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 Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rdx\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L3\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$2, %eax\n\tmovl\t-16(%rbp), %edx\n\tleal\t-1(%rdx), %ecx\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tcmpl\t%ebx, %eax\n\tjg\t.L3\n.L2:\n\tmovl\t4(%rsp), %ecx\n\tsubl\t$2, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcltd\n\tsubl\t$1, %ecx\n\tidivl\t%ecx\n\tleal\t1(%rax), %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tcmpl\t%ebx, %eax\n\tjg\t.L3\n.L2:\n\tmovl\t4(%rsp), %ecx\n\tsubl\t$2, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcltd\n\tsubl\t$1, %ecx\n\tidivl\t%ecx\n\tleal\t1(%rax), %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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}", "index": 3, "inputs": [ "4 3\n2 3 1 4\n" ], "outputs": [ "2\n" ], "question": "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 Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rdx\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L3\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$2, %eax\n\tmovl\t-16(%rbp), %edx\n\tleal\t-1(%rdx), %ecx\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 .section .rodata .LC0: .string "%d %d" .LC1: .string "%*d" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -16(%rbp), %rdx leaq -20(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -12(%rbp) jmp .L2 .L3: leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -12(%rbp) .L2: movl -20(%rbp), %eax cmpl %eax, -12(%rbp) jl .L3 movl -20(%rbp), %eax subl $2, %eax movl -16(%rbp), %edx leal -1(%rdx), %ecx cltd idivl %ecx addl $1, %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other text.
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\t.bss\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.globl\ty\n\t.align 4\n\t.type\ty, @object\n\t.size\ty, 4\ny:\n\t.zero\t4\n\t.globl\tz\n\t.align 4\n\t.type\tz, @object\n\t.size\tz, 4\nz:\n\t.zero\t4\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tjmp\t.L2\n.L8:\n\tmovl\ti(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, i(%rip)\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tmovl\t-4(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L4\n\tmovl\tz(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, z(%rip)\n\tjmp\t.L2\n.L4:\n\tmovl\t-4(%rbp), %eax\n\tandl\t$3, %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tmovl\ty(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, y(%rip)\n\tjmp\t.L2\n.L6:\n\tmovl\tz(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, z(%rip)\n.L2:\n\tleaq\t-4(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tcmpl\t$-1, %eax\n\tjne\t.L8\n\tmovl\ty(%rip), %eax\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n\tmovl\t%eax, %edx\n\tmovl\tz(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L10\n.L9:\n\tleaq\t.LC2(%rip), %rax\n.L10:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tleaq\t.LC2(%rip), %rbx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovl\t%edi, 12(%rsp)\n\tleaq\t12(%rsp), %rbp\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\ti(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, i(%rip)\n\ttestl\t%eax, %eax\n\tjne\t.L14\n.L3:\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovq\t%rbx, %rdi\n\tcall\tscanf@PLT\n\tcmpl\t$-1, %eax\n\tjne\t.L7\n\tcmpl\t$1, y(%rip)\n\tleaq\t.LC0(%rip), %rdi\n\tsbbl\t%eax, %eax\n\tcmpl\tz(%rip), %eax\n\tleaq\t.LC1(%rip), %rax\n\tcmovle\t%rax, %rdi\n\tcall\tputs@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\t.cfi_restore_state\n\tmovl\t12(%rsp), %eax\n\ttestb\t$1, %al\n\tjne\t.L15\n\ttestb\t$3, %al\n\tje\t.L6\n\taddl\t$1, y(%rip)\n\tjmp\t.L3\n.L15:\n\tsubl\t$1, z(%rip)\n\tjmp\t.L3\n.L6:\n\taddl\t$1, z(%rip)\n\tjmp\t.L3\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\tz\n\t.bss\n\t.align 4\n\t.type\tz, @object\n\t.size\tz, 4\nz:\n\t.zero\t4\n\t.globl\ty\n\t.align 4\n\t.type\ty, @object\n\t.size\ty, 4\ny:\n\t.zero\t4\n\t.globl\ti\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tleaq\t.LC2(%rip), %rbx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovl\t%edi, 12(%rsp)\n\tleaq\t12(%rsp), %rbp\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\ti(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, i(%rip)\n\ttestl\t%eax, %eax\n\tjne\t.L14\n.L3:\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovq\t%rbx, %rdi\n\tcall\tscanf@PLT\n\tcmpl\t$-1, %eax\n\tjne\t.L7\n\tcmpl\t$1, y(%rip)\n\tleaq\t.LC0(%rip), %rdi\n\tsbbl\t%eax, %eax\n\tcmpl\tz(%rip), %eax\n\tleaq\t.LC1(%rip), %rax\n\tcmovle\t%rax, %rdi\n\tcall\tputs@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\t.cfi_restore_state\n\tmovl\t12(%rsp), %eax\n\ttestb\t$1, %al\n\tjne\t.L15\n\ttestb\t$3, %al\n\tje\t.L6\n\taddl\t$1, y(%rip)\n\tjmp\t.L3\n.L15:\n\tsubl\t$1, z(%rip)\n\tjmp\t.L3\n.L6:\n\taddl\t$1, z(%rip)\n\tjmp\t.L3\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\tz\n\t.bss\n\t.align 4\n\t.type\tz, @object\n\t.size\tz, 4\nz:\n\t.zero\t4\n\t.globl\ty\n\t.align 4\n\t.type\ty, @object\n\t.size\ty, 4\ny:\n\t.zero\t4\n\t.globl\ti\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "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\");}", "index": 17, "inputs": [ "3\n1 10 100\n" ], "outputs": [ "Yes\n" ], "question": "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\t.bss\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.globl\ty\n\t.align 4\n\t.type\ty, @object\n\t.size\ty, 4\ny:\n\t.zero\t4\n\t.globl\tz\n\t.align 4\n\t.type\tz, @object\n\t.size\tz, 4\nz:\n\t.zero\t4\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tjmp\t.L2\n.L8:\n\tmovl\ti(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, i(%rip)\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tmovl\t-4(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L4\n\tmovl\tz(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, z(%rip)\n\tjmp\t.L2\n.L4:\n\tmovl\t-4(%rbp), %eax\n\tandl\t$3, %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tmovl\ty(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, y(%rip)\n\tjmp\t.L2\n.L6:\n\tmovl\tz(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, z(%rip)\n.L2:\n\tleaq\t-4(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tcmpl\t$-1, %eax\n\tjne\t.L8\n\tmovl\ty(%rip), %eax\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n\tmovl\t%eax, %edx\n\tmovl\tz(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L10\n.L9:\n\tleaq\t.LC2(%rip), %rax\n.L10:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 i: .zero 4 .globl y .align 4 .type y, @object .size y, 4 y: .zero 4 .globl z .align 4 .type z, @object .size z, 4 z: .zero 4 .section .rodata .LC0: .string "%d" .LC1: .string "No" .LC2: .string "Yes" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) jmp .L2 .L8: movl i(%rip), %eax leal 1(%rax), %edx movl %edx, i(%rip) testl %eax, %eax je .L2 movl -4(%rbp), %eax andl $1, %eax testl %eax, %eax je .L4 movl z(%rip), %eax subl $1, %eax movl %eax, z(%rip) jmp .L2 .L4: movl -4(%rbp), %eax andl $3, %eax testl %eax, %eax je .L6 movl y(%rip), %eax addl $1, %eax movl %eax, y(%rip) jmp .L2 .L6: movl z(%rip), %eax addl $1, %eax movl %eax, z(%rip) .L2: leaq -4(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call scanf@PLT cmpl $-1, %eax jne .L8 movl y(%rip), %eax testl %eax, %eax sete %al movzbl %al, %eax negl %eax movl %eax, %edx movl z(%rip), %eax cmpl %eax, %edx jle .L9 leaq .LC1(%rip), %rax jmp .L10 .L9: leaq .LC2(%rip), %rax .L10: movq %rax, %rdi call puts@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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\twhile (b > 0) {\n\t\tif (b & 1) r = add(r, a);\n\t\ta = add(a, a);\n\t\tb >>= 1;\n\t}\n\treturn r;\n}\n\nint pou(int a, int b) {\n\tint r = 1;\n\twhile (b > 0) {\n\t\tif (b & 1) r = mul(r, a);\n\t\ta = mul(a, a);\n\t\tb >>= 1;\n\t}\n\treturn r;\n}\n\nint N;\nint D[114514];\n\nint kaunto[114514];\n\nint main(void) {\n\tint i;\n\tint makkusu = 0;\n\tint kotae = 1;\n\n\tif (scanf(\"%d\", &N) != 1) return 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif (scanf(\"%d\", &D[i]) != 1) return 1;\n\t}\n\tif (D[0] != 0) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 0; i < N; i++) {\n\t\tkaunto[D[i]]++;\n\t\tif (D[i] > makkusu) makkusu = D[i];\n\t}\n\tif (kaunto[0] != 1) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 1; i <= makkusu; i++) {\n\t\tif (kaunto[i] <= 0) {\n\t\t\tputs(\"0\");\n\t\t\treturn 0;\n\t\t}\n\t\tkotae = mul(kotae, pou(kaunto[i - 1], kaunto[i]));\n\t}\n\n\tprintf(\"%d\\n\", kotae);\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t-4(%rbp), %ecx\n\tmovl\t-8(%rbp), %edx\n\taddl\t%ecx, %edx\n\tcmpl\t$998244352, %edx\n\tjle\t.L2\n\tmovl\t$998244353, %edx\n\tjmp\t.L3\n.L2:\n\tmovl\t$0, %edx\n.L3:\n\tsubl\t%edx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tadd, .-add\n\t.globl\tmul\n\t.type\tmul, @function\nmul:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-24(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L7\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tmovl\t%eax, -4(%rbp)\n.L7:\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tmovl\t%eax, -20(%rbp)\n\tsarl\t-24(%rbp)\n.L6:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L8\n\tmovl\t-4(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmul, .-mul\n\t.globl\tpou\n\t.type\tpou, @function\npou:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tjmp\t.L11\n.L13:\n\tmovl\t-24(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmul\n\tmovl\t%eax, -4(%rbp)\n.L12:\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmul\n\tmovl\t%eax, -20(%rbp)\n\tsarl\t-24(%rbp)\n.L11:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L13\n\tmovl\t-4(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tpou, .-pou\n\t.globl\tN\n\t.bss\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\tD\n\t.align 32\n\t.type\tD, @object\n\t.size\tD, 458056\nD:\n\t.zero\t458056\n\t.globl\tkaunto\n\t.align 32\n\t.type\tkaunto, @object\n\t.size\tkaunto, 458056\nkaunto:\n\t.zero\t458056\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB3:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tleaq\tN(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L16\n\tmovl\t$1, %eax\n\tjmp\t.L17\n.L16:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L18\n.L20:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L19\n\tmovl\t$1, %eax\n\tjmp\t.L17\n.L19:\n\taddl\t$1, -12(%rbp)\n.L18:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L20\n\tmovl\tD(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L21\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L21:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L22\n.L24:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tkaunto(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tleal\t1(%rdx), %ecx\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjge\t.L23\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n.L23:\n\taddl\t$1, -12(%rbp)\n.L22:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L24\n\tmovl\tkaunto(%rip), %eax\n\tcmpl\t$1, %eax\n\tje\t.L25\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L25:\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L26\n.L28:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L27\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L27:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tpou\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmul\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -12(%rbp)\n.L26:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L28\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L17:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE3:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\t.globl\tmul\n\t.type\tmul, @function\nmul:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestl\t%esi, %esi\n\tjle\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\ttestb\t$1, %sil\n\tje\t.L6\n\taddl\t%edi, %eax\n\tleal\t-998244353(%rax), %edx\n\tcmpl\t$998244352, %eax\n\tcmovg\t%edx, %eax\n.L6:\n\taddl\t%edi, %edi\n\tcmpl\t$998244352, %edi\n\tleal\t-998244353(%rdi), %edx\n\tcmovg\t%edx, %edi\n\tsarl\t%esi\n\tjne\t.L9\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tmul, .-mul\n\t.p2align 4\n\t.globl\tpou\n\t.type\tpou, @function\npou:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$1, %r8d\n\ttestl\t%esi, %esi\n\tjle\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\ttestb\t$1, %sil\n\tjne\t.L41\n\ttestl\t%edi, %edi\n\tjle\t.L31\n.L23:\n\tmovl\t%edi, %eax\n\tmovl\t%edi, %edx\n\txorl\t%edi, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\ttestb\t$1, %dl\n\tje\t.L24\n\taddl\t%eax, %edi\n\tleal\t-998244353(%rdi), %ecx\n\tcmpl\t$998244352, %edi\n\tcmovg\t%ecx, %edi\n.L24:\n\taddl\t%eax, %eax\n\tcmpl\t$998244352, %eax\n\tleal\t-998244353(%rax), %ecx\n\tcmovg\t%ecx, %eax\n\tsarl\t%edx\n\tjne\t.L27\n\tsarl\t%esi\n\tjne\t.L28\n.L15:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\ttestl\t%edi, %edi\n\tjle\t.L30\n\tmovl\t%r8d, %eax\n\tmovl\t%edi, %edx\n\txorl\t%r8d, %r8d\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\ttestb\t$1, %dl\n\tje\t.L19\n\taddl\t%eax, %r8d\n\tleal\t-998244353(%r8), %ecx\n\tcmpl\t$998244352, %r8d\n\tcmovg\t%ecx, %r8d\n.L19:\n\taddl\t%eax, %eax\n\tcmpl\t$998244352, %eax\n\tleal\t-998244353(%rax), %ecx\n\tcmovg\t%ecx, %eax\n\tsarl\t%edx\n\tjne\t.L22\n\tjmp\t.L23\n.L31:\n\txorl\t%edi, %edi\n\tsarl\t%esi\n\tjne\t.L28\n\tjmp\t.L15\n.L30:\n\txorl\t%r8d, %r8d\n\txorl\t%edi, %edi\n\tsarl\t%esi\n\tjne\t.L28\n\tjmp\t.L15\n\t.cfi_endproc\n.LFE25:\n\t.size\tpou, .-pou\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\"%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.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\t.LC0(%rip), %r12\n\txorl\t%eax, %eax\n\tleaq\tN(%rip), %rsi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovq\t%r12, %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L46\n\tcmpl\t$0, N(%rip)\n\tjle\t.L45\n\tleaq\tD(%rip), %rbx\n\txorl\t%ebp, %ebp\n\tjmp\t.L47\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tmovl\tN(%rip), %eax\n\taddl\t$1, %ebp\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %eax\n\tjle\t.L72\n.L47:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rsi\n\tmovq\t%r12, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L73\n.L46:\n\tmovl\t$1, %eax\n.L42:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L72:\n\t.cfi_restore_state\n\tcmpl\t$0, D(%rip)\n\tjne\t.L48\n\ttestl\t%eax, %eax\n\tjle\t.L50\n\tleaq\tD(%rip), %rdx\n\tleal\t-1(%rax), %ecx\n\txorl\t%r10d, %r10d\n\tleaq\t4(%rdx), %rax\n\tleaq\tkaunto(%rip), %rbx\n\tleaq\t(%rax,%rcx,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovslq\t(%rdx), %rcx\n\taddl\t$1, (%rbx,%rcx,4)\n\tcmpl\t%ecx, %r10d\n\tcmovl\t%ecx, %r10d\n\taddq\t$4, %rdx\n\tcmpq\t%rdx, %rsi\n\tjne\t.L51\n\tmovl\t(%rbx), %r9d\n\tcmpl\t$1, %r9d\n\tjne\t.L48\n\tmovl\t$1, %r11d\n\tleaq\t-4+kaunto(%rip), %rbp\n\ttestl\t%r10d, %r10d\n\tje\t.L60\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovl\t(%rbx,%r11,4), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L48\n\tmovl\t0(%rbp,%r11,4), %edi\n\tcall\tpou\n\ttestl\t%eax, %eax\n\tjle\t.L62\n\tmovl\t%r9d, %edx\n\txorl\t%r9d, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L59:\n\ttestb\t$1, %al\n\tje\t.L56\n\taddl\t%edx, %r9d\n\tleal\t-998244353(%r9), %ecx\n\tcmpl\t$998244352, %r9d\n\tcmovg\t%ecx, %r9d\n.L56:\n\taddl\t%edx, %edx\n\tcmpl\t$998244352, %edx\n\tleal\t-998244353(%rdx), %ecx\n\tcmovg\t%ecx, %edx\n\tsarl\t%eax\n\tjne\t.L59\n.L55:\n\taddq\t$1, %r11\n\tcmpl\t%r11d, %r10d\n\tjge\t.L53\n.L54:\n\tmovl\t%r9d, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\txorl\t%eax, %eax\n\tjmp\t.L42\n.L48:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\txorl\t%eax, %eax\n\tjmp\t.L42\n.L62:\n\txorl\t%r9d, %r9d\n\tjmp\t.L55\n.L45:\n\tcmpl\t$0, D(%rip)\n\tjne\t.L48\n.L50:\n\tcmpl\t$1, kaunto(%rip)\n\tjne\t.L48\n.L60:\n\tmovl\t$1, %r9d\n\tjmp\t.L54\n\t.cfi_endproc\n.LFE26:\n\t.size\tmain, .-main\n\t.globl\tkaunto\n\t.bss\n\t.align 32\n\t.type\tkaunto, @object\n\t.size\tkaunto, 458056\nkaunto:\n\t.zero\t458056\n\t.globl\tD\n\t.align 32\n\t.type\tD, @object\n\t.size\tD, 458056\nD:\n\t.zero\t458056\n\t.globl\tN\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.globl\tmul\n\t.type\tmul, @function\nmul:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestl\t%esi, %esi\n\tjle\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\ttestb\t$1, %sil\n\tje\t.L6\n\taddl\t%edi, %eax\n\tleal\t-998244353(%rax), %edx\n\tcmpl\t$998244352, %eax\n\tcmovg\t%edx, %eax\n.L6:\n\taddl\t%edi, %edi\n\tcmpl\t$998244352, %edi\n\tleal\t-998244353(%rdi), %edx\n\tcmovg\t%edx, %edi\n\tsarl\t%esi\n\tjne\t.L9\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tmul, .-mul\n\t.p2align 4\n\t.globl\tpou\n\t.type\tpou, @function\npou:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$1, %r8d\n\ttestl\t%esi, %esi\n\tjle\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\ttestb\t$1, %sil\n\tjne\t.L41\n\ttestl\t%edi, %edi\n\tjle\t.L31\n.L23:\n\tmovl\t%edi, %eax\n\tmovl\t%edi, %edx\n\txorl\t%edi, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\ttestb\t$1, %dl\n\tje\t.L24\n\taddl\t%eax, %edi\n\tleal\t-998244353(%rdi), %ecx\n\tcmpl\t$998244352, %edi\n\tcmovg\t%ecx, %edi\n.L24:\n\taddl\t%eax, %eax\n\tcmpl\t$998244352, %eax\n\tleal\t-998244353(%rax), %ecx\n\tcmovg\t%ecx, %eax\n\tsarl\t%edx\n\tjne\t.L27\n\tsarl\t%esi\n\tjne\t.L28\n.L15:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\ttestl\t%edi, %edi\n\tjle\t.L30\n\tmovl\t%r8d, %eax\n\tmovl\t%edi, %edx\n\txorl\t%r8d, %r8d\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\ttestb\t$1, %dl\n\tje\t.L19\n\taddl\t%eax, %r8d\n\tleal\t-998244353(%r8), %ecx\n\tcmpl\t$998244352, %r8d\n\tcmovg\t%ecx, %r8d\n.L19:\n\taddl\t%eax, %eax\n\tcmpl\t$998244352, %eax\n\tleal\t-998244353(%rax), %ecx\n\tcmovg\t%ecx, %eax\n\tsarl\t%edx\n\tjne\t.L22\n\tjmp\t.L23\n.L31:\n\txorl\t%edi, %edi\n\tsarl\t%esi\n\tjne\t.L28\n\tjmp\t.L15\n.L30:\n\txorl\t%r8d, %r8d\n\txorl\t%edi, %edi\n\tsarl\t%esi\n\tjne\t.L28\n\tjmp\t.L15\n\t.cfi_endproc\n.LFE25:\n\t.size\tpou, .-pou\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\"%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.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\t.LC0(%rip), %r12\n\txorl\t%eax, %eax\n\tleaq\tN(%rip), %rsi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovq\t%r12, %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L46\n\tcmpl\t$0, N(%rip)\n\tjle\t.L45\n\tleaq\tD(%rip), %rbx\n\txorl\t%ebp, %ebp\n\tjmp\t.L47\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tmovl\tN(%rip), %eax\n\taddl\t$1, %ebp\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %eax\n\tjle\t.L72\n.L47:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rsi\n\tmovq\t%r12, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L73\n.L46:\n\tmovl\t$1, %eax\n.L42:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L72:\n\t.cfi_restore_state\n\tcmpl\t$0, D(%rip)\n\tjne\t.L48\n\ttestl\t%eax, %eax\n\tjle\t.L50\n\tleaq\tD(%rip), %rdx\n\tleal\t-1(%rax), %ecx\n\txorl\t%r10d, %r10d\n\tleaq\t4(%rdx), %rax\n\tleaq\tkaunto(%rip), %rbx\n\tleaq\t(%rax,%rcx,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovslq\t(%rdx), %rcx\n\taddl\t$1, (%rbx,%rcx,4)\n\tcmpl\t%ecx, %r10d\n\tcmovl\t%ecx, %r10d\n\taddq\t$4, %rdx\n\tcmpq\t%rdx, %rsi\n\tjne\t.L51\n\tmovl\t(%rbx), %r9d\n\tcmpl\t$1, %r9d\n\tjne\t.L48\n\tmovl\t$1, %r11d\n\tleaq\t-4+kaunto(%rip), %rbp\n\ttestl\t%r10d, %r10d\n\tje\t.L60\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovl\t(%rbx,%r11,4), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L48\n\tmovl\t0(%rbp,%r11,4), %edi\n\tcall\tpou\n\ttestl\t%eax, %eax\n\tjle\t.L62\n\tmovl\t%r9d, %edx\n\txorl\t%r9d, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L59:\n\ttestb\t$1, %al\n\tje\t.L56\n\taddl\t%edx, %r9d\n\tleal\t-998244353(%r9), %ecx\n\tcmpl\t$998244352, %r9d\n\tcmovg\t%ecx, %r9d\n.L56:\n\taddl\t%edx, %edx\n\tcmpl\t$998244352, %edx\n\tleal\t-998244353(%rdx), %ecx\n\tcmovg\t%ecx, %edx\n\tsarl\t%eax\n\tjne\t.L59\n.L55:\n\taddq\t$1, %r11\n\tcmpl\t%r11d, %r10d\n\tjge\t.L53\n.L54:\n\tmovl\t%r9d, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\txorl\t%eax, %eax\n\tjmp\t.L42\n.L48:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\txorl\t%eax, %eax\n\tjmp\t.L42\n.L62:\n\txorl\t%r9d, %r9d\n\tjmp\t.L55\n.L45:\n\tcmpl\t$0, D(%rip)\n\tjne\t.L48\n.L50:\n\tcmpl\t$1, kaunto(%rip)\n\tjne\t.L48\n.L60:\n\tmovl\t$1, %r9d\n\tjmp\t.L54\n\t.cfi_endproc\n.LFE26:\n\t.size\tmain, .-main\n\t.globl\tkaunto\n\t.bss\n\t.align 32\n\t.type\tkaunto, @object\n\t.size\tkaunto, 458056\nkaunto:\n\t.zero\t458056\n\t.globl\tD\n\t.align 32\n\t.type\tD, @object\n\t.size\tD, 458056\nD:\n\t.zero\t458056\n\t.globl\tN\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\twhile (b > 0) {\n\t\tif (b & 1) r = add(r, a);\n\t\ta = add(a, a);\n\t\tb >>= 1;\n\t}\n\treturn r;\n}\n\nint pou(int a, int b) {\n\tint r = 1;\n\twhile (b > 0) {\n\t\tif (b & 1) r = mul(r, a);\n\t\ta = mul(a, a);\n\t\tb >>= 1;\n\t}\n\treturn r;\n}\n\nint N;\nint D[114514];\n\nint kaunto[114514];\n\nint main(void) {\n\tint i;\n\tint makkusu = 0;\n\tint kotae = 1;\n\n\tif (scanf(\"%d\", &N) != 1) return 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif (scanf(\"%d\", &D[i]) != 1) return 1;\n\t}\n\tif (D[0] != 0) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 0; i < N; i++) {\n\t\tkaunto[D[i]]++;\n\t\tif (D[i] > makkusu) makkusu = D[i];\n\t}\n\tif (kaunto[0] != 1) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 1; i <= makkusu; i++) {\n\t\tif (kaunto[i] <= 0) {\n\t\t\tputs(\"0\");\n\t\t\treturn 0;\n\t\t}\n\t\tkotae = mul(kotae, pou(kaunto[i - 1], kaunto[i]));\n\t}\n\n\tprintf(\"%d\\n\", kotae);\n\treturn 0;\n}\n", "index": 15, "inputs": [ "4\n0 1 1 2\n" ], "outputs": [ "2\n" ], "question": "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\twhile (b > 0) {\n\t\tif (b & 1) r = add(r, a);\n\t\ta = add(a, a);\n\t\tb >>= 1;\n\t}\n\treturn r;\n}\n\nint pou(int a, int b) {\n\tint r = 1;\n\twhile (b > 0) {\n\t\tif (b & 1) r = mul(r, a);\n\t\ta = mul(a, a);\n\t\tb >>= 1;\n\t}\n\treturn r;\n}\n\nint N;\nint D[114514];\n\nint kaunto[114514];\n\nint main(void) {\n\tint i;\n\tint makkusu = 0;\n\tint kotae = 1;\n\n\tif (scanf(\"%d\", &N) != 1) return 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif (scanf(\"%d\", &D[i]) != 1) return 1;\n\t}\n\tif (D[0] != 0) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 0; i < N; i++) {\n\t\tkaunto[D[i]]++;\n\t\tif (D[i] > makkusu) makkusu = D[i];\n\t}\n\tif (kaunto[0] != 1) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tfor (i = 1; i <= makkusu; i++) {\n\t\tif (kaunto[i] <= 0) {\n\t\t\tputs(\"0\");\n\t\t\treturn 0;\n\t\t}\n\t\tkotae = mul(kotae, pou(kaunto[i - 1], kaunto[i]));\n\t}\n\n\tprintf(\"%d\\n\", kotae);\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t-4(%rbp), %ecx\n\tmovl\t-8(%rbp), %edx\n\taddl\t%ecx, %edx\n\tcmpl\t$998244352, %edx\n\tjle\t.L2\n\tmovl\t$998244353, %edx\n\tjmp\t.L3\n.L2:\n\tmovl\t$0, %edx\n.L3:\n\tsubl\t%edx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tadd, .-add\n\t.globl\tmul\n\t.type\tmul, @function\nmul:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-24(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L7\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tmovl\t%eax, -4(%rbp)\n.L7:\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tmovl\t%eax, -20(%rbp)\n\tsarl\t-24(%rbp)\n.L6:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L8\n\tmovl\t-4(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmul, .-mul\n\t.globl\tpou\n\t.type\tpou, @function\npou:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tjmp\t.L11\n.L13:\n\tmovl\t-24(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmul\n\tmovl\t%eax, -4(%rbp)\n.L12:\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmul\n\tmovl\t%eax, -20(%rbp)\n\tsarl\t-24(%rbp)\n.L11:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L13\n\tmovl\t-4(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tpou, .-pou\n\t.globl\tN\n\t.bss\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\tD\n\t.align 32\n\t.type\tD, @object\n\t.size\tD, 458056\nD:\n\t.zero\t458056\n\t.globl\tkaunto\n\t.align 32\n\t.type\tkaunto, @object\n\t.size\tkaunto, 458056\nkaunto:\n\t.zero\t458056\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB3:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tleaq\tN(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L16\n\tmovl\t$1, %eax\n\tjmp\t.L17\n.L16:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L18\n.L20:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L19\n\tmovl\t$1, %eax\n\tjmp\t.L17\n.L19:\n\taddl\t$1, -12(%rbp)\n.L18:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L20\n\tmovl\tD(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L21\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L21:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L22\n.L24:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tkaunto(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tleal\t1(%rdx), %ecx\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjge\t.L23\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tD(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n.L23:\n\taddl\t$1, -12(%rbp)\n.L22:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L24\n\tmovl\tkaunto(%rip), %eax\n\tcmpl\t$1, %eax\n\tje\t.L25\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L25:\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L26\n.L28:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L27\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L27:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tkaunto(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tpou\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmul\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -12(%rbp)\n.L26:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L28\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L17:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE3:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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); a = add(a, a); b >>= 1; } return r; } int pou(int a, int b) { int r = 1; while (b > 0) { if (b & 1) r = mul(r, a); a = mul(a, a); b >>= 1; } return r; } int N; int D[114514]; int kaunto[114514]; int main(void) { int i; int makkusu = 0; int kotae = 1; if (scanf("%d", &N) != 1) return 1; for (i = 0; i < N; i++) { if (scanf("%d", &D[i]) != 1) return 1; } if (D[0] != 0) { puts("0"); return 0; } for (i = 0; i < N; i++) { kaunto[D[i]]++; if (D[i] > makkusu) makkusu = D[i]; } if (kaunto[0] != 1) { puts("0"); return 0; } for (i = 1; i <= makkusu; i++) { if (kaunto[i] <= 0) { puts("0"); return 0; } kotae = mul(kotae, pou(kaunto[i - 1], kaunto[i])); } printf("%d\n", kotae); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl add .type add, @function add: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %edx movl -8(%rbp), %eax addl %edx, %eax movl -4(%rbp), %ecx movl -8(%rbp), %edx addl %ecx, %edx cmpl $998244352, %edx jle .L2 movl $998244353, %edx jmp .L3 .L2: movl $0, %edx .L3: subl %edx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size add, .-add .globl mul .type mul, @function mul: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $0, -4(%rbp) jmp .L6 .L8: movl -24(%rbp), %eax andl $1, %eax testl %eax, %eax je .L7 movl -20(%rbp), %edx movl -4(%rbp), %eax movl %edx, %esi movl %eax, %edi call add movl %eax, -4(%rbp) .L7: movl -20(%rbp), %edx movl -20(%rbp), %eax movl %edx, %esi movl %eax, %edi call add movl %eax, -20(%rbp) sarl -24(%rbp) .L6: cmpl $0, -24(%rbp) jg .L8 movl -4(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size mul, .-mul .globl pou .type pou, @function pou: .LFB2: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $1, -4(%rbp) jmp .L11 .L13: movl -24(%rbp), %eax andl $1, %eax testl %eax, %eax je .L12 movl -20(%rbp), %edx movl -4(%rbp), %eax movl %edx, %esi movl %eax, %edi call mul movl %eax, -4(%rbp) .L12: movl -20(%rbp), %edx movl -20(%rbp), %eax movl %edx, %esi movl %eax, %edi call mul movl %eax, -20(%rbp) sarl -24(%rbp) .L11: cmpl $0, -24(%rbp) jg .L13 movl -4(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE2: .size pou, .-pou .globl N .bss .align 4 .type N, @object .size N, 4 N: .zero 4 .globl D .align 32 .type D, @object .size D, 458056 D: .zero 458056 .globl kaunto .align 32 .type kaunto, @object .size kaunto, 458056 kaunto: .zero 458056 .section .rodata .LC0: .string "%d" .LC1: .string "0" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB3: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl $0, -8(%rbp) movl $1, -4(%rbp) leaq N(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpl $1, %eax je .L16 movl $1, %eax jmp .L17 .L16: movl $0, -12(%rbp) jmp .L18 .L20: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq D(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpl $1, %eax je .L19 movl $1, %eax jmp .L17 .L19: addl $1, -12(%rbp) .L18: movl N(%rip), %eax cmpl %eax, -12(%rbp) jl .L20 movl D(%rip), %eax testl %eax, %eax je .L21 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L17 .L21: movl $0, -12(%rbp) jmp .L22 .L24: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq D(%rip), %rax movl (%rdx,%rax), %eax movslq %eax, %rdx leaq 0(,%rdx,4), %rcx leaq kaunto(%rip), %rdx movl (%rcx,%rdx), %edx leal 1(%rdx), %ecx cltq leaq 0(,%rax,4), %rdx leaq kaunto(%rip), %rax movl %ecx, (%rdx,%rax) movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq D(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -8(%rbp) jge .L23 movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq D(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -8(%rbp) .L23: addl $1, -12(%rbp) .L22: movl N(%rip), %eax cmpl %eax, -12(%rbp) jl .L24 movl kaunto(%rip), %eax cmpl $1, %eax je .L25 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L17 .L25: movl $1, -12(%rbp) jmp .L26 .L28: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq kaunto(%rip), %rax movl (%rdx,%rax), %eax testl %eax, %eax jg .L27 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L17 .L27: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq kaunto(%rip), %rax movl (%rdx,%rax), %edx movl -12(%rbp), %eax subl $1, %eax cltq leaq 0(,%rax,4), %rcx leaq kaunto(%rip), %rax movl (%rcx,%rax), %eax movl %edx, %esi movl %eax, %edi call pou movl %eax, %edx movl -4(%rbp), %eax movl %edx, %esi movl %eax, %edi call mul movl %eax, -4(%rbp) addl $1, -12(%rbp) .L26: movl -12(%rbp), %eax cmpl -8(%rbp), %eax jle .L28 movl -4(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L17: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE3: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"1\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L2\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L2:\n\tmovl\t-12(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L3\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L7\n\ttestl\t%eax, %eax\n\tje\t.L8\n.L3:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L7\n\ttestl\t%eax, %eax\n\tje\t.L8\n.L3:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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;\n}\n", "index": 29, "inputs": [ "000\n", "000\n" ], "outputs": [ "1\n", "1\n" ], "question": "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;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"1\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L2\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L2:\n\tmovl\t-12(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L3\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "0" .LC2: .string "1" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -12(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -12(%rbp), %eax cmpl $1, %eax jne .L2 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L3 .L2: movl -12(%rbp), %eax testl %eax, %eax jne .L3 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L3: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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\");\n return 0;\n }\n }\nprintf(\"Yes\");\n \n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -40(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$104, %al\n\tjne\t.L3\n\tmovl\t-40(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$105, %al\n\tje\t.L4\n.L3:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L7\n.L4:\n\taddl\t$2, -40(%rbp)\n.L2:\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rbx\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t%rax, %rbx\n\tjb\t.L6\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L7:\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t13(%rsp), %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\ttestq\t%rax, %rax\n\tje\t.L2\n\tcmpb\t$104, 13(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 14(%rsp)\n\tjne\t.L3\n\tcmpq\t$2, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 15(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 16(%rsp)\n\tjne\t.L3\n\tcmpq\t$4, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 17(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 18(%rsp)\n\tjne\t.L3\n\tcmpq\t$6, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 19(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 20(%rsp)\n\tjne\t.L3\n\tcmpq\t$8, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 21(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 22(%rsp)\n\tjne\t.L3\n.L2:\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L4:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L11\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L3:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L4\n.L11:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t13(%rsp), %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\ttestq\t%rax, %rax\n\tje\t.L2\n\tcmpb\t$104, 13(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 14(%rsp)\n\tjne\t.L3\n\tcmpq\t$2, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 15(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 16(%rsp)\n\tjne\t.L3\n\tcmpq\t$4, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 17(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 18(%rsp)\n\tjne\t.L3\n\tcmpq\t$6, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 19(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 20(%rsp)\n\tjne\t.L3\n\tcmpq\t$8, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 21(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 22(%rsp)\n\tjne\t.L3\n.L2:\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L4:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L11\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L3:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L4\n.L11:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\");\n return 0;\n }\n }\nprintf(\"Yes\");\n \n return 0;\n}", "index": 0, "inputs": [ "ah\n", "ih\n", "hhhi\n", "hb\n", "hh\n", "hhhj\n", "bh\n", "gi\n", "jhhh\n", "gb\n", "hg\n", "hjhh\n", "fb\n", "gh\n", "gjhh\n", "bf\n", "gg\n", "hjgh\n", "af\n", "fg\n", "gjgh\n", "bg\n", "eg\n", "gkgh\n", "ga\n", "ge\n", "hgjg\n", "ag\n", "he\n", "ggjg\n", "ia\n", "eh\n", "gjgg\n", "ai\n", "dh\n", "ggkg\n", "`i\n", "hd\n", "gkgg\n", "`h\n", "id\n", "gkhg\n", "`g\n", "jd\n", "ghkg\n", "g`\n", "dj\n", "gkhf\n", "cf\n", "di\n", "gkhe\n", "ce\n", "jc\n", "hkge\n", "be\n", "cj\n", "egkh\n", "eb\n", "bj\n", "hegk\n", "bd\n", "jb\n", "hegl\n", "bc\n", "kb\n", "kgeh\n", "bb\n", "bk\n", "kgeg\n", "ba\n", "aj\n", "egkg\n", "ab\n", "bi\n", "eglg\n", "aa\n", "ib\n", "dglg\n", "a`\n", "ic\n", "dflg\n", "`a\n", "hc\n", "glfd\n", "`b\n", "kc\n", "glfe\n", "b`\n", "ck\n", "glff\n", "``\n", "cl\n", "glgf\n", "_b\n", "lc\n", "flgf\n", "b_\n", "dl\n", "flff\n", "`_\n", "ha\n", "hihi\n", "hihi\n", "hi\n" ], "outputs": [ "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "Yes", "Yes", "Yes" ], "question": "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\");\n return 0;\n }\n }\nprintf(\"Yes\");\n \n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -40(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$104, %al\n\tjne\t.L3\n\tmovl\t-40(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$105, %al\n\tje\t.L4\n.L3:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L7\n.L4:\n\taddl\t$2, -40(%rbp)\n.L2:\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rbx\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t%rax, %rbx\n\tjb\t.L6\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L7:\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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("Yes"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "No" .LC2: .string "Yes" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $40, %rsp .cfi_offset 3, -24 movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax leaq -35(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -40(%rbp) jmp .L2 .L6: movl -40(%rbp), %eax cltq movzbl -35(%rbp,%rax), %eax cmpb $104, %al jne .L3 movl -40(%rbp), %eax addl $1, %eax cltq movzbl -35(%rbp,%rax), %eax cmpb $105, %al je .L4 .L3: leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L7 .L4: addl $2, -40(%rbp) .L2: movl -40(%rbp), %eax movslq %eax, %rbx leaq -35(%rbp), %rax movq %rax, %rdi call strlen@PLT cmpq %rax, %rbx jb .L6 leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L7: movq -24(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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[27];\n\tint N;\n\tint M;\n\tint i,j,k,l,m,n;\n\tint day,count;\n\tint case_count;\n\tfor(case_count=1;scanf(\"%d\",&N)==1 && N>0;case_count++) {\n\t\tfor(i=1;i<=5;i++) {\n\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\tscanf(\"%s\",&nowstatus[i][j][1]);\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<27;i++)a[i]=b[i]=0;\n\t\tscanf(\"%d\",&M);\n\t\tfor(i=0;i<M;i++) {\n\t\t\tscanf(\"%d\",&count);\n\t\t\ta[count]=1;\n\t\t}\n\t\tscanf(\"%d\",&M);\n\t\tfor(i=0;i<M;i++) {\n\t\t\tscanf(\"%d\",&count);\n\t\t\tb[count]=1;\n\t\t}\n\n\t\tfor(day=0;day<N;day++) {\n\t\t\tfor(i=1;i<=5;i++) {\n\t\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\t\tfor(k=1;k<=5;k++) {\n\t\t\t\t\t\tcount=0;\n\t\t\t\t\t\tfor(l=-1;l<=1;l++) {\n\t\t\t\t\t\t\tfor(m=-1;m<=1;m++) {\n\t\t\t\t\t\t\t\tfor(n=-1;n<=1;n++) {\n\t\t\t\t\t\t\t\t\tif((l|m|n)==0)continue;\n\t\t\t\t\t\t\t\t\tif(nowstatus[i+l][j+m][k+n]=='1')count++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(nowstatus[i][j][k]=='1') {\n\t\t\t\t\t\t\tnextstatus[i][j][k]=(b[count]?'1':'0');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextstatus[i][j][k]=(a[count]?'1':'0');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemcpy(nowstatus,nextstatus,sizeof(nowstatus));\n\t\t}\n\n\t\tif(case_count>1)putchar('\\n');\n\t\tprintf(\"Case %d:\\n\",case_count);\n\t\tfor(i=1;i<=5;i++) {\n\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\tputs(&nowstatus[i][j][1]);\n\t\t\t}\n\t\t\tif(i<5)putchar('\\n');\n\t\t}\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$832, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-784(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$42, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tmovw\t%ax, (%rdx)\n\taddq\t$2, %rdx\n\tmovb\t%al, (%rdx)\n\taddq\t$1, %rdx\n\tleaq\t-432(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$42, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tmovw\t%ax, (%rdx)\n\taddq\t$2, %rdx\n\tmovb\t%al, (%rdx)\n\taddq\t$1, %rdx\n\tmovl\t$1, -788(%rbp)\n\tjmp\t.L2\n.L42:\n\tmovl\t$1, -816(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t$1, -812(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-784(%rbp), %rsi\n\tmovl\t-812(%rbp), %eax\n\tcltq\n\tmovq\t%rax, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rax, %rdx\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rcx, %rax\n\taddq\t%rdx, %rax\n\taddq\t$1, %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -812(%rbp)\n.L4:\n\tcmpl\t$5, -812(%rbp)\n\tjle\t.L5\n\taddl\t$1, -816(%rbp)\n.L3:\n\tcmpl\t$5, -816(%rbp)\n\tjle\t.L6\n\tmovl\t$0, -816(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-816(%rbp), %eax\n\tcltq\n\tmovb\t$0, -48(%rbp,%rax)\n\tmovl\t-816(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %edx\n\tmovl\t-816(%rbp), %eax\n\tcltq\n\tmovb\t%dl, -80(%rbp,%rax)\n\taddl\t$1, -816(%rbp)\n.L7:\n\tcmpl\t$26, -816(%rbp)\n\tjle\t.L8\n\tleaq\t-824(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -816(%rbp)\n\tjmp\t.L9\n.L10:\n\tleaq\t-820(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovb\t$1, -80(%rbp,%rax)\n\taddl\t$1, -816(%rbp)\n.L9:\n\tmovl\t-824(%rbp), %eax\n\tcmpl\t%eax, -816(%rbp)\n\tjl\t.L10\n\tleaq\t-824(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -816(%rbp)\n\tjmp\t.L11\n.L12:\n\tleaq\t-820(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovb\t$1, -48(%rbp,%rax)\n\taddl\t$1, -816(%rbp)\n.L11:\n\tmovl\t-824(%rbp), %eax\n\tcmpl\t%eax, -816(%rbp)\n\tjl\t.L12\n\tmovl\t$0, -792(%rbp)\n\tjmp\t.L13\n.L34:\n\tmovl\t$1, -816(%rbp)\n\tjmp\t.L14\n.L33:\n\tmovl\t$1, -812(%rbp)\n\tjmp\t.L15\n.L32:\n\tmovl\t$1, -808(%rbp)\n\tjmp\t.L16\n.L31:\n\tmovl\t$0, -820(%rbp)\n\tmovl\t$-1, -804(%rbp)\n\tjmp\t.L17\n.L24:\n\tmovl\t$-1, -800(%rbp)\n\tjmp\t.L18\n.L23:\n\tmovl\t$-1, -796(%rbp)\n\tjmp\t.L19\n.L22:\n\tmovl\t-804(%rbp), %eax\n\torl\t-800(%rbp), %eax\n\torl\t-796(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L45\n\tmovl\t-816(%rbp), %edx\n\tmovl\t-804(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-812(%rbp), %ecx\n\tmovl\t-800(%rbp), %eax\n\taddl\t%ecx, %eax\n\tmovl\t-808(%rbp), %esi\n\tmovl\t-796(%rbp), %ecx\n\taddl\t%esi, %ecx\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rsi, %rax\n\tsubq\t$784, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$49, %al\n\tjne\t.L21\n\tmovl\t-820(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -820(%rbp)\n\tjmp\t.L21\n.L45:\n\tnop\n.L21:\n\taddl\t$1, -796(%rbp)\n.L19:\n\tcmpl\t$1, -796(%rbp)\n\tjle\t.L22\n\taddl\t$1, -800(%rbp)\n.L18:\n\tcmpl\t$1, -800(%rbp)\n\tjle\t.L23\n\taddl\t$1, -804(%rbp)\n.L17:\n\tcmpl\t$1, -804(%rbp)\n\tjle\t.L24\n\tmovl\t-808(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-812(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rsi, %rax\n\tsubq\t$784, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$49, %al\n\tjne\t.L25\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tje\t.L26\n\tmovl\t$49, %esi\n\tjmp\t.L27\n.L26:\n\tmovl\t$48, %esi\n.L27:\n\tmovl\t-808(%rbp), %eax\n\tmovslq\t%eax, %rdi\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-812(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rdi, %rax\n\tsubq\t$432, %rax\n\tmovb\t%sil, (%rax)\n\tjmp\t.L28\n.L25:\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovzbl\t-80(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tje\t.L29\n\tmovl\t$49, %esi\n\tjmp\t.L30\n.L29:\n\tmovl\t$48, %esi\n.L30:\n\tmovl\t-808(%rbp), %eax\n\tmovslq\t%eax, %rdi\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-812(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rdi, %rax\n\tsubq\t$432, %rax\n\tmovb\t%sil, (%rax)\n.L28:\n\taddl\t$1, -808(%rbp)\n.L16:\n\tcmpl\t$5, -808(%rbp)\n\tjle\t.L31\n\taddl\t$1, -812(%rbp)\n.L15:\n\tcmpl\t$5, -812(%rbp)\n\tjle\t.L32\n\taddl\t$1, -816(%rbp)\n.L14:\n\tcmpl\t$5, -816(%rbp)\n\tjle\t.L33\n\tleaq\t-784(%rbp), %rdx\n\tleaq\t-432(%rbp), %rax\n\tmovl\t$42, %ecx\n\tmovq\t%rdx, %rdi\n\tmovq\t%rax, %rsi\n\trep movsq\n\tmovq\t%rsi, %rax\n\tmovq\t%rdi, %rdx\n\tmovl\t(%rax), %ecx\n\tmovl\t%ecx, (%rdx)\n\tleaq\t4(%rdx), %rdx\n\tleaq\t4(%rax), %rax\n\tmovzwl\t(%rax), %ecx\n\tmovw\t%cx, (%rdx)\n\tleaq\t2(%rdx), %rdx\n\tleaq\t2(%rax), %rax\n\tmovzbl\t(%rax), %ecx\n\tmovb\t%cl, (%rdx)\n\taddl\t$1, -792(%rbp)\n.L13:\n\tmovl\t-828(%rbp), %eax\n\tcmpl\t%eax, -792(%rbp)\n\tjl\t.L34\n\tcmpl\t$1, -788(%rbp)\n\tjle\t.L35\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L35:\n\tmovl\t-788(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$1, -816(%rbp)\n\tjmp\t.L36\n.L40:\n\tmovl\t$1, -812(%rbp)\n\tjmp\t.L37\n.L38:\n\tleaq\t-784(%rbp), %rsi\n\tmovl\t-812(%rbp), %eax\n\tcltq\n\tmovq\t%rax, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rax, %rdx\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rcx, %rax\n\taddq\t%rdx, %rax\n\taddq\t$1, %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\taddl\t$1, -812(%rbp)\n.L37:\n\tcmpl\t$5, -812(%rbp)\n\tjle\t.L38\n\tcmpl\t$4, -816(%rbp)\n\tjg\t.L39\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L39:\n\taddl\t$1, -816(%rbp)\n.L36:\n\tcmpl\t$5, -816(%rbp)\n\tjle\t.L40\n\taddl\t$1, -788(%rbp)\n.L2:\n\tleaq\t-828(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L41\n\tmovl\t-828(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L42\n.L41:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L44\n\tcall\t__stack_chk_fail@PLT\n.L44:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t$42, %ecx\n\txorl\t%r8d, %r8d\n\txorl\t%r9d, %r9d\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$952, %rsp\n\t.cfi_def_cfa_offset 1008\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 936(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t160(%rsp), %rdi\n\tmovl\t$1, 84(%rsp)\n\tmovq\t%rdi, 104(%rsp)\n\trep stosq\n\tmovl\t$42, %ecx\n\tmovl\t$0, (%rdi)\n\tmovw\t%r8w, 4(%rdi)\n\tmovb\t$0, 6(%rdi)\n\tleaq\t512(%rsp), %rdi\n\tmovq\t%rdi, 112(%rsp)\n\trep stosq\n\tleaq\t148(%rsp), %rax\n\tmovq\t%rax, 128(%rsp)\n\tleaq\t293(%rsp), %rax\n\tmovq\t%rax, 136(%rsp)\n\tmovl\t$0, (%rdi)\n\tmovw\t%r9w, 4(%rdi)\n\tmovb\t$0, 6(%rdi)\n.L2:\n\tmovq\t128(%rsp), %rsi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L50\n\tmovl\t148(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L50\n\tleaq\t252(%rsp), %rax\n\tleaq\t497(%rsp), %r12\n\tmovq\t%rax, 88(%rsp)\n\tmovq\t%rax, %rbp\n.L51:\n\tleaq\t-35(%rbp), %rbx\n.L3:\n\tmovq\t%rbx, %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\taddq\t$7, %rbx\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t%rbp, %rbx\n\tjne\t.L3\n\tleaq\t49(%rbx), %rbp\n\tcmpq\t%r12, %rbp\n\tjne\t.L51\n\txorl\t%esi, %esi\n\tleaq\t152(%rsp), %r12\n\tpxor\t%xmm0, %xmm0\n\txorl\t%ecx, %ecx\n\tmovw\t%si, 888(%rsp)\n\txorl\t%eax, %eax\n\txorl\t%ebp, %ebp\n\tleaq\t.LC1(%rip), %rdi\n\tmovq\t%r12, %rsi\n\tmovw\t%cx, 920(%rsp)\n\tleaq\t156(%rsp), %rbx\n\tmovq\t$0, 912(%rsp)\n\tmovb\t$0, 922(%rsp)\n\tmovq\t$0, 880(%rsp)\n\tmovb\t$0, 890(%rsp)\n\tmovaps\t%xmm0, 896(%rsp)\n\tmovaps\t%xmm0, 864(%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t152(%rsp), %edi\n\ttestl\t%edi, %edi\n\tjle\t.L8\n.L5:\n\tmovq\t%rbx, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t156(%rsp), %rax\n\tmovb\t$1, 864(%rsp,%rax)\n\tcmpl\t%ebp, 152(%rsp)\n\tjg\t.L5\n.L8:\n\tmovq\t%r12, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\txorl\t%ebp, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t152(%rsp), %edx\n\tleaq\t156(%rsp), %rbx\n\ttestl\t%edx, %edx\n\tjle\t.L7\n.L6:\n\tmovq\t%rbx, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t156(%rsp), %rax\n\tmovb\t$1, 896(%rsp,%rax)\n\tcmpl\t%ebp, 152(%rsp)\n\tjg\t.L6\n.L7:\n\tmovl\t148(%rsp), %eax\n\tleaq\t519(%rsp), %rsi\n\tmovl\t$0, 96(%rsp)\n\tmovq\t%rsi, 120(%rsp)\n\tmovl\t%eax, 100(%rsp)\n\ttestl\t%eax, %eax\n\tjle\t.L10\n.L9:\n\tmovl\t$49, %r9d\n\tmovq\t136(%rsp), %rax\n\txorl\t%r10d, %r10d\n\tmovq\t$-98, %rdi\n\tmovq\t%r9, %r8\n\tmovq\t%r10, %r9\n\tmovq\t%rax, 64(%rsp)\n.L45:\n\tmovq\t120(%rsp), %rax\n\tmovq\t%rdi, 72(%rsp)\n\tmovq\t%r8, 32(%rsp)\n\taddq\t%r8, %rax\n\tmovq\t%r9, 40(%rsp)\n\tmovq\t%rax, 48(%rsp)\n\tmovq\t64(%rsp), %rax\n\tleaq\t-35(%rax), %r11\n.L44:\n\tmovzbl\t14(%r11), %eax\n\tmovzbl\t-98(%r11), %r13d\n\tmovq\t%r11, %r15\n\tmovzbl\t-84(%r11), %ebp\n\tmovb\t%al, 24(%rsp)\n\tmovzbl\t15(%r11), %eax\n\tmovb\t%al, 7(%rsp)\n\tmovzbl\t7(%r11), %eax\n\tmovb\t%al, 15(%rsp)\n\tmovzbl\t8(%r11), %eax\n\tmovb\t%al, 8(%rsp)\n\tmovzbl\t(%r11), %eax\n\tmovb\t%al, 26(%rsp)\n\tmovzbl\t1(%r11), %eax\n\tmovb\t%al, 9(%rsp)\n\tmovzbl\t-35(%r11), %eax\n\tmovb\t%al, 27(%rsp)\n\tmovzbl\t-34(%r11), %eax\n\tmovb\t%al, 10(%rsp)\n\tmovzbl\t-42(%r11), %eax\n\tmovb\t%al, 80(%rsp)\n\tmovzbl\t-41(%r11), %eax\n\tmovb\t%al, 11(%rsp)\n\tmovzbl\t-49(%r11), %eax\n\tmovb\t%al, 25(%rsp)\n\tmovzbl\t-48(%r11), %eax\n\tmovb\t%al, 12(%rsp)\n\tmovzbl\t-83(%r11), %eax\n\tmovb\t%al, 13(%rsp)\n\tmovzbl\t-91(%r11), %eax\n\tmovb\t%al, 81(%rsp)\n\tmovzbl\t-90(%r11), %eax\n\tmovb\t%al, 14(%rsp)\n\tmovzbl\t-97(%r11), %eax\n\tmovq\t48(%rsp), %rsi\n\tmovl\t$1, 28(%rsp)\n\tmovb\t%al, 6(%rsp)\n\tleaq\t14(%r11), %rax\n\taddq\t$7, %r11\n\tmovq\t%rsi, 16(%rsp)\n\tmovq\t%r11, %r14\n\tmovq\t%r11, 56(%rsp)\n\tmovb\t%r13b, 82(%rsp)\n\tmovq\t72(%rsp), %r13\n.L41:\n\tmovq\t40(%rsp), %rbx\n\txorl\t%edx, %edx\n\tleaq\t(%r15,%r13), %rsi\n\tcmpb\t$49, 82(%rsp)\n\tsete\t%dl\n\tleaq\t(%r14,%r13), %rdi\n\tleaq\t(%rax,%r13), %r8\n\tcmpb\t$49, 6(%rsp)\n\tmovzbl\t2(%rsi,%rbx), %r12d\n\tleal\t1(%rdx), %r10d\n\tmovzbl\t2(%rdi,%rbx), %ecx\n\tcmovne\t%edx, %r10d\n\txorl\t%edx, %edx\n\taddl\t$1, 28(%rsp)\n\tcmpb\t$49, %r12b\n\tmovb\t%cl, 83(%rsp)\n\tsete\t%dl\n\taddl\t%edx, %r10d\n\txorl\t%edx, %edx\n\tcmpb\t$49, 81(%rsp)\n\tsete\t%dl\n\taddl\t%edx, %r10d\n\txorl\t%edx, %edx\n\tcmpb\t$49, 14(%rsp)\n\tsete\t%dl\n\taddl\t%edx, %r10d\n\tcmpb\t$49, %cl\n\tsete\t%cl\n\tmovzbl\t%cl, %ecx\n\taddl\t%ecx, %r10d\n\txorl\t%ecx, %ecx\n\tcmpb\t$49, %bpl\n\tsete\t%cl\n\taddl\t%ecx, %r10d\n\txorl\t%ecx, %ecx\n\tcmpb\t$49, 13(%rsp)\n\tsete\t%cl\n\txorl\t%r9d, %r9d\n\taddl\t%ecx, %r10d\n\tmovzbl\t2(%r8,%rbx), %ecx\n\tmovq\t32(%rsp), %rbx\n\tcmpb\t$49, %cl\n\tmovzbl\t2(%rsi,%rbx), %esi\n\tmovzbl\t2(%rdi,%rbx), %edi\n\tsete\t%r9b\n\tmovzbl\t2(%r8,%rbx), %r8d\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 25(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 12(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, %sil\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 80(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, %dil\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 27(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 10(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, %r8b\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 26(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 9(%rsp)\n\tsete\t%r9b\n\txorl\t%r11d, %r11d\n\taddl\t%r9d, %r10d\n\tmovzbl\t2(%r15), %r9d\n\tcmpb\t$49, %r9b\n\tsete\t%r11b\n\taddl\t%r11d, %r10d\n\txorl\t%r11d, %r11d\n\tcmpb\t$49, 15(%rsp)\n\tsete\t%r11b\n\taddl\t%r11d, %r10d\n\txorl\t%r11d, %r11d\n\tcmpb\t$49, 8(%rsp)\n\tsete\t%r11b\n\txorl\t%ebx, %ebx\n\taddl\t%r11d, %r10d\n\tmovzbl\t2(%r14), %r11d\n\tcmpb\t$49, %r11b\n\tsete\t%bl\n\taddl\t%ebx, %r10d\n\txorl\t%ebx, %ebx\n\tcmpb\t$49, 24(%rsp)\n\tsete\t%bl\n\taddl\t%ebx, %r10d\n\txorl\t%ebx, %ebx\n\tcmpb\t$49, 7(%rsp)\n\tsete\t%bl\n\txorl\t%ebp, %ebp\n\taddl\t%ebx, %r10d\n\tmovzbl\t2(%rax), %ebx\n\tcmpb\t$49, %bl\n\tsete\t%bpl\n\taddl\t%ebp, %r10d\n\tcmpb\t$49, 11(%rsp)\n\tmovslq\t%r10d, %rbp\n\tje\t.L76\n\tcmpb\t$1, 864(%rsp,%rbp)\n\tmovl\t$48, %ebp\n\tsbbb\t$-1, %bpl\n.L39:\n\tmovq\t16(%rsp), %rdx\n\taddq\t$1, %rax\n\taddq\t$1, %r14\n\taddq\t$1, %r15\n\tmovb\t%bpl, 1(%rdx)\n\taddq\t$1, %rdx\n\tcmpl\t$6, 28(%rsp)\n\tmovq\t%rdx, 16(%rsp)\n\tmovzbl\t7(%rsp), %edx\n\tmovzbl\t13(%rsp), %ebp\n\tmovb\t%dl, 24(%rsp)\n\tmovzbl\t8(%rsp), %edx\n\tmovb\t%dl, 15(%rsp)\n\tmovzbl\t9(%rsp), %edx\n\tmovb\t%dl, 26(%rsp)\n\tmovzbl\t10(%rsp), %edx\n\tmovb\t%dl, 27(%rsp)\n\tmovzbl\t11(%rsp), %edx\n\tmovb\t%dl, 80(%rsp)\n\tmovzbl\t12(%rsp), %edx\n\tmovb\t%dl, 25(%rsp)\n\tmovzbl\t14(%rsp), %edx\n\tmovb\t%dl, 81(%rsp)\n\tmovzbl\t6(%rsp), %edx\n\tmovb\t%dl, 82(%rsp)\n\tje\t.L77\n\tmovzbl\t83(%rsp), %edx\n\tmovb\t%r12b, 6(%rsp)\n\tmovb\t%cl, 13(%rsp)\n\tmovb\t%dl, 14(%rsp)\n\tmovb\t%sil, 12(%rsp)\n\tmovb\t%dil, 11(%rsp)\n\tmovb\t%r8b, 10(%rsp)\n\tmovb\t%r9b, 9(%rsp)\n\tmovb\t%r11b, 8(%rsp)\n\tmovb\t%bl, 7(%rsp)\n\tjmp\t.L41\n.L50:\n\tmovq\t936(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L78\n\taddq\t$952, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L76:\n\t.cfi_restore_state\n\tcmpb\t$1, 896(%rsp,%rbp)\n\tmovl\t$48, %ebp\n\tsbbb\t$-1, %bpl\n\tjmp\t.L39\n.L77:\n\taddq\t$7, 48(%rsp)\n\tmovq\t56(%rsp), %r11\n\tcmpq\t64(%rsp), %r11\n\tjne\t.L44\n\tmovq\t32(%rsp), %r8\n\tmovq\t72(%rsp), %rdi\n\tleaq\t49(%r11), %rax\n\tmovq\t40(%rsp), %r9\n\tmovq\t%rax, 64(%rsp)\n\taddq\t$49, %r8\n\tsubq\t$49, %rdi\n\taddq\t$49, %r9\n\tcmpq\t$294, %r8\n\tjne\t.L45\n\tmovq\t104(%rsp), %rdi\n\tmovq\t112(%rsp), %rsi\n\tmovl\t$42, %ecx\n\tmovl\t%r10d, 156(%rsp)\n\trep movsq\n\taddl\t$1, 96(%rsp)\n\tmovl\t(%rsi), %eax\n\tmovl\t%eax, (%rdi)\n\tmovzwl\t4(%rsi), %eax\n\tmovw\t%ax, 4(%rdi)\n\tmovzbl\t6(%rsi), %eax\n\tmovb\t%al, 6(%rdi)\n\tmovl\t96(%rsp), %eax\n\tcmpl\t100(%rsp), %eax\n\tjne\t.L9\n.L10:\n\tcmpl\t$1, 84(%rsp)\n\tje\t.L46\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\tcall\tputc@PLT\n.L46:\n\tmovl\t84(%rsp), %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t$49, %ebp\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t88(%rsp), %r12\n.L47:\n\tleaq\t-35(%r12), %rbx\n.L48:\n\tmovq\t%rbx, %rdi\n\taddq\t$7, %rbx\n\tcall\tputs@PLT\n\tcmpq\t%r12, %rbx\n\tjne\t.L48\n\tcmpq\t$245, %rbp\n\tje\t.L49\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\taddq\t$49, %rbp\n\taddq\t$49, %r12\n\tcall\tputc@PLT\n\tjmp\t.L47\n.L49:\n\taddl\t$1, 84(%rsp)\n\tjmp\t.L2\n.L78:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t$42, %ecx\n\txorl\t%r8d, %r8d\n\txorl\t%r9d, %r9d\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$952, %rsp\n\t.cfi_def_cfa_offset 1008\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 936(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t160(%rsp), %rdi\n\tmovl\t$1, 84(%rsp)\n\tmovq\t%rdi, 104(%rsp)\n\trep stosq\n\tmovl\t$42, %ecx\n\tmovl\t$0, (%rdi)\n\tmovw\t%r8w, 4(%rdi)\n\tmovb\t$0, 6(%rdi)\n\tleaq\t512(%rsp), %rdi\n\tmovq\t%rdi, 112(%rsp)\n\trep stosq\n\tleaq\t148(%rsp), %rax\n\tmovq\t%rax, 128(%rsp)\n\tleaq\t293(%rsp), %rax\n\tmovq\t%rax, 136(%rsp)\n\tmovl\t$0, (%rdi)\n\tmovw\t%r9w, 4(%rdi)\n\tmovb\t$0, 6(%rdi)\n.L2:\n\tmovq\t128(%rsp), %rsi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L50\n\tmovl\t148(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L50\n\tleaq\t252(%rsp), %rax\n\tleaq\t497(%rsp), %r12\n\tmovq\t%rax, 88(%rsp)\n\tmovq\t%rax, %rbp\n.L51:\n\tleaq\t-35(%rbp), %rbx\n.L3:\n\tmovq\t%rbx, %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\taddq\t$7, %rbx\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t%rbp, %rbx\n\tjne\t.L3\n\tleaq\t49(%rbx), %rbp\n\tcmpq\t%r12, %rbp\n\tjne\t.L51\n\txorl\t%esi, %esi\n\tleaq\t152(%rsp), %r12\n\tpxor\t%xmm0, %xmm0\n\txorl\t%ecx, %ecx\n\tmovw\t%si, 888(%rsp)\n\txorl\t%eax, %eax\n\txorl\t%ebp, %ebp\n\tleaq\t.LC1(%rip), %rdi\n\tmovq\t%r12, %rsi\n\tmovw\t%cx, 920(%rsp)\n\tleaq\t156(%rsp), %rbx\n\tmovq\t$0, 912(%rsp)\n\tmovb\t$0, 922(%rsp)\n\tmovq\t$0, 880(%rsp)\n\tmovb\t$0, 890(%rsp)\n\tmovaps\t%xmm0, 896(%rsp)\n\tmovaps\t%xmm0, 864(%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t152(%rsp), %edi\n\ttestl\t%edi, %edi\n\tjle\t.L8\n.L5:\n\tmovq\t%rbx, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t156(%rsp), %rax\n\tmovb\t$1, 864(%rsp,%rax)\n\tcmpl\t%ebp, 152(%rsp)\n\tjg\t.L5\n.L8:\n\tmovq\t%r12, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\txorl\t%ebp, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t152(%rsp), %edx\n\tleaq\t156(%rsp), %rbx\n\ttestl\t%edx, %edx\n\tjle\t.L7\n.L6:\n\tmovq\t%rbx, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t156(%rsp), %rax\n\tmovb\t$1, 896(%rsp,%rax)\n\tcmpl\t%ebp, 152(%rsp)\n\tjg\t.L6\n.L7:\n\tmovl\t148(%rsp), %eax\n\tleaq\t519(%rsp), %rsi\n\tmovl\t$0, 96(%rsp)\n\tmovq\t%rsi, 120(%rsp)\n\tmovl\t%eax, 100(%rsp)\n\ttestl\t%eax, %eax\n\tjle\t.L10\n.L9:\n\tmovl\t$49, %r9d\n\tmovq\t136(%rsp), %rax\n\txorl\t%r10d, %r10d\n\tmovq\t$-98, %rdi\n\tmovq\t%r9, %r8\n\tmovq\t%r10, %r9\n\tmovq\t%rax, 64(%rsp)\n.L45:\n\tmovq\t120(%rsp), %rax\n\tmovq\t%rdi, 72(%rsp)\n\tmovq\t%r8, 32(%rsp)\n\taddq\t%r8, %rax\n\tmovq\t%r9, 40(%rsp)\n\tmovq\t%rax, 48(%rsp)\n\tmovq\t64(%rsp), %rax\n\tleaq\t-35(%rax), %r11\n.L44:\n\tmovzbl\t14(%r11), %eax\n\tmovzbl\t-98(%r11), %r13d\n\tmovq\t%r11, %r15\n\tmovzbl\t-84(%r11), %ebp\n\tmovb\t%al, 24(%rsp)\n\tmovzbl\t15(%r11), %eax\n\tmovb\t%al, 7(%rsp)\n\tmovzbl\t7(%r11), %eax\n\tmovb\t%al, 15(%rsp)\n\tmovzbl\t8(%r11), %eax\n\tmovb\t%al, 8(%rsp)\n\tmovzbl\t(%r11), %eax\n\tmovb\t%al, 26(%rsp)\n\tmovzbl\t1(%r11), %eax\n\tmovb\t%al, 9(%rsp)\n\tmovzbl\t-35(%r11), %eax\n\tmovb\t%al, 27(%rsp)\n\tmovzbl\t-34(%r11), %eax\n\tmovb\t%al, 10(%rsp)\n\tmovzbl\t-42(%r11), %eax\n\tmovb\t%al, 80(%rsp)\n\tmovzbl\t-41(%r11), %eax\n\tmovb\t%al, 11(%rsp)\n\tmovzbl\t-49(%r11), %eax\n\tmovb\t%al, 25(%rsp)\n\tmovzbl\t-48(%r11), %eax\n\tmovb\t%al, 12(%rsp)\n\tmovzbl\t-83(%r11), %eax\n\tmovb\t%al, 13(%rsp)\n\tmovzbl\t-91(%r11), %eax\n\tmovb\t%al, 81(%rsp)\n\tmovzbl\t-90(%r11), %eax\n\tmovb\t%al, 14(%rsp)\n\tmovzbl\t-97(%r11), %eax\n\tmovq\t48(%rsp), %rsi\n\tmovl\t$1, 28(%rsp)\n\tmovb\t%al, 6(%rsp)\n\tleaq\t14(%r11), %rax\n\taddq\t$7, %r11\n\tmovq\t%rsi, 16(%rsp)\n\tmovq\t%r11, %r14\n\tmovq\t%r11, 56(%rsp)\n\tmovb\t%r13b, 82(%rsp)\n\tmovq\t72(%rsp), %r13\n.L41:\n\tmovq\t40(%rsp), %rbx\n\txorl\t%edx, %edx\n\tleaq\t(%r15,%r13), %rsi\n\tcmpb\t$49, 82(%rsp)\n\tsete\t%dl\n\tleaq\t(%r14,%r13), %rdi\n\tleaq\t(%rax,%r13), %r8\n\tcmpb\t$49, 6(%rsp)\n\tmovzbl\t2(%rsi,%rbx), %r12d\n\tleal\t1(%rdx), %r10d\n\tmovzbl\t2(%rdi,%rbx), %ecx\n\tcmovne\t%edx, %r10d\n\txorl\t%edx, %edx\n\taddl\t$1, 28(%rsp)\n\tcmpb\t$49, %r12b\n\tmovb\t%cl, 83(%rsp)\n\tsete\t%dl\n\taddl\t%edx, %r10d\n\txorl\t%edx, %edx\n\tcmpb\t$49, 81(%rsp)\n\tsete\t%dl\n\taddl\t%edx, %r10d\n\txorl\t%edx, %edx\n\tcmpb\t$49, 14(%rsp)\n\tsete\t%dl\n\taddl\t%edx, %r10d\n\tcmpb\t$49, %cl\n\tsete\t%cl\n\tmovzbl\t%cl, %ecx\n\taddl\t%ecx, %r10d\n\txorl\t%ecx, %ecx\n\tcmpb\t$49, %bpl\n\tsete\t%cl\n\taddl\t%ecx, %r10d\n\txorl\t%ecx, %ecx\n\tcmpb\t$49, 13(%rsp)\n\tsete\t%cl\n\txorl\t%r9d, %r9d\n\taddl\t%ecx, %r10d\n\tmovzbl\t2(%r8,%rbx), %ecx\n\tmovq\t32(%rsp), %rbx\n\tcmpb\t$49, %cl\n\tmovzbl\t2(%rsi,%rbx), %esi\n\tmovzbl\t2(%rdi,%rbx), %edi\n\tsete\t%r9b\n\tmovzbl\t2(%r8,%rbx), %r8d\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 25(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 12(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, %sil\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 80(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, %dil\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 27(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 10(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, %r8b\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 26(%rsp)\n\tsete\t%r9b\n\taddl\t%r9d, %r10d\n\txorl\t%r9d, %r9d\n\tcmpb\t$49, 9(%rsp)\n\tsete\t%r9b\n\txorl\t%r11d, %r11d\n\taddl\t%r9d, %r10d\n\tmovzbl\t2(%r15), %r9d\n\tcmpb\t$49, %r9b\n\tsete\t%r11b\n\taddl\t%r11d, %r10d\n\txorl\t%r11d, %r11d\n\tcmpb\t$49, 15(%rsp)\n\tsete\t%r11b\n\taddl\t%r11d, %r10d\n\txorl\t%r11d, %r11d\n\tcmpb\t$49, 8(%rsp)\n\tsete\t%r11b\n\txorl\t%ebx, %ebx\n\taddl\t%r11d, %r10d\n\tmovzbl\t2(%r14), %r11d\n\tcmpb\t$49, %r11b\n\tsete\t%bl\n\taddl\t%ebx, %r10d\n\txorl\t%ebx, %ebx\n\tcmpb\t$49, 24(%rsp)\n\tsete\t%bl\n\taddl\t%ebx, %r10d\n\txorl\t%ebx, %ebx\n\tcmpb\t$49, 7(%rsp)\n\tsete\t%bl\n\txorl\t%ebp, %ebp\n\taddl\t%ebx, %r10d\n\tmovzbl\t2(%rax), %ebx\n\tcmpb\t$49, %bl\n\tsete\t%bpl\n\taddl\t%ebp, %r10d\n\tcmpb\t$49, 11(%rsp)\n\tmovslq\t%r10d, %rbp\n\tje\t.L76\n\tcmpb\t$1, 864(%rsp,%rbp)\n\tmovl\t$48, %ebp\n\tsbbb\t$-1, %bpl\n.L39:\n\tmovq\t16(%rsp), %rdx\n\taddq\t$1, %rax\n\taddq\t$1, %r14\n\taddq\t$1, %r15\n\tmovb\t%bpl, 1(%rdx)\n\taddq\t$1, %rdx\n\tcmpl\t$6, 28(%rsp)\n\tmovq\t%rdx, 16(%rsp)\n\tmovzbl\t7(%rsp), %edx\n\tmovzbl\t13(%rsp), %ebp\n\tmovb\t%dl, 24(%rsp)\n\tmovzbl\t8(%rsp), %edx\n\tmovb\t%dl, 15(%rsp)\n\tmovzbl\t9(%rsp), %edx\n\tmovb\t%dl, 26(%rsp)\n\tmovzbl\t10(%rsp), %edx\n\tmovb\t%dl, 27(%rsp)\n\tmovzbl\t11(%rsp), %edx\n\tmovb\t%dl, 80(%rsp)\n\tmovzbl\t12(%rsp), %edx\n\tmovb\t%dl, 25(%rsp)\n\tmovzbl\t14(%rsp), %edx\n\tmovb\t%dl, 81(%rsp)\n\tmovzbl\t6(%rsp), %edx\n\tmovb\t%dl, 82(%rsp)\n\tje\t.L77\n\tmovzbl\t83(%rsp), %edx\n\tmovb\t%r12b, 6(%rsp)\n\tmovb\t%cl, 13(%rsp)\n\tmovb\t%dl, 14(%rsp)\n\tmovb\t%sil, 12(%rsp)\n\tmovb\t%dil, 11(%rsp)\n\tmovb\t%r8b, 10(%rsp)\n\tmovb\t%r9b, 9(%rsp)\n\tmovb\t%r11b, 8(%rsp)\n\tmovb\t%bl, 7(%rsp)\n\tjmp\t.L41\n.L50:\n\tmovq\t936(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L78\n\taddq\t$952, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L76:\n\t.cfi_restore_state\n\tcmpb\t$1, 896(%rsp,%rbp)\n\tmovl\t$48, %ebp\n\tsbbb\t$-1, %bpl\n\tjmp\t.L39\n.L77:\n\taddq\t$7, 48(%rsp)\n\tmovq\t56(%rsp), %r11\n\tcmpq\t64(%rsp), %r11\n\tjne\t.L44\n\tmovq\t32(%rsp), %r8\n\tmovq\t72(%rsp), %rdi\n\tleaq\t49(%r11), %rax\n\tmovq\t40(%rsp), %r9\n\tmovq\t%rax, 64(%rsp)\n\taddq\t$49, %r8\n\tsubq\t$49, %rdi\n\taddq\t$49, %r9\n\tcmpq\t$294, %r8\n\tjne\t.L45\n\tmovq\t104(%rsp), %rdi\n\tmovq\t112(%rsp), %rsi\n\tmovl\t$42, %ecx\n\tmovl\t%r10d, 156(%rsp)\n\trep movsq\n\taddl\t$1, 96(%rsp)\n\tmovl\t(%rsi), %eax\n\tmovl\t%eax, (%rdi)\n\tmovzwl\t4(%rsi), %eax\n\tmovw\t%ax, 4(%rdi)\n\tmovzbl\t6(%rsi), %eax\n\tmovb\t%al, 6(%rdi)\n\tmovl\t96(%rsp), %eax\n\tcmpl\t100(%rsp), %eax\n\tjne\t.L9\n.L10:\n\tcmpl\t$1, 84(%rsp)\n\tje\t.L46\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\tcall\tputc@PLT\n.L46:\n\tmovl\t84(%rsp), %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t$49, %ebp\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t88(%rsp), %r12\n.L47:\n\tleaq\t-35(%r12), %rbx\n.L48:\n\tmovq\t%rbx, %rdi\n\taddq\t$7, %rbx\n\tcall\tputs@PLT\n\tcmpq\t%r12, %rbx\n\tjne\t.L48\n\tcmpq\t$245, %rbp\n\tje\t.L49\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\taddq\t$49, %rbp\n\taddq\t$49, %r12\n\tcall\tputc@PLT\n\tjmp\t.L47\n.L49:\n\taddl\t$1, 84(%rsp)\n\tjmp\t.L2\n.L78:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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[27];\n\tint N;\n\tint M;\n\tint i,j,k,l,m,n;\n\tint day,count;\n\tint case_count;\n\tfor(case_count=1;scanf(\"%d\",&N)==1 && N>0;case_count++) {\n\t\tfor(i=1;i<=5;i++) {\n\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\tscanf(\"%s\",&nowstatus[i][j][1]);\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<27;i++)a[i]=b[i]=0;\n\t\tscanf(\"%d\",&M);\n\t\tfor(i=0;i<M;i++) {\n\t\t\tscanf(\"%d\",&count);\n\t\t\ta[count]=1;\n\t\t}\n\t\tscanf(\"%d\",&M);\n\t\tfor(i=0;i<M;i++) {\n\t\t\tscanf(\"%d\",&count);\n\t\t\tb[count]=1;\n\t\t}\n\n\t\tfor(day=0;day<N;day++) {\n\t\t\tfor(i=1;i<=5;i++) {\n\t\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\t\tfor(k=1;k<=5;k++) {\n\t\t\t\t\t\tcount=0;\n\t\t\t\t\t\tfor(l=-1;l<=1;l++) {\n\t\t\t\t\t\t\tfor(m=-1;m<=1;m++) {\n\t\t\t\t\t\t\t\tfor(n=-1;n<=1;n++) {\n\t\t\t\t\t\t\t\t\tif((l|m|n)==0)continue;\n\t\t\t\t\t\t\t\t\tif(nowstatus[i+l][j+m][k+n]=='1')count++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(nowstatus[i][j][k]=='1') {\n\t\t\t\t\t\t\tnextstatus[i][j][k]=(b[count]?'1':'0');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextstatus[i][j][k]=(a[count]?'1':'0');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemcpy(nowstatus,nextstatus,sizeof(nowstatus));\n\t\t}\n\n\t\tif(case_count>1)putchar('\\n');\n\t\tprintf(\"Case %d:\\n\",case_count);\n\t\tfor(i=1;i<=5;i++) {\n\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\tputs(&nowstatus[i][j][1]);\n\t\t\t}\n\t\t\tif(i<5)putchar('\\n');\n\t\t}\n\t}\n\treturn 0;\n}", "index": 16, "inputs": [ "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 1\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n10000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 1\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 1\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 1\n0\n", "5\n00100\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 1\n0\n", "5\n00100\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 10 1\n0\n", "5\n00100\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10001\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 10 1\n0\n", "5\n00100\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10001\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n01100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 10 1\n0\n", "5\n00100\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01110\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01110\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10001\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n01100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n11001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 0 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00001\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10001\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n01100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n11001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 0 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11111\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00110\n00000\n\n00000\n00010\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n00001\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n10000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10001\n10001\n01110\n\n11111\n00001\n11111\n10000\n10000\n\n11110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n11001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 0 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00110\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n10100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00110\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n10100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01110\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n10100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00110\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01100\n10100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00110\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n4\n01100\n10100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n00100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n4\n01100\n10100\n00100\n00100\n01100\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n00100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10001\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n4\n01100\n10100\n00100\n00100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11111\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n4\n01100\n10100\n00100\n00100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n2\n01100\n10100\n00100\n00100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01100\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n00100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11101\n00110\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 4 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00000\n01010\n01000\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 2\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11101\n00111\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n00000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11101\n00111\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01000\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n01110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10101\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00100\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n10001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00000\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 2\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01000\n11110\n\n00001\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00100\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00001\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00001\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00001\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00100\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n00000\n00100\n00000\n00000\n\n1 0\n2 6 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00000\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n00000\n00100\n00000\n00000\n\n1 0\n2 3 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n01110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n00000\n00100\n00000\n00000\n\n1 0\n2 3 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10001\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n00000\n00100\n00000\n00000\n\n1 0\n2 3 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10001\n11001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00000\n\n1 0\n2 3 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01100\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10000\n11001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n01110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00100\n\n1 0\n2 3 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00111\n00110\n01100\n11111\n\n10001\n10000\n11001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n00110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00100\n\n1 0\n2 3 4\n2\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11111\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00101\n00110\n01100\n11111\n\n10001\n10000\n11001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n00110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00100\n\n1 0\n2 3 4\n1\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n00000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11110\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10001\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00101\n00110\n01100\n11111\n\n10001\n10000\n11001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00000\n00110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00100\n\n1 0\n2 3 4\n1\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n10000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00100\n01010\n00101\n01100\n00000\n\n00000\n01010\n00000\n00010\n00100\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01000\n00000\n00110\n00000\n\n00000\n00010\n00110\n00000\n00000\n\n1 0\n2 4 4\n4\n01110\n00100\n00100\n00100\n11110\n\n01110\n10001\n10000\n10001\n01110\n\n11011\n11001\n11110\n10100\n10000\n\n01111\n10101\n10000\n11001\n01110\n\n10000\n00000\n00100\n01000\n00000\n\n2 3 4\n1 2\n100\n00101\n01010\n00110\n10011\n10001\n\n01100\n00100\n10100\n00101\n01110\n\n00100\n01000\n00000\n00000\n00000\n\n11111\n00101\n00110\n01100\n11111\n\n10001\n10000\n11001\n10001\n01110\n\n5 1 1 5 7 9\n5 0 4 0 6 8\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00100\n00110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00100\n\n1 0\n2 3 4\n1\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n00000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n10000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00000\n01010\n01001\n00100\n00001\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01000\n00000\n\n00100\n00110\n00000\n00000\n01000\n\n00101\n10000\n00100\n00000\n00100\n\n1 0\n2 3 4\n1\n01100\n10100\n00100\n01100\n01000\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n10111\n10000\n10000\n\n01110\n10001\n10100\n10001\n01111\n\n00001\n11000\n10000\n00000\n00000\n\n2 3 3\n1 2\n100\n00100\n11110\n01000\n00001\n10011\n\n01010\n00100\n00100\n00100\n01110\n\n00001\n00000\n00000\n00000\n00100\n\n11101\n00010\n01100\n01010\n11110\n\n10000\n10011\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 1 4 10 1\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n", "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01010\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n10001\n11111\n10000\n10000\n\n01110\n10001\n10000\n10001\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n2 3 4\n1 2\n100\n00100\n01010\n01110\n10001\n10001\n\n01110\n00100\n00100\n00100\n01110\n\n00000\n00000\n00000\n00000\n00000\n\n11111\n00010\n00100\n01000\n11111\n\n10001\n10001\n10001\n10001\n01110\n\n5 1 3 5 7 9\n5 0 2 4 6 8\n0\n" ], "outputs": [ "Case 1:\n00000\n00000\n01010\n01110\n10101\n\n00000\n10001\n00000\n00000\n00000\n\n00000\n00000\n11111\n10001\n00000\n\n00000\n00000\n00000\n00000\n01010\n\n00000\n00000\n01110\n00100\n11111\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00000\n00000\n01010\n01110\n10101\n\n00000\n10001\n00000\n00000\n00000\n\n00000\n00000\n11111\n10001\n00000\n\n00000\n00000\n00000\n00000\n01010\n\n00000\n00000\n01110\n00100\n11111\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n10110\n11100\n11100\n01010\n\n00111\n10001\n00111\n01100\n11000\n\n01001\n10001\n00111\n00000\n11000\n\n01001\n00111\n10101\n00000\n00010\n\n01110\n00000\n00110\n00010\n00000\n", "Case 1:\n10000\n00001\n00101\n10100\n10001\n\n10000\n00000\n00100\n10000\n10100\n\n00000\n00000\n00001\n00000\n00110\n\n11011\n00000\n10000\n10000\n00001\n\n10000\n00000\n00000\n10000\n00001\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n10110\n11100\n11100\n01010\n\n00111\n10001\n00111\n01100\n11000\n\n01001\n10001\n00111\n00000\n11000\n\n01001\n00111\n10101\n00000\n00010\n\n01110\n00000\n00110\n00010\n00000\n", "Case 1:\n00000\n00000\n01010\n01110\n10101\n\n00000\n10001\n00000\n00000\n00000\n\n00000\n00000\n11111\n10001\n00000\n\n00000\n00000\n00000\n00000\n01010\n\n00000\n00000\n01110\n00100\n11111\n\nCase 2:\n00010\n10110\n00000\n11000\n10000\n\n00001\n00000\n10101\n00010\n00100\n\n10001\n00000\n00000\n00000\n00010\n\n01110\n10001\n00000\n00001\n10000\n\n00000\n00000\n00111\n01001\n01000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00000\n00000\n01010\n01110\n10101\n\n00000\n10001\n00000\n00000\n00000\n\n00000\n00000\n11111\n10001\n00000\n\n00000\n00000\n00000\n00000\n01010\n\n00000\n00000\n01110\n00100\n11111\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00100\n00100\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00000\n10001\n10001\n00000\n10101\n\n01010\n00000\n00000\n00000\n00000\n\n00000\n00000\n10001\n00000\n00100\n\n10101\n00100\n00000\n00000\n10001\n\n00100\n00100\n00000\n11011\n00000\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n10110\n11100\n11100\n01010\n\n00111\n10001\n00111\n01100\n11000\n\n01001\n10001\n00111\n00000\n11000\n\n01001\n00111\n10101\n00000\n00010\n\n01110\n00000\n00110\n00010\n00000\n", "Case 1:\n00010\n00000\n00000\n10010\n00000\n\n00000\n00000\n00100\n00111\n10100\n\n00111\n00011\n00011\n00000\n11000\n\n10000\n00000\n00011\n00000\n00000\n\n00000\n01000\n00000\n11000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n10000\n\n00001\n00000\n10101\n00010\n00100\n\n10001\n00000\n00000\n00000\n00010\n\n01110\n10001\n00000\n00001\n10000\n\n00000\n00000\n00111\n01001\n01000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00000\n10001\n10001\n00000\n10101\n\n01010\n00000\n00000\n00000\n00000\n\n00000\n00000\n10001\n00000\n00100\n\n10101\n00100\n00000\n00000\n10001\n\n00100\n00100\n00000\n11011\n00000\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00101\n01001\n00010\n10110\n10000\n\n00110\n10001\n01010\n00010\n10100\n\n00000\n11000\n00000\n00000\n11000\n\n00000\n00000\n00011\n00100\n00000\n\n01110\n01010\n10010\n11000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n10000\n\n00001\n00000\n10101\n00010\n00100\n\n10001\n00000\n00000\n00000\n00010\n\n01110\n10001\n00000\n00001\n10000\n\n00000\n00000\n00111\n01001\n01000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n01010\n10010\n00100\n00100\n00011\n\n01101\n00001\n00001\n00001\n01101\n\n00010\n00010\n00000\n00000\n10100\n\n00000\n00000\n00000\n11000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00100\n00100\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00000\n10001\n10001\n00000\n10101\n\n01010\n00000\n00000\n00000\n00000\n\n00000\n00000\n10001\n00000\n00100\n\n10101\n00100\n00000\n00000\n10001\n\n00100\n00100\n00000\n11011\n00000\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00000\n10000\n11000\n00000\n\n00111\n00001\n00000\n00000\n10000\n\n10010\n01101\n10001\n00000\n10100\n\n10110\n10101\n10000\n00000\n10101\n\n10001\n11000\n00100\n01001\n00000\n", "Case 1:\n00001\n00100\n00000\n10100\n10000\n\n00100\n00000\n01001\n00000\n10000\n\n00001\n01101\n00000\n00111\n11100\n\n10001\n00001\n11000\n00000\n00100\n\n00111\n00010\n00000\n11000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n10000\n\n00001\n00000\n10101\n00010\n00100\n\n10001\n00000\n00000\n00000\n00010\n\n01110\n10001\n00000\n00001\n10000\n\n00000\n00000\n00111\n01001\n01000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n01010\n10010\n00100\n00100\n00011\n\n01101\n00001\n00001\n00001\n01101\n\n00010\n00010\n00000\n00000\n10100\n\n00000\n00000\n00000\n11000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00100\n00100\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n01110\n01001\n01000\n00111\n00000\n\n00100\n00011\n10110\n01010\n01101\n\n10101\n10001\n00001\n11011\n10000\n\n00100\n00001\n10001\n00001\n00100\n\n01110\n00001\n00000\n00100\n01001\n", "Case 1:\n00000\n10001\n10001\n00000\n10101\n\n01010\n00000\n00000\n00000\n00000\n\n00000\n00000\n10001\n00000\n00100\n\n10101\n00100\n00000\n00000\n10001\n\n00100\n00100\n00000\n11011\n00000\n\nCase 2:\n00000\n00000\n00000\n00100\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n01000\n01000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n01101\n00101\n00100\n00000\n10101\n\n00010\n00000\n01001\n00000\n00100\n\n00011\n11111\n10000\n00001\n11011\n\n11000\n10001\n01010\n00011\n01010\n\n11111\n11000\n00111\n01001\n00110\n", "Case 1:\n00001\n00100\n00000\n10100\n10000\n\n00100\n00000\n01001\n00000\n10000\n\n00001\n01101\n00000\n00111\n11100\n\n10001\n00001\n11000\n00000\n00100\n\n00111\n00010\n00000\n11000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00011\n00100\n00100\n\n00001\n10001\n00100\n00001\n10001\n\n01110\n01110\n00111\n01100\n01100\n\n00000\n00000\n00000\n00011\n00011\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n01010\n10010\n00100\n00100\n00011\n\n01101\n00001\n00001\n00001\n01101\n\n00010\n00010\n00000\n00000\n10100\n\n00000\n00000\n00000\n11000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00010\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00100\n00000\n00000\n00010\n\n00000\n00100\n00000\n00010\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n01110\n01001\n01000\n00111\n00000\n\n00100\n00011\n10110\n01010\n01101\n\n10101\n10001\n00001\n11011\n10000\n\n00100\n00001\n10001\n00001\n00100\n\n01110\n00001\n00000\n00100\n01001\n", "Case 1:\n00000\n10001\n10001\n00000\n10101\n\n01010\n00000\n00000\n00000\n00000\n\n00000\n00000\n10001\n00000\n00100\n\n10101\n00100\n00000\n00000\n10001\n\n00100\n00100\n00000\n11011\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n01101\n00101\n00100\n00000\n10101\n\n00010\n00000\n01001\n00000\n00100\n\n00011\n11111\n10000\n00001\n11011\n\n11000\n10001\n01010\n00011\n01010\n\n11111\n11000\n00111\n01001\n00110\n", "Case 1:\n00001\n00100\n00000\n10100\n10000\n\n00100\n00000\n01001\n00000\n10000\n\n00001\n01101\n00000\n00111\n11100\n\n10001\n00001\n11000\n00000\n00100\n\n00111\n00010\n00000\n11000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00011\n00100\n00100\n\n00001\n10001\n00100\n00001\n10001\n\n01110\n01110\n00111\n01100\n01100\n\n00000\n00000\n00000\n00011\n00011\n\nCase 3:\n10010\n10010\n00000\n10001\n10001\n\n01010\n01010\n11011\n01101\n01101\n\n10001\n01010\n00000\n01110\n10101\n\n11100\n00011\n00100\n11100\n00011\n\n00000\n01011\n11110\n00000\n11111\n", "Case 1:\n01010\n10010\n00100\n00100\n00011\n\n01101\n00001\n00001\n00001\n01101\n\n00010\n00010\n00000\n00000\n10100\n\n00000\n00000\n00000\n11000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00010\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00100\n00000\n00000\n00010\n\n00000\n00100\n00000\n00010\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n10101\n00000\n01101\n11100\n01001\n\n00000\n00000\n00001\n10000\n11100\n\n00000\n00000\n10101\n10011\n10101\n\n00000\n00000\n00000\n00001\n00001\n\n10101\n00000\n10000\n00001\n11100\n", "Case 1:\n00000\n10001\n10001\n00000\n10101\n\n01010\n00000\n00000\n00000\n00000\n\n00000\n00000\n10001\n00000\n00100\n\n10101\n00100\n00000\n00000\n10001\n\n00100\n00100\n00000\n11011\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00001\n00010\n00010\n01101\n\n10000\n00000\n10000\n00000\n10000\n\n00000\n00000\n00000\n00000\n01110\n\n10001\n00000\n00000\n10000\n10000\n\n00000\n01011\n00011\n01000\n00001\n", "Case 1:\n00001\n00100\n00000\n10100\n10000\n\n00100\n00000\n01001\n00000\n10000\n\n00001\n01101\n00000\n00111\n11100\n\n10001\n00001\n11000\n00000\n00100\n\n00111\n00010\n00000\n11000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00010\n00010\n00010\n\n00000\n10000\n00000\n10001\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00000\n00011\n00000\n00011\n00000\n\nCase 3:\n10010\n10010\n00000\n10001\n10001\n\n01010\n01010\n11011\n01101\n01101\n\n10001\n01010\n00000\n01110\n10101\n\n11100\n00011\n00100\n11100\n00011\n\n00000\n01011\n11110\n00000\n11111\n", "Case 1:\n10001\n10000\n00010\n01001\n00100\n\n00000\n10000\n00010\n01001\n00010\n\n01010\n01010\n00000\n00000\n00000\n\n11111\n11111\n00000\n11111\n11111\n\n11111\n00100\n00000\n00100\n11111\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00001\n00010\n00010\n01101\n\n10000\n00000\n10000\n00000\n10000\n\n00000\n00000\n00000\n00000\n01110\n\n10001\n00000\n00000\n10000\n10000\n\n00000\n01011\n00011\n01000\n00001\n", "Case 1:\n00001\n00001\n00000\n00000\n00000\n\n00011\n00001\n00000\n00000\n00000\n\n00000\n00000\n00100\n01000\n01000\n\n11010\n00011\n00100\n01100\n00001\n\n00000\n00001\n00100\n01100\n00001\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00010\n00010\n00010\n\n00000\n10000\n00000\n10001\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00000\n00011\n00000\n00011\n00000\n\nCase 3:\n10010\n10010\n00000\n10001\n10001\n\n01010\n01010\n11011\n01101\n01101\n\n10001\n01010\n00000\n01110\n10101\n\n11100\n00011\n00100\n11100\n00011\n\n00000\n01011\n11110\n00000\n11111\n", "Case 1:\n01010\n10010\n00100\n00100\n00011\n\n01101\n00001\n00001\n00001\n01101\n\n00010\n00010\n00000\n00000\n10100\n\n00000\n00000\n00000\n11000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00010\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00100\n00000\n00000\n00010\n\n00000\n00100\n00000\n00010\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n10101\n00100\n01101\n10010\n00011\n\n01101\n00100\n01101\n00000\n01101\n\n11000\n00000\n00111\n00101\n01101\n\n01010\n00011\n10101\n00000\n10101\n\n10010\n00011\n10101\n00010\n11011\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00001\n00010\n00010\n01101\n\n10000\n00000\n10000\n00000\n10000\n\n00000\n00000\n00000\n00000\n01110\n\n10001\n00000\n00000\n10000\n10000\n\n00000\n01011\n00011\n01000\n00001\n", "Case 1:\n00001\n00001\n00000\n00000\n00000\n\n00011\n00001\n00000\n00000\n00000\n\n00000\n00000\n00100\n01000\n01000\n\n11010\n00011\n00100\n01100\n00001\n\n00000\n00001\n00100\n01100\n00001\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00101\n00010\n00010\n\n00000\n10000\n00000\n10000\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n10010\n10010\n00000\n10001\n10001\n\n01010\n01010\n11011\n01101\n01101\n\n10001\n01010\n00000\n01110\n10101\n\n11100\n00011\n00100\n11100\n00011\n\n00000\n01011\n11110\n00000\n11111\n", "Case 1:\n10010\n10101\n00110\n00101\n00000\n\n10001\n10000\n00100\n00101\n00000\n\n11000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00010\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00100\n00000\n00000\n00010\n\n00000\n00100\n00000\n00010\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n10101\n00100\n01101\n10010\n00011\n\n01101\n00100\n01101\n00000\n01101\n\n11000\n00000\n00111\n00101\n01101\n\n01010\n00011\n10101\n00000\n10101\n\n10010\n00011\n10101\n00010\n11011\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n01100\n11111\n00001\n00100\n00111\n\n10001\n10000\n00000\n10001\n10001\n\n10010\n00000\n00001\n00001\n00000\n\n10000\n10000\n10000\n00000\n01101\n\n10001\n10101\n10001\n10100\n11011\n", "Case 1:\n00000\n00100\n00100\n01001\n00001\n\n00011\n00100\n00110\n00000\n10010\n\n00001\n00100\n00000\n00000\n11000\n\n00000\n00001\n00011\n00000\n11011\n\n00001\n00011\n00000\n00000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00101\n00010\n00010\n\n00000\n10000\n00000\n10000\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n10010\n10010\n00000\n10001\n10001\n\n01010\n01010\n11011\n01101\n01101\n\n10001\n01010\n00000\n01110\n10101\n\n11100\n00011\n00100\n11100\n00011\n\n00000\n01011\n11110\n00000\n11111\n", "Case 1:\n10010\n10101\n00110\n00101\n00000\n\n10001\n10000\n00100\n00101\n00000\n\n11000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00001\n10010\n10100\n00000\n00000\n\nCase 2:\n00000\n00000\n00010\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00100\n00000\n00000\n00010\n\n00000\n00100\n00000\n00010\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n10010\n11101\n01101\n10001\n11110\n\n11000\n10001\n10001\n00111\n00010\n\n01001\n01110\n10101\n00011\n00000\n\n01110\n00000\n11100\n10010\n11100\n\n00000\n00001\n00100\n00100\n01101\n", "Case 1:\n00000\n00000\n00010\n10100\n00010\n\n00011\n00000\n00011\n00000\n00001\n\n00100\n00100\n00000\n01101\n01000\n\n00000\n10000\n01000\n00000\n10000\n\n00000\n10001\n00001\n10001\n01000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00101\n00010\n00010\n\n00000\n10000\n00000\n10000\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n10010\n10010\n00000\n10001\n10001\n\n01010\n01010\n11011\n01101\n01101\n\n10001\n01010\n00000\n01110\n10101\n\n11100\n00011\n00100\n11100\n00011\n\n00000\n01011\n11110\n00000\n11111\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n01000\n\n00000\n00010\n00010\n00100\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00010\n10010\n11100\n11000\n01101\n\n11000\n01001\n00100\n01011\n00110\n\n01101\n00011\n10100\n00101\n00001\n\n01100\n00010\n00001\n00001\n11100\n\n10001\n01000\n00001\n10010\n11001\n", "Case 1:\n00000\n00000\n00010\n10100\n00010\n\n00011\n00000\n00011\n00000\n00001\n\n00100\n00100\n00000\n01101\n01000\n\n00000\n10000\n01000\n00000\n10000\n\n00000\n10001\n00001\n10001\n01000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00101\n00010\n00010\n\n00000\n10000\n00000\n10000\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00100\n00100\n00000\n00000\n\n00000\n00000\n00000\n01000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00010\n00010\n00010\n00000\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00010\n10010\n11100\n11000\n01101\n\n11000\n01001\n00100\n01011\n00110\n\n01101\n00011\n10100\n00101\n00001\n\n01100\n00010\n00001\n00001\n11100\n\n10001\n01000\n00001\n10010\n11001\n", "Case 1:\n00000\n01100\n10010\n00000\n00010\n\n10001\n00000\n00000\n00000\n00000\n\n00000\n00001\n00000\n00000\n00100\n\n00000\n00000\n00000\n00000\n00001\n\n00001\n00000\n00011\n10000\n00000\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00101\n00010\n00010\n\n00000\n10000\n00000\n10000\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00001\n00001\n00101\n00000\n\n00000\n00100\n00000\n01001\n00000\n\n00000\n00110\n10010\n01100\n00000\n\n00100\n11000\n00000\n10000\n01100\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n00010\n10010\n11100\n11000\n01101\n\n11000\n01001\n00100\n01011\n00110\n\n01101\n00011\n10100\n00101\n00001\n\n01100\n00010\n00001\n00001\n11100\n\n10001\n01000\n00001\n10010\n11001\n", "Case 1:\n10001\n10001\n00000\n11000\n11000\n\n00000\n10001\n00000\n11000\n00000\n\n01010\n01010\n00000\n10100\n10100\n\n00000\n11111\n11111\n00000\n01010\n\n00000\n11111\n00100\n00000\n00000\n\nCase 2:\n00000\n00001\n00001\n00101\n00000\n\n00000\n00100\n00000\n01001\n00000\n\n00000\n00110\n10010\n01100\n00000\n\n00100\n11000\n00000\n10000\n01100\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n01100\n10001\n01010\n00101\n10000\n\n01101\n11000\n01001\n10000\n00101\n\n10110\n01101\n10000\n00001\n11100\n\n00000\n01100\n00000\n00000\n00001\n\n00011\n00011\n00000\n00000\n00100\n", "Case 1:\n00000\n00001\n00000\n01000\n11011\n\n00000\n00000\n00000\n00000\n00100\n\n10001\n00000\n00000\n10000\n00110\n\n00110\n00000\n00000\n00000\n10001\n\n00001\n01000\n10101\n00000\n01101\n\nCase 2:\n00010\n10110\n00000\n11000\n00000\n\n00001\n00000\n00101\n00010\n00010\n\n00000\n10000\n00000\n10000\n00000\n\n01000\n01000\n00000\n01000\n01000\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n10001\n11011\n00000\n11000\n11000\n\n00000\n00000\n00000\n11000\n00000\n\n00000\n00000\n00001\n10101\n10110\n\n00000\n00000\n10000\n10100\n01110\n\n11101\n00000\n11000\n10000\n00110\n\nCase 2:\n00000\n00001\n00001\n00101\n00000\n\n00000\n00100\n00000\n01001\n00000\n\n00000\n00110\n10010\n01100\n00000\n\n00100\n11000\n00000\n10000\n01100\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n01100\n10001\n01010\n00101\n10000\n\n01101\n11000\n01001\n10000\n00101\n\n10110\n01101\n10000\n00001\n11100\n\n00000\n01100\n00000\n00000\n00001\n\n00011\n00011\n00000\n00000\n00100\n", "Case 1:\n00000\n00001\n00000\n01000\n11011\n\n00000\n00000\n00000\n00000\n00100\n\n10001\n00000\n00000\n10000\n00110\n\n00110\n00000\n00000\n00000\n10001\n\n00001\n01000\n10101\n00000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n10001\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n10000\n00000\n10000\n01000\n00100\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00001\n00001\n00101\n00000\n\n00000\n00100\n00000\n01001\n00000\n\n00000\n00110\n10010\n01100\n00000\n\n00100\n11000\n00000\n10000\n01100\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n01100\n10001\n01010\n00101\n10000\n\n01101\n11000\n01001\n10000\n00101\n\n10110\n01101\n10000\n00001\n11100\n\n00000\n01100\n00000\n00000\n00001\n\n00011\n00011\n00000\n00000\n00100\n", "Case 1:\n00000\n00001\n00000\n01000\n11011\n\n00000\n00000\n00000\n00000\n00100\n\n10001\n00000\n00000\n10000\n00110\n\n00110\n00000\n00000\n00000\n10001\n\n00001\n01000\n10101\n00000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n10001\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n10000\n00000\n10000\n01000\n00100\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n11000\n11011\n11111\n00001\n01010\n\n10010\n01001\n00111\n01010\n10001\n\n01100\n01101\n11100\n01101\n01100\n\n11011\n10101\n01110\n00101\n01001\n\n10001\n00111\n10110\n00100\n10010\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n01110\n00000\n\n00000\n00010\n00000\n00001\n00000\n\n00000\n01110\n10000\n00001\n00000\n\n01100\n10000\n00000\n10001\n00000\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n01100\n10001\n01010\n00101\n10000\n\n01101\n11000\n01001\n10000\n00101\n\n10110\n01101\n10000\n00001\n11100\n\n00000\n01100\n00000\n00000\n00001\n\n00011\n00011\n00000\n00000\n00100\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n10001\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n10000\n00000\n10000\n01000\n00100\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n11000\n11011\n11111\n00001\n01010\n\n10010\n01001\n00111\n01010\n10001\n\n01100\n01101\n11100\n01101\n01100\n\n11011\n10101\n01110\n00101\n01001\n\n10001\n00111\n10110\n00100\n10010\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n10001\n00000\n01000\n\n00000\n00000\n00000\n00000\n00100\n\n10000\n00000\n10000\n01000\n00100\n\n00011\n00100\n00100\n00100\n00000\n\nCase 3:\n10101\n10100\n01010\n01010\n00011\n\n00000\n00000\n00000\n10100\n00100\n\n11100\n00001\n00100\n00011\n10110\n\n01000\n10000\n01001\n00000\n11011\n\n10111\n11111\n01001\n11100\n10100\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n01110\n00000\n\n00000\n00010\n00000\n00001\n00000\n\n00000\n01110\n10000\n00001\n00000\n\n01100\n10000\n00000\n10001\n00000\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n10001\n01101\n00000\n00101\n10001\n\n10110\n01010\n00001\n00000\n10010\n\n10010\n00110\n00011\n01111\n01010\n\n10110\n01100\n01100\n00000\n11000\n\n10101\n01001\n10001\n01111\n11001\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00101\n00010\n01100\n01000\n\n00011\n10101\n01010\n10001\n10000\n\n11011\n10001\n01110\n00000\n00000\n\n00000\n01010\n00000\n10001\n00100\n\nCase 3:\n10101\n10100\n01010\n01010\n00011\n\n00000\n00000\n00000\n10100\n00100\n\n11100\n00001\n00100\n00011\n10110\n\n01000\n10000\n01001\n00000\n11011\n\n10111\n11111\n01001\n11100\n10100\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n01110\n00000\n\n00000\n00010\n00000\n00001\n00000\n\n00000\n01110\n10000\n00001\n00000\n\n01100\n10000\n00000\n10001\n00000\n\n00000\n11100\n00000\n01100\n00000\n\nCase 3:\n10111\n10010\n00000\n10111\n10011\n\n11101\n10110\n11111\n00100\n11011\n\n10011\n10101\n11000\n00011\n00100\n\n00011\n11000\n11100\n00011\n11000\n\n11100\n11000\n00011\n11100\n01000\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00010\n01100\n01000\n\n00100\n10101\n00000\n10001\n10000\n\n11010\n11011\n00000\n00000\n00000\n\n00000\n00000\n00000\n11111\n00100\n\nCase 3:\n10101\n10100\n01010\n01010\n00011\n\n00000\n00000\n00000\n10100\n00100\n\n11100\n00001\n00100\n00011\n10110\n\n01000\n10000\n01001\n00000\n11011\n\n10111\n11111\n01001\n11100\n10100\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n01000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00000\n00110\n00001\n00001\n\nCase 3:\n10111\n10010\n00000\n10111\n10011\n\n11101\n10110\n11111\n00100\n11011\n\n10011\n10101\n11000\n00011\n00100\n\n00011\n11000\n11100\n00011\n11000\n\n11100\n11000\n00011\n11100\n01000\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n00000\n00011\n01010\n01010\n\n00000\n00000\n00000\n00001\n00011\n\n01100\n11100\n00000\n00000\n00000\n\n00010\n00000\n00000\n00000\n00010\n\nCase 3:\n10101\n10100\n01010\n01010\n00011\n\n00000\n00000\n00000\n10100\n00100\n\n11100\n00001\n00100\n00011\n10110\n\n01000\n10000\n01001\n00000\n11011\n\n10111\n11111\n01001\n11100\n10100\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00000\n00110\n00001\n00001\n\nCase 3:\n10111\n10010\n00000\n10111\n10011\n\n11101\n10110\n11111\n00100\n11011\n\n10011\n10101\n11000\n00011\n00100\n\n00011\n11000\n11100\n00011\n11000\n\n11100\n11000\n00011\n11100\n01000\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n00000\n00011\n01010\n01010\n\n00000\n00000\n00000\n00001\n00011\n\n01100\n11100\n00000\n00000\n00000\n\n00010\n00000\n00000\n00000\n00010\n\nCase 3:\n00110\n00101\n00100\n01001\n11000\n\n11100\n10000\n00000\n01001\n01001\n\n10101\n00000\n10000\n11000\n01001\n\n00001\n00001\n00001\n10001\n10101\n\n00010\n10010\n00011\n10101\n00100\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00000\n00110\n00001\n00001\n\nCase 3:\n11101\n00001\n11011\n10001\n00000\n\n00011\n00011\n11111\n10010\n10000\n\n11100\n00100\n00011\n10100\n00100\n\n00000\n01110\n00000\n00110\n01001\n\n01100\n11100\n00100\n10101\n10011\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n00000\n00011\n01010\n01010\n\n00000\n00000\n00000\n00001\n00011\n\n01100\n11100\n00000\n00000\n00000\n\n00010\n00000\n00000\n00000\n00010\n\nCase 3:\n11111\n11111\n10001\n00000\n00000\n\n00011\n00000\n11001\n10110\n00100\n\n10001\n10001\n01001\n00101\n00100\n\n01100\n00010\n00010\n10000\n11110\n\n10001\n10101\n00000\n01110\n01010\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n00000\n00011\n01010\n01010\n\n00000\n00000\n00000\n00001\n00011\n\n01100\n11100\n00000\n00000\n00000\n\n00010\n00000\n00000\n00000\n00010\n\nCase 3:\n01010\n10100\n01000\n00110\n00000\n\n01111\n10001\n00001\n10001\n10101\n\n01011\n10001\n00001\n00001\n00011\n\n11100\n10001\n00000\n10000\n00100\n\n10000\n10101\n00100\n00100\n01001\n", "Case 1:\n00010\n10000\n01110\n00010\n00000\n\n00110\n00101\n01101\n00000\n00010\n\n00000\n00011\n00000\n00011\n00000\n\n00000\n00100\n10000\n00000\n01000\n\n00000\n00101\n00000\n10000\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n11101\n00001\n11011\n10001\n00000\n\n00011\n00011\n11111\n10010\n10000\n\n11100\n00100\n00011\n10100\n00100\n\n00000\n01110\n00000\n00110\n01001\n\n01100\n11100\n00100\n10101\n10011\n", "Case 1:\n00000\n00100\n10100\n10100\n00000\n\n00000\n00110\n00100\n10001\n01110\n\n00000\n00011\n00000\n00001\n00010\n\n10000\n00100\n00000\n00000\n00100\n\n00000\n00101\n00000\n01010\n00000\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n11101\n00001\n11011\n10001\n00000\n\n00011\n00011\n11111\n10010\n10000\n\n11100\n00100\n00011\n10100\n00100\n\n00000\n01110\n00000\n00110\n01001\n\n01100\n11100\n00100\n10101\n10011\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n00000\n00011\n01010\n01010\n\n00000\n00000\n00000\n00001\n00011\n\n01100\n11100\n00000\n00000\n00000\n\n00010\n00000\n00000\n00000\n00010\n\nCase 3:\n00000\n00011\n00001\n01101\n01110\n\n00000\n11000\n10010\n00000\n10000\n\n10001\n10010\n00000\n01000\n00000\n\n00100\n01100\n10000\n01001\n00000\n\n00000\n00000\n01001\n00000\n00010\n", "Case 1:\n00100\n00000\n11000\n00000\n00100\n\n00100\n00000\n10000\n00000\n00000\n\n10000\n10000\n10000\n10000\n10100\n\n11111\n11111\n00000\n00000\n00000\n\n11111\n11111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n11101\n00001\n11011\n10001\n00000\n\n00011\n00011\n11111\n10010\n10000\n\n11100\n00100\n00011\n10100\n00100\n\n00000\n01110\n00000\n00110\n01001\n\n01100\n11100\n00100\n10101\n10011\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n10000\n00100\n00101\n00110\n\n01100\n01000\n00100\n01000\n01110\n\n00000\n00100\n00000\n10001\n00010\n\n00010\n00010\n00010\n10000\n00100\n\nCase 3:\n00000\n00011\n00001\n01101\n01110\n\n00000\n11000\n10010\n00000\n10000\n\n10001\n10010\n00000\n01000\n00000\n\n00100\n01100\n10000\n01001\n00000\n\n00000\n00000\n01001\n00000\n00010\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n11101\n00001\n11011\n10001\n00000\n\n00011\n00011\n11111\n10010\n10000\n\n11100\n00100\n00011\n10100\n00100\n\n00000\n01110\n00000\n00110\n01001\n\n01100\n11100\n00100\n10101\n10011\n", "Case 1:\n11100\n00100\n00100\n00100\n10010\n\n00010\n00000\n00011\n00000\n10100\n\n01100\n00000\n00110\n00000\n10010\n\n00100\n00000\n00000\n00000\n10001\n\n00010\n10000\n10101\n10000\n01101\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n10000\n00100\n00101\n00110\n\n01100\n01000\n00100\n01000\n01110\n\n00000\n00100\n00000\n10001\n00010\n\n00010\n00010\n00010\n10000\n00100\n\nCase 3:\n00100\n00000\n11100\n10010\n00110\n\n01001\n00001\n00000\n00010\n01010\n\n10001\n10101\n01101\n10001\n00001\n\n10001\n11000\n11000\n00000\n01001\n\n01100\n00100\n00100\n01100\n00100\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n11101\n00001\n11011\n10001\n00000\n\n00011\n00011\n11111\n10010\n10000\n\n11100\n00100\n00011\n10100\n00100\n\n00000\n01110\n00000\n00110\n01001\n\n01100\n11100\n00100\n10101\n10011\n", "Case 1:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00011\n00000\n00011\n00000\n\n00101\n00100\n00010\n10001\n00010\n\n00101\n00100\n00010\n10010\n00000\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00000\n10000\n00100\n00101\n00110\n\n01100\n01000\n00100\n01000\n01110\n\n00000\n00100\n00000\n10001\n00010\n\n00010\n00010\n00010\n10000\n00100\n\nCase 3:\n00100\n00000\n11100\n10010\n00110\n\n01001\n00001\n00000\n00010\n01010\n\n10001\n10101\n01101\n10001\n00001\n\n10001\n11000\n11000\n00000\n01001\n\n01100\n00100\n00100\n01100\n00100\n", "Case 1:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00011\n00000\n00011\n00000\n\n00101\n00100\n00010\n10001\n00010\n\n00101\n00100\n00010\n10010\n00000\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n00110\n00010\n\n00100\n10101\n00000\n01100\n00100\n\n11010\n11011\n00000\n01100\n01100\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00100\n00000\n11100\n10010\n00110\n\n01001\n00001\n00000\n00010\n01010\n\n10001\n10101\n01101\n10001\n00001\n\n10001\n11000\n11000\n00000\n01001\n\n01100\n00100\n00100\n01100\n00100\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n01111\n11100\n01111\n00001\n00011\n\n10110\n00010\n00001\n00001\n01001\n\n01110\n00000\n00001\n00110\n00001\n\n00010\n10000\n10001\n00000\n01100\n\n00000\n00100\n10000\n00000\n00110\n", "Case 1:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00011\n00000\n00011\n00000\n\n00101\n00100\n00010\n10001\n00010\n\n00101\n00100\n00010\n10010\n00000\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n00110\n00010\n\n00100\n10101\n00000\n01100\n00100\n\n11010\n11011\n00000\n01100\n01100\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n10000\n00000\n00000\n10100\n00000\n\n00110\n10001\n11100\n01000\n10100\n\n00011\n10000\n10001\n00000\n10100\n\n00000\n10000\n00001\n00001\n11010\n\n01000\n11001\n10001\n11000\n01110\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00110\n00000\n\n00000\n00110\n01000\n00001\n00001\n\n00000\n00110\n01000\n00001\n00001\n\nCase 3:\n10100\n01001\n10101\n00010\n10010\n\n00000\n10000\n00000\n00000\n00001\n\n00000\n00000\n00000\n00000\n00100\n\n01100\n00000\n01101\n10000\n11100\n\n00000\n00100\n01010\n01000\n11100\n", "Case 1:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00011\n00000\n00011\n00000\n\n00101\n00100\n00010\n10001\n00010\n\n00101\n00100\n00010\n10010\n00000\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n00110\n00010\n\n00100\n10101\n00000\n01100\n00100\n\n11010\n11011\n00000\n01100\n01100\n\n00000\n00000\n00000\n00000\n00000\n\nCase 3:\n00000\n00010\n10010\n10001\n01010\n\n00000\n10000\n10110\n00001\n10101\n\n10000\n00011\n10001\n10001\n00000\n\n01101\n10101\n10101\n00000\n10110\n\n10001\n00100\n10001\n11100\n01001\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00110\n01100\n00001\n00001\n\n00000\n00110\n01100\n00001\n00001\n\nCase 3:\n10100\n01001\n10101\n00010\n10010\n\n00000\n10000\n00000\n00000\n00001\n\n00000\n00000\n00000\n00000\n00100\n\n01100\n00000\n01101\n10000\n11100\n\n00000\n00100\n01010\n01000\n11100\n", "Case 1:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00011\n00000\n00011\n00000\n\n00101\n00100\n00010\n10001\n00010\n\n00101\n00100\n00010\n10010\n00000\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00000\n00010\n10010\n10001\n01010\n\n00000\n10000\n10110\n00001\n10101\n\n10000\n00011\n10001\n10001\n00000\n\n01101\n10101\n10101\n00000\n10110\n\n10001\n00100\n10001\n11100\n01001\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00010\n01000\n00001\n00001\n\n00000\n00010\n01000\n00001\n00001\n\nCase 3:\n10100\n01001\n10101\n00010\n10010\n\n00000\n10000\n00000\n00000\n00001\n\n00000\n00000\n00000\n00000\n00100\n\n01100\n00000\n01101\n10000\n11100\n\n00000\n00100\n01010\n01000\n11100\n", "Case 1:\n00000\n00100\n00000\n00000\n00000\n\n10001\n00001\n11000\n11000\n11000\n\n00000\n00011\n00100\n00000\n00000\n\n00000\n00000\n00001\n00011\n00000\n\n01010\n01001\n10001\n00010\n00000\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00000\n00010\n10010\n10001\n01010\n\n00000\n10000\n10110\n00001\n10101\n\n10000\n00011\n10001\n10001\n00000\n\n01101\n10101\n10101\n00000\n10110\n\n10001\n00100\n10001\n11100\n01001\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00010\n01000\n00001\n00001\n\n00000\n00010\n01000\n00001\n00001\n\nCase 3:\n10000\n00000\n10010\n11000\n00000\n\n00110\n00000\n10000\n00000\n10000\n\n10101\n00000\n01000\n01110\n10001\n\n10101\n10000\n11111\n10110\n11011\n\n00111\n00100\n11011\n01010\n01000\n", "Case 1:\n11111\n11111\n00111\n00111\n00111\n\n11111\n11111\n00011\n00011\n00011\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00000\n00010\n10010\n10001\n01010\n\n00000\n10000\n10110\n00001\n10101\n\n10000\n00011\n10001\n10001\n00000\n\n01101\n10101\n10101\n00000\n10110\n\n10001\n00100\n10001\n11100\n01001\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00111\n00111\n00011\n00011\n00011\n\n00111\n00111\n00011\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00010\n01000\n00001\n00001\n\n00000\n00010\n01000\n00001\n00001\n\nCase 3:\n00110\n10001\n01100\n10010\n10001\n\n10000\n11011\n10010\n10000\n00010\n\n01101\n10000\n00001\n00011\n01000\n\n10010\n00000\n00000\n00000\n00000\n\n10000\n00010\n10000\n01010\n01010\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n11000\n11000\n00000\n00011\n00011\n\n11000\n11000\n00000\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00010\n01000\n00001\n00001\n\n00000\n00010\n01000\n00001\n00001\n\nCase 3:\n00110\n10001\n01100\n10010\n10001\n\n10000\n11011\n10010\n10000\n00010\n\n01101\n10000\n00001\n00011\n01000\n\n10010\n00000\n00000\n00000\n00000\n\n10000\n00010\n10000\n01010\n01010\n", "Case 1:\n11111\n11111\n00111\n00111\n00111\n\n11111\n11111\n00011\n00011\n00011\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00010\n10101\n10010\n10110\n00000\n\n00110\n00001\n10001\n10001\n11000\n\n10010\n10001\n10001\n00100\n00111\n\n11000\n00101\n10001\n00001\n11000\n\n00000\n11011\n10110\n01110\n00000\n", "Case 1:\n00000\n00000\n11000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n11000\n11000\n00000\n00011\n00011\n\n11000\n11000\n00000\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00010\n01000\n00001\n00001\n\n00000\n00010\n01000\n00001\n00001\n\nCase 3:\n10101\n00111\n00010\n01000\n01010\n\n01111\n00111\n00001\n00000\n00111\n\n00111\n00101\n00001\n00011\n01001\n\n00110\n00000\n00001\n00000\n10010\n\n10100\n00001\n00100\n00010\n11010\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11100\n11100\n00000\n00000\n00000\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00010\n10101\n10010\n10110\n00000\n\n00110\n00001\n10001\n10001\n11000\n\n10010\n10001\n10001\n00100\n00111\n\n11000\n00101\n10001\n00001\n11000\n\n00000\n11011\n10110\n01110\n00000\n", "Case 1:\n00111\n00011\n00001\n00000\n10000\n\n00111\n00011\n00001\n00000\n10000\n\n11100\n11100\n00100\n00011\n00011\n\n11101\n11101\n00100\n00011\n00011\n\n11101\n11101\n00100\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00010\n01000\n00001\n00001\n\n00000\n00010\n01000\n00001\n00001\n\nCase 3:\n10101\n00111\n00010\n01000\n01010\n\n01111\n00111\n00001\n00000\n00111\n\n00111\n00101\n00001\n00011\n01001\n\n00110\n00000\n00001\n00000\n10010\n\n10100\n00001\n00100\n00010\n11010\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11100\n11100\n00000\n00000\n00000\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00110\n10010\n00010\n01010\n01110\n\n10010\n10000\n00110\n00011\n01000\n\n01100\n10010\n00111\n00010\n10001\n\n11100\n00110\n00010\n00001\n10001\n\n00000\n01000\n00010\n00100\n10110\n", "Case 1:\n00111\n00011\n00001\n00000\n10000\n\n00111\n00011\n00001\n00000\n10000\n\n11100\n11100\n00100\n00011\n00011\n\n11101\n11101\n00100\n00011\n00011\n\n11101\n11101\n00100\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00001\n00001\n00000\n00101\n\n00000\n00011\n00011\n00000\n00101\n\nCase 3:\n10101\n00111\n00010\n01000\n01010\n\n01111\n00111\n00001\n00000\n00111\n\n00111\n00101\n00001\n00011\n01001\n\n00110\n00000\n00001\n00000\n10010\n\n10100\n00001\n00100\n00010\n11010\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11100\n11100\n00000\n00000\n00000\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00100\n01100\n00001\n00000\n01001\n\n01000\n00000\n10001\n11100\n10100\n\n11000\n11100\n00100\n01010\n01110\n\n10001\n10110\n01010\n00101\n00010\n\n01100\n01010\n01010\n10000\n10100\n", "Case 1:\n00111\n00011\n00001\n00000\n10000\n\n00111\n00011\n00001\n00000\n10000\n\n11100\n11100\n00100\n00011\n00011\n\n11101\n11101\n00100\n00011\n00011\n\n11101\n11101\n00100\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00001\n00001\n00000\n00101\n\n00000\n00011\n00011\n00000\n00101\n\nCase 3:\n10001\n00111\n10001\n01010\n10100\n\n00011\n00000\n00000\n00001\n00110\n\n01000\n00001\n00000\n10010\n11101\n\n11000\n00000\n01010\n00000\n11011\n\n00011\n00100\n00000\n00000\n00000\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11100\n11100\n00000\n00000\n00000\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n01000\n01100\n00000\n00000\n10001\n\n00110\n01010\n01010\n00000\n00100\n\n01010\n00011\n00100\n01110\n00110\n\n11111\n00111\n10001\n11100\n00100\n\n00000\n00000\n01010\n11100\n10100\n", "Case 1:\n00111\n00011\n01001\n00000\n10000\n\n00111\n00011\n10001\n00000\n10000\n\n00100\n00100\n10100\n00011\n00011\n\n10001\n00001\n10100\n00011\n00011\n\n10001\n00001\n10100\n00011\n00011\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00001\n00001\n00000\n00101\n\n00000\n00011\n00011\n00000\n00101\n\nCase 3:\n10001\n00111\n10001\n01010\n10100\n\n00011\n00000\n00000\n00001\n00110\n\n01000\n00001\n00000\n10010\n11101\n\n11000\n00000\n01010\n00000\n11011\n\n00011\n00100\n00000\n00000\n00000\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11100\n11100\n00000\n00000\n00000\n\n00100\n00100\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n01010\n01010\n00100\n01010\n00010\n\n01110\n00000\n10001\n00001\n00111\n\n11100\n00001\n00000\n10000\n01001\n\n01010\n10001\n00001\n10001\n11011\n\n10110\n01111\n11100\n10110\n00110\n", "Case 1:\n00111\n00011\n01001\n00100\n10000\n\n00111\n00001\n10001\n00000\n10000\n\n00100\n00000\n10000\n00000\n00000\n\n10001\n00001\n10000\n00001\n10101\n\n10001\n00001\n10000\n00001\n10101\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00001\n00001\n00000\n00101\n\n00000\n00011\n00011\n00000\n00101\n\nCase 3:\n10001\n00111\n10001\n01010\n10100\n\n00011\n00000\n00000\n00001\n00110\n\n01000\n00001\n00000\n10010\n11101\n\n11000\n00000\n01010\n00000\n11011\n\n00011\n00100\n00000\n00000\n00000\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11000\n11000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00011\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n01010\n01010\n00100\n01010\n00010\n\n01110\n00000\n10001\n00001\n00111\n\n11100\n00001\n00000\n10000\n01001\n\n01010\n10001\n00001\n10001\n11011\n\n10110\n01111\n11100\n10110\n00110\n", "Case 1:\n00001\n00001\n10001\n00000\n10100\n\n00001\n00001\n00001\n00000\n10000\n\n10000\n00100\n00000\n00000\n00000\n\n10001\n00001\n00000\n00001\n00001\n\n11101\n00101\n00000\n00001\n00001\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00010\n00000\n\n00000\n00001\n00001\n00000\n00101\n\n00000\n00011\n00011\n00000\n00101\n\nCase 3:\n10001\n00111\n10001\n01010\n10100\n\n00011\n00000\n00000\n00001\n00110\n\n01000\n00001\n00000\n10010\n11101\n\n11000\n00000\n01010\n00000\n11011\n\n00011\n00100\n00000\n00000\n00000\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11000\n11000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00011\n11111\n11111\n\nCase 2:\n00010\n10110\n00000\n00000\n00000\n\n00001\n00000\n00000\n01110\n01110\n\n00101\n00011\n11000\n01100\n00000\n\n00000\n00100\n00000\n11100\n00000\n\n01000\n00000\n10000\n00000\n00000\n\nCase 3:\n00000\n10110\n00111\n00100\n00000\n\n01100\n00010\n10000\n00000\n00110\n\n10100\n10011\n10001\n00001\n11110\n\n10000\n10001\n00000\n10000\n11110\n\n00011\n01100\n11011\n11000\n01100\n", "Case 1:\n00001\n00001\n10001\n00000\n10100\n\n00001\n00001\n00001\n00000\n10000\n\n10000\n00100\n00000\n00000\n00000\n\n10001\n00001\n00000\n00001\n00001\n\n11101\n00101\n00000\n00001\n00001\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00000\n00101\n\n00001\n00001\n00010\n10001\n01101\n\nCase 3:\n10001\n00111\n10001\n01010\n10100\n\n00011\n00000\n00000\n00001\n00110\n\n01000\n00001\n00000\n10010\n11101\n\n11000\n00000\n01010\n00000\n11011\n\n00011\n00100\n00000\n00000\n00000\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11000\n11000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00011\n11111\n11111\n\nCase 2:\n00000\n10001\n00000\n00010\n00010\n\n00000\n00000\n00000\n01110\n00110\n\n00000\n00000\n11000\n01110\n00000\n\n00000\n00000\n00000\n10001\n00010\n\n01100\n00000\n10000\n01001\n00000\n\nCase 3:\n00000\n10110\n00111\n00100\n00000\n\n01100\n00010\n10000\n00000\n00110\n\n10100\n10011\n10001\n00001\n11110\n\n10000\n10001\n00000\n10000\n11110\n\n00011\n01100\n11011\n11000\n01100\n", "Case 1:\n00001\n00001\n10001\n00000\n10100\n\n00001\n00001\n00001\n00000\n10000\n\n10000\n00100\n00000\n00000\n00000\n\n10001\n00001\n00000\n00001\n00001\n\n11101\n00101\n00000\n00001\n00001\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00000\n00101\n\n00001\n00001\n00010\n10001\n01101\n\nCase 3:\n01001\n01001\n00100\n00000\n00000\n\n10100\n00100\n11111\n00000\n00000\n\n00010\n00001\n00101\n01000\n00000\n\n10100\n10000\n10000\n11000\n11100\n\n01010\n01010\n01000\n01100\n10100\n", "Case 1:\n11111\n11111\n00100\n00100\n00100\n\n11000\n11000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00000\n00011\n00011\n\n00000\n00000\n00011\n11111\n11111\n\nCase 2:\n00000\n10001\n00000\n00010\n00010\n\n00000\n00000\n00000\n01110\n00110\n\n00000\n00000\n11000\n01110\n00000\n\n00000\n00000\n00000\n10001\n00010\n\n01100\n00000\n10000\n01001\n00000\n\nCase 3:\n01001\n10000\n10101\n10010\n01001\n\n10010\n10010\n11100\n00101\n00111\n\n00001\n00000\n01101\n01001\n01010\n\n00001\n10000\n10000\n10101\n01100\n\n01110\n01100\n00101\n00000\n10010\n", "Case 1:\n00111\n00011\n10001\n00000\n10100\n\n00111\n00011\n00001\n00000\n10000\n\n00100\n00000\n00000\n00000\n00000\n\n11101\n00001\n00000\n00001\n00001\n\n11101\n00001\n00000\n00001\n00001\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00000\n00101\n\n00001\n00001\n00010\n10001\n01101\n\nCase 3:\n01001\n01001\n00100\n00000\n00000\n\n10100\n00100\n11111\n00000\n00000\n\n00010\n00001\n00101\n01000\n00000\n\n10100\n10000\n10000\n11000\n11100\n\n01010\n01010\n01000\n01100\n10100\n", "Case 1:\n00111\n00011\n10001\n00000\n10100\n\n00111\n00011\n00001\n00000\n10000\n\n00100\n00000\n00000\n00000\n00000\n\n11101\n00001\n00000\n00001\n00001\n\n11101\n00001\n00000\n00001\n00001\n\nCase 2:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n00000\n00000\n00000\n00000\n00101\n\n00001\n00001\n00010\n00001\n01101\n\nCase 3:\n01001\n01001\n00100\n00000\n00000\n\n10100\n00100\n11111\n00000\n00000\n\n00010\n00001\n00101\n01000\n00000\n\n10100\n10000\n10000\n11000\n11100\n\n01010\n01010\n01000\n01100\n10100\n", "Case 1:\n00000\n00000\n01010\n01110\n10101\n\n00000\n10001\n00000\n00000\n00000\n\n00000\n00000\n11111\n10001\n00000\n\n00000\n00000\n00000\n00000\n01010\n\n00000\n00000\n01110\n00100\n11111\n\nCase 2:\n00010\n10110\n00000\n11000\n10000\n\n00001\n00000\n10101\n00010\n00100\n\n10001\n00000\n00000\n00000\n00010\n\n01110\n10001\n00000\n00001\n10000\n\n00000\n00000\n00111\n01001\n01000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n", "Case 1:\n00000\n00000\n01010\n01110\n10101\n\n00000\n10001\n00000\n00000\n00000\n\n00000\n00000\n11111\n10001\n00000\n\n00000\n00000\n00000\n00000\n01010\n\n00000\n00000\n01110\n00100\n11111\n\nCase 2:\n00010\n10110\n00000\n11000\n10000\n\n00001\n00000\n10101\n00010\n00100\n\n10001\n00000\n00000\n00000\n00010\n\n01110\n10001\n00000\n00001\n10000\n\n00000\n00000\n00111\n01001\n01000\n\nCase 3:\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n\n00000\n00000\n00000\n00000\n00000\n" ], "question": "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[27];\n\tint N;\n\tint M;\n\tint i,j,k,l,m,n;\n\tint day,count;\n\tint case_count;\n\tfor(case_count=1;scanf(\"%d\",&N)==1 && N>0;case_count++) {\n\t\tfor(i=1;i<=5;i++) {\n\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\tscanf(\"%s\",&nowstatus[i][j][1]);\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<27;i++)a[i]=b[i]=0;\n\t\tscanf(\"%d\",&M);\n\t\tfor(i=0;i<M;i++) {\n\t\t\tscanf(\"%d\",&count);\n\t\t\ta[count]=1;\n\t\t}\n\t\tscanf(\"%d\",&M);\n\t\tfor(i=0;i<M;i++) {\n\t\t\tscanf(\"%d\",&count);\n\t\t\tb[count]=1;\n\t\t}\n\n\t\tfor(day=0;day<N;day++) {\n\t\t\tfor(i=1;i<=5;i++) {\n\t\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\t\tfor(k=1;k<=5;k++) {\n\t\t\t\t\t\tcount=0;\n\t\t\t\t\t\tfor(l=-1;l<=1;l++) {\n\t\t\t\t\t\t\tfor(m=-1;m<=1;m++) {\n\t\t\t\t\t\t\t\tfor(n=-1;n<=1;n++) {\n\t\t\t\t\t\t\t\t\tif((l|m|n)==0)continue;\n\t\t\t\t\t\t\t\t\tif(nowstatus[i+l][j+m][k+n]=='1')count++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(nowstatus[i][j][k]=='1') {\n\t\t\t\t\t\t\tnextstatus[i][j][k]=(b[count]?'1':'0');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnextstatus[i][j][k]=(a[count]?'1':'0');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemcpy(nowstatus,nextstatus,sizeof(nowstatus));\n\t\t}\n\n\t\tif(case_count>1)putchar('\\n');\n\t\tprintf(\"Case %d:\\n\",case_count);\n\t\tfor(i=1;i<=5;i++) {\n\t\t\tfor(j=1;j<=5;j++) {\n\t\t\t\tputs(&nowstatus[i][j][1]);\n\t\t\t}\n\t\t\tif(i<5)putchar('\\n');\n\t\t}\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$832, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-784(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$42, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tmovw\t%ax, (%rdx)\n\taddq\t$2, %rdx\n\tmovb\t%al, (%rdx)\n\taddq\t$1, %rdx\n\tleaq\t-432(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$42, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tmovw\t%ax, (%rdx)\n\taddq\t$2, %rdx\n\tmovb\t%al, (%rdx)\n\taddq\t$1, %rdx\n\tmovl\t$1, -788(%rbp)\n\tjmp\t.L2\n.L42:\n\tmovl\t$1, -816(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t$1, -812(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-784(%rbp), %rsi\n\tmovl\t-812(%rbp), %eax\n\tcltq\n\tmovq\t%rax, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rax, %rdx\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rcx, %rax\n\taddq\t%rdx, %rax\n\taddq\t$1, %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -812(%rbp)\n.L4:\n\tcmpl\t$5, -812(%rbp)\n\tjle\t.L5\n\taddl\t$1, -816(%rbp)\n.L3:\n\tcmpl\t$5, -816(%rbp)\n\tjle\t.L6\n\tmovl\t$0, -816(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-816(%rbp), %eax\n\tcltq\n\tmovb\t$0, -48(%rbp,%rax)\n\tmovl\t-816(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %edx\n\tmovl\t-816(%rbp), %eax\n\tcltq\n\tmovb\t%dl, -80(%rbp,%rax)\n\taddl\t$1, -816(%rbp)\n.L7:\n\tcmpl\t$26, -816(%rbp)\n\tjle\t.L8\n\tleaq\t-824(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -816(%rbp)\n\tjmp\t.L9\n.L10:\n\tleaq\t-820(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovb\t$1, -80(%rbp,%rax)\n\taddl\t$1, -816(%rbp)\n.L9:\n\tmovl\t-824(%rbp), %eax\n\tcmpl\t%eax, -816(%rbp)\n\tjl\t.L10\n\tleaq\t-824(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -816(%rbp)\n\tjmp\t.L11\n.L12:\n\tleaq\t-820(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovb\t$1, -48(%rbp,%rax)\n\taddl\t$1, -816(%rbp)\n.L11:\n\tmovl\t-824(%rbp), %eax\n\tcmpl\t%eax, -816(%rbp)\n\tjl\t.L12\n\tmovl\t$0, -792(%rbp)\n\tjmp\t.L13\n.L34:\n\tmovl\t$1, -816(%rbp)\n\tjmp\t.L14\n.L33:\n\tmovl\t$1, -812(%rbp)\n\tjmp\t.L15\n.L32:\n\tmovl\t$1, -808(%rbp)\n\tjmp\t.L16\n.L31:\n\tmovl\t$0, -820(%rbp)\n\tmovl\t$-1, -804(%rbp)\n\tjmp\t.L17\n.L24:\n\tmovl\t$-1, -800(%rbp)\n\tjmp\t.L18\n.L23:\n\tmovl\t$-1, -796(%rbp)\n\tjmp\t.L19\n.L22:\n\tmovl\t-804(%rbp), %eax\n\torl\t-800(%rbp), %eax\n\torl\t-796(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L45\n\tmovl\t-816(%rbp), %edx\n\tmovl\t-804(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-812(%rbp), %ecx\n\tmovl\t-800(%rbp), %eax\n\taddl\t%ecx, %eax\n\tmovl\t-808(%rbp), %esi\n\tmovl\t-796(%rbp), %ecx\n\taddl\t%esi, %ecx\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rsi, %rax\n\tsubq\t$784, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$49, %al\n\tjne\t.L21\n\tmovl\t-820(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -820(%rbp)\n\tjmp\t.L21\n.L45:\n\tnop\n.L21:\n\taddl\t$1, -796(%rbp)\n.L19:\n\tcmpl\t$1, -796(%rbp)\n\tjle\t.L22\n\taddl\t$1, -800(%rbp)\n.L18:\n\tcmpl\t$1, -800(%rbp)\n\tjle\t.L23\n\taddl\t$1, -804(%rbp)\n.L17:\n\tcmpl\t$1, -804(%rbp)\n\tjle\t.L24\n\tmovl\t-808(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-812(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rsi, %rax\n\tsubq\t$784, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$49, %al\n\tjne\t.L25\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tje\t.L26\n\tmovl\t$49, %esi\n\tjmp\t.L27\n.L26:\n\tmovl\t$48, %esi\n.L27:\n\tmovl\t-808(%rbp), %eax\n\tmovslq\t%eax, %rdi\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-812(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rdi, %rax\n\tsubq\t$432, %rax\n\tmovb\t%sil, (%rax)\n\tjmp\t.L28\n.L25:\n\tmovl\t-820(%rbp), %eax\n\tcltq\n\tmovzbl\t-80(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tje\t.L29\n\tmovl\t$49, %esi\n\tjmp\t.L30\n.L29:\n\tmovl\t$48, %esi\n.L30:\n\tmovl\t-808(%rbp), %eax\n\tmovslq\t%eax, %rdi\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-812(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rcx, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rbp, %rax\n\taddq\t%rdi, %rax\n\tsubq\t$432, %rax\n\tmovb\t%sil, (%rax)\n.L28:\n\taddl\t$1, -808(%rbp)\n.L16:\n\tcmpl\t$5, -808(%rbp)\n\tjle\t.L31\n\taddl\t$1, -812(%rbp)\n.L15:\n\tcmpl\t$5, -812(%rbp)\n\tjle\t.L32\n\taddl\t$1, -816(%rbp)\n.L14:\n\tcmpl\t$5, -816(%rbp)\n\tjle\t.L33\n\tleaq\t-784(%rbp), %rdx\n\tleaq\t-432(%rbp), %rax\n\tmovl\t$42, %ecx\n\tmovq\t%rdx, %rdi\n\tmovq\t%rax, %rsi\n\trep movsq\n\tmovq\t%rsi, %rax\n\tmovq\t%rdi, %rdx\n\tmovl\t(%rax), %ecx\n\tmovl\t%ecx, (%rdx)\n\tleaq\t4(%rdx), %rdx\n\tleaq\t4(%rax), %rax\n\tmovzwl\t(%rax), %ecx\n\tmovw\t%cx, (%rdx)\n\tleaq\t2(%rdx), %rdx\n\tleaq\t2(%rax), %rax\n\tmovzbl\t(%rax), %ecx\n\tmovb\t%cl, (%rdx)\n\taddl\t$1, -792(%rbp)\n.L13:\n\tmovl\t-828(%rbp), %eax\n\tcmpl\t%eax, -792(%rbp)\n\tjl\t.L34\n\tcmpl\t$1, -788(%rbp)\n\tjle\t.L35\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L35:\n\tmovl\t-788(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$1, -816(%rbp)\n\tjmp\t.L36\n.L40:\n\tmovl\t$1, -812(%rbp)\n\tjmp\t.L37\n.L38:\n\tleaq\t-784(%rbp), %rsi\n\tmovl\t-812(%rbp), %eax\n\tcltq\n\tmovq\t%rax, %rdx\n\tsalq\t$3, %rdx\n\tsubq\t%rax, %rdx\n\tmovl\t-816(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$4, %rax\n\taddq\t%rcx, %rax\n\taddq\t%rdx, %rax\n\taddq\t$1, %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\taddl\t$1, -812(%rbp)\n.L37:\n\tcmpl\t$5, -812(%rbp)\n\tjle\t.L38\n\tcmpl\t$4, -816(%rbp)\n\tjg\t.L39\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L39:\n\taddl\t$1, -816(%rbp)\n.L36:\n\tcmpl\t$5, -816(%rbp)\n\tjle\t.L40\n\taddl\t$1, -788(%rbp)\n.L2:\n\tleaq\t-828(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L41\n\tmovl\t-828(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L42\n.L41:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L44\n\tcall\t__stack_chk_fail@PLT\n.L44:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; int day,count; int case_count; for(case_count=1;scanf("%d",&N)==1 && N>0;case_count++) { for(i=1;i<=5;i++) { for(j=1;j<=5;j++) { scanf("%s",&nowstatus[i][j][1]); } } for(i=0;i<27;i++)a[i]=b[i]=0; scanf("%d",&M); for(i=0;i<M;i++) { scanf("%d",&count); a[count]=1; } scanf("%d",&M); for(i=0;i<M;i++) { scanf("%d",&count); b[count]=1; } for(day=0;day<N;day++) { for(i=1;i<=5;i++) { for(j=1;j<=5;j++) { for(k=1;k<=5;k++) { count=0; for(l=-1;l<=1;l++) { for(m=-1;m<=1;m++) { for(n=-1;n<=1;n++) { if((l|m|n)==0)continue; if(nowstatus[i+l][j+m][k+n]=='1')count++; } } } if(nowstatus[i][j][k]=='1') { nextstatus[i][j][k]=(b[count]?'1':'0'); } else { nextstatus[i][j][k]=(a[count]?'1':'0'); } } } } memcpy(nowstatus,nextstatus,sizeof(nowstatus)); } if(case_count>1)putchar('\n'); printf("Case %d:\n",case_count); for(i=1;i<=5;i++) { for(j=1;j<=5;j++) { puts(&nowstatus[i][j][1]); } if(i<5)putchar('\n'); } } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "%d" .LC2: .string "Case %d:\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $832, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -784(%rbp), %rdx movl $0, %eax movl $42, %ecx movq %rdx, %rdi rep stosq movq %rdi, %rdx movl %eax, (%rdx) addq $4, %rdx movw %ax, (%rdx) addq $2, %rdx movb %al, (%rdx) addq $1, %rdx leaq -432(%rbp), %rdx movl $0, %eax movl $42, %ecx movq %rdx, %rdi rep stosq movq %rdi, %rdx movl %eax, (%rdx) addq $4, %rdx movw %ax, (%rdx) addq $2, %rdx movb %al, (%rdx) addq $1, %rdx movl $1, -788(%rbp) jmp .L2 .L42: movl $1, -816(%rbp) jmp .L3 .L6: movl $1, -812(%rbp) jmp .L4 .L5: leaq -784(%rbp), %rsi movl -812(%rbp), %eax cltq movq %rax, %rdx salq $3, %rdx subq %rax, %rdx movl -816(%rbp), %eax movslq %eax, %rcx movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $4, %rax addq %rcx, %rax addq %rdx, %rax addq $1, %rax addq %rsi, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -812(%rbp) .L4: cmpl $5, -812(%rbp) jle .L5 addl $1, -816(%rbp) .L3: cmpl $5, -816(%rbp) jle .L6 movl $0, -816(%rbp) jmp .L7 .L8: movl -816(%rbp), %eax cltq movb $0, -48(%rbp,%rax) movl -816(%rbp), %eax cltq movzbl -48(%rbp,%rax), %edx movl -816(%rbp), %eax cltq movb %dl, -80(%rbp,%rax) addl $1, -816(%rbp) .L7: cmpl $26, -816(%rbp) jle .L8 leaq -824(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -816(%rbp) jmp .L9 .L10: leaq -820(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -820(%rbp), %eax cltq movb $1, -80(%rbp,%rax) addl $1, -816(%rbp) .L9: movl -824(%rbp), %eax cmpl %eax, -816(%rbp) jl .L10 leaq -824(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -816(%rbp) jmp .L11 .L12: leaq -820(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -820(%rbp), %eax cltq movb $1, -48(%rbp,%rax) addl $1, -816(%rbp) .L11: movl -824(%rbp), %eax cmpl %eax, -816(%rbp) jl .L12 movl $0, -792(%rbp) jmp .L13 .L34: movl $1, -816(%rbp) jmp .L14 .L33: movl $1, -812(%rbp) jmp .L15 .L32: movl $1, -808(%rbp) jmp .L16 .L31: movl $0, -820(%rbp) movl $-1, -804(%rbp) jmp .L17 .L24: movl $-1, -800(%rbp) jmp .L18 .L23: movl $-1, -796(%rbp) jmp .L19 .L22: movl -804(%rbp), %eax orl -800(%rbp), %eax orl -796(%rbp), %eax testl %eax, %eax je .L45 movl -816(%rbp), %edx movl -804(%rbp), %eax addl %eax, %edx movl -812(%rbp), %ecx movl -800(%rbp), %eax addl %ecx, %eax movl -808(%rbp), %esi movl -796(%rbp), %ecx addl %esi, %ecx movslq %ecx, %rsi movslq %edx, %rdx movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $4, %rax addq %rdx, %rax movq %rcx, %rdx salq $3, %rdx subq %rcx, %rdx addq %rdx, %rax addq %rbp, %rax addq %rsi, %rax subq $784, %rax movzbl (%rax), %eax cmpb $49, %al jne .L21 movl -820(%rbp), %eax addl $1, %eax movl %eax, -820(%rbp) jmp .L21 .L45: nop .L21: addl $1, -796(%rbp) .L19: cmpl $1, -796(%rbp) jle .L22 addl $1, -800(%rbp) .L18: cmpl $1, -800(%rbp) jle .L23 addl $1, -804(%rbp) .L17: cmpl $1, -804(%rbp) jle .L24 movl -808(%rbp), %eax movslq %eax, %rsi movl -816(%rbp), %eax movslq %eax, %rdx movl -812(%rbp), %eax movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $4, %rax addq %rdx, %rax movq %rcx, %rdx salq $3, %rdx subq %rcx, %rdx addq %rdx, %rax addq %rbp, %rax addq %rsi, %rax subq $784, %rax movzbl (%rax), %eax cmpb $49, %al jne .L25 movl -820(%rbp), %eax cltq movzbl -48(%rbp,%rax), %eax testb %al, %al je .L26 movl $49, %esi jmp .L27 .L26: movl $48, %esi .L27: movl -808(%rbp), %eax movslq %eax, %rdi movl -816(%rbp), %eax movslq %eax, %rdx movl -812(%rbp), %eax movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $4, %rax addq %rdx, %rax movq %rcx, %rdx salq $3, %rdx subq %rcx, %rdx addq %rdx, %rax addq %rbp, %rax addq %rdi, %rax subq $432, %rax movb %sil, (%rax) jmp .L28 .L25: movl -820(%rbp), %eax cltq movzbl -80(%rbp,%rax), %eax testb %al, %al je .L29 movl $49, %esi jmp .L30 .L29: movl $48, %esi .L30: movl -808(%rbp), %eax movslq %eax, %rdi movl -816(%rbp), %eax movslq %eax, %rdx movl -812(%rbp), %eax movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $4, %rax addq %rdx, %rax movq %rcx, %rdx salq $3, %rdx subq %rcx, %rdx addq %rdx, %rax addq %rbp, %rax addq %rdi, %rax subq $432, %rax movb %sil, (%rax) .L28: addl $1, -808(%rbp) .L16: cmpl $5, -808(%rbp) jle .L31 addl $1, -812(%rbp) .L15: cmpl $5, -812(%rbp) jle .L32 addl $1, -816(%rbp) .L14: cmpl $5, -816(%rbp) jle .L33 leaq -784(%rbp), %rdx leaq -432(%rbp), %rax movl $42, %ecx movq %rdx, %rdi movq %rax, %rsi rep movsq movq %rsi, %rax movq %rdi, %rdx movl (%rax), %ecx movl %ecx, (%rdx) leaq 4(%rdx), %rdx leaq 4(%rax), %rax movzwl (%rax), %ecx movw %cx, (%rdx) leaq 2(%rdx), %rdx leaq 2(%rax), %rax movzbl (%rax), %ecx movb %cl, (%rdx) addl $1, -792(%rbp) .L13: movl -828(%rbp), %eax cmpl %eax, -792(%rbp) jl .L34 cmpl $1, -788(%rbp) jle .L35 movl $10, %edi call putchar@PLT .L35: movl -788(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $1, -816(%rbp) jmp .L36 .L40: movl $1, -812(%rbp) jmp .L37 .L38: leaq -784(%rbp), %rsi movl -812(%rbp), %eax cltq movq %rax, %rdx salq $3, %rdx subq %rax, %rdx movl -816(%rbp), %eax movslq %eax, %rcx movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $4, %rax addq %rcx, %rax addq %rdx, %rax addq $1, %rax addq %rsi, %rax movq %rax, %rdi call puts@PLT addl $1, -812(%rbp) .L37: cmpl $5, -812(%rbp) jle .L38 cmpl $4, -816(%rbp) jg .L39 movl $10, %edi call putchar@PLT .L39: addl $1, -816(%rbp) .L36: cmpl $5, -816(%rbp) jle .L40 addl $1, -788(%rbp) .L2: leaq -828(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpl $1, %eax jne .L41 movl -828(%rbp), %eax testl %eax, %eax jg .L42 .L41: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L44 call __stack_chk_fail@PLT .L44: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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[i]);\n all ^= a[i];\n }\n\n for (int i = 0; i < N; i++)\n printf(\"%d \", a[i] ^ all);\n puts(\"\");\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d \"\n.LC2:\n\t.string\t\"\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tleaq\t-88(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$3, %rax\n\tshrq\t$2, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t$0, -84(%rbp)\n\tmovl\t$0, -80(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-80(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\txorl\t%eax, -84(%rbp)\n\taddl\t$1, -80(%rbp)\n.L5:\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, -80(%rbp)\n\tjl\t.L6\n\tmovl\t$0, -76(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\txorl\t-84(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -76(%rbp)\n.L7:\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjl\t.L8\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\t%rbx, %rsp\n\tmovl\t$0, %eax\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\t.cfi_offset 15, -24\n\tleaq\t.LC0(%rip), %r15\n\tpushq\t%r14\n\tleaq\t-60(%rbp), %rsi\n\tmovq\t%r15, %rdi\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t-60(%rbp), %rax\n\tmovq\t%rsp, %rsi\n\tmovq\t%rax, %rcx\n\tleaq\t15(,%rax,4), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rsi\n\tandq\t$-16, %rdx\n\tcmpq\t%rsi, %rsp\n\tje\t.L3\n.L18:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rsi, %rsp\n\tjne\t.L18\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L19\n.L4:\n\tmovq\t%rsp, %r14\n\ttestl\t%ecx, %ecx\n\tjle\t.L7\n\tmovq\t%r14, %rbx\n\txorl\t%r13d, %r13d\n\txorl\t%r12d, %r12d\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r15, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r13d\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-60(%rbp), %eax\n\txorl\t(%rbx), %r12d\n\taddq\t$4, %rbx\n\tcmpl\t%r13d, %eax\n\tjg\t.L6\n\ttestl\t%eax, %eax\n\tjle\t.L7\n\txorl\t%ebx, %ebx\n\tleaq\t.LC2(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%r14,%rbx,4), %edx\n\tmovq\t%r13, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbx\n\txorl\t%r12d, %edx\n\tcall\t__printf_chk@PLT\n\tcmpl\t%ebx, -60(%rbp)\n\tjg\t.L8\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L20\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n.L19:\n\t.cfi_restore_state\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L20:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\t.cfi_offset 15, -24\n\tleaq\t.LC0(%rip), %r15\n\tpushq\t%r14\n\tleaq\t-60(%rbp), %rsi\n\tmovq\t%r15, %rdi\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t-60(%rbp), %rax\n\tmovq\t%rsp, %rsi\n\tmovq\t%rax, %rcx\n\tleaq\t15(,%rax,4), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rsi\n\tandq\t$-16, %rdx\n\tcmpq\t%rsi, %rsp\n\tje\t.L3\n.L18:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rsi, %rsp\n\tjne\t.L18\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L19\n.L4:\n\tmovq\t%rsp, %r14\n\ttestl\t%ecx, %ecx\n\tjle\t.L7\n\tmovq\t%r14, %rbx\n\txorl\t%r13d, %r13d\n\txorl\t%r12d, %r12d\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r15, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r13d\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-60(%rbp), %eax\n\txorl\t(%rbx), %r12d\n\taddq\t$4, %rbx\n\tcmpl\t%r13d, %eax\n\tjg\t.L6\n\ttestl\t%eax, %eax\n\tjle\t.L7\n\txorl\t%ebx, %ebx\n\tleaq\t.LC2(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%r14,%rbx,4), %edx\n\tmovq\t%r13, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbx\n\txorl\t%r12d, %edx\n\tcall\t__printf_chk@PLT\n\tcmpl\t%ebx, -60(%rbp)\n\tjg\t.L8\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L20\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n.L19:\n\t.cfi_restore_state\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L20:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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[i]);\n all ^= a[i];\n }\n\n for (int i = 0; i < N; i++)\n printf(\"%d \", a[i] ^ all);\n puts(\"\");\n}", "index": 30, "inputs": [ "4\n5 11 9 24\n", "4\n5 11 10 24\n", "4\n0 11 10 24\n", "4\n1 11 10 24\n", "4\n1 11 10 29\n", "4\n1 11 0 29\n", "4\n1 11 0 49\n", "4\n1 2 0 49\n", "4\n2 2 0 49\n", "4\n2 0 0 49\n", "4\n2 0 1 49\n", "4\n0 0 1 49\n", "4\n1 0 1 49\n", "4\n1 0 2 49\n", "4\n1 0 3 49\n", "4\n1 0 3 87\n", "4\n1 1 3 87\n", "4\n1 1 3 20\n", "4\n1 0 3 20\n", "4\n1 -1 3 20\n", "4\n1 0 0 20\n", "4\n1 0 0 15\n", "4\n1 -1 0 15\n", "4\n1 -2 0 15\n", "4\n1 -3 0 15\n", "4\n1 -3 0 0\n", "4\n1 -3 1 0\n", "4\n2 -3 0 0\n", "4\n0 -3 0 0\n", "4\n0 -3 1 0\n", "4\n-1 -3 1 0\n", "4\n-1 -6 1 0\n", "4\n-1 -6 2 0\n", "4\n-1 -6 4 0\n", "4\n-1 -11 1 0\n", "4\n-1 -22 1 0\n", "4\n0 -22 1 0\n", "4\n0 -22 2 0\n", "4\n0 -22 2 1\n", "4\n1 -22 2 1\n", "4\n1 -22 2 2\n", "4\n1 -22 2 0\n", "4\n1 -22 2 -1\n", "4\n2 -22 2 -1\n", "4\n2 -22 1 -1\n", "4\n2 -9 1 -1\n", "4\n2 -9 1 -2\n", "4\n2 -12 1 -2\n", "4\n4 -12 1 -2\n", "4\n5 -12 1 -2\n", "4\n5 -12 1 0\n", "4\n5 -17 1 0\n", "4\n9 -17 1 0\n", "4\n9 -17 0 0\n", "4\n13 -17 0 0\n", "4\n16 -17 0 0\n", "4\n5 -17 0 0\n", "4\n5 -17 0 1\n", "4\n9 -17 0 1\n", "4\n8 -17 0 0\n", "4\n6 -17 0 0\n", "4\n6 -17 1 0\n", "4\n6 -17 1 1\n", "4\n6 -8 1 1\n", "4\n6 -8 2 1\n", "4\n6 -8 2 2\n", "4\n6 -12 2 2\n", "4\n6 -17 2 2\n", "4\n6 -17 2 1\n", "4\n6 -17 2 0\n", "4\n12 -17 2 0\n", "4\n12 -17 2 -1\n", "4\n12 -2 2 -1\n", "4\n12 -2 2 -2\n", "4\n12 -1 2 -2\n", "4\n22 -1 2 -2\n", "4\n22 -1 0 -2\n", "4\n22 -2 0 -2\n", "4\n22 -2 0 -1\n", "4\n22 -2 -1 -1\n", "4\n22 0 -1 -1\n", "4\n22 0 -1 -2\n", "4\n34 0 -1 -2\n", "4\n40 0 -1 -2\n", "4\n40 0 -1 -3\n", "4\n40 0 -2 -3\n", "4\n74 0 -2 -3\n", "4\n74 0 -2 0\n", "4\n74 0 -1 0\n", "4\n74 0 -1 1\n", "4\n74 1 -1 1\n", "4\n74 1 -1 2\n", "4\n141 1 -1 2\n", "4\n93 1 -1 2\n", "4\n93 2 -1 2\n", "4\n92 2 -1 2\n", "4\n102 2 -1 2\n", "4\n102 2 -1 4\n", "4\n102 2 -1 1\n", "4\n102 2 0 1\n", "4\n20 11 9 24\n", "4\n20 11 9 24\n" ], "outputs": [ "26 20 22 7 \n", "25 23 22 4 \n", "25 18 19 1 \n", "25 19 18 0 \n", "28 22 23 0 \n", "22 28 23 10 \n", "58 48 59 10 \n", "51 48 50 3 \n", "51 51 49 0 \n", "49 51 51 2 \n", "48 50 51 3 \n", "48 48 49 1 \n", "48 49 48 0 \n", "51 50 48 3 \n", "50 51 48 2 \n", "84 85 86 2 \n", "85 85 87 3 \n", "22 22 20 3 \n", "23 22 21 2 \n", "-24 22 -22 -3 \n", "20 21 21 1 \n", "15 14 14 1 \n", "-16 14 -15 -2 \n", "-15 14 -16 -1 \n", "-14 14 -13 -4 \n", "-3 1 -4 -4 \n", "-4 0 -4 -3 \n", "-3 2 -1 -1 \n", "-3 0 -3 -3 \n", "-4 1 -3 -4 \n", "-4 -2 2 3 \n", "-5 -2 5 4 \n", "-8 -3 5 7 \n", "-2 -5 5 1 \n", "-12 -2 10 11 \n", "-21 -2 21 20 \n", "-21 1 -22 -21 \n", "-24 2 -22 -24 \n", "-23 3 -21 -24 \n", "-23 2 -22 -23 \n", "-22 1 -23 -23 \n", "-24 3 -21 -23 \n", "23 -4 20 -23 \n", "23 -1 23 -22 \n", "20 -4 23 -23 \n", "9 -4 10 -12 \n", "8 -3 11 -12 \n", "11 -3 8 -9 \n", "11 -5 14 -15 \n", "11 -6 15 -16 \n", "-11 4 -15 -16 \n", "-18 4 -22 -21 \n", "-18 8 -26 -25 \n", "-17 9 -26 -26 \n", "-17 13 -30 -30 \n", "-17 16 -1 -1 \n", "-17 5 -22 -22 \n", "-18 4 -21 -22 \n", "-18 8 -25 -26 \n", "-17 8 -25 -25 \n", "-17 6 -23 -23 \n", "-18 7 -23 -24 \n", "-17 6 -24 -24 \n", "-8 6 -1 -1 \n", "-5 5 -1 -4 \n", "-8 6 -4 -4 \n", "-12 6 -16 -16 \n", "-17 6 -21 -21 \n", "-20 5 -24 -21 \n", "-19 4 -23 -21 \n", "-19 14 -29 -31 \n", "18 -15 28 -31 \n", "3 -15 13 -16 \n", "2 -16 12 -16 \n", "3 -16 13 -15 \n", "3 -22 23 -21 \n", "1 -24 23 -23 \n", "0 -24 22 -24 \n", "1 -23 23 -24 \n", "-2 22 23 23 \n", "0 22 -23 -23 \n", "1 23 -24 -23 \n", "1 35 -36 -35 \n", "1 41 -42 -41 \n", "2 42 -43 -41 \n", "3 43 -43 -42 \n", "3 73 -73 -76 \n", "-2 -76 74 -76 \n", "-1 -75 74 -75 \n", "-2 -76 75 -75 \n", "-1 -76 74 -76 \n", "-4 -73 73 -76 \n", "-4 -144 142 -141 \n", "-4 -96 94 -93 \n", "-1 -96 93 -96 \n", "-1 -95 92 -95 \n", "-1 -101 102 -101 \n", "-7 -99 96 -101 \n", "-4 -104 101 -101 \n", "3 103 101 100 \n", "26 5 7 22 \n", "26 5 7 22 \n" ], "question": "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[i]);\n all ^= a[i];\n }\n\n for (int i = 0; i < N; i++)\n printf(\"%d \", a[i] ^ all);\n puts(\"\");\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d \"\n.LC2:\n\t.string\t\"\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tleaq\t-88(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$3, %rax\n\tshrq\t$2, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t$0, -84(%rbp)\n\tmovl\t$0, -80(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-80(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\txorl\t%eax, -84(%rbp)\n\taddl\t$1, -80(%rbp)\n.L5:\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, -80(%rbp)\n\tjl\t.L6\n\tmovl\t$0, -76(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\txorl\t-84(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -76(%rbp)\n.L7:\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjl\t.L8\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\t%rbx, %rsp\n\tmovl\t$0, %eax\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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]; } for (int i = 0; i < N; i++) printf("%d ", a[i] ^ all); puts(""); } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d " .LC2: .string "" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $56, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 13, -40 .cfi_offset 12, -48 .cfi_offset 3, -56 movq %fs:40, %rax movq %rax, -56(%rbp) xorl %eax, %eax movq %rsp, %rax movq %rax, %rbx leaq -88(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -88(%rbp), %eax movslq %eax, %rdx subq $1, %rdx movq %rdx, -72(%rbp) movslq %eax, %rdx movq %rdx, %r14 movl $0, %r15d movslq %eax, %rdx movq %rdx, %r12 movl $0, %r13d cltq leaq 0(,%rax,4), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %esi movl $0, %edx divq %rsi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L2: cmpq %rdx, %rsp je .L3 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L2 .L3: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L4 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L4: movq %rsp, %rax addq $3, %rax shrq $2, %rax salq $2, %rax movq %rax, -64(%rbp) movl $0, -84(%rbp) movl $0, -80(%rbp) jmp .L5 .L6: movl -80(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -64(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -64(%rbp), %rax movl -80(%rbp), %edx movslq %edx, %rdx movl (%rax,%rdx,4), %eax xorl %eax, -84(%rbp) addl $1, -80(%rbp) .L5: movl -88(%rbp), %eax cmpl %eax, -80(%rbp) jl .L6 movl $0, -76(%rbp) jmp .L7 .L8: movq -64(%rbp), %rax movl -76(%rbp), %edx movslq %edx, %rdx movl (%rax,%rdx,4), %eax xorl -84(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT addl $1, -76(%rbp) .L7: movl -88(%rbp), %eax cmpl %eax, -76(%rbp) jl .L8 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movq %rbx, %rsp movl $0, %eax movq -56(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leaq -40(%rbp), %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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;}\nint lcm(int a, int b){ return (a / gcd(a, b)) * b;}\n\n/* a[0], ..., a[n-1] の数の最大公約数 */\nint ngcd(int n, int a[])\n{\n int i, d;\n\n d = a[0];\n for (i = 1; i < n && d != 1; i++)\n d = gcd(a[i], d);\n return d;\n}\n\nvoid quicksort(keytype a[], int first, int last)\n{\n int i, j;\n keytype x, t;\n\n x = a[(first + last) / 2];\n i = first; j = last;\n for ( ; ; ) {\n while (a[i] < x) i++;\n while (x < a[j]) j--;\n if (i >= j) break;\n t = a[i]; a[i] = a[j]; a[j] = t;\n i++; j--;\n }\n if (first < i - 1) quicksort(a, first , i - 1);\n if (j + 1 < last) quicksort(a, j + 1, last);\n}\n\nint is_prime(int x){\n if(x <= 1) return 0;\n for(int i = 2; i * i <= x; i++){\n if(x % i == 0) return 0;\n }\n return 1;\n}\n\nint is_substr(char s[], char t[], int i){\n int flag = 1;\n\n if(s[i] == '\\0') flag = 0;\n\n for(int j = 0; j < strlen(t); ++j, ++i){\n if(s[i] != t[j]){\n flag = 0;\n break;\n }\n }\n return flag;\n}\n\n// factor list, number of factors, natural number\nvoid factorize(int ftr[], int *num, int n){\n int a = 2, cnt = 0;\n\n while(n >= a){\n if(n % a == 0){\n n = n / a;\n ftr[cnt++] = a;\n }else{\n a++;\n }\n }\n *num = cnt;\n}\n\n//#define N 5\n//int p[N + 1];\nint nextperm(int p[], int N) /* 辞書式順序で次の順列 */\n{\n int i, j, t;\n\n i = N - 1;\n p[0] = 0; /* 番人 */\n while (p[i] >= p[i + 1]) i--;\n if (i == 0) return 0; /* 完了 */\n j = N;\n while (p[i] >= p[j]) j--;\n t = p[i]; p[i] = p[j]; p[j] = t;\n i++; j = N;\n while (i < j) {\n t = p[i]; p[i] = p[j]; p[j] = t; i++; j--;\n }\n return 1; /* 未了 */\n}\n\nvoid comb(int size1, int size2, int v[size1][size2]){\n for(int i = 0; i < size1; i++){\n v[i][0] = 1;\n v[i][i] = 1;\n }\n for(int k = 1; k < size1; k++){\n for(int j = 1; j < k; j++){\n v[k][j] = (v[k-1][j-1] + v[k-1][j]);\n }\n }\n}\n\nint abs_val(int a, int b){\n if(a > b) return a - b;\n else return b - a;\n}\n\nconst int inf = 1012345678;\nint main(){\n int h, w;\n char a[105][105];\n\n scanf(\"%d %d\", &h, &w);\n for(int i = 0; i < h; ++i){\n scanf(\"%s\", a[i]);\n }\n\n for(int i = 0; i < w + 2; ++i){\n printf(\"#\");\n }\n puts(\"\");\n for(int i = 0; i < h; ++i){\n printf(\"#\");\n printf(\"%s\",a[i]);\n printf(\"#\\n\");\n }\n for(int i = 0; i < w + 2; ++i){\n printf(\"#\");\n }\n puts(\"\");\n\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tjmp\t.L4\n.L2:\n\tmovl\t-8(%rbp), %eax\n.L4:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tgcd, .-gcd\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, %ecx\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tlcm, .-lcm\n\t.globl\tngcd\n\t.type\tngcd, @function\nngcd:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L8:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjge\t.L9\n\tcmpl\t$1, -4(%rbp)\n\tjne\t.L10\n.L9:\n\tmovl\t-4(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tngcd, .-ngcd\n\t.globl\tquicksort\n\t.type\tquicksort, @function\nquicksort:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t%edx, -32(%rbp)\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-32(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -10(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L13\n.L14:\n\taddl\t$1, -8(%rbp)\n.L13:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, -10(%rbp)\n\tjg\t.L14\n\tjmp\t.L15\n.L16:\n\tsubl\t$1, -4(%rbp)\n.L15:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, -10(%rbp)\n\tjl\t.L16\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjge\t.L23\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -9(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-8(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovq\t-24(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, (%rdx)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovzbl\t-9(%rbp), %eax\n\tmovb\t%al, (%rdx)\n\taddl\t$1, -8(%rbp)\n\tsubl\t$1, -4(%rbp)\n\tjmp\t.L13\n.L23:\n\tnop\n\tmovl\t-8(%rbp), %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjge\t.L20\n\tmovl\t-8(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-28(%rbp), %ecx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tquicksort\n.L20:\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tcmpl\t%eax, -32(%rbp)\n\tjle\t.L24\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-32(%rbp), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tquicksort\n.L24:\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tquicksort, .-quicksort\n\t.globl\tis_prime\n\t.type\tis_prime, @function\nis_prime:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tcmpl\t$1, -20(%rbp)\n\tjg\t.L26\n\tmovl\t$0, %eax\n\tjmp\t.L27\n.L26:\n\tmovl\t$2, -4(%rbp)\n\tjmp\t.L28\n.L30:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-4(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L29\n\tmovl\t$0, %eax\n\tjmp\t.L27\n.L29:\n\taddl\t$1, -4(%rbp)\n.L28:\n\tmovl\t-4(%rbp), %eax\n\timull\t%eax, %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L30\n\tmovl\t$1, %eax\n.L27:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tis_prime, .-is_prime\n\t.globl\tis_substr\n\t.type\tis_substr, @function\nis_substr:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t$1, -24(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L32\n\tmovl\t$0, -24(%rbp)\n.L32:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L33\n.L36:\n\tmovl\t-52(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L34\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L35\n.L34:\n\taddl\t$1, -20(%rbp)\n\taddl\t$1, -52(%rbp)\n.L33:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rbx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t%rax, %rbx\n\tjb\t.L36\n.L35:\n\tmovl\t-24(%rbp), %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tis_substr, .-is_substr\n\t.globl\tfactorize\n\t.type\tfactorize, @function\nfactorize:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t%edx, -36(%rbp)\n\tmovl\t$2, -8(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L39\n.L41:\n\tmovl\t-36(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L40\n\tmovl\t-36(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tjmp\t.L39\n.L40:\n\taddl\t$1, -8(%rbp)\n.L39:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjge\t.L41\n\tmovq\t-32(%rbp), %rax\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, (%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tfactorize, .-factorize\n\t.globl\tnextperm\n\t.type\tnextperm, @function\nnextperm:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, (%rax)\n\tjmp\t.L43\n.L44:\n\tsubl\t$1, -12(%rbp)\n.L43:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\taddq\t$1, %rax\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L44\n\tcmpl\t$0, -12(%rbp)\n\tjne\t.L45\n\tmovl\t$0, %eax\n\tjmp\t.L46\n.L45:\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L47\n.L48:\n\tsubl\t$1, -8(%rbp)\n.L47:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L48\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-24(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\taddl\t$1, -12(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L49\n.L50:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-24(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\taddl\t$1, -12(%rbp)\n\tsubl\t$1, -8(%rbp)\n.L49:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjl\t.L50\n\tmovl\t$1, %eax\n.L46:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tnextperm, .-nextperm\n\t.globl\tcomb\n\t.type\tcomb, @function\ncomb:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -52(%rbp)\n\tmovl\t%esi, -56(%rbp)\n\tmovq\t%rdx, -64(%rbp)\n\tmovl\t-56(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$0, %ebx\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L52\n.L53:\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t$1, (%rdx)\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t$1, (%rcx,%rdx,4)\n\taddl\t$1, -36(%rbp)\n.L52:\n\tmovl\t-36(%rbp), %edx\n\tcmpl\t-52(%rbp), %edx\n\tjl\t.L53\n\tmovl\t$1, -32(%rbp)\n\tjmp\t.L54\n.L57:\n\tmovl\t$1, -28(%rbp)\n\tjmp\t.L55\n.L56:\n\tmovl\t-32(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovl\t-28(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rcx,%rdx,4), %edi\n\tmovl\t-32(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovl\t-28(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rcx,%rdx,4), %esi\n\tmovl\t-32(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\taddl\t%edi, %esi\n\tmovl\t-28(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t%esi, (%rcx,%rdx,4)\n\taddl\t$1, -28(%rbp)\n.L55:\n\tmovl\t-28(%rbp), %edx\n\tcmpl\t-32(%rbp), %edx\n\tjl\t.L56\n\taddl\t$1, -32(%rbp)\n.L54:\n\tmovl\t-32(%rbp), %edx\n\tcmpl\t-52(%rbp), %edx\n\tjl\t.L57\n\tnop\n\tnop\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tcomb, .-comb\n\t.globl\tabs_val\n\t.type\tabs_val, @function\nabs_val:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L59\n\tmovl\t-4(%rbp), %eax\n\tsubl\t-8(%rbp), %eax\n\tjmp\t.L60\n.L59:\n\tmovl\t-8(%rbp), %eax\n\tsubl\t-4(%rbp), %eax\n.L60:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tabs_val, .-abs_val\n\t.globl\tinf\n\t.section\t.rodata\n\t.align 4\n\t.type\tinf, @object\n\t.size\tinf, 4\ninf:\n\t.long\t1012345678\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%s\"\n.LC2:\n\t.string\t\"\"\n.LC3:\n\t.string\t\"#\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$2880, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-11060(%rbp), %rdx\n\tleaq\t-11064(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -11056(%rbp)\n\tjmp\t.L62\n.L63:\n\tleaq\t-11040(%rbp), %rcx\n\tmovl\t-11056(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -11056(%rbp)\n.L62:\n\tmovl\t-11064(%rbp), %eax\n\tcmpl\t%eax, -11056(%rbp)\n\tjl\t.L63\n\tmovl\t$0, -11052(%rbp)\n\tjmp\t.L64\n.L65:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -11052(%rbp)\n.L64:\n\tmovl\t-11060(%rbp), %eax\n\taddl\t$1, %eax\n\tcmpl\t%eax, -11052(%rbp)\n\tjle\t.L65\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, -11048(%rbp)\n\tjmp\t.L66\n.L67:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\tleaq\t-11040(%rbp), %rcx\n\tmovl\t-11048(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\taddl\t$1, -11048(%rbp)\n.L66:\n\tmovl\t-11064(%rbp), %eax\n\tcmpl\t%eax, -11048(%rbp)\n\tjl\t.L67\n\tmovl\t$0, -11044(%rbp)\n\tjmp\t.L68\n.L69:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -11044(%rbp)\n.L68:\n\tmovl\t-11060(%rbp), %eax\n\taddl\t$1, %eax\n\tcmpl\t%eax, -11044(%rbp)\n\tjle\t.L69\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L71\n\tcall\t__stack_chk_fail@PLT\n.L71:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.L2\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L6\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%esi, %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tlcm, .-lcm\n\t.p2align 4\n\t.globl\tngcd\n\t.type\tngcd, @function\nngcd:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %r8d\n\tcmpl\t$1, %r8d\n\tje\t.L8\n\tcmpl\t$1, %edi\n\tjle\t.L8\n\tmovl\t$2, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovl\t-4(%rsi,%rcx,4), %eax\n\tmovl\t%r8d, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L10\n\tcmpl\t%ecx, %edi\n\tsetg\t%dl\n\tcmpl\t$1, %r8d\n\tsetne\t%al\n\taddq\t$1, %rcx\n\ttestb\t%al, %dl\n\tjne\t.L11\n.L8:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tngcd, .-ngcd\n\t.p2align 4\n\t.globl\tquicksort\n\t.type\tquicksort, @function\nquicksort:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovq\t%rdi, %r9\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tmovl\t%esi, %r14d\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$120, %rsp\n\t.cfi_def_cfa_offset 176\n\tmovl\t%edx, 48(%rsp)\n.L27:\n\tmovl\t48(%rsp), %edi\n\tmovl\t%r14d, %edx\n\tmovslq\t%r14d, %rbx\n\tmovl\t%r14d, %r11d\n\tleaq\t(%r9,%rbx), %r8\n\taddl\t%edi, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovslq\t%edi, %rax\n.L21:\n\tmovzbl\t(%r8), %ebp\n\tleaq\t(%r9,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%sil, %bpl\n\tjl\t.L22\n\tcmpb\t%dl, %sil\n\tjge\t.L23\n\tleaq\t-1(%r9,%rax), %rax\n\tleal\t-1(%rdi), %r10d\n\tsubl\t%eax, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tleal\t(%r10,%rax), %edi\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tcmpb\t%sil, %dl\n\tjg\t.L24\n.L23:\n\tcmpl\t%edi, %r11d\n\tjge\t.L25\n\tmovb\t%dl, (%r8)\n\tsubl\t$1, %edi\n\tmovb\t%bpl, (%rcx)\n\tmovslq\t%edi, %rax\n.L22:\n\taddq\t$1, %r8\n\taddl\t$1, %r11d\n\tjmp\t.L21\n.L25:\n\tleal\t-1(%r11), %eax\n\tmovl\t%edi, 88(%rsp)\n\tmovl\t%eax, 20(%rsp)\n\tcmpl\t%r14d, %eax\n\tjg\t.L122\n.L35:\n\tmovl\t88(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t48(%rsp), %eax\n\tjl\t.L27\n\taddq\t$120, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L122:\n\t.cfi_restore_state\n\tcltq\n\tmovq\t%rax, 80(%rsp)\n.L26:\n\tmovl\t20(%rsp), %ecx\n\tmovl\t%r14d, %r8d\n\tleaq\t(%r9,%rbx), %rdi\n\tmovl\t%ecx, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t80(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r9,%rax), %r10\n\tmovzbl\t(%r10), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L30\n\tcmpb\t%dl, %sil\n\tjge\t.L31\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tmovq\t%rax, %r10\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ecx\n\tcmpb\t%dl, %sil\n\tjl\t.L32\n.L31:\n\tcmpl\t%ecx, %r8d\n\tjge\t.L33\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ecx\n\tmovb\t%r11b, (%r10)\n\tmovslq\t%ecx, %rax\n.L30:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L29\n.L33:\n\tleal\t-1(%r8), %eax\n\tmovl\t%ecx, 52(%rsp)\n\tmovl\t%eax, 24(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L123\n.L42:\n\tmovl\t52(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 20(%rsp)\n\tjle\t.L35\n\tmovslq\t%eax, %rbx\n\tjmp\t.L26\n.L123:\n\tcltq\n\tmovq\t%r9, %r8\n\tmovq\t%rax, 72(%rsp)\n.L34:\n\tmovl\t24(%rsp), %ecx\n\tmovl\t%r14d, %r10d\n\tleaq\t(%r8,%rbx), %rdi\n\tmovl\t%ecx, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r8,%rax), %esi\n\tmovq\t72(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L36:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r8,%rax), %r9\n\tmovzbl\t(%r9), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L37\n\tcmpb\t%dl, %sil\n\tjge\t.L38\n\tleaq\t-1(%r8,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovq\t%rax, %r9\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ecx\n\tcmpb\t%dl, %sil\n\tjl\t.L39\n.L38:\n\tcmpl\t%r10d, %ecx\n\tjle\t.L40\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ecx\n\tmovb\t%r11b, (%r9)\n\tmovslq\t%ecx, %rax\n.L37:\n\taddq\t$1, %rdi\n\taddl\t$1, %r10d\n\tjmp\t.L36\n.L40:\n\tleal\t-1(%r10), %eax\n\tmovl\t%ecx, 56(%rsp)\n\tmovl\t%eax, 28(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L124\n\tmovl\t56(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 24(%rsp)\n\tjle\t.L114\n.L134:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L34\n.L124:\n\tcltq\n\tmovq\t%r8, %r9\n\tmovq\t%rax, 64(%rsp)\n.L41:\n\tmovl\t28(%rsp), %ecx\n\tmovl\t%r14d, %r8d\n\tleaq\t(%r9,%rbx), %rdi\n\tmovl\t%ecx, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t64(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r9,%rax), %r10\n\tmovzbl\t(%r10), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L44\n\tcmpb\t%dl, %sil\n\tjge\t.L45\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L46:\n\tmovq\t%rax, %r10\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ecx\n\tcmpb\t%dl, %sil\n\tjl\t.L46\n.L45:\n\tcmpl\t%ecx, %r8d\n\tjge\t.L47\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ecx\n\tmovb\t%r11b, (%r10)\n\tmovslq\t%ecx, %rax\n.L44:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L43\n.L47:\n\tleal\t-1(%r8), %eax\n\tmovl\t%ecx, 60(%rsp)\n\tmovl\t%eax, 16(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L125\n\tmovl\t60(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 28(%rsp)\n\tjle\t.L115\n.L133:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L41\n.L125:\n\tcltq\n\tmovq\t%r9, %r15\n\tmovq\t%rax, 40(%rsp)\n.L48:\n\tmovl\t16(%rsp), %r8d\n\tmovl\t%r14d, %r10d\n\tleaq\t(%r15,%rbx), %rdi\n\tmovl\t%r8d, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r15,%rax), %esi\n\tmovq\t40(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tmovzbl\t(%rdi), %r9d\n\tleaq\t(%r15,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r9b, %sil\n\tjg\t.L51\n\tcmpb\t%dl, %sil\n\tjge\t.L52\n\tleaq\t-1(%r15,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %r8d\n\tcmpb\t%dl, %sil\n\tjl\t.L53\n.L52:\n\tcmpl\t%r8d, %r10d\n\tjge\t.L54\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %r8d\n\tmovb\t%r9b, (%rcx)\n\tmovslq\t%r8d, %rax\n.L51:\n\taddq\t$1, %rdi\n\taddl\t$1, %r10d\n\tjmp\t.L50\n.L54:\n\tleal\t-1(%r10), %eax\n\tmovl\t%eax, 4(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L126\n\tleal\t1(%r8), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 16(%rsp)\n\tjle\t.L116\n.L132:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L48\n.L126:\n\tcltq\n\tmovl\t%r8d, 92(%rsp)\n\tmovq\t%rax, 32(%rsp)\n.L55:\n\tmovl\t4(%rsp), %r9d\n\tmovl\t%r14d, %r8d\n\tleaq\t(%r15,%rbx), %rdi\n\tmovl\t%r9d, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r15,%rax), %esi\n\tmovq\t32(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L57:\n\tmovzbl\t(%rdi), %r10d\n\tleaq\t(%r15,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r10b, %sil\n\tjg\t.L58\n\tcmpb\t%dl, %sil\n\tjge\t.L59\n\tleaq\t-1(%r15,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L60:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %r9d\n\tcmpb\t%dl, %sil\n\tjl\t.L60\n.L59:\n\tcmpl\t%r9d, %r8d\n\tjge\t.L61\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %r9d\n\tmovb\t%r10b, (%rcx)\n\tmovslq\t%r9d, %rax\n.L58:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L57\n.L61:\n\tleal\t-1(%r8), %eax\n\tmovl\t%eax, (%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L127\n\tleal\t1(%r9), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 4(%rsp)\n\tjle\t.L117\n.L131:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L55\n.L127:\n\tcltq\n\tmovl\t%r9d, 96(%rsp)\n\tmovl\t%r14d, %r10d\n\tmovq\t%rax, 8(%rsp)\n.L62:\n\tmovl\t(%rsp), %r12d\n\tleaq\t(%r15,%rbx), %rdi\n\tmovl\t%r10d, %r14d\n\tleal\t(%r12,%r10), %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r15,%rax), %esi\n\tmovq\t8(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovzbl\t(%rdi), %r8d\n\tleaq\t(%r15,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r8b, %sil\n\tjg\t.L65\n\tcmpb\t%dl, %sil\n\tjge\t.L66\n\tleaq\t-1(%r15,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %r12d\n\tcmpb\t%dl, %sil\n\tjl\t.L67\n.L66:\n\tcmpl\t%r12d, %r14d\n\tjge\t.L68\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %r12d\n\tmovb\t%r8b, (%rcx)\n\tmovslq\t%r12d, %rax\n.L65:\n\taddq\t$1, %rdi\n\taddl\t$1, %r14d\n\tjmp\t.L64\n.L68:\n\tsubl\t$1, %r14d\n\tcmpl\t%r14d, %r10d\n\tjl\t.L128\n\tleal\t1(%r12), %r10d\n\tcmpl\t%r10d, (%rsp)\n\tjle\t.L118\n.L130:\n\tmovslq\t%r10d, %rbx\n\tjmp\t.L62\n.L128:\n\tmovl\t%r12d, 100(%rsp)\n\tmovslq\t%r14d, %rax\n\tmovq\t%r15, %r9\n\tmovq\t%rax, %r15\n.L69:\n\tleal\t(%r14,%r10), %edx\n\tleaq\t(%r9,%rbx), %r8\n\tmovl\t%r10d, %r13d\n\tmovl\t%r14d, %ebp\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t%r15, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L71:\n\tmovzbl\t(%r8), %edi\n\tleaq\t(%r9,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%dil, %sil\n\tjg\t.L72\n\tcmpb\t%dl, %sil\n\tjge\t.L73\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ebp\n\tcmpb\t%dl, %sil\n\tjl\t.L74\n.L73:\n\tcmpl\t%ebp, %r13d\n\tjge\t.L75\n\tmovb\t%dl, (%r8)\n\tsubl\t$1, %ebp\n\tmovb\t%dil, (%rcx)\n\tmovslq\t%ebp, %rax\n.L72:\n\taddq\t$1, %r8\n\taddl\t$1, %r13d\n\tjmp\t.L71\n.L75:\n\tsubl\t$1, %r13d\n\tmovslq\t%r13d, %r12\n\tcmpl\t%r13d, %r10d\n\tjl\t.L76\n.L84:\n\tleal\t1(%rbp), %r10d\n\tcmpl\t%r10d, %r14d\n\tjle\t.L119\n\tmovslq\t%r10d, %rbx\n\tjmp\t.L69\n\t.p2align 4,,10\n\t.p2align 3\n.L82:\n\tleal\t-1(%r8), %edx\n\tcmpl\t%edx, %r10d\n\tjl\t.L129\n.L83:\n\tleal\t1(%rbx), %r10d\n\tcmpl\t%r10d, %r13d\n\tjle\t.L84\n\tmovslq\t%r10d, %rbx\n.L76:\n\tleal\t0(%r13,%r10), %edx\n\tleaq\t(%r9,%rbx), %rdi\n\tmovl\t%r10d, %r8d\n\tmovl\t%r13d, %ebx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t%r12, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r9,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L79\n\tcmpb\t%dl, %sil\n\tjge\t.L80\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L81:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ebx\n\tcmpb\t%dl, %sil\n\tjl\t.L81\n.L80:\n\tcmpl\t%ebx, %r8d\n\tjge\t.L82\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ebx\n\tmovb\t%r11b, (%rcx)\n\tmovslq\t%ebx, %rax\n.L79:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L78\n.L119:\n\tmovl\t100(%rsp), %r12d\n\tmovq\t%r9, %r15\n\tleal\t1(%r12), %r10d\n\tcmpl\t%r10d, (%rsp)\n\tjg\t.L130\n.L118:\n\tmovl\t96(%rsp), %r9d\n\tleal\t1(%r9), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 4(%rsp)\n\tjg\t.L131\n.L117:\n\tmovl\t92(%rsp), %r8d\n\tleal\t1(%r8), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 16(%rsp)\n\tjg\t.L132\n.L116:\n\tmovl\t60(%rsp), %eax\n\tmovq\t%r15, %r9\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 28(%rsp)\n\tjg\t.L133\n.L115:\n\tmovl\t56(%rsp), %eax\n\tmovq\t%r9, %r8\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 24(%rsp)\n\tjg\t.L134\n.L114:\n\tmovq\t%r8, %r9\n\tjmp\t.L42\n.L129:\n\tmovq\t%r9, %rdi\n\tmovl\t%r10d, %esi\n\tmovq\t%r9, 104(%rsp)\n\tcall\tquicksort\n\tmovq\t104(%rsp), %r9\n\tjmp\t.L83\n\t.cfi_endproc\n.LFE54:\n\t.size\tquicksort, .-quicksort\n\t.p2align 4\n\t.globl\tis_prime\n\t.type\tis_prime, @function\nis_prime:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%edx, %edx\n\tcmpl\t$1, %edi\n\tjle\t.L135\n\tcmpl\t$3, %edi\n\tjle\t.L140\n\ttestb\t$1, %dil\n\tje\t.L135\n\tmovl\t$2, %ecx\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tje\t.L135\n.L137:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, %eax\n\timull\t%ecx, %eax\n\tcmpl\t%edi, %eax\n\tjle\t.L138\n.L140:\n\tmovl\t$1, %edx\n.L135:\n\tmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tis_prime, .-is_prime\n\t.p2align 4\n\t.globl\tis_substr\n\t.type\tis_substr, @function\nis_substr:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovq\t%rdi, %r12\n\tmovq\t%rsi, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovl\t%edx, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rsi, %rbx\n\tcall\tstrlen@PLT\n\tmovslq\t%ebp, %rdx\n\txorl\t%ecx, %ecx\n\tleaq\t(%r12,%rdx), %rsi\n\tjmp\t.L146\n\t.p2align 4,,10\n\t.p2align 3\n.L148:\n\tmovzbl\t(%rsi,%rcx), %r8d\n\taddq\t$1, %rcx\n\tcmpb\t-1(%rbx,%rcx), %r8b\n\tjne\t.L149\n.L146:\n\tcmpq\t%rcx, %rax\n\tjne\t.L148\n\txorl\t%eax, %eax\n\tcmpb\t$0, (%r12,%rdx)\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tsetne\t%al\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L149:\n\t.cfi_restore_state\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tis_substr, .-is_substr\n\t.p2align 4\n\t.globl\tfactorize\n\t.type\tfactorize, @function\nfactorize:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edx, %r8d\n\tcmpl\t$1, %edx\n\tjle\t.L156\n\txorl\t%r9d, %r9d\n\tmovl\t$2, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L155:\n\tmovl\t%r8d, %eax\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L153\n.L159:\n\tmovl\t%eax, %r8d\n\tmovl\t%ecx, (%rdi,%r9,4)\n\tleal\t1(%r9), %eax\n\tcmpl\t%ecx, %r8d\n\tjl\t.L158\n\tmovslq\t%eax, %r9\n\tmovl\t%r8d, %eax\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tje\t.L159\n.L153:\n\taddl\t$1, %ecx\n\tcmpl\t%r8d, %ecx\n\tjle\t.L155\n\tmovl\t%r9d, (%rsi)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L158:\n\tmovl\t%eax, %r9d\n\tmovl\t%r9d, (%rsi)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L156:\n\txorl\t%r9d, %r9d\n\tmovl\t%r9d, (%rsi)\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tfactorize, .-factorize\n\t.p2align 4\n\t.globl\tnextperm\n\t.type\tnextperm, @function\nnextperm:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tmovslq\t%esi, %r12\n\tleal\t-1(%r12), %r14d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tmovslq\t%r14d, %rdx\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tmovl\t%r14d, %r8d\n\tleaq\t0(,%rdx,4), %rbp\n\tmovl\t$0, (%rdi)\n\tleaq\t4(%rbp), %rbx\n\tleaq\t(%rdi,%rbp), %rcx\n\tleaq\t(%rdi,%rbx), %r13\n\tmovl\t(%rcx), %eax\n\tmovl\t0(%r13), %r11d\n\tcmpl\t%r11d, %eax\n\tjl\t.L161\n\tmovl\t-4(%r13), %eax\n\tmovq\t%r12, %r10\n\tleaq\t-4(%rdi,%rdx,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L162:\n\tmovl\t%eax, %r9d\n\tmovl\t(%rsi), %eax\n\tmovl\t%r8d, %edx\n\tmovq\t%rsi, %rcx\n\tleal\t-1(%r8), %r8d\n\tleaq\t-4(%rsi), %rsi\n\tcmpl\t%r9d, %eax\n\tjge\t.L162\n\ttestl\t%r8d, %r8d\n\tje\t.L160\n\tcmpl\t%r11d, %eax\n\tjl\t.L164\n\tleaq\t-4(%rdi,%r12,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L165:\n\tmovq\t%rsi, %r13\n\tmovl\t(%rsi), %r11d\n\tsubq\t$4, %rsi\n\tcmpl\t%r11d, %eax\n\tjge\t.L165\n.L164:\n\tmovl\t%r11d, (%rcx)\n\tmovl\t%eax, 0(%r13)\n\tcmpl\t%edx, %r10d\n\tjle\t.L171\n\tsubl\t%edx, %r14d\n\tmovslq\t%edx, %r8\n\tleaq\t8(%rbp), %r9\n\tmovl\t%r14d, %r13d\n\tleaq\t0(,%r8,4), %rsi\n\tshrl\t%r13d\n\tleal\t1(%r13), %eax\n\tleaq\t(%rax,%r8), %rcx\n\tmovq\t%rax, %r11\n\tnegq\t%rax\n\tsalq\t$2, %rcx\n\tleaq\t(%r9,%rax,4), %rax\n\tcmpq\t%rax, %rcx\n\tsetle\t%al\n\tcmpq\t%r9, %rsi\n\tsetge\t%cl\n\torb\t%cl, %al\n\tje\t.L184\n\tcmpl\t$1, %r14d\n\tjbe\t.L184\n\tcmpl\t$5, %r14d\n\tjbe\t.L176\n\tmovl\t%r11d, %ecx\n\taddq\t%rdi, %rsi\n\tleaq\t-8(%rdi,%rbp), %rax\n\tshrl\t$2, %ecx\n\tleal\t-1(%rcx), %r9d\n\tleaq\t16(%rsi), %rcx\n\tsalq\t$4, %r9\n\taddq\t%rcx, %r9\n\tjmp\t.L169\n\t.p2align 4,,10\n\t.p2align 3\n.L194:\n\taddq\t$16, %rcx\n.L169:\n\tmovdqu\t(%rsi), %xmm0\n\tmovdqu\t(%rax), %xmm2\n\tsubq\t$16, %rax\n\tpshufd\t$27, %xmm2, %xmm1\n\tpshufd\t$27, %xmm0, %xmm0\n\tmovups\t%xmm1, (%rsi)\n\tmovq\t%rcx, %rsi\n\tmovups\t%xmm0, 16(%rax)\n\tcmpq\t%r9, %rcx\n\tjne\t.L194\n\tmovl\t%r11d, %eax\n\tandl\t$-4, %eax\n\taddl\t%eax, %edx\n\tsubl\t%eax, %r10d\n\tcmpl\t%eax, %r11d\n\tje\t.L171\n.L168:\n\tsubl\t%eax, %r11d\n\tcmpl\t%eax, %r13d\n\tje\t.L173\n\taddq\t%rax, %r8\n\tnotq\t%rax\n\tleaq\t(%rbx,%rax,4), %rax\n\tleaq\t(%rdi,%r8,4), %rcx\n\taddq\t%rdi, %rax\n\tmovq\t(%rcx), %xmm0\n\tmovq\t(%rax), %xmm1\n\tpshufd\t$225, %xmm0, %xmm0\n\tpshufd\t$225, %xmm1, %xmm1\n\tmovq\t%xmm1, (%rcx)\n\tmovq\t%xmm0, (%rax)\n\tmovl\t%r11d, %eax\n\tandl\t$-2, %eax\n\taddl\t%eax, %edx\n\tsubl\t%eax, %r10d\n\tcmpl\t%eax, %r11d\n\tje\t.L171\n.L173:\n\tmovslq\t%edx, %rdx\n\tmovslq\t%r10d, %r10\n\tleaq\t(%rdi,%rdx,4), %rdx\n\tleaq\t(%rdi,%r10,4), %rax\n\tmovl\t(%rdx), %ecx\n\tmovl\t(%rax), %esi\n\tmovl\t%esi, (%rdx)\n\tmovl\t%ecx, (%rax)\n.L171:\n\tmovl\t$1, %r8d\n.L160:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tmovl\t%r8d, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L184:\n\t.cfi_restore_state\n\tmovl\t(%rdi,%r8,4), %eax\n\tmovl\t(%rdi,%r12,4), %edx\n\tmovl\t%edx, (%rdi,%r8,4)\n\taddq\t$1, %r8\n\tmovl\t%eax, (%rdi,%r12,4)\n\tsubq\t$1, %r12\n\tcmpl\t%r8d, %r12d\n\tjg\t.L184\n\tjmp\t.L171\n\t.p2align 4,,10\n\t.p2align 3\n.L161:\n\ttestl\t%r14d, %r14d\n\tje\t.L160\n\tmovl\t%r11d, (%rcx)\n\tmovl\t%eax, 0(%r13)\n\tjmp\t.L171\n.L176:\n\txorl\t%eax, %eax\n\tjmp\t.L168\n\t.cfi_endproc\n.LFE58:\n\t.size\tnextperm, .-nextperm\n\t.p2align 4\n\t.globl\tcomb\n\t.type\tcomb, @function\ncomb:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%edi, %edi\n\tjle\t.L229\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovq\t%rdx, %r8\n\tmovq\t%rdx, %rcx\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovslq\t%esi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\t0(,%r12,4), %rsi\n\tmovl\t%edi, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t4(%rsi), %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L199:\n\taddl\t$1, %eax\n\tmovl\t$1, (%rcx)\n\taddq\t%rsi, %rcx\n\tmovl\t$1, (%rdx)\n\taddq\t%rdi, %rdx\n\tcmpl\t%eax, %ebp\n\tjne\t.L199\n\tcmpl\t$1, %ebp\n\tjle\t.L195\n\tcmpl\t$2, %ebp\n\tje\t.L195\n\tleaq\t1(%r12), %r13\n\tsubl\t$1, %ebp\n\tmovq\t%r12, %r9\n\tmovl\t$1, %edi\n\tleaq\t0(,%r12,4), %rbx\n\tmovl\t$2, %r10d\n\tleaq\t(%r8,%rbx), %rdx\n\tleaq\t4(%rbx), %r11\n\tmovq\t%rdx, -16(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L210:\n\tleaq\t(%rdx,%rbx), %rsi\n\tcmpq\t$12, %rbx\n\tjbe\t.L214\n\tcmpl\t$1, %edi\n\tje\t.L214\n\tleal\t-1(%rdi), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L213\n\tmovq\t-16(%rsp), %rax\n\tmovl\t%edi, %ecx\n\tleaq\t(%r8,%r11), %r15\n\tshrl\t$2, %ecx\n\tleaq\t(%r11,%rax), %r14\n\tsalq\t$4, %rcx\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L204:\n\tmovdqu\t(%rdx,%rax), %xmm0\n\tmovdqu\t(%r15,%rax), %xmm2\n\tpaddd\t%xmm2, %xmm0\n\tmovups\t%xmm0, (%r14,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rcx, %rax\n\tjne\t.L204\n\tmovl\t%edi, %ecx\n\tandl\t$-4, %ecx\n\tleal\t1(%rcx), %eax\n\tcmpl\t%edi, %ecx\n\tje\t.L209\n.L203:\n\tmovl\t%edi, %r15d\n\tsubl\t%ecx, %r15d\n\tcmpl\t$1, %r15d\n\tje\t.L206\n\tleaq\t(%r9,%rcx), %r14\n\tmovq\t4(%r8,%r14,4), %xmm0\n\tmovq\t(%r8,%r14,4), %xmm1\n\tleaq\t0(%r13,%r9), %r14\n\taddq\t%rcx, %r14\n\tmovl\t%r15d, %ecx\n\tpaddd\t%xmm1, %xmm0\n\tandl\t$-2, %ecx\n\taddl\t%ecx, %eax\n\tmovq\t%xmm0, (%r8,%r14,4)\n\tcmpl\t%ecx, %r15d\n\tje\t.L209\n.L206:\n\tmovslq\t%eax, %rcx\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t(%rdx,%rcx,4), %r14d\n\taddl\t(%rdx,%rax,4), %r14d\n\tmovl\t%r14d, (%rsi,%rcx,4)\n.L209:\n\taddl\t$1, %edi\n\tmovq\t%rsi, %rdx\n\taddq\t$1, %r10\n\taddq\t%rbx, %r11\n\taddq\t%r12, %r9\n\tcmpl\t%edi, %ebp\n\tjne\t.L210\n.L195:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L214:\n\t.cfi_restore_state\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L208:\n\tmovl\t(%rdx,%rax,4), %ecx\n\taddl\t-4(%rdx,%rax,4), %ecx\n\tmovl\t%ecx, (%rsi,%rax,4)\n\taddq\t$1, %rax\n\tcmpq\t%r10, %rax\n\tjne\t.L208\n\tjmp\t.L209\n.L213:\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %eax\n\tjmp\t.L203\n.L229:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\t.cfi_restore 6\n\t.cfi_restore 12\n\t.cfi_restore 13\n\t.cfi_restore 14\n\t.cfi_restore 15\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tcomb, .-comb\n\t.p2align 4\n\t.globl\tabs_val\n\t.type\tabs_val, @function\nabs_val:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\tsubl\t%esi, %edx\n\tsubl\t%edi, %eax\n\tcmpl\t%esi, %edi\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tabs_val, .-abs_val\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%s\"\n.LC2:\n\t.string\t\"\"\n.LC3:\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.LFB61:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 4144\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 8240\n\torq\t$0, (%rsp)\n\tsubq\t$2864, %rsp\n\t.cfi_def_cfa_offset 11104\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 11048(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %edx\n\ttestl\t%edx, %edx\n\tjle\t.L234\n\tleaq\t16(%rsp), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L235:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$105, %rbp\n\tcmpl\t%ebx, 8(%rsp)\n\tjg\t.L235\n.L234:\n\tcmpl\t$-1, 12(%rsp)\n\tjl\t.L236\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L237:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\tmovl\t%ebx, %eax\n\taddl\t$1, %ebx\n\tcmpl\t%eax, 12(%rsp)\n\tjge\t.L237\n.L236:\n\tleaq\t.LC2(%rip), %r13\n\tmovq\t%r13, %rdi\n\tcall\tputs@PLT\n\tmovl\t8(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L238\n\tleaq\t16(%rsp), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %r12\n\tleaq\t.LC3(%rip), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L239:\n\tmovl\t$35, %edi\n\taddl\t$1, %ebx\n\tcall\tputchar@PLT\n\tmovq\t%rbp, %rdx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$105, %rbp\n\tcall\t__printf_chk@PLT\n\tmovq\t%r14, %rdi\n\tcall\tputs@PLT\n\tcmpl\t%ebx, 8(%rsp)\n\tjg\t.L239\n.L238:\n\tcmpl\t$-1, 12(%rsp)\n\tjl\t.L240\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L241:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\tmovl\t%ebx, %eax\n\taddl\t$1, %ebx\n\tcmpl\t%eax, 12(%rsp)\n\tjge\t.L241\n.L240:\n\tmovq\t%r13, %rdi\n\tcall\tputs@PLT\n\tmovq\t11048(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L248\n\taddq\t$11056, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L248:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE61:\n\t.size\tmain, .-main\n\t.globl\tinf\n\t.section\t.rodata\n\t.align 4\n\t.type\tinf, @object\n\t.size\tinf, 4\ninf:\n\t.long\t1012345678\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L6\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%esi, %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tlcm, .-lcm\n\t.p2align 4\n\t.globl\tngcd\n\t.type\tngcd, @function\nngcd:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %r8d\n\tcmpl\t$1, %r8d\n\tje\t.L8\n\tcmpl\t$1, %edi\n\tjle\t.L8\n\tmovl\t$2, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovl\t-4(%rsi,%rcx,4), %eax\n\tmovl\t%r8d, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L10\n\tcmpl\t%ecx, %edi\n\tsetg\t%dl\n\tcmpl\t$1, %r8d\n\tsetne\t%al\n\taddq\t$1, %rcx\n\ttestb\t%al, %dl\n\tjne\t.L11\n.L8:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tngcd, .-ngcd\n\t.p2align 4\n\t.globl\tquicksort\n\t.type\tquicksort, @function\nquicksort:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovq\t%rdi, %r9\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tmovl\t%esi, %r14d\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$120, %rsp\n\t.cfi_def_cfa_offset 176\n\tmovl\t%edx, 48(%rsp)\n.L27:\n\tmovl\t48(%rsp), %edi\n\tmovl\t%r14d, %edx\n\tmovslq\t%r14d, %rbx\n\tmovl\t%r14d, %r11d\n\tleaq\t(%r9,%rbx), %r8\n\taddl\t%edi, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovslq\t%edi, %rax\n.L21:\n\tmovzbl\t(%r8), %ebp\n\tleaq\t(%r9,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%sil, %bpl\n\tjl\t.L22\n\tcmpb\t%dl, %sil\n\tjge\t.L23\n\tleaq\t-1(%r9,%rax), %rax\n\tleal\t-1(%rdi), %r10d\n\tsubl\t%eax, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tleal\t(%r10,%rax), %edi\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tcmpb\t%sil, %dl\n\tjg\t.L24\n.L23:\n\tcmpl\t%edi, %r11d\n\tjge\t.L25\n\tmovb\t%dl, (%r8)\n\tsubl\t$1, %edi\n\tmovb\t%bpl, (%rcx)\n\tmovslq\t%edi, %rax\n.L22:\n\taddq\t$1, %r8\n\taddl\t$1, %r11d\n\tjmp\t.L21\n.L25:\n\tleal\t-1(%r11), %eax\n\tmovl\t%edi, 88(%rsp)\n\tmovl\t%eax, 20(%rsp)\n\tcmpl\t%r14d, %eax\n\tjg\t.L122\n.L35:\n\tmovl\t88(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t48(%rsp), %eax\n\tjl\t.L27\n\taddq\t$120, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L122:\n\t.cfi_restore_state\n\tcltq\n\tmovq\t%rax, 80(%rsp)\n.L26:\n\tmovl\t20(%rsp), %ecx\n\tmovl\t%r14d, %r8d\n\tleaq\t(%r9,%rbx), %rdi\n\tmovl\t%ecx, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t80(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r9,%rax), %r10\n\tmovzbl\t(%r10), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L30\n\tcmpb\t%dl, %sil\n\tjge\t.L31\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tmovq\t%rax, %r10\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ecx\n\tcmpb\t%dl, %sil\n\tjl\t.L32\n.L31:\n\tcmpl\t%ecx, %r8d\n\tjge\t.L33\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ecx\n\tmovb\t%r11b, (%r10)\n\tmovslq\t%ecx, %rax\n.L30:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L29\n.L33:\n\tleal\t-1(%r8), %eax\n\tmovl\t%ecx, 52(%rsp)\n\tmovl\t%eax, 24(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L123\n.L42:\n\tmovl\t52(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 20(%rsp)\n\tjle\t.L35\n\tmovslq\t%eax, %rbx\n\tjmp\t.L26\n.L123:\n\tcltq\n\tmovq\t%r9, %r8\n\tmovq\t%rax, 72(%rsp)\n.L34:\n\tmovl\t24(%rsp), %ecx\n\tmovl\t%r14d, %r10d\n\tleaq\t(%r8,%rbx), %rdi\n\tmovl\t%ecx, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r8,%rax), %esi\n\tmovq\t72(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L36:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r8,%rax), %r9\n\tmovzbl\t(%r9), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L37\n\tcmpb\t%dl, %sil\n\tjge\t.L38\n\tleaq\t-1(%r8,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovq\t%rax, %r9\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ecx\n\tcmpb\t%dl, %sil\n\tjl\t.L39\n.L38:\n\tcmpl\t%r10d, %ecx\n\tjle\t.L40\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ecx\n\tmovb\t%r11b, (%r9)\n\tmovslq\t%ecx, %rax\n.L37:\n\taddq\t$1, %rdi\n\taddl\t$1, %r10d\n\tjmp\t.L36\n.L40:\n\tleal\t-1(%r10), %eax\n\tmovl\t%ecx, 56(%rsp)\n\tmovl\t%eax, 28(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L124\n\tmovl\t56(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 24(%rsp)\n\tjle\t.L114\n.L134:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L34\n.L124:\n\tcltq\n\tmovq\t%r8, %r9\n\tmovq\t%rax, 64(%rsp)\n.L41:\n\tmovl\t28(%rsp), %ecx\n\tmovl\t%r14d, %r8d\n\tleaq\t(%r9,%rbx), %rdi\n\tmovl\t%ecx, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t64(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r9,%rax), %r10\n\tmovzbl\t(%r10), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L44\n\tcmpb\t%dl, %sil\n\tjge\t.L45\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L46:\n\tmovq\t%rax, %r10\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ecx\n\tcmpb\t%dl, %sil\n\tjl\t.L46\n.L45:\n\tcmpl\t%ecx, %r8d\n\tjge\t.L47\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ecx\n\tmovb\t%r11b, (%r10)\n\tmovslq\t%ecx, %rax\n.L44:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L43\n.L47:\n\tleal\t-1(%r8), %eax\n\tmovl\t%ecx, 60(%rsp)\n\tmovl\t%eax, 16(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L125\n\tmovl\t60(%rsp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 28(%rsp)\n\tjle\t.L115\n.L133:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L41\n.L125:\n\tcltq\n\tmovq\t%r9, %r15\n\tmovq\t%rax, 40(%rsp)\n.L48:\n\tmovl\t16(%rsp), %r8d\n\tmovl\t%r14d, %r10d\n\tleaq\t(%r15,%rbx), %rdi\n\tmovl\t%r8d, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r15,%rax), %esi\n\tmovq\t40(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tmovzbl\t(%rdi), %r9d\n\tleaq\t(%r15,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r9b, %sil\n\tjg\t.L51\n\tcmpb\t%dl, %sil\n\tjge\t.L52\n\tleaq\t-1(%r15,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %r8d\n\tcmpb\t%dl, %sil\n\tjl\t.L53\n.L52:\n\tcmpl\t%r8d, %r10d\n\tjge\t.L54\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %r8d\n\tmovb\t%r9b, (%rcx)\n\tmovslq\t%r8d, %rax\n.L51:\n\taddq\t$1, %rdi\n\taddl\t$1, %r10d\n\tjmp\t.L50\n.L54:\n\tleal\t-1(%r10), %eax\n\tmovl\t%eax, 4(%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L126\n\tleal\t1(%r8), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 16(%rsp)\n\tjle\t.L116\n.L132:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L48\n.L126:\n\tcltq\n\tmovl\t%r8d, 92(%rsp)\n\tmovq\t%rax, 32(%rsp)\n.L55:\n\tmovl\t4(%rsp), %r9d\n\tmovl\t%r14d, %r8d\n\tleaq\t(%r15,%rbx), %rdi\n\tmovl\t%r9d, %edx\n\taddl\t%r14d, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r15,%rax), %esi\n\tmovq\t32(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L57:\n\tmovzbl\t(%rdi), %r10d\n\tleaq\t(%r15,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r10b, %sil\n\tjg\t.L58\n\tcmpb\t%dl, %sil\n\tjge\t.L59\n\tleaq\t-1(%r15,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L60:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %r9d\n\tcmpb\t%dl, %sil\n\tjl\t.L60\n.L59:\n\tcmpl\t%r9d, %r8d\n\tjge\t.L61\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %r9d\n\tmovb\t%r10b, (%rcx)\n\tmovslq\t%r9d, %rax\n.L58:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L57\n.L61:\n\tleal\t-1(%r8), %eax\n\tmovl\t%eax, (%rsp)\n\tcmpl\t%eax, %r14d\n\tjl\t.L127\n\tleal\t1(%r9), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 4(%rsp)\n\tjle\t.L117\n.L131:\n\tmovslq\t%eax, %rbx\n\tjmp\t.L55\n.L127:\n\tcltq\n\tmovl\t%r9d, 96(%rsp)\n\tmovl\t%r14d, %r10d\n\tmovq\t%rax, 8(%rsp)\n.L62:\n\tmovl\t(%rsp), %r12d\n\tleaq\t(%r15,%rbx), %rdi\n\tmovl\t%r10d, %r14d\n\tleal\t(%r12,%r10), %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r15,%rax), %esi\n\tmovq\t8(%rsp), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovzbl\t(%rdi), %r8d\n\tleaq\t(%r15,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r8b, %sil\n\tjg\t.L65\n\tcmpb\t%dl, %sil\n\tjge\t.L66\n\tleaq\t-1(%r15,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %r12d\n\tcmpb\t%dl, %sil\n\tjl\t.L67\n.L66:\n\tcmpl\t%r12d, %r14d\n\tjge\t.L68\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %r12d\n\tmovb\t%r8b, (%rcx)\n\tmovslq\t%r12d, %rax\n.L65:\n\taddq\t$1, %rdi\n\taddl\t$1, %r14d\n\tjmp\t.L64\n.L68:\n\tsubl\t$1, %r14d\n\tcmpl\t%r14d, %r10d\n\tjl\t.L128\n\tleal\t1(%r12), %r10d\n\tcmpl\t%r10d, (%rsp)\n\tjle\t.L118\n.L130:\n\tmovslq\t%r10d, %rbx\n\tjmp\t.L62\n.L128:\n\tmovl\t%r12d, 100(%rsp)\n\tmovslq\t%r14d, %rax\n\tmovq\t%r15, %r9\n\tmovq\t%rax, %r15\n.L69:\n\tleal\t(%r14,%r10), %edx\n\tleaq\t(%r9,%rbx), %r8\n\tmovl\t%r10d, %r13d\n\tmovl\t%r14d, %ebp\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t%r15, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L71:\n\tmovzbl\t(%r8), %edi\n\tleaq\t(%r9,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%dil, %sil\n\tjg\t.L72\n\tcmpb\t%dl, %sil\n\tjge\t.L73\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ebp\n\tcmpb\t%dl, %sil\n\tjl\t.L74\n.L73:\n\tcmpl\t%ebp, %r13d\n\tjge\t.L75\n\tmovb\t%dl, (%r8)\n\tsubl\t$1, %ebp\n\tmovb\t%dil, (%rcx)\n\tmovslq\t%ebp, %rax\n.L72:\n\taddq\t$1, %r8\n\taddl\t$1, %r13d\n\tjmp\t.L71\n.L75:\n\tsubl\t$1, %r13d\n\tmovslq\t%r13d, %r12\n\tcmpl\t%r13d, %r10d\n\tjl\t.L76\n.L84:\n\tleal\t1(%rbp), %r10d\n\tcmpl\t%r10d, %r14d\n\tjle\t.L119\n\tmovslq\t%r10d, %rbx\n\tjmp\t.L69\n\t.p2align 4,,10\n\t.p2align 3\n.L82:\n\tleal\t-1(%r8), %edx\n\tcmpl\t%edx, %r10d\n\tjl\t.L129\n.L83:\n\tleal\t1(%rbx), %r10d\n\tcmpl\t%r10d, %r13d\n\tjle\t.L84\n\tmovslq\t%r10d, %rbx\n.L76:\n\tleal\t0(%r13,%r10), %edx\n\tleaq\t(%r9,%rbx), %rdi\n\tmovl\t%r10d, %r8d\n\tmovl\t%r13d, %ebx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\tmovzbl\t(%r9,%rax), %esi\n\tmovq\t%r12, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovzbl\t(%rdi), %r11d\n\tleaq\t(%r9,%rax), %rcx\n\tmovzbl\t(%rcx), %edx\n\tcmpb\t%r11b, %sil\n\tjg\t.L79\n\tcmpb\t%dl, %sil\n\tjge\t.L80\n\tleaq\t-1(%r9,%rax), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L81:\n\tmovq\t%rax, %rcx\n\tmovzbl\t(%rax), %edx\n\tsubq\t$1, %rax\n\tsubl\t$1, %ebx\n\tcmpb\t%dl, %sil\n\tjl\t.L81\n.L80:\n\tcmpl\t%ebx, %r8d\n\tjge\t.L82\n\tmovb\t%dl, (%rdi)\n\tsubl\t$1, %ebx\n\tmovb\t%r11b, (%rcx)\n\tmovslq\t%ebx, %rax\n.L79:\n\taddq\t$1, %rdi\n\taddl\t$1, %r8d\n\tjmp\t.L78\n.L119:\n\tmovl\t100(%rsp), %r12d\n\tmovq\t%r9, %r15\n\tleal\t1(%r12), %r10d\n\tcmpl\t%r10d, (%rsp)\n\tjg\t.L130\n.L118:\n\tmovl\t96(%rsp), %r9d\n\tleal\t1(%r9), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 4(%rsp)\n\tjg\t.L131\n.L117:\n\tmovl\t92(%rsp), %r8d\n\tleal\t1(%r8), %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 16(%rsp)\n\tjg\t.L132\n.L116:\n\tmovl\t60(%rsp), %eax\n\tmovq\t%r15, %r9\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 28(%rsp)\n\tjg\t.L133\n.L115:\n\tmovl\t56(%rsp), %eax\n\tmovq\t%r9, %r8\n\taddl\t$1, %eax\n\tmovl\t%eax, %r14d\n\tcmpl\t%eax, 24(%rsp)\n\tjg\t.L134\n.L114:\n\tmovq\t%r8, %r9\n\tjmp\t.L42\n.L129:\n\tmovq\t%r9, %rdi\n\tmovl\t%r10d, %esi\n\tmovq\t%r9, 104(%rsp)\n\tcall\tquicksort\n\tmovq\t104(%rsp), %r9\n\tjmp\t.L83\n\t.cfi_endproc\n.LFE54:\n\t.size\tquicksort, .-quicksort\n\t.p2align 4\n\t.globl\tis_prime\n\t.type\tis_prime, @function\nis_prime:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%edx, %edx\n\tcmpl\t$1, %edi\n\tjle\t.L135\n\tcmpl\t$3, %edi\n\tjle\t.L140\n\ttestb\t$1, %dil\n\tje\t.L135\n\tmovl\t$2, %ecx\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tje\t.L135\n.L137:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, %eax\n\timull\t%ecx, %eax\n\tcmpl\t%edi, %eax\n\tjle\t.L138\n.L140:\n\tmovl\t$1, %edx\n.L135:\n\tmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tis_prime, .-is_prime\n\t.p2align 4\n\t.globl\tis_substr\n\t.type\tis_substr, @function\nis_substr:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovq\t%rdi, %r12\n\tmovq\t%rsi, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovl\t%edx, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rsi, %rbx\n\tcall\tstrlen@PLT\n\tmovslq\t%ebp, %rdx\n\txorl\t%ecx, %ecx\n\tleaq\t(%r12,%rdx), %rsi\n\tjmp\t.L146\n\t.p2align 4,,10\n\t.p2align 3\n.L148:\n\tmovzbl\t(%rsi,%rcx), %r8d\n\taddq\t$1, %rcx\n\tcmpb\t-1(%rbx,%rcx), %r8b\n\tjne\t.L149\n.L146:\n\tcmpq\t%rcx, %rax\n\tjne\t.L148\n\txorl\t%eax, %eax\n\tcmpb\t$0, (%r12,%rdx)\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tsetne\t%al\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L149:\n\t.cfi_restore_state\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tis_substr, .-is_substr\n\t.p2align 4\n\t.globl\tfactorize\n\t.type\tfactorize, @function\nfactorize:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edx, %r8d\n\tcmpl\t$1, %edx\n\tjle\t.L156\n\txorl\t%r9d, %r9d\n\tmovl\t$2, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L155:\n\tmovl\t%r8d, %eax\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L153\n.L159:\n\tmovl\t%eax, %r8d\n\tmovl\t%ecx, (%rdi,%r9,4)\n\tleal\t1(%r9), %eax\n\tcmpl\t%ecx, %r8d\n\tjl\t.L158\n\tmovslq\t%eax, %r9\n\tmovl\t%r8d, %eax\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tje\t.L159\n.L153:\n\taddl\t$1, %ecx\n\tcmpl\t%r8d, %ecx\n\tjle\t.L155\n\tmovl\t%r9d, (%rsi)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L158:\n\tmovl\t%eax, %r9d\n\tmovl\t%r9d, (%rsi)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L156:\n\txorl\t%r9d, %r9d\n\tmovl\t%r9d, (%rsi)\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tfactorize, .-factorize\n\t.p2align 4\n\t.globl\tnextperm\n\t.type\tnextperm, @function\nnextperm:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tmovslq\t%esi, %r12\n\tleal\t-1(%r12), %r14d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tmovslq\t%r14d, %rdx\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tmovl\t%r14d, %r8d\n\tleaq\t0(,%rdx,4), %rbp\n\tmovl\t$0, (%rdi)\n\tleaq\t4(%rbp), %rbx\n\tleaq\t(%rdi,%rbp), %rcx\n\tleaq\t(%rdi,%rbx), %r13\n\tmovl\t(%rcx), %eax\n\tmovl\t0(%r13), %r11d\n\tcmpl\t%r11d, %eax\n\tjl\t.L161\n\tmovl\t-4(%r13), %eax\n\tmovq\t%r12, %r10\n\tleaq\t-4(%rdi,%rdx,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L162:\n\tmovl\t%eax, %r9d\n\tmovl\t(%rsi), %eax\n\tmovl\t%r8d, %edx\n\tmovq\t%rsi, %rcx\n\tleal\t-1(%r8), %r8d\n\tleaq\t-4(%rsi), %rsi\n\tcmpl\t%r9d, %eax\n\tjge\t.L162\n\ttestl\t%r8d, %r8d\n\tje\t.L160\n\tcmpl\t%r11d, %eax\n\tjl\t.L164\n\tleaq\t-4(%rdi,%r12,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L165:\n\tmovq\t%rsi, %r13\n\tmovl\t(%rsi), %r11d\n\tsubq\t$4, %rsi\n\tcmpl\t%r11d, %eax\n\tjge\t.L165\n.L164:\n\tmovl\t%r11d, (%rcx)\n\tmovl\t%eax, 0(%r13)\n\tcmpl\t%edx, %r10d\n\tjle\t.L171\n\tsubl\t%edx, %r14d\n\tmovslq\t%edx, %r8\n\tleaq\t8(%rbp), %r9\n\tmovl\t%r14d, %r13d\n\tleaq\t0(,%r8,4), %rsi\n\tshrl\t%r13d\n\tleal\t1(%r13), %eax\n\tleaq\t(%rax,%r8), %rcx\n\tmovq\t%rax, %r11\n\tnegq\t%rax\n\tsalq\t$2, %rcx\n\tleaq\t(%r9,%rax,4), %rax\n\tcmpq\t%rax, %rcx\n\tsetle\t%al\n\tcmpq\t%r9, %rsi\n\tsetge\t%cl\n\torb\t%cl, %al\n\tje\t.L184\n\tcmpl\t$1, %r14d\n\tjbe\t.L184\n\tcmpl\t$5, %r14d\n\tjbe\t.L176\n\tmovl\t%r11d, %ecx\n\taddq\t%rdi, %rsi\n\tleaq\t-8(%rdi,%rbp), %rax\n\tshrl\t$2, %ecx\n\tleal\t-1(%rcx), %r9d\n\tleaq\t16(%rsi), %rcx\n\tsalq\t$4, %r9\n\taddq\t%rcx, %r9\n\tjmp\t.L169\n\t.p2align 4,,10\n\t.p2align 3\n.L194:\n\taddq\t$16, %rcx\n.L169:\n\tmovdqu\t(%rsi), %xmm0\n\tmovdqu\t(%rax), %xmm2\n\tsubq\t$16, %rax\n\tpshufd\t$27, %xmm2, %xmm1\n\tpshufd\t$27, %xmm0, %xmm0\n\tmovups\t%xmm1, (%rsi)\n\tmovq\t%rcx, %rsi\n\tmovups\t%xmm0, 16(%rax)\n\tcmpq\t%r9, %rcx\n\tjne\t.L194\n\tmovl\t%r11d, %eax\n\tandl\t$-4, %eax\n\taddl\t%eax, %edx\n\tsubl\t%eax, %r10d\n\tcmpl\t%eax, %r11d\n\tje\t.L171\n.L168:\n\tsubl\t%eax, %r11d\n\tcmpl\t%eax, %r13d\n\tje\t.L173\n\taddq\t%rax, %r8\n\tnotq\t%rax\n\tleaq\t(%rbx,%rax,4), %rax\n\tleaq\t(%rdi,%r8,4), %rcx\n\taddq\t%rdi, %rax\n\tmovq\t(%rcx), %xmm0\n\tmovq\t(%rax), %xmm1\n\tpshufd\t$225, %xmm0, %xmm0\n\tpshufd\t$225, %xmm1, %xmm1\n\tmovq\t%xmm1, (%rcx)\n\tmovq\t%xmm0, (%rax)\n\tmovl\t%r11d, %eax\n\tandl\t$-2, %eax\n\taddl\t%eax, %edx\n\tsubl\t%eax, %r10d\n\tcmpl\t%eax, %r11d\n\tje\t.L171\n.L173:\n\tmovslq\t%edx, %rdx\n\tmovslq\t%r10d, %r10\n\tleaq\t(%rdi,%rdx,4), %rdx\n\tleaq\t(%rdi,%r10,4), %rax\n\tmovl\t(%rdx), %ecx\n\tmovl\t(%rax), %esi\n\tmovl\t%esi, (%rdx)\n\tmovl\t%ecx, (%rax)\n.L171:\n\tmovl\t$1, %r8d\n.L160:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tmovl\t%r8d, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L184:\n\t.cfi_restore_state\n\tmovl\t(%rdi,%r8,4), %eax\n\tmovl\t(%rdi,%r12,4), %edx\n\tmovl\t%edx, (%rdi,%r8,4)\n\taddq\t$1, %r8\n\tmovl\t%eax, (%rdi,%r12,4)\n\tsubq\t$1, %r12\n\tcmpl\t%r8d, %r12d\n\tjg\t.L184\n\tjmp\t.L171\n\t.p2align 4,,10\n\t.p2align 3\n.L161:\n\ttestl\t%r14d, %r14d\n\tje\t.L160\n\tmovl\t%r11d, (%rcx)\n\tmovl\t%eax, 0(%r13)\n\tjmp\t.L171\n.L176:\n\txorl\t%eax, %eax\n\tjmp\t.L168\n\t.cfi_endproc\n.LFE58:\n\t.size\tnextperm, .-nextperm\n\t.p2align 4\n\t.globl\tcomb\n\t.type\tcomb, @function\ncomb:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%edi, %edi\n\tjle\t.L229\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovq\t%rdx, %r8\n\tmovq\t%rdx, %rcx\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovslq\t%esi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\t0(,%r12,4), %rsi\n\tmovl\t%edi, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t4(%rsi), %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L199:\n\taddl\t$1, %eax\n\tmovl\t$1, (%rcx)\n\taddq\t%rsi, %rcx\n\tmovl\t$1, (%rdx)\n\taddq\t%rdi, %rdx\n\tcmpl\t%eax, %ebp\n\tjne\t.L199\n\tcmpl\t$1, %ebp\n\tjle\t.L195\n\tcmpl\t$2, %ebp\n\tje\t.L195\n\tleaq\t1(%r12), %r13\n\tsubl\t$1, %ebp\n\tmovq\t%r12, %r9\n\tmovl\t$1, %edi\n\tleaq\t0(,%r12,4), %rbx\n\tmovl\t$2, %r10d\n\tleaq\t(%r8,%rbx), %rdx\n\tleaq\t4(%rbx), %r11\n\tmovq\t%rdx, -16(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L210:\n\tleaq\t(%rdx,%rbx), %rsi\n\tcmpq\t$12, %rbx\n\tjbe\t.L214\n\tcmpl\t$1, %edi\n\tje\t.L214\n\tleal\t-1(%rdi), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L213\n\tmovq\t-16(%rsp), %rax\n\tmovl\t%edi, %ecx\n\tleaq\t(%r8,%r11), %r15\n\tshrl\t$2, %ecx\n\tleaq\t(%r11,%rax), %r14\n\tsalq\t$4, %rcx\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L204:\n\tmovdqu\t(%rdx,%rax), %xmm0\n\tmovdqu\t(%r15,%rax), %xmm2\n\tpaddd\t%xmm2, %xmm0\n\tmovups\t%xmm0, (%r14,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rcx, %rax\n\tjne\t.L204\n\tmovl\t%edi, %ecx\n\tandl\t$-4, %ecx\n\tleal\t1(%rcx), %eax\n\tcmpl\t%edi, %ecx\n\tje\t.L209\n.L203:\n\tmovl\t%edi, %r15d\n\tsubl\t%ecx, %r15d\n\tcmpl\t$1, %r15d\n\tje\t.L206\n\tleaq\t(%r9,%rcx), %r14\n\tmovq\t4(%r8,%r14,4), %xmm0\n\tmovq\t(%r8,%r14,4), %xmm1\n\tleaq\t0(%r13,%r9), %r14\n\taddq\t%rcx, %r14\n\tmovl\t%r15d, %ecx\n\tpaddd\t%xmm1, %xmm0\n\tandl\t$-2, %ecx\n\taddl\t%ecx, %eax\n\tmovq\t%xmm0, (%r8,%r14,4)\n\tcmpl\t%ecx, %r15d\n\tje\t.L209\n.L206:\n\tmovslq\t%eax, %rcx\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t(%rdx,%rcx,4), %r14d\n\taddl\t(%rdx,%rax,4), %r14d\n\tmovl\t%r14d, (%rsi,%rcx,4)\n.L209:\n\taddl\t$1, %edi\n\tmovq\t%rsi, %rdx\n\taddq\t$1, %r10\n\taddq\t%rbx, %r11\n\taddq\t%r12, %r9\n\tcmpl\t%edi, %ebp\n\tjne\t.L210\n.L195:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L214:\n\t.cfi_restore_state\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L208:\n\tmovl\t(%rdx,%rax,4), %ecx\n\taddl\t-4(%rdx,%rax,4), %ecx\n\tmovl\t%ecx, (%rsi,%rax,4)\n\taddq\t$1, %rax\n\tcmpq\t%r10, %rax\n\tjne\t.L208\n\tjmp\t.L209\n.L213:\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %eax\n\tjmp\t.L203\n.L229:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\t.cfi_restore 6\n\t.cfi_restore 12\n\t.cfi_restore 13\n\t.cfi_restore 14\n\t.cfi_restore 15\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tcomb, .-comb\n\t.p2align 4\n\t.globl\tabs_val\n\t.type\tabs_val, @function\nabs_val:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\tsubl\t%esi, %edx\n\tsubl\t%edi, %eax\n\tcmpl\t%esi, %edi\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tabs_val, .-abs_val\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%s\"\n.LC2:\n\t.string\t\"\"\n.LC3:\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.LFB61:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 4144\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 8240\n\torq\t$0, (%rsp)\n\tsubq\t$2864, %rsp\n\t.cfi_def_cfa_offset 11104\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 11048(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %edx\n\ttestl\t%edx, %edx\n\tjle\t.L234\n\tleaq\t16(%rsp), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L235:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$105, %rbp\n\tcmpl\t%ebx, 8(%rsp)\n\tjg\t.L235\n.L234:\n\tcmpl\t$-1, 12(%rsp)\n\tjl\t.L236\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L237:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\tmovl\t%ebx, %eax\n\taddl\t$1, %ebx\n\tcmpl\t%eax, 12(%rsp)\n\tjge\t.L237\n.L236:\n\tleaq\t.LC2(%rip), %r13\n\tmovq\t%r13, %rdi\n\tcall\tputs@PLT\n\tmovl\t8(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L238\n\tleaq\t16(%rsp), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %r12\n\tleaq\t.LC3(%rip), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L239:\n\tmovl\t$35, %edi\n\taddl\t$1, %ebx\n\tcall\tputchar@PLT\n\tmovq\t%rbp, %rdx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$105, %rbp\n\tcall\t__printf_chk@PLT\n\tmovq\t%r14, %rdi\n\tcall\tputs@PLT\n\tcmpl\t%ebx, 8(%rsp)\n\tjg\t.L239\n.L238:\n\tcmpl\t$-1, 12(%rsp)\n\tjl\t.L240\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L241:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\tmovl\t%ebx, %eax\n\taddl\t$1, %ebx\n\tcmpl\t%eax, 12(%rsp)\n\tjge\t.L241\n.L240:\n\tmovq\t%r13, %rdi\n\tcall\tputs@PLT\n\tmovq\t11048(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L248\n\taddq\t$11056, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L248:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE61:\n\t.size\tmain, .-main\n\t.globl\tinf\n\t.section\t.rodata\n\t.align 4\n\t.type\tinf, @object\n\t.size\tinf, 4\ninf:\n\t.long\t1012345678\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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;}\nint lcm(int a, int b){ return (a / gcd(a, b)) * b;}\n\n/* a[0], ..., a[n-1] の数の最大公約数 */\nint ngcd(int n, int a[])\n{\n int i, d;\n\n d = a[0];\n for (i = 1; i < n && d != 1; i++)\n d = gcd(a[i], d);\n return d;\n}\n\nvoid quicksort(keytype a[], int first, int last)\n{\n int i, j;\n keytype x, t;\n\n x = a[(first + last) / 2];\n i = first; j = last;\n for ( ; ; ) {\n while (a[i] < x) i++;\n while (x < a[j]) j--;\n if (i >= j) break;\n t = a[i]; a[i] = a[j]; a[j] = t;\n i++; j--;\n }\n if (first < i - 1) quicksort(a, first , i - 1);\n if (j + 1 < last) quicksort(a, j + 1, last);\n}\n\nint is_prime(int x){\n if(x <= 1) return 0;\n for(int i = 2; i * i <= x; i++){\n if(x % i == 0) return 0;\n }\n return 1;\n}\n\nint is_substr(char s[], char t[], int i){\n int flag = 1;\n\n if(s[i] == '\\0') flag = 0;\n\n for(int j = 0; j < strlen(t); ++j, ++i){\n if(s[i] != t[j]){\n flag = 0;\n break;\n }\n }\n return flag;\n}\n\n// factor list, number of factors, natural number\nvoid factorize(int ftr[], int *num, int n){\n int a = 2, cnt = 0;\n\n while(n >= a){\n if(n % a == 0){\n n = n / a;\n ftr[cnt++] = a;\n }else{\n a++;\n }\n }\n *num = cnt;\n}\n\n//#define N 5\n//int p[N + 1];\nint nextperm(int p[], int N) /* 辞書式順序で次の順列 */\n{\n int i, j, t;\n\n i = N - 1;\n p[0] = 0; /* 番人 */\n while (p[i] >= p[i + 1]) i--;\n if (i == 0) return 0; /* 完了 */\n j = N;\n while (p[i] >= p[j]) j--;\n t = p[i]; p[i] = p[j]; p[j] = t;\n i++; j = N;\n while (i < j) {\n t = p[i]; p[i] = p[j]; p[j] = t; i++; j--;\n }\n return 1; /* 未了 */\n}\n\nvoid comb(int size1, int size2, int v[size1][size2]){\n for(int i = 0; i < size1; i++){\n v[i][0] = 1;\n v[i][i] = 1;\n }\n for(int k = 1; k < size1; k++){\n for(int j = 1; j < k; j++){\n v[k][j] = (v[k-1][j-1] + v[k-1][j]);\n }\n }\n}\n\nint abs_val(int a, int b){\n if(a > b) return a - b;\n else return b - a;\n}\n\nconst int inf = 1012345678;\nint main(){\n int h, w;\n char a[105][105];\n\n scanf(\"%d %d\", &h, &w);\n for(int i = 0; i < h; ++i){\n scanf(\"%s\", a[i]);\n }\n\n for(int i = 0; i < w + 2; ++i){\n printf(\"#\");\n }\n puts(\"\");\n for(int i = 0; i < h; ++i){\n printf(\"#\");\n printf(\"%s\",a[i]);\n printf(\"#\\n\");\n }\n for(int i = 0; i < w + 2; ++i){\n printf(\"#\");\n }\n puts(\"\");\n\n return 0;\n}\n", "index": 7, "inputs": [ "2 3\nabc\nbrc\n", "1 1\ny\n", "2 3\nabc\nbqc\n", "0 1\ny\n", "2 1\nabc\nbrc\n", "1 1\nx\n", "1 2\nz\n", "0 2\nz\n", "-2 0\nz\n", "-2 -1\nz\n", "1 -1\nz\n", "1 0\nz\n", "-20 3\nx\n", "-20 5\nx\n", "-20 6\nx\n", "1 0\nv\n", "2 3\nabc\naqc\n", "2 3\nabd\nbqc\n", "2 2\nabc\nbrc\n", "1 1\nw\n", "1 2\n{\n", "1 0\ny\n", "1 0\nx\n", "-20 8\nx\n", "1 -1\nv\n", "2 3\nacb\naqc\n", "1 3\nabd\nbqc\n", "2 2\ncba\nbrc\n", "1 1\nv\n", "1 1\n{\n", "1 2\ny\n", "1 -1\nx\n", "1 0\nu\n", "2 3\n`cb\naqc\n", "2 0\nabd\nbqc\n", "2 2\ncba\ncrb\n", "1 1\n|\n", "1 3\nz\n", "1 4\ny\n", "-2 4\nz\n", "1 -1\ny\n", "1 2\nw\n", "-1 7\nx\n", "1 1\nu\n", "1 0\nt\n", "2 3\n`cb\ncqa\n", "2 -1\nabd\nbqc\n", "2 2\ndba\ncrb\n", "1 3\n{\n", "1 5\ny\n", "1 -2\nz\n", "1 0\n{\n", "1 3\nw\n", "1 -1\n{\n", "-1 14\nx\n", "-5 10\nw\n", "1 2\nx\n", "2 6\n`cb\ncqa\n", "2 -1\nabd\ncqb\n", "2 2\ndba\ncqb\n", "1 -1\n|\n", "1 5\nz\n", "1 3\nv\n", "1 -2\n{\n", "-1 26\nx\n", "2 6\nbc`\ncqa\n", "2 -1\ndba\ncqb\n", "2 2\ndba\nbqc\n", "1 0\nw\n", "1 5\nx\n", "1 2\nv\n", "2 6\ncc`\ncqa\n", "2 -1\ndba\nbqc\n", "2 1\ndba\nbqc\n", "1 3\ny\n", "1 7\nx\n", "-4 9\ny\n", "-1 12\ny\n", "2 6\ncc`\nqca\n", "2 0\ndba\nbqc\n", "2 1\nabd\nbqc\n", "1 3\nx\n", "1 6\nx\n", "1 -1\nu\n", "2 11\ncc`\nqca\n", "2 -1\neba\nbqc\n", "1 4\n|\n", "1 -2\nu\n", "2 18\ncc`\nqca\n", "2 -1\neba\nbrc\n", "2 -1\nfba\nbrc\n", "2 0\nfba\nbrc\n", "1 2\nu\n", "-1 13\nw\n", "2 0\nfaa\nbrc\n", "-2 11\nz\n", "1 3\nu\n", "2 0\nfaa\nbcr\n", "-1 19\nx\n", "1 3\nt\n", "2 3\nabc\narc\n", "2 3\nabc\narc\n", "1 1\nz\n" ], "outputs": [ "#####\n#abc#\n#brc#\n#####\n", "###\n#y#\n###\n", "#####\n#abc#\n#bqc#\n#####\n", "###\n###\n", "###\n#abc#\n#brc#\n###\n", "###\n#x#\n###\n", "####\n#z#\n####\n", "####\n####\n", "##\n##\n", "#\n#\n", "#\n#z#\n#\n", "##\n#z#\n##\n", "#####\n#####\n", "#######\n#######\n", "########\n########\n", "##\n#v#\n##\n", "#####\n#abc#\n#aqc#\n#####\n", "#####\n#abd#\n#bqc#\n#####\n", "####\n#abc#\n#brc#\n####\n", "###\n#w#\n###\n", "####\n#{#\n####\n", "##\n#y#\n##\n", "##\n#x#\n##\n", "##########\n##########\n", "#\n#v#\n#\n", "#####\n#acb#\n#aqc#\n#####\n", "#####\n#abd#\n#####\n", "####\n#cba#\n#brc#\n####\n", "###\n#v#\n###\n", "###\n#{#\n###\n", "####\n#y#\n####\n", "#\n#x#\n#\n", "##\n#u#\n##\n", "#####\n#`cb#\n#aqc#\n#####\n", "##\n#abd#\n#bqc#\n##\n", "####\n#cba#\n#crb#\n####\n", "###\n#|#\n###\n", "#####\n#z#\n#####\n", "######\n#y#\n######\n", "######\n######\n", "#\n#y#\n#\n", "####\n#w#\n####\n", "#########\n#########\n", "###\n#u#\n###\n", "##\n#t#\n##\n", "#####\n#`cb#\n#cqa#\n#####\n", "#\n#abd#\n#bqc#\n#\n", "####\n#dba#\n#crb#\n####\n", "#####\n#{#\n#####\n", "#######\n#y#\n#######\n", "\n#z#\n\n", "##\n#{#\n##\n", "#####\n#w#\n#####\n", "#\n#{#\n#\n", "################\n################\n", "############\n############\n", "####\n#x#\n####\n", "########\n#`cb#\n#cqa#\n########\n", "#\n#abd#\n#cqb#\n#\n", "####\n#dba#\n#cqb#\n####\n", "#\n#|#\n#\n", "#######\n#z#\n#######\n", "#####\n#v#\n#####\n", "\n#{#\n\n", "############################\n############################\n", "########\n#bc`#\n#cqa#\n########\n", "#\n#dba#\n#cqb#\n#\n", "####\n#dba#\n#bqc#\n####\n", "##\n#w#\n##\n", "#######\n#x#\n#######\n", "####\n#v#\n####\n", "########\n#cc`#\n#cqa#\n########\n", "#\n#dba#\n#bqc#\n#\n", "###\n#dba#\n#bqc#\n###\n", "#####\n#y#\n#####\n", "#########\n#x#\n#########\n", "###########\n###########\n", "##############\n##############\n", "########\n#cc`#\n#qca#\n########\n", "##\n#dba#\n#bqc#\n##\n", "###\n#abd#\n#bqc#\n###\n", "#####\n#x#\n#####\n", "########\n#x#\n########\n", "#\n#u#\n#\n", "#############\n#cc`#\n#qca#\n#############\n", "#\n#eba#\n#bqc#\n#\n", "######\n#|#\n######\n", "\n#u#\n\n", "####################\n#cc`#\n#qca#\n####################\n", "#\n#eba#\n#brc#\n#\n", "#\n#fba#\n#brc#\n#\n", "##\n#fba#\n#brc#\n##\n", "####\n#u#\n####\n", "###############\n###############\n", "##\n#faa#\n#brc#\n##\n", "#############\n#############\n", "#####\n#u#\n#####\n", "##\n#faa#\n#bcr#\n##\n", "#####################\n#####################\n", "#####\n#t#\n#####\n", "#####\n#abc#\n#arc#\n#####\n", "#####\n#abc#\n#arc#\n#####\n", "###\n#z#\n###\n" ], "question": "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;}\nint lcm(int a, int b){ return (a / gcd(a, b)) * b;}\n\n/* a[0], ..., a[n-1] の数の最大公約数 */\nint ngcd(int n, int a[])\n{\n int i, d;\n\n d = a[0];\n for (i = 1; i < n && d != 1; i++)\n d = gcd(a[i], d);\n return d;\n}\n\nvoid quicksort(keytype a[], int first, int last)\n{\n int i, j;\n keytype x, t;\n\n x = a[(first + last) / 2];\n i = first; j = last;\n for ( ; ; ) {\n while (a[i] < x) i++;\n while (x < a[j]) j--;\n if (i >= j) break;\n t = a[i]; a[i] = a[j]; a[j] = t;\n i++; j--;\n }\n if (first < i - 1) quicksort(a, first , i - 1);\n if (j + 1 < last) quicksort(a, j + 1, last);\n}\n\nint is_prime(int x){\n if(x <= 1) return 0;\n for(int i = 2; i * i <= x; i++){\n if(x % i == 0) return 0;\n }\n return 1;\n}\n\nint is_substr(char s[], char t[], int i){\n int flag = 1;\n\n if(s[i] == '\\0') flag = 0;\n\n for(int j = 0; j < strlen(t); ++j, ++i){\n if(s[i] != t[j]){\n flag = 0;\n break;\n }\n }\n return flag;\n}\n\n// factor list, number of factors, natural number\nvoid factorize(int ftr[], int *num, int n){\n int a = 2, cnt = 0;\n\n while(n >= a){\n if(n % a == 0){\n n = n / a;\n ftr[cnt++] = a;\n }else{\n a++;\n }\n }\n *num = cnt;\n}\n\n//#define N 5\n//int p[N + 1];\nint nextperm(int p[], int N) /* 辞書式順序で次の順列 */\n{\n int i, j, t;\n\n i = N - 1;\n p[0] = 0; /* 番人 */\n while (p[i] >= p[i + 1]) i--;\n if (i == 0) return 0; /* 完了 */\n j = N;\n while (p[i] >= p[j]) j--;\n t = p[i]; p[i] = p[j]; p[j] = t;\n i++; j = N;\n while (i < j) {\n t = p[i]; p[i] = p[j]; p[j] = t; i++; j--;\n }\n return 1; /* 未了 */\n}\n\nvoid comb(int size1, int size2, int v[size1][size2]){\n for(int i = 0; i < size1; i++){\n v[i][0] = 1;\n v[i][i] = 1;\n }\n for(int k = 1; k < size1; k++){\n for(int j = 1; j < k; j++){\n v[k][j] = (v[k-1][j-1] + v[k-1][j]);\n }\n }\n}\n\nint abs_val(int a, int b){\n if(a > b) return a - b;\n else return b - a;\n}\n\nconst int inf = 1012345678;\nint main(){\n int h, w;\n char a[105][105];\n\n scanf(\"%d %d\", &h, &w);\n for(int i = 0; i < h; ++i){\n scanf(\"%s\", a[i]);\n }\n\n for(int i = 0; i < w + 2; ++i){\n printf(\"#\");\n }\n puts(\"\");\n for(int i = 0; i < h; ++i){\n printf(\"#\");\n printf(\"%s\",a[i]);\n printf(\"#\\n\");\n }\n for(int i = 0; i < w + 2; ++i){\n printf(\"#\");\n }\n puts(\"\");\n\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tjmp\t.L4\n.L2:\n\tmovl\t-8(%rbp), %eax\n.L4:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tgcd, .-gcd\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, %ecx\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tlcm, .-lcm\n\t.globl\tngcd\n\t.type\tngcd, @function\nngcd:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L8:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjge\t.L9\n\tcmpl\t$1, -4(%rbp)\n\tjne\t.L10\n.L9:\n\tmovl\t-4(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tngcd, .-ngcd\n\t.globl\tquicksort\n\t.type\tquicksort, @function\nquicksort:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t%edx, -32(%rbp)\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-32(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -10(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L13\n.L14:\n\taddl\t$1, -8(%rbp)\n.L13:\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, -10(%rbp)\n\tjg\t.L14\n\tjmp\t.L15\n.L16:\n\tsubl\t$1, -4(%rbp)\n.L15:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, -10(%rbp)\n\tjl\t.L16\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjge\t.L23\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -9(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-8(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovq\t-24(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, (%rdx)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovzbl\t-9(%rbp), %eax\n\tmovb\t%al, (%rdx)\n\taddl\t$1, -8(%rbp)\n\tsubl\t$1, -4(%rbp)\n\tjmp\t.L13\n.L23:\n\tnop\n\tmovl\t-8(%rbp), %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjge\t.L20\n\tmovl\t-8(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-28(%rbp), %ecx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tquicksort\n.L20:\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tcmpl\t%eax, -32(%rbp)\n\tjle\t.L24\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-32(%rbp), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tquicksort\n.L24:\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tquicksort, .-quicksort\n\t.globl\tis_prime\n\t.type\tis_prime, @function\nis_prime:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tcmpl\t$1, -20(%rbp)\n\tjg\t.L26\n\tmovl\t$0, %eax\n\tjmp\t.L27\n.L26:\n\tmovl\t$2, -4(%rbp)\n\tjmp\t.L28\n.L30:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-4(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L29\n\tmovl\t$0, %eax\n\tjmp\t.L27\n.L29:\n\taddl\t$1, -4(%rbp)\n.L28:\n\tmovl\t-4(%rbp), %eax\n\timull\t%eax, %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L30\n\tmovl\t$1, %eax\n.L27:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tis_prime, .-is_prime\n\t.globl\tis_substr\n\t.type\tis_substr, @function\nis_substr:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t$1, -24(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L32\n\tmovl\t$0, -24(%rbp)\n.L32:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L33\n.L36:\n\tmovl\t-52(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L34\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L35\n.L34:\n\taddl\t$1, -20(%rbp)\n\taddl\t$1, -52(%rbp)\n.L33:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rbx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t%rax, %rbx\n\tjb\t.L36\n.L35:\n\tmovl\t-24(%rbp), %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tis_substr, .-is_substr\n\t.globl\tfactorize\n\t.type\tfactorize, @function\nfactorize:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t%edx, -36(%rbp)\n\tmovl\t$2, -8(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L39\n.L41:\n\tmovl\t-36(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L40\n\tmovl\t-36(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tjmp\t.L39\n.L40:\n\taddl\t$1, -8(%rbp)\n.L39:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjge\t.L41\n\tmovq\t-32(%rbp), %rax\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, (%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tfactorize, .-factorize\n\t.globl\tnextperm\n\t.type\tnextperm, @function\nnextperm:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, (%rax)\n\tjmp\t.L43\n.L44:\n\tsubl\t$1, -12(%rbp)\n.L43:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\taddq\t$1, %rax\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L44\n\tcmpl\t$0, -12(%rbp)\n\tjne\t.L45\n\tmovl\t$0, %eax\n\tjmp\t.L46\n.L45:\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L47\n.L48:\n\tsubl\t$1, -8(%rbp)\n.L47:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L48\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-24(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\taddl\t$1, -12(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L49\n.L50:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-24(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\taddl\t$1, -12(%rbp)\n\tsubl\t$1, -8(%rbp)\n.L49:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjl\t.L50\n\tmovl\t$1, %eax\n.L46:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tnextperm, .-nextperm\n\t.globl\tcomb\n\t.type\tcomb, @function\ncomb:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -52(%rbp)\n\tmovl\t%esi, -56(%rbp)\n\tmovq\t%rdx, -64(%rbp)\n\tmovl\t-56(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$0, %ebx\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L52\n.L53:\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t$1, (%rdx)\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t$1, (%rcx,%rdx,4)\n\taddl\t$1, -36(%rbp)\n.L52:\n\tmovl\t-36(%rbp), %edx\n\tcmpl\t-52(%rbp), %edx\n\tjl\t.L53\n\tmovl\t$1, -32(%rbp)\n\tjmp\t.L54\n.L57:\n\tmovl\t$1, -28(%rbp)\n\tjmp\t.L55\n.L56:\n\tmovl\t-32(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovl\t-28(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rcx,%rdx,4), %edi\n\tmovl\t-32(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovl\t-28(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rcx,%rdx,4), %esi\n\tmovl\t-32(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\timulq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-64(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\taddl\t%edi, %esi\n\tmovl\t-28(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t%esi, (%rcx,%rdx,4)\n\taddl\t$1, -28(%rbp)\n.L55:\n\tmovl\t-28(%rbp), %edx\n\tcmpl\t-32(%rbp), %edx\n\tjl\t.L56\n\taddl\t$1, -32(%rbp)\n.L54:\n\tmovl\t-32(%rbp), %edx\n\tcmpl\t-52(%rbp), %edx\n\tjl\t.L57\n\tnop\n\tnop\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tcomb, .-comb\n\t.globl\tabs_val\n\t.type\tabs_val, @function\nabs_val:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L59\n\tmovl\t-4(%rbp), %eax\n\tsubl\t-8(%rbp), %eax\n\tjmp\t.L60\n.L59:\n\tmovl\t-8(%rbp), %eax\n\tsubl\t-4(%rbp), %eax\n.L60:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tabs_val, .-abs_val\n\t.globl\tinf\n\t.section\t.rodata\n\t.align 4\n\t.type\tinf, @object\n\t.size\tinf, 4\ninf:\n\t.long\t1012345678\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%s\"\n.LC2:\n\t.string\t\"\"\n.LC3:\n\t.string\t\"#\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$2880, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-11060(%rbp), %rdx\n\tleaq\t-11064(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -11056(%rbp)\n\tjmp\t.L62\n.L63:\n\tleaq\t-11040(%rbp), %rcx\n\tmovl\t-11056(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -11056(%rbp)\n.L62:\n\tmovl\t-11064(%rbp), %eax\n\tcmpl\t%eax, -11056(%rbp)\n\tjl\t.L63\n\tmovl\t$0, -11052(%rbp)\n\tjmp\t.L64\n.L65:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -11052(%rbp)\n.L64:\n\tmovl\t-11060(%rbp), %eax\n\taddl\t$1, %eax\n\tcmpl\t%eax, -11052(%rbp)\n\tjle\t.L65\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, -11048(%rbp)\n\tjmp\t.L66\n.L67:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\tleaq\t-11040(%rbp), %rcx\n\tmovl\t-11048(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\taddl\t$1, -11048(%rbp)\n.L66:\n\tmovl\t-11064(%rbp), %eax\n\tcmpl\t%eax, -11048(%rbp)\n\tjl\t.L67\n\tmovl\t$0, -11044(%rbp)\n\tjmp\t.L68\n.L69:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -11044(%rbp)\n.L68:\n\tmovl\t-11060(%rbp), %eax\n\taddl\t$1, %eax\n\tcmpl\t%eax, -11044(%rbp)\n\tjle\t.L69\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L71\n\tcall\t__stack_chk_fail@PLT\n.L71:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 (a / gcd(a, b)) * b;} /* a[0], ..., a[n-1] の数の最大公約数 */ int ngcd(int n, int a[]) { int i, d; d = a[0]; for (i = 1; i < n && d != 1; i++) d = gcd(a[i], d); return d; } void quicksort(keytype a[], int first, int last) { int i, j; keytype x, t; x = a[(first + last) / 2]; i = first; j = last; for ( ; ; ) { while (a[i] < x) i++; while (x < a[j]) j--; if (i >= j) break; t = a[i]; a[i] = a[j]; a[j] = t; i++; j--; } if (first < i - 1) quicksort(a, first , i - 1); if (j + 1 < last) quicksort(a, j + 1, last); } int is_prime(int x){ if(x <= 1) return 0; for(int i = 2; i * i <= x; i++){ if(x % i == 0) return 0; } return 1; } int is_substr(char s[], char t[], int i){ int flag = 1; if(s[i] == '\0') flag = 0; for(int j = 0; j < strlen(t); ++j, ++i){ if(s[i] != t[j]){ flag = 0; break; } } return flag; } // factor list, number of factors, natural number void factorize(int ftr[], int *num, int n){ int a = 2, cnt = 0; while(n >= a){ if(n % a == 0){ n = n / a; ftr[cnt++] = a; }else{ a++; } } *num = cnt; } //#define N 5 //int p[N + 1]; int nextperm(int p[], int N) /* 辞書式順序で次の順列 */ { int i, j, t; i = N - 1; p[0] = 0; /* 番人 */ while (p[i] >= p[i + 1]) i--; if (i == 0) return 0; /* 完了 */ j = N; while (p[i] >= p[j]) j--; t = p[i]; p[i] = p[j]; p[j] = t; i++; j = N; while (i < j) { t = p[i]; p[i] = p[j]; p[j] = t; i++; j--; } return 1; /* 未了 */ } void comb(int size1, int size2, int v[size1][size2]){ for(int i = 0; i < size1; i++){ v[i][0] = 1; v[i][i] = 1; } for(int k = 1; k < size1; k++){ for(int j = 1; j < k; j++){ v[k][j] = (v[k-1][j-1] + v[k-1][j]); } } } int abs_val(int a, int b){ if(a > b) return a - b; else return b - a; } const int inf = 1012345678; int main(){ int h, w; char a[105][105]; scanf("%d %d", &h, &w); for(int i = 0; i < h; ++i){ scanf("%s", a[i]); } for(int i = 0; i < w + 2; ++i){ printf("#"); } puts(""); for(int i = 0; i < h; ++i){ printf("#"); printf("%s",a[i]); printf("#\n"); } for(int i = 0; i < w + 2; ++i){ printf("#"); } puts(""); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl gcd .type gcd, @function gcd: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %edx, %eax testl %eax, %eax je .L2 movl -4(%rbp), %eax cltd idivl -8(%rbp) movl -8(%rbp), %eax movl %edx, %esi movl %eax, %edi call gcd jmp .L4 .L2: movl -8(%rbp), %eax .L4: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size gcd, .-gcd .globl lcm .type lcm, @function lcm: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -8(%rbp), %edx movl -4(%rbp), %eax movl %edx, %esi movl %eax, %edi call gcd movl %eax, %ecx movl -4(%rbp), %eax cltd idivl %ecx imull -8(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size lcm, .-lcm .globl ngcd .type ngcd, @function ngcd: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movq %rsi, -32(%rbp) movq -32(%rbp), %rax movl (%rax), %eax movl %eax, -4(%rbp) movl $1, -8(%rbp) jmp .L8 .L10: movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -32(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl -4(%rbp), %edx movl %edx, %esi movl %eax, %edi call gcd movl %eax, -4(%rbp) addl $1, -8(%rbp) .L8: movl -8(%rbp), %eax cmpl -20(%rbp), %eax jge .L9 cmpl $1, -4(%rbp) jne .L10 .L9: movl -4(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size ngcd, .-ngcd .globl quicksort .type quicksort, @function quicksort: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movl %esi, -28(%rbp) movl %edx, -32(%rbp) movl -28(%rbp), %edx movl -32(%rbp), %eax addl %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax movb %al, -10(%rbp) movl -28(%rbp), %eax movl %eax, -8(%rbp) movl -32(%rbp), %eax movl %eax, -4(%rbp) jmp .L13 .L14: addl $1, -8(%rbp) .L13: movl -8(%rbp), %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax cmpb %al, -10(%rbp) jg .L14 jmp .L15 .L16: subl $1, -4(%rbp) .L15: movl -4(%rbp), %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax cmpb %al, -10(%rbp) jl .L16 movl -8(%rbp), %eax cmpl -4(%rbp), %eax jge .L23 movl -8(%rbp), %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax movb %al, -9(%rbp) movl -4(%rbp), %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -8(%rbp), %edx movslq %edx, %rcx movq -24(%rbp), %rdx addq %rcx, %rdx movzbl (%rax), %eax movb %al, (%rdx) movl -4(%rbp), %eax movslq %eax, %rdx movq -24(%rbp), %rax addq %rax, %rdx movzbl -9(%rbp), %eax movb %al, (%rdx) addl $1, -8(%rbp) subl $1, -4(%rbp) jmp .L13 .L23: nop movl -8(%rbp), %eax subl $1, %eax cmpl %eax, -28(%rbp) jge .L20 movl -8(%rbp), %eax leal -1(%rax), %edx movl -28(%rbp), %ecx movq -24(%rbp), %rax movl %ecx, %esi movq %rax, %rdi call quicksort .L20: movl -4(%rbp), %eax addl $1, %eax cmpl %eax, -32(%rbp) jle .L24 movl -4(%rbp), %eax leal 1(%rax), %ecx movl -32(%rbp), %edx movq -24(%rbp), %rax movl %ecx, %esi movq %rax, %rdi call quicksort .L24: nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size quicksort, .-quicksort .globl is_prime .type is_prime, @function is_prime: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) cmpl $1, -20(%rbp) jg .L26 movl $0, %eax jmp .L27 .L26: movl $2, -4(%rbp) jmp .L28 .L30: movl -20(%rbp), %eax cltd idivl -4(%rbp) movl %edx, %eax testl %eax, %eax jne .L29 movl $0, %eax jmp .L27 .L29: addl $1, -4(%rbp) .L28: movl -4(%rbp), %eax imull %eax, %eax cmpl %eax, -20(%rbp) jge .L30 movl $1, %eax .L27: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size is_prime, .-is_prime .globl is_substr .type is_substr, @function is_substr: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $56, %rsp .cfi_offset 3, -24 movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movl %edx, -52(%rbp) movl $1, -24(%rbp) movl -52(%rbp), %eax movslq %eax, %rdx movq -40(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax testb %al, %al jne .L32 movl $0, -24(%rbp) .L32: movl $0, -20(%rbp) jmp .L33 .L36: movl -52(%rbp), %eax movslq %eax, %rdx movq -40(%rbp), %rax addq %rdx, %rax movzbl (%rax), %edx movl -20(%rbp), %eax movslq %eax, %rcx movq -48(%rbp), %rax addq %rcx, %rax movzbl (%rax), %eax cmpb %al, %dl je .L34 movl $0, -24(%rbp) jmp .L35 .L34: addl $1, -20(%rbp) addl $1, -52(%rbp) .L33: movl -20(%rbp), %eax movslq %eax, %rbx movq -48(%rbp), %rax movq %rax, %rdi call strlen@PLT cmpq %rax, %rbx jb .L36 .L35: movl -24(%rbp), %eax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size is_substr, .-is_substr .globl factorize .type factorize, @function factorize: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movl %edx, -36(%rbp) movl $2, -8(%rbp) movl $0, -4(%rbp) jmp .L39 .L41: movl -36(%rbp), %eax cltd idivl -8(%rbp) movl %edx, %eax testl %eax, %eax jne .L40 movl -36(%rbp), %eax cltd idivl -8(%rbp) movl %eax, -36(%rbp) movl -4(%rbp), %eax leal 1(%rax), %edx movl %edx, -4(%rbp) cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rax, %rdx movl -8(%rbp), %eax movl %eax, (%rdx) jmp .L39 .L40: addl $1, -8(%rbp) .L39: movl -36(%rbp), %eax cmpl -8(%rbp), %eax jge .L41 movq -32(%rbp), %rax movl -4(%rbp), %edx movl %edx, (%rax) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size factorize, .-factorize .globl nextperm .type nextperm, @function nextperm: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movl %esi, -28(%rbp) movl -28(%rbp), %eax subl $1, %eax movl %eax, -12(%rbp) movq -24(%rbp), %rax movl $0, (%rax) jmp .L43 .L44: subl $1, -12(%rbp) .L43: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -12(%rbp), %eax cltq addq $1, %rax leaq 0(,%rax,4), %rcx movq -24(%rbp), %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jge .L44 cmpl $0, -12(%rbp) jne .L45 movl $0, %eax jmp .L46 .L45: movl -28(%rbp), %eax movl %eax, -8(%rbp) jmp .L47 .L48: subl $1, -8(%rbp) .L47: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -24(%rbp), %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jge .L48 movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -4(%rbp) movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx movq -24(%rbp), %rdx addq %rcx, %rdx movl (%rax), %eax movl %eax, (%rdx) movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rax, %rdx movl -4(%rbp), %eax movl %eax, (%rdx) addl $1, -12(%rbp) movl -28(%rbp), %eax movl %eax, -8(%rbp) jmp .L49 .L50: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -4(%rbp) movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx movq -24(%rbp), %rdx addq %rcx, %rdx movl (%rax), %eax movl %eax, (%rdx) movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rax, %rdx movl -4(%rbp), %eax movl %eax, (%rdx) addl $1, -12(%rbp) subl $1, -8(%rbp) .L49: movl -12(%rbp), %eax cmpl -8(%rbp), %eax jl .L50 movl $1, %eax .L46: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size nextperm, .-nextperm .globl comb .type comb, @function comb: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx .cfi_offset 3, -24 movl %edi, -52(%rbp) movl %esi, -56(%rbp) movq %rdx, -64(%rbp) movl -56(%rbp), %eax movslq %eax, %rdx subq $1, %rdx movq %rdx, -24(%rbp) movslq %eax, %rdx movq %rdx, %rcx movl $0, %ebx movl $0, -36(%rbp) jmp .L52 .L53: movl -36(%rbp), %edx movslq %edx, %rcx movslq %eax, %rdx imulq %rcx, %rdx leaq 0(,%rdx,4), %rcx movq -64(%rbp), %rdx addq %rcx, %rdx movl $1, (%rdx) movl -36(%rbp), %edx movslq %edx, %rcx movslq %eax, %rdx imulq %rcx, %rdx leaq 0(,%rdx,4), %rcx movq -64(%rbp), %rdx addq %rdx, %rcx movl -36(%rbp), %edx movslq %edx, %rdx movl $1, (%rcx,%rdx,4) addl $1, -36(%rbp) .L52: movl -36(%rbp), %edx cmpl -52(%rbp), %edx jl .L53 movl $1, -32(%rbp) jmp .L54 .L57: movl $1, -28(%rbp) jmp .L55 .L56: movl -32(%rbp), %edx subl $1, %edx movslq %edx, %rcx movslq %eax, %rdx imulq %rcx, %rdx leaq 0(,%rdx,4), %rcx movq -64(%rbp), %rdx addq %rdx, %rcx movl -28(%rbp), %edx subl $1, %edx movslq %edx, %rdx movl (%rcx,%rdx,4), %edi movl -32(%rbp), %edx subl $1, %edx movslq %edx, %rcx movslq %eax, %rdx imulq %rcx, %rdx leaq 0(,%rdx,4), %rcx movq -64(%rbp), %rdx addq %rdx, %rcx movl -28(%rbp), %edx movslq %edx, %rdx movl (%rcx,%rdx,4), %esi movl -32(%rbp), %edx movslq %edx, %rcx movslq %eax, %rdx imulq %rcx, %rdx leaq 0(,%rdx,4), %rcx movq -64(%rbp), %rdx addq %rdx, %rcx addl %edi, %esi movl -28(%rbp), %edx movslq %edx, %rdx movl %esi, (%rcx,%rdx,4) addl $1, -28(%rbp) .L55: movl -28(%rbp), %edx cmpl -32(%rbp), %edx jl .L56 addl $1, -32(%rbp) .L54: movl -32(%rbp), %edx cmpl -52(%rbp), %edx jl .L57 nop nop movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size comb, .-comb .globl abs_val .type abs_val, @function abs_val: .LFB15: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jle .L59 movl -4(%rbp), %eax subl -8(%rbp), %eax jmp .L60 .L59: movl -8(%rbp), %eax subl -4(%rbp), %eax .L60: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE15: .size abs_val, .-abs_val .globl inf .section .rodata .align 4 .type inf, @object .size inf, 4 inf: .long 1012345678 .LC0: .string "%d %d" .LC1: .string "%s" .LC2: .string "" .LC3: .string "#" .text .globl main .type main, @function main: .LFB16: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $4096, %rsp orq $0, (%rsp) subq $4096, %rsp orq $0, (%rsp) subq $2880, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -11060(%rbp), %rdx leaq -11064(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -11056(%rbp) jmp .L62 .L63: leaq -11040(%rbp), %rcx movl -11056(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rdx, %rax salq $3, %rax addq %rdx, %rax addq %rcx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -11056(%rbp) .L62: movl -11064(%rbp), %eax cmpl %eax, -11056(%rbp) jl .L63 movl $0, -11052(%rbp) jmp .L64 .L65: movl $35, %edi call putchar@PLT addl $1, -11052(%rbp) .L64: movl -11060(%rbp), %eax addl $1, %eax cmpl %eax, -11052(%rbp) jle .L65 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, -11048(%rbp) jmp .L66 .L67: movl $35, %edi call putchar@PLT leaq -11040(%rbp), %rcx movl -11048(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rdx, %rax salq $3, %rax addq %rdx, %rax addq %rcx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT leaq .LC3(%rip), %rax movq %rax, %rdi call puts@PLT addl $1, -11048(%rbp) .L66: movl -11064(%rbp), %eax cmpl %eax, -11048(%rbp) jl .L67 movl $0, -11044(%rbp) jmp .L68 .L69: movl $35, %edi call putchar@PLT addl $1, -11044(%rbp) .L68: movl -11060(%rbp), %eax addl $1, %eax cmpl %eax, -11044(%rbp) jle .L69 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L71 call __stack_chk_fail@PLT .L71: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE16: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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) return;\n\tmerge_sort(&(x[0]), n/2);\n\tmerge_sort(&(x[n/2]), (n+1)/2);\n\t\n\tint i, p, q;\n\tfor (i = 0, p = 0, q = n/2; i < n; i++) {\n\t\tif (p >= n/2) y[i] = x[q++];\n\t\telse if (q >= n) y[i] = x[p++];\n\t\telse y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];\n\t}\n\tfor (i = 0; i < n; i++) x[i] = y[i];\n}\n\ntypedef struct {\n\tint *par, *size, *height;\n} UF_forest;\n\nvoid UF_initialize(UF_forest *F, int n)\n{\n\tint i;\n\tF->par = (int*)malloc(sizeof(int) * (n + 1));\n\tF->size = (int*)malloc(sizeof(int) * (n + 1));\n\tF->height = (int*)malloc(sizeof(int) * (n + 1));\n\tfor (i = 1; i <= n; i++) {\n\t\tF->par[i] = i;\n\t\tF->size[i] = 1;\n\t\tF->height[i] = 1;\n\t}\n}\n\nvoid UF_merge(UF_forest *F, int u, int v)\n{\n\tfor (; F->par[u] != u; u = F->par[u]);\n\tfor (; F->par[v] != v; v = F->par[v]);\n\tif (u == v) return;\n\telse if (F->height[u] > F->height[v]) {\n\t\tF->par[v] = u;\n\t\tF->size[u] += F->size[v];\n\t} else {\n\t\tF->par[u] = v;\n\t\tF->size[v] += F->size[u];\n\t\tif (F->height[u] == F->height[v]) F->height[v]++;\n\t}\n}\n\nint UF_root(UF_forest *F, int v)\n{\n\tfor (; F->par[v] != v; v = F->par[v]);\n\treturn v;\n}\n\nint main()\n{\n\tint i, u, w, N, M;\n\tscanf(\"%d %d\", &N, &M);\n\t\n\tif (N - 1 - M > N / 2) {\n\t\tprintf(\"Impossible\\n\");\n\t\tfflush(stdout);\n\t\treturn 0;\n\t}\n\t\n\tdata a[100001];\n\tfor (i = 0; i < N; i++) {\n\t\tscanf(\"%d\", &(a[i].key));\n\t\ta[i].id = i + 1;\n\t}\n\tmerge_sort(a, N);\n\t\n\tUF_forest F;\n\tUF_initialize(&F, N);\n\tfor (i = 1; i <= M; i++) {\n\t\tscanf(\"%d %d\", &u, &w);\n\t\tUF_merge(&F, u + 1, w + 1);\n\t}\n\t\n\tint k, r, count[100001] = {}, comp = 0;\n\tlong long ans = 0;\n\tfor (i = 0, k = 0; k < (N - 1 - M) * 2; i++) {\n\t\tr = UF_root(&F, a[i].id);\n\t\tif (count[r] == 0) {\n\t\t\tcomp++;\n\t\t\tcount[r]++;\n\t\t\tans += a[i].key;\n\t\t\tk++;\n\t\t} else if (count[r] < N - 1 - M && (N - 1 - M) * 2 - k > N - M - comp) {\n\t\t\tcount[r]++;\n\t\t\tans += a[i].key;\n\t\t\tk++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmerge_sort\n\t.type\tmerge_sort, @function\nmerge_sort:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tcmpl\t$1, -28(%rbp)\n\tjle\t.L12\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge_sort\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %edx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge_sort\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L4\n.L9:\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L5\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tjmp\t.L6\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L7\n\tmovl\t-8(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -8(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tjmp\t.L6\n.L7:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t-8(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -8(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tjmp\t.L6\n.L8:\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n.L6:\n\taddl\t$1, -12(%rbp)\n.L4:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L9\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\ty.0(%rip), %rax\n\tmovq\t(%rcx,%rax), %rax\n\tmovq\t%rax, (%rdx)\n\taddl\t$1, -12(%rbp)\n.L10:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L11\n\tjmp\t.L1\n.L12:\n\tnop\n.L1:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmerge_sort, .-merge_sort\n\t.globl\tUF_initialize\n\t.type\tUF_initialize, @function\nUF_initialize:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovl\t$1, -4(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$1, (%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$1, (%rax)\n\taddl\t$1, -4(%rbp)\n.L14:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjle\t.L15\n\tnop\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tUF_initialize, .-UF_initialize\n\t.globl\tUF_merge\n\t.type\tUF_merge, @function\nUF_merge:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tmovl\t%edx, -16(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n.L17:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L18\n\tjmp\t.L19\n.L20:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n.L19:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjne\t.L20\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-16(%rbp), %eax\n\tje\t.L24\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L23\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rsi\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\taddl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\tjmp\t.L16\n.L23:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rsi\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\taddl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L16\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tjmp\t.L16\n.L24:\n\tnop\n.L16:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tUF_merge, .-UF_merge\n\t.globl\tUF_root\n\t.type\tUF_root, @function\nUF_root:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n.L26:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L27\n\tmovl\t-12(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tUF_root, .-UF_root\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Impossible\"\n.LC2:\n\t.string\t\"%d\"\n.LC3:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-1196032(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$4080, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-1200092(%rbp), %rdx\n\tleaq\t-1200096(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1200096(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1200092(%rbp), %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-1200096(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, %edx\n\tjle\t.L30\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L40\n.L30:\n\tmovl\t$0, -1200088(%rbp)\n\tjmp\t.L32\n.L33:\n\tleaq\t-800016(%rbp), %rdx\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1200088(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -800012(%rbp,%rax,8)\n\taddl\t$1, -1200088(%rbp)\n.L32:\n\tmovl\t-1200096(%rbp), %eax\n\tcmpl\t%eax, -1200088(%rbp)\n\tjl\t.L33\n\tmovl\t-1200096(%rbp), %edx\n\tleaq\t-800016(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge_sort\n\tmovl\t-1200096(%rbp), %edx\n\tleaq\t-1200064(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tUF_initialize\n\tmovl\t$1, -1200088(%rbp)\n\tjmp\t.L34\n.L35:\n\tleaq\t-1200100(%rbp), %rdx\n\tleaq\t-1200104(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1200100(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200104(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tleaq\t-1200064(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tUF_merge\n\taddl\t$1, -1200088(%rbp)\n.L34:\n\tmovl\t-1200092(%rbp), %eax\n\tcmpl\t%eax, -1200088(%rbp)\n\tjle\t.L35\n\tleaq\t-1200032(%rbp), %rax\n\tmovl\t$400004, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, -1200080(%rbp)\n\tmovq\t$0, -1200072(%rbp)\n\tmovl\t$0, -1200088(%rbp)\n\tmovl\t$0, -1200084(%rbp)\n\tjmp\t.L36\n.L39:\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t-800012(%rbp,%rax,8), %edx\n\tleaq\t-1200064(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tUF_root\n\tmovl\t%eax, -1200076(%rbp)\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L37\n\taddl\t$1, -1200080(%rbp)\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -1200032(%rbp,%rax,4)\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t-800016(%rbp,%rax,8), %eax\n\tcltq\n\taddq\t%rax, -1200072(%rbp)\n\taddl\t$1, -1200084(%rbp)\n\tjmp\t.L38\n.L37:\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\tmovl\t-1200096(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovl\t-1200092(%rbp), %ecx\n\tsubl\t%ecx, %edx\n\tcmpl\t%edx, %eax\n\tjge\t.L38\n\tmovl\t-1200096(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1200092(%rbp), %edx\n\tsubl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t-1200084(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-1200096(%rbp), %eax\n\tmovl\t-1200092(%rbp), %ecx\n\tsubl\t%ecx, %eax\n\tsubl\t-1200080(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L38\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -1200032(%rbp,%rax,4)\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t-800016(%rbp,%rax,8), %eax\n\tcltq\n\taddq\t%rax, -1200072(%rbp)\n\taddl\t$1, -1200084(%rbp)\n.L38:\n\taddl\t$1, -1200088(%rbp)\n.L36:\n\tmovl\t-1200096(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1200092(%rbp), %edx\n\tsubl\t%edx, %eax\n\taddl\t%eax, %eax\n\tcmpl\t%eax, -1200084(%rbp)\n\tjl\t.L39\n\tmovq\t-1200072(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n.L40:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L41\n\tcall\t__stack_chk_fail@PLT\n.L41:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tmain, .-main\n\t.local\ty.0\n\t.comm\ty.0,800008,32\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\t%rdi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovl\t%esi, %ebx\n\tcmpl\t$1, %r12d\n\tje\t.L2\n\tmovl\t%r12d, %esi\n\tcall\tmerge_sort.part.0\n.L2:\n\tleal\t1(%rbx), %esi\n\tsarl\t%esi\n\tcmpl\t$1, %esi\n\tje\t.L3\n\tmovslq\t%r12d, %rax\n\tleaq\t0(%rbp,%rax,8), %rdi\n\tcall\tmerge_sort.part.0\n.L3:\n\ttestl\t%ebx, %ebx\n\tjle\t.L21\n\txorl\t%ecx, %ecx\n\tleaq\ty.0(%rip), %r8\n\tmovl\t%r12d, %edx\n\txorl\t%eax, %eax\n\tmovslq\t%ecx, %rdi\n\tmovq\t%r8, %rsi\n\tleaq\t0(%rbp,%rdi,8), %rdi\n\tcmpl\t%edx, %ebx\n\tjle\t.L23\n.L8:\n\tmovslq\t%edx, %r9\n\tleaq\t0(%rbp,%r9,8), %r9\n\tmovl\t(%r9), %r10d\n\tcmpl\t%r10d, (%rdi)\n\tjl\t.L23\n\tmovq\t(%r9), %rdi\n\taddl\t$1, %edx\n\tmovq\t%rdi, (%rsi)\n.L9:\n\tleal\t1(%rax), %edi\n\tcmpl\t%edi, %ebx\n\tje\t.L7\n\taddq\t$8, %rsi\n\tcmpl\t%ecx, %r12d\n\tjg\t.L25\n\tleal\t1(%rdx), %ecx\n\tmovslq\t%edx, %rdx\n\taddl\t$2, %eax\n\tmovq\t0(%rbp,%rdx,8), %rdx\n\tmovq\t%rdx, (%rsi)\n\tcmpl\t%eax, %ebx\n\tje\t.L7\n\tmovslq\t%ecx, %rdx\n\tcltq\n\tsubq\t%rax, %rdx\n\tleaq\t0(%rbp,%rdx,8), %rcx\n.L11:\n\tmovq\t(%rcx,%rax,8), %rdx\n\tmovq\t%rdx, (%r8,%rax,8)\n\taddq\t$1, %rax\n\tcmpl\t%eax, %ebx\n\tjg\t.L11\n.L7:\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rbp, %rdi\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tmovq\t%r8, %rsi\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tsalq\t$3, %rdx\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tjmp\tmemcpy@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\t.cfi_restore_state\n\tmovl\t%edi, %eax\n\tmovslq\t%ecx, %rdi\n\tleaq\t0(%rbp,%rdi,8), %rdi\n\tcmpl\t%edx, %ebx\n\tjg\t.L8\n.L23:\n\tmovq\t(%rdi), %rdi\n\taddl\t$1, %ecx\n\tmovq\t%rdi, (%rsi)\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE44:\n\t.size\tmerge_sort.part.0, .-merge_sort.part.0\n\t.p2align 4\n\t.globl\tmerge_sort\n\t.type\tmerge_sort, @function\nmerge_sort:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t$1, %esi\n\tjle\t.L26\n\tjmp\tmerge_sort.part.0\n\t.p2align 4,,10\n\t.p2align 3\n.L26:\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tmerge_sort, .-merge_sort\n\t.p2align 4\n\t.globl\tUF_initialize\n\t.type\tUF_initialize, @function\nUF_initialize:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tmovq\t%rdi, %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tleal\t1(%rsi), %r13d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tmovslq\t%r13d, %r13\n\tmovl\t%esi, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tsalq\t$2, %r13\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tmovq\t%r13, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%r13, %rdi\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %rbp\n\tcall\tmalloc@PLT\n\tmovq\t%r13, %rdi\n\tmovq\t%rax, 8(%r14)\n\tmovq\t%rax, %rbx\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 16(%r14)\n\ttestl\t%r12d, %r12d\n\tjle\t.L28\n\tmovq\t%rax, %rdx\n\tleal\t-1(%r12), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L33\n\tmovl\t%r12d, %eax\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovdqa\t.LC1(%rip), %xmm3\n\tshrl\t$2, %eax\n\tmovdqa\t.LC2(%rip), %xmm1\n\tleal\t-1(%rax), %ecx\n\tmovl\t$4, %eax\n\tsalq\t$4, %rcx\n\taddq\t$20, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\tmovdqa\t%xmm0, %xmm2\n\tmovups\t%xmm1, (%rbx,%rax)\n\tpaddd\t%xmm3, %xmm0\n\tmovups\t%xmm2, 0(%rbp,%rax)\n\tmovups\t%xmm1, (%rdx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rax, %rcx\n\tjne\t.L31\n\tmovl\t%r12d, %ecx\n\tandl\t$-4, %ecx\n\tleal\t1(%rcx), %eax\n\tcmpl\t%ecx, %r12d\n\tje\t.L28\n.L30:\n\tmovslq\t%eax, %rsi\n\tmovl\t%eax, 0(%rbp,%rsi,4)\n\tleaq\t0(,%rsi,4), %rcx\n\tmovl\t$1, (%rbx,%rsi,4)\n\tmovl\t$1, (%rdx,%rsi,4)\n\tleal\t1(%rax), %esi\n\tcmpl\t%esi, %r12d\n\tjl\t.L28\n\taddl\t$2, %eax\n\tmovl\t%esi, 4(%rbp,%rcx)\n\tmovl\t$1, 4(%rbx,%rcx)\n\tmovl\t$1, 4(%rdx,%rcx)\n\tcmpl\t%eax, %r12d\n\tjl\t.L28\n\tmovl\t%eax, 8(%rbp,%rcx)\n\tmovl\t$1, 8(%rbx,%rcx)\n\tmovl\t$1, 8(%rdx,%rcx)\n.L28:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L33:\n\t.cfi_restore_state\n\tmovl\t$1, %eax\n\tjmp\t.L30\n\t.cfi_endproc\n.LFE40:\n\t.size\tUF_initialize, .-UF_initialize\n\t.p2align 4\n\t.globl\tUF_merge\n\t.type\tUF_merge, @function\nUF_merge:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %r11\n\tmovq\t(%rdi), %rdi\n\tmovl\t%edx, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L37:\n\tmovslq\t%esi, %rcx\n\tmovl\t%esi, %r9d\n\tsalq\t$2, %rcx\n\tleaq\t(%rdi,%rcx), %r10\n\tmovl\t(%r10), %esi\n\tcmpl\t%r9d, %esi\n\tjne\t.L37\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, %r8d\n\tsalq\t$2, %rdx\n\tleaq\t(%rdi,%rdx), %rsi\n\tmovl\t(%rsi), %eax\n\tcmpl\t%r8d, %eax\n\tjne\t.L38\n\tcmpl\t%eax, %r9d\n\tje\t.L46\n\tmovq\t16(%r11), %rdi\n\tmovq\t8(%r11), %r8\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tleaq\t(%rdi,%rcx), %rbx\n\taddq\t%rdx, %rdi\n\taddq\t%r8, %rdx\n\taddq\t%rcx, %r8\n\tmovl\t(%rdi), %ecx\n\tcmpl\t%ecx, (%rbx)\n\tjle\t.L41\n\tmovl\t%r9d, (%rsi)\n\tmovl\t(%rdx), %eax\n\taddl\t%eax, (%r8)\n.L36:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\t.cfi_restore_state\n\tmovl\t%eax, (%r10)\n\tmovl\t(%r8), %eax\n\taddl\t%eax, (%rdx)\n\tmovl\t(%rdi), %eax\n\tcmpl\t%eax, (%rbx)\n\tjne\t.L36\n\taddl\t$1, %eax\n\tmovl\t%eax, (%rdi)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L46:\n\t.cfi_restore 3\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tUF_merge, .-UF_merge\n\t.p2align 4\n\t.globl\tUF_root\n\t.type\tUF_root, @function\nUF_root:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rcx\n\tmovl\t%esi, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tcltq\n\tmovq\t%rax, %rdx\n\tmovl\t(%rcx,%rax,4), %eax\n\tcmpl\t%edx, %eax\n\tjne\t.L50\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tUF_root, .-UF_root\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC3:\n\t.string\t\"%d %d\"\n.LC4:\n\t.string\t\"Impossible\"\n.LC5:\n\t.string\t\"%d\"\n.LC6:\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.LFB43:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-1196032(%rsp), %r11\n\t.cfi_def_cfa 11, 1196088\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$4056, %rsp\n\t.cfi_def_cfa_offset 1200144\n\tleaq\t.LC3(%rip), %r12\n\tmovq\t%r12, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1200072(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %esi\n\tmovl\t%esi, %eax\n\tleal\t-1(%rsi), %edx\n\tsubl\t12(%rsp), %edx\n\tshrl\t$31, %eax\n\taddl\t%esi, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, %edx\n\tjg\t.L53\n\ttestl\t%esi, %esi\n\tjle\t.L55\n\tleaq\t400064(%rsp), %r14\n\txorl\t%ebx, %ebx\n\tleaq\t.LC5(%rip), %r13\n\tmovq\t%r14, %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L57:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %esi\n\tmovl\t%ebx, 4(%rbp)\n\taddq\t$8, %rbp\n\tcmpl\t%esi, %ebx\n\tjl\t.L57\n\tcmpl\t$1, %esi\n\tjle\t.L55\n\tmovq\t%r14, %rdi\n\tcall\tmerge_sort.part.0\n\tmovl\t8(%rsp), %esi\n.L55:\n\tleaq\t16(%rsp), %rbx\n\tmovq\t%rbx, %rdi\n\tcall\tUF_initialize\n\tmovl\t12(%rsp), %r15d\n\ttestl\t%r15d, %r15d\n\tjle\t.L58\n\tmovl\t$1, %r14d\n\tleaq\t4(%rsp), %r13\n\tmovq\t%rsp, %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L59:\n\tmovq\t%r13, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tmovq\t%rbx, %rdi\n\taddl\t$1, %r14d\n\tleal\t1(%rax), %edx\n\tmovl\t(%rsp), %eax\n\tleal\t1(%rax), %esi\n\tcall\tUF_merge\n\tmovl\t12(%rsp), %r15d\n\tcmpl\t%r14d, %r15d\n\tjge\t.L59\n.L58:\n\tleaq\t48(%rsp), %rdi\n\tmovl\t$400004, %edx\n\txorl\t%esi, %esi\n\tcall\tmemset@PLT\n\tmovl\t8(%rsp), %ebx\n\tleal\t-1(%rbx), %r11d\n\tsubl\t%r15d, %r11d\n\tleal\t(%r11,%r11), %r8d\n\ttestl\t%r8d, %r8d\n\tjle\t.L66\n\tmovq\t16(%rsp), %rcx\n\txorl\t%r9d, %r9d\n\txorl\t%r10d, %r10d\n\txorl\t%edi, %edi\n\tleaq\t400064(%rsp), %rsi\n\tsubl\t%r15d, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovl\t4(%rsi), %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L61:\n\tcltq\n\tmovq\t%rax, %rdx\n\tmovslq\t(%rcx,%rax,4), %rax\n\tcmpl\t%eax, %edx\n\tjne\t.L61\n\tmovl\t48(%rsp,%rax,4), %edx\n\ttestl\t%edx, %edx\n\tjne\t.L62\n\tmovl\t$1, 48(%rsp,%rax,4)\n\tmovslq\t(%rsi), %rax\n\taddl\t$1, %r10d\n\taddl\t$1, %edi\n\taddq\t%rax, %r9\n.L63:\n\taddq\t$8, %rsi\n\tcmpl\t%r8d, %edi\n\tjl\t.L64\n.L60:\n\tmovl\t$1, %edi\n\tmovq\t%r9, %rdx\n\tleaq\t.LC6(%rip), %rsi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n.L56:\n\tmovq\t1200072(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L72\n\taddq\t$1200088, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L62:\n\t.cfi_restore_state\n\tcmpl\t%r11d, %edx\n\tjge\t.L63\n\tmovl\t%r8d, %r12d\n\tmovl\t%ebx, %ebp\n\tsubl\t%edi, %r12d\n\tsubl\t%r10d, %ebp\n\tcmpl\t%ebp, %r12d\n\tjle\t.L63\n\taddl\t$1, %edx\n\taddl\t$1, %edi\n\tmovl\t%edx, 48(%rsp,%rax,4)\n\tmovslq\t(%rsi), %rax\n\taddq\t%rax, %r9\n\tjmp\t.L63\n.L53:\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tjmp\t.L56\n.L66:\n\txorl\t%r9d, %r9d\n\tjmp\t.L60\n.L72:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE43:\n\t.size\tmain, .-main\n\t.local\ty.0\n\t.comm\ty.0,800008,32\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.long\t4\n\t.align 16\n.LC1:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.align 16\n.LC2:\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovl\t%esi, %ebx\n\tcmpl\t$1, %r12d\n\tje\t.L2\n\tmovl\t%r12d, %esi\n\tcall\tmerge_sort.part.0\n.L2:\n\tleal\t1(%rbx), %esi\n\tsarl\t%esi\n\tcmpl\t$1, %esi\n\tje\t.L3\n\tmovslq\t%r12d, %rax\n\tleaq\t0(%rbp,%rax,8), %rdi\n\tcall\tmerge_sort.part.0\n.L3:\n\ttestl\t%ebx, %ebx\n\tjle\t.L21\n\txorl\t%ecx, %ecx\n\tleaq\ty.0(%rip), %r8\n\tmovl\t%r12d, %edx\n\txorl\t%eax, %eax\n\tmovslq\t%ecx, %rdi\n\tmovq\t%r8, %rsi\n\tleaq\t0(%rbp,%rdi,8), %rdi\n\tcmpl\t%edx, %ebx\n\tjle\t.L23\n.L8:\n\tmovslq\t%edx, %r9\n\tleaq\t0(%rbp,%r9,8), %r9\n\tmovl\t(%r9), %r10d\n\tcmpl\t%r10d, (%rdi)\n\tjl\t.L23\n\tmovq\t(%r9), %rdi\n\taddl\t$1, %edx\n\tmovq\t%rdi, (%rsi)\n.L9:\n\tleal\t1(%rax), %edi\n\tcmpl\t%edi, %ebx\n\tje\t.L7\n\taddq\t$8, %rsi\n\tcmpl\t%ecx, %r12d\n\tjg\t.L25\n\tleal\t1(%rdx), %ecx\n\tmovslq\t%edx, %rdx\n\taddl\t$2, %eax\n\tmovq\t0(%rbp,%rdx,8), %rdx\n\tmovq\t%rdx, (%rsi)\n\tcmpl\t%eax, %ebx\n\tje\t.L7\n\tmovslq\t%ecx, %rdx\n\tcltq\n\tsubq\t%rax, %rdx\n\tleaq\t0(%rbp,%rdx,8), %rcx\n.L11:\n\tmovq\t(%rcx,%rax,8), %rdx\n\tmovq\t%rdx, (%r8,%rax,8)\n\taddq\t$1, %rax\n\tcmpl\t%eax, %ebx\n\tjg\t.L11\n.L7:\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rbp, %rdi\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tmovq\t%r8, %rsi\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tsalq\t$3, %rdx\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tjmp\tmemcpy@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\t.cfi_restore_state\n\tmovl\t%edi, %eax\n\tmovslq\t%ecx, %rdi\n\tleaq\t0(%rbp,%rdi,8), %rdi\n\tcmpl\t%edx, %ebx\n\tjg\t.L8\n.L23:\n\tmovq\t(%rdi), %rdi\n\taddl\t$1, %ecx\n\tmovq\t%rdi, (%rsi)\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE44:\n\t.size\tmerge_sort.part.0, .-merge_sort.part.0\n\t.p2align 4\n\t.globl\tmerge_sort\n\t.type\tmerge_sort, @function\nmerge_sort:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t$1, %esi\n\tjle\t.L26\n\tjmp\tmerge_sort.part.0\n\t.p2align 4,,10\n\t.p2align 3\n.L26:\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tmerge_sort, .-merge_sort\n\t.p2align 4\n\t.globl\tUF_initialize\n\t.type\tUF_initialize, @function\nUF_initialize:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tmovq\t%rdi, %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tleal\t1(%rsi), %r13d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tmovslq\t%r13d, %r13\n\tmovl\t%esi, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tsalq\t$2, %r13\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tmovq\t%r13, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%r13, %rdi\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %rbp\n\tcall\tmalloc@PLT\n\tmovq\t%r13, %rdi\n\tmovq\t%rax, 8(%r14)\n\tmovq\t%rax, %rbx\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 16(%r14)\n\ttestl\t%r12d, %r12d\n\tjle\t.L28\n\tmovq\t%rax, %rdx\n\tleal\t-1(%r12), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L33\n\tmovl\t%r12d, %eax\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovdqa\t.LC1(%rip), %xmm3\n\tshrl\t$2, %eax\n\tmovdqa\t.LC2(%rip), %xmm1\n\tleal\t-1(%rax), %ecx\n\tmovl\t$4, %eax\n\tsalq\t$4, %rcx\n\taddq\t$20, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\tmovdqa\t%xmm0, %xmm2\n\tmovups\t%xmm1, (%rbx,%rax)\n\tpaddd\t%xmm3, %xmm0\n\tmovups\t%xmm2, 0(%rbp,%rax)\n\tmovups\t%xmm1, (%rdx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rax, %rcx\n\tjne\t.L31\n\tmovl\t%r12d, %ecx\n\tandl\t$-4, %ecx\n\tleal\t1(%rcx), %eax\n\tcmpl\t%ecx, %r12d\n\tje\t.L28\n.L30:\n\tmovslq\t%eax, %rsi\n\tmovl\t%eax, 0(%rbp,%rsi,4)\n\tleaq\t0(,%rsi,4), %rcx\n\tmovl\t$1, (%rbx,%rsi,4)\n\tmovl\t$1, (%rdx,%rsi,4)\n\tleal\t1(%rax), %esi\n\tcmpl\t%esi, %r12d\n\tjl\t.L28\n\taddl\t$2, %eax\n\tmovl\t%esi, 4(%rbp,%rcx)\n\tmovl\t$1, 4(%rbx,%rcx)\n\tmovl\t$1, 4(%rdx,%rcx)\n\tcmpl\t%eax, %r12d\n\tjl\t.L28\n\tmovl\t%eax, 8(%rbp,%rcx)\n\tmovl\t$1, 8(%rbx,%rcx)\n\tmovl\t$1, 8(%rdx,%rcx)\n.L28:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L33:\n\t.cfi_restore_state\n\tmovl\t$1, %eax\n\tjmp\t.L30\n\t.cfi_endproc\n.LFE40:\n\t.size\tUF_initialize, .-UF_initialize\n\t.p2align 4\n\t.globl\tUF_merge\n\t.type\tUF_merge, @function\nUF_merge:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %r11\n\tmovq\t(%rdi), %rdi\n\tmovl\t%edx, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L37:\n\tmovslq\t%esi, %rcx\n\tmovl\t%esi, %r9d\n\tsalq\t$2, %rcx\n\tleaq\t(%rdi,%rcx), %r10\n\tmovl\t(%r10), %esi\n\tcmpl\t%r9d, %esi\n\tjne\t.L37\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, %r8d\n\tsalq\t$2, %rdx\n\tleaq\t(%rdi,%rdx), %rsi\n\tmovl\t(%rsi), %eax\n\tcmpl\t%r8d, %eax\n\tjne\t.L38\n\tcmpl\t%eax, %r9d\n\tje\t.L46\n\tmovq\t16(%r11), %rdi\n\tmovq\t8(%r11), %r8\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tleaq\t(%rdi,%rcx), %rbx\n\taddq\t%rdx, %rdi\n\taddq\t%r8, %rdx\n\taddq\t%rcx, %r8\n\tmovl\t(%rdi), %ecx\n\tcmpl\t%ecx, (%rbx)\n\tjle\t.L41\n\tmovl\t%r9d, (%rsi)\n\tmovl\t(%rdx), %eax\n\taddl\t%eax, (%r8)\n.L36:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\t.cfi_restore_state\n\tmovl\t%eax, (%r10)\n\tmovl\t(%r8), %eax\n\taddl\t%eax, (%rdx)\n\tmovl\t(%rdi), %eax\n\tcmpl\t%eax, (%rbx)\n\tjne\t.L36\n\taddl\t$1, %eax\n\tmovl\t%eax, (%rdi)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L46:\n\t.cfi_restore 3\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tUF_merge, .-UF_merge\n\t.p2align 4\n\t.globl\tUF_root\n\t.type\tUF_root, @function\nUF_root:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rcx\n\tmovl\t%esi, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tcltq\n\tmovq\t%rax, %rdx\n\tmovl\t(%rcx,%rax,4), %eax\n\tcmpl\t%edx, %eax\n\tjne\t.L50\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tUF_root, .-UF_root\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC3:\n\t.string\t\"%d %d\"\n.LC4:\n\t.string\t\"Impossible\"\n.LC5:\n\t.string\t\"%d\"\n.LC6:\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.LFB43:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-1196032(%rsp), %r11\n\t.cfi_def_cfa 11, 1196088\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$4056, %rsp\n\t.cfi_def_cfa_offset 1200144\n\tleaq\t.LC3(%rip), %r12\n\tmovq\t%r12, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1200072(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %esi\n\tmovl\t%esi, %eax\n\tleal\t-1(%rsi), %edx\n\tsubl\t12(%rsp), %edx\n\tshrl\t$31, %eax\n\taddl\t%esi, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, %edx\n\tjg\t.L53\n\ttestl\t%esi, %esi\n\tjle\t.L55\n\tleaq\t400064(%rsp), %r14\n\txorl\t%ebx, %ebx\n\tleaq\t.LC5(%rip), %r13\n\tmovq\t%r14, %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L57:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %esi\n\tmovl\t%ebx, 4(%rbp)\n\taddq\t$8, %rbp\n\tcmpl\t%esi, %ebx\n\tjl\t.L57\n\tcmpl\t$1, %esi\n\tjle\t.L55\n\tmovq\t%r14, %rdi\n\tcall\tmerge_sort.part.0\n\tmovl\t8(%rsp), %esi\n.L55:\n\tleaq\t16(%rsp), %rbx\n\tmovq\t%rbx, %rdi\n\tcall\tUF_initialize\n\tmovl\t12(%rsp), %r15d\n\ttestl\t%r15d, %r15d\n\tjle\t.L58\n\tmovl\t$1, %r14d\n\tleaq\t4(%rsp), %r13\n\tmovq\t%rsp, %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L59:\n\tmovq\t%r13, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tmovq\t%rbx, %rdi\n\taddl\t$1, %r14d\n\tleal\t1(%rax), %edx\n\tmovl\t(%rsp), %eax\n\tleal\t1(%rax), %esi\n\tcall\tUF_merge\n\tmovl\t12(%rsp), %r15d\n\tcmpl\t%r14d, %r15d\n\tjge\t.L59\n.L58:\n\tleaq\t48(%rsp), %rdi\n\tmovl\t$400004, %edx\n\txorl\t%esi, %esi\n\tcall\tmemset@PLT\n\tmovl\t8(%rsp), %ebx\n\tleal\t-1(%rbx), %r11d\n\tsubl\t%r15d, %r11d\n\tleal\t(%r11,%r11), %r8d\n\ttestl\t%r8d, %r8d\n\tjle\t.L66\n\tmovq\t16(%rsp), %rcx\n\txorl\t%r9d, %r9d\n\txorl\t%r10d, %r10d\n\txorl\t%edi, %edi\n\tleaq\t400064(%rsp), %rsi\n\tsubl\t%r15d, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovl\t4(%rsi), %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L61:\n\tcltq\n\tmovq\t%rax, %rdx\n\tmovslq\t(%rcx,%rax,4), %rax\n\tcmpl\t%eax, %edx\n\tjne\t.L61\n\tmovl\t48(%rsp,%rax,4), %edx\n\ttestl\t%edx, %edx\n\tjne\t.L62\n\tmovl\t$1, 48(%rsp,%rax,4)\n\tmovslq\t(%rsi), %rax\n\taddl\t$1, %r10d\n\taddl\t$1, %edi\n\taddq\t%rax, %r9\n.L63:\n\taddq\t$8, %rsi\n\tcmpl\t%r8d, %edi\n\tjl\t.L64\n.L60:\n\tmovl\t$1, %edi\n\tmovq\t%r9, %rdx\n\tleaq\t.LC6(%rip), %rsi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n.L56:\n\tmovq\t1200072(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L72\n\taddq\t$1200088, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L62:\n\t.cfi_restore_state\n\tcmpl\t%r11d, %edx\n\tjge\t.L63\n\tmovl\t%r8d, %r12d\n\tmovl\t%ebx, %ebp\n\tsubl\t%edi, %r12d\n\tsubl\t%r10d, %ebp\n\tcmpl\t%ebp, %r12d\n\tjle\t.L63\n\taddl\t$1, %edx\n\taddl\t$1, %edi\n\tmovl\t%edx, 48(%rsp,%rax,4)\n\tmovslq\t(%rsi), %rax\n\taddq\t%rax, %r9\n\tjmp\t.L63\n.L53:\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tjmp\t.L56\n.L66:\n\txorl\t%r9d, %r9d\n\tjmp\t.L60\n.L72:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE43:\n\t.size\tmain, .-main\n\t.local\ty.0\n\t.comm\ty.0,800008,32\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.long\t4\n\t.align 16\n.LC1:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.align 16\n.LC2:\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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) return;\n\tmerge_sort(&(x[0]), n/2);\n\tmerge_sort(&(x[n/2]), (n+1)/2);\n\t\n\tint i, p, q;\n\tfor (i = 0, p = 0, q = n/2; i < n; i++) {\n\t\tif (p >= n/2) y[i] = x[q++];\n\t\telse if (q >= n) y[i] = x[p++];\n\t\telse y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];\n\t}\n\tfor (i = 0; i < n; i++) x[i] = y[i];\n}\n\ntypedef struct {\n\tint *par, *size, *height;\n} UF_forest;\n\nvoid UF_initialize(UF_forest *F, int n)\n{\n\tint i;\n\tF->par = (int*)malloc(sizeof(int) * (n + 1));\n\tF->size = (int*)malloc(sizeof(int) * (n + 1));\n\tF->height = (int*)malloc(sizeof(int) * (n + 1));\n\tfor (i = 1; i <= n; i++) {\n\t\tF->par[i] = i;\n\t\tF->size[i] = 1;\n\t\tF->height[i] = 1;\n\t}\n}\n\nvoid UF_merge(UF_forest *F, int u, int v)\n{\n\tfor (; F->par[u] != u; u = F->par[u]);\n\tfor (; F->par[v] != v; v = F->par[v]);\n\tif (u == v) return;\n\telse if (F->height[u] > F->height[v]) {\n\t\tF->par[v] = u;\n\t\tF->size[u] += F->size[v];\n\t} else {\n\t\tF->par[u] = v;\n\t\tF->size[v] += F->size[u];\n\t\tif (F->height[u] == F->height[v]) F->height[v]++;\n\t}\n}\n\nint UF_root(UF_forest *F, int v)\n{\n\tfor (; F->par[v] != v; v = F->par[v]);\n\treturn v;\n}\n\nint main()\n{\n\tint i, u, w, N, M;\n\tscanf(\"%d %d\", &N, &M);\n\t\n\tif (N - 1 - M > N / 2) {\n\t\tprintf(\"Impossible\\n\");\n\t\tfflush(stdout);\n\t\treturn 0;\n\t}\n\t\n\tdata a[100001];\n\tfor (i = 0; i < N; i++) {\n\t\tscanf(\"%d\", &(a[i].key));\n\t\ta[i].id = i + 1;\n\t}\n\tmerge_sort(a, N);\n\t\n\tUF_forest F;\n\tUF_initialize(&F, N);\n\tfor (i = 1; i <= M; i++) {\n\t\tscanf(\"%d %d\", &u, &w);\n\t\tUF_merge(&F, u + 1, w + 1);\n\t}\n\t\n\tint k, r, count[100001] = {}, comp = 0;\n\tlong long ans = 0;\n\tfor (i = 0, k = 0; k < (N - 1 - M) * 2; i++) {\n\t\tr = UF_root(&F, a[i].id);\n\t\tif (count[r] == 0) {\n\t\t\tcomp++;\n\t\t\tcount[r]++;\n\t\t\tans += a[i].key;\n\t\t\tk++;\n\t\t} else if (count[r] < N - 1 - M && (N - 1 - M) * 2 - k > N - M - comp) {\n\t\t\tcount[r]++;\n\t\t\tans += a[i].key;\n\t\t\tk++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\tfflush(stdout);\n\treturn 0;\n}", "index": 6, "inputs": [ "7 5\n1 2 3 4 5 6 10\n3 0\n4 0\n1 2\n1 3\n5 6\n", "5 0\n3 0 4 1 5\n", "1 0\n3 0 4 1 2\n", "7 5\n1 2 3 4 5 6 0\n3 0\n4 0\n1 2\n1 3\n5 6\n", "7 5\n1 2 3 4 5 6 10\n3 0\n4 0\n1 2\n1 3\n5 0\n", "2 0\n3 -1 4 1 5\n", "2 0\n4 -1 4 1 1\n", "2 0\n4 0 1 1 1\n", "2 0\n7 1 4 1 2\n", "2 0\n-1 -1 2 4 0\n", "2 0\n9 1 0 0 2\n", "2 0\n6 0 0 2 2\n", "2 0\n22 0 -2 1 10\n", "2 0\n31 0 -2 1 10\n", "2 0\n39 0 -2 1 10\n", "2 0\n39 1 -2 1 10\n", "2 0\n18 0 -2 1 10\n", "2 0\n39 2 -2 1 10\n", "2 0\n0 -1 8 -1 4\n", "2 0\n18 1 -4 1 10\n", "2 0\n29 1 -1 0 1\n", "2 0\n0 14 1 0 4\n", "2 0\n5 10 2 0 2\n", "2 0\n-1 10 2 0 0\n", "2 0\n7 10 2 -1 0\n", "2 0\n6 6 3 0 1\n", "2 0\n29 0 -1 0 1\n", "7 5\n1 -1 3 4 7 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n", "2 0\n54 1 -2 0 10\n", "2 0\n63 0 -1 1 3\n", "2 0\n34 1 -2 2 11\n", "2 0\n46 0 0 1 7\n", "2 0\n39 3 -2 2 10\n", "2 0\n39 -1 -1 1 7\n", "3 0\n3 0 4 1 5\n", "3 0\n3 0 4 1 3\n", "3 0\n3 0 4 1 2\n", "1 0\n3 0 4 2 2\n", "1 0\n5 0 4 2 2\n", "1 0\n7 0 4 2 2\n", "1 0\n7 0 4 4 2\n", "1 0\n7\n", "5 0\n3 1 4 1 9\n", "5 0\n3 -1 4 1 5\n", "3 0\n3 -1 4 1 5\n", "3 -1\n3 0 4 1 3\n", "3 0\n3 0 4 1 1\n", "1 0\n3 0 4 1 0\n", "1 0\n3 0 4 2 3\n", "1 0\n7 0 4 1 2\n", "1 0\n7 0 4 4 3\n", "7 0\n1 2 3 4 5 6 0\n3 0\n4 0\n1 2\n1 3\n5 6\n", "5 0\n2 1 4 1 9\n", "4 0\n3 -1 4 1 5\n", "3 -1\n3 1 4 1 3\n", "3 0\n3 0 1 1 1\n", "1 0\n3 0 2 1 0\n", "1 0\n3 0 4 3 3\n", "1 0\n7 0 4 0 2\n", "1 0\n7 -1 4 4 3\n", "7 -1\n1 2 3 4 5 6 0\n3 0\n4 0\n1 2\n1 3\n5 6\n", "5 0\n4 1 4 1 9\n", "2 0\n3 -1 4 1 1\n", "4 0\n3 -1 3 1 5\n", "3 -1\n0 1 4 1 3\n", "3 0\n4 0 1 1 1\n", "1 0\n2 0 2 1 0\n", "1 0\n2 0 4 3 3\n", "1 0\n7 0 3 0 2\n", "7 -1\n1 2 3 4 5 6 0\n3 0\n4 0\n1 2\n2 3\n5 6\n", "5 0\n4 1 4 1 0\n", "4 0\n2 -1 3 1 5\n", "3 -1\n0 1 4 1 0\n", "1 0\n0 0 2 1 0\n", "1 0\n2 0 4 3 6\n", "1 0\n7 0 0 0 2\n", "7 -1\n1 2 3 4 5 6 0\n0 0\n4 0\n1 2\n2 3\n5 6\n", "5 0\n4 1 4 1 -1\n", "2 0\n4 -1 4 1 0\n", "4 0\n2 -1 3 0 5\n", "3 -1\n-1 1 4 1 0\n", "1 0\n0 0 2 2 0\n", "1 0\n2 0 4 3 9\n", "1 0\n7 0 0 0 3\n", "7 -1\n1 4 3 4 5 6 0\n0 0\n4 0\n1 2\n2 3\n5 6\n", "5 0\n4 0 4 1 -1\n", "2 0\n4 -1 4 2 0\n", "4 0\n2 -1 3 0 10\n", "5 -1\n-1 1 4 1 0\n", "1 0\n0 0 2 4 0\n", "1 0\n2 0 3 3 9\n", "1 0\n10 0 0 0 3\n", "7 -1\n1 3 3 4 5 6 0\n0 0\n4 0\n1 2\n2 3\n5 6\n", "5 0\n4 0 8 1 -1\n", "2 0\n4 -1 2 2 0\n", "4 0\n2 -1 2 0 10\n", "1 0\n-1 0 2 4 0\n", "2 0\n2 0 3 3 9\n", "1 0\n10 0 0 0 0\n", "7 -1\n1 3 3 4 5 6 0\n0 0\n4 0\n1 2\n2 3\n5 2\n", "1 0\n5\n", "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n", "5 0\n3 1 4 1 5\n", "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n" ], "outputs": [ "7\n", "Impossible\n", "0\n", "1\n", "11\n", "2\n", "3\n", "4\n", "8\n", "-2\n", "10\n", "6\n", "22\n", "31\n", "39\n", "40\n", "18\n", "41\n", "-1\n", "19\n", "30\n", "14\n", "15\n", "9\n", "17\n", "12\n", "29\n", "5\n", "55\n", "63\n", "35\n", "46\n", "42\n", "38\n", "Impossible\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "Impossible\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "Impossible\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "2\n", "Impossible\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "3\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "3\n", "Impossible\n", "Impossible\n", "0\n", "0\n", "0\n", "Impossible\n", "Impossible\n", "3\n", "Impossible\n", "0\n", "2\n", "0\n", "Impossible\n", "0\n", "7\n", "Impossible\n", "7\n" ], "question": "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) return;\n\tmerge_sort(&(x[0]), n/2);\n\tmerge_sort(&(x[n/2]), (n+1)/2);\n\t\n\tint i, p, q;\n\tfor (i = 0, p = 0, q = n/2; i < n; i++) {\n\t\tif (p >= n/2) y[i] = x[q++];\n\t\telse if (q >= n) y[i] = x[p++];\n\t\telse y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];\n\t}\n\tfor (i = 0; i < n; i++) x[i] = y[i];\n}\n\ntypedef struct {\n\tint *par, *size, *height;\n} UF_forest;\n\nvoid UF_initialize(UF_forest *F, int n)\n{\n\tint i;\n\tF->par = (int*)malloc(sizeof(int) * (n + 1));\n\tF->size = (int*)malloc(sizeof(int) * (n + 1));\n\tF->height = (int*)malloc(sizeof(int) * (n + 1));\n\tfor (i = 1; i <= n; i++) {\n\t\tF->par[i] = i;\n\t\tF->size[i] = 1;\n\t\tF->height[i] = 1;\n\t}\n}\n\nvoid UF_merge(UF_forest *F, int u, int v)\n{\n\tfor (; F->par[u] != u; u = F->par[u]);\n\tfor (; F->par[v] != v; v = F->par[v]);\n\tif (u == v) return;\n\telse if (F->height[u] > F->height[v]) {\n\t\tF->par[v] = u;\n\t\tF->size[u] += F->size[v];\n\t} else {\n\t\tF->par[u] = v;\n\t\tF->size[v] += F->size[u];\n\t\tif (F->height[u] == F->height[v]) F->height[v]++;\n\t}\n}\n\nint UF_root(UF_forest *F, int v)\n{\n\tfor (; F->par[v] != v; v = F->par[v]);\n\treturn v;\n}\n\nint main()\n{\n\tint i, u, w, N, M;\n\tscanf(\"%d %d\", &N, &M);\n\t\n\tif (N - 1 - M > N / 2) {\n\t\tprintf(\"Impossible\\n\");\n\t\tfflush(stdout);\n\t\treturn 0;\n\t}\n\t\n\tdata a[100001];\n\tfor (i = 0; i < N; i++) {\n\t\tscanf(\"%d\", &(a[i].key));\n\t\ta[i].id = i + 1;\n\t}\n\tmerge_sort(a, N);\n\t\n\tUF_forest F;\n\tUF_initialize(&F, N);\n\tfor (i = 1; i <= M; i++) {\n\t\tscanf(\"%d %d\", &u, &w);\n\t\tUF_merge(&F, u + 1, w + 1);\n\t}\n\t\n\tint k, r, count[100001] = {}, comp = 0;\n\tlong long ans = 0;\n\tfor (i = 0, k = 0; k < (N - 1 - M) * 2; i++) {\n\t\tr = UF_root(&F, a[i].id);\n\t\tif (count[r] == 0) {\n\t\t\tcomp++;\n\t\t\tcount[r]++;\n\t\t\tans += a[i].key;\n\t\t\tk++;\n\t\t} else if (count[r] < N - 1 - M && (N - 1 - M) * 2 - k > N - M - comp) {\n\t\t\tcount[r]++;\n\t\t\tans += a[i].key;\n\t\t\tk++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmerge_sort\n\t.type\tmerge_sort, @function\nmerge_sort:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tcmpl\t$1, -28(%rbp)\n\tjle\t.L12\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge_sort\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %edx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge_sort\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L4\n.L9:\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L5\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tjmp\t.L6\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L7\n\tmovl\t-8(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -8(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tjmp\t.L6\n.L7:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t-8(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -8(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tjmp\t.L6\n.L8:\n\tmovl\t-4(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\ty.0(%rip), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n.L6:\n\taddl\t$1, -12(%rbp)\n.L4:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L9\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\ty.0(%rip), %rax\n\tmovq\t(%rcx,%rax), %rax\n\tmovq\t%rax, (%rdx)\n\taddl\t$1, -12(%rbp)\n.L10:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L11\n\tjmp\t.L1\n.L12:\n\tnop\n.L1:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmerge_sort, .-merge_sort\n\t.globl\tUF_initialize\n\t.type\tUF_initialize, @function\nUF_initialize:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovl\t-28(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovl\t$1, -4(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$1, (%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$1, (%rax)\n\taddl\t$1, -4(%rbp)\n.L14:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjle\t.L15\n\tnop\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tUF_initialize, .-UF_initialize\n\t.globl\tUF_merge\n\t.type\tUF_merge, @function\nUF_merge:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tmovl\t%edx, -16(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n.L17:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L18\n\tjmp\t.L19\n.L20:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n.L19:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjne\t.L20\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-16(%rbp), %eax\n\tje\t.L24\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L23\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rsi\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\taddl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\tjmp\t.L16\n.L23:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rsi\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\taddl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L16\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tjmp\t.L16\n.L24:\n\tnop\n.L16:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tUF_merge, .-UF_merge\n\t.globl\tUF_root\n\t.type\tUF_root, @function\nUF_root:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n.L26:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L27\n\tmovl\t-12(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tUF_root, .-UF_root\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Impossible\"\n.LC2:\n\t.string\t\"%d\"\n.LC3:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-1196032(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$4080, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-1200092(%rbp), %rdx\n\tleaq\t-1200096(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1200096(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1200092(%rbp), %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-1200096(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tcmpl\t%eax, %edx\n\tjle\t.L30\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L40\n.L30:\n\tmovl\t$0, -1200088(%rbp)\n\tjmp\t.L32\n.L33:\n\tleaq\t-800016(%rbp), %rdx\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1200088(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -800012(%rbp,%rax,8)\n\taddl\t$1, -1200088(%rbp)\n.L32:\n\tmovl\t-1200096(%rbp), %eax\n\tcmpl\t%eax, -1200088(%rbp)\n\tjl\t.L33\n\tmovl\t-1200096(%rbp), %edx\n\tleaq\t-800016(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge_sort\n\tmovl\t-1200096(%rbp), %edx\n\tleaq\t-1200064(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tUF_initialize\n\tmovl\t$1, -1200088(%rbp)\n\tjmp\t.L34\n.L35:\n\tleaq\t-1200100(%rbp), %rdx\n\tleaq\t-1200104(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1200100(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200104(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tleaq\t-1200064(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tUF_merge\n\taddl\t$1, -1200088(%rbp)\n.L34:\n\tmovl\t-1200092(%rbp), %eax\n\tcmpl\t%eax, -1200088(%rbp)\n\tjle\t.L35\n\tleaq\t-1200032(%rbp), %rax\n\tmovl\t$400004, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, -1200080(%rbp)\n\tmovq\t$0, -1200072(%rbp)\n\tmovl\t$0, -1200088(%rbp)\n\tmovl\t$0, -1200084(%rbp)\n\tjmp\t.L36\n.L39:\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t-800012(%rbp,%rax,8), %edx\n\tleaq\t-1200064(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tUF_root\n\tmovl\t%eax, -1200076(%rbp)\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L37\n\taddl\t$1, -1200080(%rbp)\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -1200032(%rbp,%rax,4)\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t-800016(%rbp,%rax,8), %eax\n\tcltq\n\taddq\t%rax, -1200072(%rbp)\n\taddl\t$1, -1200084(%rbp)\n\tjmp\t.L38\n.L37:\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\tmovl\t-1200096(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovl\t-1200092(%rbp), %ecx\n\tsubl\t%ecx, %edx\n\tcmpl\t%edx, %eax\n\tjge\t.L38\n\tmovl\t-1200096(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1200092(%rbp), %edx\n\tsubl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t-1200084(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-1200096(%rbp), %eax\n\tmovl\t-1200092(%rbp), %ecx\n\tsubl\t%ecx, %eax\n\tsubl\t-1200080(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L38\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t-1200032(%rbp,%rax,4), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-1200076(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -1200032(%rbp,%rax,4)\n\tmovl\t-1200088(%rbp), %eax\n\tcltq\n\tmovl\t-800016(%rbp,%rax,8), %eax\n\tcltq\n\taddq\t%rax, -1200072(%rbp)\n\taddl\t$1, -1200084(%rbp)\n.L38:\n\taddl\t$1, -1200088(%rbp)\n.L36:\n\tmovl\t-1200096(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1200092(%rbp), %edx\n\tsubl\t%edx, %eax\n\taddl\t%eax, %eax\n\tcmpl\t%eax, -1200084(%rbp)\n\tjl\t.L39\n\tmovq\t-1200072(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n.L40:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L41\n\tcall\t__stack_chk_fail@PLT\n.L41:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tmain, .-main\n\t.local\ty.0\n\t.comm\ty.0,800008,32\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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); merge_sort(&(x[n/2]), (n+1)/2); int i, p, q; for (i = 0, p = 0, q = n/2; i < n; i++) { if (p >= n/2) y[i] = x[q++]; else if (q >= n) y[i] = x[p++]; else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++]; } for (i = 0; i < n; i++) x[i] = y[i]; } typedef struct { int *par, *size, *height; } UF_forest; void UF_initialize(UF_forest *F, int n) { int i; F->par = (int*)malloc(sizeof(int) * (n + 1)); F->size = (int*)malloc(sizeof(int) * (n + 1)); F->height = (int*)malloc(sizeof(int) * (n + 1)); for (i = 1; i <= n; i++) { F->par[i] = i; F->size[i] = 1; F->height[i] = 1; } } void UF_merge(UF_forest *F, int u, int v) { for (; F->par[u] != u; u = F->par[u]); for (; F->par[v] != v; v = F->par[v]); if (u == v) return; else if (F->height[u] > F->height[v]) { F->par[v] = u; F->size[u] += F->size[v]; } else { F->par[u] = v; F->size[v] += F->size[u]; if (F->height[u] == F->height[v]) F->height[v]++; } } int UF_root(UF_forest *F, int v) { for (; F->par[v] != v; v = F->par[v]); return v; } int main() { int i, u, w, N, M; scanf("%d %d", &N, &M); if (N - 1 - M > N / 2) { printf("Impossible\n"); fflush(stdout); return 0; } data a[100001]; for (i = 0; i < N; i++) { scanf("%d", &(a[i].key)); a[i].id = i + 1; } merge_sort(a, N); UF_forest F; UF_initialize(&F, N); for (i = 1; i <= M; i++) { scanf("%d %d", &u, &w); UF_merge(&F, u + 1, w + 1); } int k, r, count[100001] = {}, comp = 0; long long ans = 0; for (i = 0, k = 0; k < (N - 1 - M) * 2; i++) { r = UF_root(&F, a[i].id); if (count[r] == 0) { comp++; count[r]++; ans += a[i].key; k++; } else if (count[r] < N - 1 - M && (N - 1 - M) * 2 - k > N - M - comp) { count[r]++; ans += a[i].key; k++; } } printf("%lld\n", ans); fflush(stdout); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl merge_sort .type merge_sort, @function merge_sort: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movl %esi, -28(%rbp) cmpl $1, -28(%rbp) jle .L12 movl -28(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, %edx movq -24(%rbp), %rax movl %edx, %esi movq %rax, %rdi call merge_sort movl -28(%rbp), %eax addl $1, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, %edx movl -28(%rbp), %eax movl %eax, %ecx shrl $31, %ecx addl %ecx, %eax sarl %eax cltq leaq 0(,%rax,8), %rcx movq -24(%rbp), %rax addq %rcx, %rax movl %edx, %esi movq %rax, %rdi call merge_sort movl $0, -12(%rbp) movl $0, -8(%rbp) movl -28(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -4(%rbp) jmp .L4 .L9: movl -28(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax cmpl %eax, -8(%rbp) jl .L5 movl -4(%rbp), %eax leal 1(%rax), %edx movl %edx, -4(%rbp) cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq y.0(%rip), %rdx movq (%rax), %rax movq %rax, (%rcx,%rdx) jmp .L6 .L5: movl -4(%rbp), %eax cmpl -28(%rbp), %eax jl .L7 movl -8(%rbp), %eax leal 1(%rax), %edx movl %edx, -8(%rbp) cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq y.0(%rip), %rdx movq (%rax), %rax movq %rax, (%rcx,%rdx) jmp .L6 .L7: movl -8(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -4(%rbp), %eax cltq leaq 0(,%rax,8), %rcx movq -24(%rbp), %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jge .L8 movl -8(%rbp), %eax leal 1(%rax), %edx movl %edx, -8(%rbp) cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq y.0(%rip), %rdx movq (%rax), %rax movq %rax, (%rcx,%rdx) jmp .L6 .L8: movl -4(%rbp), %eax leal 1(%rax), %edx movl %edx, -4(%rbp) cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq y.0(%rip), %rdx movq (%rax), %rax movq %rax, (%rcx,%rdx) .L6: addl $1, -12(%rbp) .L4: movl -12(%rbp), %eax cmpl -28(%rbp), %eax jl .L9 movl $0, -12(%rbp) jmp .L10 .L11: movl -12(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rax, %rdx movl -12(%rbp), %eax cltq leaq 0(,%rax,8), %rcx leaq y.0(%rip), %rax movq (%rcx,%rax), %rax movq %rax, (%rdx) addl $1, -12(%rbp) .L10: movl -12(%rbp), %eax cmpl -28(%rbp), %eax jl .L11 jmp .L1 .L12: nop .L1: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size merge_sort, .-merge_sort .globl UF_initialize .type UF_initialize, @function UF_initialize: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movl %esi, -28(%rbp) movl -28(%rbp), %eax addl $1, %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, %rdx movq -24(%rbp), %rax movq %rdx, (%rax) movl -28(%rbp), %eax addl $1, %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, %rdx movq -24(%rbp), %rax movq %rdx, 8(%rax) movl -28(%rbp), %eax addl $1, %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, %rdx movq -24(%rbp), %rax movq %rdx, 16(%rax) movl $1, -4(%rbp) jmp .L14 .L15: movq -24(%rbp), %rax movq (%rax), %rdx movl -4(%rbp), %eax cltq salq $2, %rax addq %rax, %rdx movl -4(%rbp), %eax movl %eax, (%rdx) movq -24(%rbp), %rax movq 8(%rax), %rdx movl -4(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl $1, (%rax) movq -24(%rbp), %rax movq 16(%rax), %rdx movl -4(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl $1, (%rax) addl $1, -4(%rbp) .L14: movl -4(%rbp), %eax cmpl -28(%rbp), %eax jle .L15 nop nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size UF_initialize, .-UF_initialize .globl UF_merge .type UF_merge, @function UF_merge: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movl %esi, -12(%rbp) movl %edx, -16(%rbp) jmp .L17 .L18: movq -8(%rbp), %rax movq (%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -12(%rbp) .L17: movq -8(%rbp), %rax movq (%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax cmpl %eax, -12(%rbp) jne .L18 jmp .L19 .L20: movq -8(%rbp), %rax movq (%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -16(%rbp) .L19: movq -8(%rbp), %rax movq (%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax cmpl %eax, -16(%rbp) jne .L20 movl -12(%rbp), %eax cmpl -16(%rbp), %eax je .L24 movq -8(%rbp), %rax movq 16(%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %edx movq -8(%rbp), %rax movq 16(%rax), %rcx movl -16(%rbp), %eax cltq salq $2, %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jle .L23 movq -8(%rbp), %rax movq (%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rax, %rdx movl -12(%rbp), %eax movl %eax, (%rdx) movq -8(%rbp), %rax movq 8(%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %ecx movq -8(%rbp), %rax movq 8(%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %edx movq -8(%rbp), %rax movq 8(%rax), %rsi movl -12(%rbp), %eax cltq salq $2, %rax addq %rsi, %rax addl %ecx, %edx movl %edx, (%rax) jmp .L16 .L23: movq -8(%rbp), %rax movq (%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rax, %rdx movl -16(%rbp), %eax movl %eax, (%rdx) movq -8(%rbp), %rax movq 8(%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %ecx movq -8(%rbp), %rax movq 8(%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %edx movq -8(%rbp), %rax movq 8(%rax), %rsi movl -16(%rbp), %eax cltq salq $2, %rax addq %rsi, %rax addl %ecx, %edx movl %edx, (%rax) movq -8(%rbp), %rax movq 16(%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %edx movq -8(%rbp), %rax movq 16(%rax), %rcx movl -16(%rbp), %eax cltq salq $2, %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jne .L16 movq -8(%rbp), %rax movq 16(%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %edx addl $1, %edx movl %edx, (%rax) jmp .L16 .L24: nop .L16: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size UF_merge, .-UF_merge .globl UF_root .type UF_root, @function UF_root: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movl %esi, -12(%rbp) jmp .L26 .L27: movq -8(%rbp), %rax movq (%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -12(%rbp) .L26: movq -8(%rbp), %rax movq (%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax cmpl %eax, -12(%rbp) jne .L27 movl -12(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size UF_root, .-UF_root .section .rodata .LC0: .string "%d %d" .LC1: .string "Impossible" .LC2: .string "%d" .LC3: .string "%lld\n" .text .globl main .type main, @function main: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -1196032(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $4080, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -1200092(%rbp), %rdx leaq -1200096(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -1200096(%rbp), %eax subl $1, %eax movl -1200092(%rbp), %ecx subl %ecx, %eax movl %eax, %edx movl -1200096(%rbp), %eax movl %eax, %ecx shrl $31, %ecx addl %ecx, %eax sarl %eax cmpl %eax, %edx jle .L30 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax jmp .L40 .L30: movl $0, -1200088(%rbp) jmp .L32 .L33: leaq -800016(%rbp), %rdx movl -1200088(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -1200088(%rbp), %eax leal 1(%rax), %edx movl -1200088(%rbp), %eax cltq movl %edx, -800012(%rbp,%rax,8) addl $1, -1200088(%rbp) .L32: movl -1200096(%rbp), %eax cmpl %eax, -1200088(%rbp) jl .L33 movl -1200096(%rbp), %edx leaq -800016(%rbp), %rax movl %edx, %esi movq %rax, %rdi call merge_sort movl -1200096(%rbp), %edx leaq -1200064(%rbp), %rax movl %edx, %esi movq %rax, %rdi call UF_initialize movl $1, -1200088(%rbp) jmp .L34 .L35: leaq -1200100(%rbp), %rdx leaq -1200104(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -1200100(%rbp), %eax leal 1(%rax), %edx movl -1200104(%rbp), %eax leal 1(%rax), %ecx leaq -1200064(%rbp), %rax movl %ecx, %esi movq %rax, %rdi call UF_merge addl $1, -1200088(%rbp) .L34: movl -1200092(%rbp), %eax cmpl %eax, -1200088(%rbp) jle .L35 leaq -1200032(%rbp), %rax movl $400004, %edx movl $0, %esi movq %rax, %rdi call memset@PLT movl $0, -1200080(%rbp) movq $0, -1200072(%rbp) movl $0, -1200088(%rbp) movl $0, -1200084(%rbp) jmp .L36 .L39: movl -1200088(%rbp), %eax cltq movl -800012(%rbp,%rax,8), %edx leaq -1200064(%rbp), %rax movl %edx, %esi movq %rax, %rdi call UF_root movl %eax, -1200076(%rbp) movl -1200076(%rbp), %eax cltq movl -1200032(%rbp,%rax,4), %eax testl %eax, %eax jne .L37 addl $1, -1200080(%rbp) movl -1200076(%rbp), %eax cltq movl -1200032(%rbp,%rax,4), %eax leal 1(%rax), %edx movl -1200076(%rbp), %eax cltq movl %edx, -1200032(%rbp,%rax,4) movl -1200088(%rbp), %eax cltq movl -800016(%rbp,%rax,8), %eax cltq addq %rax, -1200072(%rbp) addl $1, -1200084(%rbp) jmp .L38 .L37: movl -1200076(%rbp), %eax cltq movl -1200032(%rbp,%rax,4), %eax movl -1200096(%rbp), %edx subl $1, %edx movl -1200092(%rbp), %ecx subl %ecx, %edx cmpl %edx, %eax jge .L38 movl -1200096(%rbp), %eax subl $1, %eax movl -1200092(%rbp), %edx subl %edx, %eax addl %eax, %eax subl -1200084(%rbp), %eax movl %eax, %edx movl -1200096(%rbp), %eax movl -1200092(%rbp), %ecx subl %ecx, %eax subl -1200080(%rbp), %eax cmpl %eax, %edx jle .L38 movl -1200076(%rbp), %eax cltq movl -1200032(%rbp,%rax,4), %eax leal 1(%rax), %edx movl -1200076(%rbp), %eax cltq movl %edx, -1200032(%rbp,%rax,4) movl -1200088(%rbp), %eax cltq movl -800016(%rbp,%rax,8), %eax cltq addq %rax, -1200072(%rbp) addl $1, -1200084(%rbp) .L38: addl $1, -1200088(%rbp) .L36: movl -1200096(%rbp), %eax subl $1, %eax movl -1200092(%rbp), %edx subl %edx, %eax addl %eax, %eax cmpl %eax, -1200084(%rbp) jl .L39 movq -1200072(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax .L40: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L41 call __stack_chk_fail@PLT .L41: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size main, .-main .local y.0 .comm y.0,800008,32 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 <= 11;i++){\n\t\tif(s[11 - i] != '?'){\n\t\t\tp[i] = s[11 - i] - 48;\n\t\t}\n\t\telse{\n\t\t\tu = i;\n\t\t}\n\t}\n\t\n\tif(u){\n\t\tfor(i = 0;i <= 9;i++){\n\t\t\tsum = 0;\n\t\t\tp[u] = i;\n\t\t\tfor(j = 1;j <= 11;j++){\n\t\t\t\tsum+=(p[j]*q[j]);\n\t\t\t}\n\t\t\tif(sum % 11 < 2){\n\t\t\t\tc = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tc = 11 - sum % 11;\n\t\t\t}\n\t\t\tif(c == p[0]){\n\t\t\t\tif(y){\n\t\t\t\t\ta = 10;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ta = i;\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i = 1;i <= 11;i++){\n\t\t\tsum+=(p[i]*q[i]);\n\t\t}\n\t\tif(sum % 11 < 2){\n\t\t\ta = 0;\n\t\t}\n\t\telse{\n\t\t\ta = 11 - sum % 11;\n\t\t}\n\t}\n\t\n\tif(a != 10){\n\t\tprintf(\"%d\\n\",a);\n\t}\n\telse{\n\t\tprintf(\"MULTIPLE\\n\");\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n.LC2:\n\t.string\t\"MULTIPLE\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$192, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -188(%rbp)\n\tmovl\t$0, -176(%rbp)\n\tmovq\t$0, -160(%rbp)\n\tmovq\t$0, -152(%rbp)\n\tmovq\t$0, -144(%rbp)\n\tmovq\t$0, -136(%rbp)\n\tmovq\t$0, -128(%rbp)\n\tmovq\t$0, -120(%rbp)\n\tmovq\t$0, -112(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tmovq\t$0, -96(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t$0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tmovq\t$0, -56(%rbp)\n\tmovq\t$0, -48(%rbp)\n\tmovq\t$0, -40(%rbp)\n\tmovl\t$2, -92(%rbp)\n\tmovl\t$3, -88(%rbp)\n\tmovl\t$4, -84(%rbp)\n\tmovl\t$5, -80(%rbp)\n\tmovl\t$6, -76(%rbp)\n\tmovl\t$7, -72(%rbp)\n\tmovl\t$2, -68(%rbp)\n\tmovl\t$3, -64(%rbp)\n\tmovl\t$4, -60(%rbp)\n\tmovl\t$5, -56(%rbp)\n\tmovl\t$6, -52(%rbp)\n\tmovl\t$0, -168(%rbp)\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -184(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t$11, %eax\n\tsubl\t-184(%rbp), %eax\n\tcltq\n\tmovzbl\t-32(%rbp,%rax), %eax\n\tcmpb\t$63, %al\n\tje\t.L3\n\tmovl\t$11, %eax\n\tsubl\t-184(%rbp), %eax\n\tcltq\n\tmovzbl\t-32(%rbp,%rax), %eax\n\tmovsbl\t%al, %eax\n\tleal\t-48(%rax), %edx\n\tmovl\t-184(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -160(%rbp,%rax,4)\n\tjmp\t.L4\n.L3:\n\tmovl\t-184(%rbp), %eax\n\tmovl\t%eax, -172(%rbp)\n.L4:\n\taddl\t$1, -184(%rbp)\n.L2:\n\tcmpl\t$11, -184(%rbp)\n\tjle\t.L5\n\tcmpl\t$0, -172(%rbp)\n\tje\t.L6\n\tmovl\t$0, -184(%rbp)\n\tjmp\t.L7\n.L14:\n\tmovl\t$0, -176(%rbp)\n\tmovl\t-172(%rbp), %eax\n\tcltq\n\tmovl\t-184(%rbp), %edx\n\tmovl\t%edx, -160(%rbp,%rax,4)\n\tmovl\t$1, -180(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-180(%rbp), %eax\n\tcltq\n\tmovl\t-160(%rbp,%rax,4), %edx\n\tmovl\t-180(%rbp), %eax\n\tcltq\n\tmovl\t-96(%rbp,%rax,4), %eax\n\timull\t%edx, %eax\n\taddl\t%eax, -176(%rbp)\n\taddl\t$1, -180(%rbp)\n.L8:\n\tcmpl\t$11, -180(%rbp)\n\tjle\t.L9\n\tmovl\t-176(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\tcmpl\t$1, %edx\n\tjg\t.L10\n\tmovl\t$0, -164(%rbp)\n\tjmp\t.L11\n.L10:\n\tmovl\t-176(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\taddl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t$11, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -164(%rbp)\n.L11:\n\tmovl\t-160(%rbp), %eax\n\tcmpl\t%eax, -164(%rbp)\n\tjne\t.L12\n\tcmpl\t$0, -188(%rbp)\n\tje\t.L13\n\tmovl\t$10, -168(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovl\t-184(%rbp), %eax\n\tmovl\t%eax, -168(%rbp)\n\taddl\t$1, -188(%rbp)\n.L12:\n\taddl\t$1, -184(%rbp)\n.L7:\n\tcmpl\t$9, -184(%rbp)\n\tjle\t.L14\n\tjmp\t.L15\n.L6:\n\tmovl\t$1, -184(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-184(%rbp), %eax\n\tcltq\n\tmovl\t-160(%rbp,%rax,4), %edx\n\tmovl\t-184(%rbp), %eax\n\tcltq\n\tmovl\t-96(%rbp,%rax,4), %eax\n\timull\t%edx, %eax\n\taddl\t%eax, -176(%rbp)\n\taddl\t$1, -184(%rbp)\n.L16:\n\tcmpl\t$11, -184(%rbp)\n\tjle\t.L17\n\tmovl\t-176(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\tcmpl\t$1, %edx\n\tjg\t.L18\n\tmovl\t$0, -168(%rbp)\n\tjmp\t.L15\n.L18:\n\tmovl\t-176(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\taddl\t%ecx, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %ecx\n\tmovl\t$11, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -168(%rbp)\n.L15:\n\tcmpl\t$10, -168(%rbp)\n\tje\t.L19\n\tmovl\t-168(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L20\n.L19:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L20:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L22\n\tcall\t__stack_chk_fail@PLT\n.L22:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$104, %rsp\n\t.cfi_def_cfa_offset 112\n\tpxor\t%xmm0, %xmm0\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 88(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t64(%rsp), %rsi\n\tmovaps\t%xmm0, (%rsp)\n\tmovaps\t%xmm0, 16(%rsp)\n\tmovaps\t%xmm0, 32(%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovsbl\t75(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L2\n\tsubl\t$48, %eax\n\tmovl\t%eax, (%rsp)\n.L2:\n\tmovsbl\t74(%rsp), %eax\n\tmovl\t$1, %r8d\n\tcmpb\t$63, %al\n\tje\t.L3\n\tsubl\t$48, %eax\n\txorl\t%r8d, %r8d\n\tmovl\t%eax, 4(%rsp)\n.L3:\n\tmovsbl\t73(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L24\n\tsubl\t$48, %eax\n\tmovl\t%eax, 8(%rsp)\n.L4:\n\tmovsbl\t72(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L25\n\tsubl\t$48, %eax\n\tmovl\t%eax, 12(%rsp)\n.L5:\n\tmovsbl\t71(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L26\n\tsubl\t$48, %eax\n\tmovl\t%eax, 16(%rsp)\n.L6:\n\tmovsbl\t70(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L27\n\tsubl\t$48, %eax\n\tmovl\t%eax, 20(%rsp)\n.L7:\n\tmovsbl\t69(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L28\n\tsubl\t$48, %eax\n\tmovl\t%eax, 24(%rsp)\n.L8:\n\tmovsbl\t68(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L29\n\tsubl\t$48, %eax\n\tmovl\t%eax, 28(%rsp)\n.L9:\n\tmovsbl\t67(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L30\n\tsubl\t$48, %eax\n\tmovl\t%eax, 32(%rsp)\n.L10:\n\tmovsbl\t66(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L31\n\tsubl\t$48, %eax\n\tmovl\t%eax, 36(%rsp)\n.L11:\n\tmovsbl\t65(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L44\n\tleal\t-48(%rax), %edx\n\tmovsbl\t64(%rsp), %eax\n\tmovl\t%edx, 40(%rsp)\n\tcmpb\t$63, %al\n\tje\t.L33\n\tleal\t-48(%rax), %ecx\n\tmovslq\t%r8d, %rsi\n\tmovl\t%ecx, 44(%rsp)\n\ttestl\t%r8d, %r8d\n\tjne\t.L13\n\tmovdqa\t.LC1(%rip), %xmm2\n\tmovl\t36(%rsp), %esi\n\timull\t$6, %ecx, %ecx\n\tmovdqu\t4(%rsp), %xmm0\n\tmovdqu\t4(%rsp), %xmm1\n\tmovdqa\t.LC2(%rip), %xmm3\n\tpmuludq\t%xmm2, %xmm0\n\tpsrlq\t$32, %xmm1\n\tpsrlq\t$32, %xmm2\n\tpmuludq\t%xmm2, %xmm1\n\tmovdqu\t20(%rsp), %xmm2\n\tpmuludq\t%xmm3, %xmm2\n\tpsrlq\t$32, %xmm3\n\tpshufd\t$8, %xmm0, %xmm0\n\tpshufd\t$8, %xmm1, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovdqu\t20(%rsp), %xmm1\n\tpshufd\t$8, %xmm2, %xmm2\n\tpsrlq\t$32, %xmm1\n\tpmuludq\t%xmm3, %xmm1\n\tpshufd\t$8, %xmm1, %xmm1\n\tpunpckldq\t%xmm1, %xmm2\n\tpaddd\t%xmm2, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpsrldq\t$8, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpsrldq\t$4, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\tmovd\t%xmm0, %eax\n\tleal\t(%rax,%rsi,4), %esi\n\tleal\t(%rdx,%rdx,4), %eax\n\taddl\t%esi, %eax\n\taddl\t%ecx, %eax\n\tmovl\t$11, %ecx\n\tcltd\n\tidivl\t%ecx\n\tcmpl\t$1, %edx\n\tjle\t.L19\n\tsubl\t%edx, %ecx\n\tmovl\t%ecx, %r8d\n.L19:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L21:\n\tmovq\t88(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L45\n\txorl\t%eax, %eax\n\taddq\t$104, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L33:\n\t.cfi_restore_state\n\tmovl\t$11, %esi\n.L13:\n\txorl\t%r8d, %r8d\n\txorl\t%edx, %edx\n\txorl\t%r10d, %r10d\n\txorl\t%r9d, %r9d\n\tmovl\t$11, %edi\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\taddl\t$1, %edx\n\tcmpl\t$10, %edx\n\tje\t.L46\n.L17:\n\tmovl\t%edx, (%rsp,%rsi,4)\n\tmovl\t8(%rsp), %eax\n\tmovl\t4(%rsp), %ecx\n\taddl\t%eax, %ecx\n\tleal\t(%rax,%rcx,2), %eax\n\tmovl\t12(%rsp), %ecx\n\tleal\t(%rax,%rcx,4), %ecx\n\tmovl\t16(%rsp), %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%ecx, %eax\n\tmovl\t20(%rsp), %ecx\n\tleal\t(%rcx,%rcx,2), %ecx\n\tleal\t(%rax,%rcx,2), %eax\n\tmovl\t24(%rsp), %ecx\n\tleal\t(%rax,%rcx,8), %eax\n\tsubl\t%ecx, %eax\n\tmovl\t28(%rsp), %ecx\n\tleal\t(%rax,%rcx,2), %ecx\n\tmovl\t32(%rsp), %eax\n\tleal\t(%rax,%rax,2), %eax\n\taddl\t%ecx, %eax\n\tmovl\t36(%rsp), %ecx\n\tleal\t(%rax,%rcx,4), %ecx\n\tmovl\t40(%rsp), %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%ecx, %eax\n\tmovl\t44(%rsp), %ecx\n\tleal\t(%rcx,%rcx,2), %ecx\n\tleal\t(%rax,%rcx,2), %ecx\n\tmovslq\t%ecx, %rax\n\tmovl\t%ecx, %r11d\n\timulq\t$780903145, %rax, %rax\n\tsarl\t$31, %r11d\n\tsarq\t$33, %rax\n\tsubl\t%r11d, %eax\n\tleal\t(%rax,%rax,4), %r11d\n\tleal\t(%rax,%r11,2), %r11d\n\tmovl\t%ecx, %eax\n\tmovl\t%edi, %ecx\n\tsubl\t%r11d, %eax\n\tsubl\t%eax, %ecx\n\tcmpl\t$1, %eax\n\tmovl\t%ecx, %eax\n\tcmovle\t%r9d, %eax\n\tcmpl\t(%rsp), %eax\n\tjne\t.L16\n\tmovl\t$10, %r8d\n\ttestl\t%r10d, %r10d\n\tjne\t.L16\n\tmovl\t%edx, %r8d\n\taddl\t$1, %edx\n\tmovl\t$1, %r10d\n\tcmpl\t$10, %edx\n\tjne\t.L17\n.L46:\n\tcmpl\t$10, %r8d\n\tjne\t.L19\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L21\n.L24:\n\tmovl\t$2, %r8d\n\tjmp\t.L4\n.L44:\n\tmovsbl\t64(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L33\n\tsubl\t$48, %eax\n\tmovl\t$10, %esi\n\tmovl\t%eax, 44(%rsp)\n\tjmp\t.L13\n.L31:\n\tmovl\t$9, %r8d\n\tjmp\t.L11\n.L26:\n\tmovl\t$4, %r8d\n\tjmp\t.L6\n.L25:\n\tmovl\t$3, %r8d\n\tjmp\t.L5\n.L30:\n\tmovl\t$8, %r8d\n\tjmp\t.L10\n.L29:\n\tmovl\t$7, %r8d\n\tjmp\t.L9\n.L28:\n\tmovl\t$6, %r8d\n\tjmp\t.L8\n.L27:\n\tmovl\t$5, %r8d\n\tjmp\t.L7\n.L45:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.long\t2\n\t.long\t3\n\t.long\t4\n\t.long\t5\n\t.align 16\n.LC2:\n\t.long\t6\n\t.long\t7\n\t.long\t2\n\t.long\t3\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tsubq\t$104, %rsp\n\t.cfi_def_cfa_offset 112\n\tpxor\t%xmm0, %xmm0\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 88(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t64(%rsp), %rsi\n\tmovaps\t%xmm0, (%rsp)\n\tmovaps\t%xmm0, 16(%rsp)\n\tmovaps\t%xmm0, 32(%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovsbl\t75(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L2\n\tsubl\t$48, %eax\n\tmovl\t%eax, (%rsp)\n.L2:\n\tmovsbl\t74(%rsp), %eax\n\tmovl\t$1, %r8d\n\tcmpb\t$63, %al\n\tje\t.L3\n\tsubl\t$48, %eax\n\txorl\t%r8d, %r8d\n\tmovl\t%eax, 4(%rsp)\n.L3:\n\tmovsbl\t73(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L24\n\tsubl\t$48, %eax\n\tmovl\t%eax, 8(%rsp)\n.L4:\n\tmovsbl\t72(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L25\n\tsubl\t$48, %eax\n\tmovl\t%eax, 12(%rsp)\n.L5:\n\tmovsbl\t71(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L26\n\tsubl\t$48, %eax\n\tmovl\t%eax, 16(%rsp)\n.L6:\n\tmovsbl\t70(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L27\n\tsubl\t$48, %eax\n\tmovl\t%eax, 20(%rsp)\n.L7:\n\tmovsbl\t69(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L28\n\tsubl\t$48, %eax\n\tmovl\t%eax, 24(%rsp)\n.L8:\n\tmovsbl\t68(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L29\n\tsubl\t$48, %eax\n\tmovl\t%eax, 28(%rsp)\n.L9:\n\tmovsbl\t67(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L30\n\tsubl\t$48, %eax\n\tmovl\t%eax, 32(%rsp)\n.L10:\n\tmovsbl\t66(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L31\n\tsubl\t$48, %eax\n\tmovl\t%eax, 36(%rsp)\n.L11:\n\tmovsbl\t65(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L44\n\tleal\t-48(%rax), %edx\n\tmovsbl\t64(%rsp), %eax\n\tmovl\t%edx, 40(%rsp)\n\tcmpb\t$63, %al\n\tje\t.L33\n\tleal\t-48(%rax), %ecx\n\tmovslq\t%r8d, %rsi\n\tmovl\t%ecx, 44(%rsp)\n\ttestl\t%r8d, %r8d\n\tjne\t.L13\n\tmovdqa\t.LC1(%rip), %xmm2\n\tmovl\t36(%rsp), %esi\n\timull\t$6, %ecx, %ecx\n\tmovdqu\t4(%rsp), %xmm0\n\tmovdqu\t4(%rsp), %xmm1\n\tmovdqa\t.LC2(%rip), %xmm3\n\tpmuludq\t%xmm2, %xmm0\n\tpsrlq\t$32, %xmm1\n\tpsrlq\t$32, %xmm2\n\tpmuludq\t%xmm2, %xmm1\n\tmovdqu\t20(%rsp), %xmm2\n\tpmuludq\t%xmm3, %xmm2\n\tpsrlq\t$32, %xmm3\n\tpshufd\t$8, %xmm0, %xmm0\n\tpshufd\t$8, %xmm1, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovdqu\t20(%rsp), %xmm1\n\tpshufd\t$8, %xmm2, %xmm2\n\tpsrlq\t$32, %xmm1\n\tpmuludq\t%xmm3, %xmm1\n\tpshufd\t$8, %xmm1, %xmm1\n\tpunpckldq\t%xmm1, %xmm2\n\tpaddd\t%xmm2, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpsrldq\t$8, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpsrldq\t$4, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\tmovd\t%xmm0, %eax\n\tleal\t(%rax,%rsi,4), %esi\n\tleal\t(%rdx,%rdx,4), %eax\n\taddl\t%esi, %eax\n\taddl\t%ecx, %eax\n\tmovl\t$11, %ecx\n\tcltd\n\tidivl\t%ecx\n\tcmpl\t$1, %edx\n\tjle\t.L19\n\tsubl\t%edx, %ecx\n\tmovl\t%ecx, %r8d\n.L19:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L21:\n\tmovq\t88(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L45\n\txorl\t%eax, %eax\n\taddq\t$104, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L33:\n\t.cfi_restore_state\n\tmovl\t$11, %esi\n.L13:\n\txorl\t%r8d, %r8d\n\txorl\t%edx, %edx\n\txorl\t%r10d, %r10d\n\txorl\t%r9d, %r9d\n\tmovl\t$11, %edi\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\taddl\t$1, %edx\n\tcmpl\t$10, %edx\n\tje\t.L46\n.L17:\n\tmovl\t%edx, (%rsp,%rsi,4)\n\tmovl\t8(%rsp), %eax\n\tmovl\t4(%rsp), %ecx\n\taddl\t%eax, %ecx\n\tleal\t(%rax,%rcx,2), %eax\n\tmovl\t12(%rsp), %ecx\n\tleal\t(%rax,%rcx,4), %ecx\n\tmovl\t16(%rsp), %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%ecx, %eax\n\tmovl\t20(%rsp), %ecx\n\tleal\t(%rcx,%rcx,2), %ecx\n\tleal\t(%rax,%rcx,2), %eax\n\tmovl\t24(%rsp), %ecx\n\tleal\t(%rax,%rcx,8), %eax\n\tsubl\t%ecx, %eax\n\tmovl\t28(%rsp), %ecx\n\tleal\t(%rax,%rcx,2), %ecx\n\tmovl\t32(%rsp), %eax\n\tleal\t(%rax,%rax,2), %eax\n\taddl\t%ecx, %eax\n\tmovl\t36(%rsp), %ecx\n\tleal\t(%rax,%rcx,4), %ecx\n\tmovl\t40(%rsp), %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%ecx, %eax\n\tmovl\t44(%rsp), %ecx\n\tleal\t(%rcx,%rcx,2), %ecx\n\tleal\t(%rax,%rcx,2), %ecx\n\tmovslq\t%ecx, %rax\n\tmovl\t%ecx, %r11d\n\timulq\t$780903145, %rax, %rax\n\tsarl\t$31, %r11d\n\tsarq\t$33, %rax\n\tsubl\t%r11d, %eax\n\tleal\t(%rax,%rax,4), %r11d\n\tleal\t(%rax,%r11,2), %r11d\n\tmovl\t%ecx, %eax\n\tmovl\t%edi, %ecx\n\tsubl\t%r11d, %eax\n\tsubl\t%eax, %ecx\n\tcmpl\t$1, %eax\n\tmovl\t%ecx, %eax\n\tcmovle\t%r9d, %eax\n\tcmpl\t(%rsp), %eax\n\tjne\t.L16\n\tmovl\t$10, %r8d\n\ttestl\t%r10d, %r10d\n\tjne\t.L16\n\tmovl\t%edx, %r8d\n\taddl\t$1, %edx\n\tmovl\t$1, %r10d\n\tcmpl\t$10, %edx\n\tjne\t.L17\n.L46:\n\tcmpl\t$10, %r8d\n\tjne\t.L19\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L21\n.L24:\n\tmovl\t$2, %r8d\n\tjmp\t.L4\n.L44:\n\tmovsbl\t64(%rsp), %eax\n\tcmpb\t$63, %al\n\tje\t.L33\n\tsubl\t$48, %eax\n\tmovl\t$10, %esi\n\tmovl\t%eax, 44(%rsp)\n\tjmp\t.L13\n.L31:\n\tmovl\t$9, %r8d\n\tjmp\t.L11\n.L26:\n\tmovl\t$4, %r8d\n\tjmp\t.L6\n.L25:\n\tmovl\t$3, %r8d\n\tjmp\t.L5\n.L30:\n\tmovl\t$8, %r8d\n\tjmp\t.L10\n.L29:\n\tmovl\t$7, %r8d\n\tjmp\t.L9\n.L28:\n\tmovl\t$6, %r8d\n\tjmp\t.L8\n.L27:\n\tmovl\t$5, %r8d\n\tjmp\t.L7\n.L45:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.long\t2\n\t.long\t3\n\t.long\t4\n\t.long\t5\n\t.align 16\n.LC2:\n\t.long\t6\n\t.long\t7\n\t.long\t2\n\t.long\t3\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 <= 11;i++){\n\t\tif(s[11 - i] != '?'){\n\t\t\tp[i] = s[11 - i] - 48;\n\t\t}\n\t\telse{\n\t\t\tu = i;\n\t\t}\n\t}\n\t\n\tif(u){\n\t\tfor(i = 0;i <= 9;i++){\n\t\t\tsum = 0;\n\t\t\tp[u] = i;\n\t\t\tfor(j = 1;j <= 11;j++){\n\t\t\t\tsum+=(p[j]*q[j]);\n\t\t\t}\n\t\t\tif(sum % 11 < 2){\n\t\t\t\tc = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tc = 11 - sum % 11;\n\t\t\t}\n\t\t\tif(c == p[0]){\n\t\t\t\tif(y){\n\t\t\t\t\ta = 10;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ta = i;\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i = 1;i <= 11;i++){\n\t\t\tsum+=(p[i]*q[i]);\n\t\t}\n\t\tif(sum % 11 < 2){\n\t\t\ta = 0;\n\t\t}\n\t\telse{\n\t\t\ta = 11 - sum % 11;\n\t\t}\n\t}\n\t\n\tif(a != 10){\n\t\tprintf(\"%d\\n\",a);\n\t}\n\telse{\n\t\tprintf(\"MULTIPLE\\n\");\n\t}\n\treturn 0;\n}", "index": 9, "inputs": [ "?123456789/1\n", "1/987654321?\n", "1.987654321?\n", "1.687954321?\n", "1/587954321?\n", "1/687954321?\n", "6/478851321?\n", "?1/315887426\n", "634788413/1?\n", "?12345678900\n", "?123456789.1\n", "1.587954321?\n", "4/687951321?\n", "4/678951321?\n", "6/478951321?\n", "?123158874/6\n", "?1/314887426\n", "624788413/1?\n", "?1.314887426\n", "?1.314887436\n", "?1/314887436\n", "?1/313887436\n", "?1/313897436\n", "?123556789/1\n", "1.287954361?\n", "1/587954311?\n", "1/687954320?\n", "4/687952321?\n", "4/618951327?\n", "6/478951312?\n", "6/471858321?\n", "5/478851321?\n", "?10315887426\n", "?1/413887426\n", "624788423/1?\n", "?1.314886426\n", "634788413.1?\n", "?6/314887431\n", "63478841301?\n", "634788313/1?\n", "00987654321?\n", "?123556789.1\n", "?123456779.1\n", "1-287954361?\n", "2/587954311?\n", "1/687954302?\n", "?123259786/4\n", "6/458971312?\n", "5/471858321?\n", "5/47885?3211\n", "?10315887326\n", "624788314/1?\n", "62478842/31?\n", "624688413.1?\n", "?1.814387436\n", "16/3?4887431\n", "63478842301?\n", "634788303/1?\n", "02987654301?\n", "?123557789/1\n", "?122456779.1\n", "1-287654391?\n", "?113459785/2\n", "1/687594302?\n", "?123259786/5\n", "6/358971312?\n", "?123858174/5\n", "5/47885?3210\n", "?20315887316\n", "624888314/1?\n", "62478742/31?\n", "624688314.1?\n", "635788413.1?\n", "63478843301?\n", "02984657301?\n", "?123557789.1\n", "?132456779.1\n", "1-287654193?\n", "?118459735/2\n", "1/787594302?\n", "?123159786/5\n", "6/358971313?\n", "?123859174/5\n", "5/47805?3218\n", "820315?87316\n", "524888314/1?\n", "62478742/30?\n", "634688314.1?\n", "636788413.1?\n", "64478843301?\n", "01984657301?\n", "?13.45677921\n", "1-387654193?\n", "?203495787/1\n", "?123159686/5\n", "3/358971613?\n", "5/47805?3318\n", "820316?87316\n", "524888315/1?\n", "?03/24787426\n", "?12345678901\n", "?12345678901\n" ], "outputs": [ "8\n", "0\n", "5\n", "7\n", "6\n", "2\n", "3\n", "4\n", "9\n", "MULTIPLE\n", "1\n", "0\n", "0\n", "0\n", "7\n", "3\n", "7\n", "3\n", "4\n", "0\n", "3\n", "6\n", "7\n", "4\n", "0\n", "9\n", "4\n", "5\n", "6\n", "8\n", "4\n", "9\n", "7\n", "4\n", "9\n", "1\n", "1\n", "7\n", "6\n", "4\n", "1\n", "8\n", "9\n", "5\n", "3\n", "6\n", "3\n", "2\n", "0\n", "7\n", "2\n", "5\n", "2\n", "9\n", "8\n", "8\n", "1\n", "9\n", "8\n", "3\n", "4\n", "6\n", "2\n", "0\n", "1\n", "6\n", "3\n", "MULTIPLE\n", "7\n", "2\n", "9\n", "0\n", "8\n", "7\n", "0\n", "7\n", "7\n", "0\n", "1\n", "6\n", "5\n", "4\n", "2\n", "8\n", "7\n", "8\n", "0\n", "6\n", "4\n", "2\n", "4\n", "4\n", "6\n", "4\n", "4\n", "0\n", "3\n", "4\n", "4\n", "6\n", "4\n", "4\n" ], "question": "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 <= 11;i++){\n\t\tif(s[11 - i] != '?'){\n\t\t\tp[i] = s[11 - i] - 48;\n\t\t}\n\t\telse{\n\t\t\tu = i;\n\t\t}\n\t}\n\t\n\tif(u){\n\t\tfor(i = 0;i <= 9;i++){\n\t\t\tsum = 0;\n\t\t\tp[u] = i;\n\t\t\tfor(j = 1;j <= 11;j++){\n\t\t\t\tsum+=(p[j]*q[j]);\n\t\t\t}\n\t\t\tif(sum % 11 < 2){\n\t\t\t\tc = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tc = 11 - sum % 11;\n\t\t\t}\n\t\t\tif(c == p[0]){\n\t\t\t\tif(y){\n\t\t\t\t\ta = 10;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ta = i;\n\t\t\t\t\ty++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i = 1;i <= 11;i++){\n\t\t\tsum+=(p[i]*q[i]);\n\t\t}\n\t\tif(sum % 11 < 2){\n\t\t\ta = 0;\n\t\t}\n\t\telse{\n\t\t\ta = 11 - sum % 11;\n\t\t}\n\t}\n\t\n\tif(a != 10){\n\t\tprintf(\"%d\\n\",a);\n\t}\n\telse{\n\t\tprintf(\"MULTIPLE\\n\");\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n.LC2:\n\t.string\t\"MULTIPLE\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$192, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -188(%rbp)\n\tmovl\t$0, -176(%rbp)\n\tmovq\t$0, -160(%rbp)\n\tmovq\t$0, -152(%rbp)\n\tmovq\t$0, -144(%rbp)\n\tmovq\t$0, -136(%rbp)\n\tmovq\t$0, -128(%rbp)\n\tmovq\t$0, -120(%rbp)\n\tmovq\t$0, -112(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tmovq\t$0, -96(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t$0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tmovq\t$0, -56(%rbp)\n\tmovq\t$0, -48(%rbp)\n\tmovq\t$0, -40(%rbp)\n\tmovl\t$2, -92(%rbp)\n\tmovl\t$3, -88(%rbp)\n\tmovl\t$4, -84(%rbp)\n\tmovl\t$5, -80(%rbp)\n\tmovl\t$6, -76(%rbp)\n\tmovl\t$7, -72(%rbp)\n\tmovl\t$2, -68(%rbp)\n\tmovl\t$3, -64(%rbp)\n\tmovl\t$4, -60(%rbp)\n\tmovl\t$5, -56(%rbp)\n\tmovl\t$6, -52(%rbp)\n\tmovl\t$0, -168(%rbp)\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -184(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t$11, %eax\n\tsubl\t-184(%rbp), %eax\n\tcltq\n\tmovzbl\t-32(%rbp,%rax), %eax\n\tcmpb\t$63, %al\n\tje\t.L3\n\tmovl\t$11, %eax\n\tsubl\t-184(%rbp), %eax\n\tcltq\n\tmovzbl\t-32(%rbp,%rax), %eax\n\tmovsbl\t%al, %eax\n\tleal\t-48(%rax), %edx\n\tmovl\t-184(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -160(%rbp,%rax,4)\n\tjmp\t.L4\n.L3:\n\tmovl\t-184(%rbp), %eax\n\tmovl\t%eax, -172(%rbp)\n.L4:\n\taddl\t$1, -184(%rbp)\n.L2:\n\tcmpl\t$11, -184(%rbp)\n\tjle\t.L5\n\tcmpl\t$0, -172(%rbp)\n\tje\t.L6\n\tmovl\t$0, -184(%rbp)\n\tjmp\t.L7\n.L14:\n\tmovl\t$0, -176(%rbp)\n\tmovl\t-172(%rbp), %eax\n\tcltq\n\tmovl\t-184(%rbp), %edx\n\tmovl\t%edx, -160(%rbp,%rax,4)\n\tmovl\t$1, -180(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-180(%rbp), %eax\n\tcltq\n\tmovl\t-160(%rbp,%rax,4), %edx\n\tmovl\t-180(%rbp), %eax\n\tcltq\n\tmovl\t-96(%rbp,%rax,4), %eax\n\timull\t%edx, %eax\n\taddl\t%eax, -176(%rbp)\n\taddl\t$1, -180(%rbp)\n.L8:\n\tcmpl\t$11, -180(%rbp)\n\tjle\t.L9\n\tmovl\t-176(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\tcmpl\t$1, %edx\n\tjg\t.L10\n\tmovl\t$0, -164(%rbp)\n\tjmp\t.L11\n.L10:\n\tmovl\t-176(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\taddl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t$11, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -164(%rbp)\n.L11:\n\tmovl\t-160(%rbp), %eax\n\tcmpl\t%eax, -164(%rbp)\n\tjne\t.L12\n\tcmpl\t$0, -188(%rbp)\n\tje\t.L13\n\tmovl\t$10, -168(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovl\t-184(%rbp), %eax\n\tmovl\t%eax, -168(%rbp)\n\taddl\t$1, -188(%rbp)\n.L12:\n\taddl\t$1, -184(%rbp)\n.L7:\n\tcmpl\t$9, -184(%rbp)\n\tjle\t.L14\n\tjmp\t.L15\n.L6:\n\tmovl\t$1, -184(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-184(%rbp), %eax\n\tcltq\n\tmovl\t-160(%rbp,%rax,4), %edx\n\tmovl\t-184(%rbp), %eax\n\tcltq\n\tmovl\t-96(%rbp,%rax,4), %eax\n\timull\t%edx, %eax\n\taddl\t%eax, -176(%rbp)\n\taddl\t$1, -184(%rbp)\n.L16:\n\tcmpl\t$11, -184(%rbp)\n\tjle\t.L17\n\tmovl\t-176(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\tcmpl\t$1, %edx\n\tjg\t.L18\n\tmovl\t$0, -168(%rbp)\n\tjmp\t.L15\n.L18:\n\tmovl\t-176(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$780903145, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t%eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\taddl\t%ecx, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, %ecx\n\tmovl\t$11, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -168(%rbp)\n.L15:\n\tcmpl\t$10, -168(%rbp)\n\tje\t.L19\n\tmovl\t-168(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L20\n.L19:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L20:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L22\n\tcall\t__stack_chk_fail@PLT\n.L22:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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] != '?'){ p[i] = s[11 - i] - 48; } else{ u = i; } } if(u){ for(i = 0;i <= 9;i++){ sum = 0; p[u] = i; for(j = 1;j <= 11;j++){ sum+=(p[j]*q[j]); } if(sum % 11 < 2){ c = 0; } else{ c = 11 - sum % 11; } if(c == p[0]){ if(y){ a = 10; } else{ a = i; y++; } } } } else{ for(i = 1;i <= 11;i++){ sum+=(p[i]*q[i]); } if(sum % 11 < 2){ a = 0; } else{ a = 11 - sum % 11; } } if(a != 10){ printf("%d\n",a); } else{ printf("MULTIPLE\n"); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "%d\n" .LC2: .string "MULTIPLE" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $192, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -188(%rbp) movl $0, -176(%rbp) movq $0, -160(%rbp) movq $0, -152(%rbp) movq $0, -144(%rbp) movq $0, -136(%rbp) movq $0, -128(%rbp) movq $0, -120(%rbp) movq $0, -112(%rbp) movq $0, -104(%rbp) movq $0, -96(%rbp) movq $0, -88(%rbp) movq $0, -80(%rbp) movq $0, -72(%rbp) movq $0, -64(%rbp) movq $0, -56(%rbp) movq $0, -48(%rbp) movq $0, -40(%rbp) movl $2, -92(%rbp) movl $3, -88(%rbp) movl $4, -84(%rbp) movl $5, -80(%rbp) movl $6, -76(%rbp) movl $7, -72(%rbp) movl $2, -68(%rbp) movl $3, -64(%rbp) movl $4, -60(%rbp) movl $5, -56(%rbp) movl $6, -52(%rbp) movl $0, -168(%rbp) leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -184(%rbp) jmp .L2 .L5: movl $11, %eax subl -184(%rbp), %eax cltq movzbl -32(%rbp,%rax), %eax cmpb $63, %al je .L3 movl $11, %eax subl -184(%rbp), %eax cltq movzbl -32(%rbp,%rax), %eax movsbl %al, %eax leal -48(%rax), %edx movl -184(%rbp), %eax cltq movl %edx, -160(%rbp,%rax,4) jmp .L4 .L3: movl -184(%rbp), %eax movl %eax, -172(%rbp) .L4: addl $1, -184(%rbp) .L2: cmpl $11, -184(%rbp) jle .L5 cmpl $0, -172(%rbp) je .L6 movl $0, -184(%rbp) jmp .L7 .L14: movl $0, -176(%rbp) movl -172(%rbp), %eax cltq movl -184(%rbp), %edx movl %edx, -160(%rbp,%rax,4) movl $1, -180(%rbp) jmp .L8 .L9: movl -180(%rbp), %eax cltq movl -160(%rbp,%rax,4), %edx movl -180(%rbp), %eax cltq movl -96(%rbp,%rax,4), %eax imull %edx, %eax addl %eax, -176(%rbp) addl $1, -180(%rbp) .L8: cmpl $11, -180(%rbp) jle .L9 movl -176(%rbp), %ecx movslq %ecx, %rax imulq $780903145, %rax, %rax shrq $32, %rax sarl %eax movl %ecx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax addl %edx, %eax subl %eax, %ecx movl %ecx, %edx cmpl $1, %edx jg .L10 movl $0, -164(%rbp) jmp .L11 .L10: movl -176(%rbp), %edx movslq %edx, %rax imulq $780903145, %rax, %rax shrq $32, %rax sarl %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax addl %ecx, %eax movl %edx, %ecx subl %eax, %ecx movl $11, %eax subl %ecx, %eax movl %eax, -164(%rbp) .L11: movl -160(%rbp), %eax cmpl %eax, -164(%rbp) jne .L12 cmpl $0, -188(%rbp) je .L13 movl $10, -168(%rbp) jmp .L12 .L13: movl -184(%rbp), %eax movl %eax, -168(%rbp) addl $1, -188(%rbp) .L12: addl $1, -184(%rbp) .L7: cmpl $9, -184(%rbp) jle .L14 jmp .L15 .L6: movl $1, -184(%rbp) jmp .L16 .L17: movl -184(%rbp), %eax cltq movl -160(%rbp,%rax,4), %edx movl -184(%rbp), %eax cltq movl -96(%rbp,%rax,4), %eax imull %edx, %eax addl %eax, -176(%rbp) addl $1, -184(%rbp) .L16: cmpl $11, -184(%rbp) jle .L17 movl -176(%rbp), %ecx movslq %ecx, %rax imulq $780903145, %rax, %rax shrq $32, %rax sarl %eax movl %ecx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax addl %edx, %eax subl %eax, %ecx movl %ecx, %edx cmpl $1, %edx jg .L18 movl $0, -168(%rbp) jmp .L15 .L18: movl -176(%rbp), %edx movslq %edx, %rax imulq $780903145, %rax, %rax shrq $32, %rax sarl %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax addl %ecx, %eax subl %eax, %edx movl %edx, %ecx movl $11, %eax subl %ecx, %eax movl %eax, -168(%rbp) .L15: cmpl $10, -168(%rbp) je .L19 movl -168(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L20 .L19: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L20: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L22 call __stack_chk_fail@PLT .L22: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%ld%ld\"\n.LC1:\n\t.string\t\"%ld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\taddq\t$1, -16(%rbp)\n.L2:\n\tmovq\t-32(%rbp), %rax\n\tmovq\t-16(%rbp), %rdx\n\tmovl\t%edx, %ecx\n\tsalq\t%cl, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L3\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\txorl\t%ecx, %ecx\n\tcmpq\t%rsi, %rdx\n\tjg\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t$1, %rcx\n\tmovq\t%rdx, %rax\n\tsalq\t%cl, %rax\n\tcmpq\t%rsi, %rax\n\tjle\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tmovq\t%rcx, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L9:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\txorl\t%ecx, %ecx\n\tcmpq\t%rsi, %rdx\n\tjg\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t$1, %rcx\n\tmovq\t%rdx, %rax\n\tsalq\t%cl, %rax\n\tcmpq\t%rsi, %rax\n\tjle\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tmovq\t%rcx, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L9:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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", "index": 10, "inputs": [ "4 20\n", "15043200 358979323846264338\n", "4 37\n", "15043200 92693776096271827\n", "2 100\n", "2 37\n", "24823321 92693776096271827\n", "12899738 158337027091717102\n", "1 109\n", "12899738 686618920047839292\n", "1565492 686618920047839292\n", "1 162\n", "1565492 1138463356571161467\n", "946321 1138463356571161467\n", "1574491 428888260588002706\n", "46617 515914936162568283\n", "46617 997873528434859475\n", "46617 1645528720419702790\n", "72240 316052473663890243\n", "57688 316052473663890243\n", "1142 236152307514161770\n", "1142 338021882461105620\n", "489 338021882461105620\n", "214 26103857378254597\n", "70 9317388634813\n", "84 146673786994\n", "148 146673786994\n", "29 9442735007\n", "6 20\n", "4 7\n", "20 26103857378254597\n", "2 122340544\n", "23 338021882461105620\n", "20 50833363860468281\n", "2 243380694\n", "42588771 5832770700279334\n", "18 338021882461105620\n", "6 166577466\n", "119 575544308122432785\n", "1 40031056583431744\n", "120 1502541996\n", "240 1502541996\n", "240 657052274\n", "21 1542857127522684815\n", "17 100\n", "3 100\n", "2 57\n", "12899738 92693776096271827\n", "6 100\n", "2 109\n", "3 109\n", "12899738 272946151952874087\n", "12899738 355392359513428890\n", "4 109\n", "6 109\n", "17699318 686618920047839292\n", "1 67\n", "14975555 686618920047839292\n", "1 54\n", "18821697 686618920047839292\n", "1 72\n", "19054465 686618920047839292\n", "1 102\n", "22011223 686618920047839292\n", "1 125\n", "1 61\n", "1574491 1138463356571161467\n", "1574491 924149884040589657\n", "1574491 980536653683774287\n", "384481 428888260588002706\n", "384481 515914936162568283\n", "72240 1645528720419702790\n", "144363 316052473663890243\n", "5597 316052473663890243\n", "5597 307210693821963751\n", "5597 276479776809276841\n", "5597 236152307514161770\n", "1142 281973289597514697\n", "1142 274671469234668507\n", "489 26103857378254597\n", "214 20477163314921140\n", "283 20477163314921140\n", "301 20477163314921140\n", "301 10263700922402146\n", "363 10263700922402146\n", "363 15010669856693554\n", "363 5404913929872006\n", "70 5404913929872006\n", "70 22983568257503\n", "70 9962836220891\n", "57 9317388634813\n", "30 9317388634813\n", "30 7161301478296\n", "30 7873218668121\n", "45 7873218668121\n", "45 15688856273711\n", "45 4625011770839\n", "45 3018270591566\n", "84 3018270591566\n", "84 1359786336679\n", "3 20\n", "3 20\n", "25 100\n", "314159265 358979323846264338\n" ], "outputs": [ "3", "35", "4", "33", "6", "5", "32", "34", "7", "36", "39", "8", "40", "41", "38", "44", "45", "46", "42", "43", "48", "49", "50", "47", "37", "31", "30", "29", "2", "1", "51", "26", "54", "52", "27", "28", "55", "25", "53", "56", "24", "23", "22", "57", "3", "6", "5", "33", "5", "6", "6", "35", "35", "5", "5", "36", "7", "36", "6", "36", "7", "36", "7", "35", "7", "6", "40", "40", "40", "41", "41", "45", "41", "46", "46", "46", "46", "48", "48", "46", "47", "47", "46", "45", "45", "46", "44", "47", "39", "38", "38", "39", "38", "38", "38", "39", "37", "36", "36", "34", "3", "3", "3", "31" ], "question": "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\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%ld%ld\"\n.LC1:\n\t.string\t\"%ld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\taddq\t$1, -16(%rbp)\n.L2:\n\tmovq\t-32(%rbp), %rax\n\tmovq\t-16(%rbp), %rdx\n\tmovl\t%edx, %ecx\n\tsalq\t%cl, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L3\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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: .string "%ld%ld" .LC1: .string "%ld" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -24(%rbp), %rdx leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq $0, -16(%rbp) jmp .L2 .L3: addq $1, -16(%rbp) .L2: movq -32(%rbp), %rax movq -16(%rbp), %rdx movl %edx, %ecx salq %cl, %rax movq %rax, %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jle .L3 movq -16(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other text.
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 unsigned long long m4=0x0f0f0f0f0f0f0f0fULL;\n\tconst unsigned long long m8=0x00ff00ff00ff00ffULL;\n\tconst unsigned long long m16=0x0000ffff0000ffffULL;\n\tconst unsigned long long m32=0x00000000ffffffffULL;\n\tn=((n>>1)&m1)+(n&m1);\n\tn=((n>>2)&m2)+(n&m2);\n\tn=((n>>4)&m4)+(n&m4);\n\tn=((n>>8)&m8)+(n&m8);\n\tn=((n>>16)&m16)+(n&m16);\n\tn=((n>>32)&m32)+(n&m32);\n\treturn n;\n}\nunsigned long long clz64(unsigned long long n){\n\tn|=n>>1;\n\tn|=n>>2;\n\tn|=n>>4;\n\tn|=n>>8;\n\tn|=n>>16;\n\tn|=n>>32;\n\treturn 64-popcnt64(n);\n}\n\n#include <stdio.h>\nint main(){\n\tlong long N;\n\tscanf(\"%lld\",&N);\n\tprintf(\"%d\\n\",64-clz64(N));\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tpopcnt64\n\t.type\tpopcnt64, @function\npopcnt64:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -56(%rbp)\n\tmovabsq\t$6148914691236517205, %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovabsq\t$3689348814741910323, %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovabsq\t$1085102592571150095, %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovabsq\t$71777214294589695, %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovabsq\t$281470681808895, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t$4294967295, %eax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t%rax\n\tandq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$2, %rax\n\tandq\t-40(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$4, %rax\n\tandq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$8, %rax\n\tandq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$16, %rax\n\tandq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$32, %rax\n\tandq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tpopcnt64, .-popcnt64\n\t.globl\tclz64\n\t.type\tclz64, @function\nclz64:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t%rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$2, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$4, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$8, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$16, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$32, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tpopcnt64\n\tmovq\t%rax, %rdx\n\tmovl\t$64, %eax\n\tsubq\t%rdx, %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tclz64, .-clz64\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tclz64\n\tmovq\t%rax, %rdx\n\tmovl\t$64, %eax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tmovabsq\t$3689348814741910323, %rdx\n\taddq\t%rax, %rdi\n\tmovq\t%rdi, %rax\n\tandq\t%rdx, %rdi\n\tshrq\t$2, %rax\n\tandq\t%rdx, %rax\n\taddq\t%rdi, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$4, %rdx\n\tandq\t%rcx, %rdx\n\tmovabsq\t$71777214294589695, %rcx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t$8, %rax\n\tandq\t%rcx, %rax\n\tmovabsq\t$281470681808895, %rcx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$16, %rdx\n\tandq\t%rcx, %rdx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tmovl\t%edx, %edx\n\tshrq\t$32, %rax\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tpopcnt64, .-popcnt64\n\t.p2align 4\n\t.globl\tclz64\n\t.type\tclz64, @function\nclz64:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tmovabsq\t$6148914691236517205, %rcx\n\tmovq\t%rdi, %rax\n\tshrq\t%rax\n\torq\t%rdi, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$2, %rdx\n\torq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$4, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$8, %rdx\n\torq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$16, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$32, %rdx\n\torq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t%rax\n\tandq\t%rcx, %rax\n\tmovabsq\t$3689348814741910323, %rcx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$2, %rdx\n\tandq\t%rcx, %rdx\n\tmovabsq\t$1085102592571150095, %rcx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t$4, %rax\n\tandq\t%rcx, %rax\n\tmovabsq\t$71777214294589695, %rcx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$8, %rdx\n\tandq\t%rcx, %rdx\n\tmovabsq\t$281470681808895, %rcx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t$16, %rax\n\tandq\t%rcx, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tmovl\t%eax, %eax\n\tshrq\t$32, %rdx\n\taddq\t%rax, %rdx\n\tmovl\t$64, %eax\n\tsubq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tclz64, .-clz64\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\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.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rdi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\tclz64\n\tmovl\t$64, %edx\n\tmovl\t$1, %edi\n\tsubq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L7:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE25:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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$3689348814741910323, %rdx\n\taddq\t%rax, %rdi\n\tmovq\t%rdi, %rax\n\tandq\t%rdx, %rdi\n\tshrq\t$2, %rax\n\tandq\t%rdx, %rax\n\taddq\t%rdi, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$4, %rdx\n\tandq\t%rcx, %rdx\n\tmovabsq\t$71777214294589695, %rcx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t$8, %rax\n\tandq\t%rcx, %rax\n\tmovabsq\t$281470681808895, %rcx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$16, %rdx\n\tandq\t%rcx, %rdx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tmovl\t%edx, %edx\n\tshrq\t$32, %rax\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tpopcnt64, .-popcnt64\n\t.p2align 4\n\t.globl\tclz64\n\t.type\tclz64, @function\nclz64:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tmovabsq\t$6148914691236517205, %rcx\n\tmovq\t%rdi, %rax\n\tshrq\t%rax\n\torq\t%rdi, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$2, %rdx\n\torq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$4, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$8, %rdx\n\torq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$16, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$32, %rdx\n\torq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t%rax\n\tandq\t%rcx, %rax\n\tmovabsq\t$3689348814741910323, %rcx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$2, %rdx\n\tandq\t%rcx, %rdx\n\tmovabsq\t$1085102592571150095, %rcx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t$4, %rax\n\tandq\t%rcx, %rax\n\tmovabsq\t$71777214294589695, %rcx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tandq\t%rcx, %rax\n\tshrq\t$8, %rdx\n\tandq\t%rcx, %rdx\n\tmovabsq\t$281470681808895, %rcx\n\taddq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tandq\t%rcx, %rdx\n\tshrq\t$16, %rax\n\tandq\t%rcx, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tmovl\t%eax, %eax\n\tshrq\t$32, %rdx\n\taddq\t%rax, %rdx\n\tmovl\t$64, %eax\n\tsubq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tclz64, .-clz64\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%lld\"\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.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rdi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\tclz64\n\tmovl\t$64, %edx\n\tmovl\t$1, %edi\n\tsubq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L7:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE25:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "unsigned long long popcnt64(unsigned long long n){\n\tconst unsigned long long m1=0x5555555555555555ULL;\n\tconst unsigned long long m2=0x3333333333333333ULL;\n\tconst unsigned long long m4=0x0f0f0f0f0f0f0f0fULL;\n\tconst unsigned long long m8=0x00ff00ff00ff00ffULL;\n\tconst unsigned long long m16=0x0000ffff0000ffffULL;\n\tconst unsigned long long m32=0x00000000ffffffffULL;\n\tn=((n>>1)&m1)+(n&m1);\n\tn=((n>>2)&m2)+(n&m2);\n\tn=((n>>4)&m4)+(n&m4);\n\tn=((n>>8)&m8)+(n&m8);\n\tn=((n>>16)&m16)+(n&m16);\n\tn=((n>>32)&m32)+(n&m32);\n\treturn n;\n}\nunsigned long long clz64(unsigned long long n){\n\tn|=n>>1;\n\tn|=n>>2;\n\tn|=n>>4;\n\tn|=n>>8;\n\tn|=n>>16;\n\tn|=n>>32;\n\treturn 64-popcnt64(n);\n}\n\n#include <stdio.h>\nint main(){\n\tlong long N;\n\tscanf(\"%lld\",&N);\n\tprintf(\"%d\\n\",64-clz64(N));\n\treturn 0;\n}", "index": 26, "inputs": [ "1\n", "2\n", "4\n", "9\n", "19\n", "38\n", "83\n", "159\n", "296\n", "000\n", "545\n", "1241\n", "2473\n", "6042\n", "9030\n", "17679\n", "33209\n", "96405\n", "140502\n", "299812\n", "763679\n", "1237235\n", "3\n", "7\n", "5\n", "6\n", "8\n", "10\n", "13\n", "14\n", "12\n", "18\n", "20\n", "15\n", "11\n", "30\n", "28\n", "51\n", "16\n", "25\n", "17\n", "22\n", "49\n", "47\n", "29\n", "58\n", "52\n", "95\n", "48\n", "27\n", "31\n", "33\n", "24\n", "72\n", "74\n", "44\n", "34\n", "21\n", "26\n", "23\n", "32\n", "35\n", "45\n", "97\n", "42\n", "36\n", "56\n", "65\n", "62\n", "41\n", "115\n", "61\n", "60\n", "54\n", "59\n", "50\n", "96\n", "158\n", "55\n", "40\n", "43\n", "46\n", "92\n", "69\n", "68\n", "86\n", "79\n", "88\n", "114\n", "126\n", "91\n", "80\n", "136\n", "418\n", "39\n", "144\n", "134\n", "225\n", "135\n", "87\n", "0\n", "0\n" ], "outputs": [ "1\n", "2\n", "3\n", "4\n", "5\n", "6\n", "7\n", "8\n", "9\n", "0\n", "10\n", "11\n", "12\n", "13\n", "14\n", "15\n", "16\n", "17\n", "18\n", "19\n", "20\n", "21\n", "2\n", "3\n", "3\n", "3\n", "4\n", "4\n", "4\n", "4\n", "4\n", "5\n", "5\n", "4\n", "4\n", "5\n", "5\n", "6\n", "5\n", "5\n", "5\n", "5\n", "6\n", "6\n", "5\n", "6\n", "6\n", "7\n", "6\n", "5\n", "5\n", "6\n", "5\n", "7\n", "7\n", "6\n", "6\n", "5\n", "5\n", "5\n", "6\n", "6\n", "6\n", "7\n", "6\n", "6\n", "6\n", "7\n", "6\n", "6\n", "7\n", "6\n", "6\n", "6\n", "6\n", "6\n", "7\n", "8\n", "6\n", "6\n", "6\n", "6\n", "7\n", "7\n", "7\n", "7\n", "7\n", "7\n", "7\n", "7\n", "7\n", "7\n", "8\n", "9\n", "6\n", "8\n", "8\n", "8\n", "8\n", "7\n", "0\n", "0\n" ], "question": "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 unsigned long long m4=0x0f0f0f0f0f0f0f0fULL;\n\tconst unsigned long long m8=0x00ff00ff00ff00ffULL;\n\tconst unsigned long long m16=0x0000ffff0000ffffULL;\n\tconst unsigned long long m32=0x00000000ffffffffULL;\n\tn=((n>>1)&m1)+(n&m1);\n\tn=((n>>2)&m2)+(n&m2);\n\tn=((n>>4)&m4)+(n&m4);\n\tn=((n>>8)&m8)+(n&m8);\n\tn=((n>>16)&m16)+(n&m16);\n\tn=((n>>32)&m32)+(n&m32);\n\treturn n;\n}\nunsigned long long clz64(unsigned long long n){\n\tn|=n>>1;\n\tn|=n>>2;\n\tn|=n>>4;\n\tn|=n>>8;\n\tn|=n>>16;\n\tn|=n>>32;\n\treturn 64-popcnt64(n);\n}\n\n#include <stdio.h>\nint main(){\n\tlong long N;\n\tscanf(\"%lld\",&N);\n\tprintf(\"%d\\n\",64-clz64(N));\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tpopcnt64\n\t.type\tpopcnt64, @function\npopcnt64:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -56(%rbp)\n\tmovabsq\t$6148914691236517205, %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovabsq\t$3689348814741910323, %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovabsq\t$1085102592571150095, %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovabsq\t$71777214294589695, %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovabsq\t$281470681808895, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t$4294967295, %eax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t%rax\n\tandq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$2, %rax\n\tandq\t-40(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$4, %rax\n\tandq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$8, %rax\n\tandq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$16, %rax\n\tandq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tshrq\t$32, %rax\n\tandq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tandq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tpopcnt64, .-popcnt64\n\t.globl\tclz64\n\t.type\tclz64, @function\nclz64:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t%rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$2, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$4, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$8, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$16, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tshrq\t$32, %rax\n\torq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tpopcnt64\n\tmovq\t%rax, %rdx\n\tmovl\t$64, %eax\n\tsubq\t%rdx, %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tclz64, .-clz64\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tclz64\n\tmovq\t%rax, %rdx\n\tmovl\t$64, %eax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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=0x0f0f0f0f0f0f0f0fULL; const unsigned long long m8=0x00ff00ff00ff00ffULL; const unsigned long long m16=0x0000ffff0000ffffULL; const unsigned long long m32=0x00000000ffffffffULL; n=((n>>1)&m1)+(n&m1); n=((n>>2)&m2)+(n&m2); n=((n>>4)&m4)+(n&m4); n=((n>>8)&m8)+(n&m8); n=((n>>16)&m16)+(n&m16); n=((n>>32)&m32)+(n&m32); return n; } unsigned long long clz64(unsigned long long n){ n|=n>>1; n|=n>>2; n|=n>>4; n|=n>>8; n|=n>>16; n|=n>>32; return 64-popcnt64(n); } #include <stdio.h> int main(){ long long N; scanf("%lld",&N); printf("%d\n",64-clz64(N)); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl popcnt64 .type popcnt64, @function popcnt64: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -56(%rbp) movabsq $6148914691236517205, %rax movq %rax, -48(%rbp) movabsq $3689348814741910323, %rax movq %rax, -40(%rbp) movabsq $1085102592571150095, %rax movq %rax, -32(%rbp) movabsq $71777214294589695, %rax movq %rax, -24(%rbp) movabsq $281470681808895, %rax movq %rax, -16(%rbp) movl $4294967295, %eax movq %rax, -8(%rbp) movq -56(%rbp), %rax shrq %rax andq -48(%rbp), %rax movq %rax, %rdx movq -56(%rbp), %rax andq -48(%rbp), %rax addq %rdx, %rax movq %rax, -56(%rbp) movq -56(%rbp), %rax shrq $2, %rax andq -40(%rbp), %rax movq %rax, %rdx movq -56(%rbp), %rax andq -40(%rbp), %rax addq %rdx, %rax movq %rax, -56(%rbp) movq -56(%rbp), %rax shrq $4, %rax andq -32(%rbp), %rax movq %rax, %rdx movq -56(%rbp), %rax andq -32(%rbp), %rax addq %rdx, %rax movq %rax, -56(%rbp) movq -56(%rbp), %rax shrq $8, %rax andq -24(%rbp), %rax movq %rax, %rdx movq -56(%rbp), %rax andq -24(%rbp), %rax addq %rdx, %rax movq %rax, -56(%rbp) movq -56(%rbp), %rax shrq $16, %rax andq -16(%rbp), %rax movq %rax, %rdx movq -56(%rbp), %rax andq -16(%rbp), %rax addq %rdx, %rax movq %rax, -56(%rbp) movq -56(%rbp), %rax shrq $32, %rax andq -8(%rbp), %rax movq %rax, %rdx movq -56(%rbp), %rax andq -8(%rbp), %rax addq %rdx, %rax movq %rax, -56(%rbp) movq -56(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size popcnt64, .-popcnt64 .globl clz64 .type clz64, @function clz64: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $8, %rsp movq %rdi, -8(%rbp) movq -8(%rbp), %rax shrq %rax orq %rax, -8(%rbp) movq -8(%rbp), %rax shrq $2, %rax orq %rax, -8(%rbp) movq -8(%rbp), %rax shrq $4, %rax orq %rax, -8(%rbp) movq -8(%rbp), %rax shrq $8, %rax orq %rax, -8(%rbp) movq -8(%rbp), %rax shrq $16, %rax orq %rax, -8(%rbp) movq -8(%rbp), %rax shrq $32, %rax orq %rax, -8(%rbp) movq -8(%rbp), %rax movq %rax, %rdi call popcnt64 movq %rax, %rdx movl $64, %eax subq %rdx, %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size clz64, .-clz64 .section .rodata .LC0: .string "%lld" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB2: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -16(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -16(%rbp), %rax movq %rax, %rdi call clz64 movq %rax, %rdx movl $64, %eax subq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L7 call __stack_chk_fail@PLT .L7: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE2: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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++) {\n\t\tif (scanf(\"%d\", &a[i]) != 1) return 1;\n\t}\n\tminIndex = 0;\n\tminValue = a[0];\n\tfor (i = 1; i < N; i++) {\n\t\tif (a[i] < minValue) {\n\t\t\tminIndex = i;\n\t\t\tminValue = a[i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", minIndex + 1);\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tN\n\t.bss\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 458056\na:\n\t.zero\t458056\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tN(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L2\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L5\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L5:\n\taddl\t$1, -12(%rbp)\n.L4:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L6\n\tmovl\t$0, -8(%rbp)\n\tmovl\ta(%rip), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L7\n.L9:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjle\t.L8\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n.L8:\n\taddl\t$1, -12(%rbp)\n.L7:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L9\n\tmovl\t-8(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L3:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC0(%rip), %r13\n\txorl\t%eax, %eax\n\tleaq\tN(%rip), %rsi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L5\n\tcmpl\t$0, N(%rip)\n\tjle\t.L10\n\tleaq\ta(%rip), %r12\n\txorl\t%ebp, %ebp\n\tmovq\t%r12, %rbx\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovslq\tN(%rip), %rax\n\taddl\t$1, %ebp\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %eax\n\tjle\t.L15\n.L6:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L16\n.L5:\n\tmovl\t$1, %eax\n.L1:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L15:\n\t.cfi_restore_state\n\tmovl\ta(%rip), %edi\n\tcmpl\t$1, %eax\n\tjle\t.L10\n\tmovl\t$1, %ecx\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%r12,%rcx,4), %esi\n\tcmpl\t%edi, %esi\n\tjge\t.L7\n\tmovl\t%esi, %edi\n\tmovl\t%ecx, %edx\n.L7:\n\taddq\t$1, %rcx\n\tcmpq\t%rcx, %rax\n\tjne\t.L8\n.L4:\n\taddl\t$1, %edx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\txorl\t%eax, %eax\n\tjmp\t.L1\n.L10:\n\txorl\t%edx, %edx\n\tjmp\t.L4\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 458056\na:\n\t.zero\t458056\n\t.globl\tN\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC0(%rip), %r13\n\txorl\t%eax, %eax\n\tleaq\tN(%rip), %rsi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tjne\t.L5\n\tcmpl\t$0, N(%rip)\n\tjle\t.L10\n\tleaq\ta(%rip), %r12\n\txorl\t%ebp, %ebp\n\tmovq\t%r12, %rbx\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovslq\tN(%rip), %rax\n\taddl\t$1, %ebp\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %eax\n\tjle\t.L15\n.L6:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L16\n.L5:\n\tmovl\t$1, %eax\n.L1:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L15:\n\t.cfi_restore_state\n\tmovl\ta(%rip), %edi\n\tcmpl\t$1, %eax\n\tjle\t.L10\n\tmovl\t$1, %ecx\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%r12,%rcx,4), %esi\n\tcmpl\t%edi, %esi\n\tjge\t.L7\n\tmovl\t%esi, %edi\n\tmovl\t%ecx, %edx\n.L7:\n\taddq\t$1, %rcx\n\tcmpq\t%rcx, %rax\n\tjne\t.L8\n.L4:\n\taddl\t$1, %edx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\txorl\t%eax, %eax\n\tjmp\t.L1\n.L10:\n\txorl\t%edx, %edx\n\tjmp\t.L4\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 458056\na:\n\t.zero\t458056\n\t.globl\tN\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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++) {\n\t\tif (scanf(\"%d\", &a[i]) != 1) return 1;\n\t}\n\tminIndex = 0;\n\tminValue = a[0];\n\tfor (i = 1; i < N; i++) {\n\t\tif (a[i] < minValue) {\n\t\t\tminIndex = i;\n\t\t\tminValue = a[i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", minIndex + 1);\n\treturn 0;\n}\n\n", "index": 33, "inputs": [ "6\n8 6 9 0 2 1\n", "6\n8 6 9 1 2 0\n", "6\n3 33 0 2 10 0\n", "6\n3 18 3 4 0 0\n", "6\n6 0 9 1 2 1\n", "6\n1 6 9 1 2 0\n", "6\n1 6 9 0 2 0\n", "6\n8 3 9 1 2 1\n", "6\n6 6 9 0 2 1\n", "6\n8 6 9 2 2 0\n", "6\n1 6 9 1 3 0\n", "6\n2 6 9 0 2 0\n", "6\n8 3 9 1 3 1\n", "6\n6 6 9 0 3 1\n", "6\n8 10 9 2 2 0\n", "6\n1 6 9 1 5 0\n", "6\n2 6 9 0 3 0\n", "6\n6 6 9 0 3 0\n", "6\n8 10 9 0 2 0\n", "6\n1 6 9 2 5 0\n", "6\n2 6 9 0 1 0\n", "6\n6 10 9 0 3 1\n", "6\n8 10 9 -1 2 0\n", "6\n1 6 9 2 5 -1\n", "6\n6 10 10 0 3 1\n", "6\n8 10 9 -1 4 0\n", "6\n1 9 9 2 5 0\n", "6\n6 10 7 0 3 1\n", "6\n8 10 9 -1 5 0\n", "6\n6 10 2 0 3 1\n", "6\n8 10 1 -1 5 0\n", "6\n6 10 2 0 3 0\n", "6\n8 10 1 -1 5 1\n", "6\n8 10 2 -1 5 1\n", "6\n8 10 2 -1 5 0\n", "6\n8 6 2 -1 5 1\n", "6\n8 6 2 -1 1 1\n", "6\n8 10 2 -1 1 1\n", "6\n8 10 2 0 1 1\n", "6\n8 20 2 0 1 1\n", "6\n8 20 2 0 2 1\n", "6\n8 20 2 0 2 2\n", "6\n8 20 2 0 1 2\n", "6\n12 20 2 0 1 2\n", "6\n12 20 2 0 2 2\n", "6\n12 20 2 0 3 2\n", "6\n12 20 2 0 6 2\n", "6\n12 20 2 0 6 0\n", "6\n5 20 2 0 6 0\n", "6\n3 20 2 0 6 0\n", "6\n5 20 2 1 6 0\n", "6\n5 20 2 1 6 -1\n", "6\n5 17 2 1 6 -1\n", "6\n5 17 2 2 6 -1\n", "6\n5 17 3 2 6 -1\n", "6\n10 17 3 2 6 -1\n", "6\n10 17 3 2 6 0\n", "6\n9 17 3 2 6 0\n", "6\n3 17 3 2 6 0\n", "6\n3 18 3 2 6 0\n", "6\n3 18 3 2 10 0\n", "6\n3 33 3 2 10 0\n", "6\n3 33 0 2 10 -1\n", "6\n3 55 0 2 10 -1\n", "6\n3 55 0 4 10 -1\n", "6\n3 55 0 4 10 0\n", "6\n3 55 0 4 10 1\n", "6\n3 55 0 4 12 1\n", "6\n3 55 0 1 12 1\n", "6\n3 55 0 1 6 1\n", "6\n3 59 0 1 6 1\n", "6\n3 59 0 1 10 1\n", "6\n3 59 0 0 10 1\n", "6\n5 59 0 0 10 1\n", "6\n10 59 0 0 10 1\n", "6\n10 37 0 0 10 1\n", "6\n10 60 0 0 10 1\n", "6\n10 60 0 0 3 1\n", "6\n10 60 0 0 1 1\n", "6\n9 60 0 0 1 1\n", "6\n2 6 9 1 2 1\n", "6\n8 6 9 0 2 0\n", "6\n8 6 9 4 2 0\n", "6\n1 12 9 1 2 0\n", "6\n1 6 7 0 2 0\n", "6\n8 3 9 0 2 1\n", "6\n6 6 15 0 2 1\n", "6\n16 6 9 0 2 0\n", "6\n1 6 9 0 3 0\n", "6\n2 6 9 0 2 1\n", "6\n8 3 10 1 3 1\n", "6\n6 6 9 1 3 1\n", "6\n11 10 9 2 2 0\n", "6\n2 6 18 0 3 0\n", "6\n9 6 9 0 3 0\n", "6\n8 10 9 0 0 0\n", "6\n1 6 9 2 6 0\n", "6\n2 7 9 0 1 0\n", "6\n6 10 3 0 3 1\n", "6\n8 10 1 -1 2 0\n", "6\n8 6 9 1 2 1\n", "6\n8 6 9 1 2 1\n" ], "outputs": [ "4\n", "6\n", "3\n", "5\n", "2\n", "6\n", "4\n", "4\n", "4\n", "6\n", "6\n", "4\n", "4\n", "4\n", "6\n", "6\n", "4\n", "4\n", "4\n", "6\n", "4\n", "4\n", "4\n", "6\n", "4\n", "4\n", "6\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "6\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "3\n", "4\n", "4\n", "6\n", "6\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "4\n", "6\n", "4\n", "4\n", "4\n", "6\n", "4\n", "4\n", "4\n", "4\n", "4\n" ], "question": "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++) {\n\t\tif (scanf(\"%d\", &a[i]) != 1) return 1;\n\t}\n\tminIndex = 0;\n\tminValue = a[0];\n\tfor (i = 1; i < N; i++) {\n\t\tif (a[i] < minValue) {\n\t\t\tminIndex = i;\n\t\t\tminValue = a[i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", minIndex + 1);\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tN\n\t.bss\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 458056\na:\n\t.zero\t458056\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tN(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L2\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$1, %eax\n\tje\t.L5\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L5:\n\taddl\t$1, -12(%rbp)\n.L4:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L6\n\tmovl\t$0, -8(%rbp)\n\tmovl\ta(%rip), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L7\n.L9:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjle\t.L8\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n.L8:\n\taddl\t$1, -12(%rbp)\n.L7:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L9\n\tmovl\t-8(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L3:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 1; } minIndex = 0; minValue = a[0]; for (i = 1; i < N; i++) { if (a[i] < minValue) { minIndex = i; minValue = a[i]; } } printf("%d\n", minIndex + 1); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl N .bss .align 4 .type N, @object .size N, 4 N: .zero 4 .globl a .align 32 .type a, @object .size a, 458056 a: .zero 458056 .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp leaq N(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpl $1, %eax je .L2 movl $1, %eax jmp .L3 .L2: movl $0, -12(%rbp) jmp .L4 .L6: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpl $1, %eax je .L5 movl $1, %eax jmp .L3 .L5: addl $1, -12(%rbp) .L4: movl N(%rip), %eax cmpl %eax, -12(%rbp) jl .L6 movl $0, -8(%rbp) movl a(%rip), %eax movl %eax, -4(%rbp) movl $1, -12(%rbp) jmp .L7 .L9: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -4(%rbp) jle .L8 movl -12(%rbp), %eax movl %eax, -8(%rbp) movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -4(%rbp) .L8: addl $1, -12(%rbp) .L7: movl N(%rip), %eax cmpl %eax, -12(%rbp) jl .L9 movl -8(%rbp), %eax addl $1, %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L3: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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)\n{\n int a, b;\n top = 0;\n char s[100];\n \n while(scanf(\"%s\", s) != EOF){\n if ( s[0] == '+' ){\n a = pop();\n b = pop();\n push(a+b);\n }\n else if (s[0] == '-'){\n b = pop();\n a = pop();\n push(a-b);\n }\n else if (s[0] == '*'){\n b = pop();\n a = pop();\n push(a*b);\n }\n else{\n push(atoi(s));\n }\n } \n printf(\"%d\\n\", pop() );\n return (0);\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ttop\n\t.bss\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.globl\tS\n\t.align 32\n\t.type\tS, @object\n\t.size\tS, 40000\nS:\n\t.zero\t40000\n\t.text\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\ttop(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tmovl\ttop(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tS(%rip), %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tpush, .-push\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\ttop(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tmovl\ttop(%rip), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tS(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tpop, .-pop\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\taddq\t$-128, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, top(%rip)\n\tjmp\t.L5\n.L9:\n\tmovzbl\t-112(%rbp), %eax\n\tcmpb\t$43, %al\n\tjne\t.L6\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -116(%rbp)\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -120(%rbp)\n\tmovl\t-116(%rbp), %edx\n\tmovl\t-120(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edi\n\tcall\tpush\n\tjmp\t.L5\n.L6:\n\tmovzbl\t-112(%rbp), %eax\n\tcmpb\t$45, %al\n\tjne\t.L7\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -120(%rbp)\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -116(%rbp)\n\tmovl\t-116(%rbp), %eax\n\tsubl\t-120(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tpush\n\tjmp\t.L5\n.L7:\n\tmovzbl\t-112(%rbp), %eax\n\tcmpb\t$42, %al\n\tjne\t.L8\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -120(%rbp)\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -116(%rbp)\n\tmovl\t-116(%rbp), %eax\n\timull\t-120(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tpush\n\tjmp\t.L5\n.L8:\n\tleaq\t-112(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tatoi@PLT\n\tmovl\t%eax, %edi\n\tcall\tpush\n.L5:\n\tleaq\t-112(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$-1, %eax\n\tjne\t.L9\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tpush, .-push\n\t.p2align 4\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tleaq\tS(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %eax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tpop, .-pop\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.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\tS(%rip), %rbx\n\tsubq\t$112, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 104(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovl\t$0, top(%rip)\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$-1, %eax\n\tje\t.L13\n\tmovzbl\t(%rsp), %eax\n\tcmpb\t$43, %al\n\tje\t.L14\n\tcmpb\t$45, %al\n\tje\t.L15\n\tcmpb\t$42, %al\n\tjne\t.L9\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %esi\n\tmovslq\t%esi, %rcx\n\tmovl\t%esi, top(%rip)\n\tmovl\t(%rbx,%rcx,4), %edx\n\timull\t(%rbx,%rax,4), %edx\n\tmovl\t%edx, (%rbx,%rcx,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %ecx\n\tmovl\t(%rbx,%rax,4), %eax\n\tmovslq\t%ecx, %rdx\n\tmovl\t%ecx, top(%rip)\n\taddl\t%eax, (%rbx,%rdx,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %esi\n\tmovslq\t%esi, %rcx\n\tmovl\t%esi, top(%rip)\n\tmovl\t(%rbx,%rcx,4), %edx\n\tsubl\t(%rbx,%rax,4), %edx\n\tmovl\t%edx, (%rbx,%rcx,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovl\t$10, %edx\n\txorl\t%esi, %esi\n\tmovq\t%rbp, %rdi\n\tcall\tstrtol@PLT\n\tmovq\t%rax, %r8\n\tmovl\ttop(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tcltq\n\tmovl\t%r8d, (%rbx,%rax,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovslq\ttop(%rip), %rax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tmovl\t(%rbx,%rax,4), %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$112, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE41:\n\t.size\tmain, .-main\n\t.globl\tS\n\t.bss\n\t.align 32\n\t.type\tS, @object\n\t.size\tS, 40000\nS:\n\t.zero\t40000\n\t.globl\ttop\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, .-push\n\t.p2align 4\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tleaq\tS(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %eax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tpop, .-pop\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.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\tS(%rip), %rbx\n\tsubq\t$112, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 104(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovl\t$0, top(%rip)\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$-1, %eax\n\tje\t.L13\n\tmovzbl\t(%rsp), %eax\n\tcmpb\t$43, %al\n\tje\t.L14\n\tcmpb\t$45, %al\n\tje\t.L15\n\tcmpb\t$42, %al\n\tjne\t.L9\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %esi\n\tmovslq\t%esi, %rcx\n\tmovl\t%esi, top(%rip)\n\tmovl\t(%rbx,%rcx,4), %edx\n\timull\t(%rbx,%rax,4), %edx\n\tmovl\t%edx, (%rbx,%rcx,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %ecx\n\tmovl\t(%rbx,%rax,4), %eax\n\tmovslq\t%ecx, %rdx\n\tmovl\t%ecx, top(%rip)\n\taddl\t%eax, (%rbx,%rdx,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tmovslq\ttop(%rip), %rax\n\tleal\t-1(%rax), %esi\n\tmovslq\t%esi, %rcx\n\tmovl\t%esi, top(%rip)\n\tmovl\t(%rbx,%rcx,4), %edx\n\tsubl\t(%rbx,%rax,4), %edx\n\tmovl\t%edx, (%rbx,%rcx,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovl\t$10, %edx\n\txorl\t%esi, %esi\n\tmovq\t%rbp, %rdi\n\tcall\tstrtol@PLT\n\tmovq\t%rax, %r8\n\tmovl\ttop(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tcltq\n\tmovl\t%r8d, (%rbx,%rax,4)\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovslq\ttop(%rip), %rax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tmovl\t(%rbx,%rax,4), %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$112, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE41:\n\t.size\tmain, .-main\n\t.globl\tS\n\t.bss\n\t.align 32\n\t.type\tS, @object\n\t.size\tS, 40000\nS:\n\t.zero\t40000\n\t.globl\ttop\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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)\n{\n int a, b;\n top = 0;\n char s[100];\n \n while(scanf(\"%s\", s) != EOF){\n if ( s[0] == '+' ){\n a = pop();\n b = pop();\n push(a+b);\n }\n else if (s[0] == '-'){\n b = pop();\n a = pop();\n push(a-b);\n }\n else if (s[0] == '*'){\n b = pop();\n a = pop();\n push(a*b);\n }\n else{\n push(atoi(s));\n }\n } \n printf(\"%d\\n\", pop() );\n return (0);\n}\n\n", "index": 20, "inputs": [ "1 4 + 3 4 - *\n", "1 3 +\n", "1 4 + 2 4 - *\n", "0 3 +\n", "1 1 + 2 4 - *\n", "0 3 *\n", "1 4 + 3 8 - *\n", "0 5 +\n", "1 1 + 3 4 - *\n", "1 4 * 3 1 - *\n", "1 4 * 3 8 - *\n", "1 1 + 5 4 - *\n", "1 4 * 3 1 - +\n", "1 4 * 3 0 - *\n", "2 4 * 3 1 - +\n", "2 4 * 3 0 - *\n", "2 4 * 3 0 - +\n", "2 4 * 6 0 - *\n", "2 4 * 5 0 - +\n", "1 4 * 5 0 - +\n", "1 4 * 5 0 - *\n", "1 4 + 5 0 - *\n", "2 4 + 5 0 - *\n", "1 8 + 2 4 - *\n", "0 1 +\n", "2 1 + 2 4 - *\n", "1 3 * 3 4 - *\n", "1 1 + 5 11 - *\n", "2 4 * 6 0 - +\n", "2 4 + 6 0 - *\n", "4 4 + 5 0 - *\n", "1 8 + 1 4 - *\n", "4 4 * 6 1 - +\n", "1 4 * 7 0 - *\n", "0 0 + 6 13 - +\n", "1 7 * 7 0 - *\n", "1 7 + 3 8 - *\n", "2 4 * 4 0 - *\n", "1 4 * 17 0 - *\n", "1 5 + 0 4 - *\n", "1 8 + 2 4 - +\n", "4 3 + 5 0 - *\n", "1 2 + 1 4 - *\n", "1 6 + 1 4 - *\n", "0 0 + 6 21 - +\n", "12 4 +\n", "22 1 +\n", "17 1 +\n", "1 4 * 2 6 - *\n", "1 12 + 3 8 - *\n", "1 7 * 8 0 - +\n", "1 0 + 6 21 - +\n", "13 4 +\n", "17 2 +\n", "1 2 * 2 6 - *\n", "1 12 + 3 5 - *\n", "2 0 + 6 21 - +\n", "10 1 + 2 0 - *\n", "23 4 +\n", "6 7 *\n", "23 6 +\n", "25 1 +\n", "44 1 +\n", "0 6 + 0 5 - *\n", "2 28 *\n", "0 11 + 2 5 - *\n", "1 11 + 2 5 - *\n", "2 17 *\n", "1 11 + 2 6 - *\n", "13 3 *\n", "0 10 + 5 0 - *\n", "2 2 + 14 1 - *\n", "1 52 +\n", "2 31 *\n", "1 31 *\n", "0 11 + 0 5 - *\n", "2 2 * 3 10 - *\n", "2 2 * 5 10 - +\n", "36 2 +\n", "1 37 *\n", "2 52 +\n", "2 58 *\n", "1 11 + 0 5 - *\n", "2 95 +\n", "1 58 *\n", "13 5 *\n", "44 0 +\n", "36 7 +\n", "6 14 *\n", "2 115 +\n", "2 1 + 22 1 - *\n", "6 18 *\n", "0 4 +\n", "1 4 * 3 4 - *\n", "0 0 *\n", "0 0 +\n", "1 0 *\n", "1 1 + 5 7 - *\n", "2 0 *\n", "1 0 + 5 7 - *\n", "1 2 + 3 4 - *\n", "1 2 +\n", "1 2 +\n" ], "outputs": [ "-5\n", "4\n", "-10\n", "3\n", "-4\n", "0\n", "-25\n", "5\n", "-2\n", "8\n", "-20\n", "2\n", "6\n", "12\n", "10\n", "24\n", "11\n", "48\n", "13\n", "9\n", "20\n", "25\n", "30\n", "-18\n", "1\n", "-6\n", "-3\n", "-12\n", "14\n", "36\n", "40\n", "-27\n", "21\n", "28\n", "-7\n", "49\n", "-40\n", "32\n", "68\n", "-24\n", "7\n", "35\n", "-9\n", "-21\n", "-15\n", "16\n", "23\n", "18\n", "-16\n", "-65\n", "15\n", "-14\n", "17\n", "19\n", "-8\n", "-26\n", "-13\n", "22\n", "27\n", "42\n", "29\n", "26\n", "45\n", "-30\n", "56\n", "-33\n", "-36\n", "34\n", "-48\n", "39\n", "50\n", "52\n", "53\n", "62\n", "31\n", "-55\n", "-28\n", "-1\n", "38\n", "37\n", "54\n", "116\n", "-60\n", "97\n", "58\n", "65\n", "44\n", "43\n", "84\n", "117\n", "63\n", "108\n", "4\n", "-4\n", "0\n", "0\n", "0\n", "-4\n", "0\n", "-2\n", "-3\n", "3\n", "3\n" ], "question": "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)\n{\n int a, b;\n top = 0;\n char s[100];\n \n while(scanf(\"%s\", s) != EOF){\n if ( s[0] == '+' ){\n a = pop();\n b = pop();\n push(a+b);\n }\n else if (s[0] == '-'){\n b = pop();\n a = pop();\n push(a-b);\n }\n else if (s[0] == '*'){\n b = pop();\n a = pop();\n push(a*b);\n }\n else{\n push(atoi(s));\n }\n } \n printf(\"%d\\n\", pop() );\n return (0);\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ttop\n\t.bss\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.globl\tS\n\t.align 32\n\t.type\tS, @object\n\t.size\tS, 40000\nS:\n\t.zero\t40000\n\t.text\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\ttop(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tmovl\ttop(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tS(%rip), %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tpush, .-push\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\ttop(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tmovl\ttop(%rip), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tS(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tpop, .-pop\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\taddq\t$-128, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, top(%rip)\n\tjmp\t.L5\n.L9:\n\tmovzbl\t-112(%rbp), %eax\n\tcmpb\t$43, %al\n\tjne\t.L6\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -116(%rbp)\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -120(%rbp)\n\tmovl\t-116(%rbp), %edx\n\tmovl\t-120(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edi\n\tcall\tpush\n\tjmp\t.L5\n.L6:\n\tmovzbl\t-112(%rbp), %eax\n\tcmpb\t$45, %al\n\tjne\t.L7\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -120(%rbp)\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -116(%rbp)\n\tmovl\t-116(%rbp), %eax\n\tsubl\t-120(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tpush\n\tjmp\t.L5\n.L7:\n\tmovzbl\t-112(%rbp), %eax\n\tcmpb\t$42, %al\n\tjne\t.L8\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -120(%rbp)\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, -116(%rbp)\n\tmovl\t-116(%rbp), %eax\n\timull\t-120(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tpush\n\tjmp\t.L5\n.L8:\n\tleaq\t-112(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tatoi@PLT\n\tmovl\t%eax, %edi\n\tcall\tpush\n.L5:\n\tleaq\t-112(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$-1, %eax\n\tjne\t.L9\n\tmovl\t$0, %eax\n\tcall\tpop\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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]; while(scanf("%s", s) != EOF){ if ( s[0] == '+' ){ a = pop(); b = pop(); push(a+b); } else if (s[0] == '-'){ b = pop(); a = pop(); push(a-b); } else if (s[0] == '*'){ b = pop(); a = pop(); push(a*b); } else{ push(atoi(s)); } } printf("%d\n", pop() ); return (0); } Unoptimized Assembly Code: .file "temp.c" .text .globl top .bss .align 4 .type top, @object .size top, 4 top: .zero 4 .globl S .align 32 .type S, @object .size S, 40000 S: .zero 40000 .text .globl push .type push, @function push: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl top(%rip), %eax addl $1, %eax movl %eax, top(%rip) movl top(%rip), %eax cltq leaq 0(,%rax,4), %rcx leaq S(%rip), %rdx movl -4(%rbp), %eax movl %eax, (%rcx,%rdx) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size push, .-push .globl pop .type pop, @function pop: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl top(%rip), %eax subl $1, %eax movl %eax, top(%rip) movl top(%rip), %eax addl $1, %eax cltq leaq 0(,%rax,4), %rdx leaq S(%rip), %rax movl (%rdx,%rax), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size pop, .-pop .section .rodata .LC0: .string "%s" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 addq $-128, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, top(%rip) jmp .L5 .L9: movzbl -112(%rbp), %eax cmpb $43, %al jne .L6 movl $0, %eax call pop movl %eax, -116(%rbp) movl $0, %eax call pop movl %eax, -120(%rbp) movl -116(%rbp), %edx movl -120(%rbp), %eax addl %edx, %eax movl %eax, %edi call push jmp .L5 .L6: movzbl -112(%rbp), %eax cmpb $45, %al jne .L7 movl $0, %eax call pop movl %eax, -120(%rbp) movl $0, %eax call pop movl %eax, -116(%rbp) movl -116(%rbp), %eax subl -120(%rbp), %eax movl %eax, %edi call push jmp .L5 .L7: movzbl -112(%rbp), %eax cmpb $42, %al jne .L8 movl $0, %eax call pop movl %eax, -120(%rbp) movl $0, %eax call pop movl %eax, -116(%rbp) movl -116(%rbp), %eax imull -120(%rbp), %eax movl %eax, %edi call push jmp .L5 .L8: leaq -112(%rbp), %rax movq %rax, %rdi call atoi@PLT movl %eax, %edi call push .L5: leaq -112(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpl $-1, %eax jne .L9 movl $0, %eax call pop movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L11 call __stack_chk_fail@PLT .L11: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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//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#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint nHr(int a,int b){return nCr(a+b-1,b);}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llnHr(long long a,long long b){return llnCr(a+b-1,b);}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\nint chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\nint chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\n\nvoid shuffledget(int x[],int n){\n srand(time(0));\n int i,b[524288],p,c;\n for(i=0;i<n;i++){\n b[i]=i;\n }\n for(i=n;i>=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[b[i]]);\n }\n}\n\nint dx4[4]={1,-1,0,0};\nint dy4[4]={0,0,1,-1};\nint dx8[8]={-1,-1,-1,0,0,1,1,1};\nint dy8[8]={-1,0,1,-1,1,-1,0,1};\n\nint search(int x,int a[],int n){\n int st=0,fi=n-1,te;\n while(st<=fi){\n te=(st+fi)/2;\n if(a[te]<x){st=te+1;}else{fi=te-1;}\n }\n return st;\n}\n\nvoid prarr(int arr[],int n){\n int i;\n for(i=0;i<n;i++){\n if(i){printf(\" \");}\n printf(\"%d\",arr[i]);\n }\n printf(\"\\n\");\n return;\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nint main(void){\n int i,j,n,m,k,a,b,c,h,w,r=0,l,t,p;\n double sd,sp,res=0.0;\n scanf(\"%d%d\",&a,&p);\n sp=(double)((100.0-2.0*(double)p)/100.0);\n if(a%2==1){\n res=1.0;\n sd=(double)a+sp;\n }\n else{sd=(double)a;}\n printf(\"%.12lf\\n\",res+(sd/(1.0-sp)));\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L2\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t-8(%rbp), %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmax, .-max\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjge\t.L5\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L6\n.L5:\n\tmovl\t-8(%rbp), %eax\n.L6:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmin, .-min\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$8, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -12(%rbp)\n\tmovl\t%esi, -16(%rbp)\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmax\n\tmovl\t%eax, %ebx\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmin\n\tmovl\t%eax, %edx\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tzt, .-zt\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjg\t.L10\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n\tjmp\t.L11\n.L10:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n.L11:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tround, .-round\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L13\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tjmp\t.L14\n.L13:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n.L14:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tceil, .-ceil\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L16:\n\tcmpl\t$0, -24(%rbp)\n\tjne\t.L17\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tgcd, .-gcd\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-4(%rbp)\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %eax\n\timull\t-24(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tlcm, .-lcm\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tsubl\t-8(%rbp), %eax\n\tmovl\t-4(%rbp), %edx\n\timull\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L22:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L23\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tnCr, .-nCr\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t%edx, %edi\n\tcall\tnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tnHr, .-nHr\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L28\n.L29:\n\tmovl\t-4(%rbp), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L28:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjle\t.L29\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tfact, .-fact\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L32\n.L33:\n\tmovl\t-4(%rbp), %eax\n\timull\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L32:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L33\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpow, .-pow\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L36\n.L37:\n\tmovl\t-20(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\taddl\t%edx, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -20(%rbp)\n.L36:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L37\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tdsum, .-dsum\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L40\n.L41:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -20(%rbp)\n.L40:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L41\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tdsumb, .-dsumb\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\timull\t-4(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tsankaku, .-sankaku\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjle\t.L46\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L47\n.L46:\n\tmovq\t-16(%rbp), %rax\n.L47:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tllmax, .-llmax\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L49\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L50\n.L49:\n\tmovq\t-16(%rbp), %rax\n.L50:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tllmin, .-llmin\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -16(%rbp)\n\tmovq\t%rsi, -24(%rbp)\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmax\n\tmovq\t%rax, %rbx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmin\n\tmovq\t%rax, %rdx\n\tmovq\t%rbx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tllzt, .-llzt\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjg\t.L54\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n\tjmp\t.L55\n.L54:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n.L55:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tllround, .-llround\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L57\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tjmp\t.L58\n.L57:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n.L58:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tllceil, .-llceil\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tjmp\t.L60\n.L61:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n.L60:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L61\n\tmovq\t-24(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tllgcd, .-llgcd\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllgcd\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-8(%rbp)\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t-32(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tlllcm, .-lllcm\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L66\n.L67:\n\tmovq\t-24(%rbp), %rax\n\taddq\t$1, %rax\n\tsubq\t-16(%rbp), %rax\n\tmovq\t-8(%rbp), %rdx\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L66:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L67\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tllnCr, .-llnCr\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB28:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\tllnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE28:\n\t.size\tllnHr, .-llnHr\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L72\n.L73:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L72:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjle\t.L73\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tllfact, .-llfact\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L76\n.L77:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L76:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L77\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tllpow, .-llpow\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L80\n.L81:\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tmovq\t%rcx, %rsi\n\tsarq\t$63, %rsi\n\tsubq\t%rsi, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\taddq\t%rdx, -8(%rbp)\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tsarq\t$63, %rcx\n\tmovq\t%rcx, %rdx\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -24(%rbp)\n.L80:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L81\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE31:\n\t.size\tlldsum, .-lldsum\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L84\n.L85:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rax, -24(%rbp)\n.L84:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L85\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE32:\n\t.size\tlldsumb, .-lldsumb\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB33:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\taddq\t$1, %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tllsankaku, .-llsankaku\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L94\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L92\n.L94:\n\tmovsd\t-16(%rbp), %xmm0\n.L92:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE34:\n\t.size\tdbmax, .-dbmax\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t-8(%rbp), %xmm0\n\tjbe\t.L100\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L98\n.L100:\n\tmovsd\t-16(%rbp), %xmm0\n.L98:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE35:\n\t.size\tdbmin, .-dbmin\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB36:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovsd\t%xmm1, -24(%rbp)\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmax\n\tmovq\t%xmm0, %rbx\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmin\n\tmovq\t%rbx, %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t%xmm1, %rax\n\tmovq\t%rax, %xmm0\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE36:\n\t.size\tdbzt, .-dbzt\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB37:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L104\n\tmovl\t$1, %eax\n\tjmp\t.L105\n.L104:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L106\n\tmovl\t$0, %eax\n\tjmp\t.L105\n.L106:\n\tmovl\t$-1, %eax\n.L105:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE37:\n\t.size\tsortfncsj, .-sortfncsj\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB38:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L108\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L108:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L110\n\tmovl\t$0, %eax\n\tjmp\t.L109\n.L110:\n\tmovl\t$-1, %eax\n.L109:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE38:\n\t.size\tsortfnckj, .-sortfnckj\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L112\n\tmovl\t$1, %eax\n\tjmp\t.L113\n.L112:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L114\n\tmovl\t$0, %eax\n\tjmp\t.L113\n.L114:\n\tmovl\t$-1, %eax\n.L113:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L116\n\tmovl\t$1, %eax\n\tjmp\t.L117\n.L116:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L118\n\tmovl\t$0, %eax\n\tjmp\t.L117\n.L118:\n\tmovl\t$-1, %eax\n.L117:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L127\n\tmovl\t$1, %eax\n\tjmp\t.L122\n.L127:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L123\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L123\n\tmovl\t$0, %eax\n\tjmp\t.L122\n.L123:\n\tmovl\t$-1, %eax\n.L122:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L136\n\tmovl\t$1, %eax\n\tjmp\t.L131\n.L136:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L132\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L132\n\tmovl\t$0, %eax\n\tjmp\t.L131\n.L132:\n\tmovl\t$-1, %eax\n.L131:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE44:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.globl\tchsortfncsj\n\t.type\tchsortfncsj, @function\nchsortfncsj:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjle\t.L142\n\tmovl\t$1, %eax\n\tjmp\t.L143\n.L142:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L144\n\tmovl\t$0, %eax\n\tjmp\t.L143\n.L144:\n\tmovl\t$-1, %eax\n.L143:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tchsortfncsj, .-chsortfncsj\n\t.globl\tchsortfnckj\n\t.type\tchsortfnckj, @function\nchsortfnckj:\n.LFB46:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjge\t.L146\n\tmovl\t$1, %eax\n\tjmp\t.L147\n.L146:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L148\n\tmovl\t$0, %eax\n\tjmp\t.L147\n.L148:\n\tmovl\t$-1, %eax\n.L147:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE46:\n\t.size\tchsortfnckj, .-chsortfnckj\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-2097152(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -2097192(%rbp)\n\tmovl\t%esi, -2097196(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, %edi\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L150\n.L151:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097180(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\taddl\t$1, -2097180(%rbp)\n.L150:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L151\n\tmovl\t-2097196(%rbp), %eax\n\tmovl\t%eax, -2097180(%rbp)\n\tjmp\t.L152\n.L153:\n\tcall\trand@PLT\n\tcltd\n\tidivl\t-2097180(%rbp)\n\tmovl\t%edx, -2097176(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tmovl\t%eax, -2097172(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tleal\t-1(%rax), %ecx\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %edx\n\tmovslq\t%ecx, %rax\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097172(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tsubl\t$1, -2097180(%rbp)\n.L152:\n\tcmpl\t$0, -2097180(%rbp)\n\tjg\t.L153\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L154\n.L155:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-2097192(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -2097180(%rbp)\n.L154:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L155\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L156\n\tcall\t__stack_chk_fail@PLT\n.L156:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tshuffledget, .-shuffledget\n\t.globl\tdx4\n\t.data\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy8\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.text\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t%edx, -24(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L158\n.L160:\n\tmovl\t-12(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L159\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L158\n.L159:\n\tmovl\t-4(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n.L158:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L160\n\tmovl\t-12(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE48:\n\t.size\tsearch, .-search\n\t.globl\tprarr\n\t.type\tprarr, @function\nprarr:\n.LFB49:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L163\n.L165:\n\tcmpl\t$0, -4(%rbp)\n\tje\t.L164\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L164:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -4(%rbp)\n.L163:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L165\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE49:\n\t.size\tprarr, .-prarr\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB50:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L168\n\tmovl\t$-1, %eax\n\tjmp\t.L169\n.L168:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L170\n\tmovl\t$1, %eax\n\tjmp\t.L169\n.L170:\n\tmovl\t$0, %eax\n.L169:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE50:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.section\t.rodata\n.LC2:\n\t.string\t\"%d%d\"\n.LC5:\n\t.string\t\"%.12lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -36(%rbp)\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -24(%rbp)\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-44(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovsd\t.LC3(%rip), %xmm0\n\tsubsd\t%xmm1, %xmm0\n\tmovsd\t.LC3(%rip), %xmm1\n\tdivsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovl\t-44(%rbp), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L172\n\tmovsd\t.LC4(%rip), %xmm0\n\tmovsd\t%xmm0, -24(%rbp)\n\tmovl\t-44(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t-16(%rbp), %xmm1\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -32(%rbp)\n\tjmp\t.L173\n.L172:\n\tmovl\t-44(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t%xmm0, -32(%rbp)\n.L173:\n\tmovsd\t.LC4(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tsubsd\t-16(%rbp), %xmm1\n\tmovsd\t-32(%rbp), %xmm0\n\tdivsd\t%xmm1, %xmm0\n\taddsd\t-24(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC5(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L175\n\tcall\t__stack_chk_fail@PLT\n.L175:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC4:\n\t.long\t0\n\t.long\t1072693248\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\nmin:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovle\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tmin, .-min\n\t.p2align 4\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tcmovg\t%esi, %edi\n\tsubl\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tzt, .-zt\n\t.p2align 4\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %edx\n\tcmpl\t%esi, %edx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tround, .-round\n\t.p2align 4\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t$1, %edx\n\tsbbl\t$-1, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tceil, .-ceil\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\ttestl\t%esi, %esi\n\tje\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovl\t%edi, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tje\t.L19\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L18\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%esi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tlcm, .-lcm\n\t.p2align 4\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L24\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddl\t$1, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L23:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L23\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tnCr, .-nCr\n\t.p2align 4\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\taddl\t%esi, %edi\n\ttestl\t%esi, %esi\n\tjle\t.L29\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L28\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tnHr, .-nHr\n\t.p2align 4\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%edi, %edi\n\tjle\t.L34\n\taddl\t$1, %edi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\timull\t%eax, %r8d\n\taddl\t$1, %eax\n\tcmpl\t%edi, %eax\n\tjne\t.L33\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tfact, .-fact\n\t.p2align 4\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L39\n\taddl\t$1, %esi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\taddl\t$1, %eax\n\timull\t%edi, %r8d\n\tcmpl\t%esi, %eax\n\tjne\t.L38\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE61:\n\t.size\tpow, .-pow\n\t.p2align 4\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L41\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %edx\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %edx\n\taddl\t%edx, %edx\n\tsubl\t%edx, %edi\n\taddl\t%edi, %r8d\n\tmovl\t%eax, %edi\n\ttestl\t%eax, %eax\n\tjne\t.L43\n.L41:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE62:\n\t.size\tdsum, .-dsum\n\t.p2align 4\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L46\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %r8d\n\ttestl\t%eax, %eax\n\tjne\t.L48\n.L46:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tdsumb, .-dsumb\n\t.p2align 4\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tleal\t1(%rdi), %edx\n\timull\t%edi, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tsankaku, .-sankaku\n\t.p2align 4\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB65:\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.LFE65:\n\t.size\tllmax, .-llmax\n\t.p2align 4\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovle\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE66:\n\t.size\tllmin, .-llmin\n\t.p2align 4\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovge\t%rdi, %rax\n\tcmovg\t%rsi, %rdi\n\tsubq\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE67:\n\t.size\tllzt, .-llzt\n\t.p2align 4\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %rdx\n\tcmpq\t%rsi, %rdx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tllround, .-llround\n\t.p2align 4\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\tcmpq\t$1, %rdx\n\tsbbq\t$-1, %rax\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tllceil, .-llceil\n\t.p2align 4\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rsi, %rdx\n\ttestq\t%rsi, %rsi\n\tje\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovq\t%rdx, %r8\n\tcqto\n\tidivq\t%r8\n\tmovq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tjne\t.L63\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE70:\n\t.size\tllgcd, .-llgcd\n\t.p2align 4\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tje\t.L69\n\tmovq\t%rsi, %rdx\n\tmovq\t%rdi, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tmovq\t%rcx, %rax\n\tmovq\t%rdx, %rcx\n\tcqto\n\tidivq\t%rcx\n\ttestq\t%rdx, %rdx\n\tjne\t.L68\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rcx\n\timulq\t%rsi, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L69:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE71:\n\t.size\tlllcm, .-lllcm\n\t.p2align 4\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L74\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddq\t$1, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L73\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tllnCr, .-llnCr\n\t.p2align 4\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB73:\n\t.cfi_startproc\n\tendbr64\n\taddq\t%rsi, %rdi\n\ttestq\t%rsi, %rsi\n\tjle\t.L79\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L78\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE73:\n\t.size\tllnHr, .-llnHr\n\t.p2align 4\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB74:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tjle\t.L84\n\taddq\t$1, %rdi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\timulq\t%rax, %r8\n\taddq\t$1, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L83\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE74:\n\t.size\tllfact, .-llfact\n\t.p2align 4\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB75:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L89\n\taddq\t$1, %rsi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\taddq\t$1, %rax\n\timulq\t%rdi, %r8\n\tcmpq\t%rsi, %rax\n\tjne\t.L88\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L89:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE75:\n\t.size\tllpow, .-llpow\n\t.p2align 4\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB76:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L91\n\tmovabsq\t$7378697629483820647, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovq\t%rdi, %rax\n\timulq\t%rcx\n\tmovq\t%rdi, %rax\n\tsarq\t$63, %rax\n\tsarq\t$2, %rdx\n\tsubq\t%rax, %rdx\n\tleaq\t(%rdx,%rdx,4), %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rdi\n\taddq\t%rdi, %r8\n\tmovq\t%rdx, %rdi\n\ttestq\t%rdx, %rdx\n\tjne\t.L93\n.L91:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE76:\n\t.size\tlldsum, .-lldsum\n\t.p2align 4\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB77:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L96\n\t.p2align 4,,10\n\t.p2align 3\n.L98:\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %r8\n\ttestq\t%rax, %rax\n\tjne\t.L98\n.L96:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE77:\n\t.size\tlldsumb, .-lldsumb\n\t.p2align 4\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB78:\n\t.cfi_startproc\n\tendbr64\n\tleaq\t1(%rdi), %rdx\n\timulq\t%rdi, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$63, %rax\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tret\n\t.cfi_endproc\n.LFE78:\n\t.size\tllsankaku, .-llsankaku\n\t.p2align 4\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB79:\n\t.cfi_startproc\n\tendbr64\n\tmaxsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE79:\n\t.size\tdbmax, .-dbmax\n\t.p2align 4\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB80:\n\t.cfi_startproc\n\tendbr64\n\tminsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE80:\n\t.size\tdbmin, .-dbmin\n\t.p2align 4\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB81:\n\t.cfi_startproc\n\tendbr64\n\tmovapd\t%xmm0, %xmm2\n\tmaxsd\t%xmm1, %xmm0\n\tminsd\t%xmm1, %xmm2\n\tsubsd\t%xmm2, %xmm0\n\tret\n\t.cfi_endproc\n.LFE81:\n\t.size\tdbzt, .-dbzt\n\t.p2align 4\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB82:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjg\t.L118\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L118:\n\tret\n\t.cfi_endproc\n.LFE82:\n\t.size\tsortfncsj, .-sortfncsj\n\t.p2align 4\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB83:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjl\t.L121\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L121:\n\tret\n\t.cfi_endproc\n.LFE83:\n\t.size\tsortfnckj, .-sortfnckj\n\t.p2align 4\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB84:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjg\t.L124\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L124:\n\tret\n\t.cfi_endproc\n.LFE84:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.p2align 4\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB85:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L127\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L127:\n\tret\n\t.cfi_endproc\n.LFE85:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.p2align 4\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB86:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm0, %xmm1\n\tja\t.L130\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L130:\n\tret\n\t.cfi_endproc\n.LFE86:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.p2align 4\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB87:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L133\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L133:\n\tret\n\t.cfi_endproc\n.LFE87:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.p2align 4\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB88:\n\t.cfi_startproc\n\tendbr64\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE88:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.p2align 4\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB89:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %r8\n\tmovq\t%rsi, %rdi\n\tmovq\t%r8, %rsi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE89:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.p2align 4\n\t.globl\tchsortfncsj\n\t.type\tchsortfncsj, @function\nchsortfncsj:\n.LFB90:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpb\t%dl, (%rdi)\n\tjg\t.L138\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L138:\n\tret\n\t.cfi_endproc\n.LFE90:\n\t.size\tchsortfncsj, .-chsortfncsj\n\t.p2align 4\n\t.globl\tchsortfnckj\n\t.type\tchsortfnckj, @function\nchsortfnckj:\n.LFB91:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpb\t%dl, (%rdi)\n\tjl\t.L141\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L141:\n\tret\n\t.cfi_endproc\n.LFE91:\n\t.size\tchsortfnckj, .-chsortfnckj\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC2:\n\t.string\t\"%d\"\n\t.text\n\t.p2align 4\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB92:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-2097152(%rsp), %r11\n\t.cfi_def_cfa 11, 2097208\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 2097232\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 2097160(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rdi, %rbp\n\txorl\t%edi, %edi\n\tmovl\t%esi, %r13d\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\ttestl\t%r13d, %r13d\n\tjle\t.L144\n\tleal\t-1(%r13), %r15d\n\tmovl\t%r15d, %r12d\n\tcmpl\t$2, %r15d\n\tjbe\t.L152\n\tmovl\t%r13d, %edx\n\tmovq\t%rsp, %rbx\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovdqa\t.LC1(%rip), %xmm2\n\tshrl\t$2, %edx\n\tmovq\t%rbx, %rax\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t16(%rsp,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L147:\n\tmovdqa\t%xmm0, %xmm1\n\taddq\t$16, %rax\n\tpaddd\t%xmm2, %xmm0\n\tmovaps\t%xmm1, -16(%rax)\n\tcmpq\t%rdx, %rax\n\tjne\t.L147\n\tmovl\t%r13d, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %r13b\n\tje\t.L148\n.L146:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n\tleal\t1(%rax), %edx\n\tcmpl\t%edx, %r13d\n\tjle\t.L148\n\tmovslq\t%edx, %rcx\n\taddl\t$2, %eax\n\tmovl\t%edx, (%rsp,%rcx,4)\n\tcmpl\t%eax, %r13d\n\tjle\t.L148\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n.L148:\n\tmovslq\t%r13d, %rax\n\tleaq\t(%rbx,%rax,4), %r14\n\tjmp\t.L149\n\t.p2align 4,,10\n\t.p2align 3\n.L158:\n\tsubl\t$1, %r15d\n.L149:\n\tcall\trand@PLT\n\tsubq\t$4, %r14\n\tcltd\n\tidivl\t%r13d\n\tmovl\t(%r14), %eax\n\tmovl\t%r15d, %r13d\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rsp,%rdx,4), %ecx\n\tmovl\t%ecx, (%r14)\n\tmovl\t%eax, (%rsp,%rdx,4)\n\ttestl\t%r15d, %r15d\n\tjne\t.L158\n\tleaq\t4(%rsp,%r12,4), %r13\n\tleaq\t.LC2(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L150:\n\tmovslq\t(%rbx), %rax\n\tmovq\t%r12, %rdi\n\taddq\t$4, %rbx\n\tleaq\t0(%rbp,%rax,4), %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t%r13, %rbx\n\tjne\t.L150\n.L144:\n\tmovq\t2097160(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L159\n\taddq\t$2097176, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L152:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbx\n\tjmp\t.L146\n.L159:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE92:\n\t.size\tshuffledget, .-shuffledget\n\t.p2align 4\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB93:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\tsubl\t$1, %edx\n\tjs\t.L160\n\t.p2align 4,,10\n\t.p2align 3\n.L164:\n\tleal\t(%rdx,%r8), %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %rcx\n\tcmpl\t(%rsi,%rcx,4), %edi\n\tjle\t.L162\n\tleal\t1(%rax), %r8d\n\tcmpl\t%edx, %r8d\n\tjle\t.L164\n.L160:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L162:\n\tleal\t-1(%rax), %edx\n\tcmpl\t%r8d, %edx\n\tjge\t.L164\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE93:\n\t.size\tsearch, .-search\n\t.p2align 4\n\t.globl\tprarr\n\t.type\tprarr, @function\nprarr:\n.LFB94:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L171\n\tleal\t-1(%rsi), %eax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\t4(%rdi,%rax,4), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tleaq\t.LC2(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rdi, %rbx\n\tjmp\t.L168\n\t.p2align 4,,10\n\t.p2align 3\n.L169:\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L168:\n\tmovl\t(%rbx), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$4, %rbx\n\tcall\t__printf_chk@PLT\n\tcmpq\t%r12, %rbx\n\tjne\t.L169\n\tpopq\t%rbx\n\t.cfi_restore 3\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %edi\n\tpopq\t%rbp\n\t.cfi_restore 6\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_restore 12\n\t.cfi_def_cfa_offset 8\n\tjmp\tputchar@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L171:\n\tmovl\t$10, %edi\n\tjmp\tputchar@PLT\n\t.cfi_endproc\n.LFE94:\n\t.size\tprarr, .-prarr\n\t.p2align 4\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB95:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tcmpl\t%eax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE95:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.section\t.rodata.str1.1\n.LC5:\n\t.string\t\"%d%d\"\n.LC7:\n\t.string\t\"%.12lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB96:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC5(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovl\t(%rsp), %edx\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t4(%rsp), %xmm0\n\tmovsd\t.LC6(%rip), %xmm1\n\tmovl\t%edx, %ecx\n\tmovapd\t%xmm1, %xmm2\n\tshrl\t$31, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\taddsd\t%xmm0, %xmm0\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tsubsd\t%xmm0, %xmm2\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%edx, %xmm0\n\tdivsd\t%xmm1, %xmm2\n\tmovsd\t.LC3(%rip), %xmm1\n\tcmpl\t$1, %eax\n\tjne\t.L179\n\tmovsd\t.LC3(%rip), %xmm1\n\taddsd\t%xmm2, %xmm0\n\tmovapd\t%xmm1, %xmm3\n.L179:\n\tsubsd\t%xmm2, %xmm1\n\tmovl\t$1, %edi\n\tmovl\t$1, %eax\n\tleaq\t.LC7(%rip), %rsi\n\tdivsd\t%xmm1, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L182\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L182:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE96:\n\t.size\tmain, .-main\n\t.globl\tdy8\n\t.data\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx4\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC1:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1072693248\n\t.align 8\n.LC6:\n\t.long\t0\n\t.long\t1079574528\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovle\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tmin, .-min\n\t.p2align 4\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tcmovg\t%esi, %edi\n\tsubl\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tzt, .-zt\n\t.p2align 4\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %edx\n\tcmpl\t%esi, %edx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tround, .-round\n\t.p2align 4\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t$1, %edx\n\tsbbl\t$-1, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tceil, .-ceil\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\ttestl\t%esi, %esi\n\tje\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovl\t%edi, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tje\t.L19\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L18\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%esi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tlcm, .-lcm\n\t.p2align 4\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L24\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddl\t$1, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L23:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L23\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tnCr, .-nCr\n\t.p2align 4\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\taddl\t%esi, %edi\n\ttestl\t%esi, %esi\n\tjle\t.L29\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L28\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tnHr, .-nHr\n\t.p2align 4\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%edi, %edi\n\tjle\t.L34\n\taddl\t$1, %edi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\timull\t%eax, %r8d\n\taddl\t$1, %eax\n\tcmpl\t%edi, %eax\n\tjne\t.L33\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tfact, .-fact\n\t.p2align 4\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L39\n\taddl\t$1, %esi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\taddl\t$1, %eax\n\timull\t%edi, %r8d\n\tcmpl\t%esi, %eax\n\tjne\t.L38\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE61:\n\t.size\tpow, .-pow\n\t.p2align 4\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L41\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %edx\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %edx\n\taddl\t%edx, %edx\n\tsubl\t%edx, %edi\n\taddl\t%edi, %r8d\n\tmovl\t%eax, %edi\n\ttestl\t%eax, %eax\n\tjne\t.L43\n.L41:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE62:\n\t.size\tdsum, .-dsum\n\t.p2align 4\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L46\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %r8d\n\ttestl\t%eax, %eax\n\tjne\t.L48\n.L46:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tdsumb, .-dsumb\n\t.p2align 4\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tleal\t1(%rdi), %edx\n\timull\t%edi, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tsankaku, .-sankaku\n\t.p2align 4\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB65:\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.LFE65:\n\t.size\tllmax, .-llmax\n\t.p2align 4\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovle\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE66:\n\t.size\tllmin, .-llmin\n\t.p2align 4\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovge\t%rdi, %rax\n\tcmovg\t%rsi, %rdi\n\tsubq\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE67:\n\t.size\tllzt, .-llzt\n\t.p2align 4\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %rdx\n\tcmpq\t%rsi, %rdx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tllround, .-llround\n\t.p2align 4\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\tcmpq\t$1, %rdx\n\tsbbq\t$-1, %rax\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tllceil, .-llceil\n\t.p2align 4\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rsi, %rdx\n\ttestq\t%rsi, %rsi\n\tje\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovq\t%rdx, %r8\n\tcqto\n\tidivq\t%r8\n\tmovq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tjne\t.L63\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE70:\n\t.size\tllgcd, .-llgcd\n\t.p2align 4\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tje\t.L69\n\tmovq\t%rsi, %rdx\n\tmovq\t%rdi, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tmovq\t%rcx, %rax\n\tmovq\t%rdx, %rcx\n\tcqto\n\tidivq\t%rcx\n\ttestq\t%rdx, %rdx\n\tjne\t.L68\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rcx\n\timulq\t%rsi, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L69:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE71:\n\t.size\tlllcm, .-lllcm\n\t.p2align 4\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L74\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddq\t$1, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L73\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tllnCr, .-llnCr\n\t.p2align 4\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB73:\n\t.cfi_startproc\n\tendbr64\n\taddq\t%rsi, %rdi\n\ttestq\t%rsi, %rsi\n\tjle\t.L79\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L78\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE73:\n\t.size\tllnHr, .-llnHr\n\t.p2align 4\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB74:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tjle\t.L84\n\taddq\t$1, %rdi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\timulq\t%rax, %r8\n\taddq\t$1, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L83\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE74:\n\t.size\tllfact, .-llfact\n\t.p2align 4\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB75:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L89\n\taddq\t$1, %rsi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\taddq\t$1, %rax\n\timulq\t%rdi, %r8\n\tcmpq\t%rsi, %rax\n\tjne\t.L88\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L89:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE75:\n\t.size\tllpow, .-llpow\n\t.p2align 4\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB76:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L91\n\tmovabsq\t$7378697629483820647, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovq\t%rdi, %rax\n\timulq\t%rcx\n\tmovq\t%rdi, %rax\n\tsarq\t$63, %rax\n\tsarq\t$2, %rdx\n\tsubq\t%rax, %rdx\n\tleaq\t(%rdx,%rdx,4), %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rdi\n\taddq\t%rdi, %r8\n\tmovq\t%rdx, %rdi\n\ttestq\t%rdx, %rdx\n\tjne\t.L93\n.L91:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE76:\n\t.size\tlldsum, .-lldsum\n\t.p2align 4\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB77:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L96\n\t.p2align 4,,10\n\t.p2align 3\n.L98:\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %r8\n\ttestq\t%rax, %rax\n\tjne\t.L98\n.L96:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE77:\n\t.size\tlldsumb, .-lldsumb\n\t.p2align 4\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB78:\n\t.cfi_startproc\n\tendbr64\n\tleaq\t1(%rdi), %rdx\n\timulq\t%rdi, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$63, %rax\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tret\n\t.cfi_endproc\n.LFE78:\n\t.size\tllsankaku, .-llsankaku\n\t.p2align 4\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB79:\n\t.cfi_startproc\n\tendbr64\n\tmaxsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE79:\n\t.size\tdbmax, .-dbmax\n\t.p2align 4\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB80:\n\t.cfi_startproc\n\tendbr64\n\tminsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE80:\n\t.size\tdbmin, .-dbmin\n\t.p2align 4\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB81:\n\t.cfi_startproc\n\tendbr64\n\tmovapd\t%xmm0, %xmm2\n\tmaxsd\t%xmm1, %xmm0\n\tminsd\t%xmm1, %xmm2\n\tsubsd\t%xmm2, %xmm0\n\tret\n\t.cfi_endproc\n.LFE81:\n\t.size\tdbzt, .-dbzt\n\t.p2align 4\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB82:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjg\t.L118\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L118:\n\tret\n\t.cfi_endproc\n.LFE82:\n\t.size\tsortfncsj, .-sortfncsj\n\t.p2align 4\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB83:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjl\t.L121\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L121:\n\tret\n\t.cfi_endproc\n.LFE83:\n\t.size\tsortfnckj, .-sortfnckj\n\t.p2align 4\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB84:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjg\t.L124\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L124:\n\tret\n\t.cfi_endproc\n.LFE84:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.p2align 4\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB85:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L127\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L127:\n\tret\n\t.cfi_endproc\n.LFE85:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.p2align 4\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB86:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm0, %xmm1\n\tja\t.L130\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L130:\n\tret\n\t.cfi_endproc\n.LFE86:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.p2align 4\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB87:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L133\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L133:\n\tret\n\t.cfi_endproc\n.LFE87:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.p2align 4\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB88:\n\t.cfi_startproc\n\tendbr64\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE88:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.p2align 4\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB89:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %r8\n\tmovq\t%rsi, %rdi\n\tmovq\t%r8, %rsi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE89:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.p2align 4\n\t.globl\tchsortfncsj\n\t.type\tchsortfncsj, @function\nchsortfncsj:\n.LFB90:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpb\t%dl, (%rdi)\n\tjg\t.L138\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L138:\n\tret\n\t.cfi_endproc\n.LFE90:\n\t.size\tchsortfncsj, .-chsortfncsj\n\t.p2align 4\n\t.globl\tchsortfnckj\n\t.type\tchsortfnckj, @function\nchsortfnckj:\n.LFB91:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpb\t%dl, (%rdi)\n\tjl\t.L141\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L141:\n\tret\n\t.cfi_endproc\n.LFE91:\n\t.size\tchsortfnckj, .-chsortfnckj\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC2:\n\t.string\t\"%d\"\n\t.text\n\t.p2align 4\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB92:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-2097152(%rsp), %r11\n\t.cfi_def_cfa 11, 2097208\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 2097232\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 2097160(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rdi, %rbp\n\txorl\t%edi, %edi\n\tmovl\t%esi, %r13d\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\ttestl\t%r13d, %r13d\n\tjle\t.L144\n\tleal\t-1(%r13), %r15d\n\tmovl\t%r15d, %r12d\n\tcmpl\t$2, %r15d\n\tjbe\t.L152\n\tmovl\t%r13d, %edx\n\tmovq\t%rsp, %rbx\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovdqa\t.LC1(%rip), %xmm2\n\tshrl\t$2, %edx\n\tmovq\t%rbx, %rax\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t16(%rsp,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L147:\n\tmovdqa\t%xmm0, %xmm1\n\taddq\t$16, %rax\n\tpaddd\t%xmm2, %xmm0\n\tmovaps\t%xmm1, -16(%rax)\n\tcmpq\t%rdx, %rax\n\tjne\t.L147\n\tmovl\t%r13d, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %r13b\n\tje\t.L148\n.L146:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n\tleal\t1(%rax), %edx\n\tcmpl\t%edx, %r13d\n\tjle\t.L148\n\tmovslq\t%edx, %rcx\n\taddl\t$2, %eax\n\tmovl\t%edx, (%rsp,%rcx,4)\n\tcmpl\t%eax, %r13d\n\tjle\t.L148\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n.L148:\n\tmovslq\t%r13d, %rax\n\tleaq\t(%rbx,%rax,4), %r14\n\tjmp\t.L149\n\t.p2align 4,,10\n\t.p2align 3\n.L158:\n\tsubl\t$1, %r15d\n.L149:\n\tcall\trand@PLT\n\tsubq\t$4, %r14\n\tcltd\n\tidivl\t%r13d\n\tmovl\t(%r14), %eax\n\tmovl\t%r15d, %r13d\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rsp,%rdx,4), %ecx\n\tmovl\t%ecx, (%r14)\n\tmovl\t%eax, (%rsp,%rdx,4)\n\ttestl\t%r15d, %r15d\n\tjne\t.L158\n\tleaq\t4(%rsp,%r12,4), %r13\n\tleaq\t.LC2(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L150:\n\tmovslq\t(%rbx), %rax\n\tmovq\t%r12, %rdi\n\taddq\t$4, %rbx\n\tleaq\t0(%rbp,%rax,4), %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t%r13, %rbx\n\tjne\t.L150\n.L144:\n\tmovq\t2097160(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L159\n\taddq\t$2097176, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L152:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbx\n\tjmp\t.L146\n.L159:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE92:\n\t.size\tshuffledget, .-shuffledget\n\t.p2align 4\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB93:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\tsubl\t$1, %edx\n\tjs\t.L160\n\t.p2align 4,,10\n\t.p2align 3\n.L164:\n\tleal\t(%rdx,%r8), %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %rcx\n\tcmpl\t(%rsi,%rcx,4), %edi\n\tjle\t.L162\n\tleal\t1(%rax), %r8d\n\tcmpl\t%edx, %r8d\n\tjle\t.L164\n.L160:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L162:\n\tleal\t-1(%rax), %edx\n\tcmpl\t%r8d, %edx\n\tjge\t.L164\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE93:\n\t.size\tsearch, .-search\n\t.p2align 4\n\t.globl\tprarr\n\t.type\tprarr, @function\nprarr:\n.LFB94:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L171\n\tleal\t-1(%rsi), %eax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\t4(%rdi,%rax,4), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tleaq\t.LC2(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rdi, %rbx\n\tjmp\t.L168\n\t.p2align 4,,10\n\t.p2align 3\n.L169:\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L168:\n\tmovl\t(%rbx), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$4, %rbx\n\tcall\t__printf_chk@PLT\n\tcmpq\t%r12, %rbx\n\tjne\t.L169\n\tpopq\t%rbx\n\t.cfi_restore 3\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %edi\n\tpopq\t%rbp\n\t.cfi_restore 6\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_restore 12\n\t.cfi_def_cfa_offset 8\n\tjmp\tputchar@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L171:\n\tmovl\t$10, %edi\n\tjmp\tputchar@PLT\n\t.cfi_endproc\n.LFE94:\n\t.size\tprarr, .-prarr\n\t.p2align 4\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB95:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tcmpl\t%eax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE95:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.section\t.rodata.str1.1\n.LC5:\n\t.string\t\"%d%d\"\n.LC7:\n\t.string\t\"%.12lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB96:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC5(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovl\t(%rsp), %edx\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t4(%rsp), %xmm0\n\tmovsd\t.LC6(%rip), %xmm1\n\tmovl\t%edx, %ecx\n\tmovapd\t%xmm1, %xmm2\n\tshrl\t$31, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\taddsd\t%xmm0, %xmm0\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tsubsd\t%xmm0, %xmm2\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%edx, %xmm0\n\tdivsd\t%xmm1, %xmm2\n\tmovsd\t.LC3(%rip), %xmm1\n\tcmpl\t$1, %eax\n\tjne\t.L179\n\tmovsd\t.LC3(%rip), %xmm1\n\taddsd\t%xmm2, %xmm0\n\tmovapd\t%xmm1, %xmm3\n.L179:\n\tsubsd\t%xmm2, %xmm1\n\tmovl\t$1, %edi\n\tmovl\t$1, %eax\n\tleaq\t.LC7(%rip), %rsi\n\tdivsd\t%xmm1, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L182\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L182:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE96:\n\t.size\tmain, .-main\n\t.globl\tdy8\n\t.data\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx4\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC1:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1072693248\n\t.align 8\n.LC6:\n\t.long\t0\n\t.long\t1079574528\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "//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#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint nHr(int a,int b){return nCr(a+b-1,b);}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llnHr(long long a,long long b){return llnCr(a+b-1,b);}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\nint chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\nint chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\n\nvoid shuffledget(int x[],int n){\n srand(time(0));\n int i,b[524288],p,c;\n for(i=0;i<n;i++){\n b[i]=i;\n }\n for(i=n;i>=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[b[i]]);\n }\n}\n\nint dx4[4]={1,-1,0,0};\nint dy4[4]={0,0,1,-1};\nint dx8[8]={-1,-1,-1,0,0,1,1,1};\nint dy8[8]={-1,0,1,-1,1,-1,0,1};\n\nint search(int x,int a[],int n){\n int st=0,fi=n-1,te;\n while(st<=fi){\n te=(st+fi)/2;\n if(a[te]<x){st=te+1;}else{fi=te-1;}\n }\n return st;\n}\n\nvoid prarr(int arr[],int n){\n int i;\n for(i=0;i<n;i++){\n if(i){printf(\" \");}\n printf(\"%d\",arr[i]);\n }\n printf(\"\\n\");\n return;\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nint main(void){\n int i,j,n,m,k,a,b,c,h,w,r=0,l,t,p;\n double sd,sp,res=0.0;\n scanf(\"%d%d\",&a,&p);\n sp=(double)((100.0-2.0*(double)p)/100.0);\n if(a%2==1){\n res=1.0;\n sd=(double)a+sp;\n }\n else{sd=(double)a;}\n printf(\"%.12lf\\n\",res+(sd/(1.0-sp)));\n return 0;\n}\n", "index": 2, "inputs": [ "6\n36\n", "101\n141\n", "3\n101\n", "6\n38\n", "101\n233\n", "3\n111\n", "6\n59\n", "101\n416\n", "3\n001\n", "6\n106\n", "101\n221\n", "3\n011\n", "6\n174\n", "101\n27\n", "3\n010\n", "6\n95\n", "101\n37\n", "3\n110\n", "6\n180\n", "101\n67\n", "3\n000\n", "6\n274\n", "101\n133\n", "6\n138\n", "101\n122\n", "6\n232\n", "101\n25\n", "6\n397\n", "101\n36\n", "6\n414\n", "101\n65\n", "6\n534\n", "101\n102\n", "6\n805\n", "101\n56\n", "6\n944\n", "101\n4\n", "6\n857\n", "101\n8\n", "6\n813\n", "6\n819\n", "101\n-1\n", "6\n1401\n", "101\n1\n", "6\n1772\n", "101\n2\n", "6\n1247\n", "101\n-2\n", "6\n160\n", "101\n3\n", "6\n20\n", "101\n6\n", "6\n25\n", "101\n13\n", "6\n19\n", "101\n24\n", "6\n37\n", "101\n11\n", "6\n56\n", "101\n9\n", "6\n30\n", "101\n5\n", "6\n35\n", "101\n10\n", "6\n61\n", "101\n16\n", "6\n85\n", "101\n46\n", "6\n121\n", "101\n82\n", "6\n169\n", "101\n132\n", "6\n254\n", "101\n131\n", "6\n463\n", "101\n216\n", "6\n370\n", "101\n14\n", "6\n473\n", "101\n15\n", "6\n603\n", "101\n20\n", "6\n472\n", "101\n23\n", "6\n866\n", "101\n29\n", "6\n1673\n", "101\n47\n", "6\n2959\n", "101\n57\n", "6\n2729\n", "101\n83\n", "6\n2101\n", "101\n71\n", "6\n3231\n", "101\n105\n", "6\n4715\n", "101\n117\n", "6\n1098\n", "101\n197\n", "6\n40\n", "3\n100\n", "3\n100\n", "101\n80\n" ], "outputs": [ "8.333333333333\n", "36.170212765957\n", "1.980198019802\n", "7.894736842105\n", "21.888412017167\n", "1.801801801802\n", "5.084745762712\n", "12.259615384615\n", "200.000000000000\n", "2.830188679245\n", "23.076923076923\n", "18.181818181818\n", "1.724137931034\n", "188.888888888889\n", "20.000000000000\n", "3.157894736842\n", "137.837837837838\n", "1.818181818182\n", "1.666666666667\n", "76.119402985075\n", "inf\n", "1.094890510949\n", "38.345864661654\n", "2.173913043478\n", "41.803278688525\n", "1.293103448276\n", "204.000000000000\n", "0.755667506297\n", "141.666666666667\n", "0.724637681159\n", "78.461538461538\n", "0.561797752809\n", "50.000000000000\n", "0.372670807453\n", "91.071428571429\n", "0.317796610169\n", "1275.000000000001\n", "0.350058343057\n", "637.500000000000\n", "0.369003690037\n", "0.366300366300\n", "-5099.999999999995\n", "0.214132762313\n", "5099.999999999995\n", "0.169300225734\n", "2549.999999999998\n", "0.240577385726\n", "-2549.999999999998\n", "1.875000000000\n", "1699.999999999998\n", "15.000000000000\n", "850.000000000000\n", "12.000000000000\n", "392.307692307692\n", "15.789473684211\n", "212.500000000000\n", "8.108108108108\n", "463.636363636364\n", "5.357142857143\n", "566.666666666667\n", "10.000000000000\n", "1020.000000000000\n", "8.571428571429\n", "510.000000000000\n", "4.918032786885\n", "318.750000000000\n", "3.529411764706\n", "110.869565217391\n", "2.479338842975\n", "62.195121951220\n", "1.775147928994\n", "38.636363636364\n", "1.181102362205\n", "38.931297709924\n", "0.647948164147\n", "23.611111111111\n", "0.810810810811\n", "364.285714285714\n", "0.634249471459\n", "340.000000000000\n", "0.497512437811\n", "255.000000000000\n", "0.635593220339\n", "221.739130434783\n", "0.346420323326\n", "175.862068965517\n", "0.179318589360\n", "108.510638297872\n", "0.101385603244\n", "89.473684210526\n", "0.109930377428\n", "61.445783132530\n", "0.142789148025\n", "71.830985915493\n", "0.092850510678\n", "48.571428571429\n", "0.063626723224\n", "43.589743589744\n", "0.273224043716\n", "25.888324873096\n", "7.500000000000\n", "2.000000000000\n", "2.000000000000\n", "63.750000000000\n" ], "question": "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#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint nHr(int a,int b){return nCr(a+b-1,b);}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llnHr(long long a,long long b){return llnCr(a+b-1,b);}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\nint chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\nint chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}\n\nvoid shuffledget(int x[],int n){\n srand(time(0));\n int i,b[524288],p,c;\n for(i=0;i<n;i++){\n b[i]=i;\n }\n for(i=n;i>=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[b[i]]);\n }\n}\n\nint dx4[4]={1,-1,0,0};\nint dy4[4]={0,0,1,-1};\nint dx8[8]={-1,-1,-1,0,0,1,1,1};\nint dy8[8]={-1,0,1,-1,1,-1,0,1};\n\nint search(int x,int a[],int n){\n int st=0,fi=n-1,te;\n while(st<=fi){\n te=(st+fi)/2;\n if(a[te]<x){st=te+1;}else{fi=te-1;}\n }\n return st;\n}\n\nvoid prarr(int arr[],int n){\n int i;\n for(i=0;i<n;i++){\n if(i){printf(\" \");}\n printf(\"%d\",arr[i]);\n }\n printf(\"\\n\");\n return;\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nint main(void){\n int i,j,n,m,k,a,b,c,h,w,r=0,l,t,p;\n double sd,sp,res=0.0;\n scanf(\"%d%d\",&a,&p);\n sp=(double)((100.0-2.0*(double)p)/100.0);\n if(a%2==1){\n res=1.0;\n sd=(double)a+sp;\n }\n else{sd=(double)a;}\n printf(\"%.12lf\\n\",res+(sd/(1.0-sp)));\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L2\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t-8(%rbp), %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmax, .-max\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjge\t.L5\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L6\n.L5:\n\tmovl\t-8(%rbp), %eax\n.L6:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmin, .-min\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$8, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -12(%rbp)\n\tmovl\t%esi, -16(%rbp)\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmax\n\tmovl\t%eax, %ebx\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmin\n\tmovl\t%eax, %edx\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tzt, .-zt\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjg\t.L10\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n\tjmp\t.L11\n.L10:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n.L11:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tround, .-round\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L13\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tjmp\t.L14\n.L13:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n.L14:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tceil, .-ceil\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L16:\n\tcmpl\t$0, -24(%rbp)\n\tjne\t.L17\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tgcd, .-gcd\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-4(%rbp)\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %eax\n\timull\t-24(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tlcm, .-lcm\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tsubl\t-8(%rbp), %eax\n\tmovl\t-4(%rbp), %edx\n\timull\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L22:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L23\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tnCr, .-nCr\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t%edx, %edi\n\tcall\tnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tnHr, .-nHr\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L28\n.L29:\n\tmovl\t-4(%rbp), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L28:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjle\t.L29\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tfact, .-fact\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L32\n.L33:\n\tmovl\t-4(%rbp), %eax\n\timull\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L32:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L33\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpow, .-pow\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L36\n.L37:\n\tmovl\t-20(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\taddl\t%edx, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -20(%rbp)\n.L36:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L37\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tdsum, .-dsum\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L40\n.L41:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -20(%rbp)\n.L40:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L41\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tdsumb, .-dsumb\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\timull\t-4(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tsankaku, .-sankaku\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjle\t.L46\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L47\n.L46:\n\tmovq\t-16(%rbp), %rax\n.L47:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tllmax, .-llmax\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L49\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L50\n.L49:\n\tmovq\t-16(%rbp), %rax\n.L50:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tllmin, .-llmin\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -16(%rbp)\n\tmovq\t%rsi, -24(%rbp)\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmax\n\tmovq\t%rax, %rbx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmin\n\tmovq\t%rax, %rdx\n\tmovq\t%rbx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tllzt, .-llzt\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjg\t.L54\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n\tjmp\t.L55\n.L54:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n.L55:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tllround, .-llround\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L57\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tjmp\t.L58\n.L57:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n.L58:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tllceil, .-llceil\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tjmp\t.L60\n.L61:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n.L60:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L61\n\tmovq\t-24(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tllgcd, .-llgcd\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllgcd\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-8(%rbp)\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t-32(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tlllcm, .-lllcm\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L66\n.L67:\n\tmovq\t-24(%rbp), %rax\n\taddq\t$1, %rax\n\tsubq\t-16(%rbp), %rax\n\tmovq\t-8(%rbp), %rdx\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L66:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L67\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tllnCr, .-llnCr\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB28:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\tllnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE28:\n\t.size\tllnHr, .-llnHr\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L72\n.L73:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L72:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjle\t.L73\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tllfact, .-llfact\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L76\n.L77:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L76:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L77\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tllpow, .-llpow\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L80\n.L81:\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tmovq\t%rcx, %rsi\n\tsarq\t$63, %rsi\n\tsubq\t%rsi, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\taddq\t%rdx, -8(%rbp)\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tsarq\t$63, %rcx\n\tmovq\t%rcx, %rdx\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -24(%rbp)\n.L80:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L81\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE31:\n\t.size\tlldsum, .-lldsum\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L84\n.L85:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rax, -24(%rbp)\n.L84:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L85\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE32:\n\t.size\tlldsumb, .-lldsumb\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB33:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\taddq\t$1, %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tllsankaku, .-llsankaku\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L94\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L92\n.L94:\n\tmovsd\t-16(%rbp), %xmm0\n.L92:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE34:\n\t.size\tdbmax, .-dbmax\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t-8(%rbp), %xmm0\n\tjbe\t.L100\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L98\n.L100:\n\tmovsd\t-16(%rbp), %xmm0\n.L98:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE35:\n\t.size\tdbmin, .-dbmin\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB36:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovsd\t%xmm1, -24(%rbp)\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmax\n\tmovq\t%xmm0, %rbx\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmin\n\tmovq\t%rbx, %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t%xmm1, %rax\n\tmovq\t%rax, %xmm0\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE36:\n\t.size\tdbzt, .-dbzt\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB37:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L104\n\tmovl\t$1, %eax\n\tjmp\t.L105\n.L104:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L106\n\tmovl\t$0, %eax\n\tjmp\t.L105\n.L106:\n\tmovl\t$-1, %eax\n.L105:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE37:\n\t.size\tsortfncsj, .-sortfncsj\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB38:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L108\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L108:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L110\n\tmovl\t$0, %eax\n\tjmp\t.L109\n.L110:\n\tmovl\t$-1, %eax\n.L109:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE38:\n\t.size\tsortfnckj, .-sortfnckj\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L112\n\tmovl\t$1, %eax\n\tjmp\t.L113\n.L112:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L114\n\tmovl\t$0, %eax\n\tjmp\t.L113\n.L114:\n\tmovl\t$-1, %eax\n.L113:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L116\n\tmovl\t$1, %eax\n\tjmp\t.L117\n.L116:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L118\n\tmovl\t$0, %eax\n\tjmp\t.L117\n.L118:\n\tmovl\t$-1, %eax\n.L117:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L127\n\tmovl\t$1, %eax\n\tjmp\t.L122\n.L127:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L123\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L123\n\tmovl\t$0, %eax\n\tjmp\t.L122\n.L123:\n\tmovl\t$-1, %eax\n.L122:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L136\n\tmovl\t$1, %eax\n\tjmp\t.L131\n.L136:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L132\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L132\n\tmovl\t$0, %eax\n\tjmp\t.L131\n.L132:\n\tmovl\t$-1, %eax\n.L131:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE44:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.globl\tchsortfncsj\n\t.type\tchsortfncsj, @function\nchsortfncsj:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjle\t.L142\n\tmovl\t$1, %eax\n\tjmp\t.L143\n.L142:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L144\n\tmovl\t$0, %eax\n\tjmp\t.L143\n.L144:\n\tmovl\t$-1, %eax\n.L143:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tchsortfncsj, .-chsortfncsj\n\t.globl\tchsortfnckj\n\t.type\tchsortfnckj, @function\nchsortfnckj:\n.LFB46:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjge\t.L146\n\tmovl\t$1, %eax\n\tjmp\t.L147\n.L146:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L148\n\tmovl\t$0, %eax\n\tjmp\t.L147\n.L148:\n\tmovl\t$-1, %eax\n.L147:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE46:\n\t.size\tchsortfnckj, .-chsortfnckj\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-2097152(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -2097192(%rbp)\n\tmovl\t%esi, -2097196(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, %edi\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L150\n.L151:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097180(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\taddl\t$1, -2097180(%rbp)\n.L150:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L151\n\tmovl\t-2097196(%rbp), %eax\n\tmovl\t%eax, -2097180(%rbp)\n\tjmp\t.L152\n.L153:\n\tcall\trand@PLT\n\tcltd\n\tidivl\t-2097180(%rbp)\n\tmovl\t%edx, -2097176(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tmovl\t%eax, -2097172(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tleal\t-1(%rax), %ecx\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %edx\n\tmovslq\t%ecx, %rax\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097172(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tsubl\t$1, -2097180(%rbp)\n.L152:\n\tcmpl\t$0, -2097180(%rbp)\n\tjg\t.L153\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L154\n.L155:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-2097192(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -2097180(%rbp)\n.L154:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L155\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L156\n\tcall\t__stack_chk_fail@PLT\n.L156:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tshuffledget, .-shuffledget\n\t.globl\tdx4\n\t.data\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy8\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.text\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t%edx, -24(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L158\n.L160:\n\tmovl\t-12(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L159\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L158\n.L159:\n\tmovl\t-4(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n.L158:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L160\n\tmovl\t-12(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE48:\n\t.size\tsearch, .-search\n\t.globl\tprarr\n\t.type\tprarr, @function\nprarr:\n.LFB49:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L163\n.L165:\n\tcmpl\t$0, -4(%rbp)\n\tje\t.L164\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L164:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -4(%rbp)\n.L163:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L165\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE49:\n\t.size\tprarr, .-prarr\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB50:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L168\n\tmovl\t$-1, %eax\n\tjmp\t.L169\n.L168:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L170\n\tmovl\t$1, %eax\n\tjmp\t.L169\n.L170:\n\tmovl\t$0, %eax\n.L169:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE50:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.section\t.rodata\n.LC2:\n\t.string\t\"%d%d\"\n.LC5:\n\t.string\t\"%.12lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB51:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -36(%rbp)\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -24(%rbp)\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-44(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovsd\t.LC3(%rip), %xmm0\n\tsubsd\t%xmm1, %xmm0\n\tmovsd\t.LC3(%rip), %xmm1\n\tdivsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovl\t-44(%rbp), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L172\n\tmovsd\t.LC4(%rip), %xmm0\n\tmovsd\t%xmm0, -24(%rbp)\n\tmovl\t-44(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t-16(%rbp), %xmm1\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -32(%rbp)\n\tjmp\t.L173\n.L172:\n\tmovl\t-44(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t%xmm0, -32(%rbp)\n.L173:\n\tmovsd\t.LC4(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tsubsd\t-16(%rbp), %xmm1\n\tmovsd\t-32(%rbp), %xmm0\n\tdivsd\t%xmm1, %xmm0\n\taddsd\t-24(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC5(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L175\n\tcall\t__stack_chk_fail@PLT\n.L175:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC4:\n\t.long\t0\n\t.long\t1072693248\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 #define mod 1000000007 #define pi 3.1415926535897932384 int max(int a,int b){if(a>b){return a;}return b;} int min(int a,int b){if(a<b){return a;}return b;} int zt(int a,int b){return max(a,b)-min(a,b);} int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} int nHr(int a,int b){return nCr(a+b-1,b);} int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} int sankaku(int x){return ((1+x)*x)/2;} long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);} int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);} int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} void shuffledget(int x[],int n){ srand(time(0)); int i,b[524288],p,c; for(i=0;i<n;i++){ b[i]=i; } for(i=n;i>=1;i--){ p=rand()%i; c=b[i-1];b[i-1]=b[p];b[p]=c; } for(i=0;i<n;i++){ scanf("%d",&x[b[i]]); } } int dx4[4]={1,-1,0,0}; int dy4[4]={0,0,1,-1}; int dx8[8]={-1,-1,-1,0,0,1,1,1}; int dy8[8]={-1,0,1,-1,1,-1,0,1}; int search(int x,int a[],int n){ int st=0,fi=n-1,te; while(st<=fi){ te=(st+fi)/2; if(a[te]<x){st=te+1;}else{fi=te-1;} } return st; } void prarr(int arr[],int n){ int i; for(i=0;i<n;i++){ if(i){printf(" ");} printf("%d",arr[i]); } printf("\n"); return; } typedef struct{ int val; int node; }sd; int sdsortfnc(const void *a,const void *b){ if(((sd*)a)->val < ((sd*)b)->val){return -1;} if(((sd*)a)->val > ((sd*)b)->val){return 1;} return 0; } int main(void){ int i,j,n,m,k,a,b,c,h,w,r=0,l,t,p; double sd,sp,res=0.0; scanf("%d%d",&a,&p); sp=(double)((100.0-2.0*(double)p)/100.0); if(a%2==1){ res=1.0; sd=(double)a+sp; } else{sd=(double)a;} printf("%.12lf\n",res+(sd/(1.0-sp))); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl max .type max, @function max: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jle .L2 movl -4(%rbp), %eax jmp .L3 .L2: movl -8(%rbp), %eax .L3: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size max, .-max .globl min .type min, @function min: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jge .L5 movl -4(%rbp), %eax jmp .L6 .L5: movl -8(%rbp), %eax .L6: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size min, .-min .globl zt .type zt, @function zt: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $8, %rsp .cfi_offset 3, -24 movl %edi, -12(%rbp) movl %esi, -16(%rbp) movl -16(%rbp), %edx movl -12(%rbp), %eax movl %edx, %esi movl %eax, %edi call max movl %eax, %ebx movl -16(%rbp), %edx movl -12(%rbp), %eax movl %edx, %esi movl %eax, %edi call min movl %eax, %edx movl %ebx, %eax subl %edx, %eax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size zt, .-zt .globl round .type round, @function round: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %edx, %eax addl %eax, %eax cmpl %eax, -8(%rbp) jg .L10 movl -4(%rbp), %eax cltd idivl -8(%rbp) addl $1, %eax jmp .L11 .L10: movl -4(%rbp), %eax cltd idivl -8(%rbp) .L11: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size round, .-round .globl ceil .type ceil, @function ceil: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %edx, %eax testl %eax, %eax jne .L13 movl -4(%rbp), %eax cltd idivl -8(%rbp) jmp .L14 .L13: movl -4(%rbp), %eax cltd idivl -8(%rbp) addl $1, %eax .L14: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size ceil, .-ceil .globl gcd .type gcd, @function gcd: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) jmp .L16 .L17: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %edx, -4(%rbp) movl -24(%rbp), %eax movl %eax, -20(%rbp) movl -4(%rbp), %eax movl %eax, -24(%rbp) .L16: cmpl $0, -24(%rbp) jne .L17 movl -20(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size gcd, .-gcd .globl lcm .type lcm, @function lcm: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl -24(%rbp), %edx movl -20(%rbp), %eax movl %edx, %esi movl %eax, %edi call gcd movl %eax, -4(%rbp) movl -20(%rbp), %eax cltd idivl -4(%rbp) movl %eax, -20(%rbp) movl -20(%rbp), %eax imull -24(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size lcm, .-lcm .globl nCr .type nCr, @function nCr: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $1, -4(%rbp) movl $1, -8(%rbp) jmp .L22 .L23: movl -20(%rbp), %eax addl $1, %eax subl -8(%rbp), %eax movl -4(%rbp), %edx imull %edx, %eax movl %eax, -4(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %eax, -4(%rbp) addl $1, -8(%rbp) .L22: movl -8(%rbp), %eax cmpl -24(%rbp), %eax jle .L23 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size nCr, .-nCr .globl nHr .type nHr, @function nHr: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $8, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %edx movl -8(%rbp), %eax addl %edx, %eax leal -1(%rax), %edx movl -8(%rbp), %eax movl %eax, %esi movl %edx, %edi call nCr leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size nHr, .-nHr .globl fact .type fact, @function fact: .LFB15: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl $1, -4(%rbp) movl $1, -8(%rbp) jmp .L28 .L29: movl -4(%rbp), %eax imull -8(%rbp), %eax movl %eax, -4(%rbp) addl $1, -8(%rbp) .L28: movl -8(%rbp), %eax cmpl -20(%rbp), %eax jle .L29 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE15: .size fact, .-fact .globl pow .type pow, @function pow: .LFB16: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $1, -4(%rbp) movl $1, -8(%rbp) jmp .L32 .L33: movl -4(%rbp), %eax imull -20(%rbp), %eax movl %eax, -4(%rbp) addl $1, -8(%rbp) .L32: movl -8(%rbp), %eax cmpl -24(%rbp), %eax jle .L33 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE16: .size pow, .-pow .globl dsum .type dsum, @function dsum: .LFB17: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl $0, -4(%rbp) jmp .L36 .L37: movl -20(%rbp), %ecx movslq %ecx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %ecx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax subl %eax, %ecx movl %ecx, %edx addl %edx, -4(%rbp) movl -20(%rbp), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -20(%rbp) .L36: cmpl $0, -20(%rbp) jne .L37 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE17: .size dsum, .-dsum .globl dsumb .type dsumb, @function dsumb: .LFB18: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $0, -4(%rbp) jmp .L40 .L41: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %edx, %eax addl %eax, -4(%rbp) movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %eax, -20(%rbp) .L40: cmpl $0, -20(%rbp) jne .L41 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE18: .size dsumb, .-dsumb .globl sankaku .type sankaku, @function sankaku: .LFB19: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl -4(%rbp), %eax addl $1, %eax imull -4(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE19: .size sankaku, .-sankaku .globl llmax .type llmax, @function llmax: .LFB20: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jle .L46 movq -8(%rbp), %rax jmp .L47 .L46: movq -16(%rbp), %rax .L47: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE20: .size llmax, .-llmax .globl llmin .type llmin, @function llmin: .LFB21: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jge .L49 movq -8(%rbp), %rax jmp .L50 .L49: movq -16(%rbp), %rax .L50: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE21: .size llmin, .-llmin .globl llzt .type llzt, @function llzt: .LFB22: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $16, %rsp .cfi_offset 3, -24 movq %rdi, -16(%rbp) movq %rsi, -24(%rbp) movq -24(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call llmax movq %rax, %rbx movq -24(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call llmin movq %rax, %rdx movq %rbx, %rax subq %rdx, %rax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE22: .size llzt, .-llzt .globl llround .type llround, @function llround: .LFB23: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cqto idivq -16(%rbp) movq %rdx, %rax addq %rax, %rax cmpq %rax, -16(%rbp) jg .L54 movq -8(%rbp), %rax cqto idivq -16(%rbp) addq $1, %rax jmp .L55 .L54: movq -8(%rbp), %rax cqto idivq -16(%rbp) .L55: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE23: .size llround, .-llround .globl llceil .type llceil, @function llceil: .LFB24: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cqto idivq -16(%rbp) movq %rdx, %rax testq %rax, %rax jne .L57 movq -8(%rbp), %rax cqto idivq -16(%rbp) jmp .L58 .L57: movq -8(%rbp), %rax cqto idivq -16(%rbp) addq $1, %rax .L58: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE24: .size llceil, .-llceil .globl llgcd .type llgcd, @function llgcd: .LFB25: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) jmp .L60 .L61: movq -24(%rbp), %rax cqto idivq -32(%rbp) movq %rdx, -8(%rbp) movq -32(%rbp), %rax movq %rax, -24(%rbp) movq -8(%rbp), %rax movq %rax, -32(%rbp) .L60: cmpq $0, -32(%rbp) jne .L61 movq -24(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE25: .size llgcd, .-llgcd .globl lllcm .type lllcm, @function lllcm: .LFB26: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -32(%rbp), %rdx movq -24(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call llgcd movq %rax, -8(%rbp) movq -24(%rbp), %rax cqto idivq -8(%rbp) movq %rax, -24(%rbp) movq -24(%rbp), %rax imulq -32(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE26: .size lllcm, .-lllcm .globl llnCr .type llnCr, @function llnCr: .LFB27: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq $1, -8(%rbp) movq $1, -16(%rbp) jmp .L66 .L67: movq -24(%rbp), %rax addq $1, %rax subq -16(%rbp), %rax movq -8(%rbp), %rdx imulq %rdx, %rax movq %rax, -8(%rbp) movq -8(%rbp), %rax cqto idivq -16(%rbp) movq %rax, -8(%rbp) addq $1, -16(%rbp) .L66: movq -16(%rbp), %rax cmpq -32(%rbp), %rax jle .L67 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE27: .size llnCr, .-llnCr .globl llnHr .type llnHr, @function llnHr: .LFB28: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax addq %rdx, %rax leaq -1(%rax), %rdx movq -16(%rbp), %rax movq %rax, %rsi movq %rdx, %rdi call llnCr leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE28: .size llnHr, .-llnHr .globl llfact .type llfact, @function llfact: .LFB29: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq $1, -8(%rbp) movq $1, -16(%rbp) jmp .L72 .L73: movq -8(%rbp), %rax imulq -16(%rbp), %rax movq %rax, -8(%rbp) addq $1, -16(%rbp) .L72: movq -16(%rbp), %rax cmpq -24(%rbp), %rax jle .L73 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE29: .size llfact, .-llfact .globl llpow .type llpow, @function llpow: .LFB30: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq $1, -8(%rbp) movq $1, -16(%rbp) jmp .L76 .L77: movq -8(%rbp), %rax imulq -24(%rbp), %rax movq %rax, -8(%rbp) addq $1, -16(%rbp) .L76: movq -16(%rbp), %rax cmpq -32(%rbp), %rax jle .L77 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE30: .size llpow, .-llpow .globl lldsum .type lldsum, @function lldsum: .LFB31: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq $0, -8(%rbp) jmp .L80 .L81: movq -24(%rbp), %rcx movabsq $7378697629483820647, %rdx movq %rcx, %rax imulq %rdx movq %rdx, %rax sarq $2, %rax movq %rcx, %rsi sarq $63, %rsi subq %rsi, %rax movq %rax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax subq %rax, %rcx movq %rcx, %rdx addq %rdx, -8(%rbp) movq -24(%rbp), %rcx movabsq $7378697629483820647, %rdx movq %rcx, %rax imulq %rdx movq %rdx, %rax sarq $2, %rax sarq $63, %rcx movq %rcx, %rdx subq %rdx, %rax movq %rax, -24(%rbp) .L80: cmpq $0, -24(%rbp) jne .L81 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE31: .size lldsum, .-lldsum .globl lldsumb .type lldsumb, @function lldsumb: .LFB32: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq $0, -8(%rbp) jmp .L84 .L85: movq -24(%rbp), %rax cqto idivq -32(%rbp) movq %rdx, %rax addq %rax, -8(%rbp) movq -24(%rbp), %rax cqto idivq -32(%rbp) movq %rax, -24(%rbp) .L84: cmpq $0, -24(%rbp) jne .L85 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE32: .size lldsumb, .-lldsumb .globl llsankaku .type llsankaku, @function llsankaku: .LFB33: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq -8(%rbp), %rax addq $1, %rax imulq -8(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE33: .size llsankaku, .-llsankaku .globl dbmax .type dbmax, @function dbmax: .LFB34: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movsd %xmm0, -8(%rbp) movsd %xmm1, -16(%rbp) movsd -8(%rbp), %xmm0 comisd -16(%rbp), %xmm0 jbe .L94 movsd -8(%rbp), %xmm0 jmp .L92 .L94: movsd -16(%rbp), %xmm0 .L92: movq %xmm0, %rax movq %rax, %xmm0 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE34: .size dbmax, .-dbmax .globl dbmin .type dbmin, @function dbmin: .LFB35: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movsd %xmm0, -8(%rbp) movsd %xmm1, -16(%rbp) movsd -16(%rbp), %xmm0 comisd -8(%rbp), %xmm0 jbe .L100 movsd -8(%rbp), %xmm0 jmp .L98 .L100: movsd -16(%rbp), %xmm0 .L98: movq %xmm0, %rax movq %rax, %xmm0 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE35: .size dbmin, .-dbmin .globl dbzt .type dbzt, @function dbzt: .LFB36: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $16, %rsp .cfi_offset 3, -24 movsd %xmm0, -16(%rbp) movsd %xmm1, -24(%rbp) movsd -24(%rbp), %xmm0 movq -16(%rbp), %rax movapd %xmm0, %xmm1 movq %rax, %xmm0 call dbmax movq %xmm0, %rbx movsd -24(%rbp), %xmm0 movq -16(%rbp), %rax movapd %xmm0, %xmm1 movq %rax, %xmm0 call dbmin movq %rbx, %xmm1 subsd %xmm0, %xmm1 movq %xmm1, %rax movq %rax, %xmm0 movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE36: .size dbzt, .-dbzt .globl sortfncsj .type sortfncsj, @function sortfncsj: .LFB37: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jle .L104 movl $1, %eax jmp .L105 .L104: movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jne .L106 movl $0, %eax jmp .L105 .L106: movl $-1, %eax .L105: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE37: .size sortfncsj, .-sortfncsj .globl sortfnckj .type sortfnckj, @function sortfnckj: .LFB38: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jge .L108 movl $1, %eax jmp .L109 .L108: movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jne .L110 movl $0, %eax jmp .L109 .L110: movl $-1, %eax .L109: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE38: .size sortfnckj, .-sortfnckj .globl llsortfncsj .type llsortfncsj, @function llsortfncsj: .LFB39: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jle .L112 movl $1, %eax jmp .L113 .L112: movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jne .L114 movl $0, %eax jmp .L113 .L114: movl $-1, %eax .L113: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE39: .size llsortfncsj, .-llsortfncsj .globl llsortfnckj .type llsortfnckj, @function llsortfnckj: .LFB40: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jge .L116 movl $1, %eax jmp .L117 .L116: movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jne .L118 movl $0, %eax jmp .L117 .L118: movl $-1, %eax .L117: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE40: .size llsortfnckj, .-llsortfnckj .globl dbsortfncsj .type dbsortfncsj, @function dbsortfncsj: .LFB41: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movsd (%rax), %xmm0 movq -16(%rbp), %rax movsd (%rax), %xmm1 comisd %xmm1, %xmm0 jbe .L127 movl $1, %eax jmp .L122 .L127: movq -8(%rbp), %rax movsd (%rax), %xmm0 movq -16(%rbp), %rax movsd (%rax), %xmm1 ucomisd %xmm1, %xmm0 jp .L123 ucomisd %xmm1, %xmm0 jne .L123 movl $0, %eax jmp .L122 .L123: movl $-1, %eax .L122: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE41: .size dbsortfncsj, .-dbsortfncsj .globl dbsortfnckj .type dbsortfnckj, @function dbsortfnckj: .LFB42: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movsd (%rax), %xmm1 movq -16(%rbp), %rax movsd (%rax), %xmm0 comisd %xmm1, %xmm0 jbe .L136 movl $1, %eax jmp .L131 .L136: movq -8(%rbp), %rax movsd (%rax), %xmm0 movq -16(%rbp), %rax movsd (%rax), %xmm1 ucomisd %xmm1, %xmm0 jp .L132 ucomisd %xmm1, %xmm0 jne .L132 movl $0, %eax jmp .L131 .L132: movl $-1, %eax .L131: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE42: .size dbsortfnckj, .-dbsortfnckj .globl strsortfncsj .type strsortfncsj, @function strsortfncsj: .LFB43: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE43: .size strsortfncsj, .-strsortfncsj .globl strsortfnckj .type strsortfnckj, @function strsortfnckj: .LFB44: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE44: .size strsortfnckj, .-strsortfnckj .globl chsortfncsj .type chsortfncsj, @function chsortfncsj: .LFB45: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movzbl (%rax), %edx movq -16(%rbp), %rax movzbl (%rax), %eax cmpb %al, %dl jle .L142 movl $1, %eax jmp .L143 .L142: movq -8(%rbp), %rax movzbl (%rax), %edx movq -16(%rbp), %rax movzbl (%rax), %eax cmpb %al, %dl jne .L144 movl $0, %eax jmp .L143 .L144: movl $-1, %eax .L143: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE45: .size chsortfncsj, .-chsortfncsj .globl chsortfnckj .type chsortfnckj, @function chsortfnckj: .LFB46: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movzbl (%rax), %edx movq -16(%rbp), %rax movzbl (%rax), %eax cmpb %al, %dl jge .L146 movl $1, %eax jmp .L147 .L146: movq -8(%rbp), %rax movzbl (%rax), %edx movq -16(%rbp), %rax movzbl (%rax), %eax cmpb %al, %dl jne .L148 movl $0, %eax jmp .L147 .L148: movl $-1, %eax .L147: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE46: .size chsortfnckj, .-chsortfnckj .section .rodata .LC0: .string "%d" .text .globl shuffledget .type shuffledget, @function shuffledget: .LFB47: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -2097152(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $48, %rsp movq %rdi, -2097192(%rbp) movl %esi, -2097196(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, %edi call time@PLT movl %eax, %edi call srand@PLT movl $0, -2097180(%rbp) jmp .L150 .L151: movl -2097180(%rbp), %eax cltq movl -2097180(%rbp), %edx movl %edx, -2097168(%rbp,%rax,4) addl $1, -2097180(%rbp) .L150: movl -2097180(%rbp), %eax cmpl -2097196(%rbp), %eax jl .L151 movl -2097196(%rbp), %eax movl %eax, -2097180(%rbp) jmp .L152 .L153: call rand@PLT cltd idivl -2097180(%rbp) movl %edx, -2097176(%rbp) movl -2097180(%rbp), %eax subl $1, %eax cltq movl -2097168(%rbp,%rax,4), %eax movl %eax, -2097172(%rbp) movl -2097180(%rbp), %eax leal -1(%rax), %ecx movl -2097176(%rbp), %eax cltq movl -2097168(%rbp,%rax,4), %edx movslq %ecx, %rax movl %edx, -2097168(%rbp,%rax,4) movl -2097176(%rbp), %eax cltq movl -2097172(%rbp), %edx movl %edx, -2097168(%rbp,%rax,4) subl $1, -2097180(%rbp) .L152: cmpl $0, -2097180(%rbp) jg .L153 movl $0, -2097180(%rbp) jmp .L154 .L155: movl -2097180(%rbp), %eax cltq movl -2097168(%rbp,%rax,4), %eax cltq leaq 0(,%rax,4), %rdx movq -2097192(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -2097180(%rbp) .L154: movl -2097180(%rbp), %eax cmpl -2097196(%rbp), %eax jl .L155 nop movq -8(%rbp), %rax subq %fs:40, %rax je .L156 call __stack_chk_fail@PLT .L156: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE47: .size shuffledget, .-shuffledget .globl dx4 .data .align 16 .type dx4, @object .size dx4, 16 dx4: .long 1 .long -1 .long 0 .long 0 .globl dy4 .align 16 .type dy4, @object .size dy4, 16 dy4: .long 0 .long 0 .long 1 .long -1 .globl dx8 .align 32 .type dx8, @object .size dx8, 32 dx8: .long -1 .long -1 .long -1 .long 0 .long 0 .long 1 .long 1 .long 1 .globl dy8 .align 32 .type dy8, @object .size dy8, 32 dy8: .long -1 .long 0 .long 1 .long -1 .long 1 .long -1 .long 0 .long 1 .text .globl search .type search, @function search: .LFB48: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movq %rsi, -32(%rbp) movl %edx, -24(%rbp) movl $0, -12(%rbp) movl -24(%rbp), %eax subl $1, %eax movl %eax, -8(%rbp) jmp .L158 .L160: movl -12(%rbp), %edx movl -8(%rbp), %eax addl %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -4(%rbp) movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -32(%rbp), %rax addq %rdx, %rax movl (%rax), %eax cmpl %eax, -20(%rbp) jle .L159 movl -4(%rbp), %eax addl $1, %eax movl %eax, -12(%rbp) jmp .L158 .L159: movl -4(%rbp), %eax subl $1, %eax movl %eax, -8(%rbp) .L158: movl -12(%rbp), %eax cmpl -8(%rbp), %eax jle .L160 movl -12(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE48: .size search, .-search .globl prarr .type prarr, @function prarr: .LFB49: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movl %esi, -28(%rbp) movl $0, -4(%rbp) jmp .L163 .L165: cmpl $0, -4(%rbp) je .L164 movl $32, %edi call putchar@PLT .L164: movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT addl $1, -4(%rbp) .L163: movl -4(%rbp), %eax cmpl -28(%rbp), %eax jl .L165 movl $10, %edi call putchar@PLT nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE49: .size prarr, .-prarr .globl sdsortfnc .type sdsortfnc, @function sdsortfnc: .LFB50: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jge .L168 movl $-1, %eax jmp .L169 .L168: movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jle .L170 movl $1, %eax jmp .L169 .L170: movl $0, %eax .L169: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE50: .size sdsortfnc, .-sdsortfnc .section .rodata .LC2: .string "%d%d" .LC5: .string "%.12lf\n" .text .globl main .type main, @function main: .LFB51: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -36(%rbp) pxor %xmm0, %xmm0 movsd %xmm0, -24(%rbp) leaq -40(%rbp), %rdx leaq -44(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -40(%rbp), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movapd %xmm0, %xmm1 addsd %xmm0, %xmm1 movsd .LC3(%rip), %xmm0 subsd %xmm1, %xmm0 movsd .LC3(%rip), %xmm1 divsd %xmm1, %xmm0 movsd %xmm0, -16(%rbp) movl -44(%rbp), %eax cltd shrl $31, %edx addl %edx, %eax andl $1, %eax subl %edx, %eax cmpl $1, %eax jne .L172 movsd .LC4(%rip), %xmm0 movsd %xmm0, -24(%rbp) movl -44(%rbp), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movsd -16(%rbp), %xmm1 addsd %xmm1, %xmm0 movsd %xmm0, -32(%rbp) jmp .L173 .L172: movl -44(%rbp), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movsd %xmm0, -32(%rbp) .L173: movsd .LC4(%rip), %xmm0 movapd %xmm0, %xmm1 subsd -16(%rbp), %xmm1 movsd -32(%rbp), %xmm0 divsd %xmm1, %xmm0 addsd -24(%rbp), %xmm0 movq %xmm0, %rax movq %rax, %xmm0 leaq .LC5(%rip), %rax movq %rax, %rdi movl $1, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L175 call __stack_chk_fail@PLT .L175: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE51: .size main, .-main .section .rodata .align 8 .LC3: .long 0 .long 1079574528 .align 8 .LC4: .long 0 .long 1072693248 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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; i <= k; i++) {\n\t\tscanf(\"%lld\", &s[i]);\n\t}\n\tif (s[k]!=2) { printf(\"-1\"); return 0; }\n\tleft = 2;\n\tright = 2;\n\tfor (int i = k - 1; i > 0; i--) {\n \n\t\tleft = (((left-1) / s[i]) + 1)*s[i];\n\t\tright = (((right+s[i+1]-1) / s[i]))*s[i];\n if(right<left){printf(\"-1\"); return 0;}\n\t}\n\tprintf(\"%lld %lld\", left, right + s[1] - 1);\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%lld %lld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-1597440(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3024, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-1600416(%rbp), %rax\n\tmovl\t$1600400, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovq\t$0, -1600424(%rbp)\n\tleaq\t-1600448(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -1600456(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-1600416(%rbp), %rdx\n\tmovl\t-1600456(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -1600456(%rbp)\n.L2:\n\tmovl\t-1600456(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-1600448(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L3\n\tmovq\t-1600448(%rbp), %rax\n\tmovq\t-1600416(%rbp,%rax,8), %rax\n\tcmpq\t$2, %rax\n\tje\t.L4\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L9\n.L4:\n\tmovq\t$2, -1600440(%rbp)\n\tmovq\t$2, -1600432(%rbp)\n\tmovq\t-1600448(%rbp), %rax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -1600452(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovq\t-1600440(%rbp), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rsi\n\tmovq\t%rcx, %rax\n\tcqto\n\tidivq\t%rsi\n\tleaq\t1(%rax), %rdx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rax\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -1600440(%rbp)\n\tmovl\t-1600452(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rdx\n\tmovq\t-1600432(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rcx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rsi\n\tmovq\t%rcx, %rax\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rax, %rdx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rax\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -1600432(%rbp)\n\tmovq\t-1600432(%rbp), %rax\n\tcmpq\t-1600440(%rbp), %rax\n\tjge\t.L7\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L9\n.L7:\n\tsubl\t$1, -1600452(%rbp)\n.L6:\n\tcmpl\t$0, -1600452(%rbp)\n\tjg\t.L8\n\tmovq\t-1600408(%rbp), %rdx\n\tmovq\t-1600432(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-1600440(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L9:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t-1597440(%rsp), %r11\n\t.cfi_def_cfa 11, 1597480\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3000, %rsp\n\t.cfi_def_cfa_offset 1600480\n\tmovl\t$1600400, %edx\n\txorl\t%esi, %esi\n\tleaq\t.LC0(%rip), %r13\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1600424(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\tmovq\t%rbp, %rdi\n\tcall\tmemset@PLT\n\tleaq\t8(%rsp), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rcx\n\ttestq\t%rcx, %rcx\n\tjle\t.L2\n\tleaq\t24(%rsp), %r12\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddq\t$8, %r12\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbx, %rax\n\tmovq\t8(%rsp), %rcx\n\taddq\t$1, %rbx\n\taddq\t$2, %rax\n\tcmpq\t%rax, %rcx\n\tjge\t.L3\n.L2:\n\tmovq\t16(%rsp,%rcx,8), %r8\n\tcmpq\t$2, %r8\n\tjne\t.L7\n\tleal\t-1(%rcx), %r9d\n\tmovl\t%ecx, %esi\n\ttestl\t%r9d, %r9d\n\tjle\t.L11\n\tmovslq\t%r9d, %r9\n\tmovl\t$1, %eax\n\tmovslq\t%ecx, %rcx\n\tmovq\t16(%rsp,%r9,8), %rdi\n\tcqto\n\tidivq\t%rdi\n\tleaq\t1(%rax), %r8\n\tmovq\t16(%rsp,%rcx,8), %rax\n\timulq\t%rdi, %r8\n\taddq\t$1, %rax\n\tcqto\n\tidivq\t%rdi\n\timulq\t%rdi, %rax\n\tmovq\t%rax, %rcx\n\tcmpq\t%rax, %r8\n\tjg\t.L7\n\tleal\t-2(%rsi), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, %eax\n\tleaq\t0(,%rdx,8), %r10\n\tsalq\t$3, %rax\n\tsubq\t%rdx, %r9\n\tleaq\t0(%rbp,%r10), %rdi\n\tsubq\t%rax, %r10\n\taddq\t%rbp, %r10\n\tjmp\t.L8\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovq\t(%rdi), %rsi\n\tleaq\t-1(%r8), %rax\n\taddq\t(%rdi,%r9,8), %rcx\n\tsubq\t$8, %rdi\n\tcqto\n\tidivq\t%rsi\n\tleaq\t1(%rax), %r8\n\tleaq\t-1(%rcx), %rax\n\tcqto\n\timulq\t%rsi, %r8\n\tidivq\t%rsi\n\timulq\t%rax, %rsi\n\tmovq\t%rsi, %rcx\n\tcmpq\t%rsi, %r8\n\tjg\t.L7\n.L8:\n\tcmpq\t%r10, %rdi\n\tjne\t.L9\n.L6:\n\taddq\t24(%rsp), %rcx\n\tmovq\t%r8, %rdx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tsubq\t$1, %rcx\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L5\n.L7:\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L5:\n\tmovq\t1600424(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L15\n\taddq\t$1600440, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L11:\n\t.cfi_restore_state\n\tmovl\t$2, %ecx\n\tjmp\t.L6\n.L15:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t-1597440(%rsp), %r11\n\t.cfi_def_cfa 11, 1597480\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3000, %rsp\n\t.cfi_def_cfa_offset 1600480\n\tmovl\t$1600400, %edx\n\txorl\t%esi, %esi\n\tleaq\t.LC0(%rip), %r13\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1600424(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\tmovq\t%rbp, %rdi\n\tcall\tmemset@PLT\n\tleaq\t8(%rsp), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rcx\n\ttestq\t%rcx, %rcx\n\tjle\t.L2\n\tleaq\t24(%rsp), %r12\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddq\t$8, %r12\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbx, %rax\n\tmovq\t8(%rsp), %rcx\n\taddq\t$1, %rbx\n\taddq\t$2, %rax\n\tcmpq\t%rax, %rcx\n\tjge\t.L3\n.L2:\n\tmovq\t16(%rsp,%rcx,8), %r8\n\tcmpq\t$2, %r8\n\tjne\t.L7\n\tleal\t-1(%rcx), %r9d\n\tmovl\t%ecx, %esi\n\ttestl\t%r9d, %r9d\n\tjle\t.L11\n\tmovslq\t%r9d, %r9\n\tmovl\t$1, %eax\n\tmovslq\t%ecx, %rcx\n\tmovq\t16(%rsp,%r9,8), %rdi\n\tcqto\n\tidivq\t%rdi\n\tleaq\t1(%rax), %r8\n\tmovq\t16(%rsp,%rcx,8), %rax\n\timulq\t%rdi, %r8\n\taddq\t$1, %rax\n\tcqto\n\tidivq\t%rdi\n\timulq\t%rdi, %rax\n\tmovq\t%rax, %rcx\n\tcmpq\t%rax, %r8\n\tjg\t.L7\n\tleal\t-2(%rsi), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, %eax\n\tleaq\t0(,%rdx,8), %r10\n\tsalq\t$3, %rax\n\tsubq\t%rdx, %r9\n\tleaq\t0(%rbp,%r10), %rdi\n\tsubq\t%rax, %r10\n\taddq\t%rbp, %r10\n\tjmp\t.L8\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovq\t(%rdi), %rsi\n\tleaq\t-1(%r8), %rax\n\taddq\t(%rdi,%r9,8), %rcx\n\tsubq\t$8, %rdi\n\tcqto\n\tidivq\t%rsi\n\tleaq\t1(%rax), %r8\n\tleaq\t-1(%rcx), %rax\n\tcqto\n\timulq\t%rsi, %r8\n\tidivq\t%rsi\n\timulq\t%rax, %rsi\n\tmovq\t%rsi, %rcx\n\tcmpq\t%rsi, %r8\n\tjg\t.L7\n.L8:\n\tcmpq\t%r10, %rdi\n\tjne\t.L9\n.L6:\n\taddq\t24(%rsp), %rcx\n\tmovq\t%r8, %rdx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tsubq\t$1, %rcx\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L5\n.L7:\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L5:\n\tmovq\t1600424(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L15\n\taddq\t$1600440, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L11:\n\t.cfi_restore_state\n\tmovl\t$2, %ecx\n\tjmp\t.L6\n.L15:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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; i <= k; i++) {\n\t\tscanf(\"%lld\", &s[i]);\n\t}\n\tif (s[k]!=2) { printf(\"-1\"); return 0; }\n\tleft = 2;\n\tright = 2;\n\tfor (int i = k - 1; i > 0; i--) {\n \n\t\tleft = (((left-1) / s[i]) + 1)*s[i];\n\t\tright = (((right+s[i+1]-1) / s[i]))*s[i];\n if(right<left){printf(\"-1\"); return 0;}\n\t}\n\tprintf(\"%lld %lld\", left, right + s[1] - 1);\n}", "index": 11, "inputs": [ "5\n3 7 100 3 2\n", "10\n2 3 2 2 2 2 2 2 2 2\n", "4\n3 3 2 2\n", "4\n4 3 2 2\n", "4\n3 5 3 2\n", "4\n1 1 2 2\n", "4\n3 4 2 2\n", "5\n3 7 100 5 2\n", "5\n3 7 100 2 2\n", "5\n3 4 100 3 3\n", "5\n3 7 101 3 2\n", "4\n3 6 2 2\n", "5\n3 12 100 5 2\n", "5\n3 7 100 1 2\n", "10\n2 3 2 2 2 2 4 2 2 2\n", "5\n3 9 101 3 2\n", "5\n3 12 100 3 2\n", "5\n6 7 100 1 2\n", "10\n2 3 2 2 2 2 4 1 2 2\n", "5\n2 9 101 3 2\n", "5\n3 12 100 3 4\n", "5\n6 1 100 1 2\n", "10\n2 3 2 2 2 2 4 1 4 2\n", "5\n2 12 101 3 2\n", "5\n3 12 100 3 3\n", "5\n2 12 101 3 4\n", "5\n2 12 100 3 4\n", "5\n2 20 100 3 4\n", "5\n2 20 100 5 4\n", "5\n2 20 100 5 1\n", "5\n2 4 100 3 2\n", "5\n2 7 100 3 2\n", "5\n3 4 100 3 6\n", "10\n2 3 3 2 2 2 2 2 2 2\n", "5\n3 7 111 3 2\n", "4\n3 6 4 2\n", "5\n3 24 100 5 2\n", "5\n3 7 110 1 2\n", "5\n3 9 001 3 2\n", "5\n6 6 100 1 2\n", "10\n2 3 2 2 1 2 4 1 2 2\n", "5\n2 14 101 3 2\n", "5\n3 12 100 3 5\n", "5\n6 1 101 1 2\n", "10\n2 3 2 2 2 2 7 1 4 2\n", "5\n2 12 111 3 2\n", "5\n3 12 100 6 3\n", "5\n2 12 101 3 6\n", "5\n2 12 111 3 4\n", "5\n2 20 110 3 4\n", "5\n2 32 100 5 4\n", "5\n2 20 101 5 1\n", "5\n2 7 101 3 2\n", "4\n3 10 2 2\n", "5\n3 4 100 3 12\n", "10\n2 3 3 2 2 2 2 2 2 4\n", "5\n3 47 100 5 2\n", "5\n3 7 111 1 2\n", "5\n6 6 100 2 2\n", "10\n2 3 2 2 1 3 4 1 2 2\n", "5\n2 8 101 3 2\n", "5\n5 1 101 1 2\n", "10\n4 3 2 2 2 2 7 1 4 2\n", "5\n2 12 111 1 2\n", "5\n3 12 101 6 3\n", "5\n2 18 101 3 6\n", "5\n2 12 111 3 7\n", "5\n2 12 110 3 4\n", "5\n2 32 100 7 4\n", "5\n2 20 101 7 1\n", "5\n2 7 101 3 4\n", "4\n3 19 2 2\n", "5\n3 4 100 3 7\n", "5\n3 47 100 9 2\n", "5\n3 7 111 2 2\n", "5\n5 6 100 2 2\n", "5\n1 8 101 3 2\n", "5\n5 1 100 1 2\n", "10\n4 1 2 2 2 2 7 1 4 2\n", "5\n3 12 111 1 2\n", "5\n6 12 100 6 3\n", "5\n2 18 101 6 6\n", "5\n2 12 111 5 7\n", "5\n2 32 100 8 4\n", "5\n2 7 101 3 3\n", "4\n2 19 2 2\n", "5\n6 4 100 3 7\n", "5\n3 47 110 9 2\n", "5\n1 7 111 2 2\n", "5\n2 6 100 2 2\n", "5\n1 8 101 5 2\n", "5\n5 1 110 1 2\n", "10\n4 1 2 3 2 2 7 1 4 2\n", "5\n3 12 101 1 2\n", "5\n6 22 100 6 3\n", "5\n2 18 100 6 6\n", "5\n2 12 111 10 7\n", "5\n2 45 100 8 4\n", "5\n2 7 101 4 3\n", "4\n2 34 2 2\n", "5\n3 4 100 3 2\n", "4\n3 4 3 2\n", "4\n3 4 3 2\n", "10\n2 2 2 2 2 2 2 2 2 2\n" ], "outputs": [ "-1", "4 5", "3 5", "4 7", "6 11", "2 3", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "4 5", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "6 8", "6 8", "2 3" ], "question": "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; i <= k; i++) {\n\t\tscanf(\"%lld\", &s[i]);\n\t}\n\tif (s[k]!=2) { printf(\"-1\"); return 0; }\n\tleft = 2;\n\tright = 2;\n\tfor (int i = k - 1; i > 0; i--) {\n \n\t\tleft = (((left-1) / s[i]) + 1)*s[i];\n\t\tright = (((right+s[i+1]-1) / s[i]))*s[i];\n if(right<left){printf(\"-1\"); return 0;}\n\t}\n\tprintf(\"%lld %lld\", left, right + s[1] - 1);\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%lld %lld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-1597440(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3024, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-1600416(%rbp), %rax\n\tmovl\t$1600400, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovq\t$0, -1600424(%rbp)\n\tleaq\t-1600448(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -1600456(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-1600416(%rbp), %rdx\n\tmovl\t-1600456(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -1600456(%rbp)\n.L2:\n\tmovl\t-1600456(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-1600448(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L3\n\tmovq\t-1600448(%rbp), %rax\n\tmovq\t-1600416(%rbp,%rax,8), %rax\n\tcmpq\t$2, %rax\n\tje\t.L4\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L9\n.L4:\n\tmovq\t$2, -1600440(%rbp)\n\tmovq\t$2, -1600432(%rbp)\n\tmovq\t-1600448(%rbp), %rax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -1600452(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovq\t-1600440(%rbp), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rsi\n\tmovq\t%rcx, %rax\n\tcqto\n\tidivq\t%rsi\n\tleaq\t1(%rax), %rdx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rax\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -1600440(%rbp)\n\tmovl\t-1600452(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rdx\n\tmovq\t-1600432(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rcx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rsi\n\tmovq\t%rcx, %rax\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rax, %rdx\n\tmovl\t-1600452(%rbp), %eax\n\tcltq\n\tmovq\t-1600416(%rbp,%rax,8), %rax\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -1600432(%rbp)\n\tmovq\t-1600432(%rbp), %rax\n\tcmpq\t-1600440(%rbp), %rax\n\tjge\t.L7\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L9\n.L7:\n\tsubl\t$1, -1600452(%rbp)\n.L6:\n\tcmpl\t$0, -1600452(%rbp)\n\tjg\t.L8\n\tmovq\t-1600408(%rbp), %rdx\n\tmovq\t-1600432(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-1600440(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L9:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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]); } if (s[k]!=2) { printf("-1"); return 0; } left = 2; right = 2; for (int i = k - 1; i > 0; i--) { left = (((left-1) / s[i]) + 1)*s[i]; right = (((right+s[i+1]-1) / s[i]))*s[i]; if(right<left){printf("-1"); return 0;} } printf("%lld %lld", left, right + s[1] - 1); } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lld" .LC1: .string "-1" .LC2: .string "%lld %lld" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -1597440(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $3024, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -1600416(%rbp), %rax movl $1600400, %edx movl $0, %esi movq %rax, %rdi call memset@PLT movq $0, -1600424(%rbp) leaq -1600448(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -1600456(%rbp) jmp .L2 .L3: leaq -1600416(%rbp), %rdx movl -1600456(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -1600456(%rbp) .L2: movl -1600456(%rbp), %eax movslq %eax, %rdx movq -1600448(%rbp), %rax cmpq %rax, %rdx jle .L3 movq -1600448(%rbp), %rax movq -1600416(%rbp,%rax,8), %rax cmpq $2, %rax je .L4 leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L9 .L4: movq $2, -1600440(%rbp) movq $2, -1600432(%rbp) movq -1600448(%rbp), %rax subl $1, %eax movl %eax, -1600452(%rbp) jmp .L6 .L8: movq -1600440(%rbp), %rax leaq -1(%rax), %rcx movl -1600452(%rbp), %eax cltq movq -1600416(%rbp,%rax,8), %rsi movq %rcx, %rax cqto idivq %rsi leaq 1(%rax), %rdx movl -1600452(%rbp), %eax cltq movq -1600416(%rbp,%rax,8), %rax imulq %rdx, %rax movq %rax, -1600440(%rbp) movl -1600452(%rbp), %eax addl $1, %eax cltq movq -1600416(%rbp,%rax,8), %rdx movq -1600432(%rbp), %rax addq %rdx, %rax leaq -1(%rax), %rcx movl -1600452(%rbp), %eax cltq movq -1600416(%rbp,%rax,8), %rsi movq %rcx, %rax cqto idivq %rsi movq %rax, %rdx movl -1600452(%rbp), %eax cltq movq -1600416(%rbp,%rax,8), %rax imulq %rdx, %rax movq %rax, -1600432(%rbp) movq -1600432(%rbp), %rax cmpq -1600440(%rbp), %rax jge .L7 leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L9 .L7: subl $1, -1600452(%rbp) .L6: cmpl $0, -1600452(%rbp) jg .L8 movq -1600408(%rbp), %rdx movq -1600432(%rbp), %rax addq %rdx, %rax leaq -1(%rax), %rdx movq -1600440(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L9: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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#define P 1000000007\n\nint comp(const void *a, const void *b){return *(int*)a-*(int*)b;}\n\nint main(void){\n\tint n, i;\n\tint a[10000], b[10000];\n\tlong A=0, B=0;\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++){ scanf(\"%d\", &a[i]); A+=a[i]; }\n\tfor(i=0; i<n; i++){ scanf(\"%d\", &b[i]); B+=b[i]; }\n\tlong c=0, d=0;\n\tfor(i=0; i<n; i++){\n\t\tif(a[i]<b[i]){c+=(b[i]-a[i])/2;}\n\t\tif(a[i]>b[i]){d+=a[i]-b[i];}\n\t}\n\tputs(c>=d?\"Yes\":\"No\");\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcomp, .-comp\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-77824(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2240, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$0, -80048(%rbp)\n\tmovq\t$0, -80040(%rbp)\n\tleaq\t-80056(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -80052(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-80016(%rbp), %rdx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %eax\n\tcltq\n\taddq\t%rax, -80048(%rbp)\n\taddl\t$1, -80052(%rbp)\n.L4:\n\tmovl\t-80056(%rbp), %eax\n\tcmpl\t%eax, -80052(%rbp)\n\tjl\t.L5\n\tmovl\t$0, -80052(%rbp)\n\tjmp\t.L6\n.L7:\n\tleaq\t-40016(%rbp), %rdx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tcltq\n\taddq\t%rax, -80040(%rbp)\n\taddl\t$1, -80052(%rbp)\n.L6:\n\tmovl\t-80056(%rbp), %eax\n\tcmpl\t%eax, -80052(%rbp)\n\tjl\t.L7\n\tmovq\t$0, -80032(%rbp)\n\tmovq\t$0, -80024(%rbp)\n\tmovl\t$0, -80052(%rbp)\n\tjmp\t.L8\n.L11:\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L9\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\taddq\t%rax, -80032(%rbp)\n.L9:\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L10\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tcltq\n\taddq\t%rax, -80024(%rbp)\n.L10:\n\taddl\t$1, -80052(%rbp)\n.L8:\n\tmovl\t-80056(%rbp), %eax\n\tcmpl\t%eax, -80052(%rbp)\n\tjl\t.L11\n\tmovq\t-80032(%rbp), %rax\n\tcmpq\t-80024(%rbp), %rax\n\tjl\t.L12\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L13\n.L12:\n\tleaq\t.LC2(%rip), %rax\n.L13:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L15\n\tcall\t__stack_chk_fail@PLT\n.L15:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\"Yes\"\n.LC1:\n\t.string\t\"No\"\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.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tleaq\t-77824(%rsp), %r11\n\t.cfi_def_cfa 11, 77872\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2208, %rsp\n\t.cfi_def_cfa_offset 80080\n\tleaq\t.LC2(%rip), %r14\n\tmovq\t%r14, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 80024(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tleaq\t16(%rsp), %rbx\n\txorl\t%ebp, %ebp\n\tmovq\t%rbx, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%r12, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\taddq\t$4, %r12\n\tcmpl\t%ebp, %eax\n\tjg\t.L5\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tleaq\t40016(%rsp), %rbp\n\txorl\t%r12d, %r12d\n\tmovq\t%rbp, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r13, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r12d\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\taddq\t$4, %r13\n\tcmpl\t%r12d, %eax\n\tjg\t.L6\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tmovslq\t%eax, %rsi\n\txorl\t%edx, %edx\n\txorl\t%r8d, %r8d\n\txorl\t%edi, %edi\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tsubl\t%ecx, %eax\n\tsarl\t%eax\n\tcltq\n\taddq\t%rax, %rdi\n.L9:\n\taddq\t$1, %rdx\n\tcmpq\t%rdx, %rsi\n\tje\t.L19\n.L10:\n\tmovl\t(%rbx,%rdx,4), %ecx\n\tmovl\t0(%rbp,%rdx,4), %eax\n\tcmpl\t%eax, %ecx\n\tjl\t.L20\n\tjle\t.L9\n\tsubl\t%eax, %ecx\n\taddq\t$1, %rdx\n\tmovslq\t%ecx, %rcx\n\taddq\t%rcx, %r8\n\tcmpq\t%rdx, %rsi\n\tjne\t.L10\n.L19:\n\tleaq\t.LC1(%rip), %r9\n\tcmpq\t%rdi, %r8\n\tjle\t.L12\n.L11:\n\tmovq\t%r9, %rdi\n\tcall\tputs@PLT\n\tmovq\t80024(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L21\n\taddq\t$80032, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L12:\n\t.cfi_restore_state\n\tleaq\t.LC0(%rip), %r9\n\tjmp\t.L11\n.L21:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE64:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.LC1:\n\t.string\t\"No\"\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.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tleaq\t-77824(%rsp), %r11\n\t.cfi_def_cfa 11, 77872\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2208, %rsp\n\t.cfi_def_cfa_offset 80080\n\tleaq\t.LC2(%rip), %r14\n\tmovq\t%r14, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 80024(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tleaq\t16(%rsp), %rbx\n\txorl\t%ebp, %ebp\n\tmovq\t%rbx, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%r12, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\taddq\t$4, %r12\n\tcmpl\t%ebp, %eax\n\tjg\t.L5\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tleaq\t40016(%rsp), %rbp\n\txorl\t%r12d, %r12d\n\tmovq\t%rbp, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r13, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r12d\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\taddq\t$4, %r13\n\tcmpl\t%r12d, %eax\n\tjg\t.L6\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tmovslq\t%eax, %rsi\n\txorl\t%edx, %edx\n\txorl\t%r8d, %r8d\n\txorl\t%edi, %edi\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tsubl\t%ecx, %eax\n\tsarl\t%eax\n\tcltq\n\taddq\t%rax, %rdi\n.L9:\n\taddq\t$1, %rdx\n\tcmpq\t%rdx, %rsi\n\tje\t.L19\n.L10:\n\tmovl\t(%rbx,%rdx,4), %ecx\n\tmovl\t0(%rbp,%rdx,4), %eax\n\tcmpl\t%eax, %ecx\n\tjl\t.L20\n\tjle\t.L9\n\tsubl\t%eax, %ecx\n\taddq\t$1, %rdx\n\tmovslq\t%ecx, %rcx\n\taddq\t%rcx, %r8\n\tcmpq\t%rdx, %rsi\n\tjne\t.L10\n.L19:\n\tleaq\t.LC1(%rip), %r9\n\tcmpq\t%rdi, %r8\n\tjle\t.L12\n.L11:\n\tmovq\t%r9, %rdi\n\tcall\tputs@PLT\n\tmovq\t80024(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L21\n\taddq\t$80032, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L12:\n\t.cfi_restore_state\n\tleaq\t.LC0(%rip), %r9\n\tjmp\t.L11\n.L21:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE64:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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#define P 1000000007\n\nint comp(const void *a, const void *b){return *(int*)a-*(int*)b;}\n\nint main(void){\n\tint n, i;\n\tint a[10000], b[10000];\n\tlong A=0, B=0;\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++){ scanf(\"%d\", &a[i]); A+=a[i]; }\n\tfor(i=0; i<n; i++){ scanf(\"%d\", &b[i]); B+=b[i]; }\n\tlong c=0, d=0;\n\tfor(i=0; i<n; i++){\n\t\tif(a[i]<b[i]){c+=(b[i]-a[i])/2;}\n\t\tif(a[i]>b[i]){d+=a[i]-b[i];}\n\t}\n\tputs(c>=d?\"Yes\":\"No\");\n}\n", "index": 13, "inputs": [ "5\n3 1 6 1 5\n2 7 1 8 2\n", "3\n1 2 2\n5 2 2\n", "5\n2 8 1 8 2\n3 1 4 1 5\n", "5\n3 1 7 1 5\n2 7 1 8 2\n", "5\n2 8 1 8 2\n5 1 4 1 5\n", "3\n1 2 2\n4 2 2\n", "5\n3 1 8 1 5\n2 7 1 8 2\n", "5\n2 8 1 8 2\n5 1 4 0 5\n", "3\n1 2 3\n4 2 2\n", "5\n3 1 8 2 5\n2 7 1 8 2\n", "5\n2 8 1 8 2\n5 1 5 0 5\n", "3\n0 2 3\n4 2 2\n", "5\n3 1 8 2 5\n2 7 1 8 4\n", "5\n2 8 1 8 2\n5 2 5 0 5\n", "3\n1 2 1\n4 2 2\n", "5\n3 1 8 2 5\n2 7 1 4 4\n", "5\n2 8 1 8 2\n5 2 10 0 5\n", "3\n0 2 2\n4 2 2\n", "5\n3 2 8 2 5\n2 7 1 4 4\n", "5\n2 8 1 8 2\n2 2 10 0 5\n", "3\n0 2 2\n7 2 2\n", "5\n3 2 8 2 7\n2 7 1 4 4\n", "5\n2 8 1 8 2\n2 2 10 0 0\n", "3\n0 0 2\n7 2 2\n", "5\n3 2 8 1 7\n2 7 1 4 4\n", "5\n3 8 1 8 2\n2 2 10 0 0\n", "3\n0 0 2\n7 2 0\n", "5\n3 2 8 1 7\n2 7 1 4 7\n", "5\n3 8 0 8 2\n2 2 10 0 0\n", "3\n0 0 2\n0 2 0\n", "5\n3 2 8 1 7\n4 7 1 4 7\n", "5\n3 8 0 8 2\n1 2 10 0 0\n", "3\n0 -1 2\n0 2 0\n", "5\n3 2 8 1 9\n4 7 1 4 7\n", "5\n3 8 0 8 2\n0 2 10 0 0\n", "3\n0 -2 2\n0 2 0\n", "5\n3 2 8 1 9\n4 7 0 4 7\n", "5\n3 8 0 8 2\n0 2 1 0 0\n", "3\n0 -2 2\n-1 2 0\n", "5\n3 2 8 2 9\n4 7 0 4 7\n", "5\n3 8 1 8 2\n0 2 1 0 0\n", "3\n0 0 2\n-1 2 0\n", "5\n3 2 8 2 9\n2 7 0 4 7\n", "5\n3 3 1 8 2\n0 2 1 0 0\n", "3\n0 0 2\n-1 2 1\n", "5\n3 2 8 2 9\n2 7 0 4 8\n", "5\n0 3 1 8 2\n0 2 1 0 0\n", "3\n0 -1 2\n-1 2 1\n", "5\n3 2 8 2 9\n2 7 1 4 8\n", "5\n0 3 1 8 0\n0 2 1 0 0\n", "3\n0 -1 2\n-1 3 1\n", "5\n3 2 8 2 9\n4 7 1 4 8\n", "5\n1 3 1 8 0\n0 2 1 0 0\n", "3\n0 -1 2\n-1 3 0\n", "5\n3 2 8 2 9\n4 7 1 0 8\n", "5\n2 3 1 8 0\n0 2 1 0 0\n", "3\n0 -1 3\n-1 3 0\n", "5\n3 2 8 2 14\n4 7 1 0 8\n", "5\n2 3 1 8 0\n1 2 1 0 0\n", "3\n0 -1 1\n-1 3 0\n", "5\n3 2 8 2 14\n1 7 1 0 8\n", "5\n2 3 1 10 0\n1 2 1 0 0\n", "3\n0 0 1\n-1 3 0\n", "5\n3 2 8 2 14\n1 7 2 0 8\n", "5\n2 3 1 19 0\n1 2 1 0 0\n", "3\n0 0 1\n-1 3 1\n", "5\n5 2 8 2 14\n1 7 2 0 8\n", "5\n2 3 0 19 0\n1 2 1 0 0\n", "3\n0 0 1\n-2 3 1\n", "5\n7 2 8 2 14\n1 7 2 0 8\n", "5\n2 3 -1 19 0\n1 2 1 0 0\n", "3\n0 0 2\n-2 3 1\n", "5\n7 2 8 2 14\n1 7 2 -1 8\n", "5\n2 3 -1 18 0\n1 2 1 0 0\n", "3\n0 -1 2\n-2 3 1\n", "5\n7 2 8 2 14\n1 7 2 -1 10\n", "5\n2 0 -1 18 0\n1 2 1 0 0\n", "3\n0 -1 0\n-2 3 1\n", "5\n7 2 8 2 11\n1 7 2 -1 10\n", "5\n2 0 -1 18 1\n1 2 1 0 0\n", "3\n0 -1 0\n-2 3 2\n", "5\n7 2 8 2 11\n1 7 3 -1 10\n", "5\n0 0 -1 18 1\n1 2 1 0 0\n", "3\n0 -1 0\n-1 3 2\n", "5\n7 2 2 2 11\n1 7 3 -1 10\n", "5\n0 0 -1 18 1\n1 1 1 0 0\n", "3\n0 -1 -1\n-1 3 2\n", "5\n7 2 2 2 11\n1 7 3 -1 7\n", "5\n-1 0 -1 18 1\n1 1 1 0 0\n", "3\n0 0 -1\n-1 3 2\n", "5\n7 2 2 3 11\n1 7 3 -1 7\n", "5\n-1 -1 -1 18 1\n1 1 1 0 0\n", "3\n1 0 -1\n-1 3 2\n", "5\n7 2 2 3 11\n1 8 3 -1 7\n", "5\n-1 -1 -1 18 1\n1 2 1 0 0\n", "3\n1 0 -1\n0 3 2\n", "5\n7 2 2 3 11\n1 8 3 0 7\n", "5\n-1 -1 -1 12 1\n1 2 1 0 0\n", "3\n1 0 -2\n-1 3 2\n", "5\n7 2 2 6 11\n1 8 3 0 7\n", "5\n3 1 4 1 5\n2 7 1 8 2\n", "3\n1 2 3\n5 2 2\n", "3\n1 2 3\n5 2 2\n", "5\n2 7 1 8 2\n3 1 4 1 5\n" ], "outputs": [ "No\n", "Yes\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "No\n" ], "question": "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#define P 1000000007\n\nint comp(const void *a, const void *b){return *(int*)a-*(int*)b;}\n\nint main(void){\n\tint n, i;\n\tint a[10000], b[10000];\n\tlong A=0, B=0;\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++){ scanf(\"%d\", &a[i]); A+=a[i]; }\n\tfor(i=0; i<n; i++){ scanf(\"%d\", &b[i]); B+=b[i]; }\n\tlong c=0, d=0;\n\tfor(i=0; i<n; i++){\n\t\tif(a[i]<b[i]){c+=(b[i]-a[i])/2;}\n\t\tif(a[i]>b[i]){d+=a[i]-b[i];}\n\t}\n\tputs(c>=d?\"Yes\":\"No\");\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcomp, .-comp\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-77824(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2240, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$0, -80048(%rbp)\n\tmovq\t$0, -80040(%rbp)\n\tleaq\t-80056(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -80052(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-80016(%rbp), %rdx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %eax\n\tcltq\n\taddq\t%rax, -80048(%rbp)\n\taddl\t$1, -80052(%rbp)\n.L4:\n\tmovl\t-80056(%rbp), %eax\n\tcmpl\t%eax, -80052(%rbp)\n\tjl\t.L5\n\tmovl\t$0, -80052(%rbp)\n\tjmp\t.L6\n.L7:\n\tleaq\t-40016(%rbp), %rdx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tcltq\n\taddq\t%rax, -80040(%rbp)\n\taddl\t$1, -80052(%rbp)\n.L6:\n\tmovl\t-80056(%rbp), %eax\n\tcmpl\t%eax, -80052(%rbp)\n\tjl\t.L7\n\tmovq\t$0, -80032(%rbp)\n\tmovq\t$0, -80024(%rbp)\n\tmovl\t$0, -80052(%rbp)\n\tjmp\t.L8\n.L11:\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L9\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcltq\n\taddq\t%rax, -80032(%rbp)\n.L9:\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L10\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-80016(%rbp,%rax,4), %edx\n\tmovl\t-80052(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tcltq\n\taddq\t%rax, -80024(%rbp)\n.L10:\n\taddl\t$1, -80052(%rbp)\n.L8:\n\tmovl\t-80056(%rbp), %eax\n\tcmpl\t%eax, -80052(%rbp)\n\tjl\t.L11\n\tmovq\t-80032(%rbp), %rax\n\tcmpq\t-80024(%rbp), %rax\n\tjl\t.L12\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L13\n.L12:\n\tleaq\t.LC2(%rip), %rax\n.L13:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L15\n\tcall\t__stack_chk_fail@PLT\n.L15:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 void *a, const void *b){return *(int*)a-*(int*)b;} int main(void){ int n, i; int a[10000], b[10000]; long A=0, B=0; scanf("%d", &n); for(i=0; i<n; i++){ scanf("%d", &a[i]); A+=a[i]; } for(i=0; i<n; i++){ scanf("%d", &b[i]); B+=b[i]; } long c=0, d=0; for(i=0; i<n; i++){ if(a[i]<b[i]){c+=(b[i]-a[i])/2;} if(a[i]>b[i]){d+=a[i]-b[i];} } puts(c>=d?"Yes":"No"); } Unoptimized Assembly Code: .file "temp.c" .text .globl comp .type comp, @function comp: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size comp, .-comp .section .rodata .LC0: .string "%d" .LC1: .string "Yes" .LC2: .string "No" .text .globl main .type main, @function main: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -77824(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $2240, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movq $0, -80048(%rbp) movq $0, -80040(%rbp) leaq -80056(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -80052(%rbp) jmp .L4 .L5: leaq -80016(%rbp), %rdx movl -80052(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -80052(%rbp), %eax cltq movl -80016(%rbp,%rax,4), %eax cltq addq %rax, -80048(%rbp) addl $1, -80052(%rbp) .L4: movl -80056(%rbp), %eax cmpl %eax, -80052(%rbp) jl .L5 movl $0, -80052(%rbp) jmp .L6 .L7: leaq -40016(%rbp), %rdx movl -80052(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -80052(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %eax cltq addq %rax, -80040(%rbp) addl $1, -80052(%rbp) .L6: movl -80056(%rbp), %eax cmpl %eax, -80052(%rbp) jl .L7 movq $0, -80032(%rbp) movq $0, -80024(%rbp) movl $0, -80052(%rbp) jmp .L8 .L11: movl -80052(%rbp), %eax cltq movl -80016(%rbp,%rax,4), %edx movl -80052(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %eax cmpl %eax, %edx jge .L9 movl -80052(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %edx movl -80052(%rbp), %eax cltq movl -80016(%rbp,%rax,4), %ecx movl %edx, %eax subl %ecx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax cltq addq %rax, -80032(%rbp) .L9: movl -80052(%rbp), %eax cltq movl -80016(%rbp,%rax,4), %edx movl -80052(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %eax cmpl %eax, %edx jle .L10 movl -80052(%rbp), %eax cltq movl -80016(%rbp,%rax,4), %edx movl -80052(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %ecx movl %edx, %eax subl %ecx, %eax cltq addq %rax, -80024(%rbp) .L10: addl $1, -80052(%rbp) .L8: movl -80056(%rbp), %eax cmpl %eax, -80052(%rbp) jl .L11 movq -80032(%rbp), %rax cmpq -80024(%rbp), %rax jl .L12 leaq .LC1(%rip), %rax jmp .L13 .L12: leaq .LC2(%rip), %rax .L13: movq %rax, %rdi call puts@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L15 call __stack_chk_fail@PLT .L15: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other text.
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\n\t.globl\td\n\t.bss\n\t.align 4\n\t.type\td, @object\n\t.size\td, 4\nd:\n\t.zero\t4\n\t.globl\tr\n\t.align 4\n\t.type\tr, @object\n\t.size\tr, 4\nr:\n\t.zero\t4\n\t.globl\ts\n\t.align 8\n\t.type\ts, @object\n\t.size\ts, 9\ns:\n\t.zero\t9\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%*c\"\n.LC1:\n\t.string\t\"NO\"\n.LC2:\n\t.string\t\"YES\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tleaq\t-4(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tjmp\t.L2\n.L5:\n\tleaq\ts(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tgets@PLT\n\tmovzbl\ts(%rip), %eax\n\tcmpb\t$65, %al\n\tje\t.L3\n\tmovl\t$-1, %edx\n\tjmp\t.L4\n.L3:\n\tmovl\t$1, %edx\n.L4:\n\tmovl\td(%rip), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, d(%rip)\n\tmovl\td(%rip), %eax\n\tshrl\t$31, %eax\n\tmovzbl\t%al, %edx\n\tmovl\tr(%rip), %eax\n\torl\t%edx, %eax\n\tmovl\t%eax, r(%rip)\n.L2:\n\tmovl\t-4(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L5\n\tmovl\tr(%rip), %edx\n\tmovl\td(%rip), %eax\n\torl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L7\n.L6:\n\tleaq\t.LC2(%rip), %rax\n.L7:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, d(%rip)\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\txorl\t%eax, %eax\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovl\t%edi, 12(%rsp)\n\tleaq\t12(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tscanf@PLT\n\tmovl\t12(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 12(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tleaq\ts(%rip), %rbx\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tsubl\t$1, %eax\n.L13:\n\tmovl\t12(%rsp), %ecx\n\tmovl\t%eax, %edx\n\tmovl\t%eax, d(%rip)\n\tshrl\t$31, %edx\n\torl\tr(%rip), %edx\n\tleal\t-1(%rcx), %esi\n\tmovl\t%edx, r(%rip)\n\tmovl\t%esi, 12(%rsp)\n\ttestl\t%ecx, %ecx\n\tje\t.L5\n.L6:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rdi\n\tcall\tgets@PLT\n\tcmpb\t$65, (%rbx)\n\tmovl\td(%rip), %eax\n\tjne\t.L15\n\taddl\t$1, %eax\n\tjmp\t.L13\n.L2:\n\tmovl\tr(%rip), %edx\n\tmovl\td(%rip), %eax\n.L5:\n\torl\t%eax, %edx\n\tleaq\t.LC0(%rip), %rdi\n\tleaq\t.LC1(%rip), %rax\n\tcmove\t%rax, %rdi\n\tcall\tputs@PLT\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, d(%rip)\n\taddq\t$16, %rsp\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\ts\n\t.bss\n\t.align 8\n\t.type\ts, @object\n\t.size\ts, 9\ns:\n\t.zero\t9\n\t.globl\tr\n\t.align 4\n\t.type\tr, @object\n\t.size\tr, 4\nr:\n\t.zero\t4\n\t.globl\td\n\t.align 4\n\t.type\td, @object\n\t.size\td, 4\nd:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\txorl\t%eax, %eax\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovl\t%edi, 12(%rsp)\n\tleaq\t12(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tscanf@PLT\n\tmovl\t12(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 12(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tleaq\ts(%rip), %rbx\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tsubl\t$1, %eax\n.L13:\n\tmovl\t12(%rsp), %ecx\n\tmovl\t%eax, %edx\n\tmovl\t%eax, d(%rip)\n\tshrl\t$31, %edx\n\torl\tr(%rip), %edx\n\tleal\t-1(%rcx), %esi\n\tmovl\t%edx, r(%rip)\n\tmovl\t%esi, 12(%rsp)\n\ttestl\t%ecx, %ecx\n\tje\t.L5\n.L6:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rdi\n\tcall\tgets@PLT\n\tcmpb\t$65, (%rbx)\n\tmovl\td(%rip), %eax\n\tjne\t.L15\n\taddl\t$1, %eax\n\tjmp\t.L13\n.L2:\n\tmovl\tr(%rip), %edx\n\tmovl\td(%rip), %eax\n.L5:\n\torl\t%eax, %edx\n\tleaq\t.LC0(%rip), %rdi\n\tleaq\t.LC1(%rip), %rax\n\tcmove\t%rax, %rdi\n\tcall\tputs@PLT\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, d(%rip)\n\taddq\t$16, %rsp\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\ts\n\t.bss\n\t.align 8\n\t.type\ts, @object\n\t.size\ts, 9\ns:\n\t.zero\t9\n\t.globl\tr\n\t.align 4\n\t.type\tr, @object\n\t.size\tr, 4\nr:\n\t.zero\t4\n\t.globl\td\n\t.align 4\n\t.type\td, @object\n\t.size\td, 4\nd:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "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\");}", "index": 19, "inputs": [ "4\nA\nUn\nB\nUn\n", "4\n@\nUn\nB\nUn\n", "4\n@\nUn\nB\nnU\n", "4\n@\nUn\nB\noU\n", "4\n@\nUn\nA\noU\n", "4\n@\nUn\nA\nUo\n", "4\n@\nTn\nA\nUo\n", "4\n@\nTn\nA\nVo\n", "4\n@\nTo\nA\nVo\n", "4\n@\nUo\nA\nVo\n", "4\n@\noU\nA\nVo\n", "4\n@\noU\nA\nWo\n", "4\n?\nUo\nA\nVo\n", "4\n?\nVo\nA\nVo\n", "4\n?\nVo\nA\noV\n", "4\n>\nVo\nA\noV\n", "4\n>\nVo\nA\nVo\n", "4\n>\nVp\nA\nVo\n", "4\n>\npV\nA\nVo\n", "4\n>\npV\n@\nVo\n", "4\n>\npV\n@\noV\n", "4\n>\npV\n?\noV\n", "4\n>\npV\n?\nVo\n", "4\n>\npW\n?\nVo\n", "4\n>\npW\n>\nVo\n", "4\n>\npW\n>\nVn\n", "4\n=\npW\n>\nVn\n", "4\n=\nqW\n>\nVn\n", "4\n>\nqW\n>\nVn\n", "4\n>\nqW\n=\nVn\n", "4\n>\nqW\n<\nVn\n", "4\n>\nqW\n;\nVn\n", "4\n=\nqW\n<\nVn\n", "4\n=\nqV\n<\nVn\n", "4\n=\nqV\n;\nVn\n", "4\n=\nVq\n<\nVn\n", "4\n=\nVq\n<\nnV\n", "4\n=\nWq\n<\nVn\n", "4\n=\nWq\n=\nVn\n", "4\n<\nWq\n=\nVn\n", "4\n<\nqW\n=\nVn\n", "4\n<\nWr\n=\nVn\n", "4\n<\nWr\n=\nnV\n", "4\n<\nWr\n=\nmV\n", "4\n<\nWr\n=\nlV\n", "4\n=\nWr\n=\nlV\n", "4\n>\nWr\n=\nlV\n", "4\n>\nWr\n<\nlV\n", "4\n>\nWr\n<\nVl\n", "4\n>\nWr\n=\nVl\n", "4\n>\nrW\n=\nVl\n", "4\n>\nrW\n>\nVl\n", "4\n>\nqW\n>\nVl\n", "4\n>\nWq\n>\nVl\n", "4\n>\nWq\n>\nlV\n", "4\n>\nWp\n>\nlV\n", "4\n>\nWp\n>\nVl\n", "4\n>\nWp\n=\nVl\n", "4\n?\nWp\n=\nVl\n", "4\n?\nWp\n>\nVl\n", "4\n?\npW\n>\nVl\n", "4\n?\npW\n>\nUl\n", "4\n?\npW\n>\nUk\n", "4\n?\npW\n>\nkU\n", "4\n?\npW\n=\nUk\n", "4\n?\npW\n?\nUk\n", "4\n?\nqW\n?\nUk\n", "4\n?\nqW\n?\nUl\n", "4\n?\nWq\n?\nUl\n", "4\n?\nWq\n>\nUl\n", "4\n?\nWq\n>\nlU\n", "4\n?\nqW\n>\nUl\n", "4\n?\nqW\n=\nUl\n", "4\n?\nqW\n=\nUm\n", "4\n?\nqW\n<\nUm\n", "4\n?\nqX\n<\nUm\n", "4\n?\nqX\n=\nUm\n", "4\n?\nXq\n=\nUm\n", "4\n@\nXq\n=\nUm\n", "4\n@\nXq\n>\nUm\n", "4\n@\nWq\n>\nUm\n", "4\n@\nWq\n>\nUn\n", "4\n?\nWq\n>\nUn\n", "4\n?\nqW\n>\nUn\n", "4\n?\nrW\n>\nUn\n", "4\n?\nrW\n>\nnU\n", "4\n?\nqW\n>\nnU\n", "4\n?\nWq\n>\nnU\n", "4\n?\nVq\n>\nnU\n", "4\n?\nVq\n?\nnU\n", "4\n>\nVq\n?\nnU\n", "4\n>\nVq\n?\nnT\n", "4\n>\nVq\n?\noT\n", "4\n>\nVq\n@\nnT\n", "4\n>\nVq\n@\nTn\n", "4\n>\nVq\n?\nTn\n", "4\n>\nqV\n?\nTn\n", "4\n>\nqW\n?\nTn\n", "4\n?\nqW\n?\nTn\n", "4\n>\nqW\n?\nnT\n", "4\nA\nUn\nA\nUn\n", "4\nA\nUn\nA\nUn\n" ], "outputs": [ "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "YES\n", "YES\n" ], "question": "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\n\t.globl\td\n\t.bss\n\t.align 4\n\t.type\td, @object\n\t.size\td, 4\nd:\n\t.zero\t4\n\t.globl\tr\n\t.align 4\n\t.type\tr, @object\n\t.size\tr, 4\nr:\n\t.zero\t4\n\t.globl\ts\n\t.align 8\n\t.type\ts, @object\n\t.size\ts, 9\ns:\n\t.zero\t9\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%*c\"\n.LC1:\n\t.string\t\"NO\"\n.LC2:\n\t.string\t\"YES\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tleaq\t-4(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tjmp\t.L2\n.L5:\n\tleaq\ts(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tgets@PLT\n\tmovzbl\ts(%rip), %eax\n\tcmpb\t$65, %al\n\tje\t.L3\n\tmovl\t$-1, %edx\n\tjmp\t.L4\n.L3:\n\tmovl\t$1, %edx\n.L4:\n\tmovl\td(%rip), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, d(%rip)\n\tmovl\td(%rip), %eax\n\tshrl\t$31, %eax\n\tmovzbl\t%al, %edx\n\tmovl\tr(%rip), %eax\n\torl\t%edx, %eax\n\tmovl\t%eax, r(%rip)\n.L2:\n\tmovl\t-4(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -4(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L5\n\tmovl\tr(%rip), %edx\n\tmovl\td(%rip), %eax\n\torl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L7\n.L6:\n\tleaq\t.LC2(%rip), %rax\n.L7:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, d(%rip)\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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, @object .size d, 4 d: .zero 4 .globl r .align 4 .type r, @object .size r, 4 r: .zero 4 .globl s .align 8 .type s, @object .size s, 9 s: .zero 9 .section .rodata .LC0: .string "%d%*c" .LC1: .string "NO" .LC2: .string "YES" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) leaq -4(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call scanf@PLT jmp .L2 .L5: leaq s(%rip), %rax movq %rax, %rdi movl $0, %eax call gets@PLT movzbl s(%rip), %eax cmpb $65, %al je .L3 movl $-1, %edx jmp .L4 .L3: movl $1, %edx .L4: movl d(%rip), %eax addl %edx, %eax movl %eax, d(%rip) movl d(%rip), %eax shrl $31, %eax movzbl %al, %edx movl r(%rip), %eax orl %edx, %eax movl %eax, r(%rip) .L2: movl -4(%rbp), %eax leal -1(%rax), %edx movl %edx, -4(%rbp) testl %eax, %eax jne .L5 movl r(%rip), %edx movl d(%rip), %eax orl %edx, %eax testl %eax, %eax je .L6 leaq .LC1(%rip), %rax jmp .L7 .L6: leaq .LC2(%rip), %rax .L7: movq %rax, %rdi call puts@PLT testl %eax, %eax sete %al movzbl %al, %eax movl %eax, d(%rip) movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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/* SPDX-License-Identifier: X11\n *\n * Copyright 2020 Elias Yuan <[email protected]>, MIT/X11 License\n * https://jthv.ai/LICENSE/X11.txt\n *\n * ANU-CPC Complexity Workshop - A: Two Integers\n * 2020-04-13\n */\n\n#include <stdio.h>\n\nint main(void)\n{\n unsigned long x,y;\n scanf(\"%lu %lu\",&x,&y);\n\n if (x < y) {\n printf(\"%lu\\n\",x);\n return 0;\n }\n\n if (x % y == 0) {\n printf(\"-1\\n\");\n return 0;\n }\n\n printf(\"%lu\\n\",x);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjnb\t.L2\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L5\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t-16(%rbp), %rcx\n\tmovl\t$0, %edx\n\tdivq\t%rcx\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L4\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L5\n.L4:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L5:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %r8\n\tmovq\t16(%rsp), %rcx\n\tcmpq\t%rcx, %r8\n\tjb\t.L4\n\tmovq\t%r8, %rax\n\txorl\t%edx, %edx\n\tdivq\t%rcx\n\ttestq\t%rdx, %rdx\n\tje\t.L8\n.L4:\n\tmovq\t%r8, %rdx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L3:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %r8\n\tmovq\t16(%rsp), %rcx\n\tcmpq\t%rcx, %r8\n\tjb\t.L4\n\tmovq\t%r8, %rax\n\txorl\t%edx, %edx\n\tdivq\t%rcx\n\ttestq\t%rdx, %rdx\n\tje\t.L8\n.L4:\n\tmovq\t%r8, %rdx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L3:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "/* SPDX-License-Identifier: X11\n *\n * Copyright 2020 Elias Yuan <[email protected]>, MIT/X11 License\n * https://jthv.ai/LICENSE/X11.txt\n *\n * ANU-CPC Complexity Workshop - A: Two Integers\n * 2020-04-13\n */\n\n#include <stdio.h>\n\nint main(void)\n{\n unsigned long x,y;\n scanf(\"%lu %lu\",&x,&y);\n\n if (x < y) {\n printf(\"%lu\\n\",x);\n return 0;\n }\n\n if (x % y == 0) {\n printf(\"-1\\n\");\n return 0;\n }\n\n printf(\"%lu\\n\",x);\n return 0;\n}", "index": 1, "inputs": [ "3 4\n", "8 2\n", "8 3\n", "6 4\n", "2 3\n", "15 2\n", "7 2\n", "13 2\n", "1 2\n", "11 6\n", "5 2\n", "16 6\n", "9 7\n", "4 3\n", "-2 4\n", "25 6\n", "12 5\n", "19 6\n", "22 5\n", "31 14\n", "14 4\n", "46 6\n", "10 3\n", "33 6\n", "17 5\n", "29 16\n", "20 15\n", "77 6\n", "27 4\n", "-3 4\n", "23 16\n", "39 14\n", "147 6\n", "26 4\n", "-4 8\n", "35 3\n", "18 5\n", "55 2\n", "78 12\n", "151 20\n", "24 7\n", "56 19\n", "36 19\n", "48 19\n", "-5 22\n", "-15 2\n", "-6 12\n", "21 6\n", "32 6\n", "-9 4\n", "-8 3\n", "28 6\n", "37 16\n", "30 4\n", "115 6\n", "-7 2\n", "-13 2\n", "126 4\n", "45 4\n", "34 4\n", "38 4\n", "-17 2\n", "248 29\n", "118 19\n", "40 6\n", "-11 2\n", "-10 4\n", "47 2\n", "-29 2\n", "-12 5\n", "41 9\n", "-21 2\n", "44 25\n", "3 5\n", "6 6\n", "6 8\n", "6 2\n", "3 6\n", "11 2\n", "6 5\n", "6 7\n", "2 1\n", "15 6\n", "8 8\n", "7 4\n", "3 2\n", "4 2\n", "1 4\n", "2 6\n", "1 5\n", "2 2\n", "11 8\n", "11 13\n", "4 4\n", "5 1\n", "-1 4\n", "16 12\n", "1 7\n", "9 12\n", "1 1\n", "3 3\n", "8 6\n", "8 6\n" ], "outputs": [ "3\n", "-1\n", "8\n", "6\n", "2\n", "15\n", "7\n", "13\n", "1\n", "11\n", "5\n", "16\n", "9\n", "4\n", "18446744073709551614\n", "25\n", "12\n", "19\n", "22\n", "31\n", "14\n", "46\n", "10\n", "33\n", "17\n", "29\n", "20\n", "77\n", "27\n", "18446744073709551613\n", "23\n", "39\n", "147\n", "26\n", "18446744073709551612\n", "35\n", "18\n", "55\n", "78\n", "151\n", "24\n", "56\n", "36\n", "48\n", "18446744073709551611\n", "18446744073709551601\n", "18446744073709551610\n", "21\n", "32\n", "18446744073709551607\n", "18446744073709551608\n", "28\n", "37\n", "30\n", "115\n", "18446744073709551609\n", "18446744073709551603\n", "126\n", "45\n", "34\n", "38\n", "18446744073709551599\n", "248\n", "118\n", "40\n", "18446744073709551605\n", "18446744073709551606\n", "47\n", "18446744073709551587\n", "18446744073709551604\n", "41\n", "18446744073709551595\n", "44\n", "3\n", "-1\n", "6\n", "-1\n", "3\n", "11\n", "6\n", "6\n", "-1\n", "15\n", "-1\n", "7\n", "3\n", "-1\n", "1\n", "2\n", "1\n", "-1\n", "11\n", "11\n", "-1\n", "-1\n", "18446744073709551615\n", "16\n", "1\n", "9\n", "-1\n", "-1\n", "8\n", "8\n" ], "question": "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 <[email protected]>, MIT/X11 License\n * https://jthv.ai/LICENSE/X11.txt\n *\n * ANU-CPC Complexity Workshop - A: Two Integers\n * 2020-04-13\n */\n\n#include <stdio.h>\n\nint main(void)\n{\n unsigned long x,y;\n scanf(\"%lu %lu\",&x,&y);\n\n if (x < y) {\n printf(\"%lu\\n\",x);\n return 0;\n }\n\n if (x % y == 0) {\n printf(\"-1\\n\");\n return 0;\n }\n\n printf(\"%lu\\n\",x);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjnb\t.L2\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L5\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t-16(%rbp), %rcx\n\tmovl\t$0, %edx\n\tdivq\t%rcx\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L4\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L5\n.L4:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L5:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 <[email protected]>, MIT/X11 License * https://jthv.ai/LICENSE/X11.txt * * ANU-CPC Complexity Workshop - A: Two Integers * 2020-04-13 */ #include <stdio.h> int main(void) { unsigned long x,y; scanf("%lu %lu",&x,&y); if (x < y) { printf("%lu\n",x); return 0; } if (x % y == 0) { printf("-1\n"); return 0; } printf("%lu\n",x); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lu %lu" .LC1: .string "%lu\n" .LC2: .string "-1" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -16(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -24(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jnb .L2 movq -24(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L5 .L2: movq -24(%rbp), %rax movq -16(%rbp), %rcx movl $0, %edx divq %rcx movq %rdx, %rax testq %rax, %rax jne .L4 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L5 .L4: movq -24(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L5: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L6 call __stack_chk_fail@PLT .L6: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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(\"0\\n\");\n } else {\n a[0] = 1;\n a[1] = 0;\n a[2] = 0;\n for (int i = 3; i <= n; i++) {\n a[i] = a[i - 1] + a[i - 3];\n if (a[i] >= 1000000007) {\n a[i] %= 1000000007;\n }\n }\n printf(\"%ld\\n\", a[n]);\n }\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"%ld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tleaq\t-80(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-80(%rbp), %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L5\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L6\n.L5:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L7\n.L6:\n\tmovq\t-64(%rbp), %rax\n\tmovq\t$1, (%rax)\n\tmovq\t-64(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tmovq\t-64(%rbp), %rax\n\tmovq\t$0, 16(%rax)\n\tmovl\t$3, -76(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-76(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovq\t-64(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovl\t-76(%rbp), %eax\n\tleal\t-3(%rax), %edx\n\tmovq\t-64(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tcmpq\t$1000000006, %rax\n\tjle\t.L9\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tleaq\t(%rdx,%rcx), %rax\n\tsarq\t$29, %rax\n\tmovq\t%rcx, %rdx\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-64(%rbp), %rdx\n\tmovl\t-76(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tmovq\t%rax, (%rdx,%rcx,8)\n.L9:\n\taddl\t$1, -76(%rbp)\n.L8:\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjle\t.L10\n\tmovl\t-80(%rbp), %edx\n\tmovq\t-64(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L7:\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t-12(%rbp), %rdi\n\tmovq\t%rsp, %rcx\n\tleal\t1(%rdi), %eax\n\tcltq\n\tleaq\t15(,%rax,8), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rcx\n\tandq\t$-16, %rdx\n\tcmpq\t%rcx, %rsp\n\tje\t.L3\n.L22:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L22\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L23\n.L4:\n\tleaq\t7(%rsp), %r10\n\tleal\t-1(%rdi), %edx\n\tmovq\t%r10, %rax\n\tandq\t$-8, %r10\n\tshrq\t$3, %rax\n\tcmpl\t$1, %edx\n\tjbe\t.L24\n\tmovdqa\t.LC2(%rip), %xmm0\n\tmovq\t$0, 16(,%rax,8)\n\tmovups\t%xmm0, 0(,%rax,8)\n\tcmpl\t$2, %edi\n\tjle\t.L11\n\tmovq\t$1, 24(,%rax,8)\n\tcmpl\t$3, %edi\n\tje\t.L11\n\tleal\t-4(%rdi), %eax\n\tleaq\t8(%r10), %rsi\n\tmovabsq\t$-8543223828751151131, %r9\n\tleaq\t16(%r10,%rax,8), %r8\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tmovq\t%rcx, %rax\n\taddq\t$8, %rsi\n\timulq\t%r9\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rcx\n\tmovq\t%rcx, 16(%rsi)\n\tcmpq\t%rsi, %r8\n\tje\t.L11\n.L10:\n\tmovq\t16(%rsi), %rcx\n\taddq\t(%rsi), %rcx\n\tcmpq\t$1000000006, %rcx\n\tjg\t.L25\n\tmovq\t%rcx, 24(%rsi)\n\taddq\t$8, %rsi\n\tcmpq\t%rsi, %r8\n\tjne\t.L10\n.L11:\n\tmovq\t(%r10,%rdi,8), %rdx\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L6:\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\tleave\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\txorl\t%eax, %eax\n\tret\n.L24:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L6\n.L23:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L26:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC2:\n\t.quad\t1\n\t.quad\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t-12(%rbp), %rdi\n\tmovq\t%rsp, %rcx\n\tleal\t1(%rdi), %eax\n\tcltq\n\tleaq\t15(,%rax,8), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rcx\n\tandq\t$-16, %rdx\n\tcmpq\t%rcx, %rsp\n\tje\t.L3\n.L22:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L22\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L23\n.L4:\n\tleaq\t7(%rsp), %r10\n\tleal\t-1(%rdi), %edx\n\tmovq\t%r10, %rax\n\tandq\t$-8, %r10\n\tshrq\t$3, %rax\n\tcmpl\t$1, %edx\n\tjbe\t.L24\n\tmovdqa\t.LC2(%rip), %xmm0\n\tmovq\t$0, 16(,%rax,8)\n\tmovups\t%xmm0, 0(,%rax,8)\n\tcmpl\t$2, %edi\n\tjle\t.L11\n\tmovq\t$1, 24(,%rax,8)\n\tcmpl\t$3, %edi\n\tje\t.L11\n\tleal\t-4(%rdi), %eax\n\tleaq\t8(%r10), %rsi\n\tmovabsq\t$-8543223828751151131, %r9\n\tleaq\t16(%r10,%rax,8), %r8\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tmovq\t%rcx, %rax\n\taddq\t$8, %rsi\n\timulq\t%r9\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rcx\n\tmovq\t%rcx, 16(%rsi)\n\tcmpq\t%rsi, %r8\n\tje\t.L11\n.L10:\n\tmovq\t16(%rsi), %rcx\n\taddq\t(%rsi), %rcx\n\tcmpq\t$1000000006, %rcx\n\tjg\t.L25\n\tmovq\t%rcx, 24(%rsi)\n\taddq\t$8, %rsi\n\tcmpq\t%rsi, %r8\n\tjne\t.L10\n.L11:\n\tmovq\t(%r10,%rdi,8), %rdx\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L6:\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\tleave\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\txorl\t%eax, %eax\n\tret\n.L24:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L6\n.L23:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L26:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC2:\n\t.quad\t1\n\t.quad\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(\"0\\n\");\n } else {\n a[0] = 1;\n a[1] = 0;\n a[2] = 0;\n for (int i = 3; i <= n; i++) {\n a[i] = a[i - 1] + a[i - 3];\n if (a[i] >= 1000000007) {\n a[i] %= 1000000007;\n }\n }\n printf(\"%ld\\n\", a[n]);\n }\n return 0;\n}", "index": 14, "inputs": [ "13\n", "3\n", "26\n", "1\n", "35\n", "20\n", "11\n", "15\n", "8\n", "10\n", "70\n", "22\n", "25\n", "14\n", "9\n", "19\n", "21\n", "27\n", "6\n", "1175\n", "23\n", "66\n", "37\n", "29\n", "41\n", "39\n", "48\n", "12\n", "16\n", "32\n", "40\n", "30\n", "17\n", "18\n", "34\n", "24\n", "333\n", "38\n", "106\n", "51\n", "54\n", "31\n", "79\n", "60\n", "62\n", "59\n", "28\n", "33\n", "192\n", "89\n", "75\n", "101\n", "56\n", "78\n", "57\n", "50\n", "36\n", "91\n", "43\n", "69\n", "96\n", "71\n", "72\n", "67\n", "150\n", "49\n", "61\n", "107\n", "98\n", "94\n", "179\n", "63\n", "154\n", "58\n", "127\n", "184\n", "133\n", "139\n", "53\n", "171\n", "190\n", "245\n", "90\n", "138\n", "126\n", "195\n", "47\n", "81\n", "92\n", "218\n", "125\n", "108\n", "104\n", "82\n", "134\n", "164\n", "239\n", "436\n", "52\n", "46\n", "7\n", "7\n", "2\n", "1729\n" ], "outputs": [ "28\n", "1\n", "4023\n", "0\n", "125491\n", "406\n", "13\n", "60\n", "4\n", "9\n", "69068402\n", "872\n", "2745\n", "41\n", "6\n", "277\n", "595\n", "5896\n", "2\n", "531468532\n", "1278\n", "572253362\n", "269542\n", "12664\n", "1243524\n", "578949\n", "18059374\n", "19\n", "88\n", "39865\n", "848491\n", "18560\n", "129\n", "189\n", "85626\n", "1873\n", "223377764\n", "395033\n", "759001237\n", "56849086\n", "178955183\n", "27201\n", "817952798\n", "773314922\n", "808901405\n", "209982074\n", "8641\n", "58425\n", "562515588\n", "731978312\n", "137910537\n", "276811116\n", "384377665\n", "482800013\n", "563332848\n", "38789712\n", "183916\n", "736036228\n", "2670964\n", "315679403\n", "872419671\n", "812494450\n", "128173846\n", "753389006\n", "754440630\n", "26467299\n", "598919331\n", "461854242\n", "480875556\n", "570220683\n", "452984182\n", "582216320\n", "388650203\n", "825604416\n", "195993319\n", "474647287\n", "94987214\n", "173571322\n", "122106097\n", "431121085\n", "572882134\n", "267433778\n", "366169929\n", "464511623\n", "2202778\n", "564472786\n", "12322413\n", "645642280\n", "468014533\n", "206559085\n", "228104745\n", "794813583\n", "702853012\n", "463595071\n", "141379432\n", "749151705\n", "941102115\n", "991327443\n", "83316385\n", "8407925\n", "3\n", "3\n", "0\n", "294867501\n" ], "question": "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(\"0\\n\");\n } else {\n a[0] = 1;\n a[1] = 0;\n a[2] = 0;\n for (int i = 3; i <= n; i++) {\n a[i] = a[i - 1] + a[i - 3];\n if (a[i] >= 1000000007) {\n a[i] %= 1000000007;\n }\n }\n printf(\"%ld\\n\", a[n]);\n }\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"%ld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tleaq\t-80(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-80(%rbp), %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L5\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L6\n.L5:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L7\n.L6:\n\tmovq\t-64(%rbp), %rax\n\tmovq\t$1, (%rax)\n\tmovq\t-64(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tmovq\t-64(%rbp), %rax\n\tmovq\t$0, 16(%rax)\n\tmovl\t$3, -76(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-76(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovq\t-64(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovl\t-76(%rbp), %eax\n\tleal\t-3(%rax), %edx\n\tmovq\t-64(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tcmpq\t$1000000006, %rax\n\tjle\t.L9\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-76(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tleaq\t(%rdx,%rcx), %rax\n\tsarq\t$29, %rax\n\tmovq\t%rcx, %rdx\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-64(%rbp), %rdx\n\tmovl\t-76(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tmovq\t%rax, (%rdx,%rcx,8)\n.L9:\n\taddl\t$1, -76(%rbp)\n.L8:\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjle\t.L10\n\tmovl\t-80(%rbp), %edx\n\tmovq\t-64(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L7:\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; a[1] = 0; a[2] = 0; for (int i = 3; i <= n; i++) { a[i] = a[i - 1] + a[i - 3]; if (a[i] >= 1000000007) { a[i] %= 1000000007; } } printf("%ld\n", a[n]); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "0" .LC2: .string "%ld\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $40, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 13, -40 .cfi_offset 12, -48 .cfi_offset 3, -56 movq %fs:40, %rax movq %rax, -56(%rbp) xorl %eax, %eax movq %rsp, %rax movq %rax, %rbx leaq -80(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -80(%rbp), %eax addl $1, %eax movslq %eax, %rdx subq $1, %rdx movq %rdx, -72(%rbp) movslq %eax, %rdx movq %rdx, %r14 movl $0, %r15d movslq %eax, %rdx movq %rdx, %r12 movl $0, %r13d cltq leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %esi movl $0, %edx divq %rsi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L2: cmpq %rdx, %rsp je .L3 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L2 .L3: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L4 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L4: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -64(%rbp) movl -80(%rbp), %eax cmpl $1, %eax je .L5 movl -80(%rbp), %eax cmpl $2, %eax jne .L6 .L5: leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L7 .L6: movq -64(%rbp), %rax movq $1, (%rax) movq -64(%rbp), %rax movq $0, 8(%rax) movq -64(%rbp), %rax movq $0, 16(%rax) movl $3, -76(%rbp) jmp .L8 .L10: movl -76(%rbp), %eax leal -1(%rax), %edx movq -64(%rbp), %rax movslq %edx, %rdx movq (%rax,%rdx,8), %rcx movl -76(%rbp), %eax leal -3(%rax), %edx movq -64(%rbp), %rax movslq %edx, %rdx movq (%rax,%rdx,8), %rax addq %rax, %rcx movq -64(%rbp), %rax movl -76(%rbp), %edx movslq %edx, %rdx movq %rcx, (%rax,%rdx,8) movq -64(%rbp), %rax movl -76(%rbp), %edx movslq %edx, %rdx movq (%rax,%rdx,8), %rax cmpq $1000000006, %rax jle .L9 movq -64(%rbp), %rax movl -76(%rbp), %edx movslq %edx, %rdx movq (%rax,%rdx,8), %rcx movabsq $-8543223828751151131, %rdx movq %rcx, %rax imulq %rdx leaq (%rdx,%rcx), %rax sarq $29, %rax movq %rcx, %rdx sarq $63, %rdx subq %rdx, %rax imulq $1000000007, %rax, %rdx movq %rcx, %rax subq %rdx, %rax movq -64(%rbp), %rdx movl -76(%rbp), %ecx movslq %ecx, %rcx movq %rax, (%rdx,%rcx,8) .L9: addl $1, -76(%rbp) .L8: movl -80(%rbp), %eax cmpl %eax, -76(%rbp) jle .L10 movl -80(%rbp), %edx movq -64(%rbp), %rax movslq %edx, %rdx movq (%rax,%rdx,8), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L7: movl $0, %eax movq %rbx, %rsp movq -56(%rbp), %rdx subq %fs:40, %rdx je .L12 call __stack_chk_fail@PLT .L12: leaq -40(%rbp), %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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\t\tx*=2;\n\t\t}\n\t\telse if(x*2>x+k){\n\t\t\tx+=k;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", x);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$1, -20(%rbp)\n\tmovl\t$1, -12(%rbp)\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-24(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\taddl\t%ecx, %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L3\n\tsall\t-20(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-24(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\taddl\t%ecx, %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L4\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, -20(%rbp)\n.L4:\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L5\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_offset 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t4(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L5\n\tmovl\t4(%rsp), %edi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tleal\t(%rdx,%rdx), %ecx\n\taddl\t%edi, %edx\n\tcmpl\t%edx, %ecx\n\tcmovle\t%ecx, %edx\n\taddl\t$1, %eax\n\tcmpl\t%esi, %eax\n\tjne\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tmovl\t$1, %edx\n\tjmp\t.L2\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, -16\n\tleaq\t.LC0(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t4(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L5\n\tmovl\t4(%rsp), %edi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tleal\t(%rdx,%rdx), %ecx\n\taddl\t%edi, %edx\n\tcmpl\t%edx, %ecx\n\tcmovle\t%ecx, %edx\n\taddl\t$1, %eax\n\tcmpl\t%esi, %eax\n\tjne\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tmovl\t$1, %edx\n\tjmp\t.L2\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\t\tx*=2;\n\t\t}\n\t\telse if(x*2>x+k){\n\t\t\tx+=k;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", x);\n\treturn 0;\n}", "index": 21, "inputs": [ "10\n17\n", "4\n4\n", "10\n15\n", "4\n7\n", "10\n11\n", "4\n2\n", "10\n14\n", "4\n0\n", "10\n24\n", "4\n-1\n", "10\n9\n", "4\n-2\n", "10\n4\n", "4\n-4\n", "10\n1\n", "4\n-5\n", "10\n2\n", "4\n-3\n", "4\n1\n", "10\n-1\n", "4\n6\n", "10\n-2\n", "4\n11\n", "10\n-3\n", "10\n6\n", "4\n5\n", "10\n8\n", "4\n-8\n", "10\n3\n", "4\n-9\n", "10\n5\n", "4\n-6\n", "10\n-4\n", "4\n-11\n", "10\n-6\n", "4\n-7\n", "10\n-7\n", "10\n-13\n", "10\n-5\n", "10\n-10\n", "10\n-17\n", "10\n-32\n", "10\n-23\n", "10\n23\n", "10\n37\n", "10\n43\n", "10\n28\n", "10\n7\n", "10\n18\n", "10\n-8\n", "10\n-11\n", "10\n-19\n", "10\n30\n", "10\n31\n", "10\n13\n", "10\n16\n", "10\n27\n", "10\n25\n", "10\n45\n", "10\n-9\n", "10\n21\n", "10\n-12\n", "10\n-37\n", "10\n-42\n", "10\n-33\n", "10\n-62\n", "10\n-41\n", "10\n-40\n", "10\n-16\n", "10\n33\n", "10\n32\n", "10\n12\n", "10\n34\n", "10\n36\n", "10\n59\n", "10\n55\n", "10\n110\n", "10\n100\n", "10\n101\n", "10\n-25\n", "10\n22\n", "10\n29\n", "10\n-22\n", "10\n19\n", "4\n-15\n", "10\n48\n", "10\n20\n", "10\n40\n", "10\n-14\n", "4\n-14\n", "10\n38\n", "4\n-12\n", "10\n-26\n", "10\n53\n", "4\n-23\n", "10\n-18\n", "4\n-13\n", "10\n-21\n", "10\n-20\n", "4\n-10\n", "10\n10\n", "4\n3\n", "4\n3\n" ], "outputs": [ "117", "12", "106", "15", "82", "8", "100", "1", "152", "-4", "70", "-12", "36", "-28", "11", "-36", "20", "-20", "5", "-256", "14", "-768", "16", "-1280", "50", "13", "64", "-60", "28", "-68", "43", "-44", "-1792", "-84", "-2816", "-52", "-3328", "-6400", "-2304", "-4864", "-8448", "-16128", "-11520", "147", "212", "236", "172", "57", "122", "-3840", "-5376", "-9472", "182", "187", "94", "112", "167", "157", "244", "-4352", "137", "-5888", "-18688", "-21248", "-16640", "-31488", "-20736", "-20224", "-7936", "196", "192", "88", "200", "208", "300", "284", "458", "428", "431", "-12544", "142", "177", "-11008", "127", "-116", "256", "132", "224", "-6912", "-108", "216", "-92", "-13056", "276", "-180", "-8960", "-100", "-10496", "-9984", "-76", "76", "10", "10" ], "question": "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\t\tx*=2;\n\t\t}\n\t\telse if(x*2>x+k){\n\t\t\tx+=k;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", x);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$1, -20(%rbp)\n\tmovl\t$1, -12(%rbp)\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-24(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\taddl\t%ecx, %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L3\n\tsall\t-20(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-24(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\taddl\t%ecx, %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L4\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, -20(%rbp)\n.L4:\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L5\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; } } printf("%d", x); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $1, -20(%rbp) movl $1, -12(%rbp) leaq -28(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -16(%rbp) jmp .L2 .L5: movl -20(%rbp), %eax leal (%rax,%rax), %edx movl -24(%rbp), %ecx movl -20(%rbp), %eax addl %ecx, %eax cmpl %eax, %edx jg .L3 sall -20(%rbp) jmp .L4 .L3: movl -20(%rbp), %eax leal (%rax,%rax), %edx movl -24(%rbp), %ecx movl -20(%rbp), %eax addl %ecx, %eax cmpl %eax, %edx jle .L4 movl -24(%rbp), %eax addl %eax, -20(%rbp) .L4: addl $1, -16(%rbp) .L2: movl -28(%rbp), %eax cmpl %eax, -16(%rbp) jl .L5 movl -20(%rbp), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L7 call __stack_chk_fail@PLT .L7: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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] != 'i') {\n printf(\"No\\n\");\n return 0;\n }\n }\n printf(\"Yes\\n\");\n\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -40(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$104, %al\n\tjne\t.L3\n\tmovl\t-40(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$105, %al\n\tje\t.L4\n.L3:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L7\n.L4:\n\taddl\t$2, -40(%rbp)\n.L2:\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rbx\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t%rax, %rbx\n\tjb\t.L6\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n.L7:\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t13(%rsp), %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\ttestq\t%rax, %rax\n\tje\t.L2\n\tcmpb\t$104, 13(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 14(%rsp)\n\tjne\t.L3\n\tcmpq\t$2, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 15(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 16(%rsp)\n\tjne\t.L3\n\tcmpq\t$4, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 17(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 18(%rsp)\n\tjne\t.L3\n\tcmpq\t$6, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 19(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 20(%rsp)\n\tjne\t.L3\n\tcmpq\t$8, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 21(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 22(%rsp)\n\tjne\t.L3\n.L2:\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L4:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L11\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L3:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L11:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t13(%rsp), %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\ttestq\t%rax, %rax\n\tje\t.L2\n\tcmpb\t$104, 13(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 14(%rsp)\n\tjne\t.L3\n\tcmpq\t$2, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 15(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 16(%rsp)\n\tjne\t.L3\n\tcmpq\t$4, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 17(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 18(%rsp)\n\tjne\t.L3\n\tcmpq\t$6, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 19(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 20(%rsp)\n\tjne\t.L3\n\tcmpq\t$8, %rax\n\tjbe\t.L2\n\tcmpb\t$104, 21(%rsp)\n\tjne\t.L3\n\tcmpb\t$105, 22(%rsp)\n\tjne\t.L3\n.L2:\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L4:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L11\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L3:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L11:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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] != 'i') {\n printf(\"No\\n\");\n return 0;\n }\n }\n printf(\"Yes\\n\");\n\n return 0;\n}", "index": 25, "inputs": [ "ah\n", "ih\n", "hhhi\n", "hb\n", "hh\n", "hhhj\n", "bh\n", "gi\n", "jhhh\n", "gb\n", "hg\n", "hjhh\n", "fb\n", "gh\n", "gjhh\n", "bf\n", "gg\n", "hjgh\n", "af\n", "fg\n", "gjgh\n", "bg\n", "eg\n", "gkgh\n", "ga\n", "ge\n", "hgjg\n", "ag\n", "he\n", "ggjg\n", "ia\n", "eh\n", "gjgg\n", "ai\n", "dh\n", "ggkg\n", "`i\n", "hd\n", "gkgg\n", "`h\n", "id\n", "gkhg\n", "`g\n", "jd\n", "ghkg\n", "g`\n", "dj\n", "gkhf\n", "cf\n", "di\n", "gkhe\n", "ce\n", "jc\n", "hkge\n", "be\n", "cj\n", "egkh\n", "eb\n", "bj\n", "hegk\n", "bd\n", "jb\n", "hegl\n", "bc\n", "kb\n", "kgeh\n", "bb\n", "bk\n", "kgeg\n", "ba\n", "aj\n", "egkg\n", "ab\n", "bi\n", "eglg\n", "aa\n", "ib\n", "dglg\n", "a`\n", "ic\n", "dflg\n", "`a\n", "hc\n", "glfd\n", "`b\n", "kc\n", "glfe\n", "b`\n", "ck\n", "glff\n", "``\n", "cl\n", "glgf\n", "_b\n", "lc\n", "flgf\n", "b_\n", "dl\n", "flff\n", "`_\n", "ha\n", "hihi\n", "hihi\n", "hi\n" ], "outputs": [ "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "Yes\n", "Yes\n" ], "question": "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] != 'i') {\n printf(\"No\\n\");\n return 0;\n }\n }\n printf(\"Yes\\n\");\n\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -40(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$104, %al\n\tjne\t.L3\n\tmovl\t-40(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-35(%rbp,%rax), %eax\n\tcmpb\t$105, %al\n\tje\t.L4\n.L3:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L7\n.L4:\n\taddl\t$2, -40(%rbp)\n.L2:\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rbx\n\tleaq\t-35(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t%rax, %rbx\n\tjb\t.L6\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n.L7:\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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"); return 0; } } printf("Yes\n"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "No" .LC2: .string "Yes" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $40, %rsp .cfi_offset 3, -24 movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax leaq -35(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -40(%rbp) jmp .L2 .L6: movl -40(%rbp), %eax cltq movzbl -35(%rbp,%rax), %eax cmpb $104, %al jne .L3 movl -40(%rbp), %eax addl $1, %eax cltq movzbl -35(%rbp,%rax), %eax cmpb $105, %al je .L4 .L3: leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L7 .L4: addl $2, -40(%rbp) .L2: movl -40(%rbp), %eax movslq %eax, %rbx leaq -35(%rbp), %rax movq %rax, %rdi call strlen@PLT cmpq %rax, %rbx jb .L6 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax .L7: movq -24(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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 <stdio.h>\n#include <stdint.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#include <time.h>\n\n#define BIG 2000000007\n#define VERYBIG 20000000000000007LL\n\n#define MOD 1000000007\n#define FOD 998244353\ntypedef uint64_t ull;\ntypedef int64_t sll;\n\n#define N_MAX 1048576\n\n#ifdef __cplusplus\n#include <queue>\n#include <stack>\n#include <tuple>\n#include <set>\n#include <map>\n#include <string>\n#include <algorithm>\n#include <functional>\n#include <array>\n\nusing std::queue;\nusing std::priority_queue;\nusing std::stack;\nusing std::tuple;\nusing std::set;\nusing std::map;\nusing std::vector;\nusing std::greater;\nusing std::pair;\nusing std::string;\nusing std::get;\n\ntemplate <typename T, typename U>\npair<T, U> operator+(pair<T, U> l, pair<T, U> r) {\n\treturn pair<T, U>(l.first + r.first, l.second + r.second);\n}\n\n#endif\n\ntypedef struct {\n\tsll a;\n\tsll b;\n} hwll;\n\ntypedef struct {\n\tsll a;\n\tsll b;\n\tsll c;\n} hwllc;\n\ntypedef struct {\n\thwll a;\n\thwll b;\n} linell;\n\ntypedef struct {\n\tdouble a;\n\tdouble b;\n} hwreal;\n\null n, m;\null h, w;\null k;\null q;\nsll va, vb, vc, vd, ve, vf;\null ua, ub, uc, ud, ue, uf;\nlong double vra, vrb, vrc;\ndouble vda, vdb, vdc;\nchar ch, dh;\n\null umin (ull x, ull y) {\n\treturn (x < y) ? x : y;\n}\n\null umax (ull x, ull y) {\n\treturn (x > y) ? x : y;\n}\n\nsll smin (sll x, sll y) {\n\treturn (x < y) ? x : y;\n}\n\nsll smax (sll x, sll y) {\n\treturn (x > y) ? x : y;\n}\n\null gcd (ull x, ull y) {\n\tif (y == 0) {\n\t\treturn x;\n\t} else {\n\t\treturn gcd(y, x % y);\n\t}\n}\n\null bitpow (ull a, ull x, ull modulo) {\n\tull result = 1;\n\twhile (x) {\n\t\tif (x & 1) {\n\t\t\tresult *= a;\n\t\t\tresult %= modulo;\n\t\t}\n\t\tx /= 2;\n\t\ta = (a * a) % modulo;\n\t}\n\treturn result;\n}\n\null divide (ull a, ull b, ull modulo) {\n\treturn (a * bitpow(b, modulo - 2, modulo)) % modulo;\n}\n\null udiff (ull a, ull b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nsll sdiff (sll a, sll b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nint bitcount (ull n) {\n\tint result = 0;\n\twhile (n) {\n\t\tif (n & 1) result++;\n\t\tn /= 2;\n\t}\n\treturn result;\n}\n\n#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)\n#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right\n#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1\n\n// int32_t pullcomp (const void *left, const void *right) {\n// \tull l = *(ull*)left;\n// \tull r = *(ull*)right;\n// \tif (l < r) {\n// \t\treturn -1;\n// \t}\n// \tif (l > r) {\n// \t\treturn +1;\n// \t}\n// \treturn 0;\n// }\nBEGCMP(pullcomp){\n\tDEFLR(ull);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(prevcomp){\n\tDEFLR(sll);\n\tCMPRET(r, l);\n\treturn 0;\n}\nBEGCMP(psllcomp){\n\tDEFLR(sll);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(pcharcomp){\n\tDEFLR(char);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(pdoublecomp){\n\tDEFLR(double);\n\tCMPRET(l, r);\n\treturn 0;\n}\n\nint32_t pstrcomp (const void *left, const void *right) {\n\tchar* l = *(char**)left;\n\tchar* r = *(char**)right;\n\n\treturn strcmp(l, r);\n}\n\nBEGCMP(phwllABcomp){\n\tDEFLR(hwll);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\nBEGCMP(phwllREVcomp){\n\tDEFLR(hwll);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.a, r.a);\n\treturn 0;\n}\nBEGCMP(ptriplecomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.c, r.c);\n\treturn 0;\n}\nBEGCMP(ptripleREVcomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.c, r.c);\n\treturn 0;\n}\nBEGCMP(ptripleCABcomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.c, r.c);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\nBEGCMP(phwrealcomp){\n\tDEFLR(hwreal);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\n\nint32_t pquadcomp (const void *left, const void *right) {\n\tlinell l = *(linell*)left;\n\tlinell r = *(linell*)right;\n\n\tsll ac = phwllABcomp(&(l.a), &(r.a));\n\tif (ac) return ac;\n\tsll bc = phwllABcomp(&(l.b), &(r.b));\n\tif (bc) return bc;\n\n\treturn 0;\n}\nint32_t pfracomp (const void *left, const void *right) {\n\thwllc l = *(hwllc*)left;\n\thwllc r = *(hwllc*)right;\n\n\tCMPRET(l.a * r.b, l.b * r.a);\n\treturn 0;\n}\n\nbool isinrange (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right);\n}\n\nbool isinrange_soft (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right) || (left >= x && x >= right);\n}\n\nsll a[N_MAX + 5];\n// ull a[N_MAX + 5];\n// sll a[3001][3001];\nsll b[N_MAX + 5];\n// ull b[N_MAX + 5];\n// sll b[3001][3001];\nsll c[N_MAX + 5];\nsll d[N_MAX + 5];\nsll e[N_MAX * 4];\n// char s[N_MAX + 1];\nchar s[3010][3010];\nchar t[N_MAX + 1];\n// char t[3010][3010];\nchar u[N_MAX + 1];\nhwll xy[N_MAX * 2 + 5];\nhwllc tup[N_MAX + 5];\n// sll table[3005][3005];\nhwll gin[N_MAX];\n// here we go\n\null knap[64000 + 1]; // [value] := mincost\n\null al[N_MAX], bl[N_MAX];\n\null solve () {\n\tsll i, j, ki, li;\n\t// ull result = 0;\n\tsll result = 0;\n\tdouble dresult = 0;\n\t// ull maybe = 0;\n\tsll maybe = 0;\n\t// ull sum = 0;\n\tsll sum = 0;\n\tsll item;\n\tsll *dpcell;\n\n\tscanf(\"%llu%llu%llu\", &n, &m, &k);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%llu\", &a[i]);\n\t\tif (i) {\n\t\t\tscanf(\"%llu\", &b[i]);\n\t\t\tb[i]--;\n\t\t}\n\t}\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tc[i]++;\n\t\td[i] += a[i];\n\t\tif (i) {\n\t\t\tc[b[i]] += c[i];\n\t\t\td[b[i]] += d[i];\n\t\t}\n\t}\n\n\tfor (i = 0; i < n; i++) {\n\t\ttup[i] = (hwllc){c[i], d[i], i};\n\t}\n\tqsort(tup, n, sizeof(hwllc), pfracomp);\n\n\tfor (i = 0; i < n; i++) {\n\t\tull x;\n\t\tif (i) {\n\t\t\tx = k;\n\t\t} else {\n\t\t\tx = 1000000000LL;\n\t\t}\n\t\tif (x <= 50) {\n\t\t\tal[i] = x;\n\t\t\tbl[i] = 0;\n\t\t} else {\n\t\t\tal[i] = 50;\n\t\t\tbl[i] = x - 50;\n\t\t}\n\t}\n\n\tull maxv = 64000;\n\tfor (i = 0; i <= maxv; i++) {\n\t\tknap[i] = m + 1;\n\t}\n\tknap[0] = 0;\n\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tull v = tup[i].c;\n\t\tfor (j = 0; j < al[v]; j++) {\n\t\t\tfor (ki = maxv; ki >= c[v]; ki--) {\n\t\t\t\tknap[ki] = smin(knap[ki], knap[ki - c[v]] + d[v]);\n\t\t\t}\n\t\t}\n\t}\n\tresult = 0;\n\tj = n - 1;\n\tull used = 0;\n\tull wild = 0;\n\tull val = 0;\n\tfor (i = maxv; i >= 0; i--) {\n\t\tif (knap[i] > m) continue;\n\t\tull v = tup[j].c;\n\t\twhile (true) {\n\t\t\tif (used == bl[tup[j].c]) {\n\t\t\t\tj--;\n\t\t\t\tused = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (knap[i] + wild + d[tup[j].c] <= m) {\n\t\t\t\twild += d[tup[j].c];\n\t\t\t\tused++;\n\t\t\t\tval += c[tup[j].c];\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tresult = umax(result, i + val);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\t// printf(\"%.15lf\\n\", dresult);\n\t// puts(s);\n\n\treturn 0;\n\n\tsuccess:\n\tputs(\"YES\");\n\t// puts(\"Yes\");\n\t// printf(\"%llu\\n\", result);\n\t// puts(\"0\");\n\t// puts(\"First\");\n\treturn 0;\n\n\tfail:\n\tputs(\"NO\");\n\t// puts(\"No\");\n\t// puts(\"0\");\n\t// puts(\"-1\");\n\t// puts(\"-1 -1 -1\");\n\t// puts(\"Second\");\n\treturn 1;\n}\n\nint32_t main (int argc, char *argv[]) {\n\tint32_t i, j;\n\n\tn = 5;\n\tm = 0;\n\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%llu\", &n, &m);\n\t// scanf(\"%llu\", &k, &n, &m);\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%llu\", &q);\n\t// scanf(\"%lld%lld\", &va, &vb, &vc, &vd);\n\t// va--;\n\t// vb--;\n\t// scanf(\"%llu%llu\", &ua, &ub, &uc, &ud, &ue);\n\t// scanf(\"%s\", s);\n\t// scanf(\"%s\", t);\n\t// scanf(\"%s\", u);\n\t// scanf(\"%llu\", &k);\n\t// scanf(\"%lld\", &m);\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// }\n\t// scanf(\"%llu\", &q);\n\t// for (i = 0; i < m; i++) {\n\t// \t// scanf(\"%lld%lld\", &xy[i].a, &xy[i].b);\n\t// \t// scanf(\"%lld%lld%lld\", &tup[i].a, &tup[i].b, &tup[i].c);\n\t// \t// scanf(\"%lld\", &c[i]);\n\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &b[i]);\n\t// \t// scanf(\"%lld\", &c[i]);\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// \t// c[i]--;\n\t// \t// d[i]--;\n\t// \t// xy[i].a--;\n\t// \t// xy[i].b--;\n\t// \t// tup[i].a--;\n\t// \t// tup[i].b--;\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \t// scanf(\"%lld%lld\", &a[i], &b[i]);\n\t// \tscanf(\"%lld\", &b[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// \t// scanf(\"%lld\", &e[i]);\n\t// \t// d[i]--;\n\t// }\n\n\t// for (i = 0; i < q; i++) {\n\t// \t// scanf(\"%lld%lld\", &xy[i].a, &xy[i].b);\n\t// \tscanf(\"%lld\", &c[i]);\n\t// \t// xy[i].a--;\n\t// \t// xy[i].b--;\n\t// }\n\n\t// for (i = 0; i < n; i++) {\n\t// \tfor (j = 0; j < m; j++) {\n\t// \t\tscanf(\"%lld\", &table[i][j]);\n\t// \t\t// table[i][j]--;\n\t// \t}\n\t// }\n\t// for (i = 0; i < h; i++) {\n\t// \tscanf(\"%s\", s[i]);\n\t// }\n\t// scanf(\"%llu\", &q);\n\n\tsolve();\n\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tn\n\t.bss\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tva\n\t.align 8\n\t.type\tva, @object\n\t.size\tva, 8\nva:\n\t.zero\t8\n\t.globl\tvb\n\t.align 8\n\t.type\tvb, @object\n\t.size\tvb, 8\nvb:\n\t.zero\t8\n\t.globl\tvc\n\t.align 8\n\t.type\tvc, @object\n\t.size\tvc, 8\nvc:\n\t.zero\t8\n\t.globl\tvd\n\t.align 8\n\t.type\tvd, @object\n\t.size\tvd, 8\nvd:\n\t.zero\t8\n\t.globl\tve\n\t.align 8\n\t.type\tve, @object\n\t.size\tve, 8\nve:\n\t.zero\t8\n\t.globl\tvf\n\t.align 8\n\t.type\tvf, @object\n\t.size\tvf, 8\nvf:\n\t.zero\t8\n\t.globl\tua\n\t.align 8\n\t.type\tua, @object\n\t.size\tua, 8\nua:\n\t.zero\t8\n\t.globl\tub\n\t.align 8\n\t.type\tub, @object\n\t.size\tub, 8\nub:\n\t.zero\t8\n\t.globl\tuc\n\t.align 8\n\t.type\tuc, @object\n\t.size\tuc, 8\nuc:\n\t.zero\t8\n\t.globl\tud\n\t.align 8\n\t.type\tud, @object\n\t.size\tud, 8\nud:\n\t.zero\t8\n\t.globl\tue\n\t.align 8\n\t.type\tue, @object\n\t.size\tue, 8\nue:\n\t.zero\t8\n\t.globl\tuf\n\t.align 8\n\t.type\tuf, @object\n\t.size\tuf, 8\nuf:\n\t.zero\t8\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.text\n\t.globl\tumin\n\t.type\tumin, @function\numin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovbe\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tumin, .-umin\n\t.globl\tumax\n\t.type\tumax, @function\numax:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovnb\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tumax, .-umax\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsmin, .-smin\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovge\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tsmax, .-smax\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tcmpq\t$0, -16(%rbp)\n\tjne\t.L10\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L11\n.L10:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tgcd\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tgcd, .-gcd\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tjmp\t.L13\n.L15:\n\tmovq\t-32(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L14\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n.L14:\n\tmovq\t-32(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n.L13:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L15\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tbitpow, .-bitpow\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-2(%rax), %rcx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tbitpow\n\timulq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-24(%rbp)\n\tmovq\t%rdx, %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tdivide, .-divide\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjb\t.L20\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L21\n.L20:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L21:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tudiff, .-udiff\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjl\t.L23\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L24\n.L23:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L24:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tsdiff, .-sdiff\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L26\n.L28:\n\tmovq\t-24(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L27\n\taddl\t$1, -4(%rbp)\n.L27:\n\tmovq\t-24(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -24(%rbp)\n.L26:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L28\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tbitcount, .-bitcount\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjnb\t.L31\n\tmovl\t$-1, %eax\n\tjmp\t.L32\n.L31:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjbe\t.L33\n\tmovl\t$1, %eax\n\tjmp\t.L32\n.L33:\n\tmovl\t$0, %eax\n.L32:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpullcomp, .-pullcomp\n\t.globl\tprevcomp\n\t.type\tprevcomp, @function\nprevcomp:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L35\n\tmovl\t$-1, %eax\n\tjmp\t.L36\n.L35:\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjle\t.L37\n\tmovl\t$1, %eax\n\tjmp\t.L36\n.L37:\n\tmovl\t$0, %eax\n.L36:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tprevcomp, .-prevcomp\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjge\t.L39\n\tmovl\t$-1, %eax\n\tjmp\t.L40\n.L39:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjle\t.L41\n\tmovl\t$1, %eax\n\tjmp\t.L40\n.L41:\n\tmovl\t$0, %eax\n.L40:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tpsllcomp, .-psllcomp\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -2(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -1(%rbp)\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjge\t.L43\n\tmovl\t$-1, %eax\n\tjmp\t.L44\n.L43:\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjle\t.L45\n\tmovl\t$1, %eax\n\tjmp\t.L44\n.L45:\n\tmovl\t$0, %eax\n.L44:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tpcharcomp, .-pcharcomp\n\t.globl\tpdoublecomp\n\t.type\tpdoublecomp, @function\npdoublecomp:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L54\n\tmovl\t$-1, %eax\n\tjmp\t.L49\n.L54:\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t-8(%rbp), %xmm0\n\tjbe\t.L55\n\tmovl\t$1, %eax\n\tjmp\t.L49\n.L55:\n\tmovl\t$0, %eax\n.L49:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tpdoublecomp, .-pdoublecomp\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tpstrcomp, .-pstrcomp\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L59\n\tmovl\t$-1, %eax\n\tjmp\t.L64\n.L59:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L61\n\tmovl\t$1, %eax\n\tjmp\t.L64\n.L61:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L62\n\tmovl\t$-1, %eax\n\tjmp\t.L64\n.L62:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L63\n\tmovl\t$1, %eax\n\tjmp\t.L64\n.L63:\n\tmovl\t$0, %eax\n.L64:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.globl\tphwllREVcomp\n\t.type\tphwllREVcomp, @function\nphwllREVcomp:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L66\n\tmovl\t$-1, %eax\n\tjmp\t.L71\n.L66:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L68\n\tmovl\t$1, %eax\n\tjmp\t.L71\n.L68:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L69\n\tmovl\t$-1, %eax\n\tjmp\t.L71\n.L69:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L70\n\tmovl\t$1, %eax\n\tjmp\t.L71\n.L70:\n\tmovl\t$0, %eax\n.L71:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tphwllREVcomp, .-phwllREVcomp\n\t.globl\tptriplecomp\n\t.type\tptriplecomp, @function\nptriplecomp:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L73\n\tmovl\t$-1, %eax\n\tjmp\t.L80\n.L73:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L75\n\tmovl\t$1, %eax\n\tjmp\t.L80\n.L75:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L76\n\tmovl\t$-1, %eax\n\tjmp\t.L80\n.L76:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L77\n\tmovl\t$1, %eax\n\tjmp\t.L80\n.L77:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L78\n\tmovl\t$-1, %eax\n\tjmp\t.L80\n.L78:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L79\n\tmovl\t$1, %eax\n\tjmp\t.L80\n.L79:\n\tmovl\t$0, %eax\n.L80:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tptriplecomp, .-ptriplecomp\n\t.globl\tptripleREVcomp\n\t.type\tptripleREVcomp, @function\nptripleREVcomp:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L82\n\tmovl\t$-1, %eax\n\tjmp\t.L89\n.L82:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L84\n\tmovl\t$1, %eax\n\tjmp\t.L89\n.L84:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L85\n\tmovl\t$-1, %eax\n\tjmp\t.L89\n.L85:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L86\n\tmovl\t$1, %eax\n\tjmp\t.L89\n.L86:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L87\n\tmovl\t$-1, %eax\n\tjmp\t.L89\n.L87:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L88\n\tmovl\t$1, %eax\n\tjmp\t.L89\n.L88:\n\tmovl\t$0, %eax\n.L89:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tptripleREVcomp, .-ptripleREVcomp\n\t.globl\tptripleCABcomp\n\t.type\tptripleCABcomp, @function\nptripleCABcomp:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L91\n\tmovl\t$-1, %eax\n\tjmp\t.L98\n.L91:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L93\n\tmovl\t$1, %eax\n\tjmp\t.L98\n.L93:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L94\n\tmovl\t$-1, %eax\n\tjmp\t.L98\n.L94:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L95\n\tmovl\t$1, %eax\n\tjmp\t.L98\n.L95:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L96\n\tmovl\t$-1, %eax\n\tjmp\t.L98\n.L96:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L97\n\tmovl\t$1, %eax\n\tjmp\t.L98\n.L97:\n\tmovl\t$0, %eax\n.L98:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tptripleCABcomp, .-ptripleCABcomp\n\t.globl\tphwrealcomp\n\t.type\tphwrealcomp, @function\nphwrealcomp:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovsd\t-32(%rbp), %xmm1\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L114\n\tmovl\t$-1, %eax\n\tjmp\t.L109\n.L114:\n\tmovsd\t-32(%rbp), %xmm0\n\tmovsd\t-16(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L115\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L115:\n\tmovsd\t-24(%rbp), %xmm1\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L116\n\tmovl\t$-1, %eax\n\tjmp\t.L109\n.L116:\n\tmovsd\t-24(%rbp), %xmm0\n\tmovsd\t-8(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L117\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L117:\n\tmovl\t$0, %eax\n.L109:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tphwrealcomp, .-phwrealcomp\n\t.globl\tpquadcomp\n\t.type\tpquadcomp, @function\npquadcomp:\n.LFB28:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$112, %rsp\n\tmovq\t%rdi, -104(%rbp)\n\tmovq\t%rsi, -112(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t-104(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -80(%rbp)\n\tmovq\t%rdx, -72(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t24(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t-112(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t24(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tleaq\t-48(%rbp), %rdx\n\tleaq\t-80(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tphwllABcomp\n\tcltq\n\tmovq\t%rax, -96(%rbp)\n\tcmpq\t$0, -96(%rbp)\n\tje\t.L119\n\tmovq\t-96(%rbp), %rax\n\tjmp\t.L122\n.L119:\n\tleaq\t-48(%rbp), %rax\n\tleaq\t16(%rax), %rdx\n\tleaq\t-80(%rbp), %rax\n\taddq\t$16, %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tphwllABcomp\n\tcltq\n\tmovq\t%rax, -88(%rbp)\n\tcmpq\t$0, -88(%rbp)\n\tje\t.L121\n\tmovq\t-88(%rbp), %rax\n\tjmp\t.L122\n.L121:\n\tmovl\t$0, %eax\n.L122:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L123\n\tcall\t__stack_chk_fail@PLT\n.L123:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE28:\n\t.size\tpquadcomp, .-pquadcomp\n\t.globl\tpfracomp\n\t.type\tpfracomp, @function\npfracomp:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L125\n\tmovl\t$-1, %eax\n\tjmp\t.L128\n.L125:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L127\n\tmovl\t$1, %eax\n\tjmp\t.L128\n.L127:\n\tmovl\t$0, %eax\n.L128:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tpfracomp, .-pfracomp\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjg\t.L130\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjg\t.L130\n\tmovl\t$1, %eax\n\tjmp\t.L131\n.L130:\n\tmovl\t$0, %eax\n.L131:\n\tandl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tisinrange, .-isinrange\n\t.globl\tisinrange_soft\n\t.type\tisinrange_soft, @function\nisinrange_soft:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjg\t.L134\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjle\t.L135\n.L134:\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjl\t.L136\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjl\t.L136\n.L135:\n\tmovl\t$1, %eax\n\tjmp\t.L137\n.L136:\n\tmovl\t$0, %eax\n.L137:\n\tandl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE31:\n\t.size\tisinrange_soft, .-isinrange_soft\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8388648\na:\n\t.zero\t8388648\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8388648\nb:\n\t.zero\t8388648\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8388648\nc:\n\t.zero\t8388648\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 8388648\nd:\n\t.zero\t8388648\n\t.globl\te\n\t.align 32\n\t.type\te, @object\n\t.size\te, 33554432\ne:\n\t.zero\t33554432\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 9060100\ns:\n\t.zero\t9060100\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 1048577\nt:\n\t.zero\t1048577\n\t.globl\tu\n\t.align 32\n\t.type\tu, @object\n\t.size\tu, 1048577\nu:\n\t.zero\t1048577\n\t.globl\txy\n\t.align 32\n\t.type\txy, @object\n\t.size\txy, 33554512\nxy:\n\t.zero\t33554512\n\t.globl\ttup\n\t.align 32\n\t.type\ttup, @object\n\t.size\ttup, 25165944\ntup:\n\t.zero\t25165944\n\t.globl\tgin\n\t.align 32\n\t.type\tgin, @object\n\t.size\tgin, 16777216\ngin:\n\t.zero\t16777216\n\t.globl\tknap\n\t.align 32\n\t.type\tknap, @object\n\t.size\tknap, 512008\nknap:\n\t.zero\t512008\n\t.globl\tal\n\t.align 32\n\t.type\tal, @object\n\t.size\tal, 8388608\nal:\n\t.zero\t8388608\n\t.globl\tbl\n\t.align 32\n\t.type\tbl, @object\n\t.size\tbl, 8388608\nbl:\n\t.zero\t8388608\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%llu%llu%llu\"\n.LC2:\n\t.string\t\"%llu\"\n.LC3:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$144, %rsp\n\tmovq\t$0, -120(%rbp)\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tleaq\tk(%rip), %rax\n\tmovq\t%rax, %rcx\n\tleaq\tm(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L140\n.L142:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t$0, -144(%rbp)\n\tje\t.L141\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n.L141:\n\taddq\t$1, -144(%rbp)\n.L140:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L142\n\tmovq\tn(%rip), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -144(%rbp)\n\tjmp\t.L143\n.L145:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ta(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tcmpq\t$0, -144(%rbp)\n\tje\t.L144\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rsi\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rsi, %rcx\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rsi\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rsi, %rcx\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n.L144:\n\tsubq\t$1, -144(%rbp)\n.L143:\n\tcmpq\t$0, -144(%rbp)\n\tjns\t.L145\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L146\n.L147:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-144(%rbp), %rsi\n\tmovq\t%rsi, %rax\n\taddq\t%rax, %rax\n\taddq\t%rsi, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rsi\n\tleaq\ttup(%rip), %rax\n\tmovq\t%rcx, (%rsi,%rax)\n\tmovq\t-144(%rbp), %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t8+tup(%rip), %rax\n\tmovq\t%rdx, (%rcx,%rax)\n\tmovq\t-144(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t16+tup(%rip), %rdx\n\tmovq\t-144(%rbp), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\taddq\t$1, -144(%rbp)\n.L146:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L147\n\tmovq\tn(%rip), %rax\n\tleaq\tpfracomp(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$24, %edx\n\tmovq\t%rax, %rsi\n\tleaq\ttup(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L148\n.L153:\n\tcmpq\t$0, -144(%rbp)\n\tje\t.L149\n\tmovq\tk(%rip), %rax\n\tmovq\t%rax, -112(%rbp)\n\tjmp\t.L150\n.L149:\n\tmovq\t$1000000000, -112(%rbp)\n.L150:\n\tcmpq\t$50, -112(%rbp)\n\tja\t.L151\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\tal(%rip), %rdx\n\tmovq\t-112(%rbp), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbl(%rip), %rax\n\tmovq\t$0, (%rdx,%rax)\n\tjmp\t.L152\n.L151:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tal(%rip), %rax\n\tmovq\t$50, (%rdx,%rax)\n\tmovq\t-112(%rbp), %rax\n\tleaq\t-50(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbl(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n.L152:\n\taddq\t$1, -144(%rbp)\n.L148:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L153\n\tmovq\t$64000, -56(%rbp)\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L154\n.L155:\n\tmovq\tm(%rip), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\taddq\t$1, -144(%rbp)\n.L154:\n\tmovq\t-144(%rbp), %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjnb\t.L155\n\tmovq\t$0, knap(%rip)\n\tmovq\tn(%rip), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -144(%rbp)\n\tjmp\t.L156\n.L161:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t$0, -136(%rbp)\n\tjmp\t.L157\n.L160:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -128(%rbp)\n\tjmp\t.L158\n.L159:\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-128(%rbp), %rax\n\tsubq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-128(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tsmin\n\tmovq\t%rax, %rcx\n\tmovq\t-128(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tsubq\t$1, -128(%rbp)\n.L158:\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tcmpq\t%rax, -128(%rbp)\n\tjge\t.L159\n\taddq\t$1, -136(%rbp)\n.L157:\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tal(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-136(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tja\t.L160\n\tsubq\t$1, -144(%rbp)\n.L156:\n\tcmpq\t$0, -144(%rbp)\n\tjns\t.L161\n\tmovq\t$0, -120(%rbp)\n\tmovq\tn(%rip), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -136(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tmovq\t$0, -96(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -144(%rbp)\n\tjmp\t.L162\n.L170:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\tm(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tja\t.L172\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -48(%rbp)\n.L169:\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbl(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tcmpq\t%rax, -104(%rbp)\n\tjne\t.L165\n\tsubq\t$1, -136(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tjmp\t.L166\n.L165:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-96(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t(%rcx,%rax), %rdx\n\tmovq\tm(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tja\t.L173\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -96(%rbp)\n\taddq\t$1, -104(%rbp)\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -88(%rbp)\n.L166:\n\tjmp\t.L169\n.L173:\n\tnop\n\tmovq\t-144(%rbp), %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-120(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tumax\n\tmovq\t%rax, -120(%rbp)\n\tjmp\t.L164\n.L172:\n\tnop\n.L164:\n\tsubq\t$1, -144(%rbp)\n.L162:\n\tcmpq\t$0, -144(%rbp)\n\tjns\t.L170\n\tmovq\t-120(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE32:\n\t.size\tsolve, .-solve\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB33:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t$5, n(%rip)\n\tmovq\t$0, m(%rip)\n\tmovl\t$0, %eax\n\tcall\tsolve\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE74:\n\t.size\tpfracomp, .-pfracomp\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\numax:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovnb\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tumax, .-umax\n\t.p2align 4\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovle\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tsmin, .-smin\n\t.p2align 4\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovge\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tsmax, .-smax\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rsi, %r8\n\ttestq\t%rsi, %rsi\n\tjne\t.L10\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovq\t%rdx, %r8\n.L10:\n\txorl\t%edx, %edx\n\tdivq\t%r8\n\tmovq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tjne\t.L18\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovl\t$1, %r8d\n\ttestq\t%rsi, %rsi\n\tje\t.L19\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\ttestb\t$1, %sil\n\tje\t.L21\n\tmovq\t%r8, %rax\n\txorl\t%edx, %edx\n\timulq\t%rdi, %rax\n\tdivq\t%rcx\n\tmovq\t%rdx, %r8\n.L21:\n\timulq\t%rdi, %rdi\n\txorl\t%edx, %edx\n\tmovq\t%rdi, %rax\n\tdivq\t%rcx\n\tshrq\t%rsi\n\tmovq\t%rdx, %rdi\n\tjne\t.L22\n.L19:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tbitpow, .-bitpow\n\t.p2align 4\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovq\t%rdx, %r8\n\tsubq\t$2, %rcx\n\tje\t.L29\n\tmovl\t$1, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\ttestb\t$1, %cl\n\tje\t.L30\n\tmovq\t%r9, %rax\n\txorl\t%edx, %edx\n\timulq\t%rsi, %rax\n\tdivq\t%r8\n\tmovq\t%rdx, %r9\n.L30:\n\timulq\t%rsi, %rsi\n\txorl\t%edx, %edx\n\tmovq\t%rsi, %rax\n\tdivq\t%r8\n\tshrq\t%rcx\n\tmovq\t%rdx, %rsi\n\tjne\t.L31\n\timulq\t%r9, %rdi\n.L29:\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\tdivq\t%r8\n\tmovq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tdivide, .-divide\n\t.p2align 4\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovnb\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tudiff, .-udiff\n\t.p2align 4\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovge\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tsdiff, .-sdiff\n\t.p2align 4\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L49\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovq\t%rdi, %rdx\n\tandl\t$1, %edx\n\taddl\t%edx, %eax\n\tshrq\t%rdi\n\tjne\t.L48\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L49:\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tbitcount, .-bitcount\n\t.p2align 4\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tseta\t%al\n\tmovzbl\t%al, %eax\n\tcmovb\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE61:\n\t.size\tpullcomp, .-pullcomp\n\t.p2align 4\n\t.globl\tprevcomp\n\t.type\tprevcomp, @function\nprevcomp:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%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.LFE62:\n\t.size\tprevcomp, .-prevcomp\n\t.p2align 4\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tpsllcomp, .-psllcomp\n\t.p2align 4\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %eax\n\tcmpb\t%al, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tpcharcomp, .-pcharcomp\n\t.p2align 4\n\t.globl\tpdoublecomp\n\t.type\tpdoublecomp, @function\npdoublecomp:\n.LFB65:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$-1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L65\n\txorl\t%eax, %eax\n\tcomisd\t%xmm0, %xmm1\n\tseta\t%al\n.L65:\n\tret\n\t.cfi_endproc\n.LFE65:\n\t.size\tpdoublecomp, .-pdoublecomp\n\t.p2align 4\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rsi\n\tmovq\t(%rdi), %rdi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE66:\n\t.size\tpstrcomp, .-pstrcomp\n\t.p2align 4\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L69\n\tmovl\t$1, %eax\n\tjg\t.L69\n\tmovq\t8(%rsi), %rax\n\tcmpq\t%rax, 8(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L69:\n\tret\n\t.cfi_endproc\n.LFE67:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.p2align 4\n\t.globl\tphwllREVcomp\n\t.type\tphwllREVcomp, @function\nphwllREVcomp:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, 8(%rdi)\n\tjl\t.L74\n\tmovl\t$1, %eax\n\tjg\t.L74\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L74:\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tphwllREVcomp, .-phwllREVcomp\n\t.p2align 4\n\t.globl\tptriplecomp\n\t.type\tptriplecomp, @function\nptriplecomp:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L79\n\tmovl\t$1, %eax\n\tjg\t.L79\n\tmovq\t8(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, 8(%rdi)\n\tjl\t.L79\n\tmovl\t$1, %eax\n\tjg\t.L79\n\tmovq\t16(%rsi), %rax\n\tcmpq\t%rax, 16(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L79:\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tptriplecomp, .-ptriplecomp\n\t.p2align 4\n\t.globl\tptripleREVcomp\n\t.type\tptripleREVcomp, @function\nptripleREVcomp:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, 8(%rdi)\n\tjl\t.L86\n\tmovl\t$1, %eax\n\tjg\t.L86\n\tmovq\t(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L86\n\tmovl\t$1, %eax\n\tjg\t.L86\n\tmovq\t16(%rsi), %rax\n\tcmpq\t%rax, 16(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L86:\n\tret\n\t.cfi_endproc\n.LFE70:\n\t.size\tptripleREVcomp, .-ptripleREVcomp\n\t.p2align 4\n\t.globl\tptripleCABcomp\n\t.type\tptripleCABcomp, @function\nptripleCABcomp:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t16(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, 16(%rdi)\n\tjl\t.L93\n\tmovl\t$1, %eax\n\tjg\t.L93\n\tmovq\t(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L93\n\tmovl\t$1, %eax\n\tjg\t.L93\n\tmovq\t8(%rsi), %rax\n\tcmpq\t%rax, 8(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L93:\n\tret\n\t.cfi_endproc\n.LFE71:\n\t.size\tptripleCABcomp, .-ptripleCABcomp\n\t.p2align 4\n\t.globl\tphwrealcomp\n\t.type\tphwrealcomp, @function\nphwrealcomp:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$-1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L100\n\tcomisd\t%xmm0, %xmm1\n\tmovl\t$1, %eax\n\tja\t.L100\n\tmovsd\t8(%rdi), %xmm1\n\tmovsd\t8(%rsi), %xmm0\n\tmovl\t$-1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L100\n\txorl\t%eax, %eax\n\tcomisd\t%xmm0, %xmm1\n\tseta\t%al\n.L100:\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tphwrealcomp, .-phwrealcomp\n\t.p2align 4\n\t.globl\tpquadcomp\n\t.type\tpquadcomp, @function\npquadcomp:\n.LFB73:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L105\n\tmovl\t$1, %eax\n\tjg\t.L105\n\tmovq\t8(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, 8(%rdi)\n\tjl\t.L105\n\tmovl\t$1, %eax\n\tjg\t.L105\n\tmovq\t16(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, 16(%rdi)\n\tjl\t.L105\n\tmovl\t$1, %eax\n\tjg\t.L105\n\tmovq\t24(%rsi), %rax\n\tcmpq\t%rax, 24(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L105:\n\tret\n\t.cfi_endproc\n.LFE73:\n\t.size\tpquadcomp, .-pquadcomp\n\t.p2align 4\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB75:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tsetle\t%al\n\tcmpq\t%rdx, %rsi\n\tsetle\t%dl\n\tandl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE75:\n\t.size\tisinrange, .-isinrange\n\t.p2align 4\n\t.globl\tisinrange_soft\n\t.type\tisinrange_soft, @function\nisinrange_soft:\n.LFB76:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tsetle\t%al\n\tcmpq\t%rdx, %rsi\n\tsetle\t%cl\n\tandb\t%cl, %al\n\tjne\t.L115\n\tcmpq\t%rsi, %rdi\n\tsetge\t%al\n\tcmpq\t%rdx, %rsi\n\tsetge\t%dl\n\tandl\t%edx, %eax\n.L115:\n\tret\n\t.cfi_endproc\n.LFE76:\n\t.size\tisinrange_soft, .-isinrange_soft\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%llu%llu%llu\"\n.LC1:\n\t.string\t\"%llu\"\n.LC2:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.p2align 4\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB77:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\tk(%rip), %rcx\n\txorl\t%eax, %eax\n\tleaq\tm(%rip), %rdx\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tleaq\tn(%rip), %rsi\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tleaq\ttup(%rip), %r15\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tcall\t__isoc99_scanf@PLT\n\tmovq\tn(%rip), %r9\n\ttestq\t%r9, %r9\n\tje\t.L119\n\tleaq\ta(%rip), %r12\n\tleaq\t.LC1(%rip), %r13\n\txorl\t%eax, %eax\n\tmovl\t$1, %ebp\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdi\n\tleaq\t8+b(%rip), %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovq\tn(%rip), %r9\n\tcmpq\t$1, %r9\n\tjbe\t.L148\n\t.p2align 4,,10\n\t.p2align 3\n.L120:\n\tleaq\t(%r12,%rbp,8), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbp\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\tn(%rip), %r9\n\tsubq\t$1, (%rbx)\n\taddq\t$8, %rbx\n\tcmpq\t%rbp, %r9\n\tja\t.L120\n.L148:\n\tleaq\t-1(%r9), %rax\n\ttestq\t%r9, %r9\n\tje\t.L121\n\tleaq\tc(%rip), %rcx\n\tleaq\td(%rip), %rdx\n\tleaq\tb(%rip), %r10\n\tjmp\t.L122\n.L180:\n\tmovq\t(%r10,%rax,8), %r8\n\tsubq\t$1, %rax\n\taddq\t%rdi, (%rcx,%r8,8)\n\taddq\t%rsi, (%rdx,%r8,8)\n.L122:\n\tmovq\t(%rcx,%rax,8), %rbx\n\tmovq\t(%r12,%rax,8), %rsi\n\taddq\t(%rdx,%rax,8), %rsi\n\tleaq\t1(%rbx), %rdi\n\tmovq\t%rsi, (%rdx,%rax,8)\n\tmovq\t%rdi, (%rcx,%rax,8)\n\ttestq\t%rax, %rax\n\tjne\t.L180\n.L121:\n\tleaq\ttup(%rip), %r15\n\txorl\t%eax, %eax\n\tleaq\tc(%rip), %rcx\n\tmovq\t%r15, %rsi\n\tleaq\td(%rip), %rdx\n\ttestq\t%r9, %r9\n\tje\t.L119\n\t.p2align 4,,10\n\t.p2align 3\n.L126:\n\tmovq\t(%rcx,%rax,8), %xmm0\n\taddq\t$24, %rsi\n\tmovhps\t(%rdx,%rax,8), %xmm0\n\tmovq\t%rax, -8(%rsi)\n\taddq\t$1, %rax\n\tmovups\t%xmm0, -24(%rsi)\n\tcmpq\t%rax, %r9\n\tjne\t.L126\n.L119:\n\tleaq\tpfracomp(%rip), %rcx\n\tmovl\t$24, %edx\n\tmovq\t%r9, %rsi\n\tmovq\t%r15, %rdi\n\tcall\tqsort@PLT\n\tmovq\tn(%rip), %r10\n\ttestq\t%r10, %r10\n\tje\t.L181\n\tmovq\tk(%rip), %rdx\n\txorl\t%eax, %eax\n\tleaq\tbl(%rip), %rsi\n\tcmpq\t$50, %rdx\n\tjbe\t.L127\n\tsubq\t$50, %rdx\n\tleaq\tal(%rip), %rcx\n.L129:\n\ttestq\t%rax, %rax\n\tjne\t.L131\n\tmovq\t$999999950, bl(%rip)\n\tmovq\t$50, al(%rip)\n\tcmpq\t$1, %r10\n\tje\t.L130\n\tmovl\t$1, %eax\n.L131:\n\tmovq\t%rdx, (%rsi,%rax,8)\n\tmovq\t$50, (%rcx,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%r10, %rax\n\tjne\t.L129\n.L130:\n\tsubq\t$1, %r10\n.L125:\n\tmovq\tm(%rip), %rbx\n\tleaq\t512000+knap(%rip), %rcx\n\tleaq\t-512000(%rcx), %rax\n\tleaq\t1(%rbx), %rdx\n\tmovq\t%rdx, %xmm0\n\tpunpcklqdq\t%xmm0, %xmm0\n\t.p2align 4,,10\n\t.p2align 3\n.L134:\n\tmovaps\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rax, %rcx\n\tjne\t.L134\n\tmovq\t%rdx, 512000+knap(%rip)\n\tmovq\t$0, knap(%rip)\n\tcmpq\t$-1, %r10\n\tje\t.L141\n\tleaq\t(%r10,%r10,2), %rax\n\tmovq\t%rbx, 8(%rsp)\n\tleaq\t-8+tup(%rip), %r14\n\tleaq\t16(%r15,%rax,8), %rbp\n\tleaq\tknap(%rip), %rax\n\tsubq\t$8, %rax\n\tleaq\tal(%rip), %r12\n\tleaq\tc(%rip), %r13\n\tmovq\t%rax, %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L140:\n\tmovq\t0(%rbp), %rdx\n\tmovq\t(%r12,%rdx,8), %r11\n\ttestq\t%r11, %r11\n\tje\t.L137\n\tmovq\t0(%r13,%rdx,8), %rax\n\tcmpq\t$64000, %rax\n\tjg\t.L137\n\tleaq\td(%rip), %rsi\n\txorl\t%r9d, %r9d\n\tmovq\t(%rsi,%rdx,8), %r8\n\tleaq\t0(,%rax,8), %rsi\n\tleaq\t(%rbx,%rsi), %rdi\n\tnegq\t%rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\tleaq\t512000+knap(%rip), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L139:\n\tmovq\t(%rax,%rsi), %rdx\n\tmovq\t(%rax), %rcx\n\taddq\t%r8, %rdx\n\tcmpq\t%rcx, %rdx\n\tcmovg\t%rcx, %rdx\n\tsubq\t$8, %rax\n\tmovq\t%rdx, 8(%rax)\n\tcmpq\t%rdi, %rax\n\tjne\t.L139\n\taddq\t$1, %r9\n\tcmpq\t%r11, %r9\n\tjne\t.L138\n.L137:\n\tsubq\t$24, %rbp\n\tcmpq\t%rbp, %r14\n\tjne\t.L140\n\tmovq\t8(%rsp), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L141:\n\tmovq\t$0, 8(%rsp)\n\txorl\t%r8d, %r8d\n\txorl\t%esi, %esi\n\txorl\t%edx, %edx\n\tmovl\t$64000, %ebp\n\tleaq\tbl(%rip), %r14\n\tleaq\td(%rip), %r12\n\tleaq\tc(%rip), %r13\n\tjmp\t.L136\n\t.p2align 4,,10\n\t.p2align 3\n.L142:\n\tsubq\t$1, %rbp\n\tjb\t.L182\n.L136:\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rax,%rbp,8), %r11\n\tcmpq\t%r11, %rbx\n\tjb\t.L142\n\tleaq\t(%r10,%r10,2), %rax\n\tmovq\t16(%r15,%rax,8), %rdi\n\tleaq\t(%r11,%rsi), %rax\n\tmovq\t(%r14,%rdi,8), %r9\n.L143:\n\tcmpq\t%r9, %rdx\n\tje\t.L183\n.L144:\n\tmovq\t(%r12,%rdi,8), %rcx\n\taddq\t%rcx, %rax\n\tcmpq\t%rax, %rbx\n\tjb\t.L146\n\taddq\t%rcx, %rsi\n\taddq\t$1, %rdx\n\taddq\t0(%r13,%rdi,8), %r8\n\tleaq\t(%r11,%rsi), %rax\n\tcmpq\t%r9, %rdx\n\tjne\t.L144\n.L183:\n\tsubq\t$1, %r10\n\tleaq\t(%r10,%r10,2), %rdx\n\tmovq\t16(%r15,%rdx,8), %rdi\n\txorl\t%edx, %edx\n\tmovq\t(%r14,%rdi,8), %r9\n\tjmp\t.L143\n.L127:\n\tleaq\tal(%rip), %rcx\n.L133:\n\ttestq\t%rax, %rax\n\tjne\t.L132\n\tmovq\t$999999950, bl(%rip)\n\tmovq\t$50, al(%rip)\n\tcmpq\t$1, %r10\n\tje\t.L130\n\tmovl\t$1, %eax\n.L132:\n\tmovq\t$0, (%rsi,%rax,8)\n\tmovq\t%rdx, (%rcx,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%rax, %r10\n\tjne\t.L133\n\tjmp\t.L130\n\t.p2align 4,,10\n\t.p2align 3\n.L146:\n\tmovq\t8(%rsp), %rdi\n\tleaq\t(%r8,%rbp), %rax\n\tcmpq\t%rdi, %rax\n\tcmovb\t%rdi, %rax\n\tmovq\t%rax, 8(%rsp)\n\tsubq\t$1, %rbp\n\tjnb\t.L136\n.L182:\n\tmovq\t8(%rsp), %rdx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L181:\n\t.cfi_restore_state\n\tmovq\t$-1, %r10\n\tjmp\t.L125\n\t.cfi_endproc\n.LFE77:\n\t.size\tsolve, .-solve\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB78:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tmovq\t$5, n(%rip)\n\tmovq\t$0, m(%rip)\n\tcall\tsolve\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE78:\n\t.size\tmain, .-main\n\t.globl\tbl\n\t.bss\n\t.align 32\n\t.type\tbl, @object\n\t.size\tbl, 8388608\nbl:\n\t.zero\t8388608\n\t.globl\tal\n\t.align 32\n\t.type\tal, @object\n\t.size\tal, 8388608\nal:\n\t.zero\t8388608\n\t.globl\tknap\n\t.align 32\n\t.type\tknap, @object\n\t.size\tknap, 512008\nknap:\n\t.zero\t512008\n\t.globl\tgin\n\t.align 32\n\t.type\tgin, @object\n\t.size\tgin, 16777216\ngin:\n\t.zero\t16777216\n\t.globl\ttup\n\t.align 32\n\t.type\ttup, @object\n\t.size\ttup, 25165944\ntup:\n\t.zero\t25165944\n\t.globl\txy\n\t.align 32\n\t.type\txy, @object\n\t.size\txy, 33554512\nxy:\n\t.zero\t33554512\n\t.globl\tu\n\t.align 32\n\t.type\tu, @object\n\t.size\tu, 1048577\nu:\n\t.zero\t1048577\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 1048577\nt:\n\t.zero\t1048577\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 9060100\ns:\n\t.zero\t9060100\n\t.globl\te\n\t.align 32\n\t.type\te, @object\n\t.size\te, 33554432\ne:\n\t.zero\t33554432\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 8388648\nd:\n\t.zero\t8388648\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8388648\nc:\n\t.zero\t8388648\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8388648\nb:\n\t.zero\t8388648\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8388648\na:\n\t.zero\t8388648\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tuf\n\t.align 8\n\t.type\tuf, @object\n\t.size\tuf, 8\nuf:\n\t.zero\t8\n\t.globl\tue\n\t.align 8\n\t.type\tue, @object\n\t.size\tue, 8\nue:\n\t.zero\t8\n\t.globl\tud\n\t.align 8\n\t.type\tud, @object\n\t.size\tud, 8\nud:\n\t.zero\t8\n\t.globl\tuc\n\t.align 8\n\t.type\tuc, @object\n\t.size\tuc, 8\nuc:\n\t.zero\t8\n\t.globl\tub\n\t.align 8\n\t.type\tub, @object\n\t.size\tub, 8\nub:\n\t.zero\t8\n\t.globl\tua\n\t.align 8\n\t.type\tua, @object\n\t.size\tua, 8\nua:\n\t.zero\t8\n\t.globl\tvf\n\t.align 8\n\t.type\tvf, @object\n\t.size\tvf, 8\nvf:\n\t.zero\t8\n\t.globl\tve\n\t.align 8\n\t.type\tve, @object\n\t.size\tve, 8\nve:\n\t.zero\t8\n\t.globl\tvd\n\t.align 8\n\t.type\tvd, @object\n\t.size\tvd, 8\nvd:\n\t.zero\t8\n\t.globl\tvc\n\t.align 8\n\t.type\tvc, @object\n\t.size\tvc, 8\nvc:\n\t.zero\t8\n\t.globl\tvb\n\t.align 8\n\t.type\tvb, @object\n\t.size\tvb, 8\nvb:\n\t.zero\t8\n\t.globl\tva\n\t.align 8\n\t.type\tva, @object\n\t.size\tva, 8\nva:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\tn\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE74:\n\t.size\tpfracomp, .-pfracomp\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\numax:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovnb\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tumax, .-umax\n\t.p2align 4\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovle\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tsmin, .-smin\n\t.p2align 4\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovge\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tsmax, .-smax\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rsi, %r8\n\ttestq\t%rsi, %rsi\n\tjne\t.L10\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovq\t%rdx, %r8\n.L10:\n\txorl\t%edx, %edx\n\tdivq\t%r8\n\tmovq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tjne\t.L18\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovl\t$1, %r8d\n\ttestq\t%rsi, %rsi\n\tje\t.L19\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\ttestb\t$1, %sil\n\tje\t.L21\n\tmovq\t%r8, %rax\n\txorl\t%edx, %edx\n\timulq\t%rdi, %rax\n\tdivq\t%rcx\n\tmovq\t%rdx, %r8\n.L21:\n\timulq\t%rdi, %rdi\n\txorl\t%edx, %edx\n\tmovq\t%rdi, %rax\n\tdivq\t%rcx\n\tshrq\t%rsi\n\tmovq\t%rdx, %rdi\n\tjne\t.L22\n.L19:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tbitpow, .-bitpow\n\t.p2align 4\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovq\t%rdx, %r8\n\tsubq\t$2, %rcx\n\tje\t.L29\n\tmovl\t$1, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\ttestb\t$1, %cl\n\tje\t.L30\n\tmovq\t%r9, %rax\n\txorl\t%edx, %edx\n\timulq\t%rsi, %rax\n\tdivq\t%r8\n\tmovq\t%rdx, %r9\n.L30:\n\timulq\t%rsi, %rsi\n\txorl\t%edx, %edx\n\tmovq\t%rsi, %rax\n\tdivq\t%r8\n\tshrq\t%rcx\n\tmovq\t%rdx, %rsi\n\tjne\t.L31\n\timulq\t%r9, %rdi\n.L29:\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\tdivq\t%r8\n\tmovq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tdivide, .-divide\n\t.p2align 4\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovnb\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tudiff, .-udiff\n\t.p2align 4\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovge\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tsdiff, .-sdiff\n\t.p2align 4\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L49\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovq\t%rdi, %rdx\n\tandl\t$1, %edx\n\taddl\t%edx, %eax\n\tshrq\t%rdi\n\tjne\t.L48\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L49:\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tbitcount, .-bitcount\n\t.p2align 4\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tseta\t%al\n\tmovzbl\t%al, %eax\n\tcmovb\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE61:\n\t.size\tpullcomp, .-pullcomp\n\t.p2align 4\n\t.globl\tprevcomp\n\t.type\tprevcomp, @function\nprevcomp:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%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.LFE62:\n\t.size\tprevcomp, .-prevcomp\n\t.p2align 4\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tpsllcomp, .-psllcomp\n\t.p2align 4\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %eax\n\tcmpb\t%al, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tpcharcomp, .-pcharcomp\n\t.p2align 4\n\t.globl\tpdoublecomp\n\t.type\tpdoublecomp, @function\npdoublecomp:\n.LFB65:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$-1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L65\n\txorl\t%eax, %eax\n\tcomisd\t%xmm0, %xmm1\n\tseta\t%al\n.L65:\n\tret\n\t.cfi_endproc\n.LFE65:\n\t.size\tpdoublecomp, .-pdoublecomp\n\t.p2align 4\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rsi\n\tmovq\t(%rdi), %rdi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE66:\n\t.size\tpstrcomp, .-pstrcomp\n\t.p2align 4\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L69\n\tmovl\t$1, %eax\n\tjg\t.L69\n\tmovq\t8(%rsi), %rax\n\tcmpq\t%rax, 8(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L69:\n\tret\n\t.cfi_endproc\n.LFE67:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.p2align 4\n\t.globl\tphwllREVcomp\n\t.type\tphwllREVcomp, @function\nphwllREVcomp:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, 8(%rdi)\n\tjl\t.L74\n\tmovl\t$1, %eax\n\tjg\t.L74\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L74:\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tphwllREVcomp, .-phwllREVcomp\n\t.p2align 4\n\t.globl\tptriplecomp\n\t.type\tptriplecomp, @function\nptriplecomp:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L79\n\tmovl\t$1, %eax\n\tjg\t.L79\n\tmovq\t8(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, 8(%rdi)\n\tjl\t.L79\n\tmovl\t$1, %eax\n\tjg\t.L79\n\tmovq\t16(%rsi), %rax\n\tcmpq\t%rax, 16(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L79:\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tptriplecomp, .-ptriplecomp\n\t.p2align 4\n\t.globl\tptripleREVcomp\n\t.type\tptripleREVcomp, @function\nptripleREVcomp:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, 8(%rdi)\n\tjl\t.L86\n\tmovl\t$1, %eax\n\tjg\t.L86\n\tmovq\t(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L86\n\tmovl\t$1, %eax\n\tjg\t.L86\n\tmovq\t16(%rsi), %rax\n\tcmpq\t%rax, 16(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L86:\n\tret\n\t.cfi_endproc\n.LFE70:\n\t.size\tptripleREVcomp, .-ptripleREVcomp\n\t.p2align 4\n\t.globl\tptripleCABcomp\n\t.type\tptripleCABcomp, @function\nptripleCABcomp:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t16(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, 16(%rdi)\n\tjl\t.L93\n\tmovl\t$1, %eax\n\tjg\t.L93\n\tmovq\t(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L93\n\tmovl\t$1, %eax\n\tjg\t.L93\n\tmovq\t8(%rsi), %rax\n\tcmpq\t%rax, 8(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L93:\n\tret\n\t.cfi_endproc\n.LFE71:\n\t.size\tptripleCABcomp, .-ptripleCABcomp\n\t.p2align 4\n\t.globl\tphwrealcomp\n\t.type\tphwrealcomp, @function\nphwrealcomp:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$-1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L100\n\tcomisd\t%xmm0, %xmm1\n\tmovl\t$1, %eax\n\tja\t.L100\n\tmovsd\t8(%rdi), %xmm1\n\tmovsd\t8(%rsi), %xmm0\n\tmovl\t$-1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L100\n\txorl\t%eax, %eax\n\tcomisd\t%xmm0, %xmm1\n\tseta\t%al\n.L100:\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tphwrealcomp, .-phwrealcomp\n\t.p2align 4\n\t.globl\tpquadcomp\n\t.type\tpquadcomp, @function\npquadcomp:\n.LFB73:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L105\n\tmovl\t$1, %eax\n\tjg\t.L105\n\tmovq\t8(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, 8(%rdi)\n\tjl\t.L105\n\tmovl\t$1, %eax\n\tjg\t.L105\n\tmovq\t16(%rsi), %rdx\n\tmovl\t$-1, %eax\n\tcmpq\t%rdx, 16(%rdi)\n\tjl\t.L105\n\tmovl\t$1, %eax\n\tjg\t.L105\n\tmovq\t24(%rsi), %rax\n\tcmpq\t%rax, 24(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L105:\n\tret\n\t.cfi_endproc\n.LFE73:\n\t.size\tpquadcomp, .-pquadcomp\n\t.p2align 4\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB75:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tsetle\t%al\n\tcmpq\t%rdx, %rsi\n\tsetle\t%dl\n\tandl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE75:\n\t.size\tisinrange, .-isinrange\n\t.p2align 4\n\t.globl\tisinrange_soft\n\t.type\tisinrange_soft, @function\nisinrange_soft:\n.LFB76:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tsetle\t%al\n\tcmpq\t%rdx, %rsi\n\tsetle\t%cl\n\tandb\t%cl, %al\n\tjne\t.L115\n\tcmpq\t%rsi, %rdi\n\tsetge\t%al\n\tcmpq\t%rdx, %rsi\n\tsetge\t%dl\n\tandl\t%edx, %eax\n.L115:\n\tret\n\t.cfi_endproc\n.LFE76:\n\t.size\tisinrange_soft, .-isinrange_soft\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%llu%llu%llu\"\n.LC1:\n\t.string\t\"%llu\"\n.LC2:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.p2align 4\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB77:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\tk(%rip), %rcx\n\txorl\t%eax, %eax\n\tleaq\tm(%rip), %rdx\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tleaq\tn(%rip), %rsi\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tleaq\ttup(%rip), %r15\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tcall\t__isoc99_scanf@PLT\n\tmovq\tn(%rip), %r9\n\ttestq\t%r9, %r9\n\tje\t.L119\n\tleaq\ta(%rip), %r12\n\tleaq\t.LC1(%rip), %r13\n\txorl\t%eax, %eax\n\tmovl\t$1, %ebp\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdi\n\tleaq\t8+b(%rip), %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovq\tn(%rip), %r9\n\tcmpq\t$1, %r9\n\tjbe\t.L148\n\t.p2align 4,,10\n\t.p2align 3\n.L120:\n\tleaq\t(%r12,%rbp,8), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbp\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\tn(%rip), %r9\n\tsubq\t$1, (%rbx)\n\taddq\t$8, %rbx\n\tcmpq\t%rbp, %r9\n\tja\t.L120\n.L148:\n\tleaq\t-1(%r9), %rax\n\ttestq\t%r9, %r9\n\tje\t.L121\n\tleaq\tc(%rip), %rcx\n\tleaq\td(%rip), %rdx\n\tleaq\tb(%rip), %r10\n\tjmp\t.L122\n.L180:\n\tmovq\t(%r10,%rax,8), %r8\n\tsubq\t$1, %rax\n\taddq\t%rdi, (%rcx,%r8,8)\n\taddq\t%rsi, (%rdx,%r8,8)\n.L122:\n\tmovq\t(%rcx,%rax,8), %rbx\n\tmovq\t(%r12,%rax,8), %rsi\n\taddq\t(%rdx,%rax,8), %rsi\n\tleaq\t1(%rbx), %rdi\n\tmovq\t%rsi, (%rdx,%rax,8)\n\tmovq\t%rdi, (%rcx,%rax,8)\n\ttestq\t%rax, %rax\n\tjne\t.L180\n.L121:\n\tleaq\ttup(%rip), %r15\n\txorl\t%eax, %eax\n\tleaq\tc(%rip), %rcx\n\tmovq\t%r15, %rsi\n\tleaq\td(%rip), %rdx\n\ttestq\t%r9, %r9\n\tje\t.L119\n\t.p2align 4,,10\n\t.p2align 3\n.L126:\n\tmovq\t(%rcx,%rax,8), %xmm0\n\taddq\t$24, %rsi\n\tmovhps\t(%rdx,%rax,8), %xmm0\n\tmovq\t%rax, -8(%rsi)\n\taddq\t$1, %rax\n\tmovups\t%xmm0, -24(%rsi)\n\tcmpq\t%rax, %r9\n\tjne\t.L126\n.L119:\n\tleaq\tpfracomp(%rip), %rcx\n\tmovl\t$24, %edx\n\tmovq\t%r9, %rsi\n\tmovq\t%r15, %rdi\n\tcall\tqsort@PLT\n\tmovq\tn(%rip), %r10\n\ttestq\t%r10, %r10\n\tje\t.L181\n\tmovq\tk(%rip), %rdx\n\txorl\t%eax, %eax\n\tleaq\tbl(%rip), %rsi\n\tcmpq\t$50, %rdx\n\tjbe\t.L127\n\tsubq\t$50, %rdx\n\tleaq\tal(%rip), %rcx\n.L129:\n\ttestq\t%rax, %rax\n\tjne\t.L131\n\tmovq\t$999999950, bl(%rip)\n\tmovq\t$50, al(%rip)\n\tcmpq\t$1, %r10\n\tje\t.L130\n\tmovl\t$1, %eax\n.L131:\n\tmovq\t%rdx, (%rsi,%rax,8)\n\tmovq\t$50, (%rcx,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%r10, %rax\n\tjne\t.L129\n.L130:\n\tsubq\t$1, %r10\n.L125:\n\tmovq\tm(%rip), %rbx\n\tleaq\t512000+knap(%rip), %rcx\n\tleaq\t-512000(%rcx), %rax\n\tleaq\t1(%rbx), %rdx\n\tmovq\t%rdx, %xmm0\n\tpunpcklqdq\t%xmm0, %xmm0\n\t.p2align 4,,10\n\t.p2align 3\n.L134:\n\tmovaps\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rax, %rcx\n\tjne\t.L134\n\tmovq\t%rdx, 512000+knap(%rip)\n\tmovq\t$0, knap(%rip)\n\tcmpq\t$-1, %r10\n\tje\t.L141\n\tleaq\t(%r10,%r10,2), %rax\n\tmovq\t%rbx, 8(%rsp)\n\tleaq\t-8+tup(%rip), %r14\n\tleaq\t16(%r15,%rax,8), %rbp\n\tleaq\tknap(%rip), %rax\n\tsubq\t$8, %rax\n\tleaq\tal(%rip), %r12\n\tleaq\tc(%rip), %r13\n\tmovq\t%rax, %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L140:\n\tmovq\t0(%rbp), %rdx\n\tmovq\t(%r12,%rdx,8), %r11\n\ttestq\t%r11, %r11\n\tje\t.L137\n\tmovq\t0(%r13,%rdx,8), %rax\n\tcmpq\t$64000, %rax\n\tjg\t.L137\n\tleaq\td(%rip), %rsi\n\txorl\t%r9d, %r9d\n\tmovq\t(%rsi,%rdx,8), %r8\n\tleaq\t0(,%rax,8), %rsi\n\tleaq\t(%rbx,%rsi), %rdi\n\tnegq\t%rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\tleaq\t512000+knap(%rip), %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L139:\n\tmovq\t(%rax,%rsi), %rdx\n\tmovq\t(%rax), %rcx\n\taddq\t%r8, %rdx\n\tcmpq\t%rcx, %rdx\n\tcmovg\t%rcx, %rdx\n\tsubq\t$8, %rax\n\tmovq\t%rdx, 8(%rax)\n\tcmpq\t%rdi, %rax\n\tjne\t.L139\n\taddq\t$1, %r9\n\tcmpq\t%r11, %r9\n\tjne\t.L138\n.L137:\n\tsubq\t$24, %rbp\n\tcmpq\t%rbp, %r14\n\tjne\t.L140\n\tmovq\t8(%rsp), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L141:\n\tmovq\t$0, 8(%rsp)\n\txorl\t%r8d, %r8d\n\txorl\t%esi, %esi\n\txorl\t%edx, %edx\n\tmovl\t$64000, %ebp\n\tleaq\tbl(%rip), %r14\n\tleaq\td(%rip), %r12\n\tleaq\tc(%rip), %r13\n\tjmp\t.L136\n\t.p2align 4,,10\n\t.p2align 3\n.L142:\n\tsubq\t$1, %rbp\n\tjb\t.L182\n.L136:\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rax,%rbp,8), %r11\n\tcmpq\t%r11, %rbx\n\tjb\t.L142\n\tleaq\t(%r10,%r10,2), %rax\n\tmovq\t16(%r15,%rax,8), %rdi\n\tleaq\t(%r11,%rsi), %rax\n\tmovq\t(%r14,%rdi,8), %r9\n.L143:\n\tcmpq\t%r9, %rdx\n\tje\t.L183\n.L144:\n\tmovq\t(%r12,%rdi,8), %rcx\n\taddq\t%rcx, %rax\n\tcmpq\t%rax, %rbx\n\tjb\t.L146\n\taddq\t%rcx, %rsi\n\taddq\t$1, %rdx\n\taddq\t0(%r13,%rdi,8), %r8\n\tleaq\t(%r11,%rsi), %rax\n\tcmpq\t%r9, %rdx\n\tjne\t.L144\n.L183:\n\tsubq\t$1, %r10\n\tleaq\t(%r10,%r10,2), %rdx\n\tmovq\t16(%r15,%rdx,8), %rdi\n\txorl\t%edx, %edx\n\tmovq\t(%r14,%rdi,8), %r9\n\tjmp\t.L143\n.L127:\n\tleaq\tal(%rip), %rcx\n.L133:\n\ttestq\t%rax, %rax\n\tjne\t.L132\n\tmovq\t$999999950, bl(%rip)\n\tmovq\t$50, al(%rip)\n\tcmpq\t$1, %r10\n\tje\t.L130\n\tmovl\t$1, %eax\n.L132:\n\tmovq\t$0, (%rsi,%rax,8)\n\tmovq\t%rdx, (%rcx,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%rax, %r10\n\tjne\t.L133\n\tjmp\t.L130\n\t.p2align 4,,10\n\t.p2align 3\n.L146:\n\tmovq\t8(%rsp), %rdi\n\tleaq\t(%r8,%rbp), %rax\n\tcmpq\t%rdi, %rax\n\tcmovb\t%rdi, %rax\n\tmovq\t%rax, 8(%rsp)\n\tsubq\t$1, %rbp\n\tjnb\t.L136\n.L182:\n\tmovq\t8(%rsp), %rdx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L181:\n\t.cfi_restore_state\n\tmovq\t$-1, %r10\n\tjmp\t.L125\n\t.cfi_endproc\n.LFE77:\n\t.size\tsolve, .-solve\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB78:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tmovq\t$5, n(%rip)\n\tmovq\t$0, m(%rip)\n\tcall\tsolve\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE78:\n\t.size\tmain, .-main\n\t.globl\tbl\n\t.bss\n\t.align 32\n\t.type\tbl, @object\n\t.size\tbl, 8388608\nbl:\n\t.zero\t8388608\n\t.globl\tal\n\t.align 32\n\t.type\tal, @object\n\t.size\tal, 8388608\nal:\n\t.zero\t8388608\n\t.globl\tknap\n\t.align 32\n\t.type\tknap, @object\n\t.size\tknap, 512008\nknap:\n\t.zero\t512008\n\t.globl\tgin\n\t.align 32\n\t.type\tgin, @object\n\t.size\tgin, 16777216\ngin:\n\t.zero\t16777216\n\t.globl\ttup\n\t.align 32\n\t.type\ttup, @object\n\t.size\ttup, 25165944\ntup:\n\t.zero\t25165944\n\t.globl\txy\n\t.align 32\n\t.type\txy, @object\n\t.size\txy, 33554512\nxy:\n\t.zero\t33554512\n\t.globl\tu\n\t.align 32\n\t.type\tu, @object\n\t.size\tu, 1048577\nu:\n\t.zero\t1048577\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 1048577\nt:\n\t.zero\t1048577\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 9060100\ns:\n\t.zero\t9060100\n\t.globl\te\n\t.align 32\n\t.type\te, @object\n\t.size\te, 33554432\ne:\n\t.zero\t33554432\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 8388648\nd:\n\t.zero\t8388648\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8388648\nc:\n\t.zero\t8388648\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8388648\nb:\n\t.zero\t8388648\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8388648\na:\n\t.zero\t8388648\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tuf\n\t.align 8\n\t.type\tuf, @object\n\t.size\tuf, 8\nuf:\n\t.zero\t8\n\t.globl\tue\n\t.align 8\n\t.type\tue, @object\n\t.size\tue, 8\nue:\n\t.zero\t8\n\t.globl\tud\n\t.align 8\n\t.type\tud, @object\n\t.size\tud, 8\nud:\n\t.zero\t8\n\t.globl\tuc\n\t.align 8\n\t.type\tuc, @object\n\t.size\tuc, 8\nuc:\n\t.zero\t8\n\t.globl\tub\n\t.align 8\n\t.type\tub, @object\n\t.size\tub, 8\nub:\n\t.zero\t8\n\t.globl\tua\n\t.align 8\n\t.type\tua, @object\n\t.size\tua, 8\nua:\n\t.zero\t8\n\t.globl\tvf\n\t.align 8\n\t.type\tvf, @object\n\t.size\tvf, 8\nvf:\n\t.zero\t8\n\t.globl\tve\n\t.align 8\n\t.type\tve, @object\n\t.size\tve, 8\nve:\n\t.zero\t8\n\t.globl\tvd\n\t.align 8\n\t.type\tvd, @object\n\t.size\tvd, 8\nvd:\n\t.zero\t8\n\t.globl\tvc\n\t.align 8\n\t.type\tvc, @object\n\t.size\tvc, 8\nvc:\n\t.zero\t8\n\t.globl\tvb\n\t.align 8\n\t.type\tvb, @object\n\t.size\tvb, 8\nvb:\n\t.zero\t8\n\t.globl\tva\n\t.align 8\n\t.type\tva, @object\n\t.size\tva, 8\nva:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\tn\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 <stdio.h>\n#include <stdint.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#include <time.h>\n\n#define BIG 2000000007\n#define VERYBIG 20000000000000007LL\n\n#define MOD 1000000007\n#define FOD 998244353\ntypedef uint64_t ull;\ntypedef int64_t sll;\n\n#define N_MAX 1048576\n\n#ifdef __cplusplus\n#include <queue>\n#include <stack>\n#include <tuple>\n#include <set>\n#include <map>\n#include <string>\n#include <algorithm>\n#include <functional>\n#include <array>\n\nusing std::queue;\nusing std::priority_queue;\nusing std::stack;\nusing std::tuple;\nusing std::set;\nusing std::map;\nusing std::vector;\nusing std::greater;\nusing std::pair;\nusing std::string;\nusing std::get;\n\ntemplate <typename T, typename U>\npair<T, U> operator+(pair<T, U> l, pair<T, U> r) {\n\treturn pair<T, U>(l.first + r.first, l.second + r.second);\n}\n\n#endif\n\ntypedef struct {\n\tsll a;\n\tsll b;\n} hwll;\n\ntypedef struct {\n\tsll a;\n\tsll b;\n\tsll c;\n} hwllc;\n\ntypedef struct {\n\thwll a;\n\thwll b;\n} linell;\n\ntypedef struct {\n\tdouble a;\n\tdouble b;\n} hwreal;\n\null n, m;\null h, w;\null k;\null q;\nsll va, vb, vc, vd, ve, vf;\null ua, ub, uc, ud, ue, uf;\nlong double vra, vrb, vrc;\ndouble vda, vdb, vdc;\nchar ch, dh;\n\null umin (ull x, ull y) {\n\treturn (x < y) ? x : y;\n}\n\null umax (ull x, ull y) {\n\treturn (x > y) ? x : y;\n}\n\nsll smin (sll x, sll y) {\n\treturn (x < y) ? x : y;\n}\n\nsll smax (sll x, sll y) {\n\treturn (x > y) ? x : y;\n}\n\null gcd (ull x, ull y) {\n\tif (y == 0) {\n\t\treturn x;\n\t} else {\n\t\treturn gcd(y, x % y);\n\t}\n}\n\null bitpow (ull a, ull x, ull modulo) {\n\tull result = 1;\n\twhile (x) {\n\t\tif (x & 1) {\n\t\t\tresult *= a;\n\t\t\tresult %= modulo;\n\t\t}\n\t\tx /= 2;\n\t\ta = (a * a) % modulo;\n\t}\n\treturn result;\n}\n\null divide (ull a, ull b, ull modulo) {\n\treturn (a * bitpow(b, modulo - 2, modulo)) % modulo;\n}\n\null udiff (ull a, ull b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nsll sdiff (sll a, sll b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nint bitcount (ull n) {\n\tint result = 0;\n\twhile (n) {\n\t\tif (n & 1) result++;\n\t\tn /= 2;\n\t}\n\treturn result;\n}\n\n#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)\n#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right\n#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1\n\n// int32_t pullcomp (const void *left, const void *right) {\n// \tull l = *(ull*)left;\n// \tull r = *(ull*)right;\n// \tif (l < r) {\n// \t\treturn -1;\n// \t}\n// \tif (l > r) {\n// \t\treturn +1;\n// \t}\n// \treturn 0;\n// }\nBEGCMP(pullcomp){\n\tDEFLR(ull);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(prevcomp){\n\tDEFLR(sll);\n\tCMPRET(r, l);\n\treturn 0;\n}\nBEGCMP(psllcomp){\n\tDEFLR(sll);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(pcharcomp){\n\tDEFLR(char);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(pdoublecomp){\n\tDEFLR(double);\n\tCMPRET(l, r);\n\treturn 0;\n}\n\nint32_t pstrcomp (const void *left, const void *right) {\n\tchar* l = *(char**)left;\n\tchar* r = *(char**)right;\n\n\treturn strcmp(l, r);\n}\n\nBEGCMP(phwllABcomp){\n\tDEFLR(hwll);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\nBEGCMP(phwllREVcomp){\n\tDEFLR(hwll);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.a, r.a);\n\treturn 0;\n}\nBEGCMP(ptriplecomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.c, r.c);\n\treturn 0;\n}\nBEGCMP(ptripleREVcomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.c, r.c);\n\treturn 0;\n}\nBEGCMP(ptripleCABcomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.c, r.c);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\nBEGCMP(phwrealcomp){\n\tDEFLR(hwreal);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\n\nint32_t pquadcomp (const void *left, const void *right) {\n\tlinell l = *(linell*)left;\n\tlinell r = *(linell*)right;\n\n\tsll ac = phwllABcomp(&(l.a), &(r.a));\n\tif (ac) return ac;\n\tsll bc = phwllABcomp(&(l.b), &(r.b));\n\tif (bc) return bc;\n\n\treturn 0;\n}\nint32_t pfracomp (const void *left, const void *right) {\n\thwllc l = *(hwllc*)left;\n\thwllc r = *(hwllc*)right;\n\n\tCMPRET(l.a * r.b, l.b * r.a);\n\treturn 0;\n}\n\nbool isinrange (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right);\n}\n\nbool isinrange_soft (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right) || (left >= x && x >= right);\n}\n\nsll a[N_MAX + 5];\n// ull a[N_MAX + 5];\n// sll a[3001][3001];\nsll b[N_MAX + 5];\n// ull b[N_MAX + 5];\n// sll b[3001][3001];\nsll c[N_MAX + 5];\nsll d[N_MAX + 5];\nsll e[N_MAX * 4];\n// char s[N_MAX + 1];\nchar s[3010][3010];\nchar t[N_MAX + 1];\n// char t[3010][3010];\nchar u[N_MAX + 1];\nhwll xy[N_MAX * 2 + 5];\nhwllc tup[N_MAX + 5];\n// sll table[3005][3005];\nhwll gin[N_MAX];\n// here we go\n\null knap[64000 + 1]; // [value] := mincost\n\null al[N_MAX], bl[N_MAX];\n\null solve () {\n\tsll i, j, ki, li;\n\t// ull result = 0;\n\tsll result = 0;\n\tdouble dresult = 0;\n\t// ull maybe = 0;\n\tsll maybe = 0;\n\t// ull sum = 0;\n\tsll sum = 0;\n\tsll item;\n\tsll *dpcell;\n\n\tscanf(\"%llu%llu%llu\", &n, &m, &k);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%llu\", &a[i]);\n\t\tif (i) {\n\t\t\tscanf(\"%llu\", &b[i]);\n\t\t\tb[i]--;\n\t\t}\n\t}\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tc[i]++;\n\t\td[i] += a[i];\n\t\tif (i) {\n\t\t\tc[b[i]] += c[i];\n\t\t\td[b[i]] += d[i];\n\t\t}\n\t}\n\n\tfor (i = 0; i < n; i++) {\n\t\ttup[i] = (hwllc){c[i], d[i], i};\n\t}\n\tqsort(tup, n, sizeof(hwllc), pfracomp);\n\n\tfor (i = 0; i < n; i++) {\n\t\tull x;\n\t\tif (i) {\n\t\t\tx = k;\n\t\t} else {\n\t\t\tx = 1000000000LL;\n\t\t}\n\t\tif (x <= 50) {\n\t\t\tal[i] = x;\n\t\t\tbl[i] = 0;\n\t\t} else {\n\t\t\tal[i] = 50;\n\t\t\tbl[i] = x - 50;\n\t\t}\n\t}\n\n\tull maxv = 64000;\n\tfor (i = 0; i <= maxv; i++) {\n\t\tknap[i] = m + 1;\n\t}\n\tknap[0] = 0;\n\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tull v = tup[i].c;\n\t\tfor (j = 0; j < al[v]; j++) {\n\t\t\tfor (ki = maxv; ki >= c[v]; ki--) {\n\t\t\t\tknap[ki] = smin(knap[ki], knap[ki - c[v]] + d[v]);\n\t\t\t}\n\t\t}\n\t}\n\tresult = 0;\n\tj = n - 1;\n\tull used = 0;\n\tull wild = 0;\n\tull val = 0;\n\tfor (i = maxv; i >= 0; i--) {\n\t\tif (knap[i] > m) continue;\n\t\tull v = tup[j].c;\n\t\twhile (true) {\n\t\t\tif (used == bl[tup[j].c]) {\n\t\t\t\tj--;\n\t\t\t\tused = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (knap[i] + wild + d[tup[j].c] <= m) {\n\t\t\t\twild += d[tup[j].c];\n\t\t\t\tused++;\n\t\t\t\tval += c[tup[j].c];\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tresult = umax(result, i + val);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\t// printf(\"%.15lf\\n\", dresult);\n\t// puts(s);\n\n\treturn 0;\n\n\tsuccess:\n\tputs(\"YES\");\n\t// puts(\"Yes\");\n\t// printf(\"%llu\\n\", result);\n\t// puts(\"0\");\n\t// puts(\"First\");\n\treturn 0;\n\n\tfail:\n\tputs(\"NO\");\n\t// puts(\"No\");\n\t// puts(\"0\");\n\t// puts(\"-1\");\n\t// puts(\"-1 -1 -1\");\n\t// puts(\"Second\");\n\treturn 1;\n}\n\nint32_t main (int argc, char *argv[]) {\n\tint32_t i, j;\n\n\tn = 5;\n\tm = 0;\n\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%llu\", &n, &m);\n\t// scanf(\"%llu\", &k, &n, &m);\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%llu\", &q);\n\t// scanf(\"%lld%lld\", &va, &vb, &vc, &vd);\n\t// va--;\n\t// vb--;\n\t// scanf(\"%llu%llu\", &ua, &ub, &uc, &ud, &ue);\n\t// scanf(\"%s\", s);\n\t// scanf(\"%s\", t);\n\t// scanf(\"%s\", u);\n\t// scanf(\"%llu\", &k);\n\t// scanf(\"%lld\", &m);\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// }\n\t// scanf(\"%llu\", &q);\n\t// for (i = 0; i < m; i++) {\n\t// \t// scanf(\"%lld%lld\", &xy[i].a, &xy[i].b);\n\t// \t// scanf(\"%lld%lld%lld\", &tup[i].a, &tup[i].b, &tup[i].c);\n\t// \t// scanf(\"%lld\", &c[i]);\n\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &b[i]);\n\t// \t// scanf(\"%lld\", &c[i]);\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// \t// c[i]--;\n\t// \t// d[i]--;\n\t// \t// xy[i].a--;\n\t// \t// xy[i].b--;\n\t// \t// tup[i].a--;\n\t// \t// tup[i].b--;\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \t// scanf(\"%lld%lld\", &a[i], &b[i]);\n\t// \tscanf(\"%lld\", &b[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// \t// scanf(\"%lld\", &e[i]);\n\t// \t// d[i]--;\n\t// }\n\n\t// for (i = 0; i < q; i++) {\n\t// \t// scanf(\"%lld%lld\", &xy[i].a, &xy[i].b);\n\t// \tscanf(\"%lld\", &c[i]);\n\t// \t// xy[i].a--;\n\t// \t// xy[i].b--;\n\t// }\n\n\t// for (i = 0; i < n; i++) {\n\t// \tfor (j = 0; j < m; j++) {\n\t// \t\tscanf(\"%lld\", &table[i][j]);\n\t// \t\t// table[i][j]--;\n\t// \t}\n\t// }\n\t// for (i = 0; i < h; i++) {\n\t// \tscanf(\"%s\", s[i]);\n\t// }\n\t// scanf(\"%llu\", &q);\n\n\tsolve();\n\n\treturn 0;\n}\n", "index": 32, "inputs": [ "3 100 10\n30\n10 1\n20 1\n", "5 1000010000 1000000\n123\n159 1\n111 1\n135 3\n147 3\n", "3 101 1\n15\n10 1\n20 1\n", "3 000 10\n30\n10 1\n20 1\n", "5 1000010000 1000000\n30\n159 1\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n84 1\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n84 0\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n164 0\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n164 0\n111 1\n73 3\n147 3\n", "5 1000010000 1000000\n30\n164 0\n111 2\n73 3\n147 3\n", "5 1000010000 1000000\n12\n164 0\n111 2\n73 3\n50 3\n", "5 1000000000 1000000\n123\n166 1\n111 1\n135 3\n147 3\n", "3 100 1\n15\n10 1\n27 1\n", "5 1000010000 1000000\n203\n159 1\n111 1\n135 3\n147 3\n", "3 010 10\n30\n10 1\n20 1\n", "5 1000010000 1000000\n30\n159 1\n111 1\n135 3\n147 4\n", "5 1000010000 1001000\n30\n84 1\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n1\n84 0\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n164 0\n111 1\n73 0\n147 3\n", "5 1000010001 0000000\n23\n164 0\n111 2\n56 0\n50 3\n", "3 1000010001 0000001\n6\n50 0\n101 2\n56 0\n50 3\n", "5 1000000000 1000000\n158\n166 1\n111 1\n135 3\n147 3\n", "3 100 1\n13\n10 1\n27 1\n", "3 101 1\n14\n10 1\n2 1\n", "5 1000010000 1001000\n12\n84 1\n111 1\n135 3\n147 3\n", "5 1000010000 0000000\n1\n84 0\n111 1\n135 3\n147 3\n", "5 1000010000 1000001\n35\n164 0\n111 1\n135 3\n147 3\n", "5 1000110000 1000000\n30\n164 0\n111 1\n73 0\n147 3\n", "5 1000010000 1000000\n2\n164 0\n101 2\n73 3\n50 3\n", "5 1000010000 1000000\n24\n282 0\n111 2\n73 3\n50 3\n", "3 1000010001 1000000\n13\n164 0\n111 2\n73 3\n50 3\n", "3 1000010001 0000001\n8\n13 0\n101 2\n91 0\n50 3\n", "5 1000000000 1001000\n158\n166 1\n111 1\n135 3\n147 3\n", "5 1000011001 1000000\n203\n159 1\n111 1\n135 3\n147 3\n", "3 101 1\n8\n10 1\n2 1\n", "5 1000010000 1000000\n30\n159 1\n111 1\n135 3\n146 2\n", "5 1000010000 0000000\n1\n84 1\n111 1\n135 3\n147 3\n", "5 1000010000 1000001\n35\n164 0\n110 1\n135 3\n147 3\n", "5 1001110000 1000000\n30\n164 0\n111 1\n73 0\n147 3\n", "5 1000011001 0000000\n23\n164 0\n111 2\n56 0\n79 3\n", "3 1000010001 0000000\n4\n48 0\n101 2\n2 0\n50 3\n", "3 1000000000 1001000\n158\n166 1\n111 1\n135 3\n147 3\n", "5 1000011001 1000000\n289\n159 1\n111 1\n135 3\n147 3\n", "3 101 1\n8\n12 1\n2 1\n", "5 1000010000 1000000\n57\n159 1\n111 1\n135 3\n146 2\n", "5 1000010000 0000000\n1\n84 1\n111 1\n135 3\n34 3\n", "5 1001110000 1000000\n30\n164 0\n111 1\n73 0\n260 3\n", "3 1000010101 0001000\n12\n164 0\n111 2\n56 0\n67 3\n", "3 1000010001 0000001\n6\n52 0\n001 2\n56 0\n50 4\n", "3 1000010001 0000001\n8\n9 0\n001 2\n91 0\n50 3\n", "3 1000000000 1001000\n158\n166 0\n111 1\n135 3\n147 3\n", "3 101 1\n30\n14 0\n20 1\n", "5 1000011001 1000000\n289\n159 1\n111 1\n135 6\n147 3\n", "3 101 0\n8\n12 1\n2 1\n", "5 1000010000 0000000\n57\n159 1\n111 1\n135 3\n146 2\n", "5 1000010000 0000000\n1\n84 1\n111 1\n266 3\n34 3\n", "5 1000010000 1000101\n35\n164 0\n110 1\n135 3\n14 3\n", "5 1000110000 1000000\n30\n164 0\n111 1\n73 0\n260 3\n", "5 1000010000 1000000\n30\n164 0\n110 0\n12 3\n147 2\n", "1 1000010001 0000000\n3\n50 1\n111 2\n56 0\n50 4\n", "3 100 1\n12\n10 0\n27 2\n", "5 1000011001 1000000\n289\n159 1\n111 1\n131 6\n147 3\n", "3 101 0\n15\n12 1\n2 1\n", "5 1000010000 0000000\n57\n159 1\n111 1\n261 3\n146 2\n", "5 1000010000 0000000\n1\n84 1\n111 1\n266 0\n34 3\n", "5 1000010000 1000101\n35\n164 0\n110 1\n135 3\n18 3\n", "5 1000110000 1000010\n30\n164 0\n111 1\n73 0\n260 3\n", "5 1000010000 1000000\n30\n164 0\n110 0\n1 3\n147 2\n", "5 1000010000 1000000\n3\n164 0\n101 0\n4 6\n50 3\n", "5 1000011001 0100000\n23\n164 0\n011 2\n56 0\n79 4\n", "3 1000011001 1000000\n289\n159 1\n111 1\n131 6\n147 3\n", "5 1000010000 0000000\n57\n159 1\n111 1\n261 3\n225 2\n", "5 1000010000 1000101\n35\n164 0\n110 1\n135 3\n20 3\n", "5 1000110000 1000010\n7\n164 0\n111 1\n73 0\n260 3\n", "3 1000010101 0001100\n12\n164 0\n011 2\n56 0\n52 3\n", "3 100 1\n1\n13 0\n27 2\n", "5 1000010000 0000000\n57\n159 1\n111 1\n396 3\n225 2\n", "5 1000010000 1000111\n35\n164 0\n110 1\n135 3\n20 3\n", "5 1000010000 1000000\n3\n164 0\n101 0\n4 1\n25 3\n", "5 1000011001 0100000\n36\n278 0\n011 2\n56 0\n79 4\n", "3 1000010101 1001100\n12\n164 0\n011 2\n56 0\n52 3\n", "3 1000010001 1000000\n2\n8 0\n101 1\n2 0\n50 4\n", "5 1000010000 1000111\n35\n164 0\n100 1\n135 3\n20 3\n", "5 1000000000 1000000\n30\n290 0\n110 0\n1 3\n147 2\n", "5 1000011001 0100010\n36\n278 0\n011 2\n56 0\n79 4\n", "5 1000000000 1000000\n30\n290 0\n110 0\n1 3\n21 2\n", "3 1000010001 1000000\n4\n8 0\n101 1\n3 0\n50 4\n", "5 1000010001 1000100\n13\n217 0\n101 2\n142 2\n1 4\n", "3 1000010001 1000000\n3\n8 0\n101 1\n3 0\n50 4\n", "5 0000010001 1000100\n13\n217 0\n101 2\n142 2\n1 4\n", "3 1000010101 1101100\n12\n164 0\n011 2\n56 0\n164 3\n", "3 1000110101 1101100\n12\n164 0\n011 2\n56 0\n164 3\n", "5 1000000000 1000000\n123\n159 1\n111 1\n135 3\n60 3\n", "5 1000010000 1000000\n123\n159 1\n111 1\n122 3\n147 3\n", "5 1000010000 1000000\n30\n218 1\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n84 1\n110 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n79 0\n111 1\n135 3\n147 3\n", "5 1000010000 1000000\n30\n164 0\n111 1\n222 3\n147 3\n", "5 1000110000 1000000\n30\n164 0\n111 2\n73 3\n147 3\n", "5 1000000000 1000000\n30\n164 0\n111 2\n73 3\n50 3\n", "3 100 10\n15\n10 1\n20 1\n", "3 100 1\n15\n10 1\n20 1\n", "3 100 1\n15\n10 1\n20 1\n", "5 1000000000 1000000\n123\n159 1\n111 1\n135 3\n147 3\n" ], "outputs": [ "10\n", "7496370\n", "7\n", "0\n", "8591151\n", "10033629\n", "9662032\n", "9456358\n", "11271578\n", "33333666\n", "83334166\n", "7460410\n", "5\n", "7152384\n", "1\n", "8591150\n", "10033800\n", "10299593\n", "10656353\n", "43478695\n", "166668333\n", "7291492\n", "6\n", "11\n", "10366296\n", "10152384\n", "9345887\n", "10657395\n", "500005000\n", "41667083\n", "76923846\n", "125001250\n", "7291810\n", "7152390\n", "15\n", "8605937\n", "10460355\n", "9367774\n", "10667812\n", "43478739\n", "250002500\n", "7131268\n", "6986985\n", "13\n", "8223766\n", "13698765\n", "7943465\n", "83334175\n", "166668334\n", "125001251\n", "7609840\n", "4\n", "6705444\n", "12\n", "8223765\n", "10080745\n", "14415182\n", "7935985\n", "33933666\n", "333336667\n", "8\n", "6728107\n", "9\n", "6812055\n", "17391476\n", "14181418\n", "7935989\n", "34300333\n", "333336666\n", "43530913\n", "5917769\n", "6150120\n", "14066873\n", "8358020\n", "83334266\n", "100\n", "5274310\n", "14066880\n", "285717142\n", "27847527\n", "83417600\n", "20262330\n", "14517459\n", "34300000\n", "27847534\n", "34600000\n", "19895428\n", "77847015\n", "20077114\n", "10001\n", "83425933\n", "83434266\n", "9391156\n", "7761404\n", "7800390\n", "10051481\n", "9709313\n", "7843215\n", "33337000\n", "33333333\n", "10\n", "7\n", "7\n", "7496296\n" ], "question": "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 <stdio.h>\n#include <stdint.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#include <time.h>\n\n#define BIG 2000000007\n#define VERYBIG 20000000000000007LL\n\n#define MOD 1000000007\n#define FOD 998244353\ntypedef uint64_t ull;\ntypedef int64_t sll;\n\n#define N_MAX 1048576\n\n#ifdef __cplusplus\n#include <queue>\n#include <stack>\n#include <tuple>\n#include <set>\n#include <map>\n#include <string>\n#include <algorithm>\n#include <functional>\n#include <array>\n\nusing std::queue;\nusing std::priority_queue;\nusing std::stack;\nusing std::tuple;\nusing std::set;\nusing std::map;\nusing std::vector;\nusing std::greater;\nusing std::pair;\nusing std::string;\nusing std::get;\n\ntemplate <typename T, typename U>\npair<T, U> operator+(pair<T, U> l, pair<T, U> r) {\n\treturn pair<T, U>(l.first + r.first, l.second + r.second);\n}\n\n#endif\n\ntypedef struct {\n\tsll a;\n\tsll b;\n} hwll;\n\ntypedef struct {\n\tsll a;\n\tsll b;\n\tsll c;\n} hwllc;\n\ntypedef struct {\n\thwll a;\n\thwll b;\n} linell;\n\ntypedef struct {\n\tdouble a;\n\tdouble b;\n} hwreal;\n\null n, m;\null h, w;\null k;\null q;\nsll va, vb, vc, vd, ve, vf;\null ua, ub, uc, ud, ue, uf;\nlong double vra, vrb, vrc;\ndouble vda, vdb, vdc;\nchar ch, dh;\n\null umin (ull x, ull y) {\n\treturn (x < y) ? x : y;\n}\n\null umax (ull x, ull y) {\n\treturn (x > y) ? x : y;\n}\n\nsll smin (sll x, sll y) {\n\treturn (x < y) ? x : y;\n}\n\nsll smax (sll x, sll y) {\n\treturn (x > y) ? x : y;\n}\n\null gcd (ull x, ull y) {\n\tif (y == 0) {\n\t\treturn x;\n\t} else {\n\t\treturn gcd(y, x % y);\n\t}\n}\n\null bitpow (ull a, ull x, ull modulo) {\n\tull result = 1;\n\twhile (x) {\n\t\tif (x & 1) {\n\t\t\tresult *= a;\n\t\t\tresult %= modulo;\n\t\t}\n\t\tx /= 2;\n\t\ta = (a * a) % modulo;\n\t}\n\treturn result;\n}\n\null divide (ull a, ull b, ull modulo) {\n\treturn (a * bitpow(b, modulo - 2, modulo)) % modulo;\n}\n\null udiff (ull a, ull b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nsll sdiff (sll a, sll b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nint bitcount (ull n) {\n\tint result = 0;\n\twhile (n) {\n\t\tif (n & 1) result++;\n\t\tn /= 2;\n\t}\n\treturn result;\n}\n\n#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)\n#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right\n#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1\n\n// int32_t pullcomp (const void *left, const void *right) {\n// \tull l = *(ull*)left;\n// \tull r = *(ull*)right;\n// \tif (l < r) {\n// \t\treturn -1;\n// \t}\n// \tif (l > r) {\n// \t\treturn +1;\n// \t}\n// \treturn 0;\n// }\nBEGCMP(pullcomp){\n\tDEFLR(ull);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(prevcomp){\n\tDEFLR(sll);\n\tCMPRET(r, l);\n\treturn 0;\n}\nBEGCMP(psllcomp){\n\tDEFLR(sll);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(pcharcomp){\n\tDEFLR(char);\n\tCMPRET(l, r);\n\treturn 0;\n}\nBEGCMP(pdoublecomp){\n\tDEFLR(double);\n\tCMPRET(l, r);\n\treturn 0;\n}\n\nint32_t pstrcomp (const void *left, const void *right) {\n\tchar* l = *(char**)left;\n\tchar* r = *(char**)right;\n\n\treturn strcmp(l, r);\n}\n\nBEGCMP(phwllABcomp){\n\tDEFLR(hwll);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\nBEGCMP(phwllREVcomp){\n\tDEFLR(hwll);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.a, r.a);\n\treturn 0;\n}\nBEGCMP(ptriplecomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.c, r.c);\n\treturn 0;\n}\nBEGCMP(ptripleREVcomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.b, r.b);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.c, r.c);\n\treturn 0;\n}\nBEGCMP(ptripleCABcomp){\n\tDEFLR(hwllc);\n\tCMPRET(l.c, r.c);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\nBEGCMP(phwrealcomp){\n\tDEFLR(hwreal);\n\tCMPRET(l.a, r.a);\n\tCMPRET(l.b, r.b);\n\treturn 0;\n}\n\nint32_t pquadcomp (const void *left, const void *right) {\n\tlinell l = *(linell*)left;\n\tlinell r = *(linell*)right;\n\n\tsll ac = phwllABcomp(&(l.a), &(r.a));\n\tif (ac) return ac;\n\tsll bc = phwllABcomp(&(l.b), &(r.b));\n\tif (bc) return bc;\n\n\treturn 0;\n}\nint32_t pfracomp (const void *left, const void *right) {\n\thwllc l = *(hwllc*)left;\n\thwllc r = *(hwllc*)right;\n\n\tCMPRET(l.a * r.b, l.b * r.a);\n\treturn 0;\n}\n\nbool isinrange (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right);\n}\n\nbool isinrange_soft (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right) || (left >= x && x >= right);\n}\n\nsll a[N_MAX + 5];\n// ull a[N_MAX + 5];\n// sll a[3001][3001];\nsll b[N_MAX + 5];\n// ull b[N_MAX + 5];\n// sll b[3001][3001];\nsll c[N_MAX + 5];\nsll d[N_MAX + 5];\nsll e[N_MAX * 4];\n// char s[N_MAX + 1];\nchar s[3010][3010];\nchar t[N_MAX + 1];\n// char t[3010][3010];\nchar u[N_MAX + 1];\nhwll xy[N_MAX * 2 + 5];\nhwllc tup[N_MAX + 5];\n// sll table[3005][3005];\nhwll gin[N_MAX];\n// here we go\n\null knap[64000 + 1]; // [value] := mincost\n\null al[N_MAX], bl[N_MAX];\n\null solve () {\n\tsll i, j, ki, li;\n\t// ull result = 0;\n\tsll result = 0;\n\tdouble dresult = 0;\n\t// ull maybe = 0;\n\tsll maybe = 0;\n\t// ull sum = 0;\n\tsll sum = 0;\n\tsll item;\n\tsll *dpcell;\n\n\tscanf(\"%llu%llu%llu\", &n, &m, &k);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%llu\", &a[i]);\n\t\tif (i) {\n\t\t\tscanf(\"%llu\", &b[i]);\n\t\t\tb[i]--;\n\t\t}\n\t}\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tc[i]++;\n\t\td[i] += a[i];\n\t\tif (i) {\n\t\t\tc[b[i]] += c[i];\n\t\t\td[b[i]] += d[i];\n\t\t}\n\t}\n\n\tfor (i = 0; i < n; i++) {\n\t\ttup[i] = (hwllc){c[i], d[i], i};\n\t}\n\tqsort(tup, n, sizeof(hwllc), pfracomp);\n\n\tfor (i = 0; i < n; i++) {\n\t\tull x;\n\t\tif (i) {\n\t\t\tx = k;\n\t\t} else {\n\t\t\tx = 1000000000LL;\n\t\t}\n\t\tif (x <= 50) {\n\t\t\tal[i] = x;\n\t\t\tbl[i] = 0;\n\t\t} else {\n\t\t\tal[i] = 50;\n\t\t\tbl[i] = x - 50;\n\t\t}\n\t}\n\n\tull maxv = 64000;\n\tfor (i = 0; i <= maxv; i++) {\n\t\tknap[i] = m + 1;\n\t}\n\tknap[0] = 0;\n\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tull v = tup[i].c;\n\t\tfor (j = 0; j < al[v]; j++) {\n\t\t\tfor (ki = maxv; ki >= c[v]; ki--) {\n\t\t\t\tknap[ki] = smin(knap[ki], knap[ki - c[v]] + d[v]);\n\t\t\t}\n\t\t}\n\t}\n\tresult = 0;\n\tj = n - 1;\n\tull used = 0;\n\tull wild = 0;\n\tull val = 0;\n\tfor (i = maxv; i >= 0; i--) {\n\t\tif (knap[i] > m) continue;\n\t\tull v = tup[j].c;\n\t\twhile (true) {\n\t\t\tif (used == bl[tup[j].c]) {\n\t\t\t\tj--;\n\t\t\t\tused = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (knap[i] + wild + d[tup[j].c] <= m) {\n\t\t\t\twild += d[tup[j].c];\n\t\t\t\tused++;\n\t\t\t\tval += c[tup[j].c];\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tresult = umax(result, i + val);\n\t}\n\n\tprintf(\"%lld\\n\", result);\n\t// printf(\"%.15lf\\n\", dresult);\n\t// puts(s);\n\n\treturn 0;\n\n\tsuccess:\n\tputs(\"YES\");\n\t// puts(\"Yes\");\n\t// printf(\"%llu\\n\", result);\n\t// puts(\"0\");\n\t// puts(\"First\");\n\treturn 0;\n\n\tfail:\n\tputs(\"NO\");\n\t// puts(\"No\");\n\t// puts(\"0\");\n\t// puts(\"-1\");\n\t// puts(\"-1 -1 -1\");\n\t// puts(\"Second\");\n\treturn 1;\n}\n\nint32_t main (int argc, char *argv[]) {\n\tint32_t i, j;\n\n\tn = 5;\n\tm = 0;\n\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%llu\", &n, &m);\n\t// scanf(\"%llu\", &k, &n, &m);\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%llu\", &q);\n\t// scanf(\"%lld%lld\", &va, &vb, &vc, &vd);\n\t// va--;\n\t// vb--;\n\t// scanf(\"%llu%llu\", &ua, &ub, &uc, &ud, &ue);\n\t// scanf(\"%s\", s);\n\t// scanf(\"%s\", t);\n\t// scanf(\"%s\", u);\n\t// scanf(\"%llu\", &k);\n\t// scanf(\"%lld\", &m);\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// }\n\t// scanf(\"%llu\", &q);\n\t// for (i = 0; i < m; i++) {\n\t// \t// scanf(\"%lld%lld\", &xy[i].a, &xy[i].b);\n\t// \t// scanf(\"%lld%lld%lld\", &tup[i].a, &tup[i].b, &tup[i].c);\n\t// \t// scanf(\"%lld\", &c[i]);\n\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &b[i]);\n\t// \t// scanf(\"%lld\", &c[i]);\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// \t// c[i]--;\n\t// \t// d[i]--;\n\t// \t// xy[i].a--;\n\t// \t// xy[i].b--;\n\t// \t// tup[i].a--;\n\t// \t// tup[i].b--;\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \t// scanf(\"%lld%lld\", &a[i], &b[i]);\n\t// \tscanf(\"%lld\", &b[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// \t// scanf(\"%lld\", &d[i]);\n\t// \t// scanf(\"%lld\", &e[i]);\n\t// \t// d[i]--;\n\t// }\n\n\t// for (i = 0; i < q; i++) {\n\t// \t// scanf(\"%lld%lld\", &xy[i].a, &xy[i].b);\n\t// \tscanf(\"%lld\", &c[i]);\n\t// \t// xy[i].a--;\n\t// \t// xy[i].b--;\n\t// }\n\n\t// for (i = 0; i < n; i++) {\n\t// \tfor (j = 0; j < m; j++) {\n\t// \t\tscanf(\"%lld\", &table[i][j]);\n\t// \t\t// table[i][j]--;\n\t// \t}\n\t// }\n\t// for (i = 0; i < h; i++) {\n\t// \tscanf(\"%s\", s[i]);\n\t// }\n\t// scanf(\"%llu\", &q);\n\n\tsolve();\n\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tn\n\t.bss\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tva\n\t.align 8\n\t.type\tva, @object\n\t.size\tva, 8\nva:\n\t.zero\t8\n\t.globl\tvb\n\t.align 8\n\t.type\tvb, @object\n\t.size\tvb, 8\nvb:\n\t.zero\t8\n\t.globl\tvc\n\t.align 8\n\t.type\tvc, @object\n\t.size\tvc, 8\nvc:\n\t.zero\t8\n\t.globl\tvd\n\t.align 8\n\t.type\tvd, @object\n\t.size\tvd, 8\nvd:\n\t.zero\t8\n\t.globl\tve\n\t.align 8\n\t.type\tve, @object\n\t.size\tve, 8\nve:\n\t.zero\t8\n\t.globl\tvf\n\t.align 8\n\t.type\tvf, @object\n\t.size\tvf, 8\nvf:\n\t.zero\t8\n\t.globl\tua\n\t.align 8\n\t.type\tua, @object\n\t.size\tua, 8\nua:\n\t.zero\t8\n\t.globl\tub\n\t.align 8\n\t.type\tub, @object\n\t.size\tub, 8\nub:\n\t.zero\t8\n\t.globl\tuc\n\t.align 8\n\t.type\tuc, @object\n\t.size\tuc, 8\nuc:\n\t.zero\t8\n\t.globl\tud\n\t.align 8\n\t.type\tud, @object\n\t.size\tud, 8\nud:\n\t.zero\t8\n\t.globl\tue\n\t.align 8\n\t.type\tue, @object\n\t.size\tue, 8\nue:\n\t.zero\t8\n\t.globl\tuf\n\t.align 8\n\t.type\tuf, @object\n\t.size\tuf, 8\nuf:\n\t.zero\t8\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.text\n\t.globl\tumin\n\t.type\tumin, @function\numin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovbe\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tumin, .-umin\n\t.globl\tumax\n\t.type\tumax, @function\numax:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovnb\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tumax, .-umax\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsmin, .-smin\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovge\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tsmax, .-smax\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tcmpq\t$0, -16(%rbp)\n\tjne\t.L10\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L11\n.L10:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tgcd\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tgcd, .-gcd\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tjmp\t.L13\n.L15:\n\tmovq\t-32(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L14\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n.L14:\n\tmovq\t-32(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n.L13:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L15\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tbitpow, .-bitpow\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-2(%rax), %rcx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tbitpow\n\timulq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-24(%rbp)\n\tmovq\t%rdx, %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tdivide, .-divide\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjb\t.L20\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L21\n.L20:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L21:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tudiff, .-udiff\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjl\t.L23\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L24\n.L23:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L24:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tsdiff, .-sdiff\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L26\n.L28:\n\tmovq\t-24(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L27\n\taddl\t$1, -4(%rbp)\n.L27:\n\tmovq\t-24(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -24(%rbp)\n.L26:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L28\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tbitcount, .-bitcount\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjnb\t.L31\n\tmovl\t$-1, %eax\n\tjmp\t.L32\n.L31:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjbe\t.L33\n\tmovl\t$1, %eax\n\tjmp\t.L32\n.L33:\n\tmovl\t$0, %eax\n.L32:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpullcomp, .-pullcomp\n\t.globl\tprevcomp\n\t.type\tprevcomp, @function\nprevcomp:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L35\n\tmovl\t$-1, %eax\n\tjmp\t.L36\n.L35:\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjle\t.L37\n\tmovl\t$1, %eax\n\tjmp\t.L36\n.L37:\n\tmovl\t$0, %eax\n.L36:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tprevcomp, .-prevcomp\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjge\t.L39\n\tmovl\t$-1, %eax\n\tjmp\t.L40\n.L39:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjle\t.L41\n\tmovl\t$1, %eax\n\tjmp\t.L40\n.L41:\n\tmovl\t$0, %eax\n.L40:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tpsllcomp, .-psllcomp\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -2(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -1(%rbp)\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjge\t.L43\n\tmovl\t$-1, %eax\n\tjmp\t.L44\n.L43:\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjle\t.L45\n\tmovl\t$1, %eax\n\tjmp\t.L44\n.L45:\n\tmovl\t$0, %eax\n.L44:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tpcharcomp, .-pcharcomp\n\t.globl\tpdoublecomp\n\t.type\tpdoublecomp, @function\npdoublecomp:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L54\n\tmovl\t$-1, %eax\n\tjmp\t.L49\n.L54:\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t-8(%rbp), %xmm0\n\tjbe\t.L55\n\tmovl\t$1, %eax\n\tjmp\t.L49\n.L55:\n\tmovl\t$0, %eax\n.L49:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tpdoublecomp, .-pdoublecomp\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tpstrcomp, .-pstrcomp\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L59\n\tmovl\t$-1, %eax\n\tjmp\t.L64\n.L59:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L61\n\tmovl\t$1, %eax\n\tjmp\t.L64\n.L61:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L62\n\tmovl\t$-1, %eax\n\tjmp\t.L64\n.L62:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L63\n\tmovl\t$1, %eax\n\tjmp\t.L64\n.L63:\n\tmovl\t$0, %eax\n.L64:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.globl\tphwllREVcomp\n\t.type\tphwllREVcomp, @function\nphwllREVcomp:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L66\n\tmovl\t$-1, %eax\n\tjmp\t.L71\n.L66:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L68\n\tmovl\t$1, %eax\n\tjmp\t.L71\n.L68:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L69\n\tmovl\t$-1, %eax\n\tjmp\t.L71\n.L69:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L70\n\tmovl\t$1, %eax\n\tjmp\t.L71\n.L70:\n\tmovl\t$0, %eax\n.L71:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tphwllREVcomp, .-phwllREVcomp\n\t.globl\tptriplecomp\n\t.type\tptriplecomp, @function\nptriplecomp:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L73\n\tmovl\t$-1, %eax\n\tjmp\t.L80\n.L73:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L75\n\tmovl\t$1, %eax\n\tjmp\t.L80\n.L75:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L76\n\tmovl\t$-1, %eax\n\tjmp\t.L80\n.L76:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L77\n\tmovl\t$1, %eax\n\tjmp\t.L80\n.L77:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L78\n\tmovl\t$-1, %eax\n\tjmp\t.L80\n.L78:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L79\n\tmovl\t$1, %eax\n\tjmp\t.L80\n.L79:\n\tmovl\t$0, %eax\n.L80:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tptriplecomp, .-ptriplecomp\n\t.globl\tptripleREVcomp\n\t.type\tptripleREVcomp, @function\nptripleREVcomp:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L82\n\tmovl\t$-1, %eax\n\tjmp\t.L89\n.L82:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L84\n\tmovl\t$1, %eax\n\tjmp\t.L89\n.L84:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L85\n\tmovl\t$-1, %eax\n\tjmp\t.L89\n.L85:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L86\n\tmovl\t$1, %eax\n\tjmp\t.L89\n.L86:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L87\n\tmovl\t$-1, %eax\n\tjmp\t.L89\n.L87:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L88\n\tmovl\t$1, %eax\n\tjmp\t.L89\n.L88:\n\tmovl\t$0, %eax\n.L89:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tptripleREVcomp, .-ptripleREVcomp\n\t.globl\tptripleCABcomp\n\t.type\tptripleCABcomp, @function\nptripleCABcomp:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L91\n\tmovl\t$-1, %eax\n\tjmp\t.L98\n.L91:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L93\n\tmovl\t$1, %eax\n\tjmp\t.L98\n.L93:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L94\n\tmovl\t$-1, %eax\n\tjmp\t.L98\n.L94:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L95\n\tmovl\t$1, %eax\n\tjmp\t.L98\n.L95:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L96\n\tmovl\t$-1, %eax\n\tjmp\t.L98\n.L96:\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L97\n\tmovl\t$1, %eax\n\tjmp\t.L98\n.L97:\n\tmovl\t$0, %eax\n.L98:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tptripleCABcomp, .-ptripleCABcomp\n\t.globl\tphwrealcomp\n\t.type\tphwrealcomp, @function\nphwrealcomp:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovsd\t-32(%rbp), %xmm1\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L114\n\tmovl\t$-1, %eax\n\tjmp\t.L109\n.L114:\n\tmovsd\t-32(%rbp), %xmm0\n\tmovsd\t-16(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L115\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L115:\n\tmovsd\t-24(%rbp), %xmm1\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L116\n\tmovl\t$-1, %eax\n\tjmp\t.L109\n.L116:\n\tmovsd\t-24(%rbp), %xmm0\n\tmovsd\t-8(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L117\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L117:\n\tmovl\t$0, %eax\n.L109:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tphwrealcomp, .-phwrealcomp\n\t.globl\tpquadcomp\n\t.type\tpquadcomp, @function\npquadcomp:\n.LFB28:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$112, %rsp\n\tmovq\t%rdi, -104(%rbp)\n\tmovq\t%rsi, -112(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t-104(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -80(%rbp)\n\tmovq\t%rdx, -72(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t24(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t-112(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t24(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tleaq\t-48(%rbp), %rdx\n\tleaq\t-80(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tphwllABcomp\n\tcltq\n\tmovq\t%rax, -96(%rbp)\n\tcmpq\t$0, -96(%rbp)\n\tje\t.L119\n\tmovq\t-96(%rbp), %rax\n\tjmp\t.L122\n.L119:\n\tleaq\t-48(%rbp), %rax\n\tleaq\t16(%rax), %rdx\n\tleaq\t-80(%rbp), %rax\n\taddq\t$16, %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tphwllABcomp\n\tcltq\n\tmovq\t%rax, -88(%rbp)\n\tcmpq\t$0, -88(%rbp)\n\tje\t.L121\n\tmovq\t-88(%rbp), %rax\n\tjmp\t.L122\n.L121:\n\tmovl\t$0, %eax\n.L122:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L123\n\tcall\t__stack_chk_fail@PLT\n.L123:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE28:\n\t.size\tpquadcomp, .-pquadcomp\n\t.globl\tpfracomp\n\t.type\tpfracomp, @function\npfracomp:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t(%rcx), %rax\n\tmovq\t8(%rcx), %rdx\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t16(%rcx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L125\n\tmovl\t$-1, %eax\n\tjmp\t.L128\n.L125:\n\tmovq\t-64(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L127\n\tmovl\t$1, %eax\n\tjmp\t.L128\n.L127:\n\tmovl\t$0, %eax\n.L128:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tpfracomp, .-pfracomp\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjg\t.L130\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjg\t.L130\n\tmovl\t$1, %eax\n\tjmp\t.L131\n.L130:\n\tmovl\t$0, %eax\n.L131:\n\tandl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tisinrange, .-isinrange\n\t.globl\tisinrange_soft\n\t.type\tisinrange_soft, @function\nisinrange_soft:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjg\t.L134\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjle\t.L135\n.L134:\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjl\t.L136\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjl\t.L136\n.L135:\n\tmovl\t$1, %eax\n\tjmp\t.L137\n.L136:\n\tmovl\t$0, %eax\n.L137:\n\tandl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE31:\n\t.size\tisinrange_soft, .-isinrange_soft\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8388648\na:\n\t.zero\t8388648\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8388648\nb:\n\t.zero\t8388648\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8388648\nc:\n\t.zero\t8388648\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 8388648\nd:\n\t.zero\t8388648\n\t.globl\te\n\t.align 32\n\t.type\te, @object\n\t.size\te, 33554432\ne:\n\t.zero\t33554432\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 9060100\ns:\n\t.zero\t9060100\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 1048577\nt:\n\t.zero\t1048577\n\t.globl\tu\n\t.align 32\n\t.type\tu, @object\n\t.size\tu, 1048577\nu:\n\t.zero\t1048577\n\t.globl\txy\n\t.align 32\n\t.type\txy, @object\n\t.size\txy, 33554512\nxy:\n\t.zero\t33554512\n\t.globl\ttup\n\t.align 32\n\t.type\ttup, @object\n\t.size\ttup, 25165944\ntup:\n\t.zero\t25165944\n\t.globl\tgin\n\t.align 32\n\t.type\tgin, @object\n\t.size\tgin, 16777216\ngin:\n\t.zero\t16777216\n\t.globl\tknap\n\t.align 32\n\t.type\tknap, @object\n\t.size\tknap, 512008\nknap:\n\t.zero\t512008\n\t.globl\tal\n\t.align 32\n\t.type\tal, @object\n\t.size\tal, 8388608\nal:\n\t.zero\t8388608\n\t.globl\tbl\n\t.align 32\n\t.type\tbl, @object\n\t.size\tbl, 8388608\nbl:\n\t.zero\t8388608\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%llu%llu%llu\"\n.LC2:\n\t.string\t\"%llu\"\n.LC3:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$144, %rsp\n\tmovq\t$0, -120(%rbp)\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tleaq\tk(%rip), %rax\n\tmovq\t%rax, %rcx\n\tleaq\tm(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L140\n.L142:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t$0, -144(%rbp)\n\tje\t.L141\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n.L141:\n\taddq\t$1, -144(%rbp)\n.L140:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L142\n\tmovq\tn(%rip), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -144(%rbp)\n\tjmp\t.L143\n.L145:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ta(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tcmpq\t$0, -144(%rbp)\n\tje\t.L144\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rsi\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rsi, %rcx\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rsi\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tb(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rsi, %rcx\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n.L144:\n\tsubq\t$1, -144(%rbp)\n.L143:\n\tcmpq\t$0, -144(%rbp)\n\tjns\t.L145\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L146\n.L147:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-144(%rbp), %rsi\n\tmovq\t%rsi, %rax\n\taddq\t%rax, %rax\n\taddq\t%rsi, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rsi\n\tleaq\ttup(%rip), %rax\n\tmovq\t%rcx, (%rsi,%rax)\n\tmovq\t-144(%rbp), %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t8+tup(%rip), %rax\n\tmovq\t%rdx, (%rcx,%rax)\n\tmovq\t-144(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t16+tup(%rip), %rdx\n\tmovq\t-144(%rbp), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\taddq\t$1, -144(%rbp)\n.L146:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L147\n\tmovq\tn(%rip), %rax\n\tleaq\tpfracomp(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$24, %edx\n\tmovq\t%rax, %rsi\n\tleaq\ttup(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L148\n.L153:\n\tcmpq\t$0, -144(%rbp)\n\tje\t.L149\n\tmovq\tk(%rip), %rax\n\tmovq\t%rax, -112(%rbp)\n\tjmp\t.L150\n.L149:\n\tmovq\t$1000000000, -112(%rbp)\n.L150:\n\tcmpq\t$50, -112(%rbp)\n\tja\t.L151\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\tal(%rip), %rdx\n\tmovq\t-112(%rbp), %rax\n\tmovq\t%rax, (%rcx,%rdx)\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbl(%rip), %rax\n\tmovq\t$0, (%rdx,%rax)\n\tjmp\t.L152\n.L151:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tal(%rip), %rax\n\tmovq\t$50, (%rdx,%rax)\n\tmovq\t-112(%rbp), %rax\n\tleaq\t-50(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbl(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n.L152:\n\taddq\t$1, -144(%rbp)\n.L148:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L153\n\tmovq\t$64000, -56(%rbp)\n\tmovq\t$0, -144(%rbp)\n\tjmp\t.L154\n.L155:\n\tmovq\tm(%rip), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\taddq\t$1, -144(%rbp)\n.L154:\n\tmovq\t-144(%rbp), %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjnb\t.L155\n\tmovq\t$0, knap(%rip)\n\tmovq\tn(%rip), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -144(%rbp)\n\tjmp\t.L156\n.L161:\n\tmovq\t-144(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t$0, -136(%rbp)\n\tjmp\t.L157\n.L160:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -128(%rbp)\n\tjmp\t.L158\n.L159:\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-128(%rbp), %rax\n\tsubq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rcx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-128(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tsmin\n\tmovq\t%rax, %rcx\n\tmovq\t-128(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tsubq\t$1, -128(%rbp)\n.L158:\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tcmpq\t%rax, -128(%rbp)\n\tjge\t.L159\n\taddq\t$1, -136(%rbp)\n.L157:\n\tmovq\t-40(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tal(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-136(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tja\t.L160\n\tsubq\t$1, -144(%rbp)\n.L156:\n\tcmpq\t$0, -144(%rbp)\n\tjns\t.L161\n\tmovq\t$0, -120(%rbp)\n\tmovq\tn(%rip), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -136(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tmovq\t$0, -96(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -144(%rbp)\n\tjmp\t.L162\n.L170:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\tm(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tja\t.L172\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -48(%rbp)\n.L169:\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbl(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tcmpq\t%rax, -104(%rbp)\n\tjne\t.L165\n\tsubq\t$1, -136(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tjmp\t.L166\n.L165:\n\tmovq\t-144(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tknap(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-96(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t(%rcx,%rax), %rdx\n\tmovq\tm(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tja\t.L173\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\td(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -96(%rbp)\n\taddq\t$1, -104(%rbp)\n\tmovq\t-136(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t16+tup(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tc(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -88(%rbp)\n.L166:\n\tjmp\t.L169\n.L173:\n\tnop\n\tmovq\t-144(%rbp), %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-120(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tumax\n\tmovq\t%rax, -120(%rbp)\n\tjmp\t.L164\n.L172:\n\tnop\n.L164:\n\tsubq\t$1, -144(%rbp)\n.L162:\n\tcmpq\t$0, -144(%rbp)\n\tjns\t.L170\n\tmovq\t-120(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE32:\n\t.size\tsolve, .-solve\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB33:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t$5, n(%rip)\n\tmovq\t$0, m(%rip)\n\tmovl\t$0, %eax\n\tcall\tsolve\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #include <time.h> #define BIG 2000000007 #define VERYBIG 20000000000000007LL #define MOD 1000000007 #define FOD 998244353 typedef uint64_t ull; typedef int64_t sll; #define N_MAX 1048576 #ifdef __cplusplus #include <queue> #include <stack> #include <tuple> #include <set> #include <map> #include <string> #include <algorithm> #include <functional> #include <array> using std::queue; using std::priority_queue; using std::stack; using std::tuple; using std::set; using std::map; using std::vector; using std::greater; using std::pair; using std::string; using std::get; template <typename T, typename U> pair<T, U> operator+(pair<T, U> l, pair<T, U> r) { return pair<T, U>(l.first + r.first, l.second + r.second); } #endif typedef struct { sll a; sll b; } hwll; typedef struct { sll a; sll b; sll c; } hwllc; typedef struct { hwll a; hwll b; } linell; typedef struct { double a; double b; } hwreal; ull n, m; ull h, w; ull k; ull q; sll va, vb, vc, vd, ve, vf; ull ua, ub, uc, ud, ue, uf; long double vra, vrb, vrc; double vda, vdb, vdc; char ch, dh; ull umin (ull x, ull y) { return (x < y) ? x : y; } ull umax (ull x, ull y) { return (x > y) ? x : y; } sll smin (sll x, sll y) { return (x < y) ? x : y; } sll smax (sll x, sll y) { return (x > y) ? x : y; } ull gcd (ull x, ull y) { if (y == 0) { return x; } else { return gcd(y, x % y); } } ull bitpow (ull a, ull x, ull modulo) { ull result = 1; while (x) { if (x & 1) { result *= a; result %= modulo; } x /= 2; a = (a * a) % modulo; } return result; } ull divide (ull a, ull b, ull modulo) { return (a * bitpow(b, modulo - 2, modulo)) % modulo; } ull udiff (ull a, ull b) { if (a >= b) { return a - b; } else { return b - a; } } sll sdiff (sll a, sll b) { if (a >= b) { return a - b; } else { return b - a; } } int bitcount (ull n) { int result = 0; while (n) { if (n & 1) result++; n /= 2; } return result; } #define BEGCMP(NAME) int32_t NAME (const void *left, const void *right) #define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right #define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1 // int32_t pullcomp (const void *left, const void *right) { // ull l = *(ull*)left; // ull r = *(ull*)right; // if (l < r) { // return -1; // } // if (l > r) { // return +1; // } // return 0; // } BEGCMP(pullcomp){ DEFLR(ull); CMPRET(l, r); return 0; } BEGCMP(prevcomp){ DEFLR(sll); CMPRET(r, l); return 0; } BEGCMP(psllcomp){ DEFLR(sll); CMPRET(l, r); return 0; } BEGCMP(pcharcomp){ DEFLR(char); CMPRET(l, r); return 0; } BEGCMP(pdoublecomp){ DEFLR(double); CMPRET(l, r); return 0; } int32_t pstrcomp (const void *left, const void *right) { char* l = *(char**)left; char* r = *(char**)right; return strcmp(l, r); } BEGCMP(phwllABcomp){ DEFLR(hwll); CMPRET(l.a, r.a); CMPRET(l.b, r.b); return 0; } BEGCMP(phwllREVcomp){ DEFLR(hwll); CMPRET(l.b, r.b); CMPRET(l.a, r.a); return 0; } BEGCMP(ptriplecomp){ DEFLR(hwllc); CMPRET(l.a, r.a); CMPRET(l.b, r.b); CMPRET(l.c, r.c); return 0; } BEGCMP(ptripleREVcomp){ DEFLR(hwllc); CMPRET(l.b, r.b); CMPRET(l.a, r.a); CMPRET(l.c, r.c); return 0; } BEGCMP(ptripleCABcomp){ DEFLR(hwllc); CMPRET(l.c, r.c); CMPRET(l.a, r.a); CMPRET(l.b, r.b); return 0; } BEGCMP(phwrealcomp){ DEFLR(hwreal); CMPRET(l.a, r.a); CMPRET(l.b, r.b); return 0; } int32_t pquadcomp (const void *left, const void *right) { linell l = *(linell*)left; linell r = *(linell*)right; sll ac = phwllABcomp(&(l.a), &(r.a)); if (ac) return ac; sll bc = phwllABcomp(&(l.b), &(r.b)); if (bc) return bc; return 0; } int32_t pfracomp (const void *left, const void *right) { hwllc l = *(hwllc*)left; hwllc r = *(hwllc*)right; CMPRET(l.a * r.b, l.b * r.a); return 0; } bool isinrange (sll left, sll x, sll right) { return (left <= x && x <= right); } bool isinrange_soft (sll left, sll x, sll right) { return (left <= x && x <= right) || (left >= x && x >= right); } sll a[N_MAX + 5]; // ull a[N_MAX + 5]; // sll a[3001][3001]; sll b[N_MAX + 5]; // ull b[N_MAX + 5]; // sll b[3001][3001]; sll c[N_MAX + 5]; sll d[N_MAX + 5]; sll e[N_MAX * 4]; // char s[N_MAX + 1]; char s[3010][3010]; char t[N_MAX + 1]; // char t[3010][3010]; char u[N_MAX + 1]; hwll xy[N_MAX * 2 + 5]; hwllc tup[N_MAX + 5]; // sll table[3005][3005]; hwll gin[N_MAX]; // here we go ull knap[64000 + 1]; // [value] := mincost ull al[N_MAX], bl[N_MAX]; ull solve () { sll i, j, ki, li; // ull result = 0; sll result = 0; double dresult = 0; // ull maybe = 0; sll maybe = 0; // ull sum = 0; sll sum = 0; sll item; sll *dpcell; scanf("%llu%llu%llu", &n, &m, &k); for (i = 0; i < n; i++) { scanf("%llu", &a[i]); if (i) { scanf("%llu", &b[i]); b[i]--; } } for (i = n - 1; i >= 0; i--) { c[i]++; d[i] += a[i]; if (i) { c[b[i]] += c[i]; d[b[i]] += d[i]; } } for (i = 0; i < n; i++) { tup[i] = (hwllc){c[i], d[i], i}; } qsort(tup, n, sizeof(hwllc), pfracomp); for (i = 0; i < n; i++) { ull x; if (i) { x = k; } else { x = 1000000000LL; } if (x <= 50) { al[i] = x; bl[i] = 0; } else { al[i] = 50; bl[i] = x - 50; } } ull maxv = 64000; for (i = 0; i <= maxv; i++) { knap[i] = m + 1; } knap[0] = 0; for (i = n - 1; i >= 0; i--) { ull v = tup[i].c; for (j = 0; j < al[v]; j++) { for (ki = maxv; ki >= c[v]; ki--) { knap[ki] = smin(knap[ki], knap[ki - c[v]] + d[v]); } } } result = 0; j = n - 1; ull used = 0; ull wild = 0; ull val = 0; for (i = maxv; i >= 0; i--) { if (knap[i] > m) continue; ull v = tup[j].c; while (true) { if (used == bl[tup[j].c]) { j--; used = 0; continue; } if (knap[i] + wild + d[tup[j].c] <= m) { wild += d[tup[j].c]; used++; val += c[tup[j].c]; } else { break; } } result = umax(result, i + val); } printf("%lld\n", result); // printf("%.15lf\n", dresult); // puts(s); return 0; success: puts("YES"); // puts("Yes"); // printf("%llu\n", result); // puts("0"); // puts("First"); return 0; fail: puts("NO"); // puts("No"); // puts("0"); // puts("-1"); // puts("-1 -1 -1"); // puts("Second"); return 1; } int32_t main (int argc, char *argv[]) { int32_t i, j; n = 5; m = 0; // scanf("%llu%llu", &h, &w); // scanf("%llu", &n, &m); // scanf("%llu", &k, &n, &m); // scanf("%llu%llu", &h, &w); // scanf("%llu", &q); // scanf("%lld%lld", &va, &vb, &vc, &vd); // va--; // vb--; // scanf("%llu%llu", &ua, &ub, &uc, &ud, &ue); // scanf("%s", s); // scanf("%s", t); // scanf("%s", u); // scanf("%llu", &k); // scanf("%lld", &m); // for (i = 0; i < n; i++) { // scanf("%lld", &a[i]); // // scanf("%lld", &d[i]); // } // scanf("%llu", &q); // for (i = 0; i < m; i++) { // // scanf("%lld%lld", &xy[i].a, &xy[i].b); // // scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c); // // scanf("%lld", &c[i]); // scanf("%lld", &a[i]); // // scanf("%lld", &b[i]); // // scanf("%lld", &c[i]); // // scanf("%lld", &d[i]); // // a[i]--; // // b[i]--; // // c[i]--; // // d[i]--; // // xy[i].a--; // // xy[i].b--; // // tup[i].a--; // // tup[i].b--; // } // for (i = 0; i < n; i++) { // // scanf("%lld%lld", &a[i], &b[i]); // scanf("%lld", &b[i]); // // a[i]--; // // b[i]--; // // scanf("%lld", &d[i]); // // scanf("%lld", &e[i]); // // d[i]--; // } // for (i = 0; i < q; i++) { // // scanf("%lld%lld", &xy[i].a, &xy[i].b); // scanf("%lld", &c[i]); // // xy[i].a--; // // xy[i].b--; // } // for (i = 0; i < n; i++) { // for (j = 0; j < m; j++) { // scanf("%lld", &table[i][j]); // // table[i][j]--; // } // } // for (i = 0; i < h; i++) { // scanf("%s", s[i]); // } // scanf("%llu", &q); solve(); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl n .bss .align 8 .type n, @object .size n, 8 n: .zero 8 .globl m .align 8 .type m, @object .size m, 8 m: .zero 8 .globl h .align 8 .type h, @object .size h, 8 h: .zero 8 .globl w .align 8 .type w, @object .size w, 8 w: .zero 8 .globl k .align 8 .type k, @object .size k, 8 k: .zero 8 .globl q .align 8 .type q, @object .size q, 8 q: .zero 8 .globl va .align 8 .type va, @object .size va, 8 va: .zero 8 .globl vb .align 8 .type vb, @object .size vb, 8 vb: .zero 8 .globl vc .align 8 .type vc, @object .size vc, 8 vc: .zero 8 .globl vd .align 8 .type vd, @object .size vd, 8 vd: .zero 8 .globl ve .align 8 .type ve, @object .size ve, 8 ve: .zero 8 .globl vf .align 8 .type vf, @object .size vf, 8 vf: .zero 8 .globl ua .align 8 .type ua, @object .size ua, 8 ua: .zero 8 .globl ub .align 8 .type ub, @object .size ub, 8 ub: .zero 8 .globl uc .align 8 .type uc, @object .size uc, 8 uc: .zero 8 .globl ud .align 8 .type ud, @object .size ud, 8 ud: .zero 8 .globl ue .align 8 .type ue, @object .size ue, 8 ue: .zero 8 .globl uf .align 8 .type uf, @object .size uf, 8 uf: .zero 8 .globl vra .align 16 .type vra, @object .size vra, 16 vra: .zero 16 .globl vrb .align 16 .type vrb, @object .size vrb, 16 vrb: .zero 16 .globl vrc .align 16 .type vrc, @object .size vrc, 16 vrc: .zero 16 .globl vda .align 8 .type vda, @object .size vda, 8 vda: .zero 8 .globl vdb .align 8 .type vdb, @object .size vdb, 8 vdb: .zero 8 .globl vdc .align 8 .type vdc, @object .size vdc, 8 vdc: .zero 8 .globl ch .type ch, @object .size ch, 1 ch: .zero 1 .globl dh .type dh, @object .size dh, 1 dh: .zero 1 .text .globl umin .type umin, @function umin: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovbe %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size umin, .-umin .globl umax .type umax, @function umax: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovnb %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size umax, .-umax .globl smin .type smin, @function smin: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovle %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size smin, .-smin .globl smax .type smax, @function smax: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovge %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size smax, .-smax .globl gcd .type gcd, @function gcd: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) cmpq $0, -16(%rbp) jne .L10 movq -8(%rbp), %rax jmp .L11 .L10: movq -8(%rbp), %rax movl $0, %edx divq -16(%rbp) movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call gcd .L11: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size gcd, .-gcd .globl bitpow .type bitpow, @function bitpow: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq %rdx, -40(%rbp) movq $1, -8(%rbp) jmp .L13 .L15: movq -32(%rbp), %rax andl $1, %eax testq %rax, %rax je .L14 movq -8(%rbp), %rax imulq -24(%rbp), %rax movq %rax, -8(%rbp) movq -8(%rbp), %rax movl $0, %edx divq -40(%rbp) movq %rdx, -8(%rbp) .L14: movq -32(%rbp), %rax shrq %rax movq %rax, -32(%rbp) movq -24(%rbp), %rax imulq %rax, %rax movl $0, %edx divq -40(%rbp) movq %rdx, -24(%rbp) .L13: cmpq $0, -32(%rbp) jne .L15 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size bitpow, .-bitpow .globl divide .type divide, @function divide: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -24(%rbp), %rax leaq -2(%rax), %rcx movq -24(%rbp), %rdx movq -16(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call bitpow imulq -8(%rbp), %rax movl $0, %edx divq -24(%rbp) movq %rdx, %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size divide, .-divide .globl udiff .type udiff, @function udiff: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jb .L20 movq -8(%rbp), %rax subq -16(%rbp), %rax jmp .L21 .L20: movq -16(%rbp), %rax subq -8(%rbp), %rax .L21: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size udiff, .-udiff .globl sdiff .type sdiff, @function sdiff: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jl .L23 movq -8(%rbp), %rax subq -16(%rbp), %rax jmp .L24 .L23: movq -16(%rbp), %rax subq -8(%rbp), %rax .L24: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size sdiff, .-sdiff .globl bitcount .type bitcount, @function bitcount: .LFB15: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movl $0, -4(%rbp) jmp .L26 .L28: movq -24(%rbp), %rax andl $1, %eax testq %rax, %rax je .L27 addl $1, -4(%rbp) .L27: movq -24(%rbp), %rax shrq %rax movq %rax, -24(%rbp) .L26: cmpq $0, -24(%rbp) jne .L28 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE15: .size bitcount, .-bitcount .globl pullcomp .type pullcomp, @function pullcomp: .LFB16: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -16(%rbp), %rax cmpq -8(%rbp), %rax jnb .L31 movl $-1, %eax jmp .L32 .L31: movq -16(%rbp), %rax cmpq -8(%rbp), %rax jbe .L33 movl $1, %eax jmp .L32 .L33: movl $0, %eax .L32: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE16: .size pullcomp, .-pullcomp .globl prevcomp .type prevcomp, @function prevcomp: .LFB17: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jge .L35 movl $-1, %eax jmp .L36 .L35: movq -8(%rbp), %rax cmpq -16(%rbp), %rax jle .L37 movl $1, %eax jmp .L36 .L37: movl $0, %eax .L36: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE17: .size prevcomp, .-prevcomp .globl psllcomp .type psllcomp, @function psllcomp: .LFB18: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -16(%rbp), %rax cmpq -8(%rbp), %rax jge .L39 movl $-1, %eax jmp .L40 .L39: movq -16(%rbp), %rax cmpq -8(%rbp), %rax jle .L41 movl $1, %eax jmp .L40 .L41: movl $0, %eax .L40: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE18: .size psllcomp, .-psllcomp .globl pcharcomp .type pcharcomp, @function pcharcomp: .LFB19: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movzbl (%rax), %eax movb %al, -2(%rbp) movq -32(%rbp), %rax movzbl (%rax), %eax movb %al, -1(%rbp) movzbl -2(%rbp), %eax cmpb -1(%rbp), %al jge .L43 movl $-1, %eax jmp .L44 .L43: movzbl -2(%rbp), %eax cmpb -1(%rbp), %al jle .L45 movl $1, %eax jmp .L44 .L45: movl $0, %eax .L44: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE19: .size pcharcomp, .-pcharcomp .globl pdoublecomp .type pdoublecomp, @function pdoublecomp: .LFB20: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movsd (%rax), %xmm0 movsd %xmm0, -16(%rbp) movq -32(%rbp), %rax movsd (%rax), %xmm0 movsd %xmm0, -8(%rbp) movsd -8(%rbp), %xmm0 comisd -16(%rbp), %xmm0 jbe .L54 movl $-1, %eax jmp .L49 .L54: movsd -16(%rbp), %xmm0 comisd -8(%rbp), %xmm0 jbe .L55 movl $1, %eax jmp .L49 .L55: movl $0, %eax .L49: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE20: .size pdoublecomp, .-pdoublecomp .globl pstrcomp .type pstrcomp, @function pstrcomp: .LFB21: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE21: .size pstrcomp, .-pstrcomp .globl phwllABcomp .type phwllABcomp, @function phwllABcomp: .LFB22: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movq -40(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq -48(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -16(%rbp) movq %rdx, -8(%rbp) movq -32(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jge .L59 movl $-1, %eax jmp .L64 .L59: movq -32(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jle .L61 movl $1, %eax jmp .L64 .L61: movq -24(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx jge .L62 movl $-1, %eax jmp .L64 .L62: movq -24(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx jle .L63 movl $1, %eax jmp .L64 .L63: movl $0, %eax .L64: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE22: .size phwllABcomp, .-phwllABcomp .globl phwllREVcomp .type phwllREVcomp, @function phwllREVcomp: .LFB23: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movq -40(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq -48(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -16(%rbp) movq %rdx, -8(%rbp) movq -24(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx jge .L66 movl $-1, %eax jmp .L71 .L66: movq -24(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx jle .L68 movl $1, %eax jmp .L71 .L68: movq -32(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jge .L69 movl $-1, %eax jmp .L71 .L69: movq -32(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jle .L70 movl $1, %eax jmp .L71 .L70: movl $0, %eax .L71: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE23: .size phwllREVcomp, .-phwllREVcomp .globl ptriplecomp .type ptriplecomp, @function ptriplecomp: .LFB24: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -72(%rbp) movq %rsi, -80(%rbp) movq -72(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -64(%rbp) movq %rdx, -56(%rbp) movq 16(%rcx), %rax movq %rax, -48(%rbp) movq -80(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq 16(%rcx), %rax movq %rax, -16(%rbp) movq -64(%rbp), %rdx movq -32(%rbp), %rax cmpq %rax, %rdx jge .L73 movl $-1, %eax jmp .L80 .L73: movq -64(%rbp), %rdx movq -32(%rbp), %rax cmpq %rax, %rdx jle .L75 movl $1, %eax jmp .L80 .L75: movq -56(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jge .L76 movl $-1, %eax jmp .L80 .L76: movq -56(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jle .L77 movl $1, %eax jmp .L80 .L77: movq -48(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jge .L78 movl $-1, %eax jmp .L80 .L78: movq -48(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jle .L79 movl $1, %eax jmp .L80 .L79: movl $0, %eax .L80: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE24: .size ptriplecomp, .-ptriplecomp .globl ptripleREVcomp .type ptripleREVcomp, @function ptripleREVcomp: .LFB25: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -72(%rbp) movq %rsi, -80(%rbp) movq -72(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -64(%rbp) movq %rdx, -56(%rbp) movq 16(%rcx), %rax movq %rax, -48(%rbp) movq -80(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq 16(%rcx), %rax movq %rax, -16(%rbp) movq -56(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jge .L82 movl $-1, %eax jmp .L89 .L82: movq -56(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jle .L84 movl $1, %eax jmp .L89 .L84: movq -64(%rbp), %rdx movq -32(%rbp), %rax cmpq %rax, %rdx jge .L85 movl $-1, %eax jmp .L89 .L85: movq -64(%rbp), %rdx movq -32(%rbp), %rax cmpq %rax, %rdx jle .L86 movl $1, %eax jmp .L89 .L86: movq -48(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jge .L87 movl $-1, %eax jmp .L89 .L87: movq -48(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jle .L88 movl $1, %eax jmp .L89 .L88: movl $0, %eax .L89: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE25: .size ptripleREVcomp, .-ptripleREVcomp .globl ptripleCABcomp .type ptripleCABcomp, @function ptripleCABcomp: .LFB26: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -72(%rbp) movq %rsi, -80(%rbp) movq -72(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -64(%rbp) movq %rdx, -56(%rbp) movq 16(%rcx), %rax movq %rax, -48(%rbp) movq -80(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq 16(%rcx), %rax movq %rax, -16(%rbp) movq -48(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jge .L91 movl $-1, %eax jmp .L98 .L91: movq -48(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jle .L93 movl $1, %eax jmp .L98 .L93: movq -64(%rbp), %rdx movq -32(%rbp), %rax cmpq %rax, %rdx jge .L94 movl $-1, %eax jmp .L98 .L94: movq -64(%rbp), %rdx movq -32(%rbp), %rax cmpq %rax, %rdx jle .L95 movl $1, %eax jmp .L98 .L95: movq -56(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jge .L96 movl $-1, %eax jmp .L98 .L96: movq -56(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jle .L97 movl $1, %eax jmp .L98 .L97: movl $0, %eax .L98: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE26: .size ptripleCABcomp, .-ptripleCABcomp .globl phwrealcomp .type phwrealcomp, @function phwrealcomp: .LFB27: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movq -40(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq -48(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -16(%rbp) movq %rdx, -8(%rbp) movsd -32(%rbp), %xmm1 movsd -16(%rbp), %xmm0 comisd %xmm1, %xmm0 jbe .L114 movl $-1, %eax jmp .L109 .L114: movsd -32(%rbp), %xmm0 movsd -16(%rbp), %xmm1 comisd %xmm1, %xmm0 jbe .L115 movl $1, %eax jmp .L109 .L115: movsd -24(%rbp), %xmm1 movsd -8(%rbp), %xmm0 comisd %xmm1, %xmm0 jbe .L116 movl $-1, %eax jmp .L109 .L116: movsd -24(%rbp), %xmm0 movsd -8(%rbp), %xmm1 comisd %xmm1, %xmm0 jbe .L117 movl $1, %eax jmp .L109 .L117: movl $0, %eax .L109: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE27: .size phwrealcomp, .-phwrealcomp .globl pquadcomp .type pquadcomp, @function pquadcomp: .LFB28: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $112, %rsp movq %rdi, -104(%rbp) movq %rsi, -112(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movq -104(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -80(%rbp) movq %rdx, -72(%rbp) movq 16(%rcx), %rax movq 24(%rcx), %rdx movq %rax, -64(%rbp) movq %rdx, -56(%rbp) movq -112(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -48(%rbp) movq %rdx, -40(%rbp) movq 16(%rcx), %rax movq 24(%rcx), %rdx movq %rax, -32(%rbp) movq %rdx, -24(%rbp) leaq -48(%rbp), %rdx leaq -80(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call phwllABcomp cltq movq %rax, -96(%rbp) cmpq $0, -96(%rbp) je .L119 movq -96(%rbp), %rax jmp .L122 .L119: leaq -48(%rbp), %rax leaq 16(%rax), %rdx leaq -80(%rbp), %rax addq $16, %rax movq %rdx, %rsi movq %rax, %rdi call phwllABcomp cltq movq %rax, -88(%rbp) cmpq $0, -88(%rbp) je .L121 movq -88(%rbp), %rax jmp .L122 .L121: movl $0, %eax .L122: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L123 call __stack_chk_fail@PLT .L123: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE28: .size pquadcomp, .-pquadcomp .globl pfracomp .type pfracomp, @function pfracomp: .LFB29: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -72(%rbp) movq %rsi, -80(%rbp) movq -72(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -64(%rbp) movq %rdx, -56(%rbp) movq 16(%rcx), %rax movq %rax, -48(%rbp) movq -80(%rbp), %rcx movq (%rcx), %rax movq 8(%rcx), %rdx movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq 16(%rcx), %rax movq %rax, -16(%rbp) movq -64(%rbp), %rdx movq -24(%rbp), %rax imulq %rax, %rdx movq -56(%rbp), %rcx movq -32(%rbp), %rax imulq %rcx, %rax cmpq %rax, %rdx jge .L125 movl $-1, %eax jmp .L128 .L125: movq -64(%rbp), %rdx movq -24(%rbp), %rax imulq %rax, %rdx movq -56(%rbp), %rcx movq -32(%rbp), %rax imulq %rcx, %rax cmpq %rax, %rdx jle .L127 movl $1, %eax jmp .L128 .L127: movl $0, %eax .L128: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE29: .size pfracomp, .-pfracomp .globl isinrange .type isinrange, @function isinrange: .LFB30: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jg .L130 movq -16(%rbp), %rax cmpq -24(%rbp), %rax jg .L130 movl $1, %eax jmp .L131 .L130: movl $0, %eax .L131: andl $1, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE30: .size isinrange, .-isinrange .globl isinrange_soft .type isinrange_soft, @function isinrange_soft: .LFB31: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jg .L134 movq -16(%rbp), %rax cmpq -24(%rbp), %rax jle .L135 .L134: movq -8(%rbp), %rax cmpq -16(%rbp), %rax jl .L136 movq -16(%rbp), %rax cmpq -24(%rbp), %rax jl .L136 .L135: movl $1, %eax jmp .L137 .L136: movl $0, %eax .L137: andl $1, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE31: .size isinrange_soft, .-isinrange_soft .globl a .bss .align 32 .type a, @object .size a, 8388648 a: .zero 8388648 .globl b .align 32 .type b, @object .size b, 8388648 b: .zero 8388648 .globl c .align 32 .type c, @object .size c, 8388648 c: .zero 8388648 .globl d .align 32 .type d, @object .size d, 8388648 d: .zero 8388648 .globl e .align 32 .type e, @object .size e, 33554432 e: .zero 33554432 .globl s .align 32 .type s, @object .size s, 9060100 s: .zero 9060100 .globl t .align 32 .type t, @object .size t, 1048577 t: .zero 1048577 .globl u .align 32 .type u, @object .size u, 1048577 u: .zero 1048577 .globl xy .align 32 .type xy, @object .size xy, 33554512 xy: .zero 33554512 .globl tup .align 32 .type tup, @object .size tup, 25165944 tup: .zero 25165944 .globl gin .align 32 .type gin, @object .size gin, 16777216 gin: .zero 16777216 .globl knap .align 32 .type knap, @object .size knap, 512008 knap: .zero 512008 .globl al .align 32 .type al, @object .size al, 8388608 al: .zero 8388608 .globl bl .align 32 .type bl, @object .size bl, 8388608 bl: .zero 8388608 .section .rodata .LC1: .string "%llu%llu%llu" .LC2: .string "%llu" .LC3: .string "%lld\n" .text .globl solve .type solve, @function solve: .LFB32: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $144, %rsp movq $0, -120(%rbp) pxor %xmm0, %xmm0 movsd %xmm0, -80(%rbp) movq $0, -72(%rbp) movq $0, -64(%rbp) leaq k(%rip), %rax movq %rax, %rcx leaq m(%rip), %rax movq %rax, %rdx leaq n(%rip), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq $0, -144(%rbp) jmp .L140 .L142: movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq a(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT cmpq $0, -144(%rbp) je .L141 movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax movq (%rdx,%rax), %rax leaq -1(%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax movq %rcx, (%rdx,%rax) .L141: addq $1, -144(%rbp) .L140: movq -144(%rbp), %rdx movq n(%rip), %rax cmpq %rax, %rdx jb .L142 movq n(%rip), %rax subq $1, %rax movq %rax, -144(%rbp) jmp .L143 .L145: movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rax leaq 1(%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq %rcx, (%rdx,%rax) movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq a(%rip), %rax movq (%rdx,%rax), %rax addq %rax, %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq %rcx, (%rdx,%rax) cmpq $0, -144(%rbp) je .L144 movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax movq (%rdx,%rax), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rsi movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax movq (%rdx,%rax), %rax addq %rsi, %rcx leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq %rcx, (%rdx,%rax) movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax movq (%rdx,%rax), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rsi movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq b(%rip), %rax movq (%rdx,%rax), %rax addq %rsi, %rcx leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq %rcx, (%rdx,%rax) .L144: subq $1, -144(%rbp) .L143: cmpq $0, -144(%rbp) jns .L145 movq $0, -144(%rbp) jmp .L146 .L147: movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rdx movq -144(%rbp), %rsi movq %rsi, %rax addq %rax, %rax addq %rsi, %rax salq $3, %rax movq %rax, %rsi leaq tup(%rip), %rax movq %rcx, (%rsi,%rax) movq -144(%rbp), %rcx movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $3, %rax movq %rax, %rcx leaq 8+tup(%rip), %rax movq %rdx, (%rcx,%rax) movq -144(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rcx leaq 16+tup(%rip), %rdx movq -144(%rbp), %rax movq %rax, (%rcx,%rdx) addq $1, -144(%rbp) .L146: movq -144(%rbp), %rdx movq n(%rip), %rax cmpq %rax, %rdx jb .L147 movq n(%rip), %rax leaq pfracomp(%rip), %rdx movq %rdx, %rcx movl $24, %edx movq %rax, %rsi leaq tup(%rip), %rax movq %rax, %rdi call qsort@PLT movq $0, -144(%rbp) jmp .L148 .L153: cmpq $0, -144(%rbp) je .L149 movq k(%rip), %rax movq %rax, -112(%rbp) jmp .L150 .L149: movq $1000000000, -112(%rbp) .L150: cmpq $50, -112(%rbp) ja .L151 movq -144(%rbp), %rax leaq 0(,%rax,8), %rcx leaq al(%rip), %rdx movq -112(%rbp), %rax movq %rax, (%rcx,%rdx) movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq bl(%rip), %rax movq $0, (%rdx,%rax) jmp .L152 .L151: movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq al(%rip), %rax movq $50, (%rdx,%rax) movq -112(%rbp), %rax leaq -50(%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq bl(%rip), %rax movq %rcx, (%rdx,%rax) .L152: addq $1, -144(%rbp) .L148: movq -144(%rbp), %rdx movq n(%rip), %rax cmpq %rax, %rdx jb .L153 movq $64000, -56(%rbp) movq $0, -144(%rbp) jmp .L154 .L155: movq m(%rip), %rax leaq 1(%rax), %rcx movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq knap(%rip), %rax movq %rcx, (%rdx,%rax) addq $1, -144(%rbp) .L154: movq -144(%rbp), %rax cmpq %rax, -56(%rbp) jnb .L155 movq $0, knap(%rip) movq n(%rip), %rax subq $1, %rax movq %rax, -144(%rbp) jmp .L156 .L161: movq -144(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rdx leaq 16+tup(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -40(%rbp) movq $0, -136(%rbp) jmp .L157 .L160: movq -56(%rbp), %rax movq %rax, -128(%rbp) jmp .L158 .L159: movq -40(%rbp), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rdx movq -128(%rbp), %rax subq %rdx, %rax leaq 0(,%rax,8), %rdx leaq knap(%rip), %rax movq (%rdx,%rax), %rcx movq -40(%rbp), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rax addq %rcx, %rax movq %rax, %rcx movq -128(%rbp), %rax leaq 0(,%rax,8), %rdx leaq knap(%rip), %rax movq (%rdx,%rax), %rax movq %rcx, %rsi movq %rax, %rdi call smin movq %rax, %rcx movq -128(%rbp), %rax leaq 0(,%rax,8), %rdx leaq knap(%rip), %rax movq %rcx, (%rdx,%rax) subq $1, -128(%rbp) .L158: movq -40(%rbp), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rax cmpq %rax, -128(%rbp) jge .L159 addq $1, -136(%rbp) .L157: movq -40(%rbp), %rax leaq 0(,%rax,8), %rdx leaq al(%rip), %rax movq (%rdx,%rax), %rdx movq -136(%rbp), %rax cmpq %rax, %rdx ja .L160 subq $1, -144(%rbp) .L156: cmpq $0, -144(%rbp) jns .L161 movq $0, -120(%rbp) movq n(%rip), %rax subq $1, %rax movq %rax, -136(%rbp) movq $0, -104(%rbp) movq $0, -96(%rbp) movq $0, -88(%rbp) movq -56(%rbp), %rax movq %rax, -144(%rbp) jmp .L162 .L170: movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq knap(%rip), %rax movq (%rdx,%rax), %rdx movq m(%rip), %rax cmpq %rax, %rdx ja .L172 movq -136(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rdx leaq 16+tup(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -48(%rbp) .L169: movq -136(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rdx leaq 16+tup(%rip), %rax movq (%rdx,%rax), %rax leaq 0(,%rax,8), %rdx leaq bl(%rip), %rax movq (%rdx,%rax), %rax cmpq %rax, -104(%rbp) jne .L165 subq $1, -136(%rbp) movq $0, -104(%rbp) jmp .L166 .L165: movq -144(%rbp), %rax leaq 0(,%rax,8), %rdx leaq knap(%rip), %rax movq (%rdx,%rax), %rdx movq -96(%rbp), %rax leaq (%rdx,%rax), %rcx movq -136(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rdx leaq 16+tup(%rip), %rax movq (%rdx,%rax), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rax leaq (%rcx,%rax), %rdx movq m(%rip), %rax cmpq %rax, %rdx ja .L173 movq -136(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rdx leaq 16+tup(%rip), %rax movq (%rdx,%rax), %rax leaq 0(,%rax,8), %rdx leaq d(%rip), %rax movq (%rdx,%rax), %rax addq %rax, -96(%rbp) addq $1, -104(%rbp) movq -136(%rbp), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $3, %rax movq %rax, %rdx leaq 16+tup(%rip), %rax movq (%rdx,%rax), %rax leaq 0(,%rax,8), %rdx leaq c(%rip), %rax movq (%rdx,%rax), %rax addq %rax, -88(%rbp) .L166: jmp .L169 .L173: nop movq -144(%rbp), %rdx movq -88(%rbp), %rax addq %rax, %rdx movq -120(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call umax movq %rax, -120(%rbp) jmp .L164 .L172: nop .L164: subq $1, -144(%rbp) .L162: cmpq $0, -144(%rbp) jns .L170 movq -120(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE32: .size solve, .-solve .globl main .type main, @function main: .LFB33: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movq %rsi, -16(%rbp) movq $5, n(%rip) movq $0, m(%rip) movl $0, %eax call solve movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE33: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 return 0;\n }\n }\n printf(\"Good\");\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"Bad\"\n.LC2:\n\t.string\t\"Good\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-13(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tmovzbl\t-13(%rbp,%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-13(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L3\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L6\n.L3:\n\taddl\t$1, -20(%rbp)\n.L2:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L5\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L6:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t3(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t4(%rsp), %eax\n\tcmpb\t%al, 3(%rsp)\n\tje\t.L2\n\tmovzbl\t5(%rsp), %edx\n\tcmpb\t%dl, %al\n\tje\t.L2\n\tcmpb\t%dl, 6(%rsp)\n\tje\t.L2\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L4:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L4\n.L8:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t3(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t4(%rsp), %eax\n\tcmpb\t%al, 3(%rsp)\n\tje\t.L2\n\tmovzbl\t5(%rsp), %edx\n\tcmpb\t%dl, %al\n\tje\t.L2\n\tcmpb\t%dl, 6(%rsp)\n\tje\t.L2\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L4:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L4\n.L8:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 return 0;\n }\n }\n printf(\"Good\");\n return 0;\n}", "index": 12, "inputs": [ "333\n", "5823\n", "7702\n", "446\n", "12101\n", "4736\n", "6783\n", "12904\n", "24106\n", "8244\n", "9217\n", "5243\n", "199\n", "4960\n", "2178\n", "6416\n", "9215\n", "7196\n", "16798\n", "29052\n", "11746\n", "1923\n", "8183\n", "5267\n", "1159\n", "3050\n", "10674\n", "25859\n", "8614\n", "3773\n", "1229\n", "10429\n", "1909\n", "7149\n", "30761\n", "13574\n", "3734\n", "2220\n", "16185\n", "2680\n", "5378\n", "18986\n", "22385\n", "1447\n", "110\n", "7113\n", "5207\n", "14072\n", "1722\n", "100\n", "3075\n", "4527\n", "23503\n", "2764\n", "000\n", "6145\n", "4487\n", "11384\n", "4102\n", "5825\n", "7912\n", "3116\n", "6023\n", "12253\n", "3291\n", "9145\n", "3415\n", "1979\n", "2069\n", "1430\n", "9991\n", "6502\n", "44\n", "15205\n", "1152\n", "2358\n", "8243\n", "7360\n", "15164\n", "36905\n", "5970\n", "4661\n", "5552\n", "2472\n", "3931\n", "10665\n", "7694\n", "1281\n", "20193\n", "47440\n", "21563\n", "2887\n", "13917\n", "3290\n", "1344\n", "2155\n", "13296\n", "12590\n", "4207\n", "377\n", "0024\n", "1333\n", "3776\n", "3776\n", "8080\n" ], "outputs": [ "Bad", "Good", "Bad", "Bad", "Good", "Good", "Good", "Good", "Good", "Bad", "Good", "Good", "Bad", "Good", "Good", "Good", "Good", "Good", "Good", "Good", "Bad", "Good", "Good", "Good", "Bad", "Good", "Good", "Good", "Good", "Bad", "Bad", "Good", "Good", "Good", "Good", "Good", "Good", "Bad", "Good", "Good", "Good", "Good", "Bad", "Bad", "Bad", "Bad", "Good", "Good", "Bad", "Bad", "Good", "Good", "Good", "Good", "Bad", "Good", "Bad", "Bad", "Good", "Good", "Good", "Bad", "Good", "Bad", "Good", "Good", "Good", "Good", "Good", "Good", "Bad", "Good", "Bad", "Good", "Bad", "Good", "Good", "Good", "Good", "Good", "Good", "Bad", "Bad", "Good", "Good", "Bad", "Good", "Good", "Good", "Bad", "Good", "Bad", "Good", "Good", "Bad", "Bad", "Good", "Good", "Good", "Bad", "Bad", "Bad", "Bad", "Bad", "Good" ], "question": "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 return 0;\n }\n }\n printf(\"Good\");\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"Bad\"\n.LC2:\n\t.string\t\"Good\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-13(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tmovzbl\t-13(%rbp,%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-13(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L3\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L6\n.L3:\n\taddl\t$1, -20(%rbp)\n.L2:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L5\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L6:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; } } printf("Good"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "Bad" .LC2: .string "Good" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -13(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -20(%rbp) jmp .L2 .L5: movl -20(%rbp), %eax cltq movzbl -13(%rbp,%rax), %edx movl -20(%rbp), %eax addl $1, %eax cltq movzbl -13(%rbp,%rax), %eax cmpb %al, %dl jne .L3 leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L6 .L3: addl $1, -20(%rbp) .L2: cmpl $2, -20(%rbp) jle .L5 leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L6: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L7 call __stack_chk_fail@PLT .L7: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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\tint j, k, l, dp[2][101][301] = {};\n\tfor (i = 1; i <= N; i++) {\n\t\tl = w[i] - w[1];\n\t\tfor (j = l; j <= i * 3; j++) {\n\t\t\tfor (k = 0; k < i; k++) if (dp[0][k][j-l] + v[i] > dp[1][k+1][j]) dp[1][k+1][j] = dp[0][k][j-l] + v[i];\n\t\t}\n\t\tfor (j = 0; j <= i * 3; j++) {\n\t\t\tfor (k = 0; k <= i; k++) dp[0][k][j] = dp[1][k][j];\n\t\t}\n\t}\n\t\n\tint max = 0;\n\tfor (k = 0; k <= 100 && w[1] * k <= W; k++) {\n\t\tfor (j = 0; j <= k * 3 && w[1] * k + j <= W; j++) if (dp[0][k][j] > max) max = dp[0][k][j];\n\t}\n\tprintf(\"%d\\n\", max);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-241664(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2416, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-244072(%rbp), %rdx\n\tleaq\t-244076(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -244068(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-243632(%rbp), %rdx\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tleaq\t-244048(%rbp), %rcx\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -244068(%rbp)\n.L2:\n\tmovl\t-244076(%rbp), %eax\n\tcmpl\t%eax, -244068(%rbp)\n\tjle\t.L3\n\tleaq\t-243216(%rbp), %rax\n\tmovl\t$243208, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$1, -244068(%rbp)\n\tjmp\t.L4\n.L14:\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tmovl\t-244048(%rbp,%rax,4), %eax\n\tmovl\t-244044(%rbp), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -244052(%rbp)\n\tmovl\t-244052(%rbp), %eax\n\tmovl\t%eax, -244064(%rbp)\n\tjmp\t.L5\n.L9:\n\tmovl\t$0, -244060(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-244064(%rbp), %eax\n\tsubl\t-244052(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %edx\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tmovl\t-243632(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-244060(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$301, %rax, %rax\n\taddq\t%rsi, %rax\n\taddq\t$30401, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L7\n\tmovl\t-244064(%rbp), %eax\n\tsubl\t-244052(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %esi\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tmovl\t-243632(%rbp,%rax,4), %edx\n\tmovl\t-244060(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\taddl\t%esi, %edx\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$301, %rax, %rax\n\taddq\t%rsi, %rax\n\taddq\t$30401, %rax\n\tmovl\t%edx, -243216(%rbp,%rax,4)\n.L7:\n\taddl\t$1, -244060(%rbp)\n.L6:\n\tmovl\t-244060(%rbp), %eax\n\tcmpl\t-244068(%rbp), %eax\n\tjl\t.L8\n\taddl\t$1, -244064(%rbp)\n.L5:\n\tmovl\t-244068(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -244064(%rbp)\n\tjle\t.L9\n\tmovl\t$0, -244064(%rbp)\n\tjmp\t.L10\n.L13:\n\tmovl\t$0, -244060(%rbp)\n\tjmp\t.L11\n.L12:\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t$30401, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tmovl\t-244064(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovl\t-244060(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\timulq\t$301, %rdx, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t%eax, -243216(%rbp,%rdx,4)\n\taddl\t$1, -244060(%rbp)\n.L11:\n\tmovl\t-244060(%rbp), %eax\n\tcmpl\t-244068(%rbp), %eax\n\tjle\t.L12\n\taddl\t$1, -244064(%rbp)\n.L10:\n\tmovl\t-244068(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -244064(%rbp)\n\tjle\t.L13\n\taddl\t$1, -244068(%rbp)\n.L4:\n\tmovl\t-244076(%rbp), %eax\n\tcmpl\t%eax, -244068(%rbp)\n\tjle\t.L14\n\tmovl\t$0, -244056(%rbp)\n\tmovl\t$0, -244060(%rbp)\n\tjmp\t.L15\n.L21:\n\tmovl\t$0, -244064(%rbp)\n\tjmp\t.L16\n.L19:\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tcmpl\t%eax, -244056(%rbp)\n\tjge\t.L17\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tmovl\t%eax, -244056(%rbp)\n.L17:\n\taddl\t$1, -244064(%rbp)\n.L16:\n\tmovl\t-244060(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -244064(%rbp)\n\tjg\t.L18\n\tmovl\t-244044(%rbp), %eax\n\timull\t-244060(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-244064(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-244072(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L19\n.L18:\n\taddl\t$1, -244060(%rbp)\n.L15:\n\tcmpl\t$100, -244060(%rbp)\n\tjg\t.L20\n\tmovl\t-244044(%rbp), %eax\n\timull\t-244060(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-244072(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L21\n.L20:\n\tmovl\t-244056(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L23\n\tcall\t__stack_chk_fail@PLT\n.L23:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-241664(%rsp), %r11\n\t.cfi_def_cfa 11, 241720\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2488, %rsp\n\t.cfi_def_cfa_offset 244208\n\tleaq\t.LC0(%rip), %r13\n\tmovq\t%r13, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 244136(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t92(%rsp), %rdx\n\tleaq\t88(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t88(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\tleaq\t96(%rsp), %r15\n\tmovl\t$4, %ebx\n\tmovl\t$1, %ebp\n\tleaq\t512(%rsp), %r14\n\tmovq\t%r15, 48(%rsp)\n\tmovq\t%r14, 56(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tleaq\t(%r14,%rbx), %rdx\n\tleaq\t(%r15,%rbx), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t88(%rsp), %r12d\n\taddl\t$1, %ebp\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %r12d\n\tjge\t.L3\n\tleaq\t928(%rsp), %rax\n\tmovl\t$243208, %edx\n\txorl\t%esi, %esi\n\tmovq\t%rax, %rdi\n\tmovq\t%rax, 16(%rsp)\n\tcall\tmemset@PLT\n\tmovl\t100(%rsp), %eax\n\tmovl\t%eax, 28(%rsp)\n\ttestl\t%r12d, %r12d\n\tjle\t.L49\n\tleal\t2(%r12), %eax\n\tmovl\t$30702, %edx\n\tmovl\t$1204, %edi\n\tmovq\t$0, 8(%rsp)\n\tmovq\t%rax, 40(%rsp)\n\tleaq\t122532(%rsp), %rax\n\tmovl\t$4, %r10d\n\tmovl\t$3, %r11d\n\tmovq\t%rax, 32(%rsp)\n\tleaq\t2132(%rsp), %rax\n\tmovl\t$2, %r9d\n\tmovq\t%rax, 72(%rsp)\n\tmovslq\t28(%rsp), %rax\n\tsubq\t%rax, %rdx\n\tmovq\t%rdx, 64(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tmovq\t48(%rsp), %rax\n\tmovslq\t-4(%rax,%r9,4), %rax\n\tmovl\t%eax, %r8d\n\tsubl\t28(%rsp), %r8d\n\tcmpl\t%r11d, %r8d\n\tjg\t.L11\n\tmovq\t56(%rsp), %rbx\n\tmovl\t%r11d, %edx\n\tleal\t1(%r11), %r12d\n\tsubl\t%r8d, %edx\n\tsubl\t%r8d, %r12d\n\tmovl\t-4(%rbx,%r9,4), %ebx\n\tcmpl\t$2, %edx\n\tjbe\t.L26\n\tmovq\t16(%rsp), %rdx\n\tmovl\t%r12d, %ebp\n\taddq\t64(%rsp), %rax\n\tmovd\t%ebx, %xmm6\n\tshrl\t$2, %ebp\n\tpshufd\t$0, %xmm6, %xmm2\n\tleaq\t(%rdx,%rax,4), %rcx\n\tsalq\t$4, %rbp\n\taddq\t%rdx, %rbp\n\tmovq\t%rcx, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovdqu\t(%rdx,%rax), %xmm1\n\tmovdqu\t(%rcx,%rax), %xmm4\n\tpaddd\t%xmm2, %xmm1\n\tmovdqa\t%xmm1, %xmm0\n\tpcmpgtd\t%xmm4, %xmm0\n\tpand\t%xmm0, %xmm1\n\tpandn\t%xmm4, %xmm0\n\tpor\t%xmm1, %xmm0\n\tmovups\t%xmm0, (%rsi,%rax)\n\taddq\t$1204, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L8\n\taddq\t$16, %rdx\n\taddq\t$16, %rcx\n\taddq\t$16, %rsi\n\tcmpq\t%rbp, %rdx\n\tjne\t.L9\n\tmovl\t%r12d, %eax\n\tandl\t$-4, %eax\n\tleal\t(%rax,%r8), %r14d\n\tcmpl\t%eax, %r12d\n\tje\t.L11\n.L7:\n\tmovq\t8(%rsp), %rax\n\tmovslq\t%r14d, %rbp\n\tmovq\t72(%rsp), %rsi\n\tmovslq\t%r8d, %r8\n\tmovq\t%rbp, %r12\n\tsubl\t%ebp, %r14d\n\taddq\t%rbp, %rax\n\tsubq\t%r8, %r12\n\tleaq\t(%rsi,%rax,4), %rsi\n\tmovq\t16(%rsp), %rax\n\tleaq\t(%rax,%rbp,4), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\t%r12, %r8\n\tmovq\t%r13, %rax\n\tsubq\t%rbp, %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t(%rax,%r8,4), %edx\n\tmovl\t122808(%rax), %ecx\n\taddl\t%ebx, %edx\n\tcmpl\t%ecx, %edx\n\tcmovl\t%ecx, %edx\n\taddq\t$1204, %rax\n\tmovl\t%edx, 121604(%rax)\n\tcmpq\t%rsi, %rax\n\tjne\t.L13\n\taddq\t$1, %rbp\n\taddq\t$4, %rsi\n\taddq\t$4, %r13\n\taddq\t$1, %r12\n\tleal\t(%r14,%rbp), %eax\n\tcmpl\t%r11d, %eax\n\tjle\t.L14\n.L11:\n\tmovl\t%r10d, %esi\n\tmovl\t%r10d, %ebx\n\tmovl\t%r10d, %r13d\n\tmovq\t32(%rsp), %rdx\n\tshrl\t$2, %esi\n\tandl\t$-4, %ebx\n\tandl\t$3, %r13d\n\txorl\t%r8d, %r8d\n\tsalq\t$4, %rsi\n\tleal\t1(%rbx), %ebp\n\tleal\t2(%rbx), %r12d\n\tmovslq\t%ebx, %r15\n\tmovq\t%rsi, (%rsp)\n\tleal\t-1(%r13), %r14d\n\tmovslq\t%ebp, %rbp\n\tmovslq\t%r12d, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t(%rsp), %rsi\n\tleaq\t-121604(%rdx), %rcx\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovdqu\t(%rdx,%rax), %xmm3\n\tmovups\t%xmm3, (%rcx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rsi, %rax\n\tjne\t.L17\n\tmovq\t%rsi, (%rsp)\n\tcmpl\t%r10d, %ebx\n\tje\t.L16\n\tmovslq\t%r8d, %rax\n\timulq\t$301, %rax, %rax\n\tleaq\t(%rax,%r15), %rcx\n\tmovl\t122532(%rsp,%rcx,4), %esi\n\tmovl\t%esi, 928(%rsp,%rcx,4)\n\ttestl\t%r14d, %r14d\n\tje\t.L16\n\tleaq\t(%rax,%rbp), %rcx\n\tmovl\t122532(%rsp,%rcx,4), %esi\n\tmovl\t%esi, 928(%rsp,%rcx,4)\n\tcmpl\t$2, %r13d\n\tje\t.L16\n\taddq\t%r12, %rax\n\tmovl\t122532(%rsp,%rax,4), %ecx\n\tmovl\t%ecx, 928(%rsp,%rax,4)\n.L16:\n\taddl\t$1, %r8d\n\taddq\t$1204, %rdx\n\tcmpl\t%r9d, %r8d\n\tjne\t.L6\n\taddq\t$1, %r9\n\taddl\t$3, %r11d\n\taddl\t$3, %r10d\n\taddq\t$301, 8(%rsp)\n\taddq\t$1204, %rdi\n\tcmpq\t40(%rsp), %r9\n\tjne\t.L20\n.L4:\n\tmovl\t28(%rsp), %ebx\n\tmovl\t92(%rsp), %r8d\n\txorl\t%edi, %edi\n\txorl\t%r9d, %r9d\n\tmovq\t16(%rsp), %r10\n\tmovq\t32(%rsp), %rbp\n\txorl\t%edx, %edx\n\tleal\t3(%rbx), %r11d\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tcmpl\t%r8d, %r9d\n\tjg\t.L24\n\tmovl\t%r9d, %eax\n\tmovq\t%r10, %rcx\n\tjmp\t.L23\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\taddl\t$1, %eax\n\taddq\t$4, %rcx\n\tcmpl\t%eax, %r8d\n\tjl\t.L22\n.L23:\n\tmovl\t(%rcx), %esi\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\tcmpl\t%edi, %eax\n\tjne\t.L51\n.L22:\n\taddq\t$1204, %r10\n\taddl\t%ebx, %r9d\n\taddl\t%r11d, %edi\n\tcmpq\t%r10, %rbp\n\tjne\t.L21\n.L24:\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t244136(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L52\n\taddq\t$244152, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L26:\n\t.cfi_restore_state\n\tmovl\t%r8d, %r14d\n\tjmp\t.L7\n.L2:\n\tleaq\t928(%rsp), %rax\n\tmovl\t$243208, %edx\n\txorl\t%esi, %esi\n\tmovq\t%rax, %rdi\n\tmovq\t%rax, 16(%rsp)\n\tcall\tmemset@PLT\n\tmovl\t100(%rsp), %eax\n\tmovl\t%eax, 28(%rsp)\n.L49:\n\tleaq\t122532(%rsp), %rax\n\tmovq\t%rax, 32(%rsp)\n\tjmp\t.L4\n.L52:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-241664(%rsp), %r11\n\t.cfi_def_cfa 11, 241720\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2488, %rsp\n\t.cfi_def_cfa_offset 244208\n\tleaq\t.LC0(%rip), %r13\n\tmovq\t%r13, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 244136(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t92(%rsp), %rdx\n\tleaq\t88(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t88(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\tleaq\t96(%rsp), %r15\n\tmovl\t$4, %ebx\n\tmovl\t$1, %ebp\n\tleaq\t512(%rsp), %r14\n\tmovq\t%r15, 48(%rsp)\n\tmovq\t%r14, 56(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tleaq\t(%r14,%rbx), %rdx\n\tleaq\t(%r15,%rbx), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t88(%rsp), %r12d\n\taddl\t$1, %ebp\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %r12d\n\tjge\t.L3\n\tleaq\t928(%rsp), %rax\n\tmovl\t$243208, %edx\n\txorl\t%esi, %esi\n\tmovq\t%rax, %rdi\n\tmovq\t%rax, 16(%rsp)\n\tcall\tmemset@PLT\n\tmovl\t100(%rsp), %eax\n\tmovl\t%eax, 28(%rsp)\n\ttestl\t%r12d, %r12d\n\tjle\t.L49\n\tleal\t2(%r12), %eax\n\tmovl\t$30702, %edx\n\tmovl\t$1204, %edi\n\tmovq\t$0, 8(%rsp)\n\tmovq\t%rax, 40(%rsp)\n\tleaq\t122532(%rsp), %rax\n\tmovl\t$4, %r10d\n\tmovl\t$3, %r11d\n\tmovq\t%rax, 32(%rsp)\n\tleaq\t2132(%rsp), %rax\n\tmovl\t$2, %r9d\n\tmovq\t%rax, 72(%rsp)\n\tmovslq\t28(%rsp), %rax\n\tsubq\t%rax, %rdx\n\tmovq\t%rdx, 64(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tmovq\t48(%rsp), %rax\n\tmovslq\t-4(%rax,%r9,4), %rax\n\tmovl\t%eax, %r8d\n\tsubl\t28(%rsp), %r8d\n\tcmpl\t%r11d, %r8d\n\tjg\t.L11\n\tmovq\t56(%rsp), %rbx\n\tmovl\t%r11d, %edx\n\tleal\t1(%r11), %r12d\n\tsubl\t%r8d, %edx\n\tsubl\t%r8d, %r12d\n\tmovl\t-4(%rbx,%r9,4), %ebx\n\tcmpl\t$2, %edx\n\tjbe\t.L26\n\tmovq\t16(%rsp), %rdx\n\tmovl\t%r12d, %ebp\n\taddq\t64(%rsp), %rax\n\tmovd\t%ebx, %xmm6\n\tshrl\t$2, %ebp\n\tpshufd\t$0, %xmm6, %xmm2\n\tleaq\t(%rdx,%rax,4), %rcx\n\tsalq\t$4, %rbp\n\taddq\t%rdx, %rbp\n\tmovq\t%rcx, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovdqu\t(%rdx,%rax), %xmm1\n\tmovdqu\t(%rcx,%rax), %xmm4\n\tpaddd\t%xmm2, %xmm1\n\tmovdqa\t%xmm1, %xmm0\n\tpcmpgtd\t%xmm4, %xmm0\n\tpand\t%xmm0, %xmm1\n\tpandn\t%xmm4, %xmm0\n\tpor\t%xmm1, %xmm0\n\tmovups\t%xmm0, (%rsi,%rax)\n\taddq\t$1204, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L8\n\taddq\t$16, %rdx\n\taddq\t$16, %rcx\n\taddq\t$16, %rsi\n\tcmpq\t%rbp, %rdx\n\tjne\t.L9\n\tmovl\t%r12d, %eax\n\tandl\t$-4, %eax\n\tleal\t(%rax,%r8), %r14d\n\tcmpl\t%eax, %r12d\n\tje\t.L11\n.L7:\n\tmovq\t8(%rsp), %rax\n\tmovslq\t%r14d, %rbp\n\tmovq\t72(%rsp), %rsi\n\tmovslq\t%r8d, %r8\n\tmovq\t%rbp, %r12\n\tsubl\t%ebp, %r14d\n\taddq\t%rbp, %rax\n\tsubq\t%r8, %r12\n\tleaq\t(%rsi,%rax,4), %rsi\n\tmovq\t16(%rsp), %rax\n\tleaq\t(%rax,%rbp,4), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\t%r12, %r8\n\tmovq\t%r13, %rax\n\tsubq\t%rbp, %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t(%rax,%r8,4), %edx\n\tmovl\t122808(%rax), %ecx\n\taddl\t%ebx, %edx\n\tcmpl\t%ecx, %edx\n\tcmovl\t%ecx, %edx\n\taddq\t$1204, %rax\n\tmovl\t%edx, 121604(%rax)\n\tcmpq\t%rsi, %rax\n\tjne\t.L13\n\taddq\t$1, %rbp\n\taddq\t$4, %rsi\n\taddq\t$4, %r13\n\taddq\t$1, %r12\n\tleal\t(%r14,%rbp), %eax\n\tcmpl\t%r11d, %eax\n\tjle\t.L14\n.L11:\n\tmovl\t%r10d, %esi\n\tmovl\t%r10d, %ebx\n\tmovl\t%r10d, %r13d\n\tmovq\t32(%rsp), %rdx\n\tshrl\t$2, %esi\n\tandl\t$-4, %ebx\n\tandl\t$3, %r13d\n\txorl\t%r8d, %r8d\n\tsalq\t$4, %rsi\n\tleal\t1(%rbx), %ebp\n\tleal\t2(%rbx), %r12d\n\tmovslq\t%ebx, %r15\n\tmovq\t%rsi, (%rsp)\n\tleal\t-1(%r13), %r14d\n\tmovslq\t%ebp, %rbp\n\tmovslq\t%r12d, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t(%rsp), %rsi\n\tleaq\t-121604(%rdx), %rcx\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovdqu\t(%rdx,%rax), %xmm3\n\tmovups\t%xmm3, (%rcx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rsi, %rax\n\tjne\t.L17\n\tmovq\t%rsi, (%rsp)\n\tcmpl\t%r10d, %ebx\n\tje\t.L16\n\tmovslq\t%r8d, %rax\n\timulq\t$301, %rax, %rax\n\tleaq\t(%rax,%r15), %rcx\n\tmovl\t122532(%rsp,%rcx,4), %esi\n\tmovl\t%esi, 928(%rsp,%rcx,4)\n\ttestl\t%r14d, %r14d\n\tje\t.L16\n\tleaq\t(%rax,%rbp), %rcx\n\tmovl\t122532(%rsp,%rcx,4), %esi\n\tmovl\t%esi, 928(%rsp,%rcx,4)\n\tcmpl\t$2, %r13d\n\tje\t.L16\n\taddq\t%r12, %rax\n\tmovl\t122532(%rsp,%rax,4), %ecx\n\tmovl\t%ecx, 928(%rsp,%rax,4)\n.L16:\n\taddl\t$1, %r8d\n\taddq\t$1204, %rdx\n\tcmpl\t%r9d, %r8d\n\tjne\t.L6\n\taddq\t$1, %r9\n\taddl\t$3, %r11d\n\taddl\t$3, %r10d\n\taddq\t$301, 8(%rsp)\n\taddq\t$1204, %rdi\n\tcmpq\t40(%rsp), %r9\n\tjne\t.L20\n.L4:\n\tmovl\t28(%rsp), %ebx\n\tmovl\t92(%rsp), %r8d\n\txorl\t%edi, %edi\n\txorl\t%r9d, %r9d\n\tmovq\t16(%rsp), %r10\n\tmovq\t32(%rsp), %rbp\n\txorl\t%edx, %edx\n\tleal\t3(%rbx), %r11d\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tcmpl\t%r8d, %r9d\n\tjg\t.L24\n\tmovl\t%r9d, %eax\n\tmovq\t%r10, %rcx\n\tjmp\t.L23\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\taddl\t$1, %eax\n\taddq\t$4, %rcx\n\tcmpl\t%eax, %r8d\n\tjl\t.L22\n.L23:\n\tmovl\t(%rcx), %esi\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\tcmpl\t%edi, %eax\n\tjne\t.L51\n.L22:\n\taddq\t$1204, %r10\n\taddl\t%ebx, %r9d\n\taddl\t%r11d, %edi\n\tcmpq\t%r10, %rbp\n\tjne\t.L21\n.L24:\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t244136(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L52\n\taddq\t$244152, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L26:\n\t.cfi_restore_state\n\tmovl\t%r8d, %r14d\n\tjmp\t.L7\n.L2:\n\tleaq\t928(%rsp), %rax\n\tmovl\t$243208, %edx\n\txorl\t%esi, %esi\n\tmovq\t%rax, %rdi\n\tmovq\t%rax, 16(%rsp)\n\tcall\tmemset@PLT\n\tmovl\t100(%rsp), %eax\n\tmovl\t%eax, 28(%rsp)\n.L49:\n\tleaq\t122532(%rsp), %rax\n\tmovq\t%rax, 32(%rsp)\n\tjmp\t.L4\n.L52:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\tint j, k, l, dp[2][101][301] = {};\n\tfor (i = 1; i <= N; i++) {\n\t\tl = w[i] - w[1];\n\t\tfor (j = l; j <= i * 3; j++) {\n\t\t\tfor (k = 0; k < i; k++) if (dp[0][k][j-l] + v[i] > dp[1][k+1][j]) dp[1][k+1][j] = dp[0][k][j-l] + v[i];\n\t\t}\n\t\tfor (j = 0; j <= i * 3; j++) {\n\t\t\tfor (k = 0; k <= i; k++) dp[0][k][j] = dp[1][k][j];\n\t\t}\n\t}\n\t\n\tint max = 0;\n\tfor (k = 0; k <= 100 && w[1] * k <= W; k++) {\n\t\tfor (j = 0; j <= k * 3 && w[1] * k + j <= W; j++) if (dp[0][k][j] > max) max = dp[0][k][j];\n\t}\n\tprintf(\"%d\\n\", max);\n\tfflush(stdout);\n\treturn 0;\n}", "index": 4, "inputs": [ "4 10\n1 100\n2 100\n1 100\n1 100\n", "4 1\n10 100\n10 100\n10 101\n10 100\n", "4 6\n2 1\n3 6\n4 10\n3 4\n", "4 10\n1 000\n1 100\n1 100\n1 100\n", "4 6\n2 1\n3 7\n4 10\n3 9\n", "4 12\n2 1\n3 4\n4 10\n3 4\n", "4 6\n2 1\n3 6\n4 8\n3 4\n", "4 6\n2 1\n3 6\n4 10\n3 9\n", "4 10\n1 100\n4 100\n1 101\n1 100\n", "4 6\n2 1\n3 6\n2 8\n3 4\n", "4 10\n1 100\n4 110\n1 101\n1 100\n", "4 10\n1 100\n4 110\n1 111\n1 100\n", "4 10\n1 100\n4 111\n1 111\n1 100\n", "4 6\n2 1\n3 8\n2 8\n2 8\n", "4 10\n1 100\n4 111\n1 111\n1 101\n", "4 2\n2 1\n3 8\n2 8\n2 8\n", "4 3\n2 1\n3 7\n4 10\n3 6\n", "4 10\n1 100\n4 110\n1 100\n1 100\n", "4 6\n2 1\n3 6\n4 8\n3 6\n", "4 9\n2 1\n3 4\n4 10\n2 4\n", "4 6\n2 1\n3 1\n2 8\n3 1\n", "4 6\n2 1\n3 12\n2 8\n3 4\n", "4 2\n1 100\n1 110\n1 111\n1 100\n", "4 6\n2 1\n3 14\n2 6\n3 8\n", "4 3\n2 0\n3 13\n4 10\n3 6\n", "4 13\n0 000\n1 000\n1 100\n1 100\n", "4 17\n0 100\n2 001\n1 100\n2 100\n", "4 1\n1 100\n1 101\n1 111\n1 101\n", "4 15\n0 100\n2 110\n2 100\n1 110\n", "4 1\n1 100\n1 100\n1 110\n1 100\n", "4 6\n2 1\n3 8\n2 13\n3 4\n", "4 10\n1 100\n4 101\n1 111\n1 100\n", "4 10\n0 000\n1 100\n1 110\n1 100\n", "4 10\n1 100\n1 110\n1 011\n1 100\n", "4 9\n2 1\n3 14\n2 6\n3 8\n", "4 6\n2 1\n3 2\n2 2\n3 1\n", "4 13\n0 000\n1 000\n1 100\n1 110\n", "4 13\n0 000\n1 100\n1 101\n1 000\n", "4 1\n1 100\n1 101\n1 011\n1 101\n", "4 13\n0 101\n1 100\n1 101\n1 100\n", "4 1\n1 100\n1 100\n1 010\n1 100\n", "4 6\n2 1\n3 16\n2 8\n4 2\n", "4 10\n1 100\n1 110\n1 001\n1 100\n", "4 9\n2 1\n3 17\n2 6\n3 8\n", "4 6\n2 1\n3 2\n2 4\n3 1\n", "4 13\n0 000\n1 100\n1 111\n1 000\n", "4 13\n0 101\n1 000\n1 101\n1 100\n", "4 15\n0 100\n0 110\n2 000\n2 110\n", "4 10\n0 111\n2 101\n1 100\n2 101\n", "4 1\n1 1\n3 6\n4 12\n3 4\n", "4 10\n0 111\n2 101\n1 100\n2 001\n", "4 28\n0 100\n2 011\n1 100\n2 111\n", "4 1\n0 001\n0 100\n1 111\n1 101\n", "4 9\n0 000\n0 101\n0 001\n0 100\n", "4 10\n0 111\n2 101\n1 100\n2 011\n", "4 3\n0 111\n2 101\n1 100\n2 011\n", "4 15\n0 011\n1 100\n0 001\n1 110\n", "4 15\n0 110\n1 101\n0 111\n1 110\n", "4 15\n0 100\n2 110\n2 110\n2 110\n", "4 6\n2 1\n3 3\n2 2\n3 1\n", "4 6\n2 1\n3 0\n2 9\n3 16\n", "4 13\n0 101\n1 001\n1 101\n0 000\n", "4 11\n2 -1\n5 6\n4 7\n3 22\n", "4 15\n0 011\n1 100\n0 110\n1 110\n", "4 13\n0 101\n1 101\n1 100\n0 101\n", "4 3\n0 111\n2 001\n1 101\n2 011\n", "4 15\n0 110\n1 100\n0 111\n1 110\n", "4 15\n0 000\n2 110\n2 110\n1 110\n", "4 2\n2 1\n3 3\n2 2\n3 1\n", "4 6\n2 1\n3 0\n2 7\n3 16\n", "4 0\n1 100\n1 100\n1 100\n1 100\n", "4 2\n10 100\n10 100\n10 100\n10 100\n", "4 10\n1 100\n4 100\n1 100\n1 100\n", "4 1\n10 100\n10 000\n10 101\n10 100\n", "4 0\n1 100\n1 100\n1 110\n1 100\n", "4 2\n10 110\n10 100\n10 100\n10 100\n", "4 1\n10 100\n10 000\n10 001\n10 100\n", "4 6\n2 0\n3 6\n4 10\n3 9\n", "4 0\n1 100\n1 100\n1 111\n1 100\n", "4 1\n10 100\n10 010\n10 001\n10 100\n", "4 6\n2 1\n3 8\n2 8\n3 4\n", "4 0\n1 100\n1 100\n1 101\n1 100\n", "4 6\n2 1\n3 8\n2 8\n3 8\n", "4 0\n1 100\n1 100\n1 001\n1 100\n", "4 10\n0 100\n1 100\n1 100\n1 100\n", "4 0\n10 100\n10 100\n10 100\n10 100\n", "4 9\n2 1\n3 4\n4 10\n3 4\n", "4 10\n0 100\n2 100\n1 100\n1 100\n", "4 10\n0 000\n1 100\n1 100\n1 100\n", "4 6\n2 1\n3 7\n4 10\n3 4\n", "4 0\n10 100\n10 000\n10 101\n10 100\n", "4 6\n2 1\n3 6\n4 8\n3 9\n", "4 0\n1 100\n1 100\n1 010\n1 100\n", "4 2\n10 110\n10 100\n10 101\n10 100\n", "4 10\n1 100\n4 100\n2 101\n1 100\n", "4 1\n10 100\n10 000\n10 011\n10 100\n", "4 6\n2 1\n3 1\n2 8\n3 4\n", "4 6\n2 0\n5 6\n4 10\n3 9\n", "4 0\n1 100\n1 100\n1 111\n1 101\n", "4 6\n2 1\n3 8\n2 8\n4 4\n", "4 6\n2 1\n3 4\n4 10\n3 4\n", "4 10\n1 100\n1 100\n1 100\n1 100\n", "4 6\n2 1\n3 4\n4 10\n3 4\n", "4 6\n2 1\n3 7\n4 10\n3 6\n", "4 1\n10 100\n10 100\n10 100\n10 100\n" ], "outputs": [ "400\n", "0\n", "11\n", "300\n", "16\n", "19\n", "10\n", "15\n", "401\n", "14\n", "411\n", "421\n", "422\n", "17\n", "423\n", "8\n", "7\n", "410\n", "12\n", "18\n", "9\n", "20\n", "221\n", "22\n", "13\n", "200\n", "301\n", "111\n", "420\n", "110\n", "21\n", "412\n", "310\n", "321\n", "28\n", "4\n", "210\n", "201\n", "101\n", "402\n", "100\n", "24\n", "311\n", "31\n", "6\n", "211\n", "302\n", "320\n", "413\n", "1\n", "313\n", "322\n", "212\n", "202\n", "323\n", "312\n", "222\n", "432\n", "430\n", "5\n", "25\n", "203\n", "29\n", "331\n", "403\n", "223\n", "431\n", "330\n", "2\n", "23\n", "0\n", "0\n", "400\n", "0\n", "0\n", "0\n", "0\n", "15\n", "0\n", "0\n", "16\n", "0\n", "16\n", "0\n", "400\n", "0\n", "15\n", "400\n", "300\n", "11\n", "0\n", "15\n", "0\n", "0\n", "401\n", "0\n", "12\n", "10\n", "0\n", "16\n", "11\n", "400\n", "11\n", "13\n", "0\n" ], "question": "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\tint j, k, l, dp[2][101][301] = {};\n\tfor (i = 1; i <= N; i++) {\n\t\tl = w[i] - w[1];\n\t\tfor (j = l; j <= i * 3; j++) {\n\t\t\tfor (k = 0; k < i; k++) if (dp[0][k][j-l] + v[i] > dp[1][k+1][j]) dp[1][k+1][j] = dp[0][k][j-l] + v[i];\n\t\t}\n\t\tfor (j = 0; j <= i * 3; j++) {\n\t\t\tfor (k = 0; k <= i; k++) dp[0][k][j] = dp[1][k][j];\n\t\t}\n\t}\n\t\n\tint max = 0;\n\tfor (k = 0; k <= 100 && w[1] * k <= W; k++) {\n\t\tfor (j = 0; j <= k * 3 && w[1] * k + j <= W; j++) if (dp[0][k][j] > max) max = dp[0][k][j];\n\t}\n\tprintf(\"%d\\n\", max);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-241664(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2416, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-244072(%rbp), %rdx\n\tleaq\t-244076(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -244068(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-243632(%rbp), %rdx\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tleaq\t-244048(%rbp), %rcx\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -244068(%rbp)\n.L2:\n\tmovl\t-244076(%rbp), %eax\n\tcmpl\t%eax, -244068(%rbp)\n\tjle\t.L3\n\tleaq\t-243216(%rbp), %rax\n\tmovl\t$243208, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$1, -244068(%rbp)\n\tjmp\t.L4\n.L14:\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tmovl\t-244048(%rbp,%rax,4), %eax\n\tmovl\t-244044(%rbp), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -244052(%rbp)\n\tmovl\t-244052(%rbp), %eax\n\tmovl\t%eax, -244064(%rbp)\n\tjmp\t.L5\n.L9:\n\tmovl\t$0, -244060(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-244064(%rbp), %eax\n\tsubl\t-244052(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %edx\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tmovl\t-243632(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-244060(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$301, %rax, %rax\n\taddq\t%rsi, %rax\n\taddq\t$30401, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L7\n\tmovl\t-244064(%rbp), %eax\n\tsubl\t-244052(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %esi\n\tmovl\t-244068(%rbp), %eax\n\tcltq\n\tmovl\t-243632(%rbp,%rax,4), %edx\n\tmovl\t-244060(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\taddl\t%esi, %edx\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$301, %rax, %rax\n\taddq\t%rsi, %rax\n\taddq\t$30401, %rax\n\tmovl\t%edx, -243216(%rbp,%rax,4)\n.L7:\n\taddl\t$1, -244060(%rbp)\n.L6:\n\tmovl\t-244060(%rbp), %eax\n\tcmpl\t-244068(%rbp), %eax\n\tjl\t.L8\n\taddl\t$1, -244064(%rbp)\n.L5:\n\tmovl\t-244068(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -244064(%rbp)\n\tjle\t.L9\n\tmovl\t$0, -244064(%rbp)\n\tjmp\t.L10\n.L13:\n\tmovl\t$0, -244060(%rbp)\n\tjmp\t.L11\n.L12:\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t$30401, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tmovl\t-244064(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovl\t-244060(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\timulq\t$301, %rdx, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t%eax, -243216(%rbp,%rdx,4)\n\taddl\t$1, -244060(%rbp)\n.L11:\n\tmovl\t-244060(%rbp), %eax\n\tcmpl\t-244068(%rbp), %eax\n\tjle\t.L12\n\taddl\t$1, -244064(%rbp)\n.L10:\n\tmovl\t-244068(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -244064(%rbp)\n\tjle\t.L13\n\taddl\t$1, -244068(%rbp)\n.L4:\n\tmovl\t-244076(%rbp), %eax\n\tcmpl\t%eax, -244068(%rbp)\n\tjle\t.L14\n\tmovl\t$0, -244056(%rbp)\n\tmovl\t$0, -244060(%rbp)\n\tjmp\t.L15\n.L21:\n\tmovl\t$0, -244064(%rbp)\n\tjmp\t.L16\n.L19:\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tcmpl\t%eax, -244056(%rbp)\n\tjge\t.L17\n\tmovl\t-244064(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-244060(%rbp), %eax\n\tcltq\n\timulq\t$301, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-243216(%rbp,%rax,4), %eax\n\tmovl\t%eax, -244056(%rbp)\n.L17:\n\taddl\t$1, -244064(%rbp)\n.L16:\n\tmovl\t-244060(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -244064(%rbp)\n\tjg\t.L18\n\tmovl\t-244044(%rbp), %eax\n\timull\t-244060(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-244064(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-244072(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L19\n.L18:\n\taddl\t$1, -244060(%rbp)\n.L15:\n\tcmpl\t$100, -244060(%rbp)\n\tjg\t.L20\n\tmovl\t-244044(%rbp), %eax\n\timull\t-244060(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-244072(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L21\n.L20:\n\tmovl\t-244056(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L23\n\tcall\t__stack_chk_fail@PLT\n.L23:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 = 1; i <= N; i++) { l = w[i] - w[1]; for (j = l; j <= i * 3; j++) { for (k = 0; k < i; k++) if (dp[0][k][j-l] + v[i] > dp[1][k+1][j]) dp[1][k+1][j] = dp[0][k][j-l] + v[i]; } for (j = 0; j <= i * 3; j++) { for (k = 0; k <= i; k++) dp[0][k][j] = dp[1][k][j]; } } int max = 0; for (k = 0; k <= 100 && w[1] * k <= W; k++) { for (j = 0; j <= k * 3 && w[1] * k + j <= W; j++) if (dp[0][k][j] > max) max = dp[0][k][j]; } printf("%d\n", max); fflush(stdout); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -241664(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $2416, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -244072(%rbp), %rdx leaq -244076(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -244068(%rbp) jmp .L2 .L3: leaq -243632(%rbp), %rdx movl -244068(%rbp), %eax cltq salq $2, %rax addq %rax, %rdx leaq -244048(%rbp), %rcx movl -244068(%rbp), %eax cltq salq $2, %rax addq %rcx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -244068(%rbp) .L2: movl -244076(%rbp), %eax cmpl %eax, -244068(%rbp) jle .L3 leaq -243216(%rbp), %rax movl $243208, %edx movl $0, %esi movq %rax, %rdi call memset@PLT movl $1, -244068(%rbp) jmp .L4 .L14: movl -244068(%rbp), %eax cltq movl -244048(%rbp,%rax,4), %eax movl -244044(%rbp), %edx subl %edx, %eax movl %eax, -244052(%rbp) movl -244052(%rbp), %eax movl %eax, -244064(%rbp) jmp .L5 .L9: movl $0, -244060(%rbp) jmp .L6 .L8: movl -244064(%rbp), %eax subl -244052(%rbp), %eax movslq %eax, %rdx movl -244060(%rbp), %eax cltq imulq $301, %rax, %rax addq %rdx, %rax movl -243216(%rbp,%rax,4), %edx movl -244068(%rbp), %eax cltq movl -243632(%rbp,%rax,4), %eax addl %eax, %edx movl -244060(%rbp), %eax leal 1(%rax), %ecx movl -244064(%rbp), %eax movslq %eax, %rsi movslq %ecx, %rax imulq $301, %rax, %rax addq %rsi, %rax addq $30401, %rax movl -243216(%rbp,%rax,4), %eax cmpl %eax, %edx jle .L7 movl -244064(%rbp), %eax subl -244052(%rbp), %eax movslq %eax, %rdx movl -244060(%rbp), %eax cltq imulq $301, %rax, %rax addq %rdx, %rax movl -243216(%rbp,%rax,4), %esi movl -244068(%rbp), %eax cltq movl -243632(%rbp,%rax,4), %edx movl -244060(%rbp), %eax leal 1(%rax), %ecx addl %esi, %edx movl -244064(%rbp), %eax movslq %eax, %rsi movslq %ecx, %rax imulq $301, %rax, %rax addq %rsi, %rax addq $30401, %rax movl %edx, -243216(%rbp,%rax,4) .L7: addl $1, -244060(%rbp) .L6: movl -244060(%rbp), %eax cmpl -244068(%rbp), %eax jl .L8 addl $1, -244064(%rbp) .L5: movl -244068(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax cmpl %eax, -244064(%rbp) jle .L9 movl $0, -244064(%rbp) jmp .L10 .L13: movl $0, -244060(%rbp) jmp .L11 .L12: movl -244064(%rbp), %eax movslq %eax, %rdx movl -244060(%rbp), %eax cltq imulq $301, %rax, %rax addq %rdx, %rax addq $30401, %rax movl -243216(%rbp,%rax,4), %eax movl -244064(%rbp), %edx movslq %edx, %rcx movl -244060(%rbp), %edx movslq %edx, %rdx imulq $301, %rdx, %rdx addq %rcx, %rdx movl %eax, -243216(%rbp,%rdx,4) addl $1, -244060(%rbp) .L11: movl -244060(%rbp), %eax cmpl -244068(%rbp), %eax jle .L12 addl $1, -244064(%rbp) .L10: movl -244068(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax cmpl %eax, -244064(%rbp) jle .L13 addl $1, -244068(%rbp) .L4: movl -244076(%rbp), %eax cmpl %eax, -244068(%rbp) jle .L14 movl $0, -244056(%rbp) movl $0, -244060(%rbp) jmp .L15 .L21: movl $0, -244064(%rbp) jmp .L16 .L19: movl -244064(%rbp), %eax movslq %eax, %rdx movl -244060(%rbp), %eax cltq imulq $301, %rax, %rax addq %rdx, %rax movl -243216(%rbp,%rax,4), %eax cmpl %eax, -244056(%rbp) jge .L17 movl -244064(%rbp), %eax movslq %eax, %rdx movl -244060(%rbp), %eax cltq imulq $301, %rax, %rax addq %rdx, %rax movl -243216(%rbp,%rax,4), %eax movl %eax, -244056(%rbp) .L17: addl $1, -244064(%rbp) .L16: movl -244060(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax cmpl %eax, -244064(%rbp) jg .L18 movl -244044(%rbp), %eax imull -244060(%rbp), %eax movl %eax, %edx movl -244064(%rbp), %eax addl %eax, %edx movl -244072(%rbp), %eax cmpl %eax, %edx jle .L19 .L18: addl $1, -244060(%rbp) .L15: cmpl $100, -244060(%rbp) jg .L20 movl -244044(%rbp), %eax imull -244060(%rbp), %eax movl %eax, %edx movl -244072(%rbp), %eax cmpl %eax, %edx jle .L21 .L20: movl -244056(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L23 call __stack_chk_fail@PLT .L23: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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[i]);\n\t\ttmp[A[i]]++;\n\t}\n\n\tint k = 0;\n\n\tfor (i = 0; i < 100005; i++) {\n\t\tif (tmp[i] > 0) {\n\t\t\tk++;\n\t\t}\n\t}\n\n\tif (k % 2 == 0) { printf(\"%d\\n\",k-1); }\n\telse { printf(\"%d\\n\",k); }\n\n\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tA\n\t.bss\n\t.align 32\n\t.type\tA, @object\n\t.size\tA, 400020\nA:\n\t.zero\t400020\n\t.globl\ttmp\n\t.align 32\n\t.type\ttmp, @object\n\t.size\ttmp, 400020\ntmp:\n\t.zero\t400020\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\" %d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tA(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tA(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\ttmp(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tleal\t1(%rdx), %ecx\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ttmp(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L3\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ttmp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L5\n\taddl\t$1, -12(%rbp)\n.L5:\n\taddl\t$1, -16(%rbp)\n.L4:\n\tcmpl\t$100004, -16(%rbp)\n\tjle\t.L6\n\tmovl\t-12(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L7\n\tmovl\t-12(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L8\n.L7:\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L8:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L2\n\tleaq\tA(%rip), %rbx\n\txorl\t%ebp, %ebp\n\tleaq\t.LC1(%rip), %r13\n\tleaq\ttmp(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t(%rbx), %rax\n\taddq\t$4, %rbx\n\taddl\t$1, (%r12,%rax,4)\n\tcmpl\t%ebp, 4(%rsp)\n\tjg\t.L3\n.L2:\n\tleaq\ttmp(%rip), %rax\n\tpxor\t%xmm0, %xmm0\n\tleaq\t400016(%rax), %rdx\n\tmovdqa\t%xmm0, %xmm2\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovdqa\t(%rax), %xmm1\n\taddq\t$16, %rax\n\tpcmpgtd\t%xmm2, %xmm1\n\tpsubd\t%xmm1, %xmm0\n\tcmpq\t%rax, %rdx\n\tjne\t.L4\n\tmovdqa\t%xmm0, %xmm1\n\tmovl\t400016+tmp(%rip), %ecx\n\txorl\t%eax, %eax\n\tpsrldq\t$8, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\ttestl\t%ecx, %ecx\n\tmovdqa\t%xmm0, %xmm1\n\tsetg\t%al\n\tpsrldq\t$4, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\tmovd\t%xmm0, %edx\n\taddl\t%eax, %edx\n\ttestb\t$1, %dl\n\tjne\t.L14\n\tsubl\t$1, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L9:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L17\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L14:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L9\n.L17:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\ttmp\n\t.bss\n\t.align 32\n\t.type\ttmp, @object\n\t.size\ttmp, 400020\ntmp:\n\t.zero\t400020\n\t.globl\tA\n\t.align 32\n\t.type\tA, @object\n\t.size\tA, 400020\nA:\n\t.zero\t400020\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L2\n\tleaq\tA(%rip), %rbx\n\txorl\t%ebp, %ebp\n\tleaq\t.LC1(%rip), %r13\n\tleaq\ttmp(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t(%rbx), %rax\n\taddq\t$4, %rbx\n\taddl\t$1, (%r12,%rax,4)\n\tcmpl\t%ebp, 4(%rsp)\n\tjg\t.L3\n.L2:\n\tleaq\ttmp(%rip), %rax\n\tpxor\t%xmm0, %xmm0\n\tleaq\t400016(%rax), %rdx\n\tmovdqa\t%xmm0, %xmm2\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovdqa\t(%rax), %xmm1\n\taddq\t$16, %rax\n\tpcmpgtd\t%xmm2, %xmm1\n\tpsubd\t%xmm1, %xmm0\n\tcmpq\t%rax, %rdx\n\tjne\t.L4\n\tmovdqa\t%xmm0, %xmm1\n\tmovl\t400016+tmp(%rip), %ecx\n\txorl\t%eax, %eax\n\tpsrldq\t$8, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\ttestl\t%ecx, %ecx\n\tmovdqa\t%xmm0, %xmm1\n\tsetg\t%al\n\tpsrldq\t$4, %xmm1\n\tpaddd\t%xmm1, %xmm0\n\tmovd\t%xmm0, %edx\n\taddl\t%eax, %edx\n\ttestb\t$1, %dl\n\tjne\t.L14\n\tsubl\t$1, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L9:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L17\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L14:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L9\n.L17:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\ttmp\n\t.bss\n\t.align 32\n\t.type\ttmp, @object\n\t.size\ttmp, 400020\ntmp:\n\t.zero\t400020\n\t.globl\tA\n\t.align 32\n\t.type\tA, @object\n\t.size\tA, 400020\nA:\n\t.zero\t400020\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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[i]);\n\t\ttmp[A[i]]++;\n\t}\n\n\tint k = 0;\n\n\tfor (i = 0; i < 100005; i++) {\n\t\tif (tmp[i] > 0) {\n\t\t\tk++;\n\t\t}\n\t}\n\n\tif (k % 2 == 0) { printf(\"%d\\n\",k-1); }\n\telse { printf(\"%d\\n\",k); }\n\n\n\treturn 0;\n}", "index": 36, "inputs": [ "5\n1 2 1 3 7\n" ], "outputs": [ "3\n" ], "question": "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[i]);\n\t\ttmp[A[i]]++;\n\t}\n\n\tint k = 0;\n\n\tfor (i = 0; i < 100005; i++) {\n\t\tif (tmp[i] > 0) {\n\t\t\tk++;\n\t\t}\n\t}\n\n\tif (k % 2 == 0) { printf(\"%d\\n\",k-1); }\n\telse { printf(\"%d\\n\",k); }\n\n\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tA\n\t.bss\n\t.align 32\n\t.type\tA, @object\n\t.size\tA, 400020\nA:\n\t.zero\t400020\n\t.globl\ttmp\n\t.align 32\n\t.type\ttmp, @object\n\t.size\ttmp, 400020\ntmp:\n\t.zero\t400020\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\" %d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tA(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tA(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\ttmp(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tleal\t1(%rdx), %ecx\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ttmp(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L3\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ttmp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L5\n\taddl\t$1, -12(%rbp)\n.L5:\n\taddl\t$1, -16(%rbp)\n.L4:\n\tcmpl\t$100004, -16(%rbp)\n\tjle\t.L6\n\tmovl\t-12(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L7\n\tmovl\t-12(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L8\n.L7:\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L8:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; i < 100005; i++) { if (tmp[i] > 0) { k++; } } if (k % 2 == 0) { printf("%d\n",k-1); } else { printf("%d\n",k); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl A .bss .align 32 .type A, @object .size A, 400020 A: .zero 400020 .globl tmp .align 32 .type tmp, @object .size tmp, 400020 tmp: .zero 400020 .section .rodata .LC0: .string "%d" .LC1: .string " %d" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -20(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -16(%rbp) jmp .L2 .L3: movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq A(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq A(%rip), %rax movl (%rdx,%rax), %eax movslq %eax, %rdx leaq 0(,%rdx,4), %rcx leaq tmp(%rip), %rdx movl (%rcx,%rdx), %edx leal 1(%rdx), %ecx cltq leaq 0(,%rax,4), %rdx leaq tmp(%rip), %rax movl %ecx, (%rdx,%rax) addl $1, -16(%rbp) .L2: movl -20(%rbp), %eax cmpl %eax, -16(%rbp) jl .L3 movl $0, -12(%rbp) movl $0, -16(%rbp) jmp .L4 .L6: movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq tmp(%rip), %rax movl (%rdx,%rax), %eax testl %eax, %eax jle .L5 addl $1, -12(%rbp) .L5: addl $1, -16(%rbp) .L4: cmpl $100004, -16(%rbp) jle .L6 movl -12(%rbp), %eax andl $1, %eax testl %eax, %eax jne .L7 movl -12(%rbp), %eax subl $1, %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L8 .L7: movl -12(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L8: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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(n)/log(k)\n printf(\"%d\\n\", (int)(log(n)/log(k))+1);\n\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -36(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-32(%rbp), %eax\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovq\t%xmm2, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tlog@PLT\n\tmovq\t%xmm0, %rbx\n\tmovl\t-28(%rbp), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovq\t%xmm3, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tlog@PLT\n\tmovq\t%rbx, %xmm1\n\tdivsd\t%xmm0, %xmm1\n\tcvttsd2sil\t%xmm1, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L3\n\tcall\t__stack_chk_fail@PLT\n.L3:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t20(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t16(%rsp), %xmm0\n\tcall\tlog@PLT\n\tmovsd\t%xmm0, 8(%rsp)\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t20(%rsp), %xmm0\n\tcall\tlog@PLT\n\tmovsd\t8(%rsp), %xmm1\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tdivsd\t%xmm0, %xmm1\n\tcvttsd2sil\t%xmm1, %edx\n\taddl\t$1, %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L5\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t20(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t16(%rsp), %xmm0\n\tcall\tlog@PLT\n\tmovsd\t%xmm0, 8(%rsp)\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t20(%rsp), %xmm0\n\tcall\tlog@PLT\n\tmovsd\t8(%rsp), %xmm1\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tdivsd\t%xmm0, %xmm1\n\tcvttsd2sil\t%xmm1, %edx\n\taddl\t$1, %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L5\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(n)/log(k)\n printf(\"%d\\n\", (int)(log(n)/log(k))+1);\n\n return 0;\n}\n", "index": 23, "inputs": [ "22 2\n", "279134799 3\n", "1011101 10\n", "1010001 2\n", "29240007 3\n", "1010001 3\n", "1010001 5\n", "0110111 5\n", "0110111 9\n", "314159265 4\n", "15 2\n", "550505180 3\n", "49139062 3\n", "1011111 4\n", "1 2\n", "49139062 5\n", "89316102 4\n", "1110111 4\n", "1110111 2\n", "0000101 8\n", "937416134 2\n", "1568902019 2\n", "11 4\n", "29240007 2\n", "52006666 2\n", "526226813 2\n", "12779368 2\n", "85892049 2\n", "4000772700 2\n", "173584601 2\n", "5162253 2\n", "25 2\n", "386999582 3\n", "1010001 10\n", "325680770 3\n", "29240007 4\n", "1010011 5\n", "1010111 5\n", "1011111 5\n", "1111111 5\n", "1110111 5\n", "0110111 10\n", "0110011 10\n", "20 2\n", "241271450 3\n", "16 2\n", "0010001 10\n", "207577553 3\n", "1010000 2\n", "52006666 4\n", "0010001 5\n", "1010011 9\n", "1010111 10\n", "1110111 3\n", "1110111 6\n", "0110011 5\n", "0110010 10\n", "268730574 4\n", "1 3\n", "299826435 3\n", "658939863 3\n", "0010001 8\n", "0011001 5\n", "1010111 9\n", "1011101 4\n", "0111011 5\n", "268730574 5\n", "299826435 4\n", "658939863 6\n", "1010001 8\n", "49139062 6\n", "89316102 7\n", "0011011 5\n", "1011101 5\n", "1110111 7\n", "1010111 2\n", "0101011 5\n", "159666378 5\n", "588476021 4\n", "479704266 6\n", "1010101 8\n", "86816898 6\n", "74349643 7\n", "0011011 6\n", "1010101 5\n", "1110011 7\n", "1011111 2\n", "0101111 5\n", "279733938 5\n", "588476021 3\n", "479704266 3\n", "0010101 8\n", "1534752 6\n", "35134125 7\n", "0011011 9\n", "1010101 9\n", "1110011 10\n", "0001111 5\n", "503878812 5\n", "391121423 3\n", "11 2\n", "11 2\n", "1010101 10\n", "314159265 3\n" ], "outputs": [ "5\n", "18\n", "7\n", "20\n", "16\n", "13\n", "9\n", "8\n", "6\n", "15\n", "4\n", "19\n", "17\n", "10\n", "1\n", "12\n", "14\n", "11\n", "21\n", "3\n", "30\n", "31\n", "2\n", "25\n", "26\n", "29\n", "24\n", "27\n", "-2147483647\n", "28\n", "23\n", "5\n", "18\n", "7\n", "18\n", "13\n", "9\n", "9\n", "9\n", "9\n", "9\n", "6\n", "6\n", "5\n", "18\n", "5\n", "5\n", "18\n", "20\n", "13\n", "6\n", "7\n", "7\n", "13\n", "8\n", "8\n", "6\n", "15\n", "1\n", "18\n", "19\n", "5\n", "6\n", "7\n", "10\n", "8\n", "13\n", "15\n", "12\n", "7\n", "10\n", "10\n", "6\n", "9\n", "8\n", "20\n", "8\n", "12\n", "15\n", "12\n", "7\n", "11\n", "10\n", "6\n", "9\n", "8\n", "20\n", "8\n", "13\n", "19\n", "19\n", "5\n", "8\n", "9\n", "5\n", "7\n", "7\n", "5\n", "13\n", "19\n", "4\n", "4\n", "7\n", "18\n" ], "question": "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(n)/log(k)\n printf(\"%d\\n\", (int)(log(n)/log(k))+1);\n\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -36(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-32(%rbp), %eax\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovq\t%xmm2, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tlog@PLT\n\tmovq\t%xmm0, %rbx\n\tmovl\t-28(%rbp), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovq\t%xmm3, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tlog@PLT\n\tmovq\t%rbx, %xmm1\n\tdivsd\t%xmm0, %xmm1\n\tcvttsd2sil\t%xmm1, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L3\n\tcall\t__stack_chk_fail@PLT\n.L3:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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(n)/log(k))+1); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $40, %rsp .cfi_offset 3, -24 movl %edi, -36(%rbp) movq %rsi, -48(%rbp) movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -28(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -32(%rbp), %eax pxor %xmm2, %xmm2 cvtsi2sdl %eax, %xmm2 movq %xmm2, %rax movq %rax, %xmm0 call log@PLT movq %xmm0, %rbx movl -28(%rbp), %eax pxor %xmm3, %xmm3 cvtsi2sdl %eax, %xmm3 movq %xmm3, %rax movq %rax, %xmm0 call log@PLT movq %rbx, %xmm1 divsd %xmm0, %xmm1 cvttsd2sil %xmm1, %eax addl $1, %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -24(%rbp), %rdx subq %fs:40, %rdx je .L3 call __stack_chk_fail@PLT .L3: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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] == ' '){\n \t\tif(str[i-1] != str[i+1]){\n \t\t\tflag = 1;\n \t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tflag == 0 ? puts(\"YES\") : puts(\"NO\");\n \n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%[^\\n]\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"NO\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$1840, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-10016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -10024(%rbp)\n\tmovl\t$0, -10020(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-10020(%rbp), %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %eax\n\tcmpb\t$32, %al\n\tjne\t.L3\n\tmovl\t-10020(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %edx\n\tmovl\t-10020(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L3\n\tmovl\t$1, -10024(%rbp)\n\tjmp\t.L4\n.L3:\n\taddl\t$1, -10020(%rbp)\n.L2:\n\tmovl\t-10020(%rbp), %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n.L4:\n\tcmpl\t$0, -10024(%rbp)\n\tjne\t.L6\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L7\n.L6:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L7:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L9\n\tcall\t__stack_chk_fail@PLT\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 4104\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 8200\n\torq\t$0, (%rsp)\n\tsubq\t$1832, %rsp\n\t.cfi_def_cfa_offset 10032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 10008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t(%rsp), %eax\n\ttestb\t%al, %al\n\tje\t.L2\n\tleaq\t1(%rsp), %rdx\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t$1, %rdx\n\ttestb\t%al, %al\n\tje\t.L2\n.L5:\n\tmovl\t%eax, %ecx\n\tmovzbl\t(%rdx), %eax\n\tcmpb\t$32, %cl\n\tjne\t.L3\n\tcmpb\t%al, -2(%rdx)\n\tje\t.L3\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L6:\n\tmovq\t10008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L15\n\txorl\t%eax, %eax\n\taddq\t$10024, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L6\n.L15:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 4104\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\t.cfi_def_cfa_offset 8200\n\torq\t$0, (%rsp)\n\tsubq\t$1832, %rsp\n\t.cfi_def_cfa_offset 10032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 10008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t(%rsp), %eax\n\ttestb\t%al, %al\n\tje\t.L2\n\tleaq\t1(%rsp), %rdx\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t$1, %rdx\n\ttestb\t%al, %al\n\tje\t.L2\n.L5:\n\tmovl\t%eax, %ecx\n\tmovzbl\t(%rdx), %eax\n\tcmpb\t$32, %cl\n\tjne\t.L3\n\tcmpb\t%al, -2(%rdx)\n\tje\t.L3\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L6:\n\tmovq\t10008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L15\n\txorl\t%eax, %eax\n\taddq\t$10024, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L6\n.L15:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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] == ' '){\n \t\tif(str[i-1] != str[i+1]){\n \t\t\tflag = 1;\n \t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tflag == 0 ? puts(\"YES\") : puts(\"NO\");\n \n return 0;\n}", "index": 31, "inputs": [ "a a `\n", "baaaa`aaaa aabaaaaaaa aaaaa`aaab\n", "rnh gorilla apple\n", "aaaaaaaaab aaaaaaaaaa aaaaa`aaab\n", "ybkiniku unagi sushi\n", "a b a\n", "rng gorilla paple\n", "aaaaaaaaab aaaaaaaaaa baaa`aaaaa\n", "ybkiniku inagu sushi\n", "a b `\n", "rnh gorilla paple\n", "aaaaaaaaab aabaaaaaaa baaa`aaaaa\n", "ukinikby inagu sushi\n", "b a a\n", "rnh gorilla pepla\n", "aaaa`aaaab aabaaaaaaa baaa`aaaaa\n", "ukinhkby inagu sushi\n", "b a b\n", "rnh allirog pepla\n", "aaaa`aaaab aaaaaaabaa baaa`aaaaa\n", "ukinhkby inagt sushi\n", "c a b\n", "roh allirog pepla\n", "aaaa`aaaab aabaaaaaaa aaaaa`aaab\n", "ukhnikby inagt sushi\n", "c b b\n", "roh `llirog pepla\n", "ukhnikby in`gt sushi\n", "c b a\n", "roh `llirog plpea\n", "baaaaaaaa` aabaaaaaaa aaaaa`aaab\n", "ukhnikby in`gt svshi\n", "d b a\n", "roh `glirol plpea\n", "baaaaaaa`` aabaaaaaaa aaaaa`aaab\n", "ukhnikby in`gt svsgi\n", "d c a\n", "roh `glirol aeplp\n", "baaaaaaa`` aabaaaaaa` aaaaa`aaab\n", "ykhnikbu in`gt svsgi\n", "d c `\n", "roh `glirok aeplp\n", "baaaaaaa`` `aaaaaabaa aaaaa`aaab\n", "ykhnikbu in`gt svsgh\n", "c c `\n", "roh `glirok `eplp\n", "baaabaaa`` `aaaaaabaa aaaaa`aaab\n", "ubkinhky in`gt svsgh\n", "b c `\n", "rph `glirok `eplp\n", "baaabaaa`` `aaabaabaa aaaaa`aaab\n", "ubkinhky in`gu svsgh\n", "b c _\n", "rph `gilrok `eplp\n", "baaabaaa`` `aaaba`baa aaaaa`aaab\n", "ubkhnhky in`gu svsgh\n", "a c _\n", "hpr `gilrok `eplp\n", "baaabaaa`` `aaaba`baa baaa`aaaaa\n", "ubkhnhjy in`gu svsgh\n", "a c ^\n", "hpr `gilrok lep`p\n", "baaabaaa`` `aaaba`baa baba`aaaaa\n", "ubkhnhjy in`fu svsgh\n", "a b ^\n", "hpr `gimrok lep`p\n", "baaabaaa`` `aaaba`baa aaaaa`abab\n", "ubkhnhjy in`fv svsgh\n", "` b ^\n", "hps `gimrok lep`p\n", "baaabaaa`` `aaaba`baa aabaa`abaa\n", "ubkhnhjy jn`fv svsgh\n", "` a ^\n", "gps `gimrok lep`p\n", "baaabaaa`` _aaaba`baa aabaa`abaa\n", "yjhnhkbu jn`fv svsgh\n", "` a ]\n", "gps `gjmrok lep`p\n", "baaabaaa`` _aaab`abaa aabaa`abaa\n", "yjhnhkbu j`nfv svsgh\n", "_ a ]\n", "gps `gmjrok lep`p\n", "``aaabaaab _aaab`abaa aabaa`abaa\n", "yjhnhkbu jn`fu svsgh\n", "` a \\\n", "gps agmjrok lep`p\n", "``aaabaaab _aabb`abaa aabaa`abaa\n", "yjhnhkau jn`fu svsgh\n", "a a \\\n", "gps agmjrok lfp`p\n", "baaabaaa`` _aabb`abaa aabaa`abaa\n", "yjinhkau jn`fu svsgh\n", "a ` \\\n", "gps agnjrok lfp`p\n", "baaabaaa`` _aabb`abaa aabba`abaa\n", "yjinhkau jnf`u svsgh\n", "` ` \\\n", "gps agnjrok p`pfl\n", "baaabaaa`` _aabb`abaa aabba`baaa\n", "yjinhkau jnf`u rvsgh\n", "yakiniku unagi sushi\n", "a a a\n", "rng gorilla apple\n", "aaaaaaaaab aaaaaaaaaa aaaaaaaaab\n", "rng gorilla apple\n" ], "outputs": [ "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "YES\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "YES\n", "YES\n", "NO\n", "YES\n" ], "question": "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] == ' '){\n \t\tif(str[i-1] != str[i+1]){\n \t\t\tflag = 1;\n \t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tflag == 0 ? puts(\"YES\") : puts(\"NO\");\n \n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%[^\\n]\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"NO\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tsubq\t$1840, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-10016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -10024(%rbp)\n\tmovl\t$0, -10020(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t-10020(%rbp), %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %eax\n\tcmpb\t$32, %al\n\tjne\t.L3\n\tmovl\t-10020(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %edx\n\tmovl\t-10020(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L3\n\tmovl\t$1, -10024(%rbp)\n\tjmp\t.L4\n.L3:\n\taddl\t$1, -10020(%rbp)\n.L2:\n\tmovl\t-10020(%rbp), %eax\n\tcltq\n\tmovzbl\t-10016(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L5\n.L4:\n\tcmpl\t$0, -10024(%rbp)\n\tjne\t.L6\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L7\n.L6:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L7:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L9\n\tcall\t__stack_chk_fail@PLT\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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]){ flag = 1; break; } } } flag == 0 ? puts("YES") : puts("NO"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%[^\n]" .LC1: .string "YES" .LC2: .string "NO" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $4096, %rsp orq $0, (%rsp) subq $4096, %rsp orq $0, (%rsp) subq $1840, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -10016(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -10024(%rbp) movl $0, -10020(%rbp) jmp .L2 .L5: movl -10020(%rbp), %eax cltq movzbl -10016(%rbp,%rax), %eax cmpb $32, %al jne .L3 movl -10020(%rbp), %eax subl $1, %eax cltq movzbl -10016(%rbp,%rax), %edx movl -10020(%rbp), %eax addl $1, %eax cltq movzbl -10016(%rbp,%rax), %eax cmpb %al, %dl je .L3 movl $1, -10024(%rbp) jmp .L4 .L3: addl $1, -10020(%rbp) .L2: movl -10020(%rbp), %eax cltq movzbl -10016(%rbp,%rax), %eax testb %al, %al jne .L5 .L4: cmpl $0, -10024(%rbp) jne .L6 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L7 .L6: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L7: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L9 call __stack_chk_fail@PLT .L9: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 - 2; i++) {\n\t\tfor (j = i + 1; j <= N - 1; j++) {\n\t\t\tif (L[i] == L[j]) continue;\n\t\t\tfor (k = j + 1; k <= N; k++) {\n\t\t\t\tif (L[k] != L[i] && L[k] != L[j] && L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) count++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\tfflush(stdout);\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$448, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -420(%rbp)\n\tleaq\t-436(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -432(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-416(%rbp), %rdx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -432(%rbp)\n.L2:\n\tmovl\t-436(%rbp), %eax\n\tcmpl\t%eax, -432(%rbp)\n\tjle\t.L3\n\tmovl\t$1, -432(%rbp)\n\tjmp\t.L4\n.L12:\n\tmovl\t-432(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -428(%rbp)\n\tjmp\t.L5\n.L11:\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L15\n\tmovl\t-428(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -424(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L9\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L9\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\taddl\t$1, -420(%rbp)\n.L9:\n\taddl\t$1, -424(%rbp)\n.L8:\n\tmovl\t-436(%rbp), %eax\n\tcmpl\t%eax, -424(%rbp)\n\tjle\t.L10\n\tjmp\t.L7\n.L15:\n\tnop\n.L7:\n\taddl\t$1, -428(%rbp)\n.L5:\n\tmovl\t-436(%rbp), %eax\n\tcmpl\t%eax, -428(%rbp)\n\tjl\t.L11\n\taddl\t$1, -432(%rbp)\n.L4:\n\tmovl\t-436(%rbp), %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -432(%rbp)\n\tjl\t.L12\n\tmovl\t-420(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_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\tleaq\t.LC0(%rip), %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tmovq\t%r14, %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$456, %rsp\n\t.cfi_def_cfa_offset 512\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 440(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t28(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tleaq\t36(%rsp), %r12\n\tmovl\t$1, %ebp\n\tmovq\t%r12, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%r13, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %ebx\n\taddq\t$4, %r13\n\tcmpl\t%ebp, %ebx\n\tjge\t.L3\n\tcmpl\t$2, %ebx\n\tjle\t.L12\n\tleal\t-1(%rbx), %edi\n\tleal\t-3(%rbx), %eax\n\txorl\t%r13d, %r13d\n\tmovl\t%edi, 12(%rsp)\n\taddq\t$3, %rax\n\tleaq\t40(%rsp), %r14\n\tmovq\t%rax, (%rsp)\n\tmovl\t$2, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tleaq\t1(%rax), %r15\n\tcmpl\t%eax, %ebx\n\tjle\t.L4\n\tmovl\t12(%rsp), %edx\n\tleaq\t1(%rax), %r15\n\tmovl\t-4(%r14), %esi\n\tmovq\t%r14, %r9\n\tmovq\t%r15, %r8\n\tsubl\t%eax, %edx\n\tleaq\t2(%rax,%rdx), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%r9), %ecx\n\tcmpl\t%ecx, %esi\n\tje\t.L5\n\tcmpl\t%r8d, %ebx\n\tjl\t.L5\n\tmovl\t%ebx, %edx\n\tleal\t(%rsi,%rcx), %r10d\n\tsubl\t%r8d, %edx\n\tleaq\t-1(%r8,%rdx), %rax\n\tleaq\t(%r12,%rax,4), %rdi\n\tmovq\t%r9, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t4(%rax), %edx\n\tcmpl\t%edx, %ecx\n\tje\t.L6\n\tcmpl\t%edx, %esi\n\tje\t.L6\n\tcmpl\t%r10d, %edx\n\tjge\t.L6\n\tleal\t(%rsi,%rdx), %r11d\n\tcmpl\t%r11d, %ecx\n\tjge\t.L6\n\taddl\t%ecx, %edx\n\tcmpl\t%edx, %esi\n\tsetl\t%dl\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %r13d\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\taddq\t$4, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L7\n.L5:\n\taddq\t$1, %r8\n\taddq\t$4, %r9\n\tcmpq\t%rbp, %r8\n\tjne\t.L8\n.L4:\n\tmovq\t%r15, %rax\n\taddq\t$4, %r14\n\tcmpq\t(%rsp), %r15\n\tjne\t.L9\n.L2:\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t%r13d, %edx\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t440(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L27\n\taddq\t$456, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L12:\n\t.cfi_restore_state\n\txorl\t%r13d, %r13d\n\tjmp\t.L2\n.L27:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_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\tleaq\t.LC0(%rip), %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tmovq\t%r14, %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$456, %rsp\n\t.cfi_def_cfa_offset 512\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 440(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t28(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L12\n\tleaq\t36(%rsp), %r12\n\tmovl\t$1, %ebp\n\tmovq\t%r12, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%r13, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %ebx\n\taddq\t$4, %r13\n\tcmpl\t%ebp, %ebx\n\tjge\t.L3\n\tcmpl\t$2, %ebx\n\tjle\t.L12\n\tleal\t-1(%rbx), %edi\n\tleal\t-3(%rbx), %eax\n\txorl\t%r13d, %r13d\n\tmovl\t%edi, 12(%rsp)\n\taddq\t$3, %rax\n\tleaq\t40(%rsp), %r14\n\tmovq\t%rax, (%rsp)\n\tmovl\t$2, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tleaq\t1(%rax), %r15\n\tcmpl\t%eax, %ebx\n\tjle\t.L4\n\tmovl\t12(%rsp), %edx\n\tleaq\t1(%rax), %r15\n\tmovl\t-4(%r14), %esi\n\tmovq\t%r14, %r9\n\tmovq\t%r15, %r8\n\tsubl\t%eax, %edx\n\tleaq\t2(%rax,%rdx), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%r9), %ecx\n\tcmpl\t%ecx, %esi\n\tje\t.L5\n\tcmpl\t%r8d, %ebx\n\tjl\t.L5\n\tmovl\t%ebx, %edx\n\tleal\t(%rsi,%rcx), %r10d\n\tsubl\t%r8d, %edx\n\tleaq\t-1(%r8,%rdx), %rax\n\tleaq\t(%r12,%rax,4), %rdi\n\tmovq\t%r9, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t4(%rax), %edx\n\tcmpl\t%edx, %ecx\n\tje\t.L6\n\tcmpl\t%edx, %esi\n\tje\t.L6\n\tcmpl\t%r10d, %edx\n\tjge\t.L6\n\tleal\t(%rsi,%rdx), %r11d\n\tcmpl\t%r11d, %ecx\n\tjge\t.L6\n\taddl\t%ecx, %edx\n\tcmpl\t%edx, %esi\n\tsetl\t%dl\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %r13d\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\taddq\t$4, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L7\n.L5:\n\taddq\t$1, %r8\n\taddq\t$4, %r9\n\tcmpq\t%rbp, %r8\n\tjne\t.L8\n.L4:\n\tmovq\t%r15, %rax\n\taddq\t$4, %r14\n\tcmpq\t(%rsp), %r15\n\tjne\t.L9\n.L2:\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t%r13d, %edx\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t440(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L27\n\taddq\t$456, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L12:\n\t.cfi_restore_state\n\txorl\t%r13d, %r13d\n\tjmp\t.L2\n.L27:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 - 2; i++) {\n\t\tfor (j = i + 1; j <= N - 1; j++) {\n\t\t\tif (L[i] == L[j]) continue;\n\t\t\tfor (k = j + 1; k <= N; k++) {\n\t\t\t\tif (L[k] != L[i] && L[k] != L[j] && L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) count++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\tfflush(stdout);\n\treturn 0;\n}\n", "index": 22, "inputs": [ "2\n1 0\n", "10\n9 4 8 1 9 6 10 6 6 8\n", "6\n4 5 8 3 3 5\n", "5\n4 4 3 7 5\n", "10\n9 4 16 1 9 6 10 6 6 8\n", "6\n4 5 6 3 3 5\n", "5\n4 0 3 7 5\n", "10\n9 7 16 1 9 6 10 6 6 8\n", "5\n4 -1 0 7 5\n", "10\n9 7 13 2 9 6 10 6 6 8\n", "10\n9 7 22 2 9 6 10 6 6 8\n", "6\n1 5 7 3 7 5\n", "10\n9 11 22 2 9 6 10 6 7 8\n", "10\n9 11 22 2 9 6 7 6 7 8\n", "10\n9 11 14 2 9 6 7 6 7 8\n", "10\n9 11 14 2 9 11 7 6 7 8\n", "10\n9 11 18 2 9 11 7 6 7 8\n", "10\n9 11 18 2 9 11 7 7 7 8\n", "10\n9 11 18 2 9 6 7 7 7 8\n", "10\n16 11 18 1 9 6 7 7 7 8\n", "10\n16 11 26 1 9 6 7 7 7 8\n", "10\n16 11 26 1 2 6 7 7 7 8\n", "10\n16 11 3 1 2 6 7 7 7 8\n", "10\n16 4 3 1 2 6 7 7 7 8\n", "10\n16 4 3 1 2 6 7 1 7 8\n", "10\n16 4 3 1 2 6 7 1 13 8\n", "10\n16 4 3 1 2 6 7 1 13 0\n", "10\n16 4 3 1 2 12 13 1 13 0\n", "10\n16 4 3 2 2 12 13 1 13 0\n", "10\n16 7 3 2 2 12 10 1 17 0\n", "6\n1 15 2 3 17 5\n", "10\n16 13 3 2 1 12 10 1 17 0\n", "10\n16 13 3 2 1 12 10 1 33 0\n", "10\n16 13 4 2 1 12 10 0 33 1\n", "2\n0 0\n", "2\n0 -1\n", "6\n4 5 8 3 5 5\n", "5\n4 -1 3 7 5\n", "2\n0 1\n", "10\n9 7 16 2 9 6 10 6 6 8\n", "6\n1 5 8 3 5 5\n", "2\n1 -1\n", "6\n1 5 6 3 5 5\n", "5\n4 -2 0 7 5\n", "2\n1 -2\n", "6\n1 5 7 3 5 5\n", "5\n4 -3 0 7 5\n", "2\n1 -3\n", "10\n9 7 22 2 9 6 10 6 7 8\n", "5\n4 -3 0 11 5\n", "2\n2 -3\n", "6\n0 5 7 3 7 5\n", "5\n4 -3 0 11 2\n", "2\n4 -3\n", "6\n0 5 7 5 7 5\n", "5\n4 -3 0 0 2\n", "2\n4 -1\n", "6\n0 5 7 7 7 5\n", "5\n4 -3 0 1 2\n", "2\n3 -1\n", "6\n0 5 7 7 12 5\n", "5\n4 -4 0 1 2\n", "2\n3 0\n", "6\n0 5 7 7 12 1\n", "5\n4 -4 1 1 2\n", "2\n3 1\n", "6\n1 5 7 7 12 1\n", "5\n2 -4 1 1 2\n", "2\n2 1\n", "6\n1 5 7 11 12 1\n", "5\n0 -4 1 1 2\n", "2\n2 2\n", "10\n16 11 18 2 9 6 7 7 7 8\n", "6\n1 8 7 11 12 1\n", "5\n0 -4 1 1 0\n", "2\n-1 0\n", "6\n1 8 7 0 12 1\n", "5\n0 -8 1 1 0\n", "2\n-2 0\n", "6\n1 8 8 0 12 1\n", "5\n0 -8 1 1 -1\n", "2\n-1 1\n", "6\n1 8 8 0 17 1\n", "5\n1 -8 1 1 -1\n", "2\n-2 1\n", "6\n1 8 8 0 17 2\n", "5\n0 -8 0 1 -1\n", "2\n6 1\n", "6\n1 8 8 0 17 3\n", "5\n1 -8 0 1 -1\n", "2\n6 0\n", "6\n1 8 14 0 17 3\n", "5\n1 -8 0 1 0\n", "2\n9 0\n", "6\n1 8 3 0 17 3\n", "5\n1 -9 0 1 0\n", "2\n13 0\n", "10\n16 4 3 1 2 6 7 1 13 4\n", "6\n1 8 3 0 17 5\n", "5\n1 -9 0 2 0\n", "5\n4 4 9 7 5\n", "2\n1 1\n", "5\n4 4 9 7 5\n", "6\n4 5 4 3 3 5\n", "10\n9 4 6 1 9 6 10 6 6 8\n" ], "outputs": [ "0\n", "48\n", "6\n", "5\n", "36\n", "12\n", "3\n", "40\n", "1\n", "63\n", "42\n", "4\n", "52\n", "46\n", "65\n", "66\n", "50\n", "39\n", "45\n", "38\n", "30\n", "22\n", "28\n", "25\n", "18\n", "17\n", "8\n", "11\n", "14\n", "13\n", "2\n", "15\n", "7\n", "9\n", "0\n", "0\n", "6\n", "3\n", "0\n", "48\n", "0\n", "0\n", "3\n", "1\n", "0\n", "3\n", "1\n", "0\n", "48\n", "0\n", "0\n", "4\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "3\n", "0\n", "0\n", "45\n", "4\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "12\n", "0\n", "0\n", "5\n", "0\n", "5\n", "8\n", "39\n" ], "question": "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 - 2; i++) {\n\t\tfor (j = i + 1; j <= N - 1; j++) {\n\t\t\tif (L[i] == L[j]) continue;\n\t\t\tfor (k = j + 1; k <= N; k++) {\n\t\t\t\tif (L[k] != L[i] && L[k] != L[j] && L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) count++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\tfflush(stdout);\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$448, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -420(%rbp)\n\tleaq\t-436(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -432(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-416(%rbp), %rdx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -432(%rbp)\n.L2:\n\tmovl\t-436(%rbp), %eax\n\tcmpl\t%eax, -432(%rbp)\n\tjle\t.L3\n\tmovl\t$1, -432(%rbp)\n\tjmp\t.L4\n.L12:\n\tmovl\t-432(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -428(%rbp)\n\tjmp\t.L5\n.L11:\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L15\n\tmovl\t-428(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -424(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L9\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L9\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %edx\n\tmovl\t-424(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\taddl\t%eax, %edx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\taddl\t$1, -420(%rbp)\n.L9:\n\taddl\t$1, -424(%rbp)\n.L8:\n\tmovl\t-436(%rbp), %eax\n\tcmpl\t%eax, -424(%rbp)\n\tjle\t.L10\n\tjmp\t.L7\n.L15:\n\tnop\n.L7:\n\taddl\t$1, -428(%rbp)\n.L5:\n\tmovl\t-436(%rbp), %eax\n\tcmpl\t%eax, -428(%rbp)\n\tjl\t.L11\n\taddl\t$1, -432(%rbp)\n.L4:\n\tmovl\t-436(%rbp), %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -432(%rbp)\n\tjl\t.L12\n\tmovl\t-420(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; j++) { if (L[i] == L[j]) continue; for (k = j + 1; k <= N; k++) { if (L[k] != L[i] && L[k] != L[j] && L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) count++; } } } printf("%d\n", count); fflush(stdout); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $448, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -420(%rbp) leaq -436(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -432(%rbp) jmp .L2 .L3: leaq -416(%rbp), %rdx movl -432(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -432(%rbp) .L2: movl -436(%rbp), %eax cmpl %eax, -432(%rbp) jle .L3 movl $1, -432(%rbp) jmp .L4 .L12: movl -432(%rbp), %eax addl $1, %eax movl %eax, -428(%rbp) jmp .L5 .L11: movl -432(%rbp), %eax cltq movl -416(%rbp,%rax,4), %edx movl -428(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cmpl %eax, %edx je .L15 movl -428(%rbp), %eax addl $1, %eax movl %eax, -424(%rbp) jmp .L8 .L10: movl -424(%rbp), %eax cltq movl -416(%rbp,%rax,4), %edx movl -432(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cmpl %eax, %edx je .L9 movl -424(%rbp), %eax cltq movl -416(%rbp,%rax,4), %edx movl -428(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cmpl %eax, %edx je .L9 movl -432(%rbp), %eax cltq movl -416(%rbp,%rax,4), %edx movl -428(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax addl %eax, %edx movl -424(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cmpl %eax, %edx jle .L9 movl -432(%rbp), %eax cltq movl -416(%rbp,%rax,4), %edx movl -424(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax addl %eax, %edx movl -428(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cmpl %eax, %edx jle .L9 movl -428(%rbp), %eax cltq movl -416(%rbp,%rax,4), %edx movl -424(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax addl %eax, %edx movl -432(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cmpl %eax, %edx jle .L9 addl $1, -420(%rbp) .L9: addl $1, -424(%rbp) .L8: movl -436(%rbp), %eax cmpl %eax, -424(%rbp) jle .L10 jmp .L7 .L15: nop .L7: addl $1, -428(%rbp) .L5: movl -436(%rbp), %eax cmpl %eax, -428(%rbp) jl .L11 addl $1, -432(%rbp) .L4: movl -436(%rbp), %eax subl $1, %eax cmpl %eax, -432(%rbp) jl .L12 movl -420(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L14 call __stack_chk_fail@PLT .L14: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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; j++)\nputchar('#');\nputchar('\\n');\n}\nprintf(\"\\n\");\n}\nreturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n.L8:\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t-20(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n.L2:\n\tmovl\t$1, -16(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -12(%rbp)\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjle\t.L6\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjle\t.L7\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %r14\n\tmovq\t%rsp, %r13\n\tjmp\t.L8\n.L2:\n\tmovl\t4(%rsp), %edx\n\ttestl\t%edx, %edx\n\tje\t.L17\n.L4:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L8:\n\tmovq\t%r14, %rdx\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L2\n\tjle\t.L4\n\tmovl\t$1, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t4(%rsp), %eax\n\tmovl\t$1, %ebx\n\ttestl\t%eax, %eax\n\tjle\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$35, %edi\n\taddl\t$1, %ebx\n\tcall\tputc@PLT\n\tcmpl\t%ebx, 4(%rsp)\n\tjge\t.L6\n.L7:\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\taddl\t$1, %ebp\n\tcall\tputc@PLT\n\tcmpl\t%ebp, (%rsp)\n\tjge\t.L3\n\tjmp\t.L4\n.L17:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L18\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %r14\n\tmovq\t%rsp, %r13\n\tjmp\t.L8\n.L2:\n\tmovl\t4(%rsp), %edx\n\ttestl\t%edx, %edx\n\tje\t.L17\n.L4:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L8:\n\tmovq\t%r14, %rdx\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L2\n\tjle\t.L4\n\tmovl\t$1, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t4(%rsp), %eax\n\tmovl\t$1, %ebx\n\ttestl\t%eax, %eax\n\tjle\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$35, %edi\n\taddl\t$1, %ebx\n\tcall\tputc@PLT\n\tcmpl\t%ebx, 4(%rsp)\n\tjge\t.L6\n.L7:\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\taddl\t$1, %ebp\n\tcall\tputc@PLT\n\tcmpl\t%ebp, (%rsp)\n\tjge\t.L3\n\tjmp\t.L4\n.L17:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L18\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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; j++)\nputchar('#');\nputchar('\\n');\n}\nprintf(\"\\n\");\n}\nreturn 0;\n}\n\n", "index": 35, "inputs": [ "3 4\n5 6\n2 3\n0 0\n", "3 4\n5 6\n2 0\n0 0\n", "3 4\n5 6\n2 4\n0 0\n", "4 4\n5 6\n2 0\n0 0\n", "4 4\n5 6\n4 0\n0 0\n", "4 3\n5 6\n4 -1\n0 0\n", "3 5\n5 6\n2 2\n0 0\n", "3 4\n5 0\n2 2\n0 0\n", "3 4\n5 6\n2 1\n0 0\n", "6 4\n5 6\n2 4\n0 0\n", "3 4\n5 6\n4 -1\n0 0\n", "8 3\n5 6\n4 -1\n0 0\n", "3 5\n5 6\n3 2\n0 0\n", "4 4\n5 6\n2 1\n0 0\n", "6 4\n5 6\n2 1\n0 0\n", "8 3\n5 12\n4 -1\n0 0\n", "3 5\n5 6\n3 1\n0 0\n", "4 4\n5 -1\n2 2\n0 0\n", "6 4\n5 6\n0 1\n0 0\n", "8 3\n5 11\n4 -1\n0 0\n", "3 1\n5 6\n3 1\n0 0\n", "6 4\n5 6\n-1 1\n0 0\n", "8 2\n5 11\n4 -1\n0 0\n", "6 4\n5 9\n-1 0\n0 0\n", "8 2\n5 22\n4 -2\n0 0\n", "6 4\n6 9\n-1 0\n0 0\n", "3 4\n9 6\n2 0\n0 0\n", "3 4\n6 6\n2 4\n0 0\n", "3 4\n5 6\n1 0\n0 0\n", "3 4\n10 6\n2 4\n0 0\n", "3 5\n5 5\n2 2\n0 0\n", "3 4\n10 0\n2 2\n0 0\n", "4 4\n5 9\n2 -1\n0 0\n", "3 8\n5 6\n4 -1\n0 0\n", "8 3\n5 9\n4 -1\n0 0\n", "3 5\n5 6\n6 2\n0 0\n", "3 0\n5 -1\n2 2\n0 0\n", "4 4\n5 5\n2 1\n0 0\n", "6 4\n5 4\n2 1\n0 0\n", "3 2\n5 6\n3 1\n0 0\n", "6 1\n5 6\n0 1\n0 0\n", "7 3\n5 11\n4 -1\n0 0\n", "3 1\n5 10\n3 1\n0 0\n", "3 4\n5 6\n-1 1\n0 0\n", "8 4\n5 6\n-1 0\n0 0\n", "13 2\n5 11\n4 -2\n0 0\n", "9 4\n5 9\n-1 0\n0 0\n", "6 4\n6 7\n-1 0\n0 0\n", "6 1\n6 9\n-2 0\n0 0\n", "3 4\n9 6\n2 1\n0 0\n", "3 4\n15 6\n2 4\n0 0\n", "3 5\n5 2\n2 2\n0 0\n", "3 0\n5 6\n4 -1\n0 0\n", "4 6\n5 5\n2 1\n0 0\n", "10 4\n5 4\n2 1\n0 0\n", "2 2\n5 6\n3 1\n0 0\n", "5 4\n5 -2\n2 2\n0 0\n", "6 1\n2 6\n0 1\n0 0\n", "7 3\n4 11\n4 -1\n0 0\n", "6 1\n5 10\n3 1\n0 0\n", "5 4\n5 6\n-1 1\n0 0\n", "10 4\n5 6\n-1 0\n0 0\n", "4 4\n5 9\n-1 0\n0 0\n", "3 4\n13 6\n2 1\n0 0\n", "1 4\n15 6\n2 4\n0 0\n", "3 5\n5 4\n2 2\n0 0\n", "8 4\n5 9\n2 0\n0 0\n", "2 0\n5 6\n4 -1\n0 0\n", "6 0\n5 0\n2 2\n0 0\n", "10 6\n5 4\n2 1\n0 0\n", "2 0\n5 6\n3 1\n0 0\n", "6 0\n2 6\n0 1\n0 0\n", "7 3\n4 11\n6 -1\n0 0\n", "1 1\n5 10\n3 1\n0 0\n", "5 4\n1 6\n-1 1\n0 0\n", "3 4\n13 6\n4 1\n0 0\n", "1 4\n15 6\n2 6\n0 0\n", "3 5\n5 4\n2 3\n0 0\n", "6 4\n1 6\n-1 3\n0 0\n", "2 0\n5 6\n1 -1\n0 0\n", "10 6\n5 6\n2 1\n0 0\n", "6 0\n2 6\n-1 1\n0 0\n", "1 1\n5 5\n3 1\n0 0\n", "5 4\n1 9\n-1 1\n0 0\n", "1 4\n5 6\n-1 -1\n0 0\n", "1 3\n15 6\n2 6\n0 0\n", "6 5\n5 4\n2 3\n0 0\n", "11 4\n1 6\n-1 3\n0 0\n", "2 0\n1 6\n1 -1\n0 0\n", "6 6\n5 6\n2 1\n0 0\n", "1 1\n5 5\n5 1\n0 0\n", "1 3\n15 6\n2 1\n0 0\n", "6 6\n5 4\n2 3\n0 0\n", "1 0\n1 6\n1 -1\n0 0\n", "6 6\n5 6\n2 2\n0 0\n", "2 1\n5 5\n5 1\n0 0\n", "1 3\n15 6\n2 0\n0 0\n", "6 4\n5 4\n2 3\n0 0\n", "11 4\n2 6\n-1 5\n0 0\n", "1 0\n1 6\n2 -1\n0 0\n", "3 4\n5 6\n2 2\n0 0\n", "3 4\n5 6\n2 2\n0 0\n" ], "outputs": [ "####\n####\n####\n\n######\n######\n######\n######\n######\n\n###\n###\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n####\n####\n\n", "####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "###\n###\n###\n###\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n##\n##\n\n", "####\n####\n####\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n####\n####\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n##\n##\n##\n\n", "####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n############\n############\n############\n############\n############\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "####\n####\n####\n####\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "#\n#\n#\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "##\n##\n##\n##\n##\n##\n##\n##\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n", "##\n##\n##\n##\n##\n##\n##\n##\n\n######################\n######################\n######################\n######################\n######################\n\n\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "#####\n#####\n#####\n\n#####\n#####\n#####\n#####\n#####\n\n##\n##\n\n", "####\n####\n####\n\n\n\n\n\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n\n\n", "########\n########\n########\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n#########\n#########\n#########\n#########\n#########\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n##\n##\n##\n##\n##\n##\n\n", "\n\n\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n####\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n####\n####\n####\n####\n####\n\n#\n#\n\n", "##\n##\n##\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "#\n#\n#\n#\n#\n#\n\n######\n######\n######\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "#\n#\n#\n\n##########\n##########\n##########\n##########\n##########\n\n#\n#\n#\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n####\n####\n####\n\n#######\n#######\n#######\n#######\n#######\n#######\n\n\n", "#\n#\n#\n#\n#\n#\n\n#########\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "#####\n#####\n#####\n\n##\n##\n##\n##\n##\n\n##\n##\n\n", "\n\n\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "######\n######\n######\n######\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n####\n####\n####\n####\n####\n\n#\n#\n\n", "##\n##\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n\n\n\n\n\n\n##\n##\n\n", "#\n#\n#\n#\n#\n#\n\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "#\n#\n#\n#\n#\n#\n\n##########\n##########\n##########\n##########\n##########\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "#####\n#####\n#####\n\n####\n####\n####\n####\n####\n\n##\n##\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n\n\n", "\n\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "\n\n\n\n\n\n\n\n\n\n\n\n\n##\n##\n\n", "######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n####\n####\n####\n\n#\n#\n\n", "\n\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "\n\n\n\n\n\n\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n\n\n", "#\n\n##########\n##########\n##########\n##########\n##########\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n######\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n#\n#\n\n", "####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n######\n######\n\n", "#####\n#####\n#####\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "####\n####\n####\n####\n####\n####\n\n######\n\n\n", "\n\n\n######\n######\n######\n######\n######\n\n\n\n", "######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "\n\n\n\n\n\n\n######\n######\n\n\n", "#\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n#########\n\n\n", "####\n\n######\n######\n######\n######\n######\n\n\n", "###\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n######\n######\n\n", "#####\n#####\n#####\n#####\n#####\n#####\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n######\n\n\n", "\n\n\n######\n\n\n\n", "######\n######\n######\n######\n######\n######\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "#\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n#\n#\n#\n\n", "###\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n\n", "######\n######\n######\n######\n######\n######\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "\n\n######\n\n\n\n", "######\n######\n######\n######\n######\n######\n\n######\n######\n######\n######\n######\n\n##\n##\n\n", "#\n#\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n#\n#\n#\n\n", "###\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n######\n######\n\n\n", "\n\n######\n\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##\n\n" ], "question": "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; j++)\nputchar('#');\nputchar('\\n');\n}\nprintf(\"\\n\");\n}\nreturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n.L8:\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t-20(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n.L2:\n\tmovl\t$1, -16(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -12(%rbp)\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjle\t.L6\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjle\t.L7\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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'); } printf("\n"); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax .L8: leaq -20(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %eax testl %eax, %eax jne .L2 movl -20(%rbp), %eax testl %eax, %eax je .L12 .L2: movl $1, -16(%rbp) jmp .L4 .L7: movl $1, -12(%rbp) jmp .L5 .L6: movl $35, %edi call putchar@PLT addl $1, -12(%rbp) .L5: movl -20(%rbp), %eax cmpl %eax, -12(%rbp) jle .L6 movl $10, %edi call putchar@PLT addl $1, -16(%rbp) .L4: movl -24(%rbp), %eax cmpl %eax, -16(%rbp) jle .L7 movl $10, %edi call putchar@PLT jmp .L8 .L12: nop movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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\t1\t\t\t\t\t\t\t\t\t\t// 汎用フラグ - ON\n#define D_OFF\t\t\t0\t\t\t\t\t\t\t\t\t\t// 汎用フラグ - OFF\n#define D_MCNT_MAX\t\t20000\t\t\t\t\t\t\t\t\t// 最大マッチ数\n#define D_NUM_KIND\t\t9\t\t\t\t\t\t\t\t\t\t// 数字種類数\n#define D_PTN_MAX\t\t6000\t\t\t\t\t\t\t\t\t// 最大パターン数\n\n// 内部構造体 - 数字情報\ntypedef struct Num {\n\tint miVal;\t\t\t\t\t\t\t\t\t\t\t\t\t// 値\n\tint miMCnt;\t\t\t\t\t\t\t\t\t\t\t\t\t// マッチ数\n\tint miUse;\t\t\t\t\t\t\t\t\t\t\t\t\t// 使用フラグ\n\tint miUCnt;\t\t\t\t\t\t\t\t\t\t\t\t\t// 使用数\n} Num;\n\n// 内部変数\nstatic FILE *szpFpI;\t\t\t\t\t\t\t\t\t\t\t// 入力\nstatic int siMCnt;\t\t\t\t\t\t\t\t\t\t\t\t// マッチ数\nstatic Num sz1Num[D_NUM_KIND];\t\t\t\t\t\t\t\t\t// 数字\nstatic int siNCnt;\t\t\t\t\t\t\t\t\t\t\t\t// 数字数\nstatic int si1SNum[D_NUM_KIND + 5];\t\t\t\t\t\t\t\t// 選択数字[数字]\nstatic int si2SCnt[D_NUM_KIND + 5][D_PTN_MAX];\t\t\t\t\t// 選択数字数[数字][残マッチ数]\nstatic char sc1Out[D_MCNT_MAX];\t\t\t\t\t\t\t\t\t// 出力文字列\n\n// 内部変数 - テスト用\n#ifdef D_TEST\n\tstatic int siRes;\n\tstatic FILE *szpFpA;\n#endif\n\n// ソート関数 - 値降順\nint\nfSortFncVd(\n\tconst void *pzpVal1\t\t\t// <I> 値1\n\t, const void *pzpVal2\t\t// <I> 値2\n)\n{\n\tNum *lzpVal1 = (Num *)pzpVal1;\n\tNum *lzpVal2 = (Num *)pzpVal2;\n\n\t// 値降順\n\tif (lzpVal1->miVal > lzpVal2->miVal) {\n\t\treturn -1;\n\t}\n\telse if (lzpVal1->miVal < lzpVal2->miVal) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n// ソート関数 - 使用フラグ降順 - マッチ数昇順 - 値降順\nint\nfSortFnc(\n\tconst void *pzpVal1\t\t\t// <I> 値1\n\t, const void *pzpVal2\t\t// <I> 値2\n)\n{\n\tint liRet;\n\tNum *lzpVal1 = (Num *)pzpVal1;\n\tNum *lzpVal2 = (Num *)pzpVal2;\n\n\t// 使用フラグ降順\n\tif (lzpVal1->miUse > lzpVal2->miUse) {\n\t\treturn -1;\n\t}\n\telse if (lzpVal1->miUse < lzpVal2->miUse) {\n\t\treturn 1;\n\t}\n\n\t// マッチ数昇順\n\tif (lzpVal1->miMCnt > lzpVal2->miMCnt) {\n\t\treturn 1;\n\t}\n\telse if (lzpVal1->miMCnt < lzpVal2->miMCnt) {\n\t\treturn -1;\n\t}\n\n\t// 値降順\n\tliRet = fSortFncVd(pzpVal1, pzpVal2);\n\tif (liRet != 0) {\n\t\treturn liRet;\n\t}\n\n\treturn 0;\n}\n\n// 最大公約数 - 取得\nint\nfGetGcd(\n\tint piVal1\t\t\t\t\t// <I> 値1\n\t, int piVal2\t\t\t\t// <I> 値2\n)\n{\n\tint liWork;\n\n\t// ユークリッドの互除法\n\tif (piVal1 < piVal2) {\n\t\tliWork = piVal1;\n\t\tpiVal1 = piVal2;\n\t\tpiVal2 = liWork;\n\t}\n\twhile (piVal2 > 0) {\n\t\tliWork = piVal1 % piVal2;\n\t\tpiVal1 = piVal2;\n\t\tpiVal2 = liWork;\n\t}\n\n\treturn piVal1;\n}\n\n// 最小公倍数 - 取得\nint\nfGetLcm(\n\tint piVal1\t\t\t\t\t// <I> 値1\n\t, int piVal2\t\t\t\t// <I> 値2\n)\n{\n\t// 最大公約数 - 取得\n\tint liGcd = fGetGcd(piVal1, piVal2);\n\n\t// 約数\n\tint liVal1 = piVal1 / liGcd;\n\tint liVal2 = piVal2 / liGcd;\n\n\treturn liVal1 * liVal2 * liGcd;\n}\n\n// 選択数字 - セット\nint\nfSetSNum(\n\tint piNNo\t\t\t\t\t// <I> 数字 0~\n\t, int piMCnt\t\t\t\t// <I> 残マッチ数\n\t, int piSCnt\t\t\t\t// <I> 選択数字数\n\t, int *pipNCnt\t\t\t\t// <I> 数字数\n)\n{\n\tint i;\n\n\t// 選択数字\n\tif (piMCnt != siMCnt) {\n\t\tif (si2SCnt[piNNo][piMCnt] >= piSCnt) {\n\t\t\treturn 0;\n\t\t}\n\t\tsi2SCnt[piNNo][piMCnt] = piSCnt;\n\t}\n\n\t// 選択中\n\tif (piNNo < siNCnt) {\n\n\t\t// ループ回数\n\t\tint liCnt = piMCnt / sz1Num[piNNo].miMCnt;\n\n\t\t// 下位へ\n\t\tfor (i = liCnt; i >= 0; i--) {\n\t\t\tpipNCnt[piNNo] = i;\n\t\t\tfSetSNum(piNNo + 1, piMCnt - sz1Num[piNNo].miMCnt * i, piSCnt + i, pipNCnt);\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t// 残マッチ数\n\tif (piMCnt != 0) {\n\t\treturn 0;\n\t}\n\n\t// 選択数字\n\tmemcpy(si1SNum, pipNCnt, sizeof(si1SNum));\n\n\treturn 0;\n}\n\n// 実行メイン\nint\nfMain(\n\tint piTNo\t\t\t\t\t// <I> テスト番号 1~\n)\n{\n\tint i, j;\n\tchar lc1Buf[1024];\n\n\t// データ - 初期化\n\tmemset(sz1Num, 0, sizeof(sz1Num));\t\t\t\t\t\t\t// 数字\n\tmemset(si2SCnt, 0, sizeof(si2SCnt));\t\t\t\t\t\t// 選択数字数[数字][マッチ数]\n\n\t// 入力 - セット\n#ifdef D_TEST\n\tsprintf(lc1Buf, \".\\\\Test\\\\T%d.txt\", piTNo);\n\tszpFpI = fopen(lc1Buf, \"r\");\n\tsprintf(lc1Buf, \".\\\\Test\\\\A%d.txt\", piTNo);\n\tszpFpA = fopen(lc1Buf, \"r\");\n\tsiRes = 0;\n#else\n\tszpFpI = stdin;\n#endif\n\n\t// 数字 - 初期化\n\tsz1Num[0].miVal = 1;\n\tsz1Num[0].miMCnt = 2;\n\tsz1Num[1].miVal = 2;\n\tsz1Num[1].miMCnt = 5;\n\tsz1Num[2].miVal = 3;\n\tsz1Num[2].miMCnt = 5;\n\tsz1Num[3].miVal = 4;\n\tsz1Num[3].miMCnt = 4;\n\tsz1Num[4].miVal = 5;\n\tsz1Num[4].miMCnt = 5;\n\tsz1Num[5].miVal = 6;\n\tsz1Num[5].miMCnt = 6;\n\tsz1Num[6].miVal = 7;\n\tsz1Num[6].miMCnt = 3;\n\tsz1Num[7].miVal = 8;\n\tsz1Num[7].miMCnt = 7;\n\tsz1Num[8].miVal = 9;\n\tsz1Num[8].miMCnt = 6;\n\n\t// マッチ数・使用数字数 - 取得\n\tint liNCnt;\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpI);\n\tsscanf(lc1Buf, \"%d%d\", &siMCnt, &liNCnt);\n\n\t// 使用数字 - 取得\n\tfor (i = 0; i < liNCnt; i++) {\n\t\tint liNum;\n\t\tfscanf(szpFpI, \"%d\", &liNum);\n\t\tsz1Num[liNum - 1].miUse = D_ON;\n\t}\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpI);\n\n\t// 数字 - ソート\n\tqsort(sz1Num, D_NUM_KIND, sizeof(Num), fSortFnc);\n\n\t// 不要数字 - 削除\n\tsiNCnt = 1;\n\tfor (i = 1; i < D_NUM_KIND; i++) {\n\t\tif (sz1Num[i].miUse == D_OFF) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sz1Num[i].miMCnt == sz1Num[i - 1].miMCnt) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (siNCnt != i) {\n\t\t\tmemcpy(&sz1Num[siNCnt], &sz1Num[i], sizeof(Num));\n\t\t}\n\t\tsiNCnt++;\n\t}\n\n\t// 最小公倍数 - 取得\n\tint liLcm = sz1Num[0].miMCnt;\n\tfor (i = 1; i < siNCnt; i++) {\n\t\tliLcm = fGetLcm(liLcm, sz1Num[i].miMCnt);\n\t}\n\n\t// 確定個数\n\tint liFCnt = (siMCnt - liLcm) / sz1Num[0].miMCnt;\n\tsz1Num[0].miUCnt = liFCnt;\n\n\t// 残本数\n\tsiMCnt -= liFCnt * sz1Num[0].miMCnt;\n\n\t// 数字 - ソート\n\tqsort(sz1Num, siNCnt, sizeof(Num), fSortFncVd);\n\n\t// 選択数字 - セット\n\tint li1UCnt[D_NUM_KIND];\n\tmemset(li1UCnt, 0, sizeof(li1UCnt));\n\tfSetSNum(0, siMCnt, 0, li1UCnt);\n\n\t// 使用数 - 加算\n\tfor (i = 0; i < siNCnt; i++) {\n\t\tsz1Num[i].miUCnt += si1SNum[i];\n\t}\n\n\t// 結果 - セット\n\tint liNo = 0;\n\tfor (i = 0; i < D_NUM_KIND; i++) {\n\t\tfor (j = 0; j < sz1Num[i].miUCnt; j++) {\n\t\t\tsc1Out[liNo] = sz1Num[i].miVal + '0';\n\t\t\tliNo++;\n\t\t}\n\t}\n\tsc1Out[liNo] = '\\n';\n\tsc1Out[liNo + 1] = '\\0';\n\n\t// 結果 - 表示\n#ifdef D_TEST\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpA);\n\tif (strcmp(lc1Buf, sc1Out)) {\n\t\tsiRes = -1;\n\t}\n#else\n\tprintf(\"%s\", sc1Out);\n#endif\n\n\t// 残データ有無\n#ifdef D_TEST\n\tlc1Buf[0] = '\\0';\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpA);\n\tif (strcmp(lc1Buf, \"\")) {\n\t\tsiRes = -1;\n\t}\n#endif\n\n\t// テストファイルクローズ\n#ifdef D_TEST\n\tfclose(szpFpI);\n\tfclose(szpFpA);\n#endif\n\n\t// テスト結果\n#ifdef D_TEST\n\tif (siRes == 0) {\n\t\tprintf(\"OK %d\\n\", piTNo);\n\t}\n\telse {\n\t\tprintf(\"NG %d\\n\", piTNo);\n\t}\n#endif\n\n\treturn 0;\n}\n\nint\nmain()\n{\n\n#ifdef D_TEST\n\tint i;\n\tfor (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {\n\t\tfMain(i);\n\t}\n#else\n\tfMain(0);\n#endif\n\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.local\tszpFpI\n\t.comm\tszpFpI,8,8\n\t.local\tsiMCnt\n\t.comm\tsiMCnt,4,4\n\t.local\tsz1Num\n\t.comm\tsz1Num,144,32\n\t.local\tsiNCnt\n\t.comm\tsiNCnt,4,4\n\t.local\tsi1SNum\n\t.comm\tsi1SNum,56,32\n\t.local\tsi2SCnt\n\t.comm\tsi2SCnt,336000,32\n\t.local\tsc1Out\n\t.comm\tsc1Out,20000,32\n\t.globl\tfSortFncVd\n\t.type\tfSortFncVd, @function\nfSortFncVd:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L2\n\tmovl\t$-1, %eax\n\tjmp\t.L3\n.L2:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L4\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L4:\n\tmovl\t$0, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tfSortFncVd, .-fSortFncVd\n\t.globl\tfSortFnc\n\t.type\tfSortFnc, @function\nfSortFnc:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t8(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t8(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L6\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L6:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t8(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t8(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L8:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L9:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L10\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L10:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tfSortFncVd\n\tmovl\t%eax, -20(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tje\t.L11\n\tmovl\t-20(%rbp), %eax\n\tjmp\t.L7\n.L11:\n\tmovl\t$0, %eax\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tfSortFnc, .-fSortFnc\n\t.globl\tfGetGcd\n\t.type\tfGetGcd, @function\nfGetGcd:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjge\t.L14\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L14:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L15\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tfGetGcd, .-fGetGcd\n\t.globl\tfGetLcm\n\t.type\tfGetLcm, @function\nfGetLcm:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tfGetGcd\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-12(%rbp)\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcltd\n\tidivl\t-12(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %eax\n\timull\t-4(%rbp), %eax\n\timull\t-12(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tfGetLcm, .-fGetLcm\n\t.globl\tfSetSNum\n\t.type\tfSetSNum, @function\nfSetSNum:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovq\t%rcx, -40(%rbp)\n\tmovl\tsiMCnt(%rip), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tje\t.L20\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\timulq\t$6000, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tsi2SCnt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjg\t.L21\n\tmovl\t$0, %eax\n\tjmp\t.L22\n.L21:\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\timulq\t$6000, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tsi2SCnt(%rip), %rdx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n.L20:\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L23\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %esi\n\tmovl\t-24(%rbp), %eax\n\tcltd\n\tidivl\t%esi\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L24\n.L25:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tmovl\t-24(%rbp), %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %esi\n\tmovl\t-20(%rbp), %eax\n\tleal\t1(%rax), %edi\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tcall\tfSetSNum\n\tsubl\t$1, -8(%rbp)\n.L24:\n\tcmpl\t$0, -8(%rbp)\n\tjns\t.L25\n\tmovl\t$0, %eax\n\tjmp\t.L22\n.L23:\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L26\n\tmovl\t$0, %eax\n\tjmp\t.L22\n.L26:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t$56, %edx\n\tmovq\t%rax, %rsi\n\tleaq\tsi1SNum(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemcpy@PLT\n\tmovl\t$0, %eax\n.L22:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tfSetSNum, .-fSetSNum\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%s\"\n\t.text\n\t.globl\tfMain\n\t.type\tfMain, @function\nfMain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$1136, %rsp\n\tmovl\t%edi, -1124(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$144, %edx\n\tmovl\t$0, %esi\n\tleaq\tsz1Num(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$336000, %edx\n\tmovl\t$0, %esi\n\tleaq\tsi2SCnt(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovq\tstdin(%rip), %rax\n\tmovq\t%rax, szpFpI(%rip)\n\tmovl\t$1, sz1Num(%rip)\n\tmovl\t$2, 4+sz1Num(%rip)\n\tmovl\t$2, 16+sz1Num(%rip)\n\tmovl\t$5, 20+sz1Num(%rip)\n\tmovl\t$3, 32+sz1Num(%rip)\n\tmovl\t$5, 36+sz1Num(%rip)\n\tmovl\t$4, 48+sz1Num(%rip)\n\tmovl\t$4, 52+sz1Num(%rip)\n\tmovl\t$5, 64+sz1Num(%rip)\n\tmovl\t$5, 68+sz1Num(%rip)\n\tmovl\t$6, 80+sz1Num(%rip)\n\tmovl\t$6, 84+sz1Num(%rip)\n\tmovl\t$7, 96+sz1Num(%rip)\n\tmovl\t$3, 100+sz1Num(%rip)\n\tmovl\t$8, 112+sz1Num(%rip)\n\tmovl\t$7, 116+sz1Num(%rip)\n\tmovl\t$9, 128+sz1Num(%rip)\n\tmovl\t$6, 132+sz1Num(%rip)\n\tmovq\tszpFpI(%rip), %rdx\n\tleaq\t-1040(%rbp), %rax\n\tmovl\t$1024, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\tleaq\t-1116(%rbp), %rdx\n\tleaq\t-1040(%rbp), %rax\n\tmovq\t%rdx, %rcx\n\tleaq\tsiMCnt(%rip), %rdx\n\tleaq\t.LC0(%rip), %rsi\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_sscanf@PLT\n\tmovl\t$0, -1108(%rbp)\n\tjmp\t.L28\n.L29:\n\tmovq\tszpFpI(%rip), %rax\n\tleaq\t-1112(%rbp), %rdx\n\tleaq\t.LC1(%rip), %rcx\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_fscanf@PLT\n\tmovl\t-1112(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t8+sz1Num(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\taddl\t$1, -1108(%rbp)\n.L28:\n\tmovl\t-1116(%rbp), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tjl\t.L29\n\tmovq\tszpFpI(%rip), %rdx\n\tleaq\t-1040(%rbp), %rax\n\tmovl\t$1024, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\tleaq\tfSortFnc(%rip), %rax\n\tmovq\t%rax, %rcx\n\tmovl\t$16, %edx\n\tmovl\t$9, %esi\n\tleaq\tsz1Num(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$1, siNCnt(%rip)\n\tmovl\t$1, -1108(%rbp)\n\tjmp\t.L30\n.L36:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t8+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tje\t.L47\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-1108(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L48\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tje\t.L35\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tsz1Num(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovl\tsiNCnt(%rip), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$4, %rcx\n\tleaq\tsz1Num(%rip), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx)\n\tmovq\t%rdx, 8(%rcx)\n.L35:\n\tmovl\tsiNCnt(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, siNCnt(%rip)\n\tjmp\t.L34\n.L48:\n\tnop\n.L34:\n\taddl\t$1, -1108(%rbp)\n.L30:\n\tcmpl\t$8, -1108(%rbp)\n\tjle\t.L36\n\tjmp\t.L32\n.L47:\n\tnop\n.L32:\n\tmovl\t4+sz1Num(%rip), %eax\n\tmovl\t%eax, -1100(%rbp)\n\tmovl\t$1, -1108(%rbp)\n\tjmp\t.L37\n.L38:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-1100(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tfGetLcm\n\tmovl\t%eax, -1100(%rbp)\n\taddl\t$1, -1108(%rbp)\n.L37:\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tjl\t.L38\n\tmovl\tsiMCnt(%rip), %eax\n\tsubl\t-1100(%rbp), %eax\n\tmovl\t4+sz1Num(%rip), %edi\n\tcltd\n\tidivl\t%edi\n\tmovl\t%eax, -1092(%rbp)\n\tmovl\t-1092(%rbp), %eax\n\tmovl\t%eax, 12+sz1Num(%rip)\n\tmovl\tsiMCnt(%rip), %edx\n\tmovl\t4+sz1Num(%rip), %eax\n\timull\t-1092(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, siMCnt(%rip)\n\tmovl\tsiNCnt(%rip), %eax\n\tcltq\n\tleaq\tfSortFncVd(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$16, %edx\n\tmovq\t%rax, %rsi\n\tleaq\tsz1Num(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tleaq\t-1088(%rbp), %rax\n\tmovl\t$36, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\tsiMCnt(%rip), %eax\n\tleaq\t-1088(%rbp), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$0, %edx\n\tmovl\t%eax, %esi\n\tmovl\t$0, %edi\n\tcall\tfSetSNum\n\tmovl\t$0, -1108(%rbp)\n\tjmp\t.L39\n.L40:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t12+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tsi1SNum(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, %ecx\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t12+sz1Num(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\taddl\t$1, -1108(%rbp)\n.L39:\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tjl\t.L40\n\tmovl\t$0, -1096(%rbp)\n\tmovl\t$0, -1108(%rbp)\n\tjmp\t.L41\n.L44:\n\tmovl\t$0, -1104(%rbp)\n\tjmp\t.L42\n.L43:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tsz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t$48, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t-1096(%rbp), %eax\n\tcltq\n\tleaq\tsc1Out(%rip), %rdx\n\tmovb\t%cl, (%rax,%rdx)\n\taddl\t$1, -1096(%rbp)\n\taddl\t$1, -1104(%rbp)\n.L42:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t12+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -1104(%rbp)\n\tjl\t.L43\n\taddl\t$1, -1108(%rbp)\n.L41:\n\tcmpl\t$8, -1108(%rbp)\n\tjle\t.L44\n\tmovl\t-1096(%rbp), %eax\n\tcltq\n\tleaq\tsc1Out(%rip), %rdx\n\tmovb\t$10, (%rax,%rdx)\n\tmovl\t-1096(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\tsc1Out(%rip), %rdx\n\tmovb\t$0, (%rax,%rdx)\n\tleaq\tsc1Out(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L46\n\tcall\t__stack_chk_fail@PLT\n.L46:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tfMain, .-fMain\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$0, %edi\n\tcall\tfMain\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\t.size\tfSortFncVd, .-fSortFncVd\n\t.p2align 4\n\t.globl\tfSortFnc\n\t.type\tfSortFnc, @function\nfSortFnc:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t8(%rsi), %ecx\n\tmovl\t$-1, %eax\n\tcmpl\t%ecx, 8(%rdi)\n\tjg\t.L5\n\tmovl\t$1, %eax\n\tjl\t.L5\n\tmovl\t4(%rsi), %edx\n\tcmpl\t%edx, 4(%rdi)\n\tjg\t.L5\n\tmovl\t$-1, %eax\n\tjl\t.L5\n\tmovl\t(%rsi), %edx\n\tcmpl\t%edx, (%rdi)\n\tsetl\t%dl\n\tmovzbl\t%dl, %edx\n\tcmovle\t%edx, %eax\n.L5:\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tfSortFnc, .-fSortFnc\n\t.p2align 4\n\t.globl\tfGetGcd\n\t.type\tfGetGcd, @function\nfGetGcd:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\tcmpl\t%esi, %edi\n\tjge\t.L13\n\tmovl\t%esi, %eax\n\tmovl\t%edi, %edx\n.L13:\n\ttestl\t%edx, %edx\n\tjle\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L15\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovl\t%eax, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tfGetGcd, .-fGetGcd\n\t.p2align 4\n\t.globl\tfGetLcm\n\t.type\tfGetLcm, @function\nfGetLcm:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tjge\t.L22\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\ttestl\t%edx, %edx\n\tjle\t.L23\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%ecx, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L21\n.L20:\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %edi\n\tmovl\t%esi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%eax, %edi\n\tmovl\t%edi, %eax\n\timull\t%ecx, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L21\n.L23:\n\tmovl\t%eax, %ecx\n\tjmp\t.L20\n\t.cfi_endproc\n.LFE54:\n\t.size\tfGetLcm, .-fGetLcm\n\t.p2align 4\n\t.globl\tfSetSNum\n\t.type\tfSetSNum, @function\nfSetSNum:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t%esi, %r9d\n\tmovl\t%edi, %r15d\n\tmovl\t%edx, %esi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$376, %rsp\n\t.cfi_def_cfa_offset 432\n\tcmpl\t%r9d, siMCnt(%rip)\n\tje\t.L26\n\tmovslq\t%r15d, %rax\n\tmovslq\t%r9d, %rdx\n\tleaq\tsi2SCnt(%rip), %rdi\n\timulq\t$6000, %rax, %rax\n\taddq\t%rdx, %rax\n\tcmpl\t%esi, (%rdi,%rax,4)\n\tjge\t.L28\n\tmovl\t%esi, (%rdi,%rax,4)\n.L26:\n\tmovl\tsiNCnt(%rip), %r8d\n\tcmpl\t%r15d, %r8d\n\tjg\t.L90\n\ttestl\t%r9d, %r9d\n\tje\t.L91\n.L28:\n\taddq\t$376, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\t.cfi_restore_state\n\tmovdqu\t(%rcx), %xmm0\n\tmovaps\t%xmm0, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm1\n\tmovaps\t%xmm1, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm2\n\tmovaps\t%xmm2, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L90:\n\tmovslq\t%r15d, %rbx\n\tmovl\t%r9d, %eax\n\tleaq\tsz1Num(%rip), %r13\n\tmovq\t%rbx, %rdx\n\tmovq\t%rbx, 56(%rsp)\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rdi\n\tcltd\n\tidivl\t4(%r13,%rdi)\n\tmovl\t%eax, %r10d\n\ttestl\t%eax, %eax\n\tjs\t.L28\n\tleaq\t0(,%rbx,4), %rax\n\tleal\t1(%r15), %r12d\n\tleaq\t(%rcx,%rax), %rdi\n\tleaq\t4(%rcx,%rax), %rax\n\tmovl\t%r12d, 152(%rsp)\n\tmovq\t%rax, 88(%rsp)\n\tleal\t2(%r15), %eax\n\tmovl\t%eax, 156(%rsp)\n\tcltq\n\tmovq\t%rdi, 72(%rsp)\n\tleaq\t(%rcx,%rax,4), %rdi\n\tmovq\t%rdi, 112(%rsp)\n\tleal\t3(%r15), %edi\n\tmovl\t%edi, 172(%rsp)\n\tmovslq\t%edi, %rdi\n\tleaq\t(%rcx,%rdi,4), %rbx\n\tmovq\t%rax, 32(%rsp)\n\tmovq\t%rbx, 120(%rsp)\n\tleal\t4(%r15), %ebx\n\tmovslq\t%ebx, %rdx\n\tmovl\t%ebx, 212(%rsp)\n\tleaq\t(%rcx,%rdx,4), %rbx\n\tmovq\t%rdi, 64(%rsp)\n\tmovq\t%rbx, 144(%rsp)\n\tleal\t5(%r15), %ebx\n\tmovl\t%ebx, 236(%rsp)\n\tmovslq\t%ebx, %rbx\n\tleaq\t(%rcx,%rbx,4), %r11\n\tmovq\t%rdx, 80(%rsp)\n\tmovq\t%r11, 160(%rsp)\n\tleal\t6(%r15), %r11d\n\tmovl\t%r11d, 256(%rsp)\n\tmovslq\t%r11d, %r11\n\tleaq\t(%rcx,%r11,4), %r14\n\tmovq\t%r11, 312(%rsp)\n\tmovq\t%r14, 176(%rsp)\n\tleal\t7(%r15), %r14d\n\tmovl\t%r14d, 280(%rsp)\n\tmovslq\t%r14d, %r14\n\tleaq\t(%rcx,%r14,4), %rbp\n\tmovq\t%rbx, 104(%rsp)\n\tmovq\t%rbp, 216(%rsp)\n\tleal\t8(%r15), %ebp\n\tmovl\t%ebp, 284(%rsp)\n\tmovslq\t%ebp, %rbp\n\tleaq\t(%rcx,%rbp,4), %rax\n\tmovq\t%r14, 128(%rsp)\n\tmovq\t%rax, 240(%rsp)\n\tleal\t(%rsi,%r10), %eax\n\tmovslq\t%r12d, %rsi\n\tmovl\t%eax, 16(%rsp)\n\timulq\t$6000, %rbp, %rax\n\tmovq\t%rbp, 328(%rsp)\n\tmovq\t%rsi, 48(%rsp)\n\tmovq\t%rax, 304(%rsp)\n\timulq\t$6000, %r14, %rax\n\tmovq\t%rax, 296(%rsp)\n\timulq\t$6000, %r11, %rax\n\tleaq\tsi2SCnt(%rip), %r11\n\tmovq\t%rax, 288(%rsp)\n\timulq\t$6000, %rbx, %rax\n\tmovq\t%rax, 272(%rsp)\n\timulq\t$6000, %rdx, %rax\n\tmovq\t%rax, 264(%rsp)\n\timulq\t$6000, %rdi, %rax\n\tmovq\t%rax, 248(%rsp)\n\timulq\t$6000, 32(%rsp), %rax\n\tmovl\t%r15d, 340(%rsp)\n\tmovl\t%r9d, 96(%rsp)\n\tmovq\t%rax, 224(%rsp)\n\timulq\t$6000, %rsi, %rax\n\tmovq\t%rax, 192(%rsp)\n.L79:\n\tmovq\t72(%rsp), %rax\n\tmovl\t96(%rsp), %r9d\n\tmovl\t%r10d, (%rax)\n\tmovq\t56(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %edi\n\timull\t%r10d, %edi\n\tsubl\t%edi, %r9d\n\tcmpl\tsiMCnt(%rip), %r9d\n\tje\t.L31\n\tmovslq\t%r9d, %rax\n\taddq\t192(%rsp), %rax\n\tmovl\t16(%rsp), %edi\n\tcmpl\t(%r11,%rax,4), %edi\n\tjle\t.L33\n\tmovl\t%edi, (%r11,%rax,4)\n.L31:\n\tcmpl\t152(%rsp), %r8d\n\tjg\t.L92\n\ttestl\t%r9d, %r9d\n\tjne\t.L33\n\tmovdqu\t(%rcx), %xmm3\n\tmovaps\t%xmm3, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm4\n\tmovaps\t%xmm4, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm5\n\tmovaps\t%xmm5, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L33:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 16(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L79\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L92:\n\tmovq\t48(%rsp), %rdx\n\tmovl\t%r9d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r14d\n\ttestl\t%eax, %eax\n\tjs\t.L33\n\tmovl\t16(%rsp), %eax\n\tmovl\t%r9d, 100(%rsp)\n\tmovl\t%r8d, %r9d\n\tmovl\t%r10d, 320(%rsp)\n\tmovl\t%r14d, %r10d\n\taddl\t%r14d, %eax\n\tmovl\t%eax, 20(%rsp)\n.L78:\n\tmovq\t88(%rsp), %rax\n\tmovl\t100(%rsp), %r14d\n\tmovl\t%r10d, (%rax)\n\tmovq\t48(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %ebx\n\timull\t%r10d, %ebx\n\tsubl\t%ebx, %r14d\n\tcmpl\tsiMCnt(%rip), %r14d\n\tje\t.L36\n\tmovslq\t%r14d, %rax\n\taddq\t224(%rsp), %rax\n\tmovl\t20(%rsp), %ebx\n\tcmpl\t(%r11,%rax,4), %ebx\n\tjle\t.L38\n\tmovl\t%ebx, (%r11,%rax,4)\n.L36:\n\tcmpl\t156(%rsp), %r9d\n\tjg\t.L93\n\ttestl\t%r14d, %r14d\n\tjne\t.L38\n\tmovdqu\t(%rcx), %xmm6\n\tmovaps\t%xmm6, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm7\n\tmovaps\t%xmm7, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm6\n\tmovaps\t%xmm6, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L38:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 20(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L78\n\tmovl\t320(%rsp), %r10d\n\tmovl\t%r9d, %r8d\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovq\t32(%rsp), %rdx\n\tmovl\t%r14d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r8d\n\ttestl\t%eax, %eax\n\tjs\t.L38\n\tmovl\t20(%rsp), %eax\n\tmovl\t%r14d, 136(%rsp)\n\tmovl\t%r10d, 324(%rsp)\n\taddl\t%r8d, %eax\n\tmovl\t%r9d, 12(%rsp)\n\tmovl\t%r8d, %r9d\n\tmovl\t%eax, 24(%rsp)\n.L77:\n\tmovq\t112(%rsp), %rax\n\tmovl\t136(%rsp), %r10d\n\tmovl\t%r9d, (%rax)\n\tmovq\t32(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %esi\n\timull\t%r9d, %esi\n\tsubl\t%esi, %r10d\n\tcmpl\tsiMCnt(%rip), %r10d\n\tje\t.L41\n\tmovslq\t%r10d, %rax\n\taddq\t248(%rsp), %rax\n\tmovl\t24(%rsp), %edx\n\tcmpl\t(%r11,%rax,4), %edx\n\tjle\t.L43\n\tmovl\t%edx, (%r11,%rax,4)\n.L41:\n\tmovl\t172(%rsp), %edi\n\tcmpl\t%edi, 12(%rsp)\n\tjg\t.L94\n\ttestl\t%r10d, %r10d\n\tjne\t.L43\n\tmovdqu\t(%rcx), %xmm7\n\tmovaps\t%xmm7, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm3\n\tmovaps\t%xmm3, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm4\n\tmovaps\t%xmm4, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L43:\n\tsubl\t$1, %r9d\n\tsubl\t$1, 24(%rsp)\n\tcmpl\t$-1, %r9d\n\tjne\t.L77\n\tmovl\t12(%rsp), %r9d\n\tmovl\t324(%rsp), %r10d\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L94:\n\tmovq\t64(%rsp), %rdx\n\tmovl\t%r10d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r15d\n\ttestl\t%eax, %eax\n\tjs\t.L43\n\tmovl\t24(%rsp), %eax\n\tmovl\t%r9d, 336(%rsp)\n\tmovl\t%r10d, 140(%rsp)\n\tmovl\t%r15d, %r10d\n\taddl\t%r15d, %eax\n\tmovl\t%eax, 28(%rsp)\n.L76:\n\tmovq\t120(%rsp), %rax\n\tmovl\t140(%rsp), %r9d\n\tmovl\t%r10d, (%rax)\n\tmovq\t64(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %edi\n\timull\t%r10d, %edi\n\tsubl\t%edi, %r9d\n\tcmpl\tsiMCnt(%rip), %r9d\n\tje\t.L46\n\tmovslq\t%r9d, %rax\n\taddq\t264(%rsp), %rax\n\tmovl\t28(%rsp), %esi\n\tcmpl\t(%r11,%rax,4), %esi\n\tjle\t.L48\n\tmovl\t%esi, (%r11,%rax,4)\n.L46:\n\tmovl\t212(%rsp), %esi\n\tcmpl\t%esi, 12(%rsp)\n\tjg\t.L95\n\ttestl\t%r9d, %r9d\n\tjne\t.L48\n\tmovdqu\t(%rcx), %xmm5\n\tmovaps\t%xmm5, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm0\n\tmovaps\t%xmm0, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm1\n\tmovaps\t%xmm1, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L48:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 28(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L76\n\tmovl\t336(%rsp), %r9d\n\tjmp\t.L43\n\t.p2align 4,,10\n\t.p2align 3\n.L95:\n\tmovq\t80(%rsp), %rdx\n\tmovl\t%r9d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r8d\n\ttestl\t%eax, %eax\n\tjs\t.L48\n\tmovl\t28(%rsp), %eax\n\tmovl\t%r9d, 168(%rsp)\n\tmovl\t%r10d, 344(%rsp)\n\tmovl\t%r8d, %r10d\n\taddl\t%r8d, %eax\n\tmovl\t%eax, 40(%rsp)\n.L75:\n\tmovq\t144(%rsp), %rax\n\tmovl\t168(%rsp), %r9d\n\tmovl\t%r10d, (%rax)\n\tmovq\t80(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %ebx\n\timull\t%r10d, %ebx\n\tsubl\t%ebx, %r9d\n\tcmpl\tsiMCnt(%rip), %r9d\n\tje\t.L51\n\tmovslq\t%r9d, %rax\n\taddq\t272(%rsp), %rax\n\tmovl\t40(%rsp), %edx\n\tcmpl\t(%r11,%rax,4), %edx\n\tjle\t.L53\n\tmovl\t%edx, (%r11,%rax,4)\n.L51:\n\tmovl\t236(%rsp), %edi\n\tcmpl\t%edi, 12(%rsp)\n\tjg\t.L96\n\ttestl\t%r9d, %r9d\n\tjne\t.L53\n\tmovdqu\t(%rcx), %xmm2\n\tmovaps\t%xmm2, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm7\n\tmovaps\t%xmm7, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm5\n\tmovaps\t%xmm5, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L53:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 40(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L75\n\tmovl\t344(%rsp), %r10d\n\tjmp\t.L48\n\t.p2align 4,,10\n\t.p2align 3\n.L96:\n\tmovq\t104(%rsp), %rdx\n\tmovl\t%r9d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r8d\n\ttestl\t%eax, %eax\n\tjs\t.L53\n\tmovl\t40(%rsp), %eax\n\tmovl\t%r9d, 208(%rsp)\n\tmovl\t%r8d, %r14d\n\tmovl\t%r10d, 348(%rsp)\n\taddl\t%r8d, %eax\n\tmovl\t%eax, 44(%rsp)\n.L74:\n\tmovq\t160(%rsp), %rax\n\tmovl\t208(%rsp), %r15d\n\tmovl\t%r14d, (%rax)\n\tmovq\t104(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %edx\n\timull\t%r14d, %edx\n\tsubl\t%edx, %r15d\n\tcmpl\tsiMCnt(%rip), %r15d\n\tje\t.L56\n\tmovslq\t%r15d, %rax\n\taddq\t288(%rsp), %rax\n\tmovl\t44(%rsp), %ebx\n\tcmpl\t(%r11,%rax,4), %ebx\n\tjle\t.L58\n\tmovl\t%ebx, (%r11,%rax,4)\n.L56:\n\tmovl\t256(%rsp), %edi\n\tcmpl\t%edi, 12(%rsp)\n\tjg\t.L97\n\ttestl\t%r15d, %r15d\n\tjne\t.L58\n\tmovdqu\t(%rcx), %xmm2\n\tmovaps\t%xmm2, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm6\n\tmovaps\t%xmm6, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm3\n\tmovaps\t%xmm3, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L58:\n\tsubl\t$1, %r14d\n\tsubl\t$1, 44(%rsp)\n\tcmpl\t$-1, %r14d\n\tjne\t.L74\n\tmovl\t348(%rsp), %r10d\n\tjmp\t.L53\n\t.p2align 4,,10\n\t.p2align 3\n.L97:\n\tmovq\t312(%rsp), %rax\n\tsalq\t$4, %rax\n\taddq\t%r13, %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, 200(%rsp)\n\tmovl\t%r15d, %eax\n\tcltd\n\tidivl\t4(%rsi)\n\tmovl\t%eax, %ebx\n\ttestl\t%eax, %eax\n\tjs\t.L58\n\tmovl\t44(%rsp), %eax\n\tmovl\t%r14d, 352(%rsp)\n\tmovl\t%r15d, 232(%rsp)\n\taddl\t%ebx, %eax\n\tmovl\t%eax, %r15d\n.L73:\n\tmovq\t176(%rsp), %rax\n\tmovq\t200(%rsp), %rdi\n\tmovl\t232(%rsp), %r14d\n\tmovl\t%ebx, (%rax)\n\tmovl\t4(%rdi), %eax\n\timull\t%ebx, %eax\n\tsubl\t%eax, %r14d\n\tcmpl\tsiMCnt(%rip), %r14d\n\tje\t.L61\n\tmovslq\t%r14d, %rax\n\taddq\t296(%rsp), %rax\n\tcmpl\t(%r11,%rax,4), %r15d\n\tjle\t.L63\n\tmovl\t%r15d, (%r11,%rax,4)\n.L61:\n\tmovl\t280(%rsp), %edx\n\tcmpl\t%edx, 12(%rsp)\n\tjg\t.L98\n\ttestl\t%r14d, %r14d\n\tjne\t.L63\n\tmovdqu\t(%rcx), %xmm4\n\tmovaps\t%xmm4, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm0\n\tmovaps\t%xmm0, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm1\n\tmovaps\t%xmm1, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L63:\n\tsubl\t$1, %ebx\n\tsubl\t$1, %r15d\n\tcmpl\t$-1, %ebx\n\tjne\t.L73\n\tmovl\t352(%rsp), %r14d\n\tjmp\t.L58\n\t.p2align 4,,10\n\t.p2align 3\n.L98:\n\tmovq\t128(%rsp), %rdx\n\tmovl\t%r14d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r12d\n\ttestl\t%eax, %eax\n\tjs\t.L63\n\tleal\t(%r15,%rax), %r9d\n\tmovq\t328(%rsp), %rax\n\tmovl\t%ebx, 356(%rsp)\n\tmovl\t%r14d, 260(%rsp)\n\tmovl\t%r9d, %ebx\n\tmovq\t%rcx, %r14\n\tsalq\t$4, %rax\n\tmovl\t%r15d, 360(%rsp)\n\tmovl\t%r12d, %r15d\n\tleaq\t4(%r13,%rax), %rax\n\tmovq\t%rax, 184(%rsp)\n.L72:\n\tmovq\t216(%rsp), %rax\n\tmovl\t260(%rsp), %r12d\n\tmovl\t%r15d, (%rax)\n\tmovq\t128(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %esi\n\timull\t%r15d, %esi\n\tsubl\t%esi, %r12d\n\tcmpl\tsiMCnt(%rip), %r12d\n\tje\t.L66\n\tmovslq\t%r12d, %rax\n\taddq\t304(%rsp), %rax\n\tcmpl\t(%r11,%rax,4), %ebx\n\tjle\t.L68\n\tmovl\t%ebx, (%r11,%rax,4)\n.L66:\n\tmovl\t284(%rsp), %ecx\n\tcmpl\t%ecx, 12(%rsp)\n\tjg\t.L99\n\ttestl\t%r12d, %r12d\n\tjne\t.L68\n\tmovdqu\t(%r14), %xmm4\n\tmovaps\t%xmm4, si1SNum(%rip)\n\tmovdqu\t16(%r14), %xmm2\n\tmovaps\t%xmm2, 16+si1SNum(%rip)\n\tmovdqu\t32(%r14), %xmm0\n\tmovaps\t%xmm0, 32+si1SNum(%rip)\n\tmovq\t48(%r14), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L68:\n\tsubl\t$1, %r15d\n\tsubl\t$1, %ebx\n\tcmpl\t$-1, %r15d\n\tjne\t.L72\n\tmovl\t356(%rsp), %ebx\n\tmovl\t360(%rsp), %r15d\n\tmovq\t%r14, %rcx\n\tjmp\t.L63\n\t.p2align 4,,10\n\t.p2align 3\n.L99:\n\tmovl\t%r12d, %eax\n\tmovq\t184(%rsp), %rcx\n\tcltd\n\tidivl\t(%rcx)\n\tmovl\t%eax, %ebp\n\ttestl\t%eax, %eax\n\tjs\t.L68\n\tmovl\t340(%rsp), %eax\n\tmovl\t%r15d, 364(%rsp)\n\tmovq\t%r14, %r15\n\tmovl\t%ebp, %r14d\n\taddl\t$9, %eax\n\tmovl\t%eax, %ebp\n.L71:\n\tmovq\t240(%rsp), %rax\n\tmovq\t184(%rsp), %rsi\n\tmovq\t%r15, %rcx\n\tmovl\t%ebp, %edi\n\tleal\t(%r14,%rbx), %edx\n\tmovl\t%r14d, (%rax)\n\tmovl\t(%rsi), %eax\n\tmovl\t%r12d, %esi\n\timull\t%r14d, %eax\n\tsubl\t$1, %r14d\n\tsubl\t%eax, %esi\n\tcall\tfSetSNum\n\tcmpl\t$-1, %r14d\n\tleaq\tsi2SCnt(%rip), %r11\n\tjne\t.L71\n\tmovq\t%r15, %r14\n\tmovl\t364(%rsp), %r15d\n\tjmp\t.L68\n\t.cfi_endproc\n.LFE55:\n\t.size\tfSetSNum, .-fSetSNum\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC9:\n\t.string\t\"%d%d\"\n.LC10:\n\t.string\t\"%d\"\n.LC11:\n\t.string\t\"%s\"\n\t.text\n\t.p2align 4\n\t.globl\tfMain\n\t.type\tfMain, @function\nfMain:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\t8+sz1Num(%rip), %rdx\n\tmovl\t$17, %ecx\n\txorl\t%esi, %esi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tmovq\t%rdx, %rdi\n\tmovl\t$336000, %edx\n\txorl\t%r14d, %r14d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tleaq\t.LC10(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tleaq\tsz1Num(%rip), %rbx\n\tsubq\t$1104, %rsp\n\t.cfi_def_cfa_offset 1152\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1096(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t64(%rsp), %r13\n\tleaq\t12(%rsp), %r12\n\trep stosq\n\tleaq\tsi2SCnt(%rip), %rdi\n\tcall\tmemset@PLT\n\tmovq\t.LC0(%rip), %rax\n\tmovl\t$1024, %esi\n\tmovq\t%r13, %rdi\n\tmovq\tstdin(%rip), %rdx\n\tmovq\t%rax, sz1Num(%rip)\n\tmovq\t.LC1(%rip), %rax\n\tmovq\t%rdx, szpFpI(%rip)\n\tmovq\t%rax, 16+sz1Num(%rip)\n\tmovq\t.LC2(%rip), %rax\n\tmovq\t%rax, 32+sz1Num(%rip)\n\tmovq\t.LC3(%rip), %rax\n\tmovq\t%rax, 48+sz1Num(%rip)\n\tmovq\t.LC4(%rip), %rax\n\tmovq\t%rax, 64+sz1Num(%rip)\n\tmovq\t.LC5(%rip), %rax\n\tmovq\t%rax, 80+sz1Num(%rip)\n\tmovq\t.LC6(%rip), %rax\n\tmovq\t%rax, 96+sz1Num(%rip)\n\tmovq\t.LC7(%rip), %rax\n\tmovq\t%rax, 112+sz1Num(%rip)\n\tmovq\t.LC8(%rip), %rax\n\tmovq\t%rax, 128+sz1Num(%rip)\n\tcall\tfgets@PLT\n\tmovq\t%r13, %rdi\n\tleaq\t8(%rsp), %rcx\n\txorl\t%eax, %eax\n\tleaq\tsiMCnt(%rip), %rdx\n\tleaq\t.LC9(%rip), %rsi\n\tcall\t__isoc99_sscanf@PLT\n\tmovl\t8(%rsp), %edi\n\ttestl\t%edi, %edi\n\tjle\t.L136\n\t.p2align 4,,10\n\t.p2align 3\n.L101:\n\tmovq\tszpFpI(%rip), %rdi\n\tmovq\t%r12, %rdx\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\taddl\t$1, %r14d\n\tcall\t__isoc99_fscanf@PLT\n\tmovl\t12(%rsp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovl\t$1, 8(%rax,%rbx)\n\tcmpl\t%r14d, 8(%rsp)\n\tjg\t.L101\n.L136:\n\tmovq\tszpFpI(%rip), %rdx\n\tmovl\t$1024, %esi\n\tmovq\t%r13, %rdi\n\tcall\tfgets@PLT\n\tmovl\t$9, %esi\n\tmovl\t$16, %edx\n\tmovq\t%rbx, %rdi\n\tleaq\tfSortFnc(%rip), %rcx\n\tcall\tqsort@PLT\n\tmovl\t24+sz1Num(%rip), %esi\n\tmovl\t$1, siNCnt(%rip)\n\ttestl\t%esi, %esi\n\tje\t.L102\n\tmovl\t20+sz1Num(%rip), %eax\n\tcmpl\t4+sz1Num(%rip), %eax\n\tje\t.L205\n\tmovl\t40+sz1Num(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L106\n\tcmpl\t%eax, 36+sz1Num(%rip)\n\tmovl\t$2, %eax\n\tje\t.L107\n.L108:\n\taddl\t$1, %eax\n.L107:\n\tmovl\t56+sz1Num(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L140\n\tmovl\t52+sz1Num(%rip), %edx\n\tcmpl\t36+sz1Num(%rip), %edx\n\tje\t.L165\n\tcmpl\t$3, %eax\n\tjne\t.L110\n.L113:\n\tmovl\t72+sz1Num(%rip), %r14d\n\taddl\t$1, %eax\n\ttestl\t%r14d, %r14d\n\tje\t.L140\n\tmovl\t52+sz1Num(%rip), %edi\n\tcmpl\t%edi, 68+sz1Num(%rip)\n\tje\t.L166\n\tcmpl\t$4, %eax\n\tjne\t.L117\n.L119:\n\tmovl\t88+sz1Num(%rip), %r12d\n\taddl\t$1, %eax\n\ttestl\t%r12d, %r12d\n\tje\t.L140\n\tmovl\t68+sz1Num(%rip), %edi\n\tcmpl\t%edi, 84+sz1Num(%rip)\n\tje\t.L167\n\tcmpl\t$5, %eax\n\tjne\t.L122\n.L124:\n\tmovl\t104+sz1Num(%rip), %r11d\n\taddl\t$1, %eax\n\ttestl\t%r11d, %r11d\n\tje\t.L140\n\tmovl\t84+sz1Num(%rip), %edi\n\tcmpl\t%edi, 100+sz1Num(%rip)\n\tje\t.L168\n\tcmpl\t$6, %eax\n\tjne\t.L127\n.L129:\n\tmovl\t120+sz1Num(%rip), %r9d\n\taddl\t$1, %eax\n\ttestl\t%r9d, %r9d\n\tje\t.L140\n\tmovl\t116+sz1Num(%rip), %edx\n\tcmpl\t100+sz1Num(%rip), %edx\n\tje\t.L169\n\tcmpl\t$7, %eax\n\tjne\t.L132\n.L134:\n\tmovl\t136+sz1Num(%rip), %edi\n\taddl\t$1, %eax\n\ttestl\t%edi, %edi\n\tje\t.L140\n\tmovl\t116+sz1Num(%rip), %edi\n\tcmpl\t%edi, 132+sz1Num(%rip)\n\tje\t.L140\n\tcmpl\t$8, %eax\n\tjne\t.L159\n.L139:\n\taddl\t$1, %eax\n.L140:\n\tmovl\t%eax, siNCnt(%rip)\n\tmovl\t4+sz1Num(%rip), %r11d\n\tmovslq\t%eax, %r10\n\tcmpl\t$1, %eax\n\tje\t.L170\n.L156:\n\tleal\t-2(%rax), %r9d\n\tleaq\t20+sz1Num(%rip), %r8\n\tmovl\t%r11d, %esi\n\tsalq\t$4, %r9\n\tleaq\t16(%r8), %rax\n\taddq\t%rax, %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L144:\n\tmovl\t(%r8), %edi\n\tcmpl\t%esi, %edi\n\tjle\t.L171\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %eax\n\ttestl\t%edx, %edx\n\tjle\t.L172\n\t.p2align 4,,10\n\t.p2align 3\n.L143:\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%ecx, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L143\n.L142:\n\tmovl\t%esi, %eax\n\taddq\t$16, %r8\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %esi\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%eax, %esi\n\timull\t%ecx, %esi\n\tcmpq\t%r8, %r9\n\tjne\t.L144\n.L137:\n\tmovl\tsiMCnt(%rip), %ecx\n\tmovq\t%rbx, %rdi\n\tmovl\t%ecx, %eax\n\tsubl\t%esi, %eax\n\tmovq\t%r10, %rsi\n\tcltd\n\tidivl\t%r11d\n\tmovl\t$16, %edx\n\tmovl\t%eax, 12+sz1Num(%rip)\n\timull\t%r11d, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, siMCnt(%rip)\n\tleaq\tfSortFncVd(%rip), %rcx\n\tcall\tqsort@PLT\n\tmovl\tsiNCnt(%rip), %r12d\n\tpxor\t%xmm0, %xmm0\n\tmovl\t$0, 48(%rsp)\n\tmovl\tsiMCnt(%rip), %r14d\n\tmovaps\t%xmm0, 16(%rsp)\n\tmovaps\t%xmm0, 32(%rsp)\n\ttestl\t%r12d, %r12d\n\tjg\t.L206\n\ttestl\t%r14d, %r14d\n\tje\t.L207\n.L148:\n\tleaq\tsz1Num(%rip), %rbx\n\txorl\t%r14d, %r14d\n\tleaq\tsc1Out(%rip), %r12\n\tleaq\t144(%rbx), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L155:\n\tmovl\t12(%rbx), %ebp\n\ttestl\t%ebp, %ebp\n\tjle\t.L152\n\tmovzbl\t(%rbx), %eax\n\tmovslq\t%r14d, %rdi\n\tmovslq\t%ebp, %rdx\n\taddl\t%ebp, %r14d\n\taddq\t%r12, %rdi\n\tleal\t48(%rax), %esi\n\tmovsbl\t%sil, %esi\n\tcall\tmemset@PLT\n.L152:\n\taddq\t$16, %rbx\n\tcmpq\t%rbx, %r13\n\tjne\t.L155\n\tmovslq\t%r14d, %rax\n\tmovq\t%r12, %rdx\n\tmovl\t$1, %edi\n\tmovb\t$10, (%r12,%rax)\n\tleal\t1(%r14), %eax\n\tleaq\t.LC11(%rip), %rsi\n\tcltq\n\tmovb\t$0, (%r12,%rax)\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t1096(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L208\n\taddq\t$1104, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L171:\n\t.cfi_restore_state\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L143\n.L172:\n\tmovl\t%eax, %ecx\n\tjmp\t.L142\n.L209:\n\tmovl\t56+sz1Num(%rip), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L102\n\tmovl\t52+sz1Num(%rip), %edx\n\tcmpl\t36+sz1Num(%rip), %edx\n\tje\t.L174\n\tmovl\t$1, %eax\n.L110:\n\tmovdqa\t48+sz1Num(%rip), %xmm7\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm7, (%rbx,%rdx)\n\tjmp\t.L113\n.L207:\n\tmovdqa\t48(%rsp), %xmm3\n\tmovq\t64(%rsp), %rax\n\tmovaps\t%xmm0, si1SNum(%rip)\n\tmovaps\t%xmm0, 16+si1SNum(%rip)\n\tmovq\t%rax, 48+si1SNum(%rip)\n\tmovaps\t%xmm3, 32+si1SNum(%rip)\n\tjmp\t.L148\n.L165:\n\tmovl\t$1, %ecx\n.L109:\n\tmovl\t72+sz1Num(%rip), %r13d\n\ttestl\t%r13d, %r13d\n\tje\t.L114\n\tcmpl\t68+sz1Num(%rip), %edx\n\tje\t.L116\n.L117:\n\tmovdqa\t64+sz1Num(%rip), %xmm6\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm6, (%rbx,%rdx)\n\tjmp\t.L119\n.L169:\n\tmovl\t$1, %ecx\n.L131:\n\tmovl\t136+sz1Num(%rip), %esi\n\ttestl\t%esi, %esi\n\tje\t.L114\n\tcmpl\t132+sz1Num(%rip), %edx\n\tjne\t.L159\n.L114:\n\ttestb\t%cl, %cl\n\tjne\t.L140\n.L102:\n\tmovl\t4+sz1Num(%rip), %esi\n\tmovl\t$1, %r10d\n\tmovl\t%esi, %r11d\n\tjmp\t.L137\n.L166:\n\tmovl\t$1, %ecx\n.L116:\n\tmovl\t88+sz1Num(%rip), %ebp\n\ttestl\t%ebp, %ebp\n\tje\t.L114\n\tmovl\t84+sz1Num(%rip), %edi\n\tcmpl\t%edi, 68+sz1Num(%rip)\n\tje\t.L121\n.L122:\n\tmovdqa\t80+sz1Num(%rip), %xmm7\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm7, (%rbx,%rdx)\n\tjmp\t.L124\n.L167:\n\tmovl\t$1, %ecx\n.L121:\n\tmovl\t104+sz1Num(%rip), %r10d\n\ttestl\t%r10d, %r10d\n\tje\t.L114\n\tmovl\t100+sz1Num(%rip), %edi\n\tcmpl\t%edi, 84+sz1Num(%rip)\n\tje\t.L126\n.L127:\n\tmovdqa\t96+sz1Num(%rip), %xmm4\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm4, (%rbx,%rdx)\n\tjmp\t.L129\n.L168:\n\tmovl\t$1, %ecx\n.L126:\n\tmovl\t120+sz1Num(%rip), %r8d\n\ttestl\t%r8d, %r8d\n\tje\t.L114\n\tmovl\t116+sz1Num(%rip), %edx\n\tcmpl\t100+sz1Num(%rip), %edx\n\tje\t.L131\n.L132:\n\tmovdqa\t112+sz1Num(%rip), %xmm5\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm5, (%rbx,%rdx)\n\tjmp\t.L134\n.L206:\n\tmovl\t%r14d, %eax\n\tmovl\t4+sz1Num(%rip), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %ebp\n\ttestl\t%eax, %eax\n\tjs\t.L146\n\tleaq\t16(%rsp), %r13\n.L147:\n\timull\t%ebp, %ecx\n\tmovl\t%r14d, %esi\n\tmovl\t%ebp, %edx\n\tmovl\t$1, %edi\n\tmovl\t%ebp, 16(%rsp)\n\tsubl\t%ecx, %esi\n\tmovq\t%r13, %rcx\n\tcall\tfSetSNum\n\tsubl\t$1, %ebp\n\tjb\t.L146\n\tmovl\t4+sz1Num(%rip), %ecx\n\tjmp\t.L147\n.L146:\n\tleal\t-1(%r12), %eax\n\tcmpl\t$3, %eax\n\tjbe\t.L173\n\tmovdqu\t12+sz1Num(%rip), %xmm0\n\tmovdqu\t28+sz1Num(%rip), %xmm2\n\tmovl\t%eax, %edx\n\tmovdqu\t44+sz1Num(%rip), %xmm1\n\tmovdqu\t60+sz1Num(%rip), %xmm3\n\tshrl\t$2, %edx\n\tshufps\t$136, %xmm2, %xmm0\n\tshufps\t$136, %xmm3, %xmm1\n\tshufps\t$136, %xmm1, %xmm0\n\tpaddd\tsi1SNum(%rip), %xmm0\n\tpshufd\t$85, %xmm0, %xmm1\n\tmovd\t%xmm0, 12+sz1Num(%rip)\n\tmovd\t%xmm1, 28+sz1Num(%rip)\n\tmovdqa\t%xmm0, %xmm1\n\tpunpckhdq\t%xmm0, %xmm1\n\tpshufd\t$255, %xmm0, %xmm0\n\tmovd\t%xmm1, 44+sz1Num(%rip)\n\tmovd\t%xmm0, 60+sz1Num(%rip)\n\tcmpl\t$1, %edx\n\tje\t.L149\n\tmovdqu\t76+sz1Num(%rip), %xmm0\n\tmovdqu\t92+sz1Num(%rip), %xmm4\n\tmovdqu\t108+sz1Num(%rip), %xmm1\n\tmovdqu\t124+sz1Num(%rip), %xmm5\n\tshufps\t$136, %xmm4, %xmm0\n\tshufps\t$136, %xmm5, %xmm1\n\tshufps\t$136, %xmm1, %xmm0\n\tpaddd\t16+si1SNum(%rip), %xmm0\n\tpshufd\t$85, %xmm0, %xmm1\n\tmovd\t%xmm0, 76+sz1Num(%rip)\n\tmovd\t%xmm1, 92+sz1Num(%rip)\n\tmovdqa\t%xmm0, %xmm1\n\tpunpckhdq\t%xmm0, %xmm1\n\tpshufd\t$255, %xmm0, %xmm0\n\tmovd\t%xmm1, 108+sz1Num(%rip)\n\tmovd\t%xmm0, 124+sz1Num(%rip)\n.L149:\n\tandl\t$-4, %eax\n.L153:\n\tmovslq\t%eax, %rcx\n\tleaq\tsi1SNum(%rip), %rsi\n\tmovq\t%rcx, %rdx\n\tmovl\t(%rsi,%rcx,4), %ecx\n\tsalq\t$4, %rdx\n\taddl\t%ecx, 12(%rdx,%rbx)\n\tleal\t1(%rax), %edx\n\tcmpl\t%r12d, %edx\n\tjge\t.L148\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t(%rsi,%rdx,4), %edx\n\tsalq\t$4, %rcx\n\taddl\t%edx, 12(%rcx,%rbx)\n\tleal\t2(%rax), %edx\n\tcmpl\t%r12d, %edx\n\tjge\t.L148\n\tmovslq\t%edx, %rdx\n\taddl\t$3, %eax\n\tmovq\t%rdx, %rcx\n\tmovl\t(%rsi,%rdx,4), %edx\n\tsalq\t$4, %rcx\n\taddl\t%edx, 12(%rcx,%rbx)\n\tcmpl\t%eax, %r12d\n\tjle\t.L148\n\tcltq\n\tmovq\t%rax, %rdx\n\tmovl\t(%rsi,%rax,4), %eax\n\tsalq\t$4, %rdx\n\taddl\t%eax, 12(%rdx,%rbx)\n\tjmp\t.L148\n.L159:\n\tmovdqa\t128+sz1Num(%rip), %xmm2\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm2, (%rbx,%rdx)\n\tjmp\t.L139\n.L205:\n\tmovl\t40+sz1Num(%rip), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L102\n\tcmpl\t%eax, 36+sz1Num(%rip)\n\tje\t.L209\n\tmovdqa\t32+sz1Num(%rip), %xmm6\n\tmovl\t$1, %eax\n\tmovaps\t%xmm6, 16+sz1Num(%rip)\n\tjmp\t.L108\n.L173:\n\txorl\t%eax, %eax\n\tjmp\t.L153\n.L106:\n\tmovl\t$2, siNCnt(%rip)\n\tmovl\t$2, %r10d\n\tmovl\t$2, %eax\n\tmovl\t4+sz1Num(%rip), %r11d\n\tjmp\t.L156\n.L170:\n\tmovl\t%r11d, %esi\n\tjmp\t.L137\n.L208:\n\tcall\t__stack_chk_fail@PLT\n.L174:\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %eax\n\tjmp\t.L109\n\t.cfi_endproc\n.LFE56:\n\t.size\tfMain, .-fMain\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\txorl\t%edi, %edi\n\tcall\tfMain\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tmain, .-main\n\t.local\tsc1Out\n\t.comm\tsc1Out,20000,32\n\t.local\tsi2SCnt\n\t.comm\tsi2SCnt,336000,32\n\t.local\tsi1SNum\n\t.comm\tsi1SNum,56,32\n\t.local\tsiNCnt\n\t.comm\tsiNCnt,4,4\n\t.local\tsz1Num\n\t.comm\tsz1Num,144,32\n\t.local\tsiMCnt\n\t.comm\tsiMCnt,4,4\n\t.local\tszpFpI\n\t.comm\tszpFpI,8,8\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t1\n\t.long\t2\n\t.align 8\n.LC1:\n\t.long\t2\n\t.long\t5\n\t.align 8\n.LC2:\n\t.long\t3\n\t.long\t5\n\t.align 8\n.LC3:\n\t.long\t4\n\t.long\t4\n\t.align 8\n.LC4:\n\t.long\t5\n\t.long\t5\n\t.align 8\n.LC5:\n\t.long\t6\n\t.long\t6\n\t.align 8\n.LC6:\n\t.long\t7\n\t.long\t3\n\t.align 8\n.LC7:\n\t.long\t8\n\t.long\t7\n\t.align 8\n.LC8:\n\t.long\t9\n\t.long\t6\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.size\tfSortFncVd, .-fSortFncVd\n\t.p2align 4\n\t.globl\tfSortFnc\n\t.type\tfSortFnc, @function\nfSortFnc:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t8(%rsi), %ecx\n\tmovl\t$-1, %eax\n\tcmpl\t%ecx, 8(%rdi)\n\tjg\t.L5\n\tmovl\t$1, %eax\n\tjl\t.L5\n\tmovl\t4(%rsi), %edx\n\tcmpl\t%edx, 4(%rdi)\n\tjg\t.L5\n\tmovl\t$-1, %eax\n\tjl\t.L5\n\tmovl\t(%rsi), %edx\n\tcmpl\t%edx, (%rdi)\n\tsetl\t%dl\n\tmovzbl\t%dl, %edx\n\tcmovle\t%edx, %eax\n.L5:\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tfSortFnc, .-fSortFnc\n\t.p2align 4\n\t.globl\tfGetGcd\n\t.type\tfGetGcd, @function\nfGetGcd:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\tcmpl\t%esi, %edi\n\tjge\t.L13\n\tmovl\t%esi, %eax\n\tmovl\t%edi, %edx\n.L13:\n\ttestl\t%edx, %edx\n\tjle\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L15\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovl\t%eax, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tfGetGcd, .-fGetGcd\n\t.p2align 4\n\t.globl\tfGetLcm\n\t.type\tfGetLcm, @function\nfGetLcm:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tjge\t.L22\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\ttestl\t%edx, %edx\n\tjle\t.L23\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%ecx, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L21\n.L20:\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %edi\n\tmovl\t%esi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%eax, %edi\n\tmovl\t%edi, %eax\n\timull\t%ecx, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L21\n.L23:\n\tmovl\t%eax, %ecx\n\tjmp\t.L20\n\t.cfi_endproc\n.LFE54:\n\t.size\tfGetLcm, .-fGetLcm\n\t.p2align 4\n\t.globl\tfSetSNum\n\t.type\tfSetSNum, @function\nfSetSNum:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t%esi, %r9d\n\tmovl\t%edi, %r15d\n\tmovl\t%edx, %esi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$376, %rsp\n\t.cfi_def_cfa_offset 432\n\tcmpl\t%r9d, siMCnt(%rip)\n\tje\t.L26\n\tmovslq\t%r15d, %rax\n\tmovslq\t%r9d, %rdx\n\tleaq\tsi2SCnt(%rip), %rdi\n\timulq\t$6000, %rax, %rax\n\taddq\t%rdx, %rax\n\tcmpl\t%esi, (%rdi,%rax,4)\n\tjge\t.L28\n\tmovl\t%esi, (%rdi,%rax,4)\n.L26:\n\tmovl\tsiNCnt(%rip), %r8d\n\tcmpl\t%r15d, %r8d\n\tjg\t.L90\n\ttestl\t%r9d, %r9d\n\tje\t.L91\n.L28:\n\taddq\t$376, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\t.cfi_restore_state\n\tmovdqu\t(%rcx), %xmm0\n\tmovaps\t%xmm0, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm1\n\tmovaps\t%xmm1, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm2\n\tmovaps\t%xmm2, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L90:\n\tmovslq\t%r15d, %rbx\n\tmovl\t%r9d, %eax\n\tleaq\tsz1Num(%rip), %r13\n\tmovq\t%rbx, %rdx\n\tmovq\t%rbx, 56(%rsp)\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rdi\n\tcltd\n\tidivl\t4(%r13,%rdi)\n\tmovl\t%eax, %r10d\n\ttestl\t%eax, %eax\n\tjs\t.L28\n\tleaq\t0(,%rbx,4), %rax\n\tleal\t1(%r15), %r12d\n\tleaq\t(%rcx,%rax), %rdi\n\tleaq\t4(%rcx,%rax), %rax\n\tmovl\t%r12d, 152(%rsp)\n\tmovq\t%rax, 88(%rsp)\n\tleal\t2(%r15), %eax\n\tmovl\t%eax, 156(%rsp)\n\tcltq\n\tmovq\t%rdi, 72(%rsp)\n\tleaq\t(%rcx,%rax,4), %rdi\n\tmovq\t%rdi, 112(%rsp)\n\tleal\t3(%r15), %edi\n\tmovl\t%edi, 172(%rsp)\n\tmovslq\t%edi, %rdi\n\tleaq\t(%rcx,%rdi,4), %rbx\n\tmovq\t%rax, 32(%rsp)\n\tmovq\t%rbx, 120(%rsp)\n\tleal\t4(%r15), %ebx\n\tmovslq\t%ebx, %rdx\n\tmovl\t%ebx, 212(%rsp)\n\tleaq\t(%rcx,%rdx,4), %rbx\n\tmovq\t%rdi, 64(%rsp)\n\tmovq\t%rbx, 144(%rsp)\n\tleal\t5(%r15), %ebx\n\tmovl\t%ebx, 236(%rsp)\n\tmovslq\t%ebx, %rbx\n\tleaq\t(%rcx,%rbx,4), %r11\n\tmovq\t%rdx, 80(%rsp)\n\tmovq\t%r11, 160(%rsp)\n\tleal\t6(%r15), %r11d\n\tmovl\t%r11d, 256(%rsp)\n\tmovslq\t%r11d, %r11\n\tleaq\t(%rcx,%r11,4), %r14\n\tmovq\t%r11, 312(%rsp)\n\tmovq\t%r14, 176(%rsp)\n\tleal\t7(%r15), %r14d\n\tmovl\t%r14d, 280(%rsp)\n\tmovslq\t%r14d, %r14\n\tleaq\t(%rcx,%r14,4), %rbp\n\tmovq\t%rbx, 104(%rsp)\n\tmovq\t%rbp, 216(%rsp)\n\tleal\t8(%r15), %ebp\n\tmovl\t%ebp, 284(%rsp)\n\tmovslq\t%ebp, %rbp\n\tleaq\t(%rcx,%rbp,4), %rax\n\tmovq\t%r14, 128(%rsp)\n\tmovq\t%rax, 240(%rsp)\n\tleal\t(%rsi,%r10), %eax\n\tmovslq\t%r12d, %rsi\n\tmovl\t%eax, 16(%rsp)\n\timulq\t$6000, %rbp, %rax\n\tmovq\t%rbp, 328(%rsp)\n\tmovq\t%rsi, 48(%rsp)\n\tmovq\t%rax, 304(%rsp)\n\timulq\t$6000, %r14, %rax\n\tmovq\t%rax, 296(%rsp)\n\timulq\t$6000, %r11, %rax\n\tleaq\tsi2SCnt(%rip), %r11\n\tmovq\t%rax, 288(%rsp)\n\timulq\t$6000, %rbx, %rax\n\tmovq\t%rax, 272(%rsp)\n\timulq\t$6000, %rdx, %rax\n\tmovq\t%rax, 264(%rsp)\n\timulq\t$6000, %rdi, %rax\n\tmovq\t%rax, 248(%rsp)\n\timulq\t$6000, 32(%rsp), %rax\n\tmovl\t%r15d, 340(%rsp)\n\tmovl\t%r9d, 96(%rsp)\n\tmovq\t%rax, 224(%rsp)\n\timulq\t$6000, %rsi, %rax\n\tmovq\t%rax, 192(%rsp)\n.L79:\n\tmovq\t72(%rsp), %rax\n\tmovl\t96(%rsp), %r9d\n\tmovl\t%r10d, (%rax)\n\tmovq\t56(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %edi\n\timull\t%r10d, %edi\n\tsubl\t%edi, %r9d\n\tcmpl\tsiMCnt(%rip), %r9d\n\tje\t.L31\n\tmovslq\t%r9d, %rax\n\taddq\t192(%rsp), %rax\n\tmovl\t16(%rsp), %edi\n\tcmpl\t(%r11,%rax,4), %edi\n\tjle\t.L33\n\tmovl\t%edi, (%r11,%rax,4)\n.L31:\n\tcmpl\t152(%rsp), %r8d\n\tjg\t.L92\n\ttestl\t%r9d, %r9d\n\tjne\t.L33\n\tmovdqu\t(%rcx), %xmm3\n\tmovaps\t%xmm3, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm4\n\tmovaps\t%xmm4, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm5\n\tmovaps\t%xmm5, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L33:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 16(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L79\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L92:\n\tmovq\t48(%rsp), %rdx\n\tmovl\t%r9d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r14d\n\ttestl\t%eax, %eax\n\tjs\t.L33\n\tmovl\t16(%rsp), %eax\n\tmovl\t%r9d, 100(%rsp)\n\tmovl\t%r8d, %r9d\n\tmovl\t%r10d, 320(%rsp)\n\tmovl\t%r14d, %r10d\n\taddl\t%r14d, %eax\n\tmovl\t%eax, 20(%rsp)\n.L78:\n\tmovq\t88(%rsp), %rax\n\tmovl\t100(%rsp), %r14d\n\tmovl\t%r10d, (%rax)\n\tmovq\t48(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %ebx\n\timull\t%r10d, %ebx\n\tsubl\t%ebx, %r14d\n\tcmpl\tsiMCnt(%rip), %r14d\n\tje\t.L36\n\tmovslq\t%r14d, %rax\n\taddq\t224(%rsp), %rax\n\tmovl\t20(%rsp), %ebx\n\tcmpl\t(%r11,%rax,4), %ebx\n\tjle\t.L38\n\tmovl\t%ebx, (%r11,%rax,4)\n.L36:\n\tcmpl\t156(%rsp), %r9d\n\tjg\t.L93\n\ttestl\t%r14d, %r14d\n\tjne\t.L38\n\tmovdqu\t(%rcx), %xmm6\n\tmovaps\t%xmm6, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm7\n\tmovaps\t%xmm7, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm6\n\tmovaps\t%xmm6, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L38:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 20(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L78\n\tmovl\t320(%rsp), %r10d\n\tmovl\t%r9d, %r8d\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovq\t32(%rsp), %rdx\n\tmovl\t%r14d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r8d\n\ttestl\t%eax, %eax\n\tjs\t.L38\n\tmovl\t20(%rsp), %eax\n\tmovl\t%r14d, 136(%rsp)\n\tmovl\t%r10d, 324(%rsp)\n\taddl\t%r8d, %eax\n\tmovl\t%r9d, 12(%rsp)\n\tmovl\t%r8d, %r9d\n\tmovl\t%eax, 24(%rsp)\n.L77:\n\tmovq\t112(%rsp), %rax\n\tmovl\t136(%rsp), %r10d\n\tmovl\t%r9d, (%rax)\n\tmovq\t32(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %esi\n\timull\t%r9d, %esi\n\tsubl\t%esi, %r10d\n\tcmpl\tsiMCnt(%rip), %r10d\n\tje\t.L41\n\tmovslq\t%r10d, %rax\n\taddq\t248(%rsp), %rax\n\tmovl\t24(%rsp), %edx\n\tcmpl\t(%r11,%rax,4), %edx\n\tjle\t.L43\n\tmovl\t%edx, (%r11,%rax,4)\n.L41:\n\tmovl\t172(%rsp), %edi\n\tcmpl\t%edi, 12(%rsp)\n\tjg\t.L94\n\ttestl\t%r10d, %r10d\n\tjne\t.L43\n\tmovdqu\t(%rcx), %xmm7\n\tmovaps\t%xmm7, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm3\n\tmovaps\t%xmm3, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm4\n\tmovaps\t%xmm4, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L43:\n\tsubl\t$1, %r9d\n\tsubl\t$1, 24(%rsp)\n\tcmpl\t$-1, %r9d\n\tjne\t.L77\n\tmovl\t12(%rsp), %r9d\n\tmovl\t324(%rsp), %r10d\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L94:\n\tmovq\t64(%rsp), %rdx\n\tmovl\t%r10d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r15d\n\ttestl\t%eax, %eax\n\tjs\t.L43\n\tmovl\t24(%rsp), %eax\n\tmovl\t%r9d, 336(%rsp)\n\tmovl\t%r10d, 140(%rsp)\n\tmovl\t%r15d, %r10d\n\taddl\t%r15d, %eax\n\tmovl\t%eax, 28(%rsp)\n.L76:\n\tmovq\t120(%rsp), %rax\n\tmovl\t140(%rsp), %r9d\n\tmovl\t%r10d, (%rax)\n\tmovq\t64(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %edi\n\timull\t%r10d, %edi\n\tsubl\t%edi, %r9d\n\tcmpl\tsiMCnt(%rip), %r9d\n\tje\t.L46\n\tmovslq\t%r9d, %rax\n\taddq\t264(%rsp), %rax\n\tmovl\t28(%rsp), %esi\n\tcmpl\t(%r11,%rax,4), %esi\n\tjle\t.L48\n\tmovl\t%esi, (%r11,%rax,4)\n.L46:\n\tmovl\t212(%rsp), %esi\n\tcmpl\t%esi, 12(%rsp)\n\tjg\t.L95\n\ttestl\t%r9d, %r9d\n\tjne\t.L48\n\tmovdqu\t(%rcx), %xmm5\n\tmovaps\t%xmm5, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm0\n\tmovaps\t%xmm0, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm1\n\tmovaps\t%xmm1, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L48:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 28(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L76\n\tmovl\t336(%rsp), %r9d\n\tjmp\t.L43\n\t.p2align 4,,10\n\t.p2align 3\n.L95:\n\tmovq\t80(%rsp), %rdx\n\tmovl\t%r9d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r8d\n\ttestl\t%eax, %eax\n\tjs\t.L48\n\tmovl\t28(%rsp), %eax\n\tmovl\t%r9d, 168(%rsp)\n\tmovl\t%r10d, 344(%rsp)\n\tmovl\t%r8d, %r10d\n\taddl\t%r8d, %eax\n\tmovl\t%eax, 40(%rsp)\n.L75:\n\tmovq\t144(%rsp), %rax\n\tmovl\t168(%rsp), %r9d\n\tmovl\t%r10d, (%rax)\n\tmovq\t80(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %ebx\n\timull\t%r10d, %ebx\n\tsubl\t%ebx, %r9d\n\tcmpl\tsiMCnt(%rip), %r9d\n\tje\t.L51\n\tmovslq\t%r9d, %rax\n\taddq\t272(%rsp), %rax\n\tmovl\t40(%rsp), %edx\n\tcmpl\t(%r11,%rax,4), %edx\n\tjle\t.L53\n\tmovl\t%edx, (%r11,%rax,4)\n.L51:\n\tmovl\t236(%rsp), %edi\n\tcmpl\t%edi, 12(%rsp)\n\tjg\t.L96\n\ttestl\t%r9d, %r9d\n\tjne\t.L53\n\tmovdqu\t(%rcx), %xmm2\n\tmovaps\t%xmm2, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm7\n\tmovaps\t%xmm7, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm5\n\tmovaps\t%xmm5, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L53:\n\tsubl\t$1, %r10d\n\tsubl\t$1, 40(%rsp)\n\tcmpl\t$-1, %r10d\n\tjne\t.L75\n\tmovl\t344(%rsp), %r10d\n\tjmp\t.L48\n\t.p2align 4,,10\n\t.p2align 3\n.L96:\n\tmovq\t104(%rsp), %rdx\n\tmovl\t%r9d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r8d\n\ttestl\t%eax, %eax\n\tjs\t.L53\n\tmovl\t40(%rsp), %eax\n\tmovl\t%r9d, 208(%rsp)\n\tmovl\t%r8d, %r14d\n\tmovl\t%r10d, 348(%rsp)\n\taddl\t%r8d, %eax\n\tmovl\t%eax, 44(%rsp)\n.L74:\n\tmovq\t160(%rsp), %rax\n\tmovl\t208(%rsp), %r15d\n\tmovl\t%r14d, (%rax)\n\tmovq\t104(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %edx\n\timull\t%r14d, %edx\n\tsubl\t%edx, %r15d\n\tcmpl\tsiMCnt(%rip), %r15d\n\tje\t.L56\n\tmovslq\t%r15d, %rax\n\taddq\t288(%rsp), %rax\n\tmovl\t44(%rsp), %ebx\n\tcmpl\t(%r11,%rax,4), %ebx\n\tjle\t.L58\n\tmovl\t%ebx, (%r11,%rax,4)\n.L56:\n\tmovl\t256(%rsp), %edi\n\tcmpl\t%edi, 12(%rsp)\n\tjg\t.L97\n\ttestl\t%r15d, %r15d\n\tjne\t.L58\n\tmovdqu\t(%rcx), %xmm2\n\tmovaps\t%xmm2, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm6\n\tmovaps\t%xmm6, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm3\n\tmovaps\t%xmm3, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L58:\n\tsubl\t$1, %r14d\n\tsubl\t$1, 44(%rsp)\n\tcmpl\t$-1, %r14d\n\tjne\t.L74\n\tmovl\t348(%rsp), %r10d\n\tjmp\t.L53\n\t.p2align 4,,10\n\t.p2align 3\n.L97:\n\tmovq\t312(%rsp), %rax\n\tsalq\t$4, %rax\n\taddq\t%r13, %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, 200(%rsp)\n\tmovl\t%r15d, %eax\n\tcltd\n\tidivl\t4(%rsi)\n\tmovl\t%eax, %ebx\n\ttestl\t%eax, %eax\n\tjs\t.L58\n\tmovl\t44(%rsp), %eax\n\tmovl\t%r14d, 352(%rsp)\n\tmovl\t%r15d, 232(%rsp)\n\taddl\t%ebx, %eax\n\tmovl\t%eax, %r15d\n.L73:\n\tmovq\t176(%rsp), %rax\n\tmovq\t200(%rsp), %rdi\n\tmovl\t232(%rsp), %r14d\n\tmovl\t%ebx, (%rax)\n\tmovl\t4(%rdi), %eax\n\timull\t%ebx, %eax\n\tsubl\t%eax, %r14d\n\tcmpl\tsiMCnt(%rip), %r14d\n\tje\t.L61\n\tmovslq\t%r14d, %rax\n\taddq\t296(%rsp), %rax\n\tcmpl\t(%r11,%rax,4), %r15d\n\tjle\t.L63\n\tmovl\t%r15d, (%r11,%rax,4)\n.L61:\n\tmovl\t280(%rsp), %edx\n\tcmpl\t%edx, 12(%rsp)\n\tjg\t.L98\n\ttestl\t%r14d, %r14d\n\tjne\t.L63\n\tmovdqu\t(%rcx), %xmm4\n\tmovaps\t%xmm4, si1SNum(%rip)\n\tmovdqu\t16(%rcx), %xmm0\n\tmovaps\t%xmm0, 16+si1SNum(%rip)\n\tmovdqu\t32(%rcx), %xmm1\n\tmovaps\t%xmm1, 32+si1SNum(%rip)\n\tmovq\t48(%rcx), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L63:\n\tsubl\t$1, %ebx\n\tsubl\t$1, %r15d\n\tcmpl\t$-1, %ebx\n\tjne\t.L73\n\tmovl\t352(%rsp), %r14d\n\tjmp\t.L58\n\t.p2align 4,,10\n\t.p2align 3\n.L98:\n\tmovq\t128(%rsp), %rdx\n\tmovl\t%r14d, %eax\n\tsalq\t$4, %rdx\n\tmovq\t%rdx, %rsi\n\tcltd\n\tidivl\t4(%r13,%rsi)\n\tmovl\t%eax, %r12d\n\ttestl\t%eax, %eax\n\tjs\t.L63\n\tleal\t(%r15,%rax), %r9d\n\tmovq\t328(%rsp), %rax\n\tmovl\t%ebx, 356(%rsp)\n\tmovl\t%r14d, 260(%rsp)\n\tmovl\t%r9d, %ebx\n\tmovq\t%rcx, %r14\n\tsalq\t$4, %rax\n\tmovl\t%r15d, 360(%rsp)\n\tmovl\t%r12d, %r15d\n\tleaq\t4(%r13,%rax), %rax\n\tmovq\t%rax, 184(%rsp)\n.L72:\n\tmovq\t216(%rsp), %rax\n\tmovl\t260(%rsp), %r12d\n\tmovl\t%r15d, (%rax)\n\tmovq\t128(%rsp), %rax\n\tsalq\t$4, %rax\n\tmovl\t4(%r13,%rax), %esi\n\timull\t%r15d, %esi\n\tsubl\t%esi, %r12d\n\tcmpl\tsiMCnt(%rip), %r12d\n\tje\t.L66\n\tmovslq\t%r12d, %rax\n\taddq\t304(%rsp), %rax\n\tcmpl\t(%r11,%rax,4), %ebx\n\tjle\t.L68\n\tmovl\t%ebx, (%r11,%rax,4)\n.L66:\n\tmovl\t284(%rsp), %ecx\n\tcmpl\t%ecx, 12(%rsp)\n\tjg\t.L99\n\ttestl\t%r12d, %r12d\n\tjne\t.L68\n\tmovdqu\t(%r14), %xmm4\n\tmovaps\t%xmm4, si1SNum(%rip)\n\tmovdqu\t16(%r14), %xmm2\n\tmovaps\t%xmm2, 16+si1SNum(%rip)\n\tmovdqu\t32(%r14), %xmm0\n\tmovaps\t%xmm0, 32+si1SNum(%rip)\n\tmovq\t48(%r14), %rax\n\tmovq\t%rax, 48+si1SNum(%rip)\n.L68:\n\tsubl\t$1, %r15d\n\tsubl\t$1, %ebx\n\tcmpl\t$-1, %r15d\n\tjne\t.L72\n\tmovl\t356(%rsp), %ebx\n\tmovl\t360(%rsp), %r15d\n\tmovq\t%r14, %rcx\n\tjmp\t.L63\n\t.p2align 4,,10\n\t.p2align 3\n.L99:\n\tmovl\t%r12d, %eax\n\tmovq\t184(%rsp), %rcx\n\tcltd\n\tidivl\t(%rcx)\n\tmovl\t%eax, %ebp\n\ttestl\t%eax, %eax\n\tjs\t.L68\n\tmovl\t340(%rsp), %eax\n\tmovl\t%r15d, 364(%rsp)\n\tmovq\t%r14, %r15\n\tmovl\t%ebp, %r14d\n\taddl\t$9, %eax\n\tmovl\t%eax, %ebp\n.L71:\n\tmovq\t240(%rsp), %rax\n\tmovq\t184(%rsp), %rsi\n\tmovq\t%r15, %rcx\n\tmovl\t%ebp, %edi\n\tleal\t(%r14,%rbx), %edx\n\tmovl\t%r14d, (%rax)\n\tmovl\t(%rsi), %eax\n\tmovl\t%r12d, %esi\n\timull\t%r14d, %eax\n\tsubl\t$1, %r14d\n\tsubl\t%eax, %esi\n\tcall\tfSetSNum\n\tcmpl\t$-1, %r14d\n\tleaq\tsi2SCnt(%rip), %r11\n\tjne\t.L71\n\tmovq\t%r15, %r14\n\tmovl\t364(%rsp), %r15d\n\tjmp\t.L68\n\t.cfi_endproc\n.LFE55:\n\t.size\tfSetSNum, .-fSetSNum\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC9:\n\t.string\t\"%d%d\"\n.LC10:\n\t.string\t\"%d\"\n.LC11:\n\t.string\t\"%s\"\n\t.text\n\t.p2align 4\n\t.globl\tfMain\n\t.type\tfMain, @function\nfMain:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\t8+sz1Num(%rip), %rdx\n\tmovl\t$17, %ecx\n\txorl\t%esi, %esi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tmovq\t%rdx, %rdi\n\tmovl\t$336000, %edx\n\txorl\t%r14d, %r14d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tleaq\t.LC10(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tleaq\tsz1Num(%rip), %rbx\n\tsubq\t$1104, %rsp\n\t.cfi_def_cfa_offset 1152\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1096(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t64(%rsp), %r13\n\tleaq\t12(%rsp), %r12\n\trep stosq\n\tleaq\tsi2SCnt(%rip), %rdi\n\tcall\tmemset@PLT\n\tmovq\t.LC0(%rip), %rax\n\tmovl\t$1024, %esi\n\tmovq\t%r13, %rdi\n\tmovq\tstdin(%rip), %rdx\n\tmovq\t%rax, sz1Num(%rip)\n\tmovq\t.LC1(%rip), %rax\n\tmovq\t%rdx, szpFpI(%rip)\n\tmovq\t%rax, 16+sz1Num(%rip)\n\tmovq\t.LC2(%rip), %rax\n\tmovq\t%rax, 32+sz1Num(%rip)\n\tmovq\t.LC3(%rip), %rax\n\tmovq\t%rax, 48+sz1Num(%rip)\n\tmovq\t.LC4(%rip), %rax\n\tmovq\t%rax, 64+sz1Num(%rip)\n\tmovq\t.LC5(%rip), %rax\n\tmovq\t%rax, 80+sz1Num(%rip)\n\tmovq\t.LC6(%rip), %rax\n\tmovq\t%rax, 96+sz1Num(%rip)\n\tmovq\t.LC7(%rip), %rax\n\tmovq\t%rax, 112+sz1Num(%rip)\n\tmovq\t.LC8(%rip), %rax\n\tmovq\t%rax, 128+sz1Num(%rip)\n\tcall\tfgets@PLT\n\tmovq\t%r13, %rdi\n\tleaq\t8(%rsp), %rcx\n\txorl\t%eax, %eax\n\tleaq\tsiMCnt(%rip), %rdx\n\tleaq\t.LC9(%rip), %rsi\n\tcall\t__isoc99_sscanf@PLT\n\tmovl\t8(%rsp), %edi\n\ttestl\t%edi, %edi\n\tjle\t.L136\n\t.p2align 4,,10\n\t.p2align 3\n.L101:\n\tmovq\tszpFpI(%rip), %rdi\n\tmovq\t%r12, %rdx\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\taddl\t$1, %r14d\n\tcall\t__isoc99_fscanf@PLT\n\tmovl\t12(%rsp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovl\t$1, 8(%rax,%rbx)\n\tcmpl\t%r14d, 8(%rsp)\n\tjg\t.L101\n.L136:\n\tmovq\tszpFpI(%rip), %rdx\n\tmovl\t$1024, %esi\n\tmovq\t%r13, %rdi\n\tcall\tfgets@PLT\n\tmovl\t$9, %esi\n\tmovl\t$16, %edx\n\tmovq\t%rbx, %rdi\n\tleaq\tfSortFnc(%rip), %rcx\n\tcall\tqsort@PLT\n\tmovl\t24+sz1Num(%rip), %esi\n\tmovl\t$1, siNCnt(%rip)\n\ttestl\t%esi, %esi\n\tje\t.L102\n\tmovl\t20+sz1Num(%rip), %eax\n\tcmpl\t4+sz1Num(%rip), %eax\n\tje\t.L205\n\tmovl\t40+sz1Num(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L106\n\tcmpl\t%eax, 36+sz1Num(%rip)\n\tmovl\t$2, %eax\n\tje\t.L107\n.L108:\n\taddl\t$1, %eax\n.L107:\n\tmovl\t56+sz1Num(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L140\n\tmovl\t52+sz1Num(%rip), %edx\n\tcmpl\t36+sz1Num(%rip), %edx\n\tje\t.L165\n\tcmpl\t$3, %eax\n\tjne\t.L110\n.L113:\n\tmovl\t72+sz1Num(%rip), %r14d\n\taddl\t$1, %eax\n\ttestl\t%r14d, %r14d\n\tje\t.L140\n\tmovl\t52+sz1Num(%rip), %edi\n\tcmpl\t%edi, 68+sz1Num(%rip)\n\tje\t.L166\n\tcmpl\t$4, %eax\n\tjne\t.L117\n.L119:\n\tmovl\t88+sz1Num(%rip), %r12d\n\taddl\t$1, %eax\n\ttestl\t%r12d, %r12d\n\tje\t.L140\n\tmovl\t68+sz1Num(%rip), %edi\n\tcmpl\t%edi, 84+sz1Num(%rip)\n\tje\t.L167\n\tcmpl\t$5, %eax\n\tjne\t.L122\n.L124:\n\tmovl\t104+sz1Num(%rip), %r11d\n\taddl\t$1, %eax\n\ttestl\t%r11d, %r11d\n\tje\t.L140\n\tmovl\t84+sz1Num(%rip), %edi\n\tcmpl\t%edi, 100+sz1Num(%rip)\n\tje\t.L168\n\tcmpl\t$6, %eax\n\tjne\t.L127\n.L129:\n\tmovl\t120+sz1Num(%rip), %r9d\n\taddl\t$1, %eax\n\ttestl\t%r9d, %r9d\n\tje\t.L140\n\tmovl\t116+sz1Num(%rip), %edx\n\tcmpl\t100+sz1Num(%rip), %edx\n\tje\t.L169\n\tcmpl\t$7, %eax\n\tjne\t.L132\n.L134:\n\tmovl\t136+sz1Num(%rip), %edi\n\taddl\t$1, %eax\n\ttestl\t%edi, %edi\n\tje\t.L140\n\tmovl\t116+sz1Num(%rip), %edi\n\tcmpl\t%edi, 132+sz1Num(%rip)\n\tje\t.L140\n\tcmpl\t$8, %eax\n\tjne\t.L159\n.L139:\n\taddl\t$1, %eax\n.L140:\n\tmovl\t%eax, siNCnt(%rip)\n\tmovl\t4+sz1Num(%rip), %r11d\n\tmovslq\t%eax, %r10\n\tcmpl\t$1, %eax\n\tje\t.L170\n.L156:\n\tleal\t-2(%rax), %r9d\n\tleaq\t20+sz1Num(%rip), %r8\n\tmovl\t%r11d, %esi\n\tsalq\t$4, %r9\n\tleaq\t16(%r8), %rax\n\taddq\t%rax, %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L144:\n\tmovl\t(%r8), %edi\n\tcmpl\t%esi, %edi\n\tjle\t.L171\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %eax\n\ttestl\t%edx, %edx\n\tjle\t.L172\n\t.p2align 4,,10\n\t.p2align 3\n.L143:\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%ecx, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L143\n.L142:\n\tmovl\t%esi, %eax\n\taddq\t$16, %r8\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %esi\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%eax, %esi\n\timull\t%ecx, %esi\n\tcmpq\t%r8, %r9\n\tjne\t.L144\n.L137:\n\tmovl\tsiMCnt(%rip), %ecx\n\tmovq\t%rbx, %rdi\n\tmovl\t%ecx, %eax\n\tsubl\t%esi, %eax\n\tmovq\t%r10, %rsi\n\tcltd\n\tidivl\t%r11d\n\tmovl\t$16, %edx\n\tmovl\t%eax, 12+sz1Num(%rip)\n\timull\t%r11d, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, siMCnt(%rip)\n\tleaq\tfSortFncVd(%rip), %rcx\n\tcall\tqsort@PLT\n\tmovl\tsiNCnt(%rip), %r12d\n\tpxor\t%xmm0, %xmm0\n\tmovl\t$0, 48(%rsp)\n\tmovl\tsiMCnt(%rip), %r14d\n\tmovaps\t%xmm0, 16(%rsp)\n\tmovaps\t%xmm0, 32(%rsp)\n\ttestl\t%r12d, %r12d\n\tjg\t.L206\n\ttestl\t%r14d, %r14d\n\tje\t.L207\n.L148:\n\tleaq\tsz1Num(%rip), %rbx\n\txorl\t%r14d, %r14d\n\tleaq\tsc1Out(%rip), %r12\n\tleaq\t144(%rbx), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L155:\n\tmovl\t12(%rbx), %ebp\n\ttestl\t%ebp, %ebp\n\tjle\t.L152\n\tmovzbl\t(%rbx), %eax\n\tmovslq\t%r14d, %rdi\n\tmovslq\t%ebp, %rdx\n\taddl\t%ebp, %r14d\n\taddq\t%r12, %rdi\n\tleal\t48(%rax), %esi\n\tmovsbl\t%sil, %esi\n\tcall\tmemset@PLT\n.L152:\n\taddq\t$16, %rbx\n\tcmpq\t%rbx, %r13\n\tjne\t.L155\n\tmovslq\t%r14d, %rax\n\tmovq\t%r12, %rdx\n\tmovl\t$1, %edi\n\tmovb\t$10, (%r12,%rax)\n\tleal\t1(%r14), %eax\n\tleaq\t.LC11(%rip), %rsi\n\tcltq\n\tmovb\t$0, (%r12,%rax)\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t1096(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L208\n\taddq\t$1104, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L171:\n\t.cfi_restore_state\n\tmovl\t%edi, %edx\n\tmovl\t%esi, %eax\n\ttestl\t%edx, %edx\n\tjg\t.L143\n.L172:\n\tmovl\t%eax, %ecx\n\tjmp\t.L142\n.L209:\n\tmovl\t56+sz1Num(%rip), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L102\n\tmovl\t52+sz1Num(%rip), %edx\n\tcmpl\t36+sz1Num(%rip), %edx\n\tje\t.L174\n\tmovl\t$1, %eax\n.L110:\n\tmovdqa\t48+sz1Num(%rip), %xmm7\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm7, (%rbx,%rdx)\n\tjmp\t.L113\n.L207:\n\tmovdqa\t48(%rsp), %xmm3\n\tmovq\t64(%rsp), %rax\n\tmovaps\t%xmm0, si1SNum(%rip)\n\tmovaps\t%xmm0, 16+si1SNum(%rip)\n\tmovq\t%rax, 48+si1SNum(%rip)\n\tmovaps\t%xmm3, 32+si1SNum(%rip)\n\tjmp\t.L148\n.L165:\n\tmovl\t$1, %ecx\n.L109:\n\tmovl\t72+sz1Num(%rip), %r13d\n\ttestl\t%r13d, %r13d\n\tje\t.L114\n\tcmpl\t68+sz1Num(%rip), %edx\n\tje\t.L116\n.L117:\n\tmovdqa\t64+sz1Num(%rip), %xmm6\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm6, (%rbx,%rdx)\n\tjmp\t.L119\n.L169:\n\tmovl\t$1, %ecx\n.L131:\n\tmovl\t136+sz1Num(%rip), %esi\n\ttestl\t%esi, %esi\n\tje\t.L114\n\tcmpl\t132+sz1Num(%rip), %edx\n\tjne\t.L159\n.L114:\n\ttestb\t%cl, %cl\n\tjne\t.L140\n.L102:\n\tmovl\t4+sz1Num(%rip), %esi\n\tmovl\t$1, %r10d\n\tmovl\t%esi, %r11d\n\tjmp\t.L137\n.L166:\n\tmovl\t$1, %ecx\n.L116:\n\tmovl\t88+sz1Num(%rip), %ebp\n\ttestl\t%ebp, %ebp\n\tje\t.L114\n\tmovl\t84+sz1Num(%rip), %edi\n\tcmpl\t%edi, 68+sz1Num(%rip)\n\tje\t.L121\n.L122:\n\tmovdqa\t80+sz1Num(%rip), %xmm7\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm7, (%rbx,%rdx)\n\tjmp\t.L124\n.L167:\n\tmovl\t$1, %ecx\n.L121:\n\tmovl\t104+sz1Num(%rip), %r10d\n\ttestl\t%r10d, %r10d\n\tje\t.L114\n\tmovl\t100+sz1Num(%rip), %edi\n\tcmpl\t%edi, 84+sz1Num(%rip)\n\tje\t.L126\n.L127:\n\tmovdqa\t96+sz1Num(%rip), %xmm4\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm4, (%rbx,%rdx)\n\tjmp\t.L129\n.L168:\n\tmovl\t$1, %ecx\n.L126:\n\tmovl\t120+sz1Num(%rip), %r8d\n\ttestl\t%r8d, %r8d\n\tje\t.L114\n\tmovl\t116+sz1Num(%rip), %edx\n\tcmpl\t100+sz1Num(%rip), %edx\n\tje\t.L131\n.L132:\n\tmovdqa\t112+sz1Num(%rip), %xmm5\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm5, (%rbx,%rdx)\n\tjmp\t.L134\n.L206:\n\tmovl\t%r14d, %eax\n\tmovl\t4+sz1Num(%rip), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %ebp\n\ttestl\t%eax, %eax\n\tjs\t.L146\n\tleaq\t16(%rsp), %r13\n.L147:\n\timull\t%ebp, %ecx\n\tmovl\t%r14d, %esi\n\tmovl\t%ebp, %edx\n\tmovl\t$1, %edi\n\tmovl\t%ebp, 16(%rsp)\n\tsubl\t%ecx, %esi\n\tmovq\t%r13, %rcx\n\tcall\tfSetSNum\n\tsubl\t$1, %ebp\n\tjb\t.L146\n\tmovl\t4+sz1Num(%rip), %ecx\n\tjmp\t.L147\n.L146:\n\tleal\t-1(%r12), %eax\n\tcmpl\t$3, %eax\n\tjbe\t.L173\n\tmovdqu\t12+sz1Num(%rip), %xmm0\n\tmovdqu\t28+sz1Num(%rip), %xmm2\n\tmovl\t%eax, %edx\n\tmovdqu\t44+sz1Num(%rip), %xmm1\n\tmovdqu\t60+sz1Num(%rip), %xmm3\n\tshrl\t$2, %edx\n\tshufps\t$136, %xmm2, %xmm0\n\tshufps\t$136, %xmm3, %xmm1\n\tshufps\t$136, %xmm1, %xmm0\n\tpaddd\tsi1SNum(%rip), %xmm0\n\tpshufd\t$85, %xmm0, %xmm1\n\tmovd\t%xmm0, 12+sz1Num(%rip)\n\tmovd\t%xmm1, 28+sz1Num(%rip)\n\tmovdqa\t%xmm0, %xmm1\n\tpunpckhdq\t%xmm0, %xmm1\n\tpshufd\t$255, %xmm0, %xmm0\n\tmovd\t%xmm1, 44+sz1Num(%rip)\n\tmovd\t%xmm0, 60+sz1Num(%rip)\n\tcmpl\t$1, %edx\n\tje\t.L149\n\tmovdqu\t76+sz1Num(%rip), %xmm0\n\tmovdqu\t92+sz1Num(%rip), %xmm4\n\tmovdqu\t108+sz1Num(%rip), %xmm1\n\tmovdqu\t124+sz1Num(%rip), %xmm5\n\tshufps\t$136, %xmm4, %xmm0\n\tshufps\t$136, %xmm5, %xmm1\n\tshufps\t$136, %xmm1, %xmm0\n\tpaddd\t16+si1SNum(%rip), %xmm0\n\tpshufd\t$85, %xmm0, %xmm1\n\tmovd\t%xmm0, 76+sz1Num(%rip)\n\tmovd\t%xmm1, 92+sz1Num(%rip)\n\tmovdqa\t%xmm0, %xmm1\n\tpunpckhdq\t%xmm0, %xmm1\n\tpshufd\t$255, %xmm0, %xmm0\n\tmovd\t%xmm1, 108+sz1Num(%rip)\n\tmovd\t%xmm0, 124+sz1Num(%rip)\n.L149:\n\tandl\t$-4, %eax\n.L153:\n\tmovslq\t%eax, %rcx\n\tleaq\tsi1SNum(%rip), %rsi\n\tmovq\t%rcx, %rdx\n\tmovl\t(%rsi,%rcx,4), %ecx\n\tsalq\t$4, %rdx\n\taddl\t%ecx, 12(%rdx,%rbx)\n\tleal\t1(%rax), %edx\n\tcmpl\t%r12d, %edx\n\tjge\t.L148\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t(%rsi,%rdx,4), %edx\n\tsalq\t$4, %rcx\n\taddl\t%edx, 12(%rcx,%rbx)\n\tleal\t2(%rax), %edx\n\tcmpl\t%r12d, %edx\n\tjge\t.L148\n\tmovslq\t%edx, %rdx\n\taddl\t$3, %eax\n\tmovq\t%rdx, %rcx\n\tmovl\t(%rsi,%rdx,4), %edx\n\tsalq\t$4, %rcx\n\taddl\t%edx, 12(%rcx,%rbx)\n\tcmpl\t%eax, %r12d\n\tjle\t.L148\n\tcltq\n\tmovq\t%rax, %rdx\n\tmovl\t(%rsi,%rax,4), %eax\n\tsalq\t$4, %rdx\n\taddl\t%eax, 12(%rdx,%rbx)\n\tjmp\t.L148\n.L159:\n\tmovdqa\t128+sz1Num(%rip), %xmm2\n\tmovslq\t%eax, %rdx\n\tsalq\t$4, %rdx\n\tmovaps\t%xmm2, (%rbx,%rdx)\n\tjmp\t.L139\n.L205:\n\tmovl\t40+sz1Num(%rip), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L102\n\tcmpl\t%eax, 36+sz1Num(%rip)\n\tje\t.L209\n\tmovdqa\t32+sz1Num(%rip), %xmm6\n\tmovl\t$1, %eax\n\tmovaps\t%xmm6, 16+sz1Num(%rip)\n\tjmp\t.L108\n.L173:\n\txorl\t%eax, %eax\n\tjmp\t.L153\n.L106:\n\tmovl\t$2, siNCnt(%rip)\n\tmovl\t$2, %r10d\n\tmovl\t$2, %eax\n\tmovl\t4+sz1Num(%rip), %r11d\n\tjmp\t.L156\n.L170:\n\tmovl\t%r11d, %esi\n\tjmp\t.L137\n.L208:\n\tcall\t__stack_chk_fail@PLT\n.L174:\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %eax\n\tjmp\t.L109\n\t.cfi_endproc\n.LFE56:\n\t.size\tfMain, .-fMain\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\txorl\t%edi, %edi\n\tcall\tfMain\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tmain, .-main\n\t.local\tsc1Out\n\t.comm\tsc1Out,20000,32\n\t.local\tsi2SCnt\n\t.comm\tsi2SCnt,336000,32\n\t.local\tsi1SNum\n\t.comm\tsi1SNum,56,32\n\t.local\tsiNCnt\n\t.comm\tsiNCnt,4,4\n\t.local\tsz1Num\n\t.comm\tsz1Num,144,32\n\t.local\tsiMCnt\n\t.comm\tsiMCnt,4,4\n\t.local\tszpFpI\n\t.comm\tszpFpI,8,8\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t1\n\t.long\t2\n\t.align 8\n.LC1:\n\t.long\t2\n\t.long\t5\n\t.align 8\n.LC2:\n\t.long\t3\n\t.long\t5\n\t.align 8\n.LC3:\n\t.long\t4\n\t.long\t4\n\t.align 8\n.LC4:\n\t.long\t5\n\t.long\t5\n\t.align 8\n.LC5:\n\t.long\t6\n\t.long\t6\n\t.align 8\n.LC6:\n\t.long\t7\n\t.long\t3\n\t.align 8\n.LC7:\n\t.long\t8\n\t.long\t7\n\t.align 8\n.LC8:\n\t.long\t9\n\t.long\t6\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\t1\t\t\t\t\t\t\t\t\t\t// 汎用フラグ - ON\n#define D_OFF\t\t\t0\t\t\t\t\t\t\t\t\t\t// 汎用フラグ - OFF\n#define D_MCNT_MAX\t\t20000\t\t\t\t\t\t\t\t\t// 最大マッチ数\n#define D_NUM_KIND\t\t9\t\t\t\t\t\t\t\t\t\t// 数字種類数\n#define D_PTN_MAX\t\t6000\t\t\t\t\t\t\t\t\t// 最大パターン数\n\n// 内部構造体 - 数字情報\ntypedef struct Num {\n\tint miVal;\t\t\t\t\t\t\t\t\t\t\t\t\t// 値\n\tint miMCnt;\t\t\t\t\t\t\t\t\t\t\t\t\t// マッチ数\n\tint miUse;\t\t\t\t\t\t\t\t\t\t\t\t\t// 使用フラグ\n\tint miUCnt;\t\t\t\t\t\t\t\t\t\t\t\t\t// 使用数\n} Num;\n\n// 内部変数\nstatic FILE *szpFpI;\t\t\t\t\t\t\t\t\t\t\t// 入力\nstatic int siMCnt;\t\t\t\t\t\t\t\t\t\t\t\t// マッチ数\nstatic Num sz1Num[D_NUM_KIND];\t\t\t\t\t\t\t\t\t// 数字\nstatic int siNCnt;\t\t\t\t\t\t\t\t\t\t\t\t// 数字数\nstatic int si1SNum[D_NUM_KIND + 5];\t\t\t\t\t\t\t\t// 選択数字[数字]\nstatic int si2SCnt[D_NUM_KIND + 5][D_PTN_MAX];\t\t\t\t\t// 選択数字数[数字][残マッチ数]\nstatic char sc1Out[D_MCNT_MAX];\t\t\t\t\t\t\t\t\t// 出力文字列\n\n// 内部変数 - テスト用\n#ifdef D_TEST\n\tstatic int siRes;\n\tstatic FILE *szpFpA;\n#endif\n\n// ソート関数 - 値降順\nint\nfSortFncVd(\n\tconst void *pzpVal1\t\t\t// <I> 値1\n\t, const void *pzpVal2\t\t// <I> 値2\n)\n{\n\tNum *lzpVal1 = (Num *)pzpVal1;\n\tNum *lzpVal2 = (Num *)pzpVal2;\n\n\t// 値降順\n\tif (lzpVal1->miVal > lzpVal2->miVal) {\n\t\treturn -1;\n\t}\n\telse if (lzpVal1->miVal < lzpVal2->miVal) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n// ソート関数 - 使用フラグ降順 - マッチ数昇順 - 値降順\nint\nfSortFnc(\n\tconst void *pzpVal1\t\t\t// <I> 値1\n\t, const void *pzpVal2\t\t// <I> 値2\n)\n{\n\tint liRet;\n\tNum *lzpVal1 = (Num *)pzpVal1;\n\tNum *lzpVal2 = (Num *)pzpVal2;\n\n\t// 使用フラグ降順\n\tif (lzpVal1->miUse > lzpVal2->miUse) {\n\t\treturn -1;\n\t}\n\telse if (lzpVal1->miUse < lzpVal2->miUse) {\n\t\treturn 1;\n\t}\n\n\t// マッチ数昇順\n\tif (lzpVal1->miMCnt > lzpVal2->miMCnt) {\n\t\treturn 1;\n\t}\n\telse if (lzpVal1->miMCnt < lzpVal2->miMCnt) {\n\t\treturn -1;\n\t}\n\n\t// 値降順\n\tliRet = fSortFncVd(pzpVal1, pzpVal2);\n\tif (liRet != 0) {\n\t\treturn liRet;\n\t}\n\n\treturn 0;\n}\n\n// 最大公約数 - 取得\nint\nfGetGcd(\n\tint piVal1\t\t\t\t\t// <I> 値1\n\t, int piVal2\t\t\t\t// <I> 値2\n)\n{\n\tint liWork;\n\n\t// ユークリッドの互除法\n\tif (piVal1 < piVal2) {\n\t\tliWork = piVal1;\n\t\tpiVal1 = piVal2;\n\t\tpiVal2 = liWork;\n\t}\n\twhile (piVal2 > 0) {\n\t\tliWork = piVal1 % piVal2;\n\t\tpiVal1 = piVal2;\n\t\tpiVal2 = liWork;\n\t}\n\n\treturn piVal1;\n}\n\n// 最小公倍数 - 取得\nint\nfGetLcm(\n\tint piVal1\t\t\t\t\t// <I> 値1\n\t, int piVal2\t\t\t\t// <I> 値2\n)\n{\n\t// 最大公約数 - 取得\n\tint liGcd = fGetGcd(piVal1, piVal2);\n\n\t// 約数\n\tint liVal1 = piVal1 / liGcd;\n\tint liVal2 = piVal2 / liGcd;\n\n\treturn liVal1 * liVal2 * liGcd;\n}\n\n// 選択数字 - セット\nint\nfSetSNum(\n\tint piNNo\t\t\t\t\t// <I> 数字 0~\n\t, int piMCnt\t\t\t\t// <I> 残マッチ数\n\t, int piSCnt\t\t\t\t// <I> 選択数字数\n\t, int *pipNCnt\t\t\t\t// <I> 数字数\n)\n{\n\tint i;\n\n\t// 選択数字\n\tif (piMCnt != siMCnt) {\n\t\tif (si2SCnt[piNNo][piMCnt] >= piSCnt) {\n\t\t\treturn 0;\n\t\t}\n\t\tsi2SCnt[piNNo][piMCnt] = piSCnt;\n\t}\n\n\t// 選択中\n\tif (piNNo < siNCnt) {\n\n\t\t// ループ回数\n\t\tint liCnt = piMCnt / sz1Num[piNNo].miMCnt;\n\n\t\t// 下位へ\n\t\tfor (i = liCnt; i >= 0; i--) {\n\t\t\tpipNCnt[piNNo] = i;\n\t\t\tfSetSNum(piNNo + 1, piMCnt - sz1Num[piNNo].miMCnt * i, piSCnt + i, pipNCnt);\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t// 残マッチ数\n\tif (piMCnt != 0) {\n\t\treturn 0;\n\t}\n\n\t// 選択数字\n\tmemcpy(si1SNum, pipNCnt, sizeof(si1SNum));\n\n\treturn 0;\n}\n\n// 実行メイン\nint\nfMain(\n\tint piTNo\t\t\t\t\t// <I> テスト番号 1~\n)\n{\n\tint i, j;\n\tchar lc1Buf[1024];\n\n\t// データ - 初期化\n\tmemset(sz1Num, 0, sizeof(sz1Num));\t\t\t\t\t\t\t// 数字\n\tmemset(si2SCnt, 0, sizeof(si2SCnt));\t\t\t\t\t\t// 選択数字数[数字][マッチ数]\n\n\t// 入力 - セット\n#ifdef D_TEST\n\tsprintf(lc1Buf, \".\\\\Test\\\\T%d.txt\", piTNo);\n\tszpFpI = fopen(lc1Buf, \"r\");\n\tsprintf(lc1Buf, \".\\\\Test\\\\A%d.txt\", piTNo);\n\tszpFpA = fopen(lc1Buf, \"r\");\n\tsiRes = 0;\n#else\n\tszpFpI = stdin;\n#endif\n\n\t// 数字 - 初期化\n\tsz1Num[0].miVal = 1;\n\tsz1Num[0].miMCnt = 2;\n\tsz1Num[1].miVal = 2;\n\tsz1Num[1].miMCnt = 5;\n\tsz1Num[2].miVal = 3;\n\tsz1Num[2].miMCnt = 5;\n\tsz1Num[3].miVal = 4;\n\tsz1Num[3].miMCnt = 4;\n\tsz1Num[4].miVal = 5;\n\tsz1Num[4].miMCnt = 5;\n\tsz1Num[5].miVal = 6;\n\tsz1Num[5].miMCnt = 6;\n\tsz1Num[6].miVal = 7;\n\tsz1Num[6].miMCnt = 3;\n\tsz1Num[7].miVal = 8;\n\tsz1Num[7].miMCnt = 7;\n\tsz1Num[8].miVal = 9;\n\tsz1Num[8].miMCnt = 6;\n\n\t// マッチ数・使用数字数 - 取得\n\tint liNCnt;\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpI);\n\tsscanf(lc1Buf, \"%d%d\", &siMCnt, &liNCnt);\n\n\t// 使用数字 - 取得\n\tfor (i = 0; i < liNCnt; i++) {\n\t\tint liNum;\n\t\tfscanf(szpFpI, \"%d\", &liNum);\n\t\tsz1Num[liNum - 1].miUse = D_ON;\n\t}\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpI);\n\n\t// 数字 - ソート\n\tqsort(sz1Num, D_NUM_KIND, sizeof(Num), fSortFnc);\n\n\t// 不要数字 - 削除\n\tsiNCnt = 1;\n\tfor (i = 1; i < D_NUM_KIND; i++) {\n\t\tif (sz1Num[i].miUse == D_OFF) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sz1Num[i].miMCnt == sz1Num[i - 1].miMCnt) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (siNCnt != i) {\n\t\t\tmemcpy(&sz1Num[siNCnt], &sz1Num[i], sizeof(Num));\n\t\t}\n\t\tsiNCnt++;\n\t}\n\n\t// 最小公倍数 - 取得\n\tint liLcm = sz1Num[0].miMCnt;\n\tfor (i = 1; i < siNCnt; i++) {\n\t\tliLcm = fGetLcm(liLcm, sz1Num[i].miMCnt);\n\t}\n\n\t// 確定個数\n\tint liFCnt = (siMCnt - liLcm) / sz1Num[0].miMCnt;\n\tsz1Num[0].miUCnt = liFCnt;\n\n\t// 残本数\n\tsiMCnt -= liFCnt * sz1Num[0].miMCnt;\n\n\t// 数字 - ソート\n\tqsort(sz1Num, siNCnt, sizeof(Num), fSortFncVd);\n\n\t// 選択数字 - セット\n\tint li1UCnt[D_NUM_KIND];\n\tmemset(li1UCnt, 0, sizeof(li1UCnt));\n\tfSetSNum(0, siMCnt, 0, li1UCnt);\n\n\t// 使用数 - 加算\n\tfor (i = 0; i < siNCnt; i++) {\n\t\tsz1Num[i].miUCnt += si1SNum[i];\n\t}\n\n\t// 結果 - セット\n\tint liNo = 0;\n\tfor (i = 0; i < D_NUM_KIND; i++) {\n\t\tfor (j = 0; j < sz1Num[i].miUCnt; j++) {\n\t\t\tsc1Out[liNo] = sz1Num[i].miVal + '0';\n\t\t\tliNo++;\n\t\t}\n\t}\n\tsc1Out[liNo] = '\\n';\n\tsc1Out[liNo + 1] = '\\0';\n\n\t// 結果 - 表示\n#ifdef D_TEST\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpA);\n\tif (strcmp(lc1Buf, sc1Out)) {\n\t\tsiRes = -1;\n\t}\n#else\n\tprintf(\"%s\", sc1Out);\n#endif\n\n\t// 残データ有無\n#ifdef D_TEST\n\tlc1Buf[0] = '\\0';\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpA);\n\tif (strcmp(lc1Buf, \"\")) {\n\t\tsiRes = -1;\n\t}\n#endif\n\n\t// テストファイルクローズ\n#ifdef D_TEST\n\tfclose(szpFpI);\n\tfclose(szpFpA);\n#endif\n\n\t// テスト結果\n#ifdef D_TEST\n\tif (siRes == 0) {\n\t\tprintf(\"OK %d\\n\", piTNo);\n\t}\n\telse {\n\t\tprintf(\"NG %d\\n\", piTNo);\n\t}\n#endif\n\n\treturn 0;\n}\n\nint\nmain()\n{\n\n#ifdef D_TEST\n\tint i;\n\tfor (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {\n\t\tfMain(i);\n\t}\n#else\n\tfMain(0);\n#endif\n\n\treturn 0;\n}\n\n", "index": 8, "inputs": [ "101 9\n9 8 7 6 5 4 3 1 1\n", "20 4\n3 7 8 7\n", "15 4\n5 4 6\n", "15 7\n5 3 6\n", "15 6\n5 1 6\n", "12 6\n5 1 6\n", "101 9\n9 8 1 6 5 4 3 2 1\n", "20 4\n3 7 8 5\n", "15 3\n5 4 9\n", "15 7\n2 3 6\n", "15 6\n7 3 6\n", "20 4\n2 7 9 7\n", "23 3\n5 3 6\n", "15 7\n4 3 6\n", "10 6\n7 5 6\n", "23 1\n6 3 6\n", "24 7\n4 3 5\n", "17 6\n7 5 6\n", "23 1\n4 3 6\n", "23 10\n4 3 5\n", "23 10\n1 3 5\n", "4 14\n1 5 5\n", "111 9\n9 8 7 6 8 4 3 1 1\n", "20 4\n4 7 9 7\n", "100 13\n9 8 1 6 5 4 3 2 1\n", "45 1\n5 3 6\n", "32 10\n4 3 5\n", "11 10\n1 3 5\n", "15 11\n8 4 6\n", "29 6\n5 1 8\n", "33 4\n3 7 8 9\n", "15 3\n7 3 1\n", "18 6\n9 5 6\n", "20 4\n2 5 1 7\n", "24 7\n8 3 8\n", "23 7\n1 3 2\n", "29 4\n5 4 2\n", "23 6\n5 2 9\n", "33 4\n3 3 8 9\n", "011 9\n9 8 7 6 8 4 3 2 1\n", "4 7\n4 4 7\n", "12 6\n9 5 6\n", "45 1\n7 3 2\n", "63 2\n4 3 6\n", "32 7\n1 3 2\n", "43 4\n3 3 8 9\n", "45 1\n7 1 2\n", "43 4\n3 5 8 9\n", "12 2\n7 4 9\n", "58 4\n5 1 8\n", "43 4\n3 4 8 9\n", "19 2\n7 4 9\n", "19 2\n7 1 9\n", "22 2\n7 1 1\n", "96 2\n4 1 5\n", "10 2\n7 1 1\n", "27 3\n5 4 6\n", "30 3\n5 4 9\n", "27 6\n7 3 6\n", "35 4\n2 7 9 7\n", "28 7\n4 3 5\n", "12 1\n6 3 6\n", "9 6\n7 5 6\n", "26 1\n4 3 6\n", "14 11\n5 4 6\n", "5 7\n7 3 6\n", "26 0\n7 3 6\n", "18 7\n4 3 7\n", "45 1\n3 3 6\n", "27 7\n1 3 5\n", "23 6\n4 2 6\n", "50 1\n5 3 2\n", "27 7\n8 3 8\n", "16 10\n1 1 5\n", "24 7\n1 3 2\n", "15 10\n2 4 9\n", "18 0\n7 1 2\n", "82 1\n7 3 2\n", "63 2\n4 5 6\n", "35 14\n5 1 8\n", "67 1\n7 1 1\n", "31 13\n1 3 2\n", "94 4\n5 1 8\n", "79 4\n3 4 8 9\n", "23 2\n7 4 9\n", "13 10\n1 3 3\n", "33 4\n4 1 8\n", "27 10\n1 3 2\n", "13 2\n7 1 1\n", "20 4\n6 4 8 5\n", "32 6\n7 3 6\n", "14 4\n2 7 9 7\n", "34 7\n4 3 5\n", "8 6\n7 5 6\n", "11 1\n4 3 6\n", "23 14\n4 3 2\n", "8 18\n1 5 5\n", "10 1\n5 4 6\n", "5 7\n5 3 6\n", "26 0\n9 3 6\n", "101 9\n9 8 7 6 5 4 3 2 1\n", "20 4\n3 7 8 4\n", "15 3\n5 4 6\n", "20 4\n3 7 8 4\n" ], "outputs": [ "71111111111111111111111111111111111111111111111111\n", "777773\n", "654\n", "555\n", "511111\n", "111111\n", "5111111111111111111111111111111111111111111111111\n", "777775\n", "954\n", "333\n", "77777\n", "777772\n", "6665\n", "643\n", "55\n", "66\n", "444444\n", "77775\n", "4444\n", "55544\n", "5111111111\n", "11\n", "7111111111111111111111111111111111111111111111111111111\n", "777744\n", "11111111111111111111111111111111111111111111111111\n", "555555555\n", "44444444\n", "5111\n", "844\n", "5111111111111\n", "77777777777\n", "7111111\n", "999\n", "1111111111\n", "8833\n", "3111111111\n", "5444444\n", "9995\n", "999333\n", "71111\n", "4\n", "99\n", "777777777777777\n", "444444444444333\n", "1111111111111111\n", "99933333\n", "777777777777777\n", "99955555\n", "7777\n", "11111111111111111111111111111\n", "9444444443\n", "777774\n", "711111111\n", "11111111111\n", "111111111111111111111111111111111111111111111111\n", "11111\n", "654444\n", "9444444\n", "777777777\n", "77777777772\n", "4444444\n", "66\n", "777\n", "44444\n", "644\n", "3\n", "1111111111111\n", "777777\n", "333333333\n", "511111111111\n", "64442\n", "5555555555\n", "83333\n", "11111111\n", "111111111111\n", "942\n", "111111111\n", "77777777777777777777777777\n", "555444444444444\n", "5111111111111111\n", "777777777777777777777\n", "31111111111111\n", "11111111111111111111111111111111111111111111111\n", "9444444444444444443\n", "7777744\n", "31111\n", "81111111111111\n", "311111111111\n", "711111\n", "44444\n", "7777777773\n", "7772\n", "55444444\n", "75\n", "4\n", "44333\n", "1111\n", "55\n", "5\n", "1111111111111\n", "71111111111111111111111111111111111111111111111111\n", "777773\n", "654\n", "777773\n" ], "question": "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\t1\t\t\t\t\t\t\t\t\t\t// 汎用フラグ - ON\n#define D_OFF\t\t\t0\t\t\t\t\t\t\t\t\t\t// 汎用フラグ - OFF\n#define D_MCNT_MAX\t\t20000\t\t\t\t\t\t\t\t\t// 最大マッチ数\n#define D_NUM_KIND\t\t9\t\t\t\t\t\t\t\t\t\t// 数字種類数\n#define D_PTN_MAX\t\t6000\t\t\t\t\t\t\t\t\t// 最大パターン数\n\n// 内部構造体 - 数字情報\ntypedef struct Num {\n\tint miVal;\t\t\t\t\t\t\t\t\t\t\t\t\t// 値\n\tint miMCnt;\t\t\t\t\t\t\t\t\t\t\t\t\t// マッチ数\n\tint miUse;\t\t\t\t\t\t\t\t\t\t\t\t\t// 使用フラグ\n\tint miUCnt;\t\t\t\t\t\t\t\t\t\t\t\t\t// 使用数\n} Num;\n\n// 内部変数\nstatic FILE *szpFpI;\t\t\t\t\t\t\t\t\t\t\t// 入力\nstatic int siMCnt;\t\t\t\t\t\t\t\t\t\t\t\t// マッチ数\nstatic Num sz1Num[D_NUM_KIND];\t\t\t\t\t\t\t\t\t// 数字\nstatic int siNCnt;\t\t\t\t\t\t\t\t\t\t\t\t// 数字数\nstatic int si1SNum[D_NUM_KIND + 5];\t\t\t\t\t\t\t\t// 選択数字[数字]\nstatic int si2SCnt[D_NUM_KIND + 5][D_PTN_MAX];\t\t\t\t\t// 選択数字数[数字][残マッチ数]\nstatic char sc1Out[D_MCNT_MAX];\t\t\t\t\t\t\t\t\t// 出力文字列\n\n// 内部変数 - テスト用\n#ifdef D_TEST\n\tstatic int siRes;\n\tstatic FILE *szpFpA;\n#endif\n\n// ソート関数 - 値降順\nint\nfSortFncVd(\n\tconst void *pzpVal1\t\t\t// <I> 値1\n\t, const void *pzpVal2\t\t// <I> 値2\n)\n{\n\tNum *lzpVal1 = (Num *)pzpVal1;\n\tNum *lzpVal2 = (Num *)pzpVal2;\n\n\t// 値降順\n\tif (lzpVal1->miVal > lzpVal2->miVal) {\n\t\treturn -1;\n\t}\n\telse if (lzpVal1->miVal < lzpVal2->miVal) {\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}\n\n// ソート関数 - 使用フラグ降順 - マッチ数昇順 - 値降順\nint\nfSortFnc(\n\tconst void *pzpVal1\t\t\t// <I> 値1\n\t, const void *pzpVal2\t\t// <I> 値2\n)\n{\n\tint liRet;\n\tNum *lzpVal1 = (Num *)pzpVal1;\n\tNum *lzpVal2 = (Num *)pzpVal2;\n\n\t// 使用フラグ降順\n\tif (lzpVal1->miUse > lzpVal2->miUse) {\n\t\treturn -1;\n\t}\n\telse if (lzpVal1->miUse < lzpVal2->miUse) {\n\t\treturn 1;\n\t}\n\n\t// マッチ数昇順\n\tif (lzpVal1->miMCnt > lzpVal2->miMCnt) {\n\t\treturn 1;\n\t}\n\telse if (lzpVal1->miMCnt < lzpVal2->miMCnt) {\n\t\treturn -1;\n\t}\n\n\t// 値降順\n\tliRet = fSortFncVd(pzpVal1, pzpVal2);\n\tif (liRet != 0) {\n\t\treturn liRet;\n\t}\n\n\treturn 0;\n}\n\n// 最大公約数 - 取得\nint\nfGetGcd(\n\tint piVal1\t\t\t\t\t// <I> 値1\n\t, int piVal2\t\t\t\t// <I> 値2\n)\n{\n\tint liWork;\n\n\t// ユークリッドの互除法\n\tif (piVal1 < piVal2) {\n\t\tliWork = piVal1;\n\t\tpiVal1 = piVal2;\n\t\tpiVal2 = liWork;\n\t}\n\twhile (piVal2 > 0) {\n\t\tliWork = piVal1 % piVal2;\n\t\tpiVal1 = piVal2;\n\t\tpiVal2 = liWork;\n\t}\n\n\treturn piVal1;\n}\n\n// 最小公倍数 - 取得\nint\nfGetLcm(\n\tint piVal1\t\t\t\t\t// <I> 値1\n\t, int piVal2\t\t\t\t// <I> 値2\n)\n{\n\t// 最大公約数 - 取得\n\tint liGcd = fGetGcd(piVal1, piVal2);\n\n\t// 約数\n\tint liVal1 = piVal1 / liGcd;\n\tint liVal2 = piVal2 / liGcd;\n\n\treturn liVal1 * liVal2 * liGcd;\n}\n\n// 選択数字 - セット\nint\nfSetSNum(\n\tint piNNo\t\t\t\t\t// <I> 数字 0~\n\t, int piMCnt\t\t\t\t// <I> 残マッチ数\n\t, int piSCnt\t\t\t\t// <I> 選択数字数\n\t, int *pipNCnt\t\t\t\t// <I> 数字数\n)\n{\n\tint i;\n\n\t// 選択数字\n\tif (piMCnt != siMCnt) {\n\t\tif (si2SCnt[piNNo][piMCnt] >= piSCnt) {\n\t\t\treturn 0;\n\t\t}\n\t\tsi2SCnt[piNNo][piMCnt] = piSCnt;\n\t}\n\n\t// 選択中\n\tif (piNNo < siNCnt) {\n\n\t\t// ループ回数\n\t\tint liCnt = piMCnt / sz1Num[piNNo].miMCnt;\n\n\t\t// 下位へ\n\t\tfor (i = liCnt; i >= 0; i--) {\n\t\t\tpipNCnt[piNNo] = i;\n\t\t\tfSetSNum(piNNo + 1, piMCnt - sz1Num[piNNo].miMCnt * i, piSCnt + i, pipNCnt);\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t// 残マッチ数\n\tif (piMCnt != 0) {\n\t\treturn 0;\n\t}\n\n\t// 選択数字\n\tmemcpy(si1SNum, pipNCnt, sizeof(si1SNum));\n\n\treturn 0;\n}\n\n// 実行メイン\nint\nfMain(\n\tint piTNo\t\t\t\t\t// <I> テスト番号 1~\n)\n{\n\tint i, j;\n\tchar lc1Buf[1024];\n\n\t// データ - 初期化\n\tmemset(sz1Num, 0, sizeof(sz1Num));\t\t\t\t\t\t\t// 数字\n\tmemset(si2SCnt, 0, sizeof(si2SCnt));\t\t\t\t\t\t// 選択数字数[数字][マッチ数]\n\n\t// 入力 - セット\n#ifdef D_TEST\n\tsprintf(lc1Buf, \".\\\\Test\\\\T%d.txt\", piTNo);\n\tszpFpI = fopen(lc1Buf, \"r\");\n\tsprintf(lc1Buf, \".\\\\Test\\\\A%d.txt\", piTNo);\n\tszpFpA = fopen(lc1Buf, \"r\");\n\tsiRes = 0;\n#else\n\tszpFpI = stdin;\n#endif\n\n\t// 数字 - 初期化\n\tsz1Num[0].miVal = 1;\n\tsz1Num[0].miMCnt = 2;\n\tsz1Num[1].miVal = 2;\n\tsz1Num[1].miMCnt = 5;\n\tsz1Num[2].miVal = 3;\n\tsz1Num[2].miMCnt = 5;\n\tsz1Num[3].miVal = 4;\n\tsz1Num[3].miMCnt = 4;\n\tsz1Num[4].miVal = 5;\n\tsz1Num[4].miMCnt = 5;\n\tsz1Num[5].miVal = 6;\n\tsz1Num[5].miMCnt = 6;\n\tsz1Num[6].miVal = 7;\n\tsz1Num[6].miMCnt = 3;\n\tsz1Num[7].miVal = 8;\n\tsz1Num[7].miMCnt = 7;\n\tsz1Num[8].miVal = 9;\n\tsz1Num[8].miMCnt = 6;\n\n\t// マッチ数・使用数字数 - 取得\n\tint liNCnt;\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpI);\n\tsscanf(lc1Buf, \"%d%d\", &siMCnt, &liNCnt);\n\n\t// 使用数字 - 取得\n\tfor (i = 0; i < liNCnt; i++) {\n\t\tint liNum;\n\t\tfscanf(szpFpI, \"%d\", &liNum);\n\t\tsz1Num[liNum - 1].miUse = D_ON;\n\t}\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpI);\n\n\t// 数字 - ソート\n\tqsort(sz1Num, D_NUM_KIND, sizeof(Num), fSortFnc);\n\n\t// 不要数字 - 削除\n\tsiNCnt = 1;\n\tfor (i = 1; i < D_NUM_KIND; i++) {\n\t\tif (sz1Num[i].miUse == D_OFF) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sz1Num[i].miMCnt == sz1Num[i - 1].miMCnt) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (siNCnt != i) {\n\t\t\tmemcpy(&sz1Num[siNCnt], &sz1Num[i], sizeof(Num));\n\t\t}\n\t\tsiNCnt++;\n\t}\n\n\t// 最小公倍数 - 取得\n\tint liLcm = sz1Num[0].miMCnt;\n\tfor (i = 1; i < siNCnt; i++) {\n\t\tliLcm = fGetLcm(liLcm, sz1Num[i].miMCnt);\n\t}\n\n\t// 確定個数\n\tint liFCnt = (siMCnt - liLcm) / sz1Num[0].miMCnt;\n\tsz1Num[0].miUCnt = liFCnt;\n\n\t// 残本数\n\tsiMCnt -= liFCnt * sz1Num[0].miMCnt;\n\n\t// 数字 - ソート\n\tqsort(sz1Num, siNCnt, sizeof(Num), fSortFncVd);\n\n\t// 選択数字 - セット\n\tint li1UCnt[D_NUM_KIND];\n\tmemset(li1UCnt, 0, sizeof(li1UCnt));\n\tfSetSNum(0, siMCnt, 0, li1UCnt);\n\n\t// 使用数 - 加算\n\tfor (i = 0; i < siNCnt; i++) {\n\t\tsz1Num[i].miUCnt += si1SNum[i];\n\t}\n\n\t// 結果 - セット\n\tint liNo = 0;\n\tfor (i = 0; i < D_NUM_KIND; i++) {\n\t\tfor (j = 0; j < sz1Num[i].miUCnt; j++) {\n\t\t\tsc1Out[liNo] = sz1Num[i].miVal + '0';\n\t\t\tliNo++;\n\t\t}\n\t}\n\tsc1Out[liNo] = '\\n';\n\tsc1Out[liNo + 1] = '\\0';\n\n\t// 結果 - 表示\n#ifdef D_TEST\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpA);\n\tif (strcmp(lc1Buf, sc1Out)) {\n\t\tsiRes = -1;\n\t}\n#else\n\tprintf(\"%s\", sc1Out);\n#endif\n\n\t// 残データ有無\n#ifdef D_TEST\n\tlc1Buf[0] = '\\0';\n\tfgets(lc1Buf, sizeof(lc1Buf), szpFpA);\n\tif (strcmp(lc1Buf, \"\")) {\n\t\tsiRes = -1;\n\t}\n#endif\n\n\t// テストファイルクローズ\n#ifdef D_TEST\n\tfclose(szpFpI);\n\tfclose(szpFpA);\n#endif\n\n\t// テスト結果\n#ifdef D_TEST\n\tif (siRes == 0) {\n\t\tprintf(\"OK %d\\n\", piTNo);\n\t}\n\telse {\n\t\tprintf(\"NG %d\\n\", piTNo);\n\t}\n#endif\n\n\treturn 0;\n}\n\nint\nmain()\n{\n\n#ifdef D_TEST\n\tint i;\n\tfor (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {\n\t\tfMain(i);\n\t}\n#else\n\tfMain(0);\n#endif\n\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.local\tszpFpI\n\t.comm\tszpFpI,8,8\n\t.local\tsiMCnt\n\t.comm\tsiMCnt,4,4\n\t.local\tsz1Num\n\t.comm\tsz1Num,144,32\n\t.local\tsiNCnt\n\t.comm\tsiNCnt,4,4\n\t.local\tsi1SNum\n\t.comm\tsi1SNum,56,32\n\t.local\tsi2SCnt\n\t.comm\tsi2SCnt,336000,32\n\t.local\tsc1Out\n\t.comm\tsc1Out,20000,32\n\t.globl\tfSortFncVd\n\t.type\tfSortFncVd, @function\nfSortFncVd:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L2\n\tmovl\t$-1, %eax\n\tjmp\t.L3\n.L2:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L4\n\tmovl\t$1, %eax\n\tjmp\t.L3\n.L4:\n\tmovl\t$0, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tfSortFncVd, .-fSortFncVd\n\t.globl\tfSortFnc\n\t.type\tfSortFnc, @function\nfSortFnc:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t8(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t8(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L6\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L6:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t8(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t8(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L8:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L9\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L9:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L10\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L10:\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tfSortFncVd\n\tmovl\t%eax, -20(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tje\t.L11\n\tmovl\t-20(%rbp), %eax\n\tjmp\t.L7\n.L11:\n\tmovl\t$0, %eax\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tfSortFnc, .-fSortFnc\n\t.globl\tfGetGcd\n\t.type\tfGetGcd, @function\nfGetGcd:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjge\t.L14\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L14:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L15\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tfGetGcd, .-fGetGcd\n\t.globl\tfGetLcm\n\t.type\tfGetLcm, @function\nfGetLcm:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tfGetGcd\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-12(%rbp)\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcltd\n\tidivl\t-12(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %eax\n\timull\t-4(%rbp), %eax\n\timull\t-12(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tfGetLcm, .-fGetLcm\n\t.globl\tfSetSNum\n\t.type\tfSetSNum, @function\nfSetSNum:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovq\t%rcx, -40(%rbp)\n\tmovl\tsiMCnt(%rip), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tje\t.L20\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\timulq\t$6000, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tsi2SCnt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjg\t.L21\n\tmovl\t$0, %eax\n\tjmp\t.L22\n.L21:\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\timulq\t$6000, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tsi2SCnt(%rip), %rdx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n.L20:\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L23\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %esi\n\tmovl\t-24(%rbp), %eax\n\tcltd\n\tidivl\t%esi\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L24\n.L25:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tmovl\t-24(%rbp), %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %esi\n\tmovl\t-20(%rbp), %eax\n\tleal\t1(%rax), %edi\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tcall\tfSetSNum\n\tsubl\t$1, -8(%rbp)\n.L24:\n\tcmpl\t$0, -8(%rbp)\n\tjns\t.L25\n\tmovl\t$0, %eax\n\tjmp\t.L22\n.L23:\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L26\n\tmovl\t$0, %eax\n\tjmp\t.L22\n.L26:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t$56, %edx\n\tmovq\t%rax, %rsi\n\tleaq\tsi1SNum(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemcpy@PLT\n\tmovl\t$0, %eax\n.L22:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tfSetSNum, .-fSetSNum\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%s\"\n\t.text\n\t.globl\tfMain\n\t.type\tfMain, @function\nfMain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$1136, %rsp\n\tmovl\t%edi, -1124(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$144, %edx\n\tmovl\t$0, %esi\n\tleaq\tsz1Num(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$336000, %edx\n\tmovl\t$0, %esi\n\tleaq\tsi2SCnt(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovq\tstdin(%rip), %rax\n\tmovq\t%rax, szpFpI(%rip)\n\tmovl\t$1, sz1Num(%rip)\n\tmovl\t$2, 4+sz1Num(%rip)\n\tmovl\t$2, 16+sz1Num(%rip)\n\tmovl\t$5, 20+sz1Num(%rip)\n\tmovl\t$3, 32+sz1Num(%rip)\n\tmovl\t$5, 36+sz1Num(%rip)\n\tmovl\t$4, 48+sz1Num(%rip)\n\tmovl\t$4, 52+sz1Num(%rip)\n\tmovl\t$5, 64+sz1Num(%rip)\n\tmovl\t$5, 68+sz1Num(%rip)\n\tmovl\t$6, 80+sz1Num(%rip)\n\tmovl\t$6, 84+sz1Num(%rip)\n\tmovl\t$7, 96+sz1Num(%rip)\n\tmovl\t$3, 100+sz1Num(%rip)\n\tmovl\t$8, 112+sz1Num(%rip)\n\tmovl\t$7, 116+sz1Num(%rip)\n\tmovl\t$9, 128+sz1Num(%rip)\n\tmovl\t$6, 132+sz1Num(%rip)\n\tmovq\tszpFpI(%rip), %rdx\n\tleaq\t-1040(%rbp), %rax\n\tmovl\t$1024, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\tleaq\t-1116(%rbp), %rdx\n\tleaq\t-1040(%rbp), %rax\n\tmovq\t%rdx, %rcx\n\tleaq\tsiMCnt(%rip), %rdx\n\tleaq\t.LC0(%rip), %rsi\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_sscanf@PLT\n\tmovl\t$0, -1108(%rbp)\n\tjmp\t.L28\n.L29:\n\tmovq\tszpFpI(%rip), %rax\n\tleaq\t-1112(%rbp), %rdx\n\tleaq\t.LC1(%rip), %rcx\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_fscanf@PLT\n\tmovl\t-1112(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t8+sz1Num(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\taddl\t$1, -1108(%rbp)\n.L28:\n\tmovl\t-1116(%rbp), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tjl\t.L29\n\tmovq\tszpFpI(%rip), %rdx\n\tleaq\t-1040(%rbp), %rax\n\tmovl\t$1024, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\tleaq\tfSortFnc(%rip), %rax\n\tmovq\t%rax, %rcx\n\tmovl\t$16, %edx\n\tmovl\t$9, %esi\n\tleaq\tsz1Num(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$1, siNCnt(%rip)\n\tmovl\t$1, -1108(%rbp)\n\tjmp\t.L30\n.L36:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t8+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tje\t.L47\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-1108(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tcmpl\t%eax, %edx\n\tje\t.L48\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tje\t.L35\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tsz1Num(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovl\tsiNCnt(%rip), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$4, %rcx\n\tleaq\tsz1Num(%rip), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rcx)\n\tmovq\t%rdx, 8(%rcx)\n.L35:\n\tmovl\tsiNCnt(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, siNCnt(%rip)\n\tjmp\t.L34\n.L48:\n\tnop\n.L34:\n\taddl\t$1, -1108(%rbp)\n.L30:\n\tcmpl\t$8, -1108(%rbp)\n\tjle\t.L36\n\tjmp\t.L32\n.L47:\n\tnop\n.L32:\n\tmovl\t4+sz1Num(%rip), %eax\n\tmovl\t%eax, -1100(%rbp)\n\tmovl\t$1, -1108(%rbp)\n\tjmp\t.L37\n.L38:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t4+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-1100(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tfGetLcm\n\tmovl\t%eax, -1100(%rbp)\n\taddl\t$1, -1108(%rbp)\n.L37:\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tjl\t.L38\n\tmovl\tsiMCnt(%rip), %eax\n\tsubl\t-1100(%rbp), %eax\n\tmovl\t4+sz1Num(%rip), %edi\n\tcltd\n\tidivl\t%edi\n\tmovl\t%eax, -1092(%rbp)\n\tmovl\t-1092(%rbp), %eax\n\tmovl\t%eax, 12+sz1Num(%rip)\n\tmovl\tsiMCnt(%rip), %edx\n\tmovl\t4+sz1Num(%rip), %eax\n\timull\t-1092(%rbp), %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, siMCnt(%rip)\n\tmovl\tsiNCnt(%rip), %eax\n\tcltq\n\tleaq\tfSortFncVd(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$16, %edx\n\tmovq\t%rax, %rsi\n\tleaq\tsz1Num(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tleaq\t-1088(%rbp), %rax\n\tmovl\t$36, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\tsiMCnt(%rip), %eax\n\tleaq\t-1088(%rbp), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$0, %edx\n\tmovl\t%eax, %esi\n\tmovl\t$0, %edi\n\tcall\tfSetSNum\n\tmovl\t$0, -1108(%rbp)\n\tjmp\t.L39\n.L40:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t12+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tsi1SNum(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, %ecx\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t12+sz1Num(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\taddl\t$1, -1108(%rbp)\n.L39:\n\tmovl\tsiNCnt(%rip), %eax\n\tcmpl\t%eax, -1108(%rbp)\n\tjl\t.L40\n\tmovl\t$0, -1096(%rbp)\n\tmovl\t$0, -1108(%rbp)\n\tjmp\t.L41\n.L44:\n\tmovl\t$0, -1104(%rbp)\n\tjmp\t.L42\n.L43:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tsz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t$48, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t-1096(%rbp), %eax\n\tcltq\n\tleaq\tsc1Out(%rip), %rdx\n\tmovb\t%cl, (%rax,%rdx)\n\taddl\t$1, -1096(%rbp)\n\taddl\t$1, -1104(%rbp)\n.L42:\n\tmovl\t-1108(%rbp), %eax\n\tcltq\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t12+sz1Num(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -1104(%rbp)\n\tjl\t.L43\n\taddl\t$1, -1108(%rbp)\n.L41:\n\tcmpl\t$8, -1108(%rbp)\n\tjle\t.L44\n\tmovl\t-1096(%rbp), %eax\n\tcltq\n\tleaq\tsc1Out(%rip), %rdx\n\tmovb\t$10, (%rax,%rdx)\n\tmovl\t-1096(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\tsc1Out(%rip), %rdx\n\tmovb\t$0, (%rax,%rdx)\n\tleaq\tsc1Out(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L46\n\tcall\t__stack_chk_fail@PLT\n.L46:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tfMain, .-fMain\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$0, %edi\n\tcall\tfMain\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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_OFF 0 // 汎用フラグ - OFF #define D_MCNT_MAX 20000 // 最大マッチ数 #define D_NUM_KIND 9 // 数字種類数 #define D_PTN_MAX 6000 // 最大パターン数 // 内部構造体 - 数字情報 typedef struct Num { int miVal; // 値 int miMCnt; // マッチ数 int miUse; // 使用フラグ int miUCnt; // 使用数 } Num; // 内部変数 static FILE *szpFpI; // 入力 static int siMCnt; // マッチ数 static Num sz1Num[D_NUM_KIND]; // 数字 static int siNCnt; // 数字数 static int si1SNum[D_NUM_KIND + 5]; // 選択数字[数字] static int si2SCnt[D_NUM_KIND + 5][D_PTN_MAX]; // 選択数字数[数字][残マッチ数] static char sc1Out[D_MCNT_MAX]; // 出力文字列 // 内部変数 - テスト用 #ifdef D_TEST static int siRes; static FILE *szpFpA; #endif // ソート関数 - 値降順 int fSortFncVd( const void *pzpVal1 // <I> 値1 , const void *pzpVal2 // <I> 値2 ) { Num *lzpVal1 = (Num *)pzpVal1; Num *lzpVal2 = (Num *)pzpVal2; // 値降順 if (lzpVal1->miVal > lzpVal2->miVal) { return -1; } else if (lzpVal1->miVal < lzpVal2->miVal) { return 1; } return 0; } // ソート関数 - 使用フラグ降順 - マッチ数昇順 - 値降順 int fSortFnc( const void *pzpVal1 // <I> 値1 , const void *pzpVal2 // <I> 値2 ) { int liRet; Num *lzpVal1 = (Num *)pzpVal1; Num *lzpVal2 = (Num *)pzpVal2; // 使用フラグ降順 if (lzpVal1->miUse > lzpVal2->miUse) { return -1; } else if (lzpVal1->miUse < lzpVal2->miUse) { return 1; } // マッチ数昇順 if (lzpVal1->miMCnt > lzpVal2->miMCnt) { return 1; } else if (lzpVal1->miMCnt < lzpVal2->miMCnt) { return -1; } // 値降順 liRet = fSortFncVd(pzpVal1, pzpVal2); if (liRet != 0) { return liRet; } return 0; } // 最大公約数 - 取得 int fGetGcd( int piVal1 // <I> 値1 , int piVal2 // <I> 値2 ) { int liWork; // ユークリッドの互除法 if (piVal1 < piVal2) { liWork = piVal1; piVal1 = piVal2; piVal2 = liWork; } while (piVal2 > 0) { liWork = piVal1 % piVal2; piVal1 = piVal2; piVal2 = liWork; } return piVal1; } // 最小公倍数 - 取得 int fGetLcm( int piVal1 // <I> 値1 , int piVal2 // <I> 値2 ) { // 最大公約数 - 取得 int liGcd = fGetGcd(piVal1, piVal2); // 約数 int liVal1 = piVal1 / liGcd; int liVal2 = piVal2 / liGcd; return liVal1 * liVal2 * liGcd; } // 選択数字 - セット int fSetSNum( int piNNo // <I> 数字 0~ , int piMCnt // <I> 残マッチ数 , int piSCnt // <I> 選択数字数 , int *pipNCnt // <I> 数字数 ) { int i; // 選択数字 if (piMCnt != siMCnt) { if (si2SCnt[piNNo][piMCnt] >= piSCnt) { return 0; } si2SCnt[piNNo][piMCnt] = piSCnt; } // 選択中 if (piNNo < siNCnt) { // ループ回数 int liCnt = piMCnt / sz1Num[piNNo].miMCnt; // 下位へ for (i = liCnt; i >= 0; i--) { pipNCnt[piNNo] = i; fSetSNum(piNNo + 1, piMCnt - sz1Num[piNNo].miMCnt * i, piSCnt + i, pipNCnt); } return 0; } // 残マッチ数 if (piMCnt != 0) { return 0; } // 選択数字 memcpy(si1SNum, pipNCnt, sizeof(si1SNum)); return 0; } // 実行メイン int fMain( int piTNo // <I> テスト番号 1~ ) { int i, j; char lc1Buf[1024]; // データ - 初期化 memset(sz1Num, 0, sizeof(sz1Num)); // 数字 memset(si2SCnt, 0, sizeof(si2SCnt)); // 選択数字数[数字][マッチ数] // 入力 - セット #ifdef D_TEST sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo); szpFpI = fopen(lc1Buf, "r"); sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo); szpFpA = fopen(lc1Buf, "r"); siRes = 0; #else szpFpI = stdin; #endif // 数字 - 初期化 sz1Num[0].miVal = 1; sz1Num[0].miMCnt = 2; sz1Num[1].miVal = 2; sz1Num[1].miMCnt = 5; sz1Num[2].miVal = 3; sz1Num[2].miMCnt = 5; sz1Num[3].miVal = 4; sz1Num[3].miMCnt = 4; sz1Num[4].miVal = 5; sz1Num[4].miMCnt = 5; sz1Num[5].miVal = 6; sz1Num[5].miMCnt = 6; sz1Num[6].miVal = 7; sz1Num[6].miMCnt = 3; sz1Num[7].miVal = 8; sz1Num[7].miMCnt = 7; sz1Num[8].miVal = 9; sz1Num[8].miMCnt = 6; // マッチ数・使用数字数 - 取得 int liNCnt; fgets(lc1Buf, sizeof(lc1Buf), szpFpI); sscanf(lc1Buf, "%d%d", &siMCnt, &liNCnt); // 使用数字 - 取得 for (i = 0; i < liNCnt; i++) { int liNum; fscanf(szpFpI, "%d", &liNum); sz1Num[liNum - 1].miUse = D_ON; } fgets(lc1Buf, sizeof(lc1Buf), szpFpI); // 数字 - ソート qsort(sz1Num, D_NUM_KIND, sizeof(Num), fSortFnc); // 不要数字 - 削除 siNCnt = 1; for (i = 1; i < D_NUM_KIND; i++) { if (sz1Num[i].miUse == D_OFF) { break; } if (sz1Num[i].miMCnt == sz1Num[i - 1].miMCnt) { continue; } if (siNCnt != i) { memcpy(&sz1Num[siNCnt], &sz1Num[i], sizeof(Num)); } siNCnt++; } // 最小公倍数 - 取得 int liLcm = sz1Num[0].miMCnt; for (i = 1; i < siNCnt; i++) { liLcm = fGetLcm(liLcm, sz1Num[i].miMCnt); } // 確定個数 int liFCnt = (siMCnt - liLcm) / sz1Num[0].miMCnt; sz1Num[0].miUCnt = liFCnt; // 残本数 siMCnt -= liFCnt * sz1Num[0].miMCnt; // 数字 - ソート qsort(sz1Num, siNCnt, sizeof(Num), fSortFncVd); // 選択数字 - セット int li1UCnt[D_NUM_KIND]; memset(li1UCnt, 0, sizeof(li1UCnt)); fSetSNum(0, siMCnt, 0, li1UCnt); // 使用数 - 加算 for (i = 0; i < siNCnt; i++) { sz1Num[i].miUCnt += si1SNum[i]; } // 結果 - セット int liNo = 0; for (i = 0; i < D_NUM_KIND; i++) { for (j = 0; j < sz1Num[i].miUCnt; j++) { sc1Out[liNo] = sz1Num[i].miVal + '0'; liNo++; } } sc1Out[liNo] = '\n'; sc1Out[liNo + 1] = '\0'; // 結果 - 表示 #ifdef D_TEST fgets(lc1Buf, sizeof(lc1Buf), szpFpA); if (strcmp(lc1Buf, sc1Out)) { siRes = -1; } #else printf("%s", sc1Out); #endif // 残データ有無 #ifdef D_TEST lc1Buf[0] = '\0'; fgets(lc1Buf, sizeof(lc1Buf), szpFpA); if (strcmp(lc1Buf, "")) { siRes = -1; } #endif // テストファイルクローズ #ifdef D_TEST fclose(szpFpI); fclose(szpFpA); #endif // テスト結果 #ifdef D_TEST if (siRes == 0) { printf("OK %d\n", piTNo); } else { printf("NG %d\n", piTNo); } #endif return 0; } int main() { #ifdef D_TEST int i; for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) { fMain(i); } #else fMain(0); #endif return 0; } Unoptimized Assembly Code: .file "temp.c" .text .local szpFpI .comm szpFpI,8,8 .local siMCnt .comm siMCnt,4,4 .local sz1Num .comm sz1Num,144,32 .local siNCnt .comm siNCnt,4,4 .local si1SNum .comm si1SNum,56,32 .local si2SCnt .comm si2SCnt,336000,32 .local sc1Out .comm sc1Out,20000,32 .globl fSortFncVd .type fSortFncVd, @function fSortFncVd: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq %rax, -8(%rbp) movq -16(%rbp), %rax movl (%rax), %edx movq -8(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jle .L2 movl $-1, %eax jmp .L3 .L2: movq -16(%rbp), %rax movl (%rax), %edx movq -8(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jge .L4 movl $1, %eax jmp .L3 .L4: movl $0, %eax .L3: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size fSortFncVd, .-fSortFncVd .globl fSortFnc .type fSortFnc, @function fSortFnc: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movq -40(%rbp), %rax movq %rax, -16(%rbp) movq -48(%rbp), %rax movq %rax, -8(%rbp) movq -16(%rbp), %rax movl 8(%rax), %edx movq -8(%rbp), %rax movl 8(%rax), %eax cmpl %eax, %edx jle .L6 movl $-1, %eax jmp .L7 .L6: movq -16(%rbp), %rax movl 8(%rax), %edx movq -8(%rbp), %rax movl 8(%rax), %eax cmpl %eax, %edx jge .L8 movl $1, %eax jmp .L7 .L8: movq -16(%rbp), %rax movl 4(%rax), %edx movq -8(%rbp), %rax movl 4(%rax), %eax cmpl %eax, %edx jle .L9 movl $1, %eax jmp .L7 .L9: movq -16(%rbp), %rax movl 4(%rax), %edx movq -8(%rbp), %rax movl 4(%rax), %eax cmpl %eax, %edx jge .L10 movl $-1, %eax jmp .L7 .L10: movq -48(%rbp), %rdx movq -40(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call fSortFncVd movl %eax, -20(%rbp) cmpl $0, -20(%rbp) je .L11 movl -20(%rbp), %eax jmp .L7 .L11: movl $0, %eax .L7: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size fSortFnc, .-fSortFnc .globl fGetGcd .type fGetGcd, @function fGetGcd: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl -20(%rbp), %eax cmpl -24(%rbp), %eax jge .L14 movl -20(%rbp), %eax movl %eax, -4(%rbp) movl -24(%rbp), %eax movl %eax, -20(%rbp) movl -4(%rbp), %eax movl %eax, -24(%rbp) jmp .L14 .L15: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %edx, -4(%rbp) movl -24(%rbp), %eax movl %eax, -20(%rbp) movl -4(%rbp), %eax movl %eax, -24(%rbp) .L14: cmpl $0, -24(%rbp) jg .L15 movl -20(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size fGetGcd, .-fGetGcd .globl fGetLcm .type fGetLcm, @function fGetLcm: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl -24(%rbp), %edx movl -20(%rbp), %eax movl %edx, %esi movl %eax, %edi call fGetGcd movl %eax, -12(%rbp) movl -20(%rbp), %eax cltd idivl -12(%rbp) movl %eax, -8(%rbp) movl -24(%rbp), %eax cltd idivl -12(%rbp) movl %eax, -4(%rbp) movl -8(%rbp), %eax imull -4(%rbp), %eax imull -12(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size fGetLcm, .-fGetLcm .globl fSetSNum .type fSetSNum, @function fSetSNum: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl %edx, -28(%rbp) movq %rcx, -40(%rbp) movl siMCnt(%rip), %eax cmpl %eax, -24(%rbp) je .L20 movl -24(%rbp), %eax movslq %eax, %rdx movl -20(%rbp), %eax cltq imulq $6000, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq si2SCnt(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -28(%rbp) jg .L21 movl $0, %eax jmp .L22 .L21: movl -24(%rbp), %eax movslq %eax, %rdx movl -20(%rbp), %eax cltq imulq $6000, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rcx leaq si2SCnt(%rip), %rdx movl -28(%rbp), %eax movl %eax, (%rcx,%rdx) .L20: movl siNCnt(%rip), %eax cmpl %eax, -20(%rbp) jge .L23 movl -20(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 4+sz1Num(%rip), %rax movl (%rdx,%rax), %esi movl -24(%rbp), %eax cltd idivl %esi movl %eax, -4(%rbp) movl -4(%rbp), %eax movl %eax, -8(%rbp) jmp .L24 .L25: movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -40(%rbp), %rax addq %rax, %rdx movl -8(%rbp), %eax movl %eax, (%rdx) movl -28(%rbp), %edx movl -8(%rbp), %eax addl %eax, %edx movl -20(%rbp), %eax cltq salq $4, %rax movq %rax, %rcx leaq 4+sz1Num(%rip), %rax movl (%rcx,%rax), %eax imull -8(%rbp), %eax movl %eax, %ecx movl -24(%rbp), %eax subl %ecx, %eax movl %eax, %esi movl -20(%rbp), %eax leal 1(%rax), %edi movq -40(%rbp), %rax movq %rax, %rcx call fSetSNum subl $1, -8(%rbp) .L24: cmpl $0, -8(%rbp) jns .L25 movl $0, %eax jmp .L22 .L23: cmpl $0, -24(%rbp) je .L26 movl $0, %eax jmp .L22 .L26: movq -40(%rbp), %rax movl $56, %edx movq %rax, %rsi leaq si1SNum(%rip), %rax movq %rax, %rdi call memcpy@PLT movl $0, %eax .L22: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size fSetSNum, .-fSetSNum .section .rodata .LC0: .string "%d%d" .LC1: .string "%d" .LC2: .string "%s" .text .globl fMain .type fMain, @function fMain: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $1136, %rsp movl %edi, -1124(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $144, %edx movl $0, %esi leaq sz1Num(%rip), %rax movq %rax, %rdi call memset@PLT movl $336000, %edx movl $0, %esi leaq si2SCnt(%rip), %rax movq %rax, %rdi call memset@PLT movq stdin(%rip), %rax movq %rax, szpFpI(%rip) movl $1, sz1Num(%rip) movl $2, 4+sz1Num(%rip) movl $2, 16+sz1Num(%rip) movl $5, 20+sz1Num(%rip) movl $3, 32+sz1Num(%rip) movl $5, 36+sz1Num(%rip) movl $4, 48+sz1Num(%rip) movl $4, 52+sz1Num(%rip) movl $5, 64+sz1Num(%rip) movl $5, 68+sz1Num(%rip) movl $6, 80+sz1Num(%rip) movl $6, 84+sz1Num(%rip) movl $7, 96+sz1Num(%rip) movl $3, 100+sz1Num(%rip) movl $8, 112+sz1Num(%rip) movl $7, 116+sz1Num(%rip) movl $9, 128+sz1Num(%rip) movl $6, 132+sz1Num(%rip) movq szpFpI(%rip), %rdx leaq -1040(%rbp), %rax movl $1024, %esi movq %rax, %rdi call fgets@PLT leaq -1116(%rbp), %rdx leaq -1040(%rbp), %rax movq %rdx, %rcx leaq siMCnt(%rip), %rdx leaq .LC0(%rip), %rsi movq %rax, %rdi movl $0, %eax call __isoc99_sscanf@PLT movl $0, -1108(%rbp) jmp .L28 .L29: movq szpFpI(%rip), %rax leaq -1112(%rbp), %rdx leaq .LC1(%rip), %rcx movq %rcx, %rsi movq %rax, %rdi movl $0, %eax call __isoc99_fscanf@PLT movl -1112(%rbp), %eax subl $1, %eax cltq salq $4, %rax movq %rax, %rdx leaq 8+sz1Num(%rip), %rax movl $1, (%rdx,%rax) addl $1, -1108(%rbp) .L28: movl -1116(%rbp), %eax cmpl %eax, -1108(%rbp) jl .L29 movq szpFpI(%rip), %rdx leaq -1040(%rbp), %rax movl $1024, %esi movq %rax, %rdi call fgets@PLT leaq fSortFnc(%rip), %rax movq %rax, %rcx movl $16, %edx movl $9, %esi leaq sz1Num(%rip), %rax movq %rax, %rdi call qsort@PLT movl $1, siNCnt(%rip) movl $1, -1108(%rbp) jmp .L30 .L36: movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 8+sz1Num(%rip), %rax movl (%rdx,%rax), %eax testl %eax, %eax je .L47 movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 4+sz1Num(%rip), %rax movl (%rdx,%rax), %edx movl -1108(%rbp), %eax subl $1, %eax cltq salq $4, %rax movq %rax, %rcx leaq 4+sz1Num(%rip), %rax movl (%rcx,%rax), %eax cmpl %eax, %edx je .L48 movl siNCnt(%rip), %eax cmpl %eax, -1108(%rbp) je .L35 movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq sz1Num(%rip), %rax addq %rdx, %rax movl siNCnt(%rip), %edx movslq %edx, %rdx movq %rdx, %rcx salq $4, %rcx leaq sz1Num(%rip), %rdx addq %rdx, %rcx movq 8(%rax), %rdx movq (%rax), %rax movq %rax, (%rcx) movq %rdx, 8(%rcx) .L35: movl siNCnt(%rip), %eax addl $1, %eax movl %eax, siNCnt(%rip) jmp .L34 .L48: nop .L34: addl $1, -1108(%rbp) .L30: cmpl $8, -1108(%rbp) jle .L36 jmp .L32 .L47: nop .L32: movl 4+sz1Num(%rip), %eax movl %eax, -1100(%rbp) movl $1, -1108(%rbp) jmp .L37 .L38: movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 4+sz1Num(%rip), %rax movl (%rdx,%rax), %edx movl -1100(%rbp), %eax movl %edx, %esi movl %eax, %edi call fGetLcm movl %eax, -1100(%rbp) addl $1, -1108(%rbp) .L37: movl siNCnt(%rip), %eax cmpl %eax, -1108(%rbp) jl .L38 movl siMCnt(%rip), %eax subl -1100(%rbp), %eax movl 4+sz1Num(%rip), %edi cltd idivl %edi movl %eax, -1092(%rbp) movl -1092(%rbp), %eax movl %eax, 12+sz1Num(%rip) movl siMCnt(%rip), %edx movl 4+sz1Num(%rip), %eax imull -1092(%rbp), %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, siMCnt(%rip) movl siNCnt(%rip), %eax cltq leaq fSortFncVd(%rip), %rdx movq %rdx, %rcx movl $16, %edx movq %rax, %rsi leaq sz1Num(%rip), %rax movq %rax, %rdi call qsort@PLT leaq -1088(%rbp), %rax movl $36, %edx movl $0, %esi movq %rax, %rdi call memset@PLT movl siMCnt(%rip), %eax leaq -1088(%rbp), %rdx movq %rdx, %rcx movl $0, %edx movl %eax, %esi movl $0, %edi call fSetSNum movl $0, -1108(%rbp) jmp .L39 .L40: movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 12+sz1Num(%rip), %rax movl (%rdx,%rax), %ecx movl -1108(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq si1SNum(%rip), %rax movl (%rdx,%rax), %eax addl %eax, %ecx movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 12+sz1Num(%rip), %rax movl %ecx, (%rdx,%rax) addl $1, -1108(%rbp) .L39: movl siNCnt(%rip), %eax cmpl %eax, -1108(%rbp) jl .L40 movl $0, -1096(%rbp) movl $0, -1108(%rbp) jmp .L41 .L44: movl $0, -1104(%rbp) jmp .L42 .L43: movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq sz1Num(%rip), %rax movl (%rdx,%rax), %eax addl $48, %eax movl %eax, %ecx movl -1096(%rbp), %eax cltq leaq sc1Out(%rip), %rdx movb %cl, (%rax,%rdx) addl $1, -1096(%rbp) addl $1, -1104(%rbp) .L42: movl -1108(%rbp), %eax cltq salq $4, %rax movq %rax, %rdx leaq 12+sz1Num(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -1104(%rbp) jl .L43 addl $1, -1108(%rbp) .L41: cmpl $8, -1108(%rbp) jle .L44 movl -1096(%rbp), %eax cltq leaq sc1Out(%rip), %rdx movb $10, (%rax,%rdx) movl -1096(%rbp), %eax addl $1, %eax cltq leaq sc1Out(%rip), %rdx movb $0, (%rax,%rdx) leaq sc1Out(%rip), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L46 call __stack_chk_fail@PLT .L46: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size fMain, .-fMain .globl main .type main, @function main: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $0, %edi call fMain movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 + 1]){\n\t\t\tcount++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", count - 1);\n\n\treturn 0;\n\n\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-98304(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$1728, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-100016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -100024(%rbp)\n\tmovl\t$0, -100020(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-100020(%rbp), %eax\n\tcltq\n\tmovzbl\t-100016(%rbp,%rax), %edx\n\tmovl\t-100020(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-100016(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L3\n\taddl\t$1, -100024(%rbp)\n.L3:\n\taddl\t$1, -100020(%rbp)\n.L2:\n\tmovl\t-100020(%rbp), %eax\n\tcltq\n\tmovzbl\t-100016(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tmovl\t-100024(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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), %r11\n\t.cfi_def_cfa 11, 98312\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$1720, %rsp\n\t.cfi_def_cfa_offset 100032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 100008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t(%rsp), %esi\n\ttestb\t%sil, %sil\n\tje\t.L7\n\tmovzbl\t1(%rsp), %eax\n\tleaq\t1(%rsp), %rcx\n\txorl\t%edx, %edx\n\tcmpb\t%al, %sil\n\tje\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\taddl\t$1, %edx\n\taddq\t$1, %rcx\n\ttestb\t%al, %al\n\tje\t.L2\n\tmovl\t%eax, %esi\n.L15:\n\tmovzbl\t(%rcx), %eax\n\tcmpb\t%al, %sil\n\tjne\t.L14\n.L3:\n\taddq\t$1, %rcx\n\tmovl\t%eax, %esi\n\tjmp\t.L15\n.L7:\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tsubl\t$1, %edx\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t100008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\txorl\t%eax, %eax\n\taddq\t$100024, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\t.cfi_def_cfa 11, 98312\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$1720, %rsp\n\t.cfi_def_cfa_offset 100032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 100008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t(%rsp), %esi\n\ttestb\t%sil, %sil\n\tje\t.L7\n\tmovzbl\t1(%rsp), %eax\n\tleaq\t1(%rsp), %rcx\n\txorl\t%edx, %edx\n\tcmpb\t%al, %sil\n\tje\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\taddl\t$1, %edx\n\taddq\t$1, %rcx\n\ttestb\t%al, %al\n\tje\t.L2\n\tmovl\t%eax, %esi\n.L15:\n\tmovzbl\t(%rcx), %eax\n\tcmpb\t%al, %sil\n\tjne\t.L14\n.L3:\n\taddq\t$1, %rcx\n\tmovl\t%eax, %esi\n\tjmp\t.L15\n.L7:\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tsubl\t$1, %edx\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t100008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\txorl\t%eax, %eax\n\taddq\t$100024, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 + 1]){\n\t\t\tcount++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", count - 1);\n\n\treturn 0;\n\n\n}", "index": 48, "inputs": [ "BBBWW\n" ], "outputs": [ "1\n" ], "question": "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 + 1]){\n\t\t\tcount++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", count - 1);\n\n\treturn 0;\n\n\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-98304(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$1728, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-100016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -100024(%rbp)\n\tmovl\t$0, -100020(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-100020(%rbp), %eax\n\tcltq\n\tmovzbl\t-100016(%rbp,%rax), %edx\n\tmovl\t-100020(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovzbl\t-100016(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L3\n\taddl\t$1, -100024(%rbp)\n.L3:\n\taddl\t$1, -100020(%rbp)\n.L2:\n\tmovl\t-100020(%rbp), %eax\n\tcltq\n\tmovzbl\t-100016(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tmovl\t-100024(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 - 1); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -98304(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $1728, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -100016(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -100024(%rbp) movl $0, -100020(%rbp) jmp .L2 .L4: movl -100020(%rbp), %eax cltq movzbl -100016(%rbp,%rax), %edx movl -100020(%rbp), %eax addl $1, %eax cltq movzbl -100016(%rbp,%rax), %eax cmpb %al, %dl je .L3 addl $1, -100024(%rbp) .L3: addl $1, -100020(%rbp) .L2: movl -100020(%rbp), %eax cltq movzbl -100016(%rbp,%rax), %eax testb %al, %al jne .L4 movl -100024(%rbp), %eax subl $1, %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L6 call __stack_chk_fail@PLT .L6: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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;\n\t\n\tprintf(\"%lld\\n\", ans);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovabsq\t$3353953467947191203, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t%rax\n\tsarq\t$63, %rcx\n\tmovq\t%rcx, %rdx\n\tsubq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovabsq\t$3353953467947191203, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t%rax\n\tmovq\t%rcx, %rsi\n\tsarq\t$63, %rsi\n\tsubq\t%rsi, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\tcmpq\t$5, %rdx\n\tjg\t.L2\n\taddq\t$1, -16(%rbp)\n\tjmp\t.L3\n.L2:\n\taddq\t$2, -16(%rbp)\n.L3:\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rax\n\txorl\t%r8d, %r8d\n\tmovabsq\t$3353953467947191203, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tleaq\t-1(%rax), %rcx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\tsarq\t%rdx\n\tsubq\t%rax, %rdx\n\tleaq\t(%rdx,%rdx,4), %rax\n\tleaq\t(%rdx,%rax,2), %rax\n\tsubq\t%rax, %rcx\n\tcmpq\t$5, %rcx\n\tsetg\t%r8b\n\txorl\t%eax, %eax\n\tleaq\t1(%r8,%rdx,2), %r8\n\tmovq\t%r8, %rdx\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L7:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rax\n\txorl\t%r8d, %r8d\n\tmovabsq\t$3353953467947191203, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tleaq\t-1(%rax), %rcx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\tsarq\t%rdx\n\tsubq\t%rax, %rdx\n\tleaq\t(%rdx,%rdx,4), %rax\n\tleaq\t(%rdx,%rax,2), %rax\n\tsubq\t%rax, %rcx\n\tcmpq\t$5, %rcx\n\tsetg\t%r8b\n\txorl\t%eax, %eax\n\tleaq\t1(%r8,%rdx,2), %r8\n\tmovq\t%r8, %rdx\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L7:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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;\n\t\n\tprintf(\"%lld\\n\", ans);\n\tfflush(stdout);\n\treturn 0;\n}", "index": 52, "inputs": [ "7\n" ], "outputs": [ "2\n" ], "question": "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;\n\t\n\tprintf(\"%lld\\n\", ans);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovabsq\t$3353953467947191203, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t%rax\n\tsarq\t$63, %rcx\n\tmovq\t%rcx, %rdx\n\tsubq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-1(%rax), %rcx\n\tmovabsq\t$3353953467947191203, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t%rax\n\tmovq\t%rcx, %rsi\n\tsarq\t$63, %rsi\n\tsubq\t%rsi, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\tcmpq\t$5, %rdx\n\tjg\t.L2\n\taddq\t$1, -16(%rbp)\n\tjmp\t.L3\n.L2:\n\taddq\t$2, -16(%rbp)\n.L3:\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lld" .LC1: .string "%lld\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -24(%rbp), %rax leaq -1(%rax), %rcx movabsq $3353953467947191203, %rdx movq %rcx, %rax imulq %rdx movq %rdx, %rax sarq %rax sarq $63, %rcx movq %rcx, %rdx subq %rdx, %rax addq %rax, %rax movq %rax, -16(%rbp) movq -24(%rbp), %rax leaq -1(%rax), %rcx movabsq $3353953467947191203, %rdx movq %rcx, %rax imulq %rdx movq %rdx, %rax sarq %rax movq %rcx, %rsi sarq $63, %rsi subq %rsi, %rax movq %rax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax subq %rax, %rcx movq %rcx, %rdx cmpq $5, %rdx jg .L2 addq $1, -16(%rbp) jmp .L3 .L2: addq $2, -16(%rbp) .L3: movq -16(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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\tlong r = (h[1]+a[1]-1)/a[1];\n\t\th[0] = r*a[0];\n\t\th[1] = r*a[1];\n\t}else{\n\t\tlong r = (h[0]+a[0]-1)/a[0];\n\t\th[0] = r*a[0];\n\t\th[1] = r*a[1];\n\t}\n}\n\nint main(void){\n\tint n, i;\n\tlong h[2]={1,1};\n\tint a[2], b[2]={1,1};\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++){\n\t\tscanf(\"%d%d\", a, a+1);\n\t\tf(h, a, b);\n\t\tb[0]=a[0], b[1]=a[1];\n\t}\n\tprintf(\"%ld\\n\", h[0]+h[1]);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\timull\t%eax, %edx\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\timull\t%ecx, %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L2\n\tmovq\t-24(%rbp), %rax\n\taddq\t$8, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\taddq\t%rdx, %rax\n\tsubq\t$1, %rax\n\tmovq\t-32(%rbp), %rdx\n\taddq\t$4, %rdx\n\tmovl\t(%rdx), %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tmovq\t-24(%rbp), %rdx\n\taddq\t$8, %rdx\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tjmp\t.L3\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovslq\t%eax, %rdi\n\tmovq\t%rcx, %rax\n\tcqto\n\tidivq\t%rdi\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tmovq\t-24(%rbp), %rdx\n\taddq\t$8, %rdx\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n.L3:\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tf, .-f\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d%d\"\n.LC2:\n\t.string\t\"%ld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$1, -32(%rbp)\n\tmovq\t$1, -24(%rbp)\n\tmovl\t$1, -40(%rbp)\n\tmovl\t$1, -36(%rbp)\n\tleaq\t-56(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L5\n.L6:\n\tleaq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tleaq\t-48(%rbp), %rcx\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-48(%rbp), %rcx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tf\n\tmovl\t-48(%rbp), %eax\n\tmovl\t%eax, -40(%rbp)\n\tmovl\t-44(%rbp), %eax\n\tmovl\t%eax, -36(%rbp)\n\taddl\t$1, -52(%rbp)\n.L5:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L6\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tjle\t.L2\n\tmovq\t8(%rcx), %rax\n\taddq\t%rdi, %rax\n\tsubq\t$1, %rax\n\tcqto\n\tidivq\t%rdi\n\timulq\t%rax, %rsi\n\timulq\t%rax, %rdi\n\tmovq\t%rsi, (%rcx)\n\tmovq\t%rdi, 8(%rcx)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t(%rcx), %rax\n\taddq\t%rsi, %rax\n\tsubq\t$1, %rax\n\tcqto\n\tidivq\t%rsi\n\timulq\t%rax, %rsi\n\timulq\t%rax, %rdi\n\tmovq\t%rsi, (%rcx)\n\tmovq\t%rdi, 8(%rcx)\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tf, .-f\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\"\n.LC2:\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.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC0(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t28(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L11\n\tleaq\t36(%rsp), %rax\n\tmovl\t$1, %r14d\n\tmovl\t$1, %ebp\n\tmovl\t$1, %ebx\n\tmovq\t%rax, 8(%rsp)\n\tmovl\t$1, %r12d\n\txorl\t%r13d, %r13d\n\tleaq\t32(%rsp), %r15\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovslq\t%r14d, %rsi\n\tmovslq\t%ebp, %r12\n\taddl\t$1, %r13d\n\tleaq\t-1(%rbx,%rsi), %rax\n\tmovq\t%rsi, %rbx\n\tcqto\n\tidivq\t%rsi\n\timulq\t%rax, %r12\n\timulq\t%rax, %rbx\n\tcmpl\t%r13d, 28(%rsp)\n\tjle\t.L6\n.L9:\n\tmovq\t8(%rsp), %rdx\n\tmovq\t%r15, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t%ebp, %eax\n\tmovl\t%r14d, %edx\n\tmovl\t32(%rsp), %ebp\n\tmovl\t36(%rsp), %r14d\n\timull\t%ebp, %edx\n\timull\t%r14d, %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L14\n\tmovslq\t%ebp, %rsi\n\tmovslq\t%r14d, %rbx\n\taddl\t$1, %r13d\n\tleaq\t-1(%r12,%rsi), %rax\n\tcqto\n\tidivq\t%rsi\n\timulq\t%rax, %rsi\n\timulq\t%rax, %rbx\n\tmovq\t%rsi, %r12\n\tcmpl\t%r13d, 28(%rsp)\n\tjg\t.L9\n.L6:\n\txorl\t%eax, %eax\n\tleaq\t(%r12,%rbx), %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L15\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L11:\n\t.cfi_restore_state\n\tmovl\t$1, %ebx\n\tmovl\t$1, %r12d\n\tjmp\t.L6\n.L15:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.L2\n\tmovq\t8(%rcx), %rax\n\taddq\t%rdi, %rax\n\tsubq\t$1, %rax\n\tcqto\n\tidivq\t%rdi\n\timulq\t%rax, %rsi\n\timulq\t%rax, %rdi\n\tmovq\t%rsi, (%rcx)\n\tmovq\t%rdi, 8(%rcx)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t(%rcx), %rax\n\taddq\t%rsi, %rax\n\tsubq\t$1, %rax\n\tcqto\n\tidivq\t%rsi\n\timulq\t%rax, %rsi\n\timulq\t%rax, %rdi\n\tmovq\t%rsi, (%rcx)\n\tmovq\t%rdi, 8(%rcx)\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tf, .-f\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\"\n.LC2:\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.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC0(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t28(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L11\n\tleaq\t36(%rsp), %rax\n\tmovl\t$1, %r14d\n\tmovl\t$1, %ebp\n\tmovl\t$1, %ebx\n\tmovq\t%rax, 8(%rsp)\n\tmovl\t$1, %r12d\n\txorl\t%r13d, %r13d\n\tleaq\t32(%rsp), %r15\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovslq\t%r14d, %rsi\n\tmovslq\t%ebp, %r12\n\taddl\t$1, %r13d\n\tleaq\t-1(%rbx,%rsi), %rax\n\tmovq\t%rsi, %rbx\n\tcqto\n\tidivq\t%rsi\n\timulq\t%rax, %r12\n\timulq\t%rax, %rbx\n\tcmpl\t%r13d, 28(%rsp)\n\tjle\t.L6\n.L9:\n\tmovq\t8(%rsp), %rdx\n\tmovq\t%r15, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t%ebp, %eax\n\tmovl\t%r14d, %edx\n\tmovl\t32(%rsp), %ebp\n\tmovl\t36(%rsp), %r14d\n\timull\t%ebp, %edx\n\timull\t%r14d, %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L14\n\tmovslq\t%ebp, %rsi\n\tmovslq\t%r14d, %rbx\n\taddl\t$1, %r13d\n\tleaq\t-1(%r12,%rsi), %rax\n\tcqto\n\tidivq\t%rsi\n\timulq\t%rax, %rsi\n\timulq\t%rax, %rbx\n\tmovq\t%rsi, %r12\n\tcmpl\t%r13d, 28(%rsp)\n\tjg\t.L9\n.L6:\n\txorl\t%eax, %eax\n\tleaq\t(%r12,%rbx), %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L15\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L11:\n\t.cfi_restore_state\n\tmovl\t$1, %ebx\n\tmovl\t$1, %r12d\n\tjmp\t.L6\n.L15:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\tlong r = (h[1]+a[1]-1)/a[1];\n\t\th[0] = r*a[0];\n\t\th[1] = r*a[1];\n\t}else{\n\t\tlong r = (h[0]+a[0]-1)/a[0];\n\t\th[0] = r*a[0];\n\t\th[1] = r*a[1];\n\t}\n}\n\nint main(void){\n\tint n, i;\n\tlong h[2]={1,1};\n\tint a[2], b[2]={1,1};\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++){\n\t\tscanf(\"%d%d\", a, a+1);\n\t\tf(h, a, b);\n\t\tb[0]=a[0], b[1]=a[1];\n\t}\n\tprintf(\"%ld\\n\", h[0]+h[1]);\n}\n", "index": 58, "inputs": [ "3\n2 3\n1 1\n3 2\n" ], "outputs": [ "10\n" ], "question": "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\tlong r = (h[1]+a[1]-1)/a[1];\n\t\th[0] = r*a[0];\n\t\th[1] = r*a[1];\n\t}else{\n\t\tlong r = (h[0]+a[0]-1)/a[0];\n\t\th[0] = r*a[0];\n\t\th[1] = r*a[1];\n\t}\n}\n\nint main(void){\n\tint n, i;\n\tlong h[2]={1,1};\n\tint a[2], b[2]={1,1};\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++){\n\t\tscanf(\"%d%d\", a, a+1);\n\t\tf(h, a, b);\n\t\tb[0]=a[0], b[1]=a[1];\n\t}\n\tprintf(\"%ld\\n\", h[0]+h[1]);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\timull\t%eax, %edx\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\timull\t%ecx, %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L2\n\tmovq\t-24(%rbp), %rax\n\taddq\t$8, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\taddq\t%rdx, %rax\n\tsubq\t$1, %rax\n\tmovq\t-32(%rbp), %rdx\n\taddq\t$4, %rdx\n\tmovl\t(%rdx), %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tmovq\t-24(%rbp), %rdx\n\taddq\t$8, %rdx\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tjmp\t.L3\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovslq\t%eax, %rdi\n\tmovq\t%rcx, %rax\n\tcqto\n\tidivq\t%rdi\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-32(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tmovq\t-24(%rbp), %rdx\n\taddq\t$8, %rdx\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n.L3:\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tf, .-f\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d%d\"\n.LC2:\n\t.string\t\"%ld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$1, -32(%rbp)\n\tmovq\t$1, -24(%rbp)\n\tmovl\t$1, -40(%rbp)\n\tmovl\t$1, -36(%rbp)\n\tleaq\t-56(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L5\n.L6:\n\tleaq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tleaq\t-48(%rbp), %rcx\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-48(%rbp), %rcx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tf\n\tmovl\t-48(%rbp), %eax\n\tmovl\t%eax, -40(%rbp)\n\tmovl\t-44(%rbp), %eax\n\tmovl\t%eax, -36(%rbp)\n\taddl\t$1, -52(%rbp)\n.L5:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L6\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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] = r*a[0]; h[1] = r*a[1]; }else{ long r = (h[0]+a[0]-1)/a[0]; h[0] = r*a[0]; h[1] = r*a[1]; } } int main(void){ int n, i; long h[2]={1,1}; int a[2], b[2]={1,1}; scanf("%d", &n); for(i=0; i<n; i++){ scanf("%d%d", a, a+1); f(h, a, b); b[0]=a[0], b[1]=a[1]; } printf("%ld\n", h[0]+h[1]); } Unoptimized Assembly Code: .file "temp.c" .text .globl f .type f, @function f: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq %rdx, -40(%rbp) movq -32(%rbp), %rax movl (%rax), %edx movq -40(%rbp), %rax addq $4, %rax movl (%rax), %eax imull %eax, %edx movq -32(%rbp), %rax addq $4, %rax movl (%rax), %ecx movq -40(%rbp), %rax movl (%rax), %eax imull %ecx, %eax cmpl %eax, %edx jle .L2 movq -24(%rbp), %rax addq $8, %rax movq (%rax), %rdx movq -32(%rbp), %rax addq $4, %rax movl (%rax), %eax cltq addq %rdx, %rax subq $1, %rax movq -32(%rbp), %rdx addq $4, %rdx movl (%rdx), %edx movslq %edx, %rsi cqto idivq %rsi movq %rax, -8(%rbp) movq -32(%rbp), %rax movl (%rax), %eax cltq imulq -8(%rbp), %rax movq %rax, %rdx movq -24(%rbp), %rax movq %rdx, (%rax) movq -32(%rbp), %rax addq $4, %rax movl (%rax), %eax cltq movq -24(%rbp), %rdx addq $8, %rdx imulq -8(%rbp), %rax movq %rax, (%rdx) jmp .L3 .L2: movq -24(%rbp), %rax movq (%rax), %rdx movq -32(%rbp), %rax movl (%rax), %eax cltq addq %rdx, %rax leaq -1(%rax), %rcx movq -32(%rbp), %rax movl (%rax), %eax movslq %eax, %rdi movq %rcx, %rax cqto idivq %rdi movq %rax, -16(%rbp) movq -32(%rbp), %rax movl (%rax), %eax cltq imulq -16(%rbp), %rax movq %rax, %rdx movq -24(%rbp), %rax movq %rdx, (%rax) movq -32(%rbp), %rax addq $4, %rax movl (%rax), %eax cltq movq -24(%rbp), %rdx addq $8, %rdx imulq -16(%rbp), %rax movq %rax, (%rdx) .L3: nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size f, .-f .section .rodata .LC0: .string "%d" .LC1: .string "%d%d" .LC2: .string "%ld\n" .text .globl main .type main, @function main: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $64, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movq $1, -32(%rbp) movq $1, -24(%rbp) movl $1, -40(%rbp) movl $1, -36(%rbp) leaq -56(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -52(%rbp) jmp .L5 .L6: leaq -48(%rbp), %rax addq $4, %rax leaq -48(%rbp), %rcx movq %rax, %rdx movq %rcx, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -40(%rbp), %rdx leaq -48(%rbp), %rcx leaq -32(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call f movl -48(%rbp), %eax movl %eax, -40(%rbp) movl -44(%rbp), %eax movl %eax, -36(%rbp) addl $1, -52(%rbp) .L5: movl -56(%rbp), %eax cmpl %eax, -52(%rbp) jl .L6 movq -32(%rbp), %rdx movq -24(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<stdint.h>\n#include<inttypes.h>\n\ntypedef int32_t i32;\ntypedef int64_t i64;\n\ntypedef struct directed_edge {\n int32_t vertex;\n int32_t next;\n} graph_edge;\n\ntypedef struct directedGraph {\n graph_edge *edge;\n int32_t *start;\n int32_t pointer;\n int32_t vertex_num;\n int32_t edge_max_size;\n} graph;\n\ngraph* new_graph (const int vertex_num) {\n graph *g = (graph *) calloc (1, sizeof (graph));\n g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));\n g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n g->pointer = 0;\n g->vertex_num = vertex_num;\n g->edge_max_size = 1;\n for (int32_t i = 0; i < vertex_num; ++i) {\n g->start[i] = -1;\n }\n return g;\n}\n\nvoid add_edge (graph *g, int32_t from, int32_t to) {\n if (g->pointer == g->edge_max_size) {\n g->edge_max_size *= 2;\n g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);\n }\n g->edge[g->pointer] = (graph_edge) {to, g->start[from]};\n g->start[from] = g->pointer++;\n}\n\nconst i32 mod = 1000000007;\n\ni32 mod_pow (i32 r, i32 n) {\n i32 t = 1;\n i32 s = r;\n while (n > 0) {\n if (n & 1) t = (i64) t * s % mod;\n s = (i64) s * s % mod;\n n >>= 1;\n }\n return t;\n}\n\ntypedef struct dp_node {\n i32 one;\n i32 zero;\n} node;\n\nnode merge (node *a, i32 n) {\n i64 one = 0;\n i64 zero = 1;\n i64 total = 1;\n for (i32 i = 0; i < n; ++i) {\n one = (one * a[i].zero + zero * a[i].one) % mod;\n zero = zero * a[i].zero % mod;\n total = total * (a[i].zero + a[i].one) % mod;\n }\n return (node) {one, (total + mod - one) % mod};\n}\n\ntypedef node deque_val;\n\ntypedef struct Deque {\n deque_val *array;\n size_t front;\n size_t last;\n size_t mask;\n} deque;\n\ndeque* new_deque (void) {\n const size_t len = 2;\n deque *d = (deque *) calloc (len, sizeof (deque));\n d->array = (deque_val *) calloc (len, sizeof (deque_val));\n d->front = d->last = 0;\n d->mask = len - 1;\n return d;\n}\n\nvoid free_deque (deque * const d) {\n free (d->array);\n free (d);\n}\n\nsize_t get_size (const deque *d) {\n return (d->last + (~d->front + 1)) & d->mask;\n}\n\nvoid deque_realloc (deque * const d) {\n deque_val *array = (deque_val *) calloc (2 * (d->mask + 1), sizeof (deque_val));\n size_t k = 0;\n for (size_t i = d->front; i != d->last; i = (i + 1) & d->mask) {\n array[k++] = d->array[i];\n }\n free (d->array);\n d->array = array;\n d->front = 0;\n d->last = k;\n d->mask = 2 * d->mask + 1;\n}\n\ndeque_val get_at (const deque *d, size_t x) {\n return d->array[(d->front + x) & d->mask];\n}\n\nvoid assign_at (const deque *d, size_t x, deque_val v) {\n d->array[(d->front + x) & d->mask] = v;\n}\n\nvoid push_front (deque * const d, const deque_val v) {\n if(((d->last + 1) & d->mask) == d->front) {\n deque_realloc (d);\n }\n d->front = (d->front + d->mask) & d->mask;\n d->array[d->front] = v;\n}\n\nint cmp_deque_size (const void *a, const void *b) {\n deque *p = *(deque **)a;\n deque *q = *(deque **)b;\n i32 d = get_size (p) - get_size (q);\n return d == 0 ? 0 : d > 0 ? -1 : 1;\n}\n\nvoid run (void) {\n i32 n;\n scanf (\"%\" SCNi32, &n);\n i32 *p = (i32 *) calloc (n + 1, sizeof (i32));\n i32 *depth = (i32 *) calloc (n + 1, sizeof (i32));\n i32 *cnt = (i32 *) calloc (n + 1, sizeof (i32));\n cnt[0] = 1;\n graph *g = new_graph (n + 1);\n for (i32 i = 1; i <= n; ++i) {\n scanf (\"%\" SCNi32, p + i);\n add_edge (g, p[i], i);\n depth[i] = depth[p[i]] + 1;\n cnt[depth[i]]++;\n }\n deque **dp = (deque **) calloc (n + 1, sizeof (deque *));\n deque **child = (deque **) calloc (n + 1, sizeof (deque *));\n node *lst = (node *) calloc (n + 1, sizeof (node));\n for (i32 i = n; i >= 0; --i) {\n i32 v = i;\n if (g->start[v] == -1) {\n dp[v] = new_deque();\n push_front (dp[v], (node) {1, 1});\n continue;\n }\n i32 len = 0;\n for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) {\n i32 u = g->edge[p].vertex;\n child[len++] = dp[u];\n }\n if (len > 1) {\n qsort (child, len, sizeof (deque *), cmp_deque_size);\n for (i32 d = 0; d < (i32) get_size (child[1]); ++d) {\n i32 j = 0;\n for (; j < len && d < (i32) get_size (child[j]); ++j) {\n lst[j] = get_at (child[j], d);\n }\n assign_at (child[0], d, merge (lst, j));\n }\n for (i32 j = 1; j < len; ++j) {\n\tfree_deque (child[j]);\n }\n }\n dp[v] = child[0];\n push_front (dp[v], (node) {1, 1});\n }\n i64 ans = 0;\n for (i32 i = 0; i < (i32) get_size (dp[0]); ++i) {\n ans += (i64) mod_pow (2, n + 1 - cnt[i]) * get_at (dp[0], i).one % mod;\n }\n printf (\"%\" PRIi64 \"\\n\", ans % mod);\n}\n\nint main (void) {\n run();\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$8, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-20(%rbp), %edx\n\tmovl\t%edx, 20(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$1, 24(%rax)\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$-1, (%rax)\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L3\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnew_graph, .-new_graph\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tmovl\t%edx, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t16(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L6\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t%edx, 24(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\trealloc@PLT\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n.L6:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t16(%rax), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t%ecx, (%rax)\n\tmovl\t%edx, 4(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t16(%rax), %eax\n\tleal\t1(%rax), %ecx\n\tmovq\t-8(%rbp), %rdx\n\tmovl\t%ecx, 16(%rdx)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t%eax, (%rdx)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tadd_edge, .-add_edge\n\t.globl\tmod\n\t.section\t.rodata\n\t.align 4\n\t.type\tmod, @object\n\t.size\tmod, 4\nmod:\n\t.long\t1000000007\n\t.text\n\t.globl\tmod_pow\n\t.type\tmod_pow, @function\nmod_pow:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-24(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L9\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\timulq\t%rdx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rcx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tmovl\t%eax, -8(%rbp)\n.L9:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\timulq\t%rdx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rcx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tmovl\t%eax, -4(%rbp)\n\tsarl\t-24(%rbp)\n.L8:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L10\n\tmovl\t-8(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmod_pow, .-mod_pow\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovl\t%esi, -44(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovl\t$0, -28(%rbp)\n\tjmp\t.L13\n.L14:\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rsi\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, -24(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, -16(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %edx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rsi\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tcltq\n\timulq\t-8(%rbp), %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, -8(%rbp)\n\taddl\t$1, -28(%rbp)\n.L13:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t-44(%rbp), %eax\n\tjl\t.L14\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%eax, %edi\n\tmovl\t$1000000007, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tsubq\t-24(%rbp), %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, %rax\n\tmovl\t%eax, %edx\n\tmovl\t%edi, %esi\n\tmovabsq\t$-4294967296, %rax\n\tandq\t%rcx, %rax\n\torq\t%rsi, %rax\n\tmovq\t%rax, %rcx\n\tmovl\t%edx, %eax\n\tsalq\t$32, %rax\n\tmovl\t%ecx, %edx\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rcx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tmerge, .-merge\n\t.globl\tnew_deque\n\t.type\tnew_deque, @function\nnew_deque:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t$2, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t$32, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$0, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-16(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 24(%rax)\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tnew_deque, .-new_deque\n\t.globl\tfree_deque\n\t.type\tfree_deque, @function\nfree_deque:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tfree_deque, .-free_deque\n\t.globl\tget_size\n\t.type\tget_size, @function\nget_size:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tsubq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tget_size, .-get_size\n\t.globl\tdeque_realloc\n\t.type\tdeque_realloc, @function\ndeque_realloc:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\taddq\t$1, %rax\n\taddq\t%rax, %rax\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovq\t-40(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$3, %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-24(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-8(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t(%rcx), %rax\n\tmovq\t%rax, (%rdx)\n\tmovq\t-16(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n.L22:\n\tmovq\t-40(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjne\t.L23\n\tmovq\t-40(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-40(%rbp), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, (%rax)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\taddq\t%rax, %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rdx, 24(%rax)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tdeque_realloc, .-deque_realloc\n\t.globl\tget_at\n\t.type\tget_at, @function\nget_at:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rcx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tget_at, .-get_at\n\t.globl\tassign_at\n\t.type\tassign_at, @function\nassign_at:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rcx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tassign_at, .-assign_at\n\t.globl\tpush_front\n\t.type\tpush_front, @function\npush_front:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L28\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeque_realloc\n.L28:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpush_front, .-push_front\n\t.globl\tcmp_deque_size\n\t.type\tcmp_deque_size, @function\ncmp_deque_size:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$48, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -48(%rbp)\n\tmovq\t%rsi, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tmovl\t%eax, %ebx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tmovl\t%eax, %edx\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -28(%rbp)\n\tcmpl\t$0, -28(%rbp)\n\tje\t.L30\n\tcmpl\t$0, -28(%rbp)\n\tjle\t.L31\n\tmovl\t$-1, %eax\n\tjmp\t.L34\n.L31:\n\tmovl\t$1, %eax\n\tjmp\t.L34\n.L30:\n\tmovl\t$0, %eax\n.L34:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tcmp_deque_size, .-cmp_deque_size\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%i\"\n.LC1:\n\t.string\t\"%li\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$136, %rsp\n\t.cfi_offset 13, -24\n\t.cfi_offset 12, -32\n\t.cfi_offset 3, -40\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -40(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-148(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -96(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -88(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -80(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovl\t$1, (%rax)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\tnew_graph\n\tmovq\t%rax, -72(%rbp)\n\tmovl\t$1, -144(%rbp)\n\tjmp\t.L36\n.L37:\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-144(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rcx, %rax\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\taddl\t$1, -144(%rbp)\n.L36:\n\tmovl\t-148(%rbp), %eax\n\tcmpl\t%eax, -144(%rbp)\n\tjle\t.L37\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -56(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -48(%rbp)\n\tmovl\t-148(%rbp), %eax\n\tmovl\t%eax, -140(%rbp)\n\tjmp\t.L38\n.L51:\n\tmovl\t-140(%rbp), %eax\n\tmovl\t%eax, -112(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t$-1, %eax\n\tjne\t.L39\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t(%rdx,%rax), %r13\n\tcall\tnew_deque\n\tmovq\t%rax, 0(%r13)\n\tmovabsq\t$-4294967296, %rax\n\tandq\t%r12, %rax\n\torq\t$1, %rax\n\tmovq\t%rax, %r12\n\tmovl\t%r12d, %edx\n\tmovabsq\t$4294967296, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %r12\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%r12, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush_front\n\tjmp\t.L40\n.L39:\n\tmovl\t$0, -136(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -132(%rbp)\n\tjmp\t.L41\n.L42:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-132(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -108(%rbp)\n\tmovl\t-108(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\t-136(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -136(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t(%rcx), %rax\n\tmovq\t%rax, (%rdx)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-132(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -132(%rbp)\n.L41:\n\tcmpl\t$-1, -132(%rbp)\n\tjne\t.L42\n\tcmpl\t$1, -136(%rbp)\n\tjle\t.L43\n\tmovl\t-136(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovq\t-56(%rbp), %rax\n\tleaq\tcmp_deque_size(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$8, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -128(%rbp)\n\tjmp\t.L44\n.L48:\n\tmovl\t$0, -124(%rbp)\n\tjmp\t.L45\n.L47:\n\tmovl\t-128(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-124(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovl\t-124(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-48(%rbp), %rcx\n\tleaq\t(%rsi,%rcx), %r13\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tget_at\n\tmovq\t%rax, 0(%r13)\n\taddl\t$1, -124(%rbp)\n.L45:\n\tmovl\t-124(%rbp), %eax\n\tcmpl\t-136(%rbp), %eax\n\tjge\t.L46\n\tmovl\t-124(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tcmpl\t%eax, -128(%rbp)\n\tjl\t.L47\n.L46:\n\tmovl\t-124(%rbp), %edx\n\tmovq\t-48(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rax, %rdx\n\tmovl\t-128(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tassign_at\n\taddl\t$1, -128(%rbp)\n.L44:\n\tmovq\t-56(%rbp), %rax\n\taddq\t$8, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tcmpl\t%eax, -128(%rbp)\n\tjl\t.L48\n\tmovl\t$1, -120(%rbp)\n\tjmp\t.L49\n.L50:\n\tmovl\t-120(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree_deque\n\taddl\t$1, -120(%rbp)\n.L49:\n\tmovl\t-120(%rbp), %eax\n\tcmpl\t-136(%rbp), %eax\n\tjl\t.L50\n.L43:\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rdx)\n\tmovabsq\t$-4294967296, %rax\n\tandq\t%rbx, %rax\n\torq\t$1, %rax\n\tmovq\t%rax, %rbx\n\tmovl\t%ebx, %edx\n\tmovabsq\t$4294967296, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rbx\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush_front\n.L40:\n\tsubl\t$1, -140(%rbp)\n.L38:\n\tcmpl\t$0, -140(%rbp)\n\tjns\t.L51\n\tmovq\t$0, -104(%rbp)\n\tmovl\t$0, -116(%rbp)\n\tjmp\t.L52\n.L53:\n\tmovl\t-148(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-116(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %esi\n\tmovl\t$2, %edi\n\tcall\tmod_pow\n\tmovslq\t%eax, %rbx\n\tmovl\t-116(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tget_at\n\tcltq\n\timulq\t%rbx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rcx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, -104(%rbp)\n\taddl\t$1, -116(%rbp)\n.L52:\n\tmovq\t-64(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tcmpl\t%eax, -116(%rbp)\n\tjl\t.L53\n\tmovl\t$1000000007, %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-104(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tnop\n\tmovq\t-40(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L54\n\tcall\t__stack_chk_fail@PLT\n.L54:\n\taddq\t$136, %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\tsubq\t8(%rcx), %rdx\n\tandq\t24(%rcx), %rdx\n\tsubl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L1\n\tsetle\t%al\n\tmovzbl\t%al, %eax\n\tleal\t-1(%rax,%rax), %eax\n.L1:\n\tret\n\t.cfi_endproc\n.LFE50:\n\t.size\tcmp_deque_size, .-cmp_deque_size\n\t.p2align 4\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB39:\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%edi, %rbp\n\tmovl\t$1, %edi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$1, %edi\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbp, %rdi\n\tmovq\t%rax, (%r12)\n\tcall\tcalloc@PLT\n\tmovl\t%ebp, 20(%r12)\n\tmovq\t%rax, 8(%r12)\n\tmovl\t$0, 16(%r12)\n\tmovl\t$1, 24(%r12)\n\ttestl\t%ebp, %ebp\n\tjle\t.L8\n\tmovq\t%rax, %rdi\n\tleaq\t0(,%rbp,4), %rdx\n\tmovl\t$255, %esi\n\tcall\tmemset@PLT\n.L8:\n\tmovq\t%r12, %rax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tnew_graph, .-new_graph\n\t.p2align 4\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\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\tmovslq\t%esi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rdi, %rbx\n\tmovl\t16(%rdi), %ecx\n\tmovq\t(%rdi), %rdi\n\tcmpl\t24(%rbx), %ecx\n\tje\t.L14\n.L12:\n\tmovq\t8(%rbx), %rax\n\tmovd\t%r12d, %xmm0\n\tmovslq\t%ecx, %rsi\n\tleal\t1(%rcx), %edx\n\tleaq\t(%rax,%rbp,4), %rax\n\tmovd\t(%rax), %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rdi,%rsi,8)\n\tmovl\t%edx, 16(%rbx)\n\tmovl\t%ecx, (%rax)\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\t.cfi_restore_state\n\taddl\t%ecx, %ecx\n\tmovl\t%ecx, 24(%rbx)\n\tmovslq\t%ecx, %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tcall\trealloc@PLT\n\tmovl\t16(%rbx), %ecx\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rax, %rdi\n\tjmp\t.L12\n\t.cfi_endproc\n.LFE40:\n\t.size\tadd_edge, .-add_edge\n\t.p2align 4\n\t.globl\tmod_pow\n\t.type\tmod_pow, @function\nmod_pow:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %ecx\n\tmovl\t$1, %r8d\n\ttestl\t%esi, %esi\n\tjle\t.L15\n\tmovabsq\t$-8543223828751151131, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovslq\t%edi, %rdi\n\ttestb\t$1, %cl\n\tje\t.L17\n\tmovslq\t%r8d, %r8\n\timulq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\timulq\t%rsi\n\tmovq\t%r8, %rax\n\tsarq\t$63, %rax\n\taddq\t%r8, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %r8d\n.L17:\n\timulq\t%rdi, %rdi\n\tmovq\t%rdi, %rax\n\timulq\t%rsi\n\tmovq\t%rdi, %rax\n\tsarq\t$63, %rax\n\taddq\t%rdi, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %edi\n\tsarl\t%ecx\n\tjne\t.L18\n.L15:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tmod_pow, .-mod_pow\n\t.p2align 4\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L27\n\tleal\t-1(%rsi), %eax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t$1, %esi\n\tmovl\t$1, %r9d\n\tmovabsq\t$-8543223828751151131, %r11\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\txorl\t%r10d, %r10d\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t8(%rdi,%rax,8), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L26:\n\tmovslq\t4(%rdi), %r12\n\tmovslq\t(%rdi), %rax\n\taddq\t$8, %rdi\n\timulq\t%r12, %r10\n\tmovq\t%rax, %rbp\n\tmovq\t%r12, %rcx\n\timulq\t%r9, %rax\n\taddl\t%ebp, %ecx\n\tmovslq\t%ecx, %rcx\n\tmovq\t%r10, %r8\n\timulq\t%rsi, %rcx\n\taddq\t%rax, %r8\n\tmovq\t%r8, %rax\n\timulq\t%r11\n\tmovq\t%r8, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r8), %r10\n\tsarq\t$29, %r10\n\tsubq\t%rax, %r10\n\timulq\t$1000000007, %r10, %rax\n\tmovq\t%r8, %r10\n\tmovq\t%r12, %r8\n\timulq\t%r9, %r8\n\tsubq\t%rax, %r10\n\tmovq\t%r8, %rax\n\timulq\t%r11\n\tmovq\t%r8, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r8), %r9\n\tsarq\t$29, %r9\n\tsubq\t%rax, %r9\n\timulq\t$1000000007, %r9, %rax\n\tmovq\t%r8, %r9\n\tsubq\t%rax, %r9\n\tmovq\t%rcx, %rax\n\timulq\t%r11\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%rcx), %rsi\n\tsarq\t$29, %rsi\n\tsubq\t%rax, %rsi\n\timulq\t$1000000007, %rsi, %rax\n\tmovq\t%rcx, %rsi\n\tsubq\t%rax, %rsi\n\tcmpq\t%rdi, %rbx\n\tjne\t.L26\n\taddq\t$1000000007, %rsi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tsubq\t%r10, %rsi\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tmovq\t%rsi, %rax\n\timulq\t%r11\n\tleaq\t(%rdx,%rsi), %rax\n\tmovq\t%rsi, %rdx\n\tsarq\t$29, %rax\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\timulq\t$1000000007, %rax, %rax\n\tsubl\t%eax, %esi\n\tmovl\t%r10d, %eax\n\tsalq\t$32, %rsi\n\torq\t%rsi, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\t.cfi_restore 3\n\t.cfi_restore 6\n\t.cfi_restore 12\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %esi\n\tsalq\t$32, %rsi\n\tmovl\t%ecx, %eax\n\torq\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tmerge, .-merge\n\t.p2align 4\n\t.globl\tnew_deque\n\t.type\tnew_deque, @function\nnew_deque:\n.LFB43:\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\tmovl\t$2, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$2, %edi\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovq\t$1, 24(%r12)\n\tmovq\t%rax, (%r12)\n\tmovq\t%r12, %rax\n\tmovups\t%xmm0, 8(%r12)\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\tnew_deque, .-new_deque\n\t.p2align 4\n\t.globl\tfree_deque\n\t.type\tfree_deque, @function\nfree_deque:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rdi, %rbp\n\tmovq\t(%rdi), %rdi\n\tcall\tfree@PLT\n\tmovq\t%rbp, %rdi\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\tfree@PLT\n\t.cfi_endproc\n.LFE44:\n\t.size\tfree_deque, .-free_deque\n\t.p2align 4\n\t.globl\tget_size\n\t.type\tget_size, @function\nget_size:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t16(%rdi), %rax\n\tsubq\t8(%rdi), %rax\n\tandq\t24(%rdi), %rax\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tget_size, .-get_size\n\t.p2align 4\n\t.globl\tdeque_realloc\n\t.type\tdeque_realloc, @function\ndeque_realloc:\n.LFB46:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t$8, %esi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%rdi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\txorl\t%ebx, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t24(%rdi), %r13\n\tleaq\t2(%r13,%r13), %rdi\n\tcall\tcalloc@PLT\n\tmovq\t8(%r12), %rdx\n\tmovq\t(%r12), %rdi\n\tmovq\t%rax, %rbp\n\tmovq\t16(%r12), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L41\n\t.p2align 4,,10\n\t.p2align 3\n.L40:\n\tmovq\t(%rdi,%rdx,8), %rcx\n\taddq\t$1, %rdx\n\taddq\t$1, %rbx\n\tandq\t%r13, %rdx\n\tmovq\t%rcx, -8(%rbp,%rbx,8)\n\tcmpq\t%rax, %rdx\n\tjne\t.L40\n.L41:\n\tcall\tfree@PLT\n\tmovq\t24(%r12), %rax\n\tmovq\t%rbp, (%r12)\n\tmovq\t%rbx, 16(%r12)\n\tmovq\t$0, 8(%r12)\n\tleaq\t1(%rax,%rax), %rax\n\tmovq\t%rax, 24(%r12)\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE46:\n\t.size\tdeque_realloc, .-deque_realloc\n\t.p2align 4\n\t.globl\tget_at\n\t.type\tget_at, @function\nget_at:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rax\n\taddq\t8(%rdi), %rsi\n\tandq\t24(%rdi), %rsi\n\tmovq\t(%rax,%rsi,8), %rax\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tget_at, .-get_at\n\t.p2align 4\n\t.globl\tassign_at\n\t.type\tassign_at, @function\nassign_at:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rax\n\taddq\t8(%rdi), %rsi\n\tandq\t24(%rdi), %rsi\n\tmovq\t%rdx, (%rax,%rsi,8)\n\tret\n\t.cfi_endproc\n.LFE48:\n\t.size\tassign_at, .-assign_at\n\t.p2align 4\n\t.globl\tpush_front\n\t.type\tpush_front, @function\npush_front:\n.LFB49:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovq\t%rsi, %r15\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.cfi_offset 13, -32\n\tmovq\t%rdi, %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t16(%rdi), %rdx\n\tmovq\t24(%rdi), %r14\n\tmovq\t8(%rdi), %rbx\n\tleaq\t1(%rdx), %rax\n\tandq\t%r14, %rax\n\tcmpq\t%rbx, %rax\n\tje\t.L47\n\taddq\t%r14, %rbx\n\tmovq\t(%rdi), %r12\n\tandq\t%r14, %rbx\n.L48:\n\tmovq\t%rbx, 8(%r13)\n\tmovq\t%r15, (%r12,%rbx,8)\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\t.cfi_restore_state\n\tleaq\t2(%r14,%r14), %rdi\n\tmovl\t$8, %esi\n\tmovq\t%rdx, 8(%rsp)\n\txorl\t%ebp, %ebp\n\tcall\tcalloc@PLT\n\tmovq\t8(%rsp), %rdx\n\tmovq\t0(%r13), %rdi\n\tmovq\t%rax, %r12\n\tcmpq\t%rbx, %rdx\n\tje\t.L51\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tmovq\t(%rdi,%rbx,8), %rax\n\taddq\t$1, %rbx\n\taddq\t$1, %rbp\n\tandq\t%r14, %rbx\n\tmovq\t%rax, -8(%r12,%rbp,8)\n\tcmpq\t%rbx, %rdx\n\tjne\t.L50\n.L51:\n\tcall\tfree@PLT\n\tmovq\t24(%r13), %rax\n\tmovq\t%r12, 0(%r13)\n\tmovq\t%rbp, 16(%r13)\n\tleaq\t1(%rax,%rax), %rbx\n\tmovq\t%rbx, 24(%r13)\n\tjmp\t.L48\n\t.cfi_endproc\n.LFE49:\n\t.size\tpush_front, .-push_front\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%i\"\n.LC3:\n\t.string\t\"%li\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB51:\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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$120, %rsp\n\t.cfi_def_cfa_offset 176\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 104(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t100(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t100(%rsp), %r14d\n\tmovl\t$4, %esi\n\tleal\t1(%r14), %r15d\n\tmovslq\t%r15d, %rbp\n\tmovq\t%rbp, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rbx\n\tcall\tcalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rbp, 8(%rsp)\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tmovl\t$1, (%rax)\n\tmovq\t%rax, 72(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$1, %edi\n\tmovq\t%rax, %rbp\n\tmovq\t%rax, 80(%rsp)\n\tcall\tcalloc@PLT\n\tmovq\t8(%rsp), %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, 0(%rbp)\n\tcall\tcalloc@PLT\n\tmovl\t$0, 16(%rbp)\n\tmovq\t%rax, 40(%rsp)\n\tmovq\t%rax, 8(%rbp)\n\tmovl\t%r15d, 20(%rbp)\n\tmovl\t$1, 24(%rbp)\n\ttestl\t%r15d, %r15d\n\tjle\t.L58\n\tmovq\t%rax, %rdi\n\tmovl\t%r14d, %eax\n\tmovl\t$255, %esi\n\tleaq\t4(,%rax,4), %rdx\n\tcall\tmemset@PLT\n.L58:\n\tmovl\t$1, %r15d\n\taddq\t$4, %rbx\n\tmovq\t%r15, %rbp\n\tmovq\t80(%rsp), %r15\n\ttestl\t%r14d, %r14d\n\tjg\t.L61\n\tjmp\t.L114\n\t.p2align 4,,10\n\t.p2align 3\n.L116:\n\tmovq\t(%r15), %rax\n.L60:\n\tmovq\t40(%rsp), %rdi\n\tmovd\t8(%rsp), %xmm0\n\taddq\t$4, %rbx\n\tleaq\t(%rdi,%r9,4), %rsi\n\tmovslq\t%r14d, %rdi\n\tmovd\t(%rsi), %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rax,%rdi,8)\n\tleal\t1(%r14), %eax\n\tmovq\t72(%rsp), %rdi\n\tmovl\t%eax, 16(%r15)\n\tmovslq\t-4(%rbx), %rax\n\tmovl\t%r14d, (%rsi)\n\tmovl\t100(%rsp), %r14d\n\tmovl\t(%r12,%rax,4), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, (%r12,%rbp,4)\n\tcltq\n\taddq\t$1, %rbp\n\taddl\t$1, (%rdi,%rax,4)\n\tcmpl\t%ebp, %r14d\n\tjl\t.L115\n.L61:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tmovl\t%ebp, 8(%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t(%rbx), %r9\n\tmovl\t16(%r15), %r14d\n\tcmpl\t24(%r15), %r14d\n\tjne\t.L116\n\tleal\t(%r14,%r14), %eax\n\tmovq\t(%r15), %rdi\n\tmovl\t%r9d, 16(%rsp)\n\tmovl\t%eax, 24(%r15)\n\tcltq\n\tleaq\t0(,%rax,8), %rsi\n\tcall\trealloc@PLT\n\tmovslq\t16(%rsp), %r9\n\tmovq\t%rax, (%r15)\n\tjmp\t.L60\n.L115:\n\tleal\t1(%r14), %ebp\n\tmovslq\t%ebp, %rax\n\tmovq\t%rax, 8(%rsp)\n\tmovq\t%rax, %rbx\n.L57:\n\tmovl\t$8, %esi\n\tmovq\t%rbx, %rdi\n\tmovabsq\t$-8543223828751151131, %r15\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, 48(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, %rbp\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %r12\n\tmovslq\t%r14d, %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestl\t%r14d, %r14d\n\tjs\t.L85\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovq\t40(%rsp), %rax\n\tmovq\t8(%rsp), %rbx\n\tmovslq\t(%rax,%rbx,4), %rax\n\tcmpl\t$-1, %eax\n\tje\t.L117\n\tmovq\t80(%rsp), %rbx\n\tmovq\t48(%rsp), %r8\n\tmovq\t%rbp, %rdx\n\txorl\t%ecx, %ecx\n\tmovq\t(%rbx), %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tleaq\t(%rdi,%rax,8), %rax\n\tmovl\t%ecx, %r13d\n\tleal\t1(%rcx), %ecx\n\taddq\t$8, %rdx\n\tmovslq\t(%rax), %rsi\n\tmovslq\t4(%rax), %rax\n\tmovq\t(%r8,%rsi,8), %rsi\n\tmovq\t%rsi, -8(%rdx)\n\tcmpl\t$-1, %eax\n\tjne\t.L67\n\tcmpl\t$1, %ecx\n\tjne\t.L68\n.L79:\n\tmovq\t0(%rbp), %r14\n\tmovq\t48(%rsp), %rax\n\tmovq\t8(%rsp), %rbx\n\tmovq\t16(%r14), %rcx\n\tmovq\t24(%r14), %rdx\n\tmovq\t%r14, (%rax,%rbx,8)\n\tmovq\t8(%r14), %rbx\n\tleaq\t1(%rcx), %rax\n\tandq\t%rdx, %rax\n\tcmpq\t%rbx, %rax\n\tje\t.L118\n\taddq\t%rdx, %rbx\n\tmovq\t(%r14), %rax\n\tandq\t%rdx, %rbx\n.L80:\n\tmovq\t.LC2(%rip), %rdi\n\tmovq\t%rbx, 8(%r14)\n\tmovq\t%rdi, (%rax,%rbx,8)\n.L66:\n\tsubq\t$1, 8(%rsp)\n\tmovq\t8(%rsp), %rax\n\ttestl\t%eax, %eax\n\tjns\t.L84\n.L85:\n\tmovq\t48(%rsp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t8(%rdx), %r9\n\tmovq\t16(%rdx), %rax\n\tmovq\t24(%rdx), %r12\n\tsubq\t%r9, %rax\n\tandq\t%r12, %rax\n\ttestl\t%eax, %eax\n\tjle\t.L119\n\tmovl\t100(%rsp), %ebx\n\tmovq\t72(%rsp), %rdi\n\tleaq\t1(%r9), %r10\n\txorl\t%r11d, %r11d\n\tmovabsq\t$-8543223828751151131, %r8\n\tmovq\t(%rdx), %r13\n\tleal\t1(%rbx), %ebp\n\tleal\t-1(%rax), %ebx\n\tmovq\t%r9, %rax\n\tnegq\t%rax\n\taddq\t%r10, %rbx\n\tleaq\t(%rdi,%rax,4), %r14\n\tmovl\t%ebp, %edi\n\tsubl\t(%r14,%r9,4), %edi\n\ttestl\t%edi, %edi\n\tjle\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L120:\n\tmovl\t$2, %ecx\n\tmovl\t$1, %esi\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\tmovslq\t%ecx, %rcx\n\ttestb\t$1, %dil\n\tje\t.L87\n\tmovslq\t%esi, %rsi\n\timulq\t%rcx, %rsi\n\tmovq\t%rsi, %rax\n\timulq\t%r8\n\tmovq\t%rsi, %rax\n\tsarq\t$63, %rax\n\taddq\t%rsi, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %esi\n.L87:\n\timulq\t%rcx, %rcx\n\tmovq\t%rcx, %rax\n\timulq\t%r8\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %ecx\n\tsarl\t%edi\n\tjne\t.L88\n\tmovslq\t%esi, %rsi\n.L86:\n\tandq\t%r12, %r9\n\tmovslq\t0(%r13,%r9,8), %rcx\n\tmovq\t%r10, %r9\n\timulq\t%rsi, %rcx\n\tmovq\t%rcx, %rax\n\timulq\t%r8\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rcx\n\taddq\t%rcx, %r11\n\tcmpq\t%rbx, %r10\n\tje\t.L108\n\tmovl\t%ebp, %edi\n\tsubl\t(%r14,%r9,4), %edi\n\taddq\t$1, %r10\n\ttestl\t%edi, %edi\n\tjg\t.L120\n.L92:\n\tmovl\t$1, %esi\n\tjmp\t.L86\n\t.p2align 4,,10\n\t.p2align 3\n.L117:\n\tmovl\t$32, %esi\n\tmovl\t$2, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$2, %edi\n\tmovq\t%rax, %rbx\n\tcall\tcalloc@PLT\n\tmovq\t48(%rsp), %rdi\n\tmovq\t8(%rsp), %rsi\n\tmovq\t$1, 24(%rbx)\n\tmovdqa\t.LC1(%rip), %xmm2\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rbx, (%rdi,%rsi,8)\n\tmovups\t%xmm2, 8(%rbx)\n\tmovq\t.LC2(%rip), %rbx\n\tmovq\t%rbx, 8(%rax)\n\tjmp\t.L66\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tmovslq\t%ecx, %rbx\n\tmovl\t$8, %edx\n\tmovq\t%rbp, %rdi\n\tleaq\tcmp_deque_size(%rip), %rcx\n\tmovq\t%rbx, %rsi\n\tcall\tqsort@PLT\n\tmovq\t8(%rbp), %rdx\n\tmovq\t16(%rdx), %rax\n\tsubq\t8(%rdx), %rax\n\tandq\t24(%rdx), %rax\n\ttestl\t%eax, %eax\n\tjle\t.L71\n\tmovq\t0(%rbp), %rdx\n\tsubl\t$1, %eax\n\tmovl\t%r13d, 92(%rsp)\n\txorl\t%r14d, %r14d\n\tmovq\t%rax, 64(%rsp)\n\tmovq\t%rbx, %r13\n\tmovq\t(%rdx), %rdi\n\tmovq\t%rdi, 56(%rsp)\n\tmovq\t8(%rdx), %rdi\n\tmovq\t%rdi, 16(%rsp)\n\tmovq\t24(%rdx), %rdi\n\tmovq\t%rdi, 24(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L72:\n\tmovq\t24(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\txorl\t%eax, %eax\n\tjmp\t.L77\n\t.p2align 4,,10\n\t.p2align 3\n.L122:\n\tmovq\t0(%rbp,%rax,8), %rdx\n\tmovq\t8(%rdx), %rsi\n\tmovq\t24(%rdx), %rdx\n.L77:\n\tmovq\t0(%rbp,%rax,8), %rdi\n\tmovl\t%eax, %ebx\n\tmovq\t16(%rdi), %rcx\n\tsubq\t%rsi, %rcx\n\tandq\t%rdx, %rcx\n\tcmpl\t%r14d, %ecx\n\tjle\t.L121\n\taddq\t%r14, %rsi\n\tleal\t1(%rax), %ebx\n\tandq\t%rdx, %rsi\n\tmovq\t(%rdi), %rdx\n\tmovq\t(%rdx,%rsi,8), %rdx\n\tmovq\t%rdx, (%r12,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%r13, %rax\n\tjne\t.L122\n.L73:\n\tmovq\t%rbp, 32(%rsp)\n\txorl\t%r11d, %r11d\n\tmovl\t$1, %edi\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %r8d\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\tmovslq\t4(%r12,%r11,8), %r10\n\tmovslq\t(%r12,%r11,8), %r9\n\taddq\t$1, %r11\n\timulq\t%r10, %rcx\n\tmovq\t%r9, %rbp\n\tmovq\t%r10, %rsi\n\timulq\t%r8, %r9\n\taddl\t%ebp, %esi\n\timulq\t%r8, %r10\n\tmovslq\t%esi, %rsi\n\timulq\t%rdi, %rsi\n\taddq\t%rcx, %r9\n\tmovq\t%r9, %rax\n\timulq\t%r15\n\tmovq\t%r9, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r9), %rcx\n\tsarq\t$29, %rcx\n\tsubq\t%rax, %rcx\n\timulq\t$1000000007, %rcx, %rax\n\tmovq\t%r9, %rcx\n\tsubq\t%rax, %rcx\n\tmovq\t%r10, %rax\n\timulq\t%r15\n\tmovq\t%r10, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r10), %r8\n\tsarq\t$29, %r8\n\tsubq\t%rax, %r8\n\timulq\t$1000000007, %r8, %rax\n\tsubq\t%rax, %r10\n\tmovq\t%rsi, %rax\n\timulq\t%r15\n\tmovq\t%rsi, %rax\n\tmovq\t%r10, %r8\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%rsi), %rdi\n\tsarq\t$29, %rdi\n\tsubq\t%rax, %rdi\n\timulq\t$1000000007, %rdi, %rax\n\tmovq\t%rsi, %rdi\n\tsubq\t%rax, %rdi\n\tcmpl\t%r11d, %ebx\n\tjg\t.L76\n\taddq\t$1000000007, %rdi\n\tmovq\t32(%rsp), %rbp\n\tmovl\t%ecx, %ebx\n\tsubq\t%rcx, %rdi\n\tmovq\t%rdi, %rax\n\timulq\t%r15\n\tleaq\t(%rdx,%rdi), %rax\n\tmovq\t%rdi, %rdx\n\tsarq\t$29, %rax\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\timulq\t$1000000007, %rax, %rax\n\tsubl\t%eax, %edi\n.L75:\n\tmovq\t16(%rsp), %rax\n\tmovq\t56(%rsp), %rsi\n\taddq\t%r14, %rax\n\tandq\t24(%rsp), %rax\n\tleaq\t(%rsi,%rax,8), %rax\n\tmovl\t%ebx, (%rax)\n\tmovl\t%edi, 4(%rax)\n\tleaq\t1(%r14), %rax\n\tcmpq\t64(%rsp), %r14\n\tje\t.L112\n\tmovq\t%rax, %r14\n\tjmp\t.L72\n\t.p2align 4,,10\n\t.p2align 3\n.L121:\n\tmovl\t$1, %edi\n\ttestl\t%eax, %eax\n\tjne\t.L73\n\tjmp\t.L75\n\t.p2align 4,,10\n\t.p2align 3\n.L112:\n\tmovl\t92(%rsp), %r13d\n.L71:\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t8(%rbp,%rbx,8), %r14\n\taddq\t$1, %rbx\n\tmovq\t(%r14), %rdi\n\tcall\tfree@PLT\n\tmovq\t%r14, %rdi\n\tcall\tfree@PLT\n\tcmpl\t%ebx, %r13d\n\tjg\t.L78\n\tjmp\t.L79\n\t.p2align 4,,10\n\t.p2align 3\n.L118:\n\tleaq\t2(%rdx,%rdx), %rdi\n\tmovl\t$8, %esi\n\tmovq\t%rcx, 16(%rsp)\n\txorl\t%r13d, %r13d\n\tmovq\t%rdx, 24(%rsp)\n\tcall\tcalloc@PLT\n\tmovq\t16(%rsp), %rcx\n\tmovq\t(%r14), %rdi\n\tcmpq\t%rbx, %rcx\n\tje\t.L83\n\tmovq\t24(%rsp), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L82:\n\tmovq\t(%rdi,%rbx,8), %rsi\n\taddq\t$1, %rbx\n\taddq\t$1, %r13\n\tandq\t%rdx, %rbx\n\tmovq\t%rsi, -8(%rax,%r13,8)\n\tcmpq\t%rbx, %rcx\n\tjne\t.L82\n.L83:\n\tmovq\t%rax, 16(%rsp)\n\tcall\tfree@PLT\n\tmovq\t24(%r14), %rdx\n\tmovq\t16(%rsp), %rax\n\tmovq\t%r13, 16(%r14)\n\tleaq\t1(%rdx,%rdx), %rbx\n\tmovq\t%rax, (%r14)\n\tmovq\t%rbx, 24(%r14)\n\tjmp\t.L80\n.L108:\n\tmovq\t%r11, %rax\n\timulq\t%r8\n\tmovq\t%r11, %rax\n\tsarq\t$63, %rax\n\taddq\t%r11, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tmovq\t%r11, %rdx\n\tsubq\t%rax, %rdx\n.L64:\n\txorl\t%eax, %eax\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L123\n\taddq\t$120, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L114:\n\t.cfi_restore_state\n\tmovq\t8(%rsp), %rbx\n\tjmp\t.L57\n.L119:\n\txorl\t%edx, %edx\n\tjmp\t.L64\n.L123:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tmain, .-main\n\t.globl\tmod\n\t.section\t.rodata\n\t.align 4\n\t.type\tmod, @object\n\t.size\tmod, 4\nmod:\n\t.long\t1000000007\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.quad\t1\n\t.quad\t0\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC2:\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tsubq\t8(%rcx), %rdx\n\tandq\t24(%rcx), %rdx\n\tsubl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tje\t.L1\n\tsetle\t%al\n\tmovzbl\t%al, %eax\n\tleal\t-1(%rax,%rax), %eax\n.L1:\n\tret\n\t.cfi_endproc\n.LFE50:\n\t.size\tcmp_deque_size, .-cmp_deque_size\n\t.p2align 4\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB39:\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%edi, %rbp\n\tmovl\t$1, %edi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$1, %edi\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbp, %rdi\n\tmovq\t%rax, (%r12)\n\tcall\tcalloc@PLT\n\tmovl\t%ebp, 20(%r12)\n\tmovq\t%rax, 8(%r12)\n\tmovl\t$0, 16(%r12)\n\tmovl\t$1, 24(%r12)\n\ttestl\t%ebp, %ebp\n\tjle\t.L8\n\tmovq\t%rax, %rdi\n\tleaq\t0(,%rbp,4), %rdx\n\tmovl\t$255, %esi\n\tcall\tmemset@PLT\n.L8:\n\tmovq\t%r12, %rax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tnew_graph, .-new_graph\n\t.p2align 4\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\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\tmovslq\t%esi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rdi, %rbx\n\tmovl\t16(%rdi), %ecx\n\tmovq\t(%rdi), %rdi\n\tcmpl\t24(%rbx), %ecx\n\tje\t.L14\n.L12:\n\tmovq\t8(%rbx), %rax\n\tmovd\t%r12d, %xmm0\n\tmovslq\t%ecx, %rsi\n\tleal\t1(%rcx), %edx\n\tleaq\t(%rax,%rbp,4), %rax\n\tmovd\t(%rax), %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rdi,%rsi,8)\n\tmovl\t%edx, 16(%rbx)\n\tmovl\t%ecx, (%rax)\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\t.cfi_restore_state\n\taddl\t%ecx, %ecx\n\tmovl\t%ecx, 24(%rbx)\n\tmovslq\t%ecx, %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tcall\trealloc@PLT\n\tmovl\t16(%rbx), %ecx\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rax, %rdi\n\tjmp\t.L12\n\t.cfi_endproc\n.LFE40:\n\t.size\tadd_edge, .-add_edge\n\t.p2align 4\n\t.globl\tmod_pow\n\t.type\tmod_pow, @function\nmod_pow:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %ecx\n\tmovl\t$1, %r8d\n\ttestl\t%esi, %esi\n\tjle\t.L15\n\tmovabsq\t$-8543223828751151131, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovslq\t%edi, %rdi\n\ttestb\t$1, %cl\n\tje\t.L17\n\tmovslq\t%r8d, %r8\n\timulq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\timulq\t%rsi\n\tmovq\t%r8, %rax\n\tsarq\t$63, %rax\n\taddq\t%r8, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %r8d\n.L17:\n\timulq\t%rdi, %rdi\n\tmovq\t%rdi, %rax\n\timulq\t%rsi\n\tmovq\t%rdi, %rax\n\tsarq\t$63, %rax\n\taddq\t%rdi, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %edi\n\tsarl\t%ecx\n\tjne\t.L18\n.L15:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tmod_pow, .-mod_pow\n\t.p2align 4\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L27\n\tleal\t-1(%rsi), %eax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t$1, %esi\n\tmovl\t$1, %r9d\n\tmovabsq\t$-8543223828751151131, %r11\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\txorl\t%r10d, %r10d\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t8(%rdi,%rax,8), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L26:\n\tmovslq\t4(%rdi), %r12\n\tmovslq\t(%rdi), %rax\n\taddq\t$8, %rdi\n\timulq\t%r12, %r10\n\tmovq\t%rax, %rbp\n\tmovq\t%r12, %rcx\n\timulq\t%r9, %rax\n\taddl\t%ebp, %ecx\n\tmovslq\t%ecx, %rcx\n\tmovq\t%r10, %r8\n\timulq\t%rsi, %rcx\n\taddq\t%rax, %r8\n\tmovq\t%r8, %rax\n\timulq\t%r11\n\tmovq\t%r8, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r8), %r10\n\tsarq\t$29, %r10\n\tsubq\t%rax, %r10\n\timulq\t$1000000007, %r10, %rax\n\tmovq\t%r8, %r10\n\tmovq\t%r12, %r8\n\timulq\t%r9, %r8\n\tsubq\t%rax, %r10\n\tmovq\t%r8, %rax\n\timulq\t%r11\n\tmovq\t%r8, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r8), %r9\n\tsarq\t$29, %r9\n\tsubq\t%rax, %r9\n\timulq\t$1000000007, %r9, %rax\n\tmovq\t%r8, %r9\n\tsubq\t%rax, %r9\n\tmovq\t%rcx, %rax\n\timulq\t%r11\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%rcx), %rsi\n\tsarq\t$29, %rsi\n\tsubq\t%rax, %rsi\n\timulq\t$1000000007, %rsi, %rax\n\tmovq\t%rcx, %rsi\n\tsubq\t%rax, %rsi\n\tcmpq\t%rdi, %rbx\n\tjne\t.L26\n\taddq\t$1000000007, %rsi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tsubq\t%r10, %rsi\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tmovq\t%rsi, %rax\n\timulq\t%r11\n\tleaq\t(%rdx,%rsi), %rax\n\tmovq\t%rsi, %rdx\n\tsarq\t$29, %rax\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\timulq\t$1000000007, %rax, %rax\n\tsubl\t%eax, %esi\n\tmovl\t%r10d, %eax\n\tsalq\t$32, %rsi\n\torq\t%rsi, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\t.cfi_restore 3\n\t.cfi_restore 6\n\t.cfi_restore 12\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %esi\n\tsalq\t$32, %rsi\n\tmovl\t%ecx, %eax\n\torq\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tmerge, .-merge\n\t.p2align 4\n\t.globl\tnew_deque\n\t.type\tnew_deque, @function\nnew_deque:\n.LFB43:\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\tmovl\t$2, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$2, %edi\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovq\t$1, 24(%r12)\n\tmovq\t%rax, (%r12)\n\tmovq\t%r12, %rax\n\tmovups\t%xmm0, 8(%r12)\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\tnew_deque, .-new_deque\n\t.p2align 4\n\t.globl\tfree_deque\n\t.type\tfree_deque, @function\nfree_deque:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rdi, %rbp\n\tmovq\t(%rdi), %rdi\n\tcall\tfree@PLT\n\tmovq\t%rbp, %rdi\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\tfree@PLT\n\t.cfi_endproc\n.LFE44:\n\t.size\tfree_deque, .-free_deque\n\t.p2align 4\n\t.globl\tget_size\n\t.type\tget_size, @function\nget_size:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t16(%rdi), %rax\n\tsubq\t8(%rdi), %rax\n\tandq\t24(%rdi), %rax\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tget_size, .-get_size\n\t.p2align 4\n\t.globl\tdeque_realloc\n\t.type\tdeque_realloc, @function\ndeque_realloc:\n.LFB46:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t$8, %esi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%rdi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\txorl\t%ebx, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t24(%rdi), %r13\n\tleaq\t2(%r13,%r13), %rdi\n\tcall\tcalloc@PLT\n\tmovq\t8(%r12), %rdx\n\tmovq\t(%r12), %rdi\n\tmovq\t%rax, %rbp\n\tmovq\t16(%r12), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L41\n\t.p2align 4,,10\n\t.p2align 3\n.L40:\n\tmovq\t(%rdi,%rdx,8), %rcx\n\taddq\t$1, %rdx\n\taddq\t$1, %rbx\n\tandq\t%r13, %rdx\n\tmovq\t%rcx, -8(%rbp,%rbx,8)\n\tcmpq\t%rax, %rdx\n\tjne\t.L40\n.L41:\n\tcall\tfree@PLT\n\tmovq\t24(%r12), %rax\n\tmovq\t%rbp, (%r12)\n\tmovq\t%rbx, 16(%r12)\n\tmovq\t$0, 8(%r12)\n\tleaq\t1(%rax,%rax), %rax\n\tmovq\t%rax, 24(%r12)\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE46:\n\t.size\tdeque_realloc, .-deque_realloc\n\t.p2align 4\n\t.globl\tget_at\n\t.type\tget_at, @function\nget_at:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rax\n\taddq\t8(%rdi), %rsi\n\tandq\t24(%rdi), %rsi\n\tmovq\t(%rax,%rsi,8), %rax\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tget_at, .-get_at\n\t.p2align 4\n\t.globl\tassign_at\n\t.type\tassign_at, @function\nassign_at:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rdi), %rax\n\taddq\t8(%rdi), %rsi\n\tandq\t24(%rdi), %rsi\n\tmovq\t%rdx, (%rax,%rsi,8)\n\tret\n\t.cfi_endproc\n.LFE48:\n\t.size\tassign_at, .-assign_at\n\t.p2align 4\n\t.globl\tpush_front\n\t.type\tpush_front, @function\npush_front:\n.LFB49:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovq\t%rsi, %r15\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.cfi_offset 13, -32\n\tmovq\t%rdi, %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t16(%rdi), %rdx\n\tmovq\t24(%rdi), %r14\n\tmovq\t8(%rdi), %rbx\n\tleaq\t1(%rdx), %rax\n\tandq\t%r14, %rax\n\tcmpq\t%rbx, %rax\n\tje\t.L47\n\taddq\t%r14, %rbx\n\tmovq\t(%rdi), %r12\n\tandq\t%r14, %rbx\n.L48:\n\tmovq\t%rbx, 8(%r13)\n\tmovq\t%r15, (%r12,%rbx,8)\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\t.cfi_restore_state\n\tleaq\t2(%r14,%r14), %rdi\n\tmovl\t$8, %esi\n\tmovq\t%rdx, 8(%rsp)\n\txorl\t%ebp, %ebp\n\tcall\tcalloc@PLT\n\tmovq\t8(%rsp), %rdx\n\tmovq\t0(%r13), %rdi\n\tmovq\t%rax, %r12\n\tcmpq\t%rbx, %rdx\n\tje\t.L51\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tmovq\t(%rdi,%rbx,8), %rax\n\taddq\t$1, %rbx\n\taddq\t$1, %rbp\n\tandq\t%r14, %rbx\n\tmovq\t%rax, -8(%r12,%rbp,8)\n\tcmpq\t%rbx, %rdx\n\tjne\t.L50\n.L51:\n\tcall\tfree@PLT\n\tmovq\t24(%r13), %rax\n\tmovq\t%r12, 0(%r13)\n\tmovq\t%rbp, 16(%r13)\n\tleaq\t1(%rax,%rax), %rbx\n\tmovq\t%rbx, 24(%r13)\n\tjmp\t.L48\n\t.cfi_endproc\n.LFE49:\n\t.size\tpush_front, .-push_front\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%i\"\n.LC3:\n\t.string\t\"%li\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB51:\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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$120, %rsp\n\t.cfi_def_cfa_offset 176\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 104(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t100(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t100(%rsp), %r14d\n\tmovl\t$4, %esi\n\tleal\t1(%r14), %r15d\n\tmovslq\t%r15d, %rbp\n\tmovq\t%rbp, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rbx\n\tcall\tcalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rbp, 8(%rsp)\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tmovl\t$1, (%rax)\n\tmovq\t%rax, 72(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$1, %edi\n\tmovq\t%rax, %rbp\n\tmovq\t%rax, 80(%rsp)\n\tcall\tcalloc@PLT\n\tmovq\t8(%rsp), %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, 0(%rbp)\n\tcall\tcalloc@PLT\n\tmovl\t$0, 16(%rbp)\n\tmovq\t%rax, 40(%rsp)\n\tmovq\t%rax, 8(%rbp)\n\tmovl\t%r15d, 20(%rbp)\n\tmovl\t$1, 24(%rbp)\n\ttestl\t%r15d, %r15d\n\tjle\t.L58\n\tmovq\t%rax, %rdi\n\tmovl\t%r14d, %eax\n\tmovl\t$255, %esi\n\tleaq\t4(,%rax,4), %rdx\n\tcall\tmemset@PLT\n.L58:\n\tmovl\t$1, %r15d\n\taddq\t$4, %rbx\n\tmovq\t%r15, %rbp\n\tmovq\t80(%rsp), %r15\n\ttestl\t%r14d, %r14d\n\tjg\t.L61\n\tjmp\t.L114\n\t.p2align 4,,10\n\t.p2align 3\n.L116:\n\tmovq\t(%r15), %rax\n.L60:\n\tmovq\t40(%rsp), %rdi\n\tmovd\t8(%rsp), %xmm0\n\taddq\t$4, %rbx\n\tleaq\t(%rdi,%r9,4), %rsi\n\tmovslq\t%r14d, %rdi\n\tmovd\t(%rsi), %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rax,%rdi,8)\n\tleal\t1(%r14), %eax\n\tmovq\t72(%rsp), %rdi\n\tmovl\t%eax, 16(%r15)\n\tmovslq\t-4(%rbx), %rax\n\tmovl\t%r14d, (%rsi)\n\tmovl\t100(%rsp), %r14d\n\tmovl\t(%r12,%rax,4), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, (%r12,%rbp,4)\n\tcltq\n\taddq\t$1, %rbp\n\taddl\t$1, (%rdi,%rax,4)\n\tcmpl\t%ebp, %r14d\n\tjl\t.L115\n.L61:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tmovl\t%ebp, 8(%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t(%rbx), %r9\n\tmovl\t16(%r15), %r14d\n\tcmpl\t24(%r15), %r14d\n\tjne\t.L116\n\tleal\t(%r14,%r14), %eax\n\tmovq\t(%r15), %rdi\n\tmovl\t%r9d, 16(%rsp)\n\tmovl\t%eax, 24(%r15)\n\tcltq\n\tleaq\t0(,%rax,8), %rsi\n\tcall\trealloc@PLT\n\tmovslq\t16(%rsp), %r9\n\tmovq\t%rax, (%r15)\n\tjmp\t.L60\n.L115:\n\tleal\t1(%r14), %ebp\n\tmovslq\t%ebp, %rax\n\tmovq\t%rax, 8(%rsp)\n\tmovq\t%rax, %rbx\n.L57:\n\tmovl\t$8, %esi\n\tmovq\t%rbx, %rdi\n\tmovabsq\t$-8543223828751151131, %r15\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, 48(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, %rbp\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %r12\n\tmovslq\t%r14d, %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestl\t%r14d, %r14d\n\tjs\t.L85\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovq\t40(%rsp), %rax\n\tmovq\t8(%rsp), %rbx\n\tmovslq\t(%rax,%rbx,4), %rax\n\tcmpl\t$-1, %eax\n\tje\t.L117\n\tmovq\t80(%rsp), %rbx\n\tmovq\t48(%rsp), %r8\n\tmovq\t%rbp, %rdx\n\txorl\t%ecx, %ecx\n\tmovq\t(%rbx), %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tleaq\t(%rdi,%rax,8), %rax\n\tmovl\t%ecx, %r13d\n\tleal\t1(%rcx), %ecx\n\taddq\t$8, %rdx\n\tmovslq\t(%rax), %rsi\n\tmovslq\t4(%rax), %rax\n\tmovq\t(%r8,%rsi,8), %rsi\n\tmovq\t%rsi, -8(%rdx)\n\tcmpl\t$-1, %eax\n\tjne\t.L67\n\tcmpl\t$1, %ecx\n\tjne\t.L68\n.L79:\n\tmovq\t0(%rbp), %r14\n\tmovq\t48(%rsp), %rax\n\tmovq\t8(%rsp), %rbx\n\tmovq\t16(%r14), %rcx\n\tmovq\t24(%r14), %rdx\n\tmovq\t%r14, (%rax,%rbx,8)\n\tmovq\t8(%r14), %rbx\n\tleaq\t1(%rcx), %rax\n\tandq\t%rdx, %rax\n\tcmpq\t%rbx, %rax\n\tje\t.L118\n\taddq\t%rdx, %rbx\n\tmovq\t(%r14), %rax\n\tandq\t%rdx, %rbx\n.L80:\n\tmovq\t.LC2(%rip), %rdi\n\tmovq\t%rbx, 8(%r14)\n\tmovq\t%rdi, (%rax,%rbx,8)\n.L66:\n\tsubq\t$1, 8(%rsp)\n\tmovq\t8(%rsp), %rax\n\ttestl\t%eax, %eax\n\tjns\t.L84\n.L85:\n\tmovq\t48(%rsp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t8(%rdx), %r9\n\tmovq\t16(%rdx), %rax\n\tmovq\t24(%rdx), %r12\n\tsubq\t%r9, %rax\n\tandq\t%r12, %rax\n\ttestl\t%eax, %eax\n\tjle\t.L119\n\tmovl\t100(%rsp), %ebx\n\tmovq\t72(%rsp), %rdi\n\tleaq\t1(%r9), %r10\n\txorl\t%r11d, %r11d\n\tmovabsq\t$-8543223828751151131, %r8\n\tmovq\t(%rdx), %r13\n\tleal\t1(%rbx), %ebp\n\tleal\t-1(%rax), %ebx\n\tmovq\t%r9, %rax\n\tnegq\t%rax\n\taddq\t%r10, %rbx\n\tleaq\t(%rdi,%rax,4), %r14\n\tmovl\t%ebp, %edi\n\tsubl\t(%r14,%r9,4), %edi\n\ttestl\t%edi, %edi\n\tjle\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L120:\n\tmovl\t$2, %ecx\n\tmovl\t$1, %esi\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\tmovslq\t%ecx, %rcx\n\ttestb\t$1, %dil\n\tje\t.L87\n\tmovslq\t%esi, %rsi\n\timulq\t%rcx, %rsi\n\tmovq\t%rsi, %rax\n\timulq\t%r8\n\tmovq\t%rsi, %rax\n\tsarq\t$63, %rax\n\taddq\t%rsi, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %esi\n.L87:\n\timulq\t%rcx, %rcx\n\tmovq\t%rcx, %rax\n\timulq\t%r8\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubl\t%edx, %ecx\n\tsarl\t%edi\n\tjne\t.L88\n\tmovslq\t%esi, %rsi\n.L86:\n\tandq\t%r12, %r9\n\tmovslq\t0(%r13,%r9,8), %rcx\n\tmovq\t%r10, %r9\n\timulq\t%rsi, %rcx\n\tmovq\t%rcx, %rax\n\timulq\t%r8\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rcx\n\taddq\t%rcx, %r11\n\tcmpq\t%rbx, %r10\n\tje\t.L108\n\tmovl\t%ebp, %edi\n\tsubl\t(%r14,%r9,4), %edi\n\taddq\t$1, %r10\n\ttestl\t%edi, %edi\n\tjg\t.L120\n.L92:\n\tmovl\t$1, %esi\n\tjmp\t.L86\n\t.p2align 4,,10\n\t.p2align 3\n.L117:\n\tmovl\t$32, %esi\n\tmovl\t$2, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$8, %esi\n\tmovl\t$2, %edi\n\tmovq\t%rax, %rbx\n\tcall\tcalloc@PLT\n\tmovq\t48(%rsp), %rdi\n\tmovq\t8(%rsp), %rsi\n\tmovq\t$1, 24(%rbx)\n\tmovdqa\t.LC1(%rip), %xmm2\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rbx, (%rdi,%rsi,8)\n\tmovups\t%xmm2, 8(%rbx)\n\tmovq\t.LC2(%rip), %rbx\n\tmovq\t%rbx, 8(%rax)\n\tjmp\t.L66\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tmovslq\t%ecx, %rbx\n\tmovl\t$8, %edx\n\tmovq\t%rbp, %rdi\n\tleaq\tcmp_deque_size(%rip), %rcx\n\tmovq\t%rbx, %rsi\n\tcall\tqsort@PLT\n\tmovq\t8(%rbp), %rdx\n\tmovq\t16(%rdx), %rax\n\tsubq\t8(%rdx), %rax\n\tandq\t24(%rdx), %rax\n\ttestl\t%eax, %eax\n\tjle\t.L71\n\tmovq\t0(%rbp), %rdx\n\tsubl\t$1, %eax\n\tmovl\t%r13d, 92(%rsp)\n\txorl\t%r14d, %r14d\n\tmovq\t%rax, 64(%rsp)\n\tmovq\t%rbx, %r13\n\tmovq\t(%rdx), %rdi\n\tmovq\t%rdi, 56(%rsp)\n\tmovq\t8(%rdx), %rdi\n\tmovq\t%rdi, 16(%rsp)\n\tmovq\t24(%rdx), %rdi\n\tmovq\t%rdi, 24(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L72:\n\tmovq\t24(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\txorl\t%eax, %eax\n\tjmp\t.L77\n\t.p2align 4,,10\n\t.p2align 3\n.L122:\n\tmovq\t0(%rbp,%rax,8), %rdx\n\tmovq\t8(%rdx), %rsi\n\tmovq\t24(%rdx), %rdx\n.L77:\n\tmovq\t0(%rbp,%rax,8), %rdi\n\tmovl\t%eax, %ebx\n\tmovq\t16(%rdi), %rcx\n\tsubq\t%rsi, %rcx\n\tandq\t%rdx, %rcx\n\tcmpl\t%r14d, %ecx\n\tjle\t.L121\n\taddq\t%r14, %rsi\n\tleal\t1(%rax), %ebx\n\tandq\t%rdx, %rsi\n\tmovq\t(%rdi), %rdx\n\tmovq\t(%rdx,%rsi,8), %rdx\n\tmovq\t%rdx, (%r12,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%r13, %rax\n\tjne\t.L122\n.L73:\n\tmovq\t%rbp, 32(%rsp)\n\txorl\t%r11d, %r11d\n\tmovl\t$1, %edi\n\txorl\t%ecx, %ecx\n\tmovl\t$1, %r8d\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\tmovslq\t4(%r12,%r11,8), %r10\n\tmovslq\t(%r12,%r11,8), %r9\n\taddq\t$1, %r11\n\timulq\t%r10, %rcx\n\tmovq\t%r9, %rbp\n\tmovq\t%r10, %rsi\n\timulq\t%r8, %r9\n\taddl\t%ebp, %esi\n\timulq\t%r8, %r10\n\tmovslq\t%esi, %rsi\n\timulq\t%rdi, %rsi\n\taddq\t%rcx, %r9\n\tmovq\t%r9, %rax\n\timulq\t%r15\n\tmovq\t%r9, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r9), %rcx\n\tsarq\t$29, %rcx\n\tsubq\t%rax, %rcx\n\timulq\t$1000000007, %rcx, %rax\n\tmovq\t%r9, %rcx\n\tsubq\t%rax, %rcx\n\tmovq\t%r10, %rax\n\timulq\t%r15\n\tmovq\t%r10, %rax\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%r10), %r8\n\tsarq\t$29, %r8\n\tsubq\t%rax, %r8\n\timulq\t$1000000007, %r8, %rax\n\tsubq\t%rax, %r10\n\tmovq\t%rsi, %rax\n\timulq\t%r15\n\tmovq\t%rsi, %rax\n\tmovq\t%r10, %r8\n\tsarq\t$63, %rax\n\tleaq\t(%rdx,%rsi), %rdi\n\tsarq\t$29, %rdi\n\tsubq\t%rax, %rdi\n\timulq\t$1000000007, %rdi, %rax\n\tmovq\t%rsi, %rdi\n\tsubq\t%rax, %rdi\n\tcmpl\t%r11d, %ebx\n\tjg\t.L76\n\taddq\t$1000000007, %rdi\n\tmovq\t32(%rsp), %rbp\n\tmovl\t%ecx, %ebx\n\tsubq\t%rcx, %rdi\n\tmovq\t%rdi, %rax\n\timulq\t%r15\n\tleaq\t(%rdx,%rdi), %rax\n\tmovq\t%rdi, %rdx\n\tsarq\t$29, %rax\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\timulq\t$1000000007, %rax, %rax\n\tsubl\t%eax, %edi\n.L75:\n\tmovq\t16(%rsp), %rax\n\tmovq\t56(%rsp), %rsi\n\taddq\t%r14, %rax\n\tandq\t24(%rsp), %rax\n\tleaq\t(%rsi,%rax,8), %rax\n\tmovl\t%ebx, (%rax)\n\tmovl\t%edi, 4(%rax)\n\tleaq\t1(%r14), %rax\n\tcmpq\t64(%rsp), %r14\n\tje\t.L112\n\tmovq\t%rax, %r14\n\tjmp\t.L72\n\t.p2align 4,,10\n\t.p2align 3\n.L121:\n\tmovl\t$1, %edi\n\ttestl\t%eax, %eax\n\tjne\t.L73\n\tjmp\t.L75\n\t.p2align 4,,10\n\t.p2align 3\n.L112:\n\tmovl\t92(%rsp), %r13d\n.L71:\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t8(%rbp,%rbx,8), %r14\n\taddq\t$1, %rbx\n\tmovq\t(%r14), %rdi\n\tcall\tfree@PLT\n\tmovq\t%r14, %rdi\n\tcall\tfree@PLT\n\tcmpl\t%ebx, %r13d\n\tjg\t.L78\n\tjmp\t.L79\n\t.p2align 4,,10\n\t.p2align 3\n.L118:\n\tleaq\t2(%rdx,%rdx), %rdi\n\tmovl\t$8, %esi\n\tmovq\t%rcx, 16(%rsp)\n\txorl\t%r13d, %r13d\n\tmovq\t%rdx, 24(%rsp)\n\tcall\tcalloc@PLT\n\tmovq\t16(%rsp), %rcx\n\tmovq\t(%r14), %rdi\n\tcmpq\t%rbx, %rcx\n\tje\t.L83\n\tmovq\t24(%rsp), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L82:\n\tmovq\t(%rdi,%rbx,8), %rsi\n\taddq\t$1, %rbx\n\taddq\t$1, %r13\n\tandq\t%rdx, %rbx\n\tmovq\t%rsi, -8(%rax,%r13,8)\n\tcmpq\t%rbx, %rcx\n\tjne\t.L82\n.L83:\n\tmovq\t%rax, 16(%rsp)\n\tcall\tfree@PLT\n\tmovq\t24(%r14), %rdx\n\tmovq\t16(%rsp), %rax\n\tmovq\t%r13, 16(%r14)\n\tleaq\t1(%rdx,%rdx), %rbx\n\tmovq\t%rax, (%r14)\n\tmovq\t%rbx, 24(%r14)\n\tjmp\t.L80\n.L108:\n\tmovq\t%r11, %rax\n\timulq\t%r8\n\tmovq\t%r11, %rax\n\tsarq\t$63, %rax\n\taddq\t%r11, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tmovq\t%r11, %rdx\n\tsubq\t%rax, %rdx\n.L64:\n\txorl\t%eax, %eax\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L123\n\taddq\t$120, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L114:\n\t.cfi_restore_state\n\tmovq\t8(%rsp), %rbx\n\tjmp\t.L57\n.L119:\n\txorl\t%edx, %edx\n\tjmp\t.L64\n.L123:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tmain, .-main\n\t.globl\tmod\n\t.section\t.rodata\n\t.align 4\n\t.type\tmod, @object\n\t.size\tmod, 4\nmod:\n\t.long\t1000000007\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.quad\t1\n\t.quad\t0\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC2:\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 vertex;\n int32_t next;\n} graph_edge;\n\ntypedef struct directedGraph {\n graph_edge *edge;\n int32_t *start;\n int32_t pointer;\n int32_t vertex_num;\n int32_t edge_max_size;\n} graph;\n\ngraph* new_graph (const int vertex_num) {\n graph *g = (graph *) calloc (1, sizeof (graph));\n g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));\n g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n g->pointer = 0;\n g->vertex_num = vertex_num;\n g->edge_max_size = 1;\n for (int32_t i = 0; i < vertex_num; ++i) {\n g->start[i] = -1;\n }\n return g;\n}\n\nvoid add_edge (graph *g, int32_t from, int32_t to) {\n if (g->pointer == g->edge_max_size) {\n g->edge_max_size *= 2;\n g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);\n }\n g->edge[g->pointer] = (graph_edge) {to, g->start[from]};\n g->start[from] = g->pointer++;\n}\n\nconst i32 mod = 1000000007;\n\ni32 mod_pow (i32 r, i32 n) {\n i32 t = 1;\n i32 s = r;\n while (n > 0) {\n if (n & 1) t = (i64) t * s % mod;\n s = (i64) s * s % mod;\n n >>= 1;\n }\n return t;\n}\n\ntypedef struct dp_node {\n i32 one;\n i32 zero;\n} node;\n\nnode merge (node *a, i32 n) {\n i64 one = 0;\n i64 zero = 1;\n i64 total = 1;\n for (i32 i = 0; i < n; ++i) {\n one = (one * a[i].zero + zero * a[i].one) % mod;\n zero = zero * a[i].zero % mod;\n total = total * (a[i].zero + a[i].one) % mod;\n }\n return (node) {one, (total + mod - one) % mod};\n}\n\ntypedef node deque_val;\n\ntypedef struct Deque {\n deque_val *array;\n size_t front;\n size_t last;\n size_t mask;\n} deque;\n\ndeque* new_deque (void) {\n const size_t len = 2;\n deque *d = (deque *) calloc (len, sizeof (deque));\n d->array = (deque_val *) calloc (len, sizeof (deque_val));\n d->front = d->last = 0;\n d->mask = len - 1;\n return d;\n}\n\nvoid free_deque (deque * const d) {\n free (d->array);\n free (d);\n}\n\nsize_t get_size (const deque *d) {\n return (d->last + (~d->front + 1)) & d->mask;\n}\n\nvoid deque_realloc (deque * const d) {\n deque_val *array = (deque_val *) calloc (2 * (d->mask + 1), sizeof (deque_val));\n size_t k = 0;\n for (size_t i = d->front; i != d->last; i = (i + 1) & d->mask) {\n array[k++] = d->array[i];\n }\n free (d->array);\n d->array = array;\n d->front = 0;\n d->last = k;\n d->mask = 2 * d->mask + 1;\n}\n\ndeque_val get_at (const deque *d, size_t x) {\n return d->array[(d->front + x) & d->mask];\n}\n\nvoid assign_at (const deque *d, size_t x, deque_val v) {\n d->array[(d->front + x) & d->mask] = v;\n}\n\nvoid push_front (deque * const d, const deque_val v) {\n if(((d->last + 1) & d->mask) == d->front) {\n deque_realloc (d);\n }\n d->front = (d->front + d->mask) & d->mask;\n d->array[d->front] = v;\n}\n\nint cmp_deque_size (const void *a, const void *b) {\n deque *p = *(deque **)a;\n deque *q = *(deque **)b;\n i32 d = get_size (p) - get_size (q);\n return d == 0 ? 0 : d > 0 ? -1 : 1;\n}\n\nvoid run (void) {\n i32 n;\n scanf (\"%\" SCNi32, &n);\n i32 *p = (i32 *) calloc (n + 1, sizeof (i32));\n i32 *depth = (i32 *) calloc (n + 1, sizeof (i32));\n i32 *cnt = (i32 *) calloc (n + 1, sizeof (i32));\n cnt[0] = 1;\n graph *g = new_graph (n + 1);\n for (i32 i = 1; i <= n; ++i) {\n scanf (\"%\" SCNi32, p + i);\n add_edge (g, p[i], i);\n depth[i] = depth[p[i]] + 1;\n cnt[depth[i]]++;\n }\n deque **dp = (deque **) calloc (n + 1, sizeof (deque *));\n deque **child = (deque **) calloc (n + 1, sizeof (deque *));\n node *lst = (node *) calloc (n + 1, sizeof (node));\n for (i32 i = n; i >= 0; --i) {\n i32 v = i;\n if (g->start[v] == -1) {\n dp[v] = new_deque();\n push_front (dp[v], (node) {1, 1});\n continue;\n }\n i32 len = 0;\n for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) {\n i32 u = g->edge[p].vertex;\n child[len++] = dp[u];\n }\n if (len > 1) {\n qsort (child, len, sizeof (deque *), cmp_deque_size);\n for (i32 d = 0; d < (i32) get_size (child[1]); ++d) {\n i32 j = 0;\n for (; j < len && d < (i32) get_size (child[j]); ++j) {\n lst[j] = get_at (child[j], d);\n }\n assign_at (child[0], d, merge (lst, j));\n }\n for (i32 j = 1; j < len; ++j) {\n\tfree_deque (child[j]);\n }\n }\n dp[v] = child[0];\n push_front (dp[v], (node) {1, 1});\n }\n i64 ans = 0;\n for (i32 i = 0; i < (i32) get_size (dp[0]); ++i) {\n ans += (i64) mod_pow (2, n + 1 - cnt[i]) * get_at (dp[0], i).one % mod;\n }\n printf (\"%\" PRIi64 \"\\n\", ans % mod);\n}\n\nint main (void) {\n run();\n return 0;\n}\n", "index": 42, "inputs": [ "2\n0 1\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "5\n0 1 1 0 3\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 3 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 3 6 11 10 8 16 5 3 20 1 25 20 23 24 23\n", "5\n0 1 1 1 4\n", "31\n0 1 0 2 4 0 4 0 6 4 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 2 3 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 3 0 12 10 8 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 0 6 4 3 9 7 3 7 3 15 6 12 10 12 7 5 3 20 1 25 20 23 24 23\n", "31\n0 0 0 2 4 0 4 1 6 4 3 9 7 3 7 2 3 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 0 6 4 3 9 7 3 7 3 15 6 12 10 12 7 5 3 20 1 25 8 23 24 23\n", "31\n0 0 0 2 4 0 4 1 6 4 3 9 7 3 7 2 3 6 12 10 12 16 5 4 20 1 25 20 23 24 23\n", "31\n0 1 0 1 4 0 4 1 6 4 3 9 7 3 7 2 3 0 12 10 8 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 0 6 4 3 9 8 3 7 3 15 6 12 10 12 7 5 3 20 1 25 8 23 24 23\n", "31\n0 1 0 1 4 0 4 1 6 4 3 9 7 3 7 2 3 0 12 10 8 16 5 3 20 2 25 20 23 24 23\n", "31\n0 1 0 1 4 0 4 1 6 7 3 9 7 3 7 2 3 0 12 10 8 16 5 3 20 2 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 2 15 6 12 10 12 15 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 5 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 1 7 3 7 3 3 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 3 6 12 10 8 16 5 3 20 2 25 20 23 24 23\n", "31\n0 1 0 2 0 0 4 1 6 4 3 9 7 3 7 3 3 0 12 10 8 16 5 3 20 1 25 20 23 24 23\n", "31\n0 0 0 2 4 0 4 1 3 4 3 9 7 3 7 2 3 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 0 6 4 3 9 3 3 7 3 15 6 12 10 12 7 5 3 20 1 25 8 23 24 23\n", "31\n0 1 0 1 4 0 4 1 6 4 3 9 0 3 7 2 3 0 12 10 8 16 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 1 4 0 4 1 6 4 3 9 7 3 7 0 3 0 12 10 8 16 5 3 20 2 25 20 23 24 23\n", "31\n0 1 0 2 4 0 4 0 6 4 3 9 8 3 7 3 15 6 12 18 12 7 5 3 20 1 25 8 23 22 23\n", "31\n0 1 0 2 4 0 4 1 6 4 3 1 7 3 7 3 3 6 12 10 12 16 6 3 20 1 25 20 23 24 23\n", "31\n0 1 1 2 4 0 4 0 6 4 3 9 7 3 7 3 15 4 12 10 12 7 5 3 20 1 25 20 23 24 23\n", "31\n0 1 0 1 4 0 4 1 6 4 2 9 0 3 7 2 3 0 12 10 8 16 5 3 20 1 25 20 23 24 23\n" ], "outputs": [ "12\n", "831058846\n", "128\n", "443427223\n", "40774039\n", "120\n", "227079070\n", "367929751\n", "906556318\n", "361296798\n", "616466348\n", "824425893\n", "19119525\n", "388218277\n", "690208165\n", "321109413\n", "502147479\n", "730395550\n", "52284290\n", "485370263\n", "401484183\n", "59306910\n", "254000549\n", "790871461\n", "985565100\n", "448694188\n", "153337253\n", "321792407\n", "703474071\n", "918456236\n" ], "question": "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 vertex;\n int32_t next;\n} graph_edge;\n\ntypedef struct directedGraph {\n graph_edge *edge;\n int32_t *start;\n int32_t pointer;\n int32_t vertex_num;\n int32_t edge_max_size;\n} graph;\n\ngraph* new_graph (const int vertex_num) {\n graph *g = (graph *) calloc (1, sizeof (graph));\n g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));\n g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n g->pointer = 0;\n g->vertex_num = vertex_num;\n g->edge_max_size = 1;\n for (int32_t i = 0; i < vertex_num; ++i) {\n g->start[i] = -1;\n }\n return g;\n}\n\nvoid add_edge (graph *g, int32_t from, int32_t to) {\n if (g->pointer == g->edge_max_size) {\n g->edge_max_size *= 2;\n g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);\n }\n g->edge[g->pointer] = (graph_edge) {to, g->start[from]};\n g->start[from] = g->pointer++;\n}\n\nconst i32 mod = 1000000007;\n\ni32 mod_pow (i32 r, i32 n) {\n i32 t = 1;\n i32 s = r;\n while (n > 0) {\n if (n & 1) t = (i64) t * s % mod;\n s = (i64) s * s % mod;\n n >>= 1;\n }\n return t;\n}\n\ntypedef struct dp_node {\n i32 one;\n i32 zero;\n} node;\n\nnode merge (node *a, i32 n) {\n i64 one = 0;\n i64 zero = 1;\n i64 total = 1;\n for (i32 i = 0; i < n; ++i) {\n one = (one * a[i].zero + zero * a[i].one) % mod;\n zero = zero * a[i].zero % mod;\n total = total * (a[i].zero + a[i].one) % mod;\n }\n return (node) {one, (total + mod - one) % mod};\n}\n\ntypedef node deque_val;\n\ntypedef struct Deque {\n deque_val *array;\n size_t front;\n size_t last;\n size_t mask;\n} deque;\n\ndeque* new_deque (void) {\n const size_t len = 2;\n deque *d = (deque *) calloc (len, sizeof (deque));\n d->array = (deque_val *) calloc (len, sizeof (deque_val));\n d->front = d->last = 0;\n d->mask = len - 1;\n return d;\n}\n\nvoid free_deque (deque * const d) {\n free (d->array);\n free (d);\n}\n\nsize_t get_size (const deque *d) {\n return (d->last + (~d->front + 1)) & d->mask;\n}\n\nvoid deque_realloc (deque * const d) {\n deque_val *array = (deque_val *) calloc (2 * (d->mask + 1), sizeof (deque_val));\n size_t k = 0;\n for (size_t i = d->front; i != d->last; i = (i + 1) & d->mask) {\n array[k++] = d->array[i];\n }\n free (d->array);\n d->array = array;\n d->front = 0;\n d->last = k;\n d->mask = 2 * d->mask + 1;\n}\n\ndeque_val get_at (const deque *d, size_t x) {\n return d->array[(d->front + x) & d->mask];\n}\n\nvoid assign_at (const deque *d, size_t x, deque_val v) {\n d->array[(d->front + x) & d->mask] = v;\n}\n\nvoid push_front (deque * const d, const deque_val v) {\n if(((d->last + 1) & d->mask) == d->front) {\n deque_realloc (d);\n }\n d->front = (d->front + d->mask) & d->mask;\n d->array[d->front] = v;\n}\n\nint cmp_deque_size (const void *a, const void *b) {\n deque *p = *(deque **)a;\n deque *q = *(deque **)b;\n i32 d = get_size (p) - get_size (q);\n return d == 0 ? 0 : d > 0 ? -1 : 1;\n}\n\nvoid run (void) {\n i32 n;\n scanf (\"%\" SCNi32, &n);\n i32 *p = (i32 *) calloc (n + 1, sizeof (i32));\n i32 *depth = (i32 *) calloc (n + 1, sizeof (i32));\n i32 *cnt = (i32 *) calloc (n + 1, sizeof (i32));\n cnt[0] = 1;\n graph *g = new_graph (n + 1);\n for (i32 i = 1; i <= n; ++i) {\n scanf (\"%\" SCNi32, p + i);\n add_edge (g, p[i], i);\n depth[i] = depth[p[i]] + 1;\n cnt[depth[i]]++;\n }\n deque **dp = (deque **) calloc (n + 1, sizeof (deque *));\n deque **child = (deque **) calloc (n + 1, sizeof (deque *));\n node *lst = (node *) calloc (n + 1, sizeof (node));\n for (i32 i = n; i >= 0; --i) {\n i32 v = i;\n if (g->start[v] == -1) {\n dp[v] = new_deque();\n push_front (dp[v], (node) {1, 1});\n continue;\n }\n i32 len = 0;\n for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) {\n i32 u = g->edge[p].vertex;\n child[len++] = dp[u];\n }\n if (len > 1) {\n qsort (child, len, sizeof (deque *), cmp_deque_size);\n for (i32 d = 0; d < (i32) get_size (child[1]); ++d) {\n i32 j = 0;\n for (; j < len && d < (i32) get_size (child[j]); ++j) {\n lst[j] = get_at (child[j], d);\n }\n assign_at (child[0], d, merge (lst, j));\n }\n for (i32 j = 1; j < len; ++j) {\n\tfree_deque (child[j]);\n }\n }\n dp[v] = child[0];\n push_front (dp[v], (node) {1, 1});\n }\n i64 ans = 0;\n for (i32 i = 0; i < (i32) get_size (dp[0]); ++i) {\n ans += (i64) mod_pow (2, n + 1 - cnt[i]) * get_at (dp[0], i).one % mod;\n }\n printf (\"%\" PRIi64 \"\\n\", ans % mod);\n}\n\nint main (void) {\n run();\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$8, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-20(%rbp), %edx\n\tmovl\t%edx, 20(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$1, 24(%rax)\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$-1, (%rax)\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L3\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnew_graph, .-new_graph\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tmovl\t%edx, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t16(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L6\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t%edx, 24(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\trealloc@PLT\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n.L6:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t16(%rax), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t%ecx, (%rax)\n\tmovl\t%edx, 4(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t16(%rax), %eax\n\tleal\t1(%rax), %ecx\n\tmovq\t-8(%rbp), %rdx\n\tmovl\t%ecx, 16(%rdx)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t%eax, (%rdx)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tadd_edge, .-add_edge\n\t.globl\tmod\n\t.section\t.rodata\n\t.align 4\n\t.type\tmod, @object\n\t.size\tmod, 4\nmod:\n\t.long\t1000000007\n\t.text\n\t.globl\tmod_pow\n\t.type\tmod_pow, @function\nmod_pow:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-24(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tje\t.L9\n\tmovl\t-8(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\timulq\t%rdx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rcx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tmovl\t%eax, -8(%rbp)\n.L9:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\timulq\t%rdx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rcx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tmovl\t%eax, -4(%rbp)\n\tsarl\t-24(%rbp)\n.L8:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L10\n\tmovl\t-8(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmod_pow, .-mod_pow\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovl\t%esi, -44(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovl\t$0, -28(%rbp)\n\tjmp\t.L13\n.L14:\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rsi\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, -24(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, -16(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %edx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rsi\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tcltq\n\timulq\t-8(%rbp), %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, -8(%rbp)\n\taddl\t$1, -28(%rbp)\n.L13:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t-44(%rbp), %eax\n\tjl\t.L14\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%eax, %edi\n\tmovl\t$1000000007, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tsubq\t-24(%rbp), %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rsi\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rdx, %rax\n\tmovl\t%eax, %edx\n\tmovl\t%edi, %esi\n\tmovabsq\t$-4294967296, %rax\n\tandq\t%rcx, %rax\n\torq\t%rsi, %rax\n\tmovq\t%rax, %rcx\n\tmovl\t%edx, %eax\n\tsalq\t$32, %rax\n\tmovl\t%ecx, %edx\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rcx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tmerge, .-merge\n\t.globl\tnew_deque\n\t.type\tnew_deque, @function\nnew_deque:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t$2, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t$32, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$0, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-16(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 24(%rax)\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tnew_deque, .-new_deque\n\t.globl\tfree_deque\n\t.type\tfree_deque, @function\nfree_deque:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tfree_deque, .-free_deque\n\t.globl\tget_size\n\t.type\tget_size, @function\nget_size:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tsubq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tget_size, .-get_size\n\t.globl\tdeque_realloc\n\t.type\tdeque_realloc, @function\ndeque_realloc:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\taddq\t$1, %rax\n\taddq\t%rax, %rax\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovq\t-40(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$3, %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-24(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-8(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t(%rcx), %rax\n\tmovq\t%rax, (%rdx)\n\tmovq\t-16(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n.L22:\n\tmovq\t-40(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjne\t.L23\n\tmovq\t-40(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-40(%rbp), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, (%rax)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\taddq\t%rax, %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tmovq\t%rdx, 24(%rax)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tdeque_realloc, .-deque_realloc\n\t.globl\tget_at\n\t.type\tget_at, @function\nget_at:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rcx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tget_at, .-get_at\n\t.globl\tassign_at\n\t.type\tassign_at, @function\nassign_at:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rcx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tassign_at, .-assign_at\n\t.globl\tpush_front\n\t.type\tpush_front, @function\npush_front:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L28\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeque_realloc\n.L28:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tandq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpush_front, .-push_front\n\t.globl\tcmp_deque_size\n\t.type\tcmp_deque_size, @function\ncmp_deque_size:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$48, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -48(%rbp)\n\tmovq\t%rsi, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tmovl\t%eax, %ebx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tmovl\t%eax, %edx\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -28(%rbp)\n\tcmpl\t$0, -28(%rbp)\n\tje\t.L30\n\tcmpl\t$0, -28(%rbp)\n\tjle\t.L31\n\tmovl\t$-1, %eax\n\tjmp\t.L34\n.L31:\n\tmovl\t$1, %eax\n\tjmp\t.L34\n.L30:\n\tmovl\t$0, %eax\n.L34:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tcmp_deque_size, .-cmp_deque_size\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%i\"\n.LC1:\n\t.string\t\"%li\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$136, %rsp\n\t.cfi_offset 13, -24\n\t.cfi_offset 12, -32\n\t.cfi_offset 3, -40\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -40(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-148(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -96(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -88(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -80(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovl\t$1, (%rax)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\tnew_graph\n\tmovq\t%rax, -72(%rbp)\n\tmovl\t$1, -144(%rbp)\n\tjmp\t.L36\n.L37:\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-144(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rcx, %rax\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tmovl\t-144(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\taddl\t$1, -144(%rbp)\n.L36:\n\tmovl\t-148(%rbp), %eax\n\tcmpl\t%eax, -144(%rbp)\n\tjle\t.L37\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -56(%rbp)\n\tmovl\t-148(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -48(%rbp)\n\tmovl\t-148(%rbp), %eax\n\tmovl\t%eax, -140(%rbp)\n\tjmp\t.L38\n.L51:\n\tmovl\t-140(%rbp), %eax\n\tmovl\t%eax, -112(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t$-1, %eax\n\tjne\t.L39\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t(%rdx,%rax), %r13\n\tcall\tnew_deque\n\tmovq\t%rax, 0(%r13)\n\tmovabsq\t$-4294967296, %rax\n\tandq\t%r12, %rax\n\torq\t$1, %rax\n\tmovq\t%rax, %r12\n\tmovl\t%r12d, %edx\n\tmovabsq\t$4294967296, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %r12\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%r12, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush_front\n\tjmp\t.L40\n.L39:\n\tmovl\t$0, -136(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -132(%rbp)\n\tjmp\t.L41\n.L42:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-132(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -108(%rbp)\n\tmovl\t-108(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\t-136(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -136(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t(%rcx), %rax\n\tmovq\t%rax, (%rdx)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovl\t-132(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -132(%rbp)\n.L41:\n\tcmpl\t$-1, -132(%rbp)\n\tjne\t.L42\n\tcmpl\t$1, -136(%rbp)\n\tjle\t.L43\n\tmovl\t-136(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovq\t-56(%rbp), %rax\n\tleaq\tcmp_deque_size(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$8, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -128(%rbp)\n\tjmp\t.L44\n.L48:\n\tmovl\t$0, -124(%rbp)\n\tjmp\t.L45\n.L47:\n\tmovl\t-128(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-124(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovl\t-124(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-48(%rbp), %rcx\n\tleaq\t(%rsi,%rcx), %r13\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tget_at\n\tmovq\t%rax, 0(%r13)\n\taddl\t$1, -124(%rbp)\n.L45:\n\tmovl\t-124(%rbp), %eax\n\tcmpl\t-136(%rbp), %eax\n\tjge\t.L46\n\tmovl\t-124(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tcmpl\t%eax, -128(%rbp)\n\tjl\t.L47\n.L46:\n\tmovl\t-124(%rbp), %edx\n\tmovq\t-48(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rax, %rdx\n\tmovl\t-128(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tassign_at\n\taddl\t$1, -128(%rbp)\n.L44:\n\tmovq\t-56(%rbp), %rax\n\taddq\t$8, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tcmpl\t%eax, -128(%rbp)\n\tjl\t.L48\n\tmovl\t$1, -120(%rbp)\n\tjmp\t.L49\n.L50:\n\tmovl\t-120(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree_deque\n\taddl\t$1, -120(%rbp)\n.L49:\n\tmovl\t-120(%rbp), %eax\n\tcmpl\t-136(%rbp), %eax\n\tjl\t.L50\n.L43:\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, (%rdx)\n\tmovabsq\t$-4294967296, %rax\n\tandq\t%rbx, %rax\n\torq\t$1, %rax\n\tmovq\t%rax, %rbx\n\tmovl\t%ebx, %edx\n\tmovabsq\t$4294967296, %rax\n\torq\t%rdx, %rax\n\tmovq\t%rax, %rbx\n\tmovl\t-112(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush_front\n.L40:\n\tsubl\t$1, -140(%rbp)\n.L38:\n\tcmpl\t$0, -140(%rbp)\n\tjns\t.L51\n\tmovq\t$0, -104(%rbp)\n\tmovl\t$0, -116(%rbp)\n\tjmp\t.L52\n.L53:\n\tmovl\t-148(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-116(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %esi\n\tmovl\t$2, %edi\n\tcall\tmod_pow\n\tmovslq\t%eax, %rbx\n\tmovl\t-116(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tget_at\n\tcltq\n\timulq\t%rbx, %rax\n\tmovl\t$1000000007, %edx\n\tmovslq\t%edx, %rcx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, -104(%rbp)\n\taddl\t$1, -116(%rbp)\n.L52:\n\tmovq\t-64(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tget_size\n\tcmpl\t%eax, -116(%rbp)\n\tjl\t.L53\n\tmovl\t$1000000007, %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-104(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tnop\n\tmovq\t-40(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L54\n\tcall\t__stack_chk_fail@PLT\n.L54:\n\taddq\t$136, %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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_edge; typedef struct directedGraph { graph_edge *edge; int32_t *start; int32_t pointer; int32_t vertex_num; int32_t edge_max_size; } graph; graph* new_graph (const int vertex_num) { graph *g = (graph *) calloc (1, sizeof (graph)); g->edge = (graph_edge *) calloc (1, sizeof (graph_edge)); g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t)); g->pointer = 0; g->vertex_num = vertex_num; g->edge_max_size = 1; for (int32_t i = 0; i < vertex_num; ++i) { g->start[i] = -1; } return g; } void add_edge (graph *g, int32_t from, int32_t to) { if (g->pointer == g->edge_max_size) { g->edge_max_size *= 2; g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size); } g->edge[g->pointer] = (graph_edge) {to, g->start[from]}; g->start[from] = g->pointer++; } const i32 mod = 1000000007; i32 mod_pow (i32 r, i32 n) { i32 t = 1; i32 s = r; while (n > 0) { if (n & 1) t = (i64) t * s % mod; s = (i64) s * s % mod; n >>= 1; } return t; } typedef struct dp_node { i32 one; i32 zero; } node; node merge (node *a, i32 n) { i64 one = 0; i64 zero = 1; i64 total = 1; for (i32 i = 0; i < n; ++i) { one = (one * a[i].zero + zero * a[i].one) % mod; zero = zero * a[i].zero % mod; total = total * (a[i].zero + a[i].one) % mod; } return (node) {one, (total + mod - one) % mod}; } typedef node deque_val; typedef struct Deque { deque_val *array; size_t front; size_t last; size_t mask; } deque; deque* new_deque (void) { const size_t len = 2; deque *d = (deque *) calloc (len, sizeof (deque)); d->array = (deque_val *) calloc (len, sizeof (deque_val)); d->front = d->last = 0; d->mask = len - 1; return d; } void free_deque (deque * const d) { free (d->array); free (d); } size_t get_size (const deque *d) { return (d->last + (~d->front + 1)) & d->mask; } void deque_realloc (deque * const d) { deque_val *array = (deque_val *) calloc (2 * (d->mask + 1), sizeof (deque_val)); size_t k = 0; for (size_t i = d->front; i != d->last; i = (i + 1) & d->mask) { array[k++] = d->array[i]; } free (d->array); d->array = array; d->front = 0; d->last = k; d->mask = 2 * d->mask + 1; } deque_val get_at (const deque *d, size_t x) { return d->array[(d->front + x) & d->mask]; } void assign_at (const deque *d, size_t x, deque_val v) { d->array[(d->front + x) & d->mask] = v; } void push_front (deque * const d, const deque_val v) { if(((d->last + 1) & d->mask) == d->front) { deque_realloc (d); } d->front = (d->front + d->mask) & d->mask; d->array[d->front] = v; } int cmp_deque_size (const void *a, const void *b) { deque *p = *(deque **)a; deque *q = *(deque **)b; i32 d = get_size (p) - get_size (q); return d == 0 ? 0 : d > 0 ? -1 : 1; } void run (void) { i32 n; scanf ("%" SCNi32, &n); i32 *p = (i32 *) calloc (n + 1, sizeof (i32)); i32 *depth = (i32 *) calloc (n + 1, sizeof (i32)); i32 *cnt = (i32 *) calloc (n + 1, sizeof (i32)); cnt[0] = 1; graph *g = new_graph (n + 1); for (i32 i = 1; i <= n; ++i) { scanf ("%" SCNi32, p + i); add_edge (g, p[i], i); depth[i] = depth[p[i]] + 1; cnt[depth[i]]++; } deque **dp = (deque **) calloc (n + 1, sizeof (deque *)); deque **child = (deque **) calloc (n + 1, sizeof (deque *)); node *lst = (node *) calloc (n + 1, sizeof (node)); for (i32 i = n; i >= 0; --i) { i32 v = i; if (g->start[v] == -1) { dp[v] = new_deque(); push_front (dp[v], (node) {1, 1}); continue; } i32 len = 0; for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) { i32 u = g->edge[p].vertex; child[len++] = dp[u]; } if (len > 1) { qsort (child, len, sizeof (deque *), cmp_deque_size); for (i32 d = 0; d < (i32) get_size (child[1]); ++d) { i32 j = 0; for (; j < len && d < (i32) get_size (child[j]); ++j) { lst[j] = get_at (child[j], d); } assign_at (child[0], d, merge (lst, j)); } for (i32 j = 1; j < len; ++j) { free_deque (child[j]); } } dp[v] = child[0]; push_front (dp[v], (node) {1, 1}); } i64 ans = 0; for (i32 i = 0; i < (i32) get_size (dp[0]); ++i) { ans += (i64) mod_pow (2, n + 1 - cnt[i]) * get_at (dp[0], i).one % mod; } printf ("%" PRIi64 "\n", ans % mod); } int main (void) { run(); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl new_graph .type new_graph, @function new_graph: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl $32, %esi movl $1, %edi call calloc@PLT movq %rax, -8(%rbp) movl $8, %esi movl $1, %edi call calloc@PLT movq %rax, %rdx movq -8(%rbp), %rax movq %rdx, (%rax) movl -20(%rbp), %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, %rdx movq -8(%rbp), %rax movq %rdx, 8(%rax) movq -8(%rbp), %rax movl $0, 16(%rax) movq -8(%rbp), %rax movl -20(%rbp), %edx movl %edx, 20(%rax) movq -8(%rbp), %rax movl $1, 24(%rax) movl $0, -12(%rbp) jmp .L2 .L3: movq -8(%rbp), %rax movq 8(%rax), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl $-1, (%rax) addl $1, -12(%rbp) .L2: movl -12(%rbp), %eax cmpl -20(%rbp), %eax jl .L3 movq -8(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size new_graph, .-new_graph .globl add_edge .type add_edge, @function add_edge: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movl %esi, -12(%rbp) movl %edx, -16(%rbp) movq -8(%rbp), %rax movl 16(%rax), %edx movq -8(%rbp), %rax movl 24(%rax), %eax cmpl %eax, %edx jne .L6 movq -8(%rbp), %rax movl 24(%rax), %eax leal (%rax,%rax), %edx movq -8(%rbp), %rax movl %edx, 24(%rax) movq -8(%rbp), %rax movl 24(%rax), %eax cltq leaq 0(,%rax,8), %rdx movq -8(%rbp), %rax movq (%rax), %rax movq %rdx, %rsi movq %rax, %rdi call realloc@PLT movq -8(%rbp), %rdx movq %rax, (%rdx) .L6: movq -8(%rbp), %rax movq (%rax), %rdx movq -8(%rbp), %rax movl 16(%rax), %eax cltq salq $3, %rax addq %rdx, %rax movq -8(%rbp), %rdx movq 8(%rdx), %rcx movl -12(%rbp), %edx movslq %edx, %rdx salq $2, %rdx addq %rcx, %rdx movl (%rdx), %edx movl -16(%rbp), %ecx movl %ecx, (%rax) movl %edx, 4(%rax) movq -8(%rbp), %rax movl 16(%rax), %eax leal 1(%rax), %ecx movq -8(%rbp), %rdx movl %ecx, 16(%rdx) movq -8(%rbp), %rdx movq 8(%rdx), %rcx movl -12(%rbp), %edx movslq %edx, %rdx salq $2, %rdx addq %rcx, %rdx movl %eax, (%rdx) nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size add_edge, .-add_edge .globl mod .section .rodata .align 4 .type mod, @object .size mod, 4 mod: .long 1000000007 .text .globl mod_pow .type mod_pow, @function mod_pow: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $1, -8(%rbp) movl -20(%rbp), %eax movl %eax, -4(%rbp) jmp .L8 .L10: movl -24(%rbp), %eax andl $1, %eax testl %eax, %eax je .L9 movl -8(%rbp), %eax movslq %eax, %rdx movl -4(%rbp), %eax cltq imulq %rdx, %rax movl $1000000007, %edx movslq %edx, %rcx cqto idivq %rcx movq %rdx, %rax movl %eax, -8(%rbp) .L9: movl -4(%rbp), %eax movslq %eax, %rdx movl -4(%rbp), %eax cltq imulq %rdx, %rax movl $1000000007, %edx movslq %edx, %rcx cqto idivq %rcx movq %rdx, %rax movl %eax, -4(%rbp) sarl -24(%rbp) .L8: cmpl $0, -24(%rbp) jg .L10 movl -8(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size mod_pow, .-mod_pow .globl merge .type merge, @function merge: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -40(%rbp) movl %esi, -44(%rbp) movq $0, -24(%rbp) movq $1, -16(%rbp) movq $1, -8(%rbp) movl $0, -28(%rbp) jmp .L13 .L14: movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl 4(%rax), %eax cltq imulq -24(%rbp), %rax movq %rax, %rdx movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rsi movq -40(%rbp), %rax addq %rsi, %rax movl (%rax), %eax cltq imulq -16(%rbp), %rax addq %rdx, %rax movl $1000000007, %edx movslq %edx, %rsi cqto idivq %rsi movq %rdx, -24(%rbp) movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl 4(%rax), %eax cltq imulq -16(%rbp), %rax movl $1000000007, %edx movslq %edx, %rsi cqto idivq %rsi movq %rdx, -16(%rbp) movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl 4(%rax), %edx movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rsi movq -40(%rbp), %rax addq %rsi, %rax movl (%rax), %eax addl %edx, %eax cltq imulq -8(%rbp), %rax movl $1000000007, %edx movslq %edx, %rsi cqto idivq %rsi movq %rdx, -8(%rbp) addl $1, -28(%rbp) .L13: movl -28(%rbp), %eax cmpl -44(%rbp), %eax jl .L14 movq -24(%rbp), %rax movl %eax, %edi movl $1000000007, %eax movslq %eax, %rdx movq -8(%rbp), %rax addq %rdx, %rax subq -24(%rbp), %rax movl $1000000007, %edx movslq %edx, %rsi cqto idivq %rsi movq %rdx, %rax movl %eax, %edx movl %edi, %esi movabsq $-4294967296, %rax andq %rcx, %rax orq %rsi, %rax movq %rax, %rcx movl %edx, %eax salq $32, %rax movl %ecx, %edx orq %rdx, %rax movq %rax, %rcx movq %rcx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size merge, .-merge .globl new_deque .type new_deque, @function new_deque: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq $2, -16(%rbp) movq -16(%rbp), %rax movl $32, %esi movq %rax, %rdi call calloc@PLT movq %rax, -8(%rbp) movq -16(%rbp), %rax movl $8, %esi movq %rax, %rdi call calloc@PLT movq %rax, %rdx movq -8(%rbp), %rax movq %rdx, (%rax) movq -8(%rbp), %rax movq $0, 16(%rax) movq -8(%rbp), %rax movq 16(%rax), %rdx movq -8(%rbp), %rax movq %rdx, 8(%rax) movq -16(%rbp), %rax leaq -1(%rax), %rdx movq -8(%rbp), %rax movq %rdx, 24(%rax) movq -8(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size new_deque, .-new_deque .globl free_deque .type free_deque, @function free_deque: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq -8(%rbp), %rax movq (%rax), %rax movq %rax, %rdi call free@PLT movq -8(%rbp), %rax movq %rax, %rdi call free@PLT nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size free_deque, .-free_deque .globl get_size .type get_size, @function get_size: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq -8(%rbp), %rax movq 16(%rax), %rdx movq -8(%rbp), %rax movq 8(%rax), %rax subq %rax, %rdx movq -8(%rbp), %rax movq 24(%rax), %rax andq %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size get_size, .-get_size .globl deque_realloc .type deque_realloc, @function deque_realloc: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %rdi, -40(%rbp) movq -40(%rbp), %rax movq 24(%rax), %rax addq $1, %rax addq %rax, %rax movl $8, %esi movq %rax, %rdi call calloc@PLT movq %rax, -8(%rbp) movq $0, -24(%rbp) movq -40(%rbp), %rax movq 8(%rax), %rax movq %rax, -16(%rbp) jmp .L22 .L23: movq -40(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax salq $3, %rax leaq (%rdx,%rax), %rcx movq -24(%rbp), %rax leaq 1(%rax), %rdx movq %rdx, -24(%rbp) leaq 0(,%rax,8), %rdx movq -8(%rbp), %rax addq %rax, %rdx movq (%rcx), %rax movq %rax, (%rdx) movq -16(%rbp), %rax leaq 1(%rax), %rdx movq -40(%rbp), %rax movq 24(%rax), %rax andq %rdx, %rax movq %rax, -16(%rbp) .L22: movq -40(%rbp), %rax movq 16(%rax), %rax cmpq %rax, -16(%rbp) jne .L23 movq -40(%rbp), %rax movq (%rax), %rax movq %rax, %rdi call free@PLT movq -40(%rbp), %rax movq -8(%rbp), %rdx movq %rdx, (%rax) movq -40(%rbp), %rax movq $0, 8(%rax) movq -40(%rbp), %rax movq -24(%rbp), %rdx movq %rdx, 16(%rax) movq -40(%rbp), %rax movq 24(%rax), %rax addq %rax, %rax leaq 1(%rax), %rdx movq -40(%rbp), %rax movq %rdx, 24(%rax) nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size deque_realloc, .-deque_realloc .globl get_at .type get_at, @function get_at: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movq (%rax), %rdx movq -8(%rbp), %rax movq 8(%rax), %rcx movq -16(%rbp), %rax addq %rax, %rcx movq -8(%rbp), %rax movq 24(%rax), %rax andq %rcx, %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size get_at, .-get_at .globl assign_at .type assign_at, @function assign_at: .LFB15: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -8(%rbp), %rax movq (%rax), %rdx movq -8(%rbp), %rax movq 8(%rax), %rcx movq -16(%rbp), %rax addq %rax, %rcx movq -8(%rbp), %rax movq 24(%rax), %rax andq %rcx, %rax salq $3, %rax addq %rax, %rdx movq -24(%rbp), %rax movq %rax, (%rdx) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE15: .size assign_at, .-assign_at .globl push_front .type push_front, @function push_front: .LFB16: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movq 16(%rax), %rax leaq 1(%rax), %rdx movq -8(%rbp), %rax movq 24(%rax), %rax andq %rax, %rdx movq -8(%rbp), %rax movq 8(%rax), %rax cmpq %rax, %rdx jne .L28 movq -8(%rbp), %rax movq %rax, %rdi call deque_realloc .L28: movq -8(%rbp), %rax movq 8(%rax), %rdx movq -8(%rbp), %rax movq 24(%rax), %rax addq %rax, %rdx movq -8(%rbp), %rax movq 24(%rax), %rax andq %rax, %rdx movq -8(%rbp), %rax movq %rdx, 8(%rax) movq -8(%rbp), %rax movq (%rax), %rdx movq -8(%rbp), %rax movq 8(%rax), %rax salq $3, %rax addq %rax, %rdx movq -16(%rbp), %rax movq %rax, (%rdx) nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE16: .size push_front, .-push_front .globl cmp_deque_size .type cmp_deque_size, @function cmp_deque_size: .LFB17: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $48, %rsp .cfi_offset 3, -24 movq %rdi, -48(%rbp) movq %rsi, -56(%rbp) movq -48(%rbp), %rax movq (%rax), %rax movq %rax, -24(%rbp) movq -56(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -24(%rbp), %rax movq %rax, %rdi call get_size movl %eax, %ebx movq -16(%rbp), %rax movq %rax, %rdi call get_size movl %eax, %edx movl %ebx, %eax subl %edx, %eax movl %eax, -28(%rbp) cmpl $0, -28(%rbp) je .L30 cmpl $0, -28(%rbp) jle .L31 movl $-1, %eax jmp .L34 .L31: movl $1, %eax jmp .L34 .L30: movl $0, %eax .L34: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE17: .size cmp_deque_size, .-cmp_deque_size .section .rodata .LC0: .string "%i" .LC1: .string "%li\n" .text .globl run .type run, @function run: .LFB18: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r13 pushq %r12 pushq %rbx subq $136, %rsp .cfi_offset 13, -24 .cfi_offset 12, -32 .cfi_offset 3, -40 movq %fs:40, %rax movq %rax, -40(%rbp) xorl %eax, %eax leaq -148(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -148(%rbp), %eax addl $1, %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -96(%rbp) movl -148(%rbp), %eax addl $1, %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -88(%rbp) movl -148(%rbp), %eax addl $1, %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -80(%rbp) movq -80(%rbp), %rax movl $1, (%rax) movl -148(%rbp), %eax addl $1, %eax movl %eax, %edi call new_graph movq %rax, -72(%rbp) movl $1, -144(%rbp) jmp .L36 .L37: movl -144(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -96(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -144(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -96(%rbp), %rax addq %rdx, %rax movl (%rax), %ecx movl -144(%rbp), %edx movq -72(%rbp), %rax movl %ecx, %esi movq %rax, %rdi call add_edge movl -144(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -96(%rbp), %rax addq %rdx, %rax movl (%rax), %eax cltq leaq 0(,%rax,4), %rdx movq -88(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -144(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -88(%rbp), %rax addq %rcx, %rax addl $1, %edx movl %edx, (%rax) movl -144(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -88(%rbp), %rax addq %rdx, %rax movl (%rax), %eax cltq leaq 0(,%rax,4), %rdx movq -80(%rbp), %rax addq %rdx, %rax movl (%rax), %edx addl $1, %edx movl %edx, (%rax) addl $1, -144(%rbp) .L36: movl -148(%rbp), %eax cmpl %eax, -144(%rbp) jle .L37 movl -148(%rbp), %eax addl $1, %eax cltq movl $8, %esi movq %rax, %rdi call calloc@PLT movq %rax, -64(%rbp) movl -148(%rbp), %eax addl $1, %eax cltq movl $8, %esi movq %rax, %rdi call calloc@PLT movq %rax, -56(%rbp) movl -148(%rbp), %eax addl $1, %eax cltq movl $8, %esi movq %rax, %rdi call calloc@PLT movq %rax, -48(%rbp) movl -148(%rbp), %eax movl %eax, -140(%rbp) jmp .L38 .L51: movl -140(%rbp), %eax movl %eax, -112(%rbp) movq -72(%rbp), %rax movq 8(%rax), %rdx movl -112(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax cmpl $-1, %eax jne .L39 movl -112(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -64(%rbp), %rax leaq (%rdx,%rax), %r13 call new_deque movq %rax, 0(%r13) movabsq $-4294967296, %rax andq %r12, %rax orq $1, %rax movq %rax, %r12 movl %r12d, %edx movabsq $4294967296, %rax orq %rdx, %rax movq %rax, %r12 movl -112(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -64(%rbp), %rax addq %rdx, %rax movq (%rax), %rax movq %r12, %rsi movq %rax, %rdi call push_front jmp .L40 .L39: movl $0, -136(%rbp) movq -72(%rbp), %rax movq 8(%rax), %rdx movl -112(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -132(%rbp) jmp .L41 .L42: movq -72(%rbp), %rax movq (%rax), %rdx movl -132(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -108(%rbp) movl -108(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -64(%rbp), %rax leaq (%rdx,%rax), %rcx movl -136(%rbp), %eax leal 1(%rax), %edx movl %edx, -136(%rbp) cltq leaq 0(,%rax,8), %rdx movq -56(%rbp), %rax addq %rax, %rdx movq (%rcx), %rax movq %rax, (%rdx) movq -72(%rbp), %rax movq (%rax), %rdx movl -132(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movl 4(%rax), %eax movl %eax, -132(%rbp) .L41: cmpl $-1, -132(%rbp) jne .L42 cmpl $1, -136(%rbp) jle .L43 movl -136(%rbp), %eax movslq %eax, %rsi movq -56(%rbp), %rax leaq cmp_deque_size(%rip), %rdx movq %rdx, %rcx movl $8, %edx movq %rax, %rdi call qsort@PLT movl $0, -128(%rbp) jmp .L44 .L48: movl $0, -124(%rbp) jmp .L45 .L47: movl -128(%rbp), %eax movslq %eax, %rdx movl -124(%rbp), %eax cltq leaq 0(,%rax,8), %rcx movq -56(%rbp), %rax addq %rcx, %rax movq (%rax), %rax movl -124(%rbp), %ecx movslq %ecx, %rcx leaq 0(,%rcx,8), %rsi movq -48(%rbp), %rcx leaq (%rsi,%rcx), %r13 movq %rdx, %rsi movq %rax, %rdi call get_at movq %rax, 0(%r13) addl $1, -124(%rbp) .L45: movl -124(%rbp), %eax cmpl -136(%rbp), %eax jge .L46 movl -124(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -56(%rbp), %rax addq %rdx, %rax movq (%rax), %rax movq %rax, %rdi call get_size cmpl %eax, -128(%rbp) jl .L47 .L46: movl -124(%rbp), %edx movq -48(%rbp), %rax movl %edx, %esi movq %rax, %rdi call merge movq %rax, %rdx movl -128(%rbp), %eax movslq %eax, %rcx movq -56(%rbp), %rax movq (%rax), %rax movq %rcx, %rsi movq %rax, %rdi call assign_at addl $1, -128(%rbp) .L44: movq -56(%rbp), %rax addq $8, %rax movq (%rax), %rax movq %rax, %rdi call get_size cmpl %eax, -128(%rbp) jl .L48 movl $1, -120(%rbp) jmp .L49 .L50: movl -120(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -56(%rbp), %rax addq %rdx, %rax movq (%rax), %rax movq %rax, %rdi call free_deque addl $1, -120(%rbp) .L49: movl -120(%rbp), %eax cmpl -136(%rbp), %eax jl .L50 .L43: movl -112(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -64(%rbp), %rax addq %rax, %rdx movq -56(%rbp), %rax movq (%rax), %rax movq %rax, (%rdx) movabsq $-4294967296, %rax andq %rbx, %rax orq $1, %rax movq %rax, %rbx movl %ebx, %edx movabsq $4294967296, %rax orq %rdx, %rax movq %rax, %rbx movl -112(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -64(%rbp), %rax addq %rdx, %rax movq (%rax), %rax movq %rbx, %rsi movq %rax, %rdi call push_front .L40: subl $1, -140(%rbp) .L38: cmpl $0, -140(%rbp) jns .L51 movq $0, -104(%rbp) movl $0, -116(%rbp) jmp .L52 .L53: movl -148(%rbp), %eax leal 1(%rax), %edx movl -116(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -80(%rbp), %rax addq %rcx, %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax movl %eax, %esi movl $2, %edi call mod_pow movslq %eax, %rbx movl -116(%rbp), %eax movslq %eax, %rdx movq -64(%rbp), %rax movq (%rax), %rax movq %rdx, %rsi movq %rax, %rdi call get_at cltq imulq %rbx, %rax movl $1000000007, %edx movslq %edx, %rcx cqto idivq %rcx movq %rdx, %rax addq %rax, -104(%rbp) addl $1, -116(%rbp) .L52: movq -64(%rbp), %rax movq (%rax), %rax movq %rax, %rdi call get_size cmpl %eax, -116(%rbp) jl .L53 movl $1000000007, %eax movslq %eax, %rcx movq -104(%rbp), %rax cqto idivq %rcx movq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT nop movq -40(%rbp), %rax subq %fs:40, %rax je .L54 call __stack_chk_fail@PLT .L54: addq $136, %rsp popq %rbx popq %r12 popq %r13 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE18: .size run, .-run .globl main .type main, @function main: .LFB19: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 call run movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE19: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 check[a] ++;\n }\n\n int ans , flag = 0;\n for(int i = n;i < 1000000;i ++){\n int temp = i , b;\n while(temp > 0){\n b = temp%10;\n if(check[b] != 0){\n temp = 0;\n flag = 1;\n }\n temp /= 10;\n }\n if(flag == 0){\n ans = i;\n i += 10000000;\n }\n flag = 0;\n }\n\n\n printf(\"%d\\n\",ans);\n\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-80(%rbp), %rdx\n\tleaq\t-84(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -48(%rbp)\n\tmovq\t$0, -40(%rbp)\n\tmovq\t$0, -32(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-76(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-76(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-48(%rbp,%rdx,4), %edx\n\taddl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\taddl\t$1, -72(%rbp)\n.L2:\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t%eax, -72(%rbp)\n\tjl\t.L3\n\tmovl\t$0, -64(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tmovl\t%eax, -60(%rbp)\n\tjmp\t.L4\n.L9:\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, -56(%rbp)\n\tjmp\t.L5\n.L7:\n\tmovl\t-56(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tmovl\t$0, -56(%rbp)\n\tmovl\t$1, -64(%rbp)\n.L6:\n\tmovl\t-56(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -56(%rbp)\n.L5:\n\tcmpl\t$0, -56(%rbp)\n\tjg\t.L7\n\tcmpl\t$0, -64(%rbp)\n\tjne\t.L8\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, -68(%rbp)\n\taddl\t$10000000, -60(%rbp)\n.L8:\n\tmovl\t$0, -64(%rbp)\n\taddl\t$1, -60(%rbp)\n.L4:\n\tcmpl\t$999999, -60(%rbp)\n\tjle\t.L9\n\tmovl\t-68(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t8(%rsp), %rdx\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %ecx\n\tpxor\t%xmm0, %xmm0\n\tmovq\t$0, 48(%rsp)\n\tmovaps\t%xmm0, 16(%rsp)\n\tmovaps\t%xmm0, 32(%rsp)\n\ttestl\t%ecx, %ecx\n\tjle\t.L2\n\txorl\t%ebx, %ebx\n\tleaq\t12(%rsp), %r13\n\tleaq\t.LC1(%rip), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%r13, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t12(%rsp), %rax\n\taddl\t$1, 16(%rsp,%rax,4)\n\tcmpl\t%ebx, 8(%rsp)\n\tjg\t.L3\n.L2:\n\tmovl\t4(%rsp), %r8d\n\tmovl\t$3435973837, %edi\n\tcmpl\t$999999, %r8d\n\tjle\t.L4\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\taddl\t$1, %r8d\n\tcmpl\t$999999, %r8d\n\tjg\t.L5\n.L4:\n\tmovl\t%r8d, %esi\n\ttestl\t%r8d, %r8d\n\tjle\t.L8\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t%esi, %eax\n\tmovl\t%esi, %edx\n\timulq\t%rdi, %rax\n\tshrq\t$35, %rax\n\tleal\t(%rax,%rax,4), %ecx\n\taddl\t%ecx, %ecx\n\tsubl\t%ecx, %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t16(%rsp,%rdx,4), %edx\n\ttestl\t%edx, %edx\n\tjne\t.L6\n\tcmpl\t$9, %esi\n\tjle\t.L8\n\tmovl\t%eax, %esi\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t%r8d, %r12d\n\taddl\t$10000000, %r8d\n\taddl\t$1, %r8d\n\tcmpl\t$999999, %r8d\n\tjle\t.L4\n.L5:\n\txorl\t%eax, %eax\n\tmovl\t%r12d, %edx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L17\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L17:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t8(%rsp), %rdx\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %ecx\n\tpxor\t%xmm0, %xmm0\n\tmovq\t$0, 48(%rsp)\n\tmovaps\t%xmm0, 16(%rsp)\n\tmovaps\t%xmm0, 32(%rsp)\n\ttestl\t%ecx, %ecx\n\tjle\t.L2\n\txorl\t%ebx, %ebx\n\tleaq\t12(%rsp), %r13\n\tleaq\t.LC1(%rip), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%r13, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t12(%rsp), %rax\n\taddl\t$1, 16(%rsp,%rax,4)\n\tcmpl\t%ebx, 8(%rsp)\n\tjg\t.L3\n.L2:\n\tmovl\t4(%rsp), %r8d\n\tmovl\t$3435973837, %edi\n\tcmpl\t$999999, %r8d\n\tjle\t.L4\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\taddl\t$1, %r8d\n\tcmpl\t$999999, %r8d\n\tjg\t.L5\n.L4:\n\tmovl\t%r8d, %esi\n\ttestl\t%r8d, %r8d\n\tjle\t.L8\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t%esi, %eax\n\tmovl\t%esi, %edx\n\timulq\t%rdi, %rax\n\tshrq\t$35, %rax\n\tleal\t(%rax,%rax,4), %ecx\n\taddl\t%ecx, %ecx\n\tsubl\t%ecx, %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t16(%rsp,%rdx,4), %edx\n\ttestl\t%edx, %edx\n\tjne\t.L6\n\tcmpl\t$9, %esi\n\tjle\t.L8\n\tmovl\t%eax, %esi\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t%r8d, %r12d\n\taddl\t$10000000, %r8d\n\taddl\t$1, %r8d\n\tcmpl\t$999999, %r8d\n\tjle\t.L4\n.L5:\n\txorl\t%eax, %eax\n\tmovl\t%r12d, %edx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L17\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L17:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 check[a] ++;\n }\n\n int ans , flag = 0;\n for(int i = n;i < 1000000;i ++){\n int temp = i , b;\n while(temp > 0){\n b = temp%10;\n if(check[b] != 0){\n temp = 0;\n flag = 1;\n }\n temp /= 10;\n }\n if(flag == 0){\n ans = i;\n i += 10000000;\n }\n flag = 0;\n }\n\n\n printf(\"%d\\n\",ans);\n\n return 0;\n}", "index": 65, "inputs": [ "67 1\n0\n", "34 1\n0\n", "3 1\n0\n", "6 1\n0\n", "10 1\n0\n", "5 1\n0\n", "39 1\n0\n", "10 1\n1\n", "4 1\n1\n", "56 1\n0\n", "12 1\n0\n", "8 1\n0\n", "2 1\n0\n", "0 1\n-1\n", "1001 8\n1 3 4 5 6 7 8 9\n", "9999 1\n-1\n", "115 1\n0\n", "10 1\n-1\n", "7 1\n1\n", "101 1\n0\n", "1 1\n0\n", "18512 1\n0\n", "27 1\n0\n", "14 1\n-1\n", "9 1\n-1\n", "20 1\n2\n", "16 1\n-1\n", "84 1\n0\n", "24 1\n-1\n", "31 1\n-1\n", "21630 1\n0\n", "37 1\n0\n", "25 1\n1\n", "21 1\n-4\n", "28 1\n0\n", "23 1\n1\n", "41 1\n-1\n", "21630 1\n1\n", "17691 1\n2\n", "22 1\n0\n", "17 1\n-11\n", "14192 1\n0\n", "57 1\n0\n", "70 1\n0\n", "101 1\n-1\n", "18512 1\n1\n", "53 1\n1\n", "70 1\n-2\n", "20079 1\n-1\n", "41 1\n1\n", "13 1\n2\n", "123 1\n0\n", "18 1\n0\n", "26378 1\n1\n", "19727 1\n0\n", "10571 1\n2\n", "29826 1\n3\n", "29 1\n0\n", "36 1\n0\n", "18512 1\n2\n", "870 1\n-1\n" ], "outputs": [ "67\n", "34\n", "3\n", "6\n", "11\n", "5\n", "39\n", "20\n", "4\n", "56\n", "12\n", "8\n", "2\n", "0\n", "2000\n", "9999\n", "115\n", "10\n", "7\n", "111\n", "1\n", "18512\n", "27\n", "14\n", "9\n", "30\n", "16\n", "84\n", "24\n", "31\n", "21631\n", "37\n", "25\n", "21\n", "28\n", "23\n", "41\n", "22000\n", "17691\n", "22\n", "17\n", "14192\n", "57\n", "71\n", "101\n", "20000\n", "53\n", "70\n", "20079\n", "42\n", "13\n", "123\n", "18\n", "26378\n", "19727\n", "10571\n", "29826\n", "29\n", "36\n", "18513\n", "870\n" ], "question": "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 check[a] ++;\n }\n\n int ans , flag = 0;\n for(int i = n;i < 1000000;i ++){\n int temp = i , b;\n while(temp > 0){\n b = temp%10;\n if(check[b] != 0){\n temp = 0;\n flag = 1;\n }\n temp /= 10;\n }\n if(flag == 0){\n ans = i;\n i += 10000000;\n }\n flag = 0;\n }\n\n\n printf(\"%d\\n\",ans);\n\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-80(%rbp), %rdx\n\tleaq\t-84(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -48(%rbp)\n\tmovq\t$0, -40(%rbp)\n\tmovq\t$0, -32(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-76(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-76(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-48(%rbp,%rdx,4), %edx\n\taddl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\taddl\t$1, -72(%rbp)\n.L2:\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t%eax, -72(%rbp)\n\tjl\t.L3\n\tmovl\t$0, -64(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tmovl\t%eax, -60(%rbp)\n\tjmp\t.L4\n.L9:\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, -56(%rbp)\n\tjmp\t.L5\n.L7:\n\tmovl\t-56(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %edx\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tmovl\t$0, -56(%rbp)\n\tmovl\t$1, -64(%rbp)\n.L6:\n\tmovl\t-56(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -56(%rbp)\n.L5:\n\tcmpl\t$0, -56(%rbp)\n\tjg\t.L7\n\tcmpl\t$0, -64(%rbp)\n\tjne\t.L8\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, -68(%rbp)\n\taddl\t$10000000, -60(%rbp)\n.L8:\n\tmovl\t$0, -64(%rbp)\n\taddl\t$1, -60(%rbp)\n.L4:\n\tcmpl\t$999999, -60(%rbp)\n\tjle\t.L9\n\tmovl\t-68(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; for(int i = n;i < 1000000;i ++){ int temp = i , b; while(temp > 0){ b = temp%10; if(check[b] != 0){ temp = 0; flag = 1; } temp /= 10; } if(flag == 0){ ans = i; i += 10000000; } flag = 0; } printf("%d\n",ans); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "%d" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $96, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -80(%rbp), %rdx leaq -84(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq $0, -48(%rbp) movq $0, -40(%rbp) movq $0, -32(%rbp) movq $0, -24(%rbp) movq $0, -16(%rbp) movl $0, -72(%rbp) jmp .L2 .L3: leaq -76(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -76(%rbp), %eax movslq %eax, %rdx movl -48(%rbp,%rdx,4), %edx addl $1, %edx cltq movl %edx, -48(%rbp,%rax,4) addl $1, -72(%rbp) .L2: movl -80(%rbp), %eax cmpl %eax, -72(%rbp) jl .L3 movl $0, -64(%rbp) movl -84(%rbp), %eax movl %eax, -60(%rbp) jmp .L4 .L9: movl -60(%rbp), %eax movl %eax, -56(%rbp) jmp .L5 .L7: movl -56(%rbp), %edx movslq %edx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax subl %eax, %edx movl %edx, -52(%rbp) movl -52(%rbp), %eax cltq movl -48(%rbp,%rax,4), %eax testl %eax, %eax je .L6 movl $0, -56(%rbp) movl $1, -64(%rbp) .L6: movl -56(%rbp), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -56(%rbp) .L5: cmpl $0, -56(%rbp) jg .L7 cmpl $0, -64(%rbp) jne .L8 movl -60(%rbp), %eax movl %eax, -68(%rbp) addl $10000000, -60(%rbp) .L8: movl $0, -64(%rbp) addl $1, -60(%rbp) .L4: cmpl $999999, -60(%rbp) jle .L9 movl -68(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L11 call __stack_chk_fail@PLT .L11: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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\ntypedef struct node * NodePointer;\n\nNodePointer nil;\n\nvoid init(){\n nil = malloc(sizeof(struct node));\n nil->next = nil;\n nil->prev = nil;\n}\n\n\n\n\nvoid printList(){\n NodePointer cur = nil->next;\n int isf = 1;\n while(1){\n if ( cur == nil ) break;\n if ( isf == 0) printf(\" \");\n printf(\"%d\", cur->key);\n cur = cur->next;\n isf = 0;\n }\n printf(\"\\n\");\n}\n\nvoid deleteNode(NodePointer t){\n /* your code */\n t->next->prev = t->prev;\n t->prev->next = t->next;\n}\n\nvoid deleteFirst(){\n NodePointer t = nil->next;\n if ( t != nil ) deleteNode(t);\n}\n\nvoid deleteLast(){\n NodePointer t = nil->prev;\n /* your code */\n if(t!=nil)deleteNode(t);\n\n}\n\nvoid delete(int key){\n /* your code */\n NodePointer del = nil->next;\n while(1){\n if(del->key == key){\n deleteNode(del);\n break;\n }\n del = del->next;\n if(del == nil->next)return;\n }\n}\n\n\nvoid insert(int key){\n NodePointer x;\n x = malloc(sizeof(struct node));\n x->key = key;\n\n x->prev = nil;\n x->next = nil->next;\n nil->next->prev =x;\n nil->next = x;\n /* \n\n your code \n\n\n */\n\n}\n\nint main(){\n int key, n, i;\n char com[20];\n\n scanf(\"%d\", &n);\n init();\n for ( i = 0; i < n; i++ ){\n scanf(\"%s%d\", com, &key);\n if ( com[0] == 'i' ) insert(key);\n else if ( com[0] == 'd' ) {\n if (strlen(com) > 6){\n\tif ( com[6] == 'F' ) deleteFirst();\n\telse if ( com[6] == 'L' ) deleteLast();\n }\n else delete(key); \n }\n }\n\n printList();\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tnil\n\t.bss\n\t.align 8\n\t.type\tnil, @object\n\t.size\tnil, 8\nnil:\n\t.zero\t8\n\t.text\n\t.globl\tinit\n\t.type\tinit, @function\ninit:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, nil(%rip)\n\tmovq\tnil(%rip), %rax\n\tmovq\tnil(%rip), %rdx\n\tmovq\t%rdx, 8(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\tnil(%rip), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tinit, .-init\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tprintList\n\t.type\tprintList, @function\nprintList:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$1, -12(%rbp)\n.L6:\n\tmovq\tnil(%rip), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L8\n\tcmpl\t$0, -12(%rbp)\n\tjne\t.L5\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L5:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L6\n.L8:\n\tnop\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tprintList, .-printList\n\t.globl\tdeleteNode\n\t.type\tdeleteNode, @function\ndeleteNode:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t16(%rdx), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t8(%rdx), %rdx\n\tmovq\t%rdx, 8(%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tdeleteNode, .-deleteNode\n\t.globl\tdeleteFirst\n\t.type\tdeleteFirst, @function\ndeleteFirst:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\tnil(%rip), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L12\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeleteNode\n.L12:\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tdeleteFirst, .-deleteFirst\n\t.globl\tdeleteLast\n\t.type\tdeleteLast, @function\ndeleteLast:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\tnil(%rip), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\tnil(%rip), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L15\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeleteNode\n.L15:\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tdeleteLast, .-deleteLast\n\t.globl\tdelete\n\t.type\tdelete, @function\ndelete:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n.L20:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjne\t.L17\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeleteNode\n\tjmp\t.L16\n.L17:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L21\n\tjmp\t.L20\n.L21:\n\tnop\n.L16:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tdelete, .-delete\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-20(%rbp), %edx\n\tmovl\t%edx, (%rax)\n\tmovq\tnil(%rip), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, 8(%rax)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tinsert, .-insert\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%s%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-40(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, %eax\n\tcall\tinit\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L24\n.L29:\n\tleaq\t-44(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t-32(%rbp), %eax\n\tcmpb\t$105, %al\n\tjne\t.L25\n\tmovl\t-44(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tinsert\n\tjmp\t.L26\n.L25:\n\tmovzbl\t-32(%rbp), %eax\n\tcmpb\t$100, %al\n\tjne\t.L26\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t$6, %rax\n\tjbe\t.L27\n\tmovzbl\t-26(%rbp), %eax\n\tcmpb\t$70, %al\n\tjne\t.L28\n\tmovl\t$0, %eax\n\tcall\tdeleteFirst\n\tjmp\t.L26\n.L28:\n\tmovzbl\t-26(%rbp), %eax\n\tcmpb\t$76, %al\n\tjne\t.L26\n\tmovl\t$0, %eax\n\tcall\tdeleteLast\n\tjmp\t.L26\n.L27:\n\tmovl\t-44(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tdelete\n.L26:\n\taddl\t$1, -36(%rbp)\n.L24:\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t%eax, -36(%rbp)\n\tjl\t.L29\n\tmovl\t$0, %eax\n\tcall\tprintList\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L31\n\tcall\t__stack_chk_fail@PLT\n.L31:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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%xmm0, 8(%rax)\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tinit, .-init\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.p2align 4\n\t.globl\tprintList\n\t.type\tprintList, @function\nprintList:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rbx\n\tcmpq\t%rbx, %rax\n\tje\t.L6\n.L5:\n\tmovl\t(%rbx), %edx\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rbx), %rbx\n\tcmpq\tnil(%rip), %rbx\n\tje\t.L6\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %edi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\tputchar@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tprintList, .-printList\n\t.p2align 4\n\t.globl\tdeleteNode\n\t.type\tdeleteNode, @function\ndeleteNode:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tdeleteNode, .-deleteNode\n\t.p2align 4\n\t.globl\tdeleteFirst\n\t.type\tdeleteFirst, @function\ndeleteFirst:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tnil(%rip), %rdx\n\tmovq\t8(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L14\n\tmovq\t8(%rax), %rdx\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n.L14:\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tdeleteFirst, .-deleteFirst\n\t.p2align 4\n\t.globl\tdeleteLast\n\t.type\tdeleteLast, @function\ndeleteLast:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tnil(%rip), %rdx\n\tmovq\t16(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L16\n\tmovq\t8(%rax), %rdx\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n.L16:\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tdeleteLast, .-deleteLast\n\t.p2align 4\n\t.globl\tdelete\n\t.type\tdelete, @function\ndelete:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tjmp\t.L21\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\tcmpq\t%rcx, %rax\n\tje\t.L23\n.L21:\n\tmovl\t(%rax), %edx\n\tmovq\t%rax, %rsi\n\tmovq\t8(%rax), %rax\n\tcmpl\t%edi, %edx\n\tjne\t.L19\n\tmovq\t16(%rsi), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t%rax, 8(%rdx)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L23:\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tdelete, .-delete\n\t.p2align 4\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tmovl\t%edi, %ebx\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\tnil(%rip), %rdx\n\tmovl\t%ebx, (%rax)\n\tmovq\t8(%rdx), %xmm0\n\tmovq\t%rdx, %xmm1\n\tpunpcklqdq\t%xmm1, %xmm0\n\tmovups\t%xmm0, 8(%rax)\n\tmovq\t8(%rdx), %rcx\n\tmovq\t%rax, 16(%rcx)\n\tmovq\t%rax, 8(%rdx)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tinsert, .-insert\n\t.section\t.rodata.str1.1\n.LC1:\n\t.string\t\"%s%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$48, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\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, 8(%rax)\n\tmovl\t12(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L34\n\txorl\t%ebx, %ebx\n\tleaq\t8(%rsp), %r13\n\tleaq\t16(%rsp), %rbp\n\tleaq\t.LC1(%rip), %r12\n\tjmp\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\taddl\t$1, %ebx\n\tcmpl\t%ebx, 12(%rsp)\n\tjle\t.L34\n.L27:\n\tmovq\t%r13, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t16(%rsp), %eax\n\tcmpb\t$105, %al\n\tje\t.L42\n\tcmpb\t$100, %al\n\tjne\t.L29\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t$6, %rax\n\tjbe\t.L30\n\tmovzbl\t22(%rsp), %eax\n\tcmpb\t$70, %al\n\tje\t.L43\n\tcmpb\t$76, %al\n\tjne\t.L29\n\tmovq\tnil(%rip), %rdx\n\tmovq\t16(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L29\n.L41:\n\tmovq\t8(%rax), %rdx\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n\tjmp\t.L29\n\t.p2align 4,,10\n\t.p2align 3\n.L42:\n\tmovl\t$24, %edi\n\tmovl\t8(%rsp), %r14d\n\taddl\t$1, %ebx\n\tcall\tmalloc@PLT\n\tmovq\tnil(%rip), %rdx\n\tmovl\t%r14d, (%rax)\n\tmovq\t8(%rdx), %xmm0\n\tmovq\t%rdx, %xmm1\n\tpunpcklqdq\t%xmm1, %xmm0\n\tmovups\t%xmm0, 8(%rax)\n\tmovq\t8(%rdx), %rcx\n\tmovq\t%rax, 16(%rcx)\n\tmovq\t%rax, 8(%rdx)\n\tcmpl\t%ebx, 12(%rsp)\n\tjg\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\txorl\t%eax, %eax\n\tcall\tprintList\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L44\n\taddq\t$48, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L30:\n\t.cfi_restore_state\n\tmovq\tnil(%rip), %rax\n\tmovl\t8(%rsp), %esi\n\tmovq\t8(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tcmpq\t%rcx, %rax\n\tje\t.L29\n.L33:\n\tmovl\t(%rax), %edx\n\tmovq\t%rax, %rdi\n\tmovq\t8(%rax), %rax\n\tcmpl\t%edx, %esi\n\tjne\t.L32\n\tmovq\t16(%rdi), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t%rax, 8(%rdx)\n\tjmp\t.L29\n.L43:\n\tmovq\tnil(%rip), %rdx\n\tmovq\t8(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L41\n\tjmp\t.L29\n.L44:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE58:\n\t.size\tmain, .-main\n\t.globl\tnil\n\t.bss\n\t.align 8\n\t.type\tnil, @object\n\t.size\tnil, 8\nnil:\n\t.zero\t8\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, 8(%rax)\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tinit, .-init\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.p2align 4\n\t.globl\tprintList\n\t.type\tprintList, @function\nprintList:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rbx\n\tcmpq\t%rbx, %rax\n\tje\t.L6\n.L5:\n\tmovl\t(%rbx), %edx\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rbx), %rbx\n\tcmpq\tnil(%rip), %rbx\n\tje\t.L6\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %edi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\tputchar@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tprintList, .-printList\n\t.p2align 4\n\t.globl\tdeleteNode\n\t.type\tdeleteNode, @function\ndeleteNode:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tdeleteNode, .-deleteNode\n\t.p2align 4\n\t.globl\tdeleteFirst\n\t.type\tdeleteFirst, @function\ndeleteFirst:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tnil(%rip), %rdx\n\tmovq\t8(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L14\n\tmovq\t8(%rax), %rdx\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n.L14:\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tdeleteFirst, .-deleteFirst\n\t.p2align 4\n\t.globl\tdeleteLast\n\t.type\tdeleteLast, @function\ndeleteLast:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tnil(%rip), %rdx\n\tmovq\t16(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L16\n\tmovq\t8(%rax), %rdx\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n.L16:\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tdeleteLast, .-deleteLast\n\t.p2align 4\n\t.globl\tdelete\n\t.type\tdelete, @function\ndelete:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tjmp\t.L21\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\tcmpq\t%rcx, %rax\n\tje\t.L23\n.L21:\n\tmovl\t(%rax), %edx\n\tmovq\t%rax, %rsi\n\tmovq\t8(%rax), %rax\n\tcmpl\t%edi, %edx\n\tjne\t.L19\n\tmovq\t16(%rsi), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t%rax, 8(%rdx)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L23:\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tdelete, .-delete\n\t.p2align 4\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tmovl\t%edi, %ebx\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\tnil(%rip), %rdx\n\tmovl\t%ebx, (%rax)\n\tmovq\t8(%rdx), %xmm0\n\tmovq\t%rdx, %xmm1\n\tpunpcklqdq\t%xmm1, %xmm0\n\tmovups\t%xmm0, 8(%rax)\n\tmovq\t8(%rdx), %rcx\n\tmovq\t%rax, 16(%rcx)\n\tmovq\t%rax, 8(%rdx)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tinsert, .-insert\n\t.section\t.rodata.str1.1\n.LC1:\n\t.string\t\"%s%d\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$48, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\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, 8(%rax)\n\tmovl\t12(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L34\n\txorl\t%ebx, %ebx\n\tleaq\t8(%rsp), %r13\n\tleaq\t16(%rsp), %rbp\n\tleaq\t.LC1(%rip), %r12\n\tjmp\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\taddl\t$1, %ebx\n\tcmpl\t%ebx, 12(%rsp)\n\tjle\t.L34\n.L27:\n\tmovq\t%r13, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t16(%rsp), %eax\n\tcmpb\t$105, %al\n\tje\t.L42\n\tcmpb\t$100, %al\n\tjne\t.L29\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t$6, %rax\n\tjbe\t.L30\n\tmovzbl\t22(%rsp), %eax\n\tcmpb\t$70, %al\n\tje\t.L43\n\tcmpb\t$76, %al\n\tjne\t.L29\n\tmovq\tnil(%rip), %rdx\n\tmovq\t16(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tje\t.L29\n.L41:\n\tmovq\t8(%rax), %rdx\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t%rdx, 8(%rax)\n\tjmp\t.L29\n\t.p2align 4,,10\n\t.p2align 3\n.L42:\n\tmovl\t$24, %edi\n\tmovl\t8(%rsp), %r14d\n\taddl\t$1, %ebx\n\tcall\tmalloc@PLT\n\tmovq\tnil(%rip), %rdx\n\tmovl\t%r14d, (%rax)\n\tmovq\t8(%rdx), %xmm0\n\tmovq\t%rdx, %xmm1\n\tpunpcklqdq\t%xmm1, %xmm0\n\tmovups\t%xmm0, 8(%rax)\n\tmovq\t8(%rdx), %rcx\n\tmovq\t%rax, 16(%rcx)\n\tmovq\t%rax, 8(%rdx)\n\tcmpl\t%ebx, 12(%rsp)\n\tjg\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\txorl\t%eax, %eax\n\tcall\tprintList\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L44\n\taddq\t$48, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L30:\n\t.cfi_restore_state\n\tmovq\tnil(%rip), %rax\n\tmovl\t8(%rsp), %esi\n\tmovq\t8(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tcmpq\t%rcx, %rax\n\tje\t.L29\n.L33:\n\tmovl\t(%rax), %edx\n\tmovq\t%rax, %rdi\n\tmovq\t8(%rax), %rax\n\tcmpl\t%edx, %esi\n\tjne\t.L32\n\tmovq\t16(%rdi), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t%rax, 8(%rdx)\n\tjmp\t.L29\n.L43:\n\tmovq\tnil(%rip), %rdx\n\tmovq\t8(%rdx), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L41\n\tjmp\t.L29\n.L44:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE58:\n\t.size\tmain, .-main\n\t.globl\tnil\n\t.bss\n\t.align 8\n\t.type\tnil, @object\n\t.size\tnil, 8\nnil:\n\t.zero\t8\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\ntypedef struct node * NodePointer;\n\nNodePointer nil;\n\nvoid init(){\n nil = malloc(sizeof(struct node));\n nil->next = nil;\n nil->prev = nil;\n}\n\n\n\n\nvoid printList(){\n NodePointer cur = nil->next;\n int isf = 1;\n while(1){\n if ( cur == nil ) break;\n if ( isf == 0) printf(\" \");\n printf(\"%d\", cur->key);\n cur = cur->next;\n isf = 0;\n }\n printf(\"\\n\");\n}\n\nvoid deleteNode(NodePointer t){\n /* your code */\n t->next->prev = t->prev;\n t->prev->next = t->next;\n}\n\nvoid deleteFirst(){\n NodePointer t = nil->next;\n if ( t != nil ) deleteNode(t);\n}\n\nvoid deleteLast(){\n NodePointer t = nil->prev;\n /* your code */\n if(t!=nil)deleteNode(t);\n\n}\n\nvoid delete(int key){\n /* your code */\n NodePointer del = nil->next;\n while(1){\n if(del->key == key){\n deleteNode(del);\n break;\n }\n del = del->next;\n if(del == nil->next)return;\n }\n}\n\n\nvoid insert(int key){\n NodePointer x;\n x = malloc(sizeof(struct node));\n x->key = key;\n\n x->prev = nil;\n x->next = nil->next;\n nil->next->prev =x;\n nil->next = x;\n /* \n\n your code \n\n\n */\n\n}\n\nint main(){\n int key, n, i;\n char com[20];\n\n scanf(\"%d\", &n);\n init();\n for ( i = 0; i < n; i++ ){\n scanf(\"%s%d\", com, &key);\n if ( com[0] == 'i' ) insert(key);\n else if ( com[0] == 'd' ) {\n if (strlen(com) > 6){\n\tif ( com[6] == 'F' ) deleteFirst();\n\telse if ( com[6] == 'L' ) deleteLast();\n }\n else delete(key); \n }\n }\n\n printList();\n return 0;\n}\n\n", "index": 63, "inputs": [ "7\ntresni 5\ninsert 2\ninsert 3\ninsert 1\ndelete 3\ninsert 6\ndelete 5\n", "7\ntresni 5\ninsert 2\ninsert 3\ninsert 2\ndelete 3\ninsert 6\ndelete 5\n", "7\ntretni 5\ninsert 2\ninsers 3\ninsert 2\ndelete 3\ntresni 6\ndelete 5\n", "9\ninsert 10\ninsert 2\ninsert 3\ninsert 1\ndelete 3\ninsert 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "7\ntresni 5\ninsert 2\ninsert 3\ninsert 0\ndelete 3\ninsert 6\ndelete 5\n", "9\ninsert 10\ninsert 2\ninsert 3\ninsert 0\ndelete 3\ninsert 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "7\ntresni 6\ninsert 2\ninsert 3\ninsert 0\ndelete 3\ninsert 3\ndelete 5\n", "9\ninsert 19\ninsert 2\ninsert 3\ninsert 0\ndelete 3\ntresni 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "7\ntresni 6\ntresni 2\ntresni 3\ninsert 0\ndelete 1\ntresni 3\ndelete 5\n", "7\ninsert 5\ninsert 4\ninsert 3\ninsert 1\ndelete 3\ninsert 6\ndelete 5\n", "7\ntresni 5\ninsert 2\ninsert 3\ninsert 1\ndelete 5\ninsert 6\ndelete 5\n", "7\ntresni 5\ninsert 2\ninsert 3\ninsert 2\ndelete 3\ninsert 1\ndelete 5\n", "9\ntresni 10\ninsert 2\ninsert 3\ninsert 1\ndelete 3\ninsert 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "9\ninsert 19\ninsert 3\ninsert 3\ninsert 0\ndelete 3\ninsert 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "7\ntresni 6\ntresni 2\ninsert 3\ninsert 0\ndelete 3\ninsert 3\ndelete 5\n", "7\ntresni 5\ninsert 2\ninsert 3\ntresni 1\ndelete 5\ninsert 6\ndelete 5\n", "7\ntresni 5\ninsert 3\ninsert 3\ninsert 0\ndelete 3\ninsert 6\ndelese 5\n", "9\ninsert 19\ninsert -1\ntresni 3\ninsert 0\ndelete 3\ntretni 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "7\nnresti 5\ninsert 4\ninsers 3\ninsert 2\ndelete 3\ninsert 6\nedleue 5\n", "7\nnresti 5\ninsert 4\ninsers 3\ninsert 2\ndelete 3\ninsert 5\nedleue 7\n", "7\ninsert 10\ntresni 1\ninsert 3\ninsert 0\ndelete 3\ninsert 3\netedel 9\n", "7\ntresni 5\ntresni 2\ninsert 3\ninsert 1\ndelete 3\ninsert 6\ndelete 5\n", "7\nnresti 5\ninsert 2\ninsers 3\ninsert 2\ndelete 3\ninsert 10\ndelete 5\n", "7\ninsert 6\ninsert 2\ninsert 3\ninsert 0\ndelete 3\ninsert 6\ndelete 5\n", "9\ninsert 19\ninsert 2\ninsert 2\ninsert 0\ndelete 3\ninsert 6\ndelete 5\ndeleteFirst\ndeleteLast\n", "7\ntresoi 5\ntresni 2\ninsers 3\ninsert 2\ndelete 3\ninsert 6\ndekete 5\n", "7\ntresni 6\ntresni 1\ninsert 3\ninsert 1\ndelete 3\ninsert 3\neteled 5\n", "7\ntresni 10\ntresni 1\ninsert 3\ninsert 0\ndelete 0\ninsert 3\neteled 5\n", "7\ntresni 10\ntresni 1\ninsert 3\ninsert 0\ndelete 5\ninsert 3\neteled 9\n", "7\ninsert 10\ntresni 1\ninsert 3\ninsert 0\ndelete 3\ninsert 0\netedel 9\n", "7\ninsert 10\ntrfsni 1\ninsdrt 3\ninsert 1\ndleete 3\ninsert 3\netedel 9\n", "7\ntresni 5\ninsert 2\ninsert 1\ninsert 1\ndelete 5\ninsert 6\ndeleue 5\n", "7\ntresni 5\ninsert 0\ninsert 3\ntresni 1\nddlete 5\ninsert 6\ndelete 5\n", "7\ntresni 6\ninsert 1\ninsert 3\ninsert 1\ndelete 3\ninsert 3\neteled 5\n", "7\nnrestj 5\ninsert 4\ninsers 3\ntresni 2\ndelete 3\ninsert 5\nedleue 7\n", "7\ninsert 6\ntresni 1\ninscrt 3\ninsert 0\ndleete 3\ninsert 3\netedel 9\n", "7\ntresni 5\ninsert 2\ninsert 2\ninsert 1\ndelete 5\ninsert 6\ndeleue 5\n", "7\ntresoi 5\ninsert 2\ninsers 5\ninsert 2\neteled 3\ninsert 9\ndelete 5\n", "7\ntretni 5\ninsert 4\nisseqn 3\ntresni 2\ndelete 3\ninsert 6\ndelete 5\n", "7\ntresni 5\ninsert 0\ninsert 3\ntresni 1\nddlete 5\ninsert 10\ndelete 5\n", "7\ninsert 4\ntresni 2\ninsers 3\ninsert 0\ndelete 3\ninsert 3\neeletd 5\n", "9\ninsert 11\njnsert 3\ninsert 5\ninsert 0\ndelete 3\ninsert 6\ndelete 4\ndeleteFirst\ndeleteLast\n", "7\ntresni 5\ninsert 2\ninsert 4\ninsert 1\ndelete 4\ninsert 9\ndelete 8\n", "7\ninsert 15\ntresnj 0\ntresni 3\ninsert 0\ndeldte 1\nnresti 3\ndelete 7\n", "7\ninsert -1\ntioser 0\ntresni 3\ninsert 0\ndelete 1\ntresni 2\ndelete 5\n", "7\ntresni 5\ninsert 3\ninsert 4\ninsert 1\ndelete 4\ninsert 9\ndelete 8\n", "7\ninsert 24\ntresnj 0\ntresni 3\ninsert 0\ndeldte 1\nnresti 3\ndelete 7\n", "7\ninsert 36\ntresnj 0\ntresni 3\ninsert 0\ndeldte 1\nnresti 3\ndelete 7\n", "7\ntresni 4\ninsert 3\ninsert 4\ninsert 1\ndelete 5\ninsert 9\ndelete 8\n", "7\ntresni 4\ninsert 3\ninsert 4\ninsert 1\ndelete 5\ninsert 3\neeldte 8\n", "7\ntresni 6\ninsert 2\ninsert 4\ninsert 0\ndelete 3\ninsert 6\ndelete 5\n", "7\ntresni 6\ninsert 2\ninsert 3\ninsert 1\ndelete 3\ninsert 3\ndelete 5\n", "7\ntresni 6\ninsert 1\ntresni 3\ninsert 0\ndelete 3\ninsert 3\ndelete 5\n", "7\ntresni 5\ninsert 2\ninsert 3\ninsert 2\ndelete 5\ninsert 6\ndelete 5\n", "7\ntresni 6\ninsert 2\ntresni 3\ninsert -1\ndeleet 1\ntresni 3\ndelete 5\n", "7\nnresti 5\ninsert 2\ninsers 3\ninsert 2\ndflete 3\ninsert 12\ndelese 7\n", "9\ninsert 19\ninsert 3\ninsert 3\ninsert 0\ndelete 6\ninsert 6\ndeldte 5\ndeleteFirst\ndeleteLast\n", "7\ntresni 6\ninsert 2\ninsert 3\ntresni 0\ndelete 3\ninsert 3\neteled 5\n", "7\ntretni 5\ninsert 1\ninseqs 3\ninsert 1\ndelete 3\ninsert 6\ndelete 5\n", "7\ninsert 10\ntresni 1\ninsert 5\ninsert 0\ndelete 3\ninsert 3\netedel 9\n", "7\ninsert 10\ntresni 1\ninsdrt 3\ninsert 0\ndleete 3\ntresni 3\netedel 9\n", "9\ninsert 10\ninsert 2\ninsert 4\ninsert 1\ndelete 3\ninsert 6\ndeletd 5\ndeleteFirst\ndeleteLast\n", "7\ninsert 5\ninsert 4\nnisert 3\ninsert 1\ndelete 3\ninsert 6\ndelete 4\n", "7\ntresni 5\ninsert 2\ninsert 4\ninsert 1\ndelete 5\ninsert 6\ndeleue 5\n", "7\ntresoi 5\ninsert 2\ninsers 5\ninsert 2\ndelete 3\ninsert 2\ndelete 5\n", "7\nnresti 5\ninsert 1\nnisers 3\ninsert 2\ndelete 3\ninsert 6\nedleue 5\n", "7\ninsert 10\ntrfsni 1\ninsdrt 3\ninsert 1\ndleete 3\ninsert 1\netedel 9\n", "7\ninsert 5\ninsert 4\nintert 3\ninsert 0\ndelete 3\ninsert 6\ndelete 5\n", "7\ninsert 6\ninsert 2\ninsert 3\ninsert 1\ndelete 3\ninsert 6\neteled 5\n", "9\ninsert 11\ninsert 3\ninsert 3\ntresni 0\ndelete 3\ninsert 6\ndelete 4\ndeleteFirst\ndeleteLast\n", "7\nmretti 5\ninsert 4\ninsers 3\ninsert 0\ncelete 3\ninsert 5\nedleue 7\n", "7\ntretni 5\ninsert 4\nisseqn 3\ntresni 2\ndelete 3\ninsert 7\ndelete 5\n", "7\ntresni 5\ninsert 0\ninsert 0\ntresni 1\nddlete 5\ninsert 10\ndelete 5\n", "7\ntresni 5\ntresni 0\ninsert 3\ntresni 1\nddeetl 5\ninsert 10\ndelete 5\n", "7\ntrdsni 5\ntresni 1\ninsert 3\ninsert 0\neteled 5\ninsert 0\neteled 9\n", "7\ntresni 2\ninsert 0\ninsert 3\ninsert 0\ndelete 0\ninsert 3\neteled 2\n", "7\ninsert 18\ntresnj 0\ntresni 3\ninsert 0\ndeldte 1\nnresti 3\ndelete 7\n", "7\ntrdsni 5\ntrfsoi 2\ninsert 3\ninsert 0\neteled 5\ninsert 5\neteled 9\n", "7\ntresni 4\ninsert 3\ninsert 4\ntresni 1\ndelete 4\ninsert 9\ndelete 8\n", "7\ninsert -2\ntioser 0\ntresni 0\ninsert 0\ndelete 1\ntresni 2\ndelete 4\n", "7\ntrdsni 5\ntrfsoi 2\ninsert 3\ninsert 0\neteled 5\ninsert 1\ndelete 9\n", "7\ntnesri 5\ninsert 2\nnisert 3\ninsert 4\neselfd 3\ninsert 6\nddlete 5\n", "7\ntresni 4\ninsert 3\ninsert 1\ninsert 1\ndelete 5\ninsert 9\neeldte 8\n", "7\ntresni 6\ninsert 2\ninsert 4\ninsert 0\ndelete 3\ninsert 6\ndelete 6\n" ], "outputs": [ "6 1 2\n", "6 2 2\n", "2 2\n", "1 2\n", "6 0 2\n", "0 2\n", "3 0 2\n", "2\n", "0\n", "6 1 4\n", "6 1 3 2\n", "1 2 2\n", "1\n", "0 3\n", "3 0\n", "6 3 2\n", "6 0 3\n", "-1\n", "6 2 4\n", "5 2 4\n", "3 0 10\n", "6 1\n", "10 2 2\n", "6 0 2 6\n", "0 2 2\n", "6 2\n", "3 1\n", "3 3\n", "3 0 3\n", "0 0 10\n", "3 1 10\n", "6 1 1 2\n", "6 3 0\n", "3 1 1\n", "5 4\n", "3 0 6\n", "6 1 2 2\n", "9 2 2\n", "6 4\n", "10 3 0\n", "3 0 4\n", "0 5\n", "9 1 2\n", "0 15\n", "0 -1\n", "9 1 3\n", "0 24\n", "0 36\n", "9 1 4 3\n", "3 1 4 3\n", "6 0 4 2\n", "3 1 2\n", "3 0 1\n", "6 2 3 2\n", "-1 2\n", "12 2 2\n", "0 3 3\n", "3 2\n", "6 1 1\n", "3 0 5 10\n", "0 10\n", "1 4 2\n", "6 1 5\n", "6 1 4 2\n", "2 2 2\n", "6 2 1\n", "1 1 10\n", "6 0 4\n", "6 1 2 6\n", "3\n", "5 0 3 4\n", "7 4\n", "10 0 0\n", "10 3\n", "0 0 3\n", "3 3 0\n", "0 18\n", "5 0 3\n", "9 3\n", "0 -2\n", "1 0 3\n", "6 4 2\n", "9 1 1 3\n", "0 4 2\n" ], "question": "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\ntypedef struct node * NodePointer;\n\nNodePointer nil;\n\nvoid init(){\n nil = malloc(sizeof(struct node));\n nil->next = nil;\n nil->prev = nil;\n}\n\n\n\n\nvoid printList(){\n NodePointer cur = nil->next;\n int isf = 1;\n while(1){\n if ( cur == nil ) break;\n if ( isf == 0) printf(\" \");\n printf(\"%d\", cur->key);\n cur = cur->next;\n isf = 0;\n }\n printf(\"\\n\");\n}\n\nvoid deleteNode(NodePointer t){\n /* your code */\n t->next->prev = t->prev;\n t->prev->next = t->next;\n}\n\nvoid deleteFirst(){\n NodePointer t = nil->next;\n if ( t != nil ) deleteNode(t);\n}\n\nvoid deleteLast(){\n NodePointer t = nil->prev;\n /* your code */\n if(t!=nil)deleteNode(t);\n\n}\n\nvoid delete(int key){\n /* your code */\n NodePointer del = nil->next;\n while(1){\n if(del->key == key){\n deleteNode(del);\n break;\n }\n del = del->next;\n if(del == nil->next)return;\n }\n}\n\n\nvoid insert(int key){\n NodePointer x;\n x = malloc(sizeof(struct node));\n x->key = key;\n\n x->prev = nil;\n x->next = nil->next;\n nil->next->prev =x;\n nil->next = x;\n /* \n\n your code \n\n\n */\n\n}\n\nint main(){\n int key, n, i;\n char com[20];\n\n scanf(\"%d\", &n);\n init();\n for ( i = 0; i < n; i++ ){\n scanf(\"%s%d\", com, &key);\n if ( com[0] == 'i' ) insert(key);\n else if ( com[0] == 'd' ) {\n if (strlen(com) > 6){\n\tif ( com[6] == 'F' ) deleteFirst();\n\telse if ( com[6] == 'L' ) deleteLast();\n }\n else delete(key); \n }\n }\n\n printList();\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tnil\n\t.bss\n\t.align 8\n\t.type\tnil, @object\n\t.size\tnil, 8\nnil:\n\t.zero\t8\n\t.text\n\t.globl\tinit\n\t.type\tinit, @function\ninit:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, nil(%rip)\n\tmovq\tnil(%rip), %rax\n\tmovq\tnil(%rip), %rdx\n\tmovq\t%rdx, 8(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\tnil(%rip), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tinit, .-init\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tprintList\n\t.type\tprintList, @function\nprintList:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$1, -12(%rbp)\n.L6:\n\tmovq\tnil(%rip), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L8\n\tcmpl\t$0, -12(%rbp)\n\tjne\t.L5\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L5:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L6\n.L8:\n\tnop\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tprintList, .-printList\n\t.globl\tdeleteNode\n\t.type\tdeleteNode, @function\ndeleteNode:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t16(%rdx), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t8(%rdx), %rdx\n\tmovq\t%rdx, 8(%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tdeleteNode, .-deleteNode\n\t.globl\tdeleteFirst\n\t.type\tdeleteFirst, @function\ndeleteFirst:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\tnil(%rip), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L12\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeleteNode\n.L12:\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tdeleteFirst, .-deleteFirst\n\t.globl\tdeleteLast\n\t.type\tdeleteLast, @function\ndeleteLast:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\tnil(%rip), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\tnil(%rip), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L15\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeleteNode\n.L15:\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tdeleteLast, .-deleteLast\n\t.globl\tdelete\n\t.type\tdelete, @function\ndelete:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n.L20:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjne\t.L17\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tdeleteNode\n\tjmp\t.L16\n.L17:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tcmpq\t%rax, -8(%rbp)\n\tje\t.L21\n\tjmp\t.L20\n.L21:\n\tnop\n.L16:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tdelete, .-delete\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$24, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-20(%rbp), %edx\n\tmovl\t%edx, (%rax)\n\tmovq\tnil(%rip), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, 16(%rax)\n\tmovq\tnil(%rip), %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, 8(%rax)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tinsert, .-insert\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%s%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-40(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, %eax\n\tcall\tinit\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L24\n.L29:\n\tleaq\t-44(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t-32(%rbp), %eax\n\tcmpb\t$105, %al\n\tjne\t.L25\n\tmovl\t-44(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tinsert\n\tjmp\t.L26\n.L25:\n\tmovzbl\t-32(%rbp), %eax\n\tcmpb\t$100, %al\n\tjne\t.L26\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tcmpq\t$6, %rax\n\tjbe\t.L27\n\tmovzbl\t-26(%rbp), %eax\n\tcmpb\t$70, %al\n\tjne\t.L28\n\tmovl\t$0, %eax\n\tcall\tdeleteFirst\n\tjmp\t.L26\n.L28:\n\tmovzbl\t-26(%rbp), %eax\n\tcmpb\t$76, %al\n\tjne\t.L26\n\tmovl\t$0, %eax\n\tcall\tdeleteLast\n\tjmp\t.L26\n.L27:\n\tmovl\t-44(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tdelete\n.L26:\n\taddl\t$1, -36(%rbp)\n.L24:\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t%eax, -36(%rbp)\n\tjl\t.L29\n\tmovl\t$0, %eax\n\tcall\tprintList\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L31\n\tcall\t__stack_chk_fail@PLT\n.L31:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; NodePointer nil; void init(){ nil = malloc(sizeof(struct node)); nil->next = nil; nil->prev = nil; } void printList(){ NodePointer cur = nil->next; int isf = 1; while(1){ if ( cur == nil ) break; if ( isf == 0) printf(" "); printf("%d", cur->key); cur = cur->next; isf = 0; } printf("\n"); } void deleteNode(NodePointer t){ /* your code */ t->next->prev = t->prev; t->prev->next = t->next; } void deleteFirst(){ NodePointer t = nil->next; if ( t != nil ) deleteNode(t); } void deleteLast(){ NodePointer t = nil->prev; /* your code */ if(t!=nil)deleteNode(t); } void delete(int key){ /* your code */ NodePointer del = nil->next; while(1){ if(del->key == key){ deleteNode(del); break; } del = del->next; if(del == nil->next)return; } } void insert(int key){ NodePointer x; x = malloc(sizeof(struct node)); x->key = key; x->prev = nil; x->next = nil->next; nil->next->prev =x; nil->next = x; /* your code */ } int main(){ int key, n, i; char com[20]; scanf("%d", &n); init(); for ( i = 0; i < n; i++ ){ scanf("%s%d", com, &key); if ( com[0] == 'i' ) insert(key); else if ( com[0] == 'd' ) { if (strlen(com) > 6){ if ( com[6] == 'F' ) deleteFirst(); else if ( com[6] == 'L' ) deleteLast(); } else delete(key); } } printList(); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl nil .bss .align 8 .type nil, @object .size nil, 8 nil: .zero 8 .text .globl init .type init, @function init: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $24, %edi call malloc@PLT movq %rax, nil(%rip) movq nil(%rip), %rax movq nil(%rip), %rdx movq %rdx, 8(%rax) movq nil(%rip), %rax movq nil(%rip), %rdx movq %rdx, 16(%rax) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size init, .-init .section .rodata .LC0: .string "%d" .text .globl printList .type printList, @function printList: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq nil(%rip), %rax movq 8(%rax), %rax movq %rax, -8(%rbp) movl $1, -12(%rbp) .L6: movq nil(%rip), %rax cmpq %rax, -8(%rbp) je .L8 cmpl $0, -12(%rbp) jne .L5 movl $32, %edi call putchar@PLT .L5: movq -8(%rbp), %rax movl (%rax), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq -8(%rbp), %rax movq 8(%rax), %rax movq %rax, -8(%rbp) movl $0, -12(%rbp) jmp .L6 .L8: nop movl $10, %edi call putchar@PLT nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size printList, .-printList .globl deleteNode .type deleteNode, @function deleteNode: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq -8(%rbp), %rax movq 8(%rax), %rax movq -8(%rbp), %rdx movq 16(%rdx), %rdx movq %rdx, 16(%rax) movq -8(%rbp), %rax movq 16(%rax), %rax movq -8(%rbp), %rdx movq 8(%rdx), %rdx movq %rdx, 8(%rax) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size deleteNode, .-deleteNode .globl deleteFirst .type deleteFirst, @function deleteFirst: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq nil(%rip), %rax movq 8(%rax), %rax movq %rax, -8(%rbp) movq nil(%rip), %rax cmpq %rax, -8(%rbp) je .L12 movq -8(%rbp), %rax movq %rax, %rdi call deleteNode .L12: nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size deleteFirst, .-deleteFirst .globl deleteLast .type deleteLast, @function deleteLast: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq nil(%rip), %rax movq 16(%rax), %rax movq %rax, -8(%rbp) movq nil(%rip), %rax cmpq %rax, -8(%rbp) je .L15 movq -8(%rbp), %rax movq %rax, %rdi call deleteNode .L15: nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size deleteLast, .-deleteLast .globl delete .type delete, @function delete: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movl %edi, -20(%rbp) movq nil(%rip), %rax movq 8(%rax), %rax movq %rax, -8(%rbp) .L20: movq -8(%rbp), %rax movl (%rax), %eax cmpl %eax, -20(%rbp) jne .L17 movq -8(%rbp), %rax movq %rax, %rdi call deleteNode jmp .L16 .L17: movq -8(%rbp), %rax movq 8(%rax), %rax movq %rax, -8(%rbp) movq nil(%rip), %rax movq 8(%rax), %rax cmpq %rax, -8(%rbp) je .L21 jmp .L20 .L21: nop .L16: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size delete, .-delete .globl insert .type insert, @function insert: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl $24, %edi call malloc@PLT movq %rax, -8(%rbp) movq -8(%rbp), %rax movl -20(%rbp), %edx movl %edx, (%rax) movq nil(%rip), %rdx movq -8(%rbp), %rax movq %rdx, 16(%rax) movq nil(%rip), %rax movq 8(%rax), %rdx movq -8(%rbp), %rax movq %rdx, 8(%rax) movq nil(%rip), %rax movq 8(%rax), %rax movq -8(%rbp), %rdx movq %rdx, 16(%rax) movq nil(%rip), %rax movq -8(%rbp), %rdx movq %rdx, 8(%rax) nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size insert, .-insert .section .rodata .LC1: .string "%s%d" .text .globl main .type main, @function main: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -40(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, %eax call init movl $0, -36(%rbp) jmp .L24 .L29: leaq -44(%rbp), %rdx leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movzbl -32(%rbp), %eax cmpb $105, %al jne .L25 movl -44(%rbp), %eax movl %eax, %edi call insert jmp .L26 .L25: movzbl -32(%rbp), %eax cmpb $100, %al jne .L26 leaq -32(%rbp), %rax movq %rax, %rdi call strlen@PLT cmpq $6, %rax jbe .L27 movzbl -26(%rbp), %eax cmpb $70, %al jne .L28 movl $0, %eax call deleteFirst jmp .L26 .L28: movzbl -26(%rbp), %eax cmpb $76, %al jne .L26 movl $0, %eax call deleteLast jmp .L26 .L27: movl -44(%rbp), %eax movl %eax, %edi call delete .L26: addl $1, -36(%rbp) .L24: movl -40(%rbp), %eax cmpl %eax, -36(%rbp) jl .L29 movl $0, %eax call printList movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L31 call __stack_chk_fail@PLT .L31: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 if(n == 0) break;\n for(i = 0; i < n; i++)\n scanf(\"%d %d\", &x[i], &y[i]);\n\n x[n] = x[0]; y[n] = y[0];\n ans = 0;\n for(i = 0; i < n; i++)\n ans += (x[i+1] - x[i]) * (y[i+1] + y[i]);\n\n cnt++;\n printf(\"%d %.1lf\\n\", cnt, ans/2);\n }\n return 0;\n}\n\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d %d\"\n.LC4:\n\t.string\t\"%d %.1lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$528, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -512(%rbp)\n.L8:\n\tleaq\t-516(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-516(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n\tmovl\t$0, -508(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-256(%rbp), %rdx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tleaq\t-496(%rbp), %rcx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -508(%rbp)\n.L4:\n\tmovl\t-516(%rbp), %eax\n\tcmpl\t%eax, -508(%rbp)\n\tjl\t.L5\n\tmovl\t-516(%rbp), %eax\n\tmovl\t-496(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -496(%rbp,%rax,4)\n\tmovl\t-516(%rbp), %eax\n\tmovl\t-256(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -256(%rbp,%rax,4)\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -504(%rbp)\n\tmovl\t$0, -508(%rbp)\n\tjmp\t.L6\n.L7:\n\tmovl\t-508(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-496(%rbp,%rax,4), %edx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tmovl\t-496(%rbp,%rax,4), %eax\n\tsubl\t%eax, %edx\n\tmovl\t-508(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-256(%rbp,%rax,4), %ecx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tmovl\t-256(%rbp,%rax,4), %eax\n\taddl\t%ecx, %eax\n\timull\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t-504(%rbp), %xmm1\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -504(%rbp)\n\taddl\t$1, -508(%rbp)\n.L6:\n\tmovl\t-516(%rbp), %eax\n\tcmpl\t%eax, -508(%rbp)\n\tjl\t.L7\n\taddl\t$1, -512(%rbp)\n\tmovsd\t-504(%rbp), %xmm0\n\tmovsd\t.LC3(%rip), %xmm1\n\tdivsd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rdx\n\tmovl\t-512(%rbp), %eax\n\tmovq\t%rdx, %xmm0\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1073741824\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\txorl\t%ebp, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t.LC2(%rip), %rbx\n\tsubq\t$536, %rsp\n\t.cfi_def_cfa_offset 592\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 520(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t28(%rsp), %rax\n\tmovq\t%rax, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovq\t8(%rsp), %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t28(%rsp), %rax\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tjle\t.L3\n\tleaq\t32(%rsp), %r15\n\txorl\t%r12d, %r12d\n\tleaq\t272(%rsp), %r14\n\tmovq\t%r15, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovq\t%r13, %rsi\n\tleaq\t(%r14,%r12,4), %rdx\n\tmovq\t%rbx, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %esi\n\taddq\t$1, %r12\n\taddq\t$4, %r13\n\tcmpl\t%r12d, %esi\n\tjg\t.L4\n\tmovl\t32(%rsp), %r8d\n\tmovl\t272(%rsp), %edx\n\tmovslq\t%esi, %rax\n\tmovl\t%r8d, 32(%rsp,%rax,4)\n\tmovl\t%edx, 272(%rsp,%rax,4)\n\ttestl\t%esi, %esi\n\tjle\t.L11\n\tcmpl\t$2, %esi\n\tjle\t.L12\n\tleal\t-3(%rsi), %eax\n\tmovl\t272(%rsp), %edi\n\tmovl\t$2, %edx\n\tpxor\t%xmm0, %xmm0\n\tshrl\t%eax\n\tleal\t2(%rax), %r9d\n\taddq\t%r9, %r9\n.L7:\n\tmovl\t-4(%r15,%rdx,4), %r10d\n\taddl\t-4(%r14,%rdx,4), %edi\n\tpxor\t%xmm1, %xmm1\n\tmovl\t-4(%r14,%rdx,4), %ecx\n\tmovl\t%r10d, %eax\n\tsubl\t%r8d, %eax\n\tmovl\t(%r15,%rdx,4), %r8d\n\timull\t%eax, %edi\n\tmovslq\t%edx, %rax\n\tmovl\t%r8d, %r11d\n\tsubl\t%r10d, %r11d\n\tcvtsi2sdl\t%edi, %xmm1\n\tmovl\t(%r14,%rdx,4), %edi\n\taddq\t$2, %rdx\n\taddl\t%edi, %ecx\n\timull\t%r11d, %ecx\n\taddsd\t%xmm1, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%ecx, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tcmpq\t%r9, %rdx\n\tjne\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t4(%r14,%rax,4), %edx\n\tmovl\t4(%r15,%rax,4), %ecx\n\tpxor\t%xmm1, %xmm1\n\taddl\t(%r14,%rax,4), %edx\n\tsubl\t(%r15,%rax,4), %ecx\n\taddq\t$1, %rax\n\timull\t%ecx, %edx\n\tcvtsi2sdl\t%edx, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tcmpl\t%eax, %esi\n\tjg\t.L8\n\tmulsd\t.LC3(%rip), %xmm0\n.L5:\n\taddl\t$1, %ebp\n\tmovl\t$1, %edi\n\tmovl\t$1, %eax\n\tmovl\t%ebp, %edx\n\tleaq\t.LC4(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t520(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L19\n\taddq\t$536, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\t.cfi_restore_state\n\tmovl\t32(%rsp), %edx\n\tpxor\t%xmm0, %xmm0\n\tmovl\t%edx, 32(%rsp,%rax,4)\n\tmovl\t272(%rsp), %edx\n\tmovl\t%edx, 272(%rsp,%rax,4)\n\tjmp\t.L5\n.L12:\n\tpxor\t%xmm0, %xmm0\n\txorl\t%eax, %eax\n\tjmp\t.L8\n.L11:\n\tpxor\t%xmm0, %xmm0\n\tjmp\t.L5\n.L19:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1071644672\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\txorl\t%ebp, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t.LC2(%rip), %rbx\n\tsubq\t$536, %rsp\n\t.cfi_def_cfa_offset 592\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 520(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t28(%rsp), %rax\n\tmovq\t%rax, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovq\t8(%rsp), %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t28(%rsp), %rax\n\ttestl\t%eax, %eax\n\tje\t.L2\n\tjle\t.L3\n\tleaq\t32(%rsp), %r15\n\txorl\t%r12d, %r12d\n\tleaq\t272(%rsp), %r14\n\tmovq\t%r15, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovq\t%r13, %rsi\n\tleaq\t(%r14,%r12,4), %rdx\n\tmovq\t%rbx, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %esi\n\taddq\t$1, %r12\n\taddq\t$4, %r13\n\tcmpl\t%r12d, %esi\n\tjg\t.L4\n\tmovl\t32(%rsp), %r8d\n\tmovl\t272(%rsp), %edx\n\tmovslq\t%esi, %rax\n\tmovl\t%r8d, 32(%rsp,%rax,4)\n\tmovl\t%edx, 272(%rsp,%rax,4)\n\ttestl\t%esi, %esi\n\tjle\t.L11\n\tcmpl\t$2, %esi\n\tjle\t.L12\n\tleal\t-3(%rsi), %eax\n\tmovl\t272(%rsp), %edi\n\tmovl\t$2, %edx\n\tpxor\t%xmm0, %xmm0\n\tshrl\t%eax\n\tleal\t2(%rax), %r9d\n\taddq\t%r9, %r9\n.L7:\n\tmovl\t-4(%r15,%rdx,4), %r10d\n\taddl\t-4(%r14,%rdx,4), %edi\n\tpxor\t%xmm1, %xmm1\n\tmovl\t-4(%r14,%rdx,4), %ecx\n\tmovl\t%r10d, %eax\n\tsubl\t%r8d, %eax\n\tmovl\t(%r15,%rdx,4), %r8d\n\timull\t%eax, %edi\n\tmovslq\t%edx, %rax\n\tmovl\t%r8d, %r11d\n\tsubl\t%r10d, %r11d\n\tcvtsi2sdl\t%edi, %xmm1\n\tmovl\t(%r14,%rdx,4), %edi\n\taddq\t$2, %rdx\n\taddl\t%edi, %ecx\n\timull\t%r11d, %ecx\n\taddsd\t%xmm1, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%ecx, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tcmpq\t%r9, %rdx\n\tjne\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t4(%r14,%rax,4), %edx\n\tmovl\t4(%r15,%rax,4), %ecx\n\tpxor\t%xmm1, %xmm1\n\taddl\t(%r14,%rax,4), %edx\n\tsubl\t(%r15,%rax,4), %ecx\n\taddq\t$1, %rax\n\timull\t%ecx, %edx\n\tcvtsi2sdl\t%edx, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tcmpl\t%eax, %esi\n\tjg\t.L8\n\tmulsd\t.LC3(%rip), %xmm0\n.L5:\n\taddl\t$1, %ebp\n\tmovl\t$1, %edi\n\tmovl\t$1, %eax\n\tmovl\t%ebp, %edx\n\tleaq\t.LC4(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t520(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L19\n\taddq\t$536, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\t.cfi_restore_state\n\tmovl\t32(%rsp), %edx\n\tpxor\t%xmm0, %xmm0\n\tmovl\t%edx, 32(%rsp,%rax,4)\n\tmovl\t272(%rsp), %edx\n\tmovl\t%edx, 272(%rsp,%rax,4)\n\tjmp\t.L5\n.L12:\n\tpxor\t%xmm0, %xmm0\n\txorl\t%eax, %eax\n\tjmp\t.L8\n.L11:\n\tpxor\t%xmm0, %xmm0\n\tjmp\t.L5\n.L19:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1071644672\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 if(n == 0) break;\n for(i = 0; i < n; i++)\n scanf(\"%d %d\", &x[i], &y[i]);\n\n x[n] = x[0]; y[n] = y[0];\n ans = 0;\n for(i = 0; i < n; i++)\n ans += (x[i+1] - x[i]) * (y[i+1] + y[i]);\n\n cnt++;\n printf(\"%d %.1lf\\n\", cnt, ans/2);\n }\n return 0;\n}\n\n\n", "index": 43, "inputs": [ "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 33\n0 40\n110 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 30\n0 40\n100 40\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 1\n6 0\n\n7\n0 0\n10 10\n0 20\n10 30\n0 40\n100 40\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 0\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n0 20\n10 33\n0 40\n110 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n0 20\n10 33\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n0 20\n9 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 1\n0 0\n\n7\n0 0\n10 10\n0 33\n10 20\n0 40\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 40\n100 40\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 20\n9 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 40\n100 77\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 4\n9 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n10 10\n0 33\n10 20\n0 69\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 40\n100 77\n110 0\n\n0\n", "3\n1 2\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 4\n9 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n0 10\n0 33\n10 20\n0 69\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 41\n100 77\n110 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n0 10\n0 32\n10 4\n0 69\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n0 10\n0 32\n10 4\n0 115\n100 26\n100 1\n\n0\n", "3\n1 1\n2 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n1 1\n2 4\n6 0\n\n7\n1 -2\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n1 1\n2 4\n6 0\n\n7\n2 -2\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n0 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n0 10\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n0 14\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n4 0\n\n7\n2 -2\n0 14\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 1\n4 0\n\n7\n2 -2\n0 14\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 33\n-1 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 5\n6 0\n\n7\n0 0\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 15\n0 20\n10 33\n0 40\n110 17\n100 0\n\n0\n", "3\n1 1\n3 8\n6 0\n\n7\n1 0\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 1\n6 0\n\n7\n0 0\n10 10\n0 33\n10 30\n0 40\n000 40\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 20\n3 33\n0 40\n110 40\n100 0\n\n0\n", "3\n1 1\n3 1\n0 0\n\n7\n0 0\n10 10\n0 33\n10 30\n0 40\n101 40\n100 1\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n-1 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n0 20\n10 32\n0 40\n111 1\n100 0\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 62\n100 40\n100 0\n\n0\n", "3\n0 1\n3 4\n2 0\n\n7\n0 0\n10 15\n0 20\n9 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n4 33\n0 40\n100 40\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 20\n16 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n9 10\n0 33\n10 20\n0 40\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 58\n100 77\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 4\n9 32\n0 40\n110 1\n101 0\n\n0\n", "3\n1 0\n3 1\n1 0\n\n7\n0 0\n10 10\n0 33\n10 20\n0 69\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 40\n101 77\n110 0\n\n0\n", "3\n1 2\n3 4\n1 0\n\n7\n0 0\n10 15\n-1 4\n9 32\n0 40\n110 1\n100 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n0 10\n0 33\n10 20\n1 69\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n1 -1\n10 9\n0 28\n3 33\n0 41\n100 77\n110 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n0 10\n0 33\n10 4\n0 69\n100 41\n100 1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 -1\n10 10\n0 28\n3 33\n0 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n1 2\n3 1\n1 0\n\n7\n0 0\n0 10\n0 32\n10 4\n0 115\n100 26\n100 1\n\n0\n", "3\n1 1\n2 4\n6 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n-1 41\n100 49\n100 0\n\n0\n", "3\n1 1\n2 3\n6 0\n\n7\n1 -2\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n1 1\n2 4\n6 0\n\n0\n2 -2\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n8 0\n\n7\n2 -2\n10 10\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n0 10\n0 10\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n0 9\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n11 0\n\n7\n2 -2\n0 14\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n4 0\n\n7\n2 -2\n1 14\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 5\n6 0\n\n7\n0 0\n10 10\n0 20\n10 38\n0 40\n100 40\n100 0\n\n0\n", "3\n1 0\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 33\n-1 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 -1\n10 10\n0 20\n10 32\n0 40\n100 40\n100 1\n\n0\n", "3\n1 1\n3 3\n6 0\n\n7\n0 0\n10 10\n0 20\n3 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 15\n0 20\n10 33\n0 40\n110 10\n100 0\n\n0\n", "3\n1 1\n3 8\n6 0\n\n7\n1 0\n10 10\n0 20\n3 33\n0 40\n000 40\n100 0\n\n0\n", "3\n2 1\n3 1\n6 0\n\n7\n0 0\n10 10\n0 33\n10 30\n0 40\n000 40\n100 1\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n-1 20\n3 33\n0 70\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n0 20\n10 32\n0 67\n111 1\n100 0\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 15\n0 28\n3 33\n0 62\n100 40\n100 0\n\n0\n", "3\n1 1\n3 1\n0 0\n\n7\n0 0\n10 1\n0 33\n10 20\n0 40\n100 26\n101 1\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 2\n0 28\n4 33\n0 40\n100 40\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 20\n16 32\n-1 40\n110 1\n100 0\n\n0\n", "3\n1 1\n0 4\n6 -1\n\n7\n1 -1\n10 10\n0 28\n3 33\n0 58\n100 77\n110 0\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n0 0\n10 15\n-1 4\n9 32\n0 40\n110 2\n101 0\n\n0\n", "3\n1 1\n3 4\n6 1\n\n7\n1 -1\n10 9\n0 28\n3 33\n0 41\n100 77\n110 0\n\n0\n", "3\n1 1\n3 4\n8 0\n\n7\n0 -1\n10 10\n0 28\n3 33\n0 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 1\n1 0\n\n7\n0 0\n0 10\n0 32\n9 2\n0 69\n100 26\n100 1\n\n0\n", "3\n1 1\n3 4\n2 0\n\n7\n1 -1\n10 10\n0 28\n3 33\n-1 41\n100 49\n111 0\n\n0\n", "3\n1 1\n2 4\n6 0\n\n7\n2 -1\n10 10\n0 28\n3 33\n-1 41\n100 49\n100 0\n\n0\n", "3\n2 1\n2 4\n8 0\n\n7\n2 -2\n10 10\n0 28\n3 33\n-1 41\n100 63\n110 0\n\n0\n", "3\n2 1\n2 4\n6 0\n\n7\n2 -2\n0 10\n0 10\n3 33\n-1 41\n100 38\n110 0\n\n0\n", "3\n2 1\n2 4\n11 0\n\n7\n2 -2\n0 16\n0 28\n3 33\n-2 41\n100 49\n110 0\n\n0\n", "3\n2 1\n2 4\n4 0\n\n7\n2 -2\n1 14\n0 28\n3 33\n-1 41\n100 49\n110 0\n\n0\n", "3\n1 1\n3 5\n6 0\n\n7\n0 0\n10 10\n-1 20\n10 38\n0 40\n100 40\n100 0\n\n0\n", "3\n1 0\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 33\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 -1\n6 10\n0 20\n10 32\n0 40\n100 40\n100 1\n\n0\n", "3\n2 1\n3 4\n6 0\n\n7\n0 0\n10 15\n0 20\n10 33\n0 40\n110 10\n100 0\n\n0\n", "3\n1 1\n3 8\n6 0\n\n7\n1 0\n15 10\n0 20\n3 33\n0 40\n000 40\n100 0\n\n0\n", "3\n2 0\n3 1\n6 0\n\n7\n0 0\n10 10\n0 33\n10 30\n0 40\n000 40\n100 1\n\n0\n", "3\n1 1\n3 1\n0 0\n\n7\n0 0\n10 10\n0 33\n10 17\n1 40\n101 40\n100 1\n\n0\n", "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n-1 20\n3 33\n0 70\n100 40\n100 -1\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 30\n0 40\n100 40\n100 0\n\n0\n", "3\n1 1\n3 4\n6 0\n\n7\n0 0\n10 10\n0 20\n10 30\n0 40\n100 40\n100 0\n\n0\n" ], "outputs": [ "1 8.5\n2 3800.0\n", "1 8.5\n2 4000.0\n", "1 8.5\n2 3750.0\n", "1 8.5\n2 3870.0\n", "1 1.0\n2 3750.0\n", "1 8.5\n2 3865.0\n", "1 2.5\n2 4000.0\n", "1 8.5\n2 3910.0\n", "1 2.5\n2 2050.0\n", "1 9.5\n2 3910.0\n", "1 9.5\n2 3882.0\n", "1 2.5\n2 2060.0\n", "1 1.0\n2 3050.0\n", "1 9.5\n2 4087.0\n", "1 2.5\n2 2068.5\n", "1 9.5\n2 6122.0\n", "1 2.5\n2 2076.5\n", "1 1.0\n2 4355.0\n", "1 8.5\n2 6122.0\n", "1 3.0\n2 2076.5\n", "1 1.0\n2 4520.0\n", "1 8.5\n2 6170.5\n", "1 8.5\n2 4630.5\n", "1 1.0\n2 4515.0\n", "1 8.5\n2 4638.5\n", "1 1.0\n2 6585.0\n", "1 8.0\n2 4638.5\n", "1 8.0\n2 4688.5\n", "1 8.0\n2 4683.5\n", "1 6.0\n2 4683.5\n", "1 6.0\n2 4833.5\n", "1 6.0\n2 4841.5\n", "1 6.0\n2 4837.5\n", "1 3.0\n2 4837.5\n", "1 0.0\n2 4837.5\n", "1 8.5\n2 3803.5\n", "1 11.0\n2 3870.0\n", "1 8.5\n2 2850.0\n", "1 18.5\n2 3865.0\n", "1 1.0\n2 1800.0\n", "1 8.5\n2 4110.0\n", "1 1.0\n2 3769.5\n", "1 9.5\n2 3921.5\n", "1 2.5\n2 2070.0\n", "1 9.5\n2 4949.0\n", "1 4.5\n2 2060.0\n", "1 9.5\n2 4081.0\n", "1 2.5\n2 1998.5\n", "1 1.0\n2 3066.5\n", "1 9.5\n2 6995.0\n", "1 2.5\n2 2077.0\n", "1 0.0\n2 4355.0\n", "1 8.5\n2 6142.0\n", "1 2.0\n2 2076.5\n", "1 1.0\n2 4517.0\n", "1 8.5\n2 6171.0\n", "1 1.0\n2 5270.0\n", "1 8.5\n2 4635.5\n", "1 2.5\n2 4638.5\n", "1 2.0\n2 6585.0\n", "1 8.0\n2 4388.5\n", "1 5.5\n2 4688.5\n", "1 8.0\n", "1 9.0\n2 4683.5\n", "1 6.0\n2 4806.5\n", "1 6.0\n2 4842.5\n", "1 13.5\n2 4837.5\n", "1 3.0\n2 4822.5\n", "1 11.0\n2 3800.0\n", "1 10.0\n2 3803.5\n", "1 8.5\n2 3795.0\n", "1 6.0\n2 3870.0\n", "1 8.5\n2 2500.0\n", "1 18.5\n2 1865.0\n", "1 0.5\n2 1800.0\n", "1 9.5\n2 5376.5\n", "1 2.5\n2 3433.5\n", "1 9.5\n2 4946.5\n", "1 1.0\n2 3063.0\n", "1 9.5\n2 4085.0\n", "1 2.5\n2 1983.0\n", "1 6.5\n2 6995.0\n", "1 2.5\n2 2127.5\n", "1 7.5\n2 6171.0\n", "1 11.5\n2 4635.5\n", "1 1.0\n2 4533.5\n", "1 2.5\n2 4663.5\n", "1 8.0\n2 4383.5\n", "1 9.0\n2 5460.5\n", "1 6.0\n2 4196.0\n", "1 13.5\n2 4835.5\n", "1 3.0\n2 4814.5\n", "1 11.0\n2 3814.0\n", "1 10.0\n2 3800.0\n", "1 8.5\n2 3837.0\n", "1 6.5\n2 2500.0\n", "1 18.5\n2 1815.0\n", "1 2.0\n2 1800.0\n", "1 1.0\n2 3758.0\n", "1 9.5\n2 5426.0\n", "1 8.5\n2 3800.0\n", "1 8.5\n2 3800.0\n" ], "question": "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 if(n == 0) break;\n for(i = 0; i < n; i++)\n scanf(\"%d %d\", &x[i], &y[i]);\n\n x[n] = x[0]; y[n] = y[0];\n ans = 0;\n for(i = 0; i < n; i++)\n ans += (x[i+1] - x[i]) * (y[i+1] + y[i]);\n\n cnt++;\n printf(\"%d %.1lf\\n\", cnt, ans/2);\n }\n return 0;\n}\n\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d %d\"\n.LC4:\n\t.string\t\"%d %.1lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$528, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -512(%rbp)\n.L8:\n\tleaq\t-516(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-516(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n\tmovl\t$0, -508(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-256(%rbp), %rdx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tleaq\t-496(%rbp), %rcx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -508(%rbp)\n.L4:\n\tmovl\t-516(%rbp), %eax\n\tcmpl\t%eax, -508(%rbp)\n\tjl\t.L5\n\tmovl\t-516(%rbp), %eax\n\tmovl\t-496(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -496(%rbp,%rax,4)\n\tmovl\t-516(%rbp), %eax\n\tmovl\t-256(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -256(%rbp,%rax,4)\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -504(%rbp)\n\tmovl\t$0, -508(%rbp)\n\tjmp\t.L6\n.L7:\n\tmovl\t-508(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-496(%rbp,%rax,4), %edx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tmovl\t-496(%rbp,%rax,4), %eax\n\tsubl\t%eax, %edx\n\tmovl\t-508(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-256(%rbp,%rax,4), %ecx\n\tmovl\t-508(%rbp), %eax\n\tcltq\n\tmovl\t-256(%rbp,%rax,4), %eax\n\taddl\t%ecx, %eax\n\timull\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t-504(%rbp), %xmm1\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -504(%rbp)\n\taddl\t$1, -508(%rbp)\n.L6:\n\tmovl\t-516(%rbp), %eax\n\tcmpl\t%eax, -508(%rbp)\n\tjl\t.L7\n\taddl\t$1, -512(%rbp)\n\tmovsd\t-504(%rbp), %xmm0\n\tmovsd\t.LC3(%rip), %xmm1\n\tdivsd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rdx\n\tmovl\t-512(%rbp), %eax\n\tmovq\t%rdx, %xmm0\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1073741824\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]); x[n] = x[0]; y[n] = y[0]; ans = 0; for(i = 0; i < n; i++) ans += (x[i+1] - x[i]) * (y[i+1] + y[i]); cnt++; printf("%d %.1lf\n", cnt, ans/2); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d %d" .LC4: .string "%d %.1lf\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $528, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -512(%rbp) .L8: leaq -516(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -516(%rbp), %eax testl %eax, %eax je .L12 movl $0, -508(%rbp) jmp .L4 .L5: leaq -256(%rbp), %rdx movl -508(%rbp), %eax cltq salq $2, %rax addq %rax, %rdx leaq -496(%rbp), %rcx movl -508(%rbp), %eax cltq salq $2, %rax addq %rcx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -508(%rbp) .L4: movl -516(%rbp), %eax cmpl %eax, -508(%rbp) jl .L5 movl -516(%rbp), %eax movl -496(%rbp), %edx cltq movl %edx, -496(%rbp,%rax,4) movl -516(%rbp), %eax movl -256(%rbp), %edx cltq movl %edx, -256(%rbp,%rax,4) pxor %xmm0, %xmm0 movsd %xmm0, -504(%rbp) movl $0, -508(%rbp) jmp .L6 .L7: movl -508(%rbp), %eax addl $1, %eax cltq movl -496(%rbp,%rax,4), %edx movl -508(%rbp), %eax cltq movl -496(%rbp,%rax,4), %eax subl %eax, %edx movl -508(%rbp), %eax addl $1, %eax cltq movl -256(%rbp,%rax,4), %ecx movl -508(%rbp), %eax cltq movl -256(%rbp,%rax,4), %eax addl %ecx, %eax imull %edx, %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movsd -504(%rbp), %xmm1 addsd %xmm1, %xmm0 movsd %xmm0, -504(%rbp) addl $1, -508(%rbp) .L6: movl -516(%rbp), %eax cmpl %eax, -508(%rbp) jl .L7 addl $1, -512(%rbp) movsd -504(%rbp), %xmm0 movsd .LC3(%rip), %xmm1 divsd %xmm1, %xmm0 movq %xmm0, %rdx movl -512(%rbp), %eax movq %rdx, %xmm0 movl %eax, %esi leaq .LC4(%rip), %rax movq %rax, %rdi movl $1, %eax call printf@PLT jmp .L8 .L12: nop movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .section .rodata .align 8 .LC3: .long 0 .long 1073741824 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 }\n else if('A' <= ch && ch <= 'Z'){\n C = ch + 32;\n printf(\"%c\",C);\n }\n else if('a' <= ch && ch <= 'z'){\n C = ch - 32;\n printf(\"%c\",C);\n }\n else{\n printf(\"%c\",ch);\n \n }\n }\n printf(\"\\n\");\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.LC0:\n\t.string\t\"%c\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n.L8:\n\tleaq\t-10(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$10, %al\n\tje\t.L12\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$32, %al\n\tjne\t.L4\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L8\n.L4:\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$64, %al\n\tjle\t.L6\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$90, %al\n\tjg\t.L6\n\tmovzbl\t-10(%rbp), %eax\n\taddl\t$32, %eax\n\tmovb\t%al, -9(%rbp)\n\tmovsbl\t-9(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L5\n.L6:\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$96, %al\n\tjle\t.L7\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$122, %al\n\tjg\t.L7\n\tmovzbl\t-10(%rbp), %eax\n\tsubl\t$32, %eax\n\tmovb\t%al, -9(%rbp)\n\tmovsbl\t-9(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L5\n.L7:\n\tmovzbl\t-10(%rbp), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar@PLT\n.L5:\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tleaq\t.LC0(%rip), %rbx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t7(%rsp), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t%rbx, %rdi\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovsbl\t7(%rsp), %edi\n\tcmpb\t$10, %dil\n\tje\t.L3\n\tcmpb\t$32, %dil\n\tje\t.L11\n\tleal\t-65(%rdi), %eax\n\tcmpb\t$25, %al\n\tjbe\t.L12\n\tleal\t-97(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L7\n\tsubl\t$32, %edi\n\tmovzbl\t%dil, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\taddl\t$32, %edi\n\tmovzbl\t%dil, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L13\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L13:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tleaq\t.LC0(%rip), %rbx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t7(%rsp), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t%rbx, %rdi\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovsbl\t7(%rsp), %edi\n\tcmpb\t$10, %dil\n\tje\t.L3\n\tcmpb\t$32, %dil\n\tje\t.L11\n\tleal\t-65(%rdi), %eax\n\tcmpb\t$25, %al\n\tjbe\t.L12\n\tleal\t-97(%rdi), %eax\n\tcmpb\t$25, %al\n\tja\t.L7\n\tsubl\t$32, %edi\n\tmovzbl\t%dil, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\taddl\t$32, %edi\n\tmovzbl\t%dil, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L13\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L13:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 }\n else if('A' <= ch && ch <= 'Z'){\n C = ch + 32;\n printf(\"%c\",C);\n }\n else if('a' <= ch && ch <= 'z'){\n C = ch - 32;\n printf(\"%c\",C);\n }\n else{\n printf(\"%c\",ch);\n \n }\n }\n printf(\"\\n\");\n return 0;\n}\n", "index": 46, "inputs": [ "f@IR, LATER, OCCASIONALLY CLOUDY.\n", "f@IR, LATER, YLLANOISACCO CLOUDY.\n", "f@IR, LATER, OLLANOISACCY CLOUDY.\n", "f@IR, LATER, OLKANOISACCY CLOUDY.\n", ",RI@f LATER, OLKANOISACCY CLOUDY.\n", ",RI@f KATER, OLKANOISACCY CLOUDY.\n", ",RI@g KATER, OLKANOISACCY CLOUDY.\n", ",RI@g KATER, OLKANOISACCY CLOUDX.\n", ",RI@g KATFR, OLKANOISACCY CLOUDX.\n", ",RI@g KATFR, OLKANOISACCY .XDUOLC\n", ",RI@g KATFR, OLKANOISACCY .XDULOC\n", ",RI@g KATFR, OLKANOISACCY .ODULXC\n", ",RI@g KATFR- OLKANOISACCY .ODULXC\n", ",RI@g KATFR- OLKANOISACCY .ODUKXC\n", ",RI@g KATFR- OLKANOISACCY .OXUKDC\n", "g@IR, KATFR- OLKANOISACCY .OXUKDC\n", "g@IR, KATFR- OLKANOISACCY CDKUXO.\n", "g@IR, KRTFA- OLKANOISACCY CDKUXO.\n", ",RI@g KRTFA- OLKANOISACCY CDKUXO.\n", ",RI@g KRTF@- OLKANOISACCY CDKUXO.\n", ",RI@g KRTF@- OLKANOISACCY CDKUXP.\n", ",RI@g KRTF@- OLKANOISACCY BDKUXP.\n", ",RI@g KRSF@- OLKANOISACCY BDKUXP.\n", ",RI@g KRSF@- OLKANOISACCY .PXUKDB\n", ",RI@g KRSF@, OLKANOISACCY .PXUKDB\n", ",IR@g KRSF@, OLKANOISACCY .PXUKDB\n", ",IR@g ,RSF@K OLKANOISACCY .PXUKDB\n", ",IR@g ,RSF@K OLKANOISACCY BDKUXP.\n", ",IR@g ,RSF@K OLKANOISACCY B.KUXPD\n", "g@RI, ,RSF@K OLKANOISACCY B.KUXPD\n", "g@RI, ,QSF@K OLKANOISACCY B.KUXPD\n", "g@RI, ,QSF@K ALKANOISOCCY B.KUXPD\n", "g@RI, ,QSF@K ALKAYOISOCCN B.KUXPD\n", "g@RH, ,QSF@K ALKAYOISOCCN B.KUXPD\n", "R@gH, ,QSF@K ALKAYOISOCCN B.KUXPD\n", "R@gH, K@FSQ, ALKAYOISOCCN B.KUXPD\n", "R@gH, K@FSQ, ALKAYOISOCCN BK.UXPD\n", "R@gH, K@FSQ, ALKAYOISOCCN BK.UWPD\n", "R@gH, K@FSQ, ALKAYOISOCBN BK.UWPD\n", "R@gH, ,QSF@K ALKAYOISOCBN BK.UWPD\n", "R@gH, ,QSG@K ALKAYOISOCBN BK.UWPD\n", "R@gH, ,QSG@K ALKAYOISOCBN DPWU.KB\n", "R@gH, ,QSG@K ALKAYOISOCBN .PWUDKB\n", "R@gH, ,QSK@G ALKAYOISOCBN .PWUDKB\n", "R@gH, G@KSQ, ALKAYOISOCBN .PWUDKB\n", "R@gH, G,KSQ@ ALKAYOISOCBN .PWUDKB\n", "R@gH, G,KSQ@ ALK@YOISOCBN .PWUDKB\n", "R@gH, G,KSQ@ AKK@YOISOCBN .PWUDKB\n", "R@gH, GQKS,@ AKK@YOISOCBN .PWUDKB\n", "R@gH, GQKS-@ AKK@YOISOCBN .PWUDKB\n", "R@gH, GQKT-@ AKK@YOISOCBN .PWUDKB\n", "R@gH, GQKT-@ AKK@YOISOCBN BKDUWP.\n", "R@gH, GQKT-@ AKK@YOISOCBN BJDUWP.\n", "R@gH, GQKT-@ AKK@YOISOCBN BPDUWJ.\n", "R@g,H GQKT-@ AKK@YOISOCBN BPDUWJ.\n", "R@g,H GQKT-@ AKK@YOISOCBN BPDUWJ/\n", "R@g,H GQKT-@ AKK@YOISOCBN BPWUDJ/\n", "R?g,H GQKT-@ AKK@YOISOCBN BPWUDJ/\n", "R?g,H GQKT-@ AKK@YOISOCBN BPWUDK/\n", "R?g,H GQKT-@ AKK@YOISOCBN B/WUDKP\n", "R?g,H GQKT-@ NBCOSIOY@KKA B/WUDKP\n", "R?g,H G-KTQ@ NBCOSIOY@KKA B/WUDKP\n", "R,g?H G-KTQ@ NBCOSIOY@KKA B/WUDKP\n", "R,g?H G-JTQ@ NBCOSIOY@KKA B/WUDKP\n", "R,g?H G-ITQ@ NBCOSIOY@KKA B/WUDKP\n", "R,g@H G-ITQ@ NBCOSIOY@KKA B/WUDKP\n", "R,g@H G-ITQ@ NBCOSIOY@KKA PKDUW/B\n", "R,g@H G-ITQ@ AKK@YOISOCBN PKDUW/B\n", "R,g@H G-ITQ@ AKK@YOISODBN PKDUW/B\n", "R,g@H G-ITQ@ AKK@YOISODBN B/WUDKP\n", "R,g@H G-ITQ@ AKK@YPISODBN B/WUDKP\n", "R,g@H G-IQT@ AKK@YPISODBN B/WUDKP\n", "R,g@H G-IQTA AKK@YPISODBN B/WUDKP\n", "R,g@H G-IQSA AKK@YPISODBN B/WUDKP\n", "RHg@, G-IQTA AKK@YPISODBN B/WUDKP\n", "RHg@, G-IQTA AKK@YPIRODBN B/WUDKP\n", "RHg@, G-IQTA AKK@YPIRODBN B0WUDKP\n", ",@gHR G-IQTA AKK@YPIRODBN B0WUDKP\n", ",@gHR G-IQTA AKK@YPIRODBN B0WUDKQ\n", ",@gHR H-IQTA AKK@YPIRODBN B0WUDKQ\n", ",@gHR H-IQTA AKK@YPIRODBN BKWUD0Q\n", "RHg@, H-IQTA AKK@YPIRODBN BKWUD0Q\n", "RHg@, H-IQTA AKK@YPIRODBN BKWUD1Q\n", "RHgA, H-IQTA AKK@YPIRODBN BKWUD1Q\n", "R,gAH H-IQTA AKK@YPIRODBN BKWUD1Q\n", "R,gAH H-IQTA AKK@YPIRODBN Q1DUWKB\n", "R,gAH H-IQTA AKK@YPJRODBN Q1DUWKB\n", "R,gAH H-IQTA AKK@YPJRODBN BKWUD1Q\n", "R,gAH A-IQTH AKK@YPJRODBN BKWUD1Q\n", "S,gAH A-IQTH AKK@YPJRODBN BKWUD1Q\n", "HAg,S A-IQTH AKK@YPJRODBN BKWUD1Q\n", "HAg-S A-IQTH AKK@YPJRODBN BKWUD1Q\n", "HAg,T A-IQTH AKK@YPJRODBN BKWUD1Q\n", "GAg,T A-IQTH AKK@YPJRODBN BKWUD1Q\n", "GAg,T HTQI-A AKK@YPJRODBN BKWUD1Q\n", "GAg,U HTQI-A AKK@YPJRODBN BKWUD1Q\n", "GAg,U HAQI-T AKK@YPJRODBN BKWUD1Q\n", "GAg,U HAQI-T AKK@YBJRODPN BKWUD1Q\n", "GAg,U HAQI-T AKK@YBJRODPN BQWUD1K\n", "GAg,U HAQI-T AKK@YBJRODPN BQWUD0K\n", "fAIR, LATER, OCCASIONALLY CLOUDY.\n", "fAIR, LATER, OCCASIONALLY CLOUDY.\n" ], "outputs": [ "F@ir, later, occasionally cloudy.\n", "F@ir, later, yllanoisacco cloudy.\n", "F@ir, later, ollanoisaccy cloudy.\n", "F@ir, later, olkanoisaccy cloudy.\n", ",ri@F later, olkanoisaccy cloudy.\n", ",ri@F kater, olkanoisaccy cloudy.\n", ",ri@G kater, olkanoisaccy cloudy.\n", ",ri@G kater, olkanoisaccy cloudx.\n", ",ri@G katfr, olkanoisaccy cloudx.\n", ",ri@G katfr, olkanoisaccy .xduolc\n", ",ri@G katfr, olkanoisaccy .xduloc\n", ",ri@G katfr, olkanoisaccy .odulxc\n", ",ri@G katfr- olkanoisaccy .odulxc\n", ",ri@G katfr- olkanoisaccy .odukxc\n", ",ri@G katfr- olkanoisaccy .oxukdc\n", "G@ir, katfr- olkanoisaccy .oxukdc\n", "G@ir, katfr- olkanoisaccy cdkuxo.\n", "G@ir, krtfa- olkanoisaccy cdkuxo.\n", ",ri@G krtfa- olkanoisaccy cdkuxo.\n", ",ri@G krtf@- olkanoisaccy cdkuxo.\n", ",ri@G krtf@- olkanoisaccy cdkuxp.\n", ",ri@G krtf@- olkanoisaccy bdkuxp.\n", ",ri@G krsf@- olkanoisaccy bdkuxp.\n", ",ri@G krsf@- olkanoisaccy .pxukdb\n", ",ri@G krsf@, olkanoisaccy .pxukdb\n", ",ir@G krsf@, olkanoisaccy .pxukdb\n", ",ir@G ,rsf@k olkanoisaccy .pxukdb\n", ",ir@G ,rsf@k olkanoisaccy bdkuxp.\n", ",ir@G ,rsf@k olkanoisaccy b.kuxpd\n", "G@ri, ,rsf@k olkanoisaccy b.kuxpd\n", "G@ri, ,qsf@k olkanoisaccy b.kuxpd\n", "G@ri, ,qsf@k alkanoisoccy b.kuxpd\n", "G@ri, ,qsf@k alkayoisoccn b.kuxpd\n", "G@rh, ,qsf@k alkayoisoccn b.kuxpd\n", "r@Gh, ,qsf@k alkayoisoccn b.kuxpd\n", "r@Gh, k@fsq, alkayoisoccn b.kuxpd\n", "r@Gh, k@fsq, alkayoisoccn bk.uxpd\n", "r@Gh, k@fsq, alkayoisoccn bk.uwpd\n", "r@Gh, k@fsq, alkayoisocbn bk.uwpd\n", "r@Gh, ,qsf@k alkayoisocbn bk.uwpd\n", "r@Gh, ,qsg@k alkayoisocbn bk.uwpd\n", "r@Gh, ,qsg@k alkayoisocbn dpwu.kb\n", "r@Gh, ,qsg@k alkayoisocbn .pwudkb\n", "r@Gh, ,qsk@g alkayoisocbn .pwudkb\n", "r@Gh, g@ksq, alkayoisocbn .pwudkb\n", "r@Gh, g,ksq@ alkayoisocbn .pwudkb\n", "r@Gh, g,ksq@ alk@yoisocbn .pwudkb\n", "r@Gh, g,ksq@ akk@yoisocbn .pwudkb\n", "r@Gh, gqks,@ akk@yoisocbn .pwudkb\n", "r@Gh, gqks-@ akk@yoisocbn .pwudkb\n", "r@Gh, gqkt-@ akk@yoisocbn .pwudkb\n", "r@Gh, gqkt-@ akk@yoisocbn bkduwp.\n", "r@Gh, gqkt-@ akk@yoisocbn bjduwp.\n", "r@Gh, gqkt-@ akk@yoisocbn bpduwj.\n", "r@G,h gqkt-@ akk@yoisocbn bpduwj.\n", "r@G,h gqkt-@ akk@yoisocbn bpduwj/\n", "r@G,h gqkt-@ akk@yoisocbn bpwudj/\n", "r?G,h gqkt-@ akk@yoisocbn bpwudj/\n", "r?G,h gqkt-@ akk@yoisocbn bpwudk/\n", "r?G,h gqkt-@ akk@yoisocbn b/wudkp\n", "r?G,h gqkt-@ nbcosioy@kka b/wudkp\n", "r?G,h g-ktq@ nbcosioy@kka b/wudkp\n", "r,G?h g-ktq@ nbcosioy@kka b/wudkp\n", "r,G?h g-jtq@ nbcosioy@kka b/wudkp\n", "r,G?h g-itq@ nbcosioy@kka b/wudkp\n", "r,G@h g-itq@ nbcosioy@kka b/wudkp\n", "r,G@h g-itq@ nbcosioy@kka pkduw/b\n", "r,G@h g-itq@ akk@yoisocbn pkduw/b\n", "r,G@h g-itq@ akk@yoisodbn pkduw/b\n", "r,G@h g-itq@ akk@yoisodbn b/wudkp\n", "r,G@h g-itq@ akk@ypisodbn b/wudkp\n", "r,G@h g-iqt@ akk@ypisodbn b/wudkp\n", "r,G@h g-iqta akk@ypisodbn b/wudkp\n", "r,G@h g-iqsa akk@ypisodbn b/wudkp\n", "rhG@, g-iqta akk@ypisodbn b/wudkp\n", "rhG@, g-iqta akk@ypirodbn b/wudkp\n", "rhG@, g-iqta akk@ypirodbn b0wudkp\n", ",@Ghr g-iqta akk@ypirodbn b0wudkp\n", ",@Ghr g-iqta akk@ypirodbn b0wudkq\n", ",@Ghr h-iqta akk@ypirodbn b0wudkq\n", ",@Ghr h-iqta akk@ypirodbn bkwud0q\n", "rhG@, h-iqta akk@ypirodbn bkwud0q\n", "rhG@, h-iqta akk@ypirodbn bkwud1q\n", "rhGa, h-iqta akk@ypirodbn bkwud1q\n", "r,Gah h-iqta akk@ypirodbn bkwud1q\n", "r,Gah h-iqta akk@ypirodbn q1duwkb\n", "r,Gah h-iqta akk@ypjrodbn q1duwkb\n", "r,Gah h-iqta akk@ypjrodbn bkwud1q\n", "r,Gah a-iqth akk@ypjrodbn bkwud1q\n", "s,Gah a-iqth akk@ypjrodbn bkwud1q\n", "haG,s a-iqth akk@ypjrodbn bkwud1q\n", "haG-s a-iqth akk@ypjrodbn bkwud1q\n", "haG,t a-iqth akk@ypjrodbn bkwud1q\n", "gaG,t a-iqth akk@ypjrodbn bkwud1q\n", "gaG,t htqi-a akk@ypjrodbn bkwud1q\n", "gaG,u htqi-a akk@ypjrodbn bkwud1q\n", "gaG,u haqi-t akk@ypjrodbn bkwud1q\n", "gaG,u haqi-t akk@ybjrodpn bkwud1q\n", "gaG,u haqi-t akk@ybjrodpn bqwud1k\n", "gaG,u haqi-t akk@ybjrodpn bqwud0k\n", "Fair, later, occasionally cloudy.\n", "Fair, later, occasionally cloudy.\n" ], "question": "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 }\n else if('A' <= ch && ch <= 'Z'){\n C = ch + 32;\n printf(\"%c\",C);\n }\n else if('a' <= ch && ch <= 'z'){\n C = ch - 32;\n printf(\"%c\",C);\n }\n else{\n printf(\"%c\",ch);\n \n }\n }\n printf(\"\\n\");\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.LC0:\n\t.string\t\"%c\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n.L8:\n\tleaq\t-10(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$10, %al\n\tje\t.L12\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$32, %al\n\tjne\t.L4\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L8\n.L4:\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$64, %al\n\tjle\t.L6\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$90, %al\n\tjg\t.L6\n\tmovzbl\t-10(%rbp), %eax\n\taddl\t$32, %eax\n\tmovb\t%al, -9(%rbp)\n\tmovsbl\t-9(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L5\n.L6:\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$96, %al\n\tjle\t.L7\n\tmovzbl\t-10(%rbp), %eax\n\tcmpb\t$122, %al\n\tjg\t.L7\n\tmovzbl\t-10(%rbp), %eax\n\tsubl\t$32, %eax\n\tmovb\t%al, -9(%rbp)\n\tmovsbl\t-9(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L5\n.L7:\n\tmovzbl\t-10(%rbp), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar@PLT\n.L5:\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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'){ C = ch + 32; printf("%c",C); } else if('a' <= ch && ch <= 'z'){ C = ch - 32; printf("%c",C); } else{ printf("%c",ch); } } printf("\n"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%c" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax .L8: leaq -10(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movzbl -10(%rbp), %eax cmpb $10, %al je .L12 movzbl -10(%rbp), %eax cmpb $32, %al jne .L4 movl $32, %edi call putchar@PLT jmp .L8 .L4: movzbl -10(%rbp), %eax cmpb $64, %al jle .L6 movzbl -10(%rbp), %eax cmpb $90, %al jg .L6 movzbl -10(%rbp), %eax addl $32, %eax movb %al, -9(%rbp) movsbl -9(%rbp), %eax movl %eax, %edi call putchar@PLT jmp .L5 .L6: movzbl -10(%rbp), %eax cmpb $96, %al jle .L7 movzbl -10(%rbp), %eax cmpb $122, %al jg .L7 movzbl -10(%rbp), %eax subl $32, %eax movb %al, -9(%rbp) movsbl -9(%rbp), %eax movl %eax, %edi call putchar@PLT jmp .L5 .L7: movzbl -10(%rbp), %eax movsbl %al, %eax movl %eax, %edi call putchar@PLT .L5: jmp .L8 .L12: nop movl $10, %edi call putchar@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-32(%rbp), %rax\n\taddq\t$3, %rax\n\tmovl\t$17, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L3\n\tcall\t__stack_chk_fail@PLT\n.L3:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%rbp, %rdi\n\tmovb\t$0, 19(%rsp)\n\tmovups\t%xmm0, 3(%rsp)\n\tcall\tputs@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L5\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, -16\n\tleaq\t.LC0(%rip), %rdi\n\tsubq\t$32, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%rbp, %rdi\n\tmovb\t$0, 19(%rsp)\n\tmovups\t%xmm0, 3(%rsp)\n\tcall\tputs@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L5\n\taddq\t$32, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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}", "index": 41, "inputs": [ "maohiro\n", "sakahashi\n", "orihoam\n", "sbkahashi\n", "ihsahakbs\n", "hhsaiakbr\n", "anphiro\n", "rbkaiashh\n", "onphira\n", "rkbaiashh\n", "arihpno\n", "skbajashh\n", "nmpgira\n", "sgi`pmn\n", "ska^iashi\n", "nlp`igs\n", "nplgi`s\n", "shsai_kai\n", "nqlgi`s\n", "shaai_ksi\n", "nilgq`s\n", "isk_iaahs\n", "inlgq`s\n", "s`qglin\n", "hsaai_kri\n", "milgq`s\n", "hta`i_jsi\n", "sgq`lim\n", "isj_i`ath\n", "ish_i`atj\n", "sgl`qil\n", "liq`lgs\n", "ith_i`auj\n", "itg_i`auj\n", "sgh`qll\n", "lghlps`\n", "lfhlps`\n", "`pslhfl\n", "lfilsp`\n", "lehlsp`\n", "vtg```kii\n", "sehllp`\n", "vig```kti\n", "sepllh`\n", "`hllpes\n", "wig``_ksi\n", "ehllo`s\n", "fhllo`s\n", "wi``g_ksi\n", "wsk_g``ii\n", "fhklns`\n", "fgklns`\n", "ij``g_ksw\n", "lsn`kgf\n", "lns`lgf\n", "fgl`snl\n", "wsj_f``ki\n", "ffl`snl\n", "wjs_f``ki\n", "gfl`snl\n", "wjt_f``ki\n", "ggl_rnl\n", "wju_f``kh\n", "hju_f``kw\n", "grl`fnl\n", "wk`f`_ujh\n", "grk`fnl\n", "frk`fnl\n", "ujg_`f`kw\n", "lof`krf\n", "ukg_`f_kw\n", "ukf_`f_kw\n", "hrk`fol\n", "krh`fol\n", "xk_f`_fku\n", "lpf`hrk\n", "wk_e`_fku\n", "lpe`hrk\n", "wj_ea_fku\n", "kqh`epl\n", "wje_u_fka\n", "lpd`hqk\n", "akf_u_ejw\n", "lod`hqk\n", "god`lqk\n", "kql`dog\n", "xie_u_fka\n", "kq`ldog\n", "kr`ldog\n", "al_fu_eix\n", "al^fu_eix\n", "glod`rk\n", "af^lu_eix\n", "kr_dolg\n", "gr_kold\n", "ixe]ul^fa\n", "rg_kold\n", "ae^lu]exi\n", "rgok_ld\n", "rgpk_ld\n", "naohiro\n", "takahashi\n", "takahashi\n" ], "outputs": [ "mao\n", "sak\n", "ori\n", "sbk\n", "ihs\n", "hhs\n", "anp\n", "rbk\n", "onp\n", "rkb\n", "ari\n", "skb\n", "nmp\n", "sgi\n", "ska\n", "nlp\n", "npl\n", "shs\n", "nql\n", "sha\n", "nil\n", "isk\n", "inl\n", "s`q\n", "hsa\n", "mil\n", "hta\n", "sgq\n", "isj\n", "ish\n", "sgl\n", "liq\n", "ith\n", "itg\n", "sgh\n", "lgh\n", "lfh\n", "`ps\n", "lfi\n", "leh\n", "vtg\n", "seh\n", "vig\n", "sep\n", "`hl\n", "wig\n", "ehl\n", "fhl\n", "wi`\n", "wsk\n", "fhk\n", "fgk\n", "ij`\n", "lsn\n", "lns\n", "fgl\n", "wsj\n", "ffl\n", "wjs\n", "gfl\n", "wjt\n", "ggl\n", "wju\n", "hju\n", "grl\n", "wk`\n", "grk\n", "frk\n", "ujg\n", "lof\n", "ukg\n", "ukf\n", "hrk\n", "krh\n", "xk_\n", "lpf\n", "wk_\n", "lpe\n", "wj_\n", "kqh\n", "wje\n", "lpd\n", "akf\n", "lod\n", "god\n", "kql\n", "xie\n", "kq`\n", "kr`\n", "al_\n", "al^\n", "glo\n", "af^\n", "kr_\n", "gr_\n", "ixe\n", "rg_\n", "ae^\n", "rgo\n", "rgp\n", "nao\n", "tak\n", "tak\n" ], "question": "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\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-32(%rbp), %rax\n\taddq\t$3, %rax\n\tmovl\t$17, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L3\n\tcall\t__stack_chk_fail@PLT\n.L3:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 .section .rodata .LC0: .string "%s" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -32(%rbp), %rax addq $3, %rax movl $17, %edx movl $0, %esi movq %rax, %rdi call memset@PLT leaq -32(%rbp), %rax movq %rax, %rdi call puts@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L3 call __stack_chk_fail@PLT .L3: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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,b) (((a)>(b))?(a):(b))\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#define ll long long\n#define INF 100000000\n#define FOR(i,a,n) for(i=(a);i<(n);i++)\nint comp(const void* a,const void* b){\n\treturn *(int*)a-*(int*)b;\n}\nvoid fill(int a[],int b,int c){\n\tint i;\n\tFOR(i,0,b) a[i]=c;\n\treturn;\n}\nint a[300][300];\nint used[300];\nint n,m,res=INF;\nvoid dfs(int cnt){\n\tint b[300],num=0,max,i,j;\n\tif(cnt==m) return;\n\tFOR(i,0,m) b[i]=0;\n\tFOR(i,0,n){\n\t\tFOR(j,0,m){\n\t\t\tif(!used[a[i][j]]){\n\t\t\t\tb[a[i][j]]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tFOR(i,0,m){\n\t\tif(num<b[i]){\n\t\t\tnum=b[i];\n\t\t\tmax=i;\n\t\t}\n\t}\n\tres=MIN(res,num);\n\tused[max]=1;\n\tdfs(cnt+1);\n\treturn;\n}\nint main(void)\n{\n\tint i,j;\n\tscanf(\"%d%d\",&n,&m);\n\tFOR(i,0,n){\n\t\tFOR(j,0,m){\n\t\t\tscanf(\"%d\",&a[i][j]);\n\t\t\ta[i][j]--;\n\t\t}\n\t}\n\tdfs(0);\n\tprintf(\"%d\\n\",res);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcomp, .-comp\n\t.globl\tfill\n\t.type\tfill, @function\nfill:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t%edx, -32(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\taddl\t$1, -4(%rbp)\n.L4:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L5\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tfill, .-fill\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 360000\na:\n\t.zero\t360000\n\t.globl\tused\n\t.align 32\n\t.type\tused, @object\n\t.size\tused, 1200\nused:\n\t.zero\t1200\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tm\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.globl\tres\n\t.data\n\t.align 4\n\t.type\tres, @object\n\t.size\tres, 4\nres:\n\t.long\t100000000\n\t.text\n\t.globl\tdfs\n\t.type\tdfs, @function\ndfs:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$1248, %rsp\n\tmovl\t%edi, -1236(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -1232(%rbp)\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1236(%rbp)\n\tje\t.L23\n\tmovl\t$0, -1224(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\tmovl\t$0, -1216(%rbp,%rax,4)\n\taddl\t$1, -1224(%rbp)\n.L10:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1224(%rbp)\n\tjl\t.L11\n\tmovl\t$0, -1224(%rbp)\n\tjmp\t.L12\n.L17:\n\tmovl\t$0, -1220(%rbp)\n\tjmp\t.L13\n.L16:\n\tmovl\t-1220(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tused(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L14\n\tmovl\t-1220(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-1216(%rbp,%rdx,4), %edx\n\taddl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -1216(%rbp,%rax,4)\n\tjmp\t.L15\n.L14:\n\taddl\t$1, -1220(%rbp)\n.L13:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1220(%rbp)\n\tjl\t.L16\n.L15:\n\taddl\t$1, -1224(%rbp)\n.L12:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -1224(%rbp)\n\tjl\t.L17\n\tmovl\t$0, -1224(%rbp)\n\tjmp\t.L18\n.L20:\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\tmovl\t-1216(%rbp,%rax,4), %eax\n\tcmpl\t%eax, -1232(%rbp)\n\tjge\t.L19\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\tmovl\t-1216(%rbp,%rax,4), %eax\n\tmovl\t%eax, -1232(%rbp)\n\tmovl\t-1224(%rbp), %eax\n\tmovl\t%eax, -1228(%rbp)\n.L19:\n\taddl\t$1, -1224(%rbp)\n.L18:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1224(%rbp)\n\tjl\t.L20\n\tmovl\tres(%rip), %edx\n\tmovl\t-1232(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t%eax, res(%rip)\n\tmovl\t-1228(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tused(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\tmovl\t-1236(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\tdfs\n\tjmp\t.L7\n.L23:\n\tnop\n.L7:\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L22\n\tcall\t__stack_chk_fail@PLT\n.L22:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tdfs, .-dfs\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tm(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L25\n.L28:\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tleal\t-1(%rax), %ecx\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\taddl\t$1, -4(%rbp)\n.L26:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjl\t.L27\n\taddl\t$1, -8(%rbp)\n.L25:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L28\n\tmovl\t$0, %edi\n\tcall\tdfs\n\tmovl\tres(%rip), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %ecx\n\ttestl\t%esi, %esi\n\tjle\t.L3\n\tleal\t-1(%rsi), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L8\n\tshrl\t$2, %esi\n\tmovd\t%edx, %xmm1\n\tmovq\t%rdi, %rax\n\tsubl\t$1, %esi\n\tpshufd\t$0, %xmm1, %xmm0\n\tsalq\t$4, %rsi\n\tleaq\t16(%rdi,%rsi), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovups\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rsi, %rax\n\tjne\t.L6\n\tmovl\t%ecx, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %cl\n\tje\t.L10\n.L5:\n\tmovslq\t%eax, %rsi\n\tmovl\t%edx, (%rdi,%rsi,4)\n\tleaq\t0(,%rsi,4), %r8\n\tleal\t1(%rax), %esi\n\tcmpl\t%esi, %ecx\n\tjle\t.L3\n\taddl\t$2, %eax\n\tmovl\t%edx, 4(%rdi,%r8)\n\tcmpl\t%eax, %ecx\n\tjle\t.L3\n\tmovl\t%edx, 8(%rdi,%r8)\n.L3:\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tret\n.L8:\n\txorl\t%eax, %eax\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE52:\n\t.size\tfill, .-fill\n\t.p2align 4\n\t.globl\tdfs\n\t.type\tdfs, @function\ndfs:\n.LFB53:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$1256, %rsp\n\t.cfi_def_cfa_offset 1312\n\tmovl\tm(%rip), %ebp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1240(%rsp)\n\txorl\t%eax, %eax\n\tcmpl\t%ebp, %edi\n\tje\t.L11\n\tleal\t-1(%rbp), %r14d\n\tleaq\t4+a(%rip), %rdx\n\tmovq\t$-4, %r15\n\tmovl\tn(%rip), %r12d\n\tleaq\t4(,%r14,4), %rax\n\tmovl\tres(%rip), %r13d\n\tmovl\t%edi, %r9d\n\tleaq\tused(%rip), %rbx\n\tmovq\t%rax, 16(%rsp)\n\tleaq\t0(,%r14,4), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tsubq\t%rax, %r15\n\tmovq\t%rcx, 24(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L26:\n\ttestl\t%ebp, %ebp\n\tjle\t.L36\n\tmovq\t16(%rsp), %rdx\n\tleaq\t32(%rsp), %rdi\n\txorl\t%esi, %esi\n\tmovl\t%r9d, 12(%rsp)\n\tmovl\t%r8d, 8(%rsp)\n\tcall\tmemset@PLT\n\ttestl\t%r12d, %r12d\n\tmovl\t8(%rsp), %r8d\n\tmovl\t12(%rsp), %r9d\n\tmovq\t%rax, %rdi\n\tjle\t.L15\n.L27:\n\tmovq\t24(%rsp), %rsi\n\txorl\t%edi, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tleaq\t(%r15,%rsi), %rax\n\ttestl\t%ebp, %ebp\n\tjg\t.L19\n\tjmp\t.L18\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\taddq\t$4, %rax\n\tcmpq\t%rsi, %rax\n\tje\t.L18\n.L19:\n\tmovslq\t(%rax), %rdx\n\tmovl\t(%rbx,%rdx,4), %ecx\n\ttestl\t%ecx, %ecx\n\tjne\t.L17\n\taddl\t$1, 32(%rsp,%rdx,4)\n.L18:\n\taddl\t$1, %edi\n\taddq\t$1200, %rsi\n\tcmpl\t%edi, %r12d\n\tjg\t.L16\n\tleaq\t32(%rsp), %rdi\n\ttestl\t%ebp, %ebp\n\tjle\t.L28\n.L15:\n\txorl\t%eax, %eax\n\txorl\t%esi, %esi\n\tjmp\t.L24\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovq\t%rdx, %rax\n.L24:\n\tmovl\t(%rdi,%rax,4), %edx\n\tcmpl\t%esi, %edx\n\tjle\t.L23\n\tmovl\t%eax, %r8d\n\tmovl\t%edx, %esi\n.L23:\n\tleaq\t1(%rax), %rdx\n\tcmpq\t%rax, %r14\n\tjne\t.L30\n.L22:\n\tcmpl\t%esi, %r13d\n\tmovslq\t%r8d, %rax\n\tcmovg\t%esi, %r13d\n\taddl\t$1, %r9d\n\tmovl\t$1, (%rbx,%rax,4)\n\tcmpl\t%r9d, %ebp\n\tjne\t.L26\n\tmovl\t%r13d, res(%rip)\n.L11:\n\tmovq\t1240(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L37\n\taddq\t$1256, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L36:\n\t.cfi_restore_state\n\ttestl\t%r12d, %r12d\n\tjg\t.L27\n.L28:\n\txorl\t%esi, %esi\n\tjmp\t.L22\n.L37:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tdfs, .-dfs\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.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\tm(%rip), %rdx\n\tleaq\tn(%rip), %rsi\n\txorl\t%eax, %eax\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L39\n\tmovl\tm(%rip), %eax\n\txorl\t%r14d, %r14d\n\txorl\t%r13d, %r13d\n\tleaq\ta(%rip), %r15\n\tleaq\t.LC1(%rip), %r12\n\ttestl\t%eax, %eax\n\tjle\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tleaq\t(%r15,%r14,4), %rbx\n\txorl\t%ebp, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tm(%rip), %eax\n\tsubl\t$1, (%rbx)\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %eax\n\tjg\t.L41\n\taddl\t$1, %r13d\n\tcmpl\tn(%rip), %r13d\n\tjge\t.L39\n\taddq\t$300, %r14\n\ttestl\t%eax, %eax\n\tjg\t.L43\n.L39:\n\txorl\t%edi, %edi\n\tcall\tdfs\n\tmovl\tres(%rip), %edx\n\tleaq\t.LC2(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tmain, .-main\n\t.globl\tres\n\t.data\n\t.align 4\n\t.type\tres, @object\n\t.size\tres, 4\nres:\n\t.long\t100000000\n\t.globl\tm\n\t.bss\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tused\n\t.align 32\n\t.type\tused, @object\n\t.size\tused, 1200\nused:\n\t.zero\t1200\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 360000\na:\n\t.zero\t360000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.cfi_startproc\n\tendbr64\n\tmovl\t%esi, %ecx\n\ttestl\t%esi, %esi\n\tjle\t.L3\n\tleal\t-1(%rsi), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L8\n\tshrl\t$2, %esi\n\tmovd\t%edx, %xmm1\n\tmovq\t%rdi, %rax\n\tsubl\t$1, %esi\n\tpshufd\t$0, %xmm1, %xmm0\n\tsalq\t$4, %rsi\n\tleaq\t16(%rdi,%rsi), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovups\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rsi, %rax\n\tjne\t.L6\n\tmovl\t%ecx, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %cl\n\tje\t.L10\n.L5:\n\tmovslq\t%eax, %rsi\n\tmovl\t%edx, (%rdi,%rsi,4)\n\tleaq\t0(,%rsi,4), %r8\n\tleal\t1(%rax), %esi\n\tcmpl\t%esi, %ecx\n\tjle\t.L3\n\taddl\t$2, %eax\n\tmovl\t%edx, 4(%rdi,%r8)\n\tcmpl\t%eax, %ecx\n\tjle\t.L3\n\tmovl\t%edx, 8(%rdi,%r8)\n.L3:\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tret\n.L8:\n\txorl\t%eax, %eax\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE52:\n\t.size\tfill, .-fill\n\t.p2align 4\n\t.globl\tdfs\n\t.type\tdfs, @function\ndfs:\n.LFB53:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$1256, %rsp\n\t.cfi_def_cfa_offset 1312\n\tmovl\tm(%rip), %ebp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1240(%rsp)\n\txorl\t%eax, %eax\n\tcmpl\t%ebp, %edi\n\tje\t.L11\n\tleal\t-1(%rbp), %r14d\n\tleaq\t4+a(%rip), %rdx\n\tmovq\t$-4, %r15\n\tmovl\tn(%rip), %r12d\n\tleaq\t4(,%r14,4), %rax\n\tmovl\tres(%rip), %r13d\n\tmovl\t%edi, %r9d\n\tleaq\tused(%rip), %rbx\n\tmovq\t%rax, 16(%rsp)\n\tleaq\t0(,%r14,4), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tsubq\t%rax, %r15\n\tmovq\t%rcx, 24(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L26:\n\ttestl\t%ebp, %ebp\n\tjle\t.L36\n\tmovq\t16(%rsp), %rdx\n\tleaq\t32(%rsp), %rdi\n\txorl\t%esi, %esi\n\tmovl\t%r9d, 12(%rsp)\n\tmovl\t%r8d, 8(%rsp)\n\tcall\tmemset@PLT\n\ttestl\t%r12d, %r12d\n\tmovl\t8(%rsp), %r8d\n\tmovl\t12(%rsp), %r9d\n\tmovq\t%rax, %rdi\n\tjle\t.L15\n.L27:\n\tmovq\t24(%rsp), %rsi\n\txorl\t%edi, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tleaq\t(%r15,%rsi), %rax\n\ttestl\t%ebp, %ebp\n\tjg\t.L19\n\tjmp\t.L18\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\taddq\t$4, %rax\n\tcmpq\t%rsi, %rax\n\tje\t.L18\n.L19:\n\tmovslq\t(%rax), %rdx\n\tmovl\t(%rbx,%rdx,4), %ecx\n\ttestl\t%ecx, %ecx\n\tjne\t.L17\n\taddl\t$1, 32(%rsp,%rdx,4)\n.L18:\n\taddl\t$1, %edi\n\taddq\t$1200, %rsi\n\tcmpl\t%edi, %r12d\n\tjg\t.L16\n\tleaq\t32(%rsp), %rdi\n\ttestl\t%ebp, %ebp\n\tjle\t.L28\n.L15:\n\txorl\t%eax, %eax\n\txorl\t%esi, %esi\n\tjmp\t.L24\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovq\t%rdx, %rax\n.L24:\n\tmovl\t(%rdi,%rax,4), %edx\n\tcmpl\t%esi, %edx\n\tjle\t.L23\n\tmovl\t%eax, %r8d\n\tmovl\t%edx, %esi\n.L23:\n\tleaq\t1(%rax), %rdx\n\tcmpq\t%rax, %r14\n\tjne\t.L30\n.L22:\n\tcmpl\t%esi, %r13d\n\tmovslq\t%r8d, %rax\n\tcmovg\t%esi, %r13d\n\taddl\t$1, %r9d\n\tmovl\t$1, (%rbx,%rax,4)\n\tcmpl\t%r9d, %ebp\n\tjne\t.L26\n\tmovl\t%r13d, res(%rip)\n.L11:\n\tmovq\t1240(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L37\n\taddq\t$1256, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L36:\n\t.cfi_restore_state\n\ttestl\t%r12d, %r12d\n\tjg\t.L27\n.L28:\n\txorl\t%esi, %esi\n\tjmp\t.L22\n.L37:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tdfs, .-dfs\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.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\tm(%rip), %rdx\n\tleaq\tn(%rip), %rsi\n\txorl\t%eax, %eax\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L39\n\tmovl\tm(%rip), %eax\n\txorl\t%r14d, %r14d\n\txorl\t%r13d, %r13d\n\tleaq\ta(%rip), %r15\n\tleaq\t.LC1(%rip), %r12\n\ttestl\t%eax, %eax\n\tjle\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tleaq\t(%r15,%r14,4), %rbx\n\txorl\t%ebp, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\tmovq\t%rbx, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tm(%rip), %eax\n\tsubl\t$1, (%rbx)\n\taddq\t$4, %rbx\n\tcmpl\t%ebp, %eax\n\tjg\t.L41\n\taddl\t$1, %r13d\n\tcmpl\tn(%rip), %r13d\n\tjge\t.L39\n\taddq\t$300, %r14\n\ttestl\t%eax, %eax\n\tjg\t.L43\n.L39:\n\txorl\t%edi, %edi\n\tcall\tdfs\n\tmovl\tres(%rip), %edx\n\tleaq\t.LC2(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tmain, .-main\n\t.globl\tres\n\t.data\n\t.align 4\n\t.type\tres, @object\n\t.size\tres, 4\nres:\n\t.long\t100000000\n\t.globl\tm\n\t.bss\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tused\n\t.align 32\n\t.type\tused, @object\n\t.size\tused, 1200\nused:\n\t.zero\t1200\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 360000\na:\n\t.zero\t360000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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,b) (((a)>(b))?(a):(b))\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#define ll long long\n#define INF 100000000\n#define FOR(i,a,n) for(i=(a);i<(n);i++)\nint comp(const void* a,const void* b){\n\treturn *(int*)a-*(int*)b;\n}\nvoid fill(int a[],int b,int c){\n\tint i;\n\tFOR(i,0,b) a[i]=c;\n\treturn;\n}\nint a[300][300];\nint used[300];\nint n,m,res=INF;\nvoid dfs(int cnt){\n\tint b[300],num=0,max,i,j;\n\tif(cnt==m) return;\n\tFOR(i,0,m) b[i]=0;\n\tFOR(i,0,n){\n\t\tFOR(j,0,m){\n\t\t\tif(!used[a[i][j]]){\n\t\t\t\tb[a[i][j]]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tFOR(i,0,m){\n\t\tif(num<b[i]){\n\t\t\tnum=b[i];\n\t\t\tmax=i;\n\t\t}\n\t}\n\tres=MIN(res,num);\n\tused[max]=1;\n\tdfs(cnt+1);\n\treturn;\n}\nint main(void)\n{\n\tint i,j;\n\tscanf(\"%d%d\",&n,&m);\n\tFOR(i,0,n){\n\t\tFOR(j,0,m){\n\t\t\tscanf(\"%d\",&a[i][j]);\n\t\t\ta[i][j]--;\n\t\t}\n\t}\n\tdfs(0);\n\tprintf(\"%d\\n\",res);\n\treturn 0;\n}", "index": 39, "inputs": [ "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n", "2 3\n2 1 3\n2 1 3\n2 1 3\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 5\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 7\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 0 1 4 5\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 4 5\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 4 2 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 8\n2 5 4 2 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 0 5\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 0 1 4 5\n2 5 1 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 1 5\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 7\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n2 5 1 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 3 1 1 5\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 7 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n3 5 1 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 1 1 6 10\n2 7 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n3 5 1 4 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n4 5 1 4 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 4 1 6 7\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 4 5\n2 5 4 6 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 4 5\n4 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 4 2 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 0 1 6 10\n2 5 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 1 1 1 5\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 7 3 3 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n3 5 2 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 1 0 6 10\n2 7 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 1 4 5\n3 5 1 4 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n4 5 1 8 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 4 1 6 12\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 4 5\n2 5 4 6 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 8 2 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 1 6 10\n2 5 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 1 1 1 9\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 5 1 6 10\n2 7 3 3 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n4 5 1 8 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 2 4 5\n2 5 4 6 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 1 1 1 9\n2 7 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 5 1 6 10\n2 6 3 3 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 5\n2 5 4 6 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 1 1 0 9\n2 7 5 3 1\n", "1 3\n2 1 3\n2 1 3\n2 1 3\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 0 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 2 6 7\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 9 10\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 2 1 5\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 2 4 7\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 3 0 1 5\n2 5 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 4 1 6 7\n2 9 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n3 10 2 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 8 5\n2 5 4 6 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n4 5 1 12 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 1 2 4 5\n2 5 4 6 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n5 1 1 1 9\n2 7 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 5\n2 5 4 5 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 1 1 0 9\n1 7 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 1 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 2 6 7\n2 5 4 3 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 10 10\n2 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n2 5 5 1 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 3 0 1 5\n2 5 5 0 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 1 1 6 7\n2 9 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 8 5\n2 5 4 6 4\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 5 5\n4 5 1 12 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 5\n2 5 1 5 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 3 0 1 5\n2 5 3 0 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 0 1 6 7\n2 9 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 5\n2 5 1 4 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 4\n2 5 1 4 2\n", "1 3\n2 1 3\n2 1 4\n2 1 3\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 1 8\n2 5 4 2 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 3\n2 5 1 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 6 10\n3 7 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 7 5\n3 5 1 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 8\n3 5 1 4 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 1 0 6 10\n2 7 3 6 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 8\n4 5 1 8 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 4 1 6 12\n3 5 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 1 4 2\n2 5 4 6 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 3 1 6 10\n2 5 8 2 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 0 6 10\n2 5 3 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 6 1 6 10\n2 7 3 3 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n4 6 1 8 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n4 0 2 4 5\n2 5 4 7 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 5\n2 5 4 6 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 1 1 0 9\n2 7 2 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 1 4 0 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 2 6 7\n2 5 4 3 0\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n3 3 0 1 5\n2 5 7 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 4 1 2 7\n2 9 4 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n5 10 2 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n1 0 1 4 5\n4 5 1 12 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n0 0 2 4 5\n2 5 4 7 2\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n6 1 1 0 9\n1 7 5 3 1\n", "2 5\n5 1 3 4 2\n2 5 3 1 4\n2 6 1 6 10\n2 5 5 1 1\n", "3 3\n2 1 3\n2 1 3\n2 1 3\n", "4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n", "4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n" ], "outputs": [ "1\n", "2\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "3\n", "2\n", "2\n" ], "question": "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,b) (((a)>(b))?(a):(b))\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#define ll long long\n#define INF 100000000\n#define FOR(i,a,n) for(i=(a);i<(n);i++)\nint comp(const void* a,const void* b){\n\treturn *(int*)a-*(int*)b;\n}\nvoid fill(int a[],int b,int c){\n\tint i;\n\tFOR(i,0,b) a[i]=c;\n\treturn;\n}\nint a[300][300];\nint used[300];\nint n,m,res=INF;\nvoid dfs(int cnt){\n\tint b[300],num=0,max,i,j;\n\tif(cnt==m) return;\n\tFOR(i,0,m) b[i]=0;\n\tFOR(i,0,n){\n\t\tFOR(j,0,m){\n\t\t\tif(!used[a[i][j]]){\n\t\t\t\tb[a[i][j]]++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tFOR(i,0,m){\n\t\tif(num<b[i]){\n\t\t\tnum=b[i];\n\t\t\tmax=i;\n\t\t}\n\t}\n\tres=MIN(res,num);\n\tused[max]=1;\n\tdfs(cnt+1);\n\treturn;\n}\nint main(void)\n{\n\tint i,j;\n\tscanf(\"%d%d\",&n,&m);\n\tFOR(i,0,n){\n\t\tFOR(j,0,m){\n\t\t\tscanf(\"%d\",&a[i][j]);\n\t\t\ta[i][j]--;\n\t\t}\n\t}\n\tdfs(0);\n\tprintf(\"%d\\n\",res);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcomp\n\t.type\tcomp, @function\ncomp:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcomp, .-comp\n\t.globl\tfill\n\t.type\tfill, @function\nfill:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t%edx, -32(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\taddl\t$1, -4(%rbp)\n.L4:\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjl\t.L5\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tfill, .-fill\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 360000\na:\n\t.zero\t360000\n\t.globl\tused\n\t.align 32\n\t.type\tused, @object\n\t.size\tused, 1200\nused:\n\t.zero\t1200\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tm\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.globl\tres\n\t.data\n\t.align 4\n\t.type\tres, @object\n\t.size\tres, 4\nres:\n\t.long\t100000000\n\t.text\n\t.globl\tdfs\n\t.type\tdfs, @function\ndfs:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$1248, %rsp\n\tmovl\t%edi, -1236(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -1232(%rbp)\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1236(%rbp)\n\tje\t.L23\n\tmovl\t$0, -1224(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\tmovl\t$0, -1216(%rbp,%rax,4)\n\taddl\t$1, -1224(%rbp)\n.L10:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1224(%rbp)\n\tjl\t.L11\n\tmovl\t$0, -1224(%rbp)\n\tjmp\t.L12\n.L17:\n\tmovl\t$0, -1220(%rbp)\n\tjmp\t.L13\n.L16:\n\tmovl\t-1220(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tused(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L14\n\tmovl\t-1220(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-1216(%rbp,%rdx,4), %edx\n\taddl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -1216(%rbp,%rax,4)\n\tjmp\t.L15\n.L14:\n\taddl\t$1, -1220(%rbp)\n.L13:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1220(%rbp)\n\tjl\t.L16\n.L15:\n\taddl\t$1, -1224(%rbp)\n.L12:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -1224(%rbp)\n\tjl\t.L17\n\tmovl\t$0, -1224(%rbp)\n\tjmp\t.L18\n.L20:\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\tmovl\t-1216(%rbp,%rax,4), %eax\n\tcmpl\t%eax, -1232(%rbp)\n\tjge\t.L19\n\tmovl\t-1224(%rbp), %eax\n\tcltq\n\tmovl\t-1216(%rbp,%rax,4), %eax\n\tmovl\t%eax, -1232(%rbp)\n\tmovl\t-1224(%rbp), %eax\n\tmovl\t%eax, -1228(%rbp)\n.L19:\n\taddl\t$1, -1224(%rbp)\n.L18:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -1224(%rbp)\n\tjl\t.L20\n\tmovl\tres(%rip), %edx\n\tmovl\t-1232(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t%eax, res(%rip)\n\tmovl\t-1228(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tused(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\tmovl\t-1236(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\tdfs\n\tjmp\t.L7\n.L23:\n\tnop\n.L7:\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L22\n\tcall\t__stack_chk_fail@PLT\n.L22:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tdfs, .-dfs\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tm(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L25\n.L28:\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tleal\t-1(%rax), %ecx\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\timulq\t$300, %rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\taddl\t$1, -4(%rbp)\n.L26:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjl\t.L27\n\taddl\t$1, -8(%rbp)\n.L25:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L28\n\tmovl\t$0, %edi\n\tcall\tdfs\n\tmovl\tres(%rip), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 MIN(a,b) (((a)<(b))?(a):(b)) #define ll long long #define INF 100000000 #define FOR(i,a,n) for(i=(a);i<(n);i++) int comp(const void* a,const void* b){ return *(int*)a-*(int*)b; } void fill(int a[],int b,int c){ int i; FOR(i,0,b) a[i]=c; return; } int a[300][300]; int used[300]; int n,m,res=INF; void dfs(int cnt){ int b[300],num=0,max,i,j; if(cnt==m) return; FOR(i,0,m) b[i]=0; FOR(i,0,n){ FOR(j,0,m){ if(!used[a[i][j]]){ b[a[i][j]]++; break; } } } FOR(i,0,m){ if(num<b[i]){ num=b[i]; max=i; } } res=MIN(res,num); used[max]=1; dfs(cnt+1); return; } int main(void) { int i,j; scanf("%d%d",&n,&m); FOR(i,0,n){ FOR(j,0,m){ scanf("%d",&a[i][j]); a[i][j]--; } } dfs(0); printf("%d\n",res); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl comp .type comp, @function comp: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size comp, .-comp .globl fill .type fill, @function fill: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movl %esi, -28(%rbp) movl %edx, -32(%rbp) movl $0, -4(%rbp) jmp .L4 .L5: movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rax, %rdx movl -32(%rbp), %eax movl %eax, (%rdx) addl $1, -4(%rbp) .L4: movl -4(%rbp), %eax cmpl -28(%rbp), %eax jl .L5 nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size fill, .-fill .globl a .bss .align 32 .type a, @object .size a, 360000 a: .zero 360000 .globl used .align 32 .type used, @object .size used, 1200 used: .zero 1200 .globl n .align 4 .type n, @object .size n, 4 n: .zero 4 .globl m .align 4 .type m, @object .size m, 4 m: .zero 4 .globl res .data .align 4 .type res, @object .size res, 4 res: .long 100000000 .text .globl dfs .type dfs, @function dfs: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $1248, %rsp movl %edi, -1236(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -1232(%rbp) movl m(%rip), %eax cmpl %eax, -1236(%rbp) je .L23 movl $0, -1224(%rbp) jmp .L10 .L11: movl -1224(%rbp), %eax cltq movl $0, -1216(%rbp,%rax,4) addl $1, -1224(%rbp) .L10: movl m(%rip), %eax cmpl %eax, -1224(%rbp) jl .L11 movl $0, -1224(%rbp) jmp .L12 .L17: movl $0, -1220(%rbp) jmp .L13 .L16: movl -1220(%rbp), %eax movslq %eax, %rdx movl -1224(%rbp), %eax cltq imulq $300, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,4), %rdx leaq used(%rip), %rax movl (%rdx,%rax), %eax testl %eax, %eax jne .L14 movl -1220(%rbp), %eax movslq %eax, %rdx movl -1224(%rbp), %eax cltq imulq $300, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax movslq %eax, %rdx movl -1216(%rbp,%rdx,4), %edx addl $1, %edx cltq movl %edx, -1216(%rbp,%rax,4) jmp .L15 .L14: addl $1, -1220(%rbp) .L13: movl m(%rip), %eax cmpl %eax, -1220(%rbp) jl .L16 .L15: addl $1, -1224(%rbp) .L12: movl n(%rip), %eax cmpl %eax, -1224(%rbp) jl .L17 movl $0, -1224(%rbp) jmp .L18 .L20: movl -1224(%rbp), %eax cltq movl -1216(%rbp,%rax,4), %eax cmpl %eax, -1232(%rbp) jge .L19 movl -1224(%rbp), %eax cltq movl -1216(%rbp,%rax,4), %eax movl %eax, -1232(%rbp) movl -1224(%rbp), %eax movl %eax, -1228(%rbp) .L19: addl $1, -1224(%rbp) .L18: movl m(%rip), %eax cmpl %eax, -1224(%rbp) jl .L20 movl res(%rip), %edx movl -1232(%rbp), %eax cmpl %eax, %edx cmovle %edx, %eax movl %eax, res(%rip) movl -1228(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq used(%rip), %rax movl $1, (%rdx,%rax) movl -1236(%rbp), %eax addl $1, %eax movl %eax, %edi call dfs jmp .L7 .L23: nop .L7: movq -8(%rbp), %rax subq %fs:40, %rax je .L22 call __stack_chk_fail@PLT .L22: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size dfs, .-dfs .section .rodata .LC0: .string "%d%d" .LC1: .string "%d" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp leaq m(%rip), %rax movq %rax, %rdx leaq n(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -8(%rbp) jmp .L25 .L28: movl $0, -4(%rbp) jmp .L26 .L27: movl -4(%rbp), %eax movslq %eax, %rdx movl -8(%rbp), %eax cltq imulq $300, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -4(%rbp), %eax movslq %eax, %rdx movl -8(%rbp), %eax cltq imulq $300, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax leal -1(%rax), %ecx movl -4(%rbp), %eax movslq %eax, %rdx movl -8(%rbp), %eax cltq imulq $300, %rax, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl %ecx, (%rdx,%rax) addl $1, -4(%rbp) .L26: movl m(%rip), %eax cmpl %eax, -4(%rbp) jl .L27 addl $1, -8(%rbp) .L25: movl n(%rip), %eax cmpl %eax, -8(%rbp) jl .L28 movl $0, %edi call dfs movl res(%rip), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 y=a;\n }\n else\n {\n y=b;\n }\n }\n else\n {\n x=b;\n b=b-1;\n if(b>=a)\n {\n y=b;\n }\n else\n {\n y=a;\n }\n }\n\n printf(\"%d\",x+y);\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L2\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L3\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L5\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n.L4:\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %edx\n\tmovl\t4(%rsp), %ecx\n\tcmpl\t%ecx, %edx\n\tjl\t.L2\n\tleal\t-1(%rdx), %eax\n\tcmpl\t%eax, %ecx\n\tmovl\t%eax, (%rsp)\n\tcmovge\t%ecx, %eax\n.L3:\n\taddl\t%eax, %edx\n\tleaq\t.LC1(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleal\t-1(%rcx), %eax\n\tcmpl\t%eax, %edx\n\tmovl\t%eax, 4(%rsp)\n\tcmovge\t%edx, %eax\n\tmovl\t%ecx, %edx\n\tjmp\t.L3\n.L7:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %edx\n\tmovl\t4(%rsp), %ecx\n\tcmpl\t%ecx, %edx\n\tjl\t.L2\n\tleal\t-1(%rdx), %eax\n\tcmpl\t%eax, %ecx\n\tmovl\t%eax, (%rsp)\n\tcmovge\t%ecx, %eax\n.L3:\n\taddl\t%eax, %edx\n\tleaq\t.LC1(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleal\t-1(%rcx), %eax\n\tcmpl\t%eax, %edx\n\tmovl\t%eax, 4(%rsp)\n\tcmovge\t%edx, %eax\n\tmovl\t%ecx, %edx\n\tjmp\t.L3\n.L7:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 y=a;\n }\n else\n {\n y=b;\n }\n }\n else\n {\n x=b;\n b=b-1;\n if(b>=a)\n {\n y=b;\n }\n else\n {\n y=a;\n }\n }\n\n printf(\"%d\",x+y);\n return 0;\n}\n\n", "index": 55, "inputs": [ "6 4\n", "10 3\n", "4 3\n", "12 3\n", "9 2\n", "2 3\n", "15 3\n", "2 1\n", "18 3\n", "14 2\n", "2 2\n", "1 1\n", "1 0\n", "5 5\n", "5 2\n", "8 2\n", "0 -1\n", "-1 11\n", "0 0\n", "-1 -1\n", "-1 -2\n", "-1 16\n", "-2 -22\n", "-3 -22\n", "-4 -16\n", "-2 19\n", "3 3\n", "25 1\n", "23 -1\n", "45 -1\n", "-6 -5\n", "17 0\n", "0 7\n", "21 0\n", "-6 13\n", "4 4\n", "0 20\n", "0 39\n", "1 52\n", "1 24\n", "1 40\n", "1 62\n", "1 101\n", "1 100\n", "-134 -8\n", "-134 -12\n", "2 110\n", "16 111\n", "11 011\n", "-2 -2\n", "-4 -4\n", "-1 38\n", "-1 65\n", "-1 53\n", "-38 -6\n", "-7 -7\n", "-7 -10\n", "-13 -10\n", "28 001\n", "35 001\n", "56 001\n", "100 100\n", "111 111\n", "101 101\n", "-10 -10\n", "-47 -9\n", "010 010\n", "110 110\n", "1 32\n", "1 43\n", "0 22\n", "0 26\n", "-1 37\n", "1 31\n", "-1 46\n", "-1 78\n", "-3 47\n", "-6 69\n", "0 29\n", "-11 -11\n", "-11 -13\n", "-3 -3\n", "-5 -5\n", "-6 -6\n", "6 3\n", "6 2\n", "9 1\n", "18 5\n", "0 2\n", "9 5\n", "-1 2\n", "-2 2\n", "2 0\n", "-3 2\n", "3 0\n", "-5 2\n", "6 0\n", "0 4\n", "-5 1\n", "9 0\n", "3 4\n", "5 3\n", "6 6\n", "5 3\n" ], "outputs": [ "11", "19", "7", "23", "17", "5", "29", "3", "35", "27", "4", "2", "1", "10", "9", "15", "-1", "21", "0", "-2", "-3", "31", "-5", "-7", "-9", "37", "6", "49", "45", "89", "-11", "33", "13", "41", "25", "8", "39", "77", "103", "47", "79", "123", "201", "199", "-17", "-25", "219", "221", "22", "-4", "-8", "75", "129", "105", "-13", "-14", "-15", "-21", "55", "69", "111", "200", "222", "202", "-20", "-19", "20", "220", "63", "85", "43", "51", "73", "61", "91", "155", "93", "137", "57", "-22", "-23", "-6", "-10", "-12", "11", "11", "17", "35", "3", "17", "3", "3", "3", "3", "5", "3", "11", "7", "1", "17", "7", "9", "12", "9" ], "question": "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 y=a;\n }\n else\n {\n y=b;\n }\n }\n else\n {\n x=b;\n b=b-1;\n if(b>=a)\n {\n y=b;\n }\n else\n {\n y=a;\n }\n }\n\n printf(\"%d\",x+y);\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L2\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L3\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L2:\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %edx\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L5\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n.L4:\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L7\n\tcall\t__stack_chk_fail@PLT\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 { y=b; } } else { x=b; b=b-1; if(b>=a) { y=b; } else { y=a; } } printf("%d",x+y); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d%d" .LC1: .string "%d" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -20(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %edx movl -20(%rbp), %eax cmpl %eax, %edx jl .L2 movl -24(%rbp), %eax movl %eax, -16(%rbp) movl -24(%rbp), %eax subl $1, %eax movl %eax, -24(%rbp) movl -24(%rbp), %edx movl -20(%rbp), %eax cmpl %eax, %edx jl .L3 movl -24(%rbp), %eax movl %eax, -12(%rbp) jmp .L4 .L3: movl -20(%rbp), %eax movl %eax, -12(%rbp) jmp .L4 .L2: movl -20(%rbp), %eax movl %eax, -16(%rbp) movl -20(%rbp), %eax subl $1, %eax movl %eax, -20(%rbp) movl -20(%rbp), %edx movl -24(%rbp), %eax cmpl %eax, %edx jl .L5 movl -20(%rbp), %eax movl %eax, -12(%rbp) jmp .L4 .L5: movl -24(%rbp), %eax movl %eax, -12(%rbp) .L4: movl -16(%rbp), %edx movl -12(%rbp), %eax addl %edx, %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L7 call __stack_chk_fail@PLT .L7: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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) > (b) ? (b) : (a))\n#define Abs(x) ((x) > 0 ? (x) : -(x))\n#define REP(i, n) for(int i = 0; i < n; i++)\n#define INF 1000000000000 //10^12\n#define MOD 1000000007 //10^9 + 7\ntypedef long long ll;\n\nint\nmain(int arg, char *argv[])\n{\n char s[200000];\n scanf(\"%s\", s);\n int f = 0, l = strlen(s) - 1, cnt = 0, flag = 0;\n while(l - f >= 0){\n if(s[f] == 'x' && s[l] != 'x'){\n f++;\n cnt++;\n }\n else if(s[f] != 'x' && s[l] == 'x'){\n l--;\n cnt++;\n }\n else if(s[l] == s[f]){\n f++;\n l--;\n }\n else{\n printf(\"-1\\n\");\n return 0;\n }\n }\n \n printf(\"%d\\n\", cnt);\n\n return 0;\n}\n \n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-196608(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3440, %rsp\n\tmovl\t%edi, -200036(%rbp)\n\tmovq\t%rsi, -200048(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -200032(%rbp)\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tsubl\t$1, %eax\n\tmovl\t%eax, -200028(%rbp)\n\tmovl\t$0, -200024(%rbp)\n\tmovl\t$0, -200020(%rbp)\n\tjmp\t.L2\n.L7:\n\tmovl\t-200032(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tjne\t.L3\n\tmovl\t-200028(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tje\t.L3\n\taddl\t$1, -200032(%rbp)\n\taddl\t$1, -200024(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-200032(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tje\t.L4\n\tmovl\t-200028(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tjne\t.L4\n\tsubl\t$1, -200028(%rbp)\n\taddl\t$1, -200024(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-200028(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %edx\n\tmovl\t-200032(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L5\n\taddl\t$1, -200032(%rbp)\n\tsubl\t$1, -200028(%rbp)\n\tjmp\t.L2\n.L5:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L8\n.L2:\n\tmovl\t-200028(%rbp), %eax\n\tsubl\t-200032(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjns\t.L7\n\tmovl\t-200024(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L8:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L9\n\tcall\t__stack_chk_fail@PLT\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t-196608(%rsp), %r11\n\t.cfi_def_cfa 11, 196624\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3408, %rsp\n\t.cfi_def_cfa_offset 200032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 200008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\ttestl\t%eax, %eax\n\tje\t.L11\n\tleal\t-1(%rax), %edx\n\txorl\t%r8d, %r8d\n\txorl\t%eax, %eax\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tcmpb\t$120, %sil\n\tje\t.L18\n\tcmpb\t%sil, %cl\n\tjne\t.L7\n.L4:\n\taddl\t$1, %eax\n\tsubl\t$1, %edx\n.L5:\n\tcmpl\t%eax, %edx\n\tjl\t.L2\n.L9:\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rsi\n\tmovzbl\t(%rsp,%rcx), %ecx\n\tmovzbl\t(%rsp,%rsi), %esi\n\tcmpb\t$120, %cl\n\tjne\t.L3\n\tcmpb\t$120, %sil\n\tje\t.L4\n\taddl\t$1, %eax\n\taddl\t$1, %r8d\n\tcmpl\t%eax, %edx\n\tjge\t.L9\n.L2:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L8:\n\tmovq\t200008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L19\n\taddq\t$200016, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\t.cfi_restore_state\n\tsubl\t$1, %edx\n\taddl\t$1, %r8d\n\tjmp\t.L5\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L8\n.L11:\n\txorl\t%r8d, %r8d\n\tjmp\t.L2\n.L19:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t-196608(%rsp), %r11\n\t.cfi_def_cfa 11, 196624\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3408, %rsp\n\t.cfi_def_cfa_offset 200032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 200008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\ttestl\t%eax, %eax\n\tje\t.L11\n\tleal\t-1(%rax), %edx\n\txorl\t%r8d, %r8d\n\txorl\t%eax, %eax\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tcmpb\t$120, %sil\n\tje\t.L18\n\tcmpb\t%sil, %cl\n\tjne\t.L7\n.L4:\n\taddl\t$1, %eax\n\tsubl\t$1, %edx\n.L5:\n\tcmpl\t%eax, %edx\n\tjl\t.L2\n.L9:\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rsi\n\tmovzbl\t(%rsp,%rcx), %ecx\n\tmovzbl\t(%rsp,%rsi), %esi\n\tcmpb\t$120, %cl\n\tjne\t.L3\n\tcmpb\t$120, %sil\n\tje\t.L4\n\taddl\t$1, %eax\n\taddl\t$1, %r8d\n\tcmpl\t%eax, %edx\n\tjge\t.L9\n.L2:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L8:\n\tmovq\t200008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L19\n\taddq\t$200016, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\t.cfi_restore_state\n\tsubl\t$1, %edx\n\taddl\t$1, %r8d\n\tjmp\t.L5\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L8\n.L11:\n\txorl\t%r8d, %r8d\n\tjmp\t.L2\n.L19:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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) > (b) ? (b) : (a))\n#define Abs(x) ((x) > 0 ? (x) : -(x))\n#define REP(i, n) for(int i = 0; i < n; i++)\n#define INF 1000000000000 //10^12\n#define MOD 1000000007 //10^9 + 7\ntypedef long long ll;\n\nint\nmain(int arg, char *argv[])\n{\n char s[200000];\n scanf(\"%s\", s);\n int f = 0, l = strlen(s) - 1, cnt = 0, flag = 0;\n while(l - f >= 0){\n if(s[f] == 'x' && s[l] != 'x'){\n f++;\n cnt++;\n }\n else if(s[f] != 'x' && s[l] == 'x'){\n l--;\n cnt++;\n }\n else if(s[l] == s[f]){\n f++;\n l--;\n }\n else{\n printf(\"-1\\n\");\n return 0;\n }\n }\n \n printf(\"%d\\n\", cnt);\n\n return 0;\n}\n \n", "index": 37, "inputs": [ "b\n", "axbax\n", "`b\n", "xxxo\n", "tpxt\n", "c\n", "bxbax\n", "b`\n", "yxxo\n", "d\n", "bxbbx\n", "ba\n", "oxxy\n", "e\n", "xxbbb\n", "bb\n", "oxyx\n", "f\n", "xxabb\n", "cb\n", "oxyy\n", "g\n", "xyabb\n", "bc\n", "oxzy\n", "h\n", "bbayx\n", "db\n", "oxzz\n", "i\n", "bb`yx\n", "bd\n", "zzxo\n", "j\n", "bb`xx\n", "cc\n", "ozxz\n", "k\n", "bc`xx\n", "eb\n", "ozzx\n", "l\n", "cc`xx\n", "da\n", "oyzx\n", "m\n", "xx`cc\n", "ad\n", "oyyx\n", "n\n", "cb`xx\n", "be\n", "oxyw\n", "o\n", "xb`xc\n", "ae\n", "wyxo\n", "p\n", "cx`bx\n", "ea\n", "xywo\n", "q\n", "cx`xb\n", "e`\n", "xyvo\n", "r\n", "cy`xb\n", "f`\n", "xowy\n", "s\n", "cy_xb\n", "`e\n", "xowx\n", "t\n", "bx_yc\n", "`f\n", "xxwo\n", "u\n", "bx`yc\n", "_f\n", "owxx\n", "v\n", "`xbyc\n", "f_\n", "xwox\n", "w\n", "_xbyc\n", "e_\n", "xxow\n", "x\n", "cybx_\n", "_e\n", "xyow\n", "y\n", "cybx^\n", "^e\n", "wyow\n", "z\n", "dybx^\n", "e^\n", "oxxx\n", "a\n", "xabxa\n", "ab\n", "xabxa\n" ], "outputs": [ "0\n", "2\n", "-1\n", "3\n", "1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "2\n", "-1\n", "-1\n", "0\n", "2\n", "0\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "0\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "-1\n", "0\n", "-1\n", "-1\n", "3\n", "0\n", "2\n", "-1\n", "2\n" ], "question": "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) > (b) ? (b) : (a))\n#define Abs(x) ((x) > 0 ? (x) : -(x))\n#define REP(i, n) for(int i = 0; i < n; i++)\n#define INF 1000000000000 //10^12\n#define MOD 1000000007 //10^9 + 7\ntypedef long long ll;\n\nint\nmain(int arg, char *argv[])\n{\n char s[200000];\n scanf(\"%s\", s);\n int f = 0, l = strlen(s) - 1, cnt = 0, flag = 0;\n while(l - f >= 0){\n if(s[f] == 'x' && s[l] != 'x'){\n f++;\n cnt++;\n }\n else if(s[f] != 'x' && s[l] == 'x'){\n l--;\n cnt++;\n }\n else if(s[l] == s[f]){\n f++;\n l--;\n }\n else{\n printf(\"-1\\n\");\n return 0;\n }\n }\n \n printf(\"%d\\n\", cnt);\n\n return 0;\n}\n \n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"-1\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-196608(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3440, %rsp\n\tmovl\t%edi, -200036(%rbp)\n\tmovq\t%rsi, -200048(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -200032(%rbp)\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tsubl\t$1, %eax\n\tmovl\t%eax, -200028(%rbp)\n\tmovl\t$0, -200024(%rbp)\n\tmovl\t$0, -200020(%rbp)\n\tjmp\t.L2\n.L7:\n\tmovl\t-200032(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tjne\t.L3\n\tmovl\t-200028(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tje\t.L3\n\taddl\t$1, -200032(%rbp)\n\taddl\t$1, -200024(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-200032(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tje\t.L4\n\tmovl\t-200028(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$120, %al\n\tjne\t.L4\n\tsubl\t$1, -200028(%rbp)\n\taddl\t$1, -200024(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-200028(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %edx\n\tmovl\t-200032(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tjne\t.L5\n\taddl\t$1, -200032(%rbp)\n\tsubl\t$1, -200028(%rbp)\n\tjmp\t.L2\n.L5:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L8\n.L2:\n\tmovl\t-200028(%rbp), %eax\n\tsubl\t-200032(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjns\t.L7\n\tmovl\t-200024(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L8:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L9\n\tcall\t__stack_chk_fail@PLT\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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) ((x) > 0 ? (x) : -(x)) #define REP(i, n) for(int i = 0; i < n; i++) #define INF 1000000000000 //10^12 #define MOD 1000000007 //10^9 + 7 typedef long long ll; int main(int arg, char *argv[]) { char s[200000]; scanf("%s", s); int f = 0, l = strlen(s) - 1, cnt = 0, flag = 0; while(l - f >= 0){ if(s[f] == 'x' && s[l] != 'x'){ f++; cnt++; } else if(s[f] != 'x' && s[l] == 'x'){ l--; cnt++; } else if(s[l] == s[f]){ f++; l--; } else{ printf("-1\n"); return 0; } } printf("%d\n", cnt); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "-1" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -196608(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $3440, %rsp movl %edi, -200036(%rbp) movq %rsi, -200048(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -200016(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -200032(%rbp) leaq -200016(%rbp), %rax movq %rax, %rdi call strlen@PLT subl $1, %eax movl %eax, -200028(%rbp) movl $0, -200024(%rbp) movl $0, -200020(%rbp) jmp .L2 .L7: movl -200032(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax cmpb $120, %al jne .L3 movl -200028(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax cmpb $120, %al je .L3 addl $1, -200032(%rbp) addl $1, -200024(%rbp) jmp .L2 .L3: movl -200032(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax cmpb $120, %al je .L4 movl -200028(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax cmpb $120, %al jne .L4 subl $1, -200028(%rbp) addl $1, -200024(%rbp) jmp .L2 .L4: movl -200028(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %edx movl -200032(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax cmpb %al, %dl jne .L5 addl $1, -200032(%rbp) subl $1, -200028(%rbp) jmp .L2 .L5: leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L8 .L2: movl -200028(%rbp), %eax subl -200032(%rbp), %eax testl %eax, %eax jns .L7 movl -200024(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L8: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L9 call __stack_chk_fail@PLT .L9: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other text.
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\tfor(j=m;j%a;j--);\n\n\t\t\tif(j<t || (j==t && a<=pre)){\n\t\t\t\tcnt=(j==t&&a==pre?cnt+1:1);\n\t\t\t\tt=j;\n\t\t\t\tpre=a;\n\t\t\t\tans=i;\n\t\t\t}\n\t\t}\n\n\t\tprintf(\"%d\\n\",cnt<2?ans+1:n);\n\t}\n\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L2\n.L13:\n\tmovl\t$1001, -32(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L3\n.L10:\n\tleaq\t-36(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tmovl\t-40(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L5:\n\tsubl\t$1, -12(%rbp)\n.L4:\n\tmovl\t-36(%rbp), %ecx\n\tmovl\t-12(%rbp), %eax\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L5\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjl\t.L6\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjne\t.L7\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjl\t.L7\n.L6:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjne\t.L8\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjne\t.L8\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$1, %eax\n.L9:\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L7:\n\taddl\t$1, -16(%rbp)\n.L3:\n\tmovl\t-44(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L10\n\tcmpl\t$1, -20(%rbp)\n\tjg\t.L11\n\tmovl\t-24(%rbp), %eax\n\taddl\t$1, %eax\n\tjmp\t.L12\n.L11:\n\tmovl\t-44(%rbp), %eax\n.L12:\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L2:\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-44(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tmovl\t-44(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L13\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L15\n\tcall\t__stack_chk_fail@PLT\n.L15:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 128\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t48(%rsp), %rax\n\tleaq\t52(%rsp), %r13\n\tmovq\t%rax, 24(%rsp)\n\tleaq\t44(%rsp), %rax\n\tmovq\t%rax, 16(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t24(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\tscanf@PLT\n\tmovl\t44(%rsp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L8\n\tmovl\t$0, %r15d\n\tmovl\t$0, %r14d\n\tmovl\t$1001, %ebx\n\tjle\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\tscanf@PLT\n\tmovl\t48(%rsp), %ecx\n\tmovl\t52(%rsp), %esi\n\tjmp\t.L26\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tsubl\t$1, %ecx\n.L26:\n\tmovl\t%ecx, %eax\n\tcltd\n\tidivl\t%esi\n\ttestl\t%edx, %edx\n\tjne\t.L28\n\tcmpl\t%ecx, %ebx\n\tjg\t.L12\n\tjne\t.L5\n\tcmpl\t%ebp, %esi\n\tjle\t.L29\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t44(%rsp), %esi\n\taddl\t$1, %r15d\n\tcmpl\t%r15d, %esi\n\tjg\t.L6\n\tcmpl\t$1, %r14d\n\tjle\t.L9\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L2\n.L29:\n\tje\t.L30\n.L12:\n\tmovl\t%r15d, 12(%rsp)\n\tmovl\t%esi, %ebp\n\tmovl\t%ecx, %ebx\n\tmovl\t$1, %r14d\n\tjmp\t.L5\n.L30:\n\tmovl\t%r15d, 12(%rsp)\n\taddl\t$1, %r14d\n\tmovl\t%ecx, %ebx\n\tjmp\t.L5\n.L9:\n\tmovl\t12(%rsp), %eax\n\tleal\t1(%rax), %esi\n\tjmp\t.L7\n.L8:\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L31\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L31:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 128\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t48(%rsp), %rax\n\tleaq\t52(%rsp), %r13\n\tmovq\t%rax, 24(%rsp)\n\tleaq\t44(%rsp), %rax\n\tmovq\t%rax, 16(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t24(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\tscanf@PLT\n\tmovl\t44(%rsp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L8\n\tmovl\t$0, %r15d\n\tmovl\t$0, %r14d\n\tmovl\t$1001, %ebx\n\tjle\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\tscanf@PLT\n\tmovl\t48(%rsp), %ecx\n\tmovl\t52(%rsp), %esi\n\tjmp\t.L26\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tsubl\t$1, %ecx\n.L26:\n\tmovl\t%ecx, %eax\n\tcltd\n\tidivl\t%esi\n\ttestl\t%edx, %edx\n\tjne\t.L28\n\tcmpl\t%ecx, %ebx\n\tjg\t.L12\n\tjne\t.L5\n\tcmpl\t%ebp, %esi\n\tjle\t.L29\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t44(%rsp), %esi\n\taddl\t$1, %r15d\n\tcmpl\t%r15d, %esi\n\tjg\t.L6\n\tcmpl\t$1, %r14d\n\tjle\t.L9\n.L7:\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L2\n.L29:\n\tje\t.L30\n.L12:\n\tmovl\t%r15d, 12(%rsp)\n\tmovl\t%esi, %ebp\n\tmovl\t%ecx, %ebx\n\tmovl\t$1, %r14d\n\tjmp\t.L5\n.L30:\n\tmovl\t%r15d, 12(%rsp)\n\taddl\t$1, %r14d\n\tmovl\t%ecx, %ebx\n\tjmp\t.L5\n.L9:\n\tmovl\t12(%rsp), %eax\n\tleal\t1(%rax), %esi\n\tjmp\t.L7\n.L8:\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L31\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L31:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "int 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\tfor(j=m;j%a;j--);\n\n\t\t\tif(j<t || (j==t && a<=pre)){\n\t\t\t\tcnt=(j==t&&a==pre?cnt+1:1);\n\t\t\t\tt=j;\n\t\t\t\tpre=a;\n\t\t\t\tans=i;\n\t\t\t}\n\t\t}\n\n\t\tprintf(\"%d\\n\",cnt<2?ans+1:n);\n\t}\n\n\treturn 0;\n}", "index": 59, "inputs": [ "3 101\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n3 7 4\n5 24\n4 5 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n4 5 12 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 3 8\n5 1\n1 1 4 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 8\n5 1\n1 1 2 3 3\n0 0\n", "3 111\n3 7 4\n5 43\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n4 5 12 4 8\n5 1\n1 1 3 2 6\n0 0\n", "3 110\n5 7 3\n5 43\n4 7 12 3 8\n5 1\n1 1 2 4 3\n0 0\n", "3 100\n3 7 8\n5 6\n1 6 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 5 20 3 8\n5 1\n1 1 2 4 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 5 20 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 011\n5 7 3\n5 43\n4 5 6 3 9\n5 1\n1 1 2 1 3\n0 0\n", "3 011\n5 11 3\n5 43\n4 5 6 3 9\n5 1\n1 1 2 1 3\n0 0\n", "1 100\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n4 5 9 4 8\n5 1\n1 1 2 2 6\n0 0\n", "3 101\n1 7 7\n5 6\n4 5 23 4 8\n5 1\n1 1 3 2 6\n0 0\n", "1 100\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 4 2 3\n0 0\n", "3 101\n3 7 5\n5 24\n4 6 12 3 8\n5 1\n1 1 2 3 3\n0 0\n", "3 100\n1 10 4\n5 24\n4 5 23 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 100\n3 7 8\n5 6\n1 6 35 7 8\n5 2\n2 2 2 5 3\n0 0\n", "3 001\n1 19 4\n5 24\n4 5 12 4 8\n5 1\n1 1 2 4 3\n0 0\n", "3 000\n1 19 4\n5 24\n4 5 12 4 8\n5 1\n1 1 2 4 3\n0 0\n", "3 000\n1 19 4\n5 16\n4 5 22 4 8\n5 1\n1 1 2 4 3\n0 0\n", "3 100\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 4 2 3\n0 0\n", "3 101\n3 9 4\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "1 111\n5 7 3\n5 43\n5 5 20 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n2 7 7\n5 12\n4 5 23 4 8\n5 1\n1 1 3 2 6\n0 0\n", "3 100\n3 2 4\n5 6\n3 6 43 3 8\n5 1\n2 2 2 2 3\n0 0\n", "3 100\n1 7 4\n5 32\n5 5 12 4 2\n5 0\n2 1 3 3 3\n0 0\n", "1 100\n3 7 4\n5 39\n4 6 12 5 8\n5 1\n1 1 7 2 6\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 111\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n4 5 12 4 8\n5 1\n1 1 2 2 6\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 12 3 8\n5 1\n2 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 8\n5 1\n1 1 3 3 3\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 12 3 8\n5 1\n2 2 2 2 3\n0 0\n", "3 111\n3 7 3\n5 43\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 2\n5 1\n1 1 3 3 3\n0 0\n", "3 101\n1 7 7\n5 24\n4 5 23 4 8\n5 1\n1 1 3 2 6\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 21 3 8\n5 1\n2 2 2 2 3\n0 0\n", "3 111\n3 7 3\n5 43\n4 7 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 2\n5 0\n1 1 3 3 3\n0 0\n", "3 100\n3 7 4\n5 6\n3 6 21 3 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n3 7 3\n5 43\n4 7 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n5 5 12 4 2\n5 0\n1 1 3 3 3\n0 0\n", "3 100\n3 7 4\n5 6\n3 6 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 7 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 100\n3 7 4\n5 6\n1 6 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 5 12 3 8\n5 1\n1 1 2 4 3\n0 0\n", "3 100\n3 7 8\n5 6\n1 6 35 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n3 7 8\n5 6\n1 6 35 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 111\n5 7 3\n5 43\n4 5 20 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 111\n5 7 3\n5 43\n4 5 20 3 8\n5 1\n1 1 2 1 3\n0 0\n", "3 111\n5 7 3\n5 43\n4 5 6 3 8\n5 1\n1 1 2 1 3\n0 0\n", "3 011\n5 7 3\n5 43\n4 5 6 3 8\n5 1\n1 1 2 1 3\n0 0\n", "3 011\n5 11 3\n5 43\n4 5 6 3 9\n5 0\n1 1 2 1 3\n0 0\n", "3 011\n5 11 5\n5 43\n4 5 6 3 9\n5 0\n1 1 2 1 3\n0 0\n", "3 101\n3 7 5\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 3 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 10 4\n5 24\n4 5 12 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n6 5 12 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 12 4 8\n5 1\n2 1 2 2 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 8\n5 1\n1 1 3 4 3\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 12 3 6\n5 1\n2 2 2 2 3\n0 0\n", "3 111\n3 7 3\n5 43\n4 6 12 3 8\n5 1\n1 1 2 3 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 1 12 4 2\n5 1\n1 1 3 3 3\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 21 3 8\n5 1\n1 2 2 2 3\n0 0\n", "3 111\n3 7 3\n5 43\n4 7 12 3 8\n5 1\n1 1 2 2 5\n0 0\n", "3 101\n1 7 4\n5 24\n4 5 12 4 2\n5 0\n1 1 3 3 1\n0 0\n", "3 100\n3 7 4\n5 6\n3 6 22 3 8\n5 1\n2 2 2 2 3\n0 0\n", "3 100\n1 7 4\n5 24\n5 5 12 4 2\n5 0\n1 1 3 3 3\n0 0\n", "3 100\n3 7 4\n5 6\n3 12 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 7 12 1 8\n5 1\n1 1 2 2 3\n0 0\n", "3 100\n4 7 4\n5 6\n1 6 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 100\n5 7 3\n5 43\n4 7 12 3 8\n5 1\n1 1 2 4 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 5 12 3 9\n5 1\n1 1 2 4 3\n0 0\n", "3 100\n3 7 8\n5 6\n1 6 35 6 8\n5 1\n2 2 2 3 3\n0 0\n", "3 110\n5 7 3\n5 43\n4 5 20 1 8\n5 1\n1 1 2 2 3\n0 0\n", "3 111\n5 7 3\n5 43\n5 5 20 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 111\n5 7 3\n5 43\n4 5 20 6 8\n5 1\n1 1 2 1 3\n0 0\n", "3 111\n5 7 3\n5 43\n4 5 6 3 10\n5 1\n1 1 2 1 3\n0 0\n", "3 011\n5 11 3\n5 43\n4 1 6 3 9\n5 1\n1 1 2 1 3\n0 0\n", "3 011\n5 11 3\n5 43\n4 5 2 3 9\n5 0\n1 1 2 1 3\n0 0\n", "3 011\n5 11 5\n5 39\n4 5 6 3 9\n5 0\n1 1 2 1 3\n0 0\n", "3 101\n1 7 4\n5 24\n4 3 12 3 8\n5 2\n1 1 2 2 3\n0 0\n", "3 101\n1 10 4\n5 24\n4 5 23 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n7 5 12 4 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n1 7 7\n5 24\n4 5 9 4 8\n5 2\n1 1 2 2 6\n0 0\n", "3 100\n3 7 4\n5 6\n4 6 5 4 8\n5 1\n2 1 2 2 3\n0 0\n", "3 101\n1 11 4\n5 24\n4 5 12 4 8\n5 1\n1 1 3 4 3\n0 0\n", "3 101\n2 7 7\n5 6\n4 5 23 4 8\n5 1\n1 1 3 2 6\n0 0\n", "3 111\n3 7 3\n5 45\n4 7 12 3 8\n5 1\n1 1 2 2 5\n0 0\n", "3 101\n1 7 4\n5 24\n4 10 12 4 2\n5 0\n1 1 3 3 1\n0 0\n", "3 100\n3 7 4\n5 6\n3 6 43 3 8\n5 1\n2 2 2 2 3\n0 0\n", "3 100\n1 7 4\n5 32\n5 5 12 4 2\n5 0\n1 1 3 3 3\n0 0\n", "3 100\n3 7 4\n5 10\n3 12 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 110\n5 5 3\n5 43\n4 7 12 1 8\n5 1\n1 1 2 2 3\n0 0\n", "3 101\n4 7 4\n5 6\n1 6 21 6 8\n5 1\n2 2 2 2 3\n0 0\n", "3 100\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n", "3 100\n3 7 4\n5 24\n4 6 12 3 8\n5 1\n1 1 2 2 3\n0 0\n" ], "outputs": [ "2\n4\n5\n", "2\n2\n5\n", "3\n2\n5\n", "2\n5\n5\n", "2\n2\n4\n", "2\n2\n3\n", "2\n3\n5\n", "3\n2\n4\n", "2\n3\n3\n", "3\n5\n5\n", "2\n1\n3\n", "2\n1\n5\n", "2\n5\n3\n", "3\n5\n3\n", "1\n1\n5\n", "3\n3\n5\n", "3\n5\n4\n", "1\n1\n4\n", "2\n4\n3\n", "1\n2\n5\n", "3\n4\n5\n", "3\n2\n3\n", "1\n2\n3\n", "1\n3\n3\n", "2\n4\n4\n", "1\n4\n5\n", "1\n7\n5\n", "3\n3\n4\n", "1\n5\n5\n", "2\n3\n2\n", "1\n7\n4\n", "2\n2\n5\n", "2\n2\n5\n", "2\n4\n5\n", "3\n2\n5\n", "2\n5\n5\n", "2\n2\n5\n", "2\n5\n5\n", "2\n3\n5\n", "2\n2\n5\n", "3\n2\n4\n", "2\n5\n5\n", "2\n3\n5\n", "2\n2\n5\n", "2\n5\n5\n", "2\n3\n5\n", "2\n5\n5\n", "2\n5\n5\n", "2\n3\n5\n", "2\n5\n5\n", "2\n3\n3\n", "3\n5\n5\n", "3\n5\n5\n", "2\n1\n5\n", "2\n1\n3\n", "2\n1\n3\n", "2\n1\n3\n", "3\n5\n5\n", "3\n5\n5\n", "2\n4\n5\n", "2\n5\n5\n", "3\n2\n5\n", "3\n2\n5\n", "2\n5\n5\n", "2\n2\n5\n", "2\n3\n5\n", "2\n3\n3\n", "2\n2\n5\n", "2\n5\n5\n", "2\n3\n5\n", "2\n2\n5\n", "2\n5\n5\n", "2\n5\n5\n", "2\n5\n5\n", "2\n3\n5\n", "2\n5\n5\n", "2\n3\n3\n", "2\n5\n3\n", "3\n5\n5\n", "2\n1\n5\n", "2\n5\n5\n", "2\n1\n3\n", "2\n1\n3\n", "3\n5\n3\n", "3\n5\n5\n", "3\n2\n5\n", "2\n5\n5\n", "3\n2\n5\n", "3\n2\n5\n", "3\n3\n5\n", "2\n5\n5\n", "2\n2\n5\n", "3\n5\n4\n", "2\n3\n5\n", "2\n2\n5\n", "2\n5\n5\n", "2\n3\n5\n", "2\n2\n5\n", "3\n3\n5\n", "2\n5\n5\n", "2\n4\n5\n", "2\n4\n5\n" ], "question": "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\tfor(j=m;j%a;j--);\n\n\t\t\tif(j<t || (j==t && a<=pre)){\n\t\t\t\tcnt=(j==t&&a==pre?cnt+1:1);\n\t\t\t\tt=j;\n\t\t\t\tpre=a;\n\t\t\t\tans=i;\n\t\t\t}\n\t\t}\n\n\t\tprintf(\"%d\\n\",cnt<2?ans+1:n);\n\t}\n\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L2\n.L13:\n\tmovl\t$1001, -32(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L3\n.L10:\n\tleaq\t-36(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tmovl\t-40(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L4\n.L5:\n\tsubl\t$1, -12(%rbp)\n.L4:\n\tmovl\t-36(%rbp), %ecx\n\tmovl\t-12(%rbp), %eax\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L5\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjl\t.L6\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjne\t.L7\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjl\t.L7\n.L6:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjne\t.L8\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjne\t.L8\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$1, %eax\n.L9:\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L7:\n\taddl\t$1, -16(%rbp)\n.L3:\n\tmovl\t-44(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L10\n\tcmpl\t$1, -20(%rbp)\n\tjg\t.L11\n\tmovl\t-24(%rbp), %eax\n\taddl\t$1, %eax\n\tjmp\t.L12\n.L11:\n\tmovl\t-44(%rbp), %eax\n.L12:\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L2:\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-44(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tmovl\t-44(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L13\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L15\n\tcall\t__stack_chk_fail@PLT\n.L15:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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)){ cnt=(j==t&&a==pre?cnt+1:1); t=j; pre=a; ans=i; } } printf("%d\n",cnt<2?ans+1:n); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .LC2: .string "%d%d" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax jmp .L2 .L13: movl $1001, -32(%rbp) movl $0, -20(%rbp) movl $0, -16(%rbp) jmp .L3 .L10: leaq -36(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call scanf@PLT movl -40(%rbp), %eax movl %eax, -12(%rbp) jmp .L4 .L5: subl $1, -12(%rbp) .L4: movl -36(%rbp), %ecx movl -12(%rbp), %eax cltd idivl %ecx movl %edx, %eax testl %eax, %eax jne .L5 movl -12(%rbp), %eax cmpl -32(%rbp), %eax jl .L6 movl -12(%rbp), %eax cmpl -32(%rbp), %eax jne .L7 movl -36(%rbp), %eax cmpl %eax, -28(%rbp) jl .L7 .L6: movl -12(%rbp), %eax cmpl -32(%rbp), %eax jne .L8 movl -36(%rbp), %eax cmpl %eax, -28(%rbp) jne .L8 movl -20(%rbp), %eax addl $1, %eax jmp .L9 .L8: movl $1, %eax .L9: movl %eax, -20(%rbp) movl -12(%rbp), %eax movl %eax, -32(%rbp) movl -36(%rbp), %eax movl %eax, -28(%rbp) movl -16(%rbp), %eax movl %eax, -24(%rbp) .L7: addl $1, -16(%rbp) .L3: movl -44(%rbp), %eax cmpl %eax, -16(%rbp) jl .L10 cmpl $1, -20(%rbp) jg .L11 movl -24(%rbp), %eax addl $1, %eax jmp .L12 .L11: movl -44(%rbp), %eax .L12: movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L2: leaq -40(%rbp), %rdx leaq -44(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call scanf@PLT movl -44(%rbp), %eax testl %eax, %eax jne .L13 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L15 call __stack_chk_fail@PLT .L15: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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 return ((struct tuple *)a)->y - ((struct tuple *)b)->y;\n}\n\n\nint main(void){\n int N;\n int x,l;\n scanf(\"%d\", &N);\n struct tuple A[1000000+10];\n for (int i = 0; i < N; i++) {\n scanf(\"%d %d\", &x, &l);\n A[i].x = x - l;\n A[i].y = x + l;\n }\n qsort(A,N,sizeof (struct tuple), asc);\n int now = -1100000000;\n int cnt = 0;\n for (int i = 0; i < N; i++) {\n if (now <= A[i].x) {\n now = A[i].y;\n cnt++;\n }\n }\n printf(\"%d\\n\",cnt);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tasc\n\t.type\tasc, @function\nasc:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tasc, .-asc\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d %d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-7999488(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$640, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-8000124(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -8000112(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-8000116(%rbp), %rdx\n\tleaq\t-8000120(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-8000120(%rbp), %eax\n\tmovl\t-8000116(%rbp), %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-8000112(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -8000096(%rbp,%rax,8)\n\tmovl\t-8000120(%rbp), %edx\n\tmovl\t-8000116(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-8000112(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -8000092(%rbp,%rax,8)\n\taddl\t$1, -8000112(%rbp)\n.L4:\n\tmovl\t-8000124(%rbp), %eax\n\tcmpl\t%eax, -8000112(%rbp)\n\tjl\t.L5\n\tmovl\t-8000124(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tleaq\t-8000096(%rbp), %rax\n\tleaq\tasc(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$8, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$-1100000000, -8000108(%rbp)\n\tmovl\t$0, -8000104(%rbp)\n\tmovl\t$0, -8000100(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-8000100(%rbp), %eax\n\tcltq\n\tmovl\t-8000096(%rbp,%rax,8), %eax\n\tcmpl\t%eax, -8000108(%rbp)\n\tjg\t.L7\n\tmovl\t-8000100(%rbp), %eax\n\tcltq\n\tmovl\t-8000092(%rbp,%rax,8), %eax\n\tmovl\t%eax, -8000108(%rbp)\n\taddl\t$1, -8000104(%rbp)\n.L7:\n\taddl\t$1, -8000100(%rbp)\n.L6:\n\tmovl\t-8000124(%rbp), %eax\n\tcmpl\t%eax, -8000100(%rbp)\n\tjl\t.L8\n\tmovl\t-8000104(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\"\n.LC1:\n\t.string\t\"%d %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.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tleaq\t-7999488(%rsp), %r11\n\t.cfi_def_cfa 11, 7999536\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$624, %rsp\n\t.cfi_def_cfa_offset 8000160\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8000104(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tleaq\t16(%rsp), %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t4(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L4\n\txorl\t%r14d, %r14d\n\tleaq\t12(%rsp), %r13\n\tleaq\t8(%rsp), %r12\n\tleaq\t.LC1(%rip), %rbp\n\tleaq\t16(%rsp), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdx\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %eax\n\tmovslq\t4(%rsp), %rsi\n\tmovl\t%eax, %ecx\n\taddl\t12(%rsp), %eax\n\tsubl\t12(%rsp), %ecx\n\tmovd\t%ecx, %xmm0\n\tmovd\t%eax, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rbx,%r14,8)\n\taddq\t$1, %r14\n\tcmpl\t%r14d, %esi\n\tjg\t.L5\n.L4:\n\tmovl\t$8, %edx\n\tleaq\tasc(%rip), %rcx\n\tmovq\t%rbx, %rdi\n\tcall\tqsort@PLT\n\tmovl\t4(%rsp), %edx\n\ttestl\t%edx, %edx\n\tjle\t.L10\n\tsubl\t$1, %edx\n\tmovq\t%rbx, %rax\n\txorl\t%r8d, %r8d\n\tleaq\t24(%rsp,%rdx,8), %rcx\n\tmovl\t$-1100000000, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tcmpl\t(%rax), %edx\n\tjg\t.L7\n\tmovl\t4(%rax), %edx\n\taddl\t$1, %r8d\n.L7:\n\taddq\t$8, %rax\n\tcmpq\t%rcx, %rax\n\tjne\t.L8\n.L6:\n\txorl\t%eax, %eax\n\tmovl\t%r8d, %edx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t8000104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$8000112, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L10:\n\t.cfi_restore_state\n\txorl\t%r8d, %r8d\n\tjmp\t.L6\n.L16:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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:\n\t.string\t\"%d %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.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tleaq\t-7999488(%rsp), %r11\n\t.cfi_def_cfa 11, 7999536\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$624, %rsp\n\t.cfi_def_cfa_offset 8000160\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8000104(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tleaq\t16(%rsp), %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t4(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L4\n\txorl\t%r14d, %r14d\n\tleaq\t12(%rsp), %r13\n\tleaq\t8(%rsp), %r12\n\tleaq\t.LC1(%rip), %rbp\n\tleaq\t16(%rsp), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdx\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t8(%rsp), %eax\n\tmovslq\t4(%rsp), %rsi\n\tmovl\t%eax, %ecx\n\taddl\t12(%rsp), %eax\n\tsubl\t12(%rsp), %ecx\n\tmovd\t%ecx, %xmm0\n\tmovd\t%eax, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rbx,%r14,8)\n\taddq\t$1, %r14\n\tcmpl\t%r14d, %esi\n\tjg\t.L5\n.L4:\n\tmovl\t$8, %edx\n\tleaq\tasc(%rip), %rcx\n\tmovq\t%rbx, %rdi\n\tcall\tqsort@PLT\n\tmovl\t4(%rsp), %edx\n\ttestl\t%edx, %edx\n\tjle\t.L10\n\tsubl\t$1, %edx\n\tmovq\t%rbx, %rax\n\txorl\t%r8d, %r8d\n\tleaq\t24(%rsp,%rdx,8), %rcx\n\tmovl\t$-1100000000, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tcmpl\t(%rax), %edx\n\tjg\t.L7\n\tmovl\t4(%rax), %edx\n\taddl\t$1, %r8d\n.L7:\n\taddq\t$8, %rax\n\tcmpq\t%rcx, %rax\n\tjne\t.L8\n.L6:\n\txorl\t%eax, %eax\n\tmovl\t%r8d, %edx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t8000104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$8000112, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L10:\n\t.cfi_restore_state\n\txorl\t%r8d, %r8d\n\tjmp\t.L6\n.L16:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 return ((struct tuple *)a)->y - ((struct tuple *)b)->y;\n}\n\n\nint main(void){\n int N;\n int x,l;\n scanf(\"%d\", &N);\n struct tuple A[1000000+10];\n for (int i = 0; i < N; i++) {\n scanf(\"%d %d\", &x, &l);\n A[i].x = x - l;\n A[i].y = x + l;\n }\n qsort(A,N,sizeof (struct tuple), asc);\n int now = -1100000000;\n int cnt = 0;\n for (int i = 0; i < N; i++) {\n if (now <= A[i].x) {\n now = A[i].y;\n cnt++;\n }\n }\n printf(\"%d\\n\",cnt);\n}\n", "index": 38, "inputs": [ "5\n10 1\n2 2\n4 1\n6 1\n8 1\n", "2\n8 20\n1 13\n", "4\n2 4\n4 3\n14 3\n100 5\n", "4\n4 16\n4 3\n6 2\n101 5\n", "5\n18 1\n2 1\n4 1\n6 1\n8 1\n", "5\n10 1\n2 2\n4 1\n6 1\n8 2\n", "2\n12 20\n1 13\n", "4\n4 4\n4 3\n14 3\n100 5\n", "2\n12 14\n1 13\n", "4\n4 4\n4 3\n28 3\n100 5\n", "2\n12 14\n1 10\n", "4\n4 4\n4 3\n28 3\n101 5\n", "2\n16 14\n1 10\n", "4\n4 8\n4 3\n28 3\n101 5\n", "4\n4 16\n4 3\n28 3\n101 5\n", "4\n4 16\n4 3\n28 2\n101 5\n", "4\n4 16\n4 3\n6 2\n100 5\n", "4\n4 16\n4 2\n6 2\n100 5\n", "4\n4 16\n8 2\n6 2\n100 5\n", "4\n4 32\n8 2\n6 2\n100 5\n", "4\n4 32\n8 2\n6 2\n101 5\n", "4\n4 32\n8 2\n6 2\n101 4\n", "4\n4 32\n8 3\n6 2\n101 4\n", "4\n4 32\n8 3\n1 2\n101 4\n", "4\n4 32\n8 4\n1 2\n101 4\n", "4\n4 32\n8 4\n1 2\n001 4\n", "4\n4 32\n8 4\n2 2\n001 4\n", "4\n4 57\n8 4\n2 2\n001 4\n", "4\n4 80\n8 4\n2 2\n001 4\n", "4\n4 80\n2 4\n2 2\n001 4\n", "4\n4 80\n2 1\n2 2\n001 4\n", "4\n4 80\n0 1\n2 2\n001 4\n", "4\n4 80\n0 1\n2 4\n001 4\n", "2\n8 40\n1 10\n", "4\n2 4\n4 5\n9 3\n100 5\n", "2\n3 20\n1 13\n", "4\n2 6\n4 3\n14 3\n100 5\n", "5\n10 1\n2 2\n0 1\n6 1\n8 2\n", "2\n12 20\n1 6\n", "4\n4 4\n4 3\n12 3\n100 5\n", "2\n12 27\n1 13\n", "4\n4 4\n4 3\n47 3\n100 5\n", "2\n12 14\n0 10\n", "4\n4 4\n4 6\n28 3\n101 5\n", "2\n16 14\n0 10\n", "4\n4 8\n4 3\n28 6\n101 5\n", "4\n4 16\n4 3\n28 2\n101 10\n", "4\n4 16\n8 3\n6 2\n101 5\n", "4\n4 16\n4 3\n6 2\n100 3\n", "4\n2 16\n4 2\n6 2\n100 5\n", "4\n4 5\n8 2\n6 2\n100 5\n", "4\n4 32\n8 4\n6 2\n100 5\n", "4\n4 32\n8 2\n6 2\n101 3\n", "4\n4 32\n8 2\n8 2\n101 4\n", "4\n7 32\n8 3\n6 2\n101 4\n", "4\n7 32\n8 3\n1 2\n101 4\n", "4\n4 32\n4 4\n1 2\n101 4\n", "4\n4 45\n8 4\n1 2\n001 4\n", "4\n4 32\n8 8\n2 2\n001 4\n", "4\n4 57\n8 4\n2 4\n001 4\n", "4\n8 80\n8 4\n2 2\n001 4\n", "4\n4 80\n2 4\n4 2\n001 4\n", "4\n4 80\n1 1\n2 2\n001 4\n", "4\n4 80\n0 1\n2 2\n001 8\n", "4\n0 80\n0 1\n2 4\n001 4\n", "2\n8 40\n2 10\n", "4\n2 4\n1 5\n9 3\n100 5\n", "2\n3 20\n1 3\n", "4\n2 5\n4 3\n14 3\n100 5\n", "5\n10 1\n2 2\n1 1\n6 1\n8 2\n", "2\n16 20\n1 6\n", "4\n4 4\n2 3\n12 3\n100 5\n", "2\n12 27\n1 21\n", "4\n4 4\n4 3\n47 3\n100 4\n", "2\n23 14\n0 10\n", "4\n4 4\n4 6\n28 5\n101 5\n", "2\n16 14\n-1 10\n", "4\n4 8\n4 3\n28 6\n101 3\n", "4\n4 16\n4 3\n51 2\n101 10\n", "4\n5 16\n8 3\n6 2\n101 5\n", "4\n4 16\n4 3\n6 2\n110 3\n", "4\n2 16\n6 2\n6 2\n100 5\n", "4\n4 32\n14 2\n6 2\n101 3\n", "4\n4 32\n8 2\n8 2\n101 6\n", "4\n7 64\n8 3\n6 2\n101 4\n", "4\n7 32\n8 5\n1 2\n101 4\n", "4\n5 32\n4 4\n1 2\n101 4\n", "4\n4 45\n8 4\n1 2\n101 4\n", "4\n4 32\n11 8\n2 2\n001 4\n", "4\n4 57\n8 4\n1 4\n001 4\n", "4\n8 80\n5 4\n2 2\n001 4\n", "4\n4 80\n2 5\n4 2\n001 4\n", "4\n4 80\n1 1\n2 4\n001 4\n", "4\n4 80\n0 2\n2 2\n001 8\n", "4\n0 80\n0 1\n2 5\n001 4\n", "2\n8 16\n2 10\n", "4\n4 4\n1 5\n9 3\n100 5\n", "2\n3 20\n0 3\n", "4\n2 4\n4 3\n14 3\n100 4\n", "5\n10 1\n2 2\n1 1\n10 1\n8 2\n", "5\n10 1\n2 1\n4 1\n6 1\n8 1\n", "4\n2 4\n4 3\n9 3\n100 5\n", "4\n2 4\n4 3\n9 3\n100 5\n", "2\n8 20\n1 10\n" ], "outputs": [ "4\n", "1\n", "3\n", "2\n", "5\n", "3\n", "1\n", "3\n", "1\n", "3\n", "1\n", "3\n", "1\n", "3\n", "3\n", "3\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "3\n", "3\n", "2\n", "2\n", "2\n", "2\n", "1\n", "1\n", "1\n", "1\n", "1\n", "3\n", "1\n", "3\n", "3\n", "1\n", "3\n", "1\n", "3\n", "1\n", "3\n", "1\n", "3\n", "3\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "3\n", "2\n", "2\n", "1\n", "1\n", "2\n", "1\n", "1\n", "1\n", "1\n", "1\n", "3\n", "1\n", "3\n", "3\n", "1\n", "3\n", "1\n", "3\n", "1\n", "3\n", "1\n", "3\n", "3\n", "2\n", "2\n", "2\n", "3\n", "2\n", "2\n", "3\n", "2\n", "3\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "1\n", "3\n", "1\n", "3\n", "2\n", "5\n", "3\n", "3\n", "1\n" ], "question": "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 return ((struct tuple *)a)->y - ((struct tuple *)b)->y;\n}\n\n\nint main(void){\n int N;\n int x,l;\n scanf(\"%d\", &N);\n struct tuple A[1000000+10];\n for (int i = 0; i < N; i++) {\n scanf(\"%d %d\", &x, &l);\n A[i].x = x - l;\n A[i].y = x + l;\n }\n qsort(A,N,sizeof (struct tuple), asc);\n int now = -1100000000;\n int cnt = 0;\n for (int i = 0; i < N; i++) {\n if (now <= A[i].x) {\n now = A[i].y;\n cnt++;\n }\n }\n printf(\"%d\\n\",cnt);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tasc\n\t.type\tasc, @function\nasc:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tasc, .-asc\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d %d\"\n.LC2:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-7999488(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$640, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-8000124(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -8000112(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-8000116(%rbp), %rdx\n\tleaq\t-8000120(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-8000120(%rbp), %eax\n\tmovl\t-8000116(%rbp), %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-8000112(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -8000096(%rbp,%rax,8)\n\tmovl\t-8000120(%rbp), %edx\n\tmovl\t-8000116(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-8000112(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -8000092(%rbp,%rax,8)\n\taddl\t$1, -8000112(%rbp)\n.L4:\n\tmovl\t-8000124(%rbp), %eax\n\tcmpl\t%eax, -8000112(%rbp)\n\tjl\t.L5\n\tmovl\t-8000124(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tleaq\t-8000096(%rbp), %rax\n\tleaq\tasc(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$8, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$-1100000000, -8000108(%rbp)\n\tmovl\t$0, -8000104(%rbp)\n\tmovl\t$0, -8000100(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-8000100(%rbp), %eax\n\tcltq\n\tmovl\t-8000096(%rbp,%rax,8), %eax\n\tcmpl\t%eax, -8000108(%rbp)\n\tjg\t.L7\n\tmovl\t-8000100(%rbp), %eax\n\tcltq\n\tmovl\t-8000092(%rbp,%rax,8), %eax\n\tmovl\t%eax, -8000108(%rbp)\n\taddl\t$1, -8000104(%rbp)\n.L7:\n\taddl\t$1, -8000100(%rbp)\n.L6:\n\tmovl\t-8000124(%rbp), %eax\n\tcmpl\t%eax, -8000100(%rbp)\n\tjl\t.L8\n\tmovl\t-8000104(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 - ((struct tuple *)b)->y; } int main(void){ int N; int x,l; scanf("%d", &N); struct tuple A[1000000+10]; for (int i = 0; i < N; i++) { scanf("%d %d", &x, &l); A[i].x = x - l; A[i].y = x + l; } qsort(A,N,sizeof (struct tuple), asc); int now = -1100000000; int cnt = 0; for (int i = 0; i < N; i++) { if (now <= A[i].x) { now = A[i].y; cnt++; } } printf("%d\n",cnt); } Unoptimized Assembly Code: .file "temp.c" .text .globl asc .type asc, @function asc: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl 4(%rax), %edx movq -16(%rbp), %rax movl 4(%rax), %ecx movl %edx, %eax subl %ecx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size asc, .-asc .section .rodata .LC0: .string "%d" .LC1: .string "%d %d" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -7999488(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $640, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -8000124(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -8000112(%rbp) jmp .L4 .L5: leaq -8000116(%rbp), %rdx leaq -8000120(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -8000120(%rbp), %eax movl -8000116(%rbp), %ecx subl %ecx, %eax movl %eax, %edx movl -8000112(%rbp), %eax cltq movl %edx, -8000096(%rbp,%rax,8) movl -8000120(%rbp), %edx movl -8000116(%rbp), %eax addl %eax, %edx movl -8000112(%rbp), %eax cltq movl %edx, -8000092(%rbp,%rax,8) addl $1, -8000112(%rbp) .L4: movl -8000124(%rbp), %eax cmpl %eax, -8000112(%rbp) jl .L5 movl -8000124(%rbp), %eax movslq %eax, %rsi leaq -8000096(%rbp), %rax leaq asc(%rip), %rdx movq %rdx, %rcx movl $8, %edx movq %rax, %rdi call qsort@PLT movl $-1100000000, -8000108(%rbp) movl $0, -8000104(%rbp) movl $0, -8000100(%rbp) jmp .L6 .L8: movl -8000100(%rbp), %eax cltq movl -8000096(%rbp,%rax,8), %eax cmpl %eax, -8000108(%rbp) jg .L7 movl -8000100(%rbp), %eax cltq movl -8000092(%rbp,%rax,8), %eax movl %eax, -8000108(%rbp) addl $1, -8000104(%rbp) .L7: addl $1, -8000100(%rbp) .L6: movl -8000124(%rbp), %eax cmpl %eax, -8000100(%rbp) jl .L8 movl -8000104(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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// 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;\nchar tr['Z'+1], assign['Z'+1];\nchar idx[10], not0[10], used[10];\nint ans;\n\nvoid calc()\n{\n\tint i, a, s;\n\tchar *p;\n\n\t// 下一桁の合計で枝刈りしてみる\n\ts = 0; for (i = 0; i < m; i++) s += assign[str[i][len[i]]];\n\ta = assign[str[m][len[m]]];\n\tif (s % 10 != a) return;\n\n\ts = 0;\n\tfor (i = 0; i < m; i++) {\n\t\ta = 0, p = str[i];\n\t\twhile (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];\n\t\ts += a;\n\t}\n\n\ta = 0, p = str[m];\n\twhile (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];\n\tif (a == s) ans++;\n}\n\nvoid rec(int k)\n{\n\tint i;\n\n\tif (k == sz) { calc(); return; }\n\tif (!used[0]) {\n\t\tif (!not0[k]) used[0] = 1, assign[idx[k]] = 0, rec(k+1), used[0] = 0;\n\t}\n\tfor (i = 1; i < 10; i++) {\n\t\tif (used[i]) continue;\n\t\tused[i] = 1, assign[idx[k]] = i, rec(k+1), used[i] = 0;\n\t}\n}\n\nint main()\n{\n\tint n, i;\n\tchar buf[10], *p;\n\n\twhile (fgets(buf, 10, stdin) && *buf != '0') {\n\t\tsz = 0, memset(tr, -1, sizeof(tr));\n\t\tmemset(not0, 0, sizeof(not0));\n\t\tn = atoi(buf), m = n - 1, max = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tfgets(str[i], 15, stdin);\n\t\t\tfor (p = str[i]; *p > ' '; p++) {\n\t\t\t\tif (tr[*p] < 0) tr[*p] = sz, idx[sz++] = *p;\n\t\t\t}\n\t\t\t*p = -1; len[i] = p-str[i]-1;\n\t\t\tif (len[i] > 0) not0[tr[*str[i]]] = 1;\n\t\t\tif (i < m && len[i] > max) max = len[i];\n\t\t}\n\t\tans = 0;\n\t\tif (len[m] >= max && len[m] <= max+2) {\n\t\t\tmemset(used, 0, sizeof(used));\n\t\t\trec(0);\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tm\n\t.bss\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tstr\n\t.align 32\n\t.type\tstr, @object\n\t.size\tstr, 143\nstr:\n\t.zero\t143\n\t.globl\tlen\n\t.align 32\n\t.type\tlen, @object\n\t.size\tlen, 52\nlen:\n\t.zero\t52\n\t.globl\tmax\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.globl\ttr\n\t.align 32\n\t.type\ttr, @object\n\t.size\ttr, 91\ntr:\n\t.zero\t91\n\t.globl\tassign\n\t.align 32\n\t.type\tassign, @object\n\t.size\tassign, 91\nassign:\n\t.zero\t91\n\t.globl\tidx\n\t.align 8\n\t.type\tidx, @object\n\t.size\tidx, 10\nidx:\n\t.zero\t10\n\t.globl\tnot0\n\t.align 8\n\t.type\tnot0, @object\n\t.size\tnot0, 10\nnot0:\n\t.zero\t10\n\t.globl\tused\n\t.align 8\n\t.type\tused, @object\n\t.size\tused, 10\nused:\n\t.zero\t10\n\t.globl\tans\n\t.align 4\n\t.type\tans, @object\n\t.size\tans, 4\nans:\n\t.zero\t4\n\t.text\n\t.globl\tcalc\n\t.type\tcalc, @function\ncalc:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t(%rax,%rcx), %rdx\n\tleaq\tstr(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\taddl\t%eax, -12(%rbp)\n\taddl\t$1, -20(%rbp)\n.L2:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L3\n\tmovl\tm(%rip), %eax\n\tmovl\tm(%rip), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tlen(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t(%rax,%rcx), %rdx\n\tleaq\tstr(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-12(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\tcmpl\t%edx, -16(%rbp)\n\tjne\t.L12\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L6\n.L9:\n\tmovl\t$0, -16(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-16(%rbp), %eax\n\tleal\t0(,%rax,8), %edx\n\tmovl\t-16(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -8(%rbp)\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\taddl\t%ecx, %eax\n\tmovl\t%eax, -16(%rbp)\n.L7:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjns\t.L8\n\tmovl\t-16(%rbp), %eax\n\taddl\t%eax, -12(%rbp)\n\taddl\t$1, -20(%rbp)\n.L6:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L9\n\tmovl\t$0, -16(%rbp)\n\tmovl\tm(%rip), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-16(%rbp), %eax\n\tleal\t0(,%rax,8), %edx\n\tmovl\t-16(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -8(%rbp)\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\taddl\t%ecx, %eax\n\tmovl\t%eax, -16(%rbp)\n.L10:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjns\t.L11\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t-12(%rbp), %eax\n\tjne\t.L1\n\tmovl\tans(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, ans(%rip)\n\tjmp\t.L1\n.L12:\n\tnop\n.L1:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcalc, .-calc\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\tsz(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjne\t.L14\n\tmovl\t$0, %eax\n\tcall\tcalc\n\tjmp\t.L13\n.L14:\n\tmovzbl\tused(%rip), %eax\n\ttestb\t%al, %al\n\tjne\t.L16\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\tnot0(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\ttestb\t%al, %al\n\tjne\t.L16\n\tmovb\t$1, used(%rip)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\tidx(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$0, (%rax,%rdx)\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\trec\n\tmovb\t$0, used(%rip)\n.L16:\n\tmovl\t$1, -4(%rbp)\n\tjmp\t.L17\n.L20:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\tused(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\ttestb\t%al, %al\n\tjne\t.L21\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\tused(%rip), %rdx\n\tmovb\t$1, (%rax,%rdx)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\tidx(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, %ecx\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovb\t%cl, (%rax,%rdx)\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\trec\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\tused(%rip), %rdx\n\tmovb\t$0, (%rax,%rdx)\n\tjmp\t.L19\n.L21:\n\tnop\n.L19:\n\taddl\t$1, -4(%rbp)\n.L17:\n\tcmpl\t$9, -4(%rbp)\n\tjle\t.L20\n.L13:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\trec, .-rec\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L23\n.L33:\n\tmovl\t$0, sz(%rip)\n\tmovl\t$91, %edx\n\tmovl\t$-1, %esi\n\tleaq\ttr(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$10, %edx\n\tmovl\t$0, %esi\n\tleaq\tnot0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-18(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tatoi@PLT\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, m(%rip)\n\tmovl\t$0, max(%rip)\n\tmovl\t$0, -40(%rbp)\n\tjmp\t.L24\n.L30:\n\tmovq\tstdin(%rip), %rcx\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tmovl\t$15, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -32(%rbp)\n\tjmp\t.L25\n.L27:\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\ttr(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\ttestb\t%al, %al\n\tjns\t.L26\n\tmovl\tsz(%rip), %edx\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%edx, %ecx\n\tcltq\n\tleaq\ttr(%rip), %rdx\n\tmovb\t%cl, (%rax,%rdx)\n\tmovl\tsz(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, sz(%rip)\n\tmovq\t-32(%rbp), %rdx\n\tmovzbl\t(%rdx), %edx\n\tcltq\n\tleaq\tidx(%rip), %rcx\n\tmovb\t%dl, (%rax,%rcx)\n.L26:\n\taddq\t$1, -32(%rbp)\n.L25:\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$32, %al\n\tjg\t.L27\n\tmovq\t-32(%rbp), %rax\n\tmovb\t$-1, (%rax)\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsubq\t%rdx, %rax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L28\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rax, %rdx\n\tleaq\tstr(%rip), %rax\n\tmovzbl\t(%rdx,%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\ttr(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tnot0(%rip), %rdx\n\tmovb\t$1, (%rax,%rdx)\n.L28:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -40(%rbp)\n\tjge\t.L29\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\tmax(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L29\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, max(%rip)\n.L29:\n\taddl\t$1, -40(%rbp)\n.L24:\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjl\t.L30\n\tmovl\t$0, ans(%rip)\n\tmovl\tm(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\tmax(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L31\n\tmovl\tm(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\tmax(%rip), %edx\n\taddl\t$2, %edx\n\tcmpl\t%edx, %eax\n\tjg\t.L31\n\tmovl\t$10, %edx\n\tmovl\t$0, %esi\n\tleaq\tused(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, %edi\n\tcall\trec\n.L31:\n\tmovl\tans(%rip), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L23:\n\tmovq\tstdin(%rip), %rdx\n\tleaq\t-18(%rbp), %rax\n\tmovl\t$10, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\ttestq\t%rax, %rax\n\tje\t.L32\n\tmovzbl\t-18(%rbp), %eax\n\tcmpb\t$48, %al\n\tjne\t.L33\n.L32:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L35\n\tcall\t__stack_chk_fail@PLT\n.L35:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\t%r10, %rcx\n\tleaq\t(%r10,%rdx,2), %rdx\n\taddq\t%r8, %rdx\n\tmovsbq\t(%rdx,%rax), %rax\n\tmovsbl\t(%rsi,%rax), %edi\n\ttestl\t%r10d, %r10d\n\tjle\t.L2\n\tmovslq\tlen(%rip), %rax\n\tmovsbq\t(%r8,%rax), %rax\n\tmovsbl\t(%rsi,%rax), %eax\n\tcmpl\t$1, %r10d\n\tje\t.L3\n\tmovslq\t4+len(%rip), %rdx\n\tmovsbq\t11(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$2, %r10d\n\tje\t.L3\n\tmovslq\t8+len(%rip), %rdx\n\tmovsbq\t22(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$3, %r10d\n\tje\t.L3\n\tmovslq\t12+len(%rip), %rdx\n\tmovsbq\t33(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$4, %r10d\n\tje\t.L3\n\tmovslq\t16+len(%rip), %rdx\n\tmovsbq\t44(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$5, %r10d\n\tje\t.L3\n\tmovslq\t20+len(%rip), %rdx\n\tmovsbq\t55(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$6, %r10d\n\tje\t.L3\n\tmovslq\t24+len(%rip), %rdx\n\tmovsbq\t66(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$7, %r10d\n\tje\t.L3\n\tmovslq\t28+len(%rip), %rdx\n\tmovsbq\t77(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$8, %r10d\n\tje\t.L3\n\tmovslq\t32+len(%rip), %rdx\n\tmovsbq\t88(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$9, %r10d\n\tje\t.L3\n\tmovslq\t36+len(%rip), %rdx\n\tmovsbq\t99(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$10, %r10d\n\tje\t.L3\n\tmovslq\t40+len(%rip), %rdx\n\tmovsbq\t110(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$11, %r10d\n\tje\t.L3\n\tmovslq\t44+len(%rip), %rdx\n\tmovsbq\t121(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$12, %r10d\n\tje\t.L3\n\tmovslq\t48+len(%rip), %rdx\n\tmovsbq\t132(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n.L3:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, %r9d\n\timulq\t$1717986919, %rdx, %rdx\n\tsarl\t$31, %r9d\n\tsarq\t$34, %rdx\n\tsubl\t%r9d, %edx\n\tleal\t(%rdx,%rdx,4), %edx\n\taddl\t%edx, %edx\n\tsubl\t%edx, %eax\n\tcmpl\t%edi, %eax\n\tjne\t.L1\n\tleal\t-1(%rcx), %eax\n\tleaq\tstr(%rip), %rdi\n\txorl\t%r9d, %r9d\n\tleaq\t(%rax,%rax,4), %rdx\n\tleaq\t(%rax,%rdx,2), %r11\n\tleaq\t11(%rdi), %rax\n\taddq\t%rax, %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovsbq\t(%rdi), %rax\n\tmovq\t%rdi, %rcx\n\ttestb\t%al, %al\n\tjs\t.L4\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovsbl\t(%rsi,%rax), %eax\n\tleal\t(%rdx,%rdx,4), %edx\n\taddq\t$1, %rcx\n\tleal\t(%rax,%rdx,2), %edx\n\tmovsbq\t(%rcx), %rax\n\ttestb\t%al, %al\n\tjns\t.L5\n\taddl\t%edx, %r9d\n.L4:\n\taddq\t$11, %rdi\n\tcmpq\t%rdi, %r11\n\tjne\t.L6\n\tleaq\t(%r10,%r10,4), %rax\n\tleaq\t(%r10,%rax,2), %rdx\n\taddq\t%r8, %rdx\n\tmovsbq\t(%rdx), %rax\n\ttestb\t%al, %al\n\tjs\t.L14\n.L12:\n\txorl\t%ecx, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovsbl\t(%rsi,%rax), %eax\n\tleal\t(%rcx,%rcx,4), %ecx\n\taddq\t$1, %rdx\n\tleal\t(%rax,%rcx,2), %ecx\n\tmovsbq\t(%rdx), %rax\n\ttestb\t%al, %al\n\tjns\t.L8\n.L7:\n\tcmpl\t%r9d, %ecx\n\tje\t.L13\n.L1:\n\tret\n.L2:\n\ttestb\t%dil, %dil\n\tjne\t.L1\n\tmovsbq\t(%rdx), %rax\n\txorl\t%r9d, %r9d\n\ttestb\t%al, %al\n\tjns\t.L12\n.L13:\n\taddl\t$1, ans(%rip)\n\tret\n.L14:\n\txorl\t%ecx, %ecx\n\tjmp\t.L7\n\t.cfi_endproc\n.LFE51:\n\t.size\tcalc, .-calc\n\t.p2align 4\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%edi, sz(%rip)\n\tje\t.L72\n\tcmpb\t$0, used(%rip)\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tmovl\t%edi, %ebx\n\tjne\t.L60\n\tmovslq\t%edi, %rax\n\tleaq\tnot0(%rip), %rdx\n\tcmpb\t$0, (%rdx,%rax)\n\tje\t.L73\n.L60:\n\tcmpb\t$0, 1+used(%rip)\n\tje\t.L74\n.L61:\n\tcmpb\t$0, 2+used(%rip)\n\tje\t.L75\n.L62:\n\tcmpb\t$0, 3+used(%rip)\n\tje\t.L76\n.L63:\n\tcmpb\t$0, 4+used(%rip)\n\tje\t.L77\n.L64:\n\tcmpb\t$0, 5+used(%rip)\n\tje\t.L78\n.L65:\n\tcmpb\t$0, 6+used(%rip)\n\tje\t.L79\n.L66:\n\tcmpb\t$0, 7+used(%rip)\n\tje\t.L80\n.L67:\n\tcmpb\t$0, 8+used(%rip)\n\tje\t.L81\n.L68:\n\tcmpb\t$0, 9+used(%rip)\n\tje\t.L82\n.L58:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L82:\n\t.cfi_restore_state\n\tmovslq\t%ebx, %rax\n\tleaq\tidx(%rip), %rdx\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 9+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$9, (%rdx,%rax)\n\tcall\trec\n\tmovb\t$0, 9+used(%rip)\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\t.cfi_restore_state\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 1+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$1, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 2+used(%rip)\n\tmovb\t$0, 1+used(%rip)\n\tjne\t.L62\n\t.p2align 4,,10\n\t.p2align 3\n.L75:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 2+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$2, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 3+used(%rip)\n\tmovb\t$0, 2+used(%rip)\n\tjne\t.L63\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 3+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$3, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 4+used(%rip)\n\tmovb\t$0, 3+used(%rip)\n\tjne\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L77:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 4+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$4, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 5+used(%rip)\n\tmovb\t$0, 4+used(%rip)\n\tjne\t.L65\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 5+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$5, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 6+used(%rip)\n\tmovb\t$0, 5+used(%rip)\n\tjne\t.L66\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 6+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$6, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 7+used(%rip)\n\tmovb\t$0, 6+used(%rip)\n\tjne\t.L67\n\t.p2align 4,,10\n\t.p2align 3\n.L80:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 7+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$7, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 8+used(%rip)\n\tmovb\t$0, 7+used(%rip)\n\tjne\t.L68\n\t.p2align 4,,10\n\t.p2align 3\n.L81:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 8+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$8, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 9+used(%rip)\n\tmovb\t$0, 8+used(%rip)\n\tjne\t.L58\n\tjmp\t.L82\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tleaq\tidx(%rip), %rdx\n\tleal\t1(%rdi), %edi\n\tmovb\t$1, used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$0, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 1+used(%rip)\n\tmovb\t$0, used(%rip)\n\tjne\t.L61\n\tjmp\t.L74\n\t.p2align 4,,10\n\t.p2align 3\n.L72:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\txorl\t%eax, %eax\n\tjmp\tcalc\n\t.cfi_endproc\n.LFE52:\n\t.size\trec, .-rec\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\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.LFB53:\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.cfi_offset 13, -32\n\tleaq\tidx(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\tlen(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t30(%rsp), %rax\n\tmovq\t%rax, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovq\tstdin(%rip), %rdx\n\tmovq\t8(%rsp), %rdi\n\tmovl\t$10, %esi\n\tcall\tfgets@PLT\n\ttestq\t%rax, %rax\n\tje\t.L97\n\tcmpb\t$48, 30(%rsp)\n\tje\t.L97\n\tmovl\t$-1, %edx\n\tmovq\t8(%rsp), %rdi\n\tpcmpeqd\t%xmm0, %xmm0\n\txorl\t%ecx, %ecx\n\tmovw\t%dx, 88+tr(%rip)\n\txorl\t%esi, %esi\n\tmovl\t$10, %edx\n\tmovl\t$0, sz(%rip)\n\tmovq\t$-1, 80+tr(%rip)\n\tmovb\t$-1, 90+tr(%rip)\n\tmovq\t$0, not0(%rip)\n\tmovw\t%cx, 8+not0(%rip)\n\tmovaps\t%xmm0, tr(%rip)\n\tmovaps\t%xmm0, 16+tr(%rip)\n\tmovaps\t%xmm0, 32+tr(%rip)\n\tmovaps\t%xmm0, 48+tr(%rip)\n\tmovaps\t%xmm0, 64+tr(%rip)\n\tcall\tstrtol@PLT\n\tmovl\t$0, max(%rip)\n\tleal\t-1(%rax), %ebx\n\tmovl\t%ebx, m(%rip)\n\tmovslq\t%ebx, %rdx\n\ttestl\t%eax, %eax\n\tjle\t.L100\n\tleaq\tstr(%rip), %r12\n\txorl\t%r15d, %r15d\n\tleaq\ttr(%rip), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L95:\n\tmovq\tstdin(%rip), %rdx\n\tmovl\t$15, %esi\n\tmovq\t%r12, %rdi\n\tcall\tfgets@PLT\n\tmovzbl\t(%r12), %edx\n\tcmpb\t$32, %dl\n\tjle\t.L86\n\tmovslq\tsz(%rip), %rsi\n\tmovq\t%r12, %rax\n\txorl\t%r9d, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\tmovsbq\t%dl, %r8\n\tcmpb\t$0, (%r14,%r8)\n\tjs\t.L113\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\tcmpb\t$32, %dl\n\tjg\t.L91\n\ttestb\t%r9b, %r9b\n\tjne\t.L114\n.L92:\n\tmovb\t$-1, (%rax)\n\tsubq\t%r12, %rax\n\tsubl\t$1, %eax\n\tmovl\t%eax, 0(%rbp,%r15,4)\n\ttestl\t%eax, %eax\n\tjle\t.L93\n\tmovsbq\t(%r12), %rdx\n\tleaq\tnot0(%rip), %rcx\n\tmovsbq\t(%r14,%rdx), %rdx\n\tmovb\t$1, (%rcx,%rdx)\n.L93:\n\tmovslq\tm(%rip), %rdx\n\tcmpl\t%r15d, %edx\n\tjle\t.L94\n\tcmpl\t%eax, max(%rip)\n\tjge\t.L94\n\tmovl\t%eax, max(%rip)\n.L94:\n\tleaq\t1(%r15), %rax\n\taddq\t$11, %r12\n\tcmpq\t%r15, %rbx\n\tje\t.L115\n\tmovq\t%rax, %r15\n\tjmp\t.L95\n\t.p2align 4,,10\n\t.p2align 3\n.L113:\n\taddq\t$1, %rax\n\tmovb\t%dl, 0(%r13,%rsi)\n\tmovzbl\t(%rax), %edx\n\tmovb\t%sil, (%r14,%r8)\n\tleal\t1(%rsi), %r8d\n\tcmpb\t$32, %dl\n\tjle\t.L89\n\tmovslq\t%r8d, %rsi\n\tmovl\t$1, %r9d\n\tjmp\t.L91\n\t.p2align 4,,10\n\t.p2align 3\n.L114:\n\tmovl\t%esi, %r8d\n.L89:\n\tmovl\t%r8d, sz(%rip)\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L86:\n\tmovb\t$-1, (%r12)\n\tmovl\t$-1, %eax\n\tmovl\t$-1, 0(%rbp,%r15,4)\n\tjmp\t.L93\n\t.p2align 4,,10\n\t.p2align 3\n.L115:\n\tmovl\tmax(%rip), %eax\n.L85:\n\tmovl\t0(%rbp,%rdx,4), %edx\n\txorl\t%r8d, %r8d\n\tmovl\t$0, ans(%rip)\n\tcmpl\t%eax, %edx\n\tjl\t.L96\n\taddl\t$2, %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L116\n.L96:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC0(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L84\n.L116:\n\tmovq\t$0, used(%rip)\n\txorl\t%eax, %eax\n\txorl\t%edi, %edi\n\tmovw\t%ax, 8+used(%rip)\n\tcall\trec\n\tmovl\tans(%rip), %r8d\n\tjmp\t.L96\n.L97:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L117\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L100:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L85\n.L117:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tmain, .-main\n\t.globl\tans\n\t.bss\n\t.align 4\n\t.type\tans, @object\n\t.size\tans, 4\nans:\n\t.zero\t4\n\t.globl\tused\n\t.align 8\n\t.type\tused, @object\n\t.size\tused, 10\nused:\n\t.zero\t10\n\t.globl\tnot0\n\t.align 8\n\t.type\tnot0, @object\n\t.size\tnot0, 10\nnot0:\n\t.zero\t10\n\t.globl\tidx\n\t.align 8\n\t.type\tidx, @object\n\t.size\tidx, 10\nidx:\n\t.zero\t10\n\t.globl\tassign\n\t.align 32\n\t.type\tassign, @object\n\t.size\tassign, 91\nassign:\n\t.zero\t91\n\t.globl\ttr\n\t.align 32\n\t.type\ttr, @object\n\t.size\ttr, 91\ntr:\n\t.zero\t91\n\t.globl\tmax\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.globl\tlen\n\t.align 32\n\t.type\tlen, @object\n\t.size\tlen, 52\nlen:\n\t.zero\t52\n\t.globl\tstr\n\t.align 32\n\t.type\tstr, @object\n\t.size\tstr, 143\nstr:\n\t.zero\t143\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tm\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, %rcx\n\tleaq\t(%r10,%rdx,2), %rdx\n\taddq\t%r8, %rdx\n\tmovsbq\t(%rdx,%rax), %rax\n\tmovsbl\t(%rsi,%rax), %edi\n\ttestl\t%r10d, %r10d\n\tjle\t.L2\n\tmovslq\tlen(%rip), %rax\n\tmovsbq\t(%r8,%rax), %rax\n\tmovsbl\t(%rsi,%rax), %eax\n\tcmpl\t$1, %r10d\n\tje\t.L3\n\tmovslq\t4+len(%rip), %rdx\n\tmovsbq\t11(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$2, %r10d\n\tje\t.L3\n\tmovslq\t8+len(%rip), %rdx\n\tmovsbq\t22(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$3, %r10d\n\tje\t.L3\n\tmovslq\t12+len(%rip), %rdx\n\tmovsbq\t33(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$4, %r10d\n\tje\t.L3\n\tmovslq\t16+len(%rip), %rdx\n\tmovsbq\t44(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$5, %r10d\n\tje\t.L3\n\tmovslq\t20+len(%rip), %rdx\n\tmovsbq\t55(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$6, %r10d\n\tje\t.L3\n\tmovslq\t24+len(%rip), %rdx\n\tmovsbq\t66(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$7, %r10d\n\tje\t.L3\n\tmovslq\t28+len(%rip), %rdx\n\tmovsbq\t77(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$8, %r10d\n\tje\t.L3\n\tmovslq\t32+len(%rip), %rdx\n\tmovsbq\t88(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$9, %r10d\n\tje\t.L3\n\tmovslq\t36+len(%rip), %rdx\n\tmovsbq\t99(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$10, %r10d\n\tje\t.L3\n\tmovslq\t40+len(%rip), %rdx\n\tmovsbq\t110(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$11, %r10d\n\tje\t.L3\n\tmovslq\t44+len(%rip), %rdx\n\tmovsbq\t121(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n\tcmpl\t$12, %r10d\n\tje\t.L3\n\tmovslq\t48+len(%rip), %rdx\n\tmovsbq\t132(%r8,%rdx), %rdx\n\tmovsbl\t(%rsi,%rdx), %edx\n\taddl\t%edx, %eax\n.L3:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, %r9d\n\timulq\t$1717986919, %rdx, %rdx\n\tsarl\t$31, %r9d\n\tsarq\t$34, %rdx\n\tsubl\t%r9d, %edx\n\tleal\t(%rdx,%rdx,4), %edx\n\taddl\t%edx, %edx\n\tsubl\t%edx, %eax\n\tcmpl\t%edi, %eax\n\tjne\t.L1\n\tleal\t-1(%rcx), %eax\n\tleaq\tstr(%rip), %rdi\n\txorl\t%r9d, %r9d\n\tleaq\t(%rax,%rax,4), %rdx\n\tleaq\t(%rax,%rdx,2), %r11\n\tleaq\t11(%rdi), %rax\n\taddq\t%rax, %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovsbq\t(%rdi), %rax\n\tmovq\t%rdi, %rcx\n\ttestb\t%al, %al\n\tjs\t.L4\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovsbl\t(%rsi,%rax), %eax\n\tleal\t(%rdx,%rdx,4), %edx\n\taddq\t$1, %rcx\n\tleal\t(%rax,%rdx,2), %edx\n\tmovsbq\t(%rcx), %rax\n\ttestb\t%al, %al\n\tjns\t.L5\n\taddl\t%edx, %r9d\n.L4:\n\taddq\t$11, %rdi\n\tcmpq\t%rdi, %r11\n\tjne\t.L6\n\tleaq\t(%r10,%r10,4), %rax\n\tleaq\t(%r10,%rax,2), %rdx\n\taddq\t%r8, %rdx\n\tmovsbq\t(%rdx), %rax\n\ttestb\t%al, %al\n\tjs\t.L14\n.L12:\n\txorl\t%ecx, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovsbl\t(%rsi,%rax), %eax\n\tleal\t(%rcx,%rcx,4), %ecx\n\taddq\t$1, %rdx\n\tleal\t(%rax,%rcx,2), %ecx\n\tmovsbq\t(%rdx), %rax\n\ttestb\t%al, %al\n\tjns\t.L8\n.L7:\n\tcmpl\t%r9d, %ecx\n\tje\t.L13\n.L1:\n\tret\n.L2:\n\ttestb\t%dil, %dil\n\tjne\t.L1\n\tmovsbq\t(%rdx), %rax\n\txorl\t%r9d, %r9d\n\ttestb\t%al, %al\n\tjns\t.L12\n.L13:\n\taddl\t$1, ans(%rip)\n\tret\n.L14:\n\txorl\t%ecx, %ecx\n\tjmp\t.L7\n\t.cfi_endproc\n.LFE51:\n\t.size\tcalc, .-calc\n\t.p2align 4\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%edi, sz(%rip)\n\tje\t.L72\n\tcmpb\t$0, used(%rip)\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 3, -16\n\tmovl\t%edi, %ebx\n\tjne\t.L60\n\tmovslq\t%edi, %rax\n\tleaq\tnot0(%rip), %rdx\n\tcmpb\t$0, (%rdx,%rax)\n\tje\t.L73\n.L60:\n\tcmpb\t$0, 1+used(%rip)\n\tje\t.L74\n.L61:\n\tcmpb\t$0, 2+used(%rip)\n\tje\t.L75\n.L62:\n\tcmpb\t$0, 3+used(%rip)\n\tje\t.L76\n.L63:\n\tcmpb\t$0, 4+used(%rip)\n\tje\t.L77\n.L64:\n\tcmpb\t$0, 5+used(%rip)\n\tje\t.L78\n.L65:\n\tcmpb\t$0, 6+used(%rip)\n\tje\t.L79\n.L66:\n\tcmpb\t$0, 7+used(%rip)\n\tje\t.L80\n.L67:\n\tcmpb\t$0, 8+used(%rip)\n\tje\t.L81\n.L68:\n\tcmpb\t$0, 9+used(%rip)\n\tje\t.L82\n.L58:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L82:\n\t.cfi_restore_state\n\tmovslq\t%ebx, %rax\n\tleaq\tidx(%rip), %rdx\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 9+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$9, (%rdx,%rax)\n\tcall\trec\n\tmovb\t$0, 9+used(%rip)\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\t.cfi_restore_state\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 1+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$1, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 2+used(%rip)\n\tmovb\t$0, 1+used(%rip)\n\tjne\t.L62\n\t.p2align 4,,10\n\t.p2align 3\n.L75:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 2+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$2, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 3+used(%rip)\n\tmovb\t$0, 2+used(%rip)\n\tjne\t.L63\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 3+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$3, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 4+used(%rip)\n\tmovb\t$0, 3+used(%rip)\n\tjne\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L77:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 4+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$4, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 5+used(%rip)\n\tmovb\t$0, 4+used(%rip)\n\tjne\t.L65\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 5+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$5, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 6+used(%rip)\n\tmovb\t$0, 5+used(%rip)\n\tjne\t.L66\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 6+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$6, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 7+used(%rip)\n\tmovb\t$0, 6+used(%rip)\n\tjne\t.L67\n\t.p2align 4,,10\n\t.p2align 3\n.L80:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 7+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$7, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 8+used(%rip)\n\tmovb\t$0, 7+used(%rip)\n\tjne\t.L68\n\t.p2align 4,,10\n\t.p2align 3\n.L81:\n\tleaq\tidx(%rip), %rdx\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tmovb\t$1, 8+used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$8, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 9+used(%rip)\n\tmovb\t$0, 8+used(%rip)\n\tjne\t.L58\n\tjmp\t.L82\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tleaq\tidx(%rip), %rdx\n\tleal\t1(%rdi), %edi\n\tmovb\t$1, used(%rip)\n\tmovsbq\t(%rdx,%rax), %rax\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$0, (%rdx,%rax)\n\tcall\trec\n\tcmpb\t$0, 1+used(%rip)\n\tmovb\t$0, used(%rip)\n\tjne\t.L61\n\tjmp\t.L74\n\t.p2align 4,,10\n\t.p2align 3\n.L72:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\txorl\t%eax, %eax\n\tjmp\tcalc\n\t.cfi_endproc\n.LFE52:\n\t.size\trec, .-rec\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\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.LFB53:\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.cfi_offset 13, -32\n\tleaq\tidx(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\tlen(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t30(%rsp), %rax\n\tmovq\t%rax, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovq\tstdin(%rip), %rdx\n\tmovq\t8(%rsp), %rdi\n\tmovl\t$10, %esi\n\tcall\tfgets@PLT\n\ttestq\t%rax, %rax\n\tje\t.L97\n\tcmpb\t$48, 30(%rsp)\n\tje\t.L97\n\tmovl\t$-1, %edx\n\tmovq\t8(%rsp), %rdi\n\tpcmpeqd\t%xmm0, %xmm0\n\txorl\t%ecx, %ecx\n\tmovw\t%dx, 88+tr(%rip)\n\txorl\t%esi, %esi\n\tmovl\t$10, %edx\n\tmovl\t$0, sz(%rip)\n\tmovq\t$-1, 80+tr(%rip)\n\tmovb\t$-1, 90+tr(%rip)\n\tmovq\t$0, not0(%rip)\n\tmovw\t%cx, 8+not0(%rip)\n\tmovaps\t%xmm0, tr(%rip)\n\tmovaps\t%xmm0, 16+tr(%rip)\n\tmovaps\t%xmm0, 32+tr(%rip)\n\tmovaps\t%xmm0, 48+tr(%rip)\n\tmovaps\t%xmm0, 64+tr(%rip)\n\tcall\tstrtol@PLT\n\tmovl\t$0, max(%rip)\n\tleal\t-1(%rax), %ebx\n\tmovl\t%ebx, m(%rip)\n\tmovslq\t%ebx, %rdx\n\ttestl\t%eax, %eax\n\tjle\t.L100\n\tleaq\tstr(%rip), %r12\n\txorl\t%r15d, %r15d\n\tleaq\ttr(%rip), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L95:\n\tmovq\tstdin(%rip), %rdx\n\tmovl\t$15, %esi\n\tmovq\t%r12, %rdi\n\tcall\tfgets@PLT\n\tmovzbl\t(%r12), %edx\n\tcmpb\t$32, %dl\n\tjle\t.L86\n\tmovslq\tsz(%rip), %rsi\n\tmovq\t%r12, %rax\n\txorl\t%r9d, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\tmovsbq\t%dl, %r8\n\tcmpb\t$0, (%r14,%r8)\n\tjs\t.L113\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\tcmpb\t$32, %dl\n\tjg\t.L91\n\ttestb\t%r9b, %r9b\n\tjne\t.L114\n.L92:\n\tmovb\t$-1, (%rax)\n\tsubq\t%r12, %rax\n\tsubl\t$1, %eax\n\tmovl\t%eax, 0(%rbp,%r15,4)\n\ttestl\t%eax, %eax\n\tjle\t.L93\n\tmovsbq\t(%r12), %rdx\n\tleaq\tnot0(%rip), %rcx\n\tmovsbq\t(%r14,%rdx), %rdx\n\tmovb\t$1, (%rcx,%rdx)\n.L93:\n\tmovslq\tm(%rip), %rdx\n\tcmpl\t%r15d, %edx\n\tjle\t.L94\n\tcmpl\t%eax, max(%rip)\n\tjge\t.L94\n\tmovl\t%eax, max(%rip)\n.L94:\n\tleaq\t1(%r15), %rax\n\taddq\t$11, %r12\n\tcmpq\t%r15, %rbx\n\tje\t.L115\n\tmovq\t%rax, %r15\n\tjmp\t.L95\n\t.p2align 4,,10\n\t.p2align 3\n.L113:\n\taddq\t$1, %rax\n\tmovb\t%dl, 0(%r13,%rsi)\n\tmovzbl\t(%rax), %edx\n\tmovb\t%sil, (%r14,%r8)\n\tleal\t1(%rsi), %r8d\n\tcmpb\t$32, %dl\n\tjle\t.L89\n\tmovslq\t%r8d, %rsi\n\tmovl\t$1, %r9d\n\tjmp\t.L91\n\t.p2align 4,,10\n\t.p2align 3\n.L114:\n\tmovl\t%esi, %r8d\n.L89:\n\tmovl\t%r8d, sz(%rip)\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L86:\n\tmovb\t$-1, (%r12)\n\tmovl\t$-1, %eax\n\tmovl\t$-1, 0(%rbp,%r15,4)\n\tjmp\t.L93\n\t.p2align 4,,10\n\t.p2align 3\n.L115:\n\tmovl\tmax(%rip), %eax\n.L85:\n\tmovl\t0(%rbp,%rdx,4), %edx\n\txorl\t%r8d, %r8d\n\tmovl\t$0, ans(%rip)\n\tcmpl\t%eax, %edx\n\tjl\t.L96\n\taddl\t$2, %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L116\n.L96:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC0(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L84\n.L116:\n\tmovq\t$0, used(%rip)\n\txorl\t%eax, %eax\n\txorl\t%edi, %edi\n\tmovw\t%ax, 8+used(%rip)\n\tcall\trec\n\tmovl\tans(%rip), %r8d\n\tjmp\t.L96\n.L97:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L117\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L100:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L85\n.L117:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tmain, .-main\n\t.globl\tans\n\t.bss\n\t.align 4\n\t.type\tans, @object\n\t.size\tans, 4\nans:\n\t.zero\t4\n\t.globl\tused\n\t.align 8\n\t.type\tused, @object\n\t.size\tused, 10\nused:\n\t.zero\t10\n\t.globl\tnot0\n\t.align 8\n\t.type\tnot0, @object\n\t.size\tnot0, 10\nnot0:\n\t.zero\t10\n\t.globl\tidx\n\t.align 8\n\t.type\tidx, @object\n\t.size\tidx, 10\nidx:\n\t.zero\t10\n\t.globl\tassign\n\t.align 32\n\t.type\tassign, @object\n\t.size\tassign, 91\nassign:\n\t.zero\t91\n\t.globl\ttr\n\t.align 32\n\t.type\ttr, @object\n\t.size\ttr, 91\ntr:\n\t.zero\t91\n\t.globl\tmax\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.globl\tlen\n\t.align 32\n\t.type\tlen, @object\n\t.size\tlen, 52\nlen:\n\t.zero\t52\n\t.globl\tstr\n\t.align 32\n\t.type\tstr, @object\n\t.size\tstr, 143\nstr:\n\t.zero\t143\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tm\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "// 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;\nchar tr['Z'+1], assign['Z'+1];\nchar idx[10], not0[10], used[10];\nint ans;\n\nvoid calc()\n{\n\tint i, a, s;\n\tchar *p;\n\n\t// 下一桁の合計で枝刈りしてみる\n\ts = 0; for (i = 0; i < m; i++) s += assign[str[i][len[i]]];\n\ta = assign[str[m][len[m]]];\n\tif (s % 10 != a) return;\n\n\ts = 0;\n\tfor (i = 0; i < m; i++) {\n\t\ta = 0, p = str[i];\n\t\twhile (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];\n\t\ts += a;\n\t}\n\n\ta = 0, p = str[m];\n\twhile (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];\n\tif (a == s) ans++;\n}\n\nvoid rec(int k)\n{\n\tint i;\n\n\tif (k == sz) { calc(); return; }\n\tif (!used[0]) {\n\t\tif (!not0[k]) used[0] = 1, assign[idx[k]] = 0, rec(k+1), used[0] = 0;\n\t}\n\tfor (i = 1; i < 10; i++) {\n\t\tif (used[i]) continue;\n\t\tused[i] = 1, assign[idx[k]] = i, rec(k+1), used[i] = 0;\n\t}\n}\n\nint main()\n{\n\tint n, i;\n\tchar buf[10], *p;\n\n\twhile (fgets(buf, 10, stdin) && *buf != '0') {\n\t\tsz = 0, memset(tr, -1, sizeof(tr));\n\t\tmemset(not0, 0, sizeof(not0));\n\t\tn = atoi(buf), m = n - 1, max = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tfgets(str[i], 15, stdin);\n\t\t\tfor (p = str[i]; *p > ' '; p++) {\n\t\t\t\tif (tr[*p] < 0) tr[*p] = sz, idx[sz++] = *p;\n\t\t\t}\n\t\t\t*p = -1; len[i] = p-str[i]-1;\n\t\t\tif (len[i] > 0) not0[tr[*str[i]]] = 1;\n\t\t\tif (i < m && len[i] > max) max = len[i];\n\t\t}\n\t\tans = 0;\n\t\tif (len[m] >= max && len[m] <= max+2) {\n\t\t\tmemset(used, 0, sizeof(used));\n\t\t\trec(0);\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}\n", "index": 54, "inputs": [ "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nB\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nD\nE\nE\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nEVIF\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nHJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nVOM\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nIJ\n0\n", "3\nACM\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nC\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nOOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nF\nIJ\n0\n", "3\nACM\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nD\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGEMA\nBEST\nGAMER\n4\nA\nC\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nEMAG\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nOOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nF\nIJ\n0\n", "3\nMCA\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nD\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSES\nGAMER\n4\nA\nB\nB\nBA\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nMCA\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOO\nDIV\n9\nB\nA\nD\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSES\nGAMER\n4\nA\nB\nB\nBA\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n0\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSES\nGAMEQ\n0\nA\nB\nB\nBA\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n0\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nAMC\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nB\nAB\n3\nA\nB\nCC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMVO\nPOP\nIDV\n9\nA\nB\nC\nD\nE\nE\nG\nI\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n0\nTOW\nTHREE\nEVIF\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nJH\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nRAMEG\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nB\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nMCA\nMBI\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBERT\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nVOM\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nB\nB\nC\nD\nE\nF\nF\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nVID\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nHAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nACM\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nB\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nD\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nEMAG\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n0\nMOV\nOOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nF\nIJ\n0\n", "3\nMCA\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nB\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOO\nDIV\n9\nA\nA\nD\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSES\nGAMER\n4\nA\nB\nB\nBA\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nB\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGEMA\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nOWT\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOP\nIDV\n9\nB\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nBCM\nIBM\nICPC\n3\nGAME\nBSES\nGAMEQ\n0\nA\nB\nB\nAB\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n0\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nCPCI\n3\nGAME\nBSES\nGQMEA\n0\nA\nB\nB\nAB\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n0\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nBD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMVO\nPOP\nIDV\n9\nA\nB\nC\nD\nE\nE\nG\nI\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nB\nB\nCD\n3\nONE\nTWO\nTHREE\n0\nTOW\nTHREE\nEVIF\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nRAMEG\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nB\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBERT\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nA\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTIREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPPP\nVDI\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nHAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nB\nE\nE\nG\nH\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMEQ\n4\nA\nC\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOQ\nIDV\n9\nA\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIAM\nICPC\n3\nGAME\nBSES\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nCD\n3\nONF\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nLOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nG\nH\nJJ\n0\n", "3\nMCA\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nOWT\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIW\n9\nA\nA\nD\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBESU\nREMAG\n4\nB\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nF\nH\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nEMAG\nBEST\nGAMER\n4\nA\nB\nD\nAC\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nOOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nF\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSES\nREMAG\n4\nA\nB\nB\nBA\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nB\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGEMA\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nOWT\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIMB\nICPC\n3\nGAME\nBSES\nGQMEA\n0\nA\nB\nB\nAB\n3\nA\nB\nCD\n3\nENO\nTWO\nEERHT\n0\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n8\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nB\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTOW\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGEAM\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nJBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nEVIF\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nF\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nA\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTIREE\nFIVE\n3\nMOV\nPOP\nVID\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nMCA\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPPP\nVDI\n9\nA\nB\nD\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nHAMER\n4\nA\nA\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nB\nE\nE\nG\nH\nIJ\n0\n", "3\nMCA\nIBM\nCPCI\n3\nEMAG\nBEST\nGAMER\n4\nA\nB\nD\nAC\n3\nA\nC\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nOOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nF\nIJ\n0\n", "3\nMCA\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nB\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOO\nDIV\n9\nA\nA\nD\nC\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nSESB\nREMAG\n4\nA\nB\nB\nBA\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\nA\nB\nB\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nMCA\nHBM\nICPC\n3\nGEMA\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nOWT\nTHRDE\n3\nTOW\nTHREE\nEVIE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nH\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSES\nGAMER\n4\nA\nB\nB\nBA\n3\nA\nA\nCD\n3\nENO\nTWO\nTHREE\n0\nTVO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDVI\n9\nA\nB\nC\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nB\nB\nC\nBA\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nEHRET\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nD\nAB\n3\nA\nB\nCD\n3\nOME\nTXO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nF\nG\nIJ\n0\n", "3\nACM\nIBM\nIDPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nBD\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nVIFE\n3\nMVO\nPOP\nIDV\n9\nA\nB\nC\nD\nE\nE\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPD\n3\nGAME\nBEST\nGAMER\n4\nB\nB\nC\nBA\n3\nA\nB\nCD\n3\nONE\nTOW\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nA\nB\nC\nC\nE\nE\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGEAM\nBSET\nGANER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nF\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nA\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTIREE\nFIVE\n3\nMVO\nPOP\nVID\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBETT\nHAMER\n4\nA\nA\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nB\nE\nE\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBESU\nREMAG\n4\nB\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nFIVE\n3\nMOV\nPOP\nIDV\n9\nC\nB\nC\nC\nF\nE\nF\nH\nHJ\n0\n", "3\nMCA\nIBM\nBPCI\n3\nEMAG\nBEST\nGAMER\n4\nA\nB\nD\nAC\n3\nA\nC\nCD\n3\nENO\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nOOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nF\nIJ\n0\n", "3\nMCA\nBIM\nICPC\n3\nGAME\nBSET\nGANER\n4\nB\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOO\nDIV\n9\nA\nA\nD\nC\nE\nF\nG\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGAMER\n4\nA\nB\nD\nAB\n3\nA\nB\nCD\n3\nOME\nTXO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nD\nF\nF\nG\nIJ\n0\n", "3\nACM\nIBM\nIDPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nDB\n3\nONE\nTWO\nTHREE\n3\nTOW\nTHREE\nVIFE\n3\nMVO\nPOP\nIDV\n9\nA\nB\nC\nD\nE\nE\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBSET\nGANER\n4\nA\nA\nC\nAB\n0\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTIREE\nFIVE\n3\nMVO\nPOP\nVID\n9\nA\nA\nC\nD\nE\nF\nG\nG\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nBA\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTOW\nEHRTE\nFIVE\n3\nLOV\nPOP\nIDV\n9\nC\nB\nC\nC\nE\nE\nG\nH\nJJ\n0\n", "3\nMCA\nBIM\nHCPC\n3\nGAME\nBSET\nGANER\n4\nB\nB\nC\nAB\n3\nA\nB\nDC\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOO\nDIV\n9\nA\nA\nD\nC\nE\nF\nG\nG\nJJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nSESB\nGAMEQ\n0\nA\nB\nB\nAB\n3\nA\nB\nCD\n2\nENO\nTWO\nTHREE\n-1\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n11\nA\nB\nD\nD\nE\nF\nF\nG\nJJ\n0\n", "3\nACM\nIBN\nCPCI\n3\nGAME\nBSES\nGQMEA\n0\nA\nB\nB\nAC\n3\nA\nB\nCD\n3\nENO\nTWO\nTHREE\n0\nTWO\nTHREE\nFIVE\n3\nMOV\nPOQ\nDIV\n9\n@\nB\nC\nD\nE\nF\nF\nG\nJI\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nC\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nD\nCD\n3\nONE\nTWO\nTHSEE\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nRELAG\n4\nA\nB\nC\nAB\n3\nA\nD\nCD\n3\nONE\nTWO\nEHSET\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nF\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nHAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nC\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nI\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nREMAG\n4\nA\nB\nC\nAB\n3\nA\nC\nCD\n3\nONE\nTWO\nTHSEE\n3\nTWO\nTHREE\nFEVI\n3\nMOV\nPOP\nVID\n9\nA\nB\nC\nD\nE\nF\nG\nI\nHJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n", "3\nACM\nIBM\nICPC\n3\nGAME\nBEST\nGAMER\n4\nA\nB\nC\nAB\n3\nA\nB\nCD\n3\nONE\nTWO\nTHREE\n3\nTWO\nTHREE\nFIVE\n3\nMOV\nPOP\nDIV\n9\nA\nB\nC\nD\nE\nF\nG\nH\nIJ\n0\n" ], "outputs": [ "4\n1\n8\n30\n0\n0\n0\n32400\n", "4\n1\n8\n30\n0\n0\n0\n40320\n", "4\n0\n8\n30\n0\n0\n0\n32400\n", "4\n0\n1\n30\n0\n0\n0\n32400\n", "4\n1\n8\n30\n0\n0\n0\n19200\n", "4\n1\n8\n30\n0\n0\n0\n16512\n", "4\n1\n8\n30\n0\n0\n0\n5712\n", "0\n1\n8\n30\n0\n0\n0\n5712\n", "0\n1\n8\n30\n0\n0\n0\n32400\n", "4\n1\n8\n30\n0\n0\n0\n35280\n", "4\n1\n8\n30\n0\n0\n55\n40320\n", "11\n1\n8\n30\n0\n0\n0\n32400\n", "4\n0\n8\n30\n0\n0\n0\n16512\n", "4\n0\n8\n30\n0\n0\n368\n32400\n", "12\n0\n8\n30\n0\n0\n0\n16512\n", "4\n0\n8\n30\n0\n0\n368\n13680\n", "4\n1\n8\n30\n0\n0\n0\n5478\n", "0\n1\n4\n30\n0\n0\n0\n5712\n", "11\n1\n8\n30\n0\n0\n105\n32400\n", "12\n0\n8\n30\n0\n0\n0\n5712\n", "4\n7\n8\n30\n0\n0\n0\n5478\n", "0\n0\n4\n30\n0\n0\n0\n5712\n", "11\n0\n8\n30\n0\n0\n105\n32400\n", "0\n0\n8\n30\n0\n0\n0\n5712\n", "4\n0\n0\n30\n0\n0\n368\n13680\n", "0\n0\n8\n30\n0\n0\n0\n16512\n", "4\n0\n0\n30\n0\n", "4\n0\n", "0\n0\n8\n30\n0\n0\n0\n32400\n", "4\n0\n1\n8\n0\n0\n0\n32400\n", "4\n1\n8\n30\n0\n0\n71\n19200\n", "0\n1\n8\n30\n0\n", "4\n1\n8\n30\n0\n0\n0\n30240\n", "4\n12\n8\n30\n0\n0\n0\n5712\n", "11\n1\n8\n30\n0\n0\n0\n5712\n", "4\n0\n8\n30\n0\n0\n55\n40320\n", "11\n1\n8\n30\n0\n0\n0\n16512\n", "4\n0\n8\n30\n0\n0\n368\n16512\n", "4\n0\n8\n30\n0\n0\n236\n13680\n", "4\n14\n8\n30\n0\n0\n0\n5478\n", "12\n0\n8\n5\n0\n0\n0\n5712\n", "11\n0\n8\n30\n0\n0\n", "0\n0\n6\n30\n0\n0\n0\n5712\n", "4\n0\n0\n30\n0\n0\n368\n5280\n", "0\n0\n8\n30\n0\n0\n0\n1416\n", "0\n0\n", "12\n0\n", "4\n1\n8\n1\n0\n0\n71\n19200\n", "0\n1\n8\n5\n0\n", "4\n12\n8\n30\n0\n0\n0\n1416\n", "4\n0\n8\n30\n0\n0\n0\n40320\n", "4\n0\n1\n30\n0\n0\n0\n16512\n", "0\n1\n8\n30\n0\n0\n99\n5712\n", "4\n14\n8\n30\n0\n0\n0\n5712\n", "0\n1\n4\n30\n0\n0\n368\n5712\n", "0\n0\n8\n30\n0\n0\n368\n13680\n", "4\n7\n8\n30\n0\n0\n0\n1206\n", "0\n0\n8\n30\n0\n0\n247\n5712\n", "4\n7\n6\n30\n0\n0\n0\n5478\n", "11\n0\n24\n30\n0\n0\n105\n32400\n", "4\n8\n0\n30\n0\n0\n368\n5280\n", "0\n0\n8\n30\n0\n0\n0\n1328\n", "5\n0\n", "4\n1\n1\n30\n0\n0\n0\n16512\n", "4\n36\n8\n30\n0\n0\n0\n32400\n", "44\n0\n8\n30\n0\n0\n0\n32400\n", "4\n0\n1\n30\n0\n0\n66\n16512\n", "0\n1\n8\n30\n0\n0\n99\n16512\n", "4\n14\n1\n30\n0\n0\n0\n5712\n", "11\n0\n24\n1\n0\n0\n105\n32400\n", "0\n0\n6\n30\n0\n0\n0\n16512\n", "4\n3\n0\n30\n0\n0\n368\n5280\n", "14\n0\n8\n30\n0\n0\n0\n1328\n", "4\n0\n0\n5\n0\n", "4\n1\n1\n30\n0\n0\n0\n40320\n", "4\n0\n8\n30\n0\n0\n66\n32400\n", "7\n1\n8\n1\n0\n0\n71\n19200\n", "8\n1\n1\n30\n0\n0\n0\n16512\n", "4\n36\n8\n30\n0\n0\n0\n16512\n", "4\n0\n1\n30\n0\n0\n69\n16512\n", "4\n10\n1\n30\n0\n0\n0\n5712\n", "4\n7\n6\n30\n0\n0\n0\n1584\n", "0\n0\n24\n1\n0\n0\n105\n32400\n", "0\n0\n6\n30\n0\n0\n0\n5280\n", "4\n0\n8\n30\n0\n0\n66\n16512\n", "7\n1\n8\n0\n0\n0\n71\n19200\n", "4\n0\n1\n", "4\n1\n8\n30\n0\n0\n0\n1206\n", "14\n0\n6\n30\n0\n0\n0\n5280\n", "4\n10\n", "58\n0\n", "4\n1\n8\n30\n0\n0\n66\n40320\n", "4\n7\n8\n30\n0\n0\n66\n40320\n", "4\n7\n8\n30\n0\n0\n66\n35280\n", "4\n7\n8\n1\n0\n0\n66\n35280\n", "4\n7\n8\n0\n0\n0\n66\n35280\n", "4\n12\n8\n0\n0\n0\n66\n35280\n", "4\n1\n8\n30\n0\n0\n66\n32400\n", "4\n26\n8\n1\n0\n0\n66\n35280\n", "4\n7\n8\n1\n0\n0\n66\n40320\n", "4\n1\n8\n30\n0\n0\n0\n40320\n", "4\n1\n8\n30\n0\n0\n0\n40320\n" ], "question": "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;\nchar tr['Z'+1], assign['Z'+1];\nchar idx[10], not0[10], used[10];\nint ans;\n\nvoid calc()\n{\n\tint i, a, s;\n\tchar *p;\n\n\t// 下一桁の合計で枝刈りしてみる\n\ts = 0; for (i = 0; i < m; i++) s += assign[str[i][len[i]]];\n\ta = assign[str[m][len[m]]];\n\tif (s % 10 != a) return;\n\n\ts = 0;\n\tfor (i = 0; i < m; i++) {\n\t\ta = 0, p = str[i];\n\t\twhile (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];\n\t\ts += a;\n\t}\n\n\ta = 0, p = str[m];\n\twhile (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++];\n\tif (a == s) ans++;\n}\n\nvoid rec(int k)\n{\n\tint i;\n\n\tif (k == sz) { calc(); return; }\n\tif (!used[0]) {\n\t\tif (!not0[k]) used[0] = 1, assign[idx[k]] = 0, rec(k+1), used[0] = 0;\n\t}\n\tfor (i = 1; i < 10; i++) {\n\t\tif (used[i]) continue;\n\t\tused[i] = 1, assign[idx[k]] = i, rec(k+1), used[i] = 0;\n\t}\n}\n\nint main()\n{\n\tint n, i;\n\tchar buf[10], *p;\n\n\twhile (fgets(buf, 10, stdin) && *buf != '0') {\n\t\tsz = 0, memset(tr, -1, sizeof(tr));\n\t\tmemset(not0, 0, sizeof(not0));\n\t\tn = atoi(buf), m = n - 1, max = 0;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tfgets(str[i], 15, stdin);\n\t\t\tfor (p = str[i]; *p > ' '; p++) {\n\t\t\t\tif (tr[*p] < 0) tr[*p] = sz, idx[sz++] = *p;\n\t\t\t}\n\t\t\t*p = -1; len[i] = p-str[i]-1;\n\t\t\tif (len[i] > 0) not0[tr[*str[i]]] = 1;\n\t\t\tif (i < m && len[i] > max) max = len[i];\n\t\t}\n\t\tans = 0;\n\t\tif (len[m] >= max && len[m] <= max+2) {\n\t\t\tmemset(used, 0, sizeof(used));\n\t\t\trec(0);\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tm\n\t.bss\n\t.align 4\n\t.type\tm, @object\n\t.size\tm, 4\nm:\n\t.zero\t4\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tstr\n\t.align 32\n\t.type\tstr, @object\n\t.size\tstr, 143\nstr:\n\t.zero\t143\n\t.globl\tlen\n\t.align 32\n\t.type\tlen, @object\n\t.size\tlen, 52\nlen:\n\t.zero\t52\n\t.globl\tmax\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.globl\ttr\n\t.align 32\n\t.type\ttr, @object\n\t.size\ttr, 91\ntr:\n\t.zero\t91\n\t.globl\tassign\n\t.align 32\n\t.type\tassign, @object\n\t.size\tassign, 91\nassign:\n\t.zero\t91\n\t.globl\tidx\n\t.align 8\n\t.type\tidx, @object\n\t.size\tidx, 10\nidx:\n\t.zero\t10\n\t.globl\tnot0\n\t.align 8\n\t.type\tnot0, @object\n\t.size\tnot0, 10\nnot0:\n\t.zero\t10\n\t.globl\tused\n\t.align 8\n\t.type\tused, @object\n\t.size\tused, 10\nused:\n\t.zero\t10\n\t.globl\tans\n\t.align 4\n\t.type\tans, @object\n\t.size\tans, 4\nans:\n\t.zero\t4\n\t.text\n\t.globl\tcalc\n\t.type\tcalc, @function\ncalc:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t(%rax,%rcx), %rdx\n\tleaq\tstr(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\taddl\t%eax, -12(%rbp)\n\taddl\t$1, -20(%rbp)\n.L2:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L3\n\tmovl\tm(%rip), %eax\n\tmovl\tm(%rip), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tlen(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\t(%rax,%rcx), %rdx\n\tleaq\tstr(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-12(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\tcmpl\t%edx, -16(%rbp)\n\tjne\t.L12\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L6\n.L9:\n\tmovl\t$0, -16(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-16(%rbp), %eax\n\tleal\t0(,%rax,8), %edx\n\tmovl\t-16(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -8(%rbp)\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\taddl\t%ecx, %eax\n\tmovl\t%eax, -16(%rbp)\n.L7:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjns\t.L8\n\tmovl\t-16(%rbp), %eax\n\taddl\t%eax, -12(%rbp)\n\taddl\t$1, -20(%rbp)\n.L6:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L9\n\tmovl\t$0, -16(%rbp)\n\tmovl\tm(%rip), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-16(%rbp), %eax\n\tleal\t0(,%rax,8), %edx\n\tmovl\t-16(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovq\t-8(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -8(%rbp)\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\taddl\t%ecx, %eax\n\tmovl\t%eax, -16(%rbp)\n.L10:\n\tmovq\t-8(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\ttestb\t%al, %al\n\tjns\t.L11\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t-12(%rbp), %eax\n\tjne\t.L1\n\tmovl\tans(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, ans(%rip)\n\tjmp\t.L1\n.L12:\n\tnop\n.L1:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcalc, .-calc\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\tsz(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjne\t.L14\n\tmovl\t$0, %eax\n\tcall\tcalc\n\tjmp\t.L13\n.L14:\n\tmovzbl\tused(%rip), %eax\n\ttestb\t%al, %al\n\tjne\t.L16\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\tnot0(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\ttestb\t%al, %al\n\tjne\t.L16\n\tmovb\t$1, used(%rip)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\tidx(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovb\t$0, (%rax,%rdx)\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\trec\n\tmovb\t$0, used(%rip)\n.L16:\n\tmovl\t$1, -4(%rbp)\n\tjmp\t.L17\n.L20:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\tused(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\ttestb\t%al, %al\n\tjne\t.L21\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\tused(%rip), %rdx\n\tmovb\t$1, (%rax,%rdx)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\tidx(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, %ecx\n\tcltq\n\tleaq\tassign(%rip), %rdx\n\tmovb\t%cl, (%rax,%rdx)\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\trec\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\tused(%rip), %rdx\n\tmovb\t$0, (%rax,%rdx)\n\tjmp\t.L19\n.L21:\n\tnop\n.L19:\n\taddl\t$1, -4(%rbp)\n.L17:\n\tcmpl\t$9, -4(%rbp)\n\tjle\t.L20\n.L13:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\trec, .-rec\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L23\n.L33:\n\tmovl\t$0, sz(%rip)\n\tmovl\t$91, %edx\n\tmovl\t$-1, %esi\n\tleaq\ttr(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$10, %edx\n\tmovl\t$0, %esi\n\tleaq\tnot0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-18(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tatoi@PLT\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, m(%rip)\n\tmovl\t$0, max(%rip)\n\tmovl\t$0, -40(%rbp)\n\tjmp\t.L24\n.L30:\n\tmovq\tstdin(%rip), %rcx\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rcx, %rdx\n\tmovl\t$15, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -32(%rbp)\n\tjmp\t.L25\n.L27:\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\ttr(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\ttestb\t%al, %al\n\tjns\t.L26\n\tmovl\tsz(%rip), %edx\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%edx, %ecx\n\tcltq\n\tleaq\ttr(%rip), %rdx\n\tmovb\t%cl, (%rax,%rdx)\n\tmovl\tsz(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, sz(%rip)\n\tmovq\t-32(%rbp), %rdx\n\tmovzbl\t(%rdx), %edx\n\tcltq\n\tleaq\tidx(%rip), %rcx\n\tmovb\t%dl, (%rax,%rcx)\n.L26:\n\taddq\t$1, -32(%rbp)\n.L25:\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$32, %al\n\tjg\t.L27\n\tmovq\t-32(%rbp), %rax\n\tmovb\t$-1, (%rax)\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tleaq\tstr(%rip), %rdx\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsubq\t%rdx, %rax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L28\n\tmovl\t-40(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rax, %rdx\n\tleaq\tstr(%rip), %rax\n\tmovzbl\t(%rdx,%rax), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\ttr(%rip), %rdx\n\tmovzbl\t(%rax,%rdx), %eax\n\tmovsbl\t%al, %eax\n\tcltq\n\tleaq\tnot0(%rip), %rdx\n\tmovb\t$1, (%rax,%rdx)\n.L28:\n\tmovl\tm(%rip), %eax\n\tcmpl\t%eax, -40(%rbp)\n\tjge\t.L29\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\tmax(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L29\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, max(%rip)\n.L29:\n\taddl\t$1, -40(%rbp)\n.L24:\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjl\t.L30\n\tmovl\t$0, ans(%rip)\n\tmovl\tm(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\tmax(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjl\t.L31\n\tmovl\tm(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\tmax(%rip), %edx\n\taddl\t$2, %edx\n\tcmpl\t%edx, %eax\n\tjg\t.L31\n\tmovl\t$10, %edx\n\tmovl\t$0, %esi\n\tleaq\tused(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, %edi\n\tcall\trec\n.L31:\n\tmovl\tans(%rip), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L23:\n\tmovq\tstdin(%rip), %rdx\n\tleaq\t-18(%rbp), %rax\n\tmovl\t$10, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfgets@PLT\n\ttestq\t%rax, %rax\n\tje\t.L32\n\tmovzbl\t-18(%rbp), %eax\n\tcmpb\t$48, %al\n\tjne\t.L33\n.L32:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L35\n\tcall\t__stack_chk_fail@PLT\n.L35:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 idx[10], not0[10], used[10]; int ans; void calc() { int i, a, s; char *p; // 下一桁の合計で枝刈りしてみる s = 0; for (i = 0; i < m; i++) s += assign[str[i][len[i]]]; a = assign[str[m][len[m]]]; if (s % 10 != a) return; s = 0; for (i = 0; i < m; i++) { a = 0, p = str[i]; while (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++]; s += a; } a = 0, p = str[m]; while (*p >= 0) a = (a<<3) + (a<<1) + assign[*p++]; if (a == s) ans++; } void rec(int k) { int i; if (k == sz) { calc(); return; } if (!used[0]) { if (!not0[k]) used[0] = 1, assign[idx[k]] = 0, rec(k+1), used[0] = 0; } for (i = 1; i < 10; i++) { if (used[i]) continue; used[i] = 1, assign[idx[k]] = i, rec(k+1), used[i] = 0; } } int main() { int n, i; char buf[10], *p; while (fgets(buf, 10, stdin) && *buf != '0') { sz = 0, memset(tr, -1, sizeof(tr)); memset(not0, 0, sizeof(not0)); n = atoi(buf), m = n - 1, max = 0; for (i = 0; i < n; i++) { fgets(str[i], 15, stdin); for (p = str[i]; *p > ' '; p++) { if (tr[*p] < 0) tr[*p] = sz, idx[sz++] = *p; } *p = -1; len[i] = p-str[i]-1; if (len[i] > 0) not0[tr[*str[i]]] = 1; if (i < m && len[i] > max) max = len[i]; } ans = 0; if (len[m] >= max && len[m] <= max+2) { memset(used, 0, sizeof(used)); rec(0); } printf("%d\n", ans); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl m .bss .align 4 .type m, @object .size m, 4 m: .zero 4 .globl sz .align 4 .type sz, @object .size sz, 4 sz: .zero 4 .globl str .align 32 .type str, @object .size str, 143 str: .zero 143 .globl len .align 32 .type len, @object .size len, 52 len: .zero 52 .globl max .align 4 .type max, @object .size max, 4 max: .zero 4 .globl tr .align 32 .type tr, @object .size tr, 91 tr: .zero 91 .globl assign .align 32 .type assign, @object .size assign, 91 assign: .zero 91 .globl idx .align 8 .type idx, @object .size idx, 10 idx: .zero 10 .globl not0 .align 8 .type not0, @object .size not0, 10 not0: .zero 10 .globl used .align 8 .type used, @object .size used, 10 used: .zero 10 .globl ans .align 4 .type ans, @object .size ans, 4 ans: .zero 4 .text .globl calc .type calc, @function calc: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $0, -12(%rbp) movl $0, -20(%rbp) jmp .L2 .L3: movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax movslq %eax, %rcx movl -20(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq (%rax,%rcx), %rdx leaq str(%rip), %rax addq %rdx, %rax movzbl (%rax), %eax movsbl %al, %eax cltq leaq assign(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax addl %eax, -12(%rbp) addl $1, -20(%rbp) .L2: movl m(%rip), %eax cmpl %eax, -20(%rbp) jl .L3 movl m(%rip), %eax movl m(%rip), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq len(%rip), %rdx movl (%rcx,%rdx), %edx movslq %edx, %rcx movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq (%rax,%rcx), %rdx leaq str(%rip), %rax addq %rdx, %rax movzbl (%rax), %eax movsbl %al, %eax cltq leaq assign(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax movl %eax, -16(%rbp) movl -12(%rbp), %ecx movslq %ecx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %ecx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax subl %eax, %ecx movl %ecx, %edx cmpl %edx, -16(%rbp) jne .L12 movl $0, -12(%rbp) movl $0, -20(%rbp) jmp .L6 .L9: movl $0, -16(%rbp) movl -20(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq str(%rip), %rdx addq %rdx, %rax movq %rax, -8(%rbp) jmp .L7 .L8: movl -16(%rbp), %eax leal 0(,%rax,8), %edx movl -16(%rbp), %eax addl %eax, %eax leal (%rdx,%rax), %ecx movq -8(%rbp), %rax leaq 1(%rax), %rdx movq %rdx, -8(%rbp) movzbl (%rax), %eax movsbl %al, %eax cltq leaq assign(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax addl %ecx, %eax movl %eax, -16(%rbp) .L7: movq -8(%rbp), %rax movzbl (%rax), %eax testb %al, %al jns .L8 movl -16(%rbp), %eax addl %eax, -12(%rbp) addl $1, -20(%rbp) .L6: movl m(%rip), %eax cmpl %eax, -20(%rbp) jl .L9 movl $0, -16(%rbp) movl m(%rip), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq str(%rip), %rdx addq %rdx, %rax movq %rax, -8(%rbp) jmp .L10 .L11: movl -16(%rbp), %eax leal 0(,%rax,8), %edx movl -16(%rbp), %eax addl %eax, %eax leal (%rdx,%rax), %ecx movq -8(%rbp), %rax leaq 1(%rax), %rdx movq %rdx, -8(%rbp) movzbl (%rax), %eax movsbl %al, %eax cltq leaq assign(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax addl %ecx, %eax movl %eax, -16(%rbp) .L10: movq -8(%rbp), %rax movzbl (%rax), %eax testb %al, %al jns .L11 movl -16(%rbp), %eax cmpl -12(%rbp), %eax jne .L1 movl ans(%rip), %eax addl $1, %eax movl %eax, ans(%rip) jmp .L1 .L12: nop .L1: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size calc, .-calc .globl rec .type rec, @function rec: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl sz(%rip), %eax cmpl %eax, -20(%rbp) jne .L14 movl $0, %eax call calc jmp .L13 .L14: movzbl used(%rip), %eax testb %al, %al jne .L16 movl -20(%rbp), %eax cltq leaq not0(%rip), %rdx movzbl (%rax,%rdx), %eax testb %al, %al jne .L16 movb $1, used(%rip) movl -20(%rbp), %eax cltq leaq idx(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax cltq leaq assign(%rip), %rdx movb $0, (%rax,%rdx) movl -20(%rbp), %eax addl $1, %eax movl %eax, %edi call rec movb $0, used(%rip) .L16: movl $1, -4(%rbp) jmp .L17 .L20: movl -4(%rbp), %eax cltq leaq used(%rip), %rdx movzbl (%rax,%rdx), %eax testb %al, %al jne .L21 movl -4(%rbp), %eax cltq leaq used(%rip), %rdx movb $1, (%rax,%rdx) movl -20(%rbp), %eax cltq leaq idx(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax movl -4(%rbp), %edx movl %edx, %ecx cltq leaq assign(%rip), %rdx movb %cl, (%rax,%rdx) movl -20(%rbp), %eax addl $1, %eax movl %eax, %edi call rec movl -4(%rbp), %eax cltq leaq used(%rip), %rdx movb $0, (%rax,%rdx) jmp .L19 .L21: nop .L19: addl $1, -4(%rbp) .L17: cmpl $9, -4(%rbp) jle .L20 .L13: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size rec, .-rec .section .rodata .LC0: .string "%d\n" .text .globl main .type main, @function main: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax jmp .L23 .L33: movl $0, sz(%rip) movl $91, %edx movl $-1, %esi leaq tr(%rip), %rax movq %rax, %rdi call memset@PLT movl $10, %edx movl $0, %esi leaq not0(%rip), %rax movq %rax, %rdi call memset@PLT leaq -18(%rbp), %rax movq %rax, %rdi call atoi@PLT movl %eax, -36(%rbp) movl -36(%rbp), %eax subl $1, %eax movl %eax, m(%rip) movl $0, max(%rip) movl $0, -40(%rbp) jmp .L24 .L30: movq stdin(%rip), %rcx movl -40(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq str(%rip), %rdx addq %rdx, %rax movq %rcx, %rdx movl $15, %esi movq %rax, %rdi call fgets@PLT movl -40(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq str(%rip), %rdx addq %rdx, %rax movq %rax, -32(%rbp) jmp .L25 .L27: movq -32(%rbp), %rax movzbl (%rax), %eax movsbl %al, %eax cltq leaq tr(%rip), %rdx movzbl (%rax,%rdx), %eax testb %al, %al jns .L26 movl sz(%rip), %edx movq -32(%rbp), %rax movzbl (%rax), %eax movsbl %al, %eax movl %edx, %ecx cltq leaq tr(%rip), %rdx movb %cl, (%rax,%rdx) movl sz(%rip), %eax leal 1(%rax), %edx movl %edx, sz(%rip) movq -32(%rbp), %rdx movzbl (%rdx), %edx cltq leaq idx(%rip), %rcx movb %dl, (%rax,%rcx) .L26: addq $1, -32(%rbp) .L25: movq -32(%rbp), %rax movzbl (%rax), %eax cmpb $32, %al jg .L27 movq -32(%rbp), %rax movb $-1, (%rax) movl -40(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rdx, %rax leaq str(%rip), %rdx addq %rax, %rdx movq -32(%rbp), %rax subq %rdx, %rax subl $1, %eax movl %eax, %ecx movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl %ecx, (%rdx,%rax) movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax testl %eax, %eax jle .L28 movl -40(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax addq %rax, %rdx leaq str(%rip), %rax movzbl (%rdx,%rax), %eax movsbl %al, %eax cltq leaq tr(%rip), %rdx movzbl (%rax,%rdx), %eax movsbl %al, %eax cltq leaq not0(%rip), %rdx movb $1, (%rax,%rdx) .L28: movl m(%rip), %eax cmpl %eax, -40(%rbp) jge .L29 movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %edx movl max(%rip), %eax cmpl %eax, %edx jle .L29 movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax movl %eax, max(%rip) .L29: addl $1, -40(%rbp) .L24: movl -40(%rbp), %eax cmpl -36(%rbp), %eax jl .L30 movl $0, ans(%rip) movl m(%rip), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %edx movl max(%rip), %eax cmpl %eax, %edx jl .L31 movl m(%rip), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax movl max(%rip), %edx addl $2, %edx cmpl %edx, %eax jg .L31 movl $10, %edx movl $0, %esi leaq used(%rip), %rax movq %rax, %rdi call memset@PLT movl $0, %edi call rec .L31: movl ans(%rip), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L23: movq stdin(%rip), %rdx leaq -18(%rbp), %rax movl $10, %esi movq %rax, %rdi call fgets@PLT testq %rax, %rax je .L32 movzbl -18(%rbp), %eax cmpb $48, %al jne .L33 .L32: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L35 call __stack_chk_fail@PLT .L35: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<limits.h>\n\nstruct node {\n int id;\n int weight;\n struct node *next;\n};\nstruct node **list;\nint *dist;\n\nvoid Insert(int, int, int);\nint Bellman(int, int);\n\nint main(void)\n{\n int i, v, e, r, s, t, d;\n scanf(\"%d %d %d\", &v, &e, &r);\n dist = (int*)malloc(sizeof(int) * v);\n list = (struct node**)malloc(sizeof(struct node*) * v);\n for (i = 0; i < v; i++) list[i] = NULL;\n for (i = 0; i < e; i++) {\n scanf(\"%d %d %d\", &s, &t, &d);\n Insert(s,t,d);\n }\n if (Bellman(r, v) == 1) {\n for (i = 0; i < v; i++) {\n if (dist[i] == INT_MAX) printf(\"INF\\n\");\n else printf(\"%d\\n\", dist[i]);\n free(list[i]);\n }\n } else {\n printf(\"NEGATIVE CYCLE\\n\");\n for (i = 0; i < v; i++) {\n free(list[i]);\n }\n }\n free(dist);\n free(list);\n return 0;\n}\n\nvoid Insert(int a, int b, int weight)\n{\n struct node *p = (struct node*)malloc(sizeof(struct node));\n p->id = b;\n p->weight = weight;\n p->next = list[a];\n list[a] = p;\n}\n\nint Bellman(int p, int size)\n{\n int i, j, update;\n struct node *n;\n for (i = 0; i < size; i++) dist[i] = INT_MAX;\n dist[p] = 0;\n for (i = 0; i < size; i++) {\n update = 0;\n for (j = 0; j < size; j++){\n if (dist[j] == INT_MAX) continue;\n for (n = list[j]; n != NULL; n = n->next) {\n int w = n->weight;\n if (w + dist[j] < dist[n->id]) {\n dist[n->id] = w + dist[j];\n update = 1;\n }\n }\n }\n if (!update) break;\n }\n if (update) return 0;\n else return 1;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tlist\n\t.bss\n\t.align 8\n\t.type\tlist, @object\n\t.size\tlist, 8\nlist:\n\t.zero\t8\n\t.globl\tdist\n\t.align 8\n\t.type\tdist, @object\n\t.size\tdist, 8\ndist:\n\t.zero\t8\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d %d\"\n.LC1:\n\t.string\t\"INF\"\n.LC2:\n\t.string\t\"%d\\n\"\n.LC3:\n\t.string\t\"NEGATIVE CYCLE\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-28(%rbp), %rcx\n\tleaq\t-32(%rbp), %rdx\n\tleaq\t-36(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, dist(%rip)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, list(%rip)\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t$0, (%rax)\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L3\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-16(%rbp), %rcx\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-20(%rbp), %ecx\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tInsert\n\taddl\t$1, -12(%rbp)\n.L4:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L5\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tBellman\n\tcmpl\t$1, %eax\n\tjne\t.L6\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L7\n.L10:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t$2147483647, %eax\n\tjne\t.L8\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L9\n.L8:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L9:\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\taddl\t$1, -12(%rbp)\n.L7:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L10\n\tjmp\t.L11\n.L6:\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\taddl\t$1, -12(%rbp)\n.L12:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L13\n.L11:\n\tmovq\tdist(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\tlist(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L15\n\tcall\t__stack_chk_fail@PLT\n.L15:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.globl\tInsert\n\t.type\tInsert, @function\nInsert:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovl\t$16, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-24(%rbp), %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-28(%rbp), %edx\n\tmovl\t%edx, 4(%rax)\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tInsert, .-Insert\n\t.globl\tBellman\n\t.type\tBellman, @function\nBellman:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovl\t%esi, -40(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L18\n.L19:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$2147483647, (%rax)\n\taddl\t$1, -24(%rbp)\n.L18:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjl\t.L19\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$0, (%rax)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L20\n.L30:\n\tmovl\t$0, -16(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L21\n.L27:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t$2147483647, %eax\n\tje\t.L33\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L24\n.L26:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovq\tdist(%rip), %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L25\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\tdist(%rip), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\taddl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\tmovl\t$1, -16(%rbp)\n.L25:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n.L24:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L26\n\tjmp\t.L23\n.L33:\n\tnop\n.L23:\n\taddl\t$1, -20(%rbp)\n.L21:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjl\t.L27\n\tcmpl\t$0, -16(%rbp)\n\tje\t.L34\n\taddl\t$1, -24(%rbp)\n.L20:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjl\t.L30\n\tjmp\t.L29\n.L34:\n\tnop\n.L29:\n\tcmpl\t$0, -16(%rbp)\n\tje\t.L31\n\tmovl\t$0, %eax\n\tjmp\t.L32\n.L31:\n\tmovl\t$1, %eax\n.L32:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tBellman, .-Bellman\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovslq\t%edi, %rbx\n\tmovl\t$16, %edi\n\tcall\tmalloc@PLT\n\tmovq\tlist(%rip), %rdx\n\tmovd\t%ebp, %xmm0\n\tmovd\t%r12d, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tleaq\t(%rdx,%rbx,8), %rdx\n\tmovq\t%xmm0, (%rax)\n\tmovq\t(%rdx), %rcx\n\tmovq\t%rcx, 8(%rax)\n\tmovq\t%rax, (%rdx)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tInsert, .-Insert\n\t.p2align 4\n\t.globl\tBellman\n\t.type\tBellman, @function\nBellman:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\t%edi, %r8\n\tmovq\tdist(%rip), %rdi\n\tleaq\t(%rdi,%r8,4), %rcx\n\ttestl\t%esi, %esi\n\tjle\t.L5\n\tleal\t-1(%rsi), %eax\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovl\t%esi, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tcmpl\t$2, %eax\n\tjbe\t.L16\n\tmovl\t%esi, %edx\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovq\t%rdi, %rax\n\tshrl\t$2, %edx\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t16(%rdi,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovups\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L7\n\tmovl\t%ebp, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %bpl\n\tje\t.L8\n.L6:\n\tmovslq\t%eax, %rsi\n\tmovl\t$2147483647, (%rdi,%rsi,4)\n\tleaq\t0(,%rsi,4), %rdx\n\tleal\t1(%rax), %esi\n\tcmpl\t%esi, %ebp\n\tjle\t.L8\n\taddl\t$2, %eax\n\tmovl\t$2147483647, 4(%rdi,%rdx)\n\tcmpl\t%ebp, %eax\n\tjge\t.L8\n\tmovl\t$2147483647, 8(%rdi,%rdx)\n.L8:\n\tmovl\t$0, (%rcx)\n\tmovq\tlist(%rip), %r11\n\txorl\t%ebx, %ebx\n\tmovl\t%ebp, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\txorl\t%r8d, %r8d\n\txorl\t%r9d, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t(%rdi,%r8,4), %esi\n\tcmpl\t$2147483647, %esi\n\tje\t.L9\n\tmovq\t(%r11,%r8,8), %rax\n\ttestq\t%rax, %rax\n\tje\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t(%rax), %rdx\n\tmovl\t4(%rax), %ecx\n\tleaq\t(%rdi,%rdx,4), %rdx\n\taddl\t%esi, %ecx\n\tcmpl\t(%rdx), %ecx\n\tjge\t.L10\n.L35:\n\tmovq\t8(%rax), %rax\n\tmovl\t%ecx, (%rdx)\n\tmovl\t$1, %r9d\n\ttestq\t%rax, %rax\n\tje\t.L9\n\tmovslq\t(%rax), %rdx\n\tmovl\t(%rdi,%r8,4), %esi\n\tmovl\t4(%rax), %ecx\n\tleaq\t(%rdi,%rdx,4), %rdx\n\taddl\t%esi, %ecx\n\tcmpl\t(%rdx), %ecx\n\tjl\t.L35\n.L10:\n\tmovq\t8(%rax), %rax\n\ttestq\t%rax, %rax\n\tjne\t.L12\n.L9:\n\taddq\t$1, %r8\n\tcmpq\t%r8, %r10\n\tjne\t.L13\n\ttestl\t%r9d, %r9d\n\tje\t.L18\n\taddl\t$1, %ebx\n\tcmpl\t%ebx, %ebp\n\tjne\t.L15\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tmovl\t$1, %eax\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L6\n.L5:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\t.cfi_restore 6\n\tmovl\t$0, (%rcx)\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tBellman, .-Bellman\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d %d %d\"\n.LC2:\n\t.string\t\"INF\"\n.LC3:\n\t.string\t\"%d\\n\"\n.LC4:\n\t.string\t\"NEGATIVE CYCLE\"\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.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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\t.LC1(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rbp, %rdi\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t24(%rsp), %rcx\n\tleaq\t20(%rsp), %rdx\n\tleaq\t16(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t16(%rsp), %r12\n\tleaq\t0(,%r12,4), %rdi\n\tmovq\t%r12, %r13\n\tsalq\t$3, %r12\n\tcall\tmalloc@PLT\n\tmovq\t%r12, %rdi\n\tmovq\t%rax, dist(%rip)\n\tcall\tmalloc@PLT\n\tmovq\t%rax, list(%rip)\n\ttestl\t%r13d, %r13d\n\tjle\t.L37\n\tmovq\t%rax, %rdi\n\tmovq\t%r12, %rdx\n\txorl\t%esi, %esi\n\tcall\tmemset@PLT\n.L37:\n\tmovl\t20(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L38\n\txorl\t%r15d, %r15d\n\tleaq\t36(%rsp), %r14\n\tleaq\t32(%rsp), %r13\n\tleaq\t28(%rsp), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovq\t%r14, %rcx\n\tmovq\t%r13, %rdx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r15d\n\tcall\t__isoc99_scanf@PLT\n\tmovd\t32(%rsp), %xmm0\n\tmovd\t36(%rsp), %xmm1\n\tmovl\t$16, %edi\n\tmovslq\t28(%rsp), %rbx\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, 8(%rsp)\n\tcall\tmalloc@PLT\n\tmovq\tlist(%rip), %rdx\n\tmovq\t8(%rsp), %xmm0\n\tleaq\t(%rdx,%rbx,8), %rdx\n\tmovq\t%xmm0, (%rax)\n\tmovq\t(%rdx), %rcx\n\tmovq\t%rcx, 8(%rax)\n\tmovq\t%rax, (%rdx)\n\tcmpl\t%r15d, 20(%rsp)\n\tjg\t.L39\n.L38:\n\tmovl\t16(%rsp), %esi\n\tmovl\t24(%rsp), %edi\n\tcall\tBellman\n\tcmpl\t$1, %eax\n\tjne\t.L40\n\tcmpl\t$0, 16(%rsp)\n\tjle\t.L41\n\txorl\t%ebx, %ebx\n\tleaq\t.LC3(%rip), %rbp\n\tleaq\t.LC2(%rip), %r12\n\tjmp\t.L44\n\t.p2align 4,,10\n\t.p2align 3\n.L42:\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L50:\n\tmovq\tlist(%rip), %rax\n\tmovq\t(%rax,%rbx,8), %rdi\n\taddq\t$1, %rbx\n\tcall\tfree@PLT\n\tcmpl\t%ebx, 16(%rsp)\n\tjle\t.L41\n.L44:\n\tmovq\tdist(%rip), %rax\n\tmovl\t(%rax,%rbx,4), %edx\n\tcmpl\t$2147483647, %edx\n\tjne\t.L42\n\tmovq\t%r12, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L50\n.L40:\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tcmpl\t$0, 16(%rsp)\n\tjle\t.L41\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L45:\n\tmovq\tlist(%rip), %rax\n\tmovq\t(%rax,%rbx,8), %rdi\n\taddq\t$1, %rbx\n\tcall\tfree@PLT\n\tcmpl\t%ebx, 16(%rsp)\n\tjg\t.L45\n.L41:\n\tmovq\tdist(%rip), %rdi\n\tcall\tfree@PLT\n\tmovq\tlist(%rip), %rdi\n\tcall\tfree@PLT\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L51\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L51:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.globl\tdist\n\t.bss\n\t.align 8\n\t.type\tdist, @object\n\t.size\tdist, 8\ndist:\n\t.zero\t8\n\t.globl\tlist\n\t.align 8\n\t.type\tlist, @object\n\t.size\tlist, 8\nlist:\n\t.zero\t8\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t2147483647\n\t.long\t2147483647\n\t.long\t2147483647\n\t.long\t2147483647\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovslq\t%edi, %rbx\n\tmovl\t$16, %edi\n\tcall\tmalloc@PLT\n\tmovq\tlist(%rip), %rdx\n\tmovd\t%ebp, %xmm0\n\tmovd\t%r12d, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tleaq\t(%rdx,%rbx,8), %rdx\n\tmovq\t%xmm0, (%rax)\n\tmovq\t(%rdx), %rcx\n\tmovq\t%rcx, 8(%rax)\n\tmovq\t%rax, (%rdx)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tInsert, .-Insert\n\t.p2align 4\n\t.globl\tBellman\n\t.type\tBellman, @function\nBellman:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tmovslq\t%edi, %r8\n\tmovq\tdist(%rip), %rdi\n\tleaq\t(%rdi,%r8,4), %rcx\n\ttestl\t%esi, %esi\n\tjle\t.L5\n\tleal\t-1(%rsi), %eax\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovl\t%esi, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tcmpl\t$2, %eax\n\tjbe\t.L16\n\tmovl\t%esi, %edx\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovq\t%rdi, %rax\n\tshrl\t$2, %edx\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t16(%rdi,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovups\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L7\n\tmovl\t%ebp, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %bpl\n\tje\t.L8\n.L6:\n\tmovslq\t%eax, %rsi\n\tmovl\t$2147483647, (%rdi,%rsi,4)\n\tleaq\t0(,%rsi,4), %rdx\n\tleal\t1(%rax), %esi\n\tcmpl\t%esi, %ebp\n\tjle\t.L8\n\taddl\t$2, %eax\n\tmovl\t$2147483647, 4(%rdi,%rdx)\n\tcmpl\t%ebp, %eax\n\tjge\t.L8\n\tmovl\t$2147483647, 8(%rdi,%rdx)\n.L8:\n\tmovl\t$0, (%rcx)\n\tmovq\tlist(%rip), %r11\n\txorl\t%ebx, %ebx\n\tmovl\t%ebp, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\txorl\t%r8d, %r8d\n\txorl\t%r9d, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t(%rdi,%r8,4), %esi\n\tcmpl\t$2147483647, %esi\n\tje\t.L9\n\tmovq\t(%r11,%r8,8), %rax\n\ttestq\t%rax, %rax\n\tje\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t(%rax), %rdx\n\tmovl\t4(%rax), %ecx\n\tleaq\t(%rdi,%rdx,4), %rdx\n\taddl\t%esi, %ecx\n\tcmpl\t(%rdx), %ecx\n\tjge\t.L10\n.L35:\n\tmovq\t8(%rax), %rax\n\tmovl\t%ecx, (%rdx)\n\tmovl\t$1, %r9d\n\ttestq\t%rax, %rax\n\tje\t.L9\n\tmovslq\t(%rax), %rdx\n\tmovl\t(%rdi,%r8,4), %esi\n\tmovl\t4(%rax), %ecx\n\tleaq\t(%rdi,%rdx,4), %rdx\n\taddl\t%esi, %ecx\n\tcmpl\t(%rdx), %ecx\n\tjl\t.L35\n.L10:\n\tmovq\t8(%rax), %rax\n\ttestq\t%rax, %rax\n\tjne\t.L12\n.L9:\n\taddq\t$1, %r8\n\tcmpq\t%r8, %r10\n\tjne\t.L13\n\ttestl\t%r9d, %r9d\n\tje\t.L18\n\taddl\t$1, %ebx\n\tcmpl\t%ebx, %ebp\n\tjne\t.L15\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tmovl\t$1, %eax\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L6\n.L5:\n\t.cfi_def_cfa_offset 8\n\t.cfi_restore 3\n\t.cfi_restore 6\n\tmovl\t$0, (%rcx)\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tBellman, .-Bellman\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d %d %d\"\n.LC2:\n\t.string\t\"INF\"\n.LC3:\n\t.string\t\"%d\\n\"\n.LC4:\n\t.string\t\"NEGATIVE CYCLE\"\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.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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\t.LC1(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rbp, %rdi\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t24(%rsp), %rcx\n\tleaq\t20(%rsp), %rdx\n\tleaq\t16(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t16(%rsp), %r12\n\tleaq\t0(,%r12,4), %rdi\n\tmovq\t%r12, %r13\n\tsalq\t$3, %r12\n\tcall\tmalloc@PLT\n\tmovq\t%r12, %rdi\n\tmovq\t%rax, dist(%rip)\n\tcall\tmalloc@PLT\n\tmovq\t%rax, list(%rip)\n\ttestl\t%r13d, %r13d\n\tjle\t.L37\n\tmovq\t%rax, %rdi\n\tmovq\t%r12, %rdx\n\txorl\t%esi, %esi\n\tcall\tmemset@PLT\n.L37:\n\tmovl\t20(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L38\n\txorl\t%r15d, %r15d\n\tleaq\t36(%rsp), %r14\n\tleaq\t32(%rsp), %r13\n\tleaq\t28(%rsp), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovq\t%r14, %rcx\n\tmovq\t%r13, %rdx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r15d\n\tcall\t__isoc99_scanf@PLT\n\tmovd\t32(%rsp), %xmm0\n\tmovd\t36(%rsp), %xmm1\n\tmovl\t$16, %edi\n\tmovslq\t28(%rsp), %rbx\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, 8(%rsp)\n\tcall\tmalloc@PLT\n\tmovq\tlist(%rip), %rdx\n\tmovq\t8(%rsp), %xmm0\n\tleaq\t(%rdx,%rbx,8), %rdx\n\tmovq\t%xmm0, (%rax)\n\tmovq\t(%rdx), %rcx\n\tmovq\t%rcx, 8(%rax)\n\tmovq\t%rax, (%rdx)\n\tcmpl\t%r15d, 20(%rsp)\n\tjg\t.L39\n.L38:\n\tmovl\t16(%rsp), %esi\n\tmovl\t24(%rsp), %edi\n\tcall\tBellman\n\tcmpl\t$1, %eax\n\tjne\t.L40\n\tcmpl\t$0, 16(%rsp)\n\tjle\t.L41\n\txorl\t%ebx, %ebx\n\tleaq\t.LC3(%rip), %rbp\n\tleaq\t.LC2(%rip), %r12\n\tjmp\t.L44\n\t.p2align 4,,10\n\t.p2align 3\n.L42:\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L50:\n\tmovq\tlist(%rip), %rax\n\tmovq\t(%rax,%rbx,8), %rdi\n\taddq\t$1, %rbx\n\tcall\tfree@PLT\n\tcmpl\t%ebx, 16(%rsp)\n\tjle\t.L41\n.L44:\n\tmovq\tdist(%rip), %rax\n\tmovl\t(%rax,%rbx,4), %edx\n\tcmpl\t$2147483647, %edx\n\tjne\t.L42\n\tmovq\t%r12, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L50\n.L40:\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tcmpl\t$0, 16(%rsp)\n\tjle\t.L41\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L45:\n\tmovq\tlist(%rip), %rax\n\tmovq\t(%rax,%rbx,8), %rdi\n\taddq\t$1, %rbx\n\tcall\tfree@PLT\n\tcmpl\t%ebx, 16(%rsp)\n\tjg\t.L45\n.L41:\n\tmovq\tdist(%rip), %rdi\n\tcall\tfree@PLT\n\tmovq\tlist(%rip), %rdi\n\tcall\tfree@PLT\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L51\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L51:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.globl\tdist\n\t.bss\n\t.align 8\n\t.type\tdist, @object\n\t.size\tdist, 8\ndist:\n\t.zero\t8\n\t.globl\tlist\n\t.align 8\n\t.type\tlist, @object\n\t.size\tlist, 8\nlist:\n\t.zero\t8\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t2147483647\n\t.long\t2147483647\n\t.long\t2147483647\n\t.long\t2147483647\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 Insert(int, int, int);\nint Bellman(int, int);\n\nint main(void)\n{\n int i, v, e, r, s, t, d;\n scanf(\"%d %d %d\", &v, &e, &r);\n dist = (int*)malloc(sizeof(int) * v);\n list = (struct node**)malloc(sizeof(struct node*) * v);\n for (i = 0; i < v; i++) list[i] = NULL;\n for (i = 0; i < e; i++) {\n scanf(\"%d %d %d\", &s, &t, &d);\n Insert(s,t,d);\n }\n if (Bellman(r, v) == 1) {\n for (i = 0; i < v; i++) {\n if (dist[i] == INT_MAX) printf(\"INF\\n\");\n else printf(\"%d\\n\", dist[i]);\n free(list[i]);\n }\n } else {\n printf(\"NEGATIVE CYCLE\\n\");\n for (i = 0; i < v; i++) {\n free(list[i]);\n }\n }\n free(dist);\n free(list);\n return 0;\n}\n\nvoid Insert(int a, int b, int weight)\n{\n struct node *p = (struct node*)malloc(sizeof(struct node));\n p->id = b;\n p->weight = weight;\n p->next = list[a];\n list[a] = p;\n}\n\nint Bellman(int p, int size)\n{\n int i, j, update;\n struct node *n;\n for (i = 0; i < size; i++) dist[i] = INT_MAX;\n dist[p] = 0;\n for (i = 0; i < size; i++) {\n update = 0;\n for (j = 0; j < size; j++){\n if (dist[j] == INT_MAX) continue;\n for (n = list[j]; n != NULL; n = n->next) {\n int w = n->weight;\n if (w + dist[j] < dist[n->id]) {\n dist[n->id] = w + dist[j];\n update = 1;\n }\n }\n }\n if (!update) break;\n }\n if (update) return 0;\n else return 1;\n}\n", "index": 44, "inputs": [ "4 5 1\n0 1 2\n0 3 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 2 -5\n2 3 1\n2 3 2\n", "4 6 0\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n3 3 2\n3 1 0\n", "4 5 0\n0 1 2\n0 2 3\n1 0 -5\n2 3 1\n2 3 2\n", "4 5 2\n0 1 2\n0 3 3\n1 2 -5\n1 3 2\n2 3 2\n", "4 0 1\n0 0 2\n1 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 5 1\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n0 3 2\n", "4 5 0\n0 1 3\n0 2 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 0 0\n0 1 2\n0 2 3\n1 2 -5\n2 3 1\n2 3 2\n", "4 5 1\n0 1 2\n1 2 3\n2 0 -5\n2 3 1\n0 3 2\n", "4 6 0\n0 1 2\n0 2 3\n1 2 -3\n1 3 1\n2 3 2\n3 2 0\n", "4 5 0\n0 1 1\n0 3 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 5 0\n0 0 2\n0 2 3\n1 0 -5\n2 3 0\n2 3 2\n", "4 5 2\n0 1 2\n0 3 3\n0 2 -5\n1 3 2\n2 3 0\n", "8 5 1\n0 1 2\n1 2 3\n2 0 -5\n2 3 1\n0 3 2\n", "8 5 1\n0 0 2\n0 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 5 0\n0 1 0\n0 3 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 5 0\n0 0 2\n0 3 3\n1 0 -5\n2 3 0\n2 3 2\n", "8 5 1\n0 1 2\n1 2 3\n2 0 -5\n2 4 1\n0 3 2\n", "4 5 0\n0 0 2\n0 2 1\n1 0 -5\n2 3 0\n2 3 2\n", "8 5 0\n0 1 2\n1 2 3\n2 0 -5\n2 4 1\n0 3 2\n", "14 5 1\n0 0 2\n0 2 3\n2 0 -5\n2 3 1\n0 2 0\n", "8 5 0\n0 1 3\n1 2 3\n2 0 -5\n2 4 1\n0 3 2\n", "4 5 1\n0 0 2\n0 2 1\n1 0 -10\n2 3 0\n2 3 2\n", "4 5 2\n0 1 2\n0 3 3\n1 0 -2\n2 2 2\n2 3 1\n", "3 -1 1\n0 0 2\n1 4 6\n2 0 -5\n0 13 1\n0 2 2\n", "5 0 1\n-1 1 4\n0 0 0\n4 0 -4\n2 5 1\n-1 4 3\n", "4 -1 2\n0 0 1\n4 1 2\n1 0 -5\n1 3 2\n-1 4 2\n", "6 -1 2\n0 0 1\n4 1 2\n1 0 -8\n1 5 2\n-1 0 2\n", "5 1 0\n1 1 9\n1 -2 0\n0 0 0\n2 5 2\n-1 0 23\n", "2 0 1\n-2 1 0\n-1 2 10\n0 -1 -4\n0 3 1\n0 2 4\n", "6 -2 0\n-1 0 -1\n1 0 0\n3 0 -8\n1 1 2\n-2 0 2\n", "2 0 0\n1 1 9\n1 -2 0\n0 0 0\n2 5 2\n-1 0 23\n", "6 -4 1\n0 0 0\n1 0 0\n3 0 -8\n1 1 2\n-2 0 2\n", "11 -4 2\n1 -1 1\n-2 46 48\n0 0 -2\n-2 5 0\n0 2 0\n", "11 -2 1\n1 -1 2\n-2 5 48\n0 0 -2\n-2 5 1\n1 4 0\n", "17 0 1\n2 -1 3\n0 5 48\n1 1 -2\n-2 5 1\n1 4 0\n", "24 0 1\n2 -1 3\n0 5 48\n1 1 -2\n-2 5 1\n1 4 0\n", "33 0 1\n2 -2 3\n0 6 55\n1 0 0\n-2 0 1\n2 1 -1\n", "33 0 0\n2 -2 3\n0 10 55\n1 0 -1\n-2 0 1\n2 1 -1\n", "33 0 2\n2 -2 5\n0 16 128\n0 0 -2\n0 1 0\n2 1 -1\n", "4 5 0\n0 1 2\n0 2 3\n1 3 -5\n1 3 1\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 2 -5\n2 3 0\n2 3 2\n", "6 6 0\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n3 3 2\n3 1 0\n", "4 5 1\n0 1 2\n0 3 3\n1 2 -5\n1 3 2\n0 3 2\n", "8 5 2\n0 1 2\n0 3 3\n1 2 -5\n1 3 2\n2 3 2\n", "4 6 0\n0 1 2\n0 2 3\n1 2 -5\n1 3 2\n2 3 2\n3 2 0\n", "4 5 0\n0 2 0\n0 3 3\n1 2 -5\n1 3 1\n2 3 2\n", "6 5 0\n0 1 2\n0 2 3\n2 0 -3\n2 0 1\n0 3 2\n", "5 5 0\n0 0 2\n1 3 3\n2 0 -2\n2 3 1\n0 2 2\n", "5 6 0\n0 1 2\n0 2 6\n1 2 -3\n1 3 2\n2 3 2\n3 2 0\n", "4 5 1\n0 0 2\n0 2 1\n1 0 -5\n2 3 0\n2 3 2\n", "8 5 0\n0 1 2\n1 2 4\n2 0 -5\n2 4 1\n0 3 2\n", "4 5 0\n0 0 2\n0 3 1\n1 0 -10\n2 3 0\n2 3 2\n", "6 5 2\n0 0 2\n0 3 3\n1 0 -2\n2 2 2\n2 3 1\n", "8 5 0\n0 2 3\n2 4 3\n3 0 -5\n2 4 2\n0 6 2\n", "7 1 1\n0 1 4\n1 -1 0\n4 0 -1\n2 5 2\n-1 4 11\n", "3 -1 2\n0 0 0\n7 0 0\n2 0 -8\n2 1 2\n-2 0 2\n", "10 1 1\n1 1 5\n1 -2 0\n0 0 0\n2 5 2\n-1 0 23\n", "3 1 0\n1 1 9\n1 -2 0\n0 0 0\n2 5 2\n-1 0 23\n", "1 0 0\n2 1 9\n1 -2 0\n0 1 0\n4 5 1\n-1 0 4\n", "8 -1 0\n0 1 2\n-4 9 15\n-1 0 -1\n-3 0 -1\n1 25 1\n", "8 -2 2\n1 0 2\n-1 10 15\n-2 0 -1\n-3 0 -1\n1 25 1\n", "6 -4 3\n1 -1 1\n-2 46 48\n0 0 -2\n-2 5 0\n0 2 0\n", "11 -4 0\n1 -1 2\n-2 5 48\n0 0 -2\n-2 5 1\n1 4 0\n", "42 0 1\n2 -1 3\n0 5 55\n1 0 -2\n-2 0 1\n2 4 -1\n", "38 0 1\n2 -2 3\n0 6 55\n1 0 0\n-2 0 1\n2 1 -1\n", "28 0 0\n2 -2 3\n0 10 68\n0 0 -2\n0 1 1\n2 1 -1\n", "34 -1 2\n2 -2 5\n0 16 128\n0 0 -2\n0 1 0\n2 0 0\n", "8 5 0\n0 1 2\n0 2 3\n1 3 -5\n1 3 1\n2 3 2\n", "6 6 0\n0 1 2\n0 2 3\n1 2 -7\n1 3 1\n3 3 2\n3 1 0\n", "4 3 0\n0 2 2\n0 2 3\n1 0 -5\n2 0 1\n0 3 2\n", "4 5 0\n0 2 0\n0 3 3\n1 2 -5\n0 3 1\n2 3 2\n", "6 5 0\n0 1 2\n0 2 3\n2 0 -3\n2 0 1\n0 3 3\n", "8 5 0\n0 1 2\n1 2 4\n2 0 -5\n2 4 0\n0 3 2\n", "6 5 2\n0 0 2\n0 3 3\n2 0 -2\n2 2 2\n2 3 1\n", "8 5 0\n0 2 3\n2 4 3\n3 0 -5\n2 4 2\n0 7 2\n", "8 5 0\n0 3 3\n2 4 0\n3 0 -1\n2 4 2\n1 3 2\n", "4 5 1\n0 1 2\n0 3 3\n1 2 -5\n1 3 2\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 0 -5\n2 3 1\n0 3 2\n", "4 5 2\n0 1 2\n0 3 3\n1 2 -2\n1 3 2\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 0 -5\n2 3 1\n0 2 2\n", "4 5 2\n0 1 2\n0 3 3\n1 3 -2\n1 3 2\n2 3 2\n", "4 5 0\n0 1 2\n1 2 3\n1 0 -5\n2 3 1\n0 2 2\n", "4 5 0\n0 1 2\n1 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 5 1\n0 1 2\n1 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 5 1\n0 0 2\n1 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 0 1\n0 0 2\n1 4 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 0 1\n0 0 2\n1 4 3\n2 0 -5\n2 3 1\n0 2 3\n", "4 6 0\n0 1 2\n0 2 3\n1 2 -3\n1 3 1\n2 3 2\n3 1 0\n", "4 5 1\n0 1 1\n0 3 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 0 -5\n2 3 0\n2 3 2\n", "4 5 2\n0 1 2\n0 3 3\n0 2 -5\n1 3 2\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 0 -5\n2 0 1\n0 3 2\n", "4 5 2\n0 1 2\n0 3 3\n1 2 -3\n1 3 2\n2 3 2\n", "4 5 2\n0 1 2\n0 3 3\n1 3 -2\n2 3 2\n2 3 2\n", "4 5 0\n0 1 2\n1 3 3\n2 0 -5\n2 3 1\n0 2 2\n", "8 5 1\n0 0 2\n1 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 0 1\n0 0 1\n1 2 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 0 1\n0 0 2\n1 8 3\n2 0 -5\n2 3 1\n0 2 2\n", "4 5 1\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 5 0\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n2 3 2\n", "4 6 0\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n2 3 2\n3 1 0\n", "4 5 0\n0 1 2\n0 2 3\n1 2 -5\n1 3 1\n2 3 2\n" ], "outputs": [ "INF\n0\n-5\n-3\n", "0\n2\n-3\n-2\n", "0\n2\n-3\n3\n", "NEGATIVE CYCLE\n", "INF\nINF\n0\n2\n", "INF\n0\nINF\nINF\n", "INF\n0\n-5\n1\n", "0\n3\n-2\n0\n", "0\nINF\nINF\nINF\n", "-2\n0\n3\n0\n", "0\n2\n-1\n1\n", "0\n1\n-4\n-2\n", "0\nINF\n3\n3\n", "INF\nINF\n0\n0\n", "-2\n0\n3\n0\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\n0\n-5\n-3\n", "0\nINF\nINF\n3\n", "-2\n0\n3\n0\n4\nINF\nINF\nINF\n", "0\nINF\n1\n1\n", "0\n2\n5\n2\n6\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\n3\n6\n2\n7\nINF\nINF\nINF\n", "-10\n0\n-9\n-9\n", "INF\nINF\n0\n1\n", "INF\n0\nINF\n", "INF\n0\nINF\nINF\nINF\n", "INF\nINF\n0\nINF\n", "INF\nINF\n0\nINF\nINF\nINF\n", "0\nINF\nINF\nINF\nINF\n", "INF\n0\n", "0\nINF\nINF\nINF\nINF\nINF\n", "0\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\n", "INF\nINF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\nINF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\n2\n3\n-3\n", "0\n2\n-3\n-3\n", "0\n2\n-3\n3\nINF\nINF\n", "INF\n0\n-5\n2\n", "INF\nINF\n0\n2\nINF\nINF\nINF\nINF\n", "0\n2\n-3\n-1\n", "0\nINF\n0\n2\n", "0\n2\n3\n2\nINF\nINF\n", "0\nINF\n2\n3\nINF\n", "0\n2\n-1\n1\nINF\n", "-5\n0\n-4\n-4\n", "0\n2\n6\n2\n7\nINF\nINF\nINF\n", "0\nINF\nINF\n1\n", "INF\nINF\n0\n1\nINF\nINF\n", "0\nINF\n3\nINF\n5\nINF\n2\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\n", "INF\nINF\n0\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\nINF\nINF\n", "0\n", "0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\nINF\n0\nINF\nINF\nINF\nINF\nINF\n", "INF\nINF\nINF\n0\nINF\nINF\n", "0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "INF\nINF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n", "0\n2\n3\n-3\nINF\nINF\nINF\nINF\n", "0\n2\n-5\n3\nINF\nINF\n", "0\nINF\n2\nINF\n", "0\nINF\n0\n1\n", "0\n2\n3\n3\nINF\nINF\n", "0\n2\n6\n2\n6\nINF\nINF\nINF\n", "-2\nINF\n0\n1\nINF\nINF\n", "0\nINF\n3\nINF\n5\nINF\nINF\n2\n", "0\nINF\nINF\n3\nINF\nINF\nINF\nINF\n", "INF\n0\n-5\n-3\n", "NEGATIVE CYCLE\n", "INF\nINF\n0\n2\n", "NEGATIVE CYCLE\n", "INF\nINF\n0\n2\n", "NEGATIVE CYCLE\n", "NEGATIVE CYCLE\n", "NEGATIVE CYCLE\n", "NEGATIVE CYCLE\n", "INF\n0\nINF\nINF\n", "INF\n0\nINF\nINF\n", "NEGATIVE CYCLE\n", "INF\n0\n-5\n-3\n", "NEGATIVE CYCLE\n", "INF\nINF\n0\n2\n", "NEGATIVE CYCLE\n", "INF\nINF\n0\n2\n", "INF\nINF\n0\n2\n", "NEGATIVE CYCLE\n", "NEGATIVE CYCLE\n", "INF\n0\nINF\nINF\n", "INF\n0\nINF\nINF\n", "INF\n0\n-5\n-3\n", "0\n2\n-3\n-1\n", "NEGATIVE CYCLE\n", "0\n2\n-3\n-1\n" ], "question": "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 Insert(int, int, int);\nint Bellman(int, int);\n\nint main(void)\n{\n int i, v, e, r, s, t, d;\n scanf(\"%d %d %d\", &v, &e, &r);\n dist = (int*)malloc(sizeof(int) * v);\n list = (struct node**)malloc(sizeof(struct node*) * v);\n for (i = 0; i < v; i++) list[i] = NULL;\n for (i = 0; i < e; i++) {\n scanf(\"%d %d %d\", &s, &t, &d);\n Insert(s,t,d);\n }\n if (Bellman(r, v) == 1) {\n for (i = 0; i < v; i++) {\n if (dist[i] == INT_MAX) printf(\"INF\\n\");\n else printf(\"%d\\n\", dist[i]);\n free(list[i]);\n }\n } else {\n printf(\"NEGATIVE CYCLE\\n\");\n for (i = 0; i < v; i++) {\n free(list[i]);\n }\n }\n free(dist);\n free(list);\n return 0;\n}\n\nvoid Insert(int a, int b, int weight)\n{\n struct node *p = (struct node*)malloc(sizeof(struct node));\n p->id = b;\n p->weight = weight;\n p->next = list[a];\n list[a] = p;\n}\n\nint Bellman(int p, int size)\n{\n int i, j, update;\n struct node *n;\n for (i = 0; i < size; i++) dist[i] = INT_MAX;\n dist[p] = 0;\n for (i = 0; i < size; i++) {\n update = 0;\n for (j = 0; j < size; j++){\n if (dist[j] == INT_MAX) continue;\n for (n = list[j]; n != NULL; n = n->next) {\n int w = n->weight;\n if (w + dist[j] < dist[n->id]) {\n dist[n->id] = w + dist[j];\n update = 1;\n }\n }\n }\n if (!update) break;\n }\n if (update) return 0;\n else return 1;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tlist\n\t.bss\n\t.align 8\n\t.type\tlist, @object\n\t.size\tlist, 8\nlist:\n\t.zero\t8\n\t.globl\tdist\n\t.align 8\n\t.type\tdist, @object\n\t.size\tdist, 8\ndist:\n\t.zero\t8\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d %d\"\n.LC1:\n\t.string\t\"INF\"\n.LC2:\n\t.string\t\"%d\\n\"\n.LC3:\n\t.string\t\"NEGATIVE CYCLE\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-28(%rbp), %rcx\n\tleaq\t-32(%rbp), %rdx\n\tleaq\t-36(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, dist(%rip)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, list(%rip)\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t$0, (%rax)\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L3\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-16(%rbp), %rcx\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-20(%rbp), %ecx\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tInsert\n\taddl\t$1, -12(%rbp)\n.L4:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L5\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tBellman\n\tcmpl\t$1, %eax\n\tjne\t.L6\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L7\n.L10:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t$2147483647, %eax\n\tjne\t.L8\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L9\n.L8:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L9:\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\taddl\t$1, -12(%rbp)\n.L7:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L10\n\tjmp\t.L11\n.L6:\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\taddl\t$1, -12(%rbp)\n.L12:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L13\n.L11:\n\tmovq\tdist(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\tlist(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L15\n\tcall\t__stack_chk_fail@PLT\n.L15:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.globl\tInsert\n\t.type\tInsert, @function\nInsert:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovl\t$16, %edi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-24(%rbp), %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-28(%rbp), %edx\n\tmovl\t%edx, 4(%rax)\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tInsert, .-Insert\n\t.globl\tBellman\n\t.type\tBellman, @function\nBellman:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovl\t%esi, -40(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L18\n.L19:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$2147483647, (%rax)\n\taddl\t$1, -24(%rbp)\n.L18:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjl\t.L19\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$0, (%rax)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L20\n.L30:\n\tmovl\t$0, -16(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L21\n.L27:\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t$2147483647, %eax\n\tje\t.L33\n\tmovq\tlist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L24\n.L26:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovq\tdist(%rip), %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L25\n\tmovq\tdist(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %ecx\n\tmovq\tdist(%rip), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\taddl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\tmovl\t$1, -16(%rbp)\n.L25:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n.L24:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L26\n\tjmp\t.L23\n.L33:\n\tnop\n.L23:\n\taddl\t$1, -20(%rbp)\n.L21:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjl\t.L27\n\tcmpl\t$0, -16(%rbp)\n\tje\t.L34\n\taddl\t$1, -24(%rbp)\n.L20:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjl\t.L30\n\tjmp\t.L29\n.L34:\n\tnop\n.L29:\n\tcmpl\t$0, -16(%rbp)\n\tje\t.L31\n\tmovl\t$0, %eax\n\tjmp\t.L32\n.L31:\n\tmovl\t$1, %eax\n.L32:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tBellman, .-Bellman\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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, int); int main(void) { int i, v, e, r, s, t, d; scanf("%d %d %d", &v, &e, &r); dist = (int*)malloc(sizeof(int) * v); list = (struct node**)malloc(sizeof(struct node*) * v); for (i = 0; i < v; i++) list[i] = NULL; for (i = 0; i < e; i++) { scanf("%d %d %d", &s, &t, &d); Insert(s,t,d); } if (Bellman(r, v) == 1) { for (i = 0; i < v; i++) { if (dist[i] == INT_MAX) printf("INF\n"); else printf("%d\n", dist[i]); free(list[i]); } } else { printf("NEGATIVE CYCLE\n"); for (i = 0; i < v; i++) { free(list[i]); } } free(dist); free(list); return 0; } void Insert(int a, int b, int weight) { struct node *p = (struct node*)malloc(sizeof(struct node)); p->id = b; p->weight = weight; p->next = list[a]; list[a] = p; } int Bellman(int p, int size) { int i, j, update; struct node *n; for (i = 0; i < size; i++) dist[i] = INT_MAX; dist[p] = 0; for (i = 0; i < size; i++) { update = 0; for (j = 0; j < size; j++){ if (dist[j] == INT_MAX) continue; for (n = list[j]; n != NULL; n = n->next) { int w = n->weight; if (w + dist[j] < dist[n->id]) { dist[n->id] = w + dist[j]; update = 1; } } } if (!update) break; } if (update) return 0; else return 1; } Unoptimized Assembly Code: .file "temp.c" .text .globl list .bss .align 8 .type list, @object .size list, 8 list: .zero 8 .globl dist .align 8 .type dist, @object .size dist, 8 dist: .zero 8 .section .rodata .LC0: .string "%d %d %d" .LC1: .string "INF" .LC2: .string "%d\n" .LC3: .string "NEGATIVE CYCLE" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -28(%rbp), %rcx leaq -32(%rbp), %rdx leaq -36(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -36(%rbp), %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, dist(%rip) movl -36(%rbp), %eax cltq salq $3, %rax movq %rax, %rdi call malloc@PLT movq %rax, list(%rip) movl $0, -12(%rbp) jmp .L2 .L3: movq list(%rip), %rdx movl -12(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq $0, (%rax) addl $1, -12(%rbp) .L2: movl -36(%rbp), %eax cmpl %eax, -12(%rbp) jl .L3 movl $0, -12(%rbp) jmp .L4 .L5: leaq -16(%rbp), %rcx leaq -20(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -16(%rbp), %edx movl -20(%rbp), %ecx movl -24(%rbp), %eax movl %ecx, %esi movl %eax, %edi call Insert addl $1, -12(%rbp) .L4: movl -32(%rbp), %eax cmpl %eax, -12(%rbp) jl .L5 movl -36(%rbp), %edx movl -28(%rbp), %eax movl %edx, %esi movl %eax, %edi call Bellman cmpl $1, %eax jne .L6 movl $0, -12(%rbp) jmp .L7 .L10: movq dist(%rip), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax cmpl $2147483647, %eax jne .L8 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L9 .L8: movq dist(%rip), %rdx movl -12(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L9: movq list(%rip), %rdx movl -12(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq (%rax), %rax movq %rax, %rdi call free@PLT addl $1, -12(%rbp) .L7: movl -36(%rbp), %eax cmpl %eax, -12(%rbp) jl .L10 jmp .L11 .L6: leaq .LC3(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, -12(%rbp) jmp .L12 .L13: movq list(%rip), %rdx movl -12(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq (%rax), %rax movq %rax, %rdi call free@PLT addl $1, -12(%rbp) .L12: movl -36(%rbp), %eax cmpl %eax, -12(%rbp) jl .L13 .L11: movq dist(%rip), %rax movq %rax, %rdi call free@PLT movq list(%rip), %rax movq %rax, %rdi call free@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L15 call __stack_chk_fail@PLT .L15: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .globl Insert .type Insert, @function Insert: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl %edx, -28(%rbp) movl $16, %edi call malloc@PLT movq %rax, -8(%rbp) movq -8(%rbp), %rax movl -24(%rbp), %edx movl %edx, (%rax) movq -8(%rbp), %rax movl -28(%rbp), %edx movl %edx, 4(%rax) movq list(%rip), %rdx movl -20(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -8(%rbp), %rax movq %rdx, 8(%rax) movq list(%rip), %rdx movl -20(%rbp), %eax cltq salq $3, %rax addq %rax, %rdx movq -8(%rbp), %rax movq %rax, (%rdx) nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size Insert, .-Insert .globl Bellman .type Bellman, @function Bellman: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -36(%rbp) movl %esi, -40(%rbp) movl $0, -24(%rbp) jmp .L18 .L19: movq dist(%rip), %rdx movl -24(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl $2147483647, (%rax) addl $1, -24(%rbp) .L18: movl -24(%rbp), %eax cmpl -40(%rbp), %eax jl .L19 movq dist(%rip), %rdx movl -36(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl $0, (%rax) movl $0, -24(%rbp) jmp .L20 .L30: movl $0, -16(%rbp) movl $0, -20(%rbp) jmp .L21 .L27: movq dist(%rip), %rdx movl -20(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax cmpl $2147483647, %eax je .L33 movq list(%rip), %rdx movl -20(%rbp), %eax cltq salq $3, %rax addq %rdx, %rax movq (%rax), %rax movq %rax, -8(%rbp) jmp .L24 .L26: movq -8(%rbp), %rax movl 4(%rax), %eax movl %eax, -12(%rbp) movq dist(%rip), %rdx movl -20(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %edx movl -12(%rbp), %eax addl %eax, %edx movq dist(%rip), %rcx movq -8(%rbp), %rax movl (%rax), %eax cltq salq $2, %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jge .L25 movq dist(%rip), %rdx movl -20(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %ecx movq dist(%rip), %rdx movq -8(%rbp), %rax movl (%rax), %eax cltq salq $2, %rax addq %rdx, %rax movl -12(%rbp), %edx addl %ecx, %edx movl %edx, (%rax) movl $1, -16(%rbp) .L25: movq -8(%rbp), %rax movq 8(%rax), %rax movq %rax, -8(%rbp) .L24: cmpq $0, -8(%rbp) jne .L26 jmp .L23 .L33: nop .L23: addl $1, -20(%rbp) .L21: movl -20(%rbp), %eax cmpl -40(%rbp), %eax jl .L27 cmpl $0, -16(%rbp) je .L34 addl $1, -24(%rbp) .L20: movl -24(%rbp), %eax cmpl -40(%rbp), %eax jl .L30 jmp .L29 .L34: nop .L29: cmpl $0, -16(%rbp) je .L31 movl $0, %eax jmp .L32 .L31: movl $1, %eax .L32: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size Bellman, .-Bellman .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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);\n\t}\n\tscanf(\"%d\", &m);\n\tfor (i = 0; i < m; i++) {\n\t\tscanf(\"%d\", b + i);\n\t}\n\tfor (i = j = 0; i < n && j < m; i++) {\n\t\tj += a[i] == b[j];\n\t}\n\tputs(j == m ? \"1\" : \"0\");\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 800000\na:\n\t.zero\t800000\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 800000\nb:\n\t.zero\t800000\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"1\"\n.LC2:\n\t.string\t\"0\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L3\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tb(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L5\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tb(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tcmpl\t%eax, %edx\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\taddl\t%eax, -12(%rbp)\n\taddl\t$1, -16(%rbp)\n.L6:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjge\t.L7\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L8\n.L7:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L9\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L10\n.L9:\n\tleaq\t.LC2(%rip), %rax\n.L10:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC2(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\tleaq\ta(%rip), %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, (%rsp)\n\tjg\t.L3\n.L2:\n\tleaq\t4(%rsp), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tjle\t.L10\n\tleaq\tb(%rip), %r12\n\txorl\t%ebx, %ebx\n\tmovq\t%r12, %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %ecx\n\tjg\t.L5\n\tmovl\t(%rsp), %r8d\n\ttestl\t%ecx, %ecx\n\tjle\t.L10\n\ttestl\t%r8d, %r8d\n\tjle\t.L10\n\tmovl\t$1, %edx\n\txorl\t%eax, %eax\n\tleaq\t-4+a(%rip), %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovslq\t%eax, %rsi\n\tmovl\t(%r12,%rsi,4), %ebx\n\txorl\t%esi, %esi\n\tcmpl\t%ebx, (%r9,%rdx,4)\n\tsete\t%sil\n\taddl\t%esi, %eax\n\tcmpl\t%edx, %r8d\n\tsetg\t%dil\n\tcmpl\t%eax, %ecx\n\tsetg\t%sil\n\taddq\t$1, %rdx\n\ttestb\t%sil, %dil\n\tjne\t.L6\n.L4:\n\tcmpl\t%eax, %ecx\n\tleaq\t.LC0(%rip), %rdi\n\tleaq\t.LC1(%rip), %rax\n\tcmovne\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L23\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L10:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L4\n.L23:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\tb\n\t.bss\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 800000\nb:\n\t.zero\t800000\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 800000\na:\n\t.zero\t800000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\t.LC2(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\tleaq\ta(%rip), %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, (%rsp)\n\tjg\t.L3\n.L2:\n\tleaq\t4(%rsp), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tjle\t.L10\n\tleaq\tb(%rip), %r12\n\txorl\t%ebx, %ebx\n\tmovq\t%r12, %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %ecx\n\tjg\t.L5\n\tmovl\t(%rsp), %r8d\n\ttestl\t%ecx, %ecx\n\tjle\t.L10\n\ttestl\t%r8d, %r8d\n\tjle\t.L10\n\tmovl\t$1, %edx\n\txorl\t%eax, %eax\n\tleaq\t-4+a(%rip), %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovslq\t%eax, %rsi\n\tmovl\t(%r12,%rsi,4), %ebx\n\txorl\t%esi, %esi\n\tcmpl\t%ebx, (%r9,%rdx,4)\n\tsete\t%sil\n\taddl\t%esi, %eax\n\tcmpl\t%edx, %r8d\n\tsetg\t%dil\n\tcmpl\t%eax, %ecx\n\tsetg\t%sil\n\taddq\t$1, %rdx\n\ttestb\t%sil, %dil\n\tjne\t.L6\n.L4:\n\tcmpl\t%eax, %ecx\n\tleaq\t.LC0(%rip), %rdi\n\tleaq\t.LC1(%rip), %rax\n\tcmovne\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L23\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L10:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L4\n.L23:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\tb\n\t.bss\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 800000\nb:\n\t.zero\t800000\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 800000\na:\n\t.zero\t800000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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);\n\t}\n\tscanf(\"%d\", &m);\n\tfor (i = 0; i < m; i++) {\n\t\tscanf(\"%d\", b + i);\n\t}\n\tfor (i = j = 0; i < n && j < m; i++) {\n\t\tj += a[i] == b[j];\n\t}\n\tputs(j == m ? \"1\" : \"0\");\n\treturn 0;\n}\n\n", "index": 57, "inputs": [ "4\n1 2 3 0\n2\n2 4\n", "4\n1 2 4 1\n2\n1 4\n", "4\n1 2 3 4\n3\n1 0 5\n", "4\n1 2 3 0\n2\n1 4\n", "4\n1 2 3 8\n3\n1 0 5\n", "4\n1 2 3 1\n2\n1 4\n", "4\n1 2 3 8\n3\n1 0 8\n", "4\n1 2 3 8\n4\n1 0 8\n", "4\n1 2 4 1\n2\n2 4\n", "4\n1 2 3 8\n4\n0 0 8\n", "4\n1 2 3 1\n2\n2 4\n", "4\n1 2 3 8\n4\n-1 0 8\n", "4\n1 2 3 1\n0\n2 4\n", "4\n2 2 3 8\n4\n-1 0 8\n", "4\n1 2 2 1\n0\n2 4\n", "4\n2 2 3 8\n4\n-2 0 8\n", "4\n2 2 2 1\n0\n2 4\n", "4\n2 0 3 8\n4\n-2 0 8\n", "4\n2 2 2 0\n0\n2 4\n", "4\n2 0 3 8\n4\n-2 1 8\n", "4\n2 2 2 0\n1\n2 4\n", "4\n2 0 3 8\n4\n-2 1 6\n", "4\n2 2 3 0\n1\n2 4\n", "4\n2 0 3 8\n4\n-1 1 6\n", "4\n2 2 3 0\n1\n1 4\n", "4\n2 0 3 8\n4\n-1 2 6\n", "4\n2 2 6 0\n1\n1 4\n", "4\n2 0 3 8\n4\n0 2 6\n", "4\n2 2 6 0\n1\n1 8\n", "4\n2 0 3 8\n6\n0 2 6\n", "4\n2 2 6 0\n0\n1 8\n", "4\n2 0 3 8\n6\n0 2 11\n", "4\n2 0 3 9\n6\n0 2 11\n", "4\n2 0 3 13\n6\n0 2 11\n", "4\n2 0 3 4\n6\n0 2 11\n", "4\n2 2 3 4\n2\n2 4\n", "4\n0 2 3 4\n3\n1 2 5\n", "4\n1 2 3 0\n1\n2 4\n", "4\n1 2 3 4\n3\n1 1 5\n", "4\n1 2 4 0\n2\n1 4\n", "4\n1 2 5 8\n3\n1 0 5\n", "4\n1 2 3 1\n2\n0 4\n", "4\n1 4 3 8\n3\n1 0 8\n", "4\n1 2 4 2\n2\n1 4\n", "4\n1 2 3 8\n4\n1 0 5\n", "4\n1 2 4 1\n0\n2 4\n", "4\n1 2 3 8\n4\n0 0 2\n", "4\n1 2 3 0\n2\n4 4\n", "4\n2 2 3 8\n4\n-1 -1 8\n", "4\n2 2 3 1\n0\n2 4\n", "4\n2 2 3 8\n0\n-1 0 8\n", "4\n1 2 2 1\n0\n2 7\n", "4\n2 2 3 8\n7\n-2 0 8\n", "4\n4 2 2 1\n0\n2 4\n", "4\n2 0 3 10\n4\n-2 0 8\n", "4\n2 2 2 0\n0\n0 4\n", "4\n3 0 3 8\n4\n-2 1 8\n", "4\n2 3 2 0\n1\n2 4\n", "4\n2 0 3 8\n4\n-2 1 10\n", "4\n4 0 3 8\n4\n-1 1 6\n", "4\n2 2 5 0\n1\n1 4\n", "4\n2 0 3 3\n4\n-1 2 6\n", "4\n0 2 6 0\n1\n1 4\n", "4\n2 0 5 8\n4\n0 2 6\n", "4\n0 2 6 0\n1\n1 8\n", "4\n2 0 3 8\n6\n1 2 6\n", "4\n2 2 5 0\n0\n1 8\n", "4\n2 0 3 8\n6\n0 2 19\n", "4\n2 0 3 9\n6\n0 3 11\n", "4\n2 0 4 13\n6\n0 2 11\n", "4\n0 0 3 4\n6\n0 2 11\n", "4\n2 2 3 6\n2\n2 4\n", "4\n0 2 3 4\n3\n1 2 1\n", "4\n1 2 3 0\n1\n4 4\n", "4\n1 1 3 4\n3\n1 1 5\n", "4\n1 2 5 16\n3\n1 0 5\n", "4\n1 2 3 2\n2\n0 4\n", "4\n1 4 3 10\n3\n1 0 8\n", "4\n1 2 4 2\n0\n1 4\n", "4\n2 2 3 8\n4\n1 0 5\n", "4\n1 3 4 1\n0\n2 4\n", "4\n1 2 3 8\n0\n0 0 2\n", "4\n1 2 3 0\n3\n4 4\n", "4\n2 3 3 8\n4\n-1 -1 8\n", "4\n2 2 2 1\n0\n0 4\n", "4\n2 2 3 8\n0\n-2 0 8\n", "4\n1 1 2 1\n0\n2 7\n", "4\n2 2 3 8\n7\n-2 0 4\n", "4\n4 2 2 1\n0\n2 1\n", "4\n2 0 3 10\n4\n-2 0 16\n", "4\n2 4 2 0\n0\n0 4\n", "4\n3 0 3 8\n4\n-2 1 2\n", "4\n0 0 3 8\n4\n-2 1 10\n", "4\n4 0 3 8\n7\n-1 1 6\n", "4\n2 2 7 0\n1\n1 4\n", "4\n2 0 3 1\n4\n-1 2 6\n", "4\n0 3 6 0\n1\n1 4\n", "4\n4 0 5 8\n4\n0 2 6\n", "4\n-1 2 6 0\n1\n1 8\n", "4\n2 0 3 8\n6\n1 2 7\n", "4\n1 2 3 4\n2\n2 4\n", "4\n1 2 3 4\n2\n2 4\n", "4\n1 2 3 4\n3\n1 2 5\n" ], "outputs": [ "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "1\n", "1\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "1\n", "1\n", "0\n", "0\n", "1\n", "1\n", "1\n", "0\n", "1\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "1\n", "0\n" ], "question": "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);\n\t}\n\tscanf(\"%d\", &m);\n\tfor (i = 0; i < m; i++) {\n\t\tscanf(\"%d\", b + i);\n\t}\n\tfor (i = j = 0; i < n && j < m; i++) {\n\t\tj += a[i] == b[j];\n\t}\n\tputs(j == m ? \"1\" : \"0\");\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 800000\na:\n\t.zero\t800000\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 800000\nb:\n\t.zero\t800000\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"1\"\n.LC2:\n\t.string\t\"0\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L3\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tb(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L5\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tb(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tcmpl\t%eax, %edx\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\taddl\t%eax, -12(%rbp)\n\taddl\t$1, -16(%rbp)\n.L6:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjge\t.L7\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L8\n.L7:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L9\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L10\n.L9:\n\tleaq\t.LC2(%rip), %rax\n.L10:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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++) { scanf("%d", b + i); } for (i = j = 0; i < n && j < m; i++) { j += a[i] == b[j]; } puts(j == m ? "1" : "0"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl a .bss .align 32 .type a, @object .size a, 800000 a: .zero 800000 .globl b .align 32 .type b, @object .size b, 800000 b: .zero 800000 .section .rodata .LC0: .string "%d" .LC1: .string "1" .LC2: .string "0" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -16(%rbp) jmp .L2 .L3: movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -16(%rbp) .L2: movl -24(%rbp), %eax cmpl %eax, -16(%rbp) jl .L3 leaq -20(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -16(%rbp) jmp .L4 .L5: movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq b(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -16(%rbp) .L4: movl -20(%rbp), %eax cmpl %eax, -16(%rbp) jl .L5 movl $0, -12(%rbp) movl -12(%rbp), %eax movl %eax, -16(%rbp) jmp .L6 .L8: movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %edx movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rcx leaq b(%rip), %rax movl (%rcx,%rax), %eax cmpl %eax, %edx sete %al movzbl %al, %eax addl %eax, -12(%rbp) addl $1, -16(%rbp) .L6: movl -24(%rbp), %eax cmpl %eax, -16(%rbp) jge .L7 movl -20(%rbp), %eax cmpl %eax, -12(%rbp) jl .L8 .L7: movl -20(%rbp), %eax cmpl %eax, -12(%rbp) jne .L9 leaq .LC1(%rip), %rax jmp .L10 .L9: leaq .LC2(%rip), %rax .L10: movq %rax, %rdi call puts@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L12 call __stack_chk_fail@PLT .L12: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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==2){\n\t\t\ts=n*4000;\n\t\t}\n\t\telse if(t==3){\n\t\t\ts=n*3000;\n\t\t}\n\t\telse if(t==4){\n\t\t\ts=n*2000;\n\t\t}\n\t\tprintf(\"%d\\n\",s);\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L7:\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L3\n\tmovl\t-20(%rbp), %eax\n\timull\t$6000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L5\n\tmovl\t-20(%rbp), %eax\n\timull\t$4000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$3, %eax\n\tjne\t.L6\n\tmovl\t-20(%rbp), %eax\n\timull\t$3000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$4, %eax\n\tjne\t.L4\n\tmovl\t-20(%rbp), %eax\n\timull\t$2000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n.L4:\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -12(%rbp)\n.L2:\n\tcmpl\t$3, -12(%rbp)\n\tjle\t.L7\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L9\n\tcall\t__stack_chk_fail@PLT\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\t.LC1(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovl\t$4, %ebx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %r15\n\tmovq\t%rsp, %r14\n.L6:\n\tmovq\t%r15, %rdx\n\tmovq\t%r14, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L11\n\tcmpl\t$2, %eax\n\tje\t.L12\n\tcmpl\t$3, %eax\n\tje\t.L13\n\tcmpl\t$4, %eax\n\tjne\t.L3\n\timull\t$2000, 4(%rsp), %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\txorl\t%eax, %eax\n\tmovl\t%ebp, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tsubl\t$1, %ebx\n\tjne\t.L6\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L14\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\timull\t$6000, 4(%rsp), %ebp\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\timull\t$4000, 4(%rsp), %ebp\n\tjmp\t.L3\n.L13:\n\timull\t$3000, 4(%rsp), %ebp\n\tjmp\t.L3\n.L14:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\t.LC1(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovl\t$4, %ebx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %r15\n\tmovq\t%rsp, %r14\n.L6:\n\tmovq\t%r15, %rdx\n\tmovq\t%r14, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L11\n\tcmpl\t$2, %eax\n\tje\t.L12\n\tcmpl\t$3, %eax\n\tje\t.L13\n\tcmpl\t$4, %eax\n\tjne\t.L3\n\timull\t$2000, 4(%rsp), %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\txorl\t%eax, %eax\n\tmovl\t%ebp, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tsubl\t$1, %ebx\n\tjne\t.L6\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L14\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\timull\t$6000, 4(%rsp), %ebp\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\timull\t$4000, 4(%rsp), %ebp\n\tjmp\t.L3\n.L13:\n\timull\t$3000, 4(%rsp), %ebp\n\tjmp\t.L3\n.L14:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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==2){\n\t\t\ts=n*4000;\n\t\t}\n\t\telse if(t==3){\n\t\t\ts=n*3000;\n\t\t}\n\t\telse if(t==4){\n\t\t\ts=n*2000;\n\t\t}\n\t\tprintf(\"%d\\n\",s);\n\t}\n\treturn 0;\n}", "index": 61, "inputs": [ "3 10\n1 4\n4 1\n1 5\n", "3 13\n1 4\n4 1\n1 5\n", "3 13\n1 4\n1 1\n1 5\n", "3 13\n1 4\n1 2\n1 5\n", "2 13\n1 4\n1 2\n1 5\n", "2 13\n1 4\n1 2\n1 3\n", "2 13\n1 6\n1 2\n1 3\n", "3 10\n1 0\n4 1\n2 5\n", "3 10\n1 4\n2 1\n1 5\n", "3 16\n1 4\n1 1\n1 5\n", "3 13\n2 4\n1 2\n1 5\n", "2 13\n1 7\n1 2\n1 3\n", "2 13\n1 6\n1 2\n1 6\n", "4 10\n1 0\n4 1\n2 5\n", "3 16\n1 4\n1 0\n1 5\n", "3 13\n2 1\n1 2\n1 5\n", "2 13\n1 7\n2 2\n1 3\n", "4 10\n1 0\n4 1\n1 5\n", "3 16\n1 4\n1 -1\n1 5\n", "3 13\n3 1\n1 2\n1 5\n", "2 13\n1 7\n2 2\n2 3\n", "4 10\n1 1\n4 1\n1 5\n", "3 16\n1 4\n1 -1\n1 2\n", "3 13\n3 1\n1 2\n2 5\n", "4 10\n1 0\n4 1\n1 8\n", "3 10\n1 4\n4 0\n1 5\n", "3 7\n1 4\n1 1\n1 5\n", "3 26\n1 4\n1 2\n1 5\n", "2 13\n1 4\n1 2\n1 2\n", "2 13\n1 8\n1 2\n1 3\n", "3 10\n1 0\n4 2\n2 5\n", "3 10\n2 4\n2 1\n1 5\n", "3 16\n1 4\n2 1\n1 5\n", "3 13\n2 4\n1 2\n1 9\n", "4 17\n1 0\n4 1\n2 5\n", "3 13\n2 1\n1 1\n1 5\n", "2 26\n1 7\n2 2\n1 3\n", "4 10\n1 0\n4 2\n1 8\n", "3 16\n1 4\n1 -2\n1 5\n", "2 13\n1 12\n2 2\n2 3\n", "3 16\n1 4\n1 -2\n1 2\n", "3 1\n3 1\n1 2\n2 5\n", "1 10\n1 0\n4 1\n1 8\n", "3 7\n1 4\n1 0\n1 5\n", "3 26\n1 4\n1 2\n1 3\n", "3 10\n1 1\n4 2\n2 5\n", "3 20\n2 4\n2 1\n1 5\n", "3 5\n1 4\n2 1\n1 5\n", "2 13\n2 4\n1 2\n1 9\n", "4 17\n1 0\n4 1\n3 5\n", "3 16\n1 4\n2 0\n2 5\n", "1 13\n2 1\n1 1\n1 5\n", "4 10\n1 0\n4 4\n1 8\n", "3 31\n1 4\n1 -2\n1 2\n", "3 1\n3 1\n1 2\n2 1\n", "1 10\n1 0\n4 1\n1 0\n", "3 7\n1 8\n1 0\n1 5\n", "3 26\n1 6\n1 2\n1 3\n", "3 20\n2 0\n2 1\n1 5\n", "3 2\n1 4\n2 1\n1 5\n", "2 13\n2 4\n1 2\n2 9\n", "4 17\n1 1\n4 1\n3 5\n", "3 16\n2 4\n2 0\n2 5\n", "1 13\n2 1\n1 1\n1 8\n", "1 10\n1 0\n4 4\n1 8\n", "3 57\n1 4\n1 -2\n1 2\n", "1 1\n3 1\n1 2\n2 1\n", "1 10\n1 1\n4 1\n1 0\n", "3 13\n2 0\n2 1\n1 5\n", "3 2\n1 4\n2 1\n1 8\n", "2 13\n1 4\n1 2\n2 9\n", "3 4\n2 4\n2 0\n2 5\n", "1 13\n2 1\n1 1\n1 7\n", "3 57\n1 3\n1 -2\n1 2\n", "1 10\n1 1\n4 1\n1 -1\n", "3 1\n1 4\n2 1\n1 8\n", "2 13\n1 4\n1 2\n2 8\n", "2 4\n2 4\n2 0\n2 5\n", "1 13\n2 2\n1 1\n1 7\n", "3 13\n1 0\n1 1\n1 5\n", "2 1\n1 4\n2 1\n1 8\n", "1 9\n2 2\n1 1\n1 7\n", "3 13\n1 0\n1 0\n1 5\n", "2 1\n1 1\n2 1\n1 8\n", "1 9\n2 2\n1 0\n1 7\n", "3 3\n1 0\n1 0\n1 5\n", "2 1\n1 1\n3 1\n1 8\n", "3 4\n1 0\n1 0\n1 5\n", "2 0\n1 1\n3 1\n1 8\n", "1 15\n2 2\n2 0\n1 7\n", "3 0\n1 0\n1 0\n1 5\n", "2 0\n1 1\n3 1\n1 3\n", "2 0\n1 1\n3 2\n1 3\n", "1 15\n2 2\n4 0\n1 14\n", "2 0\n1 1\n4 2\n1 3\n", "2 0\n1 1\n4 2\n2 3\n", "3 10\n1 4\n4 0\n2 5\n", "1 13\n1 4\n4 1\n1 5\n", "3 13\n1 4\n1 1\n2 5\n", "3 13\n1 2\n1 2\n1 5\n", "3 10\n1 4\n4 1\n2 5\n", "3 10\n1 4\n4 1\n2 5\n" ], "outputs": [ "30000\n24000\n2000\n30000\n", "39000\n24000\n2000\n30000\n", "39000\n24000\n6000\n30000\n", "39000\n24000\n12000\n30000\n", "52000\n24000\n12000\n30000\n", "52000\n24000\n12000\n18000\n", "52000\n36000\n12000\n18000\n", "30000\n0\n2000\n20000\n", "30000\n24000\n4000\n30000\n", "48000\n24000\n6000\n30000\n", "39000\n16000\n12000\n30000\n", "52000\n42000\n12000\n18000\n", "52000\n36000\n12000\n36000\n", "20000\n0\n2000\n20000\n", "48000\n24000\n0\n30000\n", "39000\n4000\n12000\n30000\n", "52000\n42000\n8000\n18000\n", "20000\n0\n2000\n30000\n", "48000\n24000\n-6000\n30000\n", "39000\n3000\n12000\n30000\n", "52000\n42000\n8000\n12000\n", "20000\n6000\n2000\n30000\n", "48000\n24000\n-6000\n12000\n", "39000\n3000\n12000\n20000\n", "20000\n0\n2000\n48000\n", "30000\n24000\n0\n30000\n", "21000\n24000\n6000\n30000\n", "78000\n24000\n12000\n30000\n", "52000\n24000\n12000\n12000\n", "52000\n48000\n12000\n18000\n", "30000\n0\n4000\n20000\n", "30000\n16000\n4000\n30000\n", "48000\n24000\n4000\n30000\n", "39000\n16000\n12000\n54000\n", "34000\n0\n2000\n20000\n", "39000\n4000\n6000\n30000\n", "104000\n42000\n8000\n18000\n", "20000\n0\n4000\n48000\n", "48000\n24000\n-12000\n30000\n", "52000\n72000\n8000\n12000\n", "48000\n24000\n-12000\n12000\n", "3000\n3000\n12000\n20000\n", "60000\n0\n2000\n48000\n", "21000\n24000\n0\n30000\n", "78000\n24000\n12000\n18000\n", "30000\n6000\n4000\n20000\n", "60000\n16000\n4000\n30000\n", "15000\n24000\n4000\n30000\n", "52000\n16000\n12000\n54000\n", "34000\n0\n2000\n15000\n", "48000\n24000\n0\n20000\n", "78000\n4000\n6000\n30000\n", "20000\n0\n8000\n48000\n", "93000\n24000\n-12000\n12000\n", "3000\n3000\n12000\n4000\n", "60000\n0\n2000\n0\n", "21000\n48000\n0\n30000\n", "78000\n36000\n12000\n18000\n", "60000\n0\n4000\n30000\n", "6000\n24000\n4000\n30000\n", "52000\n16000\n12000\n36000\n", "34000\n6000\n2000\n15000\n", "48000\n16000\n0\n20000\n", "78000\n4000\n6000\n48000\n", "60000\n0\n8000\n48000\n", "171000\n24000\n-12000\n12000\n", "6000\n3000\n12000\n4000\n", "60000\n6000\n2000\n0\n", "39000\n0\n4000\n30000\n", "6000\n24000\n4000\n48000\n", "52000\n24000\n12000\n36000\n", "12000\n16000\n0\n20000\n", "78000\n4000\n6000\n42000\n", "171000\n18000\n-12000\n12000\n", "60000\n6000\n2000\n-6000\n", "3000\n24000\n4000\n48000\n", "52000\n24000\n12000\n32000\n", "16000\n16000\n0\n20000\n", "78000\n8000\n6000\n42000\n", "39000\n0\n6000\n30000\n", "4000\n24000\n4000\n48000\n", "54000\n8000\n6000\n42000\n", "39000\n0\n0\n30000\n", "4000\n6000\n4000\n48000\n", "54000\n8000\n0\n42000\n", "9000\n0\n0\n30000\n", "4000\n6000\n3000\n48000\n", "12000\n0\n0\n30000\n", "0\n6000\n3000\n48000\n", "90000\n8000\n0\n42000\n", "0\n0\n0\n30000\n", "0\n6000\n3000\n18000\n", "0\n6000\n6000\n18000\n", "90000\n8000\n0\n84000\n", "0\n6000\n4000\n18000\n", "0\n6000\n4000\n12000\n", "30000\n24000\n0\n20000\n", "78000\n24000\n2000\n30000\n", "39000\n24000\n6000\n20000\n", "39000\n12000\n12000\n30000\n", "30000\n24000\n2000\n20000\n", "30000\n24000\n2000\n20000\n" ], "question": "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==2){\n\t\t\ts=n*4000;\n\t\t}\n\t\telse if(t==3){\n\t\t\ts=n*3000;\n\t\t}\n\t\telse if(t==4){\n\t\t\ts=n*2000;\n\t\t}\n\t\tprintf(\"%d\\n\",s);\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L2\n.L7:\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L3\n\tmovl\t-20(%rbp), %eax\n\timull\t$6000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L5\n\tmovl\t-20(%rbp), %eax\n\timull\t$4000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$3, %eax\n\tjne\t.L6\n\tmovl\t-20(%rbp), %eax\n\timull\t$3000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t$4, %eax\n\tjne\t.L4\n\tmovl\t-20(%rbp), %eax\n\timull\t$2000, %eax, %eax\n\tmovl\t%eax, -16(%rbp)\n.L4:\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -12(%rbp)\n.L2:\n\tcmpl\t$3, -12(%rbp)\n\tjle\t.L7\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L9\n\tcall\t__stack_chk_fail@PLT\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; } else if(t==4){ s=n*2000; } printf("%d\n",s); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -12(%rbp) jmp .L2 .L7: leaq -20(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %eax cmpl $1, %eax jne .L3 movl -20(%rbp), %eax imull $6000, %eax, %eax movl %eax, -16(%rbp) jmp .L4 .L3: movl -24(%rbp), %eax cmpl $2, %eax jne .L5 movl -20(%rbp), %eax imull $4000, %eax, %eax movl %eax, -16(%rbp) jmp .L4 .L5: movl -24(%rbp), %eax cmpl $3, %eax jne .L6 movl -20(%rbp), %eax imull $3000, %eax, %eax movl %eax, -16(%rbp) jmp .L4 .L6: movl -24(%rbp), %eax cmpl $4, %eax jne .L4 movl -20(%rbp), %eax imull $2000, %eax, %eax movl %eax, -16(%rbp) .L4: movl -16(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT addl $1, -12(%rbp) .L2: cmpl $3, -12(%rbp) jle .L7 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L9 call __stack_chk_fail@PLT .L9: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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/*\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=min_=1;i<n;i++)\n {\n scanf(\"%d\",&c);\n if( c <= c0)\n\tmin_++;\n c0=c;\n }\n\n printf(\"%d\\n%d\\n\",min_,n);\n \n return(0);\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tn\n\t.bss\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L2\n.L4:\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L3\n\taddl\t$1, -12(%rbp)\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L4\n\tmovl\tn(%rip), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\tn(%rip), %rsi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovl\t$1, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tleaq\t.LC0(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rbp, %rdi\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t4(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %ecx\n\tcmpl\t$1, %ecx\n\tjle\t.L2\n\tmovl\t$1, %ebx\n\tmovq\t%rsp, %r13\n\tleaq\t.LC1(%rip), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\txorl\t%eax, %eax\n\tmovq\t%r13, %rsi\n\tmovq\t%rbp, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\txorl\t%edx, %edx\n\tmovl\tn(%rip), %ecx\n\tcmpl\t4(%rsp), %eax\n\tsetle\t%dl\n\taddl\t$1, %ebx\n\tmovl\t%eax, 4(%rsp)\n\taddl\t%edx, %r12d\n\tcmpl\t%ebx, %ecx\n\tjg\t.L4\n.L2:\n\txorl\t%eax, %eax\n\tmovl\t%r12d, %edx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L10\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L10:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\tn\n\t.bss\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\tn(%rip), %rsi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovl\t$1, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tleaq\t.LC0(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rbp, %rdi\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t4(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %ecx\n\tcmpl\t$1, %ecx\n\tjle\t.L2\n\tmovl\t$1, %ebx\n\tmovq\t%rsp, %r13\n\tleaq\t.LC1(%rip), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\txorl\t%eax, %eax\n\tmovq\t%r13, %rsi\n\tmovq\t%rbp, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\txorl\t%edx, %edx\n\tmovl\tn(%rip), %ecx\n\tcmpl\t4(%rsp), %eax\n\tsetle\t%dl\n\taddl\t$1, %ebx\n\tmovl\t%eax, 4(%rsp)\n\taddl\t%edx, %r12d\n\tcmpl\t%ebx, %ecx\n\tjg\t.L4\n.L2:\n\txorl\t%eax, %eax\n\tmovl\t%r12d, %edx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L10\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L10:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\tn\n\t.bss\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "/*\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=min_=1;i<n;i++)\n {\n scanf(\"%d\",&c);\n if( c <= c0)\n\tmin_++;\n c0=c;\n }\n\n printf(\"%d\\n%d\\n\",min_,n);\n \n return(0);\n}\n\n", "index": 69, "inputs": [ "5\n8 6 9 1 0\n", "5\n0 6 9 1 0\n", "5\n1 1 1 1 0\n", "5\n0 1 1 2 4\n", "5\n0 6 6 1 0\n", "5\n0 5 6 1 0\n", "5\n0 5 6 2 0\n", "5\n0 5 6 3 0\n", "5\n0 4 6 3 0\n", "5\n-1 4 6 3 0\n", "5\n-1 4 9 3 0\n", "5\n-1 4 0 3 0\n", "5\n-1 4 -1 3 0\n", "5\n0 4 -1 3 0\n", "5\n0 4 0 3 0\n", "5\n0 4 0 4 0\n", "5\n0 4 0 5 0\n", "5\n0 4 0 5 1\n", "5\n0 2 0 5 1\n", "5\n1 2 0 5 1\n", "5\n1 2 1 5 1\n", "5\n1 2 1 0 1\n", "5\n1 3 1 0 1\n", "5\n1 3 2 0 1\n", "5\n2 3 2 0 1\n", "5\n2 3 2 1 1\n", "5\n2 3 2 1 0\n", "5\n2 3 2 2 0\n", "5\n0 3 2 2 0\n", "5\n0 3 2 4 0\n", "5\n0 4 2 4 0\n", "5\n0 7 2 4 0\n", "5\n0 7 2 2 0\n", "5\n0 1 2 2 0\n", "5\n-1 1 2 2 0\n", "5\n-1 1 4 2 0\n", "5\n-1 1 4 4 0\n", "5\n-1 1 0 4 0\n", "5\n-1 1 1 4 0\n", "5\n-1 1 1 4 -1\n", "5\n-1 1 1 0 -1\n", "5\n-1 1 1 0 0\n", "5\n-1 1 1 1 0\n", "5\n0 1 1 1 0\n", "5\n1 1 1 1 1\n", "5\n1 0 1 1 1\n", "5\n1 0 2 1 1\n", "5\n1 0 2 0 1\n", "5\n1 0 2 0 2\n", "5\n1 0 0 0 2\n", "5\n1 0 0 1 2\n", "5\n1 1 0 1 2\n", "5\n2 1 0 1 2\n", "5\n1 1 -1 1 2\n", "5\n1 1 -1 0 2\n", "5\n1 1 0 0 2\n", "5\n2 1 0 0 2\n", "5\n4 1 0 0 2\n", "5\n4 2 0 0 2\n", "5\n4 2 0 0 4\n", "5\n4 2 1 0 4\n", "5\n4 1 1 0 4\n", "5\n4 1 1 1 4\n", "5\n4 1 1 2 4\n", "5\n1 1 1 2 4\n", "5\n0 1 1 3 4\n", "5\n0 1 1 4 4\n", "5\n0 2 1 4 4\n", "5\n0 2 1 6 4\n", "5\n0 0 1 6 4\n", "5\n0 0 1 4 4\n", "5\n1 0 1 4 4\n", "5\n1 -1 1 4 4\n", "5\n1 -1 2 4 4\n", "5\n1 -1 2 6 4\n", "5\n0 -1 2 6 4\n", "5\n0 -1 2 6 7\n", "5\n0 -1 2 6 6\n", "5\n0 -1 2 0 6\n", "5\n0 -1 0 0 6\n", "5\n0 -1 0 0 5\n", "5\n0 -1 0 -1 5\n", "5\n0 -1 -1 -1 5\n", "5\n0 -1 -2 -1 5\n", "5\n0 -1 -2 -1 3\n", "5\n0 -1 -2 -2 3\n", "5\n-1 -1 -2 -2 3\n", "5\n-1 -1 -3 -2 3\n", "5\n-1 -1 -3 0 3\n", "5\n-1 -1 -3 -1 3\n", "5\n-1 -1 -6 -1 3\n", "5\n-1 -2 -6 -1 3\n", "5\n-1 -1 -6 -2 3\n", "5\n-1 -2 -6 -2 3\n", "5\n-1 -2 -6 -2 6\n", "5\n0 -2 -6 -2 6\n", "5\n0 -1 -6 -2 6\n", "5\n0 -1 -6 0 6\n", "5\n0 -1 -6 0 11\n", "5\n0 -1 -1 0 11\n", "5\n8 6 9 1 20\n", "5\n8 6 9 1 20\n" ], "outputs": [ "4\n5\n", "3\n5\n", "5\n5\n", "2\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "5\n5\n", "4\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "2\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "2\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "4\n5\n", "4\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n", "3\n5\n" ], "question": "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=min_=1;i<n;i++)\n {\n scanf(\"%d\",&c);\n if( c <= c0)\n\tmin_++;\n c0=c;\n }\n\n printf(\"%d\\n%d\\n\",min_,n);\n \n return(0);\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tn\n\t.bss\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-20(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L2\n.L4:\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L3\n\taddl\t$1, -12(%rbp)\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L4\n\tmovl\tn(%rip), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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); if( c <= c0) min_++; c0=c; } printf("%d\n%d\n",min_,n); return(0); } Unoptimized Assembly Code: .file "temp.c" .text .globl n .bss .align 4 .type n, @object .size n, 4 n: .zero 4 .section .rodata .LC0: .string "%d " .LC1: .string "%d" .LC2: .string "%d\n%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq n(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -20(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -12(%rbp) movl -12(%rbp), %eax movl %eax, -16(%rbp) jmp .L2 .L4: leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %edx movl -20(%rbp), %eax cmpl %eax, %edx jg .L3 addl $1, -12(%rbp) .L3: movl -24(%rbp), %eax movl %eax, -20(%rbp) addl $1, -16(%rbp) .L2: movl n(%rip), %eax cmpl %eax, -16(%rbp) jl .L4 movl n(%rip), %edx movl -12(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L6 call __stack_chk_fail@PLT .L6: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 for(n=0;n<H;n++)\n {\n for(i=0;i<W;i++)\n {\n printf(\"#\");\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n }\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.LC0:\n\t.string\t\"%d %d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n.L8:\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t-20(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n.L2:\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -12(%rbp)\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L6\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L7\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %r14\n\tmovq\t%rsp, %r13\n\tjmp\t.L8\n.L2:\n\tmovl\t4(%rsp), %edx\n\ttestl\t%edx, %edx\n\tje\t.L17\n.L4:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L8:\n\tmovq\t%r14, %rdx\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L2\n\tjle\t.L4\n\txorl\t%ebp, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t4(%rsp), %eax\n\txorl\t%ebx, %ebx\n\ttestl\t%eax, %eax\n\tjle\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t$35, %edi\n\taddl\t$1, %ebx\n\tcall\tputchar@PLT\n\tcmpl\t%ebx, 4(%rsp)\n\tjg\t.L6\n.L7:\n\tmovl\t$10, %edi\n\taddl\t$1, %ebp\n\tcall\tputchar@PLT\n\tcmpl\t%ebp, (%rsp)\n\tjg\t.L3\n\tjmp\t.L4\n.L17:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L18\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %r14\n\tmovq\t%rsp, %r13\n\tjmp\t.L8\n.L2:\n\tmovl\t4(%rsp), %edx\n\ttestl\t%edx, %edx\n\tje\t.L17\n.L4:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n.L8:\n\tmovq\t%r14, %rdx\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L2\n\tjle\t.L4\n\txorl\t%ebp, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t4(%rsp), %eax\n\txorl\t%ebx, %ebx\n\ttestl\t%eax, %eax\n\tjle\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t$35, %edi\n\taddl\t$1, %ebx\n\tcall\tputchar@PLT\n\tcmpl\t%ebx, 4(%rsp)\n\tjg\t.L6\n.L7:\n\tmovl\t$10, %edi\n\taddl\t$1, %ebp\n\tcall\tputchar@PLT\n\tcmpl\t%ebp, (%rsp)\n\tjg\t.L3\n\tjmp\t.L4\n.L17:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L18\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 for(n=0;n<H;n++)\n {\n for(i=0;i<W;i++)\n {\n printf(\"#\");\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n }\n return 0;\n}\n", "index": 67, "inputs": [ "3 4\n5 6\n2 3\n0 0\n", "3 4\n5 6\n2 0\n0 0\n", "3 4\n5 6\n2 4\n0 0\n", "4 4\n5 6\n2 0\n0 0\n", "4 4\n5 6\n4 0\n0 0\n", "4 3\n5 6\n4 -1\n0 0\n", "3 5\n5 6\n2 2\n0 0\n", "3 4\n5 0\n2 2\n0 0\n", "3 4\n5 6\n2 1\n0 0\n", "6 4\n5 6\n2 4\n0 0\n", "3 4\n5 6\n4 -1\n0 0\n", "8 3\n5 6\n4 -1\n0 0\n", "3 5\n5 6\n3 2\n0 0\n", "4 4\n5 6\n2 1\n0 0\n", "6 4\n5 6\n2 1\n0 0\n", "8 3\n5 12\n4 -1\n0 0\n", "3 5\n5 6\n3 1\n0 0\n", "4 4\n5 -1\n2 2\n0 0\n", "6 4\n5 6\n0 1\n0 0\n", "8 3\n5 11\n4 -1\n0 0\n", "3 1\n5 6\n3 1\n0 0\n", "6 4\n5 6\n-1 1\n0 0\n", "8 2\n5 11\n4 -1\n0 0\n", "6 4\n5 9\n-1 0\n0 0\n", "8 2\n5 22\n4 -2\n0 0\n", "6 4\n6 9\n-1 0\n0 0\n", "3 4\n9 6\n2 0\n0 0\n", "3 4\n6 6\n2 4\n0 0\n", "3 4\n5 6\n1 0\n0 0\n", "3 4\n10 6\n2 4\n0 0\n", "3 5\n5 5\n2 2\n0 0\n", "3 4\n10 0\n2 2\n0 0\n", "4 4\n5 9\n2 -1\n0 0\n", "3 8\n5 6\n4 -1\n0 0\n", "8 3\n5 9\n4 -1\n0 0\n", "3 5\n5 6\n6 2\n0 0\n", "3 0\n5 -1\n2 2\n0 0\n", "4 4\n5 5\n2 1\n0 0\n", "6 4\n5 4\n2 1\n0 0\n", "3 2\n5 6\n3 1\n0 0\n", "6 1\n5 6\n0 1\n0 0\n", "7 3\n5 11\n4 -1\n0 0\n", "3 1\n5 10\n3 1\n0 0\n", "3 4\n5 6\n-1 1\n0 0\n", "8 4\n5 6\n-1 0\n0 0\n", "13 2\n5 11\n4 -2\n0 0\n", "9 4\n5 9\n-1 0\n0 0\n", "6 4\n6 7\n-1 0\n0 0\n", "6 1\n6 9\n-2 0\n0 0\n", "3 4\n9 6\n2 1\n0 0\n", "3 4\n15 6\n2 4\n0 0\n", "3 5\n5 2\n2 2\n0 0\n", "3 0\n5 6\n4 -1\n0 0\n", "4 6\n5 5\n2 1\n0 0\n", "10 4\n5 4\n2 1\n0 0\n", "2 2\n5 6\n3 1\n0 0\n", "5 4\n5 -2\n2 2\n0 0\n", "6 1\n2 6\n0 1\n0 0\n", "7 3\n4 11\n4 -1\n0 0\n", "6 1\n5 10\n3 1\n0 0\n", "5 4\n5 6\n-1 1\n0 0\n", "10 4\n5 6\n-1 0\n0 0\n", "4 4\n5 9\n-1 0\n0 0\n", "3 4\n13 6\n2 1\n0 0\n", "1 4\n15 6\n2 4\n0 0\n", "3 5\n5 4\n2 2\n0 0\n", "8 4\n5 9\n2 0\n0 0\n", "2 0\n5 6\n4 -1\n0 0\n", "6 0\n5 0\n2 2\n0 0\n", "10 6\n5 4\n2 1\n0 0\n", "2 0\n5 6\n3 1\n0 0\n", "6 0\n2 6\n0 1\n0 0\n", "7 3\n4 11\n6 -1\n0 0\n", "1 1\n5 10\n3 1\n0 0\n", "5 4\n1 6\n-1 1\n0 0\n", "3 4\n13 6\n4 1\n0 0\n", "1 4\n15 6\n2 6\n0 0\n", "3 5\n5 4\n2 3\n0 0\n", "6 4\n1 6\n-1 3\n0 0\n", "2 0\n5 6\n1 -1\n0 0\n", "10 6\n5 6\n2 1\n0 0\n", "6 0\n2 6\n-1 1\n0 0\n", "1 1\n5 5\n3 1\n0 0\n", "5 4\n1 9\n-1 1\n0 0\n", "1 4\n5 6\n-1 -1\n0 0\n", "1 3\n15 6\n2 6\n0 0\n", "6 5\n5 4\n2 3\n0 0\n", "11 4\n1 6\n-1 3\n0 0\n", "2 0\n1 6\n1 -1\n0 0\n", "6 6\n5 6\n2 1\n0 0\n", "1 1\n5 5\n5 1\n0 0\n", "1 3\n15 6\n2 1\n0 0\n", "6 6\n5 4\n2 3\n0 0\n", "1 0\n1 6\n1 -1\n0 0\n", "6 6\n5 6\n2 2\n0 0\n", "2 1\n5 5\n5 1\n0 0\n", "1 3\n15 6\n2 0\n0 0\n", "6 4\n5 4\n2 3\n0 0\n", "11 4\n2 6\n-1 5\n0 0\n", "1 0\n1 6\n2 -1\n0 0\n", "3 4\n5 6\n2 2\n0 0\n", "3 4\n5 6\n2 2\n0 0\n" ], "outputs": [ "####\n####\n####\n\n######\n######\n######\n######\n######\n\n###\n###\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n####\n####\n\n", "####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "###\n###\n###\n###\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n##\n##\n\n", "####\n####\n####\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n####\n####\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n##\n##\n##\n\n", "####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n############\n############\n############\n############\n############\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "####\n####\n####\n####\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "#\n#\n#\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "##\n##\n##\n##\n##\n##\n##\n##\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n", "##\n##\n##\n##\n##\n##\n##\n##\n\n######################\n######################\n######################\n######################\n######################\n\n\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "#####\n#####\n#####\n\n#####\n#####\n#####\n#####\n#####\n\n##\n##\n\n", "####\n####\n####\n\n\n\n\n\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n\n\n", "########\n########\n########\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "###\n###\n###\n###\n###\n###\n###\n###\n\n#########\n#########\n#########\n#########\n#########\n\n\n\n\n\n\n", "#####\n#####\n#####\n\n######\n######\n######\n######\n######\n\n##\n##\n##\n##\n##\n##\n\n", "\n\n\n\n\n\n\n\n\n\n##\n##\n\n", "####\n####\n####\n####\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n\n####\n####\n####\n####\n####\n\n#\n#\n\n", "##\n##\n##\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "#\n#\n#\n#\n#\n#\n\n######\n######\n######\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "#\n#\n#\n\n##########\n##########\n##########\n##########\n##########\n\n#\n#\n#\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n\n###########\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n####\n####\n####\n\n#######\n#######\n#######\n#######\n#######\n#######\n\n\n", "#\n#\n#\n#\n#\n#\n\n#########\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "#####\n#####\n#####\n\n##\n##\n##\n##\n##\n\n##\n##\n\n", "\n\n\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "######\n######\n######\n######\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n####\n####\n####\n####\n####\n\n#\n#\n\n", "##\n##\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n\n\n\n\n\n\n##\n##\n\n", "#\n#\n#\n#\n#\n#\n\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n", "#\n#\n#\n#\n#\n#\n\n##########\n##########\n##########\n##########\n##########\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n\n", "####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n\n", "####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n\n", "#####\n#####\n#####\n\n####\n####\n####\n####\n####\n\n##\n##\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n\n#########\n#########\n#########\n#########\n#########\n\n\n\n\n", "\n\n\n######\n######\n######\n######\n######\n\n\n\n\n\n\n", "\n\n\n\n\n\n\n\n\n\n\n\n\n##\n##\n\n", "######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n####\n####\n####\n####\n####\n\n#\n#\n\n", "\n\n\n######\n######\n######\n######\n######\n\n#\n#\n#\n\n", "\n\n\n\n\n\n\n######\n######\n\n\n", "###\n###\n###\n###\n###\n###\n###\n\n###########\n###########\n###########\n###########\n\n\n\n\n\n\n\n\n", "#\n\n##########\n##########\n##########\n##########\n##########\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n######\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n#\n#\n\n", "####\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n######\n######\n\n", "#####\n#####\n#####\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "####\n####\n####\n####\n####\n####\n\n######\n\n\n", "\n\n\n######\n######\n######\n######\n######\n\n\n\n", "######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "\n\n\n\n\n\n\n######\n######\n\n\n", "#\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n#\n\n", "####\n####\n####\n####\n####\n\n#########\n\n\n", "####\n\n######\n######\n######\n######\n######\n\n\n", "###\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n######\n######\n\n", "#####\n#####\n#####\n#####\n#####\n#####\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n######\n\n\n", "\n\n\n######\n\n\n\n", "######\n######\n######\n######\n######\n######\n\n######\n######\n######\n######\n######\n\n#\n#\n\n", "#\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n#\n#\n#\n\n", "###\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n#\n#\n\n", "######\n######\n######\n######\n######\n######\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "\n\n######\n\n\n\n", "######\n######\n######\n######\n######\n######\n\n######\n######\n######\n######\n######\n\n##\n##\n\n", "#\n#\n\n#####\n#####\n#####\n#####\n#####\n\n#\n#\n#\n#\n#\n\n", "###\n\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n######\n\n\n\n\n", "####\n####\n####\n####\n####\n####\n\n####\n####\n####\n####\n####\n\n###\n###\n\n", "####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n####\n\n######\n######\n\n\n", "\n\n######\n\n\n\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##\n\n", "####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##\n\n" ], "question": "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 for(n=0;n<H;n++)\n {\n for(i=0;i<W;i++)\n {\n printf(\"#\");\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n }\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.LC0:\n\t.string\t\"%d %d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n.L8:\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t-20(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L12\n.L2:\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t$35, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -12(%rbp)\n.L5:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L6\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L7\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tjmp\t.L8\n.L12:\n\tnop\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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++) { for(i=0;i<W;i++) { printf("#"); } printf("\n"); } printf("\n"); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax .L8: leaq -20(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %eax testl %eax, %eax jne .L2 movl -20(%rbp), %eax testl %eax, %eax je .L12 .L2: movl $0, -16(%rbp) jmp .L4 .L7: movl $0, -12(%rbp) jmp .L5 .L6: movl $35, %edi call putchar@PLT addl $1, -12(%rbp) .L5: movl -20(%rbp), %eax cmpl %eax, -12(%rbp) jl .L6 movl $10, %edi call putchar@PLT addl $1, -16(%rbp) .L4: movl -24(%rbp), %eax cmpl %eax, -16(%rbp) jl .L7 movl $10, %edi call putchar@PLT jmp .L8 .L12: nop movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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, i, j, k;\n\tscanf(\"%lld\", &N);\n\tint **a = (int **)malloc(sizeof(int *) * N);\n\tfor(i = 0; i < N; i++){\n\t\ta[i] = (int *)malloc(sizeof(int) * N);\n\t\tfor(j = 0; j < N; j++){\n\t\t\tscanf(\"%lld\", &a[i][j]);\n\t\t}\n\t}\n\tint *dp = (int *)malloc(sizeof(int) * (1 << N));\n\tfor(i = 0; i < (1 << N); i++){\n\t\tdp[i] = 0;\n\t\tfor(j = 0; j < N; j++){\n\t\t\tfor(k = j + 1; k < N; k++){\n\t\t\t\tif((i | (1 << j)) == i && (i | (1 << k)) == i){\n\t\t\t\t\tdp[i] += a[j][k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(j = ((i - 1) & i); j > 0; j = ((j - 1) & i)){\n\t\t\tdp[i] = max(dp[i], dp[j] + dp[i ^ j]);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", dp[(1 << N) - 1]);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovge\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmax, .-max\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$72, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-72(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-72(%rbp), %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovq\t-72(%rbp), %rax\n\tsalq\t$3, %rax\n\tmovq\t-64(%rbp), %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tmovq\t-40(%rbp), %rdx\n\tleaq\t(%rcx,%rdx), %rbx\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -56(%rbp)\n.L5:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjl\t.L6\n\taddq\t$1, -64(%rbp)\n.L4:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjl\t.L7\n\tmovq\t-72(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L8\n.L16:\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t$0, (%rax)\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L9\n.L13:\n\tmovq\t-56(%rbp), %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, -48(%rbp)\n\tjmp\t.L10\n.L12:\n\tmovq\t-56(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\torq\t-64(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjne\t.L11\n\tmovq\t-48(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\torq\t-64(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjne\t.L11\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-56(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rsi\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rsi, %rax\n\taddq\t%rcx, %rdx\n\tmovq\t%rdx, (%rax)\n.L11:\n\taddq\t$1, -48(%rbp)\n.L10:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -48(%rbp)\n\tjl\t.L12\n\taddq\t$1, -56(%rbp)\n.L9:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjl\t.L13\n\tmovq\t-64(%rbp), %rax\n\tsubq\t$1, %rax\n\tandq\t-64(%rbp), %rax\n\tmovq\t%rax, -56(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovq\t-56(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\txorq\t-56(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-64(%rbp), %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-32(%rbp), %rcx\n\tleaq\t(%rsi,%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmax\n\tmovq\t%rax, (%rbx)\n\tmovq\t-56(%rbp), %rax\n\tsubq\t$1, %rax\n\tandq\t-64(%rbp), %rax\n\tmovq\t%rax, -56(%rbp)\n.L14:\n\tcmpq\t$0, -56(%rbp)\n\tjg\t.L15\n\taddq\t$1, -64(%rbp)\n.L8:\n\tmovq\t-72(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tcmpq\t%rax, -64(%rbp)\n\tjl\t.L16\n\tmovq\t-72(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tsalq\t$3, %rax\n\tleaq\t-8(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L18\n\tcall\t__stack_chk_fail@PLT\n.L18:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\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.LFB40:\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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rbp\n\tleaq\t0(,%rbp,8), %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rbx\n\ttestq\t%rbp, %rbp\n\tjle\t.L4\n\txorl\t%r14d, %r14d\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tleaq\t0(,%rbp,8), %rdi\n\txorl\t%r15d, %r15d\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx,%r14,8)\n\tmovq\t%rax, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddq\t$1, %r15\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rbp\n\taddq\t$8, %r12\n\tcmpq\t%r15, %rbp\n\tjg\t.L5\n\taddq\t$1, %r14\n\tcmpq\t%r14, %rbp\n\tjg\t.L18\n.L4:\n\tmovl\t%ebp, %ecx\n\tmovl\t$1, %eax\n\tsall\t%cl, %eax\n\tmovslq\t%eax, %r12\n\tleaq\t0(,%r12,8), %r13\n\tmovq\t%r13, %rdi\n\tcall\tmalloc@PLT\n\txorl\t%edx, %edx\n\tmovl\t$1, %esi\n\tmovq\t%rax, %r8\n\tmovq\t%rax, %rdi\n\ttestq\t%r12, %r12\n\tjle\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\t$0, (%rdi)\n\tcmpq\t$1, %rbp\n\tjle\t.L8\n\tmovl\t$1, %r9d\n\tjmp\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\taddq\t$1, %r9\n\tcmpq\t%rbp, %r9\n\tje\t.L8\n.L12:\n\tleal\t-1(%r9), %ecx\n\tmovl\t%esi, %eax\n\tsall\t%cl, %eax\n\tcltq\n\torq\t%rdx, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L9\n\tmovq\t%r9, %rcx\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\taddq\t$1, %rcx\n\tcmpq\t%rbp, %rcx\n\tjge\t.L9\n.L11:\n\tmovl\t%esi, %eax\n\tsall\t%cl, %eax\n\tcltq\n\torq\t%rdx, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L10\n\tmovq\t-8(%rbx,%r9,8), %rax\n\tmovq\t(%rax,%rcx,8), %rax\n\taddq\t%rax, (%rdi)\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleaq\t-1(%rdx), %rax\n\tandq\t%rdx, %rax\n\tje\t.L17\n\tmovq\t(%rdi), %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovq\t%rdx, %r10\n\tmovq\t(%r8,%rax,8), %rcx\n\txorq\t%rax, %r10\n\taddq\t(%r8,%r10,8), %rcx\n\tcmpq\t%rcx, %r9\n\tcmovl\t%rcx, %r9\n\tsubq\t$1, %rax\n\tmovq\t%r9, (%rdi)\n\tandq\t%rdx, %rax\n\tjne\t.L16\n.L17:\n\taddq\t$1, %rdx\n\taddq\t$8, %rdi\n\tcmpq\t%r12, %rdx\n\tjne\t.L14\n.L15:\n\tmovq\t-8(%r8,%r13), %rdx\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L30\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L30:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE40:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.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.LFB40:\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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rbp\n\tleaq\t0(,%rbp,8), %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rbx\n\ttestq\t%rbp, %rbp\n\tjle\t.L4\n\txorl\t%r14d, %r14d\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tleaq\t0(,%rbp,8), %rdi\n\txorl\t%r15d, %r15d\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx,%r14,8)\n\tmovq\t%rax, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%r12, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddq\t$1, %r15\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rbp\n\taddq\t$8, %r12\n\tcmpq\t%r15, %rbp\n\tjg\t.L5\n\taddq\t$1, %r14\n\tcmpq\t%r14, %rbp\n\tjg\t.L18\n.L4:\n\tmovl\t%ebp, %ecx\n\tmovl\t$1, %eax\n\tsall\t%cl, %eax\n\tmovslq\t%eax, %r12\n\tleaq\t0(,%r12,8), %r13\n\tmovq\t%r13, %rdi\n\tcall\tmalloc@PLT\n\txorl\t%edx, %edx\n\tmovl\t$1, %esi\n\tmovq\t%rax, %r8\n\tmovq\t%rax, %rdi\n\ttestq\t%r12, %r12\n\tjle\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\t$0, (%rdi)\n\tcmpq\t$1, %rbp\n\tjle\t.L8\n\tmovl\t$1, %r9d\n\tjmp\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\taddq\t$1, %r9\n\tcmpq\t%rbp, %r9\n\tje\t.L8\n.L12:\n\tleal\t-1(%r9), %ecx\n\tmovl\t%esi, %eax\n\tsall\t%cl, %eax\n\tcltq\n\torq\t%rdx, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L9\n\tmovq\t%r9, %rcx\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\taddq\t$1, %rcx\n\tcmpq\t%rbp, %rcx\n\tjge\t.L9\n.L11:\n\tmovl\t%esi, %eax\n\tsall\t%cl, %eax\n\tcltq\n\torq\t%rdx, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L10\n\tmovq\t-8(%rbx,%r9,8), %rax\n\tmovq\t(%rax,%rcx,8), %rax\n\taddq\t%rax, (%rdi)\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleaq\t-1(%rdx), %rax\n\tandq\t%rdx, %rax\n\tje\t.L17\n\tmovq\t(%rdi), %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovq\t%rdx, %r10\n\tmovq\t(%r8,%rax,8), %rcx\n\txorq\t%rax, %r10\n\taddq\t(%r8,%r10,8), %rcx\n\tcmpq\t%rcx, %r9\n\tcmovl\t%rcx, %r9\n\tsubq\t$1, %rax\n\tmovq\t%r9, (%rdi)\n\tandq\t%rdx, %rax\n\tjne\t.L16\n.L17:\n\taddq\t$1, %rdx\n\taddq\t$8, %rdi\n\tcmpq\t%r12, %rdx\n\tjne\t.L14\n.L15:\n\tmovq\t-8(%r8,%r13), %rdx\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L30\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L30:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE40:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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, i, j, k;\n\tscanf(\"%lld\", &N);\n\tint **a = (int **)malloc(sizeof(int *) * N);\n\tfor(i = 0; i < N; i++){\n\t\ta[i] = (int *)malloc(sizeof(int) * N);\n\t\tfor(j = 0; j < N; j++){\n\t\t\tscanf(\"%lld\", &a[i][j]);\n\t\t}\n\t}\n\tint *dp = (int *)malloc(sizeof(int) * (1 << N));\n\tfor(i = 0; i < (1 << N); i++){\n\t\tdp[i] = 0;\n\t\tfor(j = 0; j < N; j++){\n\t\t\tfor(k = j + 1; k < N; k++){\n\t\t\t\tif((i | (1 << j)) == i && (i | (1 << k)) == i){\n\t\t\t\t\tdp[i] += a[j][k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(j = ((i - 1) & i); j > 0; j = ((j - 1) & i)){\n\t\t\tdp[i] = max(dp[i], dp[j] + dp[i ^ j]);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", dp[(1 << N) - 1]);\n\treturn 0;\n}", "index": 40, "inputs": [ "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -10\n-6 0\n", "3\n0 10 20\n0 0 -100\n20 -100 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -11\n-6 0\n", "2\n0 -11\n-12 0\n", "2\n0 -17\n-10 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -1 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -3\n-6 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -14\n-12 0\n", "3\n0 1 20\n0 0 -100\n20 -100 0\n", "2\n0 -17\n-20 0\n", "2\n0 -4\n-6 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 0\n-12 0\n", "3\n0 1 20\n0 0 -100\n20 -76 0\n", "2\n0 -17\n-11 0\n", "2\n0 0\n-6 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -1 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -2 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -10\n-9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -12 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -20\n-6 0\n", "2\n0 -11\n-19 0\n", "3\n0 10 20\n1 0 -100\n20 -100 0\n", "2\n0 -34\n-10 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -2 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -14\n-17 0\n", "3\n0 1 20\n0 0 -100\n20 -115 0\n", "2\n0 -16\n-20 0\n", "2\n0 -4\n-11 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -1\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 0\n-11 0\n", "2\n0 -17\n-7 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 0 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -1 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -2 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -2 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -12 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 2 -8 -9 0\n", "3\n0 10 20\n1 0 -145\n20 -100 0\n", "2\n0 -34\n-6 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -14\n-21 0\n", "3\n0 1 20\n0 0 -161\n20 -115 0\n", "2\n0 -16\n-38 0\n", "2\n0 -4\n-12 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 7 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -1\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 0\n-8 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 7 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 0 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -1 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "3\n0 10 20\n1 0 -145\n20 -99 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -9\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -1\n-21 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 7 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 0 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -1\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -1\n-8 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -9\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -4 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -1\n-4 0\n", "2\n0 -1\n-13 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -2 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -9\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -4 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -1\n-3 0\n", "2\n0 -2\n-13 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -2 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -9\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -5 -6 1 -8 -2 -2 4 -4 -4 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -3 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 0 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -2\n-6 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -1 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n13 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 5 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -10\n-12 0\n", "3\n0 1 20\n0 0 -26\n20 -100 0\n", "2\n0 -24\n-20 0\n", "2\n0 -17\n-19 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -4 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -1 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -2 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -15 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -6\n-9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -1 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -12 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 0\n-2 0\n", "2\n0 -34\n0 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 1 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -2 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -14\n-33 0\n", "3\n0 1 20\n1 0 -100\n20 -115 0\n", "2\n0 -18\n-20 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -4 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -1\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -1 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -2 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -5 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -23\n-21 0\n", "3\n0 1 20\n0 0 -161\n20 -187 0\n", "2\n0 -1\n-1 0\n", "2\n0 0\n-4 0\n", "2\n0 -2\n-12 0\n", "2\n0 -1\n-2 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -2 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -9\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 11 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -5 -6 1 -8 -2 -2 4 -4 -4 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -3 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 1 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 7 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 0 1 -8 -2 0 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 5 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -1 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n13 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -30\n-19 0\n", "2\n0 -6\n-13 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -1 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 0 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -12 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -35\n0 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 1 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -2 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 9 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "3\n0 1 20\n1 0 -100\n20 -103 0\n", "16\n0 5 -4 -5 -8 -4 7 2 0 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -4 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 5 0 0 7 -8 0\n2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -1\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -5 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -7 0 -2 -2 -9 -2 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -2 6 0 -3 -5 9 6 -2 1 2 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "2\n0 -10\n-10 0\n", "3\n0 10 20\n10 0 -100\n20 -100 0\n", "3\n0 10 20\n10 0 -100\n20 -100 0\n", "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8\n-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7\n0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6\n7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3\n0 -1 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0\n2 -4 -6 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1\n-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8\n7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9\n7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0\n", "4\n0 1000000000 1000000000 1000000000\n1000000000 0 1000000000 1000000000\n1000000000 1000000000 0 -1\n1000000000 1000000000 -1 0\n" ], "outputs": [ "132\n", "0\n", "20\n", "132\n", "0\n", "0\n", "0\n", "132\n", "0\n", "132\n", "0\n", "20\n", "0\n", "0\n", "132\n", "0\n", "20\n", "0\n", "0\n", "132\n", "132\n", "0\n", "132\n", "0\n", "0\n", "20\n", "0\n", "132\n", "0\n", "20\n", "0\n", "0\n", "132\n", "0\n", "0\n", "132\n", "132\n", "132\n", "20\n", "0\n", "132\n", "0\n", "20\n", "0\n", "0\n", "132\n", "0\n", "132\n", "20\n", "132\n", "0\n", "132\n", "0\n", "132\n", "0\n", "0\n", "132\n", "0\n", "0\n", "132\n", "132\n", "132\n", "0\n", "132\n", "132\n", "0\n", "20\n", "0\n", "0\n", "132\n", "132\n", "0\n", "132\n", "0\n", "0\n", "132\n", "0\n", "20\n", "0\n", "132\n", "132\n", "132\n", "0\n", "20\n", "0\n", "0\n", "0\n", "0\n", "132\n", "132\n", "132\n", "132\n", "0\n", "0\n", "132\n", "0\n", "132\n", "20\n", "132\n", "132\n", "0\n", "20\n", "20\n", "132\n", "4999999999\n" ], "question": "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, i, j, k;\n\tscanf(\"%lld\", &N);\n\tint **a = (int **)malloc(sizeof(int *) * N);\n\tfor(i = 0; i < N; i++){\n\t\ta[i] = (int *)malloc(sizeof(int) * N);\n\t\tfor(j = 0; j < N; j++){\n\t\t\tscanf(\"%lld\", &a[i][j]);\n\t\t}\n\t}\n\tint *dp = (int *)malloc(sizeof(int) * (1 << N));\n\tfor(i = 0; i < (1 << N); i++){\n\t\tdp[i] = 0;\n\t\tfor(j = 0; j < N; j++){\n\t\t\tfor(k = j + 1; k < N; k++){\n\t\t\t\tif((i | (1 << j)) == i && (i | (1 << k)) == i){\n\t\t\t\t\tdp[i] += a[j][k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(j = ((i - 1) & i); j > 0; j = ((j - 1) & i)){\n\t\t\tdp[i] = max(dp[i], dp[j] + dp[i ^ j]);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", dp[(1 << N) - 1]);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovge\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmax, .-max\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$72, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-72(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-72(%rbp), %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovq\t-72(%rbp), %rax\n\tsalq\t$3, %rax\n\tmovq\t-64(%rbp), %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tmovq\t-40(%rbp), %rdx\n\tleaq\t(%rcx,%rdx), %rbx\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -56(%rbp)\n.L5:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjl\t.L6\n\taddq\t$1, -64(%rbp)\n.L4:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjl\t.L7\n\tmovq\t-72(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L8\n.L16:\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t$0, (%rax)\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L9\n.L13:\n\tmovq\t-56(%rbp), %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, -48(%rbp)\n\tjmp\t.L10\n.L12:\n\tmovq\t-56(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\torq\t-64(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjne\t.L11\n\tmovq\t-48(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\torq\t-64(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjne\t.L11\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-56(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rsi\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rsi, %rax\n\taddq\t%rcx, %rdx\n\tmovq\t%rdx, (%rax)\n.L11:\n\taddq\t$1, -48(%rbp)\n.L10:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -48(%rbp)\n\tjl\t.L12\n\taddq\t$1, -56(%rbp)\n.L9:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjl\t.L13\n\tmovq\t-64(%rbp), %rax\n\tsubq\t$1, %rax\n\tandq\t-64(%rbp), %rax\n\tmovq\t%rax, -56(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovq\t-56(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\txorq\t-56(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-64(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-64(%rbp), %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-32(%rbp), %rcx\n\tleaq\t(%rsi,%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmax\n\tmovq\t%rax, (%rbx)\n\tmovq\t-56(%rbp), %rax\n\tsubq\t$1, %rax\n\tandq\t-64(%rbp), %rax\n\tmovq\t%rax, -56(%rbp)\n.L14:\n\tcmpq\t$0, -56(%rbp)\n\tjg\t.L15\n\taddq\t$1, -64(%rbp)\n.L8:\n\tmovq\t-72(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tcmpq\t%rax, -64(%rbp)\n\tjl\t.L16\n\tmovq\t-72(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tsalq\t$3, %rax\n\tleaq\t-8(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L18\n\tcall\t__stack_chk_fail@PLT\n.L18:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 **a = (int **)malloc(sizeof(int *) * N); for(i = 0; i < N; i++){ a[i] = (int *)malloc(sizeof(int) * N); for(j = 0; j < N; j++){ scanf("%lld", &a[i][j]); } } int *dp = (int *)malloc(sizeof(int) * (1 << N)); for(i = 0; i < (1 << N); i++){ dp[i] = 0; for(j = 0; j < N; j++){ for(k = j + 1; k < N; k++){ if((i | (1 << j)) == i && (i | (1 << k)) == i){ dp[i] += a[j][k]; } } } for(j = ((i - 1) & i); j > 0; j = ((j - 1) & i)){ dp[i] = max(dp[i], dp[j] + dp[i ^ j]); } } printf("%lld\n", dp[(1 << N) - 1]); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl max .type max, @function max: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx cmovge %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size max, .-max .section .rodata .LC0: .string "%lld" .LC1: .string "%lld\n" .text .globl main .type main, @function main: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $72, %rsp .cfi_offset 3, -24 movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax leaq -72(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -72(%rbp), %rax salq $3, %rax movq %rax, %rdi call malloc@PLT movq %rax, -40(%rbp) movq $0, -64(%rbp) jmp .L4 .L7: movq -72(%rbp), %rax salq $3, %rax movq -64(%rbp), %rdx leaq 0(,%rdx,8), %rcx movq -40(%rbp), %rdx leaq (%rcx,%rdx), %rbx movq %rax, %rdi call malloc@PLT movq %rax, (%rbx) movq $0, -56(%rbp) jmp .L5 .L6: movq -64(%rbp), %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -56(%rbp), %rax salq $3, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addq $1, -56(%rbp) .L5: movq -72(%rbp), %rax cmpq %rax, -56(%rbp) jl .L6 addq $1, -64(%rbp) .L4: movq -72(%rbp), %rax cmpq %rax, -64(%rbp) jl .L7 movq -72(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq salq $3, %rax movq %rax, %rdi call malloc@PLT movq %rax, -32(%rbp) movq $0, -64(%rbp) jmp .L8 .L16: movq -64(%rbp), %rax leaq 0(,%rax,8), %rdx movq -32(%rbp), %rax addq %rdx, %rax movq $0, (%rax) movq $0, -56(%rbp) jmp .L9 .L13: movq -56(%rbp), %rax addq $1, %rax movq %rax, -48(%rbp) jmp .L10 .L12: movq -56(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq orq -64(%rbp), %rax cmpq %rax, -64(%rbp) jne .L11 movq -48(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq orq -64(%rbp), %rax cmpq %rax, -64(%rbp) jne .L11 movq -64(%rbp), %rax leaq 0(,%rax,8), %rdx movq -32(%rbp), %rax addq %rdx, %rax movq (%rax), %rcx movq -56(%rbp), %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -48(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -64(%rbp), %rax leaq 0(,%rax,8), %rsi movq -32(%rbp), %rax addq %rsi, %rax addq %rcx, %rdx movq %rdx, (%rax) .L11: addq $1, -48(%rbp) .L10: movq -72(%rbp), %rax cmpq %rax, -48(%rbp) jl .L12 addq $1, -56(%rbp) .L9: movq -72(%rbp), %rax cmpq %rax, -56(%rbp) jl .L13 movq -64(%rbp), %rax subq $1, %rax andq -64(%rbp), %rax movq %rax, -56(%rbp) jmp .L14 .L15: movq -56(%rbp), %rax leaq 0(,%rax,8), %rdx movq -32(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -64(%rbp), %rax xorq -56(%rbp), %rax leaq 0(,%rax,8), %rcx movq -32(%rbp), %rax addq %rcx, %rax movq (%rax), %rax addq %rax, %rdx movq -64(%rbp), %rax leaq 0(,%rax,8), %rcx movq -32(%rbp), %rax addq %rcx, %rax movq (%rax), %rax movq -64(%rbp), %rcx leaq 0(,%rcx,8), %rsi movq -32(%rbp), %rcx leaq (%rsi,%rcx), %rbx movq %rdx, %rsi movq %rax, %rdi call max movq %rax, (%rbx) movq -56(%rbp), %rax subq $1, %rax andq -64(%rbp), %rax movq %rax, -56(%rbp) .L14: cmpq $0, -56(%rbp) jg .L15 addq $1, -64(%rbp) .L8: movq -72(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq cmpq %rax, -64(%rbp) jl .L16 movq -72(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq salq $3, %rax leaq -8(%rax), %rdx movq -32(%rbp), %rax addq %rdx, %rax movq (%rax), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -24(%rbp), %rdx subq %fs:40, %rdx je .L18 call __stack_chk_fail@PLT .L18: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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// 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 gc() getchar_unlocked()\n#define pc(c) putchar_unlocked(c)\n#else\n#define gc() getchar()\n#define pc(c) putchar(c)\n#endif\nint in()\n{\n\tint n = 0, c = gc();\n\tdo n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');\n\treturn n;\n}\n\nvoid out(int n)\n{\n\tint i;\n\tchar ob[40];\n\n\tif (!n) pc('0');\n\telse {\n\t\tif (n < 0) pc('-'), n = -n;\n\t\ti = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;\n\t\twhile (i--) pc(ob[i]);\n\t}\n\tpc('\\n');\n}\n\n\n//// BIT library\n#define MAX 100005\nint bit[2*MAX]; int bmax;\n\nint sum(int i)\n{\n\tint s = 0;\n\n\twhile (i > 0) {\n\t\ts += bit[i];\n\t\ti -= i & -i;\n\t}\n\treturn s;\n}\n\nvoid add(int i, int v)\n{\n\twhile (i <= bmax) {\n\t\tbit[i] += v;\n\t\ti += i & -i;\n\t}\n}\n\n\n//// 本問題関連\nint N;\nint hi[MAX], *to[MAX];\nint idx[2*MAX][2]; int sz;\nint que[2*MAX], top;\n\nvoid eularTour()\n{\n\tint i, node;\n\n\tsz = 1;\n\n\t// 非再帰dfs\n\tque[0] = 0, top = 1;\n\twhile (top) {\n\t\tnode = que[--top];\n\n\t\t// dfsにする\n\t\tif (node < 0) {\n\t\t\tnode = -node;\n\t\t\tidx[node - 1][1] = sz++;\n\t\t\tcontinue;\n\t\t}\n\t\tque[top++] = -(node + 1);\n\n\t\tidx[node][0] = sz++;\n\t\tfor (i = 0; i < hi[node]; i++) que[top++] = to[node][i];\n\t}\n\n#if 0\n\tint j;\n\tfor (j = 0; j <= 1; j++) {\n\t\tfor (i = 0; i < sz; i++) printf(\"%3d \", idx[i][j]); printf(\"\\n\");\n\t}\n#endif\n}\n\nint main()\n{\n\tint i, j, k, Q;\n\tint cmd;\n\n\tN = in();\n\tfor (i = 0; i < N; i++) {\n\t\thi[i] = k = in();\n\t\tif (k > 0) {\n\t\t\tto[i] = malloc(sizeof(int)*k);\n\t\t\tfor (j = 0; j < k; j++) to[i][j] = in();\n\t\t}\n\t}\n\teularTour();\n\tbmax = sz + 1;\n\n\tQ = in();\n\twhile (Q--) {\n\t\tcmd = in();\n\t\tif (cmd == 0) { // add(v, w)\n\t\t\tint v, w;\n\t\t\tv = in(), w = in();\n\t\t\tadd(idx[v][0], w);\n\t\t\tadd(idx[v][1], -w);\n\t\t}\n\t\telse { // getSum(u)\n\t\t\tint u = in();\n\t\t\tif (u == 0) out(0);\n\t\t\telse out(sum(idx[u][0]));\n\t\t}\n\t}\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tandl\t$15, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$47, -4(%rbp)\n\tjg\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tin, .-in\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovl\t%edi, -68(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L5\n\tmovl\t$48, %edi\n\tcall\tputchar_unlocked@PLT\n\tjmp\t.L6\n.L5:\n\tcmpl\t$0, -68(%rbp)\n\tjns\t.L7\n\tmovl\t$45, %edi\n\tcall\tputchar_unlocked@PLT\n\tnegl\t-68(%rbp)\n.L7:\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-68(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tleal\t48(%rax), %ecx\n\tmovl\t-52(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t%ecx, %edx\n\tcltq\n\tmovb\t%dl, -48(%rbp,%rax)\n\tmovl\t-68(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -68(%rbp)\n.L8:\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L9\n\tjmp\t.L10\n.L11:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar_unlocked@PLT\n.L10:\n\tmovl\t-52(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L11\n.L6:\n\tmovl\t$10, %edi\n\tcall\tputchar_unlocked@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tout, .-out\n\t.globl\tbit\n\t.bss\n\t.align 32\n\t.type\tbit, @object\n\t.size\tbit, 800040\nbit:\n\t.zero\t800040\n\t.globl\tbmax\n\t.align 4\n\t.type\tbmax, @object\n\t.size\tbmax, 4\nbmax:\n\t.zero\t4\n\t.text\n\t.globl\tsum\n\t.type\tsum, @function\nsum:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tbit(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$1, %eax\n\tandl\t%eax, -20(%rbp)\n.L14:\n\tcmpl\t$0, -20(%rbp)\n\tjg\t.L15\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsum, .-sum\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tjmp\t.L18\n.L19:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tbit(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tbit(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\t-4(%rbp), %eax\n\tnegl\t%eax\n\tandl\t-4(%rbp), %eax\n\taddl\t%eax, -4(%rbp)\n.L18:\n\tmovl\tbmax(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjle\t.L19\n\tnop\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tadd, .-add\n\t.globl\tN\n\t.bss\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\thi\n\t.align 32\n\t.type\thi, @object\n\t.size\thi, 400020\nhi:\n\t.zero\t400020\n\t.globl\tto\n\t.align 32\n\t.type\tto, @object\n\t.size\tto, 800040\nto:\n\t.zero\t800040\n\t.globl\tidx\n\t.align 32\n\t.type\tidx, @object\n\t.size\tidx, 1600080\nidx:\n\t.zero\t1600080\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tque\n\t.align 32\n\t.type\tque, @object\n\t.size\tque, 800040\nque:\n\t.zero\t800040\n\t.globl\ttop\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.text\n\t.globl\teularTour\n\t.type\teularTour, @function\neularTour:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$1, sz(%rip)\n\tmovl\t$0, que(%rip)\n\tmovl\t$1, top(%rip)\n\tjmp\t.L21\n.L25:\n\tmovl\ttop(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tmovl\ttop(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tque(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tjns\t.L22\n\tnegl\t-4(%rbp)\n\tmovl\tsz(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, sz(%rip)\n\tmovl\t-4(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\t4+idx(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tjmp\t.L21\n.L22:\n\tmovl\ttop(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, %ecx\n\tnotl\t%ecx\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tque(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\tsz(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, sz(%rip)\n\tmovl\t-4(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\tidx(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L23\n.L24:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tto(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\ttop(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tmovl\t(%rcx), %edx\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tque(%rip), %rax\n\tmovl\t%edx, (%rcx,%rax)\n\taddl\t$1, -8(%rbp)\n.L23:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\thi(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L24\n.L21:\n\tmovl\ttop(%rip), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L25\n\tnop\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\teularTour, .-eularTour\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, N(%rip)\n\tmovl\t$0, -48(%rbp)\n\tjmp\t.L27\n.L31:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\thi(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tcmpl\t$0, -20(%rbp)\n\tjle\t.L28\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rcx\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tto(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tmovl\t$0, -44(%rbp)\n\tjmp\t.L29\n.L30:\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tto(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovl\t-44(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tleaq\t(%rdx,%rax), %rbx\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, (%rbx)\n\taddl\t$1, -44(%rbp)\n.L29:\n\tmovl\t-44(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L30\n.L28:\n\taddl\t$1, -48(%rbp)\n.L27:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -48(%rbp)\n\tjl\t.L31\n\tmovl\t$0, %eax\n\tcall\teularTour\n\tmovl\tsz(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, bmax(%rip)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -40(%rbp)\n\tjmp\t.L32\n.L35:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -36(%rbp)\n\tcmpl\t$0, -36(%rbp)\n\tjne\t.L33\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tidx(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-24(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tmovl\t-24(%rbp), %eax\n\tnegl\t%eax\n\tmovl\t%eax, %edx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\t4+idx(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tjmp\t.L32\n.L33:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -32(%rbp)\n\tcmpl\t$0, -32(%rbp)\n\tjne\t.L34\n\tmovl\t$0, %edi\n\tcall\tout\n\tjmp\t.L32\n.L34:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tidx(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, %edi\n\tcall\tsum\n\tmovl\t%eax, %edi\n\tcall\tout\n.L32:\n\tmovl\t-40(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -40(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L35\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L3:\n\txorl\t%r12d, %r12d\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L1\n.L5:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L7:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L4\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L1\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L1:\n\tmovl\t%r12d, %eax\n\tpopq\t%r12\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L3\n\t.cfi_endproc\n.LFE39:\n\t.size\tin, .-in\n\t.p2align 4\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tmovl\t%edi, %ebx\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t48(%rdi), %rdx\n\tmovq\t40(%rdi), %rax\n\ttestl\t%ebx, %ebx\n\tjne\t.L13\n\tcmpq\t%rdx, %rax\n\tjnb\t.L30\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$48, (%rax)\n.L15:\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L31\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$10, (%rax)\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L29\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\t.cfi_restore_state\n\tjs\t.L32\n.L16:\n\txorl\t%ecx, %ecx\n\tmovq\t%rsp, %rdx\n\tmovl\t$3435973837, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\tmovl\t%ebx, %eax\n\tmovslq\t%ecx, %r8\n\timulq\t%r9, %rax\n\tshrq\t$35, %rax\n\tleal\t(%rax,%rax,4), %esi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %ebx\n\taddl\t$48, %ebx\n\tmovb\t%bl, (%rdx,%rcx)\n\tmovl\t%eax, %ebx\n\tmovq\t%rcx, %rax\n\taddq\t$1, %rcx\n\ttestl\t%ebx, %ebx\n\tjne\t.L19\n\tleaq\t-1(%rsp,%r8), %rbp\n\tleaq\t(%rdx,%r8), %rbx\n\tsubq\t%rax, %rbp\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovq\tstdout(%rip), %rdi\n.L22:\n\tmovzbl\t(%rbx), %esi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L33\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t%sil, (%rax)\n.L21:\n\tsubq\t$1, %rbx\n\tcmpq\t%rbx, %rbp\n\tjne\t.L34\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tcmpq\t%rdx, %rax\n\tjnb\t.L35\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$45, (%rax)\n.L18:\n\tmovq\tstdout(%rip), %rdi\n\tnegl\t%ebx\n\tjmp\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\tcall\t__overflow@PLT\n\tjmp\t.L21\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovl\t$48, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L29\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %esi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\t__overflow@PLT\n.L35:\n\t.cfi_restore_state\n\tmovl\t$45, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L18\n.L29:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE40:\n\t.size\tout, .-out\n\t.p2align 4\n\t.globl\tsum\n\t.type\tsum, @function\nsum:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tjle\t.L36\n\tleaq\tbit(%rip), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\tmovslq\t%edi, %rax\n\taddl\t(%rdx,%rax,4), %r8d\n\tleal\t-1(%rdi), %eax\n\tandl\t%eax, %edi\n\tjne\t.L38\n.L36:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tsum, .-sum\n\t.p2align 4\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tbmax(%rip), %ecx\n\tcmpl\t%ecx, %edi\n\tjg\t.L41\n\tleaq\tbit(%rip), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovslq\t%edi, %rax\n\taddl\t%esi, (%rdx,%rax,4)\n\tmovl\t%edi, %eax\n\tnegl\t%eax\n\tandl\t%edi, %eax\n\taddl\t%eax, %edi\n\tcmpl\t%ecx, %edi\n\tjle\t.L43\n.L41:\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tadd, .-add\n\t.p2align 4\n\t.globl\teularTour\n\t.type\teularTour, @function\neularTour:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tque(%rip), %r10\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t$1, %esi\n\txorl\t%eax, %eax\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovl\t$1, %ecx\n\txorl\t%edx, %edx\n\tleaq\tidx(%rip), %r11\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\tto(%rip), %rbp\n\tleaq\t-4(%r10), %r8\n\tmovl\t$0, que(%rip)\n\tleaq\thi(%rip), %rbx\n\tjmp\t.L50\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovslq\t%edi, %rdi\n\tmovl\t%r9d, sz(%rip)\n\tmovl\t%edx, %ecx\n\tmovl\t%esi, 4(%r11,%rdi,8)\n.L47:\n\ttestl\t%ecx, %ecx\n\tje\t.L45\n.L54:\n\tleal\t-1(%rcx), %edx\n\tmovl\t%r9d, %esi\n\tmovslq\t%edx, %rax\n\tmovl\t(%r10,%rax,4), %eax\n.L50:\n\tmovl\t%eax, %edi\n\tmovl\t%edx, top(%rip)\n\tleal\t1(%rsi), %r9d\n\tnotl\t%edi\n\ttestl\t%eax, %eax\n\tjs\t.L53\n\tmovslq\t%edx, %rdx\n\tmovl\t%ecx, top(%rip)\n\tmovl\t%edi, (%r10,%rdx,4)\n\tmovslq\t%eax, %rdx\n\tmovl\t(%rbx,%rdx,4), %r12d\n\tmovl\t%r9d, sz(%rip)\n\tmovl\t%esi, (%r11,%rdx,8)\n\ttestl\t%r12d, %r12d\n\tjle\t.L47\n\tmovslq\t%ecx, %rsi\n\tmovq\t0(%rbp,%rdx,8), %rdx\n\tleal\t-1(%r12), %edi\n\tleal\t1(%rcx), %eax\n\tleaq\t2(%rsi,%rdi), %rdi\n\tnegq\t%rsi\n\tcltq\n\tleaq\t(%rdx,%rsi,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovl\t%eax, top(%rip)\n\tmovl\t-4(%rsi,%rax,4), %edx\n\tmovl\t%edx, (%r8,%rax,4)\n\taddq\t$1, %rax\n\tcmpq\t%rax, %rdi\n\tjne\t.L48\n\taddl\t%r12d, %ecx\n\ttestl\t%ecx, %ecx\n\tjne\t.L54\n.L45:\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\teularTour, .-eularTour\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tleaq\tto(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\txorl\t%ebp, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcall\tin\n\tmovl\t%eax, N(%rip)\n\ttestl\t%eax, %eax\n\tjle\t.L73\n\t.p2align 4,,10\n\t.p2align 3\n.L56:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L134\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L60:\n\txorl\t%r12d, %r12d\n\tjmp\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L61:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L63\n.L62:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L64:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rdx, %rcx\n\tja\t.L61\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L63\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L62\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tleaq\thi(%rip), %rax\n\tmovl\t%r12d, (%rax,%rbp,4)\n\ttestl\t%r12d, %r12d\n\tjne\t.L135\n.L65:\n\taddq\t$1, %rbp\n\tcmpl\t%ebp, N(%rip)\n\tjg\t.L56\n.L73:\n\txorl\t%eax, %eax\n\tleaq\tidx(%rip), %rbp\n\tleaq\tbit(%rip), %r13\n\tcall\teularTour\n\tmovl\tsz(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, bmax(%rip)\n\txorl\t%eax, %eax\n\tcall\tin\n\tmovl\t%eax, %ebx\n\ttestl\t%eax, %eax\n\tje\t.L131\n\t.p2align 4,,10\n\t.p2align 3\n.L110:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L136\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L75:\n\txorl\t%r12d, %r12d\n\tjmp\t.L79\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\tleaq\t1(%rdx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L78\n.L77:\n\tmovq\t%rsi, %rdx\n.L79:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L76\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rcx\n\tcmpl\t$47, %eax\n\tjg\t.L77\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\ttestl\t%r12d, %r12d\n\tje\t.L137\n\tcmpq\t%rsi, %rcx\n\tjbe\t.L138\n\tleaq\t1(%rsi), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L99:\n\txorl\t%r12d, %r12d\n\tjmp\t.L103\n\t.p2align 4,,10\n\t.p2align 3\n.L100:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L102\n.L101:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L103:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L100\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L102\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L101\n\t.p2align 4,,10\n\t.p2align 3\n.L102:\n\ttestl\t%r12d, %r12d\n\tjne\t.L104\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L139\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$48, (%rax)\n.L106:\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L140\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$10, (%rax)\n.L97:\n\tsubl\t$1, %ebx\n\tjne\t.L110\n.L131:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L104:\n\t.cfi_restore_state\n\tmovslq\t%r12d, %r12\n\txorl\t%edi, %edi\n\tmovl\t0(%rbp,%r12,8), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L108\n\t.p2align 4,,10\n\t.p2align 3\n.L109:\n\tmovslq\t%eax, %rdx\n\taddl\t0(%r13,%rdx,4), %edi\n\tleal\t-1(%rax), %edx\n\tandl\t%edx, %eax\n\tjne\t.L109\n.L108:\n\tcall\tout\n\tjmp\t.L97\n\t.p2align 4,,10\n\t.p2align 3\n.L137:\n\tcmpq\t%rsi, %rcx\n\tjbe\t.L141\n\tleaq\t1(%rsi), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L82:\n\txorl\t%r14d, %r14d\n\tjmp\t.L86\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\tleaq\t1(%rdx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L85\n.L84:\n\tmovq\t%rsi, %rdx\n.L86:\n\tleal\t(%r14,%r14,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r14d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L83\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rcx\n\tcmpl\t$47, %eax\n\tjg\t.L84\n\t.p2align 4,,10\n\t.p2align 3\n.L85:\n\tcmpq\t%rsi, %rcx\n\tjbe\t.L142\n\tleaq\t1(%rsi), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L89:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L91\n.L90:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L92:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L89\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L91\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L90\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\tmovslq\t%r14d, %r14\n\tmovl\tbmax(%rip), %ecx\n\tmovl\t0(%rbp,%r14,8), %eax\n\tcmpl\t%ecx, %eax\n\tjg\t.L96\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovslq\t%eax, %rdx\n\taddl\t%r12d, 0(%r13,%rdx,4)\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tandl\t%eax, %edx\n\taddl\t%edx, %eax\n\tcmpl\t%ecx, %eax\n\tjle\t.L93\n.L96:\n\tmovl\t4(%rbp,%r14,8), %eax\n\tcmpl\t%ecx, %eax\n\tjg\t.L97\n\t.p2align 4,,10\n\t.p2align 3\n.L94:\n\tmovslq\t%eax, %rdx\n\tsubl\t%r12d, 0(%r13,%rdx,4)\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tandl\t%eax, %edx\n\taddl\t%edx, %eax\n\tcmpl\t%ecx, %eax\n\tjle\t.L94\n\tjmp\t.L97\n\t.p2align 4,,10\n\t.p2align 3\n.L135:\n\tmovslq\t%r12d, %rdi\n\tsubl\t$1, %r12d\n\txorl\t%r14d, %r14d\n\tsalq\t$2, %rdi\n\tsalq\t$2, %r12\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 0(%r13,%rbp,8)\n\tmovq\t%rax, %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L72:\n\tmovq\tstdin(%rip), %rdi\n\taddq\t%r14, %rbx\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rsi\n\tcmpq\t%rsi, %rax\n\tjnb\t.L143\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L67:\n\txorl\t%r15d, %r15d\n\tjmp\t.L71\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L70\n.L69:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rsi\n.L71:\n\tleal\t(%r15,%r15,4), %r8d\n\tandl\t$15, %eax\n\tleal\t(%rax,%r8,2), %r15d\n\tcmpq\t%rsi, %rdx\n\tjb\t.L68\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L70\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L69\n\t.p2align 4,,10\n\t.p2align 3\n.L70:\n\tmovl\t%r15d, (%rbx)\n\tcmpq\t%r14, %r12\n\tje\t.L65\n\tmovq\t0(%r13,%rbp,8), %rbx\n\taddq\t$4, %r14\n\tjmp\t.L72\n\t.p2align 4,,10\n\t.p2align 3\n.L143:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rsi\n\tjmp\t.L67\n.L134:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L60\n.L136:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L75\n.L138:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L99\n.L139:\n\tmovl\t$48, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L106\n.L140:\n\tmovl\t$10, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L97\n.L142:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L92\n.L141:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L82\n\t.cfi_endproc\n.LFE44:\n\t.size\tmain, .-main\n\t.globl\ttop\n\t.bss\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.globl\tque\n\t.align 32\n\t.type\tque, @object\n\t.size\tque, 800040\nque:\n\t.zero\t800040\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tidx\n\t.align 32\n\t.type\tidx, @object\n\t.size\tidx, 1600080\nidx:\n\t.zero\t1600080\n\t.globl\tto\n\t.align 32\n\t.type\tto, @object\n\t.size\tto, 800040\nto:\n\t.zero\t800040\n\t.globl\thi\n\t.align 32\n\t.type\thi, @object\n\t.size\thi, 400020\nhi:\n\t.zero\t400020\n\t.globl\tN\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\tbmax\n\t.align 4\n\t.type\tbmax, @object\n\t.size\tbmax, 4\nbmax:\n\t.zero\t4\n\t.globl\tbit\n\t.align 32\n\t.type\tbit, @object\n\t.size\tbit, 800040\nbit:\n\t.zero\t800040\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L3:\n\txorl\t%r12d, %r12d\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L1\n.L5:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L7:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L4\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L1\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L1:\n\tmovl\t%r12d, %eax\n\tpopq\t%r12\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L3\n\t.cfi_endproc\n.LFE39:\n\t.size\tin, .-in\n\t.p2align 4\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tmovl\t%edi, %ebx\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t48(%rdi), %rdx\n\tmovq\t40(%rdi), %rax\n\ttestl\t%ebx, %ebx\n\tjne\t.L13\n\tcmpq\t%rdx, %rax\n\tjnb\t.L30\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$48, (%rax)\n.L15:\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L31\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$10, (%rax)\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L29\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\t.cfi_restore_state\n\tjs\t.L32\n.L16:\n\txorl\t%ecx, %ecx\n\tmovq\t%rsp, %rdx\n\tmovl\t$3435973837, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\tmovl\t%ebx, %eax\n\tmovslq\t%ecx, %r8\n\timulq\t%r9, %rax\n\tshrq\t$35, %rax\n\tleal\t(%rax,%rax,4), %esi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %ebx\n\taddl\t$48, %ebx\n\tmovb\t%bl, (%rdx,%rcx)\n\tmovl\t%eax, %ebx\n\tmovq\t%rcx, %rax\n\taddq\t$1, %rcx\n\ttestl\t%ebx, %ebx\n\tjne\t.L19\n\tleaq\t-1(%rsp,%r8), %rbp\n\tleaq\t(%rdx,%r8), %rbx\n\tsubq\t%rax, %rbp\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovq\tstdout(%rip), %rdi\n.L22:\n\tmovzbl\t(%rbx), %esi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L33\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t%sil, (%rax)\n.L21:\n\tsubq\t$1, %rbx\n\tcmpq\t%rbx, %rbp\n\tjne\t.L34\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tcmpq\t%rdx, %rax\n\tjnb\t.L35\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$45, (%rax)\n.L18:\n\tmovq\tstdout(%rip), %rdi\n\tnegl\t%ebx\n\tjmp\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\tcall\t__overflow@PLT\n\tjmp\t.L21\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovl\t$48, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L29\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %esi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\t__overflow@PLT\n.L35:\n\t.cfi_restore_state\n\tmovl\t$45, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L18\n.L29:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE40:\n\t.size\tout, .-out\n\t.p2align 4\n\t.globl\tsum\n\t.type\tsum, @function\nsum:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tjle\t.L36\n\tleaq\tbit(%rip), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\tmovslq\t%edi, %rax\n\taddl\t(%rdx,%rax,4), %r8d\n\tleal\t-1(%rdi), %eax\n\tandl\t%eax, %edi\n\tjne\t.L38\n.L36:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tsum, .-sum\n\t.p2align 4\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tbmax(%rip), %ecx\n\tcmpl\t%ecx, %edi\n\tjg\t.L41\n\tleaq\tbit(%rip), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovslq\t%edi, %rax\n\taddl\t%esi, (%rdx,%rax,4)\n\tmovl\t%edi, %eax\n\tnegl\t%eax\n\tandl\t%edi, %eax\n\taddl\t%eax, %edi\n\tcmpl\t%ecx, %edi\n\tjle\t.L43\n.L41:\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tadd, .-add\n\t.p2align 4\n\t.globl\teularTour\n\t.type\teularTour, @function\neularTour:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tque(%rip), %r10\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tmovl\t$1, %esi\n\txorl\t%eax, %eax\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovl\t$1, %ecx\n\txorl\t%edx, %edx\n\tleaq\tidx(%rip), %r11\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\tto(%rip), %rbp\n\tleaq\t-4(%r10), %r8\n\tmovl\t$0, que(%rip)\n\tleaq\thi(%rip), %rbx\n\tjmp\t.L50\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovslq\t%edi, %rdi\n\tmovl\t%r9d, sz(%rip)\n\tmovl\t%edx, %ecx\n\tmovl\t%esi, 4(%r11,%rdi,8)\n.L47:\n\ttestl\t%ecx, %ecx\n\tje\t.L45\n.L54:\n\tleal\t-1(%rcx), %edx\n\tmovl\t%r9d, %esi\n\tmovslq\t%edx, %rax\n\tmovl\t(%r10,%rax,4), %eax\n.L50:\n\tmovl\t%eax, %edi\n\tmovl\t%edx, top(%rip)\n\tleal\t1(%rsi), %r9d\n\tnotl\t%edi\n\ttestl\t%eax, %eax\n\tjs\t.L53\n\tmovslq\t%edx, %rdx\n\tmovl\t%ecx, top(%rip)\n\tmovl\t%edi, (%r10,%rdx,4)\n\tmovslq\t%eax, %rdx\n\tmovl\t(%rbx,%rdx,4), %r12d\n\tmovl\t%r9d, sz(%rip)\n\tmovl\t%esi, (%r11,%rdx,8)\n\ttestl\t%r12d, %r12d\n\tjle\t.L47\n\tmovslq\t%ecx, %rsi\n\tmovq\t0(%rbp,%rdx,8), %rdx\n\tleal\t-1(%r12), %edi\n\tleal\t1(%rcx), %eax\n\tleaq\t2(%rsi,%rdi), %rdi\n\tnegq\t%rsi\n\tcltq\n\tleaq\t(%rdx,%rsi,4), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovl\t%eax, top(%rip)\n\tmovl\t-4(%rsi,%rax,4), %edx\n\tmovl\t%edx, (%r8,%rax,4)\n\taddq\t$1, %rax\n\tcmpq\t%rax, %rdi\n\tjne\t.L48\n\taddl\t%r12d, %ecx\n\ttestl\t%ecx, %ecx\n\tjne\t.L54\n.L45:\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\teularTour, .-eularTour\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tleaq\tto(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\txorl\t%ebp, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcall\tin\n\tmovl\t%eax, N(%rip)\n\ttestl\t%eax, %eax\n\tjle\t.L73\n\t.p2align 4,,10\n\t.p2align 3\n.L56:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L134\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L60:\n\txorl\t%r12d, %r12d\n\tjmp\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L61:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L63\n.L62:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L64:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rdx, %rcx\n\tja\t.L61\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L63\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L62\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tleaq\thi(%rip), %rax\n\tmovl\t%r12d, (%rax,%rbp,4)\n\ttestl\t%r12d, %r12d\n\tjne\t.L135\n.L65:\n\taddq\t$1, %rbp\n\tcmpl\t%ebp, N(%rip)\n\tjg\t.L56\n.L73:\n\txorl\t%eax, %eax\n\tleaq\tidx(%rip), %rbp\n\tleaq\tbit(%rip), %r13\n\tcall\teularTour\n\tmovl\tsz(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, bmax(%rip)\n\txorl\t%eax, %eax\n\tcall\tin\n\tmovl\t%eax, %ebx\n\ttestl\t%eax, %eax\n\tje\t.L131\n\t.p2align 4,,10\n\t.p2align 3\n.L110:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L136\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L75:\n\txorl\t%r12d, %r12d\n\tjmp\t.L79\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\tleaq\t1(%rdx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L78\n.L77:\n\tmovq\t%rsi, %rdx\n.L79:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L76\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rcx\n\tcmpl\t$47, %eax\n\tjg\t.L77\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\ttestl\t%r12d, %r12d\n\tje\t.L137\n\tcmpq\t%rsi, %rcx\n\tjbe\t.L138\n\tleaq\t1(%rsi), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L99:\n\txorl\t%r12d, %r12d\n\tjmp\t.L103\n\t.p2align 4,,10\n\t.p2align 3\n.L100:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L102\n.L101:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L103:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L100\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L102\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L101\n\t.p2align 4,,10\n\t.p2align 3\n.L102:\n\ttestl\t%r12d, %r12d\n\tjne\t.L104\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L139\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$48, (%rax)\n.L106:\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L140\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$10, (%rax)\n.L97:\n\tsubl\t$1, %ebx\n\tjne\t.L110\n.L131:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L104:\n\t.cfi_restore_state\n\tmovslq\t%r12d, %r12\n\txorl\t%edi, %edi\n\tmovl\t0(%rbp,%r12,8), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L108\n\t.p2align 4,,10\n\t.p2align 3\n.L109:\n\tmovslq\t%eax, %rdx\n\taddl\t0(%r13,%rdx,4), %edi\n\tleal\t-1(%rax), %edx\n\tandl\t%edx, %eax\n\tjne\t.L109\n.L108:\n\tcall\tout\n\tjmp\t.L97\n\t.p2align 4,,10\n\t.p2align 3\n.L137:\n\tcmpq\t%rsi, %rcx\n\tjbe\t.L141\n\tleaq\t1(%rsi), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L82:\n\txorl\t%r14d, %r14d\n\tjmp\t.L86\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\tleaq\t1(%rdx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L85\n.L84:\n\tmovq\t%rsi, %rdx\n.L86:\n\tleal\t(%r14,%r14,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r14d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L83\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rcx\n\tcmpl\t$47, %eax\n\tjg\t.L84\n\t.p2align 4,,10\n\t.p2align 3\n.L85:\n\tcmpq\t%rsi, %rcx\n\tjbe\t.L142\n\tleaq\t1(%rsi), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L89:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L91\n.L90:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L92:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L89\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L91\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L90\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\tmovslq\t%r14d, %r14\n\tmovl\tbmax(%rip), %ecx\n\tmovl\t0(%rbp,%r14,8), %eax\n\tcmpl\t%ecx, %eax\n\tjg\t.L96\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovslq\t%eax, %rdx\n\taddl\t%r12d, 0(%r13,%rdx,4)\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tandl\t%eax, %edx\n\taddl\t%edx, %eax\n\tcmpl\t%ecx, %eax\n\tjle\t.L93\n.L96:\n\tmovl\t4(%rbp,%r14,8), %eax\n\tcmpl\t%ecx, %eax\n\tjg\t.L97\n\t.p2align 4,,10\n\t.p2align 3\n.L94:\n\tmovslq\t%eax, %rdx\n\tsubl\t%r12d, 0(%r13,%rdx,4)\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tandl\t%eax, %edx\n\taddl\t%edx, %eax\n\tcmpl\t%ecx, %eax\n\tjle\t.L94\n\tjmp\t.L97\n\t.p2align 4,,10\n\t.p2align 3\n.L135:\n\tmovslq\t%r12d, %rdi\n\tsubl\t$1, %r12d\n\txorl\t%r14d, %r14d\n\tsalq\t$2, %rdi\n\tsalq\t$2, %r12\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 0(%r13,%rbp,8)\n\tmovq\t%rax, %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L72:\n\tmovq\tstdin(%rip), %rdi\n\taddq\t%r14, %rbx\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rsi\n\tcmpq\t%rsi, %rax\n\tjnb\t.L143\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L67:\n\txorl\t%r15d, %r15d\n\tjmp\t.L71\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L70\n.L69:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rsi\n.L71:\n\tleal\t(%r15,%r15,4), %r8d\n\tandl\t$15, %eax\n\tleal\t(%rax,%r8,2), %r15d\n\tcmpq\t%rsi, %rdx\n\tjb\t.L68\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L70\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L69\n\t.p2align 4,,10\n\t.p2align 3\n.L70:\n\tmovl\t%r15d, (%rbx)\n\tcmpq\t%r14, %r12\n\tje\t.L65\n\tmovq\t0(%r13,%rbp,8), %rbx\n\taddq\t$4, %r14\n\tjmp\t.L72\n\t.p2align 4,,10\n\t.p2align 3\n.L143:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rsi\n\tjmp\t.L67\n.L134:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L60\n.L136:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L75\n.L138:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L99\n.L139:\n\tmovl\t$48, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L106\n.L140:\n\tmovl\t$10, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L97\n.L142:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L92\n.L141:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L82\n\t.cfi_endproc\n.LFE44:\n\t.size\tmain, .-main\n\t.globl\ttop\n\t.bss\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.globl\tque\n\t.align 32\n\t.type\tque, @object\n\t.size\tque, 800040\nque:\n\t.zero\t800040\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tidx\n\t.align 32\n\t.type\tidx, @object\n\t.size\tidx, 1600080\nidx:\n\t.zero\t1600080\n\t.globl\tto\n\t.align 32\n\t.type\tto, @object\n\t.size\tto, 800040\nto:\n\t.zero\t800040\n\t.globl\thi\n\t.align 32\n\t.type\thi, @object\n\t.size\thi, 400020\nhi:\n\t.zero\t400020\n\t.globl\tN\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\tbmax\n\t.align 4\n\t.type\tbmax, @object\n\t.size\tbmax, 4\nbmax:\n\t.zero\t4\n\t.globl\tbit\n\t.align 32\n\t.type\tbit, @object\n\t.size\tbit, 800040\nbit:\n\t.zero\t800040\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "// 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 gc() getchar_unlocked()\n#define pc(c) putchar_unlocked(c)\n#else\n#define gc() getchar()\n#define pc(c) putchar(c)\n#endif\nint in()\n{\n\tint n = 0, c = gc();\n\tdo n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');\n\treturn n;\n}\n\nvoid out(int n)\n{\n\tint i;\n\tchar ob[40];\n\n\tif (!n) pc('0');\n\telse {\n\t\tif (n < 0) pc('-'), n = -n;\n\t\ti = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;\n\t\twhile (i--) pc(ob[i]);\n\t}\n\tpc('\\n');\n}\n\n\n//// BIT library\n#define MAX 100005\nint bit[2*MAX]; int bmax;\n\nint sum(int i)\n{\n\tint s = 0;\n\n\twhile (i > 0) {\n\t\ts += bit[i];\n\t\ti -= i & -i;\n\t}\n\treturn s;\n}\n\nvoid add(int i, int v)\n{\n\twhile (i <= bmax) {\n\t\tbit[i] += v;\n\t\ti += i & -i;\n\t}\n}\n\n\n//// 本問題関連\nint N;\nint hi[MAX], *to[MAX];\nint idx[2*MAX][2]; int sz;\nint que[2*MAX], top;\n\nvoid eularTour()\n{\n\tint i, node;\n\n\tsz = 1;\n\n\t// 非再帰dfs\n\tque[0] = 0, top = 1;\n\twhile (top) {\n\t\tnode = que[--top];\n\n\t\t// dfsにする\n\t\tif (node < 0) {\n\t\t\tnode = -node;\n\t\t\tidx[node - 1][1] = sz++;\n\t\t\tcontinue;\n\t\t}\n\t\tque[top++] = -(node + 1);\n\n\t\tidx[node][0] = sz++;\n\t\tfor (i = 0; i < hi[node]; i++) que[top++] = to[node][i];\n\t}\n\n#if 0\n\tint j;\n\tfor (j = 0; j <= 1; j++) {\n\t\tfor (i = 0; i < sz; i++) printf(\"%3d \", idx[i][j]); printf(\"\\n\");\n\t}\n#endif\n}\n\nint main()\n{\n\tint i, j, k, Q;\n\tint cmd;\n\n\tN = in();\n\tfor (i = 0; i < N; i++) {\n\t\thi[i] = k = in();\n\t\tif (k > 0) {\n\t\t\tto[i] = malloc(sizeof(int)*k);\n\t\t\tfor (j = 0; j < k; j++) to[i][j] = in();\n\t\t}\n\t}\n\teularTour();\n\tbmax = sz + 1;\n\n\tQ = in();\n\twhile (Q--) {\n\t\tcmd = in();\n\t\tif (cmd == 0) { // add(v, w)\n\t\t\tint v, w;\n\t\t\tv = in(), w = in();\n\t\t\tadd(idx[v][0], w);\n\t\t\tadd(idx[v][1], -w);\n\t\t}\n\t\telse { // getSum(u)\n\t\t\tint u = in();\n\t\t\tif (u == 0) out(0);\n\t\t\telse out(sum(idx[u][0]));\n\t\t}\n\t}\n\treturn 0;\n}\n", "index": 71, "inputs": [ "2\n1 1\n0\n5\n0 1 1\n1 1\n0 1 1\n1 1\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n0 1 1\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 2\n0 4 20\n1 3\n0 5 40\n1 4\n", "2\n1 1\n0\n4\n0 1 1\n1 1\n0 1 1\n1 2\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1000\n0 2 1000\n0 1 1000\n1 1\n1 2\n1 4\n", "2\n1 1\n0\n5\n0 1 1\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n1 1 1\n1 1\n", "2\n1 1\n0\n7\n0 1 1\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n5\n0 1 1\n1 1\n1 1 1\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 20\n1 5\n0 5 40\n1 4\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n5\n1 1 2\n1 1\n1 1 1\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 20\n1 5\n0 5 40\n1 1\n", "2\n1 1\n0\n5\n0 1 0\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n4\n0 1 1\n0 1\n0 1 1\n1 1\n", "2\n1 1\n0\n7\n1 1 1\n1 1\n0 1 1\n1 2\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1010\n0 1 1000\n0 1 1000\n1 1\n1 2\n1 4\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n1 4 20\n1 5\n0 5 40\n1 7\n", "2\n1 1\n0\n9\n1 2 2\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n2\n0 1 1\n1 1\n0 1 1\n1 2\n", "4\n1 1\n1 2\n1 3\n0\n7\n0 3 1000\n0 2 1000\n0 1 1000\n1 1\n1 2\n1 3\n", "2\n1 1\n0\n5\n0 1 1\n0 1\n1 1 1\n1 1\n", "2\n1 1\n0\n5\n0 1 1\n1 0\n0 1 1\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 20\n1 3\n0 5 40\n1 0\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 23\n1 5\n0 5 40\n1 4\n", "2\n1 1\n0\n5\n1 1 0\n1 1\n1 1 1\n1 1\n", "2\n1 1\n0\n8\n0 1 1\n1 1\n0 1 0\n1 2\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1010\n0 1 1000\n0 1 1010\n1 1\n1 2\n1 4\n", "2\n1 1\n0\n14\n1 2 3\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n2\n0 1 2\n1 1\n0 1 1\n1 2\n", "4\n1 1\n1 2\n1 3\n0\n7\n0 3 1000\n0 2 1000\n0 1 1000\n1 1\n1 0\n1 3\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1001\n0 2 1000\n0 1 1100\n1 1\n1 2\n1 4\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 11\n1 4\n0 4 20\n1 3\n0 5 40\n1 0\n", "2\n1 1\n0\n5\n0 1 1\n0 1\n2 1 1\n1 1\n", "2\n1 1\n0\n3\n1 1 0\n1 1\n1 1 1\n1 1\n", "2\n1 1\n0\n12\n1 4 2\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n5\n0 1 1\n0 1\n2 1 2\n1 1\n", "2\n1 1\n0\n8\n1 1 1\n1 1\n0 1 2\n1 0\n", "2\n1 1\n0\n7\n0 1 1\n1 1\n0 1 -2\n1 1\n", "2\n1 1\n0\n16\n1 0 2\n1 1\n0 2 2\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 3 10\n1 2\n0 2 20\n1 3\n0 5 40\n1 4\n", "2\n1 1\n0\n5\n0 1 3\n1 1\n0 1 1\n1 1\n", "2\n1 1\n0\n5\n0 1 0\n1 1\n0 1 1\n1 1\n", "2\n1 1\n0\n4\n0 1 1\n1 0\n0 1 0\n1 2\n", "2\n1 1\n0\n6\n0 1 1\n1 1\n0 1 0\n1 0\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 1 10\n1 4\n0 4 7\n1 5\n0 5 40\n1 1\n", "2\n1 1\n0\n5\n1 1 0\n1 2\n1 1 1\n1 1\n", "2\n1 1\n0\n5\n0 1 1\n0 1\n2 1 1\n1 0\n", "2\n1 1\n0\n3\n1 1 0\n1 2\n1 1 1\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n11\n1 0\n0 3 10\n1 4\n1 4 31\n0 5\n0 5 40\n1 7\n", "2\n1 1\n0\n17\n1 1 3\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n7\n0 1 1\n0 1\n2 1 2\n1 1\n", "2\n1 1\n0\n8\n0 1 2\n1 1\n0 1 0\n1 0\n", "2\n0 2\n0\n9\n1 1 2\n1 1\n0 1 1\n1 1\n", "4\n1 1\n1 2\n1 3\n0\n9\n0 3 1011\n0 2 1000\n0 1 1100\n1 1\n1 2\n1 4\n", "2\n1 1\n0\n3\n0 1 1\n0 1\n2 1 1\n1 0\n", "2\n0 1\n0\n23\n1 1 3\n1 1\n2 1 1\n1 2\n", "2\n1 1\n0\n31\n1 2 3\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n41\n1 2 3\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n4\n1 2 0\n1 1\n1 0 1\n1 1\n", "2\n1 1\n0\n18\n2 2 2\n0 2\n1 1 1\n4 0\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 2 10\n1 2\n0 2 20\n1 3\n0 5 40\n1 4\n", "4\n1 1\n1 2\n1 3\n0\n12\n0 3 1000\n0 2 1000\n0 1 1000\n1 1\n1 2\n1 3\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n1 1 1\n0 1\n", "2\n1 1\n0\n5\n0 1 1\n1 1\n1 1 1\n0 1\n", "2\n1 1\n0\n7\n0 1 2\n1 1\n0 1 0\n1 2\n", "2\n1 1\n0\n13\n1 1 2\n1 1\n0 1 1\n1 2\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 3 10\n1 2\n0 4 20\n1 0\n0 3 40\n1 4\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1011\n0 1 1000\n0 1 1000\n1 0\n1 2\n1 4\n", "2\n1 1\n0\n5\n1 1 0\n1 1\n1 1 1\n2 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 1 20\n1 5\n0 5 40\n1 0\n", "2\n1 1\n0\n5\n0 1 -1\n1 1\n0 1 1\n1 3\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 20\n1 3\n0 5 40\n1 4\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1010\n0 2 1000\n0 1 1000\n1 1\n1 2\n1 4\n", "2\n1 1\n0\n7\n0 1 1\n1 1\n0 1 0\n1 2\n", "2\n1 1\n0\n5\n1 1 2\n1 1\n1 1 2\n1 1\n", "2\n1 1\n0\n5\n0 1 0\n0 1\n0 1 1\n1 2\n", "2\n1 1\n0\n5\n0 1 1\n1 1\n0 1 1\n1 0\n", "2\n1 1\n0\n4\n0 1 1\n1 1\n0 1 0\n1 2\n", "2\n1 1\n0\n5\n-1 1 2\n1 1\n1 1 1\n1 1\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 20\n1 5\n0 5 40\n1 7\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n0 1 2\n1 2\n", "2\n1 1\n0\n5\n1 1 2\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n7\n0 1 1\n1 1\n0 1 0\n1 0\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 0\n0 3 10\n1 4\n0 4 7\n1 5\n0 5 40\n1 1\n", "2\n1 1\n0\n5\n0 1 0\n1 1\n0 1 2\n1 2\n", "2\n1 1\n0\n5\n1 1 2\n1 1\n1 1 2\n1 0\n", "2\n1 1\n0\n5\n0 1 0\n1 1\n0 1 1\n1 0\n", "2\n1 1\n0\n5\n-1 1 2\n1 1\n1 1 0\n1 1\n", "2\n1 1\n0\n7\n1 1 2\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n-1 1 2\n1 2\n", "2\n1 1\n0\n5\n1 2 2\n1 1\n1 1 1\n1 2\n", "2\n1 1\n0\n5\n0 1 0\n1 1\n0 1 2\n1 4\n", "2\n1 1\n0\n5\n-1 1 2\n1 1\n0 1 0\n1 1\n", "2\n1 1\n0\n7\n1 1 2\n1 1\n0 1 2\n1 2\n", "2\n1 1\n0\n5\n0 1 2\n1 1\n-1 1 1\n1 2\n", "2\n1 1\n0\n5\n1 2 2\n1 1\n0 1 1\n1 2\n", "2\n1 1\n0\n5\n-1 1 2\n2 1\n0 1 0\n1 1\n", "2\n1 1\n0\n7\n2 1 2\n1 1\n0 1 2\n1 2\n", "2\n1 1\n0\n9\n1 2 2\n1 1\n1 1 1\n1 2\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 3 10\n1 2\n0 4 20\n1 3\n0 5 40\n1 4\n", "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 3 10\n1 2\n0 4 20\n1 3\n0 5 40\n1 4\n", "4\n1 1\n1 2\n1 3\n0\n6\n0 3 1000\n0 2 1000\n0 1 1000\n1 1\n1 2\n1 3\n", "2\n1 1\n0\n4\n0 1 1\n1 1\n0 1 1\n1 1\n" ], "outputs": [ "1\n2\n0\n", "2\n3\n0\n", "0\n0\n10\n60\n", "1\n0\n", "1000\n2000\n0\n", "1\n0\n0\n", "2\n2\n2\n0\n", "1\n0\n0\n0\n0\n", "1\n1\n1\n0\n", "0\n0\n0\n60\n", "2\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n", "0\n0\n0\n", "1\n1\n", "0\n0\n0\n0\n0\n0\n0\n", "2000\n2000\n0\n", "0\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n", "1\n", "1000\n2000\n3000\n0\n", "2\n2\n0\n", "0\n2\n0\n", "0\n0\n10\n0\n", "0\n0\n0\n63\n", "0\n1\n1\n0\n", "1\n0\n0\n0\n0\n0\n", "2010\n2010\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "2\n", "1000\n0\n3000\n0\n", "1100\n2100\n0\n", "0\n0\n11\n0\n", "3\n3\n0\n", "0\n1\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n3\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n", "1\n133\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n10\n40\n", "3\n4\n0\n", "0\n1\n0\n", "0\n0\n", "1\n0\n0\n0\n", "0\n10\n10\n10\n", "0\n2\n2\n0\n", "3\n0\n0\n", "0\n2\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n3\n0\n0\n0\n", "2\n0\n0\n0\n0\n0\n", "0\n", "1100\n2100\n0\n0\n0\n0\n", "3\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n1\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n10\n0\n40\n", "1000\n2000\n3000\n0\n0\n0\n0\n0\n0\n", "2\n2\n0\n0\n", "1\n1\n0\n0\n", "2\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n0\n20\n", "0\n2000\n0\n", "0\n1\n0\n0\n", "0\n0\n20\n0\n", "131\n0\n0\n", "0\n0\n10\n60\n", "1000\n2000\n0\n", "1\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n", "1\n0\n0\n", "1\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n", "2\n0\n0\n", "0\n0\n0\n0\n0\n", "1\n0\n0\n0\n0\n", "0\n0\n0\n0\n", "0\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n", "2\n2\n2\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n", "2\n2\n2\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n0\n0\n0\n0\n", "0\n0\n10\n60\n", "0\n0\n10\n60\n", "1000\n2000\n3000\n", "1\n2\n" ], "question": "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 gc() getchar_unlocked()\n#define pc(c) putchar_unlocked(c)\n#else\n#define gc() getchar()\n#define pc(c) putchar(c)\n#endif\nint in()\n{\n\tint n = 0, c = gc();\n\tdo n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');\n\treturn n;\n}\n\nvoid out(int n)\n{\n\tint i;\n\tchar ob[40];\n\n\tif (!n) pc('0');\n\telse {\n\t\tif (n < 0) pc('-'), n = -n;\n\t\ti = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;\n\t\twhile (i--) pc(ob[i]);\n\t}\n\tpc('\\n');\n}\n\n\n//// BIT library\n#define MAX 100005\nint bit[2*MAX]; int bmax;\n\nint sum(int i)\n{\n\tint s = 0;\n\n\twhile (i > 0) {\n\t\ts += bit[i];\n\t\ti -= i & -i;\n\t}\n\treturn s;\n}\n\nvoid add(int i, int v)\n{\n\twhile (i <= bmax) {\n\t\tbit[i] += v;\n\t\ti += i & -i;\n\t}\n}\n\n\n//// 本問題関連\nint N;\nint hi[MAX], *to[MAX];\nint idx[2*MAX][2]; int sz;\nint que[2*MAX], top;\n\nvoid eularTour()\n{\n\tint i, node;\n\n\tsz = 1;\n\n\t// 非再帰dfs\n\tque[0] = 0, top = 1;\n\twhile (top) {\n\t\tnode = que[--top];\n\n\t\t// dfsにする\n\t\tif (node < 0) {\n\t\t\tnode = -node;\n\t\t\tidx[node - 1][1] = sz++;\n\t\t\tcontinue;\n\t\t}\n\t\tque[top++] = -(node + 1);\n\n\t\tidx[node][0] = sz++;\n\t\tfor (i = 0; i < hi[node]; i++) que[top++] = to[node][i];\n\t}\n\n#if 0\n\tint j;\n\tfor (j = 0; j <= 1; j++) {\n\t\tfor (i = 0; i < sz; i++) printf(\"%3d \", idx[i][j]); printf(\"\\n\");\n\t}\n#endif\n}\n\nint main()\n{\n\tint i, j, k, Q;\n\tint cmd;\n\n\tN = in();\n\tfor (i = 0; i < N; i++) {\n\t\thi[i] = k = in();\n\t\tif (k > 0) {\n\t\t\tto[i] = malloc(sizeof(int)*k);\n\t\t\tfor (j = 0; j < k; j++) to[i][j] = in();\n\t\t}\n\t}\n\teularTour();\n\tbmax = sz + 1;\n\n\tQ = in();\n\twhile (Q--) {\n\t\tcmd = in();\n\t\tif (cmd == 0) { // add(v, w)\n\t\t\tint v, w;\n\t\t\tv = in(), w = in();\n\t\t\tadd(idx[v][0], w);\n\t\t\tadd(idx[v][1], -w);\n\t\t}\n\t\telse { // getSum(u)\n\t\t\tint u = in();\n\t\t\tif (u == 0) out(0);\n\t\t\telse out(sum(idx[u][0]));\n\t\t}\n\t}\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tandl\t$15, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$47, -4(%rbp)\n\tjg\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tin, .-in\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovl\t%edi, -68(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L5\n\tmovl\t$48, %edi\n\tcall\tputchar_unlocked@PLT\n\tjmp\t.L6\n.L5:\n\tcmpl\t$0, -68(%rbp)\n\tjns\t.L7\n\tmovl\t$45, %edi\n\tcall\tputchar_unlocked@PLT\n\tnegl\t-68(%rbp)\n.L7:\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-68(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tleal\t48(%rax), %ecx\n\tmovl\t-52(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t%ecx, %edx\n\tcltq\n\tmovb\t%dl, -48(%rbp,%rax)\n\tmovl\t-68(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -68(%rbp)\n.L8:\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L9\n\tjmp\t.L10\n.L11:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar_unlocked@PLT\n.L10:\n\tmovl\t-52(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L11\n.L6:\n\tmovl\t$10, %edi\n\tcall\tputchar_unlocked@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tout, .-out\n\t.globl\tbit\n\t.bss\n\t.align 32\n\t.type\tbit, @object\n\t.size\tbit, 800040\nbit:\n\t.zero\t800040\n\t.globl\tbmax\n\t.align 4\n\t.type\tbmax, @object\n\t.size\tbmax, 4\nbmax:\n\t.zero\t4\n\t.text\n\t.globl\tsum\n\t.type\tsum, @function\nsum:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tbit(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$1, %eax\n\tandl\t%eax, -20(%rbp)\n.L14:\n\tcmpl\t$0, -20(%rbp)\n\tjg\t.L15\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsum, .-sum\n\t.globl\tadd\n\t.type\tadd, @function\nadd:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tjmp\t.L18\n.L19:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tbit(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tbit(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\t-4(%rbp), %eax\n\tnegl\t%eax\n\tandl\t-4(%rbp), %eax\n\taddl\t%eax, -4(%rbp)\n.L18:\n\tmovl\tbmax(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjle\t.L19\n\tnop\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tadd, .-add\n\t.globl\tN\n\t.bss\n\t.align 4\n\t.type\tN, @object\n\t.size\tN, 4\nN:\n\t.zero\t4\n\t.globl\thi\n\t.align 32\n\t.type\thi, @object\n\t.size\thi, 400020\nhi:\n\t.zero\t400020\n\t.globl\tto\n\t.align 32\n\t.type\tto, @object\n\t.size\tto, 800040\nto:\n\t.zero\t800040\n\t.globl\tidx\n\t.align 32\n\t.type\tidx, @object\n\t.size\tidx, 1600080\nidx:\n\t.zero\t1600080\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tque\n\t.align 32\n\t.type\tque, @object\n\t.size\tque, 800040\nque:\n\t.zero\t800040\n\t.globl\ttop\n\t.align 4\n\t.type\ttop, @object\n\t.size\ttop, 4\ntop:\n\t.zero\t4\n\t.text\n\t.globl\teularTour\n\t.type\teularTour, @function\neularTour:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t$1, sz(%rip)\n\tmovl\t$0, que(%rip)\n\tmovl\t$1, top(%rip)\n\tjmp\t.L21\n.L25:\n\tmovl\ttop(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, top(%rip)\n\tmovl\ttop(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tque(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tjns\t.L22\n\tnegl\t-4(%rbp)\n\tmovl\tsz(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, sz(%rip)\n\tmovl\t-4(%rbp), %edx\n\tsubl\t$1, %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\t4+idx(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tjmp\t.L21\n.L22:\n\tmovl\ttop(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t%edx, %ecx\n\tnotl\t%ecx\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tque(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tmovl\tsz(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, sz(%rip)\n\tmovl\t-4(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\tidx(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L23\n.L24:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tto(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\ttop(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, top(%rip)\n\tmovl\t(%rcx), %edx\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tque(%rip), %rax\n\tmovl\t%edx, (%rcx,%rax)\n\taddl\t$1, -8(%rbp)\n.L23:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\thi(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L24\n.L21:\n\tmovl\ttop(%rip), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L25\n\tnop\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\teularTour, .-eularTour\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, N(%rip)\n\tmovl\t$0, -48(%rbp)\n\tjmp\t.L27\n.L31:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\thi(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tcmpl\t$0, -20(%rbp)\n\tjle\t.L28\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rcx\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tto(%rip), %rax\n\tmovq\t%rcx, (%rdx,%rax)\n\tmovl\t$0, -44(%rbp)\n\tjmp\t.L29\n.L30:\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tto(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovl\t-44(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tleaq\t(%rdx,%rax), %rbx\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, (%rbx)\n\taddl\t$1, -44(%rbp)\n.L29:\n\tmovl\t-44(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L30\n.L28:\n\taddl\t$1, -48(%rbp)\n.L27:\n\tmovl\tN(%rip), %eax\n\tcmpl\t%eax, -48(%rbp)\n\tjl\t.L31\n\tmovl\t$0, %eax\n\tcall\teularTour\n\tmovl\tsz(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, bmax(%rip)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -40(%rbp)\n\tjmp\t.L32\n.L35:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -36(%rbp)\n\tcmpl\t$0, -36(%rbp)\n\tjne\t.L33\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tidx(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-24(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tmovl\t-24(%rbp), %eax\n\tnegl\t%eax\n\tmovl\t%eax, %edx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\t4+idx(%rip), %rax\n\tmovl\t(%rcx,%rax), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tadd\n\tjmp\t.L32\n.L33:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -32(%rbp)\n\tcmpl\t$0, -32(%rbp)\n\tjne\t.L34\n\tmovl\t$0, %edi\n\tcall\tout\n\tjmp\t.L32\n.L34:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tidx(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, %edi\n\tcall\tsum\n\tmovl\t%eax, %edi\n\tcall\tout\n.L32:\n\tmovl\t-40(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -40(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L35\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 pc(c) putchar_unlocked(c) #else #define gc() getchar() #define pc(c) putchar(c) #endif int in() { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } void out(int n) { int i; char ob[40]; if (!n) pc('0'); else { if (n < 0) pc('-'), n = -n; i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10; while (i--) pc(ob[i]); } pc('\n'); } //// BIT library #define MAX 100005 int bit[2*MAX]; int bmax; int sum(int i) { int s = 0; while (i > 0) { s += bit[i]; i -= i & -i; } return s; } void add(int i, int v) { while (i <= bmax) { bit[i] += v; i += i & -i; } } //// 本問題関連 int N; int hi[MAX], *to[MAX]; int idx[2*MAX][2]; int sz; int que[2*MAX], top; void eularTour() { int i, node; sz = 1; // 非再帰dfs que[0] = 0, top = 1; while (top) { node = que[--top]; // dfsにする if (node < 0) { node = -node; idx[node - 1][1] = sz++; continue; } que[top++] = -(node + 1); idx[node][0] = sz++; for (i = 0; i < hi[node]; i++) que[top++] = to[node][i]; } #if 0 int j; for (j = 0; j <= 1; j++) { for (i = 0; i < sz; i++) printf("%3d ", idx[i][j]); printf("\n"); } #endif } int main() { int i, j, k, Q; int cmd; N = in(); for (i = 0; i < N; i++) { hi[i] = k = in(); if (k > 0) { to[i] = malloc(sizeof(int)*k); for (j = 0; j < k; j++) to[i][j] = in(); } } eularTour(); bmax = sz + 1; Q = in(); while (Q--) { cmd = in(); if (cmd == 0) { // add(v, w) int v, w; v = in(), w = in(); add(idx[v][0], w); add(idx[v][1], -w); } else { // getSum(u) int u = in(); if (u == 0) out(0); else out(sum(idx[u][0])); } } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl in .type in, @function in: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl $0, -8(%rbp) call getchar_unlocked@PLT movl %eax, -4(%rbp) .L2: movl -8(%rbp), %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax movl %eax, %edx movl -4(%rbp), %eax andl $15, %eax addl %edx, %eax movl %eax, -8(%rbp) call getchar_unlocked@PLT movl %eax, -4(%rbp) cmpl $47, -4(%rbp) jg .L2 movl -8(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size in, .-in .globl out .type out, @function out: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $80, %rsp movl %edi, -68(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax cmpl $0, -68(%rbp) jne .L5 movl $48, %edi call putchar_unlocked@PLT jmp .L6 .L5: cmpl $0, -68(%rbp) jns .L7 movl $45, %edi call putchar_unlocked@PLT negl -68(%rbp) .L7: movl $0, -52(%rbp) jmp .L8 .L9: movl -68(%rbp), %edx movslq %edx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax movl %edx, %ecx subl %eax, %ecx movl %ecx, %eax leal 48(%rax), %ecx movl -52(%rbp), %eax leal 1(%rax), %edx movl %edx, -52(%rbp) movl %ecx, %edx cltq movb %dl, -48(%rbp,%rax) movl -68(%rbp), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -68(%rbp) .L8: cmpl $0, -68(%rbp) jne .L9 jmp .L10 .L11: movl -52(%rbp), %eax cltq movzbl -48(%rbp,%rax), %eax movsbl %al, %eax movl %eax, %edi call putchar_unlocked@PLT .L10: movl -52(%rbp), %eax leal -1(%rax), %edx movl %edx, -52(%rbp) testl %eax, %eax jne .L11 .L6: movl $10, %edi call putchar_unlocked@PLT nop movq -8(%rbp), %rax subq %fs:40, %rax je .L12 call __stack_chk_fail@PLT .L12: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size out, .-out .globl bit .bss .align 32 .type bit, @object .size bit, 800040 bit: .zero 800040 .globl bmax .align 4 .type bmax, @object .size bmax, 4 bmax: .zero 4 .text .globl sum .type sum, @function sum: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl $0, -4(%rbp) jmp .L14 .L15: movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq bit(%rip), %rax movl (%rdx,%rax), %eax addl %eax, -4(%rbp) movl -20(%rbp), %eax subl $1, %eax andl %eax, -20(%rbp) .L14: cmpl $0, -20(%rbp) jg .L15 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size sum, .-sum .globl add .type add, @function add: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) jmp .L18 .L19: movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq bit(%rip), %rax movl (%rdx,%rax), %edx movl -8(%rbp), %eax leal (%rdx,%rax), %ecx movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq bit(%rip), %rax movl %ecx, (%rdx,%rax) movl -4(%rbp), %eax negl %eax andl -4(%rbp), %eax addl %eax, -4(%rbp) .L18: movl bmax(%rip), %eax cmpl %eax, -4(%rbp) jle .L19 nop nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size add, .-add .globl N .bss .align 4 .type N, @object .size N, 4 N: .zero 4 .globl hi .align 32 .type hi, @object .size hi, 400020 hi: .zero 400020 .globl to .align 32 .type to, @object .size to, 800040 to: .zero 800040 .globl idx .align 32 .type idx, @object .size idx, 1600080 idx: .zero 1600080 .globl sz .align 4 .type sz, @object .size sz, 4 sz: .zero 4 .globl que .align 32 .type que, @object .size que, 800040 que: .zero 800040 .globl top .align 4 .type top, @object .size top, 4 top: .zero 4 .text .globl eularTour .type eularTour, @function eularTour: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $1, sz(%rip) movl $0, que(%rip) movl $1, top(%rip) jmp .L21 .L25: movl top(%rip), %eax subl $1, %eax movl %eax, top(%rip) movl top(%rip), %eax cltq leaq 0(,%rax,4), %rdx leaq que(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -4(%rbp) cmpl $0, -4(%rbp) jns .L22 negl -4(%rbp) movl sz(%rip), %eax leal 1(%rax), %edx movl %edx, sz(%rip) movl -4(%rbp), %edx subl $1, %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq 4+idx(%rip), %rdx movl %eax, (%rcx,%rdx) jmp .L21 .L22: movl top(%rip), %eax leal 1(%rax), %edx movl %edx, top(%rip) movl -4(%rbp), %edx movl %edx, %ecx notl %ecx cltq leaq 0(,%rax,4), %rdx leaq que(%rip), %rax movl %ecx, (%rdx,%rax) movl sz(%rip), %eax leal 1(%rax), %edx movl %edx, sz(%rip) movl -4(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq idx(%rip), %rdx movl %eax, (%rcx,%rdx) movl $0, -8(%rbp) jmp .L23 .L24: movl -4(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq to(%rip), %rax movq (%rdx,%rax), %rdx movl -8(%rbp), %eax cltq salq $2, %rax leaq (%rdx,%rax), %rcx movl top(%rip), %eax leal 1(%rax), %edx movl %edx, top(%rip) movl (%rcx), %edx cltq leaq 0(,%rax,4), %rcx leaq que(%rip), %rax movl %edx, (%rcx,%rax) addl $1, -8(%rbp) .L23: movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq hi(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -8(%rbp) jl .L24 .L21: movl top(%rip), %eax testl %eax, %eax jne .L25 nop nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size eularTour, .-eularTour .globl main .type main, @function main: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $40, %rsp .cfi_offset 3, -24 movl $0, %eax call in movl %eax, N(%rip) movl $0, -48(%rbp) jmp .L27 .L31: movl $0, %eax call in movl %eax, -20(%rbp) movl -48(%rbp), %eax cltq leaq 0(,%rax,4), %rcx leaq hi(%rip), %rdx movl -20(%rbp), %eax movl %eax, (%rcx,%rdx) cmpl $0, -20(%rbp) jle .L28 movl -20(%rbp), %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, %rcx movl -48(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq to(%rip), %rax movq %rcx, (%rdx,%rax) movl $0, -44(%rbp) jmp .L29 .L30: movl -48(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq to(%rip), %rax movq (%rdx,%rax), %rdx movl -44(%rbp), %eax cltq salq $2, %rax leaq (%rdx,%rax), %rbx movl $0, %eax call in movl %eax, (%rbx) addl $1, -44(%rbp) .L29: movl -44(%rbp), %eax cmpl -20(%rbp), %eax jl .L30 .L28: addl $1, -48(%rbp) .L27: movl N(%rip), %eax cmpl %eax, -48(%rbp) jl .L31 movl $0, %eax call eularTour movl sz(%rip), %eax addl $1, %eax movl %eax, bmax(%rip) movl $0, %eax call in movl %eax, -40(%rbp) jmp .L32 .L35: movl $0, %eax call in movl %eax, -36(%rbp) cmpl $0, -36(%rbp) jne .L33 movl $0, %eax call in movl %eax, -28(%rbp) movl $0, %eax call in movl %eax, -24(%rbp) movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq idx(%rip), %rax movl (%rdx,%rax), %eax movl -24(%rbp), %edx movl %edx, %esi movl %eax, %edi call add movl -24(%rbp), %eax negl %eax movl %eax, %edx movl -28(%rbp), %eax cltq leaq 0(,%rax,8), %rcx leaq 4+idx(%rip), %rax movl (%rcx,%rax), %eax movl %edx, %esi movl %eax, %edi call add jmp .L32 .L33: movl $0, %eax call in movl %eax, -32(%rbp) cmpl $0, -32(%rbp) jne .L34 movl $0, %edi call out jmp .L32 .L34: movl -32(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq idx(%rip), %rax movl (%rdx,%rax), %eax movl %eax, %edi call sum movl %eax, %edi call out .L32: movl -40(%rbp), %eax leal -1(%rax), %edx movl %edx, -40(%rbp) testl %eax, %eax jne .L35 movl $0, %eax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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 t = 0;\n while( t+T[j] <=P) {\n t +=T[j];\n j++;\n if(j==n) return n; \n }\n }\n return j; \n \n}\n \nint solve() {\n long long right = MAX*10000,left=0,mid,s;\n \n while(right>left+1) {\n mid = (right + left)/2;\n s=load(mid);\n if(s>=n) right=mid;\n else left = mid;\n }\n return right; \n}\n \nint main(void)\n \n{\n int i;\n scanf(\"%d %d%\",&n,&k);\n \n for(i=0; i < n; i++) {\n scanf(\"%d\",&T[i]);\n }\n printf(\"%llu\\n\",solve());\n return 0; \n \n \n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tT\n\t.bss\n\t.align 32\n\t.type\tT, @object\n\t.size\tT, 800000\nT:\n\t.zero\t800000\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tk\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.text\n\t.globl\tload\n\t.type\tload, @function\nload:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L3\n.L5:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tT(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -8(%rbp)\n\taddl\t$1, -12(%rbp)\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L3\n\tmovl\tn(%rip), %eax\n\tjmp\t.L4\n.L3:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tT(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tcmpq\t%rax, -24(%rbp)\n\tjge\t.L5\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\tk(%rip), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L6\n\tmovl\t-12(%rbp), %eax\n.L4:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tload, .-load\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t$1000000000, -32(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tload\n\tcltq\n\tmovq\t%rax, -8(%rbp)\n\tmovl\tn(%rip), %eax\n\tcltq\n\tcmpq\t%rax, -8(%rbp)\n\tjl\t.L9\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n.L8:\n\tmovq\t-24(%rbp), %rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -32(%rbp)\n\tjg\t.L10\n\tmovq\t-32(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tsolve, .-solve\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d%\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%llu\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tk(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L13\n.L14:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tT(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -4(%rbp)\n.L13:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjl\t.L14\n\tmovl\t$0, %eax\n\tcall\tsolve\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\tleaq\t(%r10,%rax,8), %rdx\n\txorl\t%eax, %eax\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\taddl\t$1, %r8d\n\taddq\t$8, %rdx\n\tcmpl\t%r8d, %ecx\n\tje\t.L1\n.L5:\n\taddq\t(%rdx), %rax\n\tcmpq\t%rdi, %rax\n\tjle\t.L4\n\taddl\t$1, %esi\n\tcmpl\t%r9d, %esi\n\tjne\t.L3\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n.L6:\n\txorl\t%r8d, %r8d\n\tjmp\t.L1\n\t.cfi_endproc\n.LFE23:\n\t.size\tload, .-load\n\t.p2align 4\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tk(%rip), %r11d\n\tmovl\tn(%rip), %r9d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovl\t$1000000000, %eax\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tleaq\tT(%rip), %r8\n\txorl\t%ebx, %ebx\n.L9:\n\tleaq\t1(%rbx), %rbp\n\tcmpq\t%rbp, %rax\n\tjle\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tleaq\t(%rax,%rbx), %rsi\n\txorl\t%edi, %edi\n\txorl\t%r10d, %r10d\n\tsarq\t%rsi\n\ttestl\t%r11d, %r11d\n\tjle\t.L11\n.L10:\n\tmovslq\t%edi, %rdx\n\txorl\t%ecx, %ecx\n\tjmp\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\taddq\t$1, %rdx\n\tcmpl\t%edx, %r9d\n\tje\t.L18\n.L14:\n\taddq\t(%r8,%rdx,8), %rcx\n\tmovl\t%edx, %edi\n\tcmpq\t%rcx, %rsi\n\tjge\t.L13\n\taddl\t$1, %r10d\n\tcmpl\t%r10d, %r11d\n\tjne\t.L10\n.L11:\n\tcmpl\t%edi, %r9d\n\tjle\t.L18\n\tmovq\t%rsi, %rbx\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovq\t%rsi, %rax\n\tcmpq\t%rbp, %rax\n\tjg\t.L15\n.L22:\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tsolve, .-solve\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\"%llu\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\tk(%rip), %rdx\n\tleaq\tn(%rip), %rsi\n\txorl\t%eax, %eax\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L24\n\tleaq\tT(%rip), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rdi\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$8, %rbp\n\tcmpl\t%ebx, n(%rip)\n\tjg\t.L25\n.L24:\n\txorl\t%eax, %eax\n\tcall\tsolve\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\tmovl\t%eax, %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tmain, .-main\n\t.globl\tk\n\t.bss\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tT\n\t.align 32\n\t.type\tT, @object\n\t.size\tT, 800000\nT:\n\t.zero\t800000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tleaq\t(%r10,%rax,8), %rdx\n\txorl\t%eax, %eax\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\taddl\t$1, %r8d\n\taddq\t$8, %rdx\n\tcmpl\t%r8d, %ecx\n\tje\t.L1\n.L5:\n\taddq\t(%rdx), %rax\n\tcmpq\t%rdi, %rax\n\tjle\t.L4\n\taddl\t$1, %esi\n\tcmpl\t%r9d, %esi\n\tjne\t.L3\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n.L6:\n\txorl\t%r8d, %r8d\n\tjmp\t.L1\n\t.cfi_endproc\n.LFE23:\n\t.size\tload, .-load\n\t.p2align 4\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tk(%rip), %r11d\n\tmovl\tn(%rip), %r9d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovl\t$1000000000, %eax\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tleaq\tT(%rip), %r8\n\txorl\t%ebx, %ebx\n.L9:\n\tleaq\t1(%rbx), %rbp\n\tcmpq\t%rbp, %rax\n\tjle\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tleaq\t(%rax,%rbx), %rsi\n\txorl\t%edi, %edi\n\txorl\t%r10d, %r10d\n\tsarq\t%rsi\n\ttestl\t%r11d, %r11d\n\tjle\t.L11\n.L10:\n\tmovslq\t%edi, %rdx\n\txorl\t%ecx, %ecx\n\tjmp\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\taddq\t$1, %rdx\n\tcmpl\t%edx, %r9d\n\tje\t.L18\n.L14:\n\taddq\t(%r8,%rdx,8), %rcx\n\tmovl\t%edx, %edi\n\tcmpq\t%rcx, %rsi\n\tjge\t.L13\n\taddl\t$1, %r10d\n\tcmpl\t%r10d, %r11d\n\tjne\t.L10\n.L11:\n\tcmpl\t%edi, %r9d\n\tjle\t.L18\n\tmovq\t%rsi, %rbx\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovq\t%rsi, %rax\n\tcmpq\t%rbp, %rax\n\tjg\t.L15\n.L22:\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tsolve, .-solve\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\"%llu\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tleaq\tk(%rip), %rdx\n\tleaq\tn(%rip), %rsi\n\txorl\t%eax, %eax\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L24\n\tleaq\tT(%rip), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\t.LC1(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rdi\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$8, %rbp\n\tcmpl\t%ebx, n(%rip)\n\tjg\t.L25\n.L24:\n\txorl\t%eax, %eax\n\tcall\tsolve\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\tmovl\t%eax, %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tmain, .-main\n\t.globl\tk\n\t.bss\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tT\n\t.align 32\n\t.type\tT, @object\n\t.size\tT, 800000\nT:\n\t.zero\t800000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 t = 0;\n while( t+T[j] <=P) {\n t +=T[j];\n j++;\n if(j==n) return n; \n }\n }\n return j; \n \n}\n \nint solve() {\n long long right = MAX*10000,left=0,mid,s;\n \n while(right>left+1) {\n mid = (right + left)/2;\n s=load(mid);\n if(s>=n) right=mid;\n else left = mid;\n }\n return right; \n}\n \nint main(void)\n \n{\n int i;\n scanf(\"%d %d%\",&n,&k);\n \n for(i=0; i < n; i++) {\n scanf(\"%d\",&T[i]);\n }\n printf(\"%llu\\n\",solve());\n return 0; \n \n \n}\n", "index": 70, "inputs": [ "5 3\n4\n1\n7\n3\n9\n", "4 2\n1\n1\n2\n6\n", "5 3\n4\n1\n7\n3\n5\n", "5 6\n4\n1\n7\n3\n5\n", "4 2\n1\n1\n3\n1\n", "4 2\n1\n1\n3\n0\n", "4 2\n1\n4\n3\n0\n", "5 3\n6\n2\n8\n5\n4\n", "5 3\n6\n2\n8\n7\n4\n", "5 3\n8\n2\n9\n7\n5\n", "5 2\n6\n1\n8\n3\n5\n", "5 1\n6\n2\n8\n5\n4\n", "5 2\n6\n2\n8\n3\n5\n", "4 4\n-1\n4\n18\n5\n4\n", "3 4\n1\n0\n2\n6\n", "3 1\n6\n0\n8\n5\n4\n", "4 4\n-1\n2\n17\n1\n4\n", "5 1\n3\n4\n14\n7\n0\n", "4 6\n-2\n3\n5\n13\n8\n", "1 6\n1\n-1\n9\n23\n8\n", "5 1\n6\n2\n8\n6\n4\n", "5 1\n6\n1\n8\n3\n1\n", "5 2\n20\n1\n6\n3\n0\n", "5 1\n5\n2\n8\n2\n5\n", "4 3\n6\n3\n29\n0\n3\n", "2 1\n11\n12\n5\n2\n6\n", "5 1\n7\n2\n9\n1\n5\n", "5 1\n10\n4\n9\n7\n5\n", "5 2\n10\n4\n9\n7\n5\n", "5 1\n14\n2\n9\n1\n4\n", "3 4\n0\n1\n39\n5\n4\n", "4 2\n11\n17\n10\n0\n6\n", "4 2\n1\n1\n3\n6\n", "5 6\n5\n1\n7\n3\n5\n", "5 6\n6\n1\n7\n3\n5\n", "4 2\n1\n2\n3\n0\n", "5 6\n6\n1\n8\n3\n5\n", "5 6\n6\n1\n8\n3\n4\n", "5 3\n6\n1\n8\n3\n4\n", "5 3\n6\n2\n8\n3\n4\n", "5 3\n6\n2\n8\n6\n4\n", "5 3\n6\n2\n9\n7\n4\n", "5 3\n8\n2\n9\n7\n4\n", "5 3\n7\n2\n9\n7\n5\n", "4 3\n7\n2\n9\n7\n5\n", "4 3\n0\n2\n9\n7\n5\n", "4 3\n0\n2\n9\n5\n5\n", "4 4\n0\n2\n9\n5\n5\n", "4 4\n-1\n2\n9\n5\n5\n", "4 4\n-1\n3\n9\n5\n5\n", "4 4\n-1\n3\n9\n5\n4\n", "4 4\n-2\n3\n9\n5\n4\n", "4 4\n-2\n3\n4\n5\n4\n", "5 3\n8\n2\n7\n3\n9\n", "4 2\n1\n0\n2\n6\n", "5 3\n4\n2\n7\n3\n5\n", "4 2\n1\n1\n0\n6\n", "4 4\n1\n1\n3\n1\n", "5 6\n5\n2\n7\n3\n5\n", "5 6\n6\n1\n7\n3\n4\n", "4 1\n1\n2\n3\n0\n", "5 6\n6\n0\n8\n3\n4\n", "5 2\n6\n1\n8\n3\n4\n", "5 3\n10\n2\n8\n3\n4\n", "5 3\n6\n0\n8\n6\n4\n", "5 3\n6\n4\n8\n7\n4\n", "5 3\n6\n3\n9\n7\n4\n", "5 3\n8\n3\n9\n7\n4\n", "5 3\n7\n4\n9\n7\n5\n", "4 3\n7\n1\n9\n7\n5\n", "4 3\n0\n2\n9\n7\n7\n", "4 3\n0\n2\n9\n4\n5\n", "4 4\n0\n3\n9\n5\n5\n", "4 4\n-1\n3\n2\n5\n5\n", "4 4\n-1\n4\n9\n5\n4\n", "4 4\n-2\n3\n9\n4\n4\n", "4 4\n-2\n3\n4\n5\n5\n", "5 5\n8\n2\n7\n3\n9\n", "4 4\n1\n0\n2\n6\n", "5 3\n4\n4\n7\n3\n5\n", "4 2\n1\n2\n0\n6\n", "5 6\n5\n2\n3\n3\n5\n", "4 1\n1\n1\n3\n0\n", "5 10\n6\n0\n8\n3\n4\n", "5 2\n6\n1\n8\n3\n0\n", "5 3\n11\n2\n8\n3\n4\n", "3 1\n6\n2\n8\n5\n4\n", "5 3\n6\n4\n8\n7\n1\n", "5 3\n6\n3\n9\n5\n4\n", "5 3\n12\n3\n9\n7\n4\n", "3 3\n7\n1\n9\n7\n5\n", "4 3\n-1\n2\n9\n7\n7\n", "4 3\n0\n2\n9\n4\n1\n", "4 4\n0\n2\n9\n1\n5\n", "4 4\n-1\n3\n2\n6\n5\n", "4 4\n-2\n3\n11\n4\n4\n", "4 7\n-2\n3\n4\n5\n4\n", "4 4\n1\n2\n0\n6\n", "5 6\n1\n2\n3\n3\n5\n", "4 1\n1\n1\n3\n1\n", "5 3\n8\n1\n7\n3\n9\n", "5 3\n8\n1\n7\n3\n9\n", "4 2\n1\n2\n2\n6\n" ], "outputs": [ "10\n", "6\n", "8\n", "7\n", "4\n", "3\n", "5\n", "9\n", "11\n", "12\n", "15\n", "25\n", "16\n", "1000000000\n", "2\n", "14\n", "1000000000\n", "28\n", "1000000000\n", "1\n", "26\n", "19\n", "20\n", "22\n", "29\n", "23\n", "24\n", "35\n", "21\n", "30\n", "39\n", "27\n", "6\n", "7\n", "7\n", "3\n", "8\n", "8\n", "8\n", "8\n", "10\n", "11\n", "11\n", "12\n", "9\n", "9\n", "9\n", "9\n", "1000000000\n", "1000000000\n", "1000000000\n", "1000000000\n", "1000000000\n", "10\n", "6\n", "8\n", "6\n", "3\n", "7\n", "7\n", "6\n", "8\n", "15\n", "10\n", "10\n", "11\n", "11\n", "11\n", "12\n", "9\n", "9\n", "9\n", "9\n", "1000000000\n", "1000000000\n", "1000000000\n", "1000000000\n", "9\n", "6\n", "8\n", "6\n", "5\n", "5\n", "8\n", "11\n", "11\n", "16\n", "10\n", "9\n", "12\n", "9\n", "1000000000\n", "9\n", "9\n", "1000000000\n", "1000000000\n", "1000000000\n", "6\n", "5\n", "6\n", "10\n", "10\n", "6\n" ], "question": "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 t = 0;\n while( t+T[j] <=P) {\n t +=T[j];\n j++;\n if(j==n) return n; \n }\n }\n return j; \n \n}\n \nint solve() {\n long long right = MAX*10000,left=0,mid,s;\n \n while(right>left+1) {\n mid = (right + left)/2;\n s=load(mid);\n if(s>=n) right=mid;\n else left = mid;\n }\n return right; \n}\n \nint main(void)\n \n{\n int i;\n scanf(\"%d %d%\",&n,&k);\n \n for(i=0; i < n; i++) {\n scanf(\"%d\",&T[i]);\n }\n printf(\"%llu\\n\",solve());\n return 0; \n \n \n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tT\n\t.bss\n\t.align 32\n\t.type\tT, @object\n\t.size\tT, 800000\nT:\n\t.zero\t800000\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tk\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.text\n\t.globl\tload\n\t.type\tload, @function\nload:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L3\n.L5:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tT(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -8(%rbp)\n\taddl\t$1, -12(%rbp)\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L3\n\tmovl\tn(%rip), %eax\n\tjmp\t.L4\n.L3:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tT(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tcmpq\t%rax, -24(%rbp)\n\tjge\t.L5\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\tk(%rip), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L6\n\tmovl\t-12(%rbp), %eax\n.L4:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tload, .-load\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t$1000000000, -32(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tload\n\tcltq\n\tmovq\t%rax, -8(%rbp)\n\tmovl\tn(%rip), %eax\n\tcltq\n\tcmpq\t%rax, -8(%rbp)\n\tjl\t.L9\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n.L8:\n\tmovq\t-24(%rbp), %rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -32(%rbp)\n\tjg\t.L10\n\tmovq\t-32(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tsolve, .-solve\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d%\"\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%llu\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tk(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L13\n.L14:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tT(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -4(%rbp)\n.L13:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjl\t.L14\n\tmovl\t$0, %eax\n\tcall\tsolve\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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) { t +=T[j]; j++; if(j==n) return n; } } return j; } int solve() { long long right = MAX*10000,left=0,mid,s; while(right>left+1) { mid = (right + left)/2; s=load(mid); if(s>=n) right=mid; else left = mid; } return right; } int main(void) { int i; scanf("%d %d%",&n,&k); for(i=0; i < n; i++) { scanf("%d",&T[i]); } printf("%llu\n",solve()); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl T .bss .align 32 .type T, @object .size T, 800000 T: .zero 800000 .globl n .align 4 .type n, @object .size n, 4 n: .zero 4 .globl k .align 4 .type k, @object .size k, 4 k: .zero 4 .text .globl load .type load, @function load: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movl $0, -16(%rbp) movl $0, -12(%rbp) movl $0, -16(%rbp) jmp .L2 .L6: movq $0, -8(%rbp) jmp .L3 .L5: movl -12(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq T(%rip), %rax movq (%rdx,%rax), %rax addq %rax, -8(%rbp) addl $1, -12(%rbp) movl n(%rip), %eax cmpl %eax, -12(%rbp) jne .L3 movl n(%rip), %eax jmp .L4 .L3: movl -12(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq T(%rip), %rax movq (%rdx,%rax), %rdx movq -8(%rbp), %rax addq %rdx, %rax cmpq %rax, -24(%rbp) jge .L5 addl $1, -16(%rbp) .L2: movl k(%rip), %eax cmpl %eax, -16(%rbp) jl .L6 movl -12(%rbp), %eax .L4: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size load, .-load .globl solve .type solve, @function solve: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq $1000000000, -32(%rbp) movq $0, -24(%rbp) jmp .L8 .L10: movq -32(%rbp), %rdx movq -24(%rbp), %rax addq %rdx, %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax movq %rax, -16(%rbp) movq -16(%rbp), %rax movq %rax, %rdi call load cltq movq %rax, -8(%rbp) movl n(%rip), %eax cltq cmpq %rax, -8(%rbp) jl .L9 movq -16(%rbp), %rax movq %rax, -32(%rbp) jmp .L8 .L9: movq -16(%rbp), %rax movq %rax, -24(%rbp) .L8: movq -24(%rbp), %rax addq $1, %rax cmpq %rax, -32(%rbp) jg .L10 movq -32(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size solve, .-solve .section .rodata .LC0: .string "%d %d%" .LC1: .string "%d" .LC2: .string "%llu\n" .text .globl main .type main, @function main: .LFB2: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp leaq k(%rip), %rax movq %rax, %rdx leaq n(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -4(%rbp) jmp .L13 .L14: movl -4(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq T(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -4(%rbp) .L13: movl n(%rip), %eax cmpl %eax, -4(%rbp) jl .L14 movl $0, %eax call solve movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE2: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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(\"%d\",&Q);\n total+=Q;\n if(Q>maxi)\n {\n maxi=Q;\n }\n }\n if(total-maxi>maxi)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -20(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L2\n.L4:\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, -16(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L3\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n.L3:\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjle\t.L4\n\tmovl\t-16(%rbp), %eax\n\tsubl\t-20(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L5\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L6\n.L5:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L6:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\tmovl\t$1, %ebp\n\txorl\t%r12d, %r12d\n\tleaq\t4(%rsp), %r14\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\txorl\t%eax, %eax\n\tmovq\t%r14, %rsi\n\tmovq\t%r13, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\taddl\t%eax, %r12d\n\tcmpl\t%eax, %ebx\n\tcmovl\t%eax, %ebx\n\taddl\t$1, %ebp\n\tcmpl\t%ebp, (%rsp)\n\tjge\t.L3\n\tsubl\t%ebx, %r12d\n\tcmpl\t%ebx, %r12d\n\tjle\t.L2\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n.L4:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L2\n\tmovl\t$1, %ebp\n\txorl\t%r12d, %r12d\n\tleaq\t4(%rsp), %r14\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\txorl\t%eax, %eax\n\tmovq\t%r14, %rsi\n\tmovq\t%r13, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\taddl\t%eax, %r12d\n\tcmpl\t%eax, %ebx\n\tcmovl\t%eax, %ebx\n\taddl\t$1, %ebp\n\tcmpl\t%ebp, (%rsp)\n\tjge\t.L3\n\tsubl\t%ebx, %r12d\n\tcmpl\t%ebx, %r12d\n\tjle\t.L2\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n.L4:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(\"%d\",&Q);\n total+=Q;\n if(Q>maxi)\n {\n maxi=Q;\n }\n }\n if(total-maxi>maxi)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n", "index": 50, "inputs": [ "4\n3 5 5 1\n", "10\n1 0 10 5 8 12 34 100 11 3\n", "4\n3 3 4 1\n", "4\n3 5 6 1\n", "4\n4 3 4 1\n", "10\n1 0 10 10 8 12 34 100 11 3\n", "4\n3 5 0 1\n", "4\n4 1 4 1\n", "10\n1 0 10 10 8 12 34 110 11 3\n", "4\n3 5 0 0\n", "4\n2 1 4 1\n", "10\n1 0 10 10 16 12 34 110 11 3\n", "4\n3 6 0 0\n", "4\n2 1 5 1\n", "10\n1 0 10 10 16 22 34 110 11 3\n", "4\n3 6 1 0\n", "4\n2 1 2 1\n", "10\n1 0 10 10 16 17 34 110 11 3\n", "4\n3 6 1 -1\n", "4\n3 1 2 1\n", "10\n1 0 10 10 16 17 34 110 6 3\n", "4\n6 6 1 0\n", "4\n3 1 3 1\n", "10\n1 0 10 10 16 18 34 110 6 3\n", "4\n6 1 1 0\n", "4\n3 1 3 0\n", "10\n1 0 1 10 16 18 34 110 6 3\n", "4\n10 1 1 0\n", "4\n3 1 2 0\n", "10\n1 0 1 10 16 14 34 110 6 3\n", "4\n7 1 1 0\n", "4\n1 1 2 0\n", "10\n1 0 1 10 16 14 12 110 6 3\n", "4\n6 1 1 -1\n", "4\n1 0 2 0\n", "10\n1 0 0 10 16 14 12 110 6 3\n", "4\n6 2 1 -1\n", "4\n1 0 2 -1\n", "10\n1 0 0 10 16 14 12 110 6 1\n", "4\n5 2 1 -1\n", "4\n2 0 2 -1\n", "10\n1 0 1 10 16 14 12 110 6 1\n", "4\n5 4 1 -1\n", "4\n2 0 2 0\n", "10\n1 0 1 10 16 14 12 110 1 1\n", "4\n0 4 1 -1\n", "4\n4 0 2 0\n", "10\n1 0 1 10 16 14 12 100 1 1\n", "4\n0 1 1 -1\n", "4\n4 0 0 0\n", "10\n1 0 1 10 0 14 12 100 1 1\n", "4\n0 2 1 -1\n", "4\n4 -1 0 0\n", "10\n1 0 1 10 1 14 12 100 1 1\n", "4\n-1 2 1 -1\n", "4\n4 -2 0 0\n", "10\n1 0 1 5 1 14 12 100 1 1\n", "4\n-1 1 1 -1\n", "4\n5 -2 0 0\n", "10\n1 0 1 5 1 14 12 100 0 1\n", "4\n-1 1 2 -1\n", "4\n5 -2 -1 0\n", "10\n1 0 1 5 2 14 12 100 0 1\n", "4\n-2 1 2 -1\n", "4\n5 -3 -1 0\n", "10\n1 0 1 9 2 14 12 100 0 1\n", "4\n-2 0 2 -1\n", "4\n5 -5 -1 0\n", "10\n1 0 1 9 2 14 12 100 -1 1\n", "4\n-4 0 2 -1\n", "4\n4 -5 -1 0\n", "10\n0 0 1 9 2 14 12 100 -1 1\n", "4\n-4 0 4 -1\n", "4\n4 -5 -2 0\n", "10\n0 0 1 9 2 14 23 100 -1 1\n", "4\n-4 0 4 -2\n", "4\n8 -5 -2 0\n", "10\n0 0 1 9 2 14 22 100 -1 1\n", "4\n-4 0 8 -2\n", "4\n12 -5 -2 0\n", "10\n0 0 1 9 0 14 22 100 -1 1\n", "4\n-5 0 8 -2\n", "4\n12 -5 -2 -1\n", "10\n0 0 1 9 0 14 33 100 -1 1\n", "4\n-6 0 8 -2\n", "4\n12 -9 -2 -1\n", "10\n0 0 1 9 0 14 33 101 -1 1\n", "4\n-1 0 8 -2\n", "4\n12 -9 -1 -1\n", "10\n0 0 1 9 0 14 33 001 -1 1\n", "4\n-1 -1 8 -2\n", "4\n6 -9 -1 -1\n", "10\n0 0 1 10 0 14 33 001 -1 1\n", "4\n-1 -1 9 -2\n", "4\n6 -9 -1 0\n", "10\n0 0 1 10 0 14 33 001 -1 0\n", "4\n-1 -2 9 -2\n", "4\n3 -9 -1 0\n", "10\n0 0 1 10 1 14 33 001 -1 0\n", "4\n-1 -2 9 -4\n", "4\n3 8 5 1\n", "4\n3 8 5 1\n", "10\n1 8 10 5 8 12 34 100 11 3\n", "4\n3 8 4 1\n" ], "outputs": [ "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "Yes\n", "No\n", "No\n" ], "question": "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(\"%d\",&Q);\n total+=Q;\n if(Q>maxi)\n {\n maxi=Q;\n }\n }\n if(total-maxi>maxi)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -20(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tmovl\t$1, -12(%rbp)\n\tjmp\t.L2\n.L4:\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, -16(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L3\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n.L3:\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjle\t.L4\n\tmovl\t-16(%rbp), %eax\n\tsubl\t-20(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjge\t.L5\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L6\n.L5:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L6:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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(Q>maxi) { maxi=Q; } } if(total-maxi>maxi) printf("Yes\n"); else printf("No\n"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "Yes" .LC2: .string "No" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -28(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -20(%rbp) movl $0, -16(%rbp) movl $1, -12(%rbp) jmp .L2 .L4: leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %eax addl %eax, -16(%rbp) movl -24(%rbp), %eax cmpl %eax, -20(%rbp) jge .L3 movl -24(%rbp), %eax movl %eax, -20(%rbp) .L3: addl $1, -12(%rbp) .L2: movl -28(%rbp), %eax cmpl %eax, -12(%rbp) jle .L4 movl -16(%rbp), %eax subl -20(%rbp), %eax cmpl %eax, -20(%rbp) jge .L5 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L6 .L5: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L6: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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]={0};\n long long sum=0;\n\n scanf(\"%d%d\", &n, &x);\n for(int i=0; i<n; i++){ scanf(\"%d\", &a[i]); sum+=a[i]; }\n\n \t//お菓子の方が多い -> 1人犠牲になってもらう\n if( x > sum ){ printf(\"%d\\n\", n-1); return 0; }\n \t\n \t//お菓子の方が少ない -> 少ない人から順に配る\n qsort( a, n, sizeof(int), compare_int );\n \tfor(int i=0; i<n; i++){\n \tx -= a[i];\n \tif\t ( x > 0 ){ cnt++; }\n \telse if( x == 0 ){ printf(\"%d\\n\", i+1);\treturn 0; }\t//ぴったり配りきった\n \telse\t\t\t { printf(\"%d\\n\", cnt); return 0; }\t//お菓子が足りなかった\n }\n \treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcompare_int\n\t.type\tcompare_int, @function\ncompare_int:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcompare_int, .-compare_int\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$448, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -436(%rbp)\n\tleaq\t-416(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$50, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t$0, -424(%rbp)\n\tleaq\t-440(%rbp), %rdx\n\tleaq\t-444(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -432(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-416(%rbp), %rdx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcltq\n\taddq\t%rax, -424(%rbp)\n\taddl\t$1, -432(%rbp)\n.L4:\n\tmovl\t-444(%rbp), %eax\n\tcmpl\t%eax, -432(%rbp)\n\tjl\t.L5\n\tmovl\t-440(%rbp), %eax\n\tcltq\n\tcmpq\t%rax, -424(%rbp)\n\tjge\t.L6\n\tmovl\t-444(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L6:\n\tmovl\t-444(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tleaq\t-416(%rbp), %rax\n\tleaq\tcompare_int(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$4, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -428(%rbp)\n\tjmp\t.L8\n.L12:\n\tmovl\t-440(%rbp), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -440(%rbp)\n\tmovl\t-440(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L9\n\taddl\t$1, -436(%rbp)\n\tjmp\t.L15\n.L9:\n\tmovl\t-440(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L11\n\tmovl\t-428(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L11:\n\tmovl\t-436(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L15:\n\taddl\t$1, -428(%rbp)\n.L8:\n\tmovl\t-444(%rbp), %eax\n\tcmpl\t%eax, -428(%rbp)\n\tjl\t.L12\n\tmovl\t$0, %eax\n.L13:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\",@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.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t$50, %ecx\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$440, %rsp\n\t.cfi_def_cfa_offset 480\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 424(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\tleaq\t8(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\tleaq\t12(%rsp), %rdx\n\trep stosq\n\tleaq\t.LC0(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t8(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L12\n\txorl\t%ebx, %ebx\n\txorl\t%r12d, %r12d\n\tleaq\t.LC1(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tleaq\t0(%rbp,%rbx,4), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t0(%rbp,%rbx,4), %rax\n\tmovslq\t8(%rsp), %rsi\n\taddq\t$1, %rbx\n\taddq\t%rax, %r12\n\tcmpl\t%ebx, %esi\n\tjg\t.L5\n.L4:\n\tmovslq\t12(%rsp), %rax\n\tcmpq\t%r12, %rax\n\tjg\t.L16\n\tleaq\tcompare_int(%rip), %rcx\n\tmovl\t$4, %edx\n\tmovq\t%rbp, %rdi\n\tcall\tqsort@PLT\n\tmovslq\t8(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L7\n\tmovl\t12(%rsp), %ecx\n\txorl\t%eax, %eax\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\taddq\t$1, %rax\n\tcmpq\t%rax, %rsi\n\tje\t.L7\n.L9:\n\tsubl\t0(%rbp,%rax,4), %ecx\n\tmovl\t%eax, %edx\n\ttestl\t%ecx, %ecx\n\tjg\t.L17\n\tmovl\t%ecx, 12(%rsp)\n\tjne\t.L10\n\taddl\t$1, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovq\t424(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L18\n\taddq\t$440, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tleal\t-1(%rsi), %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L7\n.L10:\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L7\n.L12:\n\txorl\t%r12d, %r12d\n\tjmp\t.L4\n.L18:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE40:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\",@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.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t$50, %ecx\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$440, %rsp\n\t.cfi_def_cfa_offset 480\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 424(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\tleaq\t8(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\tleaq\t12(%rsp), %rdx\n\trep stosq\n\tleaq\t.LC0(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t8(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L12\n\txorl\t%ebx, %ebx\n\txorl\t%r12d, %r12d\n\tleaq\t.LC1(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tleaq\t0(%rbp,%rbx,4), %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t0(%rbp,%rbx,4), %rax\n\tmovslq\t8(%rsp), %rsi\n\taddq\t$1, %rbx\n\taddq\t%rax, %r12\n\tcmpl\t%ebx, %esi\n\tjg\t.L5\n.L4:\n\tmovslq\t12(%rsp), %rax\n\tcmpq\t%r12, %rax\n\tjg\t.L16\n\tleaq\tcompare_int(%rip), %rcx\n\tmovl\t$4, %edx\n\tmovq\t%rbp, %rdi\n\tcall\tqsort@PLT\n\tmovslq\t8(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L7\n\tmovl\t12(%rsp), %ecx\n\txorl\t%eax, %eax\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\taddq\t$1, %rax\n\tcmpq\t%rax, %rsi\n\tje\t.L7\n.L9:\n\tsubl\t0(%rbp,%rax,4), %ecx\n\tmovl\t%eax, %edx\n\ttestl\t%ecx, %ecx\n\tjg\t.L17\n\tmovl\t%ecx, 12(%rsp)\n\tjne\t.L10\n\taddl\t$1, %edx\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovq\t424(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L18\n\taddq\t$440, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tleal\t-1(%rsi), %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L7\n.L10:\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L7\n.L12:\n\txorl\t%r12d, %r12d\n\tjmp\t.L4\n.L18:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE40:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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]={0};\n long long sum=0;\n\n scanf(\"%d%d\", &n, &x);\n for(int i=0; i<n; i++){ scanf(\"%d\", &a[i]); sum+=a[i]; }\n\n \t//お菓子の方が多い -> 1人犠牲になってもらう\n if( x > sum ){ printf(\"%d\\n\", n-1); return 0; }\n \t\n \t//お菓子の方が少ない -> 少ない人から順に配る\n qsort( a, n, sizeof(int), compare_int );\n \tfor(int i=0; i<n; i++){\n \tx -= a[i];\n \tif\t ( x > 0 ){ cnt++; }\n \telse if( x == 0 ){ printf(\"%d\\n\", i+1);\treturn 0; }\t//ぴったり配りきった\n \telse\t\t\t { printf(\"%d\\n\", cnt); return 0; }\t//お菓子が足りなかった\n }\n \treturn 0;\n}", "index": 51, "inputs": [ "3 70\n20 30 5\n", "3 10\n20 18 10\n", "2 10\n29 20\n", "4 1111\n1 5 100 1000\n", "4 1111\n-1 2 110 1000\n", "3 70\n20 49 5\n", "3 10\n20 9 10\n", "2 10\n30 20\n", "3 70\n4 49 5\n", "3 10\n20 4 10\n", "2 0\n30 20\n", "3 70\n4 40 5\n", "3 10\n20 1 10\n", "2 1\n30 20\n", "3 70\n4 72 5\n", "2 10\n20 1 10\n", "2 1\n30 26\n", "3 70\n0 72 5\n", "2 0\n30 26\n", "3 66\n20 30 10\n", "3 10\n18 30 10\n", "2 10\n20 2\n", "3 93\n20 30 5\n", "3 11\n20 18 10\n", "2 10\n29 37\n", "3 70\n20 32 5\n", "3 10\n16 9 10\n", "2 10\n35 20\n", "3 70\n4 24 5\n", "2 0\n30 17\n", "3 62\n4 40 5\n", "3 13\n20 1 10\n", "3 70\n4 17 5\n", "2 9\n20 1 10\n", "2 1\n30 1\n", "3 70\n0 72 6\n", "2 0\n20 26\n", "4 1101\n1 5 100 1000\n", "3 66\n20 30 9\n", "3 0\n18 30 10\n", "3 93\n20 30 4\n", "3 11\n37 18 10\n", "2 19\n29 37\n", "3 70\n20 32 6\n", "2 13\n35 20\n", "3 70\n4 24 7\n", "3 62\n1 40 5\n", "3 70\n4 2 5\n", "3 70\n1 72 6\n", "1 0\n20 26\n", "4 1101\n0 5 100 1000\n", "3 11\n37 18 9\n", "3 70\n20 32 2\n", "2 13\n35 34\n", "3 23\n4 24 7\n", "3 62\n1 80 5\n", "3 70\n2 2 5\n", "3 70\n1 118 6\n", "1 0\n20 48\n", "4 1101\n0 5 110 1000\n", "3 11\n37 9 9\n", "3 70\n20 32 3\n", "3 23\n4 24 11\n", "3 62\n1 99 5\n", "3 70\n0 2 5\n", "3 121\n1 118 6\n", "1 0\n20 59\n", "4 1101\n1 5 110 1000\n", "3 70\n20 39 3\n", "3 23\n4 18 11\n", "3 62\n1 164 5\n", "3 70\n-1 2 5\n", "1 0\n20 103\n", "4 1101\n1 2 110 1000\n", "3 70\n29 39 3\n", "3 23\n6 18 11\n", "3 62\n1 164 1\n", "3 24\n0 2 5\n", "4 1101\n0 2 110 1000\n", "3 70\n29 39 4\n", "3 23\n3 18 11\n", "3 14\n0 2 5\n", "3 70\n29 43 4\n", "3 23\n3 22 11\n", "3 14\n0 3 5\n", "3 79\n29 43 4\n", "3 18\n3 22 11\n", "3 14\n1 3 5\n", "3 79\n29 59 4\n", "3 18\n3 32 11\n", "3 26\n1 3 5\n", "3 79\n29 18 4\n", "3 18\n3 32 15\n", "3 26\n1 6 5\n", "3 30\n29 18 4\n", "3 28\n3 32 15\n", "3 26\n1 10 5\n", "3 26\n29 18 4\n", "3 51\n3 32 15\n", "3 26\n1 10 10\n", "2 10\n20 20\n", "4 1111\n1 10 100 1000\n", "3 70\n20 30 10\n", "3 10\n20 30 10\n", "3 70\n20 30 10\n" ], "outputs": [ "2\n", "1\n", "0\n", "3\n", "4\n", "2\n", "1\n", "0\n", "2\n", "1\n", "0\n", "2\n", "1\n", "0\n", "2\n", "1\n", "0\n", "2\n", "0\n", "2\n", "1\n", "1\n", "2\n", "1\n", "0\n", "2\n", "1\n", "0\n", "2\n", "0\n", "2\n", "2\n", "2\n", "1\n", "1\n", "2\n", "0\n", "3\n", "2\n", "0\n", "2\n", "1\n", "0\n", "2\n", "0\n", "2\n", "2\n", "2\n", "2\n", "0\n", "3\n", "1\n", "2\n", "0\n", "2\n", "2\n", "2\n", "2\n", "0\n", "3\n", "1\n", "2\n", "2\n", "2\n", "2\n", "2\n", "0\n", "3\n", "2\n", "2\n", "2\n", "2\n", "0\n", "3\n", "2\n", "2\n", "2\n", "2\n", "3\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "0\n", "4\n", "2\n", "1\n", "2\n" ], "question": "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]={0};\n long long sum=0;\n\n scanf(\"%d%d\", &n, &x);\n for(int i=0; i<n; i++){ scanf(\"%d\", &a[i]); sum+=a[i]; }\n\n \t//お菓子の方が多い -> 1人犠牲になってもらう\n if( x > sum ){ printf(\"%d\\n\", n-1); return 0; }\n \t\n \t//お菓子の方が少ない -> 少ない人から順に配る\n qsort( a, n, sizeof(int), compare_int );\n \tfor(int i=0; i<n; i++){\n \tx -= a[i];\n \tif\t ( x > 0 ){ cnt++; }\n \telse if( x == 0 ){ printf(\"%d\\n\", i+1);\treturn 0; }\t//ぴったり配りきった\n \telse\t\t\t { printf(\"%d\\n\", cnt); return 0; }\t//お菓子が足りなかった\n }\n \treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcompare_int\n\t.type\tcompare_int, @function\ncompare_int:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcompare_int, .-compare_int\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$448, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -436(%rbp)\n\tleaq\t-416(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$50, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t$0, -424(%rbp)\n\tleaq\t-440(%rbp), %rdx\n\tleaq\t-444(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -432(%rbp)\n\tjmp\t.L4\n.L5:\n\tleaq\t-416(%rbp), %rdx\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-432(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %eax\n\tcltq\n\taddq\t%rax, -424(%rbp)\n\taddl\t$1, -432(%rbp)\n.L4:\n\tmovl\t-444(%rbp), %eax\n\tcmpl\t%eax, -432(%rbp)\n\tjl\t.L5\n\tmovl\t-440(%rbp), %eax\n\tcltq\n\tcmpq\t%rax, -424(%rbp)\n\tjge\t.L6\n\tmovl\t-444(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L6:\n\tmovl\t-444(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tleaq\t-416(%rbp), %rax\n\tleaq\tcompare_int(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$4, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -428(%rbp)\n\tjmp\t.L8\n.L12:\n\tmovl\t-440(%rbp), %edx\n\tmovl\t-428(%rbp), %eax\n\tcltq\n\tmovl\t-416(%rbp,%rax,4), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -440(%rbp)\n\tmovl\t-440(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L9\n\taddl\t$1, -436(%rbp)\n\tjmp\t.L15\n.L9:\n\tmovl\t-440(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L11\n\tmovl\t-428(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L11:\n\tmovl\t-436(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L15:\n\taddl\t$1, -428(%rbp)\n.L8:\n\tmovl\t-444(%rbp), %eax\n\tcmpl\t%eax, -428(%rbp)\n\tjl\t.L12\n\tmovl\t$0, %eax\n.L13:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; scanf("%d%d", &n, &x); for(int i=0; i<n; i++){ scanf("%d", &a[i]); sum+=a[i]; } //お菓子の方が多い -> 1人犠牲になってもらう if( x > sum ){ printf("%d\n", n-1); return 0; } //お菓子の方が少ない -> 少ない人から順に配る qsort( a, n, sizeof(int), compare_int ); for(int i=0; i<n; i++){ x -= a[i]; if ( x > 0 ){ cnt++; } else if( x == 0 ){ printf("%d\n", i+1); return 0; } //ぴったり配りきった else { printf("%d\n", cnt); return 0; } //お菓子が足りなかった } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl compare_int .type compare_int, @function compare_int: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size compare_int, .-compare_int .section .rodata .LC0: .string "%d%d" .LC1: .string "%d" .LC2: .string "%d\n" .text .globl main .type main, @function main: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $448, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -436(%rbp) leaq -416(%rbp), %rdx movl $0, %eax movl $50, %ecx movq %rdx, %rdi rep stosq movq $0, -424(%rbp) leaq -440(%rbp), %rdx leaq -444(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -432(%rbp) jmp .L4 .L5: leaq -416(%rbp), %rdx movl -432(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -432(%rbp), %eax cltq movl -416(%rbp,%rax,4), %eax cltq addq %rax, -424(%rbp) addl $1, -432(%rbp) .L4: movl -444(%rbp), %eax cmpl %eax, -432(%rbp) jl .L5 movl -440(%rbp), %eax cltq cmpq %rax, -424(%rbp) jge .L6 movl -444(%rbp), %eax subl $1, %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L13 .L6: movl -444(%rbp), %eax movslq %eax, %rsi leaq -416(%rbp), %rax leaq compare_int(%rip), %rdx movq %rdx, %rcx movl $4, %edx movq %rax, %rdi call qsort@PLT movl $0, -428(%rbp) jmp .L8 .L12: movl -440(%rbp), %edx movl -428(%rbp), %eax cltq movl -416(%rbp,%rax,4), %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -440(%rbp) movl -440(%rbp), %eax testl %eax, %eax jle .L9 addl $1, -436(%rbp) jmp .L15 .L9: movl -440(%rbp), %eax testl %eax, %eax jne .L11 movl -428(%rbp), %eax addl $1, %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L13 .L11: movl -436(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L13 .L15: addl $1, -428(%rbp) .L8: movl -444(%rbp), %eax cmpl %eax, -428(%rbp) jl .L12 movl $0, %eax .L13: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L14 call __stack_chk_fail@PLT .L14: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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// 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[40002], d[40002], s[40002];\n\n//#define getchar_unlocked() getchar()\nint in()\n{\n\tint n = 0;\n\tint c = getchar_unlocked();\n\tdo n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();\n\twhile (c >= '0');\n\treturn n;\n}\n\nint cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; }\n\nint main()\n{\n\tint n, i, j, k, sz;\n\tlong long turn, ans;\n\n\tn = in();\n\tfor (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in();\n\t\n\tsz = 0, ans = turn = 0;\n\tfor (i = 1; i <= n; i++) {\n\t\tj = a[0] - d[i];\n\t\tk = a[i] - d[0];\n\t\tif (k <= 0) continue;\n\t\tif (j <= 0) { puts(\"-1\"); return 0; }\n\n\t\tturn += k; if (s[i] > s[0]) ans += k;\n\t\ttbl[sz].d = k;\n\t\ttbl[sz++].a = (h[i]+j-1)/j;\n\t}\n\tqsort(tbl, sz, sizeof(T), cmp);\n\n\tfor (i = 0; i < sz; i++) {\n\t\tans += turn*tbl[i].a - tbl[i].d;\n\t\tif (h[0] <= ans) { puts(\"-1\"); return 0; }\n\t\tturn -= tbl[i].d;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ttbl\n\t.bss\n\t.align 32\n\t.type\ttbl, @object\n\t.size\ttbl, 320016\ntbl:\n\t.zero\t320016\n\t.globl\th\n\t.align 32\n\t.type\th, @object\n\t.size\th, 160008\nh:\n\t.zero\t160008\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 160008\na:\n\t.zero\t160008\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 160008\nd:\n\t.zero\t160008\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 160008\ns:\n\t.zero\t160008\n\t.text\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %eax\n\tleal\t0(,%rax,8), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tandl\t$15, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$47, -4(%rbp)\n\tjg\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tin, .-in\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t%rax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tcmp, .-cmp\n\t.section\t.rodata\n.LC0:\n\t.string\t\"-1\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\th(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\ta(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\td(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\ts(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -36(%rbp)\n.L7:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjle\t.L8\n\tmovl\t$0, -32(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$1, -36(%rbp)\n\tjmp\t.L9\n.L15:\n\tmovl\ta(%rip), %eax\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\td(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\td(%rip), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -20(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tjle\t.L19\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L12\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L12:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\taddq\t%rax, -16(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ts(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\ts(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L14\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\taddq\t%rax, -8(%rbp)\n.L14:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\t4+tbl(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\th(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\taddl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-32(%rbp), %ecx\n\tleal\t1(%rcx), %eax\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t%edx, %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, %esi\n\tmovslq\t%ecx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ttbl(%rip), %rax\n\tmovl\t%esi, (%rdx,%rax)\n\tjmp\t.L11\n.L19:\n\tnop\n.L11:\n\taddl\t$1, -36(%rbp)\n.L9:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjle\t.L15\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\tcmp(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$8, %edx\n\tmovq\t%rax, %rsi\n\tleaq\ttbl(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L16\n.L18:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ttbl(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\t4+tbl(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tmovslq\t%edx, %rdx\n\tsubq\t%rdx, %rax\n\taddq\t%rax, -8(%rbp)\n\tmovl\th(%rip), %eax\n\tcltq\n\tcmpq\t%rax, -8(%rbp)\n\tjl\t.L17\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L17:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\t4+tbl(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsubq\t%rax, -16(%rbp)\n\taddl\t$1, -36(%rbp)\n.L16:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjl\t.L18\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L13:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\tmovzbl\t%al, %eax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tcmp, .-cmp\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.L12\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L5:\n\txorl\t%r12d, %r12d\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L3\n.L7:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L9:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L6\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L3\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t%r12d, %eax\n\tpopq\t%r12\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE39:\n\t.size\tin, .-in\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"-1\"\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.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tcall\tin\n\ttestl\t%eax, %eax\n\tjs\t.L15\n\tmovl\t%eax, 4(%rsp)\n\txorl\t%r15d, %r15d\n\tleaq\th(%rip), %r14\n\tleaq\ta(%rip), %rbp\n\tleaq\td(%rip), %r12\n\tleaq\ts(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rdx\n\tcmpq\t%rdx, %rax\n\tjnb\t.L64\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L18:\n\txorl\t%ebx, %ebx\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\tleaq\t1(%rcx), %r8\n\tmovq\t%r8, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L21\n.L20:\n\tmovq\t%r8, %rcx\n.L22:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L19\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %r8\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L20\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovl\t%ebx, (%r14,%r15,4)\n\tcmpq\t%r8, %rdx\n\tjbe\t.L65\n\tleaq\t1(%r8), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%r8), %eax\n.L24:\n\txorl\t%ebx, %ebx\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tleaq\t1(%rcx), %r8\n\tmovq\t%r8, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L27\n.L26:\n\tmovq\t%r8, %rcx\n.L28:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L25\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %r8\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L26\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\tmovl\t%ebx, 0(%rbp,%r15,4)\n\tcmpq\t%r8, %rdx\n\tjbe\t.L66\n\tleaq\t1(%r8), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%r8), %eax\n.L30:\n\txorl\t%ebx, %ebx\n\tjmp\t.L34\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\tleaq\t1(%rcx), %r8\n\tmovq\t%r8, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L33\n.L32:\n\tmovq\t%r8, %rcx\n.L34:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L31\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %r8\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L32\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\tmovl\t%ebx, (%r12,%r15,4)\n\tcmpq\t%r8, %rdx\n\tjbe\t.L67\n\tleaq\t1(%r8), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%r8), %eax\n.L36:\n\txorl\t%ebx, %ebx\n\tjmp\t.L40\n\t.p2align 4,,10\n\t.p2align 3\n.L37:\n\tleaq\t1(%rcx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L39\n.L38:\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n.L40:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L37\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L39\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovl\t%ebx, 0(%r13,%r15,4)\n\taddq\t$1, %r15\n\tcmpl\t%r15d, 4(%rsp)\n\tjge\t.L14\n\tmovl\t4(%rsp), %ebx\n\ttestl\t%ebx, %ebx\n\tjle\t.L15\n\tmovl\ta(%rip), %eax\n\txorl\t%r8d, %r8d\n\txorl\t%r15d, %r15d\n\txorl\t%r9d, %r9d\n\tmovl\td(%rip), %r11d\n\tmovl\t$1, %ecx\n\tmovl\t%eax, 4(%rsp)\n\tmovl\t0(%r13), %eax\n\tmovl\t%eax, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L46:\n\tmovl\t0(%rbp,%rcx,4), %esi\n\tmovl\t(%r12,%rcx,4), %eax\n\tsubl\t%r11d, %esi\n\ttestl\t%esi, %esi\n\tjle\t.L42\n\tmovl\t4(%rsp), %edi\n\tsubl\t%eax, %edi\n\ttestl\t%edi, %edi\n\tjle\t.L48\n\tmovslq\t%esi, %rax\n\tmovl\t8(%rsp), %edx\n\taddq\t%rax, %r15\n\tcmpl\t%edx, 0(%r13,%rcx,4)\n\tjle\t.L45\n\taddq\t%rax, %r8\n.L45:\n\tmovl\t(%r14,%rcx,4), %eax\n\tmovd\t%esi, %xmm1\n\tmovslq\t%r9d, %r10\n\taddl\t$1, %r9d\n\taddl\t%edi, %eax\n\tsubl\t$1, %eax\n\tcltd\n\tidivl\t%edi\n\tmovd\t%eax, %xmm0\n\tleaq\ttbl(%rip), %rax\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rax,%r10,8)\n.L42:\n\taddq\t$1, %rcx\n\tcmpl\t%ecx, %ebx\n\tjge\t.L46\n\tleaq\ttbl(%rip), %rbx\n\tmovslq\t%r9d, %rsi\n\tmovl\t$8, %edx\n\tmovq\t%r8, 8(%rsp)\n\tleaq\tcmp(%rip), %rcx\n\tmovq\t%rbx, %rdi\n\tmovl\t%r9d, 4(%rsp)\n\tcall\tqsort@PLT\n\tmovl\t4(%rsp), %r9d\n\tmovq\t8(%rsp), %r8\n\ttestl\t%r9d, %r9d\n\tje\t.L47\n\tleal\t-1(%r9), %ecx\n\tleaq\t8(%rbx), %rax\n\tmovslq\th(%rip), %rsi\n\tmovq\t%rbx, %rdx\n\tleaq\t(%rax,%rcx,8), %rdi\n\tjmp\t.L49\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\taddq\t$8, %rdx\n\tsubq\t%rcx, %r15\n\tcmpq\t%rdi, %rdx\n\tje\t.L47\n.L49:\n\tmovslq\t(%rdx), %rax\n\tmovslq\t4(%rdx), %rcx\n\timulq\t%r15, %rax\n\tsubq\t%rcx, %rax\n\taddq\t%rax, %r8\n\tcmpq\t%r8, %rsi\n\tjg\t.L68\n.L48:\n\tleaq\t.LC0(%rip), %rdi\n\tcall\tputs@PLT\n.L60:\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L36\n\t.p2align 4,,10\n\t.p2align 3\n.L66:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L30\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L24\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L18\n.L15:\n\tleaq\tcmp(%rip), %rcx\n\tmovl\t$8, %edx\n\txorl\t%esi, %esi\n\tleaq\ttbl(%rip), %rdi\n\tcall\tqsort@PLT\n\txorl\t%r8d, %r8d\n.L47:\n\tmovq\t%r8, %rdx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L60\n\t.cfi_endproc\n.LFE41:\n\t.size\tmain, .-main\n\t.globl\ts\n\t.bss\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 160008\ns:\n\t.zero\t160008\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 160008\nd:\n\t.zero\t160008\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 160008\na:\n\t.zero\t160008\n\t.globl\th\n\t.align 32\n\t.type\th, @object\n\t.size\th, 160008\nh:\n\t.zero\t160008\n\t.globl\ttbl\n\t.align 32\n\t.type\ttbl, @object\n\t.size\ttbl, 320016\ntbl:\n\t.zero\t320016\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tmovzbl\t%al, %eax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tcmp, .-cmp\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.L12\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L5:\n\txorl\t%r12d, %r12d\n\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L3\n.L7:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L9:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L6\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L3\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovl\t%r12d, %eax\n\tpopq\t%r12\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE39:\n\t.size\tin, .-in\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"-1\"\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.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tcall\tin\n\ttestl\t%eax, %eax\n\tjs\t.L15\n\tmovl\t%eax, 4(%rsp)\n\txorl\t%r15d, %r15d\n\tleaq\th(%rip), %r14\n\tleaq\ta(%rip), %rbp\n\tleaq\td(%rip), %r12\n\tleaq\ts(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rdx\n\tcmpq\t%rdx, %rax\n\tjnb\t.L64\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L18:\n\txorl\t%ebx, %ebx\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\tleaq\t1(%rcx), %r8\n\tmovq\t%r8, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L21\n.L20:\n\tmovq\t%r8, %rcx\n.L22:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L19\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %r8\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L20\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovl\t%ebx, (%r14,%r15,4)\n\tcmpq\t%r8, %rdx\n\tjbe\t.L65\n\tleaq\t1(%r8), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%r8), %eax\n.L24:\n\txorl\t%ebx, %ebx\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tleaq\t1(%rcx), %r8\n\tmovq\t%r8, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L27\n.L26:\n\tmovq\t%r8, %rcx\n.L28:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L25\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %r8\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L26\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\tmovl\t%ebx, 0(%rbp,%r15,4)\n\tcmpq\t%r8, %rdx\n\tjbe\t.L66\n\tleaq\t1(%r8), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%r8), %eax\n.L30:\n\txorl\t%ebx, %ebx\n\tjmp\t.L34\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\tleaq\t1(%rcx), %r8\n\tmovq\t%r8, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L33\n.L32:\n\tmovq\t%r8, %rcx\n.L34:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L31\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %r8\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L32\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\tmovl\t%ebx, (%r12,%r15,4)\n\tcmpq\t%r8, %rdx\n\tjbe\t.L67\n\tleaq\t1(%r8), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%r8), %eax\n.L36:\n\txorl\t%ebx, %ebx\n\tjmp\t.L40\n\t.p2align 4,,10\n\t.p2align 3\n.L37:\n\tleaq\t1(%rcx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L39\n.L38:\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n.L40:\n\tleal\t(%rbx,%rbx,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %ebx\n\tcmpq\t%rdx, %rcx\n\tjb\t.L37\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L39\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovl\t%ebx, 0(%r13,%r15,4)\n\taddq\t$1, %r15\n\tcmpl\t%r15d, 4(%rsp)\n\tjge\t.L14\n\tmovl\t4(%rsp), %ebx\n\ttestl\t%ebx, %ebx\n\tjle\t.L15\n\tmovl\ta(%rip), %eax\n\txorl\t%r8d, %r8d\n\txorl\t%r15d, %r15d\n\txorl\t%r9d, %r9d\n\tmovl\td(%rip), %r11d\n\tmovl\t$1, %ecx\n\tmovl\t%eax, 4(%rsp)\n\tmovl\t0(%r13), %eax\n\tmovl\t%eax, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L46:\n\tmovl\t0(%rbp,%rcx,4), %esi\n\tmovl\t(%r12,%rcx,4), %eax\n\tsubl\t%r11d, %esi\n\ttestl\t%esi, %esi\n\tjle\t.L42\n\tmovl\t4(%rsp), %edi\n\tsubl\t%eax, %edi\n\ttestl\t%edi, %edi\n\tjle\t.L48\n\tmovslq\t%esi, %rax\n\tmovl\t8(%rsp), %edx\n\taddq\t%rax, %r15\n\tcmpl\t%edx, 0(%r13,%rcx,4)\n\tjle\t.L45\n\taddq\t%rax, %r8\n.L45:\n\tmovl\t(%r14,%rcx,4), %eax\n\tmovd\t%esi, %xmm1\n\tmovslq\t%r9d, %r10\n\taddl\t$1, %r9d\n\taddl\t%edi, %eax\n\tsubl\t$1, %eax\n\tcltd\n\tidivl\t%edi\n\tmovd\t%eax, %xmm0\n\tleaq\ttbl(%rip), %rax\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%rax,%r10,8)\n.L42:\n\taddq\t$1, %rcx\n\tcmpl\t%ecx, %ebx\n\tjge\t.L46\n\tleaq\ttbl(%rip), %rbx\n\tmovslq\t%r9d, %rsi\n\tmovl\t$8, %edx\n\tmovq\t%r8, 8(%rsp)\n\tleaq\tcmp(%rip), %rcx\n\tmovq\t%rbx, %rdi\n\tmovl\t%r9d, 4(%rsp)\n\tcall\tqsort@PLT\n\tmovl\t4(%rsp), %r9d\n\tmovq\t8(%rsp), %r8\n\ttestl\t%r9d, %r9d\n\tje\t.L47\n\tleal\t-1(%r9), %ecx\n\tleaq\t8(%rbx), %rax\n\tmovslq\th(%rip), %rsi\n\tmovq\t%rbx, %rdx\n\tleaq\t(%rax,%rcx,8), %rdi\n\tjmp\t.L49\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\taddq\t$8, %rdx\n\tsubq\t%rcx, %r15\n\tcmpq\t%rdi, %rdx\n\tje\t.L47\n.L49:\n\tmovslq\t(%rdx), %rax\n\tmovslq\t4(%rdx), %rcx\n\timulq\t%r15, %rax\n\tsubq\t%rcx, %rax\n\taddq\t%rax, %r8\n\tcmpq\t%r8, %rsi\n\tjg\t.L68\n.L48:\n\tleaq\t.LC0(%rip), %rdi\n\tcall\tputs@PLT\n.L60:\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L36\n\t.p2align 4,,10\n\t.p2align 3\n.L66:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L30\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L24\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L18\n.L15:\n\tleaq\tcmp(%rip), %rcx\n\tmovl\t$8, %edx\n\txorl\t%esi, %esi\n\tleaq\ttbl(%rip), %rdi\n\tcall\tqsort@PLT\n\txorl\t%r8d, %r8d\n.L47:\n\tmovq\t%r8, %rdx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L60\n\t.cfi_endproc\n.LFE41:\n\t.size\tmain, .-main\n\t.globl\ts\n\t.bss\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 160008\ns:\n\t.zero\t160008\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 160008\nd:\n\t.zero\t160008\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 160008\na:\n\t.zero\t160008\n\t.globl\th\n\t.align 32\n\t.type\th, @object\n\t.size\th, 160008\nh:\n\t.zero\t160008\n\t.globl\ttbl\n\t.align 32\n\t.type\ttbl, @object\n\t.size\ttbl, 320016\ntbl:\n\t.zero\t320016\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "// 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[40002], d[40002], s[40002];\n\n//#define getchar_unlocked() getchar()\nint in()\n{\n\tint n = 0;\n\tint c = getchar_unlocked();\n\tdo n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();\n\twhile (c >= '0');\n\treturn n;\n}\n\nint cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; }\n\nint main()\n{\n\tint n, i, j, k, sz;\n\tlong long turn, ans;\n\n\tn = in();\n\tfor (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in();\n\t\n\tsz = 0, ans = turn = 0;\n\tfor (i = 1; i <= n; i++) {\n\t\tj = a[0] - d[i];\n\t\tk = a[i] - d[0];\n\t\tif (k <= 0) continue;\n\t\tif (j <= 0) { puts(\"-1\"); return 0; }\n\n\t\tturn += k; if (s[i] > s[0]) ans += k;\n\t\ttbl[sz].d = k;\n\t\ttbl[sz++].a = (h[i]+j-1)/j;\n\t}\n\tqsort(tbl, sz, sizeof(T), cmp);\n\n\tfor (i = 0; i < sz; i++) {\n\t\tans += turn*tbl[i].a - tbl[i].d;\n\t\tif (h[0] <= ans) { puts(\"-1\"); return 0; }\n\t\tturn -= tbl[i].d;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n", "index": 64, "inputs": [ "1\n1 0 1 1\n10000 10000 10000 10000\n", "2\n10 3 1 2\n2 4 1 3\n1 2 1 1\n", "2\n10 3 1 2\n2 4 1 3\n1 3 1 1\n", "2\n10 3 1 2\n3 4 1 3\n1 3 1 1\n", "2\n10 3 2 2\n3 4 1 3\n1 3 1 1\n", "1\n1 0 1 1\n10000 10010 10000 10000\n", "1\n1 0 1 1\n10000 10010 10000 10100\n", "1\n1 0 1 1\n10000 10010 10000 10101\n", "1\n1 0 1 1\n10000 10010 11000 10101\n", "2\n10 3 2 2\n3 8 1 3\n1 3 1 1\n", "1\n1 0 1 1\n10000 10010 11001 10101\n", "2\n10 3 2 2\n3 8 1 3\n1 6 1 1\n", "1\n1 0 1 1\n00000 10010 11001 10101\n", "2\n10 2 2 2\n3 8 1 3\n1 6 1 1\n", "1\n1 0 1 1\n00000 00010 11001 10101\n", "2\n10 2 2 2\n3 5 1 3\n1 6 1 1\n", "1\n1 0 1 1\n00000 01010 11001 10101\n", "2\n10 2 2 2\n3 5 1 5\n1 6 1 1\n", "1\n1 0 1 1\n00001 01010 11001 10101\n", "2\n10 2 2 2\n3 5 0 5\n1 6 1 1\n", "1\n1 0 1 1\n00001 01110 11001 10101\n", "2\n10 2 2 2\n3 5 0 5\n1 8 1 1\n", "1\n1 0 0 1\n00001 01110 11001 10101\n", "1\n1 0 0 1\n10001 01110 11001 10101\n", "1\n2 0 0 1\n10001 01110 11001 10101\n", "1\n2 0 0 1\n10001 01110 11001 11101\n", "1\n4 0 0 1\n10001 01110 11001 11101\n", "1\n4 0 0 1\n10001 01111 11001 11101\n", "1\n4 0 0 1\n10001 01111 10001 11101\n", "1\n4 0 0 1\n10001 01111 11001 11001\n", "1\n4 0 1 1\n10001 01111 11001 11001\n", "1\n4 0 1 1\n10001 00111 11001 11001\n", "1\n4 0 1 1\n10001 00111 01001 11001\n", "1\n4 -1 1 1\n10001 00111 01001 11001\n", "1\n4 -1 1 1\n10001 00111 01001 11101\n", "1\n1 -1 1 1\n10001 00111 01001 11101\n", "1\n1 -1 1 1\n00001 00111 01001 11101\n", "1\n0 -1 1 1\n00001 00111 01001 11101\n", "1\n0 -1 1 1\n00001 00111 01001 11111\n", "1\n0 -1 1 1\n00001 00011 01001 11111\n", "1\n0 -1 1 1\n00001 00011 01001 11011\n", "1\n0 -1 1 1\n00001 00011 01001 01011\n", "1\n0 -1 1 1\n00001 00011 01101 01011\n", "1\n0 -1 1 1\n00001 00011 01101 01001\n", "1\n0 -1 0 1\n00001 00011 01101 01001\n", "1\n0 -1 0 1\n00001 00011 01111 01001\n", "1\n0 -1 0 1\n00001 00011 11111 01001\n", "1\n0 0 0 1\n00001 00011 11111 01001\n", "1\n0 0 0 1\n00001 00011 11110 01001\n", "1\n0 0 0 1\n00001 00010 11110 01001\n", "1\n0 0 0 1\n00001 00010 11110 00001\n", "1\n0 0 0 0\n00001 00010 11110 00001\n", "1\n0 1 0 0\n00001 00010 11110 00001\n", "1\n0 1 0 0\n00001 00010 01110 00001\n", "1\n0 1 0 0\n00001 00011 01110 00001\n", "1\n0 1 -1 0\n00001 00011 01110 00001\n", "1\n0 2 -1 0\n00001 00011 01110 00001\n", "1\n0 2 -1 0\n00001 00011 01110 00101\n", "1\n0 2 -1 0\n00001 00111 01110 00101\n", "1\n0 2 -1 0\n00101 00111 01110 00101\n", "1\n0 2 -1 0\n00101 00111 01010 00101\n", "1\n0 2 -1 0\n00101 00011 01010 00101\n", "1\n0 2 -1 0\n00101 00011 01000 00101\n", "1\n0 1 -1 0\n00101 00011 01000 00101\n", "1\n0 1 -1 -1\n00101 00011 01000 00101\n", "1\n0 1 -1 -1\n00101 00011 01000 10101\n", "1\n0 2 -1 -1\n00101 00011 01000 10101\n", "1\n-1 2 -1 -1\n00101 00011 01000 10101\n", "1\n-1 2 -1 -1\n00101 00011 11000 10101\n", "1\n-1 2 -1 -1\n00111 00011 11000 10101\n", "1\n-1 2 -1 -1\n00111 00011 11010 10101\n", "1\n-1 2 -1 -1\n00111 00010 11010 10101\n", "1\n-1 2 -1 -1\n00111 00110 11010 10101\n", "1\n-1 2 -1 -1\n00111 01110 11010 10101\n", "1\n-1 2 -1 -1\n00111 01110 11010 00101\n", "1\n-1 2 -1 -1\n00111 01110 11010 00111\n", "1\n-2 2 -1 -1\n00111 01110 11010 00111\n", "1\n-2 4 -1 -1\n00111 01110 11010 00111\n", "1\n-2 4 -1 -1\n00111 01110 11000 00111\n", "1\n-2 4 -1 -1\n00111 11110 11000 00111\n", "1\n-2 4 -1 -1\n00111 11111 11000 00111\n", "1\n-2 4 -1 0\n00111 11111 11000 00111\n", "1\n-2 4 -1 -1\n00111 11101 11000 00111\n", "1\n-2 4 -1 -2\n00111 11101 11000 00111\n", "1\n-2 7 -1 -2\n00111 11101 11000 00111\n", "1\n-2 7 -1 -2\n00011 11101 11000 00111\n", "1\n-2 7 -1 -2\n10011 11101 11000 00111\n", "1\n-2 7 -1 -2\n10011 11101 11000 00101\n", "1\n-2 7 -1 -2\n11011 11101 11000 00101\n", "1\n-2 7 -1 -2\n11011 11101 11000 00111\n", "1\n-2 11 -1 -2\n11011 11101 11000 00111\n", "1\n-2 17 -1 -2\n11011 11101 11000 00111\n", "1\n-2 17 -1 -2\n11011 11101 11000 00011\n", "1\n0 17 -1 -2\n11011 11101 11000 00011\n", "1\n0 17 -1 -2\n11001 11101 11000 00011\n", "1\n0 17 -1 -2\n11101 11101 11000 00011\n", "1\n0 17 -2 -2\n11101 11101 11000 00011\n", "1\n0 13 -2 -2\n11101 11101 11000 00011\n", "1\n0 13 -2 -2\n01101 11101 11000 00011\n", "1\n0 13 -2 -1\n01101 11101 11000 00011\n", "1\n1 1 1 1\n10000 10000 10000 10000\n", "2\n10 3 1 2\n2 4 1 3\n2 2 1 1\n", "2\n10 3 1 2\n2 4 1 3\n2 2 1 1\n" ], "outputs": [ "-1\n", "4\n", "5\n", "9\n", "6\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "9\n", "-1\n", "9\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "4\n", "4\n" ], "question": "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[40002], d[40002], s[40002];\n\n//#define getchar_unlocked() getchar()\nint in()\n{\n\tint n = 0;\n\tint c = getchar_unlocked();\n\tdo n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();\n\twhile (c >= '0');\n\treturn n;\n}\n\nint cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; }\n\nint main()\n{\n\tint n, i, j, k, sz;\n\tlong long turn, ans;\n\n\tn = in();\n\tfor (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in();\n\t\n\tsz = 0, ans = turn = 0;\n\tfor (i = 1; i <= n; i++) {\n\t\tj = a[0] - d[i];\n\t\tk = a[i] - d[0];\n\t\tif (k <= 0) continue;\n\t\tif (j <= 0) { puts(\"-1\"); return 0; }\n\n\t\tturn += k; if (s[i] > s[0]) ans += k;\n\t\ttbl[sz].d = k;\n\t\ttbl[sz++].a = (h[i]+j-1)/j;\n\t}\n\tqsort(tbl, sz, sizeof(T), cmp);\n\n\tfor (i = 0; i < sz; i++) {\n\t\tans += turn*tbl[i].a - tbl[i].d;\n\t\tif (h[0] <= ans) { puts(\"-1\"); return 0; }\n\t\tturn -= tbl[i].d;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ttbl\n\t.bss\n\t.align 32\n\t.type\ttbl, @object\n\t.size\ttbl, 320016\ntbl:\n\t.zero\t320016\n\t.globl\th\n\t.align 32\n\t.type\th, @object\n\t.size\th, 160008\nh:\n\t.zero\t160008\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 160008\na:\n\t.zero\t160008\n\t.globl\td\n\t.align 32\n\t.type\td, @object\n\t.size\td, 160008\nd:\n\t.zero\t160008\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 160008\ns:\n\t.zero\t160008\n\t.text\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %eax\n\tleal\t0(,%rax,8), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tandl\t$15, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$47, -4(%rbp)\n\tjg\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tin, .-in\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t%rax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t4(%rax), %eax\n\tcltq\n\timulq\t%rcx, %rax\n\tcmpq\t%rax, %rdx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tcmp, .-cmp\n\t.section\t.rodata\n.LC0:\n\t.string\t\"-1\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\th(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\ta(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\td(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\ts(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -36(%rbp)\n.L7:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjle\t.L8\n\tmovl\t$0, -32(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$1, -36(%rbp)\n\tjmp\t.L9\n.L15:\n\tmovl\ta(%rip), %eax\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\td(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\td(%rip), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -20(%rbp)\n\tcmpl\t$0, -20(%rbp)\n\tjle\t.L19\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L12\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L12:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\taddq\t%rax, -16(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ts(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\ts(%rip), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L14\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\taddq\t%rax, -8(%rbp)\n.L14:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\t4+tbl(%rip), %rdx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\th(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\taddl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-32(%rbp), %ecx\n\tleal\t1(%rcx), %eax\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t%edx, %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, %esi\n\tmovslq\t%ecx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ttbl(%rip), %rax\n\tmovl\t%esi, (%rdx,%rax)\n\tjmp\t.L11\n.L19:\n\tnop\n.L11:\n\taddl\t$1, -36(%rbp)\n.L9:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjle\t.L15\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\tcmp(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$8, %edx\n\tmovq\t%rax, %rsi\n\tleaq\ttbl(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L16\n.L18:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ttbl(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovl\t-36(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tleaq\t4+tbl(%rip), %rdx\n\tmovl\t(%rcx,%rdx), %edx\n\tmovslq\t%edx, %rdx\n\tsubq\t%rdx, %rax\n\taddq\t%rax, -8(%rbp)\n\tmovl\th(%rip), %eax\n\tcltq\n\tcmpq\t%rax, -8(%rbp)\n\tjl\t.L17\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L13\n.L17:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\t4+tbl(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsubq\t%rax, -16(%rbp)\n\taddl\t$1, -36(%rbp)\n.L16:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-32(%rbp), %eax\n\tjl\t.L18\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n.L13:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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]; //#define getchar_unlocked() getchar() int in() { int n = 0; int c = getchar_unlocked(); do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); return n; } int cmp(T *a, T *b) { return ((long long)a->a) * b->d > ((long long)b->a) * a->d; } int main() { int n, i, j, k, sz; long long turn, ans; n = in(); for (i = 0; i <= n; i++) h[i] = in(), a[i] = in(), d[i] = in(), s[i] = in(); sz = 0, ans = turn = 0; for (i = 1; i <= n; i++) { j = a[0] - d[i]; k = a[i] - d[0]; if (k <= 0) continue; if (j <= 0) { puts("-1"); return 0; } turn += k; if (s[i] > s[0]) ans += k; tbl[sz].d = k; tbl[sz++].a = (h[i]+j-1)/j; } qsort(tbl, sz, sizeof(T), cmp); for (i = 0; i < sz; i++) { ans += turn*tbl[i].a - tbl[i].d; if (h[0] <= ans) { puts("-1"); return 0; } turn -= tbl[i].d; } printf("%lld\n", ans); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl tbl .bss .align 32 .type tbl, @object .size tbl, 320016 tbl: .zero 320016 .globl h .align 32 .type h, @object .size h, 160008 h: .zero 160008 .globl a .align 32 .type a, @object .size a, 160008 a: .zero 160008 .globl d .align 32 .type d, @object .size d, 160008 d: .zero 160008 .globl s .align 32 .type s, @object .size s, 160008 s: .zero 160008 .text .globl in .type in, @function in: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl $0, -8(%rbp) call getchar_unlocked@PLT movl %eax, -4(%rbp) .L2: movl -8(%rbp), %eax leal 0(,%rax,8), %edx movl -8(%rbp), %eax addl %eax, %eax addl %eax, %edx movl -4(%rbp), %eax andl $15, %eax addl %edx, %eax movl %eax, -8(%rbp) call getchar_unlocked@PLT movl %eax, -4(%rbp) cmpl $47, -4(%rbp) jg .L2 movl -8(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size in, .-in .globl cmp .type cmp, @function cmp: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %eax movslq %eax, %rdx movq -16(%rbp), %rax movl 4(%rax), %eax cltq imulq %rax, %rdx movq -16(%rbp), %rax movl (%rax), %eax movslq %eax, %rcx movq -8(%rbp), %rax movl 4(%rax), %eax cltq imulq %rcx, %rax cmpq %rax, %rdx setg %al movzbl %al, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size cmp, .-cmp .section .rodata .LC0: .string "-1" .LC1: .string "%lld\n" .text .globl main .type main, @function main: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movl $0, %eax call in movl %eax, -28(%rbp) movl $0, -36(%rbp) jmp .L7 .L8: movl $0, %eax call in movl -36(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq h(%rip), %rdx movl %eax, (%rcx,%rdx) movl $0, %eax call in movl -36(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq a(%rip), %rdx movl %eax, (%rcx,%rdx) movl $0, %eax call in movl -36(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq d(%rip), %rdx movl %eax, (%rcx,%rdx) movl $0, %eax call in movl -36(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq s(%rip), %rdx movl %eax, (%rcx,%rdx) addl $1, -36(%rbp) .L7: movl -36(%rbp), %eax cmpl -28(%rbp), %eax jle .L8 movl $0, -32(%rbp) movq $0, -16(%rbp) movq -16(%rbp), %rax movq %rax, -8(%rbp) movl $1, -36(%rbp) jmp .L9 .L15: movl a(%rip), %eax movl -36(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq d(%rip), %rdx movl (%rcx,%rdx), %edx subl %edx, %eax movl %eax, -24(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax movl d(%rip), %edx subl %edx, %eax movl %eax, -20(%rbp) cmpl $0, -20(%rbp) jle .L19 cmpl $0, -24(%rbp) jg .L12 leaq .LC0(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L13 .L12: movl -20(%rbp), %eax cltq addq %rax, -16(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq s(%rip), %rax movl (%rdx,%rax), %edx movl s(%rip), %eax cmpl %eax, %edx jle .L14 movl -20(%rbp), %eax cltq addq %rax, -8(%rbp) .L14: movl -32(%rbp), %eax cltq leaq 0(,%rax,8), %rcx leaq 4+tbl(%rip), %rdx movl -20(%rbp), %eax movl %eax, (%rcx,%rdx) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq h(%rip), %rax movl (%rdx,%rax), %edx movl -24(%rbp), %eax addl %edx, %eax leal -1(%rax), %edx movl -32(%rbp), %ecx leal 1(%rcx), %eax movl %eax, -32(%rbp) movl %edx, %eax cltd idivl -24(%rbp) movl %eax, %esi movslq %ecx, %rax leaq 0(,%rax,8), %rdx leaq tbl(%rip), %rax movl %esi, (%rdx,%rax) jmp .L11 .L19: nop .L11: addl $1, -36(%rbp) .L9: movl -36(%rbp), %eax cmpl -28(%rbp), %eax jle .L15 movl -32(%rbp), %eax cltq leaq cmp(%rip), %rdx movq %rdx, %rcx movl $8, %edx movq %rax, %rsi leaq tbl(%rip), %rax movq %rax, %rdi call qsort@PLT movl $0, -36(%rbp) jmp .L16 .L18: movl -36(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq tbl(%rip), %rax movl (%rdx,%rax), %eax cltq imulq -16(%rbp), %rax movl -36(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,8), %rcx leaq 4+tbl(%rip), %rdx movl (%rcx,%rdx), %edx movslq %edx, %rdx subq %rdx, %rax addq %rax, -8(%rbp) movl h(%rip), %eax cltq cmpq %rax, -8(%rbp) jl .L17 leaq .LC0(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L13 .L17: movl -36(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq 4+tbl(%rip), %rax movl (%rdx,%rax), %eax cltq subq %rax, -16(%rbp) addl $1, -36(%rbp) .L16: movl -36(%rbp), %eax cmpl -32(%rbp), %eax jl .L18 movq -8(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax .L13: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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=acos((a[2]-b[2])/l);//printf(\"%lf %lf\\n\",l,c);\n if(a[2]>l+b[2]+eps||b[2]>l+a[2]+eps)return 0;\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] );\n x[0]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] );\n y[0]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]);\n if(a[2]+eps>l+b[2]||b[2]+eps>l+a[2])return 1;\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] );\n x[1]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] );\n y[1]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]);\n if(l+eps<a[2]+b[2])return 2;\n c=acos((a[2]+b[2])/l);//printf(\"%lf %lf\\n\",l,c);\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] );\n x[2]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] );\n y[2]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]);\n if(l<a[2]+b[2]+eps)return 3;\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] );\n x[3]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] );\n y[3]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]);\n return 4;\n}\n\nint main(){\n int p[2][3],i,j,n,r[4];//xyr\n for(i=0;i<6;i++)scanf(\"%d\",&p[i/3][i%3]);\n n=f(p[0],p[1]);\n for(i=0;i<n;i++){\n for(j=i;j;j--){\n if(x[r[j-1]]+eps<x[i]||(fabs(x[r[j-1]]-x[i])<eps&&y[r[j-1]]+eps<y[i]))break;\n r[j]=r[j-1];\n }\n r[j]=i;\n }\n for(i=0;i<n;i++)printf(\"%.10lf %.10lf\\n\",x[r[i]],y[r[i]]);\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tx\n\t.bss\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 32\nx:\n\t.zero\t32\n\t.globl\ty\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 32\ny:\n\t.zero\t32\n\t.globl\teps\n\t.data\n\t.align 8\n\t.type\teps, @object\n\t.size\teps, 8\neps:\n\t.long\t-1598689907\n\t.long\t1051772663\n\t.text\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rsi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rsi, %rax\n\tsubl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\taddl\t$1, -20(%rbp)\n.L2:\n\tcmpl\t$1, -20(%rbp)\n\tjle\t.L3\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovq\t%xmm5, %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\thypot@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tmovq\t-48(%rbp), %rdx\n\taddq\t$8, %rdx\n\tmovl\t(%rdx), %edx\n\tsubl\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-16(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tacos@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovapd\t%xmm1, %xmm2\n\taddsd\t-16(%rbp), %xmm2\n\tmovsd\teps(%rip), %xmm1\n\taddsd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L4\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovapd\t%xmm1, %xmm2\n\taddsd\t-16(%rbp), %xmm2\n\tmovsd\teps(%rip), %xmm1\n\taddsd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L17\n.L4:\n\tmovl\t$0, %eax\n\tjmp\t.L7\n.L17:\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm6, %xmm6\n\tcvtsi2sdl\t%eax, %xmm6\n\tmovsd\t%xmm6, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t%eax, %xmm7\n\tmovsd\t%xmm7, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovsd\t%xmm5, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovsd\t%xmm3, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, y(%rip)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\taddsd\t-16(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L8\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\taddsd\t-16(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L18\n.L8:\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L18:\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t%eax, %xmm4\n\tmovsd\t%xmm4, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm6, %xmm6\n\tcvtsi2sdl\t%eax, %xmm6\n\tmovsd\t%xmm6, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 8+x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t%eax, %xmm7\n\tmovsd\t%xmm7, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovsd\t%xmm5, -64(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\tmovapd\t%xmm0, %xmm3\n\txorpd\t%xmm1, %xmm3\n\tmovq\t%xmm3, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 8+y(%rip)\n\tmovsd\teps(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\taddsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L19\n\tmovl\t$2, %eax\n\tjmp\t.L7\n.L19:\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-16(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tacos@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovsd\t%xmm3, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t%eax, %xmm4\n\tmovsd\t%xmm4, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 16+x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm6, %xmm6\n\tcvtsi2sdl\t%eax, %xmm6\n\tmovsd\t%xmm6, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t%eax, %xmm7\n\tmovsd\t%xmm7, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 16+y(%rip)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L20\n\tmovl\t$3, %eax\n\tjmp\t.L7\n.L20:\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovsd\t%xmm2, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovsd\t%xmm5, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 24+x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovsd\t%xmm3, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t%eax, %xmm4\n\tmovsd\t%xmm4, -64(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\tmovapd\t%xmm0, %xmm4\n\txorpd\t%xmm1, %xmm4\n\tmovq\t%xmm4, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 24+y(%rip)\n\tmovl\t$4, %eax\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tf, .-f\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%d\"\n.LC3:\n\t.string\t\"%.10lf %.10lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -60(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovl\t-60(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1431655766, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$31, %eax\n\tmovl\t%edx, %esi\n\tsubl\t%eax, %esi\n\tmovl\t-60(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1431655766, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%edx, %ecx\n\tsarl\t$31, %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %ecx\n\taddl\t%ecx, %ecx\n\taddl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tleaq\t-32(%rbp), %rcx\n\tmovslq\t%eax, %rdi\n\tmovslq\t%esi, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rdi, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -60(%rbp)\n.L22:\n\tcmpl\t$5, -60(%rbp)\n\tjle\t.L23\n\tleaq\t-32(%rbp), %rax\n\tleaq\t12(%rax), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tf\n\tmovl\t%eax, -52(%rbp)\n\tmovl\t$0, -60(%rbp)\n\tjmp\t.L24\n.L30:\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, -56(%rbp)\n\tjmp\t.L25\n.L29:\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm0, %xmm1\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L26\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm1\n\tsubsd\t%xmm1, %xmm0\n\tmovq\t.LC2(%rip), %xmm1\n\tandpd\t%xmm0, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L27\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm0, %xmm1\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L26\n.L27:\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %edx\n\tmovl\t-56(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\tsubl\t$1, -56(%rbp)\n.L25:\n\tcmpl\t$0, -56(%rbp)\n\tjne\t.L29\n.L26:\n\tmovl\t-56(%rbp), %eax\n\tcltq\n\tmovl\t-60(%rbp), %edx\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\taddl\t$1, -60(%rbp)\n.L24:\n\tmovl\t-60(%rbp), %eax\n\tcmpl\t-52(%rbp), %eax\n\tjl\t.L30\n\tmovl\t$0, -60(%rbp)\n\tjmp\t.L31\n.L32:\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$2, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -60(%rbp)\n.L31:\n\tmovl\t-60(%rbp), %eax\n\tcmpl\t-52(%rbp), %eax\n\tjl\t.L32\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L34\n\tcall\t__stack_chk_fail@PLT\n.L34:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t-2147483648\n\t.long\t0\n\t.long\t0\n\t.align 16\n.LC2:\n\t.long\t-1\n\t.long\t2147483647\n\t.long\t0\n\t.long\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tmovq\t%rdi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rsi, %rbx\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovl\t(%rsi), %edx\n\tsubl\t(%rdi), %edx\n\tmovl\t4(%rsi), %eax\n\tmovl\t%edx, (%rsi)\n\tcvtsi2sdl\t%edx, %xmm0\n\tsubl\t4(%rdi), %eax\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovl\t%eax, 4(%rsi)\n\tcall\thypot@PLT\n\tmovl\t8(%rbp), %eax\n\tsubl\t8(%rbx), %eax\n\tmovapd\t%xmm0, %xmm1\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t%xmm1, (%rsp)\n\tdivsd\t%xmm1, %xmm0\n\tcall\tacos@PLT\n\tmovl\t8(%rbx), %r15d\n\tpxor\t%xmm5, %xmm5\n\txorl\t%eax, %eax\n\tmovsd\t(%rsp), %xmm1\n\tmovl\t8(%rbp), %r14d\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%r15d, %xmm5\n\tmovsd\teps(%rip), %xmm4\n\tcvtsi2sdl\t%r14d, %xmm3\n\tmovapd\t%xmm5, %xmm8\n\taddsd\t%xmm1, %xmm8\n\tmovapd\t%xmm8, %xmm2\n\tmovsd\t%xmm8, (%rsp)\n\taddsd\t%xmm4, %xmm2\n\tcomisd\t%xmm2, %xmm3\n\tja\t.L1\n\tmovapd\t%xmm3, %xmm10\n\tmovapd\t%xmm4, %xmm2\n\tmovsd\t%xmm3, 24(%rsp)\n\taddsd\t%xmm1, %xmm10\n\tmovsd\t%xmm1, 16(%rsp)\n\tmovsd\t%xmm4, 8(%rsp)\n\tmovsd\t%xmm5, 32(%rsp)\n\taddsd\t%xmm10, %xmm2\n\tmovsd\t%xmm10, 40(%rsp)\n\tcomisd\t%xmm2, %xmm5\n\tja\t.L1\n\tleaq\t72(%rsp), %r12\n\tleaq\t64(%rsp), %r13\n\tmovsd\t%xmm0, 56(%rsp)\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\tcall\tsincos@PLT\n\tpxor\t%xmm6, %xmm6\n\tpxor\t%xmm14, %xmm14\n\tmovsd\t64(%rsp), %xmm9\n\tcvtsi2sdl\t(%rbx), %xmm6\n\tpxor\t%xmm12, %xmm12\n\tmovl\t$1, %eax\n\tmovsd\t72(%rsp), %xmm2\n\tcvtsi2sdl\t4(%rbx), %xmm14\n\tmovsd\t24(%rsp), %xmm3\n\tmovsd\t16(%rsp), %xmm1\n\tcvtsi2sdl\t0(%rbp), %xmm12\n\tmovsd\t8(%rsp), %xmm4\n\tmovsd\t(%rsp), %xmm8\n\tmovapd\t%xmm6, %xmm7\n\tmovsd\t%xmm6, 48(%rsp)\n\tmulsd\t%xmm9, %xmm7\n\tmovapd\t%xmm14, %xmm13\n\tmulsd\t%xmm2, %xmm13\n\tmulsd\t%xmm14, %xmm9\n\tmulsd\t%xmm6, %xmm2\n\tmovapd\t%xmm7, %xmm11\n\tsubsd\t%xmm13, %xmm11\n\tmovsd\t%xmm9, 24(%rsp)\n\taddsd\t%xmm9, %xmm2\n\tmulsd\t%xmm3, %xmm11\n\tmulsd\t%xmm3, %xmm2\n\tdivsd\t%xmm1, %xmm11\n\tdivsd\t%xmm1, %xmm2\n\taddsd\t%xmm12, %xmm11\n\tmovsd\t%xmm11, x(%rip)\n\tpxor\t%xmm11, %xmm11\n\tcvtsi2sdl\t4(%rbp), %xmm11\n\tmovsd\t%xmm11, 16(%rsp)\n\taddsd\t%xmm11, %xmm2\n\tmovsd\t%xmm2, y(%rip)\n\tmovapd\t%xmm3, %xmm2\n\taddsd\t%xmm4, %xmm2\n\tcomisd\t%xmm8, %xmm2\n\tja\t.L1\n\tmovsd\t32(%rsp), %xmm5\n\tmovsd\t40(%rsp), %xmm10\n\tmovsd\t%xmm4, (%rsp)\n\taddsd\t%xmm4, %xmm5\n\tcomisd\t%xmm10, %xmm5\n\tja\t.L1\n\taddsd\t%xmm13, %xmm7\n\tmovsd\t56(%rsp), %xmm0\n\tmovsd\t%xmm3, 32(%rsp)\n\taddl\t%r15d, %r14d\n\txorpd\t.LC0(%rip), %xmm0\n\tmovsd\t%xmm1, 8(%rsp)\n\tmulsd\t%xmm3, %xmm7\n\tdivsd\t%xmm1, %xmm7\n\taddsd\t%xmm12, %xmm7\n\tmovsd\t%xmm7, 8+x(%rip)\n\tcall\tsin@PLT\n\tmovsd\t48(%rsp), %xmm6\n\tmovsd\t(%rsp), %xmm4\n\tmovl\t$2, %eax\n\tmovsd\t24(%rsp), %xmm9\n\tmovsd\t32(%rsp), %xmm3\n\tmulsd\t%xmm0, %xmm6\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t8(%rsp), %xmm1\n\tmovapd\t%xmm4, %xmm2\n\tcvtsi2sdl\t%r14d, %xmm0\n\tmovsd\t16(%rsp), %xmm11\n\taddsd\t%xmm1, %xmm2\n\taddsd\t%xmm9, %xmm6\n\tcomisd\t%xmm2, %xmm0\n\tmulsd\t%xmm3, %xmm6\n\tdivsd\t%xmm1, %xmm6\n\taddsd\t%xmm11, %xmm6\n\tmovsd\t%xmm6, 8+y(%rip)\n\tja\t.L1\n\tdivsd\t%xmm1, %xmm0\n\tcall\tacos@PLT\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\tmovsd\t%xmm0, 32(%rsp)\n\tcall\tsincos@PLT\n\tpxor\t%xmm3, %xmm3\n\tmovl\t8(%rbp), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t(%rbx), %xmm3\n\tpxor\t%xmm11, %xmm11\n\tmovsd\t64(%rsp), %xmm8\n\tmovsd\t72(%rsp), %xmm2\n\tcvtsi2sdl\t4(%rbx), %xmm11\n\tmovsd\t8(%rsp), %xmm1\n\tpxor\t%xmm9, %xmm9\n\tmovsd\t(%rsp), %xmm4\n\tcvtsi2sdl\t%eax, %xmm7\n\taddl\t8(%rbx), %eax\n\tcvtsi2sdl\t0(%rbp), %xmm9\n\tmovapd\t%xmm3, %xmm6\n\tmovsd\t%xmm3, 24(%rsp)\n\tmulsd\t%xmm8, %xmm6\n\tmovapd\t%xmm11, %xmm10\n\tmulsd\t%xmm2, %xmm10\n\tmulsd\t%xmm11, %xmm8\n\tmulsd\t%xmm3, %xmm2\n\tmovapd\t%xmm6, %xmm5\n\tsubsd\t%xmm10, %xmm5\n\tmovsd\t%xmm8, 16(%rsp)\n\taddsd\t%xmm8, %xmm2\n\tmulsd\t%xmm7, %xmm5\n\tmulsd\t%xmm7, %xmm2\n\tdivsd\t%xmm1, %xmm5\n\tdivsd\t%xmm1, %xmm2\n\taddsd\t%xmm9, %xmm5\n\tmovsd\t%xmm5, 16+x(%rip)\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t4(%rbp), %xmm5\n\tmovsd\t%xmm5, 8(%rsp)\n\taddsd\t%xmm5, %xmm2\n\tmovsd\t%xmm2, 16+y(%rip)\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovl\t$3, %eax\n\taddsd\t%xmm4, %xmm2\n\tcomisd\t%xmm1, %xmm2\n\tja\t.L1\n\taddsd\t%xmm10, %xmm6\n\tmovsd\t32(%rsp), %xmm0\n\tmovsd\t%xmm7, 40(%rsp)\n\txorpd\t.LC0(%rip), %xmm0\n\tmovsd\t%xmm1, (%rsp)\n\tmulsd\t%xmm7, %xmm6\n\tdivsd\t%xmm1, %xmm6\n\taddsd\t%xmm9, %xmm6\n\tmovsd\t%xmm6, 24+x(%rip)\n\tcall\tsin@PLT\n\tmovsd\t24(%rsp), %xmm3\n\tmovsd\t40(%rsp), %xmm7\n\tmovl\t$4, %eax\n\tmovsd\t16(%rsp), %xmm8\n\tmovsd\t(%rsp), %xmm1\n\tmulsd\t%xmm3, %xmm0\n\tmovsd\t8(%rsp), %xmm5\n\taddsd\t%xmm8, %xmm0\n\tmovapd\t%xmm0, %xmm3\n\tmulsd\t%xmm7, %xmm3\n\tdivsd\t%xmm1, %xmm3\n\taddsd\t%xmm5, %xmm3\n\tmovsd\t%xmm3, 24+y(%rip)\n.L1:\n\taddq\t$88, %rsp\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tf, .-f\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d\"\n.LC3:\n\t.string\t\"%.10lf %.10lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\txorl\t%r13d, %r13d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC1(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tmovl\t$2863311531, %ebx\n\tsubq\t$48, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovl\t%r13d, %eax\n\tmovq\t%r12, %rdi\n\timulq\t%rbx, %rax\n\tshrq\t$33, %rax\n\tleal\t(%rax,%rax,2), %ecx\n\tmovslq\t%eax, %rdx\n\tmovl\t%r13d, %eax\n\taddl\t$1, %r13d\n\tsubl\t%ecx, %eax\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tcltq\n\taddq\t%rdx, %rax\n\tleaq\t0(%rbp,%rax,4), %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$6, %r13d\n\tjne\t.L12\n\tleaq\t28(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\tcall\tf\n\ttestl\t%eax, %eax\n\tjle\t.L13\n\tmovl\t$0, (%rsp)\n\tmovsd\teps(%rip), %xmm0\n\tleaq\tx(%rip), %rbp\n\tleaq\ty(%rip), %r12\n\tcmpl\t$1, %eax\n\tje\t.L14\n\tmovsd\tx(%rip), %xmm1\n\tmovapd\t%xmm0, %xmm3\n\tmovsd\t8+x(%rip), %xmm2\n\taddsd\t%xmm1, %xmm3\n\tcomisd\t%xmm3, %xmm2\n\tja\t.L34\n\tsubsd\t%xmm2, %xmm1\n\tandpd\t.LC2(%rip), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L16\n.L17:\n\tmovl\t$0, 4(%rsp)\n\txorl\t%edx, %edx\n.L15:\n\tmovl\t$1, (%rsp,%rdx,4)\n\tleaq\tx(%rip), %rbp\n\tleaq\ty(%rip), %r12\n\tcmpl\t$2, %eax\n\tje\t.L14\n\tmovslq\t4(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm2\n\tmovsd\t16+x(%rip), %xmm3\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm2\n\tcomisd\t%xmm2, %xmm3\n\tja\t.L35\n\tsubsd\t%xmm3, %xmm1\n\tmovq\t.LC2(%rip), %xmm2\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L23\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t16+y(%rip), %xmm4\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm4\n\tja\t.L35\n.L23:\n\tmovslq\t(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm4\n\tmovl\t%edx, 8(%rsp)\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm4\n\tcomisd\t%xmm4, %xmm3\n\tja\t.L37\n\tsubsd\t%xmm3, %xmm1\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L22\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t16+y(%rip), %xmm2\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm2\n\tja\t.L37\n.L22:\n\tmovl\t%edx, 4(%rsp)\n\txorl\t%edx, %edx\n.L19:\n\tmovl\t$2, (%rsp,%rdx,4)\n\tcmpl\t$3, %eax\n\tje\t.L14\n\tmovslq\t8(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm2\n\tmovsd\t24+x(%rip), %xmm3\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm2\n\tcomisd\t%xmm2, %xmm3\n\tja\t.L39\n\tsubsd\t%xmm3, %xmm1\n\tmovq\t.LC2(%rip), %xmm2\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L61\n.L26:\n\tmovslq\t4(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm4\n\tmovl\t%edx, 12(%rsp)\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm4\n\tcomisd\t%xmm4, %xmm3\n\tja\t.L41\n\tsubsd\t%xmm3, %xmm1\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L62\n.L28:\n\tmovslq\t(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm4\n\tmovl\t%edx, 8(%rsp)\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm4\n\tcomisd\t%xmm4, %xmm3\n\tja\t.L43\n\tsubsd\t%xmm3, %xmm1\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L63\n.L30:\n\tmovl\t%edx, 4(%rsp)\n\txorl\t%edx, %edx\n.L25:\n\tmovl\t$3, (%rsp,%rdx,4)\n.L14:\n\tsubl\t$1, %eax\n\tmovq\t%rsp, %rbx\n\tleaq\t.LC3(%rip), %r13\n\tleaq\t4(%rsp,%rax,4), %r14\n.L32:\n\tmovslq\t(%rbx), %rax\n\tmovq\t%r13, %rsi\n\tmovl\t$1, %edi\n\taddq\t$4, %rbx\n\tmovsd\t0(%rbp,%rax,8), %xmm0\n\tmovsd\t(%r12,%rax,8), %xmm1\n\tmovl\t$2, %eax\n\tcall\t__printf_chk@PLT\n\tcmpq\t%r14, %rbx\n\tjne\t.L32\n.L13:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L64\n\taddq\t$48, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tmovsd\ty(%rip), %xmm1\n\tmovsd\t8+y(%rip), %xmm2\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm2\n\tjbe\t.L17\n.L34:\n\tmovl\t$1, %edx\n\tjmp\t.L15\n.L61:\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t24+y(%rip), %xmm4\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm4\n\tjbe\t.L26\n.L39:\n\tmovl\t$3, %edx\n\tjmp\t.L25\n.L62:\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t24+y(%rip), %xmm4\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm4\n\tjbe\t.L28\n.L41:\n\tmovl\t$2, %edx\n\tjmp\t.L25\n.L63:\n\taddsd\t(%r12,%rcx,8), %xmm0\n\tmovsd\t24+y(%rip), %xmm1\n\tcomisd\t%xmm0, %xmm1\n\tjbe\t.L30\n.L43:\n\tmovl\t$1, %edx\n\tjmp\t.L25\n.L35:\n\tmovl\t$2, %edx\n\tjmp\t.L19\n.L37:\n\tmovl\t$1, %edx\n\tjmp\t.L19\n.L64:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.globl\teps\n\t.data\n\t.align 8\n\t.type\teps, @object\n\t.size\teps, 8\neps:\n\t.long\t-1598689907\n\t.long\t1051772663\n\t.globl\ty\n\t.bss\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 32\ny:\n\t.zero\t32\n\t.globl\tx\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 32\nx:\n\t.zero\t32\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t-2147483648\n\t.long\t0\n\t.long\t0\n\t.align 16\n.LC2:\n\t.long\t-1\n\t.long\t2147483647\n\t.long\t0\n\t.long\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tmovq\t%rdi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rsi, %rbx\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovl\t(%rsi), %edx\n\tsubl\t(%rdi), %edx\n\tmovl\t4(%rsi), %eax\n\tmovl\t%edx, (%rsi)\n\tcvtsi2sdl\t%edx, %xmm0\n\tsubl\t4(%rdi), %eax\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovl\t%eax, 4(%rsi)\n\tcall\thypot@PLT\n\tmovl\t8(%rbp), %eax\n\tsubl\t8(%rbx), %eax\n\tmovapd\t%xmm0, %xmm1\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t%xmm1, (%rsp)\n\tdivsd\t%xmm1, %xmm0\n\tcall\tacos@PLT\n\tmovl\t8(%rbx), %r15d\n\tpxor\t%xmm5, %xmm5\n\txorl\t%eax, %eax\n\tmovsd\t(%rsp), %xmm1\n\tmovl\t8(%rbp), %r14d\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%r15d, %xmm5\n\tmovsd\teps(%rip), %xmm4\n\tcvtsi2sdl\t%r14d, %xmm3\n\tmovapd\t%xmm5, %xmm8\n\taddsd\t%xmm1, %xmm8\n\tmovapd\t%xmm8, %xmm2\n\tmovsd\t%xmm8, (%rsp)\n\taddsd\t%xmm4, %xmm2\n\tcomisd\t%xmm2, %xmm3\n\tja\t.L1\n\tmovapd\t%xmm3, %xmm10\n\tmovapd\t%xmm4, %xmm2\n\tmovsd\t%xmm3, 24(%rsp)\n\taddsd\t%xmm1, %xmm10\n\tmovsd\t%xmm1, 16(%rsp)\n\tmovsd\t%xmm4, 8(%rsp)\n\tmovsd\t%xmm5, 32(%rsp)\n\taddsd\t%xmm10, %xmm2\n\tmovsd\t%xmm10, 40(%rsp)\n\tcomisd\t%xmm2, %xmm5\n\tja\t.L1\n\tleaq\t72(%rsp), %r12\n\tleaq\t64(%rsp), %r13\n\tmovsd\t%xmm0, 56(%rsp)\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\tcall\tsincos@PLT\n\tpxor\t%xmm6, %xmm6\n\tpxor\t%xmm14, %xmm14\n\tmovsd\t64(%rsp), %xmm9\n\tcvtsi2sdl\t(%rbx), %xmm6\n\tpxor\t%xmm12, %xmm12\n\tmovl\t$1, %eax\n\tmovsd\t72(%rsp), %xmm2\n\tcvtsi2sdl\t4(%rbx), %xmm14\n\tmovsd\t24(%rsp), %xmm3\n\tmovsd\t16(%rsp), %xmm1\n\tcvtsi2sdl\t0(%rbp), %xmm12\n\tmovsd\t8(%rsp), %xmm4\n\tmovsd\t(%rsp), %xmm8\n\tmovapd\t%xmm6, %xmm7\n\tmovsd\t%xmm6, 48(%rsp)\n\tmulsd\t%xmm9, %xmm7\n\tmovapd\t%xmm14, %xmm13\n\tmulsd\t%xmm2, %xmm13\n\tmulsd\t%xmm14, %xmm9\n\tmulsd\t%xmm6, %xmm2\n\tmovapd\t%xmm7, %xmm11\n\tsubsd\t%xmm13, %xmm11\n\tmovsd\t%xmm9, 24(%rsp)\n\taddsd\t%xmm9, %xmm2\n\tmulsd\t%xmm3, %xmm11\n\tmulsd\t%xmm3, %xmm2\n\tdivsd\t%xmm1, %xmm11\n\tdivsd\t%xmm1, %xmm2\n\taddsd\t%xmm12, %xmm11\n\tmovsd\t%xmm11, x(%rip)\n\tpxor\t%xmm11, %xmm11\n\tcvtsi2sdl\t4(%rbp), %xmm11\n\tmovsd\t%xmm11, 16(%rsp)\n\taddsd\t%xmm11, %xmm2\n\tmovsd\t%xmm2, y(%rip)\n\tmovapd\t%xmm3, %xmm2\n\taddsd\t%xmm4, %xmm2\n\tcomisd\t%xmm8, %xmm2\n\tja\t.L1\n\tmovsd\t32(%rsp), %xmm5\n\tmovsd\t40(%rsp), %xmm10\n\tmovsd\t%xmm4, (%rsp)\n\taddsd\t%xmm4, %xmm5\n\tcomisd\t%xmm10, %xmm5\n\tja\t.L1\n\taddsd\t%xmm13, %xmm7\n\tmovsd\t56(%rsp), %xmm0\n\tmovsd\t%xmm3, 32(%rsp)\n\taddl\t%r15d, %r14d\n\txorpd\t.LC0(%rip), %xmm0\n\tmovsd\t%xmm1, 8(%rsp)\n\tmulsd\t%xmm3, %xmm7\n\tdivsd\t%xmm1, %xmm7\n\taddsd\t%xmm12, %xmm7\n\tmovsd\t%xmm7, 8+x(%rip)\n\tcall\tsin@PLT\n\tmovsd\t48(%rsp), %xmm6\n\tmovsd\t(%rsp), %xmm4\n\tmovl\t$2, %eax\n\tmovsd\t24(%rsp), %xmm9\n\tmovsd\t32(%rsp), %xmm3\n\tmulsd\t%xmm0, %xmm6\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t8(%rsp), %xmm1\n\tmovapd\t%xmm4, %xmm2\n\tcvtsi2sdl\t%r14d, %xmm0\n\tmovsd\t16(%rsp), %xmm11\n\taddsd\t%xmm1, %xmm2\n\taddsd\t%xmm9, %xmm6\n\tcomisd\t%xmm2, %xmm0\n\tmulsd\t%xmm3, %xmm6\n\tdivsd\t%xmm1, %xmm6\n\taddsd\t%xmm11, %xmm6\n\tmovsd\t%xmm6, 8+y(%rip)\n\tja\t.L1\n\tdivsd\t%xmm1, %xmm0\n\tcall\tacos@PLT\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\tmovsd\t%xmm0, 32(%rsp)\n\tcall\tsincos@PLT\n\tpxor\t%xmm3, %xmm3\n\tmovl\t8(%rbp), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t(%rbx), %xmm3\n\tpxor\t%xmm11, %xmm11\n\tmovsd\t64(%rsp), %xmm8\n\tmovsd\t72(%rsp), %xmm2\n\tcvtsi2sdl\t4(%rbx), %xmm11\n\tmovsd\t8(%rsp), %xmm1\n\tpxor\t%xmm9, %xmm9\n\tmovsd\t(%rsp), %xmm4\n\tcvtsi2sdl\t%eax, %xmm7\n\taddl\t8(%rbx), %eax\n\tcvtsi2sdl\t0(%rbp), %xmm9\n\tmovapd\t%xmm3, %xmm6\n\tmovsd\t%xmm3, 24(%rsp)\n\tmulsd\t%xmm8, %xmm6\n\tmovapd\t%xmm11, %xmm10\n\tmulsd\t%xmm2, %xmm10\n\tmulsd\t%xmm11, %xmm8\n\tmulsd\t%xmm3, %xmm2\n\tmovapd\t%xmm6, %xmm5\n\tsubsd\t%xmm10, %xmm5\n\tmovsd\t%xmm8, 16(%rsp)\n\taddsd\t%xmm8, %xmm2\n\tmulsd\t%xmm7, %xmm5\n\tmulsd\t%xmm7, %xmm2\n\tdivsd\t%xmm1, %xmm5\n\tdivsd\t%xmm1, %xmm2\n\taddsd\t%xmm9, %xmm5\n\tmovsd\t%xmm5, 16+x(%rip)\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t4(%rbp), %xmm5\n\tmovsd\t%xmm5, 8(%rsp)\n\taddsd\t%xmm5, %xmm2\n\tmovsd\t%xmm2, 16+y(%rip)\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovl\t$3, %eax\n\taddsd\t%xmm4, %xmm2\n\tcomisd\t%xmm1, %xmm2\n\tja\t.L1\n\taddsd\t%xmm10, %xmm6\n\tmovsd\t32(%rsp), %xmm0\n\tmovsd\t%xmm7, 40(%rsp)\n\txorpd\t.LC0(%rip), %xmm0\n\tmovsd\t%xmm1, (%rsp)\n\tmulsd\t%xmm7, %xmm6\n\tdivsd\t%xmm1, %xmm6\n\taddsd\t%xmm9, %xmm6\n\tmovsd\t%xmm6, 24+x(%rip)\n\tcall\tsin@PLT\n\tmovsd\t24(%rsp), %xmm3\n\tmovsd\t40(%rsp), %xmm7\n\tmovl\t$4, %eax\n\tmovsd\t16(%rsp), %xmm8\n\tmovsd\t(%rsp), %xmm1\n\tmulsd\t%xmm3, %xmm0\n\tmovsd\t8(%rsp), %xmm5\n\taddsd\t%xmm8, %xmm0\n\tmovapd\t%xmm0, %xmm3\n\tmulsd\t%xmm7, %xmm3\n\tdivsd\t%xmm1, %xmm3\n\taddsd\t%xmm5, %xmm3\n\tmovsd\t%xmm3, 24+y(%rip)\n.L1:\n\taddq\t$88, %rsp\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tf, .-f\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%d\"\n.LC3:\n\t.string\t\"%.10lf %.10lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\txorl\t%r13d, %r13d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC1(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tmovl\t$2863311531, %ebx\n\tsubq\t$48, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovl\t%r13d, %eax\n\tmovq\t%r12, %rdi\n\timulq\t%rbx, %rax\n\tshrq\t$33, %rax\n\tleal\t(%rax,%rax,2), %ecx\n\tmovslq\t%eax, %rdx\n\tmovl\t%r13d, %eax\n\taddl\t$1, %r13d\n\tsubl\t%ecx, %eax\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tcltq\n\taddq\t%rdx, %rax\n\tleaq\t0(%rbp,%rax,4), %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$6, %r13d\n\tjne\t.L12\n\tleaq\t28(%rsp), %rsi\n\tmovq\t%rbp, %rdi\n\tcall\tf\n\ttestl\t%eax, %eax\n\tjle\t.L13\n\tmovl\t$0, (%rsp)\n\tmovsd\teps(%rip), %xmm0\n\tleaq\tx(%rip), %rbp\n\tleaq\ty(%rip), %r12\n\tcmpl\t$1, %eax\n\tje\t.L14\n\tmovsd\tx(%rip), %xmm1\n\tmovapd\t%xmm0, %xmm3\n\tmovsd\t8+x(%rip), %xmm2\n\taddsd\t%xmm1, %xmm3\n\tcomisd\t%xmm3, %xmm2\n\tja\t.L34\n\tsubsd\t%xmm2, %xmm1\n\tandpd\t.LC2(%rip), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L16\n.L17:\n\tmovl\t$0, 4(%rsp)\n\txorl\t%edx, %edx\n.L15:\n\tmovl\t$1, (%rsp,%rdx,4)\n\tleaq\tx(%rip), %rbp\n\tleaq\ty(%rip), %r12\n\tcmpl\t$2, %eax\n\tje\t.L14\n\tmovslq\t4(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm2\n\tmovsd\t16+x(%rip), %xmm3\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm2\n\tcomisd\t%xmm2, %xmm3\n\tja\t.L35\n\tsubsd\t%xmm3, %xmm1\n\tmovq\t.LC2(%rip), %xmm2\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L23\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t16+y(%rip), %xmm4\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm4\n\tja\t.L35\n.L23:\n\tmovslq\t(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm4\n\tmovl\t%edx, 8(%rsp)\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm4\n\tcomisd\t%xmm4, %xmm3\n\tja\t.L37\n\tsubsd\t%xmm3, %xmm1\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L22\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t16+y(%rip), %xmm2\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm2\n\tja\t.L37\n.L22:\n\tmovl\t%edx, 4(%rsp)\n\txorl\t%edx, %edx\n.L19:\n\tmovl\t$2, (%rsp,%rdx,4)\n\tcmpl\t$3, %eax\n\tje\t.L14\n\tmovslq\t8(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm2\n\tmovsd\t24+x(%rip), %xmm3\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm2\n\tcomisd\t%xmm2, %xmm3\n\tja\t.L39\n\tsubsd\t%xmm3, %xmm1\n\tmovq\t.LC2(%rip), %xmm2\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L61\n.L26:\n\tmovslq\t4(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm4\n\tmovl\t%edx, 12(%rsp)\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm4\n\tcomisd\t%xmm4, %xmm3\n\tja\t.L41\n\tsubsd\t%xmm3, %xmm1\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L62\n.L28:\n\tmovslq\t(%rsp), %rcx\n\tmovapd\t%xmm0, %xmm4\n\tmovl\t%edx, 8(%rsp)\n\tmovsd\t0(%rbp,%rcx,8), %xmm1\n\tmovq\t%rcx, %rdx\n\taddsd\t%xmm1, %xmm4\n\tcomisd\t%xmm4, %xmm3\n\tja\t.L43\n\tsubsd\t%xmm3, %xmm1\n\tandpd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L63\n.L30:\n\tmovl\t%edx, 4(%rsp)\n\txorl\t%edx, %edx\n.L25:\n\tmovl\t$3, (%rsp,%rdx,4)\n.L14:\n\tsubl\t$1, %eax\n\tmovq\t%rsp, %rbx\n\tleaq\t.LC3(%rip), %r13\n\tleaq\t4(%rsp,%rax,4), %r14\n.L32:\n\tmovslq\t(%rbx), %rax\n\tmovq\t%r13, %rsi\n\tmovl\t$1, %edi\n\taddq\t$4, %rbx\n\tmovsd\t0(%rbp,%rax,8), %xmm0\n\tmovsd\t(%r12,%rax,8), %xmm1\n\tmovl\t$2, %eax\n\tcall\t__printf_chk@PLT\n\tcmpq\t%r14, %rbx\n\tjne\t.L32\n.L13:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L64\n\taddq\t$48, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tmovsd\ty(%rip), %xmm1\n\tmovsd\t8+y(%rip), %xmm2\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm2\n\tjbe\t.L17\n.L34:\n\tmovl\t$1, %edx\n\tjmp\t.L15\n.L61:\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t24+y(%rip), %xmm4\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm4\n\tjbe\t.L26\n.L39:\n\tmovl\t$3, %edx\n\tjmp\t.L25\n.L62:\n\tmovsd\t(%r12,%rcx,8), %xmm1\n\tmovsd\t24+y(%rip), %xmm4\n\taddsd\t%xmm0, %xmm1\n\tcomisd\t%xmm1, %xmm4\n\tjbe\t.L28\n.L41:\n\tmovl\t$2, %edx\n\tjmp\t.L25\n.L63:\n\taddsd\t(%r12,%rcx,8), %xmm0\n\tmovsd\t24+y(%rip), %xmm1\n\tcomisd\t%xmm0, %xmm1\n\tjbe\t.L30\n.L43:\n\tmovl\t$1, %edx\n\tjmp\t.L25\n.L35:\n\tmovl\t$2, %edx\n\tjmp\t.L19\n.L37:\n\tmovl\t$1, %edx\n\tjmp\t.L19\n.L64:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.globl\teps\n\t.data\n\t.align 8\n\t.type\teps, @object\n\t.size\teps, 8\neps:\n\t.long\t-1598689907\n\t.long\t1051772663\n\t.globl\ty\n\t.bss\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 32\ny:\n\t.zero\t32\n\t.globl\tx\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 32\nx:\n\t.zero\t32\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t-2147483648\n\t.long\t0\n\t.long\t0\n\t.align 16\n.LC2:\n\t.long\t-1\n\t.long\t2147483647\n\t.long\t0\n\t.long\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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=acos((a[2]-b[2])/l);//printf(\"%lf %lf\\n\",l,c);\n if(a[2]>l+b[2]+eps||b[2]>l+a[2]+eps)return 0;\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] );\n x[0]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] );\n y[0]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]);\n if(a[2]+eps>l+b[2]||b[2]+eps>l+a[2])return 1;\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] );\n x[1]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] );\n y[1]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]);\n if(l+eps<a[2]+b[2])return 2;\n c=acos((a[2]+b[2])/l);//printf(\"%lf %lf\\n\",l,c);\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] );\n x[2]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] );\n y[2]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]);\n if(l<a[2]+b[2]+eps)return 3;\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] );\n x[3]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] );\n y[3]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]);\n return 4;\n}\n\nint main(){\n int p[2][3],i,j,n,r[4];//xyr\n for(i=0;i<6;i++)scanf(\"%d\",&p[i/3][i%3]);\n n=f(p[0],p[1]);\n for(i=0;i<n;i++){\n for(j=i;j;j--){\n if(x[r[j-1]]+eps<x[i]||(fabs(x[r[j-1]]-x[i])<eps&&y[r[j-1]]+eps<y[i]))break;\n r[j]=r[j-1];\n }\n r[j]=i;\n }\n for(i=0;i<n;i++)printf(\"%.10lf %.10lf\\n\",x[r[i]],y[r[i]]);\n return 0;\n}\n\n", "index": 62, "inputs": [ "0 2 1\n4 2 2\n", "1 2 2\n3 2 2\n", "0 0 2\n1 0 2\n", "1 1 2\n6 2 2\n", "0 2 1\n1 2 2\n", "0 -1 2\n1 0 2\n", "1 1 2\n6 4 2\n", "0 -2 2\n1 0 2\n", "1 1 2\n6 6 2\n", "0 -4 2\n1 0 2\n", "0 1 2\n6 6 2\n", "0 -4 2\n1 0 1\n", "0 1 2\n11 6 2\n", "0 -4 3\n1 0 2\n", "1 1 2\n11 6 2\n", "0 -4 3\n2 0 2\n", "1 1 2\n10 6 2\n", "0 -4 1\n1 0 2\n", "1 1 2\n1 6 2\n", "1 1 2\n2 6 2\n", "2 1 2\n2 6 2\n", "2 1 3\n2 6 2\n", "2 1 2\n2 12 2\n", "2 1 2\n2 21 2\n", "2 1 3\n2 21 2\n", "2 1 3\n2 35 2\n", "2 2 3\n2 35 2\n", "2 2 3\n3 35 2\n", "2 2 3\n5 35 2\n", "2 2 3\n8 35 2\n", "2 2 3\n8 40 2\n", "2 2 3\n8 40 4\n", "2 2 3\n8 40 6\n", "2 2 3\n11 40 6\n", "2 2 3\n11 19 6\n", "2 2 3\n11 4 6\n", "2 2 3\n11 0 6\n", "2 2 3\n11 1 6\n", "1 2 1\n0 2 2\n", "-1 0 1\n1 0 2\n", "1 1 1\n9 2 2\n", "0 4 1\n4 2 2\n", "1 2 4\n3 2 2\n", "0 1 2\n1 0 2\n", "0 2 1\n1 2 1\n", "0 -1 2\n0 0 2\n", "1 1 2\n6 4 3\n", "-1 -2 2\n1 0 2\n", "1 1 2\n21 6 2\n", "0 -6 2\n1 0 2\n", "0 2 2\n6 6 2\n", "0 -5 2\n1 0 1\n", "0 1 2\n15 6 2\n", "-1 -4 3\n1 0 2\n", "1 1 2\n11 7 2\n", "0 -2 3\n2 0 2\n", "0 1 2\n10 6 2\n", "0 -6 1\n1 0 2\n", "2 1 2\n1 6 2\n", "1 1 3\n2 6 2\n", "2 2 2\n2 6 2\n", "2 1 3\n0 6 2\n", "2 0 2\n2 12 2\n", "2 1 4\n2 21 2\n", "2 2 3\n2 21 2\n", "3 1 3\n2 35 2\n", "2 2 4\n2 35 2\n", "2 2 3\n2 35 1\n", "2 2 3\n5 28 2\n", "2 4 3\n8 35 2\n", "2 2 3\n8 54 2\n", "2 2 3\n8 40 12\n", "2 2 5\n11 40 6\n", "2 0 3\n11 19 6\n", "1 2 3\n11 4 6\n", "2 2 3\n11 -1 6\n", "2 2 3\n8 1 6\n", "1 1 1\n0 2 2\n", "-1 0 2\n1 0 2\n", "0 8 1\n4 2 2\n", "0 1 2\n1 1 2\n", "1 -1 2\n0 0 2\n", "1 1 2\n6 4 1\n", "-1 -2 2\n1 1 2\n", "0 1 2\n21 6 2\n", "-1 -6 2\n1 0 2\n", "0 2 1\n6 6 2\n", "0 -5 4\n1 0 1\n", "0 1 2\n21 5 2\n", "-1 -1 3\n1 0 2\n", "1 2 2\n11 7 2\n", "0 -2 3\n4 0 2\n", "0 1 2\n13 6 2\n", "0 -6 1\n1 -1 2\n", "2 0 2\n1 6 2\n", "0 1 3\n2 6 2\n", "2 2 2\n3 6 2\n", "1 1 3\n0 6 2\n", "2 0 2\n2 12 4\n", "0 1 4\n2 21 2\n", "1 1 1\n6 2 2\n", "1 2 1\n4 2 2\n", "1 1 1\n6 2 2\n", "0 0 1\n1 0 2\n", "1 2 1\n3 2 2\n" ], "outputs": [ "-0.2500000000 1.0317541634\n-0.2500000000 2.9682458366\n0.7500000000 1.3385621722\n0.7500000000 2.6614378278\n", "1.0000000000 0.0000000000\n1.0000000000 4.0000000000\n", "0.0000000000 -2.0000000000\n0.0000000000 2.0000000000\n", "0.6077677297 2.9611613514\n1.3922322703 -0.9611613514\n2.2952094108 2.5239529462\n2.7817136662 0.0914316692\n", "-1.0000000000 2.0000000000\n", "-1.4142135624 0.4142135624\n1.4142135624 -2.4142135624\n", "-0.0289915109 2.7149858514\n1.4277692905 2.9537178492\n2.0289915109 -0.7149858514\n2.9251718860 0.4580468567\n", "-1.7888543820 -1.1055728090\n1.7888543820 -2.8944271910\n", "-0.4142135624 2.4142135624\n0.6338096210 2.9661903790\n2.4142135624 -0.4142135624\n2.9661903790 0.6338096210\n", "-1.9402850003 -3.5149287499\n-0.0000000000 -2.0000000000\n0.9411764706 -2.2352941176\n1.9402850003 -4.4850712501\n", "-1.2803687993 2.5364425592\n-0.3128203168 2.9753843802\n1.2803687993 -0.5364425592\n1.8865908086 0.3360910297\n", "-1.7647058824 -3.0588235294\n-0.9780833528 -2.2554791618\n1.6839657058 -2.9209914264\n2.0000000000 -4.0000000000\n", "-0.8276058886 2.8207329549\n-0.1782023460 2.9920451611\n0.8276058886 -0.8207329549\n1.3836817980 -0.4440999556\n", "-2.6470588235 -2.5882352941\n3.0000000000 -4.0000000000\n", "0.1055728090 2.7888543820\n0.8047754793 2.9904490414\n1.8944271910 -0.7888543820\n2.4752245207 -0.3504490414\n", "-2.3153393661 -2.0923303169\n2.9153393661 -4.7076696831\n", "0.0287141376 2.7483145522\n0.7842610396 2.9883301288\n1.9712858624 -0.7483145522\n2.5742295265 -0.2336131476\n", "-1.0000000000 -4.0000000000\n-0.4890416764 -3.1277395809\n0.8419828529 -3.4604957132\n0.8823529412 -4.4705882353\n", "-1.0000000000 1.0000000000\n-0.2000000000 2.6000000000\n2.2000000000 2.6000000000\n3.0000000000 1.0000000000\n", "-0.9611613514 1.3922322703\n0.0914316692 2.7817136662\n2.5239529462 2.2952094108\n2.9611613514 0.6077677297\n", "0.0000000000 1.0000000000\n0.8000000000 2.6000000000\n3.2000000000 2.6000000000\n4.0000000000 1.0000000000\n", "-0.9393876913 1.6000000000\n2.0000000000 4.0000000000\n4.9393876913 1.6000000000\n", "0.0000000000 1.0000000000\n0.1369180426 1.7272727273\n3.8630819574 1.7272727273\n4.0000000000 1.0000000000\n", "0.0000000000 1.0000000000\n0.0404082058 1.4000000000\n3.9595917942 1.4000000000\n4.0000000000 1.0000000000\n", "-0.9962476533 1.1500000000\n-0.9047375097 1.7500000000\n4.9047375097 1.7500000000\n4.9962476533 1.1500000000\n", "-0.9987021414 1.0882352941\n-0.9673832448 1.4411764706\n4.9673832448 1.4411764706\n4.9987021414 1.0882352941\n", "-0.9986222732 2.0909090909\n-0.9653648055 2.4545454545\n4.9653648055 2.4545454545\n4.9986222732 2.0909090909\n", "-0.9944954128 2.1816513761\n-0.9502747125 2.5439477186\n4.9777976483 2.3643091622\n5.0000000000 2.0000000000\n", "-0.9781220783 2.3616474617\n-0.9124874245 2.7193170386\n4.9944546376 2.1823223057\n4.9945155210 1.8186804072\n", "-0.9342976121 2.6244177477\n-0.8386298155 2.9706599665\n4.9662976121 1.5515822523\n4.9986298155 1.9093400335\n", "-0.9501254535 2.5447566506\n-0.8773437135 2.8490542706\n4.9744497779 1.6092974035\n4.9989653351 1.9212159997\n", "-0.9744497779 2.3907025965\n-0.8286864276 2.9992662780\n4.9501254535 1.4552433494\n4.9989566979 2.0791121003\n", "-0.9907516430 2.2353818384\n-0.7715984863 3.1481471294\n4.9177786700 1.3024559995\n4.9905174052 2.2383393571\n", "-0.9637287162 2.4650936433\n-0.6813114754 3.3455737705\n4.8574992080 1.0863817665\n5.0000000000 2.0000000000\n", "-0.8378378378 2.9729729730\n0.3135135135 4.4810810811\n4.4000000000 0.2000000000\n5.0000000000 2.0000000000\n", "0.4316848550 4.5574181524\n1.6624327920 -0.9809475641\n4.7176470588 3.2705882353\n5.0000000000 2.0000000000\n", "0.4316848550 -0.5574181524\n1.6624327920 4.9809475641\n4.7176470588 0.7294117647\n5.0000000000 2.0000000000\n", "0.6996096191 -0.7035134283\n1.3247806248 4.9230256235\n4.9268292683 1.3414634146\n5.0000000000 2.0000000000\n", "2.0000000000 2.0000000000\n", "-1.5000000000 -0.8660254038\n-1.5000000000 0.8660254038\n", "0.7538461538 1.9692307692\n1.0000000000 0.0000000000\n1.2541028496 1.9671772029\n1.4843586888 0.1251304894\n", "-0.6358898944 3.2282202113\n0.2358898944 4.9717797887\n0.2683375210 3.0366750419\n0.9316624790 4.3633249581\n", "5.0000000000 2.0000000000\n", "-1.4142135624 -0.4142135624\n1.4142135624 2.4142135624\n", "0.0000000000 1.0000000000\n0.0000000000 3.0000000000\n", "-2.0000000000 -1.0000000000\n2.0000000000 -1.0000000000\n", "-0.3078639964 2.5131066607\n1.7196287023 -0.8660478372\n1.9411764706 2.7647058824\n3.0000000000 1.0000000000\n", "-2.4142135624 -0.5857864376\n0.4142135624 -3.4142135624\n", "0.5149287499 2.9402850003\n0.9006176843 2.9975292627\n1.4850712501 -0.9402850003\n1.8523234921 -0.8092939686\n", "-1.9727878477 -5.6712020254\n-1.2700245497 -4.4549959084\n1.7024569821 -4.9504094970\n1.9727878477 -6.3287979746\n", "-1.1094003925 3.6641005887\n0.0000000000 4.0000000000\n1.1094003925 0.3358994113\n1.8461538462 1.2307692308\n", "-1.8461538462 -4.2307692308\n-1.3550406252 -3.5289918750\n1.8165790868 -4.1633158174\n2.0000000000 -5.0000000000\n", "-0.6324555320 2.8973665961\n-0.1318823416 2.9956470249\n0.6324555320 -0.8973665961\n1.0918823416 -0.6756470249\n", "-3.3153393661 -2.0923303169\n1.9153393661 -4.7076696831\n", "-0.0289915109 2.7149858514\n0.6216660750 2.9638898750\n2.0289915109 -0.7149858514\n2.5548045132 -0.2580075221\n", "-1.2343134833 0.7343134833\n2.7343134833 -3.2343134833\n", "-0.8944271910 2.7888543820\n-0.1952245207 2.9904490414\n0.8944271910 -0.7888543820\n1.4752245207 -0.3504490414\n", "-1.0000000000 -6.0000000000\n-0.7770004252 -5.3704999291\n0.9391625874 -5.6565270979\n0.9459459459 -6.3243243243\n", "0.0388386486 0.6077677297\n0.4760470538 2.2952094108\n2.9085683308 2.7817136662\n3.9611613514 1.3922322703\n", "-1.7692307692 2.1538461538\n1.0000000000 4.0000000000\n2.1538461538 3.7692307692\n4.0000000000 1.0000000000\n", "0.0000000000 2.0000000000\n2.0000000000 4.0000000000\n4.0000000000 2.0000000000\n", "-0.9438806666 0.4224477334\n-0.0689655172 3.1724137931\n2.0000000000 4.0000000000\n4.5300875632 2.6120350253\n", "0.0000000000 0.0000000000\n0.1143819168 0.6666666667\n3.8856180832 0.6666666667\n4.0000000000 0.0000000000\n", "-1.9799497484 1.4000000000\n-1.8157568057 2.2000000000\n5.8157568057 2.2000000000\n5.9799497484 1.4000000000\n", "-0.9958419938 2.1578947368\n-0.8942583337 2.7894736842\n4.8942583337 2.7894736842\n4.9958419938 2.1578947368\n", "0.0000000000 1.0000000000\n0.0209064964 1.3535560734\n5.9531643765 1.5280342464\n5.9948141746 1.1763180640\n", "-1.9926470526 2.2424242424\n-1.9333286641 2.7272727273\n5.9333286641 2.7272727273\n5.9926470526 2.2424242424\n", "-0.9944852895 2.1818181818\n-0.9778798826 2.3636363636\n4.9778798826 2.3636363636\n4.9944852895 2.1818181818\n", "-0.9649119789 2.4574898437\n-0.8596442077 2.9068820240\n4.9910310690 2.2318041074\n4.9911893512 1.7702473826\n", "-0.9258079176 4.6630595970\n-0.8179067722 5.0292722785\n4.9619162426 3.5235000821\n4.9984483971 3.9035261167\n", "-0.9731135779 2.4007438744\n-0.9337530122 2.6269715014\n4.9862522640 1.7131247388\n4.9994464428 1.9423715643\n", "-0.9905174052 1.7616606429\n-0.5463254224 3.5862619088\n4.7715984863 0.8518528706\n4.9111902873 2.7245489020\n", "-2.8933141590 3.0273638798\n-2.3438017824 4.4761635800\n6.8342977655 0.7234557924\n6.9929821103 2.2648200265\n", "-0.8667266214 0.8842389259\n0.0995475113 2.3212669683\n4.5002107843 -1.6579945820\n5.0000000000 0.0000000000\n", "-0.4276996737 4.6384983687\n0.6969304430 -0.9846522148\n3.3194712583 3.9026437086\n3.8728364340 1.1358178298\n", "0.2000000000 -0.4000000000\n2.0000000000 5.0000000000\n4.4000000000 0.2000000000\n5.0000000000 2.0000000000\n", "0.1114997874 -0.3310012756\n0.9695812937 4.8174877621\n", "1.0000000000 0.0000000000\n2.0000000000 1.0000000000\n", "-1.0000000000 -2.0000000000\n-1.0000000000 2.0000000000\n", "-0.9009340494 7.5660439670\n-0.5258582913 7.1494278058\n0.7470878956 8.6647252637\n0.9873967528 8.1582645019\n", "0.0000000000 -1.0000000000\n0.0000000000 3.0000000000\n", "-0.4142135624 -2.4142135624\n2.4142135624 0.4142135624\n", "0.2803712977 2.8660478372\n1.0000000000 3.0000000000\n2.3078639964 -0.5131066607\n2.7647058824 0.0588235294\n", "-2.6641005887 -0.8905996075\n0.6641005887 -3.1094003925\n", "-0.4632410546 2.9456124294\n-0.0947039364 2.9977565328\n0.4632410546 -0.9456124294\n0.8157339793 -0.8260827131\n", "-2.8973665961 -5.3675444680\n-2.0696938457 -4.3101020514\n0.8696938457 -5.2898979486\n0.8973665961 -6.6324555320\n", "-0.6647252637 2.7470878956\n-0.1582645019 2.9873967528\n0.4339560330 1.0990659506\n0.8505721942 1.4741417087\n", "-2.7100812505 -2.0579837499\n0.0000000000 -1.0000000000\n1.5384615385 -1.3076923077\n3.6331581736 -3.3266316347\n", "-0.3742242158 2.9646771328\n-0.0000000000 3.0000000000\n0.3742242158 -0.9646771328\n0.7352297593 -0.8599562363\n", "-1.0000000000 2.0000000000\n1.4000000000 -2.8000000000\n", "0.1055728090 3.7888543820\n0.8047754793 3.9904490414\n1.8944271910 0.2111456180\n2.4752245207 0.6495509586\n", "-0.7076696831 0.9153393661\n1.9076696831 -4.3153393661\n", "-0.7179581586 2.8666912124\n-0.1516321683 2.9942436375\n0.7179581586 -0.8666912124\n1.2237971167 -0.5818725034\n", "-1.0000000000 -6.0000000000\n-0.6775203126 -5.2644959375\n0.9082895434 -5.5816579087\n0.9230769231 -6.3846153846\n", "0.0272121523 -0.3287979746\n0.2975430179 1.0495905030\n3.2700245497 1.5450040916\n3.9727878477 0.3287979746\n", "-2.5300875632 2.6120350253\n0.0000000000 4.0000000000\n2.0689655172 3.1724137931\n2.9438806666 0.4224477334\n", "0.0597149997 2.4850712501\n2.0000000000 4.0000000000\n2.9411764706 3.7647058824\n3.9402850003 1.5149287499\n", "-2.0000000000 1.0000000000\n-0.1538461538 3.7692307692\n1.0000000000 4.0000000000\n3.7692307692 2.1538461538\n", "0.0279734056 -0.3333333333\n0.2679491924 1.0000000000\n3.7320508076 1.0000000000\n3.9720265944 -0.3333333333\n", "-3.9207920792 1.7920792079\n-3.6798665531 2.5679866553\n3.9174903155 1.8082509685\n4.0000000000 1.0000000000\n", "0.6153846154 1.9230769231\n1.0000000000 0.0000000000\n1.4183420913 1.9082895434\n1.7355040625 0.3224796874\n", "0.6666666667 1.0571909584\n0.6666666667 2.9428090416\n2.0000000000 2.0000000000\n", "0.6153846154 1.9230769231\n1.0000000000 0.0000000000\n1.4183420913 1.9082895434\n1.7355040625 0.3224796874\n", "-1.0000000000 0.0000000000\n", "0.5000000000 1.1339745962\n0.5000000000 2.8660254038\n" ], "question": "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=acos((a[2]-b[2])/l);//printf(\"%lf %lf\\n\",l,c);\n if(a[2]>l+b[2]+eps||b[2]>l+a[2]+eps)return 0;\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] );\n x[0]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] );\n y[0]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]);\n if(a[2]+eps>l+b[2]||b[2]+eps>l+a[2])return 1;\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] );\n x[1]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] );\n y[1]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]);\n if(l+eps<a[2]+b[2])return 2;\n c=acos((a[2]+b[2])/l);//printf(\"%lf %lf\\n\",l,c);\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] );\n x[2]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] );\n y[2]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]);\n if(l<a[2]+b[2]+eps)return 3;\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] );\n x[3]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0];\n //printf(\"%lf \" ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] );\n y[3]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1];\n //printf(\"%lf \" ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]);\n //printf(\"%lf\\n\",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]);\n return 4;\n}\n\nint main(){\n int p[2][3],i,j,n,r[4];//xyr\n for(i=0;i<6;i++)scanf(\"%d\",&p[i/3][i%3]);\n n=f(p[0],p[1]);\n for(i=0;i<n;i++){\n for(j=i;j;j--){\n if(x[r[j-1]]+eps<x[i]||(fabs(x[r[j-1]]-x[i])<eps&&y[r[j-1]]+eps<y[i]))break;\n r[j]=r[j-1];\n }\n r[j]=i;\n }\n for(i=0;i<n;i++)printf(\"%.10lf %.10lf\\n\",x[r[i]],y[r[i]]);\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tx\n\t.bss\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 32\nx:\n\t.zero\t32\n\t.globl\ty\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 32\ny:\n\t.zero\t32\n\t.globl\teps\n\t.data\n\t.align 8\n\t.type\teps, @object\n\t.size\teps, 8\neps:\n\t.long\t-1598689907\n\t.long\t1051772663\n\t.text\n\t.globl\tf\n\t.type\tf, @function\nf:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rsi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rsi, %rax\n\tsubl\t%ecx, %edx\n\tmovl\t%edx, (%rax)\n\taddl\t$1, -20(%rbp)\n.L2:\n\tcmpl\t$1, -20(%rbp)\n\tjle\t.L3\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovq\t%xmm5, %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\thypot@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tmovq\t-48(%rbp), %rdx\n\taddq\t$8, %rdx\n\tmovl\t(%rdx), %edx\n\tsubl\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-16(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tacos@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovapd\t%xmm1, %xmm2\n\taddsd\t-16(%rbp), %xmm2\n\tmovsd\teps(%rip), %xmm1\n\taddsd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L4\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovapd\t%xmm1, %xmm2\n\taddsd\t-16(%rbp), %xmm2\n\tmovsd\teps(%rip), %xmm1\n\taddsd\t%xmm2, %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L17\n.L4:\n\tmovl\t$0, %eax\n\tjmp\t.L7\n.L17:\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm6, %xmm6\n\tcvtsi2sdl\t%eax, %xmm6\n\tmovsd\t%xmm6, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t%eax, %xmm7\n\tmovsd\t%xmm7, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovsd\t%xmm5, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovsd\t%xmm3, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, y(%rip)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\taddsd\t-16(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L8\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\taddsd\t-16(%rbp), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L18\n.L8:\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L18:\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t%eax, %xmm4\n\tmovsd\t%xmm4, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm6, %xmm6\n\tcvtsi2sdl\t%eax, %xmm6\n\tmovsd\t%xmm6, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 8+x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t%eax, %xmm7\n\tmovsd\t%xmm7, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovsd\t%xmm5, -64(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\tmovapd\t%xmm0, %xmm3\n\txorpd\t%xmm1, %xmm3\n\tmovq\t%xmm3, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 8+y(%rip)\n\tmovsd\teps(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\taddsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L19\n\tmovl\t$2, %eax\n\tjmp\t.L7\n.L19:\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-16(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tacos@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovsd\t%xmm3, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t%eax, %xmm4\n\tmovsd\t%xmm4, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 16+x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm6, %xmm6\n\tcvtsi2sdl\t%eax, %xmm6\n\tmovsd\t%xmm6, -56(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm7, %xmm7\n\tcvtsi2sdl\t%eax, %xmm7\n\tmovsd\t%xmm7, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 16+y(%rip)\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\taddl\t%edx, %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%eax, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L20\n\tmovl\t$3, %eax\n\tjmp\t.L7\n.L20:\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovsd\t%xmm2, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm5, %xmm5\n\tcvtsi2sdl\t%eax, %xmm5\n\tmovsd\t%xmm5, -64(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 24+x(%rip)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t%eax, %xmm3\n\tmovsd\t%xmm3, -56(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\txorpd\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsin@PLT\n\tmulsd\t-56(%rbp), %xmm0\n\tmovsd\t%xmm0, -56(%rbp)\n\tmovq\t-48(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t%eax, %xmm4\n\tmovsd\t%xmm4, -64(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tmovq\t.LC0(%rip), %xmm1\n\tmovapd\t%xmm0, %xmm4\n\txorpd\t%xmm1, %xmm4\n\tmovq\t%xmm4, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tcos@PLT\n\tmulsd\t-64(%rbp), %xmm0\n\tmovsd\t-56(%rbp), %xmm1\n\taddsd\t%xmm0, %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$8, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmulsd\t%xmm1, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tdivsd\t-16(%rbp), %xmm1\n\tmovq\t-40(%rbp), %rax\n\taddq\t$4, %rax\n\tmovl\t(%rax), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, 24+y(%rip)\n\tmovl\t$4, %eax\n.L7:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tf, .-f\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%d\"\n.LC3:\n\t.string\t\"%.10lf %.10lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -60(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovl\t-60(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1431655766, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$31, %eax\n\tmovl\t%edx, %esi\n\tsubl\t%eax, %esi\n\tmovl\t-60(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1431655766, %rax, %rax\n\tshrq\t$32, %rax\n\tmovl\t%edx, %ecx\n\tsarl\t$31, %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %ecx\n\taddl\t%ecx, %ecx\n\taddl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tleaq\t-32(%rbp), %rcx\n\tmovslq\t%eax, %rdi\n\tmovslq\t%esi, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rdi, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -60(%rbp)\n.L22:\n\tcmpl\t$5, -60(%rbp)\n\tjle\t.L23\n\tleaq\t-32(%rbp), %rax\n\tleaq\t12(%rax), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tf\n\tmovl\t%eax, -52(%rbp)\n\tmovl\t$0, -60(%rbp)\n\tjmp\t.L24\n.L30:\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, -56(%rbp)\n\tjmp\t.L25\n.L29:\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm0, %xmm1\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L26\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm1\n\tsubsd\t%xmm1, %xmm0\n\tmovq\t.LC2(%rip), %xmm1\n\tandpd\t%xmm0, %xmm1\n\tmovsd\teps(%rip), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L27\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm1\n\tmovsd\teps(%rip), %xmm0\n\taddsd\t%xmm0, %xmm1\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L26\n.L27:\n\tmovl\t-56(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %edx\n\tmovl\t-56(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\tsubl\t$1, -56(%rbp)\n.L25:\n\tcmpl\t$0, -56(%rbp)\n\tjne\t.L29\n.L26:\n\tmovl\t-56(%rbp), %eax\n\tcltq\n\tmovl\t-60(%rbp), %edx\n\tmovl\t%edx, -48(%rbp,%rax,4)\n\taddl\t$1, -60(%rbp)\n.L24:\n\tmovl\t-60(%rbp), %eax\n\tcmpl\t-52(%rbp), %eax\n\tjl\t.L30\n\tmovl\t$0, -60(%rbp)\n\tjmp\t.L31\n.L32:\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovsd\t(%rdx,%rax), %xmm0\n\tmovl\t-60(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$2, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -60(%rbp)\n.L31:\n\tmovl\t-60(%rbp), %eax\n\tcmpl\t-52(%rbp), %eax\n\tjl\t.L32\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L34\n\tcall\t__stack_chk_fail@PLT\n.L34:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t-2147483648\n\t.long\t0\n\t.long\t0\n\t.align 16\n.LC2:\n\t.long\t-1\n\t.long\t2147483647\n\t.long\t0\n\t.long\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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("%lf %lf\n",l,c); if(a[2]>l+b[2]+eps||b[2]>l+a[2]+eps)return 0; //printf("%lf " ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] ); x[0]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0]; //printf("%lf " ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] ); y[0]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1]; //printf("%lf " ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]); //printf("%lf\n",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]); if(a[2]+eps>l+b[2]||b[2]+eps>l+a[2])return 1; //printf("%lf " ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] ); x[1]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0]; //printf("%lf " ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] ); y[1]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1]; //printf("%lf " ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]); //printf("%lf\n",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]); if(l+eps<a[2]+b[2])return 2; c=acos((a[2]+b[2])/l);//printf("%lf %lf\n",l,c); //printf("%lf " ,(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0] ); x[2]=(b[0]*cos( c)-b[1]*sin( c))*a[2]/l+a[0]; //printf("%lf " ,(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1] ); y[2]=(b[0]*sin( c)+b[1]*cos( c))*a[2]/l+a[1]; //printf("%lf " ,(b[0]*cos( c)-b[1]*sin( c))*b[2]/l+a[0]+b[0]); //printf("%lf\n",(b[0]*sin( c)+b[1]*cos( c))*b[2]/l+a[1]+b[1]); if(l<a[2]+b[2]+eps)return 3; //printf("%lf " ,(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0] ); x[3]=(b[0]*cos(-c)-b[1]*sin(-c))*a[2]/l+a[0]; //printf("%lf " ,(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1] ); y[3]=(b[0]*sin(-c)+b[1]*cos(-c))*a[2]/l+a[1]; //printf("%lf " ,(b[0]*cos(-c)-b[1]*sin(-c))*b[2]/l+a[0]+b[0]); //printf("%lf\n",(b[0]*sin(-c)+b[1]*cos(-c))*b[2]/l+a[1]+b[1]); return 4; } int main(){ int p[2][3],i,j,n,r[4];//xyr for(i=0;i<6;i++)scanf("%d",&p[i/3][i%3]); n=f(p[0],p[1]); for(i=0;i<n;i++){ for(j=i;j;j--){ if(x[r[j-1]]+eps<x[i]||(fabs(x[r[j-1]]-x[i])<eps&&y[r[j-1]]+eps<y[i]))break; r[j]=r[j-1]; } r[j]=i; } for(i=0;i<n;i++)printf("%.10lf %.10lf\n",x[r[i]],y[r[i]]); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl x .bss .align 32 .type x, @object .size x, 32 x: .zero 32 .globl y .align 32 .type y, @object .size y, 32 y: .zero 32 .globl eps .data .align 8 .type eps, @object .size eps, 8 eps: .long -1598689907 .long 1051772663 .text .globl f .type f, @function f: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $64, %rsp movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movl $0, -20(%rbp) jmp .L2 .L3: movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -48(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -40(%rbp), %rax addq %rcx, %rax movl (%rax), %ecx movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rsi movq -48(%rbp), %rax addq %rsi, %rax subl %ecx, %edx movl %edx, (%rax) addl $1, -20(%rbp) .L2: cmpl $1, -20(%rbp) jle .L3 movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm5, %xmm5 cvtsi2sdl %eax, %xmm5 movq %xmm5, %rax movapd %xmm0, %xmm1 movq %rax, %xmm0 call hypot@PLT movq %xmm0, %rax movq %rax, -16(%rbp) movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax movq -48(%rbp), %rdx addq $8, %rdx movl (%rdx), %edx subl %edx, %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 divsd -16(%rbp), %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call acos@PLT movq %xmm0, %rax movq %rax, -8(%rbp) movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 movapd %xmm1, %xmm2 addsd -16(%rbp), %xmm2 movsd eps(%rip), %xmm1 addsd %xmm2, %xmm1 comisd %xmm1, %xmm0 ja .L4 movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 movapd %xmm1, %xmm2 addsd -16(%rbp), %xmm2 movsd eps(%rip), %xmm1 addsd %xmm2, %xmm1 comisd %xmm1, %xmm0 jbe .L17 .L4: movl $0, %eax jmp .L7 .L17: movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm6, %xmm6 cvtsi2sdl %eax, %xmm6 movsd %xmm6, -56(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call cos@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm7, %xmm7 cvtsi2sdl %eax, %xmm7 movsd %xmm7, -64(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call sin@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 subsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, x(%rip) movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm5, %xmm5 cvtsi2sdl %eax, %xmm5 movsd %xmm5, -56(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call sin@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm3, %xmm3 cvtsi2sdl %eax, %xmm3 movsd %xmm3, -64(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call cos@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 addsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, y(%rip) movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 movsd eps(%rip), %xmm0 addsd %xmm1, %xmm0 movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 addsd -16(%rbp), %xmm1 comisd %xmm1, %xmm0 ja .L8 movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 movsd eps(%rip), %xmm0 addsd %xmm1, %xmm0 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 addsd -16(%rbp), %xmm1 comisd %xmm1, %xmm0 jbe .L18 .L8: movl $1, %eax jmp .L7 .L18: movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm4, %xmm4 cvtsi2sdl %eax, %xmm4 movsd %xmm4, -56(%rbp) movsd -8(%rbp), %xmm0 movq .LC0(%rip), %xmm1 xorpd %xmm1, %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call cos@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm6, %xmm6 cvtsi2sdl %eax, %xmm6 movsd %xmm6, -64(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call sin@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 addsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, 8+x(%rip) movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm7, %xmm7 cvtsi2sdl %eax, %xmm7 movsd %xmm7, -56(%rbp) movsd -8(%rbp), %xmm0 movq .LC0(%rip), %xmm1 xorpd %xmm1, %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call sin@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm5, %xmm5 cvtsi2sdl %eax, %xmm5 movsd %xmm5, -64(%rbp) movsd -8(%rbp), %xmm0 movq .LC0(%rip), %xmm1 movapd %xmm0, %xmm3 xorpd %xmm1, %xmm3 movq %xmm3, %rax movq %rax, %xmm0 call cos@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 addsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, 8+y(%rip) movsd eps(%rip), %xmm0 movapd %xmm0, %xmm1 addsd -16(%rbp), %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %edx movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax addl %edx, %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 comisd %xmm1, %xmm0 jbe .L19 movl $2, %eax jmp .L7 .L19: movq -40(%rbp), %rax addq $8, %rax movl (%rax), %edx movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax addl %edx, %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 divsd -16(%rbp), %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call acos@PLT movq %xmm0, %rax movq %rax, -8(%rbp) movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm3, %xmm3 cvtsi2sdl %eax, %xmm3 movsd %xmm3, -56(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call cos@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm4, %xmm4 cvtsi2sdl %eax, %xmm4 movsd %xmm4, -64(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call sin@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 subsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, 16+x(%rip) movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm6, %xmm6 cvtsi2sdl %eax, %xmm6 movsd %xmm6, -56(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call sin@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm7, %xmm7 cvtsi2sdl %eax, %xmm7 movsd %xmm7, -64(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call cos@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 addsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, 16+y(%rip) movq -40(%rbp), %rax addq $8, %rax movl (%rax), %edx movq -48(%rbp), %rax addq $8, %rax movl (%rax), %eax addl %edx, %eax pxor %xmm1, %xmm1 cvtsi2sdl %eax, %xmm1 movsd eps(%rip), %xmm0 addsd %xmm1, %xmm0 comisd -16(%rbp), %xmm0 jbe .L20 movl $3, %eax jmp .L7 .L20: movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm2, %xmm2 cvtsi2sdl %eax, %xmm2 movsd %xmm2, -56(%rbp) movsd -8(%rbp), %xmm0 movq .LC0(%rip), %xmm1 xorpd %xmm1, %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call cos@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm5, %xmm5 cvtsi2sdl %eax, %xmm5 movsd %xmm5, -64(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call sin@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 addsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, 24+x(%rip) movq -48(%rbp), %rax movl (%rax), %eax pxor %xmm3, %xmm3 cvtsi2sdl %eax, %xmm3 movsd %xmm3, -56(%rbp) movsd -8(%rbp), %xmm0 movq .LC0(%rip), %xmm1 xorpd %xmm1, %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call sin@PLT mulsd -56(%rbp), %xmm0 movsd %xmm0, -56(%rbp) movq -48(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm4, %xmm4 cvtsi2sdl %eax, %xmm4 movsd %xmm4, -64(%rbp) movsd -8(%rbp), %xmm0 movq .LC0(%rip), %xmm1 movapd %xmm0, %xmm4 xorpd %xmm1, %xmm4 movq %xmm4, %rax movq %rax, %xmm0 call cos@PLT mulsd -64(%rbp), %xmm0 movsd -56(%rbp), %xmm1 addsd %xmm0, %xmm1 movq -40(%rbp), %rax addq $8, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 mulsd %xmm1, %xmm0 movapd %xmm0, %xmm1 divsd -16(%rbp), %xmm1 movq -40(%rbp), %rax addq $4, %rax movl (%rax), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, 24+y(%rip) movl $4, %eax .L7: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size f, .-f .section .rodata .LC1: .string "%d" .LC3: .string "%.10lf %.10lf\n" .text .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $64, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -60(%rbp) jmp .L22 .L23: movl -60(%rbp), %eax movslq %eax, %rdx imulq $1431655766, %rdx, %rdx shrq $32, %rdx sarl $31, %eax movl %edx, %esi subl %eax, %esi movl -60(%rbp), %edx movslq %edx, %rax imulq $1431655766, %rax, %rax shrq $32, %rax movl %edx, %ecx sarl $31, %ecx subl %ecx, %eax movl %eax, %ecx addl %ecx, %ecx addl %eax, %ecx movl %edx, %eax subl %ecx, %eax leaq -32(%rbp), %rcx movslq %eax, %rdi movslq %esi, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rdi, %rax salq $2, %rax addq %rcx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -60(%rbp) .L22: cmpl $5, -60(%rbp) jle .L23 leaq -32(%rbp), %rax leaq 12(%rax), %rdx leaq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call f movl %eax, -52(%rbp) movl $0, -60(%rbp) jmp .L24 .L30: movl -60(%rbp), %eax movl %eax, -56(%rbp) jmp .L25 .L29: movl -56(%rbp), %eax subl $1, %eax cltq movl -48(%rbp,%rax,4), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movsd (%rdx,%rax), %xmm1 movsd eps(%rip), %xmm0 addsd %xmm0, %xmm1 movl -60(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movsd (%rdx,%rax), %xmm0 comisd %xmm1, %xmm0 ja .L26 movl -56(%rbp), %eax subl $1, %eax cltq movl -48(%rbp,%rax,4), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movsd (%rdx,%rax), %xmm0 movl -60(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movsd (%rdx,%rax), %xmm1 subsd %xmm1, %xmm0 movq .LC2(%rip), %xmm1 andpd %xmm0, %xmm1 movsd eps(%rip), %xmm0 comisd %xmm1, %xmm0 jbe .L27 movl -56(%rbp), %eax subl $1, %eax cltq movl -48(%rbp,%rax,4), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movsd (%rdx,%rax), %xmm1 movsd eps(%rip), %xmm0 addsd %xmm0, %xmm1 movl -60(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movsd (%rdx,%rax), %xmm0 comisd %xmm1, %xmm0 ja .L26 .L27: movl -56(%rbp), %eax subl $1, %eax cltq movl -48(%rbp,%rax,4), %edx movl -56(%rbp), %eax cltq movl %edx, -48(%rbp,%rax,4) subl $1, -56(%rbp) .L25: cmpl $0, -56(%rbp) jne .L29 .L26: movl -56(%rbp), %eax cltq movl -60(%rbp), %edx movl %edx, -48(%rbp,%rax,4) addl $1, -60(%rbp) .L24: movl -60(%rbp), %eax cmpl -52(%rbp), %eax jl .L30 movl $0, -60(%rbp) jmp .L31 .L32: movl -60(%rbp), %eax cltq movl -48(%rbp,%rax,4), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movsd (%rdx,%rax), %xmm0 movl -60(%rbp), %eax cltq movl -48(%rbp,%rax,4), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movapd %xmm0, %xmm1 movq %rax, %xmm0 leaq .LC3(%rip), %rax movq %rax, %rdi movl $2, %eax call printf@PLT addl $1, -60(%rbp) .L31: movl -60(%rbp), %eax cmpl -52(%rbp), %eax jl .L32 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L34 call __stack_chk_fail@PLT .L34: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .section .rodata .align 16 .LC0: .long 0 .long -2147483648 .long 0 .long 0 .align 16 .LC2: .long -1 .long 2147483647 .long 0 .long 0 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))\n {\n printf(\"Yes\\n\");\n }\n else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))\n {\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n\nreturn 0;\n\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rdx\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L2\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L3\n.L2:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L3:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$3, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$5, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$7, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$8, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$10, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$12, %eax\n\tjne\t.L6\n.L5:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$3, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$5, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$7, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$8, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$10, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$12, %eax\n\tjne\t.L6\n.L7:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L6:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L8\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$6, %eax\n\tje\t.L8\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$9, %eax\n\tje\t.L8\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$11, %eax\n\tjne\t.L9\n.L8:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$6, %eax\n\tje\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$9, %eax\n\tje\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$11, %eax\n\tjne\t.L9\n.L10:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L4\n.L9:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L4:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L2\n\tmovl\t4(%rsp), %edx\n\tcmpl\t$2, %edx\n\tje\t.L2\n\tcmpl\t$12, %eax\n\tja\t.L5\n\tmovl\t$5546, %esi\n\tmovl\t%eax, %ecx\n\tmovq\t%rsi, %rdi\n\tshrq\t%cl, %rdi\n\tmovq\t%rdi, %rcx\n\tandb\t$1, %cl\n\tje\t.L6\n\tcmpl\t$12, %edx\n\tja\t.L6\n\tmovl\t%edx, %ecx\n\tshrq\t%cl, %rsi\n\tandb\t$1, %sil\n\tje\t.L6\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L6:\n\tcmpl\t$11, %eax\n\tja\t.L5\n\tmovl\t$2640, %esi\n\tmovl\t%eax, %ecx\n\tmovq\t%rsi, %rdi\n\tshrq\t%cl, %rdi\n\tmovq\t%rdi, %rax\n\ttestb\t$1, %al\n\tjne\t.L25\n.L5:\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L4:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L25:\n\t.cfi_restore_state\n\tcmpl\t$11, %edx\n\tja\t.L5\n\tmovl\t%edx, %ecx\n\tshrq\t%cl, %rsi\n\tandb\t$1, %sil\n\tje\t.L5\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L4\n.L2:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L26:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L2\n\tmovl\t4(%rsp), %edx\n\tcmpl\t$2, %edx\n\tje\t.L2\n\tcmpl\t$12, %eax\n\tja\t.L5\n\tmovl\t$5546, %esi\n\tmovl\t%eax, %ecx\n\tmovq\t%rsi, %rdi\n\tshrq\t%cl, %rdi\n\tmovq\t%rdi, %rcx\n\tandb\t$1, %cl\n\tje\t.L6\n\tcmpl\t$12, %edx\n\tja\t.L6\n\tmovl\t%edx, %ecx\n\tshrq\t%cl, %rsi\n\tandb\t$1, %sil\n\tje\t.L6\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L6:\n\tcmpl\t$11, %eax\n\tja\t.L5\n\tmovl\t$2640, %esi\n\tmovl\t%eax, %ecx\n\tmovq\t%rsi, %rdi\n\tshrq\t%cl, %rdi\n\tmovq\t%rdi, %rax\n\ttestb\t$1, %al\n\tjne\t.L25\n.L5:\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n.L4:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L25:\n\t.cfi_restore_state\n\tcmpl\t$11, %edx\n\tja\t.L5\n\tmovl\t%edx, %ecx\n\tshrq\t%cl, %rsi\n\tandb\t$1, %sil\n\tje\t.L5\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L4\n.L2:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L26:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))\n {\n printf(\"Yes\\n\");\n }\n else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))\n {\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n\nreturn 0;\n\n}\n", "index": 49, "inputs": [ "2 8\n", "1 10\n", "1 4\n", "2 3\n", "2 10\n", "4 3\n", "7 3\n", "7 6\n", "7 4\n", "7 5\n", "4 5\n", "1 5\n", "1 2\n", "0 2\n", "-1 2\n", "2 1\n", "1 1\n", "2 0\n", "2 6\n", "3 3\n", "7 1\n", "5 4\n", "7 10\n", "5 5\n", "2 5\n", "2 9\n", "3 6\n", "5 3\n", "7 12\n", "5 8\n", "3 9\n", "3 4\n", "5 2\n", "1 8\n", "5 10\n", "5 1\n", "3 1\n", "1 6\n", "8 3\n", "9 4\n", "2 7\n", "5 6\n", "4 4\n", "2 -1\n", "2 -2\n", "3 2\n", "2 12\n", "10 2\n", "7 2\n", "6 1\n", "1 9\n", "4 1\n", "4 9\n", "1 11\n", "4 2\n", "8 4\n", "6 4\n", "5 12\n", "6 2\n", "2 -3\n", "3 7\n", "11 1\n", "8 1\n", "8 9\n", "2 11\n", "1 7\n", "5 7\n", "8 5\n", "4 12\n", "9 12\n", "1 12\n", "12 1\n", "3 10\n", "4 8\n", "-3 2\n", "7 9\n", "10 1\n", "-2 2\n", "8 2\n", "7 11\n", "5 9\n", "12 12\n", "9 1\n", "3 8\n", "8 7\n", "9 2\n", "3 5\n", "4 6\n", "12 2\n", "7 8\n", "-4 2\n", "6 9\n", "6 8\n", "11 2\n", "8 12\n", "10 7\n", "11 5\n", "3 11\n", "12 5\n", "4 7\n", "2 4\n", "1 3\n", "1 3\n" ], "outputs": [ "No\n", "Yes\n", "No", "No\n", "No\n", "No", "Yes\n", "No", "No", "Yes\n", "No", "Yes\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "No", "Yes\n", "Yes\n", "No\n", "No\n", "No", "Yes\n", "Yes\n", "Yes\n", "No", "No", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No", "Yes\n", "Yes", "No\n", "No", "Yes", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No", "No", "No", "Yes", "No", "No\n", "No", "Yes", "Yes\n", "No\n", "No\n", "Yes\n", "No", "Yes\n", "No", "No\n", "Yes\n", "Yes\n", "Yes\n", "No", "No", "Yes\n", "Yes\n", "Yes\n", "No", "No\n", "No", "Yes\n", "No\n", "No\n", "No", "No", "Yes\n", "No", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes", "No\n", "Yes\n", "No\n", "Yes", "No", "No\n", "Yes\n", "Yes\n", "No", "No", "Yes\n", "No", "No\n", "Yes\n", "Yes\n" ], "question": "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==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))\n {\n printf(\"Yes\\n\");\n }\n else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))\n {\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n\nreturn 0;\n\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"No\"\n.LC2:\n\t.string\t\"Yes\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rdx\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L2\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L3\n.L2:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L3:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$3, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$5, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$7, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$8, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$10, %eax\n\tje\t.L5\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$12, %eax\n\tjne\t.L6\n.L5:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$3, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$5, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$7, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$8, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$10, %eax\n\tje\t.L7\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$12, %eax\n\tjne\t.L6\n.L7:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L6:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L8\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$6, %eax\n\tje\t.L8\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$9, %eax\n\tje\t.L8\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$11, %eax\n\tjne\t.L9\n.L8:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$6, %eax\n\tje\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$9, %eax\n\tje\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$11, %eax\n\tjne\t.L9\n.L10:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L4\n.L9:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L4:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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==7||y==8||y==10||y==12)) { printf("Yes\n"); } else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11)) { printf("Yes"); } else{ printf("No"); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "No" .LC2: .string "Yes" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -12(%rbp), %rdx leaq -16(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -16(%rbp), %eax cmpl $2, %eax je .L2 movl -12(%rbp), %eax cmpl $2, %eax jne .L3 .L2: leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L4 .L3: movl -16(%rbp), %eax cmpl $1, %eax je .L5 movl -16(%rbp), %eax cmpl $3, %eax je .L5 movl -16(%rbp), %eax cmpl $5, %eax je .L5 movl -16(%rbp), %eax cmpl $7, %eax je .L5 movl -16(%rbp), %eax cmpl $8, %eax je .L5 movl -16(%rbp), %eax cmpl $10, %eax je .L5 movl -16(%rbp), %eax cmpl $12, %eax jne .L6 .L5: movl -12(%rbp), %eax cmpl $1, %eax je .L7 movl -12(%rbp), %eax cmpl $3, %eax je .L7 movl -12(%rbp), %eax cmpl $5, %eax je .L7 movl -12(%rbp), %eax cmpl $7, %eax je .L7 movl -12(%rbp), %eax cmpl $8, %eax je .L7 movl -12(%rbp), %eax cmpl $10, %eax je .L7 movl -12(%rbp), %eax cmpl $12, %eax jne .L6 .L7: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L4 .L6: movl -16(%rbp), %eax cmpl $4, %eax je .L8 movl -16(%rbp), %eax cmpl $6, %eax je .L8 movl -16(%rbp), %eax cmpl $9, %eax je .L8 movl -16(%rbp), %eax cmpl $11, %eax jne .L9 .L8: movl -12(%rbp), %eax cmpl $4, %eax je .L10 movl -12(%rbp), %eax cmpl $6, %eax je .L10 movl -12(%rbp), %eax cmpl $9, %eax je .L10 movl -12(%rbp), %eax cmpl $11, %eax jne .L9 .L10: leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L4 .L9: leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L4: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L12 call __stack_chk_fail@PLT .L12: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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(\"%d %d %d %d %d\", &a[0], &a[1], &a[2], &a[3], &a[4]);\n\n for (i = 0; i < 5; i++) {\n if (a[i] % 10 == 0) {\n ans += a[i];\n continue;\n }\n if (loss < 10 - a[i] % 10) {\n loss = 10 - a[i] % 10;\n }\n ans += (a[i] / 10) * 10 + 10;\n }\n ans -= loss;\n printf(\"%d\", ans);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d %d %d %d\"\n.LC1:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -44(%rbp)\n\tmovl\t$0, -40(%rbp)\n\tleaq\t-32(%rbp), %rax\n\tleaq\t16(%rax), %rdi\n\tleaq\t-32(%rbp), %rax\n\tleaq\t12(%rax), %rsi\n\tleaq\t-32(%rbp), %rax\n\tleaq\t8(%rax), %rcx\n\tleaq\t-32(%rbp), %rax\n\tleaq\t4(%rax), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rdi, %r9\n\tmovq\t%rsi, %r8\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\ttestl\t%edx, %edx\n\tjne\t.L3\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %eax\n\taddl\t%eax, -40(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t$10, %eax\n\tsubl\t%ecx, %eax\n\tcmpl\t%eax, -44(%rbp)\n\tjge\t.L5\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t$10, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -44(%rbp)\n.L5:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%eax, -40(%rbp)\n.L4:\n\taddl\t$1, -36(%rbp)\n.L2:\n\tcmpl\t$4, -36(%rbp)\n\tjle\t.L6\n\tmovl\t-44(%rbp), %eax\n\tsubl\t%eax, -40(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tleaq\t8(%rsp), %rcx\n\tleaq\t4(%rsp), %rdx\n\tleaq\t16(%rsp), %r9\n\tleaq\t12(%rsp), %r8\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t(%rsp), %rax\n\tmovq\t%rax, %rcx\n\timulq\t$1717986919, %rax, %rax\n\tmovl\t%ecx, %edx\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %edx\n\tmovl\t%eax, %esi\n\tmovl\t%ecx, %eax\n\taddl\t%edx, %edx\n\tsubl\t%edx, %eax\n\tje\t.L2\n\tmovl\t$10, %edx\n\tleal\t5(%rsi,%rsi,4), %ecx\n\tsubl\t%eax, %edx\n\taddl\t%ecx, %ecx\n\tmovl\t%edx, %eax\n.L2:\n\tmovslq\t4(%rsp), %rdx\n\tmovq\t%rdx, %rsi\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%esi, %edi\n\tleal\t(%rcx,%rsi), %r9d\n\tsarl\t$31, %edi\n\tsarq\t$34, %rdx\n\tsubl\t%edi, %edx\n\tleal\t(%rdx,%rdx,4), %edi\n\tmovl\t%edx, %r8d\n\taddl\t%edi, %edi\n\tsubl\t%edi, %esi\n\tmovl\t%esi, %edx\n\tje\t.L4\n\tmovl\t$10, %esi\n\tsubl\t%edx, %esi\n\tleal\t5(%r8,%r8,4), %edx\n\tcmpl\t%esi, %eax\n\tleal\t(%rcx,%rdx,2), %r9d\n\tcmovl\t%esi, %eax\n.L4:\n\tmovslq\t8(%rsp), %rdx\n\tmovq\t%rdx, %rcx\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%ecx, %esi\n\tleal\t(%r9,%rcx), %r8d\n\tsarl\t$31, %esi\n\tsarq\t$34, %rdx\n\tsubl\t%esi, %edx\n\tleal\t(%rdx,%rdx,4), %esi\n\tmovl\t%edx, %edi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %ecx\n\tmovl\t%ecx, %edx\n\tje\t.L6\n\tmovl\t$10, %ecx\n\tsubl\t%edx, %ecx\n\tleal\t5(%rdi,%rdi,4), %edx\n\tcmpl\t%ecx, %eax\n\tleal\t(%r9,%rdx,2), %r8d\n\tcmovl\t%ecx, %eax\n.L6:\n\tmovslq\t12(%rsp), %rdx\n\tmovq\t%rdx, %rcx\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%ecx, %esi\n\tleal\t(%r8,%rcx), %r9d\n\tsarl\t$31, %esi\n\tsarq\t$34, %rdx\n\tsubl\t%esi, %edx\n\tleal\t(%rdx,%rdx,4), %esi\n\tmovl\t%edx, %edi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %ecx\n\tmovl\t%ecx, %edx\n\tje\t.L8\n\tmovl\t$10, %ecx\n\tsubl\t%edx, %ecx\n\tleal\t5(%rdi,%rdi,4), %edx\n\tcmpl\t%ecx, %eax\n\tleal\t(%r8,%rdx,2), %r9d\n\tcmovl\t%ecx, %eax\n.L8:\n\tmovslq\t16(%rsp), %rdx\n\tmovq\t%rdx, %rcx\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsarq\t$34, %rdx\n\tsubl\t%esi, %edx\n\tleal\t(%rdx,%rdx,4), %esi\n\tmovl\t%edx, %edi\n\tmovl\t%ecx, %edx\n\taddl\t%esi, %esi\n\tsubl\t%esi, %edx\n\tje\t.L20\n\tmovl\t$10, %ecx\n\tsubl\t%edx, %ecx\n\tleal\t5(%rdi,%rdi,4), %edx\n\tcmpl\t%ecx, %eax\n\tleal\t(%r9,%rdx,2), %edx\n\tcmovl\t%ecx, %eax\n.L10:\n\tsubl\t%eax, %edx\n\tleaq\t.LC1(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L21\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L20:\n\t.cfi_restore_state\n\tleal\t(%rcx,%r9), %edx\n\tjmp\t.L10\n.L21:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tleaq\t8(%rsp), %rcx\n\tleaq\t4(%rsp), %rdx\n\tleaq\t16(%rsp), %r9\n\tleaq\t12(%rsp), %r8\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t(%rsp), %rax\n\tmovq\t%rax, %rcx\n\timulq\t$1717986919, %rax, %rax\n\tmovl\t%ecx, %edx\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %edx\n\tmovl\t%eax, %esi\n\tmovl\t%ecx, %eax\n\taddl\t%edx, %edx\n\tsubl\t%edx, %eax\n\tje\t.L2\n\tmovl\t$10, %edx\n\tleal\t5(%rsi,%rsi,4), %ecx\n\tsubl\t%eax, %edx\n\taddl\t%ecx, %ecx\n\tmovl\t%edx, %eax\n.L2:\n\tmovslq\t4(%rsp), %rdx\n\tmovq\t%rdx, %rsi\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%esi, %edi\n\tleal\t(%rcx,%rsi), %r9d\n\tsarl\t$31, %edi\n\tsarq\t$34, %rdx\n\tsubl\t%edi, %edx\n\tleal\t(%rdx,%rdx,4), %edi\n\tmovl\t%edx, %r8d\n\taddl\t%edi, %edi\n\tsubl\t%edi, %esi\n\tmovl\t%esi, %edx\n\tje\t.L4\n\tmovl\t$10, %esi\n\tsubl\t%edx, %esi\n\tleal\t5(%r8,%r8,4), %edx\n\tcmpl\t%esi, %eax\n\tleal\t(%rcx,%rdx,2), %r9d\n\tcmovl\t%esi, %eax\n.L4:\n\tmovslq\t8(%rsp), %rdx\n\tmovq\t%rdx, %rcx\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%ecx, %esi\n\tleal\t(%r9,%rcx), %r8d\n\tsarl\t$31, %esi\n\tsarq\t$34, %rdx\n\tsubl\t%esi, %edx\n\tleal\t(%rdx,%rdx,4), %esi\n\tmovl\t%edx, %edi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %ecx\n\tmovl\t%ecx, %edx\n\tje\t.L6\n\tmovl\t$10, %ecx\n\tsubl\t%edx, %ecx\n\tleal\t5(%rdi,%rdi,4), %edx\n\tcmpl\t%ecx, %eax\n\tleal\t(%r9,%rdx,2), %r8d\n\tcmovl\t%ecx, %eax\n.L6:\n\tmovslq\t12(%rsp), %rdx\n\tmovq\t%rdx, %rcx\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%ecx, %esi\n\tleal\t(%r8,%rcx), %r9d\n\tsarl\t$31, %esi\n\tsarq\t$34, %rdx\n\tsubl\t%esi, %edx\n\tleal\t(%rdx,%rdx,4), %esi\n\tmovl\t%edx, %edi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %ecx\n\tmovl\t%ecx, %edx\n\tje\t.L8\n\tmovl\t$10, %ecx\n\tsubl\t%edx, %ecx\n\tleal\t5(%rdi,%rdi,4), %edx\n\tcmpl\t%ecx, %eax\n\tleal\t(%r8,%rdx,2), %r9d\n\tcmovl\t%ecx, %eax\n.L8:\n\tmovslq\t16(%rsp), %rdx\n\tmovq\t%rdx, %rcx\n\timulq\t$1717986919, %rdx, %rdx\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsarq\t$34, %rdx\n\tsubl\t%esi, %edx\n\tleal\t(%rdx,%rdx,4), %esi\n\tmovl\t%edx, %edi\n\tmovl\t%ecx, %edx\n\taddl\t%esi, %esi\n\tsubl\t%esi, %edx\n\tje\t.L20\n\tmovl\t$10, %ecx\n\tsubl\t%edx, %ecx\n\tleal\t5(%rdi,%rdi,4), %edx\n\tcmpl\t%ecx, %eax\n\tleal\t(%r9,%rdx,2), %edx\n\tcmovl\t%ecx, %eax\n.L10:\n\tsubl\t%eax, %edx\n\tleaq\t.LC1(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L21\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L20:\n\t.cfi_restore_state\n\tleal\t(%rcx,%r9), %edx\n\tjmp\t.L10\n.L21:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(\"%d %d %d %d %d\", &a[0], &a[1], &a[2], &a[3], &a[4]);\n\n for (i = 0; i < 5; i++) {\n if (a[i] % 10 == 0) {\n ans += a[i];\n continue;\n }\n if (loss < 10 - a[i] % 10) {\n loss = 10 - a[i] % 10;\n }\n ans += (a[i] / 10) * 10 + 10;\n }\n ans -= loss;\n printf(\"%d\", ans);\n return 0;\n}", "index": 47, "inputs": [ "123\n123\n161\n123\n123\n", "29\n20\n13\n35\n120\n", "101\n86\n119\n108\n92\n", "123\n123\n161\n123\n163\n", "29\n20\n9\n35\n120\n", "101\n86\n119\n125\n92\n", "123\n123\n161\n123\n263\n", "29\n20\n4\n35\n120\n", "101\n26\n119\n125\n92\n", "123\n123\n40\n123\n263\n", "29\n20\n4\n18\n120\n", "101\n26\n119\n125\n53\n", "123\n118\n40\n123\n263\n", "29\n20\n4\n52\n120\n", "123\n118\n40\n123\n461\n", "29\n20\n4\n52\n96\n", "101\n28\n141\n125\n53\n", "29\n20\n4\n52\n89\n", "123\n114\n40\n95\n461\n", "123\n96\n40\n95\n461\n", "101\n30\n142\n212\n53\n", "123\n96\n8\n95\n461\n", "29\n20\n2\n52\n48\n", "101\n6\n142\n92\n53\n", "123\n96\n0\n95\n461\n", "101\n6\n142\n162\n53\n", "29\n20\n4\n60\n49\n", "101\n6\n142\n60\n53\n", "123\n96\n2\n95\n105\n", "29\n20\n6\n60\n49\n", "101\n6\n140\n60\n53\n", "123\n96\n0\n95\n105\n", "29\n29\n6\n60\n49\n", "101\n6\n140\n60\n23\n", "123\n96\n0\n95\n183\n", "29\n29\n11\n60\n49\n", "101\n6\n140\n60\n36\n", "123\n96\n0\n173\n183\n", "29\n29\n11\n60\n11\n", "101\n6\n140\n65\n36\n", "123\n96\n0\n173\n122\n", "101\n6\n22\n65\n36\n", "123\n96\n0\n230\n122\n", "29\n29\n31\n60\n11\n", "101\n6\n22\n79\n36\n", "29\n29\n31\n85\n11\n", "123\n96\n-1\n449\n122\n", "29\n40\n31\n85\n11\n", "29\n44\n31\n85\n11\n", "29\n52\n31\n85\n11\n", "123\n96\n0\n219\n122\n", "29\n52\n31\n95\n11\n", "123\n96\n1\n219\n122\n", "101\n3\n43\n79\n38\n", "123\n96\n1\n233\n122\n", "123\n96\n0\n233\n122\n", "123\n96\n0\n267\n122\n", "29\n33\n32\n58\n15\n", "123\n57\n0\n442\n122\n", "123\n111\n0\n600\n122\n", "29\n33\n8\n79\n15\n", "123\n101\n0\n600\n122\n", "29\n2\n8\n79\n15\n", "29\n2\n8\n79\n26\n", "29\n0\n8\n79\n26\n", "29\n0\n8\n79\n49\n", "123\n111\n-1\n856\n36\n", "123\n111\n-1\n856\n41\n", "29\n0\n8\n65\n22\n", "29\n0\n8\n5\n22\n", "123\n110\n-1\n856\n29\n", "29\n0\n8\n5\n11\n", "101\n10\n1\n288\n17\n", "123\n110\n-1\n940\n29\n", "101\n10\n1\n468\n17\n", "123\n110\n-1\n940\n19\n", "29\n1\n8\n9\n11\n", "101\n15\n1\n468\n17\n", "123\n110\n0\n940\n2\n", "29\n0\n8\n10\n2\n", "101\n8\n1\n576\n4\n", "123\n100\n0\n940\n2\n", "29\n0\n8\n17\n2\n", "101\n8\n1\n1055\n4\n", "101\n8\n1\n320\n4\n", "123\n111\n1\n940\n2\n", "29\n-1\n8\n17\n3\n", "29\n-1\n8\n0\n3\n", "101\n13\n1\n316\n4\n", "123\n101\n1\n52\n2\n", "101\n13\n1\n596\n4\n", "123\n111\n1\n52\n2\n", "29\n0\n2\n-1\n3\n", "123\n101\n0\n52\n2\n", "29\n0\n2\n-1\n0\n", "101\n13\n4\n1178\n4\n", "123\n100\n0\n52\n3\n", "29\n0\n3\n-1\n0\n", "101\n26\n4\n239\n5\n", "29\n-1\n3\n-4\n1\n", "123\n123\n123\n123\n123\n", "29\n20\n7\n35\n120\n", "101\n86\n119\n108\n57\n", "29\n20\n7\n35\n120\n" ], "outputs": [ "681", "223", "521", "721", "215", "541", "821", "214", "481", "693", "194", "441", "683", "232", "881", "212", "471", "202", "851", "831", "561", "801", "162", "421", "791", "491", "164", "381", "442", "166", "371", "433", "176", "341", "513", "181", "351", "593", "151", "361", "532", "251", "582", "171", "261", "201", "809", "211", "221", "231", "572", "241", "581", "281", "601", "592", "622", "182", "762", "971", "173", "961", "142", "152", "146", "168", "1149", "1159", "132", "72", "1129", "61", "431", "1209", "611", "1199", "71", "621", "1182", "52", "711", "1172", "62", "1191", "451", "1201", "69", "49", "461", "311", "741", "321", "49", "301", "39", "1321", "292", "39", "391", "56", "643", "215", "481", "215" ], "question": "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(\"%d %d %d %d %d\", &a[0], &a[1], &a[2], &a[3], &a[4]);\n\n for (i = 0; i < 5; i++) {\n if (a[i] % 10 == 0) {\n ans += a[i];\n continue;\n }\n if (loss < 10 - a[i] % 10) {\n loss = 10 - a[i] % 10;\n }\n ans += (a[i] / 10) * 10 + 10;\n }\n ans -= loss;\n printf(\"%d\", ans);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d %d %d %d\"\n.LC1:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -44(%rbp)\n\tmovl\t$0, -40(%rbp)\n\tleaq\t-32(%rbp), %rax\n\tleaq\t16(%rax), %rdi\n\tleaq\t-32(%rbp), %rax\n\tleaq\t12(%rax), %rsi\n\tleaq\t-32(%rbp), %rax\n\tleaq\t8(%rax), %rcx\n\tleaq\t-32(%rbp), %rax\n\tleaq\t4(%rax), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rdi, %r9\n\tmovq\t%rsi, %r8\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -36(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\ttestl\t%edx, %edx\n\tjne\t.L3\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %eax\n\taddl\t%eax, -40(%rbp)\n\tjmp\t.L4\n.L3:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t$10, %eax\n\tsubl\t%ecx, %eax\n\tcmpl\t%eax, -44(%rbp)\n\tjge\t.L5\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t$10, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -44(%rbp)\n.L5:\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tmovl\t-32(%rbp,%rax,4), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%eax, -40(%rbp)\n.L4:\n\taddl\t$1, -36(%rbp)\n.L2:\n\tcmpl\t$4, -36(%rbp)\n\tjle\t.L6\n\tmovl\t-44(%rbp), %eax\n\tsubl\t%eax, -40(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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], &a[3], &a[4]); for (i = 0; i < 5; i++) { if (a[i] % 10 == 0) { ans += a[i]; continue; } if (loss < 10 - a[i] % 10) { loss = 10 - a[i] % 10; } ans += (a[i] / 10) * 10 + 10; } ans -= loss; printf("%d", ans); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d %d %d %d" .LC1: .string "%d" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -44(%rbp) movl $0, -40(%rbp) leaq -32(%rbp), %rax leaq 16(%rax), %rdi leaq -32(%rbp), %rax leaq 12(%rax), %rsi leaq -32(%rbp), %rax leaq 8(%rax), %rcx leaq -32(%rbp), %rax leaq 4(%rax), %rdx leaq -32(%rbp), %rax movq %rdi, %r9 movq %rsi, %r8 movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -36(%rbp) jmp .L2 .L6: movl -36(%rbp), %eax cltq movl -32(%rbp,%rax,4), %ecx movslq %ecx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %ecx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax subl %eax, %ecx movl %ecx, %edx testl %edx, %edx jne .L3 movl -36(%rbp), %eax cltq movl -32(%rbp,%rax,4), %eax addl %eax, -40(%rbp) jmp .L4 .L3: movl -36(%rbp), %eax cltq movl -32(%rbp,%rax,4), %edx movslq %edx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax movl %edx, %ecx subl %eax, %ecx movl $10, %eax subl %ecx, %eax cmpl %eax, -44(%rbp) jge .L5 movl -36(%rbp), %eax cltq movl -32(%rbp,%rax,4), %edx movslq %edx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax movl %edx, %ecx subl %eax, %ecx movl $10, %eax subl %ecx, %eax movl %eax, -44(%rbp) .L5: movl -36(%rbp), %eax cltq movl -32(%rbp,%rax,4), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax leal 1(%rax), %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax addl %eax, -40(%rbp) .L4: addl $1, -36(%rbp) .L2: cmpl $4, -36(%rbp) jle .L6 movl -44(%rbp), %eax subl %eax, -40(%rbp) movl -40(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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.LC0:\n\t.string\t\"square1001\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\tleaq\t.LC0(%rip), %rdi\n\tcall\tputs@PLT\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tleaq\t.LC0(%rip), %rdi\n\tcall\tputs@PLT\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#include<stdio.h>\n\nint main(void) {\n puts(\"square1001\");\n return 0;\n}\n", "index": 82, "inputs": [ "\n" ], "outputs": [ "square1001\n" ], "question": "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.LC0:\n\t.string\t\"square1001\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq .LC0(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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 int x_a = x[ind2[a]];\n long long int y_a = y[ind2[a]];\n long long int x_b = x[ind2[b]];\n long long int y_b = y[ind2[b]];\n return x_a*x_b + y_a*y_b;\n}\nlong long int gaiseki(int a, int b){\n long long int x_a = x[ind2[a]];\n long long int y_a = y[ind2[a]];\n long long int x_b = x[ind2[b]];\n long long int y_b = y[ind2[b]];\n return x_a * y_b - y_a * x_b;\n}\nint compare_angle(const void* a_, const void* b_){\n //(1, 0)を基準に偏角ソートを厳密に行う関数(qsortで呼び出されることを想定)\n //同じ角度の場合や(0,0)の入力は想定していない(が,ソートする上では-1でも1でも問題ないはず)\n int a = *(int *)a_;\n int b = *(int *)b_;\n long long int x_a = x[a];\n long long int y_a = y[a];\n long long int x_b = x[b];\n long long int y_b = y[b];\n if(y_a == 0 && x_a >= 0){\n return -1;\n }\n if(y_b == 0 && x_b >= 0){\n return 1;\n }\n\n if(y_a > 0 && y_b < 0){\n return -1;\n }\n if(y_a < 0 && y_b > 0){\n return 1;\n }\n\n if(x_a * y_b - y_a * x_b > 0){\n return -1;\n }else{\n return 1;\n }\n}\nint isUnder180(int a, int b){\n //外積を計算\n return gaiseki(a, b) >= 0;\n}\ndouble dist(int a, int b){\n return pow(pow(a, 2) + pow(b, 2), 0.5);\n}\nint main(void){\n int n;\n scanf(\"%d\", &n);\n double d_max = 0;\n int i, j, k;\n long long int x_tmp, y_tmp;\n for(i = 0; i < n; i++){\n scanf(\"%lld%lld\", &x[i], &y[i]);\n }\n for(i = 0; i < n; i++){\n ind[i] = i;\n }\n qsort(ind, n, sizeof(int), compare_angle);\n for(j = 0; j < n; j++){\n ind2[j] = ind[j];\n }\n for(j = 0; j < n; j++){\n ind2[j+n] = ind[j];\n }\n\n for(i = 0; i < n; i++){\n int right = i + n;\n int left = i;\n while(right - left > 1){\n int mid = (right + left)/2;\n if(isUnder180(i, mid)){\n left = mid;\n }else{\n right = mid;\n }\n }\n x_tmp = 0;\n y_tmp = 0;\n for(j = i; j <= left; j++){\n x_tmp += x[ind2[j]];\n y_tmp += y[ind2[j]];\n d_max = d_max > dist(x_tmp, y_tmp) ? d_max : dist(x_tmp, y_tmp);\n }\n \n }\n printf(\"%.20lf\\n\", d_max);\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tx\n\t.bss\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 800\nx:\n\t.zero\t800\n\t.globl\ty\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 800\ny:\n\t.zero\t800\n\t.globl\tind\n\t.align 32\n\t.type\tind, @object\n\t.size\tind, 400\nind:\n\t.zero\t400\n\t.globl\tind2\n\t.align 32\n\t.type\tind2, @object\n\t.size\tind2, 800\nind2:\n\t.zero\t800\n\t.text\n\t.globl\tnaiseki\n\t.type\tnaiseki, @function\nnaiseki:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovl\t%esi, -40(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnaiseki, .-naiseki\n\t.globl\tgaiseki\n\t.type\tgaiseki, @function\ngaiseki:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovl\t%esi, -40(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rcx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tgaiseki, .-gaiseki\n\t.globl\tcompare_angle\n\t.type\tcompare_angle, @function\ncompare_angle:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -56(%rbp)\n\tmovq\t%rsi, -64(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -40(%rbp)\n\tmovq\t-64(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L6\n\tcmpq\t$0, -32(%rbp)\n\tjs\t.L6\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L6:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L8\n\tcmpq\t$0, -16(%rbp)\n\tjs\t.L8\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L8:\n\tcmpq\t$0, -24(%rbp)\n\tjle\t.L9\n\tcmpq\t$0, -8(%rbp)\n\tjns\t.L9\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L9:\n\tcmpq\t$0, -24(%rbp)\n\tjns\t.L10\n\tcmpq\t$0, -8(%rbp)\n\tjle\t.L10\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L10:\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rcx, %rax\n\ttestq\t%rax, %rax\n\tjle\t.L11\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L11:\n\tmovl\t$1, %eax\n.L7:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tcompare_angle, .-compare_angle\n\t.globl\tisUnder180\n\t.type\tisUnder180, @function\nisUnder180:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgaiseki\n\tnotq\t%rax\n\tshrq\t$63, %rax\n\tmovzbl\t%al, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tisUnder180, .-isUnder180\n\t.globl\tdist\n\t.type\tdist, @function\ndist:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t-4(%rbp), %xmm3\n\tmovq\t%xmm3, %rax\n\tmovsd\t.LC0(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tpow@PLT\n\tmovsd\t%xmm0, -16(%rbp)\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t-8(%rbp), %xmm4\n\tmovq\t%xmm4, %rax\n\tmovsd\t.LC0(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tpow@PLT\n\tmovapd\t%xmm0, %xmm2\n\taddsd\t-16(%rbp), %xmm2\n\tmovq\t%xmm2, %rax\n\tmovsd\t.LC1(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tpow@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tdist, .-dist\n\t.section\t.rodata\n.LC2:\n\t.string\t\"%d\"\n.LC4:\n\t.string\t\"%lld%lld\"\n.LC5:\n\t.string\t\"%.20lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-56(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -32(%rbp)\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\tx(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -52(%rbp)\n.L17:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L18\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L19\n.L20:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tind(%rip), %rdx\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -52(%rbp)\n.L19:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L20\n\tmovl\t-56(%rbp), %eax\n\tcltq\n\tleaq\tcompare_angle(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$4, %edx\n\tmovq\t%rax, %rsi\n\tleaq\tind(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -48(%rbp)\n\tjmp\t.L21\n.L22:\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-48(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tind2(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -48(%rbp)\n.L21:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -48(%rbp)\n\tjl\t.L22\n\tmovl\t$0, -48(%rbp)\n\tjmp\t.L23\n.L24:\n\tmovl\t-56(%rbp), %edx\n\tmovl\t-48(%rbp), %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%ecx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tind2(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -48(%rbp)\n.L23:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -48(%rbp)\n\tjl\t.L24\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L25\n.L34:\n\tmovl\t-56(%rbp), %edx\n\tmovl\t-52(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -44(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, -40(%rbp)\n\tjmp\t.L26\n.L28:\n\tmovl\t-44(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tisUnder180\n\ttestl\t%eax, %eax\n\tje\t.L27\n\tmovl\t-36(%rbp), %eax\n\tmovl\t%eax, -40(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovl\t-36(%rbp), %eax\n\tmovl\t%eax, -44(%rbp)\n.L26:\n\tmovl\t-44(%rbp), %eax\n\tsubl\t-40(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjg\t.L28\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, -48(%rbp)\n\tjmp\t.L29\n.L33:\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -24(%rbp)\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tdist\n\tmovsd\t-32(%rbp), %xmm1\n\tcomisd\t%xmm0, %xmm1\n\tjbe\t.L38\n\tmovq\t-32(%rbp), %rax\n\tjmp\t.L32\n.L38:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tdist\n\tmovq\t%xmm0, %rax\n.L32:\n\tmovq\t%rax, -32(%rbp)\n\taddl\t$1, -48(%rbp)\n.L29:\n\tmovl\t-48(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjle\t.L33\n\taddl\t$1, -52(%rbp)\n.L25:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L34\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC5(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L36\n\tcall\t__stack_chk_fail@PLT\n.L36:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1073741824\n\t.align 8\n.LC1:\n\t.long\t0\n\t.long\t1071644672\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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, %rax\n\tjne\t.L12\n\tmovl\t$-1, %r8d\n\ttestq\t%rdi, %rdi\n\tjs\t.L12\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t(%rsi), %rsi\n\tmovq\t(%rdx,%rsi,8), %rdx\n\tmovq\t(%rcx,%rsi,8), %rcx\n\ttestq\t%rdx, %rdx\n\tjne\t.L13\n\tmovl\t$1, %r8d\n\ttestq\t%rcx, %rcx\n\tjns\t.L1\n.L13:\n\ttestq\t%rax, %rax\n\tjle\t.L14\n\tmovl\t$-1, %r8d\n\ttestq\t%rdx, %rdx\n\tjs\t.L1\n.L14:\n\ttestq\t%rax, %rax\n\tjns\t.L15\n\tmovl\t$1, %r8d\n\ttestq\t%rdx, %rdx\n\tjg\t.L1\n.L15:\n\timulq\t%rcx, %rax\n\txorl\t%r8d, %r8d\n\timulq\t%rdx, %rdi\n\tcmpq\t%rax, %rdi\n\tsetle\t%r8b\n\tleal\t-1(%r8,%r8), %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tcompare_angle, .-compare_angle\n\t.p2align 4\n\t.globl\tnaiseki\n\t.type\tnaiseki, @function\nnaiseki:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tind2(%rip), %rax\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rsi\n\tmovslq\t(%rax,%rsi,4), %rsi\n\tmovslq\t(%rax,%rdi,4), %rdx\n\tleaq\tx(%rip), %rcx\n\tmovq\t(%rcx,%rdx,8), %rax\n\timulq\t(%rcx,%rsi,8), %rax\n\tleaq\ty(%rip), %rcx\n\tmovq\t(%rcx,%rdx,8), %rdx\n\timulq\t(%rcx,%rsi,8), %rdx\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tnaiseki, .-naiseki\n\t.p2align 4\n\t.globl\tgaiseki\n\t.type\tgaiseki, @function\ngaiseki:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tind2(%rip), %rax\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rsi\n\tmovslq\t(%rax,%rsi,4), %rsi\n\tmovslq\t(%rax,%rdi,4), %rdi\n\tleaq\tx(%rip), %rcx\n\tleaq\ty(%rip), %rdx\n\tmovq\t(%rcx,%rdi,8), %rax\n\timulq\t(%rdx,%rsi,8), %rax\n\tmovq\t(%rdx,%rdi,8), %rdx\n\timulq\t(%rcx,%rsi,8), %rdx\n\tsubq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tgaiseki, .-gaiseki\n\t.p2align 4\n\t.globl\tisUnder180\n\t.type\tisUnder180, @function\nisUnder180:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tind2(%rip), %rdx\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rsi\n\tmovslq\t(%rdx,%rsi,4), %rsi\n\tmovslq\t(%rdx,%rdi,4), %rdi\n\tleaq\tx(%rip), %rcx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rcx,%rdi,8), %rdx\n\timulq\t(%rax,%rsi,8), %rdx\n\tmovq\t(%rax,%rdi,8), %rax\n\timulq\t(%rcx,%rsi,8), %rax\n\tcmpq\t%rax, %rdx\n\tsetge\t%al\n\tmovzbl\t%al, %eax\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tisUnder180, .-isUnder180\n\t.p2align 4\n\t.globl\tdist\n\t.type\tdist, @function\ndist:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%edi, %xmm0\n\tcvtsi2sdl\t%esi, %xmm1\n\tmulsd\t%xmm0, %xmm0\n\tmulsd\t%xmm1, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t.LC0(%rip), %xmm1\n\tjmp\tpow@PLT\n\t.cfi_endproc\n.LFE43:\n\t.size\tdist, .-dist\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC3:\n\t.string\t\"%d\"\n.LC4:\n\t.string\t\"%lld%lld\"\n.LC6:\n\t.string\t\"%.20lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC3(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\tind(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 128\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t52(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L31\n\tleaq\tx(%rip), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\ty(%rip), %r13\n\tleaq\t.LC4(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tleaq\t0(%r13,%rbx,8), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %eax\n\taddq\t$1, %rbx\n\taddq\t$8, %rbp\n\tcmpl\t%ebx, %eax\n\tjg\t.L32\n\ttestl\t%eax, %eax\n\tjle\t.L56\n\tleal\t-1(%rax), %edx\n\tcmpl\t$2, %edx\n\tjbe\t.L45\n\tmovl\t%eax, %ecx\n\tleaq\tind(%rip), %r12\n\tmovdqa\t.LC1(%rip), %xmm0\n\tmovdqa\t.LC5(%rip), %xmm2\n\tshrl\t$2, %ecx\n\tleaq\t16(%r12), %rsi\n\tmovq\t%r12, %rdx\n\tsubl\t$1, %ecx\n\tsalq\t$4, %rcx\n\taddq\t%rsi, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovdqa\t%xmm0, %xmm1\n\taddq\t$16, %rdx\n\tpaddd\t%xmm2, %xmm0\n\tmovaps\t%xmm1, -16(%rdx)\n\tcmpq\t%rcx, %rdx\n\tjne\t.L34\n\tmovl\t%eax, %edx\n\tandl\t$-4, %edx\n\ttestb\t$3, %al\n\tje\t.L31\n.L33:\n\tmovslq\t%edx, %rcx\n\tmovl\t%edx, (%r12,%rcx,4)\n\tleal\t1(%rdx), %ecx\n\tcmpl\t%ecx, %eax\n\tjle\t.L31\n\tmovslq\t%ecx, %rsi\n\taddl\t$2, %edx\n\tmovl\t%ecx, (%r12,%rsi,4)\n\tcmpl\t%edx, %eax\n\tjle\t.L31\n\tmovslq\t%edx, %rcx\n\tmovl\t%edx, (%r12,%rcx,4)\n.L31:\n\tmovslq\t%eax, %rsi\n\tleaq\tcompare_angle(%rip), %rcx\n\tmovl\t$4, %edx\n\tmovq\t%r12, %rdi\n\tcall\tqsort@PLT\n\tmovslq\t52(%rsp), %rax\n\tmovl\t%eax, 36(%rsp)\n\ttestl\t%eax, %eax\n\tjle\t.L46\n\tleaq\t0(,%rax,4), %r13\n\tmovq\t%r12, %rsi\n\tleaq\tind2(%rip), %rdi\n\tmovq\t%rax, 40(%rsp)\n\tmovq\t%r13, %rdx\n\tleaq\tind2(%rip), %rbx\n\tleaq\tx(%rip), %r14\n\tcall\tmemcpy@PLT\n\tleaq\tind2(%rip), %rax\n\tmovq\t%r13, %rdx\n\tmovq\t%r12, %rsi\n\tleaq\t0(%r13,%rax), %rdi\n\tleaq\ty(%rip), %r15\n\tcall\tmemcpy@PLT\n\tpxor\t%xmm4, %xmm4\n\tmovq\t$0, 24(%rsp)\n\tmovsd\t%xmm4, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovq\t24(%rsp), %rax\n\tmovl\t36(%rsp), %r10d\n\tmovl\t%eax, %r9d\n\tmovl\t%eax, %esi\n\taddl\t%eax, %r10d\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tleal\t(%r10,%rsi), %eax\n\tleaq\tind2(%rip), %rdi\n\tmovslq\t(%rbx), %rdx\n\tsarl\t%eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t(%rdi,%rcx,4), %r11\n\tmovq\t(%r14,%rdx,8), %rcx\n\tmovq\t(%r15,%rdx,8), %rdx\n\timulq\t(%r15,%r11,8), %rcx\n\timulq\t(%r14,%r11,8), %rdx\n\tcmpq\t%rdx, %rcx\n\tcmovl\t%eax, %r10d\n\tcmovge\t%eax, %esi\n.L38:\n\tmovl\t%r10d, %eax\n\tsubl\t%esi, %eax\n\tcmpl\t$1, %eax\n\tjg\t.L39\n\tmovq\t24(%rsp), %rax\n\tcmpl\t%eax, %esi\n\tjl\t.L40\n\tsubl\t%r9d, %esi\n\tmovq\t%rbx, %rbp\n\txorl\t%r12d, %r12d\n\txorl\t%r13d, %r13d\n\taddq\t%rax, %rsi\n\tleaq\tind2(%rip), %rax\n\tleaq\t4(%rax,%rsi,4), %rax\n\tmovq\t%rax, 16(%rsp)\n\tjmp\t.L42\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\taddq\t$4, %rbp\n\tcmpq\t16(%rsp), %rbp\n\tje\t.L40\n.L42:\n\tmovslq\t0(%rbp), %rsi\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tmovq\t.LC0(%rip), %rax\n\taddq\t(%r14,%rsi,8), %r13\n\taddq\t(%r15,%rsi,8), %r12\n\tcvtsi2sdl\t%r13d, %xmm0\n\tcvtsi2sdl\t%r12d, %xmm1\n\tmulsd\t%xmm0, %xmm0\n\tmulsd\t%xmm1, %xmm1\n\tmovapd\t%xmm0, %xmm2\n\taddsd\t%xmm1, %xmm2\n\tmovq\t%rax, %xmm1\n\tmovapd\t%xmm2, %xmm0\n\tmovsd\t%xmm2, (%rsp)\n\tcall\tpow@PLT\n\tmovsd\t8(%rsp), %xmm3\n\tmovsd\t(%rsp), %xmm2\n\tcomisd\t%xmm0, %xmm3\n\tja\t.L41\n\tmovq\t.LC0(%rip), %rax\n\tmovapd\t%xmm2, %xmm0\n\taddq\t$4, %rbp\n\tmovq\t%rax, %xmm1\n\tcall\tpow@PLT\n\tmovsd\t%xmm0, 8(%rsp)\n\tcmpq\t16(%rsp), %rbp\n\tjne\t.L42\n.L40:\n\taddq\t$1, 24(%rsp)\n\taddq\t$4, %rbx\n\tmovq\t24(%rsp), %rax\n\tcmpq\t%rax, 40(%rsp)\n\tjne\t.L43\n.L36:\n\tmovsd\t8(%rsp), %xmm0\n\tmovl\t$1, %edi\n\tmovl\t$1, %eax\n\tleaq\t.LC6(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L57\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L46:\n\t.cfi_restore_state\n\tpxor\t%xmm5, %xmm5\n\tmovsd\t%xmm5, 8(%rsp)\n\tjmp\t.L36\n.L45:\n\txorl\t%edx, %edx\n\tleaq\tind(%rip), %r12\n\tjmp\t.L33\n.L57:\n\tcall\t__stack_chk_fail@PLT\n.L56:\n\tleaq\tind(%rip), %r12\n\tjmp\t.L31\n\t.cfi_endproc\n.LFE44:\n\t.size\tmain, .-main\n\t.globl\tind2\n\t.bss\n\t.align 32\n\t.type\tind2, @object\n\t.size\tind2, 800\nind2:\n\t.zero\t800\n\t.globl\tind\n\t.align 32\n\t.type\tind, @object\n\t.size\tind, 400\nind:\n\t.zero\t400\n\t.globl\ty\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 800\ny:\n\t.zero\t800\n\t.globl\tx\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 800\nx:\n\t.zero\t800\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1071644672\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC5:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\tjne\t.L12\n\tmovl\t$-1, %r8d\n\ttestq\t%rdi, %rdi\n\tjs\t.L12\n.L1:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t(%rsi), %rsi\n\tmovq\t(%rdx,%rsi,8), %rdx\n\tmovq\t(%rcx,%rsi,8), %rcx\n\ttestq\t%rdx, %rdx\n\tjne\t.L13\n\tmovl\t$1, %r8d\n\ttestq\t%rcx, %rcx\n\tjns\t.L1\n.L13:\n\ttestq\t%rax, %rax\n\tjle\t.L14\n\tmovl\t$-1, %r8d\n\ttestq\t%rdx, %rdx\n\tjs\t.L1\n.L14:\n\ttestq\t%rax, %rax\n\tjns\t.L15\n\tmovl\t$1, %r8d\n\ttestq\t%rdx, %rdx\n\tjg\t.L1\n.L15:\n\timulq\t%rcx, %rax\n\txorl\t%r8d, %r8d\n\timulq\t%rdx, %rdi\n\tcmpq\t%rax, %rdi\n\tsetle\t%r8b\n\tleal\t-1(%r8,%r8), %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tcompare_angle, .-compare_angle\n\t.p2align 4\n\t.globl\tnaiseki\n\t.type\tnaiseki, @function\nnaiseki:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tind2(%rip), %rax\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rsi\n\tmovslq\t(%rax,%rsi,4), %rsi\n\tmovslq\t(%rax,%rdi,4), %rdx\n\tleaq\tx(%rip), %rcx\n\tmovq\t(%rcx,%rdx,8), %rax\n\timulq\t(%rcx,%rsi,8), %rax\n\tleaq\ty(%rip), %rcx\n\tmovq\t(%rcx,%rdx,8), %rdx\n\timulq\t(%rcx,%rsi,8), %rdx\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tnaiseki, .-naiseki\n\t.p2align 4\n\t.globl\tgaiseki\n\t.type\tgaiseki, @function\ngaiseki:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tind2(%rip), %rax\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rsi\n\tmovslq\t(%rax,%rsi,4), %rsi\n\tmovslq\t(%rax,%rdi,4), %rdi\n\tleaq\tx(%rip), %rcx\n\tleaq\ty(%rip), %rdx\n\tmovq\t(%rcx,%rdi,8), %rax\n\timulq\t(%rdx,%rsi,8), %rax\n\tmovq\t(%rdx,%rdi,8), %rdx\n\timulq\t(%rcx,%rsi,8), %rdx\n\tsubq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tgaiseki, .-gaiseki\n\t.p2align 4\n\t.globl\tisUnder180\n\t.type\tisUnder180, @function\nisUnder180:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tleaq\tind2(%rip), %rdx\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rsi\n\tmovslq\t(%rdx,%rsi,4), %rsi\n\tmovslq\t(%rdx,%rdi,4), %rdi\n\tleaq\tx(%rip), %rcx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rcx,%rdi,8), %rdx\n\timulq\t(%rax,%rsi,8), %rdx\n\tmovq\t(%rax,%rdi,8), %rax\n\timulq\t(%rcx,%rsi,8), %rax\n\tcmpq\t%rax, %rdx\n\tsetge\t%al\n\tmovzbl\t%al, %eax\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tisUnder180, .-isUnder180\n\t.p2align 4\n\t.globl\tdist\n\t.type\tdist, @function\ndist:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%edi, %xmm0\n\tcvtsi2sdl\t%esi, %xmm1\n\tmulsd\t%xmm0, %xmm0\n\tmulsd\t%xmm1, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t.LC0(%rip), %xmm1\n\tjmp\tpow@PLT\n\t.cfi_endproc\n.LFE43:\n\t.size\tdist, .-dist\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC3:\n\t.string\t\"%d\"\n.LC4:\n\t.string\t\"%lld%lld\"\n.LC6:\n\t.string\t\"%.20lf\\n\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC3(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\tind(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 128\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t52(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L31\n\tleaq\tx(%rip), %rbp\n\txorl\t%ebx, %ebx\n\tleaq\ty(%rip), %r13\n\tleaq\t.LC4(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tleaq\t0(%r13,%rbx,8), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %eax\n\taddq\t$1, %rbx\n\taddq\t$8, %rbp\n\tcmpl\t%ebx, %eax\n\tjg\t.L32\n\ttestl\t%eax, %eax\n\tjle\t.L56\n\tleal\t-1(%rax), %edx\n\tcmpl\t$2, %edx\n\tjbe\t.L45\n\tmovl\t%eax, %ecx\n\tleaq\tind(%rip), %r12\n\tmovdqa\t.LC1(%rip), %xmm0\n\tmovdqa\t.LC5(%rip), %xmm2\n\tshrl\t$2, %ecx\n\tleaq\t16(%r12), %rsi\n\tmovq\t%r12, %rdx\n\tsubl\t$1, %ecx\n\tsalq\t$4, %rcx\n\taddq\t%rsi, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovdqa\t%xmm0, %xmm1\n\taddq\t$16, %rdx\n\tpaddd\t%xmm2, %xmm0\n\tmovaps\t%xmm1, -16(%rdx)\n\tcmpq\t%rcx, %rdx\n\tjne\t.L34\n\tmovl\t%eax, %edx\n\tandl\t$-4, %edx\n\ttestb\t$3, %al\n\tje\t.L31\n.L33:\n\tmovslq\t%edx, %rcx\n\tmovl\t%edx, (%r12,%rcx,4)\n\tleal\t1(%rdx), %ecx\n\tcmpl\t%ecx, %eax\n\tjle\t.L31\n\tmovslq\t%ecx, %rsi\n\taddl\t$2, %edx\n\tmovl\t%ecx, (%r12,%rsi,4)\n\tcmpl\t%edx, %eax\n\tjle\t.L31\n\tmovslq\t%edx, %rcx\n\tmovl\t%edx, (%r12,%rcx,4)\n.L31:\n\tmovslq\t%eax, %rsi\n\tleaq\tcompare_angle(%rip), %rcx\n\tmovl\t$4, %edx\n\tmovq\t%r12, %rdi\n\tcall\tqsort@PLT\n\tmovslq\t52(%rsp), %rax\n\tmovl\t%eax, 36(%rsp)\n\ttestl\t%eax, %eax\n\tjle\t.L46\n\tleaq\t0(,%rax,4), %r13\n\tmovq\t%r12, %rsi\n\tleaq\tind2(%rip), %rdi\n\tmovq\t%rax, 40(%rsp)\n\tmovq\t%r13, %rdx\n\tleaq\tind2(%rip), %rbx\n\tleaq\tx(%rip), %r14\n\tcall\tmemcpy@PLT\n\tleaq\tind2(%rip), %rax\n\tmovq\t%r13, %rdx\n\tmovq\t%r12, %rsi\n\tleaq\t0(%r13,%rax), %rdi\n\tleaq\ty(%rip), %r15\n\tcall\tmemcpy@PLT\n\tpxor\t%xmm4, %xmm4\n\tmovq\t$0, 24(%rsp)\n\tmovsd\t%xmm4, 8(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovq\t24(%rsp), %rax\n\tmovl\t36(%rsp), %r10d\n\tmovl\t%eax, %r9d\n\tmovl\t%eax, %esi\n\taddl\t%eax, %r10d\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tleal\t(%r10,%rsi), %eax\n\tleaq\tind2(%rip), %rdi\n\tmovslq\t(%rbx), %rdx\n\tsarl\t%eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t(%rdi,%rcx,4), %r11\n\tmovq\t(%r14,%rdx,8), %rcx\n\tmovq\t(%r15,%rdx,8), %rdx\n\timulq\t(%r15,%r11,8), %rcx\n\timulq\t(%r14,%r11,8), %rdx\n\tcmpq\t%rdx, %rcx\n\tcmovl\t%eax, %r10d\n\tcmovge\t%eax, %esi\n.L38:\n\tmovl\t%r10d, %eax\n\tsubl\t%esi, %eax\n\tcmpl\t$1, %eax\n\tjg\t.L39\n\tmovq\t24(%rsp), %rax\n\tcmpl\t%eax, %esi\n\tjl\t.L40\n\tsubl\t%r9d, %esi\n\tmovq\t%rbx, %rbp\n\txorl\t%r12d, %r12d\n\txorl\t%r13d, %r13d\n\taddq\t%rax, %rsi\n\tleaq\tind2(%rip), %rax\n\tleaq\t4(%rax,%rsi,4), %rax\n\tmovq\t%rax, 16(%rsp)\n\tjmp\t.L42\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\taddq\t$4, %rbp\n\tcmpq\t16(%rsp), %rbp\n\tje\t.L40\n.L42:\n\tmovslq\t0(%rbp), %rsi\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tmovq\t.LC0(%rip), %rax\n\taddq\t(%r14,%rsi,8), %r13\n\taddq\t(%r15,%rsi,8), %r12\n\tcvtsi2sdl\t%r13d, %xmm0\n\tcvtsi2sdl\t%r12d, %xmm1\n\tmulsd\t%xmm0, %xmm0\n\tmulsd\t%xmm1, %xmm1\n\tmovapd\t%xmm0, %xmm2\n\taddsd\t%xmm1, %xmm2\n\tmovq\t%rax, %xmm1\n\tmovapd\t%xmm2, %xmm0\n\tmovsd\t%xmm2, (%rsp)\n\tcall\tpow@PLT\n\tmovsd\t8(%rsp), %xmm3\n\tmovsd\t(%rsp), %xmm2\n\tcomisd\t%xmm0, %xmm3\n\tja\t.L41\n\tmovq\t.LC0(%rip), %rax\n\tmovapd\t%xmm2, %xmm0\n\taddq\t$4, %rbp\n\tmovq\t%rax, %xmm1\n\tcall\tpow@PLT\n\tmovsd\t%xmm0, 8(%rsp)\n\tcmpq\t16(%rsp), %rbp\n\tjne\t.L42\n.L40:\n\taddq\t$1, 24(%rsp)\n\taddq\t$4, %rbx\n\tmovq\t24(%rsp), %rax\n\tcmpq\t%rax, 40(%rsp)\n\tjne\t.L43\n.L36:\n\tmovsd\t8(%rsp), %xmm0\n\tmovl\t$1, %edi\n\tmovl\t$1, %eax\n\tleaq\t.LC6(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L57\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L46:\n\t.cfi_restore_state\n\tpxor\t%xmm5, %xmm5\n\tmovsd\t%xmm5, 8(%rsp)\n\tjmp\t.L36\n.L45:\n\txorl\t%edx, %edx\n\tleaq\tind(%rip), %r12\n\tjmp\t.L33\n.L57:\n\tcall\t__stack_chk_fail@PLT\n.L56:\n\tleaq\tind(%rip), %r12\n\tjmp\t.L31\n\t.cfi_endproc\n.LFE44:\n\t.size\tmain, .-main\n\t.globl\tind2\n\t.bss\n\t.align 32\n\t.type\tind2, @object\n\t.size\tind2, 800\nind2:\n\t.zero\t800\n\t.globl\tind\n\t.align 32\n\t.type\tind, @object\n\t.size\tind, 400\nind:\n\t.zero\t400\n\t.globl\ty\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 800\ny:\n\t.zero\t800\n\t.globl\tx\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 800\nx:\n\t.zero\t800\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1071644672\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC5:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 int x_a = x[ind2[a]];\n long long int y_a = y[ind2[a]];\n long long int x_b = x[ind2[b]];\n long long int y_b = y[ind2[b]];\n return x_a*x_b + y_a*y_b;\n}\nlong long int gaiseki(int a, int b){\n long long int x_a = x[ind2[a]];\n long long int y_a = y[ind2[a]];\n long long int x_b = x[ind2[b]];\n long long int y_b = y[ind2[b]];\n return x_a * y_b - y_a * x_b;\n}\nint compare_angle(const void* a_, const void* b_){\n //(1, 0)を基準に偏角ソートを厳密に行う関数(qsortで呼び出されることを想定)\n //同じ角度の場合や(0,0)の入力は想定していない(が,ソートする上では-1でも1でも問題ないはず)\n int a = *(int *)a_;\n int b = *(int *)b_;\n long long int x_a = x[a];\n long long int y_a = y[a];\n long long int x_b = x[b];\n long long int y_b = y[b];\n if(y_a == 0 && x_a >= 0){\n return -1;\n }\n if(y_b == 0 && x_b >= 0){\n return 1;\n }\n\n if(y_a > 0 && y_b < 0){\n return -1;\n }\n if(y_a < 0 && y_b > 0){\n return 1;\n }\n\n if(x_a * y_b - y_a * x_b > 0){\n return -1;\n }else{\n return 1;\n }\n}\nint isUnder180(int a, int b){\n //外積を計算\n return gaiseki(a, b) >= 0;\n}\ndouble dist(int a, int b){\n return pow(pow(a, 2) + pow(b, 2), 0.5);\n}\nint main(void){\n int n;\n scanf(\"%d\", &n);\n double d_max = 0;\n int i, j, k;\n long long int x_tmp, y_tmp;\n for(i = 0; i < n; i++){\n scanf(\"%lld%lld\", &x[i], &y[i]);\n }\n for(i = 0; i < n; i++){\n ind[i] = i;\n }\n qsort(ind, n, sizeof(int), compare_angle);\n for(j = 0; j < n; j++){\n ind2[j] = ind[j];\n }\n for(j = 0; j < n; j++){\n ind2[j+n] = ind[j];\n }\n\n for(i = 0; i < n; i++){\n int right = i + n;\n int left = i;\n while(right - left > 1){\n int mid = (right + left)/2;\n if(isUnder180(i, mid)){\n left = mid;\n }else{\n right = mid;\n }\n }\n x_tmp = 0;\n y_tmp = 0;\n for(j = i; j <= left; j++){\n x_tmp += x[ind2[j]];\n y_tmp += y[ind2[j]];\n d_max = d_max > dist(x_tmp, y_tmp) ? d_max : dist(x_tmp, y_tmp);\n }\n \n }\n printf(\"%.20lf\\n\", d_max);\n}", "index": 56, "inputs": [ "1\n52551 91000\n", "2\n96000 -130259\n-72000 54000\n", "3\n0 10\n5 -3\n-5 -5\n", "10\n1 0\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20\n", "5\n1 1\n1 0\n0 2\n-1 0\n0 -1\n", "3\n0 0\n0 1\n2 0\n", "5\n1 1\n2 2\n3 3\n4 2\n5 5\n", "1\n76279 91000\n", "2\n49801 -130259\n-72000 54000\n", "10\n1 0\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n4 18\n19 20\n", "5\n1 1\n0 0\n0 2\n-1 0\n0 -1\n", "5\n1 1\n2 2\n3 3\n4 2\n3 5\n", "1\n93262 91000\n", "10\n1 0\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n4 18\n19 21\n", "5\n1 1\n0 1\n0 2\n-1 0\n0 -1\n", "1\n148324 91000\n", "2\n33334 -130259\n-72000 89448\n", "3\n0 10\n1 -6\n-5 -5\n", "10\n1 0\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n3 18\n19 21\n", "5\n1 1\n2 0\n5 3\n4 2\n3 5\n", "1\n232944 91000\n", "2\n33334 -247097\n-72000 89448\n", "10\n1 0\n3 4\n5 6\n7 8\n8 10\n11 12\n13 14\n15 16\n3 18\n19 21\n", "5\n1 1\n2 0\n5 3\n4 1\n3 5\n", "1\n323092 91000\n", "2\n33334 -460653\n-72000 89448\n", "3\n0 16\n1 -6\n-5 -3\n", "3\n1 1\n0 0\n3 -1\n", "5\n1 1\n2 -1\n5 3\n4 1\n3 5\n", "1\n323092 178351\n", "3\n0 18\n1 -6\n-5 -3\n", "10\n1 0\n3 4\n5 6\n8 8\n8 10\n11 12\n13 4\n15 16\n3 18\n19 21\n", "5\n1 1\n0 1\n1 0\n-2 0\n0 -1\n", "5\n1 1\n4 -1\n5 3\n4 1\n3 5\n", "1\n568221 178351\n", "10\n1 0\n3 4\n5 6\n8 8\n8 10\n20 12\n13 4\n15 16\n3 18\n19 21\n", "5\n1 1\n7 -1\n5 3\n4 1\n3 5\n", "1\n568221 83257\n", "3\n0 20\n1 -6\n-10 -3\n", "10\n1 0\n3 7\n5 6\n8 8\n8 10\n20 12\n13 4\n15 16\n3 18\n19 21\n", "5\n1 1\n7 -1\n5 0\n4 1\n3 5\n", "1\n568221 48623\n", "2\n13872 -460653\n-72000 104892\n", "10\n1 0\n3 7\n2 6\n8 8\n8 10\n20 12\n13 4\n15 16\n3 18\n19 21\n", "5\n1 1\n7 -1\n5 0\n4 1\n3 9\n", "1\n568221 60327\n", "5\n1 3\n0 1\n1 0\n-2 -2\n0 -1\n", "1\n568221 71355\n", "10\n1 0\n3 7\n2 6\n11 8\n8 10\n20 12\n13 7\n15 16\n3 18\n19 21\n", "5\n1 3\n0 1\n1 0\n-4 -2\n0 -1\n", "5\n1 1\n7 -2\n5 -1\n4 1\n3 9\n", "1\n311727 71355\n", "10\n1 0\n3 7\n2 10\n11 8\n8 10\n20 12\n13 7\n15 16\n3 18\n19 21\n", "5\n1 1\n7 -2\n5 -1\n4 0\n3 9\n", "1\n311727 72656\n", "2\n13872 -232879\n-39358 153670\n", "10\n1 0\n3 7\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 18\n19 21\n", "5\n1 6\n0 1\n2 0\n-4 -2\n0 -1\n", "1\n311727 85902\n", "2\n13872 -200911\n-39358 153670\n", "10\n1 0\n3 13\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 18\n19 21\n", "5\n1 1\n7 -2\n5 -2\n4 0\n3 7\n", "1\n311727 113970\n", "2\n13872 -201534\n-39358 153670\n", "10\n1 0\n3 13\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 18\n29 21\n", "1\n21552 113970\n", "2\n5694 -201534\n-39358 153670\n", "3\n1 13\n1 -2\n-11 -5\n", "10\n1 0\n3 13\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 27\n29 21\n", "5\n1 6\n0 1\n2 0\n-4 -3\n1 0\n", "1\n21552 24120\n", "10\n0 0\n3 13\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 27\n29 21\n", "5\n1 6\n0 1\n2 1\n-4 -3\n1 0\n", "3\n2 5\n0 -1\n-1 -1\n", "5\n1 1\n7 -2\n10 -2\n4 0\n3 10\n", "1\n21552 17969\n", "2\n6614 -201534\n-39358 141694\n", "3\n1 13\n0 -2\n-11 -4\n", "10\n0 0\n1 13\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 27\n29 21\n", "5\n1 1\n7 -2\n10 -2\n2 0\n3 10\n", "1\n4519 17969\n", "10\n0 0\n1 13\n2 10\n11 8\n8 10\n17 12\n13 7\n15 16\n3 27\n29 35\n", "5\n1 6\n-1 1\n4 1\n-4 -3\n1 0\n", "5\n1 1\n7 -2\n15 -2\n2 0\n3 10\n", "1\n4519 21907\n", "2\n6614 -289203\n-47857 141694\n", "10\n0 0\n1 13\n2 10\n11 8\n8 4\n17 12\n13 7\n15 16\n3 27\n29 35\n", "5\n1 6\n-1 1\n4 2\n-4 -3\n1 0\n", "5\n1 1\n7 -2\n15 -2\n2 0\n3 9\n", "1\n3382 21907\n", "2\n6614 -350970\n-47857 141694\n", "3\n1 0\n-1 0\n-11 -4\n", "10\n0 0\n1 13\n2 10\n11 15\n8 4\n17 12\n13 7\n15 16\n3 27\n29 35\n", "5\n1 1\n7 -2\n15 -2\n2 0\n3 3\n", "1\n464 21907\n", "10\n0 0\n1 13\n2 10\n11 15\n8 4\n17 12\n13 7\n15 16\n3 27\n29 24\n", "3\n2 6\n0 0\n-2 0\n", "5\n1 1\n7 -2\n15 -2\n3 0\n3 3\n", "1\n464 28468\n", "3\n1 0\n0 -1\n-11 -4\n", "5\n1 1\n2 2\n3 3\n4 4\n5 5\n", "10\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20\n", "3\n0 0\n0 1\n1 0\n", "1\n90447 91000\n", "3\n0 10\n5 -5\n-5 -5\n", "5\n1 1\n1 0\n0 1\n-1 0\n0 -1\n", "3\n0 10\n5 -5\n-5 -5\n", "2\n96000 -72000\n-72000 54000\n" ], "outputs": [ "105083.81226906453957781196\n", "161812.87674656798481009901\n", "10.00000000000000000000\n", "147.18695594379278190900\n", "3.60555127546398912486\n", "2.23606797749978980505\n", "19.84943324127920760702\n", "118741.25585069411317817867\n", "139454.46096127582131884992\n", "138.68309197591463544086\n", "3.16227766016837952279\n", "18.38477631085023489277\n", "130302.72692465035652276129\n", "139.46325680981354366850\n", "4.12310562561766058565\n", "174014.39301391135086305439\n", "134456.54553423571633175015\n", "11.70469991071962567730\n", "138.84163640637487446838\n", "18.60107523773827509217\n", "250087.79885472220485098660\n", "249335.28223057402647100389\n", "138.22445514452209636147\n", "18.02775637731994606838\n", "335662.68851929315133020282\n", "461857.49096988781820982695\n", "16.00000000000000000000\n", "4.00000000000000000000\n", "17.49285568453590045124\n", "369049.48132330441148951650\n", "18.00000000000000000000\n", "131.13733259449804791075\n", "2.82842712474619029095\n", "19.23538406167134340308\n", "595553.67855634982697665691\n", "137.20787149431333773464\n", "21.93171219946130889866\n", "574288.10965403076261281967\n", "20.00000000000000000000\n", "139.38794782907166336372\n", "20.88061301782110135150\n", "570297.55476417741738259792\n", "460861.82180020073428750038\n", "137.36083866954220411571\n", "22.36067977499789805051\n", "571414.43083807395305484533\n", "4.47213595499957961010\n", "572683.71800322737544775009\n", "141.59802258506294947438\n", "5.00000000000000000000\n", "21.54065922853801495762\n", "319789.39718821196584030986\n", "144.58907289280196550862\n", "21.18962010041709120856\n", "320082.20329315407434478402\n", "233291.79373694222886115313\n", "142.63590010933432949969\n", "7.61577310586390865410\n", "323346.37176408828236162663\n", "201389.33016671962104737759\n", "147.27185746095551621693\n", "20.39607805437113796643\n", "331907.94420893274946138263\n", "202010.85500536847393959761\n", "153.71727293964070781840\n", "115989.86854031692200805992\n", "201614.42109134950442239642\n", "13.03840481040529830636\n", "160.56151469141039456190\n", "8.06225774829854913150\n", "32345.99053978715164703317\n", "159.92810884894498713038\n", "8.94427190999915922021\n", "5.38516480713450373941\n", "25.96150997149434047628\n", "28060.17934725293162046000\n", "201642.50085733414744026959\n", "13.45362404707370984625\n", "158.67261893597142830004\n", "24.04163056034261458649\n", "18528.52724854298867285252\n", "169.83815825661793041945\n", "9.43398113205660315828\n", "28.86173937932362321135\n", "22368.23663143789235618897\n", "289278.62037316203350201249\n", "165.00000000000000000000\n", "10.29563014098700080012\n", "28.63564212655270679875\n", "22166.51918998560358886607\n", "351032.31460365583188831806\n", "12.64911064067351809115\n", "170.65169205138283814449\n", "28.00000000000000000000\n", "21911.91331216879552812316\n", "161.81779877380608922977\n", "6.32455532033675904557\n", "29.00000000000000000000\n", "28471.78111745031128521077\n", "12.08304597359457233097\n", "21.21320343559642651599\n", "148.66068747318504961186\n", "1.41421356237309514547\n", "128303.00000000000000000000\n", "10.00000000000000000000\n", "2.82842712474619029095\n", "10.00000000000000000000\n", "120000.00000000000000000000\n" ], "question": "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 int x_a = x[ind2[a]];\n long long int y_a = y[ind2[a]];\n long long int x_b = x[ind2[b]];\n long long int y_b = y[ind2[b]];\n return x_a*x_b + y_a*y_b;\n}\nlong long int gaiseki(int a, int b){\n long long int x_a = x[ind2[a]];\n long long int y_a = y[ind2[a]];\n long long int x_b = x[ind2[b]];\n long long int y_b = y[ind2[b]];\n return x_a * y_b - y_a * x_b;\n}\nint compare_angle(const void* a_, const void* b_){\n //(1, 0)を基準に偏角ソートを厳密に行う関数(qsortで呼び出されることを想定)\n //同じ角度の場合や(0,0)の入力は想定していない(が,ソートする上では-1でも1でも問題ないはず)\n int a = *(int *)a_;\n int b = *(int *)b_;\n long long int x_a = x[a];\n long long int y_a = y[a];\n long long int x_b = x[b];\n long long int y_b = y[b];\n if(y_a == 0 && x_a >= 0){\n return -1;\n }\n if(y_b == 0 && x_b >= 0){\n return 1;\n }\n\n if(y_a > 0 && y_b < 0){\n return -1;\n }\n if(y_a < 0 && y_b > 0){\n return 1;\n }\n\n if(x_a * y_b - y_a * x_b > 0){\n return -1;\n }else{\n return 1;\n }\n}\nint isUnder180(int a, int b){\n //外積を計算\n return gaiseki(a, b) >= 0;\n}\ndouble dist(int a, int b){\n return pow(pow(a, 2) + pow(b, 2), 0.5);\n}\nint main(void){\n int n;\n scanf(\"%d\", &n);\n double d_max = 0;\n int i, j, k;\n long long int x_tmp, y_tmp;\n for(i = 0; i < n; i++){\n scanf(\"%lld%lld\", &x[i], &y[i]);\n }\n for(i = 0; i < n; i++){\n ind[i] = i;\n }\n qsort(ind, n, sizeof(int), compare_angle);\n for(j = 0; j < n; j++){\n ind2[j] = ind[j];\n }\n for(j = 0; j < n; j++){\n ind2[j+n] = ind[j];\n }\n\n for(i = 0; i < n; i++){\n int right = i + n;\n int left = i;\n while(right - left > 1){\n int mid = (right + left)/2;\n if(isUnder180(i, mid)){\n left = mid;\n }else{\n right = mid;\n }\n }\n x_tmp = 0;\n y_tmp = 0;\n for(j = i; j <= left; j++){\n x_tmp += x[ind2[j]];\n y_tmp += y[ind2[j]];\n d_max = d_max > dist(x_tmp, y_tmp) ? d_max : dist(x_tmp, y_tmp);\n }\n \n }\n printf(\"%.20lf\\n\", d_max);\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tx\n\t.bss\n\t.align 32\n\t.type\tx, @object\n\t.size\tx, 800\nx:\n\t.zero\t800\n\t.globl\ty\n\t.align 32\n\t.type\ty, @object\n\t.size\ty, 800\ny:\n\t.zero\t800\n\t.globl\tind\n\t.align 32\n\t.type\tind, @object\n\t.size\tind, 400\nind:\n\t.zero\t400\n\t.globl\tind2\n\t.align 32\n\t.type\tind2, @object\n\t.size\tind2, 800\nind2:\n\t.zero\t800\n\t.text\n\t.globl\tnaiseki\n\t.type\tnaiseki, @function\nnaiseki:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovl\t%esi, -40(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\taddq\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnaiseki, .-naiseki\n\t.globl\tgaiseki\n\t.type\tgaiseki, @function\ngaiseki:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovl\t%esi, -40(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rcx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tgaiseki, .-gaiseki\n\t.globl\tcompare_angle\n\t.type\tcompare_angle, @function\ncompare_angle:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -56(%rbp)\n\tmovq\t%rsi, -64(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -40(%rbp)\n\tmovq\t-64(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L6\n\tcmpq\t$0, -32(%rbp)\n\tjs\t.L6\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L6:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L8\n\tcmpq\t$0, -16(%rbp)\n\tjs\t.L8\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L8:\n\tcmpq\t$0, -24(%rbp)\n\tjle\t.L9\n\tcmpq\t$0, -8(%rbp)\n\tjns\t.L9\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L9:\n\tcmpq\t$0, -24(%rbp)\n\tjns\t.L10\n\tcmpq\t$0, -8(%rbp)\n\tjle\t.L10\n\tmovl\t$1, %eax\n\tjmp\t.L7\n.L10:\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rcx, %rax\n\ttestq\t%rax, %rax\n\tjle\t.L11\n\tmovl\t$-1, %eax\n\tjmp\t.L7\n.L11:\n\tmovl\t$1, %eax\n.L7:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tcompare_angle, .-compare_angle\n\t.globl\tisUnder180\n\t.type\tisUnder180, @function\nisUnder180:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgaiseki\n\tnotq\t%rax\n\tshrq\t$63, %rax\n\tmovzbl\t%al, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tisUnder180, .-isUnder180\n\t.globl\tdist\n\t.type\tdist, @function\ndist:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tpxor\t%xmm3, %xmm3\n\tcvtsi2sdl\t-4(%rbp), %xmm3\n\tmovq\t%xmm3, %rax\n\tmovsd\t.LC0(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tpow@PLT\n\tmovsd\t%xmm0, -16(%rbp)\n\tpxor\t%xmm4, %xmm4\n\tcvtsi2sdl\t-8(%rbp), %xmm4\n\tmovq\t%xmm4, %rax\n\tmovsd\t.LC0(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tpow@PLT\n\tmovapd\t%xmm0, %xmm2\n\taddsd\t-16(%rbp), %xmm2\n\tmovq\t%xmm2, %rax\n\tmovsd\t.LC1(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tpow@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tdist, .-dist\n\t.section\t.rodata\n.LC2:\n\t.string\t\"%d\"\n.LC4:\n\t.string\t\"%lld%lld\"\n.LC5:\n\t.string\t\"%.20lf\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-56(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tpxor\t%xmm0, %xmm0\n\tmovsd\t%xmm0, -32(%rbp)\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rcx\n\tleaq\tx(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -52(%rbp)\n.L17:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L18\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L19\n.L20:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tind(%rip), %rdx\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -52(%rbp)\n.L19:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L20\n\tmovl\t-56(%rbp), %eax\n\tcltq\n\tleaq\tcompare_angle(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$4, %edx\n\tmovq\t%rax, %rsi\n\tleaq\tind(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovl\t$0, -48(%rbp)\n\tjmp\t.L21\n.L22:\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-48(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tind2(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -48(%rbp)\n.L21:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -48(%rbp)\n\tjl\t.L22\n\tmovl\t$0, -48(%rbp)\n\tjmp\t.L23\n.L24:\n\tmovl\t-56(%rbp), %edx\n\tmovl\t-48(%rbp), %eax\n\tleal\t(%rdx,%rax), %ecx\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%ecx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tind2(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -48(%rbp)\n.L23:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -48(%rbp)\n\tjl\t.L24\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L25\n.L34:\n\tmovl\t-56(%rbp), %edx\n\tmovl\t-52(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -44(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, -40(%rbp)\n\tjmp\t.L26\n.L28:\n\tmovl\t-44(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tisUnder180\n\ttestl\t%eax, %eax\n\tje\t.L27\n\tmovl\t-36(%rbp), %eax\n\tmovl\t%eax, -40(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovl\t-36(%rbp), %eax\n\tmovl\t%eax, -44(%rbp)\n.L26:\n\tmovl\t-44(%rbp), %eax\n\tsubl\t-40(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjg\t.L28\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$0, -16(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, -48(%rbp)\n\tjmp\t.L29\n.L33:\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tx(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -24(%rbp)\n\tmovl\t-48(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tind2(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\ty(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tdist\n\tmovsd\t-32(%rbp), %xmm1\n\tcomisd\t%xmm0, %xmm1\n\tjbe\t.L38\n\tmovq\t-32(%rbp), %rax\n\tjmp\t.L32\n.L38:\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tdist\n\tmovq\t%xmm0, %rax\n.L32:\n\tmovq\t%rax, -32(%rbp)\n\taddl\t$1, -48(%rbp)\n.L29:\n\tmovl\t-48(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjle\t.L33\n\taddl\t$1, -52(%rbp)\n.L25:\n\tmovl\t-56(%rbp), %eax\n\tcmpl\t%eax, -52(%rbp)\n\tjl\t.L34\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC5(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L36\n\tcall\t__stack_chk_fail@PLT\n.L36:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1073741824\n\t.align 8\n.LC1:\n\t.long\t0\n\t.long\t1071644672\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 long int y_a = y[ind2[a]]; long long int x_b = x[ind2[b]]; long long int y_b = y[ind2[b]]; return x_a*x_b + y_a*y_b; } long long int gaiseki(int a, int b){ long long int x_a = x[ind2[a]]; long long int y_a = y[ind2[a]]; long long int x_b = x[ind2[b]]; long long int y_b = y[ind2[b]]; return x_a * y_b - y_a * x_b; } int compare_angle(const void* a_, const void* b_){ //(1, 0)を基準に偏角ソートを厳密に行う関数(qsortで呼び出されることを想定) //同じ角度の場合や(0,0)の入力は想定していない(が,ソートする上では-1でも1でも問題ないはず) int a = *(int *)a_; int b = *(int *)b_; long long int x_a = x[a]; long long int y_a = y[a]; long long int x_b = x[b]; long long int y_b = y[b]; if(y_a == 0 && x_a >= 0){ return -1; } if(y_b == 0 && x_b >= 0){ return 1; } if(y_a > 0 && y_b < 0){ return -1; } if(y_a < 0 && y_b > 0){ return 1; } if(x_a * y_b - y_a * x_b > 0){ return -1; }else{ return 1; } } int isUnder180(int a, int b){ //外積を計算 return gaiseki(a, b) >= 0; } double dist(int a, int b){ return pow(pow(a, 2) + pow(b, 2), 0.5); } int main(void){ int n; scanf("%d", &n); double d_max = 0; int i, j, k; long long int x_tmp, y_tmp; for(i = 0; i < n; i++){ scanf("%lld%lld", &x[i], &y[i]); } for(i = 0; i < n; i++){ ind[i] = i; } qsort(ind, n, sizeof(int), compare_angle); for(j = 0; j < n; j++){ ind2[j] = ind[j]; } for(j = 0; j < n; j++){ ind2[j+n] = ind[j]; } for(i = 0; i < n; i++){ int right = i + n; int left = i; while(right - left > 1){ int mid = (right + left)/2; if(isUnder180(i, mid)){ left = mid; }else{ right = mid; } } x_tmp = 0; y_tmp = 0; for(j = i; j <= left; j++){ x_tmp += x[ind2[j]]; y_tmp += y[ind2[j]]; d_max = d_max > dist(x_tmp, y_tmp) ? d_max : dist(x_tmp, y_tmp); } } printf("%.20lf\n", d_max); } Unoptimized Assembly Code: .file "temp.c" .text .globl x .bss .align 32 .type x, @object .size x, 800 x: .zero 800 .globl y .align 32 .type y, @object .size y, 800 y: .zero 800 .globl ind .align 32 .type ind, @object .size ind, 400 ind: .zero 400 .globl ind2 .align 32 .type ind2, @object .size ind2, 800 ind2: .zero 800 .text .globl naiseki .type naiseki, @function naiseki: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -36(%rbp) movl %esi, -40(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -32(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -24(%rbp) movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -16(%rbp) movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -8(%rbp) movq -32(%rbp), %rax imulq -16(%rbp), %rax movq %rax, %rdx movq -24(%rbp), %rax imulq -8(%rbp), %rax addq %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size naiseki, .-naiseki .globl gaiseki .type gaiseki, @function gaiseki: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -36(%rbp) movl %esi, -40(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -32(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -24(%rbp) movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -16(%rbp) movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -8(%rbp) movq -32(%rbp), %rax imulq -8(%rbp), %rax movq %rax, %rdx movq -24(%rbp), %rax imulq -16(%rbp), %rax movq %rax, %rcx movq %rdx, %rax subq %rcx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size gaiseki, .-gaiseki .globl compare_angle .type compare_angle, @function compare_angle: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -56(%rbp) movq %rsi, -64(%rbp) movq -56(%rbp), %rax movl (%rax), %eax movl %eax, -40(%rbp) movq -64(%rbp), %rax movl (%rax), %eax movl %eax, -36(%rbp) movl -40(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -32(%rbp) movl -40(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -24(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -16(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax movq %rax, -8(%rbp) cmpq $0, -24(%rbp) jne .L6 cmpq $0, -32(%rbp) js .L6 movl $-1, %eax jmp .L7 .L6: cmpq $0, -8(%rbp) jne .L8 cmpq $0, -16(%rbp) js .L8 movl $1, %eax jmp .L7 .L8: cmpq $0, -24(%rbp) jle .L9 cmpq $0, -8(%rbp) jns .L9 movl $-1, %eax jmp .L7 .L9: cmpq $0, -24(%rbp) jns .L10 cmpq $0, -8(%rbp) jle .L10 movl $1, %eax jmp .L7 .L10: movq -32(%rbp), %rax imulq -8(%rbp), %rax movq %rax, %rdx movq -24(%rbp), %rax imulq -16(%rbp), %rax movq %rax, %rcx movq %rdx, %rax subq %rcx, %rax testq %rax, %rax jle .L11 movl $-1, %eax jmp .L7 .L11: movl $1, %eax .L7: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size compare_angle, .-compare_angle .globl isUnder180 .type isUnder180, @function isUnder180: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $8, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -8(%rbp), %edx movl -4(%rbp), %eax movl %edx, %esi movl %eax, %edi call gaiseki notq %rax shrq $63, %rax movzbl %al, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size isUnder180, .-isUnder180 .globl dist .type dist, @function dist: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) pxor %xmm3, %xmm3 cvtsi2sdl -4(%rbp), %xmm3 movq %xmm3, %rax movsd .LC0(%rip), %xmm0 movapd %xmm0, %xmm1 movq %rax, %xmm0 call pow@PLT movsd %xmm0, -16(%rbp) pxor %xmm4, %xmm4 cvtsi2sdl -8(%rbp), %xmm4 movq %xmm4, %rax movsd .LC0(%rip), %xmm0 movapd %xmm0, %xmm1 movq %rax, %xmm0 call pow@PLT movapd %xmm0, %xmm2 addsd -16(%rbp), %xmm2 movq %xmm2, %rax movsd .LC1(%rip), %xmm0 movapd %xmm0, %xmm1 movq %rax, %xmm0 call pow@PLT movq %xmm0, %rax movq %rax, %xmm0 leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size dist, .-dist .section .rodata .LC2: .string "%d" .LC4: .string "%lld%lld" .LC5: .string "%.20lf\n" .text .globl main .type main, @function main: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $64, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -56(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT pxor %xmm0, %xmm0 movsd %xmm0, -32(%rbp) movl $0, -52(%rbp) jmp .L17 .L18: movl -52(%rbp), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax addq %rax, %rdx movl -52(%rbp), %eax cltq leaq 0(,%rax,8), %rcx leaq x(%rip), %rax addq %rcx, %rax movq %rax, %rsi leaq .LC4(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -52(%rbp) .L17: movl -56(%rbp), %eax cmpl %eax, -52(%rbp) jl .L18 movl $0, -52(%rbp) jmp .L19 .L20: movl -52(%rbp), %eax cltq leaq 0(,%rax,4), %rcx leaq ind(%rip), %rdx movl -52(%rbp), %eax movl %eax, (%rcx,%rdx) addl $1, -52(%rbp) .L19: movl -56(%rbp), %eax cmpl %eax, -52(%rbp) jl .L20 movl -56(%rbp), %eax cltq leaq compare_angle(%rip), %rdx movq %rdx, %rcx movl $4, %edx movq %rax, %rsi leaq ind(%rip), %rax movq %rax, %rdi call qsort@PLT movl $0, -48(%rbp) jmp .L21 .L22: movl -48(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind(%rip), %rax movl (%rdx,%rax), %eax movl -48(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq ind2(%rip), %rdx movl %eax, (%rcx,%rdx) addl $1, -48(%rbp) .L21: movl -56(%rbp), %eax cmpl %eax, -48(%rbp) jl .L22 movl $0, -48(%rbp) jmp .L23 .L24: movl -56(%rbp), %edx movl -48(%rbp), %eax leal (%rdx,%rax), %ecx movl -48(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind(%rip), %rax movl (%rdx,%rax), %eax movslq %ecx, %rdx leaq 0(,%rdx,4), %rcx leaq ind2(%rip), %rdx movl %eax, (%rcx,%rdx) addl $1, -48(%rbp) .L23: movl -56(%rbp), %eax cmpl %eax, -48(%rbp) jl .L24 movl $0, -52(%rbp) jmp .L25 .L34: movl -56(%rbp), %edx movl -52(%rbp), %eax addl %edx, %eax movl %eax, -44(%rbp) movl -52(%rbp), %eax movl %eax, -40(%rbp) jmp .L26 .L28: movl -44(%rbp), %edx movl -40(%rbp), %eax addl %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -36(%rbp) movl -36(%rbp), %edx movl -52(%rbp), %eax movl %edx, %esi movl %eax, %edi call isUnder180 testl %eax, %eax je .L27 movl -36(%rbp), %eax movl %eax, -40(%rbp) jmp .L26 .L27: movl -36(%rbp), %eax movl %eax, -44(%rbp) .L26: movl -44(%rbp), %eax subl -40(%rbp), %eax cmpl $1, %eax jg .L28 movq $0, -24(%rbp) movq $0, -16(%rbp) movl -52(%rbp), %eax movl %eax, -48(%rbp) jmp .L29 .L33: movl -48(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq x(%rip), %rax movq (%rdx,%rax), %rax addq %rax, -24(%rbp) movl -48(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq ind2(%rip), %rax movl (%rdx,%rax), %eax cltq leaq 0(,%rax,8), %rdx leaq y(%rip), %rax movq (%rdx,%rax), %rax addq %rax, -16(%rbp) movq -16(%rbp), %rax movl %eax, %edx movq -24(%rbp), %rax movl %edx, %esi movl %eax, %edi call dist movsd -32(%rbp), %xmm1 comisd %xmm0, %xmm1 jbe .L38 movq -32(%rbp), %rax jmp .L32 .L38: movq -16(%rbp), %rax movl %eax, %edx movq -24(%rbp), %rax movl %edx, %esi movl %eax, %edi call dist movq %xmm0, %rax .L32: movq %rax, -32(%rbp) addl $1, -48(%rbp) .L29: movl -48(%rbp), %eax cmpl -40(%rbp), %eax jle .L33 addl $1, -52(%rbp) .L25: movl -56(%rbp), %eax cmpl %eax, -52(%rbp) jl .L34 movq -32(%rbp), %rax movq %rax, %xmm0 leaq .LC5(%rip), %rax movq %rax, %rdi movl $1, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L36 call __stack_chk_fail@PLT .L36: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size main, .-main .section .rodata .align 8 .LC0: .long 0 .long 1073741824 .align 8 .LC1: .long 0 .long 1071644672 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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;printf(\"%d\\n\",f[1]);}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tf\n\t.bss\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 8020\nf:\n\t.zero\t8020\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tk\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.globl\tM\n\t.data\n\t.align 4\n\t.type\tM, @object\n\t.size\tM, 4\nM:\n\t.long\t1000000007\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tk(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tmovl\tn(%rip), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\tmovl\tn(%rip), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L2\n.L7:\n\tmovl\tn(%rip), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-12(%rbp), %eax\n\tjg\t.L4\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-8(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%ecx, %eax\n\tmovl\tM(%rip), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %ecx\n\tjmp\t.L5\n.L4:\n\tmovl\t$0, %ecx\n.L5:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tsubl\t$1, -8(%rbp)\n.L3:\n\tcmpl\t$0, -8(%rbp)\n\tjg\t.L6\n\tsubl\t$1, -12(%rbp)\n.L2:\n\tmovl\tn(%rip), %eax\n\tmovl\tk(%rip), %edx\n\tsubl\t%edx, %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjg\t.L7\n\tmovl\tn(%rip), %eax\n\tmovl\tk(%rip), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t4+f(%rip), %eax\n\taddl\t%eax, %eax\n\tmovl\tM(%rip), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\tmovl\t%eax, 4+f(%rip)\n\tsubl\t$1, -4(%rbp)\n.L8:\n\tcmpl\t$1, -4(%rbp)\n\tjg\t.L9\n\tmovl\t4+f(%rip), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\tn(%rip), %rsi\n\tleaq\tk(%rip), %rdx\n\txorl\t%eax, %eax\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tcall\tscanf@PLT\n\tmovl\tn(%rip), %r8d\n\tleaq\tf(%rip), %rsi\n\tleal\t1(%r8), %eax\n\tmovl\t%r8d, %r10d\n\tsubl\tk(%rip), %r10d\n\tcltq\n\tmovl\t$1, (%rsi,%rax,4)\n\tcmpl\t%r10d, %r8d\n\tjle\t.L2\n\tmovl\tM(%rip), %edi\n\ttestl\t%r8d, %r8d\n\tjle\t.L2\n\tmovslq\t%r8d, %rax\n\tmovd\t%r8d, %xmm7\n\tmovl\t%r8d, %r9d\n\tmovl\t$1, %ebx\n\tleaq\t-12(%rsi,%rax,4), %r11\n\tmovdqa\t.LC1(%rip), %xmm5\n\tleaq\t4(%rsi), %rbp\n\tmovdqa\t.LC2(%rip), %xmm4\n\tpshufd\t$0, %xmm7, %xmm6\n\tleaq\t-16(%r11), %r12\n\tpxor\t%xmm3, %xmm3\n\tpcmpeqd\t%xmm2, %xmm2\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tcmpl\t%r9d, %r8d\n\tjg\t.L11\n\tmovl\t%r8d, %ecx\n.L10:\n\tmovslq\t%ecx, %rcx\n\tmovl\t0(%rbp,%rcx,4), %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%rsi,%rcx,4), %eax\n\taddl\t%edx, %eax\n\tcltd\n\tidivl\t%edi\n\tmovl\t%edx, (%rsi,%rcx,4)\n\tsubq\t$1, %rcx\n\ttestl\t%ecx, %ecx\n\tjg\t.L8\n\tsubl\t$1, %r9d\n\tcmpl\t%r10d, %r9d\n\tjne\t.L4\n.L2:\n\tmovl\t4+f(%rip), %edx\n\tcmpl\t$1, %r10d\n\tjle\t.L12\n\tmovl\tM(%rip), %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tleal\t(%rdx,%rdx), %eax\n\tsubl\t$1, %r10d\n\tcltd\n\tidivl\t%ecx\n\tcmpl\t$1, %r10d\n\tjne\t.L13\n\tmovl\t%edx, 4+f(%rip)\n.L12:\n\tmovl\t%edx, %esi\n\tleaq\t.LC3(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\tprintf@PLT\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\txorl\t%edx, %edx\n\ttestl\t%r9d, %r9d\n\tmovl\t%r8d, %eax\n\tmovl\t%ebx, %r13d\n\tcmovns\t%r9d, %edx\n\tsubl\t%edx, %eax\n\tcmpl\t%edx, %r8d\n\tcmovg\t%eax, %r13d\n\tsubl\t$1, %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L14\n\tcmpl\t%edx, %r8d\n\tjle\t.L14\n\tmovl\t%r13d, %eax\n\tmovdqa\t%xmm6, %xmm1\n\tmovq\t%r12, %rcx\n\tshrl\t$2, %eax\n\tpaddd\t%xmm5, %xmm1\n\tsubl\t$1, %eax\n\tsalq\t$4, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%r11, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovdqa\t%xmm1, %xmm0\n\tmovups\t%xmm3, (%rax)\n\tsubq\t$16, %rax\n\tpaddd\t%xmm4, %xmm1\n\tpaddd\t%xmm2, %xmm0\n\tcmpq\t%rax, %rcx\n\tjne\t.L6\n\tmovl\t%r13d, %r14d\n\tpshufd\t$255, %xmm0, %xmm0\n\tmovl\t%r8d, %eax\n\tandl\t$-4, %r14d\n\tmovd\t%xmm0, %ecx\n\tsubl\t%r14d, %eax\n\tcmpl\t%r14d, %r13d\n\tje\t.L7\n.L5:\n\tmovslq\t%eax, %rcx\n\tmovl\t$0, (%rsi,%rcx,4)\n\tleal\t-1(%rax), %ecx\n\tcmpl\t%ecx, %edx\n\tjge\t.L7\n\tmovslq\t%ecx, %rcx\n\tmovl\t$0, (%rsi,%rcx,4)\n\tleal\t-2(%rax), %ecx\n\tcmpl\t%ecx, %edx\n\tjge\t.L7\n\tmovslq\t%ecx, %rcx\n\tmovl\t$0, (%rsi,%rcx,4)\n\tleal\t-3(%rax), %ecx\n.L7:\n\ttestl\t%ecx, %ecx\n\tjg\t.L10\n\tsubl\t$1, %r9d\n\tcmpl\t%r10d, %r9d\n\tjne\t.L4\n\tjmp\t.L2\n.L14:\n\tmovl\t%r8d, %eax\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\tM\n\t.data\n\t.align 4\n\t.type\tM, @object\n\t.size\tM, 4\nM:\n\t.long\t1000000007\n\t.globl\tk\n\t.bss\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tf\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 8020\nf:\n\t.zero\t8020\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.long\t0\n\t.long\t-1\n\t.long\t-2\n\t.long\t-3\n\t.align 16\n.LC2:\n\t.long\t-4\n\t.long\t-4\n\t.long\t-4\n\t.long\t-4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\tn(%rip), %rsi\n\tleaq\tk(%rip), %rdx\n\txorl\t%eax, %eax\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tcall\tscanf@PLT\n\tmovl\tn(%rip), %r8d\n\tleaq\tf(%rip), %rsi\n\tleal\t1(%r8), %eax\n\tmovl\t%r8d, %r10d\n\tsubl\tk(%rip), %r10d\n\tcltq\n\tmovl\t$1, (%rsi,%rax,4)\n\tcmpl\t%r10d, %r8d\n\tjle\t.L2\n\tmovl\tM(%rip), %edi\n\ttestl\t%r8d, %r8d\n\tjle\t.L2\n\tmovslq\t%r8d, %rax\n\tmovd\t%r8d, %xmm7\n\tmovl\t%r8d, %r9d\n\tmovl\t$1, %ebx\n\tleaq\t-12(%rsi,%rax,4), %r11\n\tmovdqa\t.LC1(%rip), %xmm5\n\tleaq\t4(%rsi), %rbp\n\tmovdqa\t.LC2(%rip), %xmm4\n\tpshufd\t$0, %xmm7, %xmm6\n\tleaq\t-16(%r11), %r12\n\tpxor\t%xmm3, %xmm3\n\tpcmpeqd\t%xmm2, %xmm2\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tcmpl\t%r9d, %r8d\n\tjg\t.L11\n\tmovl\t%r8d, %ecx\n.L10:\n\tmovslq\t%ecx, %rcx\n\tmovl\t0(%rbp,%rcx,4), %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t(%rsi,%rcx,4), %eax\n\taddl\t%edx, %eax\n\tcltd\n\tidivl\t%edi\n\tmovl\t%edx, (%rsi,%rcx,4)\n\tsubq\t$1, %rcx\n\ttestl\t%ecx, %ecx\n\tjg\t.L8\n\tsubl\t$1, %r9d\n\tcmpl\t%r10d, %r9d\n\tjne\t.L4\n.L2:\n\tmovl\t4+f(%rip), %edx\n\tcmpl\t$1, %r10d\n\tjle\t.L12\n\tmovl\tM(%rip), %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tleal\t(%rdx,%rdx), %eax\n\tsubl\t$1, %r10d\n\tcltd\n\tidivl\t%ecx\n\tcmpl\t$1, %r10d\n\tjne\t.L13\n\tmovl\t%edx, 4+f(%rip)\n.L12:\n\tmovl\t%edx, %esi\n\tleaq\t.LC3(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\tprintf@PLT\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\txorl\t%edx, %edx\n\ttestl\t%r9d, %r9d\n\tmovl\t%r8d, %eax\n\tmovl\t%ebx, %r13d\n\tcmovns\t%r9d, %edx\n\tsubl\t%edx, %eax\n\tcmpl\t%edx, %r8d\n\tcmovg\t%eax, %r13d\n\tsubl\t$1, %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L14\n\tcmpl\t%edx, %r8d\n\tjle\t.L14\n\tmovl\t%r13d, %eax\n\tmovdqa\t%xmm6, %xmm1\n\tmovq\t%r12, %rcx\n\tshrl\t$2, %eax\n\tpaddd\t%xmm5, %xmm1\n\tsubl\t$1, %eax\n\tsalq\t$4, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%r11, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovdqa\t%xmm1, %xmm0\n\tmovups\t%xmm3, (%rax)\n\tsubq\t$16, %rax\n\tpaddd\t%xmm4, %xmm1\n\tpaddd\t%xmm2, %xmm0\n\tcmpq\t%rax, %rcx\n\tjne\t.L6\n\tmovl\t%r13d, %r14d\n\tpshufd\t$255, %xmm0, %xmm0\n\tmovl\t%r8d, %eax\n\tandl\t$-4, %r14d\n\tmovd\t%xmm0, %ecx\n\tsubl\t%r14d, %eax\n\tcmpl\t%r14d, %r13d\n\tje\t.L7\n.L5:\n\tmovslq\t%eax, %rcx\n\tmovl\t$0, (%rsi,%rcx,4)\n\tleal\t-1(%rax), %ecx\n\tcmpl\t%ecx, %edx\n\tjge\t.L7\n\tmovslq\t%ecx, %rcx\n\tmovl\t$0, (%rsi,%rcx,4)\n\tleal\t-2(%rax), %ecx\n\tcmpl\t%ecx, %edx\n\tjge\t.L7\n\tmovslq\t%ecx, %rcx\n\tmovl\t$0, (%rsi,%rcx,4)\n\tleal\t-3(%rax), %ecx\n.L7:\n\ttestl\t%ecx, %ecx\n\tjg\t.L10\n\tsubl\t$1, %r9d\n\tcmpl\t%r10d, %r9d\n\tjne\t.L4\n\tjmp\t.L2\n.L14:\n\tmovl\t%r8d, %eax\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\tM\n\t.data\n\t.align 4\n\t.type\tM, @object\n\t.size\tM, 4\nM:\n\t.long\t1000000007\n\t.globl\tk\n\t.bss\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tf\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 8020\nf:\n\t.zero\t8020\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC1:\n\t.long\t0\n\t.long\t-1\n\t.long\t-2\n\t.long\t-3\n\t.align 16\n.LC2:\n\t.long\t-4\n\t.long\t-4\n\t.long\t-4\n\t.long\t-4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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;printf(\"%d\\n\",f[1]);}", "index": 66, "inputs": [ "2000 1100\n", "4 2\n", "4 1\n", "1 1\n", "3 1\n", "13 2\n", "5 2\n", "5 1\n", "10 1\n", "9 2\n", "19 1\n", "9 1\n", "38 1\n", "25 1\n", "2000 1001\n", "12 1\n", "13 3\n", "5 4\n", "10 2\n", "9 4\n", "19 2\n", "38 2\n", "7 1\n", "6 2\n", "12 2\n", "4 3\n", "6 4\n", "14 2\n", "66 2\n", "14 4\n", "40 2\n", "14 7\n", "68 2\n", "32 2\n", "13 4\n", "20 4\n", "20 5\n", "38 5\n", "26 5\n", "26 9\n", "24 9\n", "24 1\n", "45 1\n", "45 2\n", "8 2\n", "2000 0100\n", "16 2\n", "21 2\n", "5 3\n", "15 2\n", "37 1\n", "20 1\n", "14 1\n", "9 3\n", "7 4\n", "12 3\n", "20 2\n", "18 4\n", "59 2\n", "8 4\n", "88 2\n", "41 2\n", "14 6\n", "68 4\n", "32 3\n", "24 2\n", "34 5\n", "38 6\n", "36 9\n", "24 18\n", "23 1\n", "2000 0101\n", "26 2\n", "26 1\n", "18 6\n", "59 4\n", "8 7\n", "88 4\n", "11 4\n", "68 3\n", "32 1\n", "24 4\n", "34 1\n", "38 7\n", "36 1\n", "45 18\n", "28 1\n", "811 0101\n", "35 2\n", "21 6\n", "51 4\n", "61 4\n", "30 4\n", "68 6\n", "8 1\n", "24 7\n", "34 2\n", "65 7\n", "65 1\n", "45 23\n", "2 1\n", "2 1\n", "17 2\n", "2000 1000\n" ], "outputs": [ "270390985\n", "6\n", "4\n", "1\n", "2\n", "12288\n", "16\n", "8\n", "256\n", "512\n", "131072\n", "128\n", "719476260\n", "8388608\n", "353739079\n", "1024\n", "39424\n", "14\n", "1152\n", "1760\n", "1179648\n", "310310719\n", "32\n", "40\n", "5632\n", "5\n", "56\n", "26624\n", "926180134\n", "225280\n", "119147888\n", "992256\n", "34096526\n", "642998160\n", "89600\n", "42893312\n", "116064256\n", "983966398\n", "73231725\n", "939105485\n", "165912998\n", "4194304\n", "92960636\n", "45133978\n", "224\n", "973529324\n", "122880\n", "5242880\n", "18\n", "57344\n", "359738130\n", "262144\n", "4096\n", "1120\n", "192\n", "16640\n", "2490368\n", "7782400\n", "944437320\n", "600\n", "648924086\n", "116200795\n", "705024\n", "575002655\n", "875549796\n", "48234496\n", "76088899\n", "764051235\n", "840830912\n", "168863004\n", "2097152\n", "284408918\n", "209715200\n", "16777216\n", "38950912\n", "301632008\n", "429\n", "823736050\n", "13312\n", "997296941\n", "73741817\n", "192755193\n", "294967268\n", "867006299\n", "179869065\n", "570208390\n", "67108864\n", "294663417\n", "28887042\n", "663224320\n", "768705452\n", "828691022\n", "786983405\n", "758279575\n", "64\n", "348182879\n", "866959894\n", "641023304\n", "291172004\n", "55696927\n", "1\n", "1\n", "262144\n", "674286644\n" ], "question": "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;printf(\"%d\\n\",f[1]);}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tf\n\t.bss\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 8020\nf:\n\t.zero\t8020\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tk\n\t.align 4\n\t.type\tk, @object\n\t.size\tk, 4\nk:\n\t.zero\t4\n\t.globl\tM\n\t.data\n\t.align 4\n\t.type\tM, @object\n\t.size\tM, 4\nM:\n\t.long\t1000000007\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tk(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tmovl\tn(%rip), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\tmovl\tn(%rip), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L2\n.L7:\n\tmovl\tn(%rip), %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-12(%rbp), %eax\n\tjg\t.L4\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-8(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%ecx, %eax\n\tmovl\tM(%rip), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %ecx\n\tjmp\t.L5\n.L4:\n\tmovl\t$0, %ecx\n.L5:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n\tsubl\t$1, -8(%rbp)\n.L3:\n\tcmpl\t$0, -8(%rbp)\n\tjg\t.L6\n\tsubl\t$1, -12(%rbp)\n.L2:\n\tmovl\tn(%rip), %eax\n\tmovl\tk(%rip), %edx\n\tsubl\t%edx, %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjg\t.L7\n\tmovl\tn(%rip), %eax\n\tmovl\tk(%rip), %edx\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t4+f(%rip), %eax\n\taddl\t%eax, %eax\n\tmovl\tM(%rip), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\tmovl\t%eax, 4+f(%rip)\n\tsubl\t$1, -4(%rbp)\n.L8:\n\tcmpl\t$1, -4(%rbp)\n\tjg\t.L9\n\tmovl\t4+f(%rip), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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]);} Unoptimized Assembly Code: .file "temp.c" .text .globl f .bss .align 32 .type f, @object .size f, 8020 f: .zero 8020 .globl n .align 4 .type n, @object .size n, 4 n: .zero 4 .globl k .align 4 .type k, @object .size k, 4 k: .zero 4 .globl M .data .align 4 .type M, @object .size M, 4 M: .long 1000000007 .section .rodata .LC0: .string "%d%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp leaq k(%rip), %rax movq %rax, %rdx leaq n(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call scanf@PLT movl n(%rip), %eax addl $1, %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl $1, (%rdx,%rax) movl n(%rip), %eax movl %eax, -12(%rbp) jmp .L2 .L7: movl n(%rip), %eax movl %eax, -8(%rbp) jmp .L3 .L6: movl -8(%rbp), %eax cmpl -12(%rbp), %eax jg .L4 movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl (%rdx,%rax), %ecx movl -8(%rbp), %eax addl $1, %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl (%rdx,%rax), %eax addl %ecx, %eax movl M(%rip), %ecx cltd idivl %ecx movl %edx, %ecx jmp .L5 .L4: movl $0, %ecx .L5: movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl %ecx, (%rdx,%rax) subl $1, -8(%rbp) .L3: cmpl $0, -8(%rbp) jg .L6 subl $1, -12(%rbp) .L2: movl n(%rip), %eax movl k(%rip), %edx subl %edx, %eax cmpl %eax, -12(%rbp) jg .L7 movl n(%rip), %eax movl k(%rip), %edx subl %edx, %eax movl %eax, -4(%rbp) jmp .L8 .L9: movl 4+f(%rip), %eax addl %eax, %eax movl M(%rip), %ecx cltd idivl %ecx movl %edx, %eax movl %eax, 4+f(%rip) subl $1, -4(%rbp) .L8: cmpl $1, -4(%rbp) jg .L9 movl 4+f(%rip), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 for(i=0;i<n;i++){\n scanf(\"%d%d %c\",&x,&y,&a);y+=(a=='W')*k;\n s=1-(x/k%2!=y/k%2)*2;\n m[0][0]+=s>0;\n v=x%k+1;w=y%k+1;\n m[v][0]-=s;\n m[0][w]-=s;\n m[v][w]+=s*2;\n }\n for(i=0;i<=k;i++)for(j=0;j<k;j++)m[i][j+1]+=m[i][j];\n for(i=0;i<=k;i++)for(j=0;j<k;j++)m[j+1][i]+=m[j][i];\n v=0;for(i=0;i<k;i++)for(j=0;j<k;j++)v=z(v,m[i][j],n-m[i][j]);\n printf(\"%d\",v);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tz\n\t.type\tz, @function\nz:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t%edx, -12(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L2\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-12(%rbp), %eax\n\tjg\t.L3\n.L2:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovge\t%edx, %eax\n\tjmp\t.L5\n.L3:\n\tmovl\t-4(%rbp), %eax\n.L5:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tz, .-z\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d%d %c\"\n.LC2:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-4005888(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2176, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-4008016(%rbp), %rax\n\tmovl\t$4008004, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-4008048(%rbp), %rdx\n\tleaq\t-4008052(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L7\n.L10:\n\tleaq\t-4008053(%rbp), %rcx\n\tleaq\t-4008040(%rbp), %rdx\n\tleaq\t-4008044(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t-4008053(%rbp), %eax\n\tcmpb\t$87, %al\n\tsete\t%al\n\tmovzbl\t%al, %edx\n\tmovl\t-4008048(%rbp), %eax\n\timull\t%eax, %edx\n\tmovl\t-4008040(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -4008040(%rbp)\n\tmovl\t-4008044(%rbp), %eax\n\tmovl\t-4008048(%rbp), %edi\n\tcltd\n\tidivl\t%edi\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tshrl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %esi\n\tmovl\t-4008040(%rbp), %eax\n\tmovl\t-4008048(%rbp), %edi\n\tcltd\n\tidivl\t%edi\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tshrl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tcmpl\t%eax, %esi\n\tje\t.L8\n\tmovl\t$-1, %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$1, %eax\n.L9:\n\tmovl\t%eax, -4008024(%rbp)\n\tmovl\t-4008016(%rbp), %edx\n\tcmpl\t$0, -4008024(%rbp)\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -4008016(%rbp)\n\tmovl\t-4008044(%rbp), %eax\n\tmovl\t-4008048(%rbp), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -4008028(%rbp)\n\tmovl\t-4008040(%rbp), %eax\n\tmovl\t-4008048(%rbp), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -4008020(%rbp)\n\tmovl\t-4008028(%rbp), %eax\n\tcltq\n\timulq\t$4004, %rax, %rax\n\taddq\t%rbp, %rax\n\tsubq\t$4008016, %rax\n\tmovl\t(%rax), %eax\n\tsubl\t-4008024(%rbp), %eax\n\tmovl\t-4008028(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\timulq\t$4004, %rdx, %rdx\n\taddq\t%rbp, %rdx\n\tsubq\t$4008016, %rdx\n\tmovl\t%eax, (%rdx)\n\tmovl\t-4008020(%rbp), %eax\n\tcltq\n\tmovl\t-4008016(%rbp,%rax,4), %eax\n\tsubl\t-4008024(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4008020(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\tmovl\t-4008020(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008028(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %edx\n\tmovl\t-4008024(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-4008020(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-4008028(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\taddl\t$1, -4008036(%rbp)\n.L7:\n\tmovl\t-4008052(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjl\t.L10\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L11\n.L14:\n\tmovl\t$0, -4008032(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovl\t-4008032(%rbp), %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %ecx\n\tmovl\t-4008032(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %edx\n\tmovl\t-4008032(%rbp), %eax\n\taddl\t$1, %eax\n\taddl\t%ecx, %edx\n\tmovslq\t%eax, %rcx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\taddl\t$1, -4008032(%rbp)\n.L12:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008032(%rbp)\n\tjl\t.L13\n\taddl\t$1, -4008036(%rbp)\n.L11:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjle\t.L14\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L15\n.L18:\n\tmovl\t$0, -4008032(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-4008032(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-4008036(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rax\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %esi\n\tmovl\t-4008036(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008032(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %edx\n\tmovl\t-4008032(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\taddl\t%esi, %edx\n\tmovl\t-4008036(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$1001, %rax, %rax\n\taddq\t%rsi, %rax\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\taddl\t$1, -4008032(%rbp)\n.L16:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008032(%rbp)\n\tjl\t.L17\n\taddl\t$1, -4008036(%rbp)\n.L15:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjle\t.L18\n\tmovl\t$0, -4008028(%rbp)\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L19\n.L22:\n\tmovl\t$0, -4008032(%rbp)\n\tjmp\t.L20\n.L21:\n\tmovl\t-4008052(%rbp), %eax\n\tmovl\t-4008032(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovl\t-4008036(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\timulq\t$1001, %rdx, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t-4008016(%rbp,%rdx,4), %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4008032(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %ecx\n\tmovl\t-4008028(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tz\n\tmovl\t%eax, -4008028(%rbp)\n\taddl\t$1, -4008032(%rbp)\n.L20:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008032(%rbp)\n\tjl\t.L21\n\taddl\t$1, -4008036(%rbp)\n.L19:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjl\t.L22\n\tmovl\t-4008028(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L24\n\tcall\t__stack_chk_fail@PLT\n.L24:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d%d %c\"\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.LFB24:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-4005888(%rsp), %r11\n\t.cfi_def_cfa 11, 4005944\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2184, %rsp\n\t.cfi_def_cfa_offset 4008128\n\tmovl\t$4008004, %edx\n\txorl\t%esi, %esi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 4008056(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t48(%rsp), %rax\n\tmovq\t%rax, %rdi\n\tmovq\t%rax, (%rsp)\n\tcall\tmemset@PLT\n\tleaq\t36(%rsp), %rdx\n\tleaq\t32(%rsp), %rsi\n\txorl\t%eax, %eax\n\tleaq\t.LC0(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t32(%rsp), %r10d\n\ttestl\t%r10d, %r10d\n\tjle\t.L4\n\txorl\t%ebx, %ebx\n\tleaq\t31(%rsp), %r14\n\tleaq\t44(%rsp), %r13\n\txorl\t%r15d, %r15d\n\tleaq\t40(%rsp), %r12\n\tleaq\t.LC1(%rip), %rbp\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovl\t48(%rsp), %ebx\n.L7:\n\tmovq\t%r14, %rcx\n\tmovq\t%r13, %rdx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t40(%rsp), %eax\n\tmovl\t36(%rsp), %ecx\n\txorl\t%edi, %edi\n\tcmpb\t$87, 31(%rsp)\n\tmovl\t$-2, %r9d\n\tmovl\t$-1, %r10d\n\tsete\t%dil\n\tcltd\n\tidivl\t%ecx\n\timull\t%ecx, %edi\n\taddl\t44(%rsp), %edi\n\tmovl\t%edi, 44(%rsp)\n\tmovl\t%eax, %esi\n\tmovl\t%edi, %eax\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %edi\n\tmovl\t%esi, %eax\n\tshrl\t$31, %eax\n\taddl\t%eax, %esi\n\tandl\t$1, %esi\n\tsubl\t%eax, %esi\n\tmovl\t%edi, %eax\n\tshrl\t$31, %eax\n\taddl\t%eax, %edi\n\tandl\t$1, %edi\n\tsubl\t%eax, %edi\n\tcmpl\t%edi, %esi\n\tjne\t.L5\n\taddl\t$1, %ebx\n\tmovl\t$2, %r9d\n\tmovl\t$1, %r10d\n.L5:\n\tleal\t1(%r8), %eax\n\taddl\t$1, %edx\n\tmovl\t%ebx, 48(%rsp)\n\taddl\t$1, %r15d\n\tcltq\n\tmovslq\t%edx, %rdx\n\timulq\t$4004, %rax, %rsi\n\timulq\t$1001, %rax, %rax\n\tsubl\t%r10d, 48(%rsp,%rsi)\n\tsubl\t%r10d, 48(%rsp,%rdx,4)\n\tmovl\t32(%rsp), %r10d\n\taddq\t%rdx, %rax\n\taddl\t%r9d, 48(%rsp,%rax,4)\n\tcmpl\t%r15d, %r10d\n\tjg\t.L43\n.L6:\n\ttestl\t%ecx, %ecx\n\tjs\t.L28\n\tje\t.L28\n\tleal\t-1(%rcx), %eax\n\tleaq\t52(%rsp), %rdi\n\tmovq\t%rax, %r15\n\tleaq\t56(%rsp,%rax,4), %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$4004, %rax, %rax\n\tleaq\t4056(%rsp,%rax), %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovl\t-4(%rdi), %edx\n\tmovq\t%rdi, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\taddl\t(%rax), %edx\n\taddq\t$4, %rax\n\tmovl\t%edx, -4(%rax)\n\tcmpq\t%rsi, %rax\n\tjne\t.L10\n\taddq\t$4004, %rdi\n\tleaq\t4004(%rax), %rsi\n\tcmpq\t%r8, %rdi\n\tjne\t.L11\n\tleal\t1(%rcx), %r14d\n\tmovq\t(%rsp), %rbp\n\tmovl\t%r10d, 12(%rsp)\n\txorl\t%r12d, %r12d\n\tmovl\t%r14d, %eax\n\tmovl\t%r14d, %r13d\n\tmovl\t$1, %edi\n\tshrl\t$2, %eax\n\tleaq\t4052(%rsp), %rsi\n\tandl\t$-4, %r13d\n\tleal\t-1(%rax), %r9d\n\tmovl\t%r14d, %eax\n\taddq\t$1, %r9\n\tandl\t$3, %eax\n\tsalq\t$4, %r9\n\tmovl\t%eax, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tleal\t-1(%rdi), %eax\n\tleaq\t-4004(%rsi), %r8\n\txorl\t%edx, %edx\n\tcmpl\t$2, %ecx\n\tjle\t.L44\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovdqu\t(%rsi,%rdx), %xmm0\n\tmovdqu\t(%r8,%rdx), %xmm5\n\tpaddd\t%xmm5, %xmm0\n\tmovups\t%xmm0, (%rsi,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%r9, %rdx\n\tjne\t.L13\n\tcmpl\t%r14d, %r13d\n\tje\t.L14\n\tmovl\t%r10d, %ebx\n\tcmpl\t%r13d, %ecx\n\tje\t.L29\n\tmovl\t%r13d, %r8d\n\tmovl\t%r13d, %edx\n.L18:\n\tleaq\t1001(%r12,%r8), %r8\n\tsalq\t$2, %r8\n\tmovq\t-3956(%rsp,%r8), %xmm0\n\tleaq\t0(%rbp,%r8), %r11\n\tmovl\t%ebx, %r8d\n\tmovq\t(%r11), %xmm1\n\tandl\t$-2, %r8d\n\taddl\t%r8d, %edx\n\tpaddd\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%r11)\n\tcmpl\t%r8d, %ebx\n\tje\t.L14\n.L15:\n\tmovslq\t%edi, %r8\n\tcltq\n\tmovslq\t%edx, %rdx\n\timulq\t$1001, %r8, %r8\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %r8\n\taddq\t%rdx, %rax\n\tmovl\t48(%rsp,%rax,4), %eax\n\taddl\t%eax, 48(%rsp,%r8,4)\n.L14:\n\tleal\t1(%rdi), %eax\n\taddq\t$4004, %rsi\n\taddq\t$1001, %r12\n\tcmpl\t%edi, %ecx\n\tje\t.L17\n\tmovl\t%eax, %edi\n\tjmp\t.L25\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovl\t%ecx, %eax\n\tmovl\t12(%rsp), %r10d\n\tmovl\t%ecx, %r9d\n\tmovq\t(%rsp), %rbx\n\tshrl\t$2, %eax\n\tandl\t$-4, %r9d\n\txorl\t%edx, %edx\n\txorl\t%r8d, %r8d\n\tleal\t-1(%rax), %r11d\n\tmovd\t%r10d, %xmm7\n\taddq\t$1, %r11\n\tpshufd\t$0, %xmm7, %xmm4\n\tsalq\t$4, %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tcmpl\t$2, %r15d\n\tjbe\t.L31\n\tmovd\t%edx, %xmm6\n\tmovq\t%rbx, %rax\n\tleaq\t(%r11,%rbx), %rdx\n\tpshufd\t$0, %xmm6, %xmm3\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovdqu\t(%rax), %xmm2\n\tmovdqa\t%xmm4, %xmm1\n\taddq\t$16, %rax\n\tpsubd\t%xmm2, %xmm1\n\tmovdqa\t%xmm1, %xmm0\n\tpcmpgtd\t%xmm2, %xmm0\n\tpand\t%xmm0, %xmm1\n\tpandn\t%xmm2, %xmm0\n\tpor\t%xmm1, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpcmpgtd\t%xmm3, %xmm1\n\tpand\t%xmm1, %xmm0\n\tpandn\t%xmm3, %xmm1\n\tmovdqa\t%xmm1, %xmm3\n\tpor\t%xmm0, %xmm3\n\tcmpq\t%rdx, %rax\n\tjne\t.L21\n\tmovdqa\t%xmm3, %xmm1\n\tmovl\t%r9d, %eax\n\tpsrldq\t$8, %xmm1\n\tmovdqa\t%xmm1, %xmm0\n\tpcmpgtd\t%xmm3, %xmm0\n\tpand\t%xmm0, %xmm1\n\tpandn\t%xmm3, %xmm0\n\tpor\t%xmm1, %xmm0\n\tmovdqa\t%xmm0, %xmm2\n\tpsrldq\t$4, %xmm2\n\tmovdqa\t%xmm2, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm2\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm2, %xmm1\n\tmovd\t%xmm1, %edx\n\tcmpl\t%ecx, %r9d\n\tje\t.L20\n.L23:\n\tmovslq\t%r8d, %rsi\n\tmovslq\t%eax, %rdi\n\tmovl\t%r10d, %ebp\n\timulq\t$1001, %rsi, %rsi\n\taddq\t%rsi, %rdi\n\tmovl\t48(%rsp,%rdi,4), %edi\n\tcmpl\t%edi, %edx\n\tcmovl\t%edi, %edx\n\tsubl\t%edi, %ebp\n\tleal\t1(%rax), %edi\n\tcmpl\t%ebp, %edx\n\tcmovl\t%ebp, %edx\n\tcmpl\t%ecx, %edi\n\tjge\t.L20\n\tmovslq\t%edi, %rdi\n\taddq\t%rsi, %rdi\n\tmovl\t48(%rsp,%rdi,4), %ebp\n\tmovl\t%r10d, %edi\n\tsubl\t%ebp, %edi\n\tcmpl\t%ebp, %edi\n\tcmovl\t%ebp, %edi\n\tcmpl\t%edi, %edx\n\tcmovl\t%edi, %edx\n\taddl\t$2, %eax\n\tcmpl\t%eax, %ecx\n\tjle\t.L20\n\tcltq\n\taddq\t%rax, %rsi\n\tmovl\t%r10d, %eax\n\tmovl\t48(%rsp,%rsi,4), %esi\n\tsubl\t%esi, %eax\n\tcmpl\t%esi, %eax\n\tcmovl\t%esi, %eax\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n.L20:\n\taddl\t$1, %r8d\n\taddq\t$4004, %rbx\n\tcmpl\t%ecx, %r8d\n\tjne\t.L24\n.L9:\n\txorl\t%eax, %eax\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t4008056(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L45\n\taddq\t$4008072, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L23\n.L44:\n\tmovl\t%r14d, %ebx\n\txorl\t%r8d, %r8d\n\txorl\t%edx, %edx\n\tjmp\t.L18\n.L29:\n\tmovl\t%ecx, %edx\n\tjmp\t.L15\n.L28:\n\txorl\t%edx, %edx\n\tjmp\t.L9\n.L4:\n\tmovl\t36(%rsp), %ecx\n\tjmp\t.L6\n.L45:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d%d %c\"\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.LFB24:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-4005888(%rsp), %r11\n\t.cfi_def_cfa 11, 4005944\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2184, %rsp\n\t.cfi_def_cfa_offset 4008128\n\tmovl\t$4008004, %edx\n\txorl\t%esi, %esi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 4008056(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t48(%rsp), %rax\n\tmovq\t%rax, %rdi\n\tmovq\t%rax, (%rsp)\n\tcall\tmemset@PLT\n\tleaq\t36(%rsp), %rdx\n\tleaq\t32(%rsp), %rsi\n\txorl\t%eax, %eax\n\tleaq\t.LC0(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t32(%rsp), %r10d\n\ttestl\t%r10d, %r10d\n\tjle\t.L4\n\txorl\t%ebx, %ebx\n\tleaq\t31(%rsp), %r14\n\tleaq\t44(%rsp), %r13\n\txorl\t%r15d, %r15d\n\tleaq\t40(%rsp), %r12\n\tleaq\t.LC1(%rip), %rbp\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovl\t48(%rsp), %ebx\n.L7:\n\tmovq\t%r14, %rcx\n\tmovq\t%r13, %rdx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t40(%rsp), %eax\n\tmovl\t36(%rsp), %ecx\n\txorl\t%edi, %edi\n\tcmpb\t$87, 31(%rsp)\n\tmovl\t$-2, %r9d\n\tmovl\t$-1, %r10d\n\tsete\t%dil\n\tcltd\n\tidivl\t%ecx\n\timull\t%ecx, %edi\n\taddl\t44(%rsp), %edi\n\tmovl\t%edi, 44(%rsp)\n\tmovl\t%eax, %esi\n\tmovl\t%edi, %eax\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%eax, %edi\n\tmovl\t%esi, %eax\n\tshrl\t$31, %eax\n\taddl\t%eax, %esi\n\tandl\t$1, %esi\n\tsubl\t%eax, %esi\n\tmovl\t%edi, %eax\n\tshrl\t$31, %eax\n\taddl\t%eax, %edi\n\tandl\t$1, %edi\n\tsubl\t%eax, %edi\n\tcmpl\t%edi, %esi\n\tjne\t.L5\n\taddl\t$1, %ebx\n\tmovl\t$2, %r9d\n\tmovl\t$1, %r10d\n.L5:\n\tleal\t1(%r8), %eax\n\taddl\t$1, %edx\n\tmovl\t%ebx, 48(%rsp)\n\taddl\t$1, %r15d\n\tcltq\n\tmovslq\t%edx, %rdx\n\timulq\t$4004, %rax, %rsi\n\timulq\t$1001, %rax, %rax\n\tsubl\t%r10d, 48(%rsp,%rsi)\n\tsubl\t%r10d, 48(%rsp,%rdx,4)\n\tmovl\t32(%rsp), %r10d\n\taddq\t%rdx, %rax\n\taddl\t%r9d, 48(%rsp,%rax,4)\n\tcmpl\t%r15d, %r10d\n\tjg\t.L43\n.L6:\n\ttestl\t%ecx, %ecx\n\tjs\t.L28\n\tje\t.L28\n\tleal\t-1(%rcx), %eax\n\tleaq\t52(%rsp), %rdi\n\tmovq\t%rax, %r15\n\tleaq\t56(%rsp,%rax,4), %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$4004, %rax, %rax\n\tleaq\t4056(%rsp,%rax), %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovl\t-4(%rdi), %edx\n\tmovq\t%rdi, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\taddl\t(%rax), %edx\n\taddq\t$4, %rax\n\tmovl\t%edx, -4(%rax)\n\tcmpq\t%rsi, %rax\n\tjne\t.L10\n\taddq\t$4004, %rdi\n\tleaq\t4004(%rax), %rsi\n\tcmpq\t%r8, %rdi\n\tjne\t.L11\n\tleal\t1(%rcx), %r14d\n\tmovq\t(%rsp), %rbp\n\tmovl\t%r10d, 12(%rsp)\n\txorl\t%r12d, %r12d\n\tmovl\t%r14d, %eax\n\tmovl\t%r14d, %r13d\n\tmovl\t$1, %edi\n\tshrl\t$2, %eax\n\tleaq\t4052(%rsp), %rsi\n\tandl\t$-4, %r13d\n\tleal\t-1(%rax), %r9d\n\tmovl\t%r14d, %eax\n\taddq\t$1, %r9\n\tandl\t$3, %eax\n\tsalq\t$4, %r9\n\tmovl\t%eax, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L25:\n\tleal\t-1(%rdi), %eax\n\tleaq\t-4004(%rsi), %r8\n\txorl\t%edx, %edx\n\tcmpl\t$2, %ecx\n\tjle\t.L44\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovdqu\t(%rsi,%rdx), %xmm0\n\tmovdqu\t(%r8,%rdx), %xmm5\n\tpaddd\t%xmm5, %xmm0\n\tmovups\t%xmm0, (%rsi,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%r9, %rdx\n\tjne\t.L13\n\tcmpl\t%r14d, %r13d\n\tje\t.L14\n\tmovl\t%r10d, %ebx\n\tcmpl\t%r13d, %ecx\n\tje\t.L29\n\tmovl\t%r13d, %r8d\n\tmovl\t%r13d, %edx\n.L18:\n\tleaq\t1001(%r12,%r8), %r8\n\tsalq\t$2, %r8\n\tmovq\t-3956(%rsp,%r8), %xmm0\n\tleaq\t0(%rbp,%r8), %r11\n\tmovl\t%ebx, %r8d\n\tmovq\t(%r11), %xmm1\n\tandl\t$-2, %r8d\n\taddl\t%r8d, %edx\n\tpaddd\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%r11)\n\tcmpl\t%r8d, %ebx\n\tje\t.L14\n.L15:\n\tmovslq\t%edi, %r8\n\tcltq\n\tmovslq\t%edx, %rdx\n\timulq\t$1001, %r8, %r8\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %r8\n\taddq\t%rdx, %rax\n\tmovl\t48(%rsp,%rax,4), %eax\n\taddl\t%eax, 48(%rsp,%r8,4)\n.L14:\n\tleal\t1(%rdi), %eax\n\taddq\t$4004, %rsi\n\taddq\t$1001, %r12\n\tcmpl\t%edi, %ecx\n\tje\t.L17\n\tmovl\t%eax, %edi\n\tjmp\t.L25\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovl\t%ecx, %eax\n\tmovl\t12(%rsp), %r10d\n\tmovl\t%ecx, %r9d\n\tmovq\t(%rsp), %rbx\n\tshrl\t$2, %eax\n\tandl\t$-4, %r9d\n\txorl\t%edx, %edx\n\txorl\t%r8d, %r8d\n\tleal\t-1(%rax), %r11d\n\tmovd\t%r10d, %xmm7\n\taddq\t$1, %r11\n\tpshufd\t$0, %xmm7, %xmm4\n\tsalq\t$4, %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tcmpl\t$2, %r15d\n\tjbe\t.L31\n\tmovd\t%edx, %xmm6\n\tmovq\t%rbx, %rax\n\tleaq\t(%r11,%rbx), %rdx\n\tpshufd\t$0, %xmm6, %xmm3\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovdqu\t(%rax), %xmm2\n\tmovdqa\t%xmm4, %xmm1\n\taddq\t$16, %rax\n\tpsubd\t%xmm2, %xmm1\n\tmovdqa\t%xmm1, %xmm0\n\tpcmpgtd\t%xmm2, %xmm0\n\tpand\t%xmm0, %xmm1\n\tpandn\t%xmm2, %xmm0\n\tpor\t%xmm1, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpcmpgtd\t%xmm3, %xmm1\n\tpand\t%xmm1, %xmm0\n\tpandn\t%xmm3, %xmm1\n\tmovdqa\t%xmm1, %xmm3\n\tpor\t%xmm0, %xmm3\n\tcmpq\t%rdx, %rax\n\tjne\t.L21\n\tmovdqa\t%xmm3, %xmm1\n\tmovl\t%r9d, %eax\n\tpsrldq\t$8, %xmm1\n\tmovdqa\t%xmm1, %xmm0\n\tpcmpgtd\t%xmm3, %xmm0\n\tpand\t%xmm0, %xmm1\n\tpandn\t%xmm3, %xmm0\n\tpor\t%xmm1, %xmm0\n\tmovdqa\t%xmm0, %xmm2\n\tpsrldq\t$4, %xmm2\n\tmovdqa\t%xmm2, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm2\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm2, %xmm1\n\tmovd\t%xmm1, %edx\n\tcmpl\t%ecx, %r9d\n\tje\t.L20\n.L23:\n\tmovslq\t%r8d, %rsi\n\tmovslq\t%eax, %rdi\n\tmovl\t%r10d, %ebp\n\timulq\t$1001, %rsi, %rsi\n\taddq\t%rsi, %rdi\n\tmovl\t48(%rsp,%rdi,4), %edi\n\tcmpl\t%edi, %edx\n\tcmovl\t%edi, %edx\n\tsubl\t%edi, %ebp\n\tleal\t1(%rax), %edi\n\tcmpl\t%ebp, %edx\n\tcmovl\t%ebp, %edx\n\tcmpl\t%ecx, %edi\n\tjge\t.L20\n\tmovslq\t%edi, %rdi\n\taddq\t%rsi, %rdi\n\tmovl\t48(%rsp,%rdi,4), %ebp\n\tmovl\t%r10d, %edi\n\tsubl\t%ebp, %edi\n\tcmpl\t%ebp, %edi\n\tcmovl\t%ebp, %edi\n\tcmpl\t%edi, %edx\n\tcmovl\t%edi, %edx\n\taddl\t$2, %eax\n\tcmpl\t%eax, %ecx\n\tjle\t.L20\n\tcltq\n\taddq\t%rax, %rsi\n\tmovl\t%r10d, %eax\n\tmovl\t48(%rsp,%rsi,4), %esi\n\tsubl\t%esi, %eax\n\tcmpl\t%esi, %eax\n\tcmovl\t%esi, %eax\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n.L20:\n\taddl\t$1, %r8d\n\taddq\t$4004, %rbx\n\tcmpl\t%ecx, %r8d\n\tjne\t.L24\n.L9:\n\txorl\t%eax, %eax\n\tleaq\t.LC2(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t4008056(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L45\n\taddq\t$4008072, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L31:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tjmp\t.L23\n.L44:\n\tmovl\t%r14d, %ebx\n\txorl\t%r8d, %r8d\n\txorl\t%edx, %edx\n\tjmp\t.L18\n.L29:\n\tmovl\t%ecx, %edx\n\tjmp\t.L15\n.L28:\n\txorl\t%edx, %edx\n\tjmp\t.L9\n.L4:\n\tmovl\t36(%rsp), %ecx\n\tjmp\t.L6\n.L45:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 for(i=0;i<n;i++){\n scanf(\"%d%d %c\",&x,&y,&a);y+=(a=='W')*k;\n s=1-(x/k%2!=y/k%2)*2;\n m[0][0]+=s>0;\n v=x%k+1;w=y%k+1;\n m[v][0]-=s;\n m[0][w]-=s;\n m[v][w]+=s*2;\n }\n for(i=0;i<=k;i++)for(j=0;j<k;j++)m[i][j+1]+=m[i][j];\n for(i=0;i<=k;i++)for(j=0;j<k;j++)m[j+1][i]+=m[j][i];\n v=0;for(i=0;i<k;i++)for(j=0;j<k;j++)v=z(v,m[i][j],n-m[i][j]);\n printf(\"%d\",v);\n}\n", "index": 97, "inputs": [ "6 2\n1 2 B\n2 1 W\n0 2 B\n1 0 B\n0 6 W\n4 5 W\n", "4 3\n0 1 W\n1 0 W\n5 3 B\n5 4 B\n", "2 1000\n1 0 B\n0 1 W\n", "2 0001\n1 -1 B\n0 1 X\n", "0 0001\n1 -1 B\n-1 1 W\n", "6 2\n1 0 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n", "6 2\n0 2 B\n2 1 W\n0 2 B\n1 0 B\n0 6 W\n4 5 W\n", "4 3\n0 1 W\n2 0 W\n5 3 B\n5 4 B\n", "2 1000\n1 0 B\n0 1 X\n", "6 2\n0 2 B\n2 1 W\n0 2 B\n1 0 B\n0 6 W\n0 5 W\n", "4 3\n1 1 W\n2 0 W\n5 3 B\n5 4 B\n" ], "outputs": [ "3", "4", "2", "2", "0", "5", "4", "3", "2", "4", "3" ], "question": "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 for(i=0;i<n;i++){\n scanf(\"%d%d %c\",&x,&y,&a);y+=(a=='W')*k;\n s=1-(x/k%2!=y/k%2)*2;\n m[0][0]+=s>0;\n v=x%k+1;w=y%k+1;\n m[v][0]-=s;\n m[0][w]-=s;\n m[v][w]+=s*2;\n }\n for(i=0;i<=k;i++)for(j=0;j<k;j++)m[i][j+1]+=m[i][j];\n for(i=0;i<=k;i++)for(j=0;j<k;j++)m[j+1][i]+=m[j][i];\n v=0;for(i=0;i<k;i++)for(j=0;j<k;j++)v=z(v,m[i][j],n-m[i][j]);\n printf(\"%d\",v);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tz\n\t.type\tz, @function\nz:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t%edx, -12(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L2\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-12(%rbp), %eax\n\tjg\t.L3\n.L2:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovge\t%edx, %eax\n\tjmp\t.L5\n.L3:\n\tmovl\t-4(%rbp), %eax\n.L5:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tz, .-z\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC1:\n\t.string\t\"%d%d %c\"\n.LC2:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-4005888(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2176, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-4008016(%rbp), %rax\n\tmovl\t$4008004, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-4008048(%rbp), %rdx\n\tleaq\t-4008052(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L7\n.L10:\n\tleaq\t-4008053(%rbp), %rcx\n\tleaq\t-4008040(%rbp), %rdx\n\tleaq\t-4008044(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t-4008053(%rbp), %eax\n\tcmpb\t$87, %al\n\tsete\t%al\n\tmovzbl\t%al, %edx\n\tmovl\t-4008048(%rbp), %eax\n\timull\t%eax, %edx\n\tmovl\t-4008040(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -4008040(%rbp)\n\tmovl\t-4008044(%rbp), %eax\n\tmovl\t-4008048(%rbp), %edi\n\tcltd\n\tidivl\t%edi\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tshrl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %esi\n\tmovl\t-4008040(%rbp), %eax\n\tmovl\t-4008048(%rbp), %edi\n\tcltd\n\tidivl\t%edi\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tshrl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tcmpl\t%eax, %esi\n\tje\t.L8\n\tmovl\t$-1, %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$1, %eax\n.L9:\n\tmovl\t%eax, -4008024(%rbp)\n\tmovl\t-4008016(%rbp), %edx\n\tcmpl\t$0, -4008024(%rbp)\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -4008016(%rbp)\n\tmovl\t-4008044(%rbp), %eax\n\tmovl\t-4008048(%rbp), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -4008028(%rbp)\n\tmovl\t-4008040(%rbp), %eax\n\tmovl\t-4008048(%rbp), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t%edx, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -4008020(%rbp)\n\tmovl\t-4008028(%rbp), %eax\n\tcltq\n\timulq\t$4004, %rax, %rax\n\taddq\t%rbp, %rax\n\tsubq\t$4008016, %rax\n\tmovl\t(%rax), %eax\n\tsubl\t-4008024(%rbp), %eax\n\tmovl\t-4008028(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\timulq\t$4004, %rdx, %rdx\n\taddq\t%rbp, %rdx\n\tsubq\t$4008016, %rdx\n\tmovl\t%eax, (%rdx)\n\tmovl\t-4008020(%rbp), %eax\n\tcltq\n\tmovl\t-4008016(%rbp,%rax,4), %eax\n\tsubl\t-4008024(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4008020(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\tmovl\t-4008020(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008028(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %edx\n\tmovl\t-4008024(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-4008020(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-4008028(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\taddl\t$1, -4008036(%rbp)\n.L7:\n\tmovl\t-4008052(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjl\t.L10\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L11\n.L14:\n\tmovl\t$0, -4008032(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovl\t-4008032(%rbp), %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %ecx\n\tmovl\t-4008032(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %edx\n\tmovl\t-4008032(%rbp), %eax\n\taddl\t$1, %eax\n\taddl\t%ecx, %edx\n\tmovslq\t%eax, %rcx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\taddl\t$1, -4008032(%rbp)\n.L12:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008032(%rbp)\n\tjl\t.L13\n\taddl\t$1, -4008036(%rbp)\n.L11:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjle\t.L14\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L15\n.L18:\n\tmovl\t$0, -4008032(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-4008032(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-4008036(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rax\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %esi\n\tmovl\t-4008036(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-4008032(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %edx\n\tmovl\t-4008032(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\taddl\t%esi, %edx\n\tmovl\t-4008036(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%ecx, %rax\n\timulq\t$1001, %rax, %rax\n\taddq\t%rsi, %rax\n\tmovl\t%edx, -4008016(%rbp,%rax,4)\n\taddl\t$1, -4008032(%rbp)\n.L16:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008032(%rbp)\n\tjl\t.L17\n\taddl\t$1, -4008036(%rbp)\n.L15:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjle\t.L18\n\tmovl\t$0, -4008028(%rbp)\n\tmovl\t$0, -4008036(%rbp)\n\tjmp\t.L19\n.L22:\n\tmovl\t$0, -4008032(%rbp)\n\tjmp\t.L20\n.L21:\n\tmovl\t-4008052(%rbp), %eax\n\tmovl\t-4008032(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovl\t-4008036(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\timulq\t$1001, %rdx, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t-4008016(%rbp,%rdx,4), %ecx\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4008032(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-4008036(%rbp), %eax\n\tcltq\n\timulq\t$1001, %rax, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-4008016(%rbp,%rax,4), %ecx\n\tmovl\t-4008028(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tz\n\tmovl\t%eax, -4008028(%rbp)\n\taddl\t$1, -4008032(%rbp)\n.L20:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008032(%rbp)\n\tjl\t.L21\n\taddl\t$1, -4008036(%rbp)\n.L19:\n\tmovl\t-4008048(%rbp), %eax\n\tcmpl\t%eax, -4008036(%rbp)\n\tjl\t.L22\n\tmovl\t-4008028(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L24\n\tcall\t__stack_chk_fail@PLT\n.L24:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 %c",&x,&y,&a);y+=(a=='W')*k; s=1-(x/k%2!=y/k%2)*2; m[0][0]+=s>0; v=x%k+1;w=y%k+1; m[v][0]-=s; m[0][w]-=s; m[v][w]+=s*2; } for(i=0;i<=k;i++)for(j=0;j<k;j++)m[i][j+1]+=m[i][j]; for(i=0;i<=k;i++)for(j=0;j<k;j++)m[j+1][i]+=m[j][i]; v=0;for(i=0;i<k;i++)for(j=0;j<k;j++)v=z(v,m[i][j],n-m[i][j]); printf("%d",v); } Unoptimized Assembly Code: .file "temp.c" .text .globl z .type z, @function z: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl %edx, -12(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jle .L2 movl -4(%rbp), %eax cmpl -12(%rbp), %eax jg .L3 .L2: movl -8(%rbp), %edx movl -12(%rbp), %eax cmpl %eax, %edx cmovge %edx, %eax jmp .L5 .L3: movl -4(%rbp), %eax .L5: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size z, .-z .section .rodata .LC0: .string "%d%d" .LC1: .string "%d%d %c" .LC2: .string "%d" .text .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -4005888(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $2176, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -4008016(%rbp), %rax movl $4008004, %edx movl $0, %esi movq %rax, %rdi call memset@PLT leaq -4008048(%rbp), %rdx leaq -4008052(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -4008036(%rbp) jmp .L7 .L10: leaq -4008053(%rbp), %rcx leaq -4008040(%rbp), %rdx leaq -4008044(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movzbl -4008053(%rbp), %eax cmpb $87, %al sete %al movzbl %al, %edx movl -4008048(%rbp), %eax imull %eax, %edx movl -4008040(%rbp), %eax addl %edx, %eax movl %eax, -4008040(%rbp) movl -4008044(%rbp), %eax movl -4008048(%rbp), %edi cltd idivl %edi movl %eax, %edx movl %edx, %eax sarl $31, %eax shrl $31, %eax movl %eax, %ecx leal (%rdx,%rcx), %eax andl $1, %eax subl %ecx, %eax movl %eax, %esi movl -4008040(%rbp), %eax movl -4008048(%rbp), %edi cltd idivl %edi movl %eax, %edx movl %edx, %eax sarl $31, %eax shrl $31, %eax movl %eax, %ecx leal (%rdx,%rcx), %eax andl $1, %eax subl %ecx, %eax cmpl %eax, %esi je .L8 movl $-1, %eax jmp .L9 .L8: movl $1, %eax .L9: movl %eax, -4008024(%rbp) movl -4008016(%rbp), %edx cmpl $0, -4008024(%rbp) setg %al movzbl %al, %eax addl %edx, %eax movl %eax, -4008016(%rbp) movl -4008044(%rbp), %eax movl -4008048(%rbp), %ecx cltd idivl %ecx movl %edx, %eax addl $1, %eax movl %eax, -4008028(%rbp) movl -4008040(%rbp), %eax movl -4008048(%rbp), %ecx cltd idivl %ecx movl %edx, %eax addl $1, %eax movl %eax, -4008020(%rbp) movl -4008028(%rbp), %eax cltq imulq $4004, %rax, %rax addq %rbp, %rax subq $4008016, %rax movl (%rax), %eax subl -4008024(%rbp), %eax movl -4008028(%rbp), %edx movslq %edx, %rdx imulq $4004, %rdx, %rdx addq %rbp, %rdx subq $4008016, %rdx movl %eax, (%rdx) movl -4008020(%rbp), %eax cltq movl -4008016(%rbp,%rax,4), %eax subl -4008024(%rbp), %eax movl %eax, %edx movl -4008020(%rbp), %eax cltq movl %edx, -4008016(%rbp,%rax,4) movl -4008020(%rbp), %eax movslq %eax, %rdx movl -4008028(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rdx, %rax movl -4008016(%rbp,%rax,4), %edx movl -4008024(%rbp), %eax addl %eax, %eax addl %eax, %edx movl -4008020(%rbp), %eax movslq %eax, %rcx movl -4008028(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rcx, %rax movl %edx, -4008016(%rbp,%rax,4) addl $1, -4008036(%rbp) .L7: movl -4008052(%rbp), %eax cmpl %eax, -4008036(%rbp) jl .L10 movl $0, -4008036(%rbp) jmp .L11 .L14: movl $0, -4008032(%rbp) jmp .L12 .L13: movl -4008032(%rbp), %eax addl $1, %eax movslq %eax, %rdx movl -4008036(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rdx, %rax movl -4008016(%rbp,%rax,4), %ecx movl -4008032(%rbp), %eax movslq %eax, %rdx movl -4008036(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rdx, %rax movl -4008016(%rbp,%rax,4), %edx movl -4008032(%rbp), %eax addl $1, %eax addl %ecx, %edx movslq %eax, %rcx movl -4008036(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rcx, %rax movl %edx, -4008016(%rbp,%rax,4) addl $1, -4008032(%rbp) .L12: movl -4008048(%rbp), %eax cmpl %eax, -4008032(%rbp) jl .L13 addl $1, -4008036(%rbp) .L11: movl -4008048(%rbp), %eax cmpl %eax, -4008036(%rbp) jle .L14 movl $0, -4008036(%rbp) jmp .L15 .L18: movl $0, -4008032(%rbp) jmp .L16 .L17: movl -4008032(%rbp), %eax leal 1(%rax), %edx movl -4008036(%rbp), %eax movslq %eax, %rcx movslq %edx, %rax imulq $1001, %rax, %rax addq %rcx, %rax movl -4008016(%rbp,%rax,4), %esi movl -4008036(%rbp), %eax movslq %eax, %rdx movl -4008032(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rdx, %rax movl -4008016(%rbp,%rax,4), %edx movl -4008032(%rbp), %eax leal 1(%rax), %ecx addl %esi, %edx movl -4008036(%rbp), %eax movslq %eax, %rsi movslq %ecx, %rax imulq $1001, %rax, %rax addq %rsi, %rax movl %edx, -4008016(%rbp,%rax,4) addl $1, -4008032(%rbp) .L16: movl -4008048(%rbp), %eax cmpl %eax, -4008032(%rbp) jl .L17 addl $1, -4008036(%rbp) .L15: movl -4008048(%rbp), %eax cmpl %eax, -4008036(%rbp) jle .L18 movl $0, -4008028(%rbp) movl $0, -4008036(%rbp) jmp .L19 .L22: movl $0, -4008032(%rbp) jmp .L20 .L21: movl -4008052(%rbp), %eax movl -4008032(%rbp), %edx movslq %edx, %rcx movl -4008036(%rbp), %edx movslq %edx, %rdx imulq $1001, %rdx, %rdx addq %rcx, %rdx movl -4008016(%rbp,%rdx,4), %ecx subl %ecx, %eax movl %eax, %edx movl -4008032(%rbp), %eax movslq %eax, %rcx movl -4008036(%rbp), %eax cltq imulq $1001, %rax, %rax addq %rcx, %rax movl -4008016(%rbp,%rax,4), %ecx movl -4008028(%rbp), %eax movl %ecx, %esi movl %eax, %edi call z movl %eax, -4008028(%rbp) addl $1, -4008032(%rbp) .L20: movl -4008048(%rbp), %eax cmpl %eax, -4008032(%rbp) jl .L21 addl $1, -4008036(%rbp) .L19: movl -4008048(%rbp), %eax cmpl %eax, -4008036(%rbp) jl .L22 movl -4008028(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L24 call __stack_chk_fail@PLT .L24: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other text.
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\ts\n\t.bss\n\t.align 4\n\t.type\ts, @object\n\t.size\ts, 4\ns:\n\t.zero\t4\n\t.globl\ti\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d%d\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"NO\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t%edx, -12(%rbp)\n\tleaq\t-12(%rbp), %rcx\n\tleaq\t-8(%rbp), %rdx\n\tleaq\t-4(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tjmp\t.L2\n.L5:\n\tmovl\t-4(%rbp), %edx\n\tmovl\ti(%rip), %eax\n\timull\t%edx, %eax\n\tmovl\t-8(%rbp), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L2\n\tmovl\ts(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, s(%rip)\n\ttestl\t%eax, %eax\n.L2:\n\tmovl\ti(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, i(%rip)\n\tmovl\ti(%rip), %edx\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L5\n\tmovl\ts(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L7\n.L6:\n\tleaq\t.LC2(%rip), %rax\n.L7:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\txorl\t%eax, %eax\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\txorl\t%ebx, %ebx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovl\t%edi, 12(%rsp)\n\tleaq\t4(%rsp), %rcx\n\tleaq\t.LC2(%rip), %rdi\n\tmovl\t%esi, 8(%rsp)\n\tleaq\t12(%rsp), %rsi\n\tmovl\t%edx, 4(%rsp)\n\tleaq\t8(%rsp), %rdx\n\tcall\tscanf@PLT\n\tmovl\ts(%rip), %ebp\n\tmovl\ti(%rip), %edi\n\tmovl\t8(%rsp), %esi\n\tmovl\t12(%rsp), %r8d\n\tmovl\t4(%rsp), %r9d\n\tmovl\t%ebp, %r10d\n.L2:\n\tleal\t1(%rdi), %eax\n\tmovl\t%r8d, %ecx\n\tmovl\t%r10d, %r11d\n\timull\t%eax, %ecx\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t%ecx, %eax\n\taddl\t%r8d, %ecx\n\tcltd\n\tidivl\t%esi\n\tleal\t1(%rdi), %eax\n\tcmpl\t%r9d, %edx\n\tje\t.L12\n.L3:\n\tmovl\t%eax, %edi\n\tcmpl\t%esi, %eax\n\tjle\t.L4\n\tmovl\t%eax, i(%rip)\n\ttestb\t%bl, %bl\n\tje\t.L7\n\tmovl\t%r10d, s(%rip)\n.L5:\n\ttestl\t%r11d, %r11d\n\tleaq\t.LC1(%rip), %rax\n\tleaq\t.LC0(%rip), %rdi\n\tcmove\t%rax, %rdi\n\tcall\tputs@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\t.cfi_restore_state\n\taddl\t$1, %r10d\n\tmovl\t$1, %ebx\n\tjmp\t.L2\n.L7:\n\tmovl\t%ebp, %r11d\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\ti\n\t.bss\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.globl\ts\n\t.align 4\n\t.type\ts, @object\n\t.size\ts, 4\ns:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\txorl\t%eax, %eax\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\txorl\t%ebx, %ebx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovl\t%edi, 12(%rsp)\n\tleaq\t4(%rsp), %rcx\n\tleaq\t.LC2(%rip), %rdi\n\tmovl\t%esi, 8(%rsp)\n\tleaq\t12(%rsp), %rsi\n\tmovl\t%edx, 4(%rsp)\n\tleaq\t8(%rsp), %rdx\n\tcall\tscanf@PLT\n\tmovl\ts(%rip), %ebp\n\tmovl\ti(%rip), %edi\n\tmovl\t8(%rsp), %esi\n\tmovl\t12(%rsp), %r8d\n\tmovl\t4(%rsp), %r9d\n\tmovl\t%ebp, %r10d\n.L2:\n\tleal\t1(%rdi), %eax\n\tmovl\t%r8d, %ecx\n\tmovl\t%r10d, %r11d\n\timull\t%eax, %ecx\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t%ecx, %eax\n\taddl\t%r8d, %ecx\n\tcltd\n\tidivl\t%esi\n\tleal\t1(%rdi), %eax\n\tcmpl\t%r9d, %edx\n\tje\t.L12\n.L3:\n\tmovl\t%eax, %edi\n\tcmpl\t%esi, %eax\n\tjle\t.L4\n\tmovl\t%eax, i(%rip)\n\ttestb\t%bl, %bl\n\tje\t.L7\n\tmovl\t%r10d, s(%rip)\n.L5:\n\ttestl\t%r11d, %r11d\n\tleaq\t.LC1(%rip), %rax\n\tleaq\t.LC0(%rip), %rdi\n\tcmove\t%rax, %rdi\n\tcall\tputs@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\t.cfi_restore_state\n\taddl\t$1, %r10d\n\tmovl\t$1, %ebx\n\tjmp\t.L2\n.L7:\n\tmovl\t%ebp, %r11d\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.globl\ti\n\t.bss\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.globl\ts\n\t.align 4\n\t.type\ts, @object\n\t.size\ts, 4\ns:\n\t.zero\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "s;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}", "index": 72, "inputs": [ "7 5 0\n", "77 42 5\n", "2 2 0\n", "80 98 58\n", "1 110 97\n", "11 5 0\n", "2 4 0\n", "77 42 2\n", "103 98 58\n", "0 110 97\n", "14 5 0\n", "2 4 -1\n", "77 42 0\n", "103 98 87\n", "1 111 97\n", "14 9 0\n", "77 79 0\n", "13 98 87\n", "2 111 97\n", "14 9 1\n", "77 79 1\n", "14 2 1\n", "141 79 1\n", "117 79 1\n", "117 63 1\n", "174 63 1\n", "320 63 1\n", "299 63 1\n", "299 117 1\n", "299 16 1\n", "459 16 1\n", "459 16 0\n", "459 13 0\n", "338 13 0\n", "64 13 0\n", "38 13 0\n", "77 63 36\n", "40 50 58\n", "4 5 1\n", "2 3 0\n", "33 42 5\n", "11 4 0\n", "4 4 0\n", "77 42 3\n", "103 77 58\n", "1 110 2\n", "14 10 0\n", "4 4 -1\n", "153 42 0\n", "103 98 85\n", "1 101 97\n", "26 9 1\n", "3 111 97\n", "0 9 0\n", "77 120 1\n", "280 79 1\n", "117 35 1\n", "117 111 1\n", "174 3 1\n", "41 63 1\n", "299 63 0\n", "299 16 0\n", "549 16 1\n", "459 30 0\n", "338 22 0\n", "8 13 0\n", "38 23 0\n", "4 5 0\n", "33 42 4\n", "11 8 0\n", "2 1 0\n", "77 8 3\n", "67 77 58\n", "1 010 2\n", "0 10 0\n", "4 4 -2\n", "153 17 0\n", "103 135 85\n", "1 101 54\n", "9 9 1\n", "3 110 97\n", "1 9 0\n", "66 120 1\n", "135 79 1\n", "117 55 1\n", "117 101 1\n", "146 3 1\n", "41 63 2\n", "299 7 0\n", "299 25 0\n", "549 14 1\n", "809 30 0\n", "338 22 1\n", "12 13 0\n", "63 23 0\n", "4 8 0\n", "33 19 4\n", "11 2 0\n", "77 8 4\n", "122 77 58\n", "40 98 58\n", "7 5 1\n", "7 5 1\n", "1 100 97\n", "77 42 36\n", "2 2 1\n" ], "outputs": [ "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "NO\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "NO\n", "NO\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "NO\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "YES\n", "NO\n", "NO\n" ], "question": "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\ts\n\t.bss\n\t.align 4\n\t.type\ts, @object\n\t.size\ts, 4\ns:\n\t.zero\t4\n\t.globl\ti\n\t.align 4\n\t.type\ti, @object\n\t.size\ti, 4\ni:\n\t.zero\t4\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d%d\"\n.LC1:\n\t.string\t\"YES\"\n.LC2:\n\t.string\t\"NO\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t%edx, -12(%rbp)\n\tleaq\t-12(%rbp), %rcx\n\tleaq\t-8(%rbp), %rdx\n\tleaq\t-4(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tscanf@PLT\n\tjmp\t.L2\n.L5:\n\tmovl\t-4(%rbp), %edx\n\tmovl\ti(%rip), %eax\n\timull\t%edx, %eax\n\tmovl\t-8(%rbp), %ecx\n\tcltd\n\tidivl\t%ecx\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L2\n\tmovl\ts(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, s(%rip)\n\ttestl\t%eax, %eax\n.L2:\n\tmovl\ti(%rip), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, i(%rip)\n\tmovl\ti(%rip), %edx\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L5\n\tmovl\ts(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L6\n\tleaq\t.LC1(%rip), %rax\n\tjmp\t.L7\n.L6:\n\tleaq\t.LC2(%rip), %rax\n.L7:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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, 4 s: .zero 4 .globl i .align 4 .type i, @object .size i, 4 i: .zero 4 .section .rodata .LC0: .string "%d%d%d" .LC1: .string "YES" .LC2: .string "NO" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl %edx, -12(%rbp) leaq -12(%rbp), %rcx leaq -8(%rbp), %rdx leaq -4(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call scanf@PLT jmp .L2 .L5: movl -4(%rbp), %edx movl i(%rip), %eax imull %edx, %eax movl -8(%rbp), %ecx cltd idivl %ecx movl -12(%rbp), %eax cmpl %eax, %edx jne .L2 movl s(%rip), %eax leal 1(%rax), %edx movl %edx, s(%rip) testl %eax, %eax .L2: movl i(%rip), %eax addl $1, %eax movl %eax, i(%rip) movl i(%rip), %edx movl -8(%rbp), %eax cmpl %eax, %edx jle .L5 movl s(%rip), %eax testl %eax, %eax je .L6 leaq .LC1(%rip), %rax jmp .L7 .L6: leaq .LC2(%rip), %rax .L7: movq %rax, %rdi call puts@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 = w;\n\treturn w = w ^ (w >> 19) ^ (t ^ (t >> 8));\n}\n\ntypedef struct node_t {\n\tint val;\n\tstruct node_t *lch, *rch;\n\tint size;\n\tunsigned int pri;\n} node;\n\nnode* new_node(int val) {\n\tstatic int it = 0;\n\tstatic node pool[200000];\n\tpool[it] = (node) { val, 0, 0, 1, xor128() };\n\treturn &pool[it++];\n}\n\nint count(node *t) {\n\treturn !t ? 0 : t->size;\n}\n\nnode *update(node *t) {\n\tt->size = count(t->lch) + count(t->rch) + 1;\n\treturn t;\n}\n\nnode *merge(node *l, node *r) {\n\tif (!l || !r) return !l ? r : l;\n\tif (l->pri > r->pri) {\n\t\tl->rch = merge(l->rch, r);\n\t\treturn update(l);\n\t}\n\tr->lch = merge(l, r->lch);\n\treturn update(r);\n}\n\ntypedef struct{ node *a, *b; } pnode;\n\npnode split(node *t, int k) {\n\tif (!t) return (pnode) { 0, 0 };\n\tif (k <= count(t->lch)) {\n\t\tpnode s = split(t->lch, k);\n\t\tt->lch = s.b;\n\t\treturn (pnode) { s.a, update(t) };\n\t}\n\tpnode s = split(t->rch, k - count(t->lch) - 1);\n\tt->rch = s.a;\n\treturn (pnode) { update(t), s.b };\n}\n\nnode* find(node *t, int val) {\n\twhile (t) {\n\t\tif (t->val == val) break;\n\t\tt = val < t->val ? t->lch : t->rch;\n\t}\n\treturn t;\n}\n\nint count_lower(node *t, int v) {\n\tif (!t) return 0;\n\tif (t->val < v) return count(t->lch) + 1 + count_lower(t->rch, v);\n\tif (t->val == v) return count(t->lch);\n\treturn count_lower(t->lch, v);\n}\n\nnode *insert(node *t, int val) {\n\tint k = count_lower(t, val);\n\tpnode s = split(t, k);\n\treturn merge(merge(s.a, new_node(val)), s.b);\n}\n\nnode *erase(node *t, int k) {\n\tpnode s1 = split(t, k), s2 = split(s1.b, 1);\n\treturn merge(s1.a, s2.b);\n}\n\nvoid print(node *t) {\n\tif (!t) return;\n\tprint(t->lch);\n\tprintf(\"%d\\n\", t->val);\n\tprint(t->rch);\n}\n\nint main(void)\n{\n\tint q, com, x, l, r, cnt = 0;\n\tnode *root = 0;\n\tpnode p1, p2;\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d%d\", &com, &x);\n\t\tif (com == 0) {\n\t\t\tif (!find(root, x)) ++cnt, root = insert(root, x);\n\t\t\tprintf(\"%d\\n\", cnt);\n\t\t}\n\t\telse if (com == 1) {\n\t\t\tputs(find(root, x) ? \"1\" : \"0\");\n\t\t}\n\t\telse if (com == 2) {\n\t\t\tif (find(root, x)) --cnt, root = erase(root, count_lower(root, x));\n\t\t}\n\t\telse {\n\t\t\tscanf(\"%d\", &r);\n\t\t\tl = count_lower(root, x);\n\t\t\tr = count_lower(root, r + 1);\n\t\t\tp1 = split(root, l), p2 = split(p1.b, r - l);\n\t\t\tprint(p2.a);\n\t\t\troot = merge(merge(p1.a, p2.a), p2.b);\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\txor128\n\t.type\txor128, @function\nxor128:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\tx.5(%rip), %eax\n\tsall\t$11, %eax\n\tmovl\t%eax, %edx\n\tmovl\tx.5(%rip), %eax\n\txorl\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\ty.4(%rip), %eax\n\tmovl\t%eax, x.5(%rip)\n\tmovl\tz.3(%rip), %eax\n\tmovl\t%eax, y.4(%rip)\n\tmovl\tw.2(%rip), %eax\n\tmovl\t%eax, z.3(%rip)\n\tmovl\tw.2(%rip), %eax\n\tshrl\t$19, %eax\n\tmovl\t%eax, %edx\n\tmovl\tw.2(%rip), %eax\n\txorl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tshrl\t$8, %eax\n\txorl\t-4(%rbp), %eax\n\txorl\t%edx, %eax\n\tmovl\t%eax, w.2(%rip)\n\tmovl\tw.2(%rip), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\txor128, .-xor128\n\t.globl\tnew_node\n\t.type\tnew_node, @function\nnew_node:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -52(%rbp)\n\tmovl\tit.1(%rip), %ebx\n\tmovl\t$0, %eax\n\tcall\txor128\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rsi\n\tsalq\t$5, %rsi\n\tleaq\tpool.0(%rip), %rcx\n\tmovl\t-52(%rbp), %edx\n\tmovl\t%edx, (%rsi,%rcx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t8+pool.0(%rip), %rdx\n\tmovq\t$0, (%rcx,%rdx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t16+pool.0(%rip), %rdx\n\tmovq\t$0, (%rcx,%rdx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t24+pool.0(%rip), %rdx\n\tmovl\t$1, (%rcx,%rdx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t28+pool.0(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\tit.1(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, it.1(%rip)\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tpool.0(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tnew_node, .-new_node\n\t.globl\tcount\n\t.type\tcount, @function\ncount:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tje\t.L6\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tjmp\t.L8\n.L6:\n\tmovl\t$0, %eax\n.L8:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tcount, .-count\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB3:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$8, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tmovl\t%eax, %ebx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\taddl\t%ebx, %eax\n\tleal\t1(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%edx, 24(%rax)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE3:\n\t.size\tupdate, .-update\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB4:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tje\t.L12\n\tcmpq\t$0, -16(%rbp)\n\tjne\t.L13\n.L12:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L14\n\tmovq\t-16(%rbp), %rax\n\tjmp\t.L16\n.L14:\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L16\n.L13:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t28(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t28(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjbe\t.L17\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n\tjmp\t.L16\n.L17:\n\tmovq\t-16(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t%rax, 8(%rdx)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n.L16:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE4:\n\t.size\tmerge, .-merge\n\t.globl\tsplit\n\t.type\tsplit, @function\nsplit:\n.LFB5:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 13, -24\n\t.cfi_offset 12, -32\n\t.cfi_offset 3, -40\n\tmovq\t%rdi, -56(%rbp)\n\tmovl\t%esi, -60(%rbp)\n\tcmpq\t$0, -56(%rbp)\n\tjne\t.L19\n\tmovl\t$0, %r12d\n\tmovl\t$0, %r13d\n\tjmp\t.L20\n.L19:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tcmpl\t%eax, -60(%rbp)\n\tjg\t.L21\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovl\t-60(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-48(%rbp), %rbx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n\tmovq\t%rbx, %r12\n\tmovq\t%rax, %r13\n\tjmp\t.L20\n.L21:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tmovl\t%eax, %edx\n\tmovl\t-60(%rbp), %eax\n\tsubl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t%rax, %r12\n\tmovq\t%rdx, %r13\n.L20:\n\tmovq\t%r12, %rax\n\tmovq\t%r13, %rdx\n\taddq\t$40, %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE5:\n\t.size\tsplit, .-split\n\t.globl\tfind\n\t.type\tfind, @function\nfind:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tjmp\t.L24\n.L29:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tje\t.L31\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjge\t.L27\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tjmp\t.L28\n.L27:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n.L28:\n\tmovq\t%rax, -8(%rbp)\n.L24:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L29\n\tjmp\t.L26\n.L31:\n\tnop\n.L26:\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tfind, .-find\n\t.globl\tcount_lower\n\t.type\tcount_lower, @function\ncount_lower:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L33\n\tmovl\t$0, %eax\n\tjmp\t.L34\n.L33:\n\tmovq\t-24(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjle\t.L35\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tleal\t1(%rax), %ebx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovl\t-28(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\taddl\t%ebx, %eax\n\tjmp\t.L34\n.L35:\n\tmovq\t-24(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjne\t.L36\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tjmp\t.L34\n.L36:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovl\t-28(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n.L34:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tcount_lower, .-count_lower\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -56(%rbp)\n\tmovl\t%esi, -60(%rbp)\n\tmovl\t-60(%rbp), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-36(%rbp), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rbx\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tnew_node\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tinsert, .-insert\n\t.globl\terase\n\t.type\terase, @function\nerase:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovl\t%esi, -44(%rbp)\n\tmovl\t-44(%rbp), %edx\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$1, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\terase, .-erase\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tprint\n\t.type\tprint, @function\nprint:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tje\t.L44\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tprint\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tprint\n\tjmp\t.L41\n.L44:\n\tnop\n.L41:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tprint, .-print\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d%d\"\n.LC3:\n\t.string\t\"1\"\n.LC4:\n\t.string\t\"0\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$88, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tleaq\t-96(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tjmp\t.L46\n.L53:\n\tleaq\t-88(%rbp), %rdx\n\tleaq\t-92(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-92(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L47\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfind\n\ttestq\t%rax, %rax\n\tjne\t.L48\n\taddl\t$1, -80(%rbp)\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tinsert\n\tmovq\t%rax, -72(%rbp)\n.L48:\n\tmovl\t-80(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L46\n.L47:\n\tmovl\t-92(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L49\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfind\n\ttestq\t%rax, %rax\n\tje\t.L50\n\tleaq\t.LC3(%rip), %rax\n\tjmp\t.L51\n.L50:\n\tleaq\t.LC4(%rip), %rax\n.L51:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L46\n.L49:\n\tmovl\t-92(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L52\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfind\n\ttestq\t%rax, %rax\n\tje\t.L46\n\tsubl\t$1, -80(%rbp)\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\terase\n\tmovq\t%rax, -72(%rbp)\n\tjmp\t.L46\n.L52:\n\tleaq\t-84(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, -76(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, -84(%rbp)\n\tmovl\t-76(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tsubl\t-76(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tprint\n\tmovq\t-40(%rbp), %rbx\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rax, -72(%rbp)\n.L46:\n\tmovl\t-96(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -96(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L53\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L55\n\tcall\t__stack_chk_fail@PLT\n.L55:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.data\n\t.align 4\n\t.type\tx.5, @object\n\t.size\tx.5, 4\nx.5:\n\t.long\t123456789\n\t.align 4\n\t.type\ty.4, @object\n\t.size\ty.4, 4\ny.4:\n\t.long\t362436069\n\t.align 4\n\t.type\tz.3, @object\n\t.size\tz.3, 4\nz.3:\n\t.long\t521288629\n\t.align 4\n\t.type\tw.2, @object\n\t.size\tw.2, 4\nw.2:\n\t.long\t88675123\n\t.local\tit.1\n\t.comm\tit.1,4,4\n\t.local\tpool.0\n\t.comm\tpool.0,6400000,32\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tmovl\tz.3(%rip), %eax\n\tmovl\t%ecx, z.3(%rip)\n\tmovl\t%eax, y.4(%rip)\n\tmovl\t%ecx, %eax\n\tshrl\t$19, %eax\n\txorl\t%ecx, %eax\n\txorl\t%edx, %eax\n\tshrl\t$8, %edx\n\txorl\t%edx, %eax\n\tmovl\t%eax, w.2(%rip)\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\txor128, .-xor128\n\t.p2align 4\n\t.globl\tnew_node\n\t.type\tnew_node, @function\nnew_node:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tx.5(%rip), %edx\n\tmovl\tw.2(%rip), %esi\n\tpxor\t%xmm0, %xmm0\n\tmovl\tit.1(%rip), %ecx\n\tmovl\t%edx, %eax\n\tsall\t$11, %eax\n\txorl\t%edx, %eax\n\tmovl\ty.4(%rip), %edx\n\tmovl\t%edx, x.5(%rip)\n\tmovl\tz.3(%rip), %edx\n\tmovl\t%esi, z.3(%rip)\n\tmovl\t%edx, y.4(%rip)\n\tmovl\t%esi, %edx\n\tshrl\t$19, %edx\n\txorl\t%esi, %edx\n\tmovslq\t%ecx, %rsi\n\taddl\t$1, %ecx\n\txorl\t%eax, %edx\n\tshrl\t$8, %eax\n\tmovl\t%ecx, it.1(%rip)\n\txorl\t%eax, %edx\n\tsalq\t$5, %rsi\n\tleaq\tpool.0(%rip), %rax\n\taddq\t%rsi, %rax\n\tmovl\t%edx, w.2(%rip)\n\tmovl\t%edi, (%rax)\n\tleaq\t8+pool.0(%rip), %rdi\n\tmovups\t%xmm0, (%rdi,%rsi)\n\tmovl\t$1, 24(%rax)\n\tmovl\t%edx, 28(%rax)\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tnew_node, .-new_node\n\t.p2align 4\n\t.globl\tcount\n\t.type\tcount, @function\ncount:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L4\n\tmovl\t24(%rdi), %eax\n.L4:\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tcount, .-count\n\t.p2align 4\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rdi), %rcx\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\ttestq\t%rcx, %rcx\n\tje\t.L9\n\tmovl\t24(%rcx), %edx\n.L9:\n\tmovq\t16(%rax), %rcx\n\ttestq\t%rcx, %rcx\n\tje\t.L10\n\taddl\t24(%rcx), %edx\n.L10:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%rax)\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tupdate, .-update\n\t.p2align 4\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tmovq\t%rdi, %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tmovq\t%rsi, %rbp\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\ttestq\t%rdi, %rdi\n\tje\t.L51\n\ttestq\t%rsi, %rsi\n\tje\t.L51\n\tmovl\t28(%rdi), %eax\n\tmovl\t28(%rsi), %edx\n\tcmpl\t%edx, %eax\n\tja\t.L76\n\tmovq\t8(%rsi), %r12\n\ttestq\t%r12, %r12\n\tje\t.L29\n\tcmpl\t28(%r12), %eax\n\tja\t.L77\n\tmovq\t8(%r12), %r14\n\ttestq\t%r14, %r14\n\tje\t.L34\n\tcmpl\t28(%r14), %eax\n\tja\t.L78\n\tmovq\t8(%r14), %rsi\n\tcall\tmerge\n\tmovq\t%rax, %rdx\n\tmovq\t%rax, 8(%r14)\n\txorl\t%eax, %eax\n\ttestq\t%rdx, %rdx\n\tje\t.L39\n\tmovl\t24(%rdx), %eax\n.L39:\n\tmovq\t16(%r14), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L40\n\taddl\t24(%rdx), %eax\n.L40:\n\taddl\t$1, %eax\n\tmovq\t%r14, %r13\n\tmovl\t%eax, 24(%r14)\n.L38:\n\tmovq\t16(%r12), %rdx\n\tmovq\t%r13, 8(%r12)\n\ttestq\t%rdx, %rdx\n\tje\t.L44\n\taddl\t24(%rdx), %eax\n.L44:\n\taddl\t$1, %eax\n\tmovq\t%r12, %r13\n\tmovl\t%eax, 24(%r12)\n.L33:\n\tmovq\t16(%rbp), %rdx\n\tmovq\t%r13, 8(%rbp)\n\ttestq\t%rdx, %rdx\n\tje\t.L42\n\taddl\t24(%rdx), %eax\n.L42:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%rbp)\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tmovq\t%rbp, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\t.cfi_restore_state\n\tmovq\t16(%rdi), %r12\n\ttestq\t%r12, %r12\n\tje\t.L79\n\tcmpl\t28(%r12), %edx\n\tjb\t.L80\n\tmovq\t8(%rsi), %rsi\n\tmovq\t%r12, %rdi\n\tcall\tmerge\n\txorl\t%edx, %edx\n\tmovq\t%rax, 8(%rbp)\n\ttestq\t%rax, %rax\n\tje\t.L26\n\tmovl\t24(%rax), %edx\n.L26:\n\tmovq\t16(%rbp), %rax\n\ttestq\t%rax, %rax\n\tje\t.L27\n\taddl\t24(%rax), %edx\n.L27:\n\tleal\t1(%rdx), %eax\n\tmovl\t%eax, 24(%rbp)\n.L22:\n\tmovq\t8(%r13), %rdx\n\tmovq\t%rbp, 16(%r13)\n\ttestq\t%rdx, %rdx\n\tje\t.L28\n\taddl\t24(%rdx), %eax\n.L28:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r13)\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tmovq\t%r13, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\t.cfi_restore_state\n\ttestq\t%r13, %r13\n\tmovq\t%r13, %rax\n\tcmove\t%rbp, %rax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L77:\n\t.cfi_restore_state\n\tmovq\t16(%rdi), %rdi\n\tmovq\t%r12, %rsi\n\tcall\tmerge\n\tmovq\t8(%r13), %rcx\n\txorl\t%edx, %edx\n\tmovq\t%rax, 16(%r13)\n\ttestq\t%rcx, %rcx\n\tje\t.L31\n\tmovl\t24(%rcx), %edx\n.L31:\n\ttestq\t%rax, %rax\n\tje\t.L32\n\taddl\t24(%rax), %edx\n.L32:\n\tleal\t1(%rdx), %eax\n\tmovl\t%eax, 24(%r13)\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tmovl\t24(%rsi), %eax\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovl\t24(%rdi), %eax\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovl\t24(%rdi), %eax\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L80:\n\tmovq\t16(%r12), %rdi\n\tcall\tmerge\n\tmovq\t8(%r12), %rcx\n\txorl\t%edx, %edx\n\tmovq\t%rax, 16(%r12)\n\ttestq\t%rcx, %rcx\n\tje\t.L24\n\tmovl\t24(%rcx), %edx\n.L24:\n\ttestq\t%rax, %rax\n\tje\t.L25\n\taddl\t24(%rax), %edx\n.L25:\n\tleal\t1(%rdx), %eax\n\tmovq\t%r12, %rbp\n\tmovl\t%eax, 24(%r12)\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t16(%rdi), %rdi\n\tmovq\t%r14, %rsi\n\tcall\tmerge\n\tmovq\t8(%r13), %rcx\n\tmovq\t%rax, 16(%r13)\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\ttestq\t%rcx, %rcx\n\tje\t.L36\n\tmovl\t24(%rcx), %eax\n.L36:\n\ttestq\t%rdx, %rdx\n\tje\t.L37\n\taddl\t24(%rdx), %eax\n.L37:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r13)\n\tjmp\t.L38\n\t.cfi_endproc\n.LFE27:\n\t.size\tmerge, .-merge\n\t.p2align 4\n\t.globl\tsplit\n\t.type\tsplit, @function\nsplit:\n.LFB28:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%rdi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\ttestq\t%rdi, %rdi\n\tje\t.L151\n\tmovq\t8(%rdi), %rbx\n\tmovq\t%rbx, %r14\n\ttestq\t%rbx, %rbx\n\tje\t.L83\n\tmovl\t24(%rbx), %eax\n\tcmpl\t%eax, %esi\n\tjle\t.L239\n\tmovq\t16(%rdi), %rbp\n\tsubl\t%eax, %esi\n\txorl\t%edx, %edx\n\tsubl\t$1, %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L145\n.L105:\n\tmovq\t8(%rbp), %r13\n\ttestq\t%r13, %r13\n\tje\t.L107\n\tmovl\t24(%r13), %eax\n\tcmpl\t%eax, %esi\n\tjle\t.L240\n\tmovq\t16(%rbp), %r14\n\tsubl\t%eax, %esi\n\txorl\t%edx, %edx\n\tsubl\t$1, %esi\n\ttestq\t%r14, %r14\n\tje\t.L142\n.L121:\n\tmovq\t8(%r14), %rdx\n\txorl\t%eax, %eax\n\ttestq\t%rdx, %rdx\n\tje\t.L123\n\tmovl\t24(%rdx), %eax\n.L123:\n\tcmpl\t%esi, %eax\n\tjge\t.L241\n\tmovq\t16(%r14), %r15\n\tsubl\t%eax, %esi\n\tsubl\t$1, %esi\n\ttestq\t%r15, %r15\n\tje\t.L242\n\tmovq\t8(%r15), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L132\n\tmovl\t24(%rdi), %eax\n.L132:\n\tcmpl\t%eax, %esi\n\tjle\t.L243\n\tsubl\t%eax, %esi\n\tmovq\t16(%r15), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\tmovq\t8(%r15), %rsi\n\tmovq\t%rax, 16(%r15)\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\ttestq\t%rsi, %rsi\n\tje\t.L138\n\tmovl\t24(%rsi), %eax\n.L138:\n\ttestq\t%rcx, %rcx\n\tje\t.L139\n\taddl\t24(%rcx), %eax\n.L139:\n\tmovq\t8(%r14), %rcx\n\taddl\t$1, %eax\n\tmovq\t8(%rbp), %r13\n\tmovl\t%eax, 24(%r15)\n\tmovq\t8(%r12), %rbx\n\tmovq\t%r15, 16(%r14)\n\ttestq\t%rcx, %rcx\n\tje\t.L140\n.L136:\n\tmovl\t24(%rcx), %eax\n.L137:\n\ttestq\t%r15, %r15\n\tje\t.L140\n\taddl\t24(%r15), %eax\n.L140:\n\taddl\t$1, %eax\n.L130:\n\tmovl\t%eax, 24(%r14)\n\tmovq\t%r14, 16(%rbp)\n\ttestq\t%r13, %r13\n\tje\t.L142\n.L127:\n\tmovl\t24(%r13), %eax\n.L128:\n\ttestq\t%r14, %r14\n\tje\t.L142\n\taddl\t24(%r14), %eax\n.L142:\n\taddl\t$1, %eax\n.L144:\n\tmovl\t%eax, 24(%rbp)\n\tmovq\t%rbp, 16(%r12)\n\ttestq\t%rbx, %rbx\n\tje\t.L145\n.L119:\n\tmovl\t24(%rbx), %eax\n.L120:\n\ttestq\t%rbp, %rbp\n\tje\t.L145\n\taddl\t24(%rbp), %eax\n.L145:\n\taddl\t$1, %eax\n.L147:\n\tmovl\t%eax, 24(%r12)\n.L234:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovq\t%r12, %rax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L239:\n\t.cfi_restore_state\n\tmovq\t8(%rbx), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L85\n\tmovl\t24(%rdi), %eax\n.L85:\n\tcmpl\t%eax, %esi\n\tjle\t.L244\n\tmovq\t16(%r14), %rbp\n\tsubl\t%eax, %esi\n\tsubl\t$1, %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L245\n\tmovq\t8(%rbp), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L93\n\tmovl\t24(%rdi), %eax\n.L93:\n\tcmpl\t%eax, %esi\n\tjle\t.L246\n\tsubl\t%eax, %esi\n\tmovq\t16(%rbp), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\tmovq\t8(%rbp), %rsi\n\txorl\t%ecx, %ecx\n\tmovq\t%rax, 16(%rbp)\n\ttestq\t%rsi, %rsi\n\tje\t.L99\n\tmovl\t24(%rsi), %ecx\n.L99:\n\ttestq\t%rax, %rax\n\tje\t.L100\n\taddl\t24(%rax), %ecx\n.L100:\n\tleal\t1(%rcx), %eax\n\tmovq\t8(%r14), %rcx\n\tmovl\t%eax, 24(%rbp)\n\tmovq\t%rbp, 16(%r14)\n\ttestq\t%rcx, %rcx\n\tje\t.L101\n.L97:\n\tmovl\t24(%rcx), %eax\n.L98:\n\ttestq\t%rbp, %rbp\n\tje\t.L101\n\taddl\t24(%rbp), %eax\n.L101:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r14)\n\tmovq\t%rdx, 8(%r12)\n\ttestq\t%rdx, %rdx\n\tje\t.L172\n\tmovl\t24(%rdx), %edx\n.L92:\n\tmovq\t16(%r12), %rax\n\ttestq\t%rax, %rax\n\tje\t.L104\n\taddl\t24(%rax), %edx\n.L104:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%r12)\n\tmovq\t%r12, %rdx\n\tmovq\t%rbx, %r12\n\tjmp\t.L234\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\ttestl\t%esi, %esi\n\tjle\t.L172\n\tmovq\t16(%rdi), %rbp\n\tsubl\t$1, %esi\n\ttestq\t%rbp, %rbp\n\tjne\t.L105\n\txorl\t%edx, %edx\n\tmovl\t$1, %eax\n\tjmp\t.L147\n\t.p2align 4,,10\n\t.p2align 3\n.L240:\n\tmovq\t8(%r13), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L111\n\tmovl\t24(%rdi), %eax\n.L111:\n\tcmpl\t%eax, %esi\n\tjle\t.L247\n\tsubl\t%eax, %esi\n\tmovq\t16(%r13), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\tmovq\t8(%r13), %rsi\n\txorl\t%ecx, %ecx\n\tmovq\t%rax, 16(%r13)\n\ttestq\t%rsi, %rsi\n\tje\t.L116\n\tmovl\t24(%rsi), %ecx\n.L116:\n\ttestq\t%rax, %rax\n\tje\t.L117\n\taddl\t24(%rax), %ecx\n.L117:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, 24(%r13)\n\tmovq\t%rdx, 8(%rbp)\n\ttestq\t%rdx, %rdx\n\tje\t.L162\n\tmovl\t24(%rdx), %esi\n\tmovq\t8(%r12), %r14\n.L110:\n\tmovq\t16(%rbp), %rax\n\ttestq\t%rax, %rax\n\tje\t.L118\n\taddl\t24(%rax), %esi\n.L118:\n\taddl\t$1, %esi\n\tmovq\t%rbp, %rdx\n\tmovq\t%r14, %rbx\n\txorl\t%eax, %eax\n\tmovl\t%esi, 24(%rbp)\n\tmovq\t%r13, %rbp\n\tmovq\t%r13, 16(%r12)\n\ttestq\t%r14, %r14\n\tjne\t.L119\n\tjmp\t.L120\n\t.p2align 4,,10\n\t.p2align 3\n.L244:\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%r14)\n\tmovq\t%rax, %rbx\n\ttestq\t%rdx, %rdx\n\tje\t.L87\n\tmovl\t24(%rdx), %ecx\n.L87:\n\tmovq\t16(%r14), %rax\n\ttestq\t%rax, %rax\n\tje\t.L88\n\taddl\t24(%rax), %ecx\n.L88:\n\tleal\t1(%rcx), %edx\n\tmovl\t%edx, 24(%r14)\n\tmovq\t%r14, 8(%r12)\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L172:\n\txorl\t%edx, %edx\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L151:\n\txorl\t%edx, %edx\n\tjmp\t.L234\n\t.p2align 4,,10\n\t.p2align 3\n.L107:\n\ttestl\t%esi, %esi\n\tje\t.L110\n\tmovq\t16(%rbp), %r14\n\tsubl\t$1, %esi\n\ttestq\t%r14, %r14\n\tjne\t.L121\n\txorl\t%edx, %edx\n\tmovl\t$1, %eax\n\tjmp\t.L144\n\t.p2align 4,,10\n\t.p2align 3\n.L241:\n\tmovq\t%rdx, %rdi\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%r14)\n\ttestq\t%rdx, %rdx\n\tje\t.L125\n\tmovl\t24(%rdx), %ecx\n.L125:\n\tmovq\t16(%r14), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L126\n\taddl\t24(%rdx), %ecx\n.L126:\n\tmovq\t8(%rbp), %r13\n\taddl\t$1, %ecx\n\tmovq\t%r14, %rdx\n\tmovq\t8(%r12), %rbx\n\tmovl\t%ecx, 24(%r14)\n\tmovq\t%rax, %r14\n\tmovq\t%rax, 16(%rbp)\n\txorl\t%eax, %eax\n\ttestq\t%r13, %r13\n\tjne\t.L127\n\tjmp\t.L128\n\t.p2align 4,,10\n\t.p2align 3\n.L243:\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%r15)\n\ttestq\t%rdx, %rdx\n\tje\t.L134\n\tmovl\t24(%rdx), %ecx\n.L134:\n\tmovq\t16(%r15), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L135\n\taddl\t24(%rdx), %ecx\n.L135:\n\taddl\t$1, %ecx\n\tmovq\t%r15, %rdx\n\tmovq\t8(%rbp), %r13\n\tmovq\t8(%r12), %rbx\n\tmovl\t%ecx, 24(%r15)\n\tmovq\t8(%r14), %rcx\n\tmovq\t%rax, %r15\n\tmovq\t%rax, 16(%r14)\n\txorl\t%eax, %eax\n\ttestq\t%rcx, %rcx\n\tjne\t.L136\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L247:\n\tcall\tsplit\n\txorl\t%esi, %esi\n\tmovq\t%rdx, 8(%r13)\n\ttestq\t%rdx, %rdx\n\tje\t.L113\n\tmovl\t24(%rdx), %esi\n.L113:\n\tmovq\t16(%r13), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L114\n\taddl\t24(%rdx), %esi\n.L114:\n\taddl\t$1, %esi\n\tmovl\t%esi, 24(%r13)\n\tmovq\t%r13, 8(%rbp)\n\tmovq\t%rax, %r13\n\tmovq\t8(%r12), %r14\n\tjmp\t.L110\n\t.p2align 4,,10\n\t.p2align 3\n.L246:\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%rbp)\n\ttestq\t%rdx, %rdx\n\tje\t.L95\n\tmovl\t24(%rdx), %ecx\n.L95:\n\tmovq\t16(%rbp), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L96\n\taddl\t24(%rdx), %ecx\n.L96:\n\taddl\t$1, %ecx\n\tmovq\t%rbp, %rdx\n\tmovl\t%ecx, 24(%rbp)\n\tmovq\t8(%r14), %rcx\n\tmovq\t%rax, %rbp\n\tmovq\t%rax, 16(%r14)\n\txorl\t%eax, %eax\n\ttestq\t%rcx, %rcx\n\tjne\t.L97\n\tjmp\t.L98\n\t.p2align 4,,10\n\t.p2align 3\n.L242:\n\tmovl\t$1, %eax\n\ttestq\t%rdx, %rdx\n\tje\t.L130\n\tmovl\t24(%rdx), %eax\n\txorl\t%edx, %edx\n\tjmp\t.L140\n\t.p2align 4,,10\n\t.p2align 3\n.L245:\n\ttestq\t%rdi, %rdi\n\tje\t.L248\n\tmovl\t24(%rdi), %eax\n\txorl\t%edx, %edx\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r14)\n\tmovq\t$0, 8(%r12)\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L162:\n\tmovq\t8(%r12), %r14\n\txorl\t%esi, %esi\n\tjmp\t.L110\n.L248:\n\tmovl\t$1, 24(%r14)\n\txorl\t%edx, %edx\n\tmovq\t$0, 8(%r12)\n\tjmp\t.L92\n\t.cfi_endproc\n.LFE28:\n\t.size\tsplit, .-split\n\t.p2align 4\n\t.globl\tfind\n\t.type\tfind, @function\nfind:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tjmp\t.L257\n\t.p2align 4,,10\n\t.p2align 3\n.L252:\n\tcmpl\t%esi, (%rdi)\n\tje\t.L254\n\tmovq\t8(%rdi), %rax\n\tcmovle\t16(%rdi), %rax\n\tmovq\t%rax, %rdi\n.L257:\n\ttestq\t%rdi, %rdi\n\tjne\t.L252\n\txorl\t%eax, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L254:\n\tmovq\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tfind, .-find\n\t.p2align 4\n\t.globl\tcount_lower\n\t.type\tcount_lower, @function\ncount_lower:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tjne\t.L260\n\tjmp\t.L258\n\t.p2align 4,,10\n\t.p2align 3\n.L274:\n\tmovl\t$1, %edx\n\ttestq\t%rax, %rax\n\tje\t.L262\n\tmovl\t24(%rax), %edx\n\taddl\t$1, %edx\n.L262:\n\tmovq\t16(%rdi), %rdi\n\taddl\t%edx, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L258\n.L260:\n\tmovq\t8(%rdi), %rax\n\tcmpl\t%esi, (%rdi)\n\tjl\t.L274\n\tje\t.L275\n\tmovq\t%rax, %rdi\n\ttestq\t%rdi, %rdi\n\tjne\t.L260\n.L258:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L275:\n\ttestq\t%rax, %rax\n\tje\t.L258\n\taddl\t24(%rax), %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tcount_lower, .-count_lower\n\t.p2align 4\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovl\t%esi, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L282\n\tmovq\t%rdi, %rax\n\txorl\t%esi, %esi\n\tjmp\t.L278\n\t.p2align 4,,10\n\t.p2align 3\n.L293:\n\tmovl\t$1, %ecx\n\ttestq\t%rdx, %rdx\n\tje\t.L280\n\tmovl\t24(%rdx), %ecx\n\taddl\t$1, %ecx\n.L280:\n\tmovq\t16(%rax), %rax\n\taddl\t%ecx, %esi\n\ttestq\t%rax, %rax\n\tje\t.L277\n.L278:\n\tmovq\t8(%rax), %rdx\n\tcmpl\t(%rax), %r8d\n\tjg\t.L293\n\tje\t.L294\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L278\n.L277:\n\tcall\tsplit\n\tmovl\tw.2(%rip), %esi\n\tmovl\tit.1(%rip), %ecx\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%rax, %rdi\n\tmovl\tx.5(%rip), %eax\n\tmovq\t%rdx, %r9\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.3(%rip), %eax\n\tmovl\t%esi, z.3(%rip)\n\tmovl\t%eax, y.4(%rip)\n\tmovl\t%esi, %eax\n\tshrl\t$19, %eax\n\txorl\t%esi, %eax\n\tleaq\tpool.0(%rip), %rsi\n\txorl\t%edx, %eax\n\tshrl\t$8, %edx\n\txorl\t%edx, %eax\n\tmovslq\t%ecx, %rdx\n\taddl\t$1, %ecx\n\tsalq\t$5, %rdx\n\tmovl\t%eax, w.2(%rip)\n\taddq\t%rdx, %rsi\n\tmovl\t%ecx, it.1(%rip)\n\tmovl\t%r8d, (%rsi)\n\tleaq\t8+pool.0(%rip), %r8\n\tmovups\t%xmm0, (%r8,%rdx)\n\tmovl\t$1, 24(%rsi)\n\tmovl\t%eax, 28(%rsi)\n\tcall\tmerge\n\tmovq\t%r9, %rsi\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovq\t%rax, %rdi\n\tjmp\tmerge\n\t.p2align 4,,10\n\t.p2align 3\n.L294:\n\t.cfi_restore_state\n\ttestq\t%rdx, %rdx\n\tje\t.L277\n\taddl\t24(%rdx), %esi\n\tjmp\t.L277\n.L282:\n\txorl\t%esi, %esi\n\tjmp\t.L277\n\t.cfi_endproc\n.LFE31:\n\t.size\tinsert, .-insert\n\t.p2align 4\n\t.globl\terase\n\t.type\terase, @function\nerase:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tje\t.L362\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovq\t%rdi, %r9\n\tmovq\t8(%rdi), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L298\n\tmovl\t24(%rdi), %eax\n.L298:\n\tcmpl\t%eax, %esi\n\tjle\t.L363\n\tsubl\t%eax, %esi\n\tmovq\t16(%r9), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, %r8\n\tmovq\t8(%r9), %rdx\n\tmovq\t%rax, 16(%r9)\n\ttestq\t%rdx, %rdx\n\tje\t.L303\n\tmovl\t24(%rdx), %ecx\n.L303:\n\ttestq\t%rax, %rax\n\tje\t.L304\n\taddl\t24(%rax), %ecx\n.L304:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, 24(%r9)\n\ttestq\t%r8, %r8\n\tje\t.L361\n\tmovq\t8(%r8), %rdi\n\ttestq\t%rdi, %rdi\n\tje\t.L324\n.L367:\n\tmovl\t24(%rdi), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L364\n\tmovl\t$1, %esi\n\tcall\tsplit\n\txorl\t%eax, %eax\n\tmovq\t%rdx, 8(%r8)\n\ttestq\t%rdx, %rdx\n\tje\t.L309\n\tmovl\t24(%rdx), %eax\n.L309:\n\tmovq\t16(%r8), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L310\n\taddl\t24(%rdx), %eax\n.L310:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r8)\n\tjmp\t.L311\n\t.p2align 4,,10\n\t.p2align 3\n.L364:\n\tnegl\t%esi\n.L307:\n\tmovq\t16(%r8), %rdi\n\tcall\tsplit\n\tmovq\t8(%r8), %rsi\n\txorl\t%ecx, %ecx\n\tmovq\t%rax, 16(%r8)\n\ttestq\t%rsi, %rsi\n\tje\t.L312\n\tmovl\t24(%rsi), %ecx\n.L312:\n\ttestq\t%rax, %rax\n\tje\t.L313\n\taddl\t24(%rax), %ecx\n.L313:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, 24(%r8)\n\tmovq\t%rdx, %r8\n.L311:\n\ttestq\t%r9, %r9\n\tje\t.L295\n\ttestq\t%r8, %r8\n\tje\t.L365\n\tmovl\t28(%r8), %eax\n\tcmpl\t%eax, 28(%r9)\n\tja\t.L366\n\tmovq\t8(%r8), %rsi\n\tmovq\t%r9, %rdi\n\tcall\tmerge\n\txorl\t%edx, %edx\n\tmovq\t%rax, 8(%r8)\n\ttestq\t%rax, %rax\n\tje\t.L319\n\tmovl\t24(%rax), %edx\n.L319:\n\tmovq\t16(%r8), %rax\n\ttestq\t%rax, %rax\n\tje\t.L320\n\taddl\t24(%rax), %edx\n.L320:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%r8)\n.L295:\n\tmovq\t%r8, %rax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L366:\n\t.cfi_restore_state\n\tmovq\t16(%r9), %rdi\n\tmovq\t%r8, %rsi\n\tcall\tmerge\n\tmovq\t8(%r9), %rcx\n\txorl\t%edx, %edx\n\tmovq\t%rax, 16(%r9)\n\ttestq\t%rcx, %rcx\n\tje\t.L317\n\tmovl\t24(%rcx), %edx\n.L317:\n\ttestq\t%rax, %rax\n\tje\t.L318\n\taddl\t24(%rax), %edx\n.L318:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%r9)\n.L361:\n\tmovq\t%r9, %r8\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L363:\n\t.cfi_restore_state\n\tcall\tsplit\n\tmovq\t%rdx, %rdi\n\tmovq\t%rdx, 8(%r9)\n\txorl\t%edx, %edx\n\ttestq\t%rdi, %rdi\n\tje\t.L300\n\tmovl\t24(%rdi), %edx\n.L300:\n\tmovq\t16(%r9), %rcx\n\ttestq\t%rcx, %rcx\n\tje\t.L301\n\taddl\t24(%rcx), %edx\n.L301:\n\taddl\t$1, %edx\n\tmovq\t%r9, %r8\n\tmovl\t%edx, 24(%r9)\n\tmovq\t%rax, %r9\n\ttestq\t%rdi, %rdi\n\tjne\t.L367\n.L324:\n\txorl\t%esi, %esi\n\tjmp\t.L307\n\t.p2align 4,,10\n\t.p2align 3\n.L362:\n\t.cfi_def_cfa_offset 8\n\txorl\t%eax, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L365:\n\t.cfi_def_cfa_offset 16\n\ttestq\t%r9, %r9\n\tjne\t.L361\n\tjmp\t.L295\n\t.cfi_endproc\n.LFE32:\n\t.size\terase, .-erase\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\\n\"\n\t.text\n\t.p2align 4\n\t.globl\tprint\n\t.type\tprint, @function\nprint:\n.LFB33:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%rdi, 16(%rsp)\n\ttestq\t%rdi, %rdi\n\tje\t.L368\n\tleaq\t.LC0(%rip), %rbp\n.L369:\n\tmovq\t16(%rsp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, (%rsp)\n\ttestq\t%rax, %rax\n\tje\t.L370\n.L385:\n\tmovq\t(%rsp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestq\t%rax, %rax\n\tje\t.L371\n.L384:\n\tmovq\t8(%rsp), %rax\n\tmovq\t8(%rax), %r15\n\ttestq\t%r15, %r15\n\tje\t.L372\n.L383:\n\tmovq\t8(%r15), %rbx\n\ttestq\t%rbx, %rbx\n\tje\t.L373\n.L382:\n\tmovq\t8(%rbx), %r13\n\ttestq\t%r13, %r13\n\tje\t.L374\n.L381:\n\tmovq\t8(%r13), %r12\n\ttestq\t%r12, %r12\n\tje\t.L375\n.L380:\n\tmovq\t8(%r12), %r14\n\ttestq\t%r14, %r14\n\tje\t.L376\n.L379:\n\tmovq\t8(%r14), %r9\n\ttestq\t%r9, %r9\n\tje\t.L377\n.L378:\n\tmovq\t8(%r9), %rdi\n\tmovq\t%r9, 24(%rsp)\n\tcall\tprint\n\tmovq\t24(%rsp), %r9\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tmovl\t(%r9), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %r9\n\tmovq\t16(%r9), %r9\n\ttestq\t%r9, %r9\n\tjne\t.L378\n.L377:\n\tmovl\t(%r14), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r14), %r14\n\ttestq\t%r14, %r14\n\tjne\t.L379\n.L376:\n\tmovl\t(%r12), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r12), %r12\n\ttestq\t%r12, %r12\n\tjne\t.L380\n.L375:\n\tmovl\t0(%r13), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r13), %r13\n\ttestq\t%r13, %r13\n\tjne\t.L381\n.L374:\n\tmovl\t(%rbx), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rbx\n\ttestq\t%rbx, %rbx\n\tjne\t.L382\n.L373:\n\tmovl\t(%r15), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r15), %r15\n\ttestq\t%r15, %r15\n\tjne\t.L383\n.L372:\n\tmovq\t8(%rsp), %rbx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t(%rbx), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestq\t%rax, %rax\n\tjne\t.L384\n.L371:\n\tmovq\t(%rsp), %rbx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t(%rbx), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rax\n\tmovq\t%rax, (%rsp)\n\ttestq\t%rax, %rax\n\tjne\t.L385\n.L370:\n\tmovq\t16(%rsp), %rbx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t(%rbx), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rax\n\tmovq\t%rax, 16(%rsp)\n\ttestq\t%rax, %rax\n\tjne\t.L369\n.L368:\n\taddq\t$40, %rsp\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tprint, .-print\n\t.section\t.rodata.str1.1\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"1\"\n.LC3:\n\t.string\t\"%d\"\n.LC4:\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.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC3(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 128\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t40(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t40(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 40(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L452\n\tleaq\t52(%rsp), %rax\n\tmovl\t$0, 28(%rsp)\n\tleaq\t44(%rsp), %r14\n\txorl\t%ebp, %ebp\n\tmovq\t%rax, 16(%rsp)\n\tleaq\t48(%rsp), %r15\n\tmovq\t%r14, %r13\n\tleaq\t.LC4(%rip), %r12\n\tleaq\t.LC0(%rip), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L426:\n\tmovq\t%r15, %rdx\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t44(%rsp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L499\n\tcmpl\t$1, %eax\n\tje\t.L500\n\tcmpl\t$2, %eax\n\tje\t.L501\n\tmovq\t16(%rsp), %rsi\n\tleaq\t.LC3(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t48(%rsp), %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L458\n\tmovq\t%rbp, %rax\n\txorl\t%r8d, %r8d\n\tjmp\t.L442\n\t.p2align 4,,10\n\t.p2align 3\n.L502:\n\tmovl\t$1, %ecx\n\ttestq\t%rdx, %rdx\n\tje\t.L445\n\tmovl\t24(%rdx), %ecx\n\taddl\t$1, %ecx\n.L445:\n\tmovq\t16(%rax), %rax\n\taddl\t%ecx, %r8d\n\ttestq\t%rax, %rax\n\tje\t.L443\n.L442:\n\tmovq\t8(%rax), %rdx\n\tcmpl\t(%rax), %esi\n\tjg\t.L502\n\tje\t.L503\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L442\n.L443:\n\tmovl\t52(%rsp), %eax\n\txorl\t%edi, %edi\n\tleal\t1(%rax), %esi\n\tmovq\t%rbp, %rax\n\tjmp\t.L453\n\t.p2align 4,,10\n\t.p2align 3\n.L504:\n\tmovl\t$1, %ecx\n\ttestq\t%rdx, %rdx\n\tje\t.L448\n\tmovl\t24(%rdx), %ecx\n\taddl\t$1, %ecx\n.L448:\n\tmovq\t16(%rax), %rax\n\taddl\t%ecx, %edi\n\ttestq\t%rax, %rax\n\tje\t.L441\n.L453:\n\tmovq\t8(%rax), %rdx\n\tcmpl\t(%rax), %esi\n\tjg\t.L504\n\tje\t.L505\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L453\n.L441:\n\tmovl\t%edi, 52(%rsp)\n\tmovl\t%r8d, %esi\n\tmovq\t%rbp, %rdi\n\tcall\tsplit\n\tmovl\t52(%rsp), %esi\n\tmovq\t%rdx, %rdi\n\tmovq\t%rax, (%rsp)\n\tsubl\t%r8d, %esi\n\tcall\tsplit\n\tmovq\t%rdx, 8(%rsp)\n\tmovq\t%rax, %rbp\n\tmovq\t%rax, %r14\n\ttestq\t%rax, %rax\n\tje\t.L451\n.L450:\n\tmovq\t8(%r14), %rdi\n\tcall\tprint\n\tmovl\t(%r14), %edx\n\tmovq\t%rbx, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r14), %r14\n\ttestq\t%r14, %r14\n\tjne\t.L450\n.L451:\n\tmovq\t(%rsp), %rdi\n\tmovq\t%rbp, %rsi\n\tcall\tmerge\n\tmovq\t8(%rsp), %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rax, %rbp\n.L432:\n\tmovl\t40(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 40(%rsp)\n\ttestl\t%eax, %eax\n\tjne\t.L426\n.L452:\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L506\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L499:\n\t.cfi_restore_state\n\tmovl\t48(%rsp), %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L428\n\tmovq\t%rbp, %rax\n\tjmp\t.L431\n\t.p2align 4,,10\n\t.p2align 3\n.L507:\n\tmovq\t8(%rax), %rdx\n\tcmovge\t16(%rax), %rdx\n\tmovq\t%rdx, %rax\n\ttestq\t%rdx, %rdx\n\tje\t.L428\n.L431:\n\tcmpl\t(%rax), %esi\n\tjne\t.L507\n.L429:\n\tmovl\t28(%rsp), %edx\n\tmovq\t%rbx, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L432\n\t.p2align 4,,10\n\t.p2align 3\n.L501:\n\tmovl\t48(%rsp), %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L432\n\tmovq\t%rbp, %rax\n\tjmp\t.L440\n\t.p2align 4,,10\n\t.p2align 3\n.L508:\n\tmovq\t8(%rax), %rdx\n\tcmovge\t16(%rax), %rdx\n\tmovq\t%rdx, %rax\n\ttestq\t%rdx, %rdx\n\tje\t.L432\n.L440:\n\tcmpl\t(%rax), %esi\n\tjne\t.L508\n\tmovq\t%rbp, %rdi\n\tsubl\t$1, 28(%rsp)\n\tcall\tcount_lower\n\tmovq\t%rbp, %rdi\n\tmovl\t%eax, %esi\n\tcall\terase\n\tmovq\t%rax, %rbp\n\tjmp\t.L432\n\t.p2align 4,,10\n\t.p2align 3\n.L503:\n\ttestq\t%rdx, %rdx\n\tje\t.L443\n\taddl\t24(%rdx), %r8d\n\tjmp\t.L443\n\t.p2align 4,,10\n\t.p2align 3\n.L505:\n\ttestq\t%rdx, %rdx\n\tje\t.L441\n\taddl\t24(%rdx), %edi\n\tjmp\t.L441\n\t.p2align 4,,10\n\t.p2align 3\n.L500:\n\tmovl\t48(%rsp), %ecx\n\tleaq\t.LC1(%rip), %rdi\n\ttestq\t%rbp, %rbp\n\tje\t.L434\n\tmovq\t%rbp, %rax\n\tjmp\t.L436\n\t.p2align 4,,10\n\t.p2align 3\n.L510:\n\tmovq\t8(%rax), %rdx\n\tcmovge\t16(%rax), %rdx\n\tmovq\t%rdx, %rax\n\ttestq\t%rdx, %rdx\n\tje\t.L509\n.L436:\n\tcmpl\t(%rax), %ecx\n\tjne\t.L510\n\tleaq\t.LC2(%rip), %rdi\n.L434:\n\tcall\tputs@PLT\n\tjmp\t.L432\n.L509:\n\tleaq\t.LC1(%rip), %rdi\n\tjmp\t.L434\n.L428:\n\tmovq\t%rbp, %rdi\n\taddl\t$1, 28(%rsp)\n\tcall\tinsert\n\tmovq\t%rax, %rbp\n\tjmp\t.L429\n.L458:\n\txorl\t%edi, %edi\n\txorl\t%r8d, %r8d\n\tjmp\t.L441\n.L506:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE34:\n\t.size\tmain, .-main\n\t.local\tpool.0\n\t.comm\tpool.0,6400000,32\n\t.local\tit.1\n\t.comm\tit.1,4,4\n\t.data\n\t.align 4\n\t.type\tw.2, @object\n\t.size\tw.2, 4\nw.2:\n\t.long\t88675123\n\t.align 4\n\t.type\tz.3, @object\n\t.size\tz.3, 4\nz.3:\n\t.long\t521288629\n\t.align 4\n\t.type\ty.4, @object\n\t.size\ty.4, 4\ny.4:\n\t.long\t362436069\n\t.align 4\n\t.type\tx.5, @object\n\t.size\tx.5, 4\nx.5:\n\t.long\t123456789\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.3(%rip), %eax\n\tmovl\t%ecx, z.3(%rip)\n\tmovl\t%eax, y.4(%rip)\n\tmovl\t%ecx, %eax\n\tshrl\t$19, %eax\n\txorl\t%ecx, %eax\n\txorl\t%edx, %eax\n\tshrl\t$8, %edx\n\txorl\t%edx, %eax\n\tmovl\t%eax, w.2(%rip)\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\txor128, .-xor128\n\t.p2align 4\n\t.globl\tnew_node\n\t.type\tnew_node, @function\nnew_node:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tx.5(%rip), %edx\n\tmovl\tw.2(%rip), %esi\n\tpxor\t%xmm0, %xmm0\n\tmovl\tit.1(%rip), %ecx\n\tmovl\t%edx, %eax\n\tsall\t$11, %eax\n\txorl\t%edx, %eax\n\tmovl\ty.4(%rip), %edx\n\tmovl\t%edx, x.5(%rip)\n\tmovl\tz.3(%rip), %edx\n\tmovl\t%esi, z.3(%rip)\n\tmovl\t%edx, y.4(%rip)\n\tmovl\t%esi, %edx\n\tshrl\t$19, %edx\n\txorl\t%esi, %edx\n\tmovslq\t%ecx, %rsi\n\taddl\t$1, %ecx\n\txorl\t%eax, %edx\n\tshrl\t$8, %eax\n\tmovl\t%ecx, it.1(%rip)\n\txorl\t%eax, %edx\n\tsalq\t$5, %rsi\n\tleaq\tpool.0(%rip), %rax\n\taddq\t%rsi, %rax\n\tmovl\t%edx, w.2(%rip)\n\tmovl\t%edi, (%rax)\n\tleaq\t8+pool.0(%rip), %rdi\n\tmovups\t%xmm0, (%rdi,%rsi)\n\tmovl\t$1, 24(%rax)\n\tmovl\t%edx, 28(%rax)\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tnew_node, .-new_node\n\t.p2align 4\n\t.globl\tcount\n\t.type\tcount, @function\ncount:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L4\n\tmovl\t24(%rdi), %eax\n.L4:\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tcount, .-count\n\t.p2align 4\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t8(%rdi), %rcx\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\ttestq\t%rcx, %rcx\n\tje\t.L9\n\tmovl\t24(%rcx), %edx\n.L9:\n\tmovq\t16(%rax), %rcx\n\ttestq\t%rcx, %rcx\n\tje\t.L10\n\taddl\t24(%rcx), %edx\n.L10:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%rax)\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tupdate, .-update\n\t.p2align 4\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tmovq\t%rdi, %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tmovq\t%rsi, %rbp\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\ttestq\t%rdi, %rdi\n\tje\t.L51\n\ttestq\t%rsi, %rsi\n\tje\t.L51\n\tmovl\t28(%rdi), %eax\n\tmovl\t28(%rsi), %edx\n\tcmpl\t%edx, %eax\n\tja\t.L76\n\tmovq\t8(%rsi), %r12\n\ttestq\t%r12, %r12\n\tje\t.L29\n\tcmpl\t28(%r12), %eax\n\tja\t.L77\n\tmovq\t8(%r12), %r14\n\ttestq\t%r14, %r14\n\tje\t.L34\n\tcmpl\t28(%r14), %eax\n\tja\t.L78\n\tmovq\t8(%r14), %rsi\n\tcall\tmerge\n\tmovq\t%rax, %rdx\n\tmovq\t%rax, 8(%r14)\n\txorl\t%eax, %eax\n\ttestq\t%rdx, %rdx\n\tje\t.L39\n\tmovl\t24(%rdx), %eax\n.L39:\n\tmovq\t16(%r14), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L40\n\taddl\t24(%rdx), %eax\n.L40:\n\taddl\t$1, %eax\n\tmovq\t%r14, %r13\n\tmovl\t%eax, 24(%r14)\n.L38:\n\tmovq\t16(%r12), %rdx\n\tmovq\t%r13, 8(%r12)\n\ttestq\t%rdx, %rdx\n\tje\t.L44\n\taddl\t24(%rdx), %eax\n.L44:\n\taddl\t$1, %eax\n\tmovq\t%r12, %r13\n\tmovl\t%eax, 24(%r12)\n.L33:\n\tmovq\t16(%rbp), %rdx\n\tmovq\t%r13, 8(%rbp)\n\ttestq\t%rdx, %rdx\n\tje\t.L42\n\taddl\t24(%rdx), %eax\n.L42:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%rbp)\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tmovq\t%rbp, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\t.cfi_restore_state\n\tmovq\t16(%rdi), %r12\n\ttestq\t%r12, %r12\n\tje\t.L79\n\tcmpl\t28(%r12), %edx\n\tjb\t.L80\n\tmovq\t8(%rsi), %rsi\n\tmovq\t%r12, %rdi\n\tcall\tmerge\n\txorl\t%edx, %edx\n\tmovq\t%rax, 8(%rbp)\n\ttestq\t%rax, %rax\n\tje\t.L26\n\tmovl\t24(%rax), %edx\n.L26:\n\tmovq\t16(%rbp), %rax\n\ttestq\t%rax, %rax\n\tje\t.L27\n\taddl\t24(%rax), %edx\n.L27:\n\tleal\t1(%rdx), %eax\n\tmovl\t%eax, 24(%rbp)\n.L22:\n\tmovq\t8(%r13), %rdx\n\tmovq\t%rbp, 16(%r13)\n\ttestq\t%rdx, %rdx\n\tje\t.L28\n\taddl\t24(%rdx), %eax\n.L28:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r13)\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tmovq\t%r13, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\t.cfi_restore_state\n\ttestq\t%r13, %r13\n\tmovq\t%r13, %rax\n\tcmove\t%rbp, %rax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L77:\n\t.cfi_restore_state\n\tmovq\t16(%rdi), %rdi\n\tmovq\t%r12, %rsi\n\tcall\tmerge\n\tmovq\t8(%r13), %rcx\n\txorl\t%edx, %edx\n\tmovq\t%rax, 16(%r13)\n\ttestq\t%rcx, %rcx\n\tje\t.L31\n\tmovl\t24(%rcx), %edx\n.L31:\n\ttestq\t%rax, %rax\n\tje\t.L32\n\taddl\t24(%rax), %edx\n.L32:\n\tleal\t1(%rdx), %eax\n\tmovl\t%eax, 24(%r13)\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tmovl\t24(%rsi), %eax\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovl\t24(%rdi), %eax\n\tjmp\t.L33\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovl\t24(%rdi), %eax\n\tjmp\t.L38\n\t.p2align 4,,10\n\t.p2align 3\n.L80:\n\tmovq\t16(%r12), %rdi\n\tcall\tmerge\n\tmovq\t8(%r12), %rcx\n\txorl\t%edx, %edx\n\tmovq\t%rax, 16(%r12)\n\ttestq\t%rcx, %rcx\n\tje\t.L24\n\tmovl\t24(%rcx), %edx\n.L24:\n\ttestq\t%rax, %rax\n\tje\t.L25\n\taddl\t24(%rax), %edx\n.L25:\n\tleal\t1(%rdx), %eax\n\tmovq\t%r12, %rbp\n\tmovl\t%eax, 24(%r12)\n\tjmp\t.L22\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t16(%rdi), %rdi\n\tmovq\t%r14, %rsi\n\tcall\tmerge\n\tmovq\t8(%r13), %rcx\n\tmovq\t%rax, 16(%r13)\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\ttestq\t%rcx, %rcx\n\tje\t.L36\n\tmovl\t24(%rcx), %eax\n.L36:\n\ttestq\t%rdx, %rdx\n\tje\t.L37\n\taddl\t24(%rdx), %eax\n.L37:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r13)\n\tjmp\t.L38\n\t.cfi_endproc\n.LFE27:\n\t.size\tmerge, .-merge\n\t.p2align 4\n\t.globl\tsplit\n\t.type\tsplit, @function\nsplit:\n.LFB28:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%rdi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\ttestq\t%rdi, %rdi\n\tje\t.L151\n\tmovq\t8(%rdi), %rbx\n\tmovq\t%rbx, %r14\n\ttestq\t%rbx, %rbx\n\tje\t.L83\n\tmovl\t24(%rbx), %eax\n\tcmpl\t%eax, %esi\n\tjle\t.L239\n\tmovq\t16(%rdi), %rbp\n\tsubl\t%eax, %esi\n\txorl\t%edx, %edx\n\tsubl\t$1, %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L145\n.L105:\n\tmovq\t8(%rbp), %r13\n\ttestq\t%r13, %r13\n\tje\t.L107\n\tmovl\t24(%r13), %eax\n\tcmpl\t%eax, %esi\n\tjle\t.L240\n\tmovq\t16(%rbp), %r14\n\tsubl\t%eax, %esi\n\txorl\t%edx, %edx\n\tsubl\t$1, %esi\n\ttestq\t%r14, %r14\n\tje\t.L142\n.L121:\n\tmovq\t8(%r14), %rdx\n\txorl\t%eax, %eax\n\ttestq\t%rdx, %rdx\n\tje\t.L123\n\tmovl\t24(%rdx), %eax\n.L123:\n\tcmpl\t%esi, %eax\n\tjge\t.L241\n\tmovq\t16(%r14), %r15\n\tsubl\t%eax, %esi\n\tsubl\t$1, %esi\n\ttestq\t%r15, %r15\n\tje\t.L242\n\tmovq\t8(%r15), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L132\n\tmovl\t24(%rdi), %eax\n.L132:\n\tcmpl\t%eax, %esi\n\tjle\t.L243\n\tsubl\t%eax, %esi\n\tmovq\t16(%r15), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\tmovq\t8(%r15), %rsi\n\tmovq\t%rax, 16(%r15)\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\ttestq\t%rsi, %rsi\n\tje\t.L138\n\tmovl\t24(%rsi), %eax\n.L138:\n\ttestq\t%rcx, %rcx\n\tje\t.L139\n\taddl\t24(%rcx), %eax\n.L139:\n\tmovq\t8(%r14), %rcx\n\taddl\t$1, %eax\n\tmovq\t8(%rbp), %r13\n\tmovl\t%eax, 24(%r15)\n\tmovq\t8(%r12), %rbx\n\tmovq\t%r15, 16(%r14)\n\ttestq\t%rcx, %rcx\n\tje\t.L140\n.L136:\n\tmovl\t24(%rcx), %eax\n.L137:\n\ttestq\t%r15, %r15\n\tje\t.L140\n\taddl\t24(%r15), %eax\n.L140:\n\taddl\t$1, %eax\n.L130:\n\tmovl\t%eax, 24(%r14)\n\tmovq\t%r14, 16(%rbp)\n\ttestq\t%r13, %r13\n\tje\t.L142\n.L127:\n\tmovl\t24(%r13), %eax\n.L128:\n\ttestq\t%r14, %r14\n\tje\t.L142\n\taddl\t24(%r14), %eax\n.L142:\n\taddl\t$1, %eax\n.L144:\n\tmovl\t%eax, 24(%rbp)\n\tmovq\t%rbp, 16(%r12)\n\ttestq\t%rbx, %rbx\n\tje\t.L145\n.L119:\n\tmovl\t24(%rbx), %eax\n.L120:\n\ttestq\t%rbp, %rbp\n\tje\t.L145\n\taddl\t24(%rbp), %eax\n.L145:\n\taddl\t$1, %eax\n.L147:\n\tmovl\t%eax, 24(%r12)\n.L234:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovq\t%r12, %rax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L239:\n\t.cfi_restore_state\n\tmovq\t8(%rbx), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L85\n\tmovl\t24(%rdi), %eax\n.L85:\n\tcmpl\t%eax, %esi\n\tjle\t.L244\n\tmovq\t16(%r14), %rbp\n\tsubl\t%eax, %esi\n\tsubl\t$1, %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L245\n\tmovq\t8(%rbp), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L93\n\tmovl\t24(%rdi), %eax\n.L93:\n\tcmpl\t%eax, %esi\n\tjle\t.L246\n\tsubl\t%eax, %esi\n\tmovq\t16(%rbp), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\tmovq\t8(%rbp), %rsi\n\txorl\t%ecx, %ecx\n\tmovq\t%rax, 16(%rbp)\n\ttestq\t%rsi, %rsi\n\tje\t.L99\n\tmovl\t24(%rsi), %ecx\n.L99:\n\ttestq\t%rax, %rax\n\tje\t.L100\n\taddl\t24(%rax), %ecx\n.L100:\n\tleal\t1(%rcx), %eax\n\tmovq\t8(%r14), %rcx\n\tmovl\t%eax, 24(%rbp)\n\tmovq\t%rbp, 16(%r14)\n\ttestq\t%rcx, %rcx\n\tje\t.L101\n.L97:\n\tmovl\t24(%rcx), %eax\n.L98:\n\ttestq\t%rbp, %rbp\n\tje\t.L101\n\taddl\t24(%rbp), %eax\n.L101:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r14)\n\tmovq\t%rdx, 8(%r12)\n\ttestq\t%rdx, %rdx\n\tje\t.L172\n\tmovl\t24(%rdx), %edx\n.L92:\n\tmovq\t16(%r12), %rax\n\ttestq\t%rax, %rax\n\tje\t.L104\n\taddl\t24(%rax), %edx\n.L104:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%r12)\n\tmovq\t%r12, %rdx\n\tmovq\t%rbx, %r12\n\tjmp\t.L234\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\ttestl\t%esi, %esi\n\tjle\t.L172\n\tmovq\t16(%rdi), %rbp\n\tsubl\t$1, %esi\n\ttestq\t%rbp, %rbp\n\tjne\t.L105\n\txorl\t%edx, %edx\n\tmovl\t$1, %eax\n\tjmp\t.L147\n\t.p2align 4,,10\n\t.p2align 3\n.L240:\n\tmovq\t8(%r13), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L111\n\tmovl\t24(%rdi), %eax\n.L111:\n\tcmpl\t%eax, %esi\n\tjle\t.L247\n\tsubl\t%eax, %esi\n\tmovq\t16(%r13), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\tmovq\t8(%r13), %rsi\n\txorl\t%ecx, %ecx\n\tmovq\t%rax, 16(%r13)\n\ttestq\t%rsi, %rsi\n\tje\t.L116\n\tmovl\t24(%rsi), %ecx\n.L116:\n\ttestq\t%rax, %rax\n\tje\t.L117\n\taddl\t24(%rax), %ecx\n.L117:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, 24(%r13)\n\tmovq\t%rdx, 8(%rbp)\n\ttestq\t%rdx, %rdx\n\tje\t.L162\n\tmovl\t24(%rdx), %esi\n\tmovq\t8(%r12), %r14\n.L110:\n\tmovq\t16(%rbp), %rax\n\ttestq\t%rax, %rax\n\tje\t.L118\n\taddl\t24(%rax), %esi\n.L118:\n\taddl\t$1, %esi\n\tmovq\t%rbp, %rdx\n\tmovq\t%r14, %rbx\n\txorl\t%eax, %eax\n\tmovl\t%esi, 24(%rbp)\n\tmovq\t%r13, %rbp\n\tmovq\t%r13, 16(%r12)\n\ttestq\t%r14, %r14\n\tjne\t.L119\n\tjmp\t.L120\n\t.p2align 4,,10\n\t.p2align 3\n.L244:\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%r14)\n\tmovq\t%rax, %rbx\n\ttestq\t%rdx, %rdx\n\tje\t.L87\n\tmovl\t24(%rdx), %ecx\n.L87:\n\tmovq\t16(%r14), %rax\n\ttestq\t%rax, %rax\n\tje\t.L88\n\taddl\t24(%rax), %ecx\n.L88:\n\tleal\t1(%rcx), %edx\n\tmovl\t%edx, 24(%r14)\n\tmovq\t%r14, 8(%r12)\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L172:\n\txorl\t%edx, %edx\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L151:\n\txorl\t%edx, %edx\n\tjmp\t.L234\n\t.p2align 4,,10\n\t.p2align 3\n.L107:\n\ttestl\t%esi, %esi\n\tje\t.L110\n\tmovq\t16(%rbp), %r14\n\tsubl\t$1, %esi\n\ttestq\t%r14, %r14\n\tjne\t.L121\n\txorl\t%edx, %edx\n\tmovl\t$1, %eax\n\tjmp\t.L144\n\t.p2align 4,,10\n\t.p2align 3\n.L241:\n\tmovq\t%rdx, %rdi\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%r14)\n\ttestq\t%rdx, %rdx\n\tje\t.L125\n\tmovl\t24(%rdx), %ecx\n.L125:\n\tmovq\t16(%r14), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L126\n\taddl\t24(%rdx), %ecx\n.L126:\n\tmovq\t8(%rbp), %r13\n\taddl\t$1, %ecx\n\tmovq\t%r14, %rdx\n\tmovq\t8(%r12), %rbx\n\tmovl\t%ecx, 24(%r14)\n\tmovq\t%rax, %r14\n\tmovq\t%rax, 16(%rbp)\n\txorl\t%eax, %eax\n\ttestq\t%r13, %r13\n\tjne\t.L127\n\tjmp\t.L128\n\t.p2align 4,,10\n\t.p2align 3\n.L243:\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%r15)\n\ttestq\t%rdx, %rdx\n\tje\t.L134\n\tmovl\t24(%rdx), %ecx\n.L134:\n\tmovq\t16(%r15), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L135\n\taddl\t24(%rdx), %ecx\n.L135:\n\taddl\t$1, %ecx\n\tmovq\t%r15, %rdx\n\tmovq\t8(%rbp), %r13\n\tmovq\t8(%r12), %rbx\n\tmovl\t%ecx, 24(%r15)\n\tmovq\t8(%r14), %rcx\n\tmovq\t%rax, %r15\n\tmovq\t%rax, 16(%r14)\n\txorl\t%eax, %eax\n\ttestq\t%rcx, %rcx\n\tjne\t.L136\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L247:\n\tcall\tsplit\n\txorl\t%esi, %esi\n\tmovq\t%rdx, 8(%r13)\n\ttestq\t%rdx, %rdx\n\tje\t.L113\n\tmovl\t24(%rdx), %esi\n.L113:\n\tmovq\t16(%r13), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L114\n\taddl\t24(%rdx), %esi\n.L114:\n\taddl\t$1, %esi\n\tmovl\t%esi, 24(%r13)\n\tmovq\t%r13, 8(%rbp)\n\tmovq\t%rax, %r13\n\tmovq\t8(%r12), %r14\n\tjmp\t.L110\n\t.p2align 4,,10\n\t.p2align 3\n.L246:\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, 8(%rbp)\n\ttestq\t%rdx, %rdx\n\tje\t.L95\n\tmovl\t24(%rdx), %ecx\n.L95:\n\tmovq\t16(%rbp), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L96\n\taddl\t24(%rdx), %ecx\n.L96:\n\taddl\t$1, %ecx\n\tmovq\t%rbp, %rdx\n\tmovl\t%ecx, 24(%rbp)\n\tmovq\t8(%r14), %rcx\n\tmovq\t%rax, %rbp\n\tmovq\t%rax, 16(%r14)\n\txorl\t%eax, %eax\n\ttestq\t%rcx, %rcx\n\tjne\t.L97\n\tjmp\t.L98\n\t.p2align 4,,10\n\t.p2align 3\n.L242:\n\tmovl\t$1, %eax\n\ttestq\t%rdx, %rdx\n\tje\t.L130\n\tmovl\t24(%rdx), %eax\n\txorl\t%edx, %edx\n\tjmp\t.L140\n\t.p2align 4,,10\n\t.p2align 3\n.L245:\n\ttestq\t%rdi, %rdi\n\tje\t.L248\n\tmovl\t24(%rdi), %eax\n\txorl\t%edx, %edx\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r14)\n\tmovq\t$0, 8(%r12)\n\tjmp\t.L92\n\t.p2align 4,,10\n\t.p2align 3\n.L162:\n\tmovq\t8(%r12), %r14\n\txorl\t%esi, %esi\n\tjmp\t.L110\n.L248:\n\tmovl\t$1, 24(%r14)\n\txorl\t%edx, %edx\n\tmovq\t$0, 8(%r12)\n\tjmp\t.L92\n\t.cfi_endproc\n.LFE28:\n\t.size\tsplit, .-split\n\t.p2align 4\n\t.globl\tfind\n\t.type\tfind, @function\nfind:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tjmp\t.L257\n\t.p2align 4,,10\n\t.p2align 3\n.L252:\n\tcmpl\t%esi, (%rdi)\n\tje\t.L254\n\tmovq\t8(%rdi), %rax\n\tcmovle\t16(%rdi), %rax\n\tmovq\t%rax, %rdi\n.L257:\n\ttestq\t%rdi, %rdi\n\tjne\t.L252\n\txorl\t%eax, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L254:\n\tmovq\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tfind, .-find\n\t.p2align 4\n\t.globl\tcount_lower\n\t.type\tcount_lower, @function\ncount_lower:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tjne\t.L260\n\tjmp\t.L258\n\t.p2align 4,,10\n\t.p2align 3\n.L274:\n\tmovl\t$1, %edx\n\ttestq\t%rax, %rax\n\tje\t.L262\n\tmovl\t24(%rax), %edx\n\taddl\t$1, %edx\n.L262:\n\tmovq\t16(%rdi), %rdi\n\taddl\t%edx, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L258\n.L260:\n\tmovq\t8(%rdi), %rax\n\tcmpl\t%esi, (%rdi)\n\tjl\t.L274\n\tje\t.L275\n\tmovq\t%rax, %rdi\n\ttestq\t%rdi, %rdi\n\tjne\t.L260\n.L258:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L275:\n\ttestq\t%rax, %rax\n\tje\t.L258\n\taddl\t24(%rax), %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tcount_lower, .-count_lower\n\t.p2align 4\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovl\t%esi, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L282\n\tmovq\t%rdi, %rax\n\txorl\t%esi, %esi\n\tjmp\t.L278\n\t.p2align 4,,10\n\t.p2align 3\n.L293:\n\tmovl\t$1, %ecx\n\ttestq\t%rdx, %rdx\n\tje\t.L280\n\tmovl\t24(%rdx), %ecx\n\taddl\t$1, %ecx\n.L280:\n\tmovq\t16(%rax), %rax\n\taddl\t%ecx, %esi\n\ttestq\t%rax, %rax\n\tje\t.L277\n.L278:\n\tmovq\t8(%rax), %rdx\n\tcmpl\t(%rax), %r8d\n\tjg\t.L293\n\tje\t.L294\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L278\n.L277:\n\tcall\tsplit\n\tmovl\tw.2(%rip), %esi\n\tmovl\tit.1(%rip), %ecx\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%rax, %rdi\n\tmovl\tx.5(%rip), %eax\n\tmovq\t%rdx, %r9\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.3(%rip), %eax\n\tmovl\t%esi, z.3(%rip)\n\tmovl\t%eax, y.4(%rip)\n\tmovl\t%esi, %eax\n\tshrl\t$19, %eax\n\txorl\t%esi, %eax\n\tleaq\tpool.0(%rip), %rsi\n\txorl\t%edx, %eax\n\tshrl\t$8, %edx\n\txorl\t%edx, %eax\n\tmovslq\t%ecx, %rdx\n\taddl\t$1, %ecx\n\tsalq\t$5, %rdx\n\tmovl\t%eax, w.2(%rip)\n\taddq\t%rdx, %rsi\n\tmovl\t%ecx, it.1(%rip)\n\tmovl\t%r8d, (%rsi)\n\tleaq\t8+pool.0(%rip), %r8\n\tmovups\t%xmm0, (%r8,%rdx)\n\tmovl\t$1, 24(%rsi)\n\tmovl\t%eax, 28(%rsi)\n\tcall\tmerge\n\tmovq\t%r9, %rsi\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovq\t%rax, %rdi\n\tjmp\tmerge\n\t.p2align 4,,10\n\t.p2align 3\n.L294:\n\t.cfi_restore_state\n\ttestq\t%rdx, %rdx\n\tje\t.L277\n\taddl\t24(%rdx), %esi\n\tjmp\t.L277\n.L282:\n\txorl\t%esi, %esi\n\tjmp\t.L277\n\t.cfi_endproc\n.LFE31:\n\t.size\tinsert, .-insert\n\t.p2align 4\n\t.globl\terase\n\t.type\terase, @function\nerase:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tje\t.L362\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovq\t%rdi, %r9\n\tmovq\t8(%rdi), %rdi\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L298\n\tmovl\t24(%rdi), %eax\n.L298:\n\tcmpl\t%eax, %esi\n\tjle\t.L363\n\tsubl\t%eax, %esi\n\tmovq\t16(%r9), %rdi\n\tsubl\t$1, %esi\n\tcall\tsplit\n\txorl\t%ecx, %ecx\n\tmovq\t%rdx, %r8\n\tmovq\t8(%r9), %rdx\n\tmovq\t%rax, 16(%r9)\n\ttestq\t%rdx, %rdx\n\tje\t.L303\n\tmovl\t24(%rdx), %ecx\n.L303:\n\ttestq\t%rax, %rax\n\tje\t.L304\n\taddl\t24(%rax), %ecx\n.L304:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, 24(%r9)\n\ttestq\t%r8, %r8\n\tje\t.L361\n\tmovq\t8(%r8), %rdi\n\ttestq\t%rdi, %rdi\n\tje\t.L324\n.L367:\n\tmovl\t24(%rdi), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L364\n\tmovl\t$1, %esi\n\tcall\tsplit\n\txorl\t%eax, %eax\n\tmovq\t%rdx, 8(%r8)\n\ttestq\t%rdx, %rdx\n\tje\t.L309\n\tmovl\t24(%rdx), %eax\n.L309:\n\tmovq\t16(%r8), %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L310\n\taddl\t24(%rdx), %eax\n.L310:\n\taddl\t$1, %eax\n\tmovl\t%eax, 24(%r8)\n\tjmp\t.L311\n\t.p2align 4,,10\n\t.p2align 3\n.L364:\n\tnegl\t%esi\n.L307:\n\tmovq\t16(%r8), %rdi\n\tcall\tsplit\n\tmovq\t8(%r8), %rsi\n\txorl\t%ecx, %ecx\n\tmovq\t%rax, 16(%r8)\n\ttestq\t%rsi, %rsi\n\tje\t.L312\n\tmovl\t24(%rsi), %ecx\n.L312:\n\ttestq\t%rax, %rax\n\tje\t.L313\n\taddl\t24(%rax), %ecx\n.L313:\n\taddl\t$1, %ecx\n\tmovl\t%ecx, 24(%r8)\n\tmovq\t%rdx, %r8\n.L311:\n\ttestq\t%r9, %r9\n\tje\t.L295\n\ttestq\t%r8, %r8\n\tje\t.L365\n\tmovl\t28(%r8), %eax\n\tcmpl\t%eax, 28(%r9)\n\tja\t.L366\n\tmovq\t8(%r8), %rsi\n\tmovq\t%r9, %rdi\n\tcall\tmerge\n\txorl\t%edx, %edx\n\tmovq\t%rax, 8(%r8)\n\ttestq\t%rax, %rax\n\tje\t.L319\n\tmovl\t24(%rax), %edx\n.L319:\n\tmovq\t16(%r8), %rax\n\ttestq\t%rax, %rax\n\tje\t.L320\n\taddl\t24(%rax), %edx\n.L320:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%r8)\n.L295:\n\tmovq\t%r8, %rax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L366:\n\t.cfi_restore_state\n\tmovq\t16(%r9), %rdi\n\tmovq\t%r8, %rsi\n\tcall\tmerge\n\tmovq\t8(%r9), %rcx\n\txorl\t%edx, %edx\n\tmovq\t%rax, 16(%r9)\n\ttestq\t%rcx, %rcx\n\tje\t.L317\n\tmovl\t24(%rcx), %edx\n.L317:\n\ttestq\t%rax, %rax\n\tje\t.L318\n\taddl\t24(%rax), %edx\n.L318:\n\taddl\t$1, %edx\n\tmovl\t%edx, 24(%r9)\n.L361:\n\tmovq\t%r9, %r8\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L363:\n\t.cfi_restore_state\n\tcall\tsplit\n\tmovq\t%rdx, %rdi\n\tmovq\t%rdx, 8(%r9)\n\txorl\t%edx, %edx\n\ttestq\t%rdi, %rdi\n\tje\t.L300\n\tmovl\t24(%rdi), %edx\n.L300:\n\tmovq\t16(%r9), %rcx\n\ttestq\t%rcx, %rcx\n\tje\t.L301\n\taddl\t24(%rcx), %edx\n.L301:\n\taddl\t$1, %edx\n\tmovq\t%r9, %r8\n\tmovl\t%edx, 24(%r9)\n\tmovq\t%rax, %r9\n\ttestq\t%rdi, %rdi\n\tjne\t.L367\n.L324:\n\txorl\t%esi, %esi\n\tjmp\t.L307\n\t.p2align 4,,10\n\t.p2align 3\n.L362:\n\t.cfi_def_cfa_offset 8\n\txorl\t%eax, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L365:\n\t.cfi_def_cfa_offset 16\n\ttestq\t%r9, %r9\n\tjne\t.L361\n\tjmp\t.L295\n\t.cfi_endproc\n.LFE32:\n\t.size\terase, .-erase\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\\n\"\n\t.text\n\t.p2align 4\n\t.globl\tprint\n\t.type\tprint, @function\nprint:\n.LFB33:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%rdi, 16(%rsp)\n\ttestq\t%rdi, %rdi\n\tje\t.L368\n\tleaq\t.LC0(%rip), %rbp\n.L369:\n\tmovq\t16(%rsp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, (%rsp)\n\ttestq\t%rax, %rax\n\tje\t.L370\n.L385:\n\tmovq\t(%rsp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestq\t%rax, %rax\n\tje\t.L371\n.L384:\n\tmovq\t8(%rsp), %rax\n\tmovq\t8(%rax), %r15\n\ttestq\t%r15, %r15\n\tje\t.L372\n.L383:\n\tmovq\t8(%r15), %rbx\n\ttestq\t%rbx, %rbx\n\tje\t.L373\n.L382:\n\tmovq\t8(%rbx), %r13\n\ttestq\t%r13, %r13\n\tje\t.L374\n.L381:\n\tmovq\t8(%r13), %r12\n\ttestq\t%r12, %r12\n\tje\t.L375\n.L380:\n\tmovq\t8(%r12), %r14\n\ttestq\t%r14, %r14\n\tje\t.L376\n.L379:\n\tmovq\t8(%r14), %r9\n\ttestq\t%r9, %r9\n\tje\t.L377\n.L378:\n\tmovq\t8(%r9), %rdi\n\tmovq\t%r9, 24(%rsp)\n\tcall\tprint\n\tmovq\t24(%rsp), %r9\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tmovl\t(%r9), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %r9\n\tmovq\t16(%r9), %r9\n\ttestq\t%r9, %r9\n\tjne\t.L378\n.L377:\n\tmovl\t(%r14), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r14), %r14\n\ttestq\t%r14, %r14\n\tjne\t.L379\n.L376:\n\tmovl\t(%r12), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r12), %r12\n\ttestq\t%r12, %r12\n\tjne\t.L380\n.L375:\n\tmovl\t0(%r13), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r13), %r13\n\ttestq\t%r13, %r13\n\tjne\t.L381\n.L374:\n\tmovl\t(%rbx), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rbx\n\ttestq\t%rbx, %rbx\n\tjne\t.L382\n.L373:\n\tmovl\t(%r15), %edx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r15), %r15\n\ttestq\t%r15, %r15\n\tjne\t.L383\n.L372:\n\tmovq\t8(%rsp), %rbx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t(%rbx), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestq\t%rax, %rax\n\tjne\t.L384\n.L371:\n\tmovq\t(%rsp), %rbx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t(%rbx), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rax\n\tmovq\t%rax, (%rsp)\n\ttestq\t%rax, %rax\n\tjne\t.L385\n.L370:\n\tmovq\t16(%rsp), %rbx\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tmovl\t(%rbx), %edx\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%rbx), %rax\n\tmovq\t%rax, 16(%rsp)\n\ttestq\t%rax, %rax\n\tjne\t.L369\n.L368:\n\taddq\t$40, %rsp\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tprint, .-print\n\t.section\t.rodata.str1.1\n.LC1:\n\t.string\t\"0\"\n.LC2:\n\t.string\t\"1\"\n.LC3:\n\t.string\t\"%d\"\n.LC4:\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.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC3(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$72, %rsp\n\t.cfi_def_cfa_offset 128\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 56(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t40(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t40(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 40(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L452\n\tleaq\t52(%rsp), %rax\n\tmovl\t$0, 28(%rsp)\n\tleaq\t44(%rsp), %r14\n\txorl\t%ebp, %ebp\n\tmovq\t%rax, 16(%rsp)\n\tleaq\t48(%rsp), %r15\n\tmovq\t%r14, %r13\n\tleaq\t.LC4(%rip), %r12\n\tleaq\t.LC0(%rip), %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L426:\n\tmovq\t%r15, %rdx\n\tmovq\t%r13, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t44(%rsp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L499\n\tcmpl\t$1, %eax\n\tje\t.L500\n\tcmpl\t$2, %eax\n\tje\t.L501\n\tmovq\t16(%rsp), %rsi\n\tleaq\t.LC3(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t48(%rsp), %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L458\n\tmovq\t%rbp, %rax\n\txorl\t%r8d, %r8d\n\tjmp\t.L442\n\t.p2align 4,,10\n\t.p2align 3\n.L502:\n\tmovl\t$1, %ecx\n\ttestq\t%rdx, %rdx\n\tje\t.L445\n\tmovl\t24(%rdx), %ecx\n\taddl\t$1, %ecx\n.L445:\n\tmovq\t16(%rax), %rax\n\taddl\t%ecx, %r8d\n\ttestq\t%rax, %rax\n\tje\t.L443\n.L442:\n\tmovq\t8(%rax), %rdx\n\tcmpl\t(%rax), %esi\n\tjg\t.L502\n\tje\t.L503\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L442\n.L443:\n\tmovl\t52(%rsp), %eax\n\txorl\t%edi, %edi\n\tleal\t1(%rax), %esi\n\tmovq\t%rbp, %rax\n\tjmp\t.L453\n\t.p2align 4,,10\n\t.p2align 3\n.L504:\n\tmovl\t$1, %ecx\n\ttestq\t%rdx, %rdx\n\tje\t.L448\n\tmovl\t24(%rdx), %ecx\n\taddl\t$1, %ecx\n.L448:\n\tmovq\t16(%rax), %rax\n\taddl\t%ecx, %edi\n\ttestq\t%rax, %rax\n\tje\t.L441\n.L453:\n\tmovq\t8(%rax), %rdx\n\tcmpl\t(%rax), %esi\n\tjg\t.L504\n\tje\t.L505\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L453\n.L441:\n\tmovl\t%edi, 52(%rsp)\n\tmovl\t%r8d, %esi\n\tmovq\t%rbp, %rdi\n\tcall\tsplit\n\tmovl\t52(%rsp), %esi\n\tmovq\t%rdx, %rdi\n\tmovq\t%rax, (%rsp)\n\tsubl\t%r8d, %esi\n\tcall\tsplit\n\tmovq\t%rdx, 8(%rsp)\n\tmovq\t%rax, %rbp\n\tmovq\t%rax, %r14\n\ttestq\t%rax, %rax\n\tje\t.L451\n.L450:\n\tmovq\t8(%r14), %rdi\n\tcall\tprint\n\tmovl\t(%r14), %edx\n\tmovq\t%rbx, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t16(%r14), %r14\n\ttestq\t%r14, %r14\n\tjne\t.L450\n.L451:\n\tmovq\t(%rsp), %rdi\n\tmovq\t%rbp, %rsi\n\tcall\tmerge\n\tmovq\t8(%rsp), %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rax, %rbp\n.L432:\n\tmovl\t40(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 40(%rsp)\n\ttestl\t%eax, %eax\n\tjne\t.L426\n.L452:\n\tmovq\t56(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L506\n\taddq\t$72, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L499:\n\t.cfi_restore_state\n\tmovl\t48(%rsp), %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L428\n\tmovq\t%rbp, %rax\n\tjmp\t.L431\n\t.p2align 4,,10\n\t.p2align 3\n.L507:\n\tmovq\t8(%rax), %rdx\n\tcmovge\t16(%rax), %rdx\n\tmovq\t%rdx, %rax\n\ttestq\t%rdx, %rdx\n\tje\t.L428\n.L431:\n\tcmpl\t(%rax), %esi\n\tjne\t.L507\n.L429:\n\tmovl\t28(%rsp), %edx\n\tmovq\t%rbx, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L432\n\t.p2align 4,,10\n\t.p2align 3\n.L501:\n\tmovl\t48(%rsp), %esi\n\ttestq\t%rbp, %rbp\n\tje\t.L432\n\tmovq\t%rbp, %rax\n\tjmp\t.L440\n\t.p2align 4,,10\n\t.p2align 3\n.L508:\n\tmovq\t8(%rax), %rdx\n\tcmovge\t16(%rax), %rdx\n\tmovq\t%rdx, %rax\n\ttestq\t%rdx, %rdx\n\tje\t.L432\n.L440:\n\tcmpl\t(%rax), %esi\n\tjne\t.L508\n\tmovq\t%rbp, %rdi\n\tsubl\t$1, 28(%rsp)\n\tcall\tcount_lower\n\tmovq\t%rbp, %rdi\n\tmovl\t%eax, %esi\n\tcall\terase\n\tmovq\t%rax, %rbp\n\tjmp\t.L432\n\t.p2align 4,,10\n\t.p2align 3\n.L503:\n\ttestq\t%rdx, %rdx\n\tje\t.L443\n\taddl\t24(%rdx), %r8d\n\tjmp\t.L443\n\t.p2align 4,,10\n\t.p2align 3\n.L505:\n\ttestq\t%rdx, %rdx\n\tje\t.L441\n\taddl\t24(%rdx), %edi\n\tjmp\t.L441\n\t.p2align 4,,10\n\t.p2align 3\n.L500:\n\tmovl\t48(%rsp), %ecx\n\tleaq\t.LC1(%rip), %rdi\n\ttestq\t%rbp, %rbp\n\tje\t.L434\n\tmovq\t%rbp, %rax\n\tjmp\t.L436\n\t.p2align 4,,10\n\t.p2align 3\n.L510:\n\tmovq\t8(%rax), %rdx\n\tcmovge\t16(%rax), %rdx\n\tmovq\t%rdx, %rax\n\ttestq\t%rdx, %rdx\n\tje\t.L509\n.L436:\n\tcmpl\t(%rax), %ecx\n\tjne\t.L510\n\tleaq\t.LC2(%rip), %rdi\n.L434:\n\tcall\tputs@PLT\n\tjmp\t.L432\n.L509:\n\tleaq\t.LC1(%rip), %rdi\n\tjmp\t.L434\n.L428:\n\tmovq\t%rbp, %rdi\n\taddl\t$1, 28(%rsp)\n\tcall\tinsert\n\tmovq\t%rax, %rbp\n\tjmp\t.L429\n.L458:\n\txorl\t%edi, %edi\n\txorl\t%r8d, %r8d\n\tjmp\t.L441\n.L506:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE34:\n\t.size\tmain, .-main\n\t.local\tpool.0\n\t.comm\tpool.0,6400000,32\n\t.local\tit.1\n\t.comm\tit.1,4,4\n\t.data\n\t.align 4\n\t.type\tw.2, @object\n\t.size\tw.2, 4\nw.2:\n\t.long\t88675123\n\t.align 4\n\t.type\tz.3, @object\n\t.size\tz.3, 4\nz.3:\n\t.long\t521288629\n\t.align 4\n\t.type\ty.4, @object\n\t.size\ty.4, 4\ny.4:\n\t.long\t362436069\n\t.align 4\n\t.type\tx.5, @object\n\t.size\tx.5, 4\nx.5:\n\t.long\t123456789\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 = w;\n\treturn w = w ^ (w >> 19) ^ (t ^ (t >> 8));\n}\n\ntypedef struct node_t {\n\tint val;\n\tstruct node_t *lch, *rch;\n\tint size;\n\tunsigned int pri;\n} node;\n\nnode* new_node(int val) {\n\tstatic int it = 0;\n\tstatic node pool[200000];\n\tpool[it] = (node) { val, 0, 0, 1, xor128() };\n\treturn &pool[it++];\n}\n\nint count(node *t) {\n\treturn !t ? 0 : t->size;\n}\n\nnode *update(node *t) {\n\tt->size = count(t->lch) + count(t->rch) + 1;\n\treturn t;\n}\n\nnode *merge(node *l, node *r) {\n\tif (!l || !r) return !l ? r : l;\n\tif (l->pri > r->pri) {\n\t\tl->rch = merge(l->rch, r);\n\t\treturn update(l);\n\t}\n\tr->lch = merge(l, r->lch);\n\treturn update(r);\n}\n\ntypedef struct{ node *a, *b; } pnode;\n\npnode split(node *t, int k) {\n\tif (!t) return (pnode) { 0, 0 };\n\tif (k <= count(t->lch)) {\n\t\tpnode s = split(t->lch, k);\n\t\tt->lch = s.b;\n\t\treturn (pnode) { s.a, update(t) };\n\t}\n\tpnode s = split(t->rch, k - count(t->lch) - 1);\n\tt->rch = s.a;\n\treturn (pnode) { update(t), s.b };\n}\n\nnode* find(node *t, int val) {\n\twhile (t) {\n\t\tif (t->val == val) break;\n\t\tt = val < t->val ? t->lch : t->rch;\n\t}\n\treturn t;\n}\n\nint count_lower(node *t, int v) {\n\tif (!t) return 0;\n\tif (t->val < v) return count(t->lch) + 1 + count_lower(t->rch, v);\n\tif (t->val == v) return count(t->lch);\n\treturn count_lower(t->lch, v);\n}\n\nnode *insert(node *t, int val) {\n\tint k = count_lower(t, val);\n\tpnode s = split(t, k);\n\treturn merge(merge(s.a, new_node(val)), s.b);\n}\n\nnode *erase(node *t, int k) {\n\tpnode s1 = split(t, k), s2 = split(s1.b, 1);\n\treturn merge(s1.a, s2.b);\n}\n\nvoid print(node *t) {\n\tif (!t) return;\n\tprint(t->lch);\n\tprintf(\"%d\\n\", t->val);\n\tprint(t->rch);\n}\n\nint main(void)\n{\n\tint q, com, x, l, r, cnt = 0;\n\tnode *root = 0;\n\tpnode p1, p2;\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d%d\", &com, &x);\n\t\tif (com == 0) {\n\t\t\tif (!find(root, x)) ++cnt, root = insert(root, x);\n\t\t\tprintf(\"%d\\n\", cnt);\n\t\t}\n\t\telse if (com == 1) {\n\t\t\tputs(find(root, x) ? \"1\" : \"0\");\n\t\t}\n\t\telse if (com == 2) {\n\t\t\tif (find(root, x)) --cnt, root = erase(root, count_lower(root, x));\n\t\t}\n\t\telse {\n\t\t\tscanf(\"%d\", &r);\n\t\t\tl = count_lower(root, x);\n\t\t\tr = count_lower(root, r + 1);\n\t\t\tp1 = split(root, l), p2 = split(p1.b, r - l);\n\t\t\tprint(p2.a);\n\t\t\troot = merge(merge(p1.a, p2.a), p2.b);\n\t\t}\n\t}\n\treturn 0;\n}\n\n", "index": 73, "inputs": [ "9\n0 1\n0 2\n0 3\n2 2\n1 1\n1 2\n0 3\n0 4\n3 2 4\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 4\n3 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 5\n3 2 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 3\n0 3\n0 5\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n2 1\n1 2\n1 3\n0 4\n3 2 4\n", "9\n0 1\n0 2\n0 3\n2 2\n0 1\n1 2\n0 3\n0 4\n3 2 5\n", "9\n0 1\n0 2\n0 3\n2 2\n1 1\n1 2\n0 3\n0 4\n0 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 4\n1 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n1 5\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n2 0\n1 3\n0 3\n0 5\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n2 2\n1 2\n1 3\n0 4\n3 2 4\n", "9\n0 1\n0 2\n0 3\n2 2\n0 0\n1 2\n0 3\n0 4\n3 2 5\n", "9\n1 1\n0 2\n0 3\n2 2\n1 1\n1 2\n0 3\n0 4\n0 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 2\n0 4\n1 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n2 0\n1 3\n0 3\n0 2\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n2 2\n1 2\n1 3\n0 4\n3 4 4\n", "9\n0 1\n0 2\n0 3\n2 4\n1 0\n1 2\n0 3\n1 4\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 1\n0 3\n0 0\n3 2 15\n", "9\n0 1\n1 2\n0 3\n2 2\n2 0\n1 3\n0 3\n0 2\n3 3 10\n", "9\n0 1\n0 2\n0 6\n2 2\n0 0\n1 2\n0 3\n0 4\n3 2 6\n", "9\n0 2\n0 2\n0 3\n2 2\n1 0\n1 2\n0 2\n0 4\n1 2 8\n", "9\n0 1\n0 2\n0 5\n2 4\n1 0\n1 2\n0 3\n1 4\n3 3 10\n", "9\n0 1\n1 2\n0 3\n2 2\n2 0\n1 3\n0 6\n0 2\n3 3 10\n", "9\n0 1\n0 2\n0 4\n2 2\n1 0\n1 1\n0 3\n0 -1\n3 2 15\n", "9\n0 1\n1 2\n0 3\n2 2\n2 0\n1 3\n0 6\n0 2\n3 2 10\n", "9\n0 3\n0 2\n0 3\n2 2\n1 0\n1 2\n0 2\n0 1\n1 2 8\n", "9\n0 1\n0 2\n0 4\n2 2\n1 0\n2 1\n0 3\n0 -1\n3 2 15\n", "9\n0 1\n0 2\n0 3\n2 2\n1 1\n1 4\n0 3\n0 7\n-1 2 2\n", "9\n0 3\n0 2\n0 3\n2 2\n1 0\n0 2\n0 2\n0 1\n1 2 8\n", "9\n0 1\n0 2\n0 4\n2 2\n0 0\n2 1\n0 3\n0 -1\n3 2 15\n", "9\n0 3\n1 2\n0 3\n2 2\n1 0\n0 2\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n0 3\n2 2\n1 0\n0 1\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n0 6\n2 2\n1 0\n0 1\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n0 6\n2 2\n1 0\n0 2\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n0 6\n3 2\n1 0\n0 2\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n0 6\n3 2\n1 0\n0 2\n0 0\n0 1\n1 2 8\n", "9\n0 3\n1 2\n-1 6\n3 2\n1 0\n0 2\n0 0\n0 1\n1 2 0\n", "9\n0 1\n0 2\n0 3\n2 2\n1 1\n1 2\n1 3\n0 8\n3 2 4\n", "9\n0 1\n0 2\n0 3\n2 2\n1 1\n0 2\n0 3\n0 4\n3 2 5\n", "9\n0 1\n0 2\n0 5\n2 2\n1 0\n1 2\n0 3\n0 4\n3 2 6\n", "9\n0 1\n0 2\n0 3\n3 2\n1 0\n1 2\n0 3\n0 4\n3 2 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 5\n3 0 10\n", "9\n0 1\n0 2\n0 3\n2 2\n2 0\n1 2\n0 3\n0 5\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 3\n0 3\n0 1\n3 3 10\n", "9\n0 1\n0 4\n0 3\n2 2\n1 1\n1 2\n0 3\n0 4\n0 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n1 3\n0 4\n1 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 3\n0 3\n0 4\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 8\n3 2 15\n", "9\n0 1\n0 2\n0 3\n2 2\n2 2\n1 2\n1 4\n0 4\n3 2 4\n", "9\n1 1\n0 2\n0 5\n2 2\n1 1\n1 2\n0 3\n0 4\n0 2 6\n", "9\n0 1\n0 3\n0 3\n2 2\n1 0\n1 2\n0 2\n0 4\n1 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n2 4\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 1\n0 6\n0 5\n3 2 15\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 -1\n3 2 15\n", "9\n0 1\n1 2\n0 3\n2 2\n2 0\n1 3\n1 3\n0 2\n3 3 10\n", "9\n1 1\n0 2\n0 3\n1 2\n1 1\n1 2\n0 3\n0 7\n0 2 2\n", "9\n0 2\n0 2\n0 3\n2 2\n1 0\n0 2\n0 2\n0 4\n1 2 8\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 1\n1 3\n0 -1\n3 2 15\n", "9\n0 1\n1 2\n0 3\n2 2\n2 0\n1 3\n0 6\n0 4\n3 3 10\n", "9\n2 1\n0 2\n0 3\n2 2\n1 1\n1 4\n0 3\n0 7\n0 2 2\n", "9\n0 1\n0 2\n0 5\n2 4\n1 0\n1 2\n0 3\n1 4\n0 3 7\n", "9\n0 1\n0 2\n0 4\n2 2\n0 0\n1 1\n0 3\n0 -1\n3 2 15\n", "9\n0 1\n1 2\n0 3\n2 1\n2 0\n1 3\n0 6\n0 2\n3 2 10\n", "9\n0 1\n0 2\n1 3\n2 2\n1 1\n1 4\n0 3\n0 7\n0 2 2\n", "9\n0 1\n0 0\n0 4\n2 2\n1 0\n2 1\n0 3\n0 -1\n3 2 15\n", "9\n0 3\n0 2\n0 3\n2 2\n2 0\n0 2\n0 2\n0 1\n1 2 8\n", "9\n0 1\n0 2\n0 4\n2 2\n0 0\n2 1\n1 3\n0 -1\n3 2 15\n", "9\n0 3\n1 2\n0 3\n2 2\n2 0\n0 1\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n-1 6\n3 2\n1 1\n0 2\n0 0\n0 1\n1 2 0\n", "9\n0 3\n2 2\n-2 6\n3 2\n1 0\n0 2\n1 0\n0 1\n1 2 0\n", "9\n0 1\n0 1\n0 3\n2 2\n1 1\n1 2\n0 1\n0 4\n3 2 4\n", "9\n0 1\n0 4\n0 3\n2 2\n1 1\n0 2\n0 3\n0 4\n3 2 5\n", "9\n0 1\n0 2\n0 5\n2 0\n1 0\n1 2\n0 3\n0 4\n3 2 6\n", "9\n0 1\n0 4\n0 3\n3 2\n1 0\n1 2\n0 3\n0 4\n3 2 10\n", "9\n0 1\n0 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 3\n3 0 10\n", "9\n0 0\n0 2\n0 3\n2 2\n2 0\n1 2\n0 3\n0 5\n3 3 10\n", "9\n0 1\n0 4\n0 3\n2 2\n1 1\n0 2\n0 3\n0 4\n0 2 6\n", "9\n0 1\n1 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 8\n3 2 15\n", "9\n0 1\n0 2\n0 4\n2 0\n1 0\n1 2\n0 3\n0 5\n3 3 10\n", "9\n0 1\n0 2\n0 3\n2 2\n2 2\n1 2\n1 4\n0 4\n1 2 4\n", "9\n1 1\n0 2\n0 5\n2 2\n2 1\n1 2\n0 3\n0 4\n0 2 6\n", "9\n0 1\n0 2\n0 3\n2 2\n2 0\n1 1\n0 3\n0 2\n3 1 10\n", "9\n0 0\n0 2\n0 3\n2 2\n0 2\n1 2\n1 3\n0 4\n3 4 4\n", "9\n1 1\n0 2\n0 3\n2 2\n0 0\n1 4\n0 3\n0 4\n3 2 6\n", "9\n0 2\n1 2\n0 3\n2 2\n1 0\n1 2\n0 2\n0 4\n2 2 8\n", "9\n0 1\n1 2\n0 3\n2 2\n1 0\n1 2\n0 3\n0 -1\n3 2 15\n", "9\n0 2\n0 2\n0 3\n2 2\n1 0\n0 2\n0 2\n0 4\n1 1 8\n", "9\n0 1\n0 2\n0 5\n2 5\n2 0\n1 2\n0 3\n1 4\n3 3 10\n", "9\n0 1\n1 2\n0 3\n2 2\n2 0\n1 3\n0 11\n0 4\n3 3 10\n", "9\n2 1\n0 2\n0 3\n0 2\n1 1\n1 4\n0 3\n0 7\n0 2 2\n", "9\n0 2\n0 2\n0 3\n2 2\n1 0\n0 4\n0 2\n0 1\n1 2 8\n", "9\n0 1\n0 2\n0 5\n2 4\n2 0\n1 2\n0 3\n1 4\n0 3 7\n", "9\n1 1\n0 2\n0 4\n2 2\n0 0\n1 1\n0 3\n0 -1\n3 2 15\n", "9\n0 1\n1 2\n0 3\n2 1\n2 0\n1 3\n0 6\n0 2\n3 4 10\n", "9\n0 3\n0 2\n0 3\n2 2\n2 0\n0 2\n0 1\n0 1\n1 2 8\n", "9\n0 5\n1 2\n0 3\n2 2\n2 0\n0 1\n0 2\n0 1\n1 2 8\n", "9\n0 3\n1 2\n0 6\n2 2\n1 -1\n0 1\n0 2\n-1 1\n1 2 8\n", "9\n0 3\n1 2\n-1 6\n3 2\n1 0\n0 2\n0 2\n0 1\n1 2 13\n", "9\n0 3\n1 2\n0 6\n3 2\n1 0\n0 2\n0 0\n-1 0\n1 2 0\n", "9\n0 1\n0 1\n0 3\n2 2\n0 1\n1 2\n0 1\n0 4\n3 2 4\n", "9\n0 1\n0 2\n0 3\n2 2\n1 1\n1 2\n1 3\n0 4\n3 2 4\n", "9\n0 1\n0 2\n0 3\n2 2\n1 1\n1 2\n1 3\n0 4\n3 2 4\n" ], "outputs": [ "1\n2\n3\n1\n0\n2\n3\n3\n4\n", "1\n2\n3\n0\n0\n2\n3\n3\n4\n", "1\n2\n3\n0\n0\n2\n3\n3\n5\n", "1\n2\n3\n0\n1\n2\n3\n3\n5\n", "1\n2\n3\n0\n1\n2\n3\n4\n", "1\n2\n3\n2\n0\n2\n3\n3\n4\n", "1\n2\n3\n1\n0\n2\n3\n4\n", "1\n2\n3\n0\n0\n2\n3\n0\n", "1\n2\n3\n0\n0\n2\n0\n3\n", "1\n2\n3\n1\n2\n3\n3\n5\n", "1\n2\n3\n0\n1\n3\n3\n4\n", "1\n2\n3\n3\n0\n3\n4\n3\n4\n", "0\n1\n2\n0\n0\n1\n2\n3\n", "1\n2\n3\n0\n0\n3\n4\n1\n", "1\n2\n3\n1\n2\n3\n3\n", "1\n2\n3\n0\n1\n3\n4\n", "1\n2\n3\n0\n1\n3\n0\n3\n", "1\n2\n3\n0\n1\n2\n3\n3\n", "1\n0\n2\n1\n2\n3\n3\n", "1\n2\n3\n3\n0\n4\n5\n3\n4\n6\n", "1\n1\n2\n0\n0\n2\n3\n1\n", "1\n2\n3\n0\n1\n4\n0\n3\n5\n", "1\n0\n2\n1\n3\n4\n3\n6\n", "1\n2\n3\n0\n1\n3\n4\n3\n4\n", "1\n0\n2\n1\n3\n4\n2\n3\n6\n", "1\n2\n2\n0\n0\n2\n3\n1\n", "1\n2\n3\n0\n2\n3\n3\n4\n", "1\n2\n3\n1\n0\n2\n3\n", "1\n2\n2\n0\n2\n2\n3\n1\n", "1\n2\n3\n3\n3\n4\n3\n4\n", "1\n0\n1\n0\n2\n2\n3\n1\n", "1\n0\n1\n0\n2\n3\n3\n1\n", "1\n0\n2\n0\n3\n4\n4\n1\n", "1\n0\n2\n0\n3\n3\n4\n1\n", "1\n0\n2\n3\n0\n", "1\n0\n2\n3\n3\n0\n", "1\n0\n2\n2\n0\n", "1\n2\n3\n1\n0\n1\n3\n3\n", "1\n2\n3\n1\n3\n3\n4\n2\n3\n4\n", "1\n2\n3\n0\n0\n3\n4\n3\n4\n5\n", "1\n2\n3\n3\n1\n2\n3\n2\n3\n2\n3\n", "1\n2\n3\n0\n0\n2\n3\n1\n3\n5\n", "1\n2\n3\n0\n2\n3\n3\n5\n", "1\n2\n3\n0\n1\n2\n2\n3\n", "1\n2\n3\n1\n0\n3\n3\n4\n", "1\n2\n3\n0\n0\n1\n3\n0\n", "1\n2\n3\n0\n1\n2\n3\n3\n4\n", "1\n2\n3\n0\n0\n2\n3\n3\n8\n", "1\n2\n3\n0\n0\n3\n3\n4\n", "0\n1\n2\n0\n0\n2\n3\n4\n", "1\n2\n2\n0\n0\n3\n4\n1\n", "1\n2\n3\n0\n0\n2\n3\n", "1\n2\n3\n0\n1\n3\n4\n3\n5\n6\n", "1\n2\n3\n0\n0\n2\n3\n3\n", "1\n0\n2\n1\n1\n3\n3\n", "0\n1\n2\n1\n0\n1\n2\n3\n3\n", "1\n1\n2\n0\n2\n2\n3\n1\n", "1\n2\n3\n0\n1\n1\n3\n3\n", "1\n0\n2\n1\n3\n4\n3\n4\n6\n", "1\n2\n0\n0\n1\n2\n3\n", "1\n2\n3\n0\n1\n4\n0\n4\n", "1\n2\n3\n3\n1\n4\n5\n3\n4\n", "1\n0\n2\n1\n2\n3\n2\n3\n6\n", "1\n2\n0\n1\n0\n2\n3\n4\n", "1\n2\n3\n1\n3\n4\n3\n4\n", "1\n2\n2\n2\n2\n3\n1\n", "1\n2\n3\n3\n0\n3\n4\n", "1\n0\n1\n2\n3\n3\n1\n", "1\n0\n0\n2\n0\n", "1\n2\n2\n0\n", "1\n1\n2\n1\n0\n2\n3\n3\n4\n", "1\n2\n3\n1\n4\n4\n4\n2\n3\n4\n", "1\n2\n3\n0\n1\n4\n5\n2\n3\n4\n5\n", "1\n2\n3\n3\n1\n3\n4\n3\n4\n3\n", "1\n2\n3\n0\n0\n2\n2\n1\n3\n", "1\n2\n3\n0\n1\n2\n3\n5\n", "1\n2\n3\n1\n4\n4\n4\n4\n", "1\n0\n2\n0\n0\n2\n3\n3\n8\n", "1\n2\n3\n0\n1\n4\n5\n3\n4\n5\n", "1\n2\n3\n0\n0\n3\n0\n", "0\n1\n2\n0\n2\n3\n4\n", "1\n2\n3\n1\n2\n3\n1\n2\n3\n", "1\n2\n3\n3\n1\n1\n4\n4\n", "0\n1\n2\n2\n0\n2\n3\n3\n4\n", "1\n1\n2\n0\n0\n2\n3\n", "1\n0\n2\n0\n0\n2\n3\n3\n", "1\n1\n2\n0\n2\n2\n3\n0\n", "1\n2\n3\n1\n3\n0\n3\n", "1\n0\n2\n1\n3\n4\n3\n4\n", "1\n2\n2\n0\n0\n2\n3\n3\n", "1\n1\n2\n0\n2\n3\n4\n1\n", "1\n2\n3\n1\n4\n0\n4\n", "0\n1\n2\n2\n0\n3\n4\n3\n4\n", "1\n0\n2\n1\n2\n3\n6\n", "1\n2\n2\n2\n3\n3\n1\n", "1\n0\n2\n3\n4\n4\n1\n", "1\n0\n2\n0\n3\n4\n1\n", "1\n0\n2\n0\n", "1\n0\n2\n3\n3\n4\n", "1\n1\n2\n2\n0\n2\n3\n3\n4\n", "1\n2\n3\n1\n0\n1\n3\n3\n4\n", "1\n2\n3\n1\n0\n1\n3\n3\n4\n" ], "question": "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 = w;\n\treturn w = w ^ (w >> 19) ^ (t ^ (t >> 8));\n}\n\ntypedef struct node_t {\n\tint val;\n\tstruct node_t *lch, *rch;\n\tint size;\n\tunsigned int pri;\n} node;\n\nnode* new_node(int val) {\n\tstatic int it = 0;\n\tstatic node pool[200000];\n\tpool[it] = (node) { val, 0, 0, 1, xor128() };\n\treturn &pool[it++];\n}\n\nint count(node *t) {\n\treturn !t ? 0 : t->size;\n}\n\nnode *update(node *t) {\n\tt->size = count(t->lch) + count(t->rch) + 1;\n\treturn t;\n}\n\nnode *merge(node *l, node *r) {\n\tif (!l || !r) return !l ? r : l;\n\tif (l->pri > r->pri) {\n\t\tl->rch = merge(l->rch, r);\n\t\treturn update(l);\n\t}\n\tr->lch = merge(l, r->lch);\n\treturn update(r);\n}\n\ntypedef struct{ node *a, *b; } pnode;\n\npnode split(node *t, int k) {\n\tif (!t) return (pnode) { 0, 0 };\n\tif (k <= count(t->lch)) {\n\t\tpnode s = split(t->lch, k);\n\t\tt->lch = s.b;\n\t\treturn (pnode) { s.a, update(t) };\n\t}\n\tpnode s = split(t->rch, k - count(t->lch) - 1);\n\tt->rch = s.a;\n\treturn (pnode) { update(t), s.b };\n}\n\nnode* find(node *t, int val) {\n\twhile (t) {\n\t\tif (t->val == val) break;\n\t\tt = val < t->val ? t->lch : t->rch;\n\t}\n\treturn t;\n}\n\nint count_lower(node *t, int v) {\n\tif (!t) return 0;\n\tif (t->val < v) return count(t->lch) + 1 + count_lower(t->rch, v);\n\tif (t->val == v) return count(t->lch);\n\treturn count_lower(t->lch, v);\n}\n\nnode *insert(node *t, int val) {\n\tint k = count_lower(t, val);\n\tpnode s = split(t, k);\n\treturn merge(merge(s.a, new_node(val)), s.b);\n}\n\nnode *erase(node *t, int k) {\n\tpnode s1 = split(t, k), s2 = split(s1.b, 1);\n\treturn merge(s1.a, s2.b);\n}\n\nvoid print(node *t) {\n\tif (!t) return;\n\tprint(t->lch);\n\tprintf(\"%d\\n\", t->val);\n\tprint(t->rch);\n}\n\nint main(void)\n{\n\tint q, com, x, l, r, cnt = 0;\n\tnode *root = 0;\n\tpnode p1, p2;\n\tscanf(\"%d\", &q);\n\twhile (q--) {\n\t\tscanf(\"%d%d\", &com, &x);\n\t\tif (com == 0) {\n\t\t\tif (!find(root, x)) ++cnt, root = insert(root, x);\n\t\t\tprintf(\"%d\\n\", cnt);\n\t\t}\n\t\telse if (com == 1) {\n\t\t\tputs(find(root, x) ? \"1\" : \"0\");\n\t\t}\n\t\telse if (com == 2) {\n\t\t\tif (find(root, x)) --cnt, root = erase(root, count_lower(root, x));\n\t\t}\n\t\telse {\n\t\t\tscanf(\"%d\", &r);\n\t\t\tl = count_lower(root, x);\n\t\t\tr = count_lower(root, r + 1);\n\t\t\tp1 = split(root, l), p2 = split(p1.b, r - l);\n\t\t\tprint(p2.a);\n\t\t\troot = merge(merge(p1.a, p2.a), p2.b);\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\txor128\n\t.type\txor128, @function\nxor128:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\tx.5(%rip), %eax\n\tsall\t$11, %eax\n\tmovl\t%eax, %edx\n\tmovl\tx.5(%rip), %eax\n\txorl\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\ty.4(%rip), %eax\n\tmovl\t%eax, x.5(%rip)\n\tmovl\tz.3(%rip), %eax\n\tmovl\t%eax, y.4(%rip)\n\tmovl\tw.2(%rip), %eax\n\tmovl\t%eax, z.3(%rip)\n\tmovl\tw.2(%rip), %eax\n\tshrl\t$19, %eax\n\tmovl\t%eax, %edx\n\tmovl\tw.2(%rip), %eax\n\txorl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tshrl\t$8, %eax\n\txorl\t-4(%rbp), %eax\n\txorl\t%edx, %eax\n\tmovl\t%eax, w.2(%rip)\n\tmovl\tw.2(%rip), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\txor128, .-xor128\n\t.globl\tnew_node\n\t.type\tnew_node, @function\nnew_node:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -52(%rbp)\n\tmovl\tit.1(%rip), %ebx\n\tmovl\t$0, %eax\n\tcall\txor128\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rsi\n\tsalq\t$5, %rsi\n\tleaq\tpool.0(%rip), %rcx\n\tmovl\t-52(%rbp), %edx\n\tmovl\t%edx, (%rsi,%rcx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t8+pool.0(%rip), %rdx\n\tmovq\t$0, (%rcx,%rdx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t16+pool.0(%rip), %rdx\n\tmovq\t$0, (%rcx,%rdx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t24+pool.0(%rip), %rdx\n\tmovl\t$1, (%rcx,%rdx)\n\tmovslq\t%ebx, %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$5, %rcx\n\tleaq\t28+pool.0(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\tit.1(%rip), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, it.1(%rip)\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tpool.0(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tnew_node, .-new_node\n\t.globl\tcount\n\t.type\tcount, @function\ncount:\n.LFB2:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tje\t.L6\n\tmovq\t-8(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tjmp\t.L8\n.L6:\n\tmovl\t$0, %eax\n.L8:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE2:\n\t.size\tcount, .-count\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB3:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$8, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tmovl\t%eax, %ebx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\taddl\t%ebx, %eax\n\tleal\t1(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%edx, 24(%rax)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE3:\n\t.size\tupdate, .-update\n\t.globl\tmerge\n\t.type\tmerge, @function\nmerge:\n.LFB4:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tje\t.L12\n\tcmpq\t$0, -16(%rbp)\n\tjne\t.L13\n.L12:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L14\n\tmovq\t-16(%rbp), %rax\n\tjmp\t.L16\n.L14:\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L16\n.L13:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t28(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t28(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjbe\t.L17\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rax, 16(%rdx)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n\tjmp\t.L16\n.L17:\n\tmovq\t-16(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t%rax, 8(%rdx)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n.L16:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE4:\n\t.size\tmerge, .-merge\n\t.globl\tsplit\n\t.type\tsplit, @function\nsplit:\n.LFB5:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 13, -24\n\t.cfi_offset 12, -32\n\t.cfi_offset 3, -40\n\tmovq\t%rdi, -56(%rbp)\n\tmovl\t%esi, -60(%rbp)\n\tcmpq\t$0, -56(%rbp)\n\tjne\t.L19\n\tmovl\t$0, %r12d\n\tmovl\t$0, %r13d\n\tjmp\t.L20\n.L19:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tcmpl\t%eax, -60(%rbp)\n\tjg\t.L21\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovl\t-60(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-48(%rbp), %rbx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n\tmovq\t%rbx, %r12\n\tmovq\t%rax, %r13\n\tjmp\t.L20\n.L21:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tmovl\t%eax, %edx\n\tmovl\t-60(%rbp), %eax\n\tsubl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tupdate\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t%rax, %r12\n\tmovq\t%rdx, %r13\n.L20:\n\tmovq\t%r12, %rax\n\tmovq\t%r13, %rdx\n\taddq\t$40, %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE5:\n\t.size\tsplit, .-split\n\t.globl\tfind\n\t.type\tfind, @function\nfind:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovl\t%esi, -12(%rbp)\n\tjmp\t.L24\n.L29:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tje\t.L31\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjge\t.L27\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tjmp\t.L28\n.L27:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n.L28:\n\tmovq\t%rax, -8(%rbp)\n.L24:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L29\n\tjmp\t.L26\n.L31:\n\tnop\n.L26:\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tfind, .-find\n\t.globl\tcount_lower\n\t.type\tcount_lower, @function\ncount_lower:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L33\n\tmovl\t$0, %eax\n\tjmp\t.L34\n.L33:\n\tmovq\t-24(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjle\t.L35\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tleal\t1(%rax), %ebx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovl\t-28(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\taddl\t%ebx, %eax\n\tjmp\t.L34\n.L35:\n\tmovq\t-24(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjne\t.L36\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tcount\n\tjmp\t.L34\n.L36:\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovl\t-28(%rbp), %edx\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n.L34:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tcount_lower, .-count_lower\n\t.globl\tinsert\n\t.type\tinsert, @function\ninsert:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -56(%rbp)\n\tmovl\t%esi, -60(%rbp)\n\tmovl\t-60(%rbp), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t-36(%rbp), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rbx\n\tmovl\t-60(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tnew_node\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tinsert, .-insert\n\t.globl\terase\n\t.type\terase, @function\nerase:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -40(%rbp)\n\tmovl\t%esi, -44(%rbp)\n\tmovl\t-44(%rbp), %edx\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$1, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\terase, .-erase\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tprint\n\t.type\tprint, @function\nprint:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tje\t.L44\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tprint\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t%rax, %rdi\n\tcall\tprint\n\tjmp\t.L41\n.L44:\n\tnop\n.L41:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tprint, .-print\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%d\"\n.LC2:\n\t.string\t\"%d%d\"\n.LC3:\n\t.string\t\"1\"\n.LC4:\n\t.string\t\"0\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$88, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tleaq\t-96(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tjmp\t.L46\n.L53:\n\tleaq\t-88(%rbp), %rdx\n\tleaq\t-92(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-92(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L47\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfind\n\ttestq\t%rax, %rax\n\tjne\t.L48\n\taddl\t$1, -80(%rbp)\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tinsert\n\tmovq\t%rax, -72(%rbp)\n.L48:\n\tmovl\t-80(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L46\n.L47:\n\tmovl\t-92(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L49\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfind\n\ttestq\t%rax, %rax\n\tje\t.L50\n\tleaq\t.LC3(%rip), %rax\n\tjmp\t.L51\n.L50:\n\tleaq\t.LC4(%rip), %rax\n.L51:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L46\n.L49:\n\tmovl\t-92(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L52\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tfind\n\ttestq\t%rax, %rax\n\tje\t.L46\n\tsubl\t$1, -80(%rbp)\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\terase\n\tmovq\t%rax, -72(%rbp)\n\tjmp\t.L46\n.L52:\n\tleaq\t-84(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, -76(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcount_lower\n\tmovl\t%eax, -84(%rbp)\n\tmovl\t-76(%rbp), %edx\n\tmovq\t-72(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tsubl\t-76(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsplit\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tprint\n\tmovq\t-40(%rbp), %rbx\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmerge\n\tmovq\t%rax, -72(%rbp)\n.L46:\n\tmovl\t-96(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -96(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L53\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L55\n\tcall\t__stack_chk_fail@PLT\n.L55:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.data\n\t.align 4\n\t.type\tx.5, @object\n\t.size\tx.5, 4\nx.5:\n\t.long\t123456789\n\t.align 4\n\t.type\ty.4, @object\n\t.size\ty.4, 4\ny.4:\n\t.long\t362436069\n\t.align 4\n\t.type\tz.3, @object\n\t.size\tz.3, 4\nz.3:\n\t.long\t521288629\n\t.align 4\n\t.type\tw.2, @object\n\t.size\tw.2, 4\nw.2:\n\t.long\t88675123\n\t.local\tit.1\n\t.comm\tit.1,4,4\n\t.local\tpool.0\n\t.comm\tpool.0,6400000,32\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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) ^ (t ^ (t >> 8)); } typedef struct node_t { int val; struct node_t *lch, *rch; int size; unsigned int pri; } node; node* new_node(int val) { static int it = 0; static node pool[200000]; pool[it] = (node) { val, 0, 0, 1, xor128() }; return &pool[it++]; } int count(node *t) { return !t ? 0 : t->size; } node *update(node *t) { t->size = count(t->lch) + count(t->rch) + 1; return t; } node *merge(node *l, node *r) { if (!l || !r) return !l ? r : l; if (l->pri > r->pri) { l->rch = merge(l->rch, r); return update(l); } r->lch = merge(l, r->lch); return update(r); } typedef struct{ node *a, *b; } pnode; pnode split(node *t, int k) { if (!t) return (pnode) { 0, 0 }; if (k <= count(t->lch)) { pnode s = split(t->lch, k); t->lch = s.b; return (pnode) { s.a, update(t) }; } pnode s = split(t->rch, k - count(t->lch) - 1); t->rch = s.a; return (pnode) { update(t), s.b }; } node* find(node *t, int val) { while (t) { if (t->val == val) break; t = val < t->val ? t->lch : t->rch; } return t; } int count_lower(node *t, int v) { if (!t) return 0; if (t->val < v) return count(t->lch) + 1 + count_lower(t->rch, v); if (t->val == v) return count(t->lch); return count_lower(t->lch, v); } node *insert(node *t, int val) { int k = count_lower(t, val); pnode s = split(t, k); return merge(merge(s.a, new_node(val)), s.b); } node *erase(node *t, int k) { pnode s1 = split(t, k), s2 = split(s1.b, 1); return merge(s1.a, s2.b); } void print(node *t) { if (!t) return; print(t->lch); printf("%d\n", t->val); print(t->rch); } int main(void) { int q, com, x, l, r, cnt = 0; node *root = 0; pnode p1, p2; scanf("%d", &q); while (q--) { scanf("%d%d", &com, &x); if (com == 0) { if (!find(root, x)) ++cnt, root = insert(root, x); printf("%d\n", cnt); } else if (com == 1) { puts(find(root, x) ? "1" : "0"); } else if (com == 2) { if (find(root, x)) --cnt, root = erase(root, count_lower(root, x)); } else { scanf("%d", &r); l = count_lower(root, x); r = count_lower(root, r + 1); p1 = split(root, l), p2 = split(p1.b, r - l); print(p2.a); root = merge(merge(p1.a, p2.a), p2.b); } } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl xor128 .type xor128, @function xor128: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl x.5(%rip), %eax sall $11, %eax movl %eax, %edx movl x.5(%rip), %eax xorl %edx, %eax movl %eax, -4(%rbp) movl y.4(%rip), %eax movl %eax, x.5(%rip) movl z.3(%rip), %eax movl %eax, y.4(%rip) movl w.2(%rip), %eax movl %eax, z.3(%rip) movl w.2(%rip), %eax shrl $19, %eax movl %eax, %edx movl w.2(%rip), %eax xorl %eax, %edx movl -4(%rbp), %eax shrl $8, %eax xorl -4(%rbp), %eax xorl %edx, %eax movl %eax, w.2(%rip) movl w.2(%rip), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size xor128, .-xor128 .globl new_node .type new_node, @function new_node: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $56, %rsp .cfi_offset 3, -24 movl %edi, -52(%rbp) movl it.1(%rip), %ebx movl $0, %eax call xor128 movslq %ebx, %rdx movq %rdx, %rsi salq $5, %rsi leaq pool.0(%rip), %rcx movl -52(%rbp), %edx movl %edx, (%rsi,%rcx) movslq %ebx, %rdx movq %rdx, %rcx salq $5, %rcx leaq 8+pool.0(%rip), %rdx movq $0, (%rcx,%rdx) movslq %ebx, %rdx movq %rdx, %rcx salq $5, %rcx leaq 16+pool.0(%rip), %rdx movq $0, (%rcx,%rdx) movslq %ebx, %rdx movq %rdx, %rcx salq $5, %rcx leaq 24+pool.0(%rip), %rdx movl $1, (%rcx,%rdx) movslq %ebx, %rdx movq %rdx, %rcx salq $5, %rcx leaq 28+pool.0(%rip), %rdx movl %eax, (%rcx,%rdx) movl it.1(%rip), %eax leal 1(%rax), %edx movl %edx, it.1(%rip) cltq salq $5, %rax movq %rax, %rdx leaq pool.0(%rip), %rax addq %rdx, %rax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size new_node, .-new_node .globl count .type count, @function count: .LFB2: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) cmpq $0, -8(%rbp) je .L6 movq -8(%rbp), %rax movl 24(%rax), %eax jmp .L8 .L6: movl $0, %eax .L8: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE2: .size count, .-count .globl update .type update, @function update: .LFB3: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $8, %rsp .cfi_offset 3, -24 movq %rdi, -16(%rbp) movq -16(%rbp), %rax movq 8(%rax), %rax movq %rax, %rdi call count movl %eax, %ebx movq -16(%rbp), %rax movq 16(%rax), %rax movq %rax, %rdi call count addl %ebx, %eax leal 1(%rax), %edx movq -16(%rbp), %rax movl %edx, 24(%rax) movq -16(%rbp), %rax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE3: .size update, .-update .globl merge .type merge, @function merge: .LFB4: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) cmpq $0, -8(%rbp) je .L12 cmpq $0, -16(%rbp) jne .L13 .L12: cmpq $0, -8(%rbp) jne .L14 movq -16(%rbp), %rax jmp .L16 .L14: movq -8(%rbp), %rax jmp .L16 .L13: movq -8(%rbp), %rax movl 28(%rax), %edx movq -16(%rbp), %rax movl 28(%rax), %eax cmpl %eax, %edx jbe .L17 movq -8(%rbp), %rax movq 16(%rax), %rax movq -16(%rbp), %rdx movq %rdx, %rsi movq %rax, %rdi call merge movq -8(%rbp), %rdx movq %rax, 16(%rdx) movq -8(%rbp), %rax movq %rax, %rdi call update jmp .L16 .L17: movq -16(%rbp), %rax movq 8(%rax), %rdx movq -8(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call merge movq -16(%rbp), %rdx movq %rax, 8(%rdx) movq -16(%rbp), %rax movq %rax, %rdi call update .L16: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE4: .size merge, .-merge .globl split .type split, @function split: .LFB5: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r13 pushq %r12 pushq %rbx subq $40, %rsp .cfi_offset 13, -24 .cfi_offset 12, -32 .cfi_offset 3, -40 movq %rdi, -56(%rbp) movl %esi, -60(%rbp) cmpq $0, -56(%rbp) jne .L19 movl $0, %r12d movl $0, %r13d jmp .L20 .L19: movq -56(%rbp), %rax movq 8(%rax), %rax movq %rax, %rdi call count cmpl %eax, -60(%rbp) jg .L21 movq -56(%rbp), %rax movq 8(%rax), %rax movl -60(%rbp), %edx movl %edx, %esi movq %rax, %rdi call split movq %rax, -48(%rbp) movq %rdx, -40(%rbp) movq -40(%rbp), %rdx movq -56(%rbp), %rax movq %rdx, 8(%rax) movq -48(%rbp), %rbx movq -56(%rbp), %rax movq %rax, %rdi call update movq %rbx, %r12 movq %rax, %r13 jmp .L20 .L21: movq -56(%rbp), %rax movq 8(%rax), %rax movq %rax, %rdi call count movl %eax, %edx movl -60(%rbp), %eax subl %edx, %eax leal -1(%rax), %edx movq -56(%rbp), %rax movq 16(%rax), %rax movl %edx, %esi movq %rax, %rdi call split movq %rax, -48(%rbp) movq %rdx, -40(%rbp) movq -48(%rbp), %rdx movq -56(%rbp), %rax movq %rdx, 16(%rax) movq -56(%rbp), %rax movq %rax, %rdi call update movq -40(%rbp), %rdx movq %rax, %r12 movq %rdx, %r13 .L20: movq %r12, %rax movq %r13, %rdx addq $40, %rsp popq %rbx popq %r12 popq %r13 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE5: .size split, .-split .globl find .type find, @function find: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movl %esi, -12(%rbp) jmp .L24 .L29: movq -8(%rbp), %rax movl (%rax), %eax cmpl %eax, -12(%rbp) je .L31 movq -8(%rbp), %rax movl (%rax), %eax cmpl %eax, -12(%rbp) jge .L27 movq -8(%rbp), %rax movq 8(%rax), %rax jmp .L28 .L27: movq -8(%rbp), %rax movq 16(%rax), %rax .L28: movq %rax, -8(%rbp) .L24: cmpq $0, -8(%rbp) jne .L29 jmp .L26 .L31: nop .L26: movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size find, .-find .globl count_lower .type count_lower, @function count_lower: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $24, %rsp .cfi_offset 3, -24 movq %rdi, -24(%rbp) movl %esi, -28(%rbp) cmpq $0, -24(%rbp) jne .L33 movl $0, %eax jmp .L34 .L33: movq -24(%rbp), %rax movl (%rax), %eax cmpl %eax, -28(%rbp) jle .L35 movq -24(%rbp), %rax movq 8(%rax), %rax movq %rax, %rdi call count leal 1(%rax), %ebx movq -24(%rbp), %rax movq 16(%rax), %rax movl -28(%rbp), %edx movl %edx, %esi movq %rax, %rdi call count_lower addl %ebx, %eax jmp .L34 .L35: movq -24(%rbp), %rax movl (%rax), %eax cmpl %eax, -28(%rbp) jne .L36 movq -24(%rbp), %rax movq 8(%rax), %rax movq %rax, %rdi call count jmp .L34 .L36: movq -24(%rbp), %rax movq 8(%rax), %rax movl -28(%rbp), %edx movl %edx, %esi movq %rax, %rdi call count_lower .L34: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size count_lower, .-count_lower .globl insert .type insert, @function insert: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $56, %rsp .cfi_offset 3, -24 movq %rdi, -56(%rbp) movl %esi, -60(%rbp) movl -60(%rbp), %edx movq -56(%rbp), %rax movl %edx, %esi movq %rax, %rdi call count_lower movl %eax, -36(%rbp) movl -36(%rbp), %edx movq -56(%rbp), %rax movl %edx, %esi movq %rax, %rdi call split movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq -24(%rbp), %rbx movl -60(%rbp), %eax movl %eax, %edi call new_node movq %rax, %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call merge movq %rbx, %rsi movq %rax, %rdi call merge movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size insert, .-insert .globl erase .type erase, @function erase: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %rdi, -40(%rbp) movl %esi, -44(%rbp) movl -44(%rbp), %edx movq -40(%rbp), %rax movl %edx, %esi movq %rax, %rdi call split movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq -24(%rbp), %rax movl $1, %esi movq %rax, %rdi call split movq %rax, -16(%rbp) movq %rdx, -8(%rbp) movq -8(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call merge leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size erase, .-erase .section .rodata .LC0: .string "%d\n" .text .globl print .type print, @function print: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) cmpq $0, -8(%rbp) je .L44 movq -8(%rbp), %rax movq 8(%rax), %rax movq %rax, %rdi call print movq -8(%rbp), %rax movl (%rax), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq -8(%rbp), %rax movq 16(%rax), %rax movq %rax, %rdi call print jmp .L41 .L44: nop .L41: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size print, .-print .section .rodata .LC1: .string "%d" .LC2: .string "%d%d" .LC3: .string "1" .LC4: .string "0" .text .globl main .type main, @function main: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $88, %rsp .cfi_offset 3, -24 movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax movl $0, -80(%rbp) movq $0, -72(%rbp) leaq -96(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT jmp .L46 .L53: leaq -88(%rbp), %rdx leaq -92(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -92(%rbp), %eax testl %eax, %eax jne .L47 movl -88(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call find testq %rax, %rax jne .L48 addl $1, -80(%rbp) movl -88(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call insert movq %rax, -72(%rbp) .L48: movl -80(%rbp), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L46 .L47: movl -92(%rbp), %eax cmpl $1, %eax jne .L49 movl -88(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call find testq %rax, %rax je .L50 leaq .LC3(%rip), %rax jmp .L51 .L50: leaq .LC4(%rip), %rax .L51: movq %rax, %rdi call puts@PLT jmp .L46 .L49: movl -92(%rbp), %eax cmpl $2, %eax jne .L52 movl -88(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call find testq %rax, %rax je .L46 subl $1, -80(%rbp) movl -88(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call count_lower movl %eax, %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call erase movq %rax, -72(%rbp) jmp .L46 .L52: leaq -84(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -88(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call count_lower movl %eax, -76(%rbp) movl -84(%rbp), %eax leal 1(%rax), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call count_lower movl %eax, -84(%rbp) movl -76(%rbp), %edx movq -72(%rbp), %rax movl %edx, %esi movq %rax, %rdi call split movq %rax, -64(%rbp) movq %rdx, -56(%rbp) movl -84(%rbp), %eax subl -76(%rbp), %eax movl %eax, %edx movq -56(%rbp), %rax movl %edx, %esi movq %rax, %rdi call split movq %rax, -48(%rbp) movq %rdx, -40(%rbp) movq -48(%rbp), %rax movq %rax, %rdi call print movq -40(%rbp), %rbx movq -48(%rbp), %rdx movq -64(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call merge movq %rbx, %rsi movq %rax, %rdi call merge movq %rax, -72(%rbp) .L46: movl -96(%rbp), %eax leal -1(%rax), %edx movl %edx, -96(%rbp) testl %eax, %eax jne .L53 movl $0, %eax movq -24(%rbp), %rdx subq %fs:40, %rdx je .L55 call __stack_chk_fail@PLT .L55: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size main, .-main .data .align 4 .type x.5, @object .size x.5, 4 x.5: .long 123456789 .align 4 .type y.4, @object .size y.4, 4 y.4: .long 362436069 .align 4 .type z.3, @object .size z.3, 4 z.3: .long 521288629 .align 4 .type w.2, @object .size w.2, 4 w.2: .long 88675123 .local it.1 .comm it.1,4,4 .local pool.0 .comm pool.0,6400000,32 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 if(str[i] == '?'){\n str[i] = 'D';\n }\n }\n \n printf(\"%s\\n\",str);\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%200000s\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-196608(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3424, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -200020(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-200020(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$63, %al\n\tjne\t.L3\n\tmovl\t-200020(%rbp), %eax\n\tcltq\n\tmovb\t$68, -200016(%rbp,%rax)\n.L3:\n\taddl\t$1, -200020(%rbp)\n.L2:\n\tmovl\t-200020(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.cfi_offset 6, -16\n\tleaq\t-196608(%rsp), %r11\n\t.cfi_def_cfa 11, 196624\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3408, %rsp\n\t.cfi_def_cfa_offset 200032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 200008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t(%rsp), %edx\n\ttestb\t%dl, %dl\n\tje\t.L2\n\tmovq\t%rbp, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tcmpb\t$63, %dl\n\tje\t.L15\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\ttestb\t%dl, %dl\n\tjne\t.L5\n.L2:\n\tmovq\t%rbp, %rdi\n\tcall\tputs@PLT\n\tmovq\t200008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$200016, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\t.cfi_restore_state\n\tmovb\t$68, (%rax)\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\ttestb\t%dl, %dl\n\tjne\t.L5\n\tjmp\t.L2\n.L16:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_offset 6, -16\n\tleaq\t-196608(%rsp), %r11\n\t.cfi_def_cfa 11, 196624\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3408, %rsp\n\t.cfi_def_cfa_offset 200032\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 200008(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t(%rsp), %edx\n\ttestb\t%dl, %dl\n\tje\t.L2\n\tmovq\t%rbp, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tcmpb\t$63, %dl\n\tje\t.L15\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\ttestb\t%dl, %dl\n\tjne\t.L5\n.L2:\n\tmovq\t%rbp, %rdi\n\tcall\tputs@PLT\n\tmovq\t200008(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$200016, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\t.cfi_restore_state\n\tmovb\t$68, (%rax)\n\tmovzbl\t1(%rax), %edx\n\taddq\t$1, %rax\n\ttestb\t%dl, %dl\n\tjne\t.L5\n\tjmp\t.L2\n.L16:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 if(str[i] == '?'){\n str[i] = 'D';\n }\n }\n \n printf(\"%s\\n\",str);\n}", "index": 74, "inputs": [ "PDPD???\n", "?P?P\n", "DDPP???\n", "??PP\n", "DDPO???\n", "??OP\n", "DDPO?>?\n", "??OO\n", "?>?OPDD\n", "@?OP\n", "?>?PPDD\n", "@?PO\n", "DDPP?>?\n", "@?PN\n", "DDPP?>@\n", "NP?@\n", "DDPP??@\n", "@P?N\n", "@DPP??D\n", "@P@N\n", "D??PPD@\n", "?P@N\n", "D??PPC@\n", "NP@?\n", "D??CPP@\n", "N?@P\n", "D??CPPA\n", "P@?N\n", "DC??PPA\n", "PN?@\n", "DP?C?PA\n", "@?NP\n", "DQ?C?PA\n", "A?NP\n", "CQ?C?PA\n", "PN?A\n", "CQ?D?PA\n", "PN?B\n", "AP?D?QC\n", "ON?B\n", "PA?D?QC\n", "OO?B\n", "PA>D?QC\n", "PO?B\n", "PP?B\n", "PA>?DQB\n", "QP?B\n", "PA??DQB\n", "B?PQ\n", "PA??EQB\n", "B?QP\n", "BQE??AP\n", "PQ?B\n", "PA??ERB\n", "Q?PB\n", "PB??ERB\n", "Q?QB\n", "PB??ESB\n", "BQ?Q\n", "BSE??BP\n", "BQQ?\n", "BSE@?BP\n", "AQ?Q\n", "PB?@ESB\n", "AQ>Q\n", "PB?@DSB\n", "AQ>P\n", "PC?@DSB\n", "QA>P\n", "PD?@DSB\n", "QP>A\n", "PD?@DRB\n", "A>PQ\n", "PD?@CRB\n", "A>PP\n", "PD?@CRA\n", "P>AP\n", "ARC@?DP\n", "PA>P\n", "PD?@RCA\n", "PA?P\n", "ACR@?DP\n", "PP?A\n", "ACR@?DO\n", "PQ?A\n", "OD?@RCA\n", "PQ?@\n", "PD@@RCA\n", "PQ@@\n", "ACR@@DP\n", "@@QP\n", "PCR@@DA\n", "PP@@\n", "PC@R@DA\n", "@P@P\n", "AD@R@CP\n", "@Q@P\n", "RD@A@CP\n", "@PP@\n", "PC@A@DR\n", "PD?D??P\n", "PD?D??P\n", "P?P?\n" ], "outputs": [ "PDPDDDD\n", "DPDP\n", "DDPPDDD\n", "DDPP\n", "DDPODDD\n", "DDOP\n", "DDPOD>D\n", "DDOO\n", "D>DOPDD\n", "@DOP\n", "D>DPPDD\n", "@DPO\n", "DDPPD>D\n", "@DPN\n", "DDPPD>@\n", "NPD@\n", "DDPPDD@\n", "@PDN\n", "@DPPDDD\n", "@P@N\n", "DDDPPD@\n", "DP@N\n", "DDDPPC@\n", "NP@D\n", "DDDCPP@\n", "ND@P\n", "DDDCPPA\n", "P@DN\n", "DCDDPPA\n", "PND@\n", "DPDCDPA\n", "@DNP\n", "DQDCDPA\n", "ADNP\n", "CQDCDPA\n", "PNDA\n", "CQDDDPA\n", "PNDB\n", "APDDDQC\n", "ONDB\n", "PADDDQC\n", "OODB\n", "PA>DDQC\n", "PODB\n", "PPDB\n", "PA>DDQB\n", "QPDB\n", "PADDDQB\n", "BDPQ\n", "PADDEQB\n", "BDQP\n", "BQEDDAP\n", "PQDB\n", "PADDERB\n", "QDPB\n", "PBDDERB\n", "QDQB\n", "PBDDESB\n", "BQDQ\n", "BSEDDBP\n", "BQQD\n", "BSE@DBP\n", "AQDQ\n", "PBD@ESB\n", "AQ>Q\n", "PBD@DSB\n", "AQ>P\n", "PCD@DSB\n", "QA>P\n", "PDD@DSB\n", "QP>A\n", "PDD@DRB\n", "A>PQ\n", "PDD@CRB\n", "A>PP\n", "PDD@CRA\n", "P>AP\n", "ARC@DDP\n", "PA>P\n", "PDD@RCA\n", "PADP\n", "ACR@DDP\n", "PPDA\n", "ACR@DDO\n", "PQDA\n", "ODD@RCA\n", "PQD@\n", "PD@@RCA\n", "PQ@@\n", "ACR@@DP\n", "@@QP\n", "PCR@@DA\n", "PP@@\n", "PC@R@DA\n", "@P@P\n", "AD@R@CP\n", "@Q@P\n", "RD@A@CP\n", "@PP@\n", "PC@A@DR\n", "PDDDDDP\n", "PDDDDDP\n", "PDPD\n" ], "question": "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 if(str[i] == '?'){\n str[i] = 'D';\n }\n }\n \n printf(\"%s\\n\",str);\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%200000s\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-196608(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3424, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -200020(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-200020(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\tcmpb\t$63, %al\n\tjne\t.L3\n\tmovl\t-200020(%rbp), %eax\n\tcltq\n\tmovb\t$68, -200016(%rbp,%rax)\n.L3:\n\taddl\t$1, -200020(%rbp)\n.L2:\n\tmovl\t-200020(%rbp), %eax\n\tcltq\n\tmovzbl\t-200016(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L4\n\tleaq\t-200016(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L6\n\tcall\t__stack_chk_fail@PLT\n.L6:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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] == '?'){ str[i] = 'D'; } } printf("%s\n",str); } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%200000s" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -196608(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $3424, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -200016(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -200020(%rbp) jmp .L2 .L4: movl -200020(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax cmpb $63, %al jne .L3 movl -200020(%rbp), %eax cltq movb $68, -200016(%rbp,%rax) .L3: addl $1, -200020(%rbp) .L2: movl -200020(%rbp), %eax cltq movzbl -200016(%rbp,%rax), %eax testb %al, %al jne .L4 leaq -200016(%rbp), %rax movq %rax, %rdi call puts@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L6 call __stack_chk_fail@PLT .L6: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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#define max 200001\n\n//qsort(str, n, sizeof(int), up_comp);\nint up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}\nint down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}\nint int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}\nint count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}\nint euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}\n\nint main(void){\n \n int s;\n \n scanf(\"%d\", &s);\n \n if (s==4||s==2||s==1) {\n printf(\"%d\\n\", 4);\n return 0;\n }\n \n for (int i=2; i<=1000000; i++) {\n if (s%2==0) {\n s=s/2;\n } else {\n s=3*s+1;\n }\n \n if (s==4||s==2||s==1) {\n printf(\"%d\\n\", i+3);\n return 0;\n }\n }\n \n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tup_comp\n\t.type\tup_comp, @function\nup_comp:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tup_comp, .-up_comp\n\t.globl\tdown_comp\n\t.type\tdown_comp, @function\ndown_comp:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tdown_comp, .-down_comp\n\t.globl\tint_sort\n\t.type\tint_sort, @function\nint_sort:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tint_sort, .-int_sort\n\t.globl\tcount_digit\n\t.type\tcount_digit, @function\ncount_digit:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -20(%rbp)\n\taddl\t$1, -4(%rbp)\n.L8:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L9\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tcount_digit, .-count_digit\n\t.globl\teuclid\n\t.type\teuclid, @function\neuclid:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjge\t.L12\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L12:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L13\n\tmovl\t$-1, %eax\n\tjmp\t.L14\n.L13:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L15\n\tmovl\t-24(%rbp), %eax\n\tjmp\t.L14\n.L15:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\teuclid\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\teuclid, .-euclid\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L17\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L17\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L18\n.L17:\n\tmovl\t$4, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L26\n.L18:\n\tmovl\t$2, -12(%rbp)\n\tjmp\t.L20\n.L25:\n\tmovl\t-16(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L21\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L22\n.L21:\n\tmovl\t-16(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -16(%rbp)\n.L22:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L23\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L23\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L24\n.L23:\n\tmovl\t-12(%rbp), %eax\n\taddl\t$3, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L26\n.L24:\n\taddl\t$1, -12(%rbp)\n.L20:\n\tcmpl\t$1000000, -12(%rbp)\n\tjle\t.L25\n\tmovl\t$0, %eax\n.L26:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L27\n\tcall\t__stack_chk_fail@PLT\n.L27:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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, @function\ndown_comp:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tsubl\t(%rdi), %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tdown_comp, .-down_comp\n\t.p2align 4\n\t.globl\tint_sort\n\t.type\tint_sort, @function\nint_sort:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tint_sort, .-int_sort\n\t.p2align 4\n\t.globl\tcount_digit\n\t.type\tcount_digit, @function\ncount_digit:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %edx\n\taddl\t$1, %r8d\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, %edi\n\tjne\t.L7\n.L5:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tcount_digit, .-count_digit\n\t.p2align 4\n\t.globl\teuclid\n\t.type\teuclid, @function\neuclid:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tcmpl\t%esi, %edi\n\tjl\t.L11\n\tmovl\t%esi, %eax\n\tmovl\t%edi, %esi\n\tmovl\t%eax, %edi\n.L11:\n\ttestl\t%edi, %edi\n\tjle\t.L15\n\tmovl\t%esi, %eax\n\tcltd\n\tidivl\t%edi\n\tmovl\t%edx, %esi\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tmovl\t%edi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tmovl\t$-1, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\teuclid, .-euclid\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.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tcmpl\t$1, %edx\n\tjbe\t.L27\n\tmovl\t$2, %edx\n\tcmpl\t$4, %eax\n\tjne\t.L18\n\tjmp\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tleal\t-1(%rax), %ecx\n\tcmpl\t$1, %ecx\n\tjbe\t.L28\n.L34:\n\tcmpl\t$4, %eax\n\tje\t.L28\n\taddl\t$1, %edx\n\tcmpl\t$1000001, %edx\n\tje\t.L20\n.L18:\n\ttestb\t$1, %al\n\tje\t.L33\n\tleal\t1(%rax,%rax,2), %eax\n\tleal\t-1(%rax), %ecx\n\tcmpl\t$1, %ecx\n\tja\t.L34\n.L28:\n\tmovl\t%eax, 4(%rsp)\n\taddl\t$3, %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n.L20:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L35\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L27:\n\t.cfi_restore_state\n\tmovl\t$4, %edx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L20\n.L35:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE56:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, @function\ndown_comp:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tsubl\t(%rdi), %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tdown_comp, .-down_comp\n\t.p2align 4\n\t.globl\tint_sort\n\t.type\tint_sort, @function\nint_sort:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tint_sort, .-int_sort\n\t.p2align 4\n\t.globl\tcount_digit\n\t.type\tcount_digit, @function\ncount_digit:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %edx\n\taddl\t$1, %r8d\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, %edi\n\tjne\t.L7\n.L5:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tcount_digit, .-count_digit\n\t.p2align 4\n\t.globl\teuclid\n\t.type\teuclid, @function\neuclid:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tcmpl\t%esi, %edi\n\tjl\t.L11\n\tmovl\t%esi, %eax\n\tmovl\t%edi, %esi\n\tmovl\t%eax, %edi\n.L11:\n\ttestl\t%edi, %edi\n\tjle\t.L15\n\tmovl\t%esi, %eax\n\tcltd\n\tidivl\t%edi\n\tmovl\t%edx, %esi\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tmovl\t%edi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tmovl\t$-1, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\teuclid, .-euclid\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.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tcmpl\t$1, %edx\n\tjbe\t.L27\n\tmovl\t$2, %edx\n\tcmpl\t$4, %eax\n\tjne\t.L18\n\tjmp\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\taddl\t%ecx, %eax\n\tsarl\t%eax\n\tleal\t-1(%rax), %ecx\n\tcmpl\t$1, %ecx\n\tjbe\t.L28\n.L34:\n\tcmpl\t$4, %eax\n\tje\t.L28\n\taddl\t$1, %edx\n\tcmpl\t$1000001, %edx\n\tje\t.L20\n.L18:\n\ttestb\t$1, %al\n\tje\t.L33\n\tleal\t1(%rax,%rax,2), %eax\n\tleal\t-1(%rax), %ecx\n\tcmpl\t$1, %ecx\n\tja\t.L34\n.L28:\n\tmovl\t%eax, 4(%rsp)\n\taddl\t$3, %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n.L20:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L35\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L27:\n\t.cfi_restore_state\n\tmovl\t$4, %edx\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L20\n.L35:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE56:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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#define max 200001\n\n//qsort(str, n, sizeof(int), up_comp);\nint up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}\nint down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}\nint int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}\nint count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}\nint euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}\n\nint main(void){\n \n int s;\n \n scanf(\"%d\", &s);\n \n if (s==4||s==2||s==1) {\n printf(\"%d\\n\", 4);\n return 0;\n }\n \n for (int i=2; i<=1000000; i++) {\n if (s%2==0) {\n s=s/2;\n } else {\n s=3*s+1;\n }\n \n if (s==4||s==2||s==1) {\n printf(\"%d\\n\", i+3);\n return 0;\n }\n }\n \n return 0;\n}\n", "index": 75, "inputs": [ "87\n", "11\n", "10\n", "82\n", "17\n", "20\n", "65\n", "2\n", "22\n", "43\n", "18\n", "15\n", "27\n", "6\n", "35\n", "5\n", "38\n", "31\n", "28\n", "9\n", "12\n", "25\n", "16\n", "39\n", "55\n", "44\n", "50\n", "41\n", "26\n", "47\n", "59\n", "77\n", "33\n", "108\n", "62\n", "119\n", "211\n", "121\n", "223\n", "107\n", "103\n", "161\n", "220\n", "94\n", "295\n", "306\n", "233\n", "53\n", "409\n", "588\n", "71\n", "643\n", "137\n", "133\n", "126\n", "527\n", "191\n", "79\n", "91\n", "323\n", "206\n", "287\n", "123\n", "146\n", "105\n", "73\n", "143\n", "182\n", "292\n", "111\n", "297\n", "169\n", "159\n", "156\n", "265\n", "505\n", "129\n", "239\n", "235\n", "139\n", "523\n", "178\n", "243\n", "246\n", "447\n", "388\n", "167\n", "199\n", "494\n", "601\n", "171\n", "865\n", "933\n", "2724\n", "2585\n", "365\n", "556\n", "274\n", "1171\n", "335\n", "54\n", "8\n", "7\n", "8\n" ], "outputs": [ "32\n", "16\n", "8\n", "112\n", "14\n", "9\n", "29\n", "4\n", "17\n", "31\n", "22\n", "19\n", "113\n", "10\n", "15\n", "7\n", "23\n", "108\n", "20\n", "21\n", "11\n", "25\n", "6\n", "36\n", "114\n", "18\n", "26\n", "111\n", "12\n", "106\n", "34\n", "24\n", "28\n", "115\n", "109\n", "35\n", "41\n", "97\n", "72\n", "102\n", "89\n", "100\n", "116\n", "107\n", "57\n", "39\n", "85\n", "13\n", "42\n", "120\n", "104\n", "27\n", "92\n", "30\n", "110\n", "81\n", "46\n", "37\n", "94\n", "101\n", "90\n", "44\n", "48\n", "118\n", "40\n", "117\n", "105\n", "95\n", "119\n", "71\n", "75\n", "51\n", "56\n", "38\n", "124\n", "63\n", "123\n", "54\n", "129\n", "43\n", "125\n", "33\n", "98\n", "49\n", "99\n", "122\n", "69\n", "121\n", "50\n", "58\n", "126\n", "149\n", "87\n", "68\n", "55\n", "96\n", "45\n", "93\n", "59\n", "70\n", "114\n", "5\n", "18\n", "5\n" ], "question": "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#define max 200001\n\n//qsort(str, n, sizeof(int), up_comp);\nint up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}\nint down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}\nint int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}\nint count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}\nint euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}\n\nint main(void){\n \n int s;\n \n scanf(\"%d\", &s);\n \n if (s==4||s==2||s==1) {\n printf(\"%d\\n\", 4);\n return 0;\n }\n \n for (int i=2; i<=1000000; i++) {\n if (s%2==0) {\n s=s/2;\n } else {\n s=3*s+1;\n }\n \n if (s==4||s==2||s==1) {\n printf(\"%d\\n\", i+3);\n return 0;\n }\n }\n \n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tup_comp\n\t.type\tup_comp, @function\nup_comp:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tup_comp, .-up_comp\n\t.globl\tdown_comp\n\t.type\tdown_comp, @function\ndown_comp:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tdown_comp, .-down_comp\n\t.globl\tint_sort\n\t.type\tint_sort, @function\nint_sort:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tint_sort, .-int_sort\n\t.globl\tcount_digit\n\t.type\tcount_digit, @function\ncount_digit:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -20(%rbp)\n\taddl\t$1, -4(%rbp)\n.L8:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L9\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tcount_digit, .-count_digit\n\t.globl\teuclid\n\t.type\teuclid, @function\neuclid:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjge\t.L12\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L12:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L13\n\tmovl\t$-1, %eax\n\tjmp\t.L14\n.L13:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L15\n\tmovl\t-24(%rbp), %eax\n\tjmp\t.L14\n.L15:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\teuclid\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\teuclid, .-euclid\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L17\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L17\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L18\n.L17:\n\tmovl\t$4, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L26\n.L18:\n\tmovl\t$2, -12(%rbp)\n\tjmp\t.L20\n.L25:\n\tmovl\t-16(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L21\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L22\n.L21:\n\tmovl\t-16(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -16(%rbp)\n.L22:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$4, %eax\n\tje\t.L23\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L23\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L24\n.L23:\n\tmovl\t-12(%rbp), %eax\n\taddl\t$3, %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L26\n.L24:\n\taddl\t$1, -12(%rbp)\n.L20:\n\tcmpl\t$1000000, -12(%rbp)\n\tjle\t.L25\n\tmovl\t$0, %eax\n.L26:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L27\n\tcall\t__stack_chk_fail@PLT\n.L27:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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, n, sizeof(int), up_comp); int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;} int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;} int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );} int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;} int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);} int main(void){ int s; scanf("%d", &s); if (s==4||s==2||s==1) { printf("%d\n", 4); return 0; } for (int i=2; i<=1000000; i++) { if (s%2==0) { s=s/2; } else { s=3*s+1; } if (s==4||s==2||s==1) { printf("%d\n", i+3); return 0; } } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl up_comp .type up_comp, @function up_comp: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size up_comp, .-up_comp .globl down_comp .type down_comp, @function down_comp: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rax movl (%rax), %edx movq -8(%rbp), %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size down_comp, .-down_comp .globl int_sort .type int_sort, @function int_sort: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size int_sort, .-int_sort .globl count_digit .type count_digit, @function count_digit: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl $0, -4(%rbp) jmp .L8 .L9: movl -20(%rbp), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -20(%rbp) addl $1, -4(%rbp) .L8: cmpl $0, -20(%rbp) jne .L9 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size count_digit, .-count_digit .globl euclid .type euclid, @function euclid: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl -20(%rbp), %eax cmpl -24(%rbp), %eax jge .L12 movl -20(%rbp), %eax movl %eax, -4(%rbp) movl -24(%rbp), %eax movl %eax, -20(%rbp) movl -4(%rbp), %eax movl %eax, -24(%rbp) .L12: cmpl $0, -24(%rbp) jg .L13 movl $-1, %eax jmp .L14 .L13: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %edx, %eax testl %eax, %eax jne .L15 movl -24(%rbp), %eax jmp .L14 .L15: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl -24(%rbp), %eax movl %edx, %esi movl %eax, %edi call euclid .L14: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size euclid, .-euclid .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -16(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -16(%rbp), %eax cmpl $4, %eax je .L17 movl -16(%rbp), %eax cmpl $2, %eax je .L17 movl -16(%rbp), %eax cmpl $1, %eax jne .L18 .L17: movl $4, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L26 .L18: movl $2, -12(%rbp) jmp .L20 .L25: movl -16(%rbp), %eax andl $1, %eax testl %eax, %eax jne .L21 movl -16(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -16(%rbp) jmp .L22 .L21: movl -16(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax addl $1, %eax movl %eax, -16(%rbp) .L22: movl -16(%rbp), %eax cmpl $4, %eax je .L23 movl -16(%rbp), %eax cmpl $2, %eax je .L23 movl -16(%rbp), %eax cmpl $1, %eax jne .L24 .L23: movl -12(%rbp), %eax addl $3, %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L26 .L24: addl $1, -12(%rbp) .L20: cmpl $1000000, -12(%rbp) jle .L25 movl $0, %eax .L26: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L27 call __stack_chk_fail@PLT .L27: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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(\"%d\",&a[i][j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tdp[i][j]=-1;\n\t\t}\n\t}\n\tfor(i=0;i<3;i++) dp[0][i]=a[0][i];\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tfor(k=0;k<3;k++){\n\t\t\t\tif(i+1<n&&k!=j&&dp[i][j]+a[i+1][k]>dp[i+1][k]){\n\t\t\t\t\tdp[i+1][k]=dp[i][j]+a[i+1][k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<3;i++){\n\t\tif(dp[n-1][i]>max){\n\t\t\tmax=dp[n-1][i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tdp\n\t.bss\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 1200012\ndp:\n\t.zero\t1200012\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 1200012\na:\n\t.zero\t1200012\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$-1, -12(%rbp)\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L3\n.L4:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -20(%rbp)\n.L3:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L4\n\taddl\t$1, -24(%rbp)\n.L2:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjl\t.L5\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L6\n.L9:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t$-1, (%rdx,%rax)\n\taddl\t$1, -20(%rbp)\n.L7:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L8\n\taddl\t$1, -24(%rbp)\n.L6:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjl\t.L9\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-24(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tdp(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -24(%rbp)\n.L10:\n\tcmpl\t$2, -24(%rbp)\n\tjle\t.L11\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L12\n.L18:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L13\n.L17:\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L14\n.L16:\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L15\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tje\t.L15\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rsi, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, %ecx\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rsi, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, %ecx\n\tjle\t.L15\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %esi\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\taddl\t%esi, %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rsi, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n.L15:\n\taddl\t$1, -16(%rbp)\n.L14:\n\tcmpl\t$2, -16(%rbp)\n\tjle\t.L16\n\taddl\t$1, -20(%rbp)\n.L13:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L17\n\taddl\t$1, -24(%rbp)\n.L12:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjl\t.L18\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L19\n.L21:\n\tmovl\t-28(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjge\t.L20\n\tmovl\t-28(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n.L20:\n\taddl\t$1, -24(%rbp)\n.L19:\n\tcmpl\t$2, -24(%rbp)\n\tjle\t.L21\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L23\n\tcall\t__stack_chk_fail@PLT\n.L23:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\txorl\t%r12d, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tleaq\t.LC0(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rbp, %rdi\n\tleaq\ta(%rip), %rbx\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tjle\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%rbx, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r12d\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t4(%rbx), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t8(%rbx), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\taddq\t$12, %rbx\n\tcmpl\t%r12d, %ecx\n\tjg\t.L5\n\ttestl\t%ecx, %ecx\n\tjle\t.L3\n\tleal\t-1(%rcx), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L26\n\tmovl\t%ecx, %edx\n\tleaq\tdp(%rip), %r8\n\tpcmpeqd\t%xmm0, %xmm0\n\tshrl\t$2, %edx\n\tleaq\t48(%r8), %rsi\n\tmovq\t%r8, %rax\n\tsubl\t$1, %edx\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tsalq\t$4, %rdx\n\taddq\t%rsi, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovaps\t%xmm0, (%rax)\n\taddq\t$48, %rax\n\tmovaps\t%xmm0, -32(%rax)\n\tmovaps\t%xmm0, -16(%rax)\n\tcmpq\t%rdx, %rax\n\tjne\t.L8\n\tmovl\t%ecx, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %cl\n\tje\t.L9\n.L7:\n\tmovslq\t%eax, %rdx\n\tmovq\t.LC1(%rip), %rsi\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tsalq\t$2, %rdx\n\tmovq\t%rsi, (%r8,%rdx)\n\tmovl\t$-1, 8(%rdx,%r8)\n\tleal\t1(%rax), %edx\n\tcmpl\t%edx, %ecx\n\tjle\t.L9\n\tmovslq\t%edx, %rdx\n\taddl\t$2, %eax\n\timulq\t$12, %rdx, %rdx\n\tmovq\t%rsi, (%r8,%rdx)\n\tmovl\t$-1, 8(%rdx,%r8)\n\tcmpl\t%eax, %ecx\n\tjle\t.L9\n\tcltq\n\timulq\t$12, %rax, %rax\n\tmovq\t%rsi, (%r8,%rax)\n\tmovl\t$-1, 8(%rax,%r8)\n.L9:\n\tmovq\ta(%rip), %rax\n\tleaq\t12+a(%rip), %rdx\n\txorl\t%esi, %esi\n\tmovq\t%rax, dp(%rip)\n\tmovl\t8+a(%rip), %eax\n\tmovl\t%eax, 8+dp(%rip)\n\tleaq\tdp(%rip), %rax\n.L17:\n\taddl\t$1, %esi\n\tcmpl\t%esi, %ecx\n\tjle\t.L10\n.L35:\n\tmovl\t4(%rdx), %edi\n\taddl\t(%rax), %edi\n\tcmpl\t16(%rax), %edi\n\tjle\t.L11\n\tmovl\t%edi, 16(%rax)\n.L11:\n\tmovl\t8(%rdx), %edi\n\taddl\t(%rax), %edi\n\tcmpl\t20(%rax), %edi\n\tjle\t.L12\n\tmovl\t%edi, 20(%rax)\n.L12:\n\tmovl\t(%rdx), %edi\n\taddl\t4(%rax), %edi\n\tcmpl\t12(%rax), %edi\n\tjle\t.L13\n\tmovl\t%edi, 12(%rax)\n.L13:\n\tmovl\t8(%rdx), %edi\n\taddl\t4(%rax), %edi\n\tcmpl\t20(%rax), %edi\n\tjle\t.L14\n\tmovl\t%edi, 20(%rax)\n.L14:\n\tmovl\t(%rdx), %edi\n\taddl\t8(%rax), %edi\n\tcmpl\t12(%rax), %edi\n\tjle\t.L15\n\tmovl\t%edi, 12(%rax)\n.L15:\n\tmovl\t4(%rdx), %edi\n\taddl\t8(%rax), %edi\n\tcmpl\t16(%rax), %edi\n\tjle\t.L16\n\tmovl\t%edi, 16(%rax)\n.L16:\n\taddl\t$1, %esi\n\taddq\t$12, %rax\n\taddq\t$12, %rdx\n\tcmpl\t%esi, %ecx\n\tjg\t.L35\n.L10:\n\taddq\t$12, %rax\n\taddq\t$12, %rdx\n\tcmpl\t%esi, %ecx\n\tjne\t.L17\n.L18:\n\tleal\t-1(%rsi), %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcltq\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%r8,%rax,4), %rdx\n\tmovl\t4(%rdx), %ecx\n\tmovl\t(%rdx), %eax\n\tmovl\t8(%rdx), %edx\n\tcmpl\t%ecx, %eax\n\tcmovl\t%ecx, %eax\n\tmovl\t$-1, %ecx\n\ttestl\t%eax, %eax\n\tcmovs\t%ecx, %eax\n\tcmpl\t%edx, %eax\n\tcmovge\t%eax, %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L36\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L3:\n\t.cfi_restore_state\n\tmovq\ta(%rip), %rax\n\tmovl\t%ecx, %esi\n\tleaq\tdp(%rip), %r8\n\tmovq\t%rax, dp(%rip)\n\tmovl\t8+a(%rip), %eax\n\tmovl\t%eax, 8+dp(%rip)\n\tjmp\t.L18\n.L26:\n\txorl\t%eax, %eax\n\tleaq\tdp(%rip), %r8\n\tjmp\t.L7\n.L36:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 1200012\na:\n\t.zero\t1200012\n\t.globl\tdp\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 1200012\ndp:\n\t.zero\t1200012\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC1:\n\t.long\t-1\n\t.long\t-1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 16\n\t.cfi_offset 12, -16\n\txorl\t%r12d, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tleaq\t.LC0(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rbp, %rdi\n\tleaq\ta(%rip), %rbx\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\ttestl\t%ecx, %ecx\n\tjle\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovq\t%rbx, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r12d\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t4(%rbx), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t8(%rbx), %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %ecx\n\taddq\t$12, %rbx\n\tcmpl\t%r12d, %ecx\n\tjg\t.L5\n\ttestl\t%ecx, %ecx\n\tjle\t.L3\n\tleal\t-1(%rcx), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L26\n\tmovl\t%ecx, %edx\n\tleaq\tdp(%rip), %r8\n\tpcmpeqd\t%xmm0, %xmm0\n\tshrl\t$2, %edx\n\tleaq\t48(%r8), %rsi\n\tmovq\t%r8, %rax\n\tsubl\t$1, %edx\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tsalq\t$4, %rdx\n\taddq\t%rsi, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovaps\t%xmm0, (%rax)\n\taddq\t$48, %rax\n\tmovaps\t%xmm0, -32(%rax)\n\tmovaps\t%xmm0, -16(%rax)\n\tcmpq\t%rdx, %rax\n\tjne\t.L8\n\tmovl\t%ecx, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %cl\n\tje\t.L9\n.L7:\n\tmovslq\t%eax, %rdx\n\tmovq\t.LC1(%rip), %rsi\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tsalq\t$2, %rdx\n\tmovq\t%rsi, (%r8,%rdx)\n\tmovl\t$-1, 8(%rdx,%r8)\n\tleal\t1(%rax), %edx\n\tcmpl\t%edx, %ecx\n\tjle\t.L9\n\tmovslq\t%edx, %rdx\n\taddl\t$2, %eax\n\timulq\t$12, %rdx, %rdx\n\tmovq\t%rsi, (%r8,%rdx)\n\tmovl\t$-1, 8(%rdx,%r8)\n\tcmpl\t%eax, %ecx\n\tjle\t.L9\n\tcltq\n\timulq\t$12, %rax, %rax\n\tmovq\t%rsi, (%r8,%rax)\n\tmovl\t$-1, 8(%rax,%r8)\n.L9:\n\tmovq\ta(%rip), %rax\n\tleaq\t12+a(%rip), %rdx\n\txorl\t%esi, %esi\n\tmovq\t%rax, dp(%rip)\n\tmovl\t8+a(%rip), %eax\n\tmovl\t%eax, 8+dp(%rip)\n\tleaq\tdp(%rip), %rax\n.L17:\n\taddl\t$1, %esi\n\tcmpl\t%esi, %ecx\n\tjle\t.L10\n.L35:\n\tmovl\t4(%rdx), %edi\n\taddl\t(%rax), %edi\n\tcmpl\t16(%rax), %edi\n\tjle\t.L11\n\tmovl\t%edi, 16(%rax)\n.L11:\n\tmovl\t8(%rdx), %edi\n\taddl\t(%rax), %edi\n\tcmpl\t20(%rax), %edi\n\tjle\t.L12\n\tmovl\t%edi, 20(%rax)\n.L12:\n\tmovl\t(%rdx), %edi\n\taddl\t4(%rax), %edi\n\tcmpl\t12(%rax), %edi\n\tjle\t.L13\n\tmovl\t%edi, 12(%rax)\n.L13:\n\tmovl\t8(%rdx), %edi\n\taddl\t4(%rax), %edi\n\tcmpl\t20(%rax), %edi\n\tjle\t.L14\n\tmovl\t%edi, 20(%rax)\n.L14:\n\tmovl\t(%rdx), %edi\n\taddl\t8(%rax), %edi\n\tcmpl\t12(%rax), %edi\n\tjle\t.L15\n\tmovl\t%edi, 12(%rax)\n.L15:\n\tmovl\t4(%rdx), %edi\n\taddl\t8(%rax), %edi\n\tcmpl\t16(%rax), %edi\n\tjle\t.L16\n\tmovl\t%edi, 16(%rax)\n.L16:\n\taddl\t$1, %esi\n\taddq\t$12, %rax\n\taddq\t$12, %rdx\n\tcmpl\t%esi, %ecx\n\tjg\t.L35\n.L10:\n\taddq\t$12, %rax\n\taddq\t$12, %rdx\n\tcmpl\t%esi, %ecx\n\tjne\t.L17\n.L18:\n\tleal\t-1(%rsi), %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcltq\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%r8,%rax,4), %rdx\n\tmovl\t4(%rdx), %ecx\n\tmovl\t(%rdx), %eax\n\tmovl\t8(%rdx), %edx\n\tcmpl\t%ecx, %eax\n\tcmovl\t%ecx, %eax\n\tmovl\t$-1, %ecx\n\ttestl\t%eax, %eax\n\tcmovs\t%ecx, %eax\n\tcmpl\t%edx, %eax\n\tcmovge\t%eax, %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L36\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L3:\n\t.cfi_restore_state\n\tmovq\ta(%rip), %rax\n\tmovl\t%ecx, %esi\n\tleaq\tdp(%rip), %r8\n\tmovq\t%rax, dp(%rip)\n\tmovl\t8+a(%rip), %eax\n\tmovl\t%eax, 8+dp(%rip)\n\tjmp\t.L18\n.L26:\n\txorl\t%eax, %eax\n\tleaq\tdp(%rip), %r8\n\tjmp\t.L7\n.L36:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.globl\ta\n\t.bss\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 1200012\na:\n\t.zero\t1200012\n\t.globl\tdp\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 1200012\ndp:\n\t.zero\t1200012\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC1:\n\t.long\t-1\n\t.long\t-1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(\"%d\",&a[i][j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tdp[i][j]=-1;\n\t\t}\n\t}\n\tfor(i=0;i<3;i++) dp[0][i]=a[0][i];\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tfor(k=0;k<3;k++){\n\t\t\t\tif(i+1<n&&k!=j&&dp[i][j]+a[i+1][k]>dp[i+1][k]){\n\t\t\t\t\tdp[i+1][k]=dp[i][j]+a[i+1][k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<3;i++){\n\t\tif(dp[n-1][i]>max){\n\t\t\tmax=dp[n-1][i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}", "index": 76, "inputs": [ "3\n1 40 70\n20 50 80\n30 60 90\n", "1\n100 16 1\n", "7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 7 1\n", "1\n000 16 1\n", "7\n6 7 14\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 7 1\n", "3\n1 40 34\n20 50 80\n30 35 90\n", "3\n1 76 34\n20 50 80\n30 35 90\n", "1\n000 25 2\n", "7\n5 7 14\n7 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 7 1\n", "3\n0 94 34\n20 50 80\n30 35 90\n", "1\n001 29 2\n", "7\n5 7 14\n7 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 8\n7 7 0\n", "3\n0 94 34\n34 50 80\n30 35 90\n", "1\n101 29 1\n", "3\n-1 24 37\n34 50 80\n30 35 90\n", "3\n-1 24 37\n34 50 80\n30 35 6\n", "7\n3 7 14\n7 8 3\n2 5 2\n7 13 6\n4 6 3\n3 3 8\n4 7 0\n", "3\n-1 24 37\n34 50 149\n30 35 6\n", "7\n3 7 14\n7 8 3\n1 5 2\n12 13 6\n4 6 3\n3 3 8\n4 7 0\n", "3\n-1 35 53\n34 50 149\n30 35 5\n", "3\n-1 35 53\n34 50 149\n30 8 5\n", "1\n110 1 0\n", "7\n3 7 14\n11 8 3\n1 5 2\n12 13 6\n4 6 1\n3 3 8\n4 3 -1\n", "3\n-1 35 53\n15 50 149\n19 8 5\n", "3\n-1 35 56\n15 50 48\n19 8 5\n", "7\n3 7 14\n11 8 3\n2 5 2\n12 13 6\n4 8 1\n3 3 8\n2 3 -1\n", "3\n-1 35 9\n15 50 48\n19 8 5\n", "1\n010 3 0\n", "1\n011 3 1\n", "7\n3 7 14\n11 9 0\n4 5 3\n15 13 6\n4 8 1\n3 3 7\n2 3 -1\n", "7\n3 7 19\n11 8 0\n4 5 3\n15 14 6\n4 8 1\n3 3 7\n2 3 -1\n", "7\n3 7 19\n11 8 0\n4 4 3\n15 14 6\n4 8 1\n3 3 7\n2 3 -1\n", "7\n3 7 19\n11 8 0\n4 4 3\n15 14 6\n4 8 1\n3 3 7\n2 1 -1\n", "3\n-1 35 0\n1 15 18\n19 4 3\n", "7\n3 7 16\n22 8 0\n4 4 3\n15 14 6\n4 8 1\n3 3 7\n2 1 -1\n", "1\n001 3 0\n", "3\n-1 38 0\n1 15 18\n19 7 3\n", "7\n3 6 16\n22 8 0\n4 4 6\n15 14 6\n4 8 1\n3 3 7\n2 1 -1\n", "3\n-1 38 0\n1 15 18\n31 14 3\n", "1\n001 4 0\n", "1\n001 6 0\n", "3\n-1 41 0\n1 15 18\n31 13 3\n", "7\n3 2 16\n1 8 0\n4 4 6\n15 4 6\n4 8 2\n2 3 7\n2 1 -1\n", "7\n3 2 16\n1 8 0\n4 4 12\n15 8 6\n4 5 1\n2 3 7\n1 1 -1\n", "3\n0 41 -1\n1 9 25\n31 5 1\n", "1\n111 5 -3\n", "3\n0 41 -1\n1 9 25\n11 5 1\n", "3\n0 61 -1\n0 9 10\n11 5 1\n", "7\n3 1 16\n1 8 0\n0 3 19\n15 6 6\n4 5 1\n1 2 7\n1 1 -1\n", "3\n-1 61 -2\n0 9 10\n7 5 1\n", "7\n3 1 31\n1 8 0\n0 3 19\n15 6 6\n4 5 1\n1 2 7\n1 1 -1\n", "3\n-1 61 -2\n0 17 5\n7 5 1\n", "7\n3 1 31\n1 8 0\n-1 2 2\n15 6 6\n4 5 0\n1 2 7\n1 0 -1\n", "1\n001 0 -1\n", "7\n3 1 31\n1 8 0\n0 2 2\n27 7 6\n4 8 0\n1 2 7\n1 0 -1\n", "3\n-1 47 -1\n0 17 5\n5 0 3\n", "7\n3 1 31\n1 8 0\n0 2 -1\n27 7 6\n4 8 0\n0 2 7\n1 0 -1\n", "3\n-2 32 -1\n0 5 5\n5 0 3\n", "7\n3 1 61\n1 8 0\n0 2 -1\n27 7 6\n4 8 0\n0 2 7\n2 0 -2\n", "7\n3 1 61\n1 8 0\n0 2 -1\n27 3 6\n4 8 0\n0 4 13\n2 0 -2\n", "1\n000 2 0\n", "7\n3 1 61\n1 8 0\n0 2 -1\n17 3 6\n4 8 0\n0 4 13\n2 0 -2\n", "3\n-2 32 -1\n0 10 6\n9 -1 3\n", "7\n3 1 61\n1 1 0\n0 2 -1\n17 3 6\n4 8 0\n0 4 13\n2 0 -4\n", "1\n000 0 -1\n", "3\n-2 75 0\n0 10 6\n14 -1 3\n", "7\n5 1 61\n1 1 0\n0 2 -2\n20 3 6\n1 8 0\n0 1 13\n2 0 -4\n", "3\n-2 29 0\n0 10 6\n14 -1 1\n", "7\n5 1 61\n1 1 0\n0 2 -2\n5 4 6\n1 8 0\n0 1 13\n2 0 -4\n", "3\n-2 20 0\n0 10 6\n14 -1 1\n", "3\n-2 20 0\n0 10 3\n14 -1 1\n", "3\n1 20 0\n0 10 5\n14 0 1\n", "3\n2 39 1\n0 10 5\n14 1 4\n", "7\n5 1 66\n0 1 1\n0 2 -2\n5 4 1\n0 12 0\n0 1 12\n2 1 -5\n", "7\n5 1 66\n-1 1 1\n-1 2 0\n5 4 1\n0 12 0\n0 1 12\n2 1 -3\n", "3\n0 56 0\n-1 19 5\n22 1 6\n", "7\n9 1 66\n-1 1 2\n-1 2 0\n2 4 1\n0 12 1\n0 1 22\n2 1 -3\n", "7\n3 1 66\n0 1 0\n-2 2 0\n2 4 1\n-1 12 1\n0 1 22\n2 1 -3\n", "7\n3 1 90\n0 1 0\n-2 2 0\n2 4 2\n-1 12 1\n0 1 22\n2 1 -3\n", "7\n3 1 90\n0 1 0\n-2 2 0\n2 4 2\n-1 12 1\n0 1 22\n0 1 -3\n", "3\n-1 56 -2\n-1 52 2\n22 0 6\n", "7\n3 1 176\n0 1 0\n-2 2 0\n2 4 2\n-1 12 1\n0 1 22\n0 1 -4\n", "7\n5 1 176\n0 1 0\n-2 2 0\n2 8 2\n-1 4 1\n0 1 10\n0 1 -4\n", "7\n5 1 176\n0 2 0\n-2 2 0\n2 8 2\n-1 4 1\n0 1 10\n0 1 -4\n", "3\n-2 56 -2\n0 4 3\n35 1 10\n", "7\n5 1 176\n0 2 0\n-2 2 0\n2 8 2\n-1 3 1\n0 1 4\n0 1 -5\n", "7\n5 1 176\n0 2 0\n-2 2 -1\n2 8 2\n-1 3 1\n0 1 4\n0 1 -5\n", "3\n-2 6 -4\n0 4 3\n21 2 10\n", "3\n-1 6 -4\n0 4 5\n21 2 10\n", "3\n-1 6 -4\n-1 4 4\n21 2 10\n", "3\n-1 6 -4\n-1 0 8\n21 4 10\n", "3\n-1 5 -4\n-1 0 8\n21 4 10\n", "3\n-1 12 -4\n-1 0 8\n21 4 10\n", "7\n6 2 176\n1 3 -1\n-2 0 0\n3 9 3\n-1 4 2\n-4 1 4\n0 1 -5\n", "7\n6 2 176\n1 3 -1\n0 0 0\n3 9 3\n-1 7 2\n-4 1 4\n0 1 -5\n", "7\n6 2 176\n1 3 -2\n0 0 0\n3 9 3\n-1 7 2\n-4 1 7\n0 1 -5\n", "7\n6 2 176\n1 3 -2\n0 0 0\n3 9 4\n-1 7 2\n-4 1 7\n0 1 -5\n", "3\n-1 17 -1\n0 2 11\n37 7 2\n", "7\n6 2 176\n1 3 -3\n0 0 0\n6 9 4\n-1 7 2\n-4 1 7\n0 1 -5\n", "7\n6 2 176\n2 3 -3\n0 0 -1\n6 9 4\n-1 7 2\n-4 1 7\n0 1 -8\n", "3\n10 40 70\n20 50 80\n30 60 90\n", "3\n10 40 70\n20 50 80\n30 60 90\n", "7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n", "1\n100 10 1\n" ], "outputs": [ "210\n", "100\n", "46\n", "16\n", "52\n", "174\n", "191\n", "25\n", "51\n", "209\n", "29\n", "54\n", "218\n", "101\n", "177\n", "139\n", "56\n", "208\n", "59\n", "219\n", "214\n", "110\n", "60\n", "203\n", "125\n", "61\n", "102\n", "10\n", "11\n", "63\n", "68\n", "67\n", "66\n", "72\n", "74\n", "3\n", "75\n", "76\n", "87\n", "4\n", "6\n", "90\n", "62\n", "64\n", "97\n", "111\n", "77\n", "82\n", "71\n", "78\n", "86\n", "73\n", "69\n", "1\n", "84\n", "57\n", "81\n", "42\n", "112\n", "118\n", "2\n", "108\n", "47\n", "104\n", "0\n", "95\n", "107\n", "49\n", "93\n", "40\n", "37\n", "39\n", "58\n", "99\n", "98\n", "83\n", "105\n", "106\n", "130\n", "129\n", "80\n", "215\n", "195\n", "196\n", "94\n", "190\n", "189\n", "30\n", "32\n", "31\n", "35\n", "34\n", "41\n", "192\n", "194\n", "197\n", "198\n", "65\n", "200\n", "199\n", "210\n", "210\n", "46\n", "100\n" ], "question": "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(\"%d\",&a[i][j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tdp[i][j]=-1;\n\t\t}\n\t}\n\tfor(i=0;i<3;i++) dp[0][i]=a[0][i];\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tfor(k=0;k<3;k++){\n\t\t\t\tif(i+1<n&&k!=j&&dp[i][j]+a[i+1][k]>dp[i+1][k]){\n\t\t\t\t\tdp[i+1][k]=dp[i][j]+a[i+1][k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<3;i++){\n\t\tif(dp[n-1][i]>max){\n\t\t\tmax=dp[n-1][i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tdp\n\t.bss\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 1200012\ndp:\n\t.zero\t1200012\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 1200012\na:\n\t.zero\t1200012\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$-1, -12(%rbp)\n\tleaq\t-28(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L2\n.L5:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L3\n.L4:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -20(%rbp)\n.L3:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L4\n\taddl\t$1, -24(%rbp)\n.L2:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjl\t.L5\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L6\n.L9:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t$-1, (%rdx,%rax)\n\taddl\t$1, -20(%rbp)\n.L7:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L8\n\taddl\t$1, -24(%rbp)\n.L6:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjl\t.L9\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-24(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tdp(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\taddl\t$1, -24(%rbp)\n.L10:\n\tcmpl\t$2, -24(%rbp)\n\tjle\t.L11\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L12\n.L18:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L13\n.L17:\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L14\n.L16:\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L15\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tje\t.L15\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rsi, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, %ecx\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rsi, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, %ecx\n\tjle\t.L15\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %esi\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\ta(%rip), %rax\n\tmovl\t(%rdx,%rax), %ecx\n\tmovl\t-24(%rbp), %eax\n\tleal\t1(%rax), %edx\n\taddl\t%esi, %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rsi, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t%ecx, (%rdx,%rax)\n.L15:\n\taddl\t$1, -16(%rbp)\n.L14:\n\tcmpl\t$2, -16(%rbp)\n\tjle\t.L16\n\taddl\t$1, -20(%rbp)\n.L13:\n\tcmpl\t$2, -20(%rbp)\n\tjle\t.L17\n\taddl\t$1, -24(%rbp)\n.L12:\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjl\t.L18\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L19\n.L21:\n\tmovl\t-28(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjge\t.L20\n\tmovl\t-28(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tdp(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n.L20:\n\taddl\t$1, -24(%rbp)\n.L19:\n\tcmpl\t$2, -24(%rbp)\n\tjle\t.L21\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L23\n\tcall\t__stack_chk_fail@PLT\n.L23:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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++){ for(j=0;j<3;j++){ dp[i][j]=-1; } } for(i=0;i<3;i++) dp[0][i]=a[0][i]; for(i=0;i<n;i++){ for(j=0;j<3;j++){ for(k=0;k<3;k++){ if(i+1<n&&k!=j&&dp[i][j]+a[i+1][k]>dp[i+1][k]){ dp[i+1][k]=dp[i][j]+a[i+1][k]; } } } } for(i=0;i<3;i++){ if(dp[n-1][i]>max){ max=dp[n-1][i]; } } printf("%d\n",max); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl dp .bss .align 32 .type dp, @object .size dp, 1200012 dp: .zero 1200012 .globl a .align 32 .type a, @object .size a, 1200012 a: .zero 1200012 .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $-1, -12(%rbp) leaq -28(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -24(%rbp) jmp .L2 .L5: movl $0, -20(%rbp) jmp .L3 .L4: movl -20(%rbp), %eax movslq %eax, %rcx movl -24(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -20(%rbp) .L3: cmpl $2, -20(%rbp) jle .L4 addl $1, -24(%rbp) .L2: movl -28(%rbp), %eax cmpl %eax, -24(%rbp) jl .L5 movl $0, -24(%rbp) jmp .L6 .L9: movl $0, -20(%rbp) jmp .L7 .L8: movl -20(%rbp), %eax movslq %eax, %rcx movl -24(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl $-1, (%rdx,%rax) addl $1, -20(%rbp) .L7: cmpl $2, -20(%rbp) jle .L8 addl $1, -24(%rbp) .L6: movl -28(%rbp), %eax cmpl %eax, -24(%rbp) jl .L9 movl $0, -24(%rbp) jmp .L10 .L11: movl -24(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax movl -24(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq dp(%rip), %rdx movl %eax, (%rcx,%rdx) addl $1, -24(%rbp) .L10: cmpl $2, -24(%rbp) jle .L11 movl $0, -24(%rbp) jmp .L12 .L18: movl $0, -20(%rbp) jmp .L13 .L17: movl $0, -16(%rbp) jmp .L14 .L16: movl -24(%rbp), %eax leal 1(%rax), %edx movl -28(%rbp), %eax cmpl %eax, %edx jge .L15 movl -16(%rbp), %eax cmpl -20(%rbp), %eax je .L15 movl -20(%rbp), %eax movslq %eax, %rcx movl -24(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl (%rdx,%rax), %ecx movl -24(%rbp), %eax leal 1(%rax), %edx movl -16(%rbp), %eax movslq %eax, %rsi movslq %edx, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rsi, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %eax addl %eax, %ecx movl -24(%rbp), %eax leal 1(%rax), %edx movl -16(%rbp), %eax movslq %eax, %rsi movslq %edx, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rsi, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, %ecx jle .L15 movl -20(%rbp), %eax movslq %eax, %rcx movl -24(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl (%rdx,%rax), %esi movl -24(%rbp), %eax leal 1(%rax), %edx movl -16(%rbp), %eax movslq %eax, %rcx movslq %edx, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq a(%rip), %rax movl (%rdx,%rax), %ecx movl -24(%rbp), %eax leal 1(%rax), %edx addl %esi, %ecx movl -16(%rbp), %eax movslq %eax, %rsi movslq %edx, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rsi, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl %ecx, (%rdx,%rax) .L15: addl $1, -16(%rbp) .L14: cmpl $2, -16(%rbp) jle .L16 addl $1, -20(%rbp) .L13: cmpl $2, -20(%rbp) jle .L17 addl $1, -24(%rbp) .L12: movl -28(%rbp), %eax cmpl %eax, -24(%rbp) jl .L18 movl $0, -24(%rbp) jmp .L19 .L21: movl -28(%rbp), %eax leal -1(%rax), %edx movl -24(%rbp), %eax movslq %eax, %rcx movslq %edx, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -12(%rbp) jge .L20 movl -28(%rbp), %eax leal -1(%rax), %edx movl -24(%rbp), %eax movslq %eax, %rcx movslq %edx, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax addq %rcx, %rax leaq 0(,%rax,4), %rdx leaq dp(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -12(%rbp) .L20: addl $1, -24(%rbp) .L19: cmpl $2, -24(%rbp) jle .L21 movl -12(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L23 call __stack_chk_fail@PLT .L23: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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),a){\n\tscanf(\"%d %d %d\",&b,&c,&e);\n\tb--;\n\tc--;\n\tif(m[b][c]>e||m[b][c]==0)m[b][c]=m[c][b]=e;\n }\n else{\n\tscanf(\"%d %d\",&b,&c);\n\tb--;\n\tc--;\n\tint d[100]={0};\n\tchar f[100]={0};\n\tmi=b;\n\tfor(i=0;i<n;i++){\n\t f[mi]=2;\n\t for(j=0;j<n;j++){\n\t if(m[mi][j]==0||f[j]==2)continue;\n\t if(d[j]==0||d[j]>d[mi]+m[mi][j]){\n\t d[j]=d[mi]+m[mi][j];\n\t f[j]=1;\n\t }\n\t }\n\t min=2100000000;\n\t for(j=h=0;j<n;j++){\n\t if(f[j]!=1)continue;\n\t h=1;\n\t if(min>d[j]){\n\t min=d[j];\n\t mi=j;\n\t }\n\t }\n\t if(!h)break;\n\t}\n\tif(d[c])printf(\"%d\\n\",d[c]);\n\telse printf(\"-1\\n\");\n }\n }\n }\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-36864(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3696, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L2\n.L26:\n\tleaq\t-40112(%rbp), %rax\n\tmovl\t$40000, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tjmp\t.L3\n.L22:\n\tleaq\t-40548(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40548(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L4\n\tleaq\t-40536(%rbp), %rcx\n\tleaq\t-40540(%rbp), %rdx\n\tleaq\t-40544(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40544(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40544(%rbp)\n\tmovl\t-40540(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40540(%rbp)\n\tmovl\t-40544(%rbp), %eax\n\tmovl\t-40540(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %edx\n\tmovl\t-40536(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L5\n\tmovl\t-40544(%rbp), %eax\n\tmovl\t-40540(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L3\n.L5:\n\tmovl\t-40540(%rbp), %edx\n\tmovl\t-40544(%rbp), %ecx\n\tmovl\t-40536(%rbp), %esi\n\tmovslq\t%ecx, %r8\n\tmovslq\t%edx, %rdi\n\tmovq\t%rdi, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdi, %rax\n\tleaq\t0(,%rax,4), %rdi\n\taddq\t%rdi, %rax\n\tsalq\t$2, %rax\n\taddq\t%r8, %rax\n\tmovl\t%esi, -40112(%rbp,%rax,4)\n\tmovl\t-40544(%rbp), %esi\n\tmovl\t-40540(%rbp), %edi\n\tmovslq\t%ecx, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %edx\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rcx\n\tmovq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdi, %rax\n\tmovl\t%edx, -40112(%rbp,%rax,4)\n\tjmp\t.L3\n.L4:\n\tleaq\t-40540(%rbp), %rdx\n\tleaq\t-40544(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40544(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40544(%rbp)\n\tmovl\t-40540(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40540(%rbp)\n\tleaq\t-40512(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$50, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t$0, -112(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tmovq\t$0, -96(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t$0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tmovq\t$0, -56(%rbp)\n\tmovq\t$0, -48(%rbp)\n\tmovq\t$0, -40(%rbp)\n\tmovq\t$0, -32(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tmovl\t-40544(%rbp), %eax\n\tmovl\t%eax, -40520(%rbp)\n\tmovl\t$0, -40532(%rbp)\n\tjmp\t.L6\n.L19:\n\tmovl\t-40520(%rbp), %eax\n\tcltq\n\tmovb\t$2, -112(%rbp,%rax)\n\tmovl\t$0, -40528(%rbp)\n\tjmp\t.L7\n.L12:\n\tmovl\t-40528(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-40520(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L29\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovzbl\t-112(%rbp,%rax), %eax\n\tcmpb\t$2, %al\n\tje\t.L29\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L11\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %ecx\n\tmovl\t-40520(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %esi\n\tmovl\t-40528(%rbp), %eax\n\tmovslq\t%eax, %rdi\n\tmovl\t-40520(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdi, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\taddl\t%esi, %eax\n\tcmpl\t%eax, %ecx\n\tjle\t.L10\n.L11:\n\tmovl\t-40520(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %ecx\n\tmovl\t-40528(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovl\t-40520(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\tleal\t(%rcx,%rax), %edx\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -40512(%rbp,%rax,4)\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovb\t$1, -112(%rbp,%rax)\n\tjmp\t.L10\n.L29:\n\tnop\n.L10:\n\taddl\t$1, -40528(%rbp)\n.L7:\n\tmovl\t-40556(%rbp), %eax\n\tcmpl\t%eax, -40528(%rbp)\n\tjl\t.L12\n\tmovl\t$2100000000, -40516(%rbp)\n\tmovl\t$0, -40524(%rbp)\n\tmovl\t-40524(%rbp), %eax\n\tmovl\t%eax, -40528(%rbp)\n\tjmp\t.L13\n.L16:\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovzbl\t-112(%rbp,%rax), %eax\n\tcmpb\t$1, %al\n\tjne\t.L30\n\tmovl\t$1, -40524(%rbp)\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\tcmpl\t%eax, -40516(%rbp)\n\tjle\t.L15\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\tmovl\t%eax, -40516(%rbp)\n\tmovl\t-40528(%rbp), %eax\n\tmovl\t%eax, -40520(%rbp)\n\tjmp\t.L15\n.L30:\n\tnop\n.L15:\n\taddl\t$1, -40528(%rbp)\n.L13:\n\tmovl\t-40556(%rbp), %eax\n\tcmpl\t%eax, -40528(%rbp)\n\tjl\t.L16\n\tcmpl\t$0, -40524(%rbp)\n\tje\t.L31\n\taddl\t$1, -40532(%rbp)\n.L6:\n\tmovl\t-40556(%rbp), %eax\n\tcmpl\t%eax, -40532(%rbp)\n\tjl\t.L19\n\tjmp\t.L18\n.L31:\n\tnop\n.L18:\n\tmovl\t-40540(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L20\n\tmovl\t-40540(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L3\n.L20:\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovl\t-40552(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -40552(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L22\n.L2:\n\tleaq\t-40552(%rbp), %rdx\n\tleaq\t-40556(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40556(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L23\n\tmovl\t-40552(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L24\n.L23:\n\tmovl\t$1, %eax\n\tjmp\t.L25\n.L24:\n\tmovl\t$0, %eax\n.L25:\n\ttestl\t%eax, %eax\n\tjne\t.L26\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L28\n\tcall\t__stack_chk_fail@PLT\n.L28:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.type\tmain, @function\nmain:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-36864(%rsp), %r11\n\t.cfi_def_cfa 11, 36920\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3736, %rsp\n\t.cfi_def_cfa_offset 40656\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40584(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t60(%rsp), %rax\n\tmovq\t%rax, 40(%rsp)\n\tleaq\t56(%rsp), %rax\n\tmovq\t%rax, 32(%rsp)\n.L2:\n\tmovq\t40(%rsp), %rdx\n\tmovq\t32(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t56(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L19\n\tmovl\t60(%rsp), %ebx\n\ttestl\t%ebx, %ebx\n\tje\t.L47\n\tleaq\t480(%rsp), %r12\n\tmovl\t$40000, %edx\n\txorl\t%esi, %esi\n\tsubl\t$1, %ebx\n\tmovq\t%r12, %rdi\n\tcall\tmemset@PLT\n\tmovl\t%ebx, 60(%rsp)\n.L3:\n\tleaq\t64(%rsp), %rax\n\tmovq\t%rax, (%rsp)\n\tleaq\t72(%rsp), %rax\n\tmovq\t%rax, 8(%rsp)\n\tleaq\t68(%rsp), %rax\n\tmovq\t%rax, 16(%rsp)\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovq\t8(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\tleaq\t76(%rsp), %rcx\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t68(%rsp), %eax\n\tmovl\t72(%rsp), %edi\n\tsubl\t$1, %eax\n\tleal\t-1(%rdi), %edx\n\tmovl\t%eax, 68(%rsp)\n\tcltq\n\tleaq\t(%rax,%rax,4), %rcx\n\tmovl\t%edx, 72(%rsp)\n\tmovslq\t%edx, %rdx\n\tleaq\t(%rcx,%rcx,4), %rcx\n\tleaq\t(%rdx,%rcx,4), %rcx\n\tmovl\t480(%rsp,%rcx,4), %esi\n\tmovl\t76(%rsp), %ecx\n\ttestl\t%esi, %esi\n\tje\t.L24\n\tcmpl\t%ecx, %esi\n\tjle\t.L5\n.L24:\n\tleaq\t(%rdx,%rdx,4), %rsi\n\tleaq\t(%rsi,%rsi,4), %rsi\n\tleaq\t(%rax,%rsi,4), %rsi\n\tleaq\t(%rax,%rax,4), %rax\n\tleaq\t(%rax,%rax,4), %rax\n\tmovl\t%ecx, 480(%rsp,%rsi,4)\n\tleaq\t(%rdx,%rax,4), %rax\n\tmovl\t%ecx, 480(%rsp,%rax,4)\n.L5:\n\tmovl\t60(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 60(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L2\n.L17:\n\tmovq\t(%rsp), %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t64(%rsp), %edx\n\ttestl\t%edx, %edx\n\tjne\t.L48\n\tmovq\t8(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\txorl\t%eax, %eax\n\tleaq\t80(%rsp), %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t68(%rsp), %eax\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%rbx, %rdi\n\tmovl\t56(%rsp), %r15d\n\tmovl\t$50, %ecx\n\tmovl\t$0, 40576(%rsp)\n\tleal\t-1(%rax), %ebp\n\tmovl\t72(%rsp), %eax\n\tmovaps\t%xmm0, 40480(%rsp)\n\tmovl\t%ebp, 68(%rsp)\n\tsubl\t$1, %eax\n\tmovaps\t%xmm0, 40496(%rsp)\n\tmovl\t%eax, 28(%rsp)\n\tmovl\t%eax, 72(%rsp)\n\txorl\t%eax, %eax\n\trep stosq\n\tmovaps\t%xmm0, 40512(%rsp)\n\tmovaps\t%xmm0, 40528(%rsp)\n\tmovaps\t%xmm0, 40544(%rsp)\n\tmovaps\t%xmm0, 40560(%rsp)\n\ttestl\t%r15d, %r15d\n\tjle\t.L15\n\tleal\t-1(%r15), %eax\n\txorl\t%r14d, %r14d\n\tleaq\t40480(%rsp), %r8\n\tmovl\t%r15d, %r13d\n\tleaq\t40481(%rsp,%rax), %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovslq\t%ebp, %r9\n\tmovq\t%rbx, %rsi\n\tmovb\t$2, 40480(%rsp,%r9)\n\tleaq\t(%r9,%r9,4), %rax\n\tleaq\t(%rax,%rax,4), %rcx\n\tmovq\t%r8, %rax\n\tsalq\t$4, %rcx\n\taddq\t%r12, %rcx\n\tjmp\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\taddl\t%r10d, %edx\n.L11:\n\tmovl\t%edx, (%rsi)\n\tmovb\t$1, (%rax)\n.L10:\n\taddq\t$1, %rax\n\taddq\t$4, %rcx\n\taddq\t$4, %rsi\n\tcmpq\t%r11, %rax\n\tje\t.L49\n.L12:\n\tmovl\t(%rcx), %edx\n\ttestl\t%edx, %edx\n\tje\t.L10\n\tcmpb\t$2, (%rax)\n\tje\t.L10\n\tmovl\t(%rsi), %edi\n\tmovl\t80(%rsp,%r9,4), %r10d\n\ttestl\t%edi, %edi\n\tje\t.L50\n\taddl\t%r10d, %edx\n\tcmpl\t%edx, %edi\n\tjle\t.L10\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L49:\n\txorl\t%edx, %edx\n\txorl\t%eax, %eax\n\tmovl\t$2100000000, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tcmpb\t$1, (%r8,%rax)\n\tjne\t.L13\n\tmovl\t(%rbx,%rax,4), %edx\n\tcmpl\t%ecx, %edx\n\tjge\t.L45\n\tmovl\t%edx, %ecx\n\tmovl\t%eax, %ebp\n.L45:\n\tmovl\t$1, %edx\n.L13:\n\taddq\t$1, %rax\n\tcmpq\t%rax, %r13\n\tjne\t.L14\n\ttestl\t%edx, %edx\n\tje\t.L15\n\taddl\t$1, %r14d\n\tcmpl\t%r14d, %r15d\n\tjne\t.L7\n.L15:\n\tmovslq\t28(%rsp), %rax\n\tmovl\t80(%rsp,%rax,4), %edx\n\ttestl\t%edx, %edx\n\tje\t.L51\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L5\n.L51:\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L5\n.L19:\n\tleaq\t480(%rsp), %r12\n\tmovl\t$40000, %edx\n\txorl\t%esi, %esi\n\tmovq\t%r12, %rdi\n\tcall\tmemset@PLT\n\tmovl\t60(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 60(%rsp)\n\ttestl\t%eax, %eax\n\tjne\t.L3\n\tjmp\t.L2\n.L47:\n\tmovq\t40584(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L52\n\taddq\t$40600, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L52:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tmain, @function\nmain:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-36864(%rsp), %r11\n\t.cfi_def_cfa 11, 36920\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3736, %rsp\n\t.cfi_def_cfa_offset 40656\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40584(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t60(%rsp), %rax\n\tmovq\t%rax, 40(%rsp)\n\tleaq\t56(%rsp), %rax\n\tmovq\t%rax, 32(%rsp)\n.L2:\n\tmovq\t40(%rsp), %rdx\n\tmovq\t32(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t56(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L19\n\tmovl\t60(%rsp), %ebx\n\ttestl\t%ebx, %ebx\n\tje\t.L47\n\tleaq\t480(%rsp), %r12\n\tmovl\t$40000, %edx\n\txorl\t%esi, %esi\n\tsubl\t$1, %ebx\n\tmovq\t%r12, %rdi\n\tcall\tmemset@PLT\n\tmovl\t%ebx, 60(%rsp)\n.L3:\n\tleaq\t64(%rsp), %rax\n\tmovq\t%rax, (%rsp)\n\tleaq\t72(%rsp), %rax\n\tmovq\t%rax, 8(%rsp)\n\tleaq\t68(%rsp), %rax\n\tmovq\t%rax, 16(%rsp)\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovq\t8(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\tleaq\t76(%rsp), %rcx\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t68(%rsp), %eax\n\tmovl\t72(%rsp), %edi\n\tsubl\t$1, %eax\n\tleal\t-1(%rdi), %edx\n\tmovl\t%eax, 68(%rsp)\n\tcltq\n\tleaq\t(%rax,%rax,4), %rcx\n\tmovl\t%edx, 72(%rsp)\n\tmovslq\t%edx, %rdx\n\tleaq\t(%rcx,%rcx,4), %rcx\n\tleaq\t(%rdx,%rcx,4), %rcx\n\tmovl\t480(%rsp,%rcx,4), %esi\n\tmovl\t76(%rsp), %ecx\n\ttestl\t%esi, %esi\n\tje\t.L24\n\tcmpl\t%ecx, %esi\n\tjle\t.L5\n.L24:\n\tleaq\t(%rdx,%rdx,4), %rsi\n\tleaq\t(%rsi,%rsi,4), %rsi\n\tleaq\t(%rax,%rsi,4), %rsi\n\tleaq\t(%rax,%rax,4), %rax\n\tleaq\t(%rax,%rax,4), %rax\n\tmovl\t%ecx, 480(%rsp,%rsi,4)\n\tleaq\t(%rdx,%rax,4), %rax\n\tmovl\t%ecx, 480(%rsp,%rax,4)\n.L5:\n\tmovl\t60(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 60(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L2\n.L17:\n\tmovq\t(%rsp), %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t64(%rsp), %edx\n\ttestl\t%edx, %edx\n\tjne\t.L48\n\tmovq\t8(%rsp), %rdx\n\tmovq\t16(%rsp), %rsi\n\tleaq\t.LC2(%rip), %rdi\n\txorl\t%eax, %eax\n\tleaq\t80(%rsp), %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t68(%rsp), %eax\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%rbx, %rdi\n\tmovl\t56(%rsp), %r15d\n\tmovl\t$50, %ecx\n\tmovl\t$0, 40576(%rsp)\n\tleal\t-1(%rax), %ebp\n\tmovl\t72(%rsp), %eax\n\tmovaps\t%xmm0, 40480(%rsp)\n\tmovl\t%ebp, 68(%rsp)\n\tsubl\t$1, %eax\n\tmovaps\t%xmm0, 40496(%rsp)\n\tmovl\t%eax, 28(%rsp)\n\tmovl\t%eax, 72(%rsp)\n\txorl\t%eax, %eax\n\trep stosq\n\tmovaps\t%xmm0, 40512(%rsp)\n\tmovaps\t%xmm0, 40528(%rsp)\n\tmovaps\t%xmm0, 40544(%rsp)\n\tmovaps\t%xmm0, 40560(%rsp)\n\ttestl\t%r15d, %r15d\n\tjle\t.L15\n\tleal\t-1(%r15), %eax\n\txorl\t%r14d, %r14d\n\tleaq\t40480(%rsp), %r8\n\tmovl\t%r15d, %r13d\n\tleaq\t40481(%rsp,%rax), %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovslq\t%ebp, %r9\n\tmovq\t%rbx, %rsi\n\tmovb\t$2, 40480(%rsp,%r9)\n\tleaq\t(%r9,%r9,4), %rax\n\tleaq\t(%rax,%rax,4), %rcx\n\tmovq\t%r8, %rax\n\tsalq\t$4, %rcx\n\taddq\t%r12, %rcx\n\tjmp\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\taddl\t%r10d, %edx\n.L11:\n\tmovl\t%edx, (%rsi)\n\tmovb\t$1, (%rax)\n.L10:\n\taddq\t$1, %rax\n\taddq\t$4, %rcx\n\taddq\t$4, %rsi\n\tcmpq\t%r11, %rax\n\tje\t.L49\n.L12:\n\tmovl\t(%rcx), %edx\n\ttestl\t%edx, %edx\n\tje\t.L10\n\tcmpb\t$2, (%rax)\n\tje\t.L10\n\tmovl\t(%rsi), %edi\n\tmovl\t80(%rsp,%r9,4), %r10d\n\ttestl\t%edi, %edi\n\tje\t.L50\n\taddl\t%r10d, %edx\n\tcmpl\t%edx, %edi\n\tjle\t.L10\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L49:\n\txorl\t%edx, %edx\n\txorl\t%eax, %eax\n\tmovl\t$2100000000, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tcmpb\t$1, (%r8,%rax)\n\tjne\t.L13\n\tmovl\t(%rbx,%rax,4), %edx\n\tcmpl\t%ecx, %edx\n\tjge\t.L45\n\tmovl\t%edx, %ecx\n\tmovl\t%eax, %ebp\n.L45:\n\tmovl\t$1, %edx\n.L13:\n\taddq\t$1, %rax\n\tcmpq\t%rax, %r13\n\tjne\t.L14\n\ttestl\t%edx, %edx\n\tje\t.L15\n\taddl\t$1, %r14d\n\tcmpl\t%r14d, %r15d\n\tjne\t.L7\n.L15:\n\tmovslq\t28(%rsp), %rax\n\tmovl\t80(%rsp,%rax,4), %edx\n\ttestl\t%edx, %edx\n\tje\t.L51\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L5\n.L51:\n\tleaq\t.LC4(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L5\n.L19:\n\tleaq\t480(%rsp), %r12\n\tmovl\t$40000, %edx\n\txorl\t%esi, %esi\n\tmovq\t%r12, %rdi\n\tcall\tmemset@PLT\n\tmovl\t60(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 60(%rsp)\n\ttestl\t%eax, %eax\n\tjne\t.L3\n\tjmp\t.L2\n.L47:\n\tmovq\t40584(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L52\n\taddq\t$40600, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L52:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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),a){\n\tscanf(\"%d %d %d\",&b,&c,&e);\n\tb--;\n\tc--;\n\tif(m[b][c]>e||m[b][c]==0)m[b][c]=m[c][b]=e;\n }\n else{\n\tscanf(\"%d %d\",&b,&c);\n\tb--;\n\tc--;\n\tint d[100]={0};\n\tchar f[100]={0};\n\tmi=b;\n\tfor(i=0;i<n;i++){\n\t f[mi]=2;\n\t for(j=0;j<n;j++){\n\t if(m[mi][j]==0||f[j]==2)continue;\n\t if(d[j]==0||d[j]>d[mi]+m[mi][j]){\n\t d[j]=d[mi]+m[mi][j];\n\t f[j]=1;\n\t }\n\t }\n\t min=2100000000;\n\t for(j=h=0;j<n;j++){\n\t if(f[j]!=1)continue;\n\t h=1;\n\t if(min>d[j]){\n\t min=d[j];\n\t mi=j;\n\t }\n\t }\n\t if(!h)break;\n\t}\n\tif(d[c])printf(\"%d\\n\",d[c]);\n\telse printf(\"-1\\n\");\n }\n }\n }\n return 0;\n}", "index": 83, "inputs": [ "3 8\n1 3 1 10\n0 2 3\n1 2 2 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 2 20\n1 1 1 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 212055\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 2 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 150117\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 2780\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 1\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 3\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 4\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 5842\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 4\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 5 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 1\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 1 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 1 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 25185\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 6685\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 5842\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 9\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 1 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 6\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 2 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 3 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 1678\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 7\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 8\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 25466\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 1 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 1 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4402\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 25185\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 5 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 3\n0 2 3\n1 2 3 1\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 5 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 3\n0 2 3\n1 2 3 2\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 4 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 5 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 9\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 2 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 1 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 2 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 5 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 11\n1 2 1 9\n0 2 3\n5 16\n1 1 2 149121\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 3 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 442171\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 1 3 150674\n1 2 4 545492\n1 2 5 250\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 2 3 1\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 136\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 1 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 1 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 2 3\n0 0\n", "3 8\n1 3 1 7\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4402\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 25185\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 5 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 3 3 20\n1 1 2 5\n0 1 3\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 5 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 3\n0 2 3\n1 2 3 1\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 4750\n1 1 4 347392\n1 1 5 2257\n1 2 3 46435\n1 2 5 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 9\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 623\n1 3 4 271980\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 3 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 2852\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 2 3 20\n1 1 2 4\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 158\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 4 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 2\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 4 4 343983\n1 3 1 843468\n1 5 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 1 1 10\n0 1 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 1\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 6685\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 11453\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 4 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 1 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 16\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 4 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 19016\n1 1 5 5497\n1 2 3 123394\n1 2 4 133156\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 2780\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 12\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 3 3 123394\n1 3 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 1678\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 4 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 2 3 1\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 5 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 1066\n1 1 4 347392\n1 1 5 4402\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 25185\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 3039\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 5 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 14\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 2 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 5 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 16\n1 1 2 5\n0 3 2\n1 1 3 10\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 1678\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 10082\n1 1 3 150674\n1 2 4 545492\n1 2 5 250\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 8\n0 2 3\n1 2 3 39\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 700\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 2 3\n1 2 3 1\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 136\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 5\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 1\n1 1 1 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 2257\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 1476667\n1 4 5 2961\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 1 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 5 4 343983\n1 3 5 843468\n1 5 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 1 4 343983\n1 3 1 843468\n1 5 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 2 1 10\n0 1 3\n1 3 3 20\n1 1 3 5\n0 1 2\n1 1 3 13\n1 2 1 16\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 4 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 9\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4823\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 99055\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 2 3 236617\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 2780\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 8\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 172254\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 578\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 11\n0 2 3\n1 2 3 39\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 4307\n1 2 3 123394\n1 2 4 545492\n1 2 5 700\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 19\n0 1 3\n1 3 2 20\n1 1 2 5\n0 1 2\n1 1 3 13\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 5 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 9\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 8\n1 2 1 9\n0 1 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 1 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 623\n1 3 4 271980\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 2\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 629411\n1 1 5 5497\n1 2 3 123394\n1 5 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 3 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 2 3 236617\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 2780\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 2 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 212055\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 3 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 2 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 150117\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 5 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 2 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 212055\n1 2 4 545492\n1 2 5 458\n1 3 4 447400\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 3 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 149121\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 3 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 3 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 1 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 3 1 9\n0 2 3\n5 16\n1 1 2 85440\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 3 4 585368\n1 2 5 458\n1 3 4 343983\n1 3 1 843468\n1 4 5 15934\n0 2 1\n0 4 2\n0 1 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n", "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 2 343750\n1 1 3 3343\n1 1 4 347392\n1 1 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 15934\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0\n" ], "outputs": [ "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n-1\n16\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n16392\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n8277\n9298\n3238\n11620\n8840\n", "-1\n15\n7\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n8458\n5955\n3419\n11801\n8840\n", "-1\n15\n12\n2715\n5218\n2715\n3419\n8561\n5600\n", "-1\n1\n1\n2715\n5218\n2715\n3419\n8561\n5600\n", "-1\n15\n8\n5955\n8458\n5955\n3419\n11801\n8840\n", "-1\n9\n9\n5955\n21431\n5955\n16392\n24774\n8840\n", "10\n15\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n15\n7\n4765\n20241\n8108\n16392\n23584\n7650\n", "-1\n15\n12\n2715\n8099\n2715\n6300\n11442\n5600\n", "-1\n5\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n20\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n15\n9\n5955\n8458\n5955\n3419\n11801\n8840\n", "-1\n15\n12\n5955\n353281\n5955\n353281\n343983\n8840\n", "10\n15\n12\n5955\n16392\n5955\n16392\n21431\n8840\n", "-1\n5\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n7\n4765\n29492\n8108\n25643\n32835\n7650\n", "-1\n15\n12\n2715\n8099\n2715\n6300\n14784\n8942\n", "-1\n5\n15\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n5\n18\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n14\n7\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n15934\n5955\n21889\n19277\n8840\n", "-1\n16\n13\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n10\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n85440\n88859\n85440\n3419\n92202\n89241\n", "-1\n15\n12\n2715\n5218\n2715\n3419\n6896\n3935\n", "-1\n12\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n13\n7\n4765\n20241\n8108\n16392\n23584\n7650\n", "-1\n5\n12\n5955\n30963\n9298\n25924\n34306\n8840\n", "-1\n5\n12\n85440\n101832\n85440\n16392\n105175\n89241\n", "-1\n15\n7\n4860\n29587\n8203\n25643\n32930\n7745\n", "-1\n5\n15\n5955\n21431\n9298\n458\n24774\n8840\n", "-1\n1\n1\n2715\n3419\n2715\n3419\n8561\n5600\n", "-1\n2\n2\n2715\n5218\n2715\n3419\n8561\n5600\n", "-1\n14\n7\n5955\n16392\n9298\n16392\n24774\n8840\n", "-1\n15\n15\n5955\n15934\n5955\n21889\n19277\n8840\n", "-1\n15\n10\n5955\n21431\n9298\n16392\n8840\n8840\n", "-1\n15\n15\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5747\n21431\n5747\n16184\n24774\n8840\n", "-1\n1\n1\n594\n3097\n594\n3419\n6440\n3479\n", "-1\n5\n12\n85440\n101832\n85440\n16392\n105175\n88783\n", "-1\n12\n7\n4860\n29587\n8203\n25643\n32930\n7745\n", "10\n5\n15\n5955\n21431\n9298\n458\n24774\n8840\n", "10\n10\n15\n5955\n21431\n9298\n458\n24774\n8840\n", "-1\n1\n1\n2715\n3419\n2715\n3419\n9968\n7007\n", "-1\n14\n7\n6120\n16557\n9463\n16557\n24774\n8840\n", "-1\n15\n12\n126737\n19735\n123394\n139786\n16392\n458\n", "-1\n15\n12\n5955\n21431\n8807\n16392\n24283\n8349\n", "10\n14\n11\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n15\n7\n4465\n20241\n7808\n16092\n23584\n7650\n", "-1\n20\n12\n85440\n91395\n85440\n91395\n9298\n8840\n", "-1\n15\n7\n5955\n8458\n5955\n3419\n11801\n8840\n", "-1\n15\n12\n5955\n353347\n5955\n353347\n350735\n8840\n", "-1\n20\n12\n5955\n16392\n5955\n16392\n21431\n8840\n", "-1\n15\n12\n2715\n13710\n2715\n11911\n20395\n8942\n", "-1\n5\n18\n21889\n5497\n25232\n16392\n8840\n24774\n", "-1\n5\n18\n126737\n5955\n123394\n132692\n9298\n8840\n", "-1\n15\n12\n5955\n19016\n5955\n16392\n22359\n8840\n", "-1\n15\n12\n126737\n129975\n123394\n3238\n126632\n123852\n", "-1\n12\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5676\n5218\n5676\n458\n6896\n3935\n", "-1\n1\n1\n2715\n2257\n2715\n3419\n8561\n5600\n", "-1\n15\n7\n4860\n29587\n5926\n25643\n30653\n5468\n", "-1\n5\n15\n3497\n18973\n6840\n458\n22316\n6382\n", "-1\n19\n14\n5955\n21431\n9298\n16392\n8840\n8840\n", "-1\n15\n15\n2715\n5218\n2715\n3419\n6896\n3935\n", "-1\n15\n12\n10332\n26016\n10332\n16184\n29359\n13425\n", "-1\n13\n7\n5007\n20241\n8350\n16634\n23584\n7650\n", "-1\n1\n1\n594\n3097\n594\n3419\n2961\n3479\n", "-1\n-1\n16\n2715\n5218\n2715\n3419\n8561\n5600\n", "-1\n5\n12\n5955\n347392\n9298\n344441\n350735\n8840\n", "-1\n15\n12\n5955\n349938\n5955\n349938\n347326\n8840\n", "-1\n10\n15\n126737\n5955\n123394\n132692\n9298\n8840\n", "-1\n14\n7\n5281\n20757\n8624\n16392\n24100\n8166\n", "-1\n15\n12\n239960\n243198\n236617\n3238\n239855\n237075\n", "-1\n13\n7\n4885\n20241\n8228\n16512\n23584\n7650\n", "-1\n16\n7\n5007\n20241\n8350\n16634\n23584\n7650\n", "19\n5\n18\n5955\n21431\n9298\n458\n24774\n8840\n", "-1\n14\n8\n6120\n16557\n9463\n16557\n24774\n8840\n", "10\n15\n7\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n20\n14\n239960\n243198\n236617\n3238\n239855\n237075\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "10\n15\n12\n5955\n16392\n5955\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n", "-1\n15\n12\n5955\n21431\n9298\n16392\n24774\n8840\n" ], "question": "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),a){\n\tscanf(\"%d %d %d\",&b,&c,&e);\n\tb--;\n\tc--;\n\tif(m[b][c]>e||m[b][c]==0)m[b][c]=m[c][b]=e;\n }\n else{\n\tscanf(\"%d %d\",&b,&c);\n\tb--;\n\tc--;\n\tint d[100]={0};\n\tchar f[100]={0};\n\tmi=b;\n\tfor(i=0;i<n;i++){\n\t f[mi]=2;\n\t for(j=0;j<n;j++){\n\t if(m[mi][j]==0||f[j]==2)continue;\n\t if(d[j]==0||d[j]>d[mi]+m[mi][j]){\n\t d[j]=d[mi]+m[mi][j];\n\t f[j]=1;\n\t }\n\t }\n\t min=2100000000;\n\t for(j=h=0;j<n;j++){\n\t if(f[j]!=1)continue;\n\t h=1;\n\t if(min>d[j]){\n\t min=d[j];\n\t mi=j;\n\t }\n\t }\n\t if(!h)break;\n\t}\n\tif(d[c])printf(\"%d\\n\",d[c]);\n\telse printf(\"-1\\n\");\n }\n }\n }\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-36864(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3696, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L2\n.L26:\n\tleaq\t-40112(%rbp), %rax\n\tmovl\t$40000, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tjmp\t.L3\n.L22:\n\tleaq\t-40548(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40548(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L4\n\tleaq\t-40536(%rbp), %rcx\n\tleaq\t-40540(%rbp), %rdx\n\tleaq\t-40544(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40544(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40544(%rbp)\n\tmovl\t-40540(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40540(%rbp)\n\tmovl\t-40544(%rbp), %eax\n\tmovl\t-40540(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %edx\n\tmovl\t-40536(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L5\n\tmovl\t-40544(%rbp), %eax\n\tmovl\t-40540(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L3\n.L5:\n\tmovl\t-40540(%rbp), %edx\n\tmovl\t-40544(%rbp), %ecx\n\tmovl\t-40536(%rbp), %esi\n\tmovslq\t%ecx, %r8\n\tmovslq\t%edx, %rdi\n\tmovq\t%rdi, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdi, %rax\n\tleaq\t0(,%rax,4), %rdi\n\taddq\t%rdi, %rax\n\tsalq\t$2, %rax\n\taddq\t%r8, %rax\n\tmovl\t%esi, -40112(%rbp,%rax,4)\n\tmovl\t-40544(%rbp), %esi\n\tmovl\t-40540(%rbp), %edi\n\tmovslq\t%ecx, %rcx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %edx\n\tmovslq\t%edi, %rdi\n\tmovslq\t%esi, %rcx\n\tmovq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdi, %rax\n\tmovl\t%edx, -40112(%rbp,%rax,4)\n\tjmp\t.L3\n.L4:\n\tleaq\t-40540(%rbp), %rdx\n\tleaq\t-40544(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40544(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40544(%rbp)\n\tmovl\t-40540(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -40540(%rbp)\n\tleaq\t-40512(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$50, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t$0, -112(%rbp)\n\tmovq\t$0, -104(%rbp)\n\tmovq\t$0, -96(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t$0, -80(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tmovq\t$0, -56(%rbp)\n\tmovq\t$0, -48(%rbp)\n\tmovq\t$0, -40(%rbp)\n\tmovq\t$0, -32(%rbp)\n\tmovq\t$0, -24(%rbp)\n\tmovl\t$0, -16(%rbp)\n\tmovl\t-40544(%rbp), %eax\n\tmovl\t%eax, -40520(%rbp)\n\tmovl\t$0, -40532(%rbp)\n\tjmp\t.L6\n.L19:\n\tmovl\t-40520(%rbp), %eax\n\tcltq\n\tmovb\t$2, -112(%rbp,%rax)\n\tmovl\t$0, -40528(%rbp)\n\tjmp\t.L7\n.L12:\n\tmovl\t-40528(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-40520(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L29\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovzbl\t-112(%rbp,%rax), %eax\n\tcmpb\t$2, %al\n\tje\t.L29\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L11\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %ecx\n\tmovl\t-40520(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %esi\n\tmovl\t-40528(%rbp), %eax\n\tmovslq\t%eax, %rdi\n\tmovl\t-40520(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdi, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\taddl\t%esi, %eax\n\tcmpl\t%eax, %ecx\n\tjle\t.L10\n.L11:\n\tmovl\t-40520(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %ecx\n\tmovl\t-40528(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovl\t-40520(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\tmovl\t-40112(%rbp,%rax,4), %eax\n\tleal\t(%rcx,%rax), %edx\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -40512(%rbp,%rax,4)\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovb\t$1, -112(%rbp,%rax)\n\tjmp\t.L10\n.L29:\n\tnop\n.L10:\n\taddl\t$1, -40528(%rbp)\n.L7:\n\tmovl\t-40556(%rbp), %eax\n\tcmpl\t%eax, -40528(%rbp)\n\tjl\t.L12\n\tmovl\t$2100000000, -40516(%rbp)\n\tmovl\t$0, -40524(%rbp)\n\tmovl\t-40524(%rbp), %eax\n\tmovl\t%eax, -40528(%rbp)\n\tjmp\t.L13\n.L16:\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovzbl\t-112(%rbp,%rax), %eax\n\tcmpb\t$1, %al\n\tjne\t.L30\n\tmovl\t$1, -40524(%rbp)\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\tcmpl\t%eax, -40516(%rbp)\n\tjle\t.L15\n\tmovl\t-40528(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\tmovl\t%eax, -40516(%rbp)\n\tmovl\t-40528(%rbp), %eax\n\tmovl\t%eax, -40520(%rbp)\n\tjmp\t.L15\n.L30:\n\tnop\n.L15:\n\taddl\t$1, -40528(%rbp)\n.L13:\n\tmovl\t-40556(%rbp), %eax\n\tcmpl\t%eax, -40528(%rbp)\n\tjl\t.L16\n\tcmpl\t$0, -40524(%rbp)\n\tje\t.L31\n\taddl\t$1, -40532(%rbp)\n.L6:\n\tmovl\t-40556(%rbp), %eax\n\tcmpl\t%eax, -40532(%rbp)\n\tjl\t.L19\n\tjmp\t.L18\n.L31:\n\tnop\n.L18:\n\tmovl\t-40540(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tje\t.L20\n\tmovl\t-40540(%rbp), %eax\n\tcltq\n\tmovl\t-40512(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L3\n.L20:\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovl\t-40552(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -40552(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L22\n.L2:\n\tleaq\t-40552(%rbp), %rdx\n\tleaq\t-40556(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-40556(%rbp), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L23\n\tmovl\t-40552(%rbp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L24\n.L23:\n\tmovl\t$1, %eax\n\tjmp\t.L25\n.L24:\n\tmovl\t$0, %eax\n.L25:\n\ttestl\t%eax, %eax\n\tjne\t.L26\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L28\n\tcall\t__stack_chk_fail@PLT\n.L28:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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); b--; c--; if(m[b][c]>e||m[b][c]==0)m[b][c]=m[c][b]=e; } else{ scanf("%d %d",&b,&c); b--; c--; int d[100]={0}; char f[100]={0}; mi=b; for(i=0;i<n;i++){ f[mi]=2; for(j=0;j<n;j++){ if(m[mi][j]==0||f[j]==2)continue; if(d[j]==0||d[j]>d[mi]+m[mi][j]){ d[j]=d[mi]+m[mi][j]; f[j]=1; } } min=2100000000; for(j=h=0;j<n;j++){ if(f[j]!=1)continue; h=1; if(min>d[j]){ min=d[j]; mi=j; } } if(!h)break; } if(d[c])printf("%d\n",d[c]); else printf("-1\n"); } } } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d %d %d" .LC2: .string "%d %d" .LC3: .string "%d\n" .LC4: .string "-1" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -36864(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $3696, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax jmp .L2 .L26: leaq -40112(%rbp), %rax movl $40000, %edx movl $0, %esi movq %rax, %rdi call memset@PLT jmp .L3 .L22: leaq -40548(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -40548(%rbp), %eax testl %eax, %eax je .L4 leaq -40536(%rbp), %rcx leaq -40540(%rbp), %rdx leaq -40544(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -40544(%rbp), %eax subl $1, %eax movl %eax, -40544(%rbp) movl -40540(%rbp), %eax subl $1, %eax movl %eax, -40540(%rbp) movl -40544(%rbp), %eax movl -40540(%rbp), %edx movslq %edx, %rcx movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl -40112(%rbp,%rax,4), %edx movl -40536(%rbp), %eax cmpl %eax, %edx jg .L5 movl -40544(%rbp), %eax movl -40540(%rbp), %edx movslq %edx, %rcx movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl -40112(%rbp,%rax,4), %eax testl %eax, %eax jne .L3 .L5: movl -40540(%rbp), %edx movl -40544(%rbp), %ecx movl -40536(%rbp), %esi movslq %ecx, %r8 movslq %edx, %rdi movq %rdi, %rax salq $2, %rax addq %rdi, %rax leaq 0(,%rax,4), %rdi addq %rdi, %rax salq $2, %rax addq %r8, %rax movl %esi, -40112(%rbp,%rax,4) movl -40544(%rbp), %esi movl -40540(%rbp), %edi movslq %ecx, %rcx movslq %edx, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl -40112(%rbp,%rax,4), %edx movslq %edi, %rdi movslq %esi, %rcx movq %rcx, %rax salq $2, %rax addq %rcx, %rax leaq 0(,%rax,4), %rcx addq %rcx, %rax salq $2, %rax addq %rdi, %rax movl %edx, -40112(%rbp,%rax,4) jmp .L3 .L4: leaq -40540(%rbp), %rdx leaq -40544(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -40544(%rbp), %eax subl $1, %eax movl %eax, -40544(%rbp) movl -40540(%rbp), %eax subl $1, %eax movl %eax, -40540(%rbp) leaq -40512(%rbp), %rdx movl $0, %eax movl $50, %ecx movq %rdx, %rdi rep stosq movq $0, -112(%rbp) movq $0, -104(%rbp) movq $0, -96(%rbp) movq $0, -88(%rbp) movq $0, -80(%rbp) movq $0, -72(%rbp) movq $0, -64(%rbp) movq $0, -56(%rbp) movq $0, -48(%rbp) movq $0, -40(%rbp) movq $0, -32(%rbp) movq $0, -24(%rbp) movl $0, -16(%rbp) movl -40544(%rbp), %eax movl %eax, -40520(%rbp) movl $0, -40532(%rbp) jmp .L6 .L19: movl -40520(%rbp), %eax cltq movb $2, -112(%rbp,%rax) movl $0, -40528(%rbp) jmp .L7 .L12: movl -40528(%rbp), %eax movslq %eax, %rcx movl -40520(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl -40112(%rbp,%rax,4), %eax testl %eax, %eax je .L29 movl -40528(%rbp), %eax cltq movzbl -112(%rbp,%rax), %eax cmpb $2, %al je .L29 movl -40528(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %eax testl %eax, %eax je .L11 movl -40528(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %ecx movl -40520(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %esi movl -40528(%rbp), %eax movslq %eax, %rdi movl -40520(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rdi, %rax movl -40112(%rbp,%rax,4), %eax addl %esi, %eax cmpl %eax, %ecx jle .L10 .L11: movl -40520(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %ecx movl -40528(%rbp), %eax movslq %eax, %rsi movl -40520(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rsi, %rax movl -40112(%rbp,%rax,4), %eax leal (%rcx,%rax), %edx movl -40528(%rbp), %eax cltq movl %edx, -40512(%rbp,%rax,4) movl -40528(%rbp), %eax cltq movb $1, -112(%rbp,%rax) jmp .L10 .L29: nop .L10: addl $1, -40528(%rbp) .L7: movl -40556(%rbp), %eax cmpl %eax, -40528(%rbp) jl .L12 movl $2100000000, -40516(%rbp) movl $0, -40524(%rbp) movl -40524(%rbp), %eax movl %eax, -40528(%rbp) jmp .L13 .L16: movl -40528(%rbp), %eax cltq movzbl -112(%rbp,%rax), %eax cmpb $1, %al jne .L30 movl $1, -40524(%rbp) movl -40528(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %eax cmpl %eax, -40516(%rbp) jle .L15 movl -40528(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %eax movl %eax, -40516(%rbp) movl -40528(%rbp), %eax movl %eax, -40520(%rbp) jmp .L15 .L30: nop .L15: addl $1, -40528(%rbp) .L13: movl -40556(%rbp), %eax cmpl %eax, -40528(%rbp) jl .L16 cmpl $0, -40524(%rbp) je .L31 addl $1, -40532(%rbp) .L6: movl -40556(%rbp), %eax cmpl %eax, -40532(%rbp) jl .L19 jmp .L18 .L31: nop .L18: movl -40540(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %eax testl %eax, %eax je .L20 movl -40540(%rbp), %eax cltq movl -40512(%rbp,%rax,4), %eax movl %eax, %esi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT jmp .L3 .L20: leaq .LC4(%rip), %rax movq %rax, %rdi call puts@PLT .L3: movl -40552(%rbp), %eax leal -1(%rax), %edx movl %edx, -40552(%rbp) testl %eax, %eax jne .L22 .L2: leaq -40552(%rbp), %rdx leaq -40556(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -40556(%rbp), %eax testl %eax, %eax jne .L23 movl -40552(%rbp), %eax testl %eax, %eax je .L24 .L23: movl $1, %eax jmp .L25 .L24: movl $0, %eax .L25: testl %eax, %eax jne .L26 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L28 call __stack_chk_fail@PLT .L28: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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,13336,0,0},\n {0,14416,0,0,0,0,0,0,0,0},\n {0,0,3,0,0,0,16971,0,18448,0},\n {50000,342,0,0,0,0,0,0,0,50000},\n {0,20398,0,0,7169,0,0,5300,0,0},\n {0,0,0,0,0,0,0,0,0,0},\n {0,0,0,17391,0,0,0,0,0,0},\n {0,0,0,0,0,799,0,0,0,0}\n};\nchar ch[20];\n\nvoid puti(int i) {\n if (i >= 10) {\n puti(i / 10);\n i %= 10;\n }\n fputc(i + '0', stdout);\n}\n\nint main(void) {\n // テストケースハックする良くないコード\n fread(ch, sizeof(char), 8, stdin);\n int res = arr1[ch[0] - '0'][ch[7] - '0'];\n if (ch[7] == '\\n') {\n if (ch[0] == '3') {\n res = '4' - ch[2];\n }\n else if (ch[0] == '2' && ch[1] == ' ') {\n res = ch[2] - '0';\n }\n else\n res = arr1[ch[0] - '0'][ch[6] - '0'];\n }\n else if (ch[6] == '9') {\n if (ch[0] == '6') {\n res = 22888;\n }\n else if (ch[0] == '9') {\n res = 25436;\n }\n }\n puti(res);\n fputc('\\n', stdout);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tarr1\n\t.data\n\t.align 32\n\t.type\tarr1, @object\n\t.size\tarr1, 400\narr1:\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t100000\n\t.long\t0\n\t.long\t9029\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t7519\n\t.long\t7572\n\t.long\t1\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t9527\n\t.long\t0\n\t.long\t0\n\t.long\t13336\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t14416\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t3\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t16971\n\t.long\t0\n\t.long\t18448\n\t.long\t0\n\t.long\t50000\n\t.long\t342\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t50000\n\t.long\t0\n\t.long\t20398\n\t.long\t0\n\t.long\t0\n\t.long\t7169\n\t.long\t0\n\t.long\t0\n\t.long\t5300\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t17391\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t799\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.globl\tch\n\t.bss\n\t.align 16\n\t.type\tch, @object\n\t.size\tch, 20\nch:\n\t.zero\t20\n\t.text\n\t.p2align 4\n\t.globl\tputi\n\t.type\tputi, @function\nputi:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tmovl\t%edi, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 32\n\tcmpl\t$9, %edi\n\tjg\t.L5\n.L2:\n\tmovq\tstdout(%rip), %rsi\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tleal\t48(%rbx), %edi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\tfputc@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\t.cfi_restore_state\n\tmovslq\t%edi, %rbp\n\tmovl\t%edi, %eax\n\timulq\t$1717986919, %rbp, %rbp\n\tsarl\t$31, %eax\n\tsarq\t$34, %rbp\n\tsubl\t%eax, %ebp\n\tmovl\t%ebp, %edi\n\tcall\tputi\n\tleal\t0(%rbp,%rbp,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ebx\n\tjmp\t.L2\n\t.cfi_endproc\n.LFE0:\n\t.size\tputi, .-puti\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovq\tstdin(%rip), %rcx\n\tmovl\t$8, %edx\n\tmovl\t$1, %esi\n\tleaq\tch(%rip), %rdi\n\tcall\tfread@PLT\n\tmovsbl\tch(%rip), %eax\n\tmovsbl\t7+ch(%rip), %edx\n\tleaq\tarr1(%rip), %r8\n\tmovl\t%eax, %esi\n\tsubl\t$48, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t$48, %edx\n\tcltq\n\tmovslq\t%edx, %rdx\n\tleaq\t(%rax,%rax,4), %rdi\n\tleaq\t(%rdx,%rdi,2), %rdx\n\tmovl\t(%r8,%rdx,4), %edi\n\tcmpb\t$10, %cl\n\tje\t.L13\n\tcmpb\t$57, 6+ch(%rip)\n\tje\t.L14\n.L9:\n\tcall\tputi\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\tcall\tfputc@PLT\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L14:\n\t.cfi_restore_state\n\tcmpb\t$54, %sil\n\tje\t.L11\n\tcmpb\t$57, %sil\n\tmovl\t$25436, %eax\n\tcmove\t%eax, %edi\n\tjmp\t.L9\n.L13:\n\tcmpb\t$51, %sil\n\tje\t.L15\n\tcmpb\t$50, %sil\n\tje\t.L16\n.L10:\n\tmovsbl\t6+ch(%rip), %edx\n\timulq\t$10, %rax, %rax\n\tsubl\t$48, %edx\n\tmovslq\t%edx, %rdx\n\taddq\t%rdx, %rax\n\tmovl\t(%r8,%rax,4), %edi\n\tjmp\t.L9\n.L11:\n\tmovl\t$22888, %edi\n\tjmp\t.L9\n.L16:\n\tcmpb\t$32, 1+ch(%rip)\n\tjne\t.L10\n\tmovsbl\t2+ch(%rip), %edi\n\tsubl\t$48, %edi\n\tjmp\t.L9\n.L15:\n\tmovsbl\t2+ch(%rip), %eax\n\tmovl\t$52, %edi\n\tsubl\t%eax, %edi\n\tjmp\t.L9\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovl\t%edi, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcmpl\t$9, %edi\n\tjg\t.L7\n.L2:\n\tmovq\tstdout(%rip), %rsi\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tleal\t48(%rbx), %edi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tjmp\tfputc@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\t.cfi_restore_state\n\tmovslq\t%edi, %r12\n\tmovl\t%edi, %eax\n\timulq\t$1717986919, %r12, %rbp\n\tsarl\t$31, %eax\n\tsarq\t$34, %rbp\n\tsubl\t%eax, %ebp\n\tcmpl\t$99, %edi\n\tjg\t.L8\n.L3:\n\tmovq\tstdout(%rip), %rsi\n\tleal\t48(%rbp), %edi\n\tcall\tfputc@PLT\n\timulq\t$1717986919, %r12, %rax\n\tmovl\t%ebx, %edx\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ebx\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t%ebp, %r13d\n\tmovl\t$3435973837, %eax\n\tmovq\t%r13, %r14\n\timulq\t%rax, %r14\n\tshrq\t$35, %r14\n\tcmpl\t$999, %edi\n\tjg\t.L9\n.L4:\n\tmovq\tstdout(%rip), %rsi\n\tleal\t48(%r14), %edi\n\tcall\tfputc@PLT\n\tmovl\t$3435973837, %eax\n\timulq\t%rax, %r13\n\tshrq\t$35, %r13\n\tleal\t0(%r13,%r13,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ebp\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovl\t%r14d, %r15d\n\timulq\t%rax, %r15\n\tshrq\t$35, %r15\n\tmovl\t%r15d, %edi\n\tcall\tputi\n\tleal\t(%r15,%r15,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %r14d\n\tjmp\t.L4\n\t.cfi_endproc\n.LFE23:\n\t.size\tputi, .-puti\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovq\tstdin(%rip), %rcx\n\tmovl\t$8, %edx\n\tmovl\t$1, %esi\n\tleaq\tch(%rip), %rdi\n\tcall\tfread@PLT\n\tmovsbl\tch(%rip), %eax\n\tmovsbl\t7+ch(%rip), %edx\n\tleaq\tarr1(%rip), %r8\n\tmovl\t%eax, %esi\n\tsubl\t$48, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t$48, %edx\n\tcltq\n\tmovslq\t%edx, %rdx\n\tleaq\t(%rax,%rax,4), %rdi\n\tleaq\t(%rdx,%rdi,2), %rdx\n\tmovl\t(%r8,%rdx,4), %edi\n\tcmpb\t$10, %cl\n\tje\t.L17\n\tcmpb\t$57, 6+ch(%rip)\n\tje\t.L18\n.L13:\n\tcall\tputi\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\tcall\tfputc@PLT\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tcmpb\t$54, %sil\n\tje\t.L15\n\tcmpb\t$57, %sil\n\tmovl\t$25436, %eax\n\tcmove\t%eax, %edi\n\tjmp\t.L13\n.L17:\n\tcmpb\t$51, %sil\n\tje\t.L19\n\tcmpb\t$50, %sil\n\tje\t.L20\n.L14:\n\tmovsbl\t6+ch(%rip), %edx\n\timulq\t$10, %rax, %rax\n\tsubl\t$48, %edx\n\tmovslq\t%edx, %rdx\n\taddq\t%rdx, %rax\n\tmovl\t(%r8,%rax,4), %edi\n\tjmp\t.L13\n.L15:\n\tmovl\t$22888, %edi\n\tjmp\t.L13\n.L20:\n\tcmpb\t$32, 1+ch(%rip)\n\tjne\t.L14\n\tmovsbl\t2+ch(%rip), %edi\n\tsubl\t$48, %edi\n\tjmp\t.L13\n.L19:\n\tmovsbl\t2+ch(%rip), %eax\n\tmovl\t$52, %edi\n\tsubl\t%eax, %edi\n\tjmp\t.L13\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.globl\tch\n\t.bss\n\t.align 16\n\t.type\tch, @object\n\t.size\tch, 20\nch:\n\t.zero\t20\n\t.globl\tarr1\n\t.data\n\t.align 32\n\t.type\tarr1, @object\n\t.size\tarr1, 400\narr1:\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t100000\n\t.long\t0\n\t.long\t9029\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t7519\n\t.long\t7572\n\t.long\t1\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t9527\n\t.long\t0\n\t.long\t0\n\t.long\t13336\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t14416\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t3\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t16971\n\t.long\t0\n\t.long\t18448\n\t.long\t0\n\t.long\t50000\n\t.long\t342\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t50000\n\t.long\t0\n\t.long\t20398\n\t.long\t0\n\t.long\t0\n\t.long\t7169\n\t.long\t0\n\t.long\t0\n\t.long\t5300\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t17391\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t799\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovl\t%edi, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcmpl\t$9, %edi\n\tjg\t.L7\n.L2:\n\tmovq\tstdout(%rip), %rsi\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tleal\t48(%rbx), %edi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tjmp\tfputc@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\t.cfi_restore_state\n\tmovslq\t%edi, %r12\n\tmovl\t%edi, %eax\n\timulq\t$1717986919, %r12, %rbp\n\tsarl\t$31, %eax\n\tsarq\t$34, %rbp\n\tsubl\t%eax, %ebp\n\tcmpl\t$99, %edi\n\tjg\t.L8\n.L3:\n\tmovq\tstdout(%rip), %rsi\n\tleal\t48(%rbp), %edi\n\tcall\tfputc@PLT\n\timulq\t$1717986919, %r12, %rax\n\tmovl\t%ebx, %edx\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ebx\n\tjmp\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovl\t%ebp, %r13d\n\tmovl\t$3435973837, %eax\n\tmovq\t%r13, %r14\n\timulq\t%rax, %r14\n\tshrq\t$35, %r14\n\tcmpl\t$999, %edi\n\tjg\t.L9\n.L4:\n\tmovq\tstdout(%rip), %rsi\n\tleal\t48(%r14), %edi\n\tcall\tfputc@PLT\n\tmovl\t$3435973837, %eax\n\timulq\t%rax, %r13\n\tshrq\t$35, %r13\n\tleal\t0(%r13,%r13,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ebp\n\tjmp\t.L3\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovl\t%r14d, %r15d\n\timulq\t%rax, %r15\n\tshrq\t$35, %r15\n\tmovl\t%r15d, %edi\n\tcall\tputi\n\tleal\t(%r15,%r15,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %r14d\n\tjmp\t.L4\n\t.cfi_endproc\n.LFE23:\n\t.size\tputi, .-puti\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovq\tstdin(%rip), %rcx\n\tmovl\t$8, %edx\n\tmovl\t$1, %esi\n\tleaq\tch(%rip), %rdi\n\tcall\tfread@PLT\n\tmovsbl\tch(%rip), %eax\n\tmovsbl\t7+ch(%rip), %edx\n\tleaq\tarr1(%rip), %r8\n\tmovl\t%eax, %esi\n\tsubl\t$48, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t$48, %edx\n\tcltq\n\tmovslq\t%edx, %rdx\n\tleaq\t(%rax,%rax,4), %rdi\n\tleaq\t(%rdx,%rdi,2), %rdx\n\tmovl\t(%r8,%rdx,4), %edi\n\tcmpb\t$10, %cl\n\tje\t.L17\n\tcmpb\t$57, 6+ch(%rip)\n\tje\t.L18\n.L13:\n\tcall\tputi\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\tcall\tfputc@PLT\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L18:\n\t.cfi_restore_state\n\tcmpb\t$54, %sil\n\tje\t.L15\n\tcmpb\t$57, %sil\n\tmovl\t$25436, %eax\n\tcmove\t%eax, %edi\n\tjmp\t.L13\n.L17:\n\tcmpb\t$51, %sil\n\tje\t.L19\n\tcmpb\t$50, %sil\n\tje\t.L20\n.L14:\n\tmovsbl\t6+ch(%rip), %edx\n\timulq\t$10, %rax, %rax\n\tsubl\t$48, %edx\n\tmovslq\t%edx, %rdx\n\taddq\t%rdx, %rax\n\tmovl\t(%r8,%rax,4), %edi\n\tjmp\t.L13\n.L15:\n\tmovl\t$22888, %edi\n\tjmp\t.L13\n.L20:\n\tcmpb\t$32, 1+ch(%rip)\n\tjne\t.L14\n\tmovsbl\t2+ch(%rip), %edi\n\tsubl\t$48, %edi\n\tjmp\t.L13\n.L19:\n\tmovsbl\t2+ch(%rip), %eax\n\tmovl\t$52, %edi\n\tsubl\t%eax, %edi\n\tjmp\t.L13\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.globl\tch\n\t.bss\n\t.align 16\n\t.type\tch, @object\n\t.size\tch, 20\nch:\n\t.zero\t20\n\t.globl\tarr1\n\t.data\n\t.align 32\n\t.type\tarr1, @object\n\t.size\tarr1, 400\narr1:\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t100000\n\t.long\t0\n\t.long\t9029\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t7519\n\t.long\t7572\n\t.long\t1\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t9527\n\t.long\t0\n\t.long\t0\n\t.long\t13336\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t14416\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t3\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t16971\n\t.long\t0\n\t.long\t18448\n\t.long\t0\n\t.long\t50000\n\t.long\t342\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t50000\n\t.long\t0\n\t.long\t20398\n\t.long\t0\n\t.long\t0\n\t.long\t7169\n\t.long\t0\n\t.long\t0\n\t.long\t5300\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t17391\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t799\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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,13336,0,0},\n {0,14416,0,0,0,0,0,0,0,0},\n {0,0,3,0,0,0,16971,0,18448,0},\n {50000,342,0,0,0,0,0,0,0,50000},\n {0,20398,0,0,7169,0,0,5300,0,0},\n {0,0,0,0,0,0,0,0,0,0},\n {0,0,0,17391,0,0,0,0,0,0},\n {0,0,0,0,0,799,0,0,0,0}\n};\nchar ch[20];\n\nvoid puti(int i) {\n if (i >= 10) {\n puti(i / 10);\n i %= 10;\n }\n fputc(i + '0', stdout);\n}\n\nint main(void) {\n // テストケースハックする良くないコード\n fread(ch, sizeof(char), 8, stdin);\n int res = arr1[ch[0] - '0'][ch[7] - '0'];\n if (ch[7] == '\\n') {\n if (ch[0] == '3') {\n res = '4' - ch[2];\n }\n else if (ch[0] == '2' && ch[1] == ' ') {\n res = ch[2] - '0';\n }\n else\n res = arr1[ch[0] - '0'][ch[6] - '0'];\n }\n else if (ch[6] == '9') {\n if (ch[0] == '6') {\n res = 22888;\n }\n else if (ch[0] == '9') {\n res = 25436;\n }\n }\n puti(res);\n fputc('\\n', stdout);\n return 0;\n}", "index": 81, "inputs": [ "6 2\n1 2\n2 3\n", "4 4\n1 2\n2 3\n4 1\n3 0\n", "6 2\n1 0\n2 6\n", "6 2\n1 2\n2 6\n", "6 2\n2 0\n2 6\n", "3 2\n1 0\n2 3\n", "4 4\n2 2\n2 3\n4 1\n3 4\n", "4 4\n1 2\n2 3\n4 1\n1 0\n", "6 2\n1 2\n4 6\n", "3 2\n2 0\n2 3\n", "6 4\n1 2\n2 3\n4 1\n1 0\n", "6 2\n0 2\n4 6\n", "6 2\n1 4\n4 6\n", "6 2\n1 4\n3 6\n", "3 2\n1 2\n3 3\n", "4 4\n1 1\n2 3\n4 1\n3 4\n", "5 3\n1 2\n2 3\n2 3\n", "6 2\n0 2\n2 3\n", "4 4\n1 2\n2 3\n4 1\n0 0\n", "6 2\n1 3\n2 6\n", "3 2\n1 0\n2 0\n", "3 2\n2 0\n3 3\n", "6 4\n1 2\n2 0\n4 1\n1 0\n", "6 2\n0 3\n4 6\n", "6 2\n1 4\n1 6\n", "3 2\n2 2\n3 3\n", "4 4\n1 1\n0 3\n4 1\n3 4\n", "5 3\n2 2\n2 3\n2 3\n", "6 2\n0 4\n2 3\n", "4 4\n1 2\n2 3\n4 0\n0 0\n", "5 2\n1 0\n2 0\n", "7 4\n1 2\n2 0\n4 1\n1 0\n", "6 2\n0 5\n4 6\n", "4 2\n2 2\n3 3\n", "4 4\n1 1\n0 3\n4 0\n3 4\n", "6 2\n1 4\n2 3\n", "7 4\n1 2\n2 3\n4 0\n0 0\n", "4 4\n1 1\n-1 3\n4 0\n3 4\n", "9 2\n1 4\n2 3\n", "7 4\n1 2\n2 3\n7 0\n0 0\n", "12 2\n1 4\n2 3\n", "7 4\n1 2\n1 3\n7 0\n0 0\n", "12 2\n1 3\n2 3\n", "7 4\n0 2\n1 3\n7 0\n0 0\n", "12 2\n0 3\n2 3\n", "7 4\n-1 2\n1 3\n7 0\n0 0\n", "15 2\n0 3\n2 3\n", "7 4\n-1 2\n1 6\n7 0\n0 0\n", "15 2\n0 6\n2 3\n", "15 2\n0 6\n3 3\n", "15 2\n0 6\n1 3\n", "14 2\n0 6\n1 3\n", "14 2\n0 5\n1 3\n", "3 0\n1 2\n2 3\n", "3 3\n0 2\n2 3\n2 3\n", "4 4\n1 2\n2 3\n4 1\n3 1\n", "12 2\n1 0\n2 6\n", "6 2\n2 0\n3 6\n", "4 3\n1 2\n2 3\n4 1\n1 0\n", "6 2\n1 1\n4 6\n", "3 2\n2 -1\n2 3\n", "6 4\n1 2\n2 3\n4 0\n1 0\n", "6 2\n0 2\n0 6\n", "6 2\n1 4\n5 6\n", "3 2\n1 3\n3 3\n", "4 4\n1 1\n2 3\n1 1\n3 4\n", "5 3\n1 2\n2 3\n1 3\n", "6 2\n0 2\n2 6\n", "12 2\n1 3\n2 6\n", "3 2\n2 -1\n3 3\n", "6 4\n1 3\n2 0\n4 1\n1 0\n", "6 2\n0 6\n4 6\n", "6 0\n1 4\n1 6\n", "4 4\n2 1\n0 3\n4 1\n3 4\n", "9 3\n2 2\n2 3\n2 3\n", "6 2\n-1 4\n2 3\n", "4 4\n1 2\n2 3\n4 0\n1 0\n", "5 2\n1 0\n3 0\n", "7 4\n1 2\n2 0\n3 1\n1 0\n", "6 2\n0 5\n5 6\n", "4 2\n2 2\n1 3\n", "4 4\n1 1\n0 1\n4 0\n3 4\n", "10 4\n1 2\n2 3\n4 0\n0 0\n", "4 4\n1 2\n-1 3\n4 0\n3 4\n", "9 2\n1 5\n2 3\n", "7 4\n1 2\n2 2\n7 0\n0 0\n", "9 4\n1 2\n2 3\n7 0\n0 0\n", "12 2\n1 0\n2 3\n", "12 2\n0 6\n2 3\n", "15 2\n-1 3\n2 3\n", "7 4\n-1 0\n1 6\n7 0\n0 0\n", "10 2\n0 6\n2 3\n", "15 2\n0 6\n3 2\n", "14 2\n1 6\n1 3\n", "14 2\n0 5\n2 3\n", "3 0\n1 1\n2 3\n", "3 0\n0 2\n2 3\n2 3\n", "4 4\n1 4\n2 3\n4 1\n3 1\n", "12 2\n1 0\n0 6\n", "6 2\n2 1\n3 6\n", "3 2\n1 2\n2 3\n", "3 2\n1 2\n2 3\n", "3 3\n1 2\n2 3\n2 3\n", "4 4\n1 2\n2 3\n4 1\n3 4\n" ], "outputs": [ "0\n", "3\n", "0\n", "0\n", "0\n", "2\n", "3\n", "3\n", "0\n", "2\n", "0\n", "0\n", "7169\n", "7169\n", "2\n", "0\n", "0\n", "0\n", "3\n", "0\n", "2\n", "2\n", "0\n", "0\n", "7169\n", "2\n", "0\n", "0\n", "7169\n", "3\n", "50000\n", "0\n", "0\n", "3\n", "0\n", "7169\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "9029\n", "0\n", "9029\n", "0\n", "9029\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "4\n", "1\n", "3\n", "0\n", "0\n", "3\n", "20398\n", "14416\n", "0\n", "0\n", "7169\n", "2\n", "0\n", "0\n", "0\n", "9029\n", "14416\n", "0\n", "0\n", "7169\n", "0\n", "0\n", "7169\n", "3\n", "50000\n", "0\n", "0\n", "3\n", "0\n", "0\n", "3\n", "799\n", "0\n", "0\n", "0\n", "0\n", "8\n", "0\n", "0\n", "0\n", "0\n", "0\n", "4\n", "4\n", "0\n", "0\n", "20398\n", "2\n", "2\n", "1\n", "3\n" ], "question": "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,13336,0,0},\n {0,14416,0,0,0,0,0,0,0,0},\n {0,0,3,0,0,0,16971,0,18448,0},\n {50000,342,0,0,0,0,0,0,0,50000},\n {0,20398,0,0,7169,0,0,5300,0,0},\n {0,0,0,0,0,0,0,0,0,0},\n {0,0,0,17391,0,0,0,0,0,0},\n {0,0,0,0,0,799,0,0,0,0}\n};\nchar ch[20];\n\nvoid puti(int i) {\n if (i >= 10) {\n puti(i / 10);\n i %= 10;\n }\n fputc(i + '0', stdout);\n}\n\nint main(void) {\n // テストケースハックする良くないコード\n fread(ch, sizeof(char), 8, stdin);\n int res = arr1[ch[0] - '0'][ch[7] - '0'];\n if (ch[7] == '\\n') {\n if (ch[0] == '3') {\n res = '4' - ch[2];\n }\n else if (ch[0] == '2' && ch[1] == ' ') {\n res = ch[2] - '0';\n }\n else\n res = arr1[ch[0] - '0'][ch[6] - '0'];\n }\n else if (ch[6] == '9') {\n if (ch[0] == '6') {\n res = 22888;\n }\n else if (ch[0] == '9') {\n res = 25436;\n }\n }\n puti(res);\n fputc('\\n', stdout);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tarr1\n\t.data\n\t.align 32\n\t.type\tarr1, @object\n\t.size\tarr1, 400\narr1:\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t100000\n\t.long\t0\n\t.long\t9029\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t7519\n\t.long\t7572\n\t.long\t1\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t9527\n\t.long\t0\n\t.long\t0\n\t.long\t13336\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t14416\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t3\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t16971\n\t.long\t0\n\t.long\t18448\n\t.long\t0\n\t.long\t50000\n\t.long\t342\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t50000\n\t.long\t0\n\t.long\t20398\n\t.long\t0\n\t.long\t0\n\t.long\t7169\n\t.long\t0\n\t.long\t0\n\t.long\t5300\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t17391\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t799\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.long\t0\n\t.globl\tch\n\t.bss\n\t.align 16\n\t.type\tch, @object\n\t.size\tch, 20\nch:\n\t.zero\t20\n\t.text\n\t.p2align 4\n\t.globl\tputi\n\t.type\tputi, @function\nputi:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tmovl\t%edi, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 32\n\tcmpl\t$9, %edi\n\tjg\t.L5\n.L2:\n\tmovq\tstdout(%rip), %rsi\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tleal\t48(%rbx), %edi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\tfputc@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\t.cfi_restore_state\n\tmovslq\t%edi, %rbp\n\tmovl\t%edi, %eax\n\timulq\t$1717986919, %rbp, %rbp\n\tsarl\t$31, %eax\n\tsarq\t$34, %rbp\n\tsubl\t%eax, %ebp\n\tmovl\t%ebp, %edi\n\tcall\tputi\n\tleal\t0(%rbp,%rbp,4), %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ebx\n\tjmp\t.L2\n\t.cfi_endproc\n.LFE0:\n\t.size\tputi, .-puti\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tmovq\tstdin(%rip), %rcx\n\tmovl\t$8, %edx\n\tmovl\t$1, %esi\n\tleaq\tch(%rip), %rdi\n\tcall\tfread@PLT\n\tmovsbl\tch(%rip), %eax\n\tmovsbl\t7+ch(%rip), %edx\n\tleaq\tarr1(%rip), %r8\n\tmovl\t%eax, %esi\n\tsubl\t$48, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t$48, %edx\n\tcltq\n\tmovslq\t%edx, %rdx\n\tleaq\t(%rax,%rax,4), %rdi\n\tleaq\t(%rdx,%rdi,2), %rdx\n\tmovl\t(%r8,%rdx,4), %edi\n\tcmpb\t$10, %cl\n\tje\t.L13\n\tcmpb\t$57, 6+ch(%rip)\n\tje\t.L14\n.L9:\n\tcall\tputi\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$10, %edi\n\tcall\tfputc@PLT\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L14:\n\t.cfi_restore_state\n\tcmpb\t$54, %sil\n\tje\t.L11\n\tcmpb\t$57, %sil\n\tmovl\t$25436, %eax\n\tcmove\t%eax, %edi\n\tjmp\t.L9\n.L13:\n\tcmpb\t$51, %sil\n\tje\t.L15\n\tcmpb\t$50, %sil\n\tje\t.L16\n.L10:\n\tmovsbl\t6+ch(%rip), %edx\n\timulq\t$10, %rax, %rax\n\tsubl\t$48, %edx\n\tmovslq\t%edx, %rdx\n\taddq\t%rdx, %rax\n\tmovl\t(%r8,%rax,4), %edi\n\tjmp\t.L9\n.L11:\n\tmovl\t$22888, %edi\n\tjmp\t.L9\n.L16:\n\tcmpb\t$32, 1+ch(%rip)\n\tjne\t.L10\n\tmovsbl\t2+ch(%rip), %edi\n\tsubl\t$48, %edi\n\tjmp\t.L9\n.L15:\n\tmovsbl\t2+ch(%rip), %eax\n\tmovl\t$52, %edi\n\tsubl\t%eax, %edi\n\tjmp\t.L9\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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,0,0,0}, {0,0,3,0,0,0,16971,0,18448,0}, {50000,342,0,0,0,0,0,0,0,50000}, {0,20398,0,0,7169,0,0,5300,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,17391,0,0,0,0,0,0}, {0,0,0,0,0,799,0,0,0,0} }; char ch[20]; void puti(int i) { if (i >= 10) { puti(i / 10); i %= 10; } fputc(i + '0', stdout); } int main(void) { // テストケースハックする良くないコード fread(ch, sizeof(char), 8, stdin); int res = arr1[ch[0] - '0'][ch[7] - '0']; if (ch[7] == '\n') { if (ch[0] == '3') { res = '4' - ch[2]; } else if (ch[0] == '2' && ch[1] == ' ') { res = ch[2] - '0'; } else res = arr1[ch[0] - '0'][ch[6] - '0']; } else if (ch[6] == '9') { if (ch[0] == '6') { res = 22888; } else if (ch[0] == '9') { res = 25436; } } puti(res); fputc('\n', stdout); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl arr1 .data .align 32 .type arr1, @object .size arr1, 400 arr1: .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 100000 .long 0 .long 9029 .long 0 .long 0 .long 0 .long 7519 .long 7572 .long 1 .long 0 .long 0 .long 0 .long 0 .long 9527 .long 0 .long 0 .long 13336 .long 0 .long 0 .long 0 .long 14416 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 3 .long 0 .long 0 .long 0 .long 16971 .long 0 .long 18448 .long 0 .long 50000 .long 342 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 50000 .long 0 .long 20398 .long 0 .long 0 .long 7169 .long 0 .long 0 .long 5300 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 17391 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 0 .long 799 .long 0 .long 0 .long 0 .long 0 .globl ch .bss .align 16 .type ch, @object .size ch, 20 ch: .zero 20 .text .p2align 4 .globl puti .type puti, @function puti: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 pushq %rbx .cfi_def_cfa_offset 24 .cfi_offset 3, -24 movl %edi, %ebx subq $8, %rsp .cfi_def_cfa_offset 32 cmpl $9, %edi jg .L5 .L2: movq stdout(%rip), %rsi addq $8, %rsp .cfi_remember_state .cfi_def_cfa_offset 24 leal 48(%rbx), %edi popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 jmp fputc@PLT .p2align 4,,10 .p2align 3 .L5: .cfi_restore_state movslq %edi, %rbp movl %edi, %eax imulq $1717986919, %rbp, %rbp sarl $31, %eax sarq $34, %rbp subl %eax, %ebp movl %ebp, %edi call puti leal 0(%rbp,%rbp,4), %eax addl %eax, %eax subl %eax, %ebx jmp .L2 .cfi_endproc .LFE0: .size puti, .-puti .section .text.startup,"ax",@progbits .p2align 4 .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 movq stdin(%rip), %rcx movl $8, %edx movl $1, %esi leaq ch(%rip), %rdi call fread@PLT movsbl ch(%rip), %eax movsbl 7+ch(%rip), %edx leaq arr1(%rip), %r8 movl %eax, %esi subl $48, %eax movl %edx, %ecx subl $48, %edx cltq movslq %edx, %rdx leaq (%rax,%rax,4), %rdi leaq (%rdx,%rdi,2), %rdx movl (%r8,%rdx,4), %edi cmpb $10, %cl je .L13 cmpb $57, 6+ch(%rip) je .L14 .L9: call puti movq stdout(%rip), %rsi movl $10, %edi call fputc@PLT xorl %eax, %eax addq $8, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L14: .cfi_restore_state cmpb $54, %sil je .L11 cmpb $57, %sil movl $25436, %eax cmove %eax, %edi jmp .L9 .L13: cmpb $51, %sil je .L15 cmpb $50, %sil je .L16 .L10: movsbl 6+ch(%rip), %edx imulq $10, %rax, %rax subl $48, %edx movslq %edx, %rdx addq %rdx, %rax movl (%r8,%rax,4), %edi jmp .L9 .L11: movl $22888, %edi jmp .L9 .L16: cmpb $32, 1+ch(%rip) jne .L10 movsbl 2+ch(%rip), %edi subl $48, %edi jmp .L9 .L15: movsbl 2+ch(%rip), %eax movl $52, %edi subl %eax, %edi jmp .L9 .cfi_endproc .LFE1: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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) / b)));\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld %lld %lld\"\n.LC1:\n\t.string\t\"%lld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rcx\n\tleaq\t-24(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L2\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\timulq\t%rdx, %rax\n\tmovq\t-24(%rbp), %rsi\n\tcqto\n\tidivq\t%rsi\n\tjmp\t.L3\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\timulq\t%rdx, %rax\n\tmovq\t-24(%rbp), %rdi\n\tcqto\n\tidivq\t%rdi\n.L3:\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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$40, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rcx\n\tleaq\t8(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t16(%rsp), %rax\n\tmovq\t8(%rsp), %rcx\n\tcmpq\t%rcx, %rax\n\tjl\t.L6\n\tleaq\t-1(%rcx), %rax\n.L6:\n\timulq\t(%rsp), %rax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rcx\n\tleaq\t8(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t16(%rsp), %rax\n\tmovq\t8(%rsp), %rcx\n\tcmpq\t%rcx, %rax\n\tjl\t.L6\n\tleaq\t-1(%rcx), %rax\n.L6:\n\timulq\t(%rsp), %rax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L8:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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) / b)));\n return 0;\n}", "index": 79, "inputs": [ "4 7 4\n", "1 7 4\n", "5 7 5\n", "2 7 4\n", "7 7 5\n", "20 10 3\n", "35 10 3\n", "9 6 5\n", "56 12 1\n", "11 4 4\n", "11 11 9\n", "-2 2 1\n", "14 7 8\n", "42 7 3\n", "11 10 2\n", "2 10 2\n", "1 7 1\n", "2 10 0\n", "1 7 0\n", "2 11 0\n", "2 11 1\n", "3 11 1\n", "2 12 1\n", "3 12 1\n", "0 12 1\n", "0 12 2\n", "0 19 2\n", "0 19 3\n", "0 23 3\n", "0 35 3\n", "0 41 3\n", "0 34 3\n", "0 68 3\n", "1 68 3\n", "0 68 2\n", "0 130 2\n", "0 130 4\n", "1 130 4\n", "0 254 4\n", "1 1 4\n", "11 10 0\n", "11 10 3\n", "0 10 2\n", "1 9 1\n", "2 15 0\n", "0 7 0\n", "2 8 0\n", "4 11 1\n", "4 11 2\n", "2 12 2\n", "5 12 1\n", "1 12 2\n", "1 19 3\n", "0 23 5\n", "0 35 2\n", "1 41 3\n", "1 34 3\n", "0 73 3\n", "1 130 3\n", "0 22 2\n", "0 29 2\n", "1 260 4\n", "0 486 4\n", "1 1 2\n", "11 10 1\n", "0 5 2\n", "1 15 1\n", "2 20 0\n", "-1 7 0\n", "1 8 0\n", "7 11 1\n", "1 5 2\n", "10 12 1\n", "0 8 2\n", "1 36 3\n", "0 32 5\n", "0 35 1\n", "1 5 3\n", "1 34 1\n", "0 78 3\n", "0 130 3\n", "0 29 1\n", "2 260 4\n", "0 297 4\n", "1 1 3\n", "11 19 2\n", "9 7 5\n", "1 5 1\n", "1 15 0\n", "-1 1 0\n", "2 7 0\n", "7 20 1\n", "10 12 0\n", "0 1 2\n", "0 36 3\n", "1 32 5\n", "1 35 2\n", "1 8 3\n", "1 44 1\n", "0 30 3\n", "5 7 4\n", "5 7 4\n", "11 10 9\n" ], "outputs": [ "2", "0", "3", "1", "5", "6", "10", "7", "4", "8", "9", "-1", "12", "18", "2", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "6", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "2", "2", "9" ], "question": "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) / b)));\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld %lld %lld\"\n.LC1:\n\t.string\t\"%lld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rcx\n\tleaq\t-24(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L2\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\timulq\t%rdx, %rax\n\tmovq\t-24(%rbp), %rsi\n\tcqto\n\tidivq\t%rsi\n\tjmp\t.L3\n.L2:\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\timulq\t%rdx, %rax\n\tmovq\t-24(%rbp), %rdi\n\tcqto\n\tidivq\t%rdi\n.L3:\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lld %lld %lld" .LC1: .string "%lld" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -16(%rbp), %rcx leaq -24(%rbp), %rdx leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -16(%rbp), %rdx movq -24(%rbp), %rax cmpq %rax, %rdx jge .L2 movq -32(%rbp), %rdx movq -16(%rbp), %rax imulq %rdx, %rax movq -24(%rbp), %rsi cqto idivq %rsi jmp .L3 .L2: movq -24(%rbp), %rax leaq -1(%rax), %rdx movq -32(%rbp), %rax imulq %rdx, %rax movq -24(%rbp), %rdi cqto idivq %rdi .L3: movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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; z<=100; z++){\n tmp = x*x + y*y + z*z + x*y + y*z + z*x;\n if( tmp <= 10000 ){ cnt[tmp]++; }\n }\n }\n }\n for(int i=1; i<=n; i++){ printf(\"%d\\n\",cnt[i]); }\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-36864(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3184, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -40020(%rbp)\n\tleaq\t-40016(%rbp), %rax\n\tmovl\t$40004, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-40040(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -40036(%rbp)\n\tjmp\t.L2\n.L8:\n\tmovl\t$1, -40032(%rbp)\n\tjmp\t.L3\n.L7:\n\tmovl\t$1, -40028(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-40036(%rbp), %eax\n\timull\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-40032(%rbp), %eax\n\timull\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-40028(%rbp), %eax\n\timull\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-40036(%rbp), %eax\n\timull\t-40032(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-40032(%rbp), %eax\n\timull\t-40028(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-40028(%rbp), %eax\n\timull\t-40036(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -40020(%rbp)\n\tcmpl\t$10000, -40020(%rbp)\n\tjg\t.L5\n\tmovl\t-40020(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-40020(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -40016(%rbp,%rax,4)\n.L5:\n\taddl\t$1, -40028(%rbp)\n.L4:\n\tcmpl\t$100, -40028(%rbp)\n\tjle\t.L6\n\taddl\t$1, -40032(%rbp)\n.L3:\n\tcmpl\t$100, -40032(%rbp)\n\tjle\t.L7\n\taddl\t$1, -40036(%rbp)\n.L2:\n\tcmpl\t$100, -40036(%rbp)\n\tjle\t.L8\n\tmovl\t$1, -40024(%rbp)\n\tjmp\t.L9\n.L10:\n\tmovl\t-40024(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -40024(%rbp)\n.L9:\n\tmovl\t-40040(%rbp), %eax\n\tcmpl\t%eax, -40024(%rbp)\n\tjle\t.L10\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t-36864(%rsp), %r11\n\t.cfi_def_cfa 11, 36896\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3168, %rsp\n\t.cfi_def_cfa_offset 40064\n\tmovl\t$40004, %edx\n\txorl\t%esi, %esi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40024(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbx\n\tmovq\t%rbx, %rdi\n\tcall\tmemset@PLT\n\tleaq\t12(%rsp), %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, %r9d\n.L2:\n\tmovl\t%r9d, %r11d\n\tmovl\t%r9d, %r10d\n\tmovl\t$1, %edi\n\timull\t%r9d, %r11d\n.L8:\n\tmovl\t%edi, %r8d\n\tmovl\t%r9d, %esi\n\tmovl\t%edi, %ecx\n\tmovl\t$1, %edx\n\timull\t%edi, %r8d\n\taddl\t%r11d, %r8d\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t%edx, %eax\n\timull\t%edx, %eax\n\taddl\t%r8d, %eax\n\taddl\t%r10d, %eax\n\taddl\t%ecx, %eax\n\taddl\t%esi, %eax\n\tcmpl\t$10000, %eax\n\tjg\t.L3\n\tcltq\n\taddl\t$1, 16(%rsp,%rax,4)\n.L3:\n\taddl\t$1, %edx\n\taddl\t%edi, %ecx\n\taddl\t%r9d, %esi\n\tcmpl\t$101, %edx\n\tjne\t.L4\n\taddl\t$1, %edi\n\taddl\t%r9d, %r10d\n\tcmpl\t$101, %edi\n\tjne\t.L8\n\taddl\t$1, %r9d\n\tcmpl\t$101, %r9d\n\tjne\t.L2\n\tmovl\t12(%rsp), %eax\n\tmovl\t$1, %ebp\n\tleaq\t.LC1(%rip), %r12\n\ttestl\t%eax, %eax\n\tjle\t.L7\n.L6:\n\tmovl\t(%rbx,%rbp,4), %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbp\n\tcall\t__printf_chk@PLT\n\tcmpl\t%ebp, 12(%rsp)\n\tjge\t.L6\n.L7:\n\tmovq\t40024(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L17\n\taddq\t$40032, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L17:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t-36864(%rsp), %r11\n\t.cfi_def_cfa 11, 36896\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$3168, %rsp\n\t.cfi_def_cfa_offset 40064\n\tmovl\t$40004, %edx\n\txorl\t%esi, %esi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40024(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbx\n\tmovq\t%rbx, %rdi\n\tcall\tmemset@PLT\n\tleaq\t12(%rsp), %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, %r9d\n.L2:\n\tmovl\t%r9d, %r11d\n\tmovl\t%r9d, %r10d\n\tmovl\t$1, %edi\n\timull\t%r9d, %r11d\n.L8:\n\tmovl\t%edi, %r8d\n\tmovl\t%r9d, %esi\n\tmovl\t%edi, %ecx\n\tmovl\t$1, %edx\n\timull\t%edi, %r8d\n\taddl\t%r11d, %r8d\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t%edx, %eax\n\timull\t%edx, %eax\n\taddl\t%r8d, %eax\n\taddl\t%r10d, %eax\n\taddl\t%ecx, %eax\n\taddl\t%esi, %eax\n\tcmpl\t$10000, %eax\n\tjg\t.L3\n\tcltq\n\taddl\t$1, 16(%rsp,%rax,4)\n.L3:\n\taddl\t$1, %edx\n\taddl\t%edi, %ecx\n\taddl\t%r9d, %esi\n\tcmpl\t$101, %edx\n\tjne\t.L4\n\taddl\t$1, %edi\n\taddl\t%r9d, %r10d\n\tcmpl\t$101, %edi\n\tjne\t.L8\n\taddl\t$1, %r9d\n\tcmpl\t$101, %r9d\n\tjne\t.L2\n\tmovl\t12(%rsp), %eax\n\tmovl\t$1, %ebp\n\tleaq\t.LC1(%rip), %r12\n\ttestl\t%eax, %eax\n\tjle\t.L7\n.L6:\n\tmovl\t(%rbx,%rbp,4), %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbp\n\tcall\t__printf_chk@PLT\n\tcmpl\t%ebp, 12(%rsp)\n\tjge\t.L6\n.L7:\n\tmovq\t40024(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L17\n\taddq\t$40032, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L17:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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; z<=100; z++){\n tmp = x*x + y*y + z*z + x*y + y*z + z*x;\n if( tmp <= 10000 ){ cnt[tmp]++; }\n }\n }\n }\n for(int i=1; i<=n; i++){ printf(\"%d\\n\",cnt[i]); }\n return 0;\n}\n", "index": 87, "inputs": [ "27\n", "13\n", "3\n", "2\n", "4\n", "8\n", "14\n", "1\n", "31\n", "53\n", "10\n", "5\n", "6\n", "11\n", "15\n", "9\n", "16\n", "12\n", "22\n", "7\n", "29\n", "23\n", "21\n", "18\n", "17\n", "32\n", "33\n", "45\n", "25\n", "28\n", "24\n", "19\n", "43\n", "41\n", "42\n", "26\n", "52\n", "40\n", "44\n", "36\n", "60\n", "30\n", "104\n", "62\n", "35\n", "84\n", "37\n", "80\n", "79\n", "38\n", "34\n", "51\n", "70\n", "63\n", "46\n", "39\n", "58\n", "171\n", "49\n", "64\n", "65\n", "83\n", "97\n", "76\n", "110\n", "71\n", "334\n", "90\n", "102\n", "73\n", "99\n", "135\n", "122\n", "132\n", "390\n", "150\n", "157\n", "72\n", "131\n", "181\n", "138\n", "743\n", "198\n", "124\n", "112\n", "320\n", "293\n", "183\n", "117\n", "395\n", "418\n", "48\n", "218\n", "153\n", "344\n", "56\n", "335\n", "270\n", "587\n", "50\n", "20\n", "20\n" ], "outputs": [ "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n", "0\n0\n0\n", "0\n0\n", "0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n", "0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n0\n12\n0\n9\n6\n0\n3\n12\n3\n6\n6\n12\n6\n6\n0\n0\n0\n15\n3\n18\n3\n18\n3\n12\n6\n3\n6\n9\n0\n12\n0\n12\n0\n18\n12\n0\n0\n12\n3\n6\n0\n6\n6\n9\n6\n0\n0\n18\n1\n18\n3\n12\n6\n6\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n0\n12\n0\n9\n6\n0\n3\n12\n3\n6\n6\n12\n6\n6\n0\n0\n0\n15\n3\n18\n3\n18\n3\n12\n6\n3\n6\n9\n0\n12\n0\n12\n0\n18\n12\n0\n0\n12\n3\n6\n0\n6\n6\n9\n6\n0\n0\n18\n1\n18\n3\n12\n6\n6\n6\n12\n0\n15\n6\n12\n6\n18\n0\n0\n6\n0\n9\n12\n0\n18\n0\n6\n3\n12\n0\n12\n12\n0\n0\n12\n0\n3\n6\n12\n6\n18\n9\n18\n0\n9\n6\n18\n0\n6\n0\n6\n3\n27\n6\n6\n6\n6\n3\n6\n0\n12\n6\n9\n0\n6\n0\n18\n0\n9\n9\n15\n3\n12\n6\n6\n3\n9\n6\n12\n12\n18\n0\n18\n0\n6\n6\n21\n6\n0\n0\n6\n3\n15\n6\n12\n6\n18\n0\n0\n0\n12\n6\n6\n3\n6\n4\n18\n6\n12\n6\n3\n9\n30\n0\n18\n0\n6\n6\n12\n6\n6\n9\n12\n0\n18\n6\n18\n0\n6\n0\n12\n0\n6\n12\n6\n3\n18\n0\n6\n6\n6\n6\n15\n3\n24\n0\n6\n3\n18\n0\n12\n6\n12\n6\n24\n0\n15\n18\n9\n6\n0\n0\n18\n3\n6\n0\n15\n12\n12\n6\n6\n0\n18\n0\n6\n3\n12\n0\n12\n6\n6\n9\n9\n6\n24\n3\n24\n0\n9\n12\n6\n6\n12\n0\n12\n0\n21\n9\n15\n6\n12\n3\n18\n3\n12\n6\n12\n6\n0\n0\n12\n0\n12\n6\n24\n0\n6\n12\n6\n1\n9\n6\n12\n6\n24\n0\n18\n3\n12\n6\n6\n12\n24\n0\n12\n6\n15\n6\n18\n0\n18\n0\n0\n0\n18\n9\n21\n12\n0\n6\n18\n0\n9\n6\n6\n6\n12\n0\n12\n0\n9\n9\n27\n6\n6\n3\n18\n6\n21\n6\n6\n12\n12\n0\n12\n0\n24\n12\n0\n0\n24\n3\n24\n6\n12\n12\n18\n0\n0\n0\n12\n0\n18\n3\n15\n6\n12\n9\n6\n0\n15\n6\n9\n12\n24\n0\n12\n3\n6\n6\n21\n6\n18\n3\n18\n0\n21\n12\n15\n6\n6\n0\n12\n3\n12\n9\n18\n9\n12\n6\n6\n6\n24\n0\n18\n3\n24\n0\n6\n6\n0\n6\n9\n6\n6\n4\n30\n0\n18\n12\n9\n6\n24\n0\n18\n0\n9\n12\n21\n6\n6\n12\n12\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n0\n12\n0\n9\n6\n0\n3\n12\n3\n6\n6\n12\n6\n6\n0\n0\n0\n15\n3\n18\n3\n18\n3\n12\n6\n3\n6\n9\n0\n12\n0\n12\n0\n18\n12\n0\n0\n12\n3\n6\n0\n6\n6\n9\n6\n0\n0\n18\n1\n18\n3\n12\n6\n6\n6\n12\n0\n15\n6\n12\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n0\n12\n0\n9\n6\n0\n3\n12\n3\n6\n6\n12\n6\n6\n0\n0\n0\n15\n3\n18\n3\n18\n3\n12\n6\n3\n6\n9\n0\n12\n0\n12\n0\n18\n12\n0\n0\n12\n3\n6\n0\n6\n6\n9\n6\n0\n0\n18\n1\n18\n3\n12\n6\n6\n6\n12\n0\n15\n6\n12\n6\n18\n0\n0\n6\n0\n9\n12\n0\n18\n0\n6\n3\n12\n0\n12\n12\n0\n0\n12\n0\n3\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n0\n12\n0\n9\n6\n0\n3\n12\n3\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n6\n0\n0\n0\n0\n6\n1\n6\n0\n6\n6\n0\n3\n12\n0\n6\n0\n0\n3\n6\n0\n0\n0\n3\n3\n12\n0\n6\n3\n6\n0\n3\n6\n9\n0\n6\n0\n0\n0\n3\n6\n3\n3\n6\n0\n6\n3\n12\n0\n3\n6\n6\n0\n6\n0\n6\n3\n6\n0\n0\n1\n6\n3\n12\n6\n0\n0\n12\n0\n6\n0\n6\n6\n12\n0\n0\n6\n0\n0\n6\n0\n12\n3\n6\n0\n6\n3\n9\n6\n3\n6\n6\n0\n6\n0\n6\n0\n15\n6\n0\n0\n6\n0\n3\n3\n12\n0\n12\n6\n6\n0\n3\n6\n6\n3\n12\n0\n6\n0\n9\n6\n0\n0\n6\n3\n12\n1\n6\n6\n6\n6\n0\n0\n18\n0\n12\n0\n3\n6\n12\n0\n0\n6\n3\n6\n12\n0\n12\n0\n0\n0\n9\n3\n9\n6\n12\n3\n12\n0\n3\n6\n6\n0\n12\n0\n12\n0\n9\n9\n0\n0\n6\n3\n6\n3\n12\n6\n9\n3\n6\n0\n12\n3\n6\n3\n9\n6\n12\n6\n6\n0\n6\n0\n9\n6\n6\n0\n12\n3\n6\n0\n9\n6\n6\n1\n6\n0\n21\n12\n6\n0\n12\n0\n12\n0\n0\n6\n15\n6\n0\n6\n12\n0\n12\n0\n12\n0\n0\n0\n12\n0\n12\n12\n3\n3\n18\n3\n6\n3\n6\n6\n9\n9\n18\n0\n6\n0\n12\n0\n9\n6\n0\n3\n12\n3\n6\n6\n12\n6\n6\n0\n0\n0\n15\n3\n18\n3\n18\n3\n12\n6\n3\n6\n9\n0\n12\n0\n12\n0\n18\n12\n0\n0\n12\n3\n6\n0\n6\n6\n9\n6\n0\n0\n18\n1\n18\n3\n12\n6\n6\n6\n12\n0\n15\n6\n12\n6\n18\n0\n0\n6\n0\n9\n12\n0\n18\n0\n6\n3\n12\n0\n12\n12\n0\n0\n12\n0\n3\n6\n12\n6\n18\n9\n18\n0\n9\n6\n18\n0\n6\n0\n6\n3\n27\n6\n6\n6\n6\n3\n6\n0\n12\n6\n9\n0\n6\n0\n18\n0\n9\n9\n15\n3\n12\n6\n6\n3\n9\n6\n12\n12\n18\n0\n18\n0\n6\n6\n21\n6\n0\n0\n6\n3\n15\n6\n12\n6\n18\n0\n0\n0\n12\n6\n6\n3\n6\n4\n18\n6\n12\n6\n3\n9\n30\n0\n18\n0\n6\n6\n12\n6\n6\n9\n12\n0\n18\n6\n18\n0\n6\n0\n12\n0\n6\n12\n6\n3\n18\n0\n6\n6\n6\n6\n15\n3\n24\n0\n6\n3\n18\n0\n12\n6\n12\n6\n24\n0\n15\n18\n9\n6\n0\n0\n18\n3\n6\n0\n15\n12\n12\n6\n6\n0\n18\n0\n6\n3\n12\n0\n12\n6\n6\n9\n9\n6\n24\n3\n24\n0\n9\n12\n6\n6\n12\n0\n12\n0\n21\n9\n15\n6\n12\n3\n18\n3\n12\n6\n12\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n", "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n" ], "question": "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; z<=100; z++){\n tmp = x*x + y*y + z*z + x*y + y*z + z*x;\n if( tmp <= 10000 ){ cnt[tmp]++; }\n }\n }\n }\n for(int i=1; i<=n; i++){ printf(\"%d\\n\",cnt[i]); }\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-36864(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$3184, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -40020(%rbp)\n\tleaq\t-40016(%rbp), %rax\n\tmovl\t$40004, %edx\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tleaq\t-40040(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -40036(%rbp)\n\tjmp\t.L2\n.L8:\n\tmovl\t$1, -40032(%rbp)\n\tjmp\t.L3\n.L7:\n\tmovl\t$1, -40028(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-40036(%rbp), %eax\n\timull\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-40032(%rbp), %eax\n\timull\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-40028(%rbp), %eax\n\timull\t%eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-40036(%rbp), %eax\n\timull\t-40032(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-40032(%rbp), %eax\n\timull\t-40028(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-40028(%rbp), %eax\n\timull\t-40036(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -40020(%rbp)\n\tcmpl\t$10000, -40020(%rbp)\n\tjg\t.L5\n\tmovl\t-40020(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-40020(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -40016(%rbp,%rax,4)\n.L5:\n\taddl\t$1, -40028(%rbp)\n.L4:\n\tcmpl\t$100, -40028(%rbp)\n\tjle\t.L6\n\taddl\t$1, -40032(%rbp)\n.L3:\n\tcmpl\t$100, -40032(%rbp)\n\tjle\t.L7\n\taddl\t$1, -40036(%rbp)\n.L2:\n\tcmpl\t$100, -40036(%rbp)\n\tjle\t.L8\n\tmovl\t$1, -40024(%rbp)\n\tjmp\t.L9\n.L10:\n\tmovl\t-40024(%rbp), %eax\n\tcltq\n\tmovl\t-40016(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -40024(%rbp)\n.L9:\n\tmovl\t-40040(%rbp), %eax\n\tcmpl\t%eax, -40024(%rbp)\n\tjle\t.L10\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L12\n\tcall\t__stack_chk_fail@PLT\n.L12:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 + y*y + z*z + x*y + y*z + z*x; if( tmp <= 10000 ){ cnt[tmp]++; } } } } for(int i=1; i<=n; i++){ printf("%d\n",cnt[i]); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -36864(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $3184, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -40020(%rbp) leaq -40016(%rbp), %rax movl $40004, %edx movl $0, %esi movq %rax, %rdi call memset@PLT leaq -40040(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -40036(%rbp) jmp .L2 .L8: movl $1, -40032(%rbp) jmp .L3 .L7: movl $1, -40028(%rbp) jmp .L4 .L6: movl -40036(%rbp), %eax imull %eax, %eax movl %eax, %edx movl -40032(%rbp), %eax imull %eax, %eax addl %eax, %edx movl -40028(%rbp), %eax imull %eax, %eax addl %eax, %edx movl -40036(%rbp), %eax imull -40032(%rbp), %eax addl %eax, %edx movl -40032(%rbp), %eax imull -40028(%rbp), %eax addl %eax, %edx movl -40028(%rbp), %eax imull -40036(%rbp), %eax addl %edx, %eax movl %eax, -40020(%rbp) cmpl $10000, -40020(%rbp) jg .L5 movl -40020(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %eax leal 1(%rax), %edx movl -40020(%rbp), %eax cltq movl %edx, -40016(%rbp,%rax,4) .L5: addl $1, -40028(%rbp) .L4: cmpl $100, -40028(%rbp) jle .L6 addl $1, -40032(%rbp) .L3: cmpl $100, -40032(%rbp) jle .L7 addl $1, -40036(%rbp) .L2: cmpl $100, -40036(%rbp) jle .L8 movl $1, -40024(%rbp) jmp .L9 .L10: movl -40024(%rbp), %eax cltq movl -40016(%rbp,%rax,4), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT addl $1, -40024(%rbp) .L9: movl -40040(%rbp), %eax cmpl %eax, -40024(%rbp) jle .L10 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L12 call __stack_chk_fail@PLT .L12: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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//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#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint nHr(int a,int b){return nCr(a+b-1,b);}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llnHr(long long a,long long b){return llnCr(a+b-1,b);}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\n\nvoid shuffledget(int x[],int n){\n srand(time(0));\n int i,b[524288],p,c;\n for(i=0;i<n;i++){\n b[i]=i;\n }\n for(i=n;i>=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[b[i]]);\n }\n}\n\nint dx4[4]={1,-1,0,0};\nint dy4[4]={0,0,1,-1};\nint dx8[8]={-1,-1,-1,0,0,1,1,1};\nint dy8[8]={-1,0,1,-1,1,-1,0,1};\n\nint search(int x,int a[],int n){\n int st=0,fi=n-1,te;\n while(st<=fi){\n te=(st+fi)/2;\n if(a[te]<x){st=te+1;}else{fi=te-1;}\n }\n return st;\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nlong long cid(long long x,long long w,long long d){\n if(x<w){return 0;}\n return ((x-w)/d)+1;\n}\n\nint main(void){\n long long i,j,n,m,k,a,b,c,h,r=0,l,t;\n long long w[131072],d[131072];\n long long st=0,fi=llinf,te;\n char s[524288];\n scanf(\"%lld%lld\",&n,&k);\n //l=strlen(s);\n for(i=0;i<n;i++){\n scanf(\"%lld%lld\",&w[i],&d[i]);\n }\n while(st<=fi){\n te=(st+fi)/2;r=0;\n for(i=0;i<n;i++){\n r+=cid(te,w[i],d[i]);\n if(r>=k){break;}\n }\n if(r<k){st=te+1;}else{fi=te-1;}\n }\n //shuffledget(a,n);\n //qsort(a,n,sizeof(int),sortfncsj);\n printf(\"%lld\\n\",st);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L2\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t-8(%rbp), %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmax, .-max\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjge\t.L5\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L6\n.L5:\n\tmovl\t-8(%rbp), %eax\n.L6:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmin, .-min\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$8, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -12(%rbp)\n\tmovl\t%esi, -16(%rbp)\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmax\n\tmovl\t%eax, %ebx\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmin\n\tmovl\t%eax, %edx\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tzt, .-zt\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjg\t.L10\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n\tjmp\t.L11\n.L10:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n.L11:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tround, .-round\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L13\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tjmp\t.L14\n.L13:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n.L14:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tceil, .-ceil\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L16:\n\tcmpl\t$0, -24(%rbp)\n\tjne\t.L17\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tgcd, .-gcd\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-4(%rbp)\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %eax\n\timull\t-24(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tlcm, .-lcm\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tsubl\t-8(%rbp), %eax\n\tmovl\t-4(%rbp), %edx\n\timull\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L22:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L23\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tnCr, .-nCr\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t%edx, %edi\n\tcall\tnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tnHr, .-nHr\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L28\n.L29:\n\tmovl\t-4(%rbp), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L28:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjle\t.L29\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tfact, .-fact\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L32\n.L33:\n\tmovl\t-4(%rbp), %eax\n\timull\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L32:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L33\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpow, .-pow\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L36\n.L37:\n\tmovl\t-20(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\taddl\t%edx, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -20(%rbp)\n.L36:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L37\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tdsum, .-dsum\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L40\n.L41:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -20(%rbp)\n.L40:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L41\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tdsumb, .-dsumb\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\timull\t-4(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tsankaku, .-sankaku\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjle\t.L46\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L47\n.L46:\n\tmovq\t-16(%rbp), %rax\n.L47:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tllmax, .-llmax\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L49\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L50\n.L49:\n\tmovq\t-16(%rbp), %rax\n.L50:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tllmin, .-llmin\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -16(%rbp)\n\tmovq\t%rsi, -24(%rbp)\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmax\n\tmovq\t%rax, %rbx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmin\n\tmovq\t%rax, %rdx\n\tmovq\t%rbx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tllzt, .-llzt\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjg\t.L54\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n\tjmp\t.L55\n.L54:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n.L55:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tllround, .-llround\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L57\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tjmp\t.L58\n.L57:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n.L58:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tllceil, .-llceil\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tjmp\t.L60\n.L61:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n.L60:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L61\n\tmovq\t-24(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tllgcd, .-llgcd\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllgcd\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-8(%rbp)\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t-32(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tlllcm, .-lllcm\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L66\n.L67:\n\tmovq\t-24(%rbp), %rax\n\taddq\t$1, %rax\n\tsubq\t-16(%rbp), %rax\n\tmovq\t-8(%rbp), %rdx\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L66:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L67\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tllnCr, .-llnCr\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB28:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\tllnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE28:\n\t.size\tllnHr, .-llnHr\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L72\n.L73:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L72:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjle\t.L73\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tllfact, .-llfact\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L76\n.L77:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L76:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L77\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tllpow, .-llpow\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L80\n.L81:\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tmovq\t%rcx, %rsi\n\tsarq\t$63, %rsi\n\tsubq\t%rsi, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\taddq\t%rdx, -8(%rbp)\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tsarq\t$63, %rcx\n\tmovq\t%rcx, %rdx\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -24(%rbp)\n.L80:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L81\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE31:\n\t.size\tlldsum, .-lldsum\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L84\n.L85:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rax, -24(%rbp)\n.L84:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L85\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE32:\n\t.size\tlldsumb, .-lldsumb\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB33:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\taddq\t$1, %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tllsankaku, .-llsankaku\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L94\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L92\n.L94:\n\tmovsd\t-16(%rbp), %xmm0\n.L92:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE34:\n\t.size\tdbmax, .-dbmax\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t-8(%rbp), %xmm0\n\tjbe\t.L100\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L98\n.L100:\n\tmovsd\t-16(%rbp), %xmm0\n.L98:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE35:\n\t.size\tdbmin, .-dbmin\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB36:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovsd\t%xmm1, -24(%rbp)\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmax\n\tmovq\t%xmm0, %rbx\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmin\n\tmovq\t%rbx, %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t%xmm1, %rax\n\tmovq\t%rax, %xmm0\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE36:\n\t.size\tdbzt, .-dbzt\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB37:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L104\n\tmovl\t$1, %eax\n\tjmp\t.L105\n.L104:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L106\n\tmovl\t$0, %eax\n\tjmp\t.L105\n.L106:\n\tmovl\t$-1, %eax\n.L105:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE37:\n\t.size\tsortfncsj, .-sortfncsj\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB38:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L108\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L108:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L110\n\tmovl\t$0, %eax\n\tjmp\t.L109\n.L110:\n\tmovl\t$-1, %eax\n.L109:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE38:\n\t.size\tsortfnckj, .-sortfnckj\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L112\n\tmovl\t$1, %eax\n\tjmp\t.L113\n.L112:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L114\n\tmovl\t$0, %eax\n\tjmp\t.L113\n.L114:\n\tmovl\t$-1, %eax\n.L113:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L116\n\tmovl\t$1, %eax\n\tjmp\t.L117\n.L116:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L118\n\tmovl\t$0, %eax\n\tjmp\t.L117\n.L118:\n\tmovl\t$-1, %eax\n.L117:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L127\n\tmovl\t$1, %eax\n\tjmp\t.L122\n.L127:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L123\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L123\n\tmovl\t$0, %eax\n\tjmp\t.L122\n.L123:\n\tmovl\t$-1, %eax\n.L122:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L136\n\tmovl\t$1, %eax\n\tjmp\t.L131\n.L136:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L132\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L132\n\tmovl\t$0, %eax\n\tjmp\t.L131\n.L132:\n\tmovl\t$-1, %eax\n.L131:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE44:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-2097152(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -2097192(%rbp)\n\tmovl\t%esi, -2097196(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, %edi\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L142\n.L143:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097180(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\taddl\t$1, -2097180(%rbp)\n.L142:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L143\n\tmovl\t-2097196(%rbp), %eax\n\tmovl\t%eax, -2097180(%rbp)\n\tjmp\t.L144\n.L145:\n\tcall\trand@PLT\n\tcltd\n\tidivl\t-2097180(%rbp)\n\tmovl\t%edx, -2097176(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tmovl\t%eax, -2097172(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tleal\t-1(%rax), %ecx\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %edx\n\tmovslq\t%ecx, %rax\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097172(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tsubl\t$1, -2097180(%rbp)\n.L144:\n\tcmpl\t$0, -2097180(%rbp)\n\tjg\t.L145\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L146\n.L147:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-2097192(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -2097180(%rbp)\n.L146:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L147\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L148\n\tcall\t__stack_chk_fail@PLT\n.L148:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tshuffledget, .-shuffledget\n\t.globl\tdx4\n\t.data\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy8\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.text\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB46:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t%edx, -24(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L150\n.L152:\n\tmovl\t-12(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L151\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L150\n.L151:\n\tmovl\t-4(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n.L150:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L152\n\tmovl\t-12(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE46:\n\t.size\tsearch, .-search\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L155\n\tmovl\t$-1, %eax\n\tjmp\t.L156\n.L155:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L157\n\tmovl\t$1, %eax\n\tjmp\t.L156\n.L157:\n\tmovl\t$0, %eax\n.L156:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.globl\tcid\n\t.type\tcid, @function\ncid:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L159\n\tmovl\t$0, %eax\n\tjmp\t.L160\n.L159:\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tcqto\n\tidivq\t-24(%rbp)\n\taddq\t$1, %rax\n.L160:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE48:\n\t.size\tcid, .-cid\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%lld%lld\"\n.LC2:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB49:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-2621440(%rsp), %r11\n.LPSRL1:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL1\n\tsubq\t$80, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$0, -2621488(%rbp)\n\tmovq\t$0, -2621480(%rbp)\n\tmovabsq\t$4154118101919364364, %rax\n\tmovq\t%rax, -2621472(%rbp)\n\tleaq\t-2621504(%rbp), %rdx\n\tleaq\t-2621512(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -2621496(%rbp)\n\tjmp\t.L162\n.L163:\n\tleaq\t-1572880(%rbp), %rdx\n\tmovq\t-2621496(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tleaq\t-2621456(%rbp), %rcx\n\tmovq\t-2621496(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -2621496(%rbp)\n.L162:\n\tmovq\t-2621512(%rbp), %rax\n\tcmpq\t%rax, -2621496(%rbp)\n\tjl\t.L163\n\tjmp\t.L164\n.L170:\n\tmovq\t-2621480(%rbp), %rdx\n\tmovq\t-2621472(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tmovq\t%rax, -2621464(%rbp)\n\tmovq\t$0, -2621488(%rbp)\n\tmovq\t$0, -2621496(%rbp)\n\tjmp\t.L165\n.L168:\n\tmovq\t-2621496(%rbp), %rax\n\tmovq\t-1572880(%rbp,%rax,8), %rdx\n\tmovq\t-2621496(%rbp), %rax\n\tmovq\t-2621456(%rbp,%rax,8), %rcx\n\tmovq\t-2621464(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tcid\n\taddq\t%rax, -2621488(%rbp)\n\tmovq\t-2621504(%rbp), %rax\n\tcmpq\t%rax, -2621488(%rbp)\n\tjge\t.L173\n\taddq\t$1, -2621496(%rbp)\n.L165:\n\tmovq\t-2621512(%rbp), %rax\n\tcmpq\t%rax, -2621496(%rbp)\n\tjl\t.L168\n\tjmp\t.L167\n.L173:\n\tnop\n.L167:\n\tmovq\t-2621504(%rbp), %rax\n\tcmpq\t%rax, -2621488(%rbp)\n\tjge\t.L169\n\tmovq\t-2621464(%rbp), %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, -2621480(%rbp)\n\tjmp\t.L164\n.L169:\n\tmovq\t-2621464(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -2621472(%rbp)\n.L164:\n\tmovq\t-2621480(%rbp), %rax\n\tcmpq\t-2621472(%rbp), %rax\n\tjle\t.L170\n\tmovq\t-2621480(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L172\n\tcall\t__stack_chk_fail@PLT\n.L172:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE49:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\nmin:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovle\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tmin, .-min\n\t.p2align 4\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tcmovg\t%esi, %edi\n\tsubl\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tzt, .-zt\n\t.p2align 4\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %edx\n\tcmpl\t%esi, %edx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tround, .-round\n\t.p2align 4\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t$1, %edx\n\tsbbl\t$-1, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tceil, .-ceil\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\ttestl\t%esi, %esi\n\tje\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovl\t%edi, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tje\t.L19\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L18\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%esi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tlcm, .-lcm\n\t.p2align 4\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L24\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddl\t$1, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L23:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L23\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tnCr, .-nCr\n\t.p2align 4\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\taddl\t%esi, %edi\n\ttestl\t%esi, %esi\n\tjle\t.L29\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L28\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tnHr, .-nHr\n\t.p2align 4\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%edi, %edi\n\tjle\t.L34\n\taddl\t$1, %edi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\timull\t%eax, %r8d\n\taddl\t$1, %eax\n\tcmpl\t%edi, %eax\n\tjne\t.L33\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tfact, .-fact\n\t.p2align 4\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L39\n\taddl\t$1, %esi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\taddl\t$1, %eax\n\timull\t%edi, %r8d\n\tcmpl\t%esi, %eax\n\tjne\t.L38\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE61:\n\t.size\tpow, .-pow\n\t.p2align 4\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L41\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %edx\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %edx\n\taddl\t%edx, %edx\n\tsubl\t%edx, %edi\n\taddl\t%edi, %r8d\n\tmovl\t%eax, %edi\n\ttestl\t%eax, %eax\n\tjne\t.L43\n.L41:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE62:\n\t.size\tdsum, .-dsum\n\t.p2align 4\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L46\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %r8d\n\ttestl\t%eax, %eax\n\tjne\t.L48\n.L46:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tdsumb, .-dsumb\n\t.p2align 4\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tleal\t1(%rdi), %edx\n\timull\t%edi, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tsankaku, .-sankaku\n\t.p2align 4\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB65:\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.LFE65:\n\t.size\tllmax, .-llmax\n\t.p2align 4\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovle\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE66:\n\t.size\tllmin, .-llmin\n\t.p2align 4\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovge\t%rdi, %rax\n\tcmovg\t%rsi, %rdi\n\tsubq\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE67:\n\t.size\tllzt, .-llzt\n\t.p2align 4\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %rdx\n\tcmpq\t%rsi, %rdx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tllround, .-llround\n\t.p2align 4\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\tcmpq\t$1, %rdx\n\tsbbq\t$-1, %rax\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tllceil, .-llceil\n\t.p2align 4\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rsi, %rdx\n\ttestq\t%rsi, %rsi\n\tje\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovq\t%rdx, %r8\n\tcqto\n\tidivq\t%r8\n\tmovq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tjne\t.L63\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE70:\n\t.size\tllgcd, .-llgcd\n\t.p2align 4\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tje\t.L69\n\tmovq\t%rsi, %rdx\n\tmovq\t%rdi, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tmovq\t%rcx, %rax\n\tmovq\t%rdx, %rcx\n\tcqto\n\tidivq\t%rcx\n\ttestq\t%rdx, %rdx\n\tjne\t.L68\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rcx\n\timulq\t%rsi, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L69:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE71:\n\t.size\tlllcm, .-lllcm\n\t.p2align 4\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L74\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddq\t$1, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L73\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tllnCr, .-llnCr\n\t.p2align 4\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB73:\n\t.cfi_startproc\n\tendbr64\n\taddq\t%rsi, %rdi\n\ttestq\t%rsi, %rsi\n\tjle\t.L79\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L78\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE73:\n\t.size\tllnHr, .-llnHr\n\t.p2align 4\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB74:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tjle\t.L84\n\taddq\t$1, %rdi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\timulq\t%rax, %r8\n\taddq\t$1, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L83\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE74:\n\t.size\tllfact, .-llfact\n\t.p2align 4\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB75:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L89\n\taddq\t$1, %rsi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\taddq\t$1, %rax\n\timulq\t%rdi, %r8\n\tcmpq\t%rsi, %rax\n\tjne\t.L88\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L89:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE75:\n\t.size\tllpow, .-llpow\n\t.p2align 4\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB76:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L91\n\tmovabsq\t$7378697629483820647, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovq\t%rdi, %rax\n\timulq\t%rcx\n\tmovq\t%rdi, %rax\n\tsarq\t$63, %rax\n\tsarq\t$2, %rdx\n\tsubq\t%rax, %rdx\n\tleaq\t(%rdx,%rdx,4), %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rdi\n\taddq\t%rdi, %r8\n\tmovq\t%rdx, %rdi\n\ttestq\t%rdx, %rdx\n\tjne\t.L93\n.L91:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE76:\n\t.size\tlldsum, .-lldsum\n\t.p2align 4\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB77:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L96\n\t.p2align 4,,10\n\t.p2align 3\n.L98:\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %r8\n\ttestq\t%rax, %rax\n\tjne\t.L98\n.L96:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE77:\n\t.size\tlldsumb, .-lldsumb\n\t.p2align 4\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB78:\n\t.cfi_startproc\n\tendbr64\n\tleaq\t1(%rdi), %rdx\n\timulq\t%rdi, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$63, %rax\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tret\n\t.cfi_endproc\n.LFE78:\n\t.size\tllsankaku, .-llsankaku\n\t.p2align 4\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB79:\n\t.cfi_startproc\n\tendbr64\n\tmaxsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE79:\n\t.size\tdbmax, .-dbmax\n\t.p2align 4\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB80:\n\t.cfi_startproc\n\tendbr64\n\tminsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE80:\n\t.size\tdbmin, .-dbmin\n\t.p2align 4\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB81:\n\t.cfi_startproc\n\tendbr64\n\tmovapd\t%xmm0, %xmm2\n\tmaxsd\t%xmm1, %xmm0\n\tminsd\t%xmm1, %xmm2\n\tsubsd\t%xmm2, %xmm0\n\tret\n\t.cfi_endproc\n.LFE81:\n\t.size\tdbzt, .-dbzt\n\t.p2align 4\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB82:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjg\t.L118\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L118:\n\tret\n\t.cfi_endproc\n.LFE82:\n\t.size\tsortfncsj, .-sortfncsj\n\t.p2align 4\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB83:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjl\t.L121\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L121:\n\tret\n\t.cfi_endproc\n.LFE83:\n\t.size\tsortfnckj, .-sortfnckj\n\t.p2align 4\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB84:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjg\t.L124\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L124:\n\tret\n\t.cfi_endproc\n.LFE84:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.p2align 4\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB85:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L127\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L127:\n\tret\n\t.cfi_endproc\n.LFE85:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.p2align 4\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB86:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm0, %xmm1\n\tja\t.L130\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L130:\n\tret\n\t.cfi_endproc\n.LFE86:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.p2align 4\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB87:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L133\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L133:\n\tret\n\t.cfi_endproc\n.LFE87:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.p2align 4\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB88:\n\t.cfi_startproc\n\tendbr64\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE88:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.p2align 4\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB89:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %r8\n\tmovq\t%rsi, %rdi\n\tmovq\t%r8, %rsi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE89:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC2:\n\t.string\t\"%d\"\n\t.text\n\t.p2align 4\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB90:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-2097152(%rsp), %r11\n\t.cfi_def_cfa 11, 2097208\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 2097232\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 2097160(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rdi, %rbp\n\txorl\t%edi, %edi\n\tmovl\t%esi, %r13d\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\ttestl\t%r13d, %r13d\n\tjle\t.L138\n\tleal\t-1(%r13), %r15d\n\tmovl\t%r15d, %r12d\n\tcmpl\t$2, %r15d\n\tjbe\t.L146\n\tmovl\t%r13d, %edx\n\tmovq\t%rsp, %rbx\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovdqa\t.LC1(%rip), %xmm2\n\tshrl\t$2, %edx\n\tmovq\t%rbx, %rax\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t16(%rsp,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L141:\n\tmovdqa\t%xmm0, %xmm1\n\taddq\t$16, %rax\n\tpaddd\t%xmm2, %xmm0\n\tmovaps\t%xmm1, -16(%rax)\n\tcmpq\t%rdx, %rax\n\tjne\t.L141\n\tmovl\t%r13d, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %r13b\n\tje\t.L142\n.L140:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n\tleal\t1(%rax), %edx\n\tcmpl\t%edx, %r13d\n\tjle\t.L142\n\tmovslq\t%edx, %rcx\n\taddl\t$2, %eax\n\tmovl\t%edx, (%rsp,%rcx,4)\n\tcmpl\t%eax, %r13d\n\tjle\t.L142\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n.L142:\n\tmovslq\t%r13d, %rax\n\tleaq\t(%rbx,%rax,4), %r14\n\tjmp\t.L143\n\t.p2align 4,,10\n\t.p2align 3\n.L152:\n\tsubl\t$1, %r15d\n.L143:\n\tcall\trand@PLT\n\tsubq\t$4, %r14\n\tcltd\n\tidivl\t%r13d\n\tmovl\t(%r14), %eax\n\tmovl\t%r15d, %r13d\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rsp,%rdx,4), %ecx\n\tmovl\t%ecx, (%r14)\n\tmovl\t%eax, (%rsp,%rdx,4)\n\ttestl\t%r15d, %r15d\n\tjne\t.L152\n\tleaq\t4(%rsp,%r12,4), %r13\n\tleaq\t.LC2(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L144:\n\tmovslq\t(%rbx), %rax\n\tmovq\t%r12, %rdi\n\taddq\t$4, %rbx\n\tleaq\t0(%rbp,%rax,4), %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t%r13, %rbx\n\tjne\t.L144\n.L138:\n\tmovq\t2097160(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L153\n\taddq\t$2097176, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L146:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbx\n\tjmp\t.L140\n.L153:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE90:\n\t.size\tshuffledget, .-shuffledget\n\t.p2align 4\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB91:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\tsubl\t$1, %edx\n\tjs\t.L154\n\t.p2align 4,,10\n\t.p2align 3\n.L158:\n\tleal\t(%rdx,%r8), %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %rcx\n\tcmpl\t(%rsi,%rcx,4), %edi\n\tjle\t.L156\n\tleal\t1(%rax), %r8d\n\tcmpl\t%edx, %r8d\n\tjle\t.L158\n.L154:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L156:\n\tleal\t-1(%rax), %edx\n\tcmpl\t%r8d, %edx\n\tjge\t.L158\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE91:\n\t.size\tsearch, .-search\n\t.p2align 4\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB92:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tcmpl\t%eax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE92:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.p2align 4\n\t.globl\tcid\n\t.type\tcid, @function\ncid:\n.LFB93:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rdx, %rcx\n\txorl\t%r8d, %r8d\n\tcmpq\t%rsi, %rdi\n\tjl\t.L163\n\tsubq\t%rsi, %rax\n\tcqto\n\tidivq\t%rcx\n\tleaq\t1(%rax), %r8\n.L163:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE93:\n\t.size\tcid, .-cid\n\t.section\t.rodata.str1.1\n.LC3:\n\t.string\t\"%lld%lld\"\n.LC4:\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.LFB94:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t-2097152(%rsp), %r11\n\t.cfi_def_cfa 11, 2097192\n.LPSRL1:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL1\n\t.cfi_def_cfa_register 7\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 2097232\n\tleaq\t.LC3(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 2097176(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t8(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %r9\n\ttestq\t%r9, %r9\n\tjle\t.L167\n\tleaq\t16(%rsp), %r12\n\txorl\t%ebx, %ebx\n\tleaq\t1048592(%rsp), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L168:\n\tleaq\t0(%r13,%rbx,8), %rdx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %r9\n\taddq\t$1, %rbx\n\taddq\t$8, %r12\n\tcmpq\t%rbx, %r9\n\tjg\t.L168\n.L167:\n\tmovq\t8(%rsp), %r11\n\txorl\t%r12d, %r12d\n\tmovabsq\t$4154118101919364364, %rbx\n\tleaq\t1048592(%rsp), %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L175:\n\tleaq\t(%r12,%rbx), %rdi\n\tsarq\t%rdi\n\ttestq\t%r9, %r9\n\tjle\t.L169\n\txorl\t%esi, %esi\n\txorl\t%ecx, %ecx\n\tleaq\t16(%rsp), %r10\n\tjmp\t.L172\n\t.p2align 4,,10\n\t.p2align 3\n.L181:\n\taddq\t$1, %rcx\n\tcmpq\t%rcx, %r9\n\tje\t.L173\n.L172:\n\tmovq\t(%r10,%rcx,8), %rdx\n\tcmpq\t%rdi, %rdx\n\tjg\t.L170\n\tmovq\t%rdi, %rax\n\tsubq\t%rdx, %rax\n\tcqto\n\tidivq\t(%r8,%rcx,8)\n\tleaq\t1(%rsi,%rax), %rsi\n.L170:\n\tcmpq\t%rsi, %r11\n\tjg\t.L181\n.L171:\n\tleaq\t-1(%rdi), %rbx\n.L174:\n\tcmpq\t%rbx, %r12\n\tjle\t.L175\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC4(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t2097176(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L182\n\taddq\t$2097192, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L169:\n\t.cfi_restore_state\n\ttestq\t%r11, %r11\n\tjle\t.L171\n\t.p2align 4,,10\n\t.p2align 3\n.L173:\n\tleaq\t1(%rdi), %r12\n\tjmp\t.L174\n.L182:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE94:\n\t.size\tmain, .-main\n\t.globl\tdy8\n\t.data\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx4\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC1:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovle\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tmin, .-min\n\t.p2align 4\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpl\t%esi, %edi\n\tmovl\t%esi, %eax\n\tcmovge\t%edi, %eax\n\tcmovg\t%esi, %edi\n\tsubl\t%edi, %eax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tzt, .-zt\n\t.p2align 4\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %edx\n\tcmpl\t%esi, %edx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tround, .-round\n\t.p2align 4\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%esi\n\tcmpl\t$1, %edx\n\tsbbl\t$-1, %eax\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tceil, .-ceil\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\tmovl\t%esi, %edx\n\ttestl\t%esi, %esi\n\tje\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovl\t%edx, %r8d\n\tcltd\n\tidivl\t%r8d\n\tmovl\t%r8d, %eax\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovl\t%edi, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tje\t.L19\n\tmovl\t%esi, %edx\n\tmovl\t%edi, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovl\t%ecx, %eax\n\tmovl\t%edx, %ecx\n\tcltd\n\tidivl\t%ecx\n\ttestl\t%edx, %edx\n\tjne\t.L18\n\tmovl\t%edi, %eax\n\tcltd\n\tidivl\t%ecx\n\timull\t%esi, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tlcm, .-lcm\n\t.p2align 4\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L24\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddl\t$1, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L23:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L23\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tnCr, .-nCr\n\t.p2align 4\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\taddl\t%esi, %edi\n\ttestl\t%esi, %esi\n\tjle\t.L29\n\taddl\t$1, %esi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tmovl\t%edi, %edx\n\tsubl\t%ecx, %edx\n\timull\t%edx, %eax\n\tcltd\n\tidivl\t%ecx\n\taddl\t$1, %ecx\n\tcmpl\t%esi, %ecx\n\tjne\t.L28\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tnHr, .-nHr\n\t.p2align 4\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%edi, %edi\n\tjle\t.L34\n\taddl\t$1, %edi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\timull\t%eax, %r8d\n\taddl\t$1, %eax\n\tcmpl\t%edi, %eax\n\tjne\t.L33\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L34:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE60:\n\t.size\tfact, .-fact\n\t.p2align 4\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\ttestl\t%esi, %esi\n\tjle\t.L39\n\taddl\t$1, %esi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L38:\n\taddl\t$1, %eax\n\timull\t%edi, %r8d\n\tcmpl\t%esi, %eax\n\tjne\t.L38\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tmovl\t$1, %r8d\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE61:\n\t.size\tpow, .-pow\n\t.p2align 4\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L41\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tmovslq\t%edi, %rax\n\tmovl\t%edi, %edx\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %edx\n\tsarq\t$34, %rax\n\tsubl\t%edx, %eax\n\tleal\t(%rax,%rax,4), %edx\n\taddl\t%edx, %edx\n\tsubl\t%edx, %edi\n\taddl\t%edi, %r8d\n\tmovl\t%eax, %edi\n\ttestl\t%eax, %eax\n\tjne\t.L43\n.L41:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE62:\n\t.size\tdsum, .-dsum\n\t.p2align 4\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t%edi, %eax\n\txorl\t%r8d, %r8d\n\ttestl\t%edi, %edi\n\tje\t.L46\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tcltd\n\tidivl\t%esi\n\taddl\t%edx, %r8d\n\ttestl\t%eax, %eax\n\tjne\t.L48\n.L46:\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE63:\n\t.size\tdsumb, .-dsumb\n\t.p2align 4\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tleal\t1(%rdi), %edx\n\timull\t%edi, %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tsankaku, .-sankaku\n\t.p2align 4\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB65:\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.LFE65:\n\t.size\tllmax, .-llmax\n\t.p2align 4\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovle\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE66:\n\t.size\tllmin, .-llmin\n\t.p2align 4\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovge\t%rdi, %rax\n\tcmovg\t%rsi, %rdi\n\tsubq\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE67:\n\t.size\tllzt, .-llzt\n\t.p2align 4\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %rdx\n\tcmpq\t%rsi, %rdx\n\tsetge\t%dl\n\tmovzbl\t%dl, %edx\n\taddq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tllround, .-llround\n\t.p2align 4\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rsi\n\tcmpq\t$1, %rdx\n\tsbbq\t$-1, %rax\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tllceil, .-llceil\n\t.p2align 4\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rsi, %rdx\n\ttestq\t%rsi, %rsi\n\tje\t.L64\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovq\t%rdx, %r8\n\tcqto\n\tidivq\t%r8\n\tmovq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tjne\t.L63\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tmovq\t%rdi, %r8\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE70:\n\t.size\tllgcd, .-llgcd\n\t.p2align 4\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tje\t.L69\n\tmovq\t%rsi, %rdx\n\tmovq\t%rdi, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\tmovq\t%rcx, %rax\n\tmovq\t%rdx, %rcx\n\tcqto\n\tidivq\t%rcx\n\ttestq\t%rdx, %rdx\n\tjne\t.L68\n\tmovq\t%rdi, %rax\n\tcqto\n\tidivq\t%rcx\n\timulq\t%rsi, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L69:\n\txorl\t%eax, %eax\n\tret\n\t.cfi_endproc\n.LFE71:\n\t.size\tlllcm, .-lllcm\n\t.p2align 4\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L74\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\taddq\t$1, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L73:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L73\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L74:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tllnCr, .-llnCr\n\t.p2align 4\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB73:\n\t.cfi_startproc\n\tendbr64\n\taddq\t%rsi, %rdi\n\ttestq\t%rsi, %rsi\n\tjle\t.L79\n\taddq\t$1, %rsi\n\tmovl\t$1, %eax\n\tmovl\t$1, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t%rdi, %rdx\n\tsubq\t%rcx, %rdx\n\timulq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\taddq\t$1, %rcx\n\tcmpq\t%rsi, %rcx\n\tjne\t.L78\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L79:\n\tmovl\t$1, %eax\n\tret\n\t.cfi_endproc\n.LFE73:\n\t.size\tllnHr, .-llnHr\n\t.p2align 4\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB74:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rdi, %rdi\n\tjle\t.L84\n\taddq\t$1, %rdi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L83:\n\timulq\t%rax, %r8\n\taddq\t$1, %rax\n\tcmpq\t%rdi, %rax\n\tjne\t.L83\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE74:\n\t.size\tllfact, .-llfact\n\t.p2align 4\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB75:\n\t.cfi_startproc\n\tendbr64\n\ttestq\t%rsi, %rsi\n\tjle\t.L89\n\taddq\t$1, %rsi\n\tmovl\t$1, %r8d\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\taddq\t$1, %rax\n\timulq\t%rdi, %r8\n\tcmpq\t%rsi, %rax\n\tjne\t.L88\n\tmovq\t%r8, %rax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L89:\n\tmovl\t$1, %r8d\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE75:\n\t.size\tllpow, .-llpow\n\t.p2align 4\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB76:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L91\n\tmovabsq\t$7378697629483820647, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L93:\n\tmovq\t%rdi, %rax\n\timulq\t%rcx\n\tmovq\t%rdi, %rax\n\tsarq\t$63, %rax\n\tsarq\t$2, %rdx\n\tsubq\t%rax, %rdx\n\tleaq\t(%rdx,%rdx,4), %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rdi\n\taddq\t%rdi, %r8\n\tmovq\t%rdx, %rdi\n\ttestq\t%rdx, %rdx\n\tjne\t.L93\n.L91:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE76:\n\t.size\tlldsum, .-lldsum\n\t.p2align 4\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB77:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\txorl\t%r8d, %r8d\n\ttestq\t%rdi, %rdi\n\tje\t.L96\n\t.p2align 4,,10\n\t.p2align 3\n.L98:\n\tcqto\n\tidivq\t%rsi\n\taddq\t%rdx, %r8\n\ttestq\t%rax, %rax\n\tjne\t.L98\n.L96:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE77:\n\t.size\tlldsumb, .-lldsumb\n\t.p2align 4\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB78:\n\t.cfi_startproc\n\tendbr64\n\tleaq\t1(%rdi), %rdx\n\timulq\t%rdi, %rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$63, %rax\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tret\n\t.cfi_endproc\n.LFE78:\n\t.size\tllsankaku, .-llsankaku\n\t.p2align 4\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB79:\n\t.cfi_startproc\n\tendbr64\n\tmaxsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE79:\n\t.size\tdbmax, .-dbmax\n\t.p2align 4\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB80:\n\t.cfi_startproc\n\tendbr64\n\tminsd\t%xmm1, %xmm0\n\tret\n\t.cfi_endproc\n.LFE80:\n\t.size\tdbmin, .-dbmin\n\t.p2align 4\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB81:\n\t.cfi_startproc\n\tendbr64\n\tmovapd\t%xmm0, %xmm2\n\tmaxsd\t%xmm1, %xmm0\n\tminsd\t%xmm1, %xmm2\n\tsubsd\t%xmm2, %xmm0\n\tret\n\t.cfi_endproc\n.LFE81:\n\t.size\tdbzt, .-dbzt\n\t.p2align 4\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB82:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjg\t.L118\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L118:\n\tret\n\t.cfi_endproc\n.LFE82:\n\t.size\tsortfncsj, .-sortfncsj\n\t.p2align 4\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB83:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %edx\n\tmovl\t$1, %eax\n\tcmpl\t%edx, (%rdi)\n\tjl\t.L121\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L121:\n\tret\n\t.cfi_endproc\n.LFE83:\n\t.size\tsortfnckj, .-sortfnckj\n\t.p2align 4\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB84:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjg\t.L124\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L124:\n\tret\n\t.cfi_endproc\n.LFE84:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.p2align 4\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB85:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rdx\n\tmovl\t$1, %eax\n\tcmpq\t%rdx, (%rdi)\n\tjl\t.L127\n\tsetne\t%al\n\tmovzbl\t%al, %eax\n\tnegl\t%eax\n.L127:\n\tret\n\t.cfi_endproc\n.LFE85:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.p2align 4\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB86:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm0, %xmm1\n\tja\t.L130\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L130:\n\tret\n\t.cfi_endproc\n.LFE86:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.p2align 4\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB87:\n\t.cfi_startproc\n\tendbr64\n\tmovsd\t(%rdi), %xmm1\n\tmovsd\t(%rsi), %xmm0\n\tmovl\t$1, %eax\n\tcomisd\t%xmm1, %xmm0\n\tja\t.L133\n\txorl\t%edx, %edx\n\tucomisd\t%xmm0, %xmm1\n\tsetp\t%dl\n\tcmove\t%edx, %eax\n\tnegl\t%eax\n.L133:\n\tret\n\t.cfi_endproc\n.LFE87:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.p2align 4\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB88:\n\t.cfi_startproc\n\tendbr64\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE88:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.p2align 4\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB89:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %r8\n\tmovq\t%rsi, %rdi\n\tmovq\t%r8, %rsi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE89:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC2:\n\t.string\t\"%d\"\n\t.text\n\t.p2align 4\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB90:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\t-2097152(%rsp), %r11\n\t.cfi_def_cfa 11, 2097208\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 2097232\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 2097160(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rdi, %rbp\n\txorl\t%edi, %edi\n\tmovl\t%esi, %r13d\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\ttestl\t%r13d, %r13d\n\tjle\t.L138\n\tleal\t-1(%r13), %r15d\n\tmovl\t%r15d, %r12d\n\tcmpl\t$2, %r15d\n\tjbe\t.L146\n\tmovl\t%r13d, %edx\n\tmovq\t%rsp, %rbx\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovdqa\t.LC1(%rip), %xmm2\n\tshrl\t$2, %edx\n\tmovq\t%rbx, %rax\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t16(%rsp,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L141:\n\tmovdqa\t%xmm0, %xmm1\n\taddq\t$16, %rax\n\tpaddd\t%xmm2, %xmm0\n\tmovaps\t%xmm1, -16(%rax)\n\tcmpq\t%rdx, %rax\n\tjne\t.L141\n\tmovl\t%r13d, %eax\n\tandl\t$-4, %eax\n\ttestb\t$3, %r13b\n\tje\t.L142\n.L140:\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n\tleal\t1(%rax), %edx\n\tcmpl\t%edx, %r13d\n\tjle\t.L142\n\tmovslq\t%edx, %rcx\n\taddl\t$2, %eax\n\tmovl\t%edx, (%rsp,%rcx,4)\n\tcmpl\t%eax, %r13d\n\tjle\t.L142\n\tmovslq\t%eax, %rdx\n\tmovl\t%eax, (%rsp,%rdx,4)\n.L142:\n\tmovslq\t%r13d, %rax\n\tleaq\t(%rbx,%rax,4), %r14\n\tjmp\t.L143\n\t.p2align 4,,10\n\t.p2align 3\n.L152:\n\tsubl\t$1, %r15d\n.L143:\n\tcall\trand@PLT\n\tsubq\t$4, %r14\n\tcltd\n\tidivl\t%r13d\n\tmovl\t(%r14), %eax\n\tmovl\t%r15d, %r13d\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rsp,%rdx,4), %ecx\n\tmovl\t%ecx, (%r14)\n\tmovl\t%eax, (%rsp,%rdx,4)\n\ttestl\t%r15d, %r15d\n\tjne\t.L152\n\tleaq\t4(%rsp,%r12,4), %r13\n\tleaq\t.LC2(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L144:\n\tmovslq\t(%rbx), %rax\n\tmovq\t%r12, %rdi\n\taddq\t$4, %rbx\n\tleaq\t0(%rbp,%rax,4), %rsi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tcmpq\t%r13, %rbx\n\tjne\t.L144\n.L138:\n\tmovq\t2097160(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L153\n\taddq\t$2097176, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L146:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rbx\n\tjmp\t.L140\n.L153:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE90:\n\t.size\tshuffledget, .-shuffledget\n\t.p2align 4\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB91:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%r8d, %r8d\n\tsubl\t$1, %edx\n\tjs\t.L154\n\t.p2align 4,,10\n\t.p2align 3\n.L158:\n\tleal\t(%rdx,%r8), %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %rcx\n\tcmpl\t(%rsi,%rcx,4), %edi\n\tjle\t.L156\n\tleal\t1(%rax), %r8d\n\tcmpl\t%edx, %r8d\n\tjle\t.L158\n.L154:\n\tmovl\t%r8d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L156:\n\tleal\t-1(%rax), %edx\n\tcmpl\t%r8d, %edx\n\tjge\t.L158\n\tmovl\t%r8d, %eax\n\tret\n\t.cfi_endproc\n.LFE91:\n\t.size\tsearch, .-search\n\t.p2align 4\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB92:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t(%rsi), %eax\n\tcmpl\t%eax, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE92:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.p2align 4\n\t.globl\tcid\n\t.type\tcid, @function\ncid:\n.LFB93:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tmovq\t%rdx, %rcx\n\txorl\t%r8d, %r8d\n\tcmpq\t%rsi, %rdi\n\tjl\t.L163\n\tsubq\t%rsi, %rax\n\tcqto\n\tidivq\t%rcx\n\tleaq\t1(%rax), %r8\n.L163:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE93:\n\t.size\tcid, .-cid\n\t.section\t.rodata.str1.1\n.LC3:\n\t.string\t\"%lld%lld\"\n.LC4:\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.LFB94:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t-2097152(%rsp), %r11\n\t.cfi_def_cfa 11, 2097192\n.LPSRL1:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL1\n\t.cfi_def_cfa_register 7\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 2097232\n\tleaq\t.LC3(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 2097176(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t8(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %r9\n\ttestq\t%r9, %r9\n\tjle\t.L167\n\tleaq\t16(%rsp), %r12\n\txorl\t%ebx, %ebx\n\tleaq\t1048592(%rsp), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L168:\n\tleaq\t0(%r13,%rbx,8), %rdx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %r9\n\taddq\t$1, %rbx\n\taddq\t$8, %r12\n\tcmpq\t%rbx, %r9\n\tjg\t.L168\n.L167:\n\tmovq\t8(%rsp), %r11\n\txorl\t%r12d, %r12d\n\tmovabsq\t$4154118101919364364, %rbx\n\tleaq\t1048592(%rsp), %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L175:\n\tleaq\t(%r12,%rbx), %rdi\n\tsarq\t%rdi\n\ttestq\t%r9, %r9\n\tjle\t.L169\n\txorl\t%esi, %esi\n\txorl\t%ecx, %ecx\n\tleaq\t16(%rsp), %r10\n\tjmp\t.L172\n\t.p2align 4,,10\n\t.p2align 3\n.L181:\n\taddq\t$1, %rcx\n\tcmpq\t%rcx, %r9\n\tje\t.L173\n.L172:\n\tmovq\t(%r10,%rcx,8), %rdx\n\tcmpq\t%rdi, %rdx\n\tjg\t.L170\n\tmovq\t%rdi, %rax\n\tsubq\t%rdx, %rax\n\tcqto\n\tidivq\t(%r8,%rcx,8)\n\tleaq\t1(%rsi,%rax), %rsi\n.L170:\n\tcmpq\t%rsi, %r11\n\tjg\t.L181\n.L171:\n\tleaq\t-1(%rdi), %rbx\n.L174:\n\tcmpq\t%rbx, %r12\n\tjle\t.L175\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC4(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t2097176(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L182\n\taddq\t$2097192, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L169:\n\t.cfi_restore_state\n\ttestq\t%r11, %r11\n\tjle\t.L171\n\t.p2align 4,,10\n\t.p2align 3\n.L173:\n\tleaq\t1(%rdi), %r12\n\tjmp\t.L174\n.L182:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE94:\n\t.size\tmain, .-main\n\t.globl\tdy8\n\t.data\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx4\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC1:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "//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#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint nHr(int a,int b){return nCr(a+b-1,b);}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llnHr(long long a,long long b){return llnCr(a+b-1,b);}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\n\nvoid shuffledget(int x[],int n){\n srand(time(0));\n int i,b[524288],p,c;\n for(i=0;i<n;i++){\n b[i]=i;\n }\n for(i=n;i>=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[b[i]]);\n }\n}\n\nint dx4[4]={1,-1,0,0};\nint dy4[4]={0,0,1,-1};\nint dx8[8]={-1,-1,-1,0,0,1,1,1};\nint dy8[8]={-1,0,1,-1,1,-1,0,1};\n\nint search(int x,int a[],int n){\n int st=0,fi=n-1,te;\n while(st<=fi){\n te=(st+fi)/2;\n if(a[te]<x){st=te+1;}else{fi=te-1;}\n }\n return st;\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nlong long cid(long long x,long long w,long long d){\n if(x<w){return 0;}\n return ((x-w)/d)+1;\n}\n\nint main(void){\n long long i,j,n,m,k,a,b,c,h,r=0,l,t;\n long long w[131072],d[131072];\n long long st=0,fi=llinf,te;\n char s[524288];\n scanf(\"%lld%lld\",&n,&k);\n //l=strlen(s);\n for(i=0;i<n;i++){\n scanf(\"%lld%lld\",&w[i],&d[i]);\n }\n while(st<=fi){\n te=(st+fi)/2;r=0;\n for(i=0;i<n;i++){\n r+=cid(te,w[i],d[i]);\n if(r>=k){break;}\n }\n if(r<k){st=te+1;}else{fi=te-1;}\n }\n //shuffledget(a,n);\n //qsort(a,n,sizeof(int),sortfncsj);\n printf(\"%lld\\n\",st);\n return 0;\n}", "index": 78, "inputs": [ "2 5\n20 10\n25 15\n", "3 9\n16 10\n10 10\n10 10\n", "2 5\n20 16\n25 15\n", "2 5\n20 13\n25 15\n", "2 6\n20 10\n43 15\n", "3 9\n10 10\n7 10\n10 10\n", "3 9\n10 10\n7 10\n10 18\n", "2 5\n20 11\n25 10\n", "3 9\n7 10\n13 10\n10 10\n", "2 5\n38 9\n25 15\n", "3 9\n10 10\n5 10\n10 18\n", "2 5\n38 9\n39 15\n", "2 5\n38 9\n17 15\n", "3 9\n3 3\n5 10\n10 18\n", "3 17\n22 15\n10 10\n17 10\n", "3 9\n4 10\n13 20\n10 20\n", "3 17\n22 19\n10 10\n17 10\n", "3 27\n22 19\n10 10\n1 10\n", "3 9\n4 10\n15 20\n19 10\n", "3 27\n22 35\n10 10\n1 10\n", "3 9\n4 3\n15 20\n19 10\n", "3 27\n22 63\n10 10\n1 10\n", "3 36\n22 63\n10 10\n1 10\n", "3 36\n22 63\n10 10\n2 10\n", "2 9\n10 10\n10 10\n10 10\n", "2 6\n20 17\n43 15\n", "1 9\n16 12\n10 10\n12 10\n", "3 9\n22 12\n10 5\n12 10\n", "1 9\n10 10\n5 10\n10 18\n", "3 9\n22 12\n10 11\n17 10\n", "3 9\n4 3\n5 10\n10 18\n", "3 5\n4 10\n15 20\n10 20\n", "3 17\n22 19\n10 14\n1 10\n", "1 27\n22 19\n10 10\n1 10\n", "3 27\n22 35\n10 10\n1 7\n", "3 27\n22 63\n18 10\n1 10\n", "3 36\n22 63\n10 10\n0 10\n", "2 6\n20 17\n29 15\n", "3 9\n10 12\n7 10\n10 7\n", "1 9\n8 10\n5 10\n10 18\n", "2 5\n38 17\n35 15\n", "3 9\n3 10\n5 4\n20 18\n", "3 17\n22 15\n10 10\n17 5\n", "3 9\n6 10\n13 20\n11 38\n", "3 9\n4 14\n13 20\n10 19\n", "3 9\n4 10\n15 51\n19 20\n", "3 9\n4 10\n0 20\n19 6\n", "3 36\n41 63\n10 10\n0 10\n", "1 9\n4 3\n15 24\n19 20\n", "2 6\n20 11\n29 15\n", "1 5\n16 12\n10 4\n12 10\n", "3 10\n0 10\n13 2\n10 10\n", "1 17\n22 15\n10 10\n17 5\n", "3 9\n1 10\n15 51\n19 20\n", "1 27\n22 15\n10 3\n1 10\n", "3 27\n22 32\n10 10\n1 8\n", "2 9\n4 3\n15 20\n5 20\n", "3 36\n41 63\n10 10\n0 12\n", "3 9\n10 13\n7 10\n10 5\n", "3 5\n0 10\n13 2\n10 10\n", "1 27\n22 9\n10 3\n1 10\n", "3 27\n22 32\n10 10\n1 13\n", "3 67\n41 63\n10 10\n0 12\n", "2 10\n26 9\n1 15\n", "3 5\n20 22\n13 10\n16 10\n", "1 9\n20 13\n4 11\n17 10\n", "2 6\n4 3\n2 10\n16 18\n", "1 9\n6 10\n13 25\n9 38\n", "3 27\n22 44\n10 10\n1 13\n", "3 42\n41 63\n10 10\n0 12\n", "1 17\n6 15\n3 10\n17 5\n", "1 9\n2 10\n15 51\n20 20\n", "3 27\n22 44\n10 10\n2 13\n", "3 42\n41 63\n10 4\n0 12\n", "2 5\n17 17\n62 13\n", "1 7\n20 13\n3 11\n17 10\n", "3 27\n22 44\n10 20\n2 13\n", "3 42\n41 63\n10 4\n0 14\n", "1 15\n3 3\n2 27\n19 29\n", "1 5\n16 17\n10 6\n2 10\n", "3 27\n22 44\n10 20\n2 12\n", "3 42\n41 63\n10 4\n0 20\n", "1 18\n2 10\n10 80\n20 20\n", "3 42\n41 120\n10 4\n0 20\n", "1 14\n20 13\n3 11\n17 1\n", "1 14\n31 13\n3 11\n17 1\n", "1 18\n2 17\n10 80\n39 20\n", "1 6\n16 17\n10 9\n3 12\n", "1 18\n31 13\n3 11\n17 1\n", "3 42\n74 120\n10 2\n0 19\n", "2 11\n8 1\n5 31\n8 26\n", "3 42\n74 120\n4 2\n0 19\n", "3 9\n10 10\n10 1\n10 10\n", "2 5\n20 3\n25 10\n", "1 5\n38 9\n25 15\n", "3 17\n22 7\n10 10\n17 10\n", "3 17\n22 19\n6 10\n1 10\n", "3 36\n22 63\n10 10\n1 14\n", "2 6\n20 22\n43 15\n", "3 9\n22 12\n8 11\n17 10\n", "1 1000000000\n1000000000000000000 1000000000\n", "2 6\n20 10\n25 15\n", "3 9\n10 10\n10 10\n10 10\n", "2 6\n20 10\n25 15\n" ], "outputs": [ "40\n", "36\n", "52\n", "46\n", "58\n", "30\n", "37\n", "42\n", "33\n", "55\n", "35\n", "56\n", "47\n", "18\n", "70\n", "44\n", "77\n", "110\n", "39\n", "120\n", "22\n", "121\n", "161\n", "162\n", "50\n", "71\n", "112\n", "32\n", "90\n", "43\n", "19\n", "24\n", "79\n", "516\n", "99\n", "128\n", "160\n", "59\n", "31\n", "88\n", "65\n", "23\n", "57\n", "49\n", "48\n", "54\n", "34\n", "167\n", "28\n", "53\n", "64\n", "21\n", "262\n", "51\n", "412\n", "105\n", "25\n", "180\n", "27\n", "15\n", "256\n", "130\n", "336\n", "62\n", "26\n", "124\n", "13\n", "86\n", "131\n", "210\n", "246\n", "82\n", "132\n", "122\n", "68\n", "98\n", "171\n", "126\n", "45\n", "84\n", "170\n", "138\n", "172\n", "140\n", "189\n", "200\n", "291\n", "101\n", "252\n", "80\n", "17\n", "76\n", "16\n", "29\n", "74\n", "60\n", "66\n", "190\n", "73\n", "41\n", "1999999999000000000\n", "50\n", "30\n", "50\n" ], "question": "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#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint nHr(int a,int b){return nCr(a+b-1,b);}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nint dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}\nint dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}\nint sankaku(int x){return ((1+x)*x)/2;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llnHr(long long a,long long b){return llnCr(a+b-1,b);}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}\nlong long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}\nlong long llsankaku(long long x){return ((1+x)*x)/2;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\n\nvoid shuffledget(int x[],int n){\n srand(time(0));\n int i,b[524288],p,c;\n for(i=0;i<n;i++){\n b[i]=i;\n }\n for(i=n;i>=1;i--){\n p=rand()%i;\n c=b[i-1];b[i-1]=b[p];b[p]=c;\n }\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[b[i]]);\n }\n}\n\nint dx4[4]={1,-1,0,0};\nint dy4[4]={0,0,1,-1};\nint dx8[8]={-1,-1,-1,0,0,1,1,1};\nint dy8[8]={-1,0,1,-1,1,-1,0,1};\n\nint search(int x,int a[],int n){\n int st=0,fi=n-1,te;\n while(st<=fi){\n te=(st+fi)/2;\n if(a[te]<x){st=te+1;}else{fi=te-1;}\n }\n return st;\n}\n\ntypedef struct{\nint val;\nint node;\n}sd;\n\nint sdsortfnc(const void *a,const void *b){\nif(((sd*)a)->val < ((sd*)b)->val){return -1;}\nif(((sd*)a)->val > ((sd*)b)->val){return 1;}\nreturn 0;\n}\n\nlong long cid(long long x,long long w,long long d){\n if(x<w){return 0;}\n return ((x-w)/d)+1;\n}\n\nint main(void){\n long long i,j,n,m,k,a,b,c,h,r=0,l,t;\n long long w[131072],d[131072];\n long long st=0,fi=llinf,te;\n char s[524288];\n scanf(\"%lld%lld\",&n,&k);\n //l=strlen(s);\n for(i=0;i<n;i++){\n scanf(\"%lld%lld\",&w[i],&d[i]);\n }\n while(st<=fi){\n te=(st+fi)/2;r=0;\n for(i=0;i<n;i++){\n r+=cid(te,w[i],d[i]);\n if(r>=k){break;}\n }\n if(r<k){st=te+1;}else{fi=te-1;}\n }\n //shuffledget(a,n);\n //qsort(a,n,sizeof(int),sortfncsj);\n printf(\"%lld\\n\",st);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tmax\n\t.type\tmax, @function\nmax:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L2\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L3\n.L2:\n\tmovl\t-8(%rbp), %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmax, .-max\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjge\t.L5\n\tmovl\t-4(%rbp), %eax\n\tjmp\t.L6\n.L5:\n\tmovl\t-8(%rbp), %eax\n.L6:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmin, .-min\n\t.globl\tzt\n\t.type\tzt, @function\nzt:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$8, %rsp\n\t.cfi_offset 3, -24\n\tmovl\t%edi, -12(%rbp)\n\tmovl\t%esi, -16(%rbp)\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmax\n\tmovl\t%eax, %ebx\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tmin\n\tmovl\t%eax, %edx\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tzt, .-zt\n\t.globl\tround\n\t.type\tround, @function\nround:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjg\t.L10\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n\tjmp\t.L11\n.L10:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n.L11:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tround, .-round\n\t.globl\tceil\n\t.type\tceil, @function\nceil:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L13\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tjmp\t.L14\n.L13:\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\taddl\t$1, %eax\n.L14:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tceil, .-ceil\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tjmp\t.L16\n.L17:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, -4(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, -24(%rbp)\n.L16:\n\tcmpl\t$0, -24(%rbp)\n\tjne\t.L17\n\tmovl\t-20(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tgcd, .-gcd\n\t.globl\tlcm\n\t.type\tlcm, @function\nlcm:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edx, %esi\n\tmovl\t%eax, %edi\n\tcall\tgcd\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-4(%rbp)\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %eax\n\timull\t-24(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tlcm, .-lcm\n\t.globl\tnCr\n\t.type\tnCr, @function\nnCr:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L22\n.L23:\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tsubl\t-8(%rbp), %eax\n\tmovl\t-4(%rbp), %edx\n\timull\t%edx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltd\n\tidivl\t-8(%rbp)\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L22:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L23\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tnCr, .-nCr\n\t.globl\tnHr\n\t.type\tnHr, @function\nnHr:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$8, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t%esi, -8(%rbp)\n\tmovl\t-4(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t%edx, %edi\n\tcall\tnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tnHr, .-nHr\n\t.globl\tfact\n\t.type\tfact, @function\nfact:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L28\n.L29:\n\tmovl\t-4(%rbp), %eax\n\timull\t-8(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L28:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjle\t.L29\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tfact, .-fact\n\t.globl\tpow\n\t.type\tpow, @function\npow:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$1, -4(%rbp)\n\tmovl\t$1, -8(%rbp)\n\tjmp\t.L32\n.L33:\n\tmovl\t-4(%rbp), %eax\n\timull\t-20(%rbp), %eax\n\tmovl\t%eax, -4(%rbp)\n\taddl\t$1, -8(%rbp)\n.L32:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L33\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tpow, .-pow\n\t.globl\tdsum\n\t.type\tdsum, @function\ndsum:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L36\n.L37:\n\tmovl\t-20(%rbp), %ecx\n\tmovslq\t%ecx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%ecx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %edx\n\taddl\t%edx, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -20(%rbp)\n.L36:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L37\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tdsum, .-dsum\n\t.globl\tdsumb\n\t.type\tdsumb, @function\ndsumb:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L40\n.L41:\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%edx, %eax\n\taddl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltd\n\tidivl\t-24(%rbp)\n\tmovl\t%eax, -20(%rbp)\n.L40:\n\tcmpl\t$0, -20(%rbp)\n\tjne\t.L41\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tdsumb, .-dsumb\n\t.globl\tsankaku\n\t.type\tsankaku, @function\nsankaku:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\timull\t-4(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tsankaku, .-sankaku\n\t.globl\tllmax\n\t.type\tllmax, @function\nllmax:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjle\t.L46\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L47\n.L46:\n\tmovq\t-16(%rbp), %rax\n.L47:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tllmax, .-llmax\n\t.globl\tllmin\n\t.type\tllmin, @function\nllmin:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L49\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L50\n.L49:\n\tmovq\t-16(%rbp), %rax\n.L50:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tllmin, .-llmin\n\t.globl\tllzt\n\t.type\tllzt, @function\nllzt:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -16(%rbp)\n\tmovq\t%rsi, -24(%rbp)\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmax\n\tmovq\t%rax, %rbx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllmin\n\tmovq\t%rax, %rdx\n\tmovq\t%rbx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tllzt, .-llzt\n\t.globl\tllround\n\t.type\tllround, @function\nllround:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjg\t.L54\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n\tjmp\t.L55\n.L54:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n.L55:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tllround, .-llround\n\t.globl\tllceil\n\t.type\tllceil, @function\nllceil:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tjne\t.L57\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tjmp\t.L58\n.L57:\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\taddq\t$1, %rax\n.L58:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tllceil, .-llceil\n\t.globl\tllgcd\n\t.type\tllgcd, @function\nllgcd:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tjmp\t.L60\n.L61:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n.L60:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L61\n\tmovq\t-24(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tllgcd, .-llgcd\n\t.globl\tlllcm\n\t.type\tlllcm, @function\nlllcm:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tllgcd\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-8(%rbp)\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t-32(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tlllcm, .-lllcm\n\t.globl\tllnCr\n\t.type\tllnCr, @function\nllnCr:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L66\n.L67:\n\tmovq\t-24(%rbp), %rax\n\taddq\t$1, %rax\n\tsubq\t-16(%rbp), %rax\n\tmovq\t-8(%rbp), %rdx\n\timulq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcqto\n\tidivq\t-16(%rbp)\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L66:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L67\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tllnCr, .-llnCr\n\t.globl\tllnHr\n\t.type\tllnHr, @function\nllnHr:\n.LFB28:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\tllnCr\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE28:\n\t.size\tllnHr, .-llnHr\n\t.globl\tllfact\n\t.type\tllfact, @function\nllfact:\n.LFB29:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L72\n.L73:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L72:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjle\t.L73\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE29:\n\t.size\tllfact, .-llfact\n\t.globl\tllpow\n\t.type\tllpow, @function\nllpow:\n.LFB30:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tjmp\t.L76\n.L77:\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\taddq\t$1, -16(%rbp)\n.L76:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-32(%rbp), %rax\n\tjle\t.L77\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE30:\n\t.size\tllpow, .-llpow\n\t.globl\tlldsum\n\t.type\tlldsum, @function\nlldsum:\n.LFB31:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L80\n.L81:\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tmovq\t%rcx, %rsi\n\tsarq\t$63, %rsi\n\tsubq\t%rsi, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\taddq\t%rdx, -8(%rbp)\n\tmovq\t-24(%rbp), %rcx\n\tmovabsq\t$7378697629483820647, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tmovq\t%rdx, %rax\n\tsarq\t$2, %rax\n\tsarq\t$63, %rcx\n\tmovq\t%rcx, %rdx\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -24(%rbp)\n.L80:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L81\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE31:\n\t.size\tlldsum, .-lldsum\n\t.globl\tlldsumb\n\t.type\tlldsumb, @function\nlldsumb:\n.LFB32:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t$0, -8(%rbp)\n\tjmp\t.L84\n.L85:\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rdx, %rax\n\taddq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tcqto\n\tidivq\t-32(%rbp)\n\tmovq\t%rax, -24(%rbp)\n.L84:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L85\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE32:\n\t.size\tlldsumb, .-lldsumb\n\t.globl\tllsankaku\n\t.type\tllsankaku, @function\nllsankaku:\n.LFB33:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\taddq\t$1, %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE33:\n\t.size\tllsankaku, .-llsankaku\n\t.globl\tdbmax\n\t.type\tdbmax, @function\ndbmax:\n.LFB34:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-8(%rbp), %xmm0\n\tcomisd\t-16(%rbp), %xmm0\n\tjbe\t.L94\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L92\n.L94:\n\tmovsd\t-16(%rbp), %xmm0\n.L92:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE34:\n\t.size\tdbmax, .-dbmax\n\t.globl\tdbmin\n\t.type\tdbmin, @function\ndbmin:\n.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t%xmm1, -16(%rbp)\n\tmovsd\t-16(%rbp), %xmm0\n\tcomisd\t-8(%rbp), %xmm0\n\tjbe\t.L100\n\tmovsd\t-8(%rbp), %xmm0\n\tjmp\t.L98\n.L100:\n\tmovsd\t-16(%rbp), %xmm0\n.L98:\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE35:\n\t.size\tdbmin, .-dbmin\n\t.globl\tdbzt\n\t.type\tdbzt, @function\ndbzt:\n.LFB36:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$16, %rsp\n\t.cfi_offset 3, -24\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovsd\t%xmm1, -24(%rbp)\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmax\n\tmovq\t%xmm0, %rbx\n\tmovsd\t-24(%rbp), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovapd\t%xmm0, %xmm1\n\tmovq\t%rax, %xmm0\n\tcall\tdbmin\n\tmovq\t%rbx, %xmm1\n\tsubsd\t%xmm0, %xmm1\n\tmovq\t%xmm1, %rax\n\tmovq\t%rax, %xmm0\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE36:\n\t.size\tdbzt, .-dbzt\n\t.globl\tsortfncsj\n\t.type\tsortfncsj, @function\nsortfncsj:\n.LFB37:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L104\n\tmovl\t$1, %eax\n\tjmp\t.L105\n.L104:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L106\n\tmovl\t$0, %eax\n\tjmp\t.L105\n.L106:\n\tmovl\t$-1, %eax\n.L105:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE37:\n\t.size\tsortfncsj, .-sortfncsj\n\t.globl\tsortfnckj\n\t.type\tsortfnckj, @function\nsortfnckj:\n.LFB38:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L108\n\tmovl\t$1, %eax\n\tjmp\t.L109\n.L108:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L110\n\tmovl\t$0, %eax\n\tjmp\t.L109\n.L110:\n\tmovl\t$-1, %eax\n.L109:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE38:\n\t.size\tsortfnckj, .-sortfnckj\n\t.globl\tllsortfncsj\n\t.type\tllsortfncsj, @function\nllsortfncsj:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L112\n\tmovl\t$1, %eax\n\tjmp\t.L113\n.L112:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L114\n\tmovl\t$0, %eax\n\tjmp\t.L113\n.L114:\n\tmovl\t$-1, %eax\n.L113:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tllsortfncsj, .-llsortfncsj\n\t.globl\tllsortfnckj\n\t.type\tllsortfnckj, @function\nllsortfnckj:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L116\n\tmovl\t$1, %eax\n\tjmp\t.L117\n.L116:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L118\n\tmovl\t$0, %eax\n\tjmp\t.L117\n.L118:\n\tmovl\t$-1, %eax\n.L117:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tllsortfnckj, .-llsortfnckj\n\t.globl\tdbsortfncsj\n\t.type\tdbsortfncsj, @function\ndbsortfncsj:\n.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L127\n\tmovl\t$1, %eax\n\tjmp\t.L122\n.L127:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L123\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L123\n\tmovl\t$0, %eax\n\tjmp\t.L122\n.L123:\n\tmovl\t$-1, %eax\n.L122:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\tdbsortfncsj, .-dbsortfncsj\n\t.globl\tdbsortfnckj\n\t.type\tdbsortfnckj, @function\ndbsortfnckj:\n.LFB42:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tcomisd\t%xmm1, %xmm0\n\tjbe\t.L136\n\tmovl\t$1, %eax\n\tjmp\t.L131\n.L136:\n\tmovq\t-8(%rbp), %rax\n\tmovsd\t(%rax), %xmm0\n\tmovq\t-16(%rbp), %rax\n\tmovsd\t(%rax), %xmm1\n\tucomisd\t%xmm1, %xmm0\n\tjp\t.L132\n\tucomisd\t%xmm1, %xmm0\n\tjne\t.L132\n\tmovl\t$0, %eax\n\tjmp\t.L131\n.L132:\n\tmovl\t$-1, %eax\n.L131:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE42:\n\t.size\tdbsortfnckj, .-dbsortfnckj\n\t.globl\tstrsortfncsj\n\t.type\tstrsortfncsj, @function\nstrsortfncsj:\n.LFB43:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE43:\n\t.size\tstrsortfncsj, .-strsortfncsj\n\t.globl\tstrsortfnckj\n\t.type\tstrsortfnckj, @function\nstrsortfnckj:\n.LFB44:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE44:\n\t.size\tstrsortfnckj, .-strsortfnckj\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tshuffledget\n\t.type\tshuffledget, @function\nshuffledget:\n.LFB45:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-2097152(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -2097192(%rbp)\n\tmovl\t%esi, -2097196(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, %edi\n\tcall\ttime@PLT\n\tmovl\t%eax, %edi\n\tcall\tsrand@PLT\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L142\n.L143:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097180(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\taddl\t$1, -2097180(%rbp)\n.L142:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L143\n\tmovl\t-2097196(%rbp), %eax\n\tmovl\t%eax, -2097180(%rbp)\n\tjmp\t.L144\n.L145:\n\tcall\trand@PLT\n\tcltd\n\tidivl\t-2097180(%rbp)\n\tmovl\t%edx, -2097176(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tmovl\t%eax, -2097172(%rbp)\n\tmovl\t-2097180(%rbp), %eax\n\tleal\t-1(%rax), %ecx\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %edx\n\tmovslq\t%ecx, %rax\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tmovl\t-2097176(%rbp), %eax\n\tcltq\n\tmovl\t-2097172(%rbp), %edx\n\tmovl\t%edx, -2097168(%rbp,%rax,4)\n\tsubl\t$1, -2097180(%rbp)\n.L144:\n\tcmpl\t$0, -2097180(%rbp)\n\tjg\t.L145\n\tmovl\t$0, -2097180(%rbp)\n\tjmp\t.L146\n.L147:\n\tmovl\t-2097180(%rbp), %eax\n\tcltq\n\tmovl\t-2097168(%rbp,%rax,4), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-2097192(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -2097180(%rbp)\n.L146:\n\tmovl\t-2097180(%rbp), %eax\n\tcmpl\t-2097196(%rbp), %eax\n\tjl\t.L147\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L148\n\tcall\t__stack_chk_fail@PLT\n.L148:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE45:\n\t.size\tshuffledget, .-shuffledget\n\t.globl\tdx4\n\t.data\n\t.align 16\n\t.type\tdx4, @object\n\t.size\tdx4, 16\ndx4:\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.globl\tdy4\n\t.align 16\n\t.type\tdy4, @object\n\t.size\tdy4, 16\ndy4:\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.globl\tdx8\n\t.align 32\n\t.type\tdx8, @object\n\t.size\tdx8, 32\ndx8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.globl\tdy8\n\t.align 32\n\t.type\tdy8, @object\n\t.size\tdy8, 32\ndy8:\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.text\n\t.globl\tsearch\n\t.type\tsearch, @function\nsearch:\n.LFB46:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t%edx, -24(%rbp)\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L150\n.L152:\n\tmovl\t-12(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L151\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L150\n.L151:\n\tmovl\t-4(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n.L150:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L152\n\tmovl\t-12(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE46:\n\t.size\tsearch, .-search\n\t.globl\tsdsortfnc\n\t.type\tsdsortfnc, @function\nsdsortfnc:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L155\n\tmovl\t$-1, %eax\n\tjmp\t.L156\n.L155:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L157\n\tmovl\t$1, %eax\n\tjmp\t.L156\n.L157:\n\tmovl\t$0, %eax\n.L156:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tsdsortfnc, .-sdsortfnc\n\t.globl\tcid\n\t.type\tcid, @function\ncid:\n.LFB48:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjge\t.L159\n\tmovl\t$0, %eax\n\tjmp\t.L160\n.L159:\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tcqto\n\tidivq\t-24(%rbp)\n\taddq\t$1, %rax\n.L160:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE48:\n\t.size\tcid, .-cid\n\t.section\t.rodata\n.LC1:\n\t.string\t\"%lld%lld\"\n.LC2:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB49:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-2621440(%rsp), %r11\n.LPSRL1:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL1\n\tsubq\t$80, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$0, -2621488(%rbp)\n\tmovq\t$0, -2621480(%rbp)\n\tmovabsq\t$4154118101919364364, %rax\n\tmovq\t%rax, -2621472(%rbp)\n\tleaq\t-2621504(%rbp), %rdx\n\tleaq\t-2621512(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -2621496(%rbp)\n\tjmp\t.L162\n.L163:\n\tleaq\t-1572880(%rbp), %rdx\n\tmovq\t-2621496(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rax, %rdx\n\tleaq\t-2621456(%rbp), %rcx\n\tmovq\t-2621496(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -2621496(%rbp)\n.L162:\n\tmovq\t-2621512(%rbp), %rax\n\tcmpq\t%rax, -2621496(%rbp)\n\tjl\t.L163\n\tjmp\t.L164\n.L170:\n\tmovq\t-2621480(%rbp), %rdx\n\tmovq\t-2621472(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tmovq\t%rax, -2621464(%rbp)\n\tmovq\t$0, -2621488(%rbp)\n\tmovq\t$0, -2621496(%rbp)\n\tjmp\t.L165\n.L168:\n\tmovq\t-2621496(%rbp), %rax\n\tmovq\t-1572880(%rbp,%rax,8), %rdx\n\tmovq\t-2621496(%rbp), %rax\n\tmovq\t-2621456(%rbp,%rax,8), %rcx\n\tmovq\t-2621464(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tcid\n\taddq\t%rax, -2621488(%rbp)\n\tmovq\t-2621504(%rbp), %rax\n\tcmpq\t%rax, -2621488(%rbp)\n\tjge\t.L173\n\taddq\t$1, -2621496(%rbp)\n.L165:\n\tmovq\t-2621512(%rbp), %rax\n\tcmpq\t%rax, -2621496(%rbp)\n\tjl\t.L168\n\tjmp\t.L167\n.L173:\n\tnop\n.L167:\n\tmovq\t-2621504(%rbp), %rax\n\tcmpq\t%rax, -2621488(%rbp)\n\tjge\t.L169\n\tmovq\t-2621464(%rbp), %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, -2621480(%rbp)\n\tjmp\t.L164\n.L169:\n\tmovq\t-2621464(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -2621472(%rbp)\n.L164:\n\tmovq\t-2621480(%rbp), %rax\n\tcmpq\t-2621472(%rbp), %rax\n\tjle\t.L170\n\tmovq\t-2621480(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L172\n\tcall\t__stack_chk_fail@PLT\n.L172:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE49:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 #define mod 1000000007 #define pi 3.1415926535897932384 int max(int a,int b){if(a>b){return a;}return b;} int min(int a,int b){if(a<b){return a;}return b;} int zt(int a,int b){return max(a,b)-min(a,b);} int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} int nHr(int a,int b){return nCr(a+b-1,b);} int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} int sankaku(int x){return ((1+x)*x)/2;} long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);} int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);} void shuffledget(int x[],int n){ srand(time(0)); int i,b[524288],p,c; for(i=0;i<n;i++){ b[i]=i; } for(i=n;i>=1;i--){ p=rand()%i; c=b[i-1];b[i-1]=b[p];b[p]=c; } for(i=0;i<n;i++){ scanf("%d",&x[b[i]]); } } int dx4[4]={1,-1,0,0}; int dy4[4]={0,0,1,-1}; int dx8[8]={-1,-1,-1,0,0,1,1,1}; int dy8[8]={-1,0,1,-1,1,-1,0,1}; int search(int x,int a[],int n){ int st=0,fi=n-1,te; while(st<=fi){ te=(st+fi)/2; if(a[te]<x){st=te+1;}else{fi=te-1;} } return st; } typedef struct{ int val; int node; }sd; int sdsortfnc(const void *a,const void *b){ if(((sd*)a)->val < ((sd*)b)->val){return -1;} if(((sd*)a)->val > ((sd*)b)->val){return 1;} return 0; } long long cid(long long x,long long w,long long d){ if(x<w){return 0;} return ((x-w)/d)+1; } int main(void){ long long i,j,n,m,k,a,b,c,h,r=0,l,t; long long w[131072],d[131072]; long long st=0,fi=llinf,te; char s[524288]; scanf("%lld%lld",&n,&k); //l=strlen(s); for(i=0;i<n;i++){ scanf("%lld%lld",&w[i],&d[i]); } while(st<=fi){ te=(st+fi)/2;r=0; for(i=0;i<n;i++){ r+=cid(te,w[i],d[i]); if(r>=k){break;} } if(r<k){st=te+1;}else{fi=te-1;} } //shuffledget(a,n); //qsort(a,n,sizeof(int),sortfncsj); printf("%lld\n",st); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl max .type max, @function max: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jle .L2 movl -4(%rbp), %eax jmp .L3 .L2: movl -8(%rbp), %eax .L3: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size max, .-max .globl min .type min, @function min: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cmpl -8(%rbp), %eax jge .L5 movl -4(%rbp), %eax jmp .L6 .L5: movl -8(%rbp), %eax .L6: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size min, .-min .globl zt .type zt, @function zt: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $8, %rsp .cfi_offset 3, -24 movl %edi, -12(%rbp) movl %esi, -16(%rbp) movl -16(%rbp), %edx movl -12(%rbp), %eax movl %edx, %esi movl %eax, %edi call max movl %eax, %ebx movl -16(%rbp), %edx movl -12(%rbp), %eax movl %edx, %esi movl %eax, %edi call min movl %eax, %edx movl %ebx, %eax subl %edx, %eax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size zt, .-zt .globl round .type round, @function round: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %edx, %eax addl %eax, %eax cmpl %eax, -8(%rbp) jg .L10 movl -4(%rbp), %eax cltd idivl -8(%rbp) addl $1, %eax jmp .L11 .L10: movl -4(%rbp), %eax cltd idivl -8(%rbp) .L11: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size round, .-round .globl ceil .type ceil, @function ceil: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %edx, %eax testl %eax, %eax jne .L13 movl -4(%rbp), %eax cltd idivl -8(%rbp) jmp .L14 .L13: movl -4(%rbp), %eax cltd idivl -8(%rbp) addl $1, %eax .L14: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size ceil, .-ceil .globl gcd .type gcd, @function gcd: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) jmp .L16 .L17: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %edx, -4(%rbp) movl -24(%rbp), %eax movl %eax, -20(%rbp) movl -4(%rbp), %eax movl %eax, -24(%rbp) .L16: cmpl $0, -24(%rbp) jne .L17 movl -20(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size gcd, .-gcd .globl lcm .type lcm, @function lcm: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl -24(%rbp), %edx movl -20(%rbp), %eax movl %edx, %esi movl %eax, %edi call gcd movl %eax, -4(%rbp) movl -20(%rbp), %eax cltd idivl -4(%rbp) movl %eax, -20(%rbp) movl -20(%rbp), %eax imull -24(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size lcm, .-lcm .globl nCr .type nCr, @function nCr: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $1, -4(%rbp) movl $1, -8(%rbp) jmp .L22 .L23: movl -20(%rbp), %eax addl $1, %eax subl -8(%rbp), %eax movl -4(%rbp), %edx imull %edx, %eax movl %eax, -4(%rbp) movl -4(%rbp), %eax cltd idivl -8(%rbp) movl %eax, -4(%rbp) addl $1, -8(%rbp) .L22: movl -8(%rbp), %eax cmpl -24(%rbp), %eax jle .L23 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size nCr, .-nCr .globl nHr .type nHr, @function nHr: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $8, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %edx movl -8(%rbp), %eax addl %edx, %eax leal -1(%rax), %edx movl -8(%rbp), %eax movl %eax, %esi movl %edx, %edi call nCr leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size nHr, .-nHr .globl fact .type fact, @function fact: .LFB15: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl $1, -4(%rbp) movl $1, -8(%rbp) jmp .L28 .L29: movl -4(%rbp), %eax imull -8(%rbp), %eax movl %eax, -4(%rbp) addl $1, -8(%rbp) .L28: movl -8(%rbp), %eax cmpl -20(%rbp), %eax jle .L29 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE15: .size fact, .-fact .globl pow .type pow, @function pow: .LFB16: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $1, -4(%rbp) movl $1, -8(%rbp) jmp .L32 .L33: movl -4(%rbp), %eax imull -20(%rbp), %eax movl %eax, -4(%rbp) addl $1, -8(%rbp) .L32: movl -8(%rbp), %eax cmpl -24(%rbp), %eax jle .L33 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE16: .size pow, .-pow .globl dsum .type dsum, @function dsum: .LFB17: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl $0, -4(%rbp) jmp .L36 .L37: movl -20(%rbp), %ecx movslq %ecx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %ecx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax subl %eax, %ecx movl %ecx, %edx addl %edx, -4(%rbp) movl -20(%rbp), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -20(%rbp) .L36: cmpl $0, -20(%rbp) jne .L37 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE17: .size dsum, .-dsum .globl dsumb .type dsumb, @function dsumb: .LFB18: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl $0, -4(%rbp) jmp .L40 .L41: movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %edx, %eax addl %eax, -4(%rbp) movl -20(%rbp), %eax cltd idivl -24(%rbp) movl %eax, -20(%rbp) .L40: cmpl $0, -20(%rbp) jne .L41 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE18: .size dsumb, .-dsumb .globl sankaku .type sankaku, @function sankaku: .LFB19: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) movl -4(%rbp), %eax addl $1, %eax imull -4(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE19: .size sankaku, .-sankaku .globl llmax .type llmax, @function llmax: .LFB20: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jle .L46 movq -8(%rbp), %rax jmp .L47 .L46: movq -16(%rbp), %rax .L47: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE20: .size llmax, .-llmax .globl llmin .type llmin, @function llmin: .LFB21: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jge .L49 movq -8(%rbp), %rax jmp .L50 .L49: movq -16(%rbp), %rax .L50: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE21: .size llmin, .-llmin .globl llzt .type llzt, @function llzt: .LFB22: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $16, %rsp .cfi_offset 3, -24 movq %rdi, -16(%rbp) movq %rsi, -24(%rbp) movq -24(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call llmax movq %rax, %rbx movq -24(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call llmin movq %rax, %rdx movq %rbx, %rax subq %rdx, %rax movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE22: .size llzt, .-llzt .globl llround .type llround, @function llround: .LFB23: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cqto idivq -16(%rbp) movq %rdx, %rax addq %rax, %rax cmpq %rax, -16(%rbp) jg .L54 movq -8(%rbp), %rax cqto idivq -16(%rbp) addq $1, %rax jmp .L55 .L54: movq -8(%rbp), %rax cqto idivq -16(%rbp) .L55: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE23: .size llround, .-llround .globl llceil .type llceil, @function llceil: .LFB24: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cqto idivq -16(%rbp) movq %rdx, %rax testq %rax, %rax jne .L57 movq -8(%rbp), %rax cqto idivq -16(%rbp) jmp .L58 .L57: movq -8(%rbp), %rax cqto idivq -16(%rbp) addq $1, %rax .L58: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE24: .size llceil, .-llceil .globl llgcd .type llgcd, @function llgcd: .LFB25: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) jmp .L60 .L61: movq -24(%rbp), %rax cqto idivq -32(%rbp) movq %rdx, -8(%rbp) movq -32(%rbp), %rax movq %rax, -24(%rbp) movq -8(%rbp), %rax movq %rax, -32(%rbp) .L60: cmpq $0, -32(%rbp) jne .L61 movq -24(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE25: .size llgcd, .-llgcd .globl lllcm .type lllcm, @function lllcm: .LFB26: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -32(%rbp), %rdx movq -24(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call llgcd movq %rax, -8(%rbp) movq -24(%rbp), %rax cqto idivq -8(%rbp) movq %rax, -24(%rbp) movq -24(%rbp), %rax imulq -32(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE26: .size lllcm, .-lllcm .globl llnCr .type llnCr, @function llnCr: .LFB27: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq $1, -8(%rbp) movq $1, -16(%rbp) jmp .L66 .L67: movq -24(%rbp), %rax addq $1, %rax subq -16(%rbp), %rax movq -8(%rbp), %rdx imulq %rdx, %rax movq %rax, -8(%rbp) movq -8(%rbp), %rax cqto idivq -16(%rbp) movq %rax, -8(%rbp) addq $1, -16(%rbp) .L66: movq -16(%rbp), %rax cmpq -32(%rbp), %rax jle .L67 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE27: .size llnCr, .-llnCr .globl llnHr .type llnHr, @function llnHr: .LFB28: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax addq %rdx, %rax leaq -1(%rax), %rdx movq -16(%rbp), %rax movq %rax, %rsi movq %rdx, %rdi call llnCr leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE28: .size llnHr, .-llnHr .globl llfact .type llfact, @function llfact: .LFB29: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq $1, -8(%rbp) movq $1, -16(%rbp) jmp .L72 .L73: movq -8(%rbp), %rax imulq -16(%rbp), %rax movq %rax, -8(%rbp) addq $1, -16(%rbp) .L72: movq -16(%rbp), %rax cmpq -24(%rbp), %rax jle .L73 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE29: .size llfact, .-llfact .globl llpow .type llpow, @function llpow: .LFB30: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq $1, -8(%rbp) movq $1, -16(%rbp) jmp .L76 .L77: movq -8(%rbp), %rax imulq -24(%rbp), %rax movq %rax, -8(%rbp) addq $1, -16(%rbp) .L76: movq -16(%rbp), %rax cmpq -32(%rbp), %rax jle .L77 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE30: .size llpow, .-llpow .globl lldsum .type lldsum, @function lldsum: .LFB31: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq $0, -8(%rbp) jmp .L80 .L81: movq -24(%rbp), %rcx movabsq $7378697629483820647, %rdx movq %rcx, %rax imulq %rdx movq %rdx, %rax sarq $2, %rax movq %rcx, %rsi sarq $63, %rsi subq %rsi, %rax movq %rax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax subq %rax, %rcx movq %rcx, %rdx addq %rdx, -8(%rbp) movq -24(%rbp), %rcx movabsq $7378697629483820647, %rdx movq %rcx, %rax imulq %rdx movq %rdx, %rax sarq $2, %rax sarq $63, %rcx movq %rcx, %rdx subq %rdx, %rax movq %rax, -24(%rbp) .L80: cmpq $0, -24(%rbp) jne .L81 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE31: .size lldsum, .-lldsum .globl lldsumb .type lldsumb, @function lldsumb: .LFB32: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq $0, -8(%rbp) jmp .L84 .L85: movq -24(%rbp), %rax cqto idivq -32(%rbp) movq %rdx, %rax addq %rax, -8(%rbp) movq -24(%rbp), %rax cqto idivq -32(%rbp) movq %rax, -24(%rbp) .L84: cmpq $0, -24(%rbp) jne .L85 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE32: .size lldsumb, .-lldsumb .globl llsankaku .type llsankaku, @function llsankaku: .LFB33: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq -8(%rbp), %rax addq $1, %rax imulq -8(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE33: .size llsankaku, .-llsankaku .globl dbmax .type dbmax, @function dbmax: .LFB34: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movsd %xmm0, -8(%rbp) movsd %xmm1, -16(%rbp) movsd -8(%rbp), %xmm0 comisd -16(%rbp), %xmm0 jbe .L94 movsd -8(%rbp), %xmm0 jmp .L92 .L94: movsd -16(%rbp), %xmm0 .L92: movq %xmm0, %rax movq %rax, %xmm0 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE34: .size dbmax, .-dbmax .globl dbmin .type dbmin, @function dbmin: .LFB35: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movsd %xmm0, -8(%rbp) movsd %xmm1, -16(%rbp) movsd -16(%rbp), %xmm0 comisd -8(%rbp), %xmm0 jbe .L100 movsd -8(%rbp), %xmm0 jmp .L98 .L100: movsd -16(%rbp), %xmm0 .L98: movq %xmm0, %rax movq %rax, %xmm0 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE35: .size dbmin, .-dbmin .globl dbzt .type dbzt, @function dbzt: .LFB36: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $16, %rsp .cfi_offset 3, -24 movsd %xmm0, -16(%rbp) movsd %xmm1, -24(%rbp) movsd -24(%rbp), %xmm0 movq -16(%rbp), %rax movapd %xmm0, %xmm1 movq %rax, %xmm0 call dbmax movq %xmm0, %rbx movsd -24(%rbp), %xmm0 movq -16(%rbp), %rax movapd %xmm0, %xmm1 movq %rax, %xmm0 call dbmin movq %rbx, %xmm1 subsd %xmm0, %xmm1 movq %xmm1, %rax movq %rax, %xmm0 movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE36: .size dbzt, .-dbzt .globl sortfncsj .type sortfncsj, @function sortfncsj: .LFB37: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jle .L104 movl $1, %eax jmp .L105 .L104: movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jne .L106 movl $0, %eax jmp .L105 .L106: movl $-1, %eax .L105: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE37: .size sortfncsj, .-sortfncsj .globl sortfnckj .type sortfnckj, @function sortfnckj: .LFB38: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jge .L108 movl $1, %eax jmp .L109 .L108: movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jne .L110 movl $0, %eax jmp .L109 .L110: movl $-1, %eax .L109: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE38: .size sortfnckj, .-sortfnckj .globl llsortfncsj .type llsortfncsj, @function llsortfncsj: .LFB39: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jle .L112 movl $1, %eax jmp .L113 .L112: movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jne .L114 movl $0, %eax jmp .L113 .L114: movl $-1, %eax .L113: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE39: .size llsortfncsj, .-llsortfncsj .globl llsortfnckj .type llsortfnckj, @function llsortfnckj: .LFB40: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jge .L116 movl $1, %eax jmp .L117 .L116: movq -8(%rbp), %rax movq (%rax), %rdx movq -16(%rbp), %rax movq (%rax), %rax cmpq %rax, %rdx jne .L118 movl $0, %eax jmp .L117 .L118: movl $-1, %eax .L117: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE40: .size llsortfnckj, .-llsortfnckj .globl dbsortfncsj .type dbsortfncsj, @function dbsortfncsj: .LFB41: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movsd (%rax), %xmm0 movq -16(%rbp), %rax movsd (%rax), %xmm1 comisd %xmm1, %xmm0 jbe .L127 movl $1, %eax jmp .L122 .L127: movq -8(%rbp), %rax movsd (%rax), %xmm0 movq -16(%rbp), %rax movsd (%rax), %xmm1 ucomisd %xmm1, %xmm0 jp .L123 ucomisd %xmm1, %xmm0 jne .L123 movl $0, %eax jmp .L122 .L123: movl $-1, %eax .L122: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE41: .size dbsortfncsj, .-dbsortfncsj .globl dbsortfnckj .type dbsortfnckj, @function dbsortfnckj: .LFB42: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movsd (%rax), %xmm1 movq -16(%rbp), %rax movsd (%rax), %xmm0 comisd %xmm1, %xmm0 jbe .L136 movl $1, %eax jmp .L131 .L136: movq -8(%rbp), %rax movsd (%rax), %xmm0 movq -16(%rbp), %rax movsd (%rax), %xmm1 ucomisd %xmm1, %xmm0 jp .L132 ucomisd %xmm1, %xmm0 jne .L132 movl $0, %eax jmp .L131 .L132: movl $-1, %eax .L131: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE42: .size dbsortfnckj, .-dbsortfnckj .globl strsortfncsj .type strsortfncsj, @function strsortfncsj: .LFB43: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE43: .size strsortfncsj, .-strsortfncsj .globl strsortfnckj .type strsortfnckj, @function strsortfnckj: .LFB44: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE44: .size strsortfnckj, .-strsortfnckj .section .rodata .LC0: .string "%d" .text .globl shuffledget .type shuffledget, @function shuffledget: .LFB45: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -2097152(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $48, %rsp movq %rdi, -2097192(%rbp) movl %esi, -2097196(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, %edi call time@PLT movl %eax, %edi call srand@PLT movl $0, -2097180(%rbp) jmp .L142 .L143: movl -2097180(%rbp), %eax cltq movl -2097180(%rbp), %edx movl %edx, -2097168(%rbp,%rax,4) addl $1, -2097180(%rbp) .L142: movl -2097180(%rbp), %eax cmpl -2097196(%rbp), %eax jl .L143 movl -2097196(%rbp), %eax movl %eax, -2097180(%rbp) jmp .L144 .L145: call rand@PLT cltd idivl -2097180(%rbp) movl %edx, -2097176(%rbp) movl -2097180(%rbp), %eax subl $1, %eax cltq movl -2097168(%rbp,%rax,4), %eax movl %eax, -2097172(%rbp) movl -2097180(%rbp), %eax leal -1(%rax), %ecx movl -2097176(%rbp), %eax cltq movl -2097168(%rbp,%rax,4), %edx movslq %ecx, %rax movl %edx, -2097168(%rbp,%rax,4) movl -2097176(%rbp), %eax cltq movl -2097172(%rbp), %edx movl %edx, -2097168(%rbp,%rax,4) subl $1, -2097180(%rbp) .L144: cmpl $0, -2097180(%rbp) jg .L145 movl $0, -2097180(%rbp) jmp .L146 .L147: movl -2097180(%rbp), %eax cltq movl -2097168(%rbp,%rax,4), %eax cltq leaq 0(,%rax,4), %rdx movq -2097192(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -2097180(%rbp) .L146: movl -2097180(%rbp), %eax cmpl -2097196(%rbp), %eax jl .L147 nop movq -8(%rbp), %rax subq %fs:40, %rax je .L148 call __stack_chk_fail@PLT .L148: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE45: .size shuffledget, .-shuffledget .globl dx4 .data .align 16 .type dx4, @object .size dx4, 16 dx4: .long 1 .long -1 .long 0 .long 0 .globl dy4 .align 16 .type dy4, @object .size dy4, 16 dy4: .long 0 .long 0 .long 1 .long -1 .globl dx8 .align 32 .type dx8, @object .size dx8, 32 dx8: .long -1 .long -1 .long -1 .long 0 .long 0 .long 1 .long 1 .long 1 .globl dy8 .align 32 .type dy8, @object .size dy8, 32 dy8: .long -1 .long 0 .long 1 .long -1 .long 1 .long -1 .long 0 .long 1 .text .globl search .type search, @function search: .LFB46: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movq %rsi, -32(%rbp) movl %edx, -24(%rbp) movl $0, -12(%rbp) movl -24(%rbp), %eax subl $1, %eax movl %eax, -8(%rbp) jmp .L150 .L152: movl -12(%rbp), %edx movl -8(%rbp), %eax addl %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -4(%rbp) movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -32(%rbp), %rax addq %rdx, %rax movl (%rax), %eax cmpl %eax, -20(%rbp) jle .L151 movl -4(%rbp), %eax addl $1, %eax movl %eax, -12(%rbp) jmp .L150 .L151: movl -4(%rbp), %eax subl $1, %eax movl %eax, -8(%rbp) .L150: movl -12(%rbp), %eax cmpl -8(%rbp), %eax jle .L152 movl -12(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE46: .size search, .-search .globl sdsortfnc .type sdsortfnc, @function sdsortfnc: .LFB47: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jge .L155 movl $-1, %eax jmp .L156 .L155: movq -8(%rbp), %rax movl (%rax), %edx movq -16(%rbp), %rax movl (%rax), %eax cmpl %eax, %edx jle .L157 movl $1, %eax jmp .L156 .L157: movl $0, %eax .L156: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE47: .size sdsortfnc, .-sdsortfnc .globl cid .type cid, @function cid: .LFB48: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jge .L159 movl $0, %eax jmp .L160 .L159: movq -8(%rbp), %rax subq -16(%rbp), %rax cqto idivq -24(%rbp) addq $1, %rax .L160: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE48: .size cid, .-cid .section .rodata .LC1: .string "%lld%lld" .LC2: .string "%lld\n" .text .globl main .type main, @function main: .LFB49: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -2621440(%rsp), %r11 .LPSRL1: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL1 subq $80, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movq $0, -2621488(%rbp) movq $0, -2621480(%rbp) movabsq $4154118101919364364, %rax movq %rax, -2621472(%rbp) leaq -2621504(%rbp), %rdx leaq -2621512(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq $0, -2621496(%rbp) jmp .L162 .L163: leaq -1572880(%rbp), %rdx movq -2621496(%rbp), %rax salq $3, %rax addq %rax, %rdx leaq -2621456(%rbp), %rcx movq -2621496(%rbp), %rax salq $3, %rax addq %rcx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addq $1, -2621496(%rbp) .L162: movq -2621512(%rbp), %rax cmpq %rax, -2621496(%rbp) jl .L163 jmp .L164 .L170: movq -2621480(%rbp), %rdx movq -2621472(%rbp), %rax addq %rdx, %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax movq %rax, -2621464(%rbp) movq $0, -2621488(%rbp) movq $0, -2621496(%rbp) jmp .L165 .L168: movq -2621496(%rbp), %rax movq -1572880(%rbp,%rax,8), %rdx movq -2621496(%rbp), %rax movq -2621456(%rbp,%rax,8), %rcx movq -2621464(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call cid addq %rax, -2621488(%rbp) movq -2621504(%rbp), %rax cmpq %rax, -2621488(%rbp) jge .L173 addq $1, -2621496(%rbp) .L165: movq -2621512(%rbp), %rax cmpq %rax, -2621496(%rbp) jl .L168 jmp .L167 .L173: nop .L167: movq -2621504(%rbp), %rax cmpq %rax, -2621488(%rbp) jge .L169 movq -2621464(%rbp), %rax addq $1, %rax movq %rax, -2621480(%rbp) jmp .L164 .L169: movq -2621464(%rbp), %rax subq $1, %rax movq %rax, -2621472(%rbp) .L164: movq -2621480(%rbp), %rax cmpq -2621472(%rbp), %rax jle .L170 movq -2621480(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L172 call __stack_chk_fail@PLT .L172: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE49: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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;\n\tfor(i=0;i<7;i++){\n\t\tif(x==a[i]) f1=1;\n\t\tif(y==a[i]) f2=1;\n\t}\n\tif(f1==1&&f2==1) flg=1;\n\tf1=0;f2=0;\n\tfor(i=0;i<4;i++){\n\t\tif(x==b[i]) f1=1;\n\t\tif(y==b[i]) f2=1;\n\t}\n\tif(f1==1&&f2==1) flg=1;\n\tif(flg==1){\n\t\tprintf(\"Yes\\n\");\n\t}\n\telse{\n\t\tprintf(\"No\\n\");\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -76(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tmovl\t$0, -68(%rbp)\n\tmovl\t$1, -48(%rbp)\n\tmovl\t$3, -44(%rbp)\n\tmovl\t$5, -40(%rbp)\n\tmovl\t$7, -36(%rbp)\n\tmovl\t$8, -32(%rbp)\n\tmovl\t$10, -28(%rbp)\n\tmovl\t$12, -24(%rbp)\n\tmovl\t$4, -64(%rbp)\n\tmovl\t$6, -60(%rbp)\n\tmovl\t$9, -56(%rbp)\n\tmovl\t$11, -52(%rbp)\n\tleaq\t-84(%rbp), %rdx\n\tleaq\t-88(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L2\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L2\n\tmovl\t$1, -68(%rbp)\n.L2:\n\tmovl\t$0, -80(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %edx\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L4\n\tmovl\t$1, -76(%rbp)\n.L4:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %edx\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L5\n\tmovl\t$1, -72(%rbp)\n.L5:\n\taddl\t$1, -80(%rbp)\n.L3:\n\tcmpl\t$6, -80(%rbp)\n\tjle\t.L6\n\tcmpl\t$1, -76(%rbp)\n\tjne\t.L7\n\tcmpl\t$1, -72(%rbp)\n\tjne\t.L7\n\tmovl\t$1, -68(%rbp)\n.L7:\n\tmovl\t$0, -76(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tmovl\t$0, -80(%rbp)\n\tjmp\t.L8\n.L11:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-64(%rbp,%rax,4), %edx\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L9\n\tmovl\t$1, -76(%rbp)\n.L9:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-64(%rbp,%rax,4), %edx\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L10\n\tmovl\t$1, -72(%rbp)\n.L10:\n\taddl\t$1, -80(%rbp)\n.L8:\n\tcmpl\t$3, -80(%rbp)\n\tjle\t.L11\n\tcmpl\t$1, -76(%rbp)\n\tjne\t.L12\n\tcmpl\t$1, -72(%rbp)\n\tjne\t.L12\n\tmovl\t$1, -68(%rbp)\n.L12:\n\tcmpl\t$1, -68(%rbp)\n\tjne\t.L13\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L14\n.L13:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L14:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L16\n\tcall\t__stack_chk_fail@PLT\n.L16:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC1(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tleaq\t4(%rsp), %rdx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %esi\n\tcmpl\t$2, %esi\n\tje\t.L37\n\tmovl\t4(%rsp), %ecx\n\tmovd\t%esi, %xmm7\n\txorl\t%edi, %edi\n\tmovdqa\t.LC2(%rip), %xmm0\n\tpshufd\t$0, %xmm7, %xmm4\n\tmovdqa\t.LC3(%rip), %xmm2\n\tmovd\t%ecx, %xmm7\n\tmovdqa\t%xmm4, %xmm5\n\tpshufd\t$0, %xmm7, %xmm3\n\tpcmpeqd\t%xmm0, %xmm5\n\tpcmpeqd\t%xmm3, %xmm0\n\tpand\t%xmm2, %xmm5\n\tpand\t%xmm2, %xmm0\n\tmovdqa\t%xmm0, %xmm6\n\tpsrldq\t$8, %xmm6\n\tmovdqa\t%xmm6, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm6\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm6, %xmm1\n\tmovdqa\t%xmm1, %xmm6\n\tpsrldq\t$4, %xmm6\n\tmovdqa\t%xmm6, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm6\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm6, %xmm0\n\tmovd\t%xmm0, %eax\n\tmovdqa\t%xmm5, %xmm0\n\tpsrldq\t$8, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpcmpgtd\t%xmm5, %xmm1\n\tpand\t%xmm1, %xmm0\n\tpandn\t%xmm5, %xmm1\n\tpor\t%xmm0, %xmm1\n\tmovdqa\t%xmm1, %xmm5\n\tpsrldq\t$4, %xmm5\n\tmovdqa\t%xmm5, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm5\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm5, %xmm0\n\tmovd\t%xmm0, %edx\n\tcmpl\t$8, %esi\n\tje\t.L4\n.L3:\n\tcmpl\t$8, %ecx\n\tje\t.L17\n.L5:\n\tcmpl\t$10, %esi\n\tjne\t.L18\n\tcmpl\t$10, %ecx\n\tje\t.L38\n.L10:\n\tmovl\t$1, %edx\n\tcmpl\t$12, %ecx\n\tjne\t.L13\n.L8:\n\tleaq\t.LC5(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t$1, %edx\n\tcmpl\t$8, %ecx\n\tje\t.L17\n.L18:\n\tcmpl\t$10, %ecx\n\tje\t.L39\n\tcmpl\t$12, %esi\n\tje\t.L10\n\tcmpl\t$12, %ecx\n\tmovl\t$1, %ecx\n\tcmove\t%ecx, %eax\n.L13:\n\ttestl\t%eax, %edx\n\tjne\t.L8\n\tmovdqa\t.LC4(%rip), %xmm0\n\tpcmpeqd\t%xmm0, %xmm4\n\tpcmpeqd\t%xmm3, %xmm0\n\tpand\t%xmm2, %xmm0\n\tpand\t%xmm2, %xmm4\n\tmovdqa\t%xmm0, %xmm2\n\tpsrldq\t$8, %xmm2\n\tmovdqa\t%xmm2, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm2\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm2, %xmm1\n\tmovdqa\t%xmm1, %xmm2\n\tpsrldq\t$4, %xmm2\n\tmovdqa\t%xmm2, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm2\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm2, %xmm0\n\tmovd\t%xmm0, %edx\n\tmovdqa\t%xmm4, %xmm0\n\tpsrldq\t$8, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpcmpgtd\t%xmm4, %xmm1\n\tpand\t%xmm1, %xmm0\n\tpandn\t%xmm4, %xmm1\n\tpor\t%xmm0, %xmm1\n\tmovdqa\t%xmm1, %xmm2\n\tpsrldq\t$4, %xmm2\n\tmovdqa\t%xmm2, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm2\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm2, %xmm0\n\tmovd\t%xmm0, %eax\n\tandl\t%edx, %eax\n\torl\t%edi, %eax\n\ttestb\t$1, %al\n\tjne\t.L8\n\tleaq\t.LC6(%rip), %rdi\n\tcall\tputs@PLT\n.L16:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L40\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L17:\n\t.cfi_restore_state\n\tmovl\t$8, %ecx\n\tmovl\t$1, %eax\n\tjmp\t.L5\n.L39:\n\tcmpl\t$12, %esi\n\tje\t.L8\n.L9:\n\tmovl\t$1, %eax\n\tjmp\t.L13\n.L37:\n\tmovl\t4(%rsp), %ecx\n\tmovdqa\t.LC3(%rip), %xmm2\n\txorl\t%edi, %edi\n\tcmpl\t$2, 4(%rsp)\n\tmovd\t%ecx, %xmm3\n\tsete\t%dil\n\txorl\t%edx, %edx\n\tpshufd\t$0, %xmm3, %xmm3\n\tmovdqa\t%xmm3, %xmm0\n\tpcmpeqd\t.LC2(%rip), %xmm0\n\tpand\t%xmm2, %xmm0\n\tmovdqa\t%xmm0, %xmm4\n\tpsrldq\t$8, %xmm4\n\tmovdqa\t%xmm4, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm4\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm4, %xmm1\n\tmovdqa\t%xmm1, %xmm4\n\tpsrldq\t$4, %xmm4\n\tmovdqa\t%xmm4, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm4\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm4, %xmm0\n\tmovdqa\t.LC0(%rip), %xmm4\n\tmovd\t%xmm0, %eax\n\tjmp\t.L3\n.L38:\n\tmovl\t$1, %edx\n\tjmp\t.L9\n.L40:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t2\n\t.long\t2\n\t.long\t2\n\t.long\t2\n\t.align 16\n.LC2:\n\t.long\t1\n\t.long\t3\n\t.long\t5\n\t.long\t7\n\t.align 16\n.LC3:\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.align 16\n.LC4:\n\t.long\t4\n\t.long\t6\n\t.long\t9\n\t.long\t11\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC1(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tleaq\t4(%rsp), %rdx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %esi\n\tcmpl\t$2, %esi\n\tje\t.L37\n\tmovl\t4(%rsp), %ecx\n\tmovd\t%esi, %xmm7\n\txorl\t%edi, %edi\n\tmovdqa\t.LC2(%rip), %xmm0\n\tpshufd\t$0, %xmm7, %xmm4\n\tmovdqa\t.LC3(%rip), %xmm2\n\tmovd\t%ecx, %xmm7\n\tmovdqa\t%xmm4, %xmm5\n\tpshufd\t$0, %xmm7, %xmm3\n\tpcmpeqd\t%xmm0, %xmm5\n\tpcmpeqd\t%xmm3, %xmm0\n\tpand\t%xmm2, %xmm5\n\tpand\t%xmm2, %xmm0\n\tmovdqa\t%xmm0, %xmm6\n\tpsrldq\t$8, %xmm6\n\tmovdqa\t%xmm6, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm6\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm6, %xmm1\n\tmovdqa\t%xmm1, %xmm6\n\tpsrldq\t$4, %xmm6\n\tmovdqa\t%xmm6, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm6\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm6, %xmm0\n\tmovd\t%xmm0, %eax\n\tmovdqa\t%xmm5, %xmm0\n\tpsrldq\t$8, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpcmpgtd\t%xmm5, %xmm1\n\tpand\t%xmm1, %xmm0\n\tpandn\t%xmm5, %xmm1\n\tpor\t%xmm0, %xmm1\n\tmovdqa\t%xmm1, %xmm5\n\tpsrldq\t$4, %xmm5\n\tmovdqa\t%xmm5, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm5\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm5, %xmm0\n\tmovd\t%xmm0, %edx\n\tcmpl\t$8, %esi\n\tje\t.L4\n.L3:\n\tcmpl\t$8, %ecx\n\tje\t.L17\n.L5:\n\tcmpl\t$10, %esi\n\tjne\t.L18\n\tcmpl\t$10, %ecx\n\tje\t.L38\n.L10:\n\tmovl\t$1, %edx\n\tcmpl\t$12, %ecx\n\tjne\t.L13\n.L8:\n\tleaq\t.LC5(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t$1, %edx\n\tcmpl\t$8, %ecx\n\tje\t.L17\n.L18:\n\tcmpl\t$10, %ecx\n\tje\t.L39\n\tcmpl\t$12, %esi\n\tje\t.L10\n\tcmpl\t$12, %ecx\n\tmovl\t$1, %ecx\n\tcmove\t%ecx, %eax\n.L13:\n\ttestl\t%eax, %edx\n\tjne\t.L8\n\tmovdqa\t.LC4(%rip), %xmm0\n\tpcmpeqd\t%xmm0, %xmm4\n\tpcmpeqd\t%xmm3, %xmm0\n\tpand\t%xmm2, %xmm0\n\tpand\t%xmm2, %xmm4\n\tmovdqa\t%xmm0, %xmm2\n\tpsrldq\t$8, %xmm2\n\tmovdqa\t%xmm2, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm2\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm2, %xmm1\n\tmovdqa\t%xmm1, %xmm2\n\tpsrldq\t$4, %xmm2\n\tmovdqa\t%xmm2, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm2\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm2, %xmm0\n\tmovd\t%xmm0, %edx\n\tmovdqa\t%xmm4, %xmm0\n\tpsrldq\t$8, %xmm0\n\tmovdqa\t%xmm0, %xmm1\n\tpcmpgtd\t%xmm4, %xmm1\n\tpand\t%xmm1, %xmm0\n\tpandn\t%xmm4, %xmm1\n\tpor\t%xmm0, %xmm1\n\tmovdqa\t%xmm1, %xmm2\n\tpsrldq\t$4, %xmm2\n\tmovdqa\t%xmm2, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm2\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm2, %xmm0\n\tmovd\t%xmm0, %eax\n\tandl\t%edx, %eax\n\torl\t%edi, %eax\n\ttestb\t$1, %al\n\tjne\t.L8\n\tleaq\t.LC6(%rip), %rdi\n\tcall\tputs@PLT\n.L16:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L40\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L17:\n\t.cfi_restore_state\n\tmovl\t$8, %ecx\n\tmovl\t$1, %eax\n\tjmp\t.L5\n.L39:\n\tcmpl\t$12, %esi\n\tje\t.L8\n.L9:\n\tmovl\t$1, %eax\n\tjmp\t.L13\n.L37:\n\tmovl\t4(%rsp), %ecx\n\tmovdqa\t.LC3(%rip), %xmm2\n\txorl\t%edi, %edi\n\tcmpl\t$2, 4(%rsp)\n\tmovd\t%ecx, %xmm3\n\tsete\t%dil\n\txorl\t%edx, %edx\n\tpshufd\t$0, %xmm3, %xmm3\n\tmovdqa\t%xmm3, %xmm0\n\tpcmpeqd\t.LC2(%rip), %xmm0\n\tpand\t%xmm2, %xmm0\n\tmovdqa\t%xmm0, %xmm4\n\tpsrldq\t$8, %xmm4\n\tmovdqa\t%xmm4, %xmm1\n\tpcmpgtd\t%xmm0, %xmm1\n\tpand\t%xmm1, %xmm4\n\tpandn\t%xmm0, %xmm1\n\tpor\t%xmm4, %xmm1\n\tmovdqa\t%xmm1, %xmm4\n\tpsrldq\t$4, %xmm4\n\tmovdqa\t%xmm4, %xmm0\n\tpcmpgtd\t%xmm1, %xmm0\n\tpand\t%xmm0, %xmm4\n\tpandn\t%xmm1, %xmm0\n\tpor\t%xmm4, %xmm0\n\tmovdqa\t.LC0(%rip), %xmm4\n\tmovd\t%xmm0, %eax\n\tjmp\t.L3\n.L38:\n\tmovl\t$1, %edx\n\tjmp\t.L9\n.L40:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t2\n\t.long\t2\n\t.long\t2\n\t.long\t2\n\t.align 16\n.LC2:\n\t.long\t1\n\t.long\t3\n\t.long\t5\n\t.long\t7\n\t.align 16\n.LC3:\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.long\t1\n\t.align 16\n.LC4:\n\t.long\t4\n\t.long\t6\n\t.long\t9\n\t.long\t11\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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;\n\tfor(i=0;i<7;i++){\n\t\tif(x==a[i]) f1=1;\n\t\tif(y==a[i]) f2=1;\n\t}\n\tif(f1==1&&f2==1) flg=1;\n\tf1=0;f2=0;\n\tfor(i=0;i<4;i++){\n\t\tif(x==b[i]) f1=1;\n\t\tif(y==b[i]) f2=1;\n\t}\n\tif(f1==1&&f2==1) flg=1;\n\tif(flg==1){\n\t\tprintf(\"Yes\\n\");\n\t}\n\telse{\n\t\tprintf(\"No\\n\");\n\t}\n\treturn 0;\n}", "index": 84, "inputs": [ "2 8\n", "1 10\n", "1 4\n", "2 3\n", "2 10\n", "4 3\n", "7 3\n", "7 6\n", "7 4\n", "7 5\n", "4 5\n", "1 5\n", "1 2\n", "0 2\n", "-1 2\n", "2 1\n", "1 1\n", "2 0\n", "2 6\n", "3 3\n", "7 1\n", "5 4\n", "7 10\n", "5 5\n", "2 5\n", "2 9\n", "3 6\n", "5 3\n", "7 12\n", "5 8\n", "3 9\n", "3 4\n", "5 2\n", "1 8\n", "5 10\n", "5 1\n", "3 1\n", "1 6\n", "8 3\n", "9 4\n", "2 7\n", "5 6\n", "4 4\n", "2 -1\n", "2 -2\n", "3 2\n", "2 12\n", "10 2\n", "7 2\n", "6 1\n", "1 9\n", "4 1\n", "4 9\n", "1 11\n", "4 2\n", "8 4\n", "6 4\n", "5 12\n", "6 2\n", "2 -3\n", "3 7\n", "11 1\n", "8 1\n", "8 9\n", "2 11\n", "1 7\n", "5 7\n", "8 5\n", "4 12\n", "9 12\n", "1 12\n", "12 1\n", "3 10\n", "4 8\n", "-3 2\n", "7 9\n", "10 1\n", "-2 2\n", "8 2\n", "7 11\n", "5 9\n", "12 12\n", "9 1\n", "3 8\n", "8 7\n", "9 2\n", "3 5\n", "4 6\n", "12 2\n", "7 8\n", "-4 2\n", "6 9\n", "6 8\n", "11 2\n", "8 12\n", "10 7\n", "11 5\n", "3 11\n", "12 5\n", "4 7\n", "2 4\n", "1 3\n", "1 3\n" ], "outputs": [ "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "No\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "No\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "No\n", "No\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n" ], "question": "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;\n\tfor(i=0;i<7;i++){\n\t\tif(x==a[i]) f1=1;\n\t\tif(y==a[i]) f2=1;\n\t}\n\tif(f1==1&&f2==1) flg=1;\n\tf1=0;f2=0;\n\tfor(i=0;i<4;i++){\n\t\tif(x==b[i]) f1=1;\n\t\tif(y==b[i]) f2=1;\n\t}\n\tif(f1==1&&f2==1) flg=1;\n\tif(flg==1){\n\t\tprintf(\"Yes\\n\");\n\t}\n\telse{\n\t\tprintf(\"No\\n\");\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -76(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tmovl\t$0, -68(%rbp)\n\tmovl\t$1, -48(%rbp)\n\tmovl\t$3, -44(%rbp)\n\tmovl\t$5, -40(%rbp)\n\tmovl\t$7, -36(%rbp)\n\tmovl\t$8, -32(%rbp)\n\tmovl\t$10, -28(%rbp)\n\tmovl\t$12, -24(%rbp)\n\tmovl\t$4, -64(%rbp)\n\tmovl\t$6, -60(%rbp)\n\tmovl\t$9, -56(%rbp)\n\tmovl\t$11, -52(%rbp)\n\tleaq\t-84(%rbp), %rdx\n\tleaq\t-88(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L2\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L2\n\tmovl\t$1, -68(%rbp)\n.L2:\n\tmovl\t$0, -80(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %edx\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L4\n\tmovl\t$1, -76(%rbp)\n.L4:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-48(%rbp,%rax,4), %edx\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L5\n\tmovl\t$1, -72(%rbp)\n.L5:\n\taddl\t$1, -80(%rbp)\n.L3:\n\tcmpl\t$6, -80(%rbp)\n\tjle\t.L6\n\tcmpl\t$1, -76(%rbp)\n\tjne\t.L7\n\tcmpl\t$1, -72(%rbp)\n\tjne\t.L7\n\tmovl\t$1, -68(%rbp)\n.L7:\n\tmovl\t$0, -76(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tmovl\t$0, -80(%rbp)\n\tjmp\t.L8\n.L11:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-64(%rbp,%rax,4), %edx\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L9\n\tmovl\t$1, -76(%rbp)\n.L9:\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tmovl\t-64(%rbp,%rax,4), %edx\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L10\n\tmovl\t$1, -72(%rbp)\n.L10:\n\taddl\t$1, -80(%rbp)\n.L8:\n\tcmpl\t$3, -80(%rbp)\n\tjle\t.L11\n\tcmpl\t$1, -76(%rbp)\n\tjne\t.L12\n\tcmpl\t$1, -72(%rbp)\n\tjne\t.L12\n\tmovl\t$1, -68(%rbp)\n.L12:\n\tcmpl\t$1, -68(%rbp)\n\tjne\t.L13\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L14\n.L13:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L14:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L16\n\tcall\t__stack_chk_fail@PLT\n.L16:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; if(y==a[i]) f2=1; } if(f1==1&&f2==1) flg=1; f1=0;f2=0; for(i=0;i<4;i++){ if(x==b[i]) f1=1; if(y==b[i]) f2=1; } if(f1==1&&f2==1) flg=1; if(flg==1){ printf("Yes\n"); } else{ printf("No\n"); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "Yes" .LC2: .string "No" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $96, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -76(%rbp) movl $0, -72(%rbp) movl $0, -68(%rbp) movl $1, -48(%rbp) movl $3, -44(%rbp) movl $5, -40(%rbp) movl $7, -36(%rbp) movl $8, -32(%rbp) movl $10, -28(%rbp) movl $12, -24(%rbp) movl $4, -64(%rbp) movl $6, -60(%rbp) movl $9, -56(%rbp) movl $11, -52(%rbp) leaq -84(%rbp), %rdx leaq -88(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -88(%rbp), %eax cmpl $2, %eax jne .L2 movl -84(%rbp), %eax cmpl $2, %eax jne .L2 movl $1, -68(%rbp) .L2: movl $0, -80(%rbp) jmp .L3 .L6: movl -80(%rbp), %eax cltq movl -48(%rbp,%rax,4), %edx movl -88(%rbp), %eax cmpl %eax, %edx jne .L4 movl $1, -76(%rbp) .L4: movl -80(%rbp), %eax cltq movl -48(%rbp,%rax,4), %edx movl -84(%rbp), %eax cmpl %eax, %edx jne .L5 movl $1, -72(%rbp) .L5: addl $1, -80(%rbp) .L3: cmpl $6, -80(%rbp) jle .L6 cmpl $1, -76(%rbp) jne .L7 cmpl $1, -72(%rbp) jne .L7 movl $1, -68(%rbp) .L7: movl $0, -76(%rbp) movl $0, -72(%rbp) movl $0, -80(%rbp) jmp .L8 .L11: movl -80(%rbp), %eax cltq movl -64(%rbp,%rax,4), %edx movl -88(%rbp), %eax cmpl %eax, %edx jne .L9 movl $1, -76(%rbp) .L9: movl -80(%rbp), %eax cltq movl -64(%rbp,%rax,4), %edx movl -84(%rbp), %eax cmpl %eax, %edx jne .L10 movl $1, -72(%rbp) .L10: addl $1, -80(%rbp) .L8: cmpl $3, -80(%rbp) jle .L11 cmpl $1, -76(%rbp) jne .L12 cmpl $1, -72(%rbp) jne .L12 movl $1, -68(%rbp) .L12: cmpl $1, -68(%rbp) jne .L13 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L14 .L13: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L14: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L16 call __stack_chk_fail@PLT .L16: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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) * n);\n l = (int*)malloc(sizeof(int) * n);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n printf(\"%d\\n\", lis(n, a, l));\n free(a);\n free(l);\n}\nint lis(int size, int *A, int *L)\n{\n int i, length = 1;\n L[0] = A[0];\n for (i = 0; i < size; i++) {\n if (L[length-1] < A[i]) L[length++] = A[i];\n else {\n int lo = 0, hi = length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (A[i] <= L[mid]) hi = mid - 1;\n else lo = mid + 1;\n }\n L[lo] = A[i];\n }\n }\n return length;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t$0, -28(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -28(%rbp)\n.L2:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjl\t.L3\n\tmovl\t-32(%rbp), %eax\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-24(%rbp), %rcx\n\tmovq\t%rcx, %rsi\n\tmovl\t%eax, %edi\n\tcall\tlis\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.globl\tlis\n\t.type\tlis, @function\nlis:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovl\t$1, -16(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, (%rax)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L7\n.L13:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tleaq\t-4(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -16(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t(%rcx), %eax\n\tmovl\t%eax, (%rdx)\n\tjmp\t.L9\n.L8:\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L10\n.L12:\n\tmovl\t-12(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L11\n\tmovl\t-4(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n.L10:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L12\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-56(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, (%rdx)\n.L9:\n\taddl\t$1, -20(%rbp)\n.L7:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjl\t.L13\n\tmovl\t-16(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tlis, .-lis\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tjmp\t.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t%r10d, %rax\n\taddq\t$4, %rsi\n\taddl\t$1, %r10d\n\tmovl\t%edi, (%r8,%rax,4)\n\tcmpq\t%rsi, %r11\n\tje\t.L1\n.L13:\n\tmovslq\t%r10d, %rax\n\tmovl\t-4(%r8,%rax,4), %eax\n.L9:\n\tmovl\t(%rsi), %edi\n\tcmpl\t%eax, %edi\n\tjg\t.L12\n\tleal\t-1(%r10), %ecx\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleal\t(%rcx,%rdx), %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %r9\n\tcmpl\t(%r8,%r9,4), %edi\n\tjg\t.L5\n\tleal\t-1(%rax), %ecx\n\tcmpl\t%edx, %ecx\n\tjge\t.L8\n\tmovslq\t%edx, %rdx\n\tmovl\t%edi, (%r8,%rdx,4)\n.L14:\n\taddq\t$4, %rsi\n\tcmpq\t%rsi, %r11\n\tjne\t.L13\n.L1:\n\tmovl\t%r10d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tleal\t1(%rax), %edx\n\tcmpl\t%ecx, %edx\n\tjle\t.L8\n\tmovslq\t%edx, %rdx\n\tmovl\t%edi, (%r8,%rdx,4)\n\tjmp\t.L14\n.L10:\n\tmovl\t$1, %r10d\n\tmovl\t%r10d, %eax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tlis, .-lis\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%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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t4(%rsp), %rbp\n\tmovq\t%rbp, %r12\n\tsalq\t$2, %rbp\n\tmovq\t%rbp, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovq\t%rax, %r14\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %r15\n\ttestl\t%r12d, %r12d\n\tjle\t.L16\n\tmovq\t%r14, %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %r12d\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %r12d\n\tjg\t.L17\n.L16:\n\tmovq\t%r15, %rdx\n\tmovq\t%r14, %rsi\n\tmovl\t%r12d, %edi\n\tcall\tlis\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tmovl\t%eax, %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%r14, %rdi\n\tcall\tfree@PLT\n\tmovq\t%r15, %rdi\n\tcall\tfree@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L21\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L21:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.L9\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t%r10d, %rax\n\taddq\t$4, %rsi\n\taddl\t$1, %r10d\n\tmovl\t%edi, (%r8,%rax,4)\n\tcmpq\t%rsi, %r11\n\tje\t.L1\n.L13:\n\tmovslq\t%r10d, %rax\n\tmovl\t-4(%r8,%rax,4), %eax\n.L9:\n\tmovl\t(%rsi), %edi\n\tcmpl\t%eax, %edi\n\tjg\t.L12\n\tleal\t-1(%r10), %ecx\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleal\t(%rcx,%rdx), %eax\n\tsarl\t%eax\n\tmovslq\t%eax, %r9\n\tcmpl\t(%r8,%r9,4), %edi\n\tjg\t.L5\n\tleal\t-1(%rax), %ecx\n\tcmpl\t%edx, %ecx\n\tjge\t.L8\n\tmovslq\t%edx, %rdx\n\tmovl\t%edi, (%r8,%rdx,4)\n.L14:\n\taddq\t$4, %rsi\n\tcmpq\t%rsi, %r11\n\tjne\t.L13\n.L1:\n\tmovl\t%r10d, %eax\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tleal\t1(%rax), %edx\n\tcmpl\t%ecx, %edx\n\tjle\t.L8\n\tmovslq\t%edx, %rdx\n\tmovl\t%edi, (%r8,%rdx,4)\n\tjmp\t.L14\n.L10:\n\tmovl\t$1, %r10d\n\tmovl\t%r10d, %eax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tlis, .-lis\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%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.cfi_offset 13, -32\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovq\t%r13, %rdi\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t4(%rsp), %rbp\n\tmovq\t%rbp, %r12\n\tsalq\t$2, %rbp\n\tmovq\t%rbp, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovq\t%rax, %r14\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %r15\n\ttestl\t%r12d, %r12d\n\tjle\t.L16\n\tmovq\t%r14, %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L17:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %r12d\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %r12d\n\tjg\t.L17\n.L16:\n\tmovq\t%r15, %rdx\n\tmovq\t%r14, %rsi\n\tmovl\t%r12d, %edi\n\tcall\tlis\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tmovl\t%eax, %edx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%r14, %rdi\n\tcall\tfree@PLT\n\tmovq\t%r15, %rdi\n\tcall\tfree@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L21\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L21:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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) * n);\n l = (int*)malloc(sizeof(int) * n);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n printf(\"%d\\n\", lis(n, a, l));\n free(a);\n free(l);\n}\nint lis(int size, int *A, int *L)\n{\n int i, length = 1;\n L[0] = A[0];\n for (i = 0; i < size; i++) {\n if (L[length-1] < A[i]) L[length++] = A[i];\n else {\n int lo = 0, hi = length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (A[i] <= L[mid]) hi = mid - 1;\n else lo = mid + 1;\n }\n L[lo] = A[i];\n }\n }\n return length;\n}\n", "index": 100, "inputs": [ "5\n5\n1\n3\n2\n6\n", "3\n1\n1\n2\n", "3\n1\n1\n0\n", "5\n0\n2\n1\n2\n11\n", "5\n5\n1\n3\n1\n6\n", "3\n0\n1\n2\n", "5\n5\n1\n2\n1\n6\n", "3\n0\n2\n2\n", "5\n5\n1\n2\n0\n6\n", "5\n5\n1\n2\n-1\n6\n", "5\n5\n1\n2\n-1\n10\n", "5\n5\n1\n0\n-1\n10\n", "5\n5\n1\n0\n0\n10\n", "5\n5\n1\n0\n-1\n11\n", "5\n5\n1\n0\n0\n11\n", "5\n5\n1\n1\n0\n11\n", "5\n5\n2\n1\n0\n11\n", "5\n8\n2\n1\n0\n11\n", "5\n8\n1\n1\n0\n11\n", "5\n8\n1\n0\n0\n11\n", "5\n2\n1\n0\n0\n11\n", "5\n2\n1\n0\n1\n11\n", "5\n5\n1\n0\n2\n4\n", "3\n1\n2\n1\n", "5\n5\n1\n3\n2\n8\n", "5\n5\n1\n1\n1\n6\n", "3\n0\n1\n3\n", "5\n5\n1\n4\n0\n6\n", "3\n0\n3\n2\n", "5\n5\n0\n2\n0\n6\n", "5\n5\n1\n1\n-1\n6\n", "5\n5\n2\n2\n-1\n6\n", "5\n5\n1\n0\n0\n16\n", "5\n8\n1\n0\n-1\n11\n", "5\n5\n1\n0\n0\n13\n", "5\n5\n1\n1\n0\n2\n", "5\n0\n2\n1\n0\n11\n", "5\n8\n2\n1\n1\n11\n", "5\n8\n1\n1\n1\n11\n", "5\n8\n1\n0\n1\n11\n", "5\n2\n1\n1\n0\n11\n", "5\n2\n1\n0\n1\n19\n", "5\n5\n2\n0\n2\n4\n", "3\n1\n2\n0\n", "5\n9\n1\n3\n2\n8\n", "3\n1\n0\n0\n", "5\n5\n1\n0\n1\n6\n", "3\n0\n1\n1\n", "5\n8\n1\n4\n0\n6\n", "3\n0\n3\n3\n", "5\n5\n0\n2\n-1\n6\n", "5\n5\n0\n1\n-1\n6\n", "5\n1\n2\n2\n-1\n6\n", "5\n5\n1\n0\n0\n23\n", "5\n8\n2\n0\n-1\n11\n", "5\n5\n1\n0\n0\n24\n", "5\n5\n0\n1\n0\n2\n", "5\n0\n2\n1\n1\n11\n", "5\n8\n2\n1\n1\n4\n", "5\n11\n1\n1\n0\n11\n", "5\n14\n1\n0\n1\n11\n", "5\n2\n1\n1\n0\n15\n", "5\n2\n1\n0\n0\n19\n", "5\n5\n2\n0\n2\n6\n", "3\n2\n0\n0\n", "5\n9\n1\n6\n2\n8\n", "3\n1\n0\n-1\n", "3\n1\n1\n4\n", "5\n11\n1\n4\n0\n6\n", "5\n1\n2\n2\n-1\n5\n", "5\n5\n1\n0\n0\n1\n", "5\n8\n2\n0\n0\n11\n", "5\n5\n1\n0\n0\n42\n", "5\n5\n0\n1\n-1\n2\n", "5\n1\n2\n1\n1\n11\n", "5\n6\n2\n1\n1\n4\n", "5\n11\n0\n1\n0\n11\n", "5\n14\n1\n0\n0\n11\n", "5\n2\n1\n1\n-1\n15\n", "5\n1\n1\n0\n0\n19\n", "5\n9\n2\n0\n2\n6\n", "3\n2\n0\n1\n", "5\n9\n1\n0\n2\n8\n", "3\n1\n-1\n-1\n", "3\n1\n1\n3\n", "5\n11\n1\n3\n0\n6\n", "5\n1\n2\n2\n-2\n5\n", "5\n3\n1\n0\n0\n1\n", "5\n14\n2\n0\n0\n11\n", "5\n5\n1\n0\n0\n29\n", "5\n5\n0\n1\n-1\n3\n", "5\n6\n4\n1\n1\n4\n", "5\n11\n0\n1\n1\n11\n", "5\n14\n1\n0\n0\n1\n", "5\n1\n1\n1\n-1\n15\n", "5\n1\n1\n0\n0\n8\n", "5\n9\n4\n0\n2\n6\n", "3\n2\n0\n2\n", "5\n9\n1\n0\n2\n12\n", "3\n0\n-1\n-1\n", "5\n5\n1\n3\n2\n4\n", "5\n5\n1\n3\n2\n4\n", "3\n1\n1\n1\n" ], "outputs": [ "3\n", "2\n", "1\n", "4\n", "3\n", "3\n", "3\n", "2\n", "3\n", "3\n", "3\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "3\n", "3\n", "2\n", "3\n", "2\n", "3\n", "3\n", "2\n", "3\n", "2\n", "2\n", "2\n", "2\n", "2\n", "2\n", "3\n", "2\n", "2\n", "3\n", "2\n", "3\n", "3\n", "2\n", "3\n", "1\n", "3\n", "2\n", "3\n", "2\n", "3\n", "3\n", "3\n", "2\n", "2\n", "2\n", "3\n", "3\n", "2\n", "2\n", "3\n", "2\n", "2\n", "3\n", "1\n", "3\n", "1\n", "2\n", "3\n", "3\n", "2\n", "2\n", "2\n", "3\n", "3\n", "2\n", "3\n", "2\n", "2\n", "2\n", "3\n", "2\n", "3\n", "1\n", "2\n", "3\n", "3\n", "2\n", "2\n", "2\n", "3\n", "2\n", "3\n", "2\n", "2\n", "2\n", "3\n", "2\n", "3\n", "1\n", "3\n", "3\n", "1\n" ], "question": "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) * n);\n l = (int*)malloc(sizeof(int) * n);\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n printf(\"%d\\n\", lis(n, a, l));\n free(a);\n free(l);\n}\nint lis(int size, int *A, int *L)\n{\n int i, length = 1;\n L[0] = A[0];\n for (i = 0; i < size; i++) {\n if (L[length-1] < A[i]) L[length++] = A[i];\n else {\n int lo = 0, hi = length - 1;\n while (lo <= hi) {\n int mid = (lo + hi) / 2;\n if (A[i] <= L[mid]) hi = mid - 1;\n else lo = mid + 1;\n }\n L[lo] = A[i];\n }\n }\n return length;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t$0, -28(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -28(%rbp)\n.L2:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t%eax, -28(%rbp)\n\tjl\t.L3\n\tmovl\t-32(%rbp), %eax\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-24(%rbp), %rcx\n\tmovq\t%rcx, %rsi\n\tmovl\t%eax, %edi\n\tcall\tlis\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.globl\tlis\n\t.type\tlis, @function\nlis:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -36(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t%rdx, -56(%rbp)\n\tmovl\t$1, -16(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-56(%rbp), %rax\n\tmovl\t%edx, (%rax)\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L7\n.L13:\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\tleaq\t-4(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -16(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t(%rcx), %eax\n\tmovl\t%eax, (%rdx)\n\tjmp\t.L9\n.L8:\n\tmovl\t$0, -12(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L10\n.L12:\n\tmovl\t-12(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjg\t.L11\n\tmovl\t-4(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -8(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovl\t-4(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n.L10:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-8(%rbp), %eax\n\tjle\t.L12\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t-12(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tmovq\t-56(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, (%rdx)\n.L9:\n\taddl\t$1, -20(%rbp)\n.L7:\n\tmovl\t-20(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjl\t.L13\n\tmovl\t-16(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tlis, .-lis\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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) * n); for (i = 0; i < n; i++) scanf("%d", &a[i]); printf("%d\n", lis(n, a, l)); free(a); free(l); } int lis(int size, int *A, int *L) { int i, length = 1; L[0] = A[0]; for (i = 0; i < size; i++) { if (L[length-1] < A[i]) L[length++] = A[i]; else { int lo = 0, hi = length - 1; while (lo <= hi) { int mid = (lo + hi) / 2; if (A[i] <= L[mid]) hi = mid - 1; else lo = mid + 1; } L[lo] = A[i]; } } return length; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -32(%rbp), %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, -24(%rbp) movl -32(%rbp), %eax cltq salq $2, %rax movq %rax, %rdi call malloc@PLT movq %rax, -16(%rbp) movl $0, -28(%rbp) jmp .L2 .L3: movl -28(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -28(%rbp) .L2: movl -32(%rbp), %eax cmpl %eax, -28(%rbp) jl .L3 movl -32(%rbp), %eax movq -16(%rbp), %rdx movq -24(%rbp), %rcx movq %rcx, %rsi movl %eax, %edi call lis movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq -24(%rbp), %rax movq %rax, %rdi call free@PLT movq -16(%rbp), %rax movq %rax, %rdi call free@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .globl lis .type lis, @function lis: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -36(%rbp) movq %rsi, -48(%rbp) movq %rdx, -56(%rbp) movl $1, -16(%rbp) movq -48(%rbp), %rax movl (%rax), %edx movq -56(%rbp), %rax movl %edx, (%rax) movl $0, -20(%rbp) jmp .L7 .L13: movl -16(%rbp), %eax cltq salq $2, %rax leaq -4(%rax), %rdx movq -56(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -48(%rbp), %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jge .L8 movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -48(%rbp), %rax leaq (%rdx,%rax), %rcx movl -16(%rbp), %eax leal 1(%rax), %edx movl %edx, -16(%rbp) cltq leaq 0(,%rax,4), %rdx movq -56(%rbp), %rax addq %rax, %rdx movl (%rcx), %eax movl %eax, (%rdx) jmp .L9 .L8: movl $0, -12(%rbp) movl -16(%rbp), %eax subl $1, %eax movl %eax, -8(%rbp) jmp .L10 .L12: movl -12(%rbp), %edx movl -8(%rbp), %eax addl %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -4(%rbp) movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -48(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -4(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -56(%rbp), %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jg .L11 movl -4(%rbp), %eax subl $1, %eax movl %eax, -8(%rbp) jmp .L10 .L11: movl -4(%rbp), %eax addl $1, %eax movl %eax, -12(%rbp) .L10: movl -12(%rbp), %eax cmpl -8(%rbp), %eax jle .L12 movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -48(%rbp), %rax addq %rdx, %rax movl -12(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx movq -56(%rbp), %rdx addq %rcx, %rdx movl (%rax), %eax movl %eax, (%rdx) .L9: addl $1, -20(%rbp) .L7: movl -20(%rbp), %eax cmpl -36(%rbp), %eax jl .L13 movl -16(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size lis, .-lis .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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, const void *b){\n\tint sub = (((pair *)a)->L + ((pair *)a)->R) - (((pair *)b)->L + ((pair *)b)->R);\n\tif(sub > 0){\n\t\treturn -1;\n\t}\n\telse if(sub == 0){\n\t\treturn 0;\n\t}\n\telse{\n\t\treturn 1;\n\t}\n}\n\nint min(int a, int b){\n\treturn a <= b ? a : b;\n}\n\nsigned main(){\n\tint N, i, j, k, l;\n\tscanf(\"%lld\", &N);\n\tpair *ps = (pair *)malloc(sizeof(pair) * N);\n\tfor(i = 0; i < N; i++){\n\t\tscanf(\"%lld%lld\", &ps[i].L, &ps[i].R);\n\t}\n\tqsort(ps, N, sizeof(pair), compair);\n\tint ***dp = (int ***)malloc(sizeof(int **) * (N / 2 + 2));\n\tfor(i = 0; i <= N / 2 + 1; i++){\n\t\tdp[i] = (int **)malloc(sizeof(int *) * (N / 2 + 2));\n\t\tfor(j = 0; j <= N / 2 + 1; j++){\n\t\t\tdp[i][j] = (int *)malloc(sizeof(int) * (N % 2 + 1));\n\t\t\tfor(k = 0; k <= N % 2; k++){\n\t\t\t\tdp[i][j][k] = inf;\n\t\t\t}\n\t\t}\n\t}\n\tdp[0][0][0] = 0;\n\tfor(i = 0; i <= N / 2; i++){\n\t\tfor(j = 0; j <= N / 2; j++){\n\t\t\tfor(k = 0; k <= N % 2; k++){\n//\t\t\t\tprintf(\"(i, j, k) = (%lld, %lld, %lld)\\n\", i, j, k);\n//\t\t\t\tprintf(\"dp = %lld\\n\", dp[i][j][k]);\n\t\t\t\tl = i + j + k;\n\t\t\t\tif(l >= N){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k] + i * (ps[l].L + ps[l].R) + ps[l].R);\n//\t\t\t\tprintf(\"test\\n\");\n\t\t\t\tdp[i][j + 1][k] = min(dp[i][j + 1][k], dp[i][j][k] + j * (ps[l].L + ps[l].R) + ps[l].L);\n//\t\t\t\tprintf(\"dp2 = %lld\\n\", dp[i][j + 1][k]);\n\t\t\t\tif(k == 0 && N % 2 == 1 && l < N){\n\t\t\t\t\tdp[i][j][1] = min(dp[i][j][1], dp[i][j][0] + (N / 2) * (ps[l].L + ps[l].R));\n//\t\t\t\t\tprintf(\"dp3 = %lld\\n\", dp[i][j][1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n/*\tfor(i = 0; i < N; i++){\n\t\tfor(j = 0; j < N; j++){\n\t\t\tfor(k = 0; k <= N % 2; k++){\n\t\t\t\tprintf(\"dp[%lld][%lld][%lld] = %lld\\n\", i, j, k, dp[i][j][k]);\n\t\t\t}\n\t\t}\n\t}\n*/\tprintf(\"%lld\\n\", dp[N / 2][N / 2][N % 2]);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcompair\n\t.type\tcompair, @function\ncompair:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rcx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tjle\t.L2\n\tmovl\t$-1, %eax\n\tjmp\t.L3\n.L2:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L4\n\tmovl\t$0, %eax\n\tjmp\t.L3\n.L4:\n\tmovl\t$1, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcompair, .-compair\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmin, .-min\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld%lld\"\n.LC2:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$72, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-80(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-80(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovq\t-72(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\taddq\t$8, %rax\n\tmovq\t-72(%rbp), %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$4, %rcx\n\tmovq\t-48(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovq\t%rdx, %rcx\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -72(%rbp)\n.L8:\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -72(%rbp)\n\tjl\t.L9\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t-48(%rbp), %rax\n\tleaq\tcompair(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$16, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$2, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tjmp\t.L10\n.L15:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$2, %rax\n\tsalq\t$3, %rax\n\tmovq\t-72(%rbp), %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tmovq\t-40(%rbp), %rdx\n\tleaq\t(%rcx,%rdx), %rbx\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L11\n.L14:\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\taddq\t$1, %rax\n\tsalq\t$3, %rax\n\tmovq\t-72(%rbp), %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tmovq\t-40(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovq\t(%rdx), %rcx\n\tmovq\t-64(%rbp), %rdx\n\tsalq\t$3, %rdx\n\tleaq\t(%rcx,%rdx), %rbx\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovabsq\t$1000000000000000000, %rbx\n\tmovq\t%rbx, (%rax)\n\taddq\t$1, -56(%rbp)\n.L12:\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjle\t.L13\n\taddq\t$1, -64(%rbp)\n.L11:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjle\t.L14\n\taddq\t$1, -72(%rbp)\n.L10:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -72(%rbp)\n\tjle\t.L15\n\tmovq\t-40(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t$0, (%rax)\n\tmovq\t$0, -72(%rbp)\n\tjmp\t.L16\n.L23:\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L17\n.L22:\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L18\n.L21:\n\tmovq\t-72(%rbp), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -32(%rbp)\n\tjge\t.L26\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rsi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rcx, %rax\n\timulq\t-72(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-72(%rbp), %rax\n\taddq\t$1, %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-72(%rbp), %rcx\n\taddq\t$1, %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-40(%rbp), %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-64(%rbp), %rcx\n\tsalq\t$3, %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-56(%rbp), %rcx\n\tsalq\t$3, %rcx\n\tleaq\t(%rsi,%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmin\n\tmovq\t%rax, (%rbx)\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rsi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rcx, %rax\n\timulq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-64(%rbp), %rax\n\taddq\t$1, %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-72(%rbp), %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-40(%rbp), %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-64(%rbp), %rcx\n\taddq\t$1, %rcx\n\tsalq\t$3, %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-56(%rbp), %rcx\n\tsalq\t$3, %rcx\n\tleaq\t(%rsi,%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmin\n\tmovq\t%rax, (%rbx)\n\tcmpq\t$0, -56(%rbp)\n\tjne\t.L20\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tcmpq\t$1, %rax\n\tjne\t.L20\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -32(%rbp)\n\tjge\t.L20\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tshrq\t$63, %rcx\n\taddq\t%rcx, %rax\n\tsarq\t%rax\n\tmovq\t%rax, %rsi\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdi, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rcx, %rax\n\timulq\t%rsi, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\taddq\t$8, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-72(%rbp), %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-40(%rbp), %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-64(%rbp), %rcx\n\tsalq\t$3, %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rcx\n\tleaq\t8(%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmin\n\tmovq\t%rax, (%rbx)\n\tjmp\t.L20\n.L26:\n\tnop\n.L20:\n\taddq\t$1, -56(%rbp)\n.L18:\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjle\t.L21\n\taddq\t$1, -64(%rbp)\n.L17:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tcmpq\t%rax, -64(%rbp)\n\tjle\t.L22\n\taddq\t$1, -72(%rbp)\n.L16:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tcmpq\t%rax, -72(%rbp)\n\tjle\t.L23\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tshrq\t$63, %rcx\n\taddq\t%rcx, %rax\n\tsarq\t%rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L25\n\tcall\t__stack_chk_fail@PLT\n.L25:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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%al\n\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tcompair, .-compair\n\t.p2align 4\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovle\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tmin, .-min\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.LC2:\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.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC0(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 72(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t64(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t64(%rsp), %r12\n\tmovq\t%r12, %rdi\n\tsalq\t$4, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 16(%rsp)\n\ttestq\t%r12, %r12\n\tjle\t.L7\n\tmovq\t%rax, %rbx\n\txorl\t%ebp, %ebp\n\tleaq\t.LC1(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleaq\t8(%rbx), %rdx\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t64(%rsp), %r12\n\taddq\t$1, %rbp\n\taddq\t$16, %rbx\n\tcmpq\t%rbp, %r12\n\tjg\t.L8\n.L7:\n\tmovq\t16(%rsp), %rdi\n\tleaq\tcompair(%rip), %rcx\n\tmovl\t$16, %edx\n\tmovq\t%r12, %rsi\n\tcall\tqsort@PLT\n\tmovq\t64(%rsp), %r15\n\tmovq\t%r15, %rax\n\tshrq\t$63, %rax\n\taddq\t%r15, %rax\n\tsarq\t%rax\n\tleaq\t16(,%rax,8), %rbp\n\tmovq\t%rax, (%rsp)\n\tmovq\t%rbp, %rdi\n\tmovq\t%rbp, 24(%rsp)\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 32(%rsp)\n\tmovq\t%rax, %r14\n\tcmpq\t$-3, %r15\n\tjl\t.L9\n\tmovq\t%r15, %rax\n\tmovq\t%r15, 56(%rsp)\n\taddq\t%r14, %rbp\n\tshrq\t$63, %rax\n\tmovq\t%rbp, 8(%rsp)\n\tmovabsq\t$1000000000000000000, %rbp\n\tleaq\t(%r15,%rax), %rbx\n\tandl\t$1, %ebx\n\tsubq\t%rax, %rbx\n\tmovq\t%rbx, 48(%rsp)\n\tleaq\t8(,%rbx,8), %r13\n\tmovq\t%rbx, 40(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\t24(%rsp), %r12\n\tmovq\t%r12, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %r15\n\taddq\t%rax, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovq\t%r13, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%r15)\n\tcmpq\t$-1, %rbx\n\tje\t.L13\n\tmovq\t%rbp, (%rax)\n\tcmpq\t$1, %rbx\n\tjne\t.L13\n\tmovq\t%rbp, 8(%rax)\n.L13:\n\taddq\t$8, %r15\n\tcmpq\t%r12, %r15\n\tjne\t.L11\n\taddq\t$8, %r14\n\tcmpq\t8(%rsp), %r14\n\tjne\t.L14\n\tmovq\t56(%rsp), %r15\n.L15:\n\tmovq\t32(%rsp), %r10\n\tmovq\t(%r10), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t$0, (%rax)\n\tcmpq\t$-1, %r15\n\tjl\t.L16\n\tmovq\t48(%rsp), %r13\n\txorl\t%r9d, %r9d\n\tcmpq\t$-1, %r13\n\tje\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tleaq\t1(%r9), %rbx\n\tmovq\t16(%rsp), %rdx\n\txorl\t%ecx, %ecx\n\txorl\t%eax, %eax\n\tmovq\t%rbx, 8(%rsp)\n\tjmp\t.L25\n\t.p2align 4,,10\n\t.p2align 3\n.L42:\n\tmovq\t(%r10), %rbp\n\tmovq\t(%rdx), %rbx\n\tmovq\t8(%rdx), %r14\n\tmovq\t8(%r10), %rsi\n\tmovq\t0(%rbp,%rdi), %r11\n\tmovq\t0(%rbp,%rcx), %rbp\n\tleaq\t(%r14,%rbx), %r8\n\tmovq\t(%rsi,%rdi), %r12\n\tmovq\t%r9, %rsi\n\timulq\t%r8, %rsi\n\taddq\t(%r11), %rsi\n\taddq\t%r14, %rsi\n\tmovq\t(%r12), %r14\n\tcmpq\t%r14, %rsi\n\tcmovg\t%r14, %rsi\n\tmovq\t%rsi, (%r12)\n\tmovq\t%rax, %rsi\n\timulq\t%r8, %rsi\n\taddq\t(%r11), %rsi\n\taddq\t%rbx, %rsi\n\tmovq\t0(%rbp), %rbx\n\tcmpq\t%rbx, %rsi\n\tcmovg\t%rbx, %rsi\n\tmovq\t%rsi, 0(%rbp)\n\ttestq\t%r13, %r13\n\tjne\t.L41\n.L20:\n\taddq\t$1, %rax\n\taddq\t$16, %rdx\n\tcmpq\t%rax, (%rsp)\n\tjl\t.L22\n.L25:\n\tleaq\t(%r9,%rax), %rsi\n\tmovq\t%rcx, %rdi\n\taddq\t$8, %rcx\n\tcmpq\t%rsi, %r15\n\tjg\t.L42\n\tcmpq\t$1, %r13\n\tjne\t.L20\n.L24:\n\tmovq\t8(%rsp), %rbx\n\tleaq\t(%rbx,%rax), %rsi\n\tcmpq\t%rsi, %r15\n\tjle\t.L20\n\tmovq\t16(%rdx), %r8\n\tmovq\t24(%rdx), %r12\n\tmovq\t(%r10), %rbx\n\tmovq\t8(%r10), %rbp\n\tleaq\t(%r8,%r12), %rsi\n\tmovq\t(%rbx,%rdi), %r11\n\tmovq\t0(%rbp,%rdi), %rbp\n\tmovq\t%rsi, %rdi\n\timulq\t%r9, %rdi\n\taddq\t8(%r11), %rdi\n\taddq\t%r12, %rdi\n\tmovq\t8(%rbp), %r12\n\tcmpq\t%r12, %rdi\n\tcmovg\t%r12, %rdi\n\timulq\t%rax, %rsi\n\tmovq\t%rdi, 8(%rbp)\n\tmovq\t(%rbx,%rcx), %rdi\n\taddq\t8(%r11), %rsi\n\taddq\t%r8, %rsi\n\tmovq\t8(%rdi), %r8\n\tcmpq\t%r8, %rsi\n\tcmovg\t%r8, %rsi\n\taddq\t$1, %rax\n\taddq\t$16, %rdx\n\tmovq\t%rsi, 8(%rdi)\n\tcmpq\t%rax, (%rsp)\n\tjge\t.L25\n.L22:\n\taddq\t$16, 16(%rsp)\n\tmovq\t8(%rsp), %r9\n\taddq\t$8, %r10\n\tcmpq\t%r9, (%rsp)\n\tjge\t.L18\n.L16:\n\tmovq\t24(%rsp), %rcx\n\tmovq\t32(%rsp), %rax\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tmovq\t-16(%rax,%rcx), %rax\n\tmovq\t-16(%rax,%rcx), %rax\n\tmovq\t40(%rsp), %rcx\n\tmovq\t(%rax,%rcx,8), %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t72(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L43\n\taddq\t$88, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\t.cfi_restore_state\n\tmovq\t8(%r11), %rsi\n\timulq\t(%rsp), %r8\n\taddq\t(%r11), %r8\n\tcmpq\t%rsi, %r8\n\tcmovg\t%rsi, %r8\n\tmovq\t%r8, 8(%r11)\n\tjmp\t.L24\n.L9:\n\tmovq\t%r15, %rax\n\tmovl\t$2, %ecx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, 48(%rsp)\n\tmovq\t%rdx, 40(%rsp)\n\tjmp\t.L15\n.L43:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE41:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tcmovg\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tcompair, .-compair\n\t.p2align 4\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tmovq\t%rsi, %rax\n\tcmovle\t%rdi, %rax\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tmin, .-min\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.LC2:\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.LFB41:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC0(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 72(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t64(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t64(%rsp), %r12\n\tmovq\t%r12, %rdi\n\tsalq\t$4, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 16(%rsp)\n\ttestq\t%r12, %r12\n\tjle\t.L7\n\tmovq\t%rax, %rbx\n\txorl\t%ebp, %ebp\n\tleaq\t.LC1(%rip), %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tleaq\t8(%rbx), %rdx\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t64(%rsp), %r12\n\taddq\t$1, %rbp\n\taddq\t$16, %rbx\n\tcmpq\t%rbp, %r12\n\tjg\t.L8\n.L7:\n\tmovq\t16(%rsp), %rdi\n\tleaq\tcompair(%rip), %rcx\n\tmovl\t$16, %edx\n\tmovq\t%r12, %rsi\n\tcall\tqsort@PLT\n\tmovq\t64(%rsp), %r15\n\tmovq\t%r15, %rax\n\tshrq\t$63, %rax\n\taddq\t%r15, %rax\n\tsarq\t%rax\n\tleaq\t16(,%rax,8), %rbp\n\tmovq\t%rax, (%rsp)\n\tmovq\t%rbp, %rdi\n\tmovq\t%rbp, 24(%rsp)\n\tcall\tmalloc@PLT\n\tmovq\t%rax, 32(%rsp)\n\tmovq\t%rax, %r14\n\tcmpq\t$-3, %r15\n\tjl\t.L9\n\tmovq\t%r15, %rax\n\tmovq\t%r15, 56(%rsp)\n\taddq\t%r14, %rbp\n\tshrq\t$63, %rax\n\tmovq\t%rbp, 8(%rsp)\n\tmovabsq\t$1000000000000000000, %rbp\n\tleaq\t(%r15,%rax), %rbx\n\tandl\t$1, %ebx\n\tsubq\t%rax, %rbx\n\tmovq\t%rbx, 48(%rsp)\n\tleaq\t8(,%rbx,8), %r13\n\tmovq\t%rbx, 40(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovq\t24(%rsp), %r12\n\tmovq\t%r12, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %r15\n\taddq\t%rax, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\tmovq\t%r13, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%r15)\n\tcmpq\t$-1, %rbx\n\tje\t.L13\n\tmovq\t%rbp, (%rax)\n\tcmpq\t$1, %rbx\n\tjne\t.L13\n\tmovq\t%rbp, 8(%rax)\n.L13:\n\taddq\t$8, %r15\n\tcmpq\t%r12, %r15\n\tjne\t.L11\n\taddq\t$8, %r14\n\tcmpq\t8(%rsp), %r14\n\tjne\t.L14\n\tmovq\t56(%rsp), %r15\n.L15:\n\tmovq\t32(%rsp), %r10\n\tmovq\t(%r10), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t$0, (%rax)\n\tcmpq\t$-1, %r15\n\tjl\t.L16\n\tmovq\t48(%rsp), %r13\n\txorl\t%r9d, %r9d\n\tcmpq\t$-1, %r13\n\tje\t.L16\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tleaq\t1(%r9), %rbx\n\tmovq\t16(%rsp), %rdx\n\txorl\t%ecx, %ecx\n\txorl\t%eax, %eax\n\tmovq\t%rbx, 8(%rsp)\n\tjmp\t.L25\n\t.p2align 4,,10\n\t.p2align 3\n.L42:\n\tmovq\t(%r10), %rbp\n\tmovq\t(%rdx), %rbx\n\tmovq\t8(%rdx), %r14\n\tmovq\t8(%r10), %rsi\n\tmovq\t0(%rbp,%rdi), %r11\n\tmovq\t0(%rbp,%rcx), %rbp\n\tleaq\t(%r14,%rbx), %r8\n\tmovq\t(%rsi,%rdi), %r12\n\tmovq\t%r9, %rsi\n\timulq\t%r8, %rsi\n\taddq\t(%r11), %rsi\n\taddq\t%r14, %rsi\n\tmovq\t(%r12), %r14\n\tcmpq\t%r14, %rsi\n\tcmovg\t%r14, %rsi\n\tmovq\t%rsi, (%r12)\n\tmovq\t%rax, %rsi\n\timulq\t%r8, %rsi\n\taddq\t(%r11), %rsi\n\taddq\t%rbx, %rsi\n\tmovq\t0(%rbp), %rbx\n\tcmpq\t%rbx, %rsi\n\tcmovg\t%rbx, %rsi\n\tmovq\t%rsi, 0(%rbp)\n\ttestq\t%r13, %r13\n\tjne\t.L41\n.L20:\n\taddq\t$1, %rax\n\taddq\t$16, %rdx\n\tcmpq\t%rax, (%rsp)\n\tjl\t.L22\n.L25:\n\tleaq\t(%r9,%rax), %rsi\n\tmovq\t%rcx, %rdi\n\taddq\t$8, %rcx\n\tcmpq\t%rsi, %r15\n\tjg\t.L42\n\tcmpq\t$1, %r13\n\tjne\t.L20\n.L24:\n\tmovq\t8(%rsp), %rbx\n\tleaq\t(%rbx,%rax), %rsi\n\tcmpq\t%rsi, %r15\n\tjle\t.L20\n\tmovq\t16(%rdx), %r8\n\tmovq\t24(%rdx), %r12\n\tmovq\t(%r10), %rbx\n\tmovq\t8(%r10), %rbp\n\tleaq\t(%r8,%r12), %rsi\n\tmovq\t(%rbx,%rdi), %r11\n\tmovq\t0(%rbp,%rdi), %rbp\n\tmovq\t%rsi, %rdi\n\timulq\t%r9, %rdi\n\taddq\t8(%r11), %rdi\n\taddq\t%r12, %rdi\n\tmovq\t8(%rbp), %r12\n\tcmpq\t%r12, %rdi\n\tcmovg\t%r12, %rdi\n\timulq\t%rax, %rsi\n\tmovq\t%rdi, 8(%rbp)\n\tmovq\t(%rbx,%rcx), %rdi\n\taddq\t8(%r11), %rsi\n\taddq\t%r8, %rsi\n\tmovq\t8(%rdi), %r8\n\tcmpq\t%r8, %rsi\n\tcmovg\t%r8, %rsi\n\taddq\t$1, %rax\n\taddq\t$16, %rdx\n\tmovq\t%rsi, 8(%rdi)\n\tcmpq\t%rax, (%rsp)\n\tjge\t.L25\n.L22:\n\taddq\t$16, 16(%rsp)\n\tmovq\t8(%rsp), %r9\n\taddq\t$8, %r10\n\tcmpq\t%r9, (%rsp)\n\tjge\t.L18\n.L16:\n\tmovq\t24(%rsp), %rcx\n\tmovq\t32(%rsp), %rax\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tmovq\t-16(%rax,%rcx), %rax\n\tmovq\t-16(%rax,%rcx), %rax\n\tmovq\t40(%rsp), %rcx\n\tmovq\t(%rax,%rcx,8), %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t72(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L43\n\taddq\t$88, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\t.cfi_restore_state\n\tmovq\t8(%r11), %rsi\n\timulq\t(%rsp), %r8\n\taddq\t(%r11), %r8\n\tcmpq\t%rsi, %r8\n\tcmovg\t%rsi, %r8\n\tmovq\t%r8, 8(%r11)\n\tjmp\t.L24\n.L9:\n\tmovq\t%r15, %rax\n\tmovl\t$2, %ecx\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, 48(%rsp)\n\tmovq\t%rdx, 40(%rsp)\n\tjmp\t.L15\n.L43:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE41:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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, const void *b){\n\tint sub = (((pair *)a)->L + ((pair *)a)->R) - (((pair *)b)->L + ((pair *)b)->R);\n\tif(sub > 0){\n\t\treturn -1;\n\t}\n\telse if(sub == 0){\n\t\treturn 0;\n\t}\n\telse{\n\t\treturn 1;\n\t}\n}\n\nint min(int a, int b){\n\treturn a <= b ? a : b;\n}\n\nsigned main(){\n\tint N, i, j, k, l;\n\tscanf(\"%lld\", &N);\n\tpair *ps = (pair *)malloc(sizeof(pair) * N);\n\tfor(i = 0; i < N; i++){\n\t\tscanf(\"%lld%lld\", &ps[i].L, &ps[i].R);\n\t}\n\tqsort(ps, N, sizeof(pair), compair);\n\tint ***dp = (int ***)malloc(sizeof(int **) * (N / 2 + 2));\n\tfor(i = 0; i <= N / 2 + 1; i++){\n\t\tdp[i] = (int **)malloc(sizeof(int *) * (N / 2 + 2));\n\t\tfor(j = 0; j <= N / 2 + 1; j++){\n\t\t\tdp[i][j] = (int *)malloc(sizeof(int) * (N % 2 + 1));\n\t\t\tfor(k = 0; k <= N % 2; k++){\n\t\t\t\tdp[i][j][k] = inf;\n\t\t\t}\n\t\t}\n\t}\n\tdp[0][0][0] = 0;\n\tfor(i = 0; i <= N / 2; i++){\n\t\tfor(j = 0; j <= N / 2; j++){\n\t\t\tfor(k = 0; k <= N % 2; k++){\n//\t\t\t\tprintf(\"(i, j, k) = (%lld, %lld, %lld)\\n\", i, j, k);\n//\t\t\t\tprintf(\"dp = %lld\\n\", dp[i][j][k]);\n\t\t\t\tl = i + j + k;\n\t\t\t\tif(l >= N){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k] + i * (ps[l].L + ps[l].R) + ps[l].R);\n//\t\t\t\tprintf(\"test\\n\");\n\t\t\t\tdp[i][j + 1][k] = min(dp[i][j + 1][k], dp[i][j][k] + j * (ps[l].L + ps[l].R) + ps[l].L);\n//\t\t\t\tprintf(\"dp2 = %lld\\n\", dp[i][j + 1][k]);\n\t\t\t\tif(k == 0 && N % 2 == 1 && l < N){\n\t\t\t\t\tdp[i][j][1] = min(dp[i][j][1], dp[i][j][0] + (N / 2) * (ps[l].L + ps[l].R));\n//\t\t\t\t\tprintf(\"dp3 = %lld\\n\", dp[i][j][1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n/*\tfor(i = 0; i < N; i++){\n\t\tfor(j = 0; j < N; j++){\n\t\t\tfor(k = 0; k <= N % 2; k++){\n\t\t\t\tprintf(\"dp[%lld][%lld][%lld] = %lld\\n\", i, j, k, dp[i][j][k]);\n\t\t\t}\n\t\t}\n\t}\n*/\tprintf(\"%lld\\n\", dp[N / 2][N / 2][N % 2]);\n\treturn 0;\n}", "index": 90, "inputs": [ "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 37\n57 39\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 80\n57 18\n34 28\n76 55\n21 80\n", "4\n1 7\n2 5\n4 1\n7 5\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 37\n57 39\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n57 18\n34 28\n76 55\n21 80\n", "4\n1 7\n3 5\n4 1\n7 5\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 37\n57 39\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n57 18\n34 28\n76 55\n21 73\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 37\n57 39\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n56 18\n34 28\n76 55\n21 73\n", "4\n1 7\n3 5\n5 1\n2 5\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 37\n57 39\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n56 18\n34 28\n76 11\n21 73\n", "4\n1 7\n3 5\n8 1\n2 5\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n57 39\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n56 18\n34 28\n76 11\n21 73\n", "4\n1 7\n4 5\n8 1\n2 5\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n57 47\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n56 18\n34 28\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 47\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n56 18\n34 28\n76 11\n21 73\n", "4\n1 9\n4 5\n8 1\n2 6\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 47\n18 11\n79 6\n55 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 50\n56 4\n34 28\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 47\n18 11\n79 6\n55 68\n68 16\n26 63\n93 49\n91 10\n55 68\n31 50\n56 4\n34 28\n76 11\n21 73\n", "4\n0 9\n4 8\n8 1\n2 6\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 10\n18 11\n79 6\n55 68\n68 16\n26 63\n93 49\n91 10\n55 68\n31 50\n56 4\n34 28\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 10\n18 11\n79 6\n55 68\n68 15\n26 63\n93 49\n91 10\n55 68\n31 50\n56 4\n34 28\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 10\n18 11\n79 6\n55 68\n68 15\n26 63\n93 49\n91 10\n55 0\n31 50\n56 4\n34 28\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 53\n59 10\n18 11\n79 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 28\n76 11\n21 73\n", "4\n-1 9\n4 1\n8 0\n2 6\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n28 53\n59 10\n18 11\n79 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 28\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n28 53\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 28\n76 11\n21 73\n", "4\n-1 9\n3 1\n12 0\n2 6\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n28 53\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 73\n", "4\n-1 9\n3 1\n12 -1\n2 6\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n16 53\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 73\n", "4\n-1 9\n7 1\n12 0\n2 6\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n16 60\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 73\n", "4\n-1 3\n7 1\n12 0\n2 6\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 60\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 49\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 60\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 73\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n55 68\n68 15\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n55 68\n68 25\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n55 68\n124 25\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n55 68\n124 17\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n75 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "4\n-1 3\n7 1\n7 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 63\n93 24\n91 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n5 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 63\n93 24\n74 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n5 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 63\n93 24\n92 19\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "4\n0 4\n7 1\n6 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 63\n93 24\n92 30\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n5 25\n82 84\n17 85\n32 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "4\n0 0\n6 1\n6 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n58 2\n10 55\n59 10\n18 11\n50 6\n79 68\n124 17\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "4\n0 -1\n6 1\n6 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n58 2\n10 55\n59 10\n18 11\n50 6\n79 136\n124 17\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 48\n76 11\n21 139\n", "20\n97 2\n5 25\n82 84\n17 85\n58 2\n10 55\n59 10\n18 11\n50 6\n79 136\n124 17\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 11\n21 139\n", "4\n0 -2\n6 2\n6 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n58 2\n10 55\n59 10\n18 11\n50 6\n79 136\n124 17\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 11\n35 139\n", "4\n-1 -2\n6 2\n6 1\n1 0\n", "4\n-1 -2\n6 2\n2 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n58 2\n10 55\n59 10\n18 11\n50 6\n101 136\n124 3\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 11\n35 139\n", "4\n0 -2\n6 2\n2 1\n1 0\n", "20\n97 2\n5 25\n82 84\n17 85\n58 2\n10 55\n59 10\n18 11\n50 6\n101 136\n124 3\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 1\n35 139\n", "20\n86 2\n5 25\n82 84\n17 85\n58 0\n10 55\n59 10\n18 11\n50 6\n101 136\n124 3\n26 123\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 1\n35 139\n", "4\n2 -2\n6 2\n2 1\n1 -1\n", "20\n86 2\n5 25\n82 84\n17 85\n58 0\n10 55\n59 10\n18 11\n50 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 1\n35 139\n", "20\n86 4\n5 25\n82 84\n17 85\n58 0\n10 55\n59 10\n18 11\n50 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n31 50\n56 4\n34 62\n76 1\n35 139\n", "20\n86 4\n5 25\n82 84\n17 85\n58 0\n10 55\n59 10\n18 11\n50 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n34 62\n76 1\n35 139\n", "20\n86 4\n5 25\n82 84\n17 85\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n34 62\n76 1\n35 139\n", "20\n86 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n34 62\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n34 62\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n34 13\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n124 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n50 13\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n3 50\n56 4\n50 13\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n50 13\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 55\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n50 7\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 71\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n50 7\n76 1\n35 139\n", "4\n2 0\n6 3\n1 4\n0 0\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n10 83\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n50 7\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n16 83\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n50 7\n76 1\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n16 83\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n50 7\n76 2\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n16 83\n59 10\n18 11\n42 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n100 4\n5 25\n82 84\n17 112\n58 0\n16 83\n59 10\n18 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n100 4\n5 25\n82 143\n17 112\n58 0\n16 83\n59 10\n18 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n100 4\n5 25\n82 143\n17 112\n58 0\n16 83\n59 6\n18 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n100 4\n5 25\n82 143\n17 112\n58 0\n16 83\n59 4\n18 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n100 4\n5 25\n82 143\n17 112\n58 0\n16 83\n59 4\n22 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n82 143\n17 112\n58 0\n16 83\n59 4\n22 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "4\n2 -1\n1 -1\n2 6\n0 0\n", "20\n000 4\n5 25\n93 143\n17 112\n58 0\n16 83\n59 4\n22 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 101\n58 0\n16 83\n59 4\n22 11\n37 6\n101 136\n114 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 101\n58 0\n16 83\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 4\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 101\n58 0\n16 83\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 101\n58 0\n16 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 111\n58 0\n16 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 111\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 110\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 30\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 110\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n76 2\n35 139\n", "20\n000 4\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n132 2\n35 139\n", "20\n000 6\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 61\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n132 2\n35 139\n", "20\n000 6\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 90\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n132 2\n35 139\n", "20\n010 6\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 90\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n132 2\n35 139\n", "20\n010 6\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 29\n93 24\n92 34\n55 0\n1 50\n56 0\n75 7\n132 2\n35 139\n", "20\n010 6\n5 25\n93 143\n17 010\n58 0\n18 19\n59 4\n22 11\n37 6\n101 136\n118 3\n26 29\n93 24\n175 34\n55 0\n1 50\n56 0\n75 7\n132 2\n35 139\n", "20\n97 2\n75 25\n82 84\n17 56\n32 2\n28 37\n57 39\n18 11\n79 6\n40 68\n68 16\n40 63\n93 49\n91 10\n55 68\n31 80\n57 18\n34 28\n76 55\n21 80\n", "4\n2 7\n2 5\n4 1\n7 5\n", "4\n2 7\n2 5\n4 1\n7 5\n" ], "outputs": [ "7385\n", "21\n", "7240\n", "23\n", "7210\n", "7203\n", "22\n", "7076\n", "24\n", "7185\n", "25\n", "7213\n", "7215\n", "26\n", "7089\n", "7028\n", "28\n", "6812\n", "6805\n", "6511\n", "6529\n", "15\n", "6644\n", "6448\n", "14\n", "6586\n", "13\n", "6490\n", "18\n", "6539\n", "12\n", "6491\n", "6466\n", "6431\n", "6528\n", "6581\n", "6642\n", "6634\n", "6706\n", "10\n", "6211\n", "6157\n", "6213\n", "11\n", "6241\n", "6387\n", "8\n", "6616\n", "7\n", "6631\n", "6687\n", "5\n", "6715\n", "4\n", "1\n", "6709\n", "2\n", "6649\n", "6587\n", "3\n", "6439\n", "6449\n", "6261\n", "6190\n", "6244\n", "6300\n", "6060\n", "6178\n", "6165\n", "6149\n", "6113\n", "6186\n", "6\n", "6228\n", "6252\n", "6258\n", "6413\n", "6368\n", "6401\n", "6381\n", "6369\n", "6406\n", "5698\n", "0\n", "5709\n", "5687\n", "5695\n", "5665\n", "5359\n", "5379\n", "5395\n", "5393\n", "5401\n", "4973\n", "5115\n", "5133\n", "5220\n", "5320\n", "5123\n", "5188\n", "7337\n", "22\n", "22\n" ], "question": "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, const void *b){\n\tint sub = (((pair *)a)->L + ((pair *)a)->R) - (((pair *)b)->L + ((pair *)b)->R);\n\tif(sub > 0){\n\t\treturn -1;\n\t}\n\telse if(sub == 0){\n\t\treturn 0;\n\t}\n\telse{\n\t\treturn 1;\n\t}\n}\n\nint min(int a, int b){\n\treturn a <= b ? a : b;\n}\n\nsigned main(){\n\tint N, i, j, k, l;\n\tscanf(\"%lld\", &N);\n\tpair *ps = (pair *)malloc(sizeof(pair) * N);\n\tfor(i = 0; i < N; i++){\n\t\tscanf(\"%lld%lld\", &ps[i].L, &ps[i].R);\n\t}\n\tqsort(ps, N, sizeof(pair), compair);\n\tint ***dp = (int ***)malloc(sizeof(int **) * (N / 2 + 2));\n\tfor(i = 0; i <= N / 2 + 1; i++){\n\t\tdp[i] = (int **)malloc(sizeof(int *) * (N / 2 + 2));\n\t\tfor(j = 0; j <= N / 2 + 1; j++){\n\t\t\tdp[i][j] = (int *)malloc(sizeof(int) * (N % 2 + 1));\n\t\t\tfor(k = 0; k <= N % 2; k++){\n\t\t\t\tdp[i][j][k] = inf;\n\t\t\t}\n\t\t}\n\t}\n\tdp[0][0][0] = 0;\n\tfor(i = 0; i <= N / 2; i++){\n\t\tfor(j = 0; j <= N / 2; j++){\n\t\t\tfor(k = 0; k <= N % 2; k++){\n//\t\t\t\tprintf(\"(i, j, k) = (%lld, %lld, %lld)\\n\", i, j, k);\n//\t\t\t\tprintf(\"dp = %lld\\n\", dp[i][j][k]);\n\t\t\t\tl = i + j + k;\n\t\t\t\tif(l >= N){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k] + i * (ps[l].L + ps[l].R) + ps[l].R);\n//\t\t\t\tprintf(\"test\\n\");\n\t\t\t\tdp[i][j + 1][k] = min(dp[i][j + 1][k], dp[i][j][k] + j * (ps[l].L + ps[l].R) + ps[l].L);\n//\t\t\t\tprintf(\"dp2 = %lld\\n\", dp[i][j + 1][k]);\n\t\t\t\tif(k == 0 && N % 2 == 1 && l < N){\n\t\t\t\t\tdp[i][j][1] = min(dp[i][j][1], dp[i][j][0] + (N / 2) * (ps[l].L + ps[l].R));\n//\t\t\t\t\tprintf(\"dp3 = %lld\\n\", dp[i][j][1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n/*\tfor(i = 0; i < N; i++){\n\t\tfor(j = 0; j < N; j++){\n\t\t\tfor(k = 0; k <= N % 2; k++){\n\t\t\t\tprintf(\"dp[%lld][%lld][%lld] = %lld\\n\", i, j, k, dp[i][j][k]);\n\t\t\t}\n\t\t}\n\t}\n*/\tprintf(\"%lld\\n\", dp[N / 2][N / 2][N % 2]);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tcompair\n\t.type\tcompair, @function\ncompair:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rcx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tcmpq\t$0, -8(%rbp)\n\tjle\t.L2\n\tmovl\t$-1, %eax\n\tjmp\t.L3\n.L2:\n\tcmpq\t$0, -8(%rbp)\n\tjne\t.L4\n\tmovl\t$0, %eax\n\tjmp\t.L3\n.L4:\n\tmovl\t$1, %eax\n.L3:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tcompair, .-compair\n\t.globl\tmin\n\t.type\tmin, @function\nmin:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tmin, .-min\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld\"\n.LC1:\n\t.string\t\"%lld%lld\"\n.LC2:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$72, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -24(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-80(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-80(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovq\t-72(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdx, %rax\n\taddq\t$8, %rax\n\tmovq\t-72(%rbp), %rdx\n\tmovq\t%rdx, %rcx\n\tsalq\t$4, %rcx\n\tmovq\t-48(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovq\t%rdx, %rcx\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -72(%rbp)\n.L8:\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -72(%rbp)\n\tjl\t.L9\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t-48(%rbp), %rax\n\tleaq\tcompair(%rip), %rdx\n\tmovq\t%rdx, %rcx\n\tmovl\t$16, %edx\n\tmovq\t%rax, %rdi\n\tcall\tqsort@PLT\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$2, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t$0, -72(%rbp)\n\tjmp\t.L10\n.L15:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$2, %rax\n\tsalq\t$3, %rax\n\tmovq\t-72(%rbp), %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tmovq\t-40(%rbp), %rdx\n\tleaq\t(%rcx,%rdx), %rbx\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L11\n.L14:\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\taddq\t$1, %rax\n\tsalq\t$3, %rax\n\tmovq\t-72(%rbp), %rdx\n\tleaq\t0(,%rdx,8), %rcx\n\tmovq\t-40(%rbp), %rdx\n\taddq\t%rcx, %rdx\n\tmovq\t(%rdx), %rcx\n\tmovq\t-64(%rbp), %rdx\n\tsalq\t$3, %rdx\n\tleaq\t(%rcx,%rdx), %rbx\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovabsq\t$1000000000000000000, %rbx\n\tmovq\t%rbx, (%rax)\n\taddq\t$1, -56(%rbp)\n.L12:\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjle\t.L13\n\taddq\t$1, -64(%rbp)\n.L11:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -64(%rbp)\n\tjle\t.L14\n\taddq\t$1, -72(%rbp)\n.L10:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -72(%rbp)\n\tjle\t.L15\n\tmovq\t-40(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t$0, (%rax)\n\tmovq\t$0, -72(%rbp)\n\tjmp\t.L16\n.L23:\n\tmovq\t$0, -64(%rbp)\n\tjmp\t.L17\n.L22:\n\tmovq\t$0, -56(%rbp)\n\tjmp\t.L18\n.L21:\n\tmovq\t-72(%rbp), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -32(%rbp)\n\tjge\t.L26\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rsi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rcx, %rax\n\timulq\t-72(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-72(%rbp), %rax\n\taddq\t$1, %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-72(%rbp), %rcx\n\taddq\t$1, %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-40(%rbp), %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-64(%rbp), %rcx\n\tsalq\t$3, %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-56(%rbp), %rcx\n\tsalq\t$3, %rcx\n\tleaq\t(%rsi,%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmin\n\tmovq\t%rax, (%rbx)\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rsi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rsi, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rcx, %rax\n\timulq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-64(%rbp), %rax\n\taddq\t$1, %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-56(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-72(%rbp), %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-40(%rbp), %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-64(%rbp), %rcx\n\taddq\t$1, %rcx\n\tsalq\t$3, %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-56(%rbp), %rcx\n\tsalq\t$3, %rcx\n\tleaq\t(%rsi,%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmin\n\tmovq\t%rax, (%rbx)\n\tcmpq\t$0, -56(%rbp)\n\tjne\t.L20\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tcmpq\t$1, %rax\n\tjne\t.L20\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -32(%rbp)\n\tjge\t.L20\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tshrq\t$63, %rcx\n\taddq\t%rcx, %rax\n\tsarq\t%rax\n\tmovq\t%rax, %rsi\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tsalq\t$4, %rax\n\tmovq\t%rax, %rdi\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rdi, %rax\n\tmovq\t8(%rax), %rax\n\taddq\t%rcx, %rax\n\timulq\t%rsi, %rax\n\taddq\t%rax, %rdx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-64(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\taddq\t$8, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t-72(%rbp), %rcx\n\tleaq\t0(,%rcx,8), %rsi\n\tmovq\t-40(%rbp), %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rsi\n\tmovq\t-64(%rbp), %rcx\n\tsalq\t$3, %rcx\n\taddq\t%rsi, %rcx\n\tmovq\t(%rcx), %rcx\n\tleaq\t8(%rcx), %rbx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmin\n\tmovq\t%rax, (%rbx)\n\tjmp\t.L20\n.L26:\n\tnop\n.L20:\n\taddq\t$1, -56(%rbp)\n.L18:\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tcmpq\t%rax, -56(%rbp)\n\tjle\t.L21\n\taddq\t$1, -64(%rbp)\n.L17:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tcmpq\t%rax, -64(%rbp)\n\tjle\t.L22\n\taddq\t$1, -72(%rbp)\n.L16:\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tcmpq\t%rax, -72(%rbp)\n\tjle\t.L23\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tsarq\t%rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tshrq\t$63, %rcx\n\taddq\t%rcx, %rax\n\tsarq\t%rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-80(%rbp), %rax\n\tcqto\n\tshrq\t$63, %rdx\n\taddq\t%rdx, %rax\n\tandl\t$1, %eax\n\tsubq\t%rdx, %rax\n\tsalq\t$3, %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-24(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L25\n\tcall\t__stack_chk_fail@PLT\n.L25:\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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)->L + ((pair *)a)->R) - (((pair *)b)->L + ((pair *)b)->R); if(sub > 0){ return -1; } else if(sub == 0){ return 0; } else{ return 1; } } int min(int a, int b){ return a <= b ? a : b; } signed main(){ int N, i, j, k, l; scanf("%lld", &N); pair *ps = (pair *)malloc(sizeof(pair) * N); for(i = 0; i < N; i++){ scanf("%lld%lld", &ps[i].L, &ps[i].R); } qsort(ps, N, sizeof(pair), compair); int ***dp = (int ***)malloc(sizeof(int **) * (N / 2 + 2)); for(i = 0; i <= N / 2 + 1; i++){ dp[i] = (int **)malloc(sizeof(int *) * (N / 2 + 2)); for(j = 0; j <= N / 2 + 1; j++){ dp[i][j] = (int *)malloc(sizeof(int) * (N % 2 + 1)); for(k = 0; k <= N % 2; k++){ dp[i][j][k] = inf; } } } dp[0][0][0] = 0; for(i = 0; i <= N / 2; i++){ for(j = 0; j <= N / 2; j++){ for(k = 0; k <= N % 2; k++){ // printf("(i, j, k) = (%lld, %lld, %lld)\n", i, j, k); // printf("dp = %lld\n", dp[i][j][k]); l = i + j + k; if(l >= N){ continue; } dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k] + i * (ps[l].L + ps[l].R) + ps[l].R); // printf("test\n"); dp[i][j + 1][k] = min(dp[i][j + 1][k], dp[i][j][k] + j * (ps[l].L + ps[l].R) + ps[l].L); // printf("dp2 = %lld\n", dp[i][j + 1][k]); if(k == 0 && N % 2 == 1 && l < N){ dp[i][j][1] = min(dp[i][j][1], dp[i][j][0] + (N / 2) * (ps[l].L + ps[l].R)); // printf("dp3 = %lld\n", dp[i][j][1]); } } } } /* for(i = 0; i < N; i++){ for(j = 0; j < N; j++){ for(k = 0; k <= N % 2; k++){ printf("dp[%lld][%lld][%lld] = %lld\n", i, j, k, dp[i][j][k]); } } } */ printf("%lld\n", dp[N / 2][N / 2][N % 2]); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl compair .type compair, @function compair: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rdx movq -24(%rbp), %rax movq 8(%rax), %rax addq %rax, %rdx movq -32(%rbp), %rax movq (%rax), %rcx movq -32(%rbp), %rax movq 8(%rax), %rax addq %rax, %rcx movq %rdx, %rax subq %rcx, %rax movq %rax, -8(%rbp) cmpq $0, -8(%rbp) jle .L2 movl $-1, %eax jmp .L3 .L2: cmpq $0, -8(%rbp) jne .L4 movl $0, %eax jmp .L3 .L4: movl $1, %eax .L3: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size compair, .-compair .globl min .type min, @function min: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx cmovle %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size min, .-min .section .rodata .LC0: .string "%lld" .LC1: .string "%lld%lld" .LC2: .string "%lld\n" .text .globl main .type main, @function main: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $72, %rsp .cfi_offset 3, -24 movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax leaq -80(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -80(%rbp), %rax salq $4, %rax movq %rax, %rdi call malloc@PLT movq %rax, -48(%rbp) movq $0, -72(%rbp) jmp .L8 .L9: movq -72(%rbp), %rax salq $4, %rax movq %rax, %rdx movq -48(%rbp), %rax addq %rdx, %rax addq $8, %rax movq -72(%rbp), %rdx movq %rdx, %rcx salq $4, %rcx movq -48(%rbp), %rdx addq %rcx, %rdx movq %rdx, %rcx movq %rax, %rdx movq %rcx, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addq $1, -72(%rbp) .L8: movq -80(%rbp), %rax cmpq %rax, -72(%rbp) jl .L9 movq -80(%rbp), %rax movq %rax, %rsi movq -48(%rbp), %rax leaq compair(%rip), %rdx movq %rdx, %rcx movl $16, %edx movq %rax, %rdi call qsort@PLT movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax addq $2, %rax salq $3, %rax movq %rax, %rdi call malloc@PLT movq %rax, -40(%rbp) movq $0, -72(%rbp) jmp .L10 .L15: movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax addq $2, %rax salq $3, %rax movq -72(%rbp), %rdx leaq 0(,%rdx,8), %rcx movq -40(%rbp), %rdx leaq (%rcx,%rdx), %rbx movq %rax, %rdi call malloc@PLT movq %rax, (%rbx) movq $0, -64(%rbp) jmp .L11 .L14: movq -80(%rbp), %rax cqto shrq $63, %rdx addq %rdx, %rax andl $1, %eax subq %rdx, %rax addq $1, %rax salq $3, %rax movq -72(%rbp), %rdx leaq 0(,%rdx,8), %rcx movq -40(%rbp), %rdx addq %rcx, %rdx movq (%rdx), %rcx movq -64(%rbp), %rdx salq $3, %rdx leaq (%rcx,%rdx), %rbx movq %rax, %rdi call malloc@PLT movq %rax, (%rbx) movq $0, -56(%rbp) jmp .L12 .L13: movq -72(%rbp), %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -64(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -56(%rbp), %rax salq $3, %rax addq %rdx, %rax movabsq $1000000000000000000, %rbx movq %rbx, (%rax) addq $1, -56(%rbp) .L12: movq -80(%rbp), %rax cqto shrq $63, %rdx addq %rdx, %rax andl $1, %eax subq %rdx, %rax cmpq %rax, -56(%rbp) jle .L13 addq $1, -64(%rbp) .L11: movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax addq $1, %rax cmpq %rax, -64(%rbp) jle .L14 addq $1, -72(%rbp) .L10: movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax addq $1, %rax cmpq %rax, -72(%rbp) jle .L15 movq -40(%rbp), %rax movq (%rax), %rax movq (%rax), %rax movq $0, (%rax) movq $0, -72(%rbp) jmp .L16 .L23: movq $0, -64(%rbp) jmp .L17 .L22: movq $0, -56(%rbp) jmp .L18 .L21: movq -72(%rbp), %rdx movq -64(%rbp), %rax addq %rax, %rdx movq -56(%rbp), %rax addq %rdx, %rax movq %rax, -32(%rbp) movq -80(%rbp), %rax cmpq %rax, -32(%rbp) jge .L26 movq -72(%rbp), %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -64(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -56(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rcx movq -48(%rbp), %rax addq %rcx, %rax movq (%rax), %rcx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rsi movq -48(%rbp), %rax addq %rsi, %rax movq 8(%rax), %rax addq %rcx, %rax imulq -72(%rbp), %rax addq %rax, %rdx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rcx movq -48(%rbp), %rax addq %rcx, %rax movq 8(%rax), %rax addq %rax, %rdx movq -72(%rbp), %rax addq $1, %rax leaq 0(,%rax,8), %rcx movq -40(%rbp), %rax addq %rcx, %rax movq (%rax), %rcx movq -64(%rbp), %rax salq $3, %rax addq %rcx, %rax movq (%rax), %rcx movq -56(%rbp), %rax salq $3, %rax addq %rcx, %rax movq (%rax), %rax movq -72(%rbp), %rcx addq $1, %rcx leaq 0(,%rcx,8), %rsi movq -40(%rbp), %rcx addq %rsi, %rcx movq (%rcx), %rsi movq -64(%rbp), %rcx salq $3, %rcx addq %rsi, %rcx movq (%rcx), %rsi movq -56(%rbp), %rcx salq $3, %rcx leaq (%rsi,%rcx), %rbx movq %rdx, %rsi movq %rax, %rdi call min movq %rax, (%rbx) movq -72(%rbp), %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -64(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -56(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rdx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rcx movq -48(%rbp), %rax addq %rcx, %rax movq (%rax), %rcx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rsi movq -48(%rbp), %rax addq %rsi, %rax movq 8(%rax), %rax addq %rcx, %rax imulq -64(%rbp), %rax addq %rax, %rdx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rcx movq -48(%rbp), %rax addq %rcx, %rax movq (%rax), %rax addq %rax, %rdx movq -72(%rbp), %rax leaq 0(,%rax,8), %rcx movq -40(%rbp), %rax addq %rcx, %rax movq (%rax), %rcx movq -64(%rbp), %rax addq $1, %rax salq $3, %rax addq %rcx, %rax movq (%rax), %rcx movq -56(%rbp), %rax salq $3, %rax addq %rcx, %rax movq (%rax), %rax movq -72(%rbp), %rcx leaq 0(,%rcx,8), %rsi movq -40(%rbp), %rcx addq %rsi, %rcx movq (%rcx), %rsi movq -64(%rbp), %rcx addq $1, %rcx salq $3, %rcx addq %rsi, %rcx movq (%rcx), %rsi movq -56(%rbp), %rcx salq $3, %rcx leaq (%rsi,%rcx), %rbx movq %rdx, %rsi movq %rax, %rdi call min movq %rax, (%rbx) cmpq $0, -56(%rbp) jne .L20 movq -80(%rbp), %rax cqto shrq $63, %rdx addq %rdx, %rax andl $1, %eax subq %rdx, %rax cmpq $1, %rax jne .L20 movq -80(%rbp), %rax cmpq %rax, -32(%rbp) jge .L20 movq -72(%rbp), %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -64(%rbp), %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rax movq (%rax), %rdx movq -80(%rbp), %rax movq %rax, %rcx shrq $63, %rcx addq %rcx, %rax sarq %rax movq %rax, %rsi movq -32(%rbp), %rax salq $4, %rax movq %rax, %rcx movq -48(%rbp), %rax addq %rcx, %rax movq (%rax), %rcx movq -32(%rbp), %rax salq $4, %rax movq %rax, %rdi movq -48(%rbp), %rax addq %rdi, %rax movq 8(%rax), %rax addq %rcx, %rax imulq %rsi, %rax addq %rax, %rdx movq -72(%rbp), %rax leaq 0(,%rax,8), %rcx movq -40(%rbp), %rax addq %rcx, %rax movq (%rax), %rcx movq -64(%rbp), %rax salq $3, %rax addq %rcx, %rax movq (%rax), %rax addq $8, %rax movq (%rax), %rax movq -72(%rbp), %rcx leaq 0(,%rcx,8), %rsi movq -40(%rbp), %rcx addq %rsi, %rcx movq (%rcx), %rsi movq -64(%rbp), %rcx salq $3, %rcx addq %rsi, %rcx movq (%rcx), %rcx leaq 8(%rcx), %rbx movq %rdx, %rsi movq %rax, %rdi call min movq %rax, (%rbx) jmp .L20 .L26: nop .L20: addq $1, -56(%rbp) .L18: movq -80(%rbp), %rax cqto shrq $63, %rdx addq %rdx, %rax andl $1, %eax subq %rdx, %rax cmpq %rax, -56(%rbp) jle .L21 addq $1, -64(%rbp) .L17: movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax cmpq %rax, -64(%rbp) jle .L22 addq $1, -72(%rbp) .L16: movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax cmpq %rax, -72(%rbp) jle .L23 movq -80(%rbp), %rax movq %rax, %rdx shrq $63, %rdx addq %rdx, %rax sarq %rax leaq 0(,%rax,8), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -80(%rbp), %rax movq %rax, %rcx shrq $63, %rcx addq %rcx, %rax sarq %rax salq $3, %rax addq %rdx, %rax movq (%rax), %rcx movq -80(%rbp), %rax cqto shrq $63, %rdx addq %rdx, %rax andl $1, %eax subq %rdx, %rax salq $3, %rax addq %rcx, %rax movq (%rax), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -24(%rbp), %rdx subq %fs:40, %rdx je .L25 call __stack_chk_fail@PLT .L25: movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Yay!\"\n.LC2:\n\t.string\t\":(\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rdx\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$8, %eax\n\tjg\t.L2\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$8, %eax\n\tjg\t.L2\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L2:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$8, (%rsp)\n\tjg\t.L2\n\tcmpl\t$8, 4(%rsp)\n\tjle\t.L7\n.L2:\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L7:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L8:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t$8, (%rsp)\n\tjg\t.L2\n\tcmpl\t$8, 4(%rsp)\n\tjle\t.L7\n.L2:\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L8\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L7:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L8:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 return 0;\n}", "index": 85, "inputs": [ "11 6\n", "0 8\n", "5 1\n", "11 5\n", "0 9\n", "8 1\n", "13 5\n", "0 18\n", "8 0\n", "18 5\n", "0 17\n", "14 1\n", "18 8\n", "0 31\n", "14 2\n", "18 4\n", "-1 31\n", "10 2\n", "18 1\n", "-1 54\n", "10 4\n", "25 1\n", "-2 54\n", "5 5\n", "15 1\n", "-2 40\n", "5 2\n", "3 1\n", "-4 40\n", "9 2\n", "6 1\n", "-6 40\n", "9 0\n", "11 1\n", "-6 20\n", "9 -1\n", "21 1\n", "-6 26\n", "9 -2\n", "9 1\n", "-4 26\n", "5 -1\n", "0 1\n", "-4 47\n", "5 0\n", "0 2\n", "-1 47\n", "8 -1\n", "1 2\n", "-1 34\n", "6 -1\n", "1 1\n", "-1 5\n", "6 0\n", "-1 1\n", "-1 7\n", "10 -1\n", "-1 0\n", "0 7\n", "13 -1\n", "0 0\n", "0 4\n", "7 0\n", "1 0\n", "1 4\n", "2 0\n", "2 1\n", "1 7\n", "4 0\n", "3 0\n", "2 7\n", "4 1\n", "2 2\n", "3 7\n", "4 2\n", "2 -1\n", "3 2\n", "4 4\n", "1 -1\n", "3 3\n", "18 0\n", "-1 2\n", "0 3\n", "30 0\n", "-2 0\n", "1 3\n", "10 0\n", "-2 -1\n", "0 -1\n", "10 1\n", "-3 -1\n", "-2 1\n", "11 2\n", "-6 -1\n", "-3 1\n", "17 2\n", "-4 -1\n", "-3 2\n", "22 2\n", "-4 0\n", "11 4\n", "5 4\n", "5 4\n", "8 8\n" ], "outputs": [ ":(\n", "Yay!\n", "Yay!\n", ":(\n", ":(\n", "Yay!\n", ":(\n", ":(\n", "Yay!\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", "Yay!\n", ":(\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", ":(\n", "Yay!\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", ":(\n", "Yay!\n", ":(\n", "Yay!\n", "Yay!\n", "Yay!\n" ], "question": "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 return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d\"\n.LC1:\n\t.string\t\"Yay!\"\n.LC2:\n\t.string\t\":(\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-12(%rbp), %rdx\n\tleaq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t$8, %eax\n\tjg\t.L2\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t$8, %eax\n\tjg\t.L2\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L3\n.L2:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L3:\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "Yay!" .LC2: .string ":(" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -12(%rbp), %rdx leaq -16(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -16(%rbp), %eax cmpl $8, %eax jg .L2 movl -12(%rbp), %eax cmpl $8, %eax jg .L2 leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L3 .L2: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L3: movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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\tcount = 0;\n\ti = 0;\n\twhile (i <= A){\n\t\tj = 0;\n\t\twhile (j <= B){\n\t\t\tk = 0;\n\t\t\twhile (k <= C){\n\t\t\t\ttotal = 500*i + 100*j + 50*k;\n\t\t\t\tif (total == X){\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\", count);\n\treturn (0);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d %d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rsi\n\tleaq\t-36(%rbp), %rcx\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-44(%rbp), %rax\n\tmovq\t%rsi, %r8\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -28(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L2\n.L8:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L3\n.L7:\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-24(%rbp), %eax\n\timull\t$500, %eax, %edx\n\tmovl\t-20(%rbp), %eax\n\timull\t$100, %eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-16(%rbp), %eax\n\timull\t$50, %eax, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L5\n\taddl\t$1, -28(%rbp)\n.L5:\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjle\t.L6\n\taddl\t$1, -20(%rbp)\n.L3:\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L7\n\taddl\t$1, -24(%rbp)\n.L2:\n\tmovl\t-44(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjle\t.L8\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC1(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t32(%rsp), %rcx\n\tleaq\t28(%rsp), %rdx\n\tleaq\t24(%rsp), %rsi\n\tleaq\t36(%rsp), %r8\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t24(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjs\t.L20\n\tmovl\t32(%rsp), %esi\n\tmovl\t36(%rsp), %r9d\n\taddl\t$1, %eax\n\txorl\t%r14d, %r14d\n\tmovl\t28(%rsp), %r15d\n\tmovl\t%eax, 12(%rsp)\n\txorl\t%r13d, %r13d\n\txorl\t%edx, %edx\n\tleal\t1(%rsi), %r12d\n\tmovd\t%r9d, %xmm7\n\tmovdqa\t.LC2(%rip), %xmm5\n\tmovl\t%r12d, %edi\n\tleal\t1(%r15), %ebp\n\tpshufd\t$0, %xmm7, %xmm6\n\tmovl\t%r12d, %r11d\n\tshrl\t$2, %edi\n\tandl\t$-4, %r11d\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\ttestl\t%r15d, %r15d\n\tjs\t.L15\n\tmovl\t%r14d, %eax\n\txorl\t%r10d, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\ttestl\t%esi, %esi\n\tjs\t.L17\n\tcmpl\t$6, %esi\n\tjbe\t.L21\n\tmovd\t%eax, %xmm7\n\tmovdqa\t.LC0(%rip), %xmm3\n\txorl\t%ecx, %ecx\n\tpxor\t%xmm2, %xmm2\n\tpshufd\t$0, %xmm7, %xmm4\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovdqa\t%xmm3, %xmm1\n\taddl\t$1, %ecx\n\tpaddd\t%xmm5, %xmm3\n\tmovdqa\t%xmm1, %xmm0\n\tpslld\t$1, %xmm0\n\tpaddd\t%xmm1, %xmm0\n\tpslld\t$3, %xmm0\n\tpaddd\t%xmm1, %xmm0\n\tpslld\t$1, %xmm0\n\tpaddd\t%xmm4, %xmm0\n\tpcmpeqd\t%xmm6, %xmm0\n\tpsubd\t%xmm0, %xmm2\n\tcmpl\t%ecx, %edi\n\tjne\t.L5\n\tmovdqa\t%xmm2, %xmm0\n\tpsrldq\t$8, %xmm0\n\tpaddd\t%xmm0, %xmm2\n\tmovdqa\t%xmm2, %xmm0\n\tpsrldq\t$4, %xmm0\n\tpaddd\t%xmm0, %xmm2\n\tmovd\t%xmm2, %ecx\n\taddl\t%ecx, %edx\n\tmovl\t%r11d, %ecx\n\tcmpl\t%r11d, %r12d\n\tje\t.L17\n.L4:\n\timull\t$50, %ecx, %r8d\n\tleal\t(%rax,%r8), %ebx\n\tcmpl\t%r9d, %ebx\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t1(%rcx), %ebx\n\tcmpl\t%esi, %ebx\n\tjg\t.L17\n\tleal\t50(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t2(%rcx), %ebx\n\tcmpl\t%esi, %ebx\n\tjg\t.L17\n\tleal\t100(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t3(%rcx), %ebx\n\tcmpl\t%ebx, %esi\n\tjl\t.L17\n\tleal\t150(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t4(%rcx), %ebx\n\tcmpl\t%ebx, %esi\n\tjl\t.L17\n\tleal\t200(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t5(%rcx), %ebx\n\tcmpl\t%ebx, %esi\n\tjl\t.L17\n\tleal\t250(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\taddl\t$6, %ecx\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tcmpl\t%ecx, %esi\n\tjl\t.L17\n\tleal\t300(%r8,%rax), %ecx\n\tcmpl\t%ecx, %r9d\n\tsete\t%cl\n\tmovzbl\t%cl, %ecx\n\taddl\t%ecx, %edx\n.L17:\n\taddl\t$1, %r10d\n\taddl\t$100, %eax\n\tcmpl\t%ebp, %r10d\n\tjne\t.L18\n.L15:\n\taddl\t$1, %r13d\n\taddl\t$500, %r14d\n\tcmpl\t12(%rsp), %r13d\n\tjne\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L27\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L21:\n\t.cfi_restore_state\n\txorl\t%ecx, %ecx\n\tjmp\t.L4\n.L20:\n\txorl\t%edx, %edx\n\tjmp\t.L2\n.L27:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC2:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC1(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 112\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t32(%rsp), %rcx\n\tleaq\t28(%rsp), %rdx\n\tleaq\t24(%rsp), %rsi\n\tleaq\t36(%rsp), %r8\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t24(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjs\t.L20\n\tmovl\t32(%rsp), %esi\n\tmovl\t36(%rsp), %r9d\n\taddl\t$1, %eax\n\txorl\t%r14d, %r14d\n\tmovl\t28(%rsp), %r15d\n\tmovl\t%eax, 12(%rsp)\n\txorl\t%r13d, %r13d\n\txorl\t%edx, %edx\n\tleal\t1(%rsi), %r12d\n\tmovd\t%r9d, %xmm7\n\tmovdqa\t.LC2(%rip), %xmm5\n\tmovl\t%r12d, %edi\n\tleal\t1(%r15), %ebp\n\tpshufd\t$0, %xmm7, %xmm6\n\tmovl\t%r12d, %r11d\n\tshrl\t$2, %edi\n\tandl\t$-4, %r11d\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\ttestl\t%r15d, %r15d\n\tjs\t.L15\n\tmovl\t%r14d, %eax\n\txorl\t%r10d, %r10d\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\ttestl\t%esi, %esi\n\tjs\t.L17\n\tcmpl\t$6, %esi\n\tjbe\t.L21\n\tmovd\t%eax, %xmm7\n\tmovdqa\t.LC0(%rip), %xmm3\n\txorl\t%ecx, %ecx\n\tpxor\t%xmm2, %xmm2\n\tpshufd\t$0, %xmm7, %xmm4\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovdqa\t%xmm3, %xmm1\n\taddl\t$1, %ecx\n\tpaddd\t%xmm5, %xmm3\n\tmovdqa\t%xmm1, %xmm0\n\tpslld\t$1, %xmm0\n\tpaddd\t%xmm1, %xmm0\n\tpslld\t$3, %xmm0\n\tpaddd\t%xmm1, %xmm0\n\tpslld\t$1, %xmm0\n\tpaddd\t%xmm4, %xmm0\n\tpcmpeqd\t%xmm6, %xmm0\n\tpsubd\t%xmm0, %xmm2\n\tcmpl\t%ecx, %edi\n\tjne\t.L5\n\tmovdqa\t%xmm2, %xmm0\n\tpsrldq\t$8, %xmm0\n\tpaddd\t%xmm0, %xmm2\n\tmovdqa\t%xmm2, %xmm0\n\tpsrldq\t$4, %xmm0\n\tpaddd\t%xmm0, %xmm2\n\tmovd\t%xmm2, %ecx\n\taddl\t%ecx, %edx\n\tmovl\t%r11d, %ecx\n\tcmpl\t%r11d, %r12d\n\tje\t.L17\n.L4:\n\timull\t$50, %ecx, %r8d\n\tleal\t(%rax,%r8), %ebx\n\tcmpl\t%r9d, %ebx\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t1(%rcx), %ebx\n\tcmpl\t%esi, %ebx\n\tjg\t.L17\n\tleal\t50(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t2(%rcx), %ebx\n\tcmpl\t%esi, %ebx\n\tjg\t.L17\n\tleal\t100(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t3(%rcx), %ebx\n\tcmpl\t%ebx, %esi\n\tjl\t.L17\n\tleal\t150(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t4(%rcx), %ebx\n\tcmpl\t%ebx, %esi\n\tjl\t.L17\n\tleal\t200(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tleal\t5(%rcx), %ebx\n\tcmpl\t%ebx, %esi\n\tjl\t.L17\n\tleal\t250(%r8,%rax), %ebx\n\tcmpl\t%ebx, %r9d\n\tsete\t%bl\n\taddl\t$6, %ecx\n\tmovzbl\t%bl, %ebx\n\taddl\t%ebx, %edx\n\tcmpl\t%ecx, %esi\n\tjl\t.L17\n\tleal\t300(%r8,%rax), %ecx\n\tcmpl\t%ecx, %r9d\n\tsete\t%cl\n\tmovzbl\t%cl, %ecx\n\taddl\t%ecx, %edx\n.L17:\n\taddl\t$1, %r10d\n\taddl\t$100, %eax\n\tcmpl\t%ebp, %r10d\n\tjne\t.L18\n.L15:\n\taddl\t$1, %r13d\n\taddl\t$500, %r14d\n\tcmpl\t12(%rsp), %r13d\n\tjne\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tleaq\t.LC3(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L27\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L21:\n\t.cfi_restore_state\n\txorl\t%ecx, %ecx\n\tjmp\t.L4\n.L20:\n\txorl\t%edx, %edx\n\tjmp\t.L2\n.L27:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.long\t0\n\t.long\t1\n\t.long\t2\n\t.long\t3\n\t.align 16\n.LC2:\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\tcount = 0;\n\ti = 0;\n\twhile (i <= A){\n\t\tj = 0;\n\t\twhile (j <= B){\n\t\t\tk = 0;\n\t\t\twhile (k <= C){\n\t\t\t\ttotal = 500*i + 100*j + 50*k;\n\t\t\t\tif (total == X){\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\", count);\n\treturn (0);\n}\n", "index": 93, "inputs": [ "2\n2\n4\n100\n", "30\n40\n77\n6000\n", "5\n0\n0\n150\n", "30\n47\n77\n6000\n", "5\n0\n0\n0\n", "2\n2\n5\n100\n", "2\n2\n10\n100\n", "30\n47\n77\n10696\n", "5\n0\n1\n0\n", "2\n0\n10\n100\n", "30\n56\n77\n10696\n", "5\n1\n1\n0\n", "2\n0\n10\n110\n", "30\n56\n77\n13326\n", "5\n2\n1\n0\n", "2\n0\n1\n100\n", "30\n60\n77\n13326\n", "5\n2\n1\n-1\n", "2\n0\n1\n000\n", "30\n60\n77\n14610\n", "5\n2\n0\n-1\n", "2\n0\n2\n000\n", "30\n60\n77\n20069\n", "5\n0\n0\n-1\n", "2\n0\n4\n000\n", "30\n60\n77\n31334\n", "5\n-1\n0\n-1\n", "2\n-1\n4\n000\n", "30\n60\n76\n31334\n", "5\n-1\n-1\n-1\n", "2\n-1\n4\n010\n", "30\n60\n76\n16179\n", "5\n-1\n-2\n-1\n", "2\n-2\n4\n010\n", "30\n73\n76\n16179\n", "5\n0\n-2\n-1\n", "2\n-2\n0\n010\n", "30\n73\n76\n20818\n", "5\n0\n-2\n-2\n", "2\n-2\n0\n011\n", "30\n73\n76\n6415\n", "5\n0\n-3\n-2\n", "2\n-2\n-1\n011\n", "30\n73\n134\n6415\n", "5\n-1\n-3\n-2\n", "2\n-2\n-1\n001\n", "30\n112\n134\n6415\n", "5\n-2\n-3\n-2\n", "2\n-3\n-1\n001\n", "30\n112\n134\n8208\n", "5\n-2\n-3\n0\n", "2\n-6\n-1\n001\n", "30\n112\n134\n3602\n", "5\n-1\n-3\n0\n", "2\n-6\n0\n001\n", "30\n168\n134\n3602\n", "5\n-1\n-3\n1\n", "2\n-8\n0\n001\n", "30\n168\n252\n3602\n", "5\n-1\n-4\n1\n", "2\n-8\n1\n001\n", "30\n168\n252\n4759\n", "5\n-1\n-4\n0\n", "2\n-12\n0\n001\n", "30\n168\n252\n5860\n", "5\n-1\n-8\n0\n", "2\n-17\n0\n001\n", "30\n168\n152\n5860\n", "5\n-1\n-14\n0\n", "2\n-24\n0\n001\n", "30\n168\n280\n5860\n", "5\n-1\n-21\n0\n", "2\n-6\n0\n101\n", "30\n191\n280\n5860\n", "5\n0\n-21\n0\n", "2\n-3\n0\n101\n", "30\n151\n280\n5860\n", "5\n-1\n0\n0\n", "2\n-3\n1\n101\n", "30\n151\n280\n8240\n", "5\n-1\n0\n1\n", "2\n-3\n-1\n101\n", "30\n151\n280\n961\n", "5\n0\n0\n1\n", "2\n-6\n-1\n101\n", "30\n151\n136\n961\n", "5\n0\n0\n2\n", "2\n-6\n-1\n100\n", "30\n41\n136\n961\n", "5\n0\n1\n2\n", "2\n-11\n-1\n100\n", "30\n42\n136\n961\n", "5\n1\n1\n2\n", "2\n-10\n-1\n100\n", "30\n82\n136\n961\n", "5\n1\n2\n0\n", "2\n-10\n-1\n000\n", "30\n82\n136\n803\n", "5\n0\n2\n0\n", "2\n-10\n-1\n010\n", "2\n2\n2\n100\n", "2\n2\n2\n100\n", "5\n1\n0\n150\n", "30\n40\n50\n6000\n" ], "outputs": [ "2\n", "293\n", "0\n", "319\n", "1\n", "2\n", "2\n", "0\n", "1\n", "1\n", "0\n", "1\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "1\n", "0\n", "0\n", "1\n", "0\n", "0\n", "1\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "0\n", "0\n", "1\n", "0\n", "2\n", "2\n", "0\n", "213\n" ], "question": "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\tcount = 0;\n\ti = 0;\n\twhile (i <= A){\n\t\tj = 0;\n\t\twhile (j <= B){\n\t\t\tk = 0;\n\t\t\twhile (k <= C){\n\t\t\t\ttotal = 500*i + 100*j + 50*k;\n\t\t\t\tif (total == X){\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\tk++;\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\", count);\n\treturn (0);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %d %d %d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-32(%rbp), %rsi\n\tleaq\t-36(%rbp), %rcx\n\tleaq\t-40(%rbp), %rdx\n\tleaq\t-44(%rbp), %rax\n\tmovq\t%rsi, %r8\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -28(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L2\n.L8:\n\tmovl\t$0, -20(%rbp)\n\tjmp\t.L3\n.L7:\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L4\n.L6:\n\tmovl\t-24(%rbp), %eax\n\timull\t$500, %eax, %edx\n\tmovl\t-20(%rbp), %eax\n\timull\t$100, %eax, %eax\n\taddl\t%eax, %edx\n\tmovl\t-16(%rbp), %eax\n\timull\t$50, %eax, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjne\t.L5\n\taddl\t$1, -28(%rbp)\n.L5:\n\taddl\t$1, -16(%rbp)\n.L4:\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjle\t.L6\n\taddl\t$1, -20(%rbp)\n.L3:\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L7\n\taddl\t$1, -24(%rbp)\n.L2:\n\tmovl\t-44(%rbp), %eax\n\tcmpl\t%eax, -24(%rbp)\n\tjle\t.L8\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L10\n\tcall\t__stack_chk_fail@PLT\n.L10:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; while (j <= B){ k = 0; while (k <= C){ total = 500*i + 100*j + 50*k; if (total == X){ count++; } k++; } j++; } i++; } printf("%d\n", count); return (0); } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d %d %d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -32(%rbp), %rsi leaq -36(%rbp), %rcx leaq -40(%rbp), %rdx leaq -44(%rbp), %rax movq %rsi, %r8 movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -28(%rbp) movl $0, -24(%rbp) jmp .L2 .L8: movl $0, -20(%rbp) jmp .L3 .L7: movl $0, -16(%rbp) jmp .L4 .L6: movl -24(%rbp), %eax imull $500, %eax, %edx movl -20(%rbp), %eax imull $100, %eax, %eax addl %eax, %edx movl -16(%rbp), %eax imull $50, %eax, %eax addl %edx, %eax movl %eax, -12(%rbp) movl -32(%rbp), %eax cmpl %eax, -12(%rbp) jne .L5 addl $1, -28(%rbp) .L5: addl $1, -16(%rbp) .L4: movl -36(%rbp), %eax cmpl %eax, -16(%rbp) jle .L6 addl $1, -20(%rbp) .L3: movl -40(%rbp), %eax cmpl %eax, -20(%rbp) jle .L7 addl $1, -24(%rbp) .L2: movl -44(%rbp), %eax cmpl %eax, -24(%rbp) jle .L8 movl -28(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L10 call __stack_chk_fail@PLT .L10: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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){\n i++;\n m = X[i];\n X[i] = X[j];\n X[j] = m;\n }\n }\n m= X[i+1];\n X[i + 1] = X[r];\n X[r] =m;\n return i+1;\n}\n\nint main(){\n int i,q;\n\n scanf(\"%d\",&num);\n for(i=0;i<num;i++){\n scanf(\"%d\",&X[i]);\n }\n\n q= partition(0,num-1);\n\n for(i=0;i<num;i++){\n if(i){\n printf(\" \");\n }\n if(i == q){\n printf(\"[\");\n }\n printf(\"%d\",X[i]);\n if(i==q){\n printf(\"]\");\n }\n }\n printf(\"\\n\");\n\n return 0;\n }\n\t\t \n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tX\n\t.bss\n\t.align 32\n\t.type\tX, @object\n\t.size\tX, 400000\nX:\n\t.zero\t400000\n\t.globl\tnum\n\t.align 4\n\t.type\tnum, @object\n\t.size\tnum, 4\nnum:\n\t.zero\t4\n\t.text\n\t.globl\tpartition\n\t.type\tpartition, @function\npartition:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L3\n\taddl\t$1, -16(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-16(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n.L3:\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjl\t.L4\n\tmovl\t-16(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%ecx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-16(%rbp), %eax\n\taddl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tpartition, .-partition\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tnum(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -8(%rbp)\n.L7:\n\tmovl\tnum(%rip), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L8\n\tmovl\tnum(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tmovl\t$0, %edi\n\tcall\tpartition\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L9\n.L13:\n\tcmpl\t$0, -8(%rbp)\n\tje\t.L10\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L10:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjne\t.L11\n\tmovl\t$91, %edi\n\tcall\tputchar@PLT\n.L11:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjne\t.L12\n\tmovl\t$93, %edi\n\tcall\tputchar@PLT\n.L12:\n\taddl\t$1, -8(%rbp)\n.L9:\n\tmovl\tnum(%rip), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L13\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tmovslq\t%edi, %r10\n\tleal\t-1(%rsi), %eax\n\tleaq\t4(%rcx), %rsi\n\taddq\t%r10, %rax\n\tleaq\t(%rcx,%r10,4), %rdx\n\tleaq\t(%rsi,%rax,4), %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t(%rdx), %eax\n\tcmpl\t%r9d, %eax\n\tjg\t.L3\n\taddl\t$1, %r8d\n\tmovslq\t%r8d, %rsi\n\tmovl\t(%rcx,%rsi,4), %r10d\n\tmovl\t%eax, (%rcx,%rsi,4)\n\tmovl\t%r10d, (%rdx)\n.L3:\n\taddq\t$4, %rdx\n\tcmpq\t%rdi, %rdx\n\tjne\t.L4\n\tleal\t1(%r8), %eax\n\tmovl\t(%rcx,%r11,4), %r9d\n\tmovslq\t%eax, %rdx\n\tmovl\t(%rcx,%rdx,4), %esi\n\tmovl\t%r9d, (%rcx,%rdx,4)\n\tmovl\t%esi, (%rcx,%r11,4)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t%edi, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t(%rcx,%rdx,4), %esi\n\tmovl\t%r9d, (%rcx,%rdx,4)\n\tmovl\t%esi, (%rcx,%r11,4)\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tpartition, .-partition\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.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\tnum(%rip), %rsi\n\txorl\t%eax, %eax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tmovq\t%r12, %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tnum(%rip), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L9\n\tleaq\tX(%rip), %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tnum(%rip), %esi\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %esi\n\tjg\t.L10\n.L9:\n\tsubl\t$1, %esi\n\txorl\t%edi, %edi\n\tleaq\tX(%rip), %r13\n\txorl\t%ebx, %ebx\n\tcall\tpartition\n\tmovl\t%eax, %ebp\n\tmovl\tnum(%rip), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L11\n\tjmp\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovl\t0(%r13,%rbx,4), %edx\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\taddq\t$1, %rbx\n\tcall\t__printf_chk@PLT\n\tcmpl\t%ebx, num(%rip)\n\tjle\t.L14\n.L13:\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L11:\n\tcmpl\t%ebx, %ebp\n\tjne\t.L12\n\tmovl\t$91, %edi\n\tcall\tputchar@PLT\n\tmovl\t0(%r13,%rbx,4), %edx\n\tmovq\t%r12, %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\taddq\t$1, %rbx\n\tcall\t__printf_chk@PLT\n\tmovl\t$93, %edi\n\tcall\tputchar@PLT\n\tcmpl\t%ebx, num(%rip)\n\tjg\t.L13\n.L14:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.globl\tnum\n\t.bss\n\t.align 4\n\t.type\tnum, @object\n\t.size\tnum, 4\nnum:\n\t.zero\t4\n\t.globl\tX\n\t.align 32\n\t.type\tX, @object\n\t.size\tX, 400000\nX:\n\t.zero\t400000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\t%edi, %r10\n\tleal\t-1(%rsi), %eax\n\tleaq\t4(%rcx), %rsi\n\taddq\t%r10, %rax\n\tleaq\t(%rcx,%r10,4), %rdx\n\tleaq\t(%rsi,%rax,4), %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tmovl\t(%rdx), %eax\n\tcmpl\t%r9d, %eax\n\tjg\t.L3\n\taddl\t$1, %r8d\n\tmovslq\t%r8d, %rsi\n\tmovl\t(%rcx,%rsi,4), %r10d\n\tmovl\t%eax, (%rcx,%rsi,4)\n\tmovl\t%r10d, (%rdx)\n.L3:\n\taddq\t$4, %rdx\n\tcmpq\t%rdi, %rdx\n\tjne\t.L4\n\tleal\t1(%r8), %eax\n\tmovl\t(%rcx,%r11,4), %r9d\n\tmovslq\t%eax, %rdx\n\tmovl\t(%rcx,%rdx,4), %esi\n\tmovl\t%r9d, (%rcx,%rdx,4)\n\tmovl\t%esi, (%rcx,%r11,4)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t%edi, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t(%rcx,%rdx,4), %esi\n\tmovl\t%r9d, (%rcx,%rdx,4)\n\tmovl\t%esi, (%rcx,%r11,4)\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tpartition, .-partition\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.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tleaq\tnum(%rip), %rsi\n\txorl\t%eax, %eax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tleaq\t.LC0(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tmovq\t%r12, %rdi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tnum(%rip), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L9\n\tleaq\tX(%rip), %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tnum(%rip), %esi\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %esi\n\tjg\t.L10\n.L9:\n\tsubl\t$1, %esi\n\txorl\t%edi, %edi\n\tleaq\tX(%rip), %r13\n\txorl\t%ebx, %ebx\n\tcall\tpartition\n\tmovl\t%eax, %ebp\n\tmovl\tnum(%rip), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L11\n\tjmp\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovl\t0(%r13,%rbx,4), %edx\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\taddq\t$1, %rbx\n\tcall\t__printf_chk@PLT\n\tcmpl\t%ebx, num(%rip)\n\tjle\t.L14\n.L13:\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L11:\n\tcmpl\t%ebx, %ebp\n\tjne\t.L12\n\tmovl\t$91, %edi\n\tcall\tputchar@PLT\n\tmovl\t0(%r13,%rbx,4), %edx\n\tmovq\t%r12, %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\taddq\t$1, %rbx\n\tcall\t__printf_chk@PLT\n\tmovl\t$93, %edi\n\tcall\tputchar@PLT\n\tcmpl\t%ebx, num(%rip)\n\tjg\t.L13\n.L14:\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.globl\tnum\n\t.bss\n\t.align 4\n\t.type\tnum, @object\n\t.size\tnum, 4\nnum:\n\t.zero\t4\n\t.globl\tX\n\t.align 32\n\t.type\tX, @object\n\t.size\tX, 400000\nX:\n\t.zero\t400000\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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){\n i++;\n m = X[i];\n X[i] = X[j];\n X[j] = m;\n }\n }\n m= X[i+1];\n X[i + 1] = X[r];\n X[r] =m;\n return i+1;\n}\n\nint main(){\n int i,q;\n\n scanf(\"%d\",&num);\n for(i=0;i<num;i++){\n scanf(\"%d\",&X[i]);\n }\n\n q= partition(0,num-1);\n\n for(i=0;i<num;i++){\n if(i){\n printf(\" \");\n }\n if(i == q){\n printf(\"[\");\n }\n printf(\"%d\",X[i]);\n if(i==q){\n printf(\"]\");\n }\n }\n printf(\"\\n\");\n\n return 0;\n }\n\t\t \n\n", "index": 95, "inputs": [ "12\n13 19 9 5 12 8 7 4 21 2 10 11\n", "12\n13 19 9 5 12 8 7 4 21 2 10 18\n", "12\n13 19 9 5 12 8 7 4 21 0 10 18\n", "12\n13 19 9 5 12 8 7 4 37 0 10 18\n", "12\n13 19 9 5 12 8 7 4 13 0 10 18\n", "12\n25 19 9 5 12 8 7 4 13 0 10 18\n", "12\n25 19 9 5 12 8 7 4 13 -1 10 18\n", "12\n25 19 9 9 12 8 7 4 13 -1 10 18\n", "12\n25 19 9 9 12 8 7 4 13 -1 10 22\n", "12\n23 19 9 9 12 8 7 4 13 -1 10 22\n", "12\n25 19 9 6 12 8 7 4 13 -1 10 22\n", "12\n40 19 9 6 12 8 7 4 13 -1 10 22\n", "12\n40 19 9 6 12 8 8 4 13 -1 10 22\n", "12\n40 19 9 1 12 8 8 4 13 -1 10 22\n", "12\n40 19 9 1 12 8 8 4 21 -1 10 22\n", "12\n40 19 9 1 12 8 8 4 21 0 10 22\n", "12\n40 19 6 1 12 8 8 4 21 0 10 22\n", "12\n40 19 6 1 12 8 8 2 21 0 10 22\n", "12\n40 19 6 1 12 8 8 2 21 1 10 22\n", "12\n40 19 6 1 12 8 0 2 21 1 10 22\n", "12\n40 19 6 1 12 8 0 3 21 1 10 22\n", "12\n40 19 6 1 12 8 0 5 21 1 10 22\n", "12\n40 19 6 1 12 7 0 5 21 1 10 22\n", "12\n40 19 6 1 12 7 0 5 21 0 10 22\n", "12\n40 19 6 1 12 7 0 5 21 -1 10 22\n", "12\n40 19 6 2 12 7 0 5 21 -1 10 22\n", "12\n40 19 12 2 12 7 0 5 21 -1 10 22\n", "12\n40 19 12 2 12 7 0 5 21 -1 1 22\n", "12\n40 19 12 2 12 7 0 5 21 -1 1 37\n", "12\n40 19 12 2 12 11 0 5 21 -1 1 37\n", "12\n40 19 22 2 12 11 0 5 21 -1 1 37\n", "12\n40 19 22 2 12 11 1 5 21 -1 1 37\n", "12\n40 19 22 2 3 11 1 5 21 -1 1 37\n", "12\n38 19 22 2 3 11 1 5 21 -1 1 37\n", "12\n38 19 22 2 3 11 1 5 22 -1 1 37\n", "12\n38 18 22 2 3 11 1 5 22 -1 1 37\n", "12\n13 19 9 5 12 10 7 4 21 2 6 11\n", "12\n13 19 9 5 12 8 7 2 21 2 10 11\n", "12\n13 19 9 5 12 8 7 4 21 4 10 18\n", "12\n13 19 9 5 12 8 7 4 21 0 2 18\n", "12\n13 19 9 5 12 8 7 4 40 0 10 18\n", "12\n13 19 9 5 12 8 7 4 13 0 6 18\n", "12\n25 19 9 5 12 8 7 4 17 0 10 18\n", "12\n25 19 9 5 12 10 7 4 13 -1 10 18\n", "12\n47 19 9 9 12 8 7 4 13 -1 10 18\n", "12\n25 19 9 9 14 8 7 4 13 -1 10 22\n", "12\n23 19 9 9 23 8 7 4 13 -1 10 22\n", "12\n25 19 9 6 12 6 7 4 13 -1 10 22\n", "12\n40 19 9 6 12 8 7 4 25 -1 10 22\n", "12\n40 19 9 6 17 8 8 4 13 -1 10 22\n", "12\n40 10 9 1 12 8 8 4 13 -1 10 22\n", "12\n40 19 9 2 12 8 8 4 21 -1 10 22\n", "12\n40 19 9 1 12 8 8 6 21 0 10 22\n", "12\n40 19 6 1 12 8 8 2 36 0 10 22\n", "12\n40 19 6 1 12 8 12 2 21 1 10 22\n", "12\n40 19 6 1 12 8 0 2 21 2 10 22\n", "12\n40 19 6 1 12 8 0 3 21 0 10 22\n", "12\n71 19 6 1 12 8 0 5 21 1 10 22\n", "12\n40 19 6 1 12 7 0 5 21 1 10 30\n", "12\n26 19 6 1 12 7 0 5 21 -1 10 22\n", "12\n74 19 6 2 12 7 0 5 21 -1 10 22\n", "12\n40 19 12 2 12 7 1 5 21 -1 10 22\n", "12\n40 19 12 2 12 7 0 5 21 -2 1 22\n", "12\n40 19 12 2 12 7 0 4 21 -1 1 37\n", "12\n40 30 12 2 12 11 0 5 21 -1 1 37\n", "12\n63 19 22 2 12 11 0 5 21 -1 1 37\n", "12\n40 19 22 2 12 11 1 5 5 -1 1 37\n", "12\n40 19 22 1 3 11 1 5 21 -1 1 37\n", "12\n38 19 22 2 3 11 1 5 21 -1 1 13\n", "12\n38 19 22 2 3 11 1 5 38 -1 1 37\n", "12\n38 18 22 2 3 20 1 5 22 -1 1 37\n", "12\n13 19 9 3 12 10 7 4 21 2 6 11\n", "12\n13 19 9 5 12 8 7 2 36 2 10 11\n", "12\n8 19 9 5 12 8 7 4 21 4 10 18\n", "12\n13 19 9 5 12 8 7 4 21 -1 2 18\n", "12\n13 19 9 5 12 8 7 4 40 0 10 1\n", "12\n13 19 9 5 12 8 7 4 13 0 6 3\n", "12\n25 38 9 5 12 8 7 4 17 0 10 18\n", "12\n25 19 9 5 12 10 7 2 13 -1 10 18\n", "12\n47 19 9 9 12 8 7 7 13 -1 10 18\n", "12\n25 3 9 9 14 8 7 4 13 -1 10 22\n", "12\n23 19 9 9 23 8 10 4 13 -1 10 22\n", "12\n25 19 9 6 12 6 7 4 25 -1 10 22\n", "12\n40 19 9 1 12 8 7 4 25 -1 10 22\n", "12\n32 19 9 6 17 8 8 4 13 -1 10 22\n", "12\n40 10 9 1 12 8 11 4 13 -1 10 22\n", "12\n40 19 9 2 12 8 8 1 21 -1 10 22\n", "12\n40 19 9 1 12 8 8 6 21 0 10 1\n", "12\n40 19 12 1 12 8 8 2 36 0 10 22\n", "12\n40 19 6 1 24 8 12 2 21 1 10 22\n", "12\n40 19 6 1 12 8 0 2 21 2 4 22\n", "12\n33 19 6 1 12 8 0 3 21 0 10 22\n", "12\n71 19 9 1 12 8 0 5 21 1 10 22\n", "12\n74 19 6 2 12 7 0 5 21 -2 10 22\n", "12\n40 19 12 2 12 7 1 5 21 -1 10 20\n", "12\n40 19 12 2 12 7 0 5 37 -2 1 22\n", "12\n40 19 12 2 12 0 0 4 21 -1 1 37\n", "12\n40 22 12 2 12 11 0 5 21 -1 1 37\n", "12\n63 19 22 2 12 11 0 5 21 -1 0 37\n", "12\n40 19 22 1 3 11 1 3 21 -1 1 37\n", "12\n13 19 9 5 12 8 7 4 21 2 6 11\n", "12\n13 19 9 5 12 8 7 4 21 2 6 11\n" ], "outputs": [ "9 5 8 7 4 2 10 [11] 21 13 19 12\n", "13 9 5 12 8 7 4 2 10 [18] 21 19\n", "13 9 5 12 8 7 4 0 10 [18] 21 19\n", "13 9 5 12 8 7 4 0 10 [18] 37 19\n", "13 9 5 12 8 7 4 13 0 10 [18] 19\n", "9 5 12 8 7 4 13 0 10 [18] 25 19\n", "9 5 12 8 7 4 13 -1 10 [18] 25 19\n", "9 9 12 8 7 4 13 -1 10 [18] 25 19\n", "19 9 9 12 8 7 4 13 -1 10 [22] 25\n", "19 9 9 12 8 7 4 13 -1 10 [22] 23\n", "19 9 6 12 8 7 4 13 -1 10 [22] 25\n", "19 9 6 12 8 7 4 13 -1 10 [22] 40\n", "19 9 6 12 8 8 4 13 -1 10 [22] 40\n", "19 9 1 12 8 8 4 13 -1 10 [22] 40\n", "19 9 1 12 8 8 4 21 -1 10 [22] 40\n", "19 9 1 12 8 8 4 21 0 10 [22] 40\n", "19 6 1 12 8 8 4 21 0 10 [22] 40\n", "19 6 1 12 8 8 2 21 0 10 [22] 40\n", "19 6 1 12 8 8 2 21 1 10 [22] 40\n", "19 6 1 12 8 0 2 21 1 10 [22] 40\n", "19 6 1 12 8 0 3 21 1 10 [22] 40\n", "19 6 1 12 8 0 5 21 1 10 [22] 40\n", "19 6 1 12 7 0 5 21 1 10 [22] 40\n", "19 6 1 12 7 0 5 21 0 10 [22] 40\n", "19 6 1 12 7 0 5 21 -1 10 [22] 40\n", "19 6 2 12 7 0 5 21 -1 10 [22] 40\n", "19 12 2 12 7 0 5 21 -1 10 [22] 40\n", "19 12 2 12 7 0 5 21 -1 1 [22] 40\n", "19 12 2 12 7 0 5 21 -1 1 [37] 40\n", "19 12 2 12 11 0 5 21 -1 1 [37] 40\n", "19 22 2 12 11 0 5 21 -1 1 [37] 40\n", "19 22 2 12 11 1 5 21 -1 1 [37] 40\n", "19 22 2 3 11 1 5 21 -1 1 [37] 40\n", "19 22 2 3 11 1 5 21 -1 1 [37] 38\n", "19 22 2 3 11 1 5 22 -1 1 [37] 38\n", "18 22 2 3 11 1 5 22 -1 1 [37] 38\n", "9 5 10 7 4 2 6 [11] 21 13 19 12\n", "9 5 8 7 2 2 10 [11] 21 13 19 12\n", "13 9 5 12 8 7 4 4 10 [18] 21 19\n", "13 9 5 12 8 7 4 0 2 [18] 21 19\n", "13 9 5 12 8 7 4 0 10 [18] 40 19\n", "13 9 5 12 8 7 4 13 0 6 [18] 19\n", "9 5 12 8 7 4 17 0 10 [18] 25 19\n", "9 5 12 10 7 4 13 -1 10 [18] 25 19\n", "9 9 12 8 7 4 13 -1 10 [18] 47 19\n", "19 9 9 14 8 7 4 13 -1 10 [22] 25\n", "19 9 9 8 7 4 13 -1 10 [22] 23 23\n", "19 9 6 12 6 7 4 13 -1 10 [22] 25\n", "19 9 6 12 8 7 4 -1 10 [22] 25 40\n", "19 9 6 17 8 8 4 13 -1 10 [22] 40\n", "10 9 1 12 8 8 4 13 -1 10 [22] 40\n", "19 9 2 12 8 8 4 21 -1 10 [22] 40\n", "19 9 1 12 8 8 6 21 0 10 [22] 40\n", "19 6 1 12 8 8 2 0 10 [22] 36 40\n", "19 6 1 12 8 12 2 21 1 10 [22] 40\n", "19 6 1 12 8 0 2 21 2 10 [22] 40\n", "19 6 1 12 8 0 3 21 0 10 [22] 40\n", "19 6 1 12 8 0 5 21 1 10 [22] 71\n", "19 6 1 12 7 0 5 21 1 10 [30] 40\n", "19 6 1 12 7 0 5 21 -1 10 [22] 26\n", "19 6 2 12 7 0 5 21 -1 10 [22] 74\n", "19 12 2 12 7 1 5 21 -1 10 [22] 40\n", "19 12 2 12 7 0 5 21 -2 1 [22] 40\n", "19 12 2 12 7 0 4 21 -1 1 [37] 40\n", "30 12 2 12 11 0 5 21 -1 1 [37] 40\n", "19 22 2 12 11 0 5 21 -1 1 [37] 63\n", "19 22 2 12 11 1 5 5 -1 1 [37] 40\n", "19 22 1 3 11 1 5 21 -1 1 [37] 40\n", "2 3 11 1 5 -1 1 [13] 21 22 38 19\n", "19 22 2 3 11 1 5 -1 1 [37] 38 38\n", "18 22 2 3 20 1 5 22 -1 1 [37] 38\n", "9 3 10 7 4 2 6 [11] 21 13 19 12\n", "9 5 8 7 2 2 10 [11] 36 13 19 12\n", "8 9 5 12 8 7 4 4 10 [18] 21 19\n", "13 9 5 12 8 7 4 -1 2 [18] 21 19\n", "0 [1] 9 5 12 8 7 4 40 13 10 19\n", "0 [3] 9 5 12 8 7 4 13 13 6 19\n", "9 5 12 8 7 4 17 0 10 [18] 25 38\n", "9 5 12 10 7 2 13 -1 10 [18] 25 19\n", "9 9 12 8 7 7 13 -1 10 [18] 47 19\n", "3 9 9 14 8 7 4 13 -1 10 [22] 25\n", "19 9 9 8 10 4 13 -1 10 [22] 23 23\n", "19 9 6 12 6 7 4 -1 10 [22] 25 25\n", "19 9 1 12 8 7 4 -1 10 [22] 25 40\n", "19 9 6 17 8 8 4 13 -1 10 [22] 32\n", "10 9 1 12 8 11 4 13 -1 10 [22] 40\n", "19 9 2 12 8 8 1 21 -1 10 [22] 40\n", "1 0 [1] 40 12 8 8 6 21 19 10 9\n", "19 12 1 12 8 8 2 0 10 [22] 36 40\n", "19 6 1 8 12 2 21 1 10 [22] 24 40\n", "19 6 1 12 8 0 2 21 2 4 [22] 40\n", "19 6 1 12 8 0 3 21 0 10 [22] 33\n", "19 9 1 12 8 0 5 21 1 10 [22] 71\n", "19 6 2 12 7 0 5 21 -2 10 [22] 74\n", "19 12 2 12 7 1 5 -1 10 [20] 21 40\n", "19 12 2 12 7 0 5 -2 1 [22] 37 40\n", "19 12 2 12 0 0 4 21 -1 1 [37] 40\n", "22 12 2 12 11 0 5 21 -1 1 [37] 40\n", "19 22 2 12 11 0 5 21 -1 0 [37] 63\n", "19 22 1 3 11 1 3 21 -1 1 [37] 40\n", "9 5 8 7 4 2 6 [11] 21 13 19 12\n", "9 5 8 7 4 2 6 [11] 21 13 19 12\n" ], "question": "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){\n i++;\n m = X[i];\n X[i] = X[j];\n X[j] = m;\n }\n }\n m= X[i+1];\n X[i + 1] = X[r];\n X[r] =m;\n return i+1;\n}\n\nint main(){\n int i,q;\n\n scanf(\"%d\",&num);\n for(i=0;i<num;i++){\n scanf(\"%d\",&X[i]);\n }\n\n q= partition(0,num-1);\n\n for(i=0;i<num;i++){\n if(i){\n printf(\" \");\n }\n if(i == q){\n printf(\"[\");\n }\n printf(\"%d\",X[i]);\n if(i==q){\n printf(\"]\");\n }\n }\n printf(\"\\n\");\n\n return 0;\n }\n\t\t \n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tX\n\t.bss\n\t.align 32\n\t.type\tX, @object\n\t.size\tX, 400000\nX:\n\t.zero\t400000\n\t.globl\tnum\n\t.align 4\n\t.type\tnum, @object\n\t.size\tnum, 4\nnum:\n\t.zero\t4\n\t.text\n\t.globl\tpartition\n\t.type\tpartition, @function\npartition:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L2\n.L4:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L3\n\taddl\t$1, -16(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-16(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n.L3:\n\taddl\t$1, -12(%rbp)\n.L2:\n\tmovl\t-12(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjl\t.L4\n\tmovl\t-16(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-16(%rbp), %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovslq\t%ecx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-24(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tX(%rip), %rdx\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-16(%rbp), %eax\n\taddl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tpartition, .-partition\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tleaq\tnum(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -8(%rbp)\n.L7:\n\tmovl\tnum(%rip), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L8\n\tmovl\tnum(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %esi\n\tmovl\t$0, %edi\n\tcall\tpartition\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L9\n.L13:\n\tcmpl\t$0, -8(%rbp)\n\tje\t.L10\n\tmovl\t$32, %edi\n\tcall\tputchar@PLT\n.L10:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjne\t.L11\n\tmovl\t$91, %edi\n\tcall\tputchar@PLT\n.L11:\n\tmovl\t-8(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tX(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjne\t.L12\n\tmovl\t$93, %edi\n\tcall\tputchar@PLT\n.L12:\n\taddl\t$1, -8(%rbp)\n.L9:\n\tmovl\tnum(%rip), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjl\t.L13\n\tmovl\t$10, %edi\n\tcall\tputchar@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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[i] = X[j]; X[j] = m; } } m= X[i+1]; X[i + 1] = X[r]; X[r] =m; return i+1; } int main(){ int i,q; scanf("%d",&num); for(i=0;i<num;i++){ scanf("%d",&X[i]); } q= partition(0,num-1); for(i=0;i<num;i++){ if(i){ printf(" "); } if(i == q){ printf("["); } printf("%d",X[i]); if(i==q){ printf("]"); } } printf("\n"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl X .bss .align 32 .type X, @object .size X, 400000 X: .zero 400000 .globl num .align 4 .type num, @object .size num, 4 num: .zero 4 .text .globl partition .type partition, @function partition: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl -24(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -8(%rbp) movl -20(%rbp), %eax subl $1, %eax movl %eax, -16(%rbp) movl -20(%rbp), %eax movl %eax, -12(%rbp) jmp .L2 .L4: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -8(%rbp) jl .L3 addl $1, -16(%rbp) movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -4(%rbp) movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax movl -16(%rbp), %edx movslq %edx, %rdx leaq 0(,%rdx,4), %rcx leaq X(%rip), %rdx movl %eax, (%rcx,%rdx) movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rcx leaq X(%rip), %rdx movl -4(%rbp), %eax movl %eax, (%rcx,%rdx) .L3: addl $1, -12(%rbp) .L2: movl -12(%rbp), %eax cmpl -24(%rbp), %eax jl .L4 movl -16(%rbp), %eax addl $1, %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -4(%rbp) movl -16(%rbp), %eax leal 1(%rax), %ecx movl -24(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax movslq %ecx, %rdx leaq 0(,%rdx,4), %rcx leaq X(%rip), %rdx movl %eax, (%rcx,%rdx) movl -24(%rbp), %eax cltq leaq 0(,%rax,4), %rcx leaq X(%rip), %rdx movl -4(%rbp), %eax movl %eax, (%rcx,%rdx) movl -16(%rbp), %eax addl $1, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size partition, .-partition .section .rodata .LC0: .string "%d" .text .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp leaq num(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -8(%rbp) jmp .L7 .L8: movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -8(%rbp) .L7: movl num(%rip), %eax cmpl %eax, -8(%rbp) jl .L8 movl num(%rip), %eax subl $1, %eax movl %eax, %esi movl $0, %edi call partition movl %eax, -4(%rbp) movl $0, -8(%rbp) jmp .L9 .L13: cmpl $0, -8(%rbp) je .L10 movl $32, %edi call putchar@PLT .L10: movl -8(%rbp), %eax cmpl -4(%rbp), %eax jne .L11 movl $91, %edi call putchar@PLT .L11: movl -8(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq X(%rip), %rax movl (%rdx,%rax), %eax movl %eax, %esi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl -8(%rbp), %eax cmpl -4(%rbp), %eax jne .L12 movl $93, %edi call putchar@PLT .L12: addl $1, -8(%rbp) .L9: movl num(%rip), %eax cmpl %eax, -8(%rbp) jl .L13 movl $10, %edi call putchar@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<stdint.h>\n#include<inttypes.h>\n#include<string.h>\n\ntypedef int32_t flow_type;\n\nconst flow_type flow_inf = 1000 * 1000;\n\ntypedef struct flow_edge {\n int32_t vertex;\n int32_t next;\n flow_type capacity;\n} flow_edge;\n\ntypedef struct maxFlowGraph {\n flow_edge *edge;\n int32_t *start;\n int32_t vertex_num;\n int32_t pointer;\n int32_t edge_length;\n} graph;\n\ngraph* new_graph (const int32_t vertex_num) {\n graph *g = (graph *) calloc (1, sizeof (graph));\n g->vertex_num = vertex_num;\n const int32_t initial_length = 4;\n g->edge = (flow_edge *) calloc (initial_length, sizeof (flow_edge));\n g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n g->pointer = 0;\n g->edge_length = initial_length;\n for (int32_t i = 0; i < vertex_num; ++i) {\n g->start[i] = -1;\n }\n return g;\n}\n\nvoid add_edge (graph * const g, const int32_t from, const int32_t to, const flow_type capa) {\n //printf (\"edge %\" PRIi32 \" -> %\" PRIi32 \", %\" PRIi32 \"\\n\", from, to, capa);\n if (g->pointer == g->edge_length) {\n g->edge_length *= 2;\n g->edge = (flow_edge *) realloc (g->edge, sizeof (flow_edge) * g->edge_length);\n }\n const int32_t p = g->pointer;\n g->edge[p] = (flow_edge) {to, g->start[from], capa};\n g->start[from] = p;\n g->edge[p + 1] = (flow_edge) {from, g->start[to], 0};\n g->start[to] = p + 1;\n g->pointer += 2;\n}\n\nflow_type dinic_dfs (const int32_t v, const graph * const g, const int32_t dst, const int32_t * const level, int32_t * const iter, flow_type e) {\n if (v == dst) return e;\n flow_type sum = 0;\n for (int32_t p = iter[v]; p != -1; p = g->edge[p].next, iter[v] = p) {\n const int32_t u = g->edge[p].vertex;\n const flow_type capa = g->edge[p].capacity;\n if (level[u] <= level[v] || capa <= 0) continue;\n const flow_type f = dinic_dfs (u, g, dst, level, iter, capa < e ? capa : e);\n if (f > 0) {\n g->edge[p].capacity -= f;\n g->edge[p ^ 1].capacity += f;\n sum += f;\n e -= f;\n if (e <= 0) return sum;\n }\n }\n return sum;\n}\n\nflow_type dinic (const graph * const g, const int32_t src, const int32_t dst) {\n const int32_t vertex_num = g->vertex_num;\n int32_t * const level = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n int32_t * const queue = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n int32_t * const iter = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n flow_type flow = 0;\n while (1) {\n memset (level, 0, sizeof (int32_t) * vertex_num);\n int32_t front = 0;\n int32_t last = 0;\n level[dst] = vertex_num;\n queue[last++] = dst;\n while (front < last && level[src] == 0) {\n const int32_t v = queue[front++];\n for (int32_t p = g->start[v]; p!=-1; p = g->edge[p].next) {\n const int32_t u = g->edge[p].vertex;\n if (g->edge[p ^ 1].capacity > 0 && level[u] == 0) {\n level[u] = level[v] - 1;\n queue[last++] = u;\n }\n }\n }\n if (level[src] == 0) break;\n memcpy (iter, g->start, sizeof (int32_t) * vertex_num);\n while (1) {\n flow_type f = dinic_dfs (src, g, dst, level, iter, flow_inf);\n if (f <= 0) break;\n flow += f;\n }\n }\n free (level);\n free (queue);\n free (iter);\n return flow;\n}\n\ntypedef int32_t i32;\n\nvoid run (void) {\n i32 n, m;\n scanf (\"%\" SCNi32 \"%\" SCNi32, &n, &m);\n char *u = (char *) calloc (n + 1, sizeof (char));\n scanf (\"%s\", u);\n graph *g = new_graph (n + 2);\n const i32 src = 0;\n const i32 dst = n + 1;\n for (i32 i = 1; i <= n; ++i) {\n i32 a;\n scanf (\"%\" SCNi32, &a);\n if (u[i - 1] =='R') {\n add_edge (g, src, i, a);\n } else {\n add_edge (g, i, dst, a);\n }\n }\n while (m--) {\n i32 s, t, b;\n scanf (\"%\" SCNi32 \"%\" SCNi32 \"%\" SCNi32, &s, &t, &b);\n if (s > t) {\n i32 swap = s;\n s = t;\n t = swap;\n }\n add_edge (g, s, t, b);\n }\n i32 ans = dinic (g, src, dst);\n printf (\"%\" PRIi32 \"\\n\", ans);\n}\n\nint main (void) {\n run ();\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tflow_inf\n\t.section\t.rodata\n\t.align 4\n\t.type\tflow_inf, @object\n\t.size\tflow_inf, 4\nflow_inf:\n\t.long\t1000000\n\t.text\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-20(%rbp), %edx\n\tmovl\t%edx, 16(%rax)\n\tmovl\t$4, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tmovl\t$12, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, 20(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-12(%rbp), %edx\n\tmovl\t%edx, 24(%rax)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$-1, (%rax)\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L3\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnew_graph, .-new_graph\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t%edx, -32(%rbp)\n\tmovl\t%ecx, -36(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t20(%rax), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L6\n\tmovq\t-24(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, 24(%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\trealloc@PLT\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n.L6:\n\tmovq\t-24(%rbp), %rax\n\tmovl\t20(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-28(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t-32(%rbp), %ecx\n\tmovl\t%ecx, (%rax)\n\tmovl\t%edx, 4(%rax)\n\tmovl\t-36(%rbp), %edx\n\tmovl\t%edx, 8(%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-32(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t-28(%rbp), %ecx\n\tmovl\t%ecx, (%rax)\n\tmovl\t%edx, 4(%rax)\n\tmovl\t$0, 8(%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-16(%rbp), %edx\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t20(%rax), %eax\n\tleal\t2(%rax), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, 20(%rax)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tadd_edge, .-add_edge\n\t.globl\tdinic_dfs\n\t.type\tdinic_dfs, @function\ndinic_dfs:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovl\t%edi, -36(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovl\t%edx, -40(%rbp)\n\tmovq\t%rcx, -56(%rbp)\n\tmovq\t%r8, -64(%rbp)\n\tmovl\t%r9d, -68(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjne\t.L8\n\tmovl\t-68(%rbp), %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$0, -20(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L10\n.L14:\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L15\n\tcmpl\t$0, -8(%rbp)\n\tjle\t.L15\n\tmovl\t-68(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t%eax, %r8d\n\tmovq\t-64(%rbp), %rdi\n\tmovq\t-56(%rbp), %rcx\n\tmovl\t-40(%rbp), %edx\n\tmovq\t-48(%rbp), %rsi\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%r8d, %r9d\n\tmovq\t%rdi, %r8\n\tmovl\t%eax, %edi\n\tcall\tdinic_dfs\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tjle\t.L13\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rsi\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\tleaq\t(%rsi,%rax), %rcx\n\tmovl\t%edx, %eax\n\tsubl\t-4(%rbp), %eax\n\tmovl\t%eax, 8(%rcx)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\txorl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %ecx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rsi\n\tmovl\t-16(%rbp), %eax\n\txorl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\tmovl\t-4(%rbp), %edx\n\taddl\t%ecx, %edx\n\tmovl\t%edx, 8(%rax)\n\tmovl\t-4(%rbp), %eax\n\taddl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tsubl\t%eax, -68(%rbp)\n\tcmpl\t$0, -68(%rbp)\n\tjg\t.L13\n\tmovl\t-20(%rbp), %eax\n\tjmp\t.L9\n.L15:\n\tnop\n.L13:\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n.L10:\n\tcmpl\t$-1, -16(%rbp)\n\tjne\t.L14\n\tmovl\t-20(%rbp), %eax\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tdinic_dfs, .-dinic_dfs\n\t.globl\tdinic\n\t.type\tdinic, @function\ndinic:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovq\t%rdi, -72(%rbp)\n\tmovl\t%esi, -76(%rbp)\n\tmovl\t%edx, -80(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovl\t16(%rax), %eax\n\tmovl\t%eax, -40(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$0, -56(%rbp)\n.L28:\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, -52(%rbp)\n\tmovl\t$0, -48(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-40(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-48(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -48(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-80(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tjmp\t.L17\n.L22:\n\tmovl\t-52(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -36(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -44(%rbp)\n\tjmp\t.L18\n.L20:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-44(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -32(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-44(%rbp), %eax\n\txorl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L19\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L19\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tsubl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tmovl\t-48(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -48(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n.L19:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-44(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -44(%rbp)\n.L18:\n\tcmpl\t$-1, -44(%rbp)\n\tjne\t.L20\n.L17:\n\tmovl\t-52(%rbp), %eax\n\tcmpl\t-48(%rbp), %eax\n\tjge\t.L21\n\tmovl\t-76(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\ttestl\t%eax, %eax\n\tje\t.L22\n.L21:\n\tmovl\t-76(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\ttestl\t%eax, %eax\n\tje\t.L32\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmemcpy@PLT\n.L27:\n\tmovl\t$1000000, %r8d\n\tmovq\t-8(%rbp), %rdi\n\tmovq\t-24(%rbp), %rcx\n\tmovl\t-80(%rbp), %edx\n\tmovq\t-72(%rbp), %rsi\n\tmovl\t-76(%rbp), %eax\n\tmovl\t%r8d, %r9d\n\tmovq\t%rdi, %r8\n\tmovl\t%eax, %edi\n\tcall\tdinic_dfs\n\tmovl\t%eax, -28(%rbp)\n\tcmpl\t$0, -28(%rbp)\n\tjle\t.L33\n\tmovl\t-28(%rbp), %eax\n\taddl\t%eax, -56(%rbp)\n\tjmp\t.L27\n.L33:\n\tnop\n\tjmp\t.L28\n.L32:\n\tnop\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovl\t-56(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tdinic, .-dinic\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%i%i\"\n.LC1:\n\t.string\t\"%s\"\n.LC2:\n\t.string\t\"%i\"\n.LC3:\n\t.string\t\"%i%i%i\"\n.LC4:\n\t.string\t\"%i\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-60(%rbp), %rdx\n\tleaq\t-64(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-64(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$1, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-64(%rbp), %eax\n\taddl\t$2, %eax\n\tmovl\t%eax, %edi\n\tcall\tnew_graph\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t$0, -40(%rbp)\n\tmovl\t-64(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t$1, -44(%rbp)\n\tjmp\t.L35\n.L38:\n\tleaq\t-48(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-44(%rbp), %eax\n\tcltq\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$82, %al\n\tjne\t.L36\n\tmovl\t-48(%rbp), %ecx\n\tmovl\t-44(%rbp), %edx\n\tmovl\t-40(%rbp), %esi\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n\tjmp\t.L37\n.L36:\n\tmovl\t-48(%rbp), %ecx\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-44(%rbp), %esi\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n.L37:\n\taddl\t$1, -44(%rbp)\n.L35:\n\tmovl\t-64(%rbp), %eax\n\tcmpl\t%eax, -44(%rbp)\n\tjle\t.L38\n\tjmp\t.L39\n.L41:\n\tleaq\t-48(%rbp), %rcx\n\tleaq\t-52(%rbp), %rdx\n\tleaq\t-56(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-56(%rbp), %edx\n\tmovl\t-52(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L40\n\tmovl\t-56(%rbp), %eax\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, -56(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -52(%rbp)\n.L40:\n\tmovl\t-48(%rbp), %ecx\n\tmovl\t-52(%rbp), %edx\n\tmovl\t-56(%rbp), %esi\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n.L39:\n\tmovl\t-60(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -60(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L41\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-40(%rbp), %ecx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tdinic\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L42\n\tcall\t__stack_chk_fail@PLT\n.L42:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tmovslq\t%edi, %rbp\n\tmovl\t$1, %edi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\tcalloc@PLT\n\tmovl\t$12, %esi\n\tmovl\t$4, %edi\n\tmovl\t%ebp, 16(%rax)\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, (%r12)\n\tcall\tcalloc@PLT\n\tmovq\t%rax, 8(%r12)\n\tmovq\t%rax, %rdi\n\tmovq\t.LC0(%rip), %rax\n\tmovq\t%rax, 20(%r12)\n\ttestl\t%ebp, %ebp\n\tjle\t.L1\n\tleaq\t0(,%rbp,4), %rdx\n\tmovl\t$255, %esi\n\tcall\tmemset@PLT\n.L1:\n\tmovq\t%r12, %rax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tnew_graph, .-new_graph\n\t.p2align 4\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t%ecx, %r13d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovl\t%esi, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tmovslq\t%edx, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rdi, %rbx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovl\t20(%rdi), %eax\n\tmovq\t(%rdi), %rdi\n\tcmpl\t24(%rbx), %eax\n\tje\t.L8\n.L6:\n\tmovq\t8(%rbx), %rsi\n\tmovslq\t%eax, %rdx\n\tmovslq\t%r12d, %r8\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rsi,%r8,4), %r8\n\tsalq\t$2, %rdx\n\tmovl\t(%r8), %r9d\n\tleaq\t(%rdi,%rdx), %rcx\n\tleaq\t12(%rdi,%rdx), %rdx\n\tmovl\t%ebp, (%rcx)\n\tmovl\t%r9d, 4(%rcx)\n\tmovl\t%r13d, 8(%rcx)\n\tleaq\t(%rsi,%rbp,4), %rcx\n\tmovl\t%eax, (%r8)\n\tmovl\t(%rcx), %esi\n\taddl\t$1, %eax\n\tmovl\t%r12d, (%rdx)\n\tmovl\t%esi, 4(%rdx)\n\tmovl\t$0, 8(%rdx)\n\tmovl\t%eax, (%rcx)\n\taddl\t$2, 20(%rbx)\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\t.cfi_restore_state\n\taddl\t%eax, %eax\n\tmovl\t%eax, 24(%rbx)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rax, %rdi\n\tmovl\t20(%rbx), %eax\n\tjmp\t.L6\n\t.cfi_endproc\n.LFE52:\n\t.size\tadd_edge, .-add_edge\n\t.p2align 4\n\t.globl\tdinic_dfs\n\t.type\tdinic_dfs, @function\ndinic_dfs:\n.LFB53:\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\tmovl\t%r9d, %r14d\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovslq\t%edi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tcmpl\t%edx, %r12d\n\tje\t.L9\n\tsalq\t$2, %r12\n\tleaq\t(%r8,%r12), %r15\n\tmovl\t(%r15), %ebx\n\tcmpl\t$-1, %ebx\n\tje\t.L14\n\taddq\t%rcx, %r12\n\tmovq\t(%rsi), %r13\n\tmovq\t%r15, %r10\n\txorl\t%r11d, %r11d\n\tmovq\t%r12, %r14\n\tmovl\t%r9d, %r15d\n\tmovq\t%rcx, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t%ebx, %rax\n\tmovl\t(%r14), %ecx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t0(%r13,%rax,4), %rbp\n\tmovslq\t0(%rbp), %rax\n\tmovl\t8(%rbp), %r9d\n\tmovq\t%rax, %rdi\n\tcmpl\t%ecx, (%r12,%rax,4)\n\tjle\t.L11\n\ttestl\t%r9d, %r9d\n\tjle\t.L11\n\tcmpl\t%r9d, %r15d\n\tmovq\t%r12, %rcx\n\tmovl\t%r11d, 28(%rsp)\n\tcmovle\t%r15d, %r9d\n\tmovq\t%r10, 16(%rsp)\n\tmovq\t%r8, 8(%rsp)\n\tmovl\t%edx, 24(%rsp)\n\tmovq\t%rsi, (%rsp)\n\tcall\tdinic_dfs\n\tmovq\t(%rsp), %rsi\n\tmovl\t24(%rsp), %edx\n\ttestl\t%eax, %eax\n\tmovq\t8(%rsp), %r8\n\tmovq\t16(%rsp), %r10\n\tmovl\t28(%rsp), %r11d\n\tjle\t.L11\n\txorl\t$1, %ebx\n\tsubl\t%eax, %r15d\n\tsubl\t%eax, 8(%rbp)\n\taddl\t%eax, %r11d\n\tmovslq\t%ebx, %rbx\n\tleaq\t(%rbx,%rbx,2), %rcx\n\taddl\t%eax, 8(%r13,%rcx,4)\n\ttestl\t%r15d, %r15d\n\tjle\t.L16\n.L11:\n\tmovl\t4(%rbp), %ebx\n\tmovl\t%ebx, (%r10)\n\tcmpl\t$-1, %ebx\n\tjne\t.L12\n.L16:\n\tmovl\t%r11d, %r14d\n.L9:\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovl\t%r14d, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\t.cfi_restore_state\n\txorl\t%r14d, %r14d\n\tjmp\t.L9\n\t.cfi_endproc\n.LFE53:\n\t.size\tdinic_dfs, .-dinic_dfs\n\t.p2align 4\n\t.globl\tdinic\n\t.type\tdinic, @function\ndinic:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t%edx, %r15d\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tmovl\t%esi, %r14d\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovslq\t16(%rdi), %rbx\n\tmovl\t%esi, 36(%rsp)\n\tmovl\t$4, %esi\n\tmovq\t%rdi, 8(%rsp)\n\tmovq\t%rbx, %rdi\n\tmovl\t%edx, 20(%rsp)\n\tmovl\t%ebx, 68(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, (%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, 48(%rsp)\n\tcall\tcalloc@PLT\n\tmovq\t(%rsp), %rcx\n\tmovq\t8(%rsp), %r11\n\tmovl\t$0, 64(%rsp)\n\tmovq\t%rax, 24(%rsp)\n\tleaq\t0(,%rbx,4), %rax\n\tmovq\t%rax, 40(%rsp)\n\tmovslq\t%r15d, %rax\n\tleaq\t(%rcx,%rax,4), %rax\n\tmovq\t%rax, 56(%rsp)\n\tmovslq\t%r14d, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, 72(%rsp)\n\tleaq\t(%rcx,%rax), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovq\t40(%rsp), %rdx\n\tmovq\t%rcx, %rdi\n\txorl\t%esi, %esi\n\tmovq\t%r11, (%rsp)\n\tcall\tmemset@PLT\n\tmovl\t68(%rsp), %edi\n\tmovq\t(%rsp), %r11\n\tmovl\t$1, %r10d\n\tmovq\t%rax, %rcx\n\tmovq\t56(%rsp), %rax\n\tmovl\t$1, %r9d\n\tmovq\t8(%r11), %rbp\n\tmovl\t%edi, (%rax)\n\tmovl\t20(%rsp), %eax\n\tmovq\t48(%rsp), %rdi\n\tmovl\t%eax, (%rdi)\n\tmovl\t(%r14), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tmovslq\t-4(%rdi,%r10,4), %rax\n\tleaq\t0(,%rax,4), %r8\n\tmovl\t0(%rbp,%rax,4), %eax\n\tcmpl\t$-1, %eax\n\tje\t.L20\n\tmovq\t(%r11), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\tmovslq\t%eax, %rdx\n\txorl\t$1, %eax\n\tcltq\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%rsi,%rdx,4), %rdx\n\tmovl\t8(%rsi,%rax,4), %r13d\n\ttestl\t%r13d, %r13d\n\tjle\t.L21\n\tmovslq\t(%rdx), %rbx\n\tmovq\t%rbx, %rax\n\tleaq\t(%rcx,%rbx,4), %rbx\n\tmovl\t(%rbx), %r12d\n\ttestl\t%r12d, %r12d\n\tjne\t.L21\n\tmovl\t(%rcx,%r8), %r15d\n\tleal\t-1(%r15), %r12d\n\tmovl\t%r12d, (%rbx)\n\tmovslq\t%r9d, %rbx\n\taddl\t$1, %r9d\n\tmovl\t%eax, (%rdi,%rbx,4)\n.L21:\n\tmovl\t4(%rdx), %eax\n\tcmpl\t$-1, %eax\n\tjne\t.L22\n\tmovl\t(%r14), %eax\n\tcmpl\t%r10d, %r9d\n\tjle\t.L23\n\taddq\t$1, %r10\n\ttestl\t%eax, %eax\n\tje\t.L24\n.L27:\n\tmovq\t24(%rsp), %r15\n\tmovq\t40(%rsp), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%rcx, (%rsp)\n\tmovq\t%r11, 8(%rsp)\n\tmovq\t%r15, %rdi\n\tcall\tmemcpy@PLT\n\taddq\t72(%rsp), %r15\n\tmovq\t8(%rsp), %rsi\n\tmovq\t%r15, %r10\n\tmovl\t36(%rsp), %ecx\n\tmovq\t(%rsp), %r15\n\tcmpl\t%ecx, 20(%rsp)\n\tje\t.L34\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovl\t(%r10), %ebx\n\tcmpl\t$-1, %ebx\n\tje\t.L47\n\txorl\t%r11d, %r11d\n\tmovq\t(%rsi), %r13\n\tmovl\t$1000000, %r12d\n\tmovl\t%r11d, 32(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tmovslq\t%ebx, %rax\n\tmovl\t(%r14), %ecx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t0(%r13,%rax,4), %rbp\n\tmovslq\t0(%rbp), %rax\n\tmovl\t8(%rbp), %r9d\n\tmovq\t%rax, %rdi\n\tcmpl\t%ecx, (%r15,%rax,4)\n\tjle\t.L31\n\ttestl\t%r9d, %r9d\n\tjle\t.L31\n\tcmpl\t%r12d, %r9d\n\tmovq\t24(%rsp), %r8\n\tmovl\t20(%rsp), %edx\n\tmovq\t%r15, %rcx\n\tcmovg\t%r12d, %r9d\n\tmovq\t%r10, 8(%rsp)\n\tmovq\t%rsi, (%rsp)\n\tcall\tdinic_dfs\n\tmovq\t(%rsp), %rsi\n\tmovq\t8(%rsp), %r10\n\ttestl\t%eax, %eax\n\tjle\t.L31\n\txorl\t$1, %ebx\n\tsubl\t%eax, %r12d\n\tsubl\t%eax, 8(%rbp)\n\tmovslq\t%ebx, %rbx\n\taddl\t%eax, 32(%rsp)\n\tleaq\t(%rbx,%rbx,2), %rdx\n\taddl\t%eax, 8(%r13,%rdx,4)\n\ttestl\t%r12d, %r12d\n\tjle\t.L48\n.L31:\n\tmovl\t4(%rbp), %ebx\n\tmovl\t%ebx, (%r10)\n\tcmpl\t$-1, %ebx\n\tjne\t.L32\n\tmovl\t32(%rsp), %r11d\n\ttestl\t%r11d, %r11d\n\tje\t.L47\n.L28:\n\taddl\t%r11d, 64(%rsp)\n\tmovl\t36(%rsp), %ecx\n\tcmpl\t%ecx, 20(%rsp)\n\tjne\t.L51\n.L34:\n\tmovl\t$1000000, %r11d\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tcmpl\t%r10d, %r9d\n\tjle\t.L26\n\taddq\t$1, %r10\n\tjmp\t.L24\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovl\t32(%rsp), %r11d\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\tmovq\t%r15, %rcx\n\tmovq\t%rsi, %r11\n\tjmp\t.L30\n.L23:\n\ttestl\t%eax, %eax\n\tjne\t.L27\n.L26:\n\tmovq\t%rcx, %rdi\n\tcall\tfree@PLT\n\tmovq\t48(%rsp), %rdi\n\tcall\tfree@PLT\n\tmovq\t24(%rsp), %rdi\n\tcall\tfree@PLT\n\tmovl\t64(%rsp), %eax\n\taddq\t$88, %rsp\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tdinic, .-dinic\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%i%i\"\n.LC2:\n\t.string\t\"%s\"\n.LC3:\n\t.string\t\"%i\"\n.LC4:\n\t.string\t\"%i%i%i\"\n.LC5:\n\t.string\t\"%i\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC1(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 72(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t56(%rsp), %rdx\n\tleaq\t52(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %eax\n\tmovl\t$1, %esi\n\tleal\t1(%rax), %edi\n\tmovslq\t%edi, %rdi\n\tcall\tcalloc@PLT\n\tleaq\t.LC2(%rip), %rdi\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, %r12\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %ebp\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$12, %esi\n\tmovl\t$4, %edi\n\tleal\t2(%rbp), %ebx\n\tmovq\t%rax, %r15\n\tmovl\t%ebx, 16(%rax)\n\tcall\tcalloc@PLT\n\tmovslq\t%ebx, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, (%r15)\n\tcall\tcalloc@PLT\n\tmovq\t%rax, 8(%r15)\n\tmovq\t%rax, %rdi\n\tmovq\t.LC0(%rip), %rax\n\tmovq\t%rax, 20(%r15)\n\ttestl\t%ebx, %ebx\n\tjle\t.L100\n\tleal\t1(%rbp), %eax\n\tmovl\t$255, %esi\n\tleaq\t4(,%rax,4), %rdx\n\tmovl\t%eax, 12(%rsp)\n\tcall\tmemset@PLT\n.L56:\n\tmovslq\t12(%rsp), %rax\n\tmovl\t$1, %r14d\n\tleaq\t68(%rsp), %rbx\n\tleaq\t.LC3(%rip), %r13\n\tsalq\t$2, %rax\n\tmovq\t%rax, (%rsp)\n\ttestl\t%ebp, %ebp\n\tjle\t.L55\n\tmovq\t%r14, %rax\n\tmovq\t%r15, %r14\n\tmovq\t%rax, %r15\n\tjmp\t.L54\n.L59:\n\tmovq\t(%r14), %r10\n\tcmpl\t24(%r14), %eax\n\tje\t.L101\n.L62:\n\tmovslq\t%eax, %rsi\n\tleaq\t(%rsi,%rsi,2), %rdi\n\tmovq\t8(%r14), %rsi\n\tsalq\t$2, %rdi\n\tleaq\t(%rsi,%r15,4), %r11\n\tleaq\t(%r10,%rdi), %r9\n\taddq\t(%rsp), %rsi\n\taddq\t$1, %r15\n\tmovl\t(%r11), %ecx\n\tmovl\t%r8d, 8(%r9)\n\tleaq\t12(%r10,%rdi), %rdi\n\tmovl\t%ecx, 4(%r9)\n\tmovl\t12(%rsp), %ecx\n\tmovl\t%ecx, (%r9)\n\tmovl\t%eax, (%r11)\n\tmovl\t(%rsi), %r8d\n\taddl\t$1, %eax\n\tmovl\t%ebp, (%rdi)\n\tmovl\t%r8d, 4(%rdi)\n\tmovl\t$0, 8(%rdi)\n\tmovl\t%eax, (%rsi)\n\tmovl\t20(%r14), %eax\n\taddl\t$2, %eax\n\tmovl\t%eax, 20(%r14)\n\tcmpl\t%r15d, 52(%rsp)\n\tjl\t.L102\n.L54:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\tmovl\t%r15d, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tcmpb\t$82, -1(%r12,%r15)\n\tmovl\t68(%rsp), %r8d\n\tmovl\t20(%r14), %eax\n\tjne\t.L59\n\tmovq\t(%r14), %rdi\n\tcmpl\t24(%r14), %eax\n\tje\t.L103\n.L60:\n\tmovq\t8(%r14), %r9\n\tmovslq\t%eax, %rsi\n\tmovd\t%ebp, %xmm0\n\tleaq\t(%rsi,%rsi,2), %rsi\n\tmovd\t(%r9), %xmm1\n\tsalq\t$2, %rsi\n\tleaq\t(%rdi,%rsi), %r10\n\tleaq\t12(%rdi,%rsi), %rsi\n\tpunpckldq\t%xmm1, %xmm0\n\tleaq\t(%r9,%r15,4), %rdi\n\tmovl\t%r8d, 8(%r10)\n\taddq\t$1, %r15\n\tmovq\t%xmm0, (%r10)\n\tmovl\t%eax, (%r9)\n\tmovl\t(%rdi), %r8d\n\taddl\t$1, %eax\n\tmovl\t$0, (%rsi)\n\tmovl\t%r8d, 4(%rsi)\n\tmovl\t$0, 8(%rsi)\n\tmovl\t%eax, (%rdi)\n\tmovl\t20(%r14), %eax\n\taddl\t$2, %eax\n\tmovl\t%eax, 20(%r14)\n\tcmpl\t%r15d, 52(%rsp)\n\tjge\t.L54\n.L102:\n\tmovq\t%r14, %r15\n.L55:\n\tmovl\t56(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 56(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L58\n\tleaq\t68(%rsp), %rbx\n\tleaq\t64(%rsp), %r13\n\tleaq\t60(%rsp), %r12\n\tleaq\t.LC4(%rip), %rbp\n\tjmp\t.L57\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\tmovq\t8(%r15), %r9\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %r10\n\tleaq\t(%rcx,%rcx,2), %rcx\n\tleaq\t(%r9,%r10,4), %r10\n\tsalq\t$2, %rcx\n\tmovl\t(%r10), %r11d\n\tleaq\t(%rdi,%rcx), %rsi\n\tleaq\t12(%rdi,%rcx), %rcx\n\tmovl\t%r14d, (%rsi)\n\tmovl\t%r11d, 4(%rsi)\n\tmovl\t%r8d, 8(%rsi)\n\tleaq\t(%r9,%r14,4), %rsi\n\tmovl\t%eax, (%r10)\n\tmovl\t(%rsi), %edi\n\taddl\t$1, %eax\n\tmovl\t%edx, (%rcx)\n\tmovl\t%edi, 4(%rcx)\n\tmovl\t$0, 8(%rcx)\n\tmovl\t%eax, (%rsi)\n\tmovl\t56(%rsp), %eax\n\taddl\t$2, 20(%r15)\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 56(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L58\n.L57:\n\tmovq\t%r13, %rdx\n\tmovq\t%rbx, %rcx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t60(%rsp), %edx\n\tmovslq\t64(%rsp), %r14\n\tcmpl\t%r14d, %edx\n\tjle\t.L64\n\tmovl\t%r14d, %eax\n\tmovl\t%r14d, 60(%rsp)\n\tmovslq\t%edx, %r14\n\tmovl\t%edx, 64(%rsp)\n\tmovl\t%eax, %edx\n.L64:\n\tmovl\t68(%rsp), %r8d\n\tmovl\t20(%r15), %eax\n\tmovq\t(%r15), %rdi\n\tcmpl\t24(%r15), %eax\n\tjne\t.L65\n\taddl\t%eax, %eax\n\tmovl\t%r8d, 32(%rsp)\n\tmovl\t%eax, 24(%r15)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tmovl\t%edx, 8(%rsp)\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovl\t32(%rsp), %r8d\n\tmovl\t8(%rsp), %edx\n\tmovq\t%rax, (%r15)\n\tmovq\t%rax, %rdi\n\tmovl\t20(%r15), %eax\n\tjmp\t.L65\n.L101:\n\taddl\t%eax, %eax\n\tmovq\t%r10, %rdi\n\tmovl\t%r8d, 8(%rsp)\n\tmovl\t%eax, 24(%r14)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovl\t8(%rsp), %r8d\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %r10\n\tmovl\t20(%r14), %eax\n\tjmp\t.L62\n.L58:\n\tmovslq\t16(%r15), %rbx\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovl\t%ebx, 36(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, %r14\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, 24(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$0, 32(%rsp)\n\tmovq\t%rax, %r13\n\tleaq\t0(,%rbx,4), %rax\n\tmovq\t%rax, 16(%rsp)\n\tmovq\t(%rsp), %rax\n\taddq\t%r14, %rax\n\tmovq\t%rax, 40(%rsp)\n\tmovq\t%r14, %rax\n\tmovq\t%r15, %r14\n\tmovq\t%rax, %r15\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovq\t16(%rsp), %rdx\n\txorl\t%esi, %esi\n\tmovq\t%r15, %rdi\n\tcall\tmemset@PLT\n\tmovq\t40(%rsp), %rax\n\tmovl\t36(%rsp), %ecx\n\tmovl\t$1, %r9d\n\tmovq\t24(%rsp), %rsi\n\tmovq\t8(%r14), %r10\n\tmovl\t$1, %edi\n\tmovl\t%ecx, (%rax)\n\tmovl\t12(%rsp), %eax\n\tmovl\t%eax, (%rsi)\n\tmovl\t(%r15), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L74\n\t.p2align 4,,10\n\t.p2align 3\n.L71:\n\tmovslq\t-4(%rsi,%r9,4), %rax\n\tleaq\t0(,%rax,4), %r8\n\tmovl\t(%r10,%rax,4), %eax\n\tcmpl\t$-1, %eax\n\tje\t.L67\n\tmovq\t(%r14), %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L69:\n\tmovslq\t%eax, %rdx\n\txorl\t$1, %eax\n\tcltq\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%rcx,%rdx,4), %rdx\n\tmovl\t8(%rcx,%rax,4), %ebp\n\ttestl\t%ebp, %ebp\n\tjle\t.L68\n\tmovslq\t(%rdx), %r11\n\tmovq\t%r11, %rax\n\tleaq\t(%r15,%r11,4), %r11\n\tmovl\t(%r11), %ebx\n\ttestl\t%ebx, %ebx\n\tjne\t.L68\n\tmovl\t(%r15,%r8), %ebx\n\tsubl\t$1, %ebx\n\tmovl\t%ebx, (%r11)\n\tmovslq\t%edi, %r11\n\taddl\t$1, %edi\n\tmovl\t%eax, (%rsi,%r11,4)\n.L68:\n\tmovl\t4(%rdx), %eax\n\tcmpl\t$-1, %eax\n\tjne\t.L69\n\tmovl\t(%r15), %eax\n\tcmpl\t%r9d, %edi\n\tjle\t.L70\n\taddq\t$1, %r9\n\ttestl\t%eax, %eax\n\tje\t.L71\n.L74:\n\tmovq\t16(%rsp), %rdx\n\tmovq\t%r13, %rdi\n\tmovq\t%r10, %rsi\n\tcall\tmemcpy@PLT\n\tmovl\t0(%r13), %ebx\n\tmovq\t%r14, %r13\n\tmovq\t%rax, %r14\n\tmovl\t12(%rsp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L82\n.L105:\n\tcmpl\t$-1, %ebx\n\tje\t.L97\n\tmovl\t$0, 8(%rsp)\n\tmovq\t0(%r13), %r10\n\tmovl\t$1000000, %r12d\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovslq\t%ebx, %rax\n\tmovl\t(%r15), %esi\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%r10,%rax,4), %rbp\n\tmovslq\t0(%rbp), %rax\n\tmovl\t8(%rbp), %r9d\n\tmovq\t%rax, %rdi\n\tcmpl\t%esi, (%r15,%rax,4)\n\tjle\t.L77\n\ttestl\t%r9d, %r9d\n\tjle\t.L77\n\tcmpl\t%r12d, %r9d\n\tmovl\t12(%rsp), %edx\n\tmovq\t%r14, %r8\n\tmovq\t%r15, %rcx\n\tcmovg\t%r12d, %r9d\n\tmovq\t%r13, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tdinic_dfs\n\tmovq\t(%rsp), %r10\n\ttestl\t%eax, %eax\n\tjle\t.L77\n\txorl\t$1, %ebx\n\tsubl\t%eax, %r12d\n\tsubl\t%eax, 8(%rbp)\n\tmovslq\t%ebx, %rbx\n\taddl\t%eax, 8(%rsp)\n\tleaq\t(%rbx,%rbx,2), %rdx\n\taddl\t%eax, 8(%r10,%rdx,4)\n\ttestl\t%r12d, %r12d\n\tjle\t.L104\n.L77:\n\tmovl\t4(%rbp), %ebx\n\tmovl\t%ebx, (%r14)\n\tcmpl\t$-1, %ebx\n\tjne\t.L78\n\tmovq\t%r14, %rax\n\tmovl\t8(%rsp), %esi\n\tmovq\t%r13, %r14\n\taddl\t%esi, 32(%rsp)\n\tmovq\t%rax, %r13\n\tjmp\t.L63\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tcmpl\t%r9d, %edi\n\tjle\t.L98\n\taddq\t$1, %r9\n\tjmp\t.L71\n\t.p2align 4,,10\n\t.p2align 3\n.L104:\n\tmovl\t(%r14), %ebx\n.L75:\n\tmovl\t12(%rsp), %eax\n\tmovl\t8(%rsp), %ecx\n\taddl\t%ecx, 32(%rsp)\n\ttestl\t%eax, %eax\n\tjne\t.L105\n.L82:\n\tmovl\t$1000000, 8(%rsp)\n\tjmp\t.L75\n.L70:\n\ttestl\t%eax, %eax\n\tjne\t.L74\n.L98:\n\tmovq\t%r15, %rdi\n\tcall\tfree@PLT\n\tmovq\t24(%rsp), %rdi\n\tcall\tfree@PLT\n\tmovq\t%r13, %rdi\n\tcall\tfree@PLT\n\tmovl\t32(%rsp), %edx\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC5(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t72(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L106\n\taddq\t$88, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L97:\n\t.cfi_restore_state\n\tmovq\t%r14, %rax\n\tmovq\t%r13, %r14\n\tmovq\t%rax, %r13\n\tjmp\t.L63\n.L103:\n\taddl\t%eax, %eax\n\tmovl\t%r8d, 8(%rsp)\n\tmovl\t%eax, 24(%r14)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovl\t8(%rsp), %r8d\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %rdi\n\tmovl\t20(%r14), %eax\n\tjmp\t.L60\n.L100:\n\tleal\t1(%rbp), %eax\n\tmovl\t%eax, 12(%rsp)\n\tjmp\t.L56\n.L106:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE55:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tmain, .-main\n\t.globl\tflow_inf\n\t.section\t.rodata\n\t.align 4\n\t.type\tflow_inf, @object\n\t.size\tflow_inf, 4\nflow_inf:\n\t.long\t1000000\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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%edi, %rbp\n\tmovl\t$1, %edi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tcall\tcalloc@PLT\n\tmovl\t$12, %esi\n\tmovl\t$4, %edi\n\tmovl\t%ebp, 16(%rax)\n\tmovq\t%rax, %r12\n\tcall\tcalloc@PLT\n\tmovq\t%rbp, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, (%r12)\n\tcall\tcalloc@PLT\n\tmovq\t%rax, 8(%r12)\n\tmovq\t%rax, %rdi\n\tmovq\t.LC0(%rip), %rax\n\tmovq\t%rax, 20(%r12)\n\ttestl\t%ebp, %ebp\n\tjle\t.L1\n\tleaq\t0(,%rbp,4), %rdx\n\tmovl\t$255, %esi\n\tcall\tmemset@PLT\n.L1:\n\tmovq\t%r12, %rax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE51:\n\t.size\tnew_graph, .-new_graph\n\t.p2align 4\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t%ecx, %r13d\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovl\t%esi, %r12d\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tmovslq\t%edx, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rdi, %rbx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tmovl\t20(%rdi), %eax\n\tmovq\t(%rdi), %rdi\n\tcmpl\t24(%rbx), %eax\n\tje\t.L8\n.L6:\n\tmovq\t8(%rbx), %rsi\n\tmovslq\t%eax, %rdx\n\tmovslq\t%r12d, %r8\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rsi,%r8,4), %r8\n\tsalq\t$2, %rdx\n\tmovl\t(%r8), %r9d\n\tleaq\t(%rdi,%rdx), %rcx\n\tleaq\t12(%rdi,%rdx), %rdx\n\tmovl\t%ebp, (%rcx)\n\tmovl\t%r9d, 4(%rcx)\n\tmovl\t%r13d, 8(%rcx)\n\tleaq\t(%rsi,%rbp,4), %rcx\n\tmovl\t%eax, (%r8)\n\tmovl\t(%rcx), %esi\n\taddl\t$1, %eax\n\tmovl\t%r12d, (%rdx)\n\tmovl\t%esi, 4(%rdx)\n\tmovl\t$0, 8(%rdx)\n\tmovl\t%eax, (%rcx)\n\taddl\t$2, 20(%rbx)\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\t.cfi_restore_state\n\taddl\t%eax, %eax\n\tmovl\t%eax, 24(%rbx)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rax, %rdi\n\tmovl\t20(%rbx), %eax\n\tjmp\t.L6\n\t.cfi_endproc\n.LFE52:\n\t.size\tadd_edge, .-add_edge\n\t.p2align 4\n\t.globl\tdinic_dfs\n\t.type\tdinic_dfs, @function\ndinic_dfs:\n.LFB53:\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\tmovl\t%r9d, %r14d\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tmovslq\t%edi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tcmpl\t%edx, %r12d\n\tje\t.L9\n\tsalq\t$2, %r12\n\tleaq\t(%r8,%r12), %r15\n\tmovl\t(%r15), %ebx\n\tcmpl\t$-1, %ebx\n\tje\t.L14\n\taddq\t%rcx, %r12\n\tmovq\t(%rsi), %r13\n\tmovq\t%r15, %r10\n\txorl\t%r11d, %r11d\n\tmovq\t%r12, %r14\n\tmovl\t%r9d, %r15d\n\tmovq\t%rcx, %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovslq\t%ebx, %rax\n\tmovl\t(%r14), %ecx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t0(%r13,%rax,4), %rbp\n\tmovslq\t0(%rbp), %rax\n\tmovl\t8(%rbp), %r9d\n\tmovq\t%rax, %rdi\n\tcmpl\t%ecx, (%r12,%rax,4)\n\tjle\t.L11\n\ttestl\t%r9d, %r9d\n\tjle\t.L11\n\tcmpl\t%r9d, %r15d\n\tmovq\t%r12, %rcx\n\tmovl\t%r11d, 28(%rsp)\n\tcmovle\t%r15d, %r9d\n\tmovq\t%r10, 16(%rsp)\n\tmovq\t%r8, 8(%rsp)\n\tmovl\t%edx, 24(%rsp)\n\tmovq\t%rsi, (%rsp)\n\tcall\tdinic_dfs\n\tmovq\t(%rsp), %rsi\n\tmovl\t24(%rsp), %edx\n\ttestl\t%eax, %eax\n\tmovq\t8(%rsp), %r8\n\tmovq\t16(%rsp), %r10\n\tmovl\t28(%rsp), %r11d\n\tjle\t.L11\n\txorl\t$1, %ebx\n\tsubl\t%eax, %r15d\n\tsubl\t%eax, 8(%rbp)\n\taddl\t%eax, %r11d\n\tmovslq\t%ebx, %rbx\n\tleaq\t(%rbx,%rbx,2), %rcx\n\taddl\t%eax, 8(%r13,%rcx,4)\n\ttestl\t%r15d, %r15d\n\tjle\t.L16\n.L11:\n\tmovl\t4(%rbp), %ebx\n\tmovl\t%ebx, (%r10)\n\tcmpl\t$-1, %ebx\n\tjne\t.L12\n.L16:\n\tmovl\t%r11d, %r14d\n.L9:\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovl\t%r14d, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\t.cfi_restore_state\n\txorl\t%r14d, %r14d\n\tjmp\t.L9\n\t.cfi_endproc\n.LFE53:\n\t.size\tdinic_dfs, .-dinic_dfs\n\t.p2align 4\n\t.globl\tdinic\n\t.type\tdinic, @function\ndinic:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t%edx, %r15d\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tmovl\t%esi, %r14d\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovslq\t16(%rdi), %rbx\n\tmovl\t%esi, 36(%rsp)\n\tmovl\t$4, %esi\n\tmovq\t%rdi, 8(%rsp)\n\tmovq\t%rbx, %rdi\n\tmovl\t%edx, 20(%rsp)\n\tmovl\t%ebx, 68(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, (%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, 48(%rsp)\n\tcall\tcalloc@PLT\n\tmovq\t(%rsp), %rcx\n\tmovq\t8(%rsp), %r11\n\tmovl\t$0, 64(%rsp)\n\tmovq\t%rax, 24(%rsp)\n\tleaq\t0(,%rbx,4), %rax\n\tmovq\t%rax, 40(%rsp)\n\tmovslq\t%r15d, %rax\n\tleaq\t(%rcx,%rax,4), %rax\n\tmovq\t%rax, 56(%rsp)\n\tmovslq\t%r14d, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, 72(%rsp)\n\tleaq\t(%rcx,%rax), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovq\t40(%rsp), %rdx\n\tmovq\t%rcx, %rdi\n\txorl\t%esi, %esi\n\tmovq\t%r11, (%rsp)\n\tcall\tmemset@PLT\n\tmovl\t68(%rsp), %edi\n\tmovq\t(%rsp), %r11\n\tmovl\t$1, %r10d\n\tmovq\t%rax, %rcx\n\tmovq\t56(%rsp), %rax\n\tmovl\t$1, %r9d\n\tmovq\t8(%r11), %rbp\n\tmovl\t%edi, (%rax)\n\tmovl\t20(%rsp), %eax\n\tmovq\t48(%rsp), %rdi\n\tmovl\t%eax, (%rdi)\n\tmovl\t(%r14), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L27\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\tmovslq\t-4(%rdi,%r10,4), %rax\n\tleaq\t0(,%rax,4), %r8\n\tmovl\t0(%rbp,%rax,4), %eax\n\tcmpl\t$-1, %eax\n\tje\t.L20\n\tmovq\t(%r11), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\tmovslq\t%eax, %rdx\n\txorl\t$1, %eax\n\tcltq\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%rsi,%rdx,4), %rdx\n\tmovl\t8(%rsi,%rax,4), %r13d\n\ttestl\t%r13d, %r13d\n\tjle\t.L21\n\tmovslq\t(%rdx), %rbx\n\tmovq\t%rbx, %rax\n\tleaq\t(%rcx,%rbx,4), %rbx\n\tmovl\t(%rbx), %r12d\n\ttestl\t%r12d, %r12d\n\tjne\t.L21\n\tmovl\t(%rcx,%r8), %r15d\n\tleal\t-1(%r15), %r12d\n\tmovl\t%r12d, (%rbx)\n\tmovslq\t%r9d, %rbx\n\taddl\t$1, %r9d\n\tmovl\t%eax, (%rdi,%rbx,4)\n.L21:\n\tmovl\t4(%rdx), %eax\n\tcmpl\t$-1, %eax\n\tjne\t.L22\n\tmovl\t(%r14), %eax\n\tcmpl\t%r10d, %r9d\n\tjle\t.L23\n\taddq\t$1, %r10\n\ttestl\t%eax, %eax\n\tje\t.L24\n.L27:\n\tmovq\t24(%rsp), %r15\n\tmovq\t40(%rsp), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%rcx, (%rsp)\n\tmovq\t%r11, 8(%rsp)\n\tmovq\t%r15, %rdi\n\tcall\tmemcpy@PLT\n\taddq\t72(%rsp), %r15\n\tmovq\t8(%rsp), %rsi\n\tmovq\t%r15, %r10\n\tmovl\t36(%rsp), %ecx\n\tmovq\t(%rsp), %r15\n\tcmpl\t%ecx, 20(%rsp)\n\tje\t.L34\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovl\t(%r10), %ebx\n\tcmpl\t$-1, %ebx\n\tje\t.L47\n\txorl\t%r11d, %r11d\n\tmovq\t(%rsi), %r13\n\tmovl\t$1000000, %r12d\n\tmovl\t%r11d, 32(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L32:\n\tmovslq\t%ebx, %rax\n\tmovl\t(%r14), %ecx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t0(%r13,%rax,4), %rbp\n\tmovslq\t0(%rbp), %rax\n\tmovl\t8(%rbp), %r9d\n\tmovq\t%rax, %rdi\n\tcmpl\t%ecx, (%r15,%rax,4)\n\tjle\t.L31\n\ttestl\t%r9d, %r9d\n\tjle\t.L31\n\tcmpl\t%r12d, %r9d\n\tmovq\t24(%rsp), %r8\n\tmovl\t20(%rsp), %edx\n\tmovq\t%r15, %rcx\n\tcmovg\t%r12d, %r9d\n\tmovq\t%r10, 8(%rsp)\n\tmovq\t%rsi, (%rsp)\n\tcall\tdinic_dfs\n\tmovq\t(%rsp), %rsi\n\tmovq\t8(%rsp), %r10\n\ttestl\t%eax, %eax\n\tjle\t.L31\n\txorl\t$1, %ebx\n\tsubl\t%eax, %r12d\n\tsubl\t%eax, 8(%rbp)\n\tmovslq\t%ebx, %rbx\n\taddl\t%eax, 32(%rsp)\n\tleaq\t(%rbx,%rbx,2), %rdx\n\taddl\t%eax, 8(%r13,%rdx,4)\n\ttestl\t%r12d, %r12d\n\tjle\t.L48\n.L31:\n\tmovl\t4(%rbp), %ebx\n\tmovl\t%ebx, (%r10)\n\tcmpl\t$-1, %ebx\n\tjne\t.L32\n\tmovl\t32(%rsp), %r11d\n\ttestl\t%r11d, %r11d\n\tje\t.L47\n.L28:\n\taddl\t%r11d, 64(%rsp)\n\tmovl\t36(%rsp), %ecx\n\tcmpl\t%ecx, 20(%rsp)\n\tjne\t.L51\n.L34:\n\tmovl\t$1000000, %r11d\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tcmpl\t%r10d, %r9d\n\tjle\t.L26\n\taddq\t$1, %r10\n\tjmp\t.L24\n\t.p2align 4,,10\n\t.p2align 3\n.L48:\n\tmovl\t32(%rsp), %r11d\n\tjmp\t.L28\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\tmovq\t%r15, %rcx\n\tmovq\t%rsi, %r11\n\tjmp\t.L30\n.L23:\n\ttestl\t%eax, %eax\n\tjne\t.L27\n.L26:\n\tmovq\t%rcx, %rdi\n\tcall\tfree@PLT\n\tmovq\t48(%rsp), %rdi\n\tcall\tfree@PLT\n\tmovq\t24(%rsp), %rdi\n\tcall\tfree@PLT\n\tmovl\t64(%rsp), %eax\n\taddq\t$88, %rsp\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tdinic, .-dinic\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%i%i\"\n.LC2:\n\t.string\t\"%s\"\n.LC3:\n\t.string\t\"%i\"\n.LC4:\n\t.string\t\"%i%i%i\"\n.LC5:\n\t.string\t\"%i\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC1(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$88, %rsp\n\t.cfi_def_cfa_offset 144\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 72(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t56(%rsp), %rdx\n\tleaq\t52(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %eax\n\tmovl\t$1, %esi\n\tleal\t1(%rax), %edi\n\tmovslq\t%edi, %rdi\n\tcall\tcalloc@PLT\n\tleaq\t.LC2(%rip), %rdi\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, %r12\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t52(%rsp), %ebp\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$12, %esi\n\tmovl\t$4, %edi\n\tleal\t2(%rbp), %ebx\n\tmovq\t%rax, %r15\n\tmovl\t%ebx, 16(%rax)\n\tcall\tcalloc@PLT\n\tmovslq\t%ebx, %rdi\n\tmovl\t$4, %esi\n\tmovq\t%rax, (%r15)\n\tcall\tcalloc@PLT\n\tmovq\t%rax, 8(%r15)\n\tmovq\t%rax, %rdi\n\tmovq\t.LC0(%rip), %rax\n\tmovq\t%rax, 20(%r15)\n\ttestl\t%ebx, %ebx\n\tjle\t.L100\n\tleal\t1(%rbp), %eax\n\tmovl\t$255, %esi\n\tleaq\t4(,%rax,4), %rdx\n\tmovl\t%eax, 12(%rsp)\n\tcall\tmemset@PLT\n.L56:\n\tmovslq\t12(%rsp), %rax\n\tmovl\t$1, %r14d\n\tleaq\t68(%rsp), %rbx\n\tleaq\t.LC3(%rip), %r13\n\tsalq\t$2, %rax\n\tmovq\t%rax, (%rsp)\n\ttestl\t%ebp, %ebp\n\tjle\t.L55\n\tmovq\t%r14, %rax\n\tmovq\t%r15, %r14\n\tmovq\t%rax, %r15\n\tjmp\t.L54\n.L59:\n\tmovq\t(%r14), %r10\n\tcmpl\t24(%r14), %eax\n\tje\t.L101\n.L62:\n\tmovslq\t%eax, %rsi\n\tleaq\t(%rsi,%rsi,2), %rdi\n\tmovq\t8(%r14), %rsi\n\tsalq\t$2, %rdi\n\tleaq\t(%rsi,%r15,4), %r11\n\tleaq\t(%r10,%rdi), %r9\n\taddq\t(%rsp), %rsi\n\taddq\t$1, %r15\n\tmovl\t(%r11), %ecx\n\tmovl\t%r8d, 8(%r9)\n\tleaq\t12(%r10,%rdi), %rdi\n\tmovl\t%ecx, 4(%r9)\n\tmovl\t12(%rsp), %ecx\n\tmovl\t%ecx, (%r9)\n\tmovl\t%eax, (%r11)\n\tmovl\t(%rsi), %r8d\n\taddl\t$1, %eax\n\tmovl\t%ebp, (%rdi)\n\tmovl\t%r8d, 4(%rdi)\n\tmovl\t$0, 8(%rdi)\n\tmovl\t%eax, (%rsi)\n\tmovl\t20(%r14), %eax\n\taddl\t$2, %eax\n\tmovl\t%eax, 20(%r14)\n\tcmpl\t%r15d, 52(%rsp)\n\tjl\t.L102\n.L54:\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rsi\n\tmovq\t%r13, %rdi\n\tmovl\t%r15d, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tcmpb\t$82, -1(%r12,%r15)\n\tmovl\t68(%rsp), %r8d\n\tmovl\t20(%r14), %eax\n\tjne\t.L59\n\tmovq\t(%r14), %rdi\n\tcmpl\t24(%r14), %eax\n\tje\t.L103\n.L60:\n\tmovq\t8(%r14), %r9\n\tmovslq\t%eax, %rsi\n\tmovd\t%ebp, %xmm0\n\tleaq\t(%rsi,%rsi,2), %rsi\n\tmovd\t(%r9), %xmm1\n\tsalq\t$2, %rsi\n\tleaq\t(%rdi,%rsi), %r10\n\tleaq\t12(%rdi,%rsi), %rsi\n\tpunpckldq\t%xmm1, %xmm0\n\tleaq\t(%r9,%r15,4), %rdi\n\tmovl\t%r8d, 8(%r10)\n\taddq\t$1, %r15\n\tmovq\t%xmm0, (%r10)\n\tmovl\t%eax, (%r9)\n\tmovl\t(%rdi), %r8d\n\taddl\t$1, %eax\n\tmovl\t$0, (%rsi)\n\tmovl\t%r8d, 4(%rsi)\n\tmovl\t$0, 8(%rsi)\n\tmovl\t%eax, (%rdi)\n\tmovl\t20(%r14), %eax\n\taddl\t$2, %eax\n\tmovl\t%eax, 20(%r14)\n\tcmpl\t%r15d, 52(%rsp)\n\tjge\t.L54\n.L102:\n\tmovq\t%r14, %r15\n.L55:\n\tmovl\t56(%rsp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 56(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L58\n\tleaq\t68(%rsp), %rbx\n\tleaq\t64(%rsp), %r13\n\tleaq\t60(%rsp), %r12\n\tleaq\t.LC4(%rip), %rbp\n\tjmp\t.L57\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\tmovq\t8(%r15), %r9\n\tmovslq\t%eax, %rcx\n\tmovslq\t%edx, %r10\n\tleaq\t(%rcx,%rcx,2), %rcx\n\tleaq\t(%r9,%r10,4), %r10\n\tsalq\t$2, %rcx\n\tmovl\t(%r10), %r11d\n\tleaq\t(%rdi,%rcx), %rsi\n\tleaq\t12(%rdi,%rcx), %rcx\n\tmovl\t%r14d, (%rsi)\n\tmovl\t%r11d, 4(%rsi)\n\tmovl\t%r8d, 8(%rsi)\n\tleaq\t(%r9,%r14,4), %rsi\n\tmovl\t%eax, (%r10)\n\tmovl\t(%rsi), %edi\n\taddl\t$1, %eax\n\tmovl\t%edx, (%rcx)\n\tmovl\t%edi, 4(%rcx)\n\tmovl\t$0, 8(%rcx)\n\tmovl\t%eax, (%rsi)\n\tmovl\t56(%rsp), %eax\n\taddl\t$2, 20(%r15)\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, 56(%rsp)\n\ttestl\t%eax, %eax\n\tje\t.L58\n.L57:\n\tmovq\t%r13, %rdx\n\tmovq\t%rbx, %rcx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t60(%rsp), %edx\n\tmovslq\t64(%rsp), %r14\n\tcmpl\t%r14d, %edx\n\tjle\t.L64\n\tmovl\t%r14d, %eax\n\tmovl\t%r14d, 60(%rsp)\n\tmovslq\t%edx, %r14\n\tmovl\t%edx, 64(%rsp)\n\tmovl\t%eax, %edx\n.L64:\n\tmovl\t68(%rsp), %r8d\n\tmovl\t20(%r15), %eax\n\tmovq\t(%r15), %rdi\n\tcmpl\t24(%r15), %eax\n\tjne\t.L65\n\taddl\t%eax, %eax\n\tmovl\t%r8d, 32(%rsp)\n\tmovl\t%eax, 24(%r15)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tmovl\t%edx, 8(%rsp)\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovl\t32(%rsp), %r8d\n\tmovl\t8(%rsp), %edx\n\tmovq\t%rax, (%r15)\n\tmovq\t%rax, %rdi\n\tmovl\t20(%r15), %eax\n\tjmp\t.L65\n.L101:\n\taddl\t%eax, %eax\n\tmovq\t%r10, %rdi\n\tmovl\t%r8d, 8(%rsp)\n\tmovl\t%eax, 24(%r14)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovl\t8(%rsp), %r8d\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %r10\n\tmovl\t20(%r14), %eax\n\tjmp\t.L62\n.L58:\n\tmovslq\t16(%r15), %rbx\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovl\t%ebx, 36(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, %r14\n\tcall\tcalloc@PLT\n\tmovl\t$4, %esi\n\tmovq\t%rbx, %rdi\n\tmovq\t%rax, 24(%rsp)\n\tcall\tcalloc@PLT\n\tmovl\t$0, 32(%rsp)\n\tmovq\t%rax, %r13\n\tleaq\t0(,%rbx,4), %rax\n\tmovq\t%rax, 16(%rsp)\n\tmovq\t(%rsp), %rax\n\taddq\t%r14, %rax\n\tmovq\t%rax, 40(%rsp)\n\tmovq\t%r14, %rax\n\tmovq\t%r15, %r14\n\tmovq\t%rax, %r15\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovq\t16(%rsp), %rdx\n\txorl\t%esi, %esi\n\tmovq\t%r15, %rdi\n\tcall\tmemset@PLT\n\tmovq\t40(%rsp), %rax\n\tmovl\t36(%rsp), %ecx\n\tmovl\t$1, %r9d\n\tmovq\t24(%rsp), %rsi\n\tmovq\t8(%r14), %r10\n\tmovl\t$1, %edi\n\tmovl\t%ecx, (%rax)\n\tmovl\t12(%rsp), %eax\n\tmovl\t%eax, (%rsi)\n\tmovl\t(%r15), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L74\n\t.p2align 4,,10\n\t.p2align 3\n.L71:\n\tmovslq\t-4(%rsi,%r9,4), %rax\n\tleaq\t0(,%rax,4), %r8\n\tmovl\t(%r10,%rax,4), %eax\n\tcmpl\t$-1, %eax\n\tje\t.L67\n\tmovq\t(%r14), %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L69:\n\tmovslq\t%eax, %rdx\n\txorl\t$1, %eax\n\tcltq\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%rcx,%rdx,4), %rdx\n\tmovl\t8(%rcx,%rax,4), %ebp\n\ttestl\t%ebp, %ebp\n\tjle\t.L68\n\tmovslq\t(%rdx), %r11\n\tmovq\t%r11, %rax\n\tleaq\t(%r15,%r11,4), %r11\n\tmovl\t(%r11), %ebx\n\ttestl\t%ebx, %ebx\n\tjne\t.L68\n\tmovl\t(%r15,%r8), %ebx\n\tsubl\t$1, %ebx\n\tmovl\t%ebx, (%r11)\n\tmovslq\t%edi, %r11\n\taddl\t$1, %edi\n\tmovl\t%eax, (%rsi,%r11,4)\n.L68:\n\tmovl\t4(%rdx), %eax\n\tcmpl\t$-1, %eax\n\tjne\t.L69\n\tmovl\t(%r15), %eax\n\tcmpl\t%r9d, %edi\n\tjle\t.L70\n\taddq\t$1, %r9\n\ttestl\t%eax, %eax\n\tje\t.L71\n.L74:\n\tmovq\t16(%rsp), %rdx\n\tmovq\t%r13, %rdi\n\tmovq\t%r10, %rsi\n\tcall\tmemcpy@PLT\n\tmovl\t0(%r13), %ebx\n\tmovq\t%r14, %r13\n\tmovq\t%rax, %r14\n\tmovl\t12(%rsp), %eax\n\ttestl\t%eax, %eax\n\tje\t.L82\n.L105:\n\tcmpl\t$-1, %ebx\n\tje\t.L97\n\tmovl\t$0, 8(%rsp)\n\tmovq\t0(%r13), %r10\n\tmovl\t$1000000, %r12d\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovslq\t%ebx, %rax\n\tmovl\t(%r15), %esi\n\tleaq\t(%rax,%rax,2), %rax\n\tleaq\t(%r10,%rax,4), %rbp\n\tmovslq\t0(%rbp), %rax\n\tmovl\t8(%rbp), %r9d\n\tmovq\t%rax, %rdi\n\tcmpl\t%esi, (%r15,%rax,4)\n\tjle\t.L77\n\ttestl\t%r9d, %r9d\n\tjle\t.L77\n\tcmpl\t%r12d, %r9d\n\tmovl\t12(%rsp), %edx\n\tmovq\t%r14, %r8\n\tmovq\t%r15, %rcx\n\tcmovg\t%r12d, %r9d\n\tmovq\t%r13, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tdinic_dfs\n\tmovq\t(%rsp), %r10\n\ttestl\t%eax, %eax\n\tjle\t.L77\n\txorl\t$1, %ebx\n\tsubl\t%eax, %r12d\n\tsubl\t%eax, 8(%rbp)\n\tmovslq\t%ebx, %rbx\n\taddl\t%eax, 8(%rsp)\n\tleaq\t(%rbx,%rbx,2), %rdx\n\taddl\t%eax, 8(%r10,%rdx,4)\n\ttestl\t%r12d, %r12d\n\tjle\t.L104\n.L77:\n\tmovl\t4(%rbp), %ebx\n\tmovl\t%ebx, (%r14)\n\tcmpl\t$-1, %ebx\n\tjne\t.L78\n\tmovq\t%r14, %rax\n\tmovl\t8(%rsp), %esi\n\tmovq\t%r13, %r14\n\taddl\t%esi, 32(%rsp)\n\tmovq\t%rax, %r13\n\tjmp\t.L63\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tcmpl\t%r9d, %edi\n\tjle\t.L98\n\taddq\t$1, %r9\n\tjmp\t.L71\n\t.p2align 4,,10\n\t.p2align 3\n.L104:\n\tmovl\t(%r14), %ebx\n.L75:\n\tmovl\t12(%rsp), %eax\n\tmovl\t8(%rsp), %ecx\n\taddl\t%ecx, 32(%rsp)\n\ttestl\t%eax, %eax\n\tjne\t.L105\n.L82:\n\tmovl\t$1000000, 8(%rsp)\n\tjmp\t.L75\n.L70:\n\ttestl\t%eax, %eax\n\tjne\t.L74\n.L98:\n\tmovq\t%r15, %rdi\n\tcall\tfree@PLT\n\tmovq\t24(%rsp), %rdi\n\tcall\tfree@PLT\n\tmovq\t%r13, %rdi\n\tcall\tfree@PLT\n\tmovl\t32(%rsp), %edx\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC5(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t72(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L106\n\taddq\t$88, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L97:\n\t.cfi_restore_state\n\tmovq\t%r14, %rax\n\tmovq\t%r13, %r14\n\tmovq\t%rax, %r13\n\tjmp\t.L63\n.L103:\n\taddl\t%eax, %eax\n\tmovl\t%r8d, 8(%rsp)\n\tmovl\t%eax, 24(%r14)\n\tcltq\n\tleaq\t(%rax,%rax,2), %rsi\n\tsalq\t$2, %rsi\n\tcall\trealloc@PLT\n\tmovl\t8(%rsp), %r8d\n\tmovq\t%rax, (%r14)\n\tmovq\t%rax, %rdi\n\tmovl\t20(%r14), %eax\n\tjmp\t.L60\n.L100:\n\tleal\t1(%rbp), %eax\n\tmovl\t%eax, 12(%rsp)\n\tjmp\t.L56\n.L106:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE55:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tmain, .-main\n\t.globl\tflow_inf\n\t.section\t.rodata\n\t.align 4\n\t.type\tflow_inf, @object\n\t.size\tflow_inf, 4\nflow_inf:\n\t.long\t1000000\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t4\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 * 1000;\n\ntypedef struct flow_edge {\n int32_t vertex;\n int32_t next;\n flow_type capacity;\n} flow_edge;\n\ntypedef struct maxFlowGraph {\n flow_edge *edge;\n int32_t *start;\n int32_t vertex_num;\n int32_t pointer;\n int32_t edge_length;\n} graph;\n\ngraph* new_graph (const int32_t vertex_num) {\n graph *g = (graph *) calloc (1, sizeof (graph));\n g->vertex_num = vertex_num;\n const int32_t initial_length = 4;\n g->edge = (flow_edge *) calloc (initial_length, sizeof (flow_edge));\n g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n g->pointer = 0;\n g->edge_length = initial_length;\n for (int32_t i = 0; i < vertex_num; ++i) {\n g->start[i] = -1;\n }\n return g;\n}\n\nvoid add_edge (graph * const g, const int32_t from, const int32_t to, const flow_type capa) {\n //printf (\"edge %\" PRIi32 \" -> %\" PRIi32 \", %\" PRIi32 \"\\n\", from, to, capa);\n if (g->pointer == g->edge_length) {\n g->edge_length *= 2;\n g->edge = (flow_edge *) realloc (g->edge, sizeof (flow_edge) * g->edge_length);\n }\n const int32_t p = g->pointer;\n g->edge[p] = (flow_edge) {to, g->start[from], capa};\n g->start[from] = p;\n g->edge[p + 1] = (flow_edge) {from, g->start[to], 0};\n g->start[to] = p + 1;\n g->pointer += 2;\n}\n\nflow_type dinic_dfs (const int32_t v, const graph * const g, const int32_t dst, const int32_t * const level, int32_t * const iter, flow_type e) {\n if (v == dst) return e;\n flow_type sum = 0;\n for (int32_t p = iter[v]; p != -1; p = g->edge[p].next, iter[v] = p) {\n const int32_t u = g->edge[p].vertex;\n const flow_type capa = g->edge[p].capacity;\n if (level[u] <= level[v] || capa <= 0) continue;\n const flow_type f = dinic_dfs (u, g, dst, level, iter, capa < e ? capa : e);\n if (f > 0) {\n g->edge[p].capacity -= f;\n g->edge[p ^ 1].capacity += f;\n sum += f;\n e -= f;\n if (e <= 0) return sum;\n }\n }\n return sum;\n}\n\nflow_type dinic (const graph * const g, const int32_t src, const int32_t dst) {\n const int32_t vertex_num = g->vertex_num;\n int32_t * const level = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n int32_t * const queue = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n int32_t * const iter = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n flow_type flow = 0;\n while (1) {\n memset (level, 0, sizeof (int32_t) * vertex_num);\n int32_t front = 0;\n int32_t last = 0;\n level[dst] = vertex_num;\n queue[last++] = dst;\n while (front < last && level[src] == 0) {\n const int32_t v = queue[front++];\n for (int32_t p = g->start[v]; p!=-1; p = g->edge[p].next) {\n const int32_t u = g->edge[p].vertex;\n if (g->edge[p ^ 1].capacity > 0 && level[u] == 0) {\n level[u] = level[v] - 1;\n queue[last++] = u;\n }\n }\n }\n if (level[src] == 0) break;\n memcpy (iter, g->start, sizeof (int32_t) * vertex_num);\n while (1) {\n flow_type f = dinic_dfs (src, g, dst, level, iter, flow_inf);\n if (f <= 0) break;\n flow += f;\n }\n }\n free (level);\n free (queue);\n free (iter);\n return flow;\n}\n\ntypedef int32_t i32;\n\nvoid run (void) {\n i32 n, m;\n scanf (\"%\" SCNi32 \"%\" SCNi32, &n, &m);\n char *u = (char *) calloc (n + 1, sizeof (char));\n scanf (\"%s\", u);\n graph *g = new_graph (n + 2);\n const i32 src = 0;\n const i32 dst = n + 1;\n for (i32 i = 1; i <= n; ++i) {\n i32 a;\n scanf (\"%\" SCNi32, &a);\n if (u[i - 1] =='R') {\n add_edge (g, src, i, a);\n } else {\n add_edge (g, i, dst, a);\n }\n }\n while (m--) {\n i32 s, t, b;\n scanf (\"%\" SCNi32 \"%\" SCNi32 \"%\" SCNi32, &s, &t, &b);\n if (s > t) {\n i32 swap = s;\n s = t;\n t = swap;\n }\n add_edge (g, s, t, b);\n }\n i32 ans = dinic (g, src, dst);\n printf (\"%\" PRIi32 \"\\n\", ans);\n}\n\nint main (void) {\n run ();\n return 0;\n}\n\n", "index": 88, "inputs": [ "3 1\nRRL\n5 5 1\n3 1 3\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 9\n4 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 10\n1 4 5\n2 4 9\n2 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 0\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 7\n2 4 9\n4 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 1\n3 5 10\n", "5 5\nLLRLR\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 1\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 9\n1 4 9\n2 2 2\n1 5 1\n3 5 1\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n2 4 2\n2 2 7\n1 5 4\n3 5 1\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 28\n4 2 3\n3 1 3\n3 5 2\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 9\n2 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n12 5 1 3 10\n1 4 5\n2 4 9\n2 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 0\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n2 4 2\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n1 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 7\n2 4 9\n4 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 1\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 5\n2 4 9\n2 2 7\n1 5 1\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 16\n4 2 16\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 5\n2 4 9\n2 2 2\n1 5 1\n3 5 0\n", "5 5\nRLRLL\n9 9 1 3 10\n1 3 5\n2 4 9\n4 2 16\n1 5 2\n3 5 10\n", "3 1\nRRL\n5 5 1\n3 1 6\n", "5 5\nRLRLL\n9 5 1 3 10\n1 4 5\n2 4 7\n2 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 10\n1 4 5\n2 4 9\n3 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 2\n2 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 0\n3 2 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 9\n2 4 9\n2 2 7\n1 5 0\n3 5 0\n", "5 4\nRLRLL\n9 5 0 3 6\n1 4 5\n2 4 9\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 7\n2 4 9\n4 2 7\n1 5 0\n3 5 10\n", "5 5\nRLRLL\n12 5 1 3 10\n1 4 5\n2 4 9\n2 2 7\n1 5 2\n3 5 2\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 9\n2 2 12\n1 5 1\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 11\n1 4 5\n2 4 0\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n18 5 0 3 6\n1 4 5\n2 4 2\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n1 2 2\n3 5 18\n", "5 5\nRLRLL\n9 5 1 3 6\n1 3 7\n2 4 9\n4 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n6 2 16\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 5\n2 4 9\n2 2 7\n1 5 1\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 16\n4 2 17\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 9\n2 4 9\n2 2 2\n1 5 1\n3 5 0\n", "5 5\nRLRLL\n9 9 1 3 10\n1 3 5\n2 4 9\n4 2 8\n1 5 2\n3 5 10\n", "3 1\nLRR\n5 5 1\n3 1 6\n", "5 5\nRLRLL\n9 5 1 3 10\n1 4 2\n2 4 9\n3 2 7\n1 5 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 2\n2 2 7\n1 5 4\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 10\n2 4 9\n2 2 7\n1 5 0\n3 2 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 9\n2 4 9\n2 2 7\n1 5 0\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 7\n2 4 5\n4 2 7\n1 5 0\n3 5 10\n", "5 5\nRLRLL\n12 5 1 3 10\n1 4 5\n2 4 9\n2 2 7\n1 2 2\n3 5 2\n", "5 5\nRLRLL\n9 5 1 3 11\n1 4 5\n2 4 0\n3 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n18 5 0 3 6\n2 4 5\n2 4 2\n2 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n6 2 31\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 5\n2 4 9\n2 2 0\n1 5 1\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 16\n4 2 17\n2 2 3\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 9\n2 4 9\n2 2 2\n1 5 1\n3 5 1\n", "3 1\nLRR\n5 5 1\n3 1 12\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 5\n2 4 2\n2 2 7\n1 5 4\n3 5 1\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 10\n2 2 9\n2 2 7\n1 5 0\n3 2 10\n", "5 5\nRLRLL\n9 5 1 5 10\n1 3 7\n2 4 5\n4 2 7\n1 5 0\n3 5 10\n", "5 5\nRLRLL\n12 5 1 3 10\n1 4 5\n2 4 9\n3 2 7\n1 2 2\n3 5 2\n", "5 5\nRLRLL\n9 10 1 3 11\n1 4 5\n2 4 0\n3 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n18 5 0 3 6\n2 4 5\n2 4 2\n2 2 7\n1 5 -1\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 10\n2 3 5\n2 4 16\n6 2 31\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 5 4\n2 4 9\n2 2 0\n1 5 1\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 16\n4 2 3\n2 2 3\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 10\n2 1 9\n2 2 7\n1 5 0\n3 2 10\n", "5 5\nRLRLL\n9 5 1 5 10\n1 3 8\n2 4 5\n4 2 7\n1 5 0\n3 5 10\n", "5 5\nRLRLL\n9 10 1 3 18\n1 4 5\n2 4 0\n3 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n1 5 1 3 10\n2 3 5\n2 4 16\n6 2 31\n2 2 2\n3 5 10\n", "5 5\nRLRLL\n9 5 1 3 11\n1 5 4\n2 4 9\n2 2 0\n1 5 1\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 28\n4 2 3\n2 2 3\n3 5 10\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n2 4 3\n2 2 7\n1 5 4\n3 5 1\n", "5 5\nRLRLL\n9 5 1 3 6\n1 4 10\n2 2 9\n2 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n9 5 1 5 1\n1 3 8\n2 4 5\n4 2 7\n1 5 0\n3 5 10\n", "5 5\nRLRLL\n9 10 1 3 18\n1 4 5\n2 3 0\n3 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 1 3 11\n2 5 4\n2 4 9\n2 2 0\n1 5 1\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 28\n4 2 3\n2 1 3\n3 5 10\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n4 4 3\n2 2 7\n1 5 4\n3 5 1\n", "5 5\nRLRLL\n9 1 1 3 6\n1 4 10\n2 2 9\n2 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n9 5 1 5 1\n1 3 8\n2 4 5\n4 2 7\n1 5 0\n3 1 10\n", "5 5\nLLRRL\n9 10 1 3 18\n1 4 5\n2 3 0\n3 2 7\n1 5 0\n3 5 0\n", "5 5\nRLRLL\n9 5 0 3 11\n2 5 4\n2 4 9\n2 2 0\n1 5 1\n1 5 0\n", "5 5\nRLRLL\n9 5 1 3 3\n1 3 5\n2 4 28\n4 2 3\n2 1 3\n3 5 2\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n4 4 3\n2 2 7\n1 3 4\n3 5 1\n", "5 5\nRLRLL\n9 1 0 3 6\n1 4 10\n2 2 9\n2 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n9 5 1 5 1\n1 3 3\n2 4 5\n4 2 7\n1 5 0\n3 1 10\n", "5 5\nRLRLL\n9 5 0 3 6\n1 4 5\n4 4 3\n3 2 7\n1 3 4\n3 5 1\n", "5 5\nRLRLL\n9 1 0 3 6\n2 4 10\n2 2 9\n2 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n9 5 1 5 1\n1 3 3\n2 4 5\n4 2 7\n1 5 0\n3 2 10\n", "5 5\nRLRLL\n9 1 0 3 6\n2 4 20\n2 2 9\n2 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n9 5 1 5 1\n1 3 3\n3 4 5\n4 2 7\n1 5 0\n3 2 10\n", "5 5\nRLRLL\n9 1 0 3 6\n2 4 20\n2 2 14\n2 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n9 1 0 3 6\n2 4 20\n2 2 14\n4 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n2 1 0 3 6\n2 4 20\n2 2 14\n4 2 7\n1 5 0\n3 3 10\n", "5 5\nRLRLL\n2 1 0 3 6\n2 4 20\n2 2 14\n4 2 7\n1 6 0\n3 3 10\n", "5 5\nRLRLL\n2 1 1 3 6\n2 4 20\n2 2 14\n4 2 7\n1 6 0\n3 3 10\n", "5 5\nRLRLL\n2 1 1 3 6\n2 4 20\n2 2 14\n4 2 7\n1 6 -1\n3 3 10\n", "3 1\nRRL\n5 5 1\n3 1 10\n", "3 1\nRRL\n5 5 1\n3 1 10\n", "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 9\n4 2 16\n1 5 2\n3 5 10\n" ], "outputs": [ "1\n", "8\n", "6\n", "4\n", "3\n", "10\n", "5\n", "0\n", "9\n", "7\n", "2\n", "8\n", "6\n", "3\n", "8\n", "6\n", "3\n", "3\n", "8\n", "3\n", "4\n", "6\n", "6\n", "3\n", "6\n", "8\n", "1\n", "6\n", "6\n", "6\n", "3\n", "3\n", "3\n", "8\n", "6\n", "5\n", "3\n", "3\n", "8\n", "6\n", "6\n", "6\n", "3\n", "6\n", "8\n", "0\n", "5\n", "8\n", "3\n", "3\n", "8\n", "6\n", "3\n", "0\n", "6\n", "6\n", "3\n", "6\n", "0\n", "8\n", "3\n", "8\n", "6\n", "3\n", "0\n", "1\n", "5\n", "3\n", "8\n", "9\n", "3\n", "1\n", "5\n", "3\n", "7\n", "3\n", "1\n", "3\n", "1\n", "6\n", "7\n", "3\n", "0\n", "0\n", "1\n", "5\n", "4\n", "3\n", "0\n", "4\n", "0\n", "0\n", "0\n", "4\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "1\n", "1\n", "8\n" ], "question": "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 * 1000;\n\ntypedef struct flow_edge {\n int32_t vertex;\n int32_t next;\n flow_type capacity;\n} flow_edge;\n\ntypedef struct maxFlowGraph {\n flow_edge *edge;\n int32_t *start;\n int32_t vertex_num;\n int32_t pointer;\n int32_t edge_length;\n} graph;\n\ngraph* new_graph (const int32_t vertex_num) {\n graph *g = (graph *) calloc (1, sizeof (graph));\n g->vertex_num = vertex_num;\n const int32_t initial_length = 4;\n g->edge = (flow_edge *) calloc (initial_length, sizeof (flow_edge));\n g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n g->pointer = 0;\n g->edge_length = initial_length;\n for (int32_t i = 0; i < vertex_num; ++i) {\n g->start[i] = -1;\n }\n return g;\n}\n\nvoid add_edge (graph * const g, const int32_t from, const int32_t to, const flow_type capa) {\n //printf (\"edge %\" PRIi32 \" -> %\" PRIi32 \", %\" PRIi32 \"\\n\", from, to, capa);\n if (g->pointer == g->edge_length) {\n g->edge_length *= 2;\n g->edge = (flow_edge *) realloc (g->edge, sizeof (flow_edge) * g->edge_length);\n }\n const int32_t p = g->pointer;\n g->edge[p] = (flow_edge) {to, g->start[from], capa};\n g->start[from] = p;\n g->edge[p + 1] = (flow_edge) {from, g->start[to], 0};\n g->start[to] = p + 1;\n g->pointer += 2;\n}\n\nflow_type dinic_dfs (const int32_t v, const graph * const g, const int32_t dst, const int32_t * const level, int32_t * const iter, flow_type e) {\n if (v == dst) return e;\n flow_type sum = 0;\n for (int32_t p = iter[v]; p != -1; p = g->edge[p].next, iter[v] = p) {\n const int32_t u = g->edge[p].vertex;\n const flow_type capa = g->edge[p].capacity;\n if (level[u] <= level[v] || capa <= 0) continue;\n const flow_type f = dinic_dfs (u, g, dst, level, iter, capa < e ? capa : e);\n if (f > 0) {\n g->edge[p].capacity -= f;\n g->edge[p ^ 1].capacity += f;\n sum += f;\n e -= f;\n if (e <= 0) return sum;\n }\n }\n return sum;\n}\n\nflow_type dinic (const graph * const g, const int32_t src, const int32_t dst) {\n const int32_t vertex_num = g->vertex_num;\n int32_t * const level = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n int32_t * const queue = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n int32_t * const iter = (int32_t *) calloc (vertex_num, sizeof (int32_t));\n flow_type flow = 0;\n while (1) {\n memset (level, 0, sizeof (int32_t) * vertex_num);\n int32_t front = 0;\n int32_t last = 0;\n level[dst] = vertex_num;\n queue[last++] = dst;\n while (front < last && level[src] == 0) {\n const int32_t v = queue[front++];\n for (int32_t p = g->start[v]; p!=-1; p = g->edge[p].next) {\n const int32_t u = g->edge[p].vertex;\n if (g->edge[p ^ 1].capacity > 0 && level[u] == 0) {\n level[u] = level[v] - 1;\n queue[last++] = u;\n }\n }\n }\n if (level[src] == 0) break;\n memcpy (iter, g->start, sizeof (int32_t) * vertex_num);\n while (1) {\n flow_type f = dinic_dfs (src, g, dst, level, iter, flow_inf);\n if (f <= 0) break;\n flow += f;\n }\n }\n free (level);\n free (queue);\n free (iter);\n return flow;\n}\n\ntypedef int32_t i32;\n\nvoid run (void) {\n i32 n, m;\n scanf (\"%\" SCNi32 \"%\" SCNi32, &n, &m);\n char *u = (char *) calloc (n + 1, sizeof (char));\n scanf (\"%s\", u);\n graph *g = new_graph (n + 2);\n const i32 src = 0;\n const i32 dst = n + 1;\n for (i32 i = 1; i <= n; ++i) {\n i32 a;\n scanf (\"%\" SCNi32, &a);\n if (u[i - 1] =='R') {\n add_edge (g, src, i, a);\n } else {\n add_edge (g, i, dst, a);\n }\n }\n while (m--) {\n i32 s, t, b;\n scanf (\"%\" SCNi32 \"%\" SCNi32 \"%\" SCNi32, &s, &t, &b);\n if (s > t) {\n i32 swap = s;\n s = t;\n t = swap;\n }\n add_edge (g, s, t, b);\n }\n i32 ans = dinic (g, src, dst);\n printf (\"%\" PRIi32 \"\\n\", ans);\n}\n\nint main (void) {\n run ();\n return 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tflow_inf\n\t.section\t.rodata\n\t.align 4\n\t.type\tflow_inf, @object\n\t.size\tflow_inf, 4\nflow_inf:\n\t.long\t1000000\n\t.text\n\t.globl\tnew_graph\n\t.type\tnew_graph, @function\nnew_graph:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$32, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-20(%rbp), %edx\n\tmovl\t%edx, 16(%rax)\n\tmovl\t$4, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tmovl\t$12, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, 20(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t-12(%rbp), %edx\n\tmovl\t%edx, 24(%rax)\n\tmovl\t$0, -16(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovq\t-8(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$-1, (%rax)\n\taddl\t$1, -16(%rbp)\n.L2:\n\tmovl\t-16(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L3\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnew_graph, .-new_graph\n\t.globl\tadd_edge\n\t.type\tadd_edge, @function\nadd_edge:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t%esi, -28(%rbp)\n\tmovl\t%edx, -32(%rbp)\n\tmovl\t%ecx, -36(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t20(%rax), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L6\n\tmovq\t-24(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, 24(%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t24(%rax), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\trealloc@PLT\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n.L6:\n\tmovq\t-24(%rbp), %rax\n\tmovl\t20(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-28(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t-32(%rbp), %ecx\n\tmovl\t%ecx, (%rax)\n\tmovl\t%edx, 4(%rax)\n\tmovl\t-36(%rbp), %edx\n\tmovl\t%edx, 8(%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-28(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t8(%rdx), %rcx\n\tmovl\t-32(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$2, %rdx\n\taddq\t%rcx, %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t-28(%rbp), %ecx\n\tmovl\t%ecx, (%rax)\n\tmovl\t%edx, 4(%rax)\n\tmovl\t$0, 8(%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t-16(%rbp), %edx\n\taddl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t20(%rax), %eax\n\tleal\t2(%rax), %edx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t%edx, 20(%rax)\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tadd_edge, .-add_edge\n\t.globl\tdinic_dfs\n\t.type\tdinic_dfs, @function\ndinic_dfs:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovl\t%edi, -36(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovl\t%edx, -40(%rbp)\n\tmovq\t%rcx, -56(%rbp)\n\tmovq\t%r8, -64(%rbp)\n\tmovl\t%r9d, -68(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcmpl\t-40(%rbp), %eax\n\tjne\t.L8\n\tmovl\t-68(%rbp), %eax\n\tjmp\t.L9\n.L8:\n\tmovl\t$0, -20(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L10\n.L14:\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L15\n\tcmpl\t$0, -8(%rbp)\n\tjle\t.L15\n\tmovl\t-68(%rbp), %edx\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t%eax, %r8d\n\tmovq\t-64(%rbp), %rdi\n\tmovq\t-56(%rbp), %rcx\n\tmovl\t-40(%rbp), %edx\n\tmovq\t-48(%rbp), %rsi\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%r8d, %r9d\n\tmovq\t%rdi, %r8\n\tmovl\t%eax, %edi\n\tcall\tdinic_dfs\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tjle\t.L13\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %edx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rsi\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\tleaq\t(%rsi,%rax), %rcx\n\tmovl\t%edx, %eax\n\tsubl\t-4(%rbp), %eax\n\tmovl\t%eax, 8(%rcx)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\txorl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %ecx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rsi\n\tmovl\t-16(%rbp), %eax\n\txorl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rsi, %rax\n\tmovl\t-4(%rbp), %edx\n\taddl\t%ecx, %edx\n\tmovl\t%edx, 8(%rax)\n\tmovl\t-4(%rbp), %eax\n\taddl\t%eax, -20(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tsubl\t%eax, -68(%rbp)\n\tcmpl\t$0, -68(%rbp)\n\tjg\t.L13\n\tmovl\t-20(%rbp), %eax\n\tjmp\t.L9\n.L15:\n\tnop\n.L13:\n\tmovq\t-48(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n.L10:\n\tcmpl\t$-1, -16(%rbp)\n\tjne\t.L14\n\tmovl\t-20(%rbp), %eax\n.L9:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tdinic_dfs, .-dinic_dfs\n\t.globl\tdinic\n\t.type\tdinic, @function\ndinic:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovq\t%rdi, -72(%rbp)\n\tmovl\t%esi, -76(%rbp)\n\tmovl\t%edx, -80(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovl\t16(%rax), %eax\n\tmovl\t%eax, -40(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovl\t$0, -56(%rbp)\n.L28:\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, -52(%rbp)\n\tmovl\t$0, -48(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-40(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-48(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -48(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-80(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tjmp\t.L17\n.L22:\n\tmovl\t-52(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -36(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -44(%rbp)\n\tjmp\t.L18\n.L20:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-44(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -32(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-44(%rbp), %eax\n\txorl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t8(%rax), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L19\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L19\n\tmovl\t-36(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rcx, %rax\n\tsubl\t$1, %edx\n\tmovl\t%edx, (%rax)\n\tmovl\t-48(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -48(%rbp)\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-16(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n.L19:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovl\t-44(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tmovl\t4(%rax), %eax\n\tmovl\t%eax, -44(%rbp)\n.L18:\n\tcmpl\t$-1, -44(%rbp)\n\tjne\t.L20\n.L17:\n\tmovl\t-52(%rbp), %eax\n\tcmpl\t-48(%rbp), %eax\n\tjge\t.L21\n\tmovl\t-76(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\ttestl\t%eax, %eax\n\tje\t.L22\n.L21:\n\tmovl\t-76(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\ttestl\t%eax, %eax\n\tje\t.L32\n\tmovl\t-40(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rcx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmemcpy@PLT\n.L27:\n\tmovl\t$1000000, %r8d\n\tmovq\t-8(%rbp), %rdi\n\tmovq\t-24(%rbp), %rcx\n\tmovl\t-80(%rbp), %edx\n\tmovq\t-72(%rbp), %rsi\n\tmovl\t-76(%rbp), %eax\n\tmovl\t%r8d, %r9d\n\tmovq\t%rdi, %r8\n\tmovl\t%eax, %edi\n\tcall\tdinic_dfs\n\tmovl\t%eax, -28(%rbp)\n\tcmpl\t$0, -28(%rbp)\n\tjle\t.L33\n\tmovl\t-28(%rbp), %eax\n\taddl\t%eax, -56(%rbp)\n\tjmp\t.L27\n.L33:\n\tnop\n\tjmp\t.L28\n.L32:\n\tnop\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfree@PLT\n\tmovl\t-56(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tdinic, .-dinic\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%i%i\"\n.LC1:\n\t.string\t\"%s\"\n.LC2:\n\t.string\t\"%i\"\n.LC3:\n\t.string\t\"%i%i%i\"\n.LC4:\n\t.string\t\"%i\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-60(%rbp), %rdx\n\tleaq\t-64(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-64(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$1, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-64(%rbp), %eax\n\taddl\t$2, %eax\n\tmovl\t%eax, %edi\n\tcall\tnew_graph\n\tmovq\t%rax, -16(%rbp)\n\tmovl\t$0, -40(%rbp)\n\tmovl\t-64(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -36(%rbp)\n\tmovl\t$1, -44(%rbp)\n\tjmp\t.L35\n.L38:\n\tleaq\t-48(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-44(%rbp), %eax\n\tcltq\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovzbl\t(%rax), %eax\n\tcmpb\t$82, %al\n\tjne\t.L36\n\tmovl\t-48(%rbp), %ecx\n\tmovl\t-44(%rbp), %edx\n\tmovl\t-40(%rbp), %esi\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n\tjmp\t.L37\n.L36:\n\tmovl\t-48(%rbp), %ecx\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-44(%rbp), %esi\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n.L37:\n\taddl\t$1, -44(%rbp)\n.L35:\n\tmovl\t-64(%rbp), %eax\n\tcmpl\t%eax, -44(%rbp)\n\tjle\t.L38\n\tjmp\t.L39\n.L41:\n\tleaq\t-48(%rbp), %rcx\n\tleaq\t-52(%rbp), %rdx\n\tleaq\t-56(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-56(%rbp), %edx\n\tmovl\t-52(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjle\t.L40\n\tmovl\t-56(%rbp), %eax\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t-52(%rbp), %eax\n\tmovl\t%eax, -56(%rbp)\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, -52(%rbp)\n.L40:\n\tmovl\t-48(%rbp), %ecx\n\tmovl\t-52(%rbp), %edx\n\tmovl\t-56(%rbp), %esi\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tadd_edge\n.L39:\n\tmovl\t-60(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -60(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L41\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-40(%rbp), %ecx\n\tmovq\t-16(%rbp), %rax\n\tmovl\t%ecx, %esi\n\tmovq\t%rax, %rdi\n\tcall\tdinic\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L42\n\tcall\t__stack_chk_fail@PLT\n.L42:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 { int32_t vertex; int32_t next; flow_type capacity; } flow_edge; typedef struct maxFlowGraph { flow_edge *edge; int32_t *start; int32_t vertex_num; int32_t pointer; int32_t edge_length; } graph; graph* new_graph (const int32_t vertex_num) { graph *g = (graph *) calloc (1, sizeof (graph)); g->vertex_num = vertex_num; const int32_t initial_length = 4; g->edge = (flow_edge *) calloc (initial_length, sizeof (flow_edge)); g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t)); g->pointer = 0; g->edge_length = initial_length; for (int32_t i = 0; i < vertex_num; ++i) { g->start[i] = -1; } return g; } void add_edge (graph * const g, const int32_t from, const int32_t to, const flow_type capa) { //printf ("edge %" PRIi32 " -> %" PRIi32 ", %" PRIi32 "\n", from, to, capa); if (g->pointer == g->edge_length) { g->edge_length *= 2; g->edge = (flow_edge *) realloc (g->edge, sizeof (flow_edge) * g->edge_length); } const int32_t p = g->pointer; g->edge[p] = (flow_edge) {to, g->start[from], capa}; g->start[from] = p; g->edge[p + 1] = (flow_edge) {from, g->start[to], 0}; g->start[to] = p + 1; g->pointer += 2; } flow_type dinic_dfs (const int32_t v, const graph * const g, const int32_t dst, const int32_t * const level, int32_t * const iter, flow_type e) { if (v == dst) return e; flow_type sum = 0; for (int32_t p = iter[v]; p != -1; p = g->edge[p].next, iter[v] = p) { const int32_t u = g->edge[p].vertex; const flow_type capa = g->edge[p].capacity; if (level[u] <= level[v] || capa <= 0) continue; const flow_type f = dinic_dfs (u, g, dst, level, iter, capa < e ? capa : e); if (f > 0) { g->edge[p].capacity -= f; g->edge[p ^ 1].capacity += f; sum += f; e -= f; if (e <= 0) return sum; } } return sum; } flow_type dinic (const graph * const g, const int32_t src, const int32_t dst) { const int32_t vertex_num = g->vertex_num; int32_t * const level = (int32_t *) calloc (vertex_num, sizeof (int32_t)); int32_t * const queue = (int32_t *) calloc (vertex_num, sizeof (int32_t)); int32_t * const iter = (int32_t *) calloc (vertex_num, sizeof (int32_t)); flow_type flow = 0; while (1) { memset (level, 0, sizeof (int32_t) * vertex_num); int32_t front = 0; int32_t last = 0; level[dst] = vertex_num; queue[last++] = dst; while (front < last && level[src] == 0) { const int32_t v = queue[front++]; for (int32_t p = g->start[v]; p!=-1; p = g->edge[p].next) { const int32_t u = g->edge[p].vertex; if (g->edge[p ^ 1].capacity > 0 && level[u] == 0) { level[u] = level[v] - 1; queue[last++] = u; } } } if (level[src] == 0) break; memcpy (iter, g->start, sizeof (int32_t) * vertex_num); while (1) { flow_type f = dinic_dfs (src, g, dst, level, iter, flow_inf); if (f <= 0) break; flow += f; } } free (level); free (queue); free (iter); return flow; } typedef int32_t i32; void run (void) { i32 n, m; scanf ("%" SCNi32 "%" SCNi32, &n, &m); char *u = (char *) calloc (n + 1, sizeof (char)); scanf ("%s", u); graph *g = new_graph (n + 2); const i32 src = 0; const i32 dst = n + 1; for (i32 i = 1; i <= n; ++i) { i32 a; scanf ("%" SCNi32, &a); if (u[i - 1] =='R') { add_edge (g, src, i, a); } else { add_edge (g, i, dst, a); } } while (m--) { i32 s, t, b; scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &s, &t, &b); if (s > t) { i32 swap = s; s = t; t = swap; } add_edge (g, s, t, b); } i32 ans = dinic (g, src, dst); printf ("%" PRIi32 "\n", ans); } int main (void) { run (); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl flow_inf .section .rodata .align 4 .type flow_inf, @object .size flow_inf, 4 flow_inf: .long 1000000 .text .globl new_graph .type new_graph, @function new_graph: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl $32, %esi movl $1, %edi call calloc@PLT movq %rax, -8(%rbp) movq -8(%rbp), %rax movl -20(%rbp), %edx movl %edx, 16(%rax) movl $4, -12(%rbp) movl -12(%rbp), %eax cltq movl $12, %esi movq %rax, %rdi call calloc@PLT movq %rax, %rdx movq -8(%rbp), %rax movq %rdx, (%rax) movl -20(%rbp), %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, %rdx movq -8(%rbp), %rax movq %rdx, 8(%rax) movq -8(%rbp), %rax movl $0, 20(%rax) movq -8(%rbp), %rax movl -12(%rbp), %edx movl %edx, 24(%rax) movl $0, -16(%rbp) jmp .L2 .L3: movq -8(%rbp), %rax movq 8(%rax), %rdx movl -16(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl $-1, (%rax) addl $1, -16(%rbp) .L2: movl -16(%rbp), %eax cmpl -20(%rbp), %eax jl .L3 movq -8(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size new_graph, .-new_graph .globl add_edge .type add_edge, @function add_edge: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %rdi, -24(%rbp) movl %esi, -28(%rbp) movl %edx, -32(%rbp) movl %ecx, -36(%rbp) movq -24(%rbp), %rax movl 20(%rax), %edx movq -24(%rbp), %rax movl 24(%rax), %eax cmpl %eax, %edx jne .L6 movq -24(%rbp), %rax movl 24(%rax), %eax leal (%rax,%rax), %edx movq -24(%rbp), %rax movl %edx, 24(%rax) movq -24(%rbp), %rax movl 24(%rax), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax movq %rax, %rdx movq -24(%rbp), %rax movq (%rax), %rax movq %rdx, %rsi movq %rax, %rdi call realloc@PLT movq -24(%rbp), %rdx movq %rax, (%rdx) .L6: movq -24(%rbp), %rax movl 20(%rax), %eax movl %eax, -16(%rbp) movq -24(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movq -24(%rbp), %rdx movq 8(%rdx), %rcx movl -28(%rbp), %edx movslq %edx, %rdx salq $2, %rdx addq %rcx, %rdx movl (%rdx), %edx movl -32(%rbp), %ecx movl %ecx, (%rax) movl %edx, 4(%rax) movl -36(%rbp), %edx movl %edx, 8(%rax) movq -24(%rbp), %rax movq 8(%rax), %rdx movl -28(%rbp), %eax cltq salq $2, %rax addq %rax, %rdx movl -16(%rbp), %eax movl %eax, (%rdx) movq -24(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax cltq leaq 1(%rax), %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movq -24(%rbp), %rdx movq 8(%rdx), %rcx movl -32(%rbp), %edx movslq %edx, %rdx salq $2, %rdx addq %rcx, %rdx movl (%rdx), %edx movl -28(%rbp), %ecx movl %ecx, (%rax) movl %edx, 4(%rax) movl $0, 8(%rax) movq -24(%rbp), %rax movq 8(%rax), %rdx movl -32(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl -16(%rbp), %edx addl $1, %edx movl %edx, (%rax) movq -24(%rbp), %rax movl 20(%rax), %eax leal 2(%rax), %edx movq -24(%rbp), %rax movl %edx, 20(%rax) nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size add_edge, .-add_edge .globl dinic_dfs .type dinic_dfs, @function dinic_dfs: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $80, %rsp movl %edi, -36(%rbp) movq %rsi, -48(%rbp) movl %edx, -40(%rbp) movq %rcx, -56(%rbp) movq %r8, -64(%rbp) movl %r9d, -68(%rbp) movl -36(%rbp), %eax cmpl -40(%rbp), %eax jne .L8 movl -68(%rbp), %eax jmp .L9 .L8: movl $0, -20(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -64(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -16(%rbp) jmp .L10 .L14: movq -48(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl (%rax), %eax movl %eax, -12(%rbp) movq -48(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl 8(%rax), %eax movl %eax, -8(%rbp) movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -56(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -56(%rbp), %rax addq %rcx, %rax movl (%rax), %eax cmpl %eax, %edx jle .L15 cmpl $0, -8(%rbp) jle .L15 movl -68(%rbp), %edx movl -8(%rbp), %eax cmpl %eax, %edx cmovle %edx, %eax movl %eax, %r8d movq -64(%rbp), %rdi movq -56(%rbp), %rcx movl -40(%rbp), %edx movq -48(%rbp), %rsi movl -12(%rbp), %eax movl %r8d, %r9d movq %rdi, %r8 movl %eax, %edi call dinic_dfs movl %eax, -4(%rbp) cmpl $0, -4(%rbp) jle .L13 movq -48(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl 8(%rax), %edx movq -48(%rbp), %rax movq (%rax), %rsi movl -16(%rbp), %eax movslq %eax, %rcx movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $2, %rax leaq (%rsi,%rax), %rcx movl %edx, %eax subl -4(%rbp), %eax movl %eax, 8(%rcx) movq -48(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax xorl $1, %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl 8(%rax), %ecx movq -48(%rbp), %rax movq (%rax), %rsi movl -16(%rbp), %eax xorl $1, %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rsi, %rax movl -4(%rbp), %edx addl %ecx, %edx movl %edx, 8(%rax) movl -4(%rbp), %eax addl %eax, -20(%rbp) movl -4(%rbp), %eax subl %eax, -68(%rbp) cmpl $0, -68(%rbp) jg .L13 movl -20(%rbp), %eax jmp .L9 .L15: nop .L13: movq -48(%rbp), %rax movq (%rax), %rcx movl -16(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl 4(%rax), %eax movl %eax, -16(%rbp) movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -64(%rbp), %rax addq %rax, %rdx movl -16(%rbp), %eax movl %eax, (%rdx) .L10: cmpl $-1, -16(%rbp) jne .L14 movl -20(%rbp), %eax .L9: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size dinic_dfs, .-dinic_dfs .globl dinic .type dinic, @function dinic: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $80, %rsp movq %rdi, -72(%rbp) movl %esi, -76(%rbp) movl %edx, -80(%rbp) movq -72(%rbp), %rax movl 16(%rax), %eax movl %eax, -40(%rbp) movl -40(%rbp), %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -24(%rbp) movl -40(%rbp), %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -16(%rbp) movl -40(%rbp), %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -8(%rbp) movl $0, -56(%rbp) .L28: movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax movl $0, %esi movq %rax, %rdi call memset@PLT movl $0, -52(%rbp) movl $0, -48(%rbp) movl -80(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rax, %rdx movl -40(%rbp), %eax movl %eax, (%rdx) movl -48(%rbp), %eax leal 1(%rax), %edx movl %edx, -48(%rbp) cltq leaq 0(,%rax,4), %rdx movq -16(%rbp), %rax addq %rax, %rdx movl -80(%rbp), %eax movl %eax, (%rdx) jmp .L17 .L22: movl -52(%rbp), %eax leal 1(%rax), %edx movl %edx, -52(%rbp) cltq leaq 0(,%rax,4), %rdx movq -16(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -36(%rbp) movq -72(%rbp), %rax movq 8(%rax), %rdx movl -36(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -44(%rbp) jmp .L18 .L20: movq -72(%rbp), %rax movq (%rax), %rcx movl -44(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl (%rax), %eax movl %eax, -32(%rbp) movq -72(%rbp), %rax movq (%rax), %rcx movl -44(%rbp), %eax xorl $1, %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl 8(%rax), %eax testl %eax, %eax jle .L19 movl -32(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %eax testl %eax, %eax jne .L19 movl -36(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %edx movl -32(%rbp), %eax cltq leaq 0(,%rax,4), %rcx movq -24(%rbp), %rax addq %rcx, %rax subl $1, %edx movl %edx, (%rax) movl -48(%rbp), %eax leal 1(%rax), %edx movl %edx, -48(%rbp) cltq leaq 0(,%rax,4), %rdx movq -16(%rbp), %rax addq %rax, %rdx movl -32(%rbp), %eax movl %eax, (%rdx) .L19: movq -72(%rbp), %rax movq (%rax), %rcx movl -44(%rbp), %eax movslq %eax, %rdx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax addq %rcx, %rax movl 4(%rax), %eax movl %eax, -44(%rbp) .L18: cmpl $-1, -44(%rbp) jne .L20 .L17: movl -52(%rbp), %eax cmpl -48(%rbp), %eax jge .L21 movl -76(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %eax testl %eax, %eax je .L22 .L21: movl -76(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -24(%rbp), %rax addq %rdx, %rax movl (%rax), %eax testl %eax, %eax je .L32 movl -40(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -72(%rbp), %rax movq 8(%rax), %rcx movq -8(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call memcpy@PLT .L27: movl $1000000, %r8d movq -8(%rbp), %rdi movq -24(%rbp), %rcx movl -80(%rbp), %edx movq -72(%rbp), %rsi movl -76(%rbp), %eax movl %r8d, %r9d movq %rdi, %r8 movl %eax, %edi call dinic_dfs movl %eax, -28(%rbp) cmpl $0, -28(%rbp) jle .L33 movl -28(%rbp), %eax addl %eax, -56(%rbp) jmp .L27 .L33: nop jmp .L28 .L32: nop movq -24(%rbp), %rax movq %rax, %rdi call free@PLT movq -16(%rbp), %rax movq %rax, %rdi call free@PLT movq -8(%rbp), %rax movq %rax, %rdi call free@PLT movl -56(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size dinic, .-dinic .section .rodata .LC0: .string "%i%i" .LC1: .string "%s" .LC2: .string "%i" .LC3: .string "%i%i%i" .LC4: .string "%i\n" .text .globl run .type run, @function run: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $64, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -60(%rbp), %rdx leaq -64(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -64(%rbp), %eax addl $1, %eax cltq movl $1, %esi movq %rax, %rdi call calloc@PLT movq %rax, -24(%rbp) movq -24(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -64(%rbp), %eax addl $2, %eax movl %eax, %edi call new_graph movq %rax, -16(%rbp) movl $0, -40(%rbp) movl -64(%rbp), %eax addl $1, %eax movl %eax, -36(%rbp) movl $1, -44(%rbp) jmp .L35 .L38: leaq -48(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -44(%rbp), %eax cltq leaq -1(%rax), %rdx movq -24(%rbp), %rax addq %rdx, %rax movzbl (%rax), %eax cmpb $82, %al jne .L36 movl -48(%rbp), %ecx movl -44(%rbp), %edx movl -40(%rbp), %esi movq -16(%rbp), %rax movq %rax, %rdi call add_edge jmp .L37 .L36: movl -48(%rbp), %ecx movl -36(%rbp), %edx movl -44(%rbp), %esi movq -16(%rbp), %rax movq %rax, %rdi call add_edge .L37: addl $1, -44(%rbp) .L35: movl -64(%rbp), %eax cmpl %eax, -44(%rbp) jle .L38 jmp .L39 .L41: leaq -48(%rbp), %rcx leaq -52(%rbp), %rdx leaq -56(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -56(%rbp), %edx movl -52(%rbp), %eax cmpl %eax, %edx jle .L40 movl -56(%rbp), %eax movl %eax, -28(%rbp) movl -52(%rbp), %eax movl %eax, -56(%rbp) movl -28(%rbp), %eax movl %eax, -52(%rbp) .L40: movl -48(%rbp), %ecx movl -52(%rbp), %edx movl -56(%rbp), %esi movq -16(%rbp), %rax movq %rax, %rdi call add_edge .L39: movl -60(%rbp), %eax leal -1(%rax), %edx movl %edx, -60(%rbp) testl %eax, %eax jne .L41 movl -36(%rbp), %edx movl -40(%rbp), %ecx movq -16(%rbp), %rax movl %ecx, %esi movq %rax, %rdi call dinic movl %eax, -32(%rbp) movl -32(%rbp), %eax movl %eax, %esi leaq .LC4(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT nop movq -8(%rbp), %rax subq %fs:40, %rax je .L42 call __stack_chk_fail@PLT .L42: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size run, .-run .globl main .type main, @function main: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 call run movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(w>g[t[i]].s)\n\t\t\t\treturn;\n\t\t\tw+=g[t[i]].w;\n\t\t\tG+=g[t[i]].w*(i+1);\n\t\t}\n\t\tif(max<G)\n\t\t{\n\t\t\tmax=G;\n\t\t\tmemcpy(ans,t,40);\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(!f[i])\n\t\t\t{\n\t\t\t\tf[i]=1;\n\t\t\t\tt[d]=i;\n\t\t\t\trec(d+1);\n\t\t\t\tf[i]=0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint i;\n\tfor(;;)\n\t{\n\t\tmemset(ans,0,40);\n\t\tmemset(f,0,40);\n\t\tmax=0;\n\t\tscanf(\"%d\",&n);\n\t\tif(!n)\n\t\t\treturn 0;\n\t\tfor(i=0;i<n;i++)\n\t\t\tscanf(\"%s %d%d\",g[i].f,&g[i].w,&g[i].s);\n\t\trec(0);\n\t\twhile(-- n>=0)\n\t\t\tputs(g[ans[n]].f);\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tg\n\t.bss\n\t.align 32\n\t.type\tg, @object\n\t.size\tg, 320\ng:\n\t.zero\t320\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 40\nt:\n\t.zero\t40\n\t.globl\tf\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 40\nf:\n\t.zero\t40\n\t.globl\tans\n\t.align 32\n\t.type\tans, @object\n\t.size\tans, 40\nans:\n\t.zero\t40\n\t.globl\tmax\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.text\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjne\t.L2\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t24+g(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjg\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t28+g(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, -8(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t28+g(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-12(%rbp), %edx\n\taddl\t$1, %edx\n\timull\t%edx, %eax\n\taddl\t%eax, -4(%rbp)\n\taddl\t$1, -12(%rbp)\n.L3:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L6\n\tmovl\tmax(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjle\t.L1\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, max(%rip)\n\tmovq\tt(%rip), %rax\n\tmovq\t8+t(%rip), %rdx\n\tmovq\t%rax, ans(%rip)\n\tmovq\t%rdx, 8+ans(%rip)\n\tmovq\t16+t(%rip), %rax\n\tmovq\t24+t(%rip), %rdx\n\tmovq\t%rax, 16+ans(%rip)\n\tmovq\t%rdx, 24+ans(%rip)\n\tmovq\t32+t(%rip), %rax\n\tmovq\t%rax, 32+ans(%rip)\n\tjmp\t.L1\n.L2:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L7\n.L9:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L8\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tt(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\trec\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t$0, (%rdx,%rax)\n.L8:\n\taddl\t$1, -12(%rbp)\n.L7:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L9\n\tjmp\t.L1\n.L10:\n\tnop\n.L1:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\trec, .-rec\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%s %d%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n.L18:\n\tmovl\t$40, %edx\n\tmovl\t$0, %esi\n\tleaq\tans(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$40, %edx\n\tmovl\t$0, %esi\n\tleaq\tf(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, max(%rip)\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L12\n\tmovl\t$0, %eax\n\tjmp\t.L19\n.L12:\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tleaq\t16(%rax), %rdx\n\tleaq\tg(%rip), %rax\n\taddq\t%rdx, %rax\n\tleaq\t8(%rax), %rcx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tleaq\t16(%rax), %rdx\n\tleaq\tg(%rip), %rax\n\taddq\t%rdx, %rax\n\tleaq\t12(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rsi\n\tleaq\tg(%rip), %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -4(%rbp)\n.L14:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjl\t.L15\n\tmovl\t$0, %edi\n\tcall\trec\n\tjmp\t.L16\n.L17:\n\tmovl\tn(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tans(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tg(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L16:\n\tmovl\tn(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, n(%rip)\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjns\t.L17\n\tjmp\t.L18\n.L19:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tmovl\tf(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L49\n\tcmpl\t$1, %eax\n\tjle\t.L1\n.L59:\n\tmovl\t4+f(%rip), %r11d\n\ttestl\t%r11d, %r11d\n\tje\t.L50\n.L10:\n\tcmpl\t$2, %eax\n\tjle\t.L1\n\tmovl\t8+f(%rip), %r10d\n\ttestl\t%r10d, %r10d\n\tje\t.L51\n.L11:\n\tcmpl\t$3, %eax\n\tjle\t.L1\n\tmovl\t12+f(%rip), %r9d\n\ttestl\t%r9d, %r9d\n\tje\t.L52\n.L12:\n\tcmpl\t$4, %eax\n\tjle\t.L1\n\tmovl\t16+f(%rip), %r8d\n\ttestl\t%r8d, %r8d\n\tje\t.L53\n.L13:\n\tcmpl\t$5, %eax\n\tjle\t.L1\n\tmovl\t20+f(%rip), %edi\n\ttestl\t%edi, %edi\n\tje\t.L54\n.L14:\n\tcmpl\t$6, %eax\n\tjle\t.L1\n\tmovl\t24+f(%rip), %esi\n\ttestl\t%esi, %esi\n\tje\t.L55\n.L15:\n\tcmpl\t$7, %eax\n\tjle\t.L1\n\tmovl\t28+f(%rip), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L56\n.L16:\n\tcmpl\t$8, %eax\n\tjle\t.L1\n\tmovl\t32+f(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L57\n.L17:\n\tcmpl\t$9, %eax\n\tjle\t.L1\n\tmovl\t36+f(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L58\n.L1:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\t.cfi_restore_state\n\ttestl\t%edi, %edi\n\tjle\t.L19\n\tmovslq\tt(%rip), %rax\n\tleaq\tg(%rip), %rcx\n\tsalq\t$5, %rax\n\taddq\t%rcx, %rax\n\tmovl\t24(%rax), %esi\n\ttestl\t%esi, %esi\n\tjs\t.L1\n\tmovl\t28(%rax), %edx\n\tcmpl\t$1, %edi\n\tje\t.L5\n\tmovslq\t4+t(%rip), %rax\n\tsalq\t$5, %rax\n\taddq\t%rcx, %rax\n\tcmpl\t24(%rax), %edx\n\tjg\t.L1\n\tmovl\t28(%rax), %esi\n\tleal\t(%rdx,%rsi), %eax\n\tleal\t(%rsi,%rax), %edx\n\tcmpl\t$2, %edi\n\tje\t.L5\n\tmovslq\t8+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,2), %esi\n\taddl\t%esi, %edx\n\tcmpl\t$3, %edi\n\tje\t.L5\n\tmovslq\t12+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rdx,%rsi,4), %edx\n\tcmpl\t$4, %edi\n\tje\t.L5\n\tmovslq\t16+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,4), %esi\n\taddl\t%esi, %edx\n\tcmpl\t$5, %edi\n\tje\t.L5\n\tmovslq\t20+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,2), %esi\n\tleal\t(%rdx,%rsi,2), %edx\n\tcmpl\t$6, %edi\n\tje\t.L5\n\tmovslq\t24+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\tleal\t(%rdx,%rsi,8), %edx\n\taddl\t%esi, %eax\n\tsubl\t%esi, %edx\n\tcmpl\t$7, %edi\n\tje\t.L5\n\tmovslq\t28+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rdx,%rsi,8), %edx\n\tcmpl\t$8, %edi\n\tje\t.L5\n\tmovslq\t32+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,8), %esi\n\taddl\t%esi, %edx\n\tcmpl\t$9, %edi\n\tje\t.L5\n\tmovslq\t36+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rsi, %rcx\n\tcmpl\t%eax, 24(%rcx)\n\tjl\t.L1\n\tmovl\t28(%rcx), %eax\n\tleal\t(%rax,%rax,4), %eax\n\tleal\t(%rdx,%rax,2), %edx\n.L5:\n\tcmpl\t%edx, max(%rip)\n\tjge\t.L1\n\tmovdqa\tt(%rip), %xmm0\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovl\t%edx, max(%rip)\n\tmovdqa\t16+t(%rip), %xmm1\n\tmovq\t32+t(%rip), %rax\n\tmovaps\t%xmm0, ans(%rip)\n\tmovq\t%rax, 32+ans(%rip)\n\tmovaps\t%xmm1, 16+ans(%rip)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L49:\n\t.cfi_restore_state\n\tmovslq\t%edi, %rax\n\tleal\t1(%rdi), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, f(%rip)\n\tmovl\t$0, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, f(%rip)\n\tcmpl\t$1, %eax\n\tjg\t.L59\n\tjmp\t.L1\n\t.p2align 4,,10\n\t.p2align 3\n.L52:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 12+f(%rip)\n\tmovl\t$3, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 12+f(%rip)\n\tjmp\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 4+f(%rip)\n\tmovl\t$1, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 4+f(%rip)\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 8+f(%rip)\n\tmovl\t$2, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 8+f(%rip)\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 16+f(%rip)\n\tmovl\t$4, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 16+f(%rip)\n\tjmp\t.L13\n.L57:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 32+f(%rip)\n\tmovl\t$8, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 32+f(%rip)\n\tjmp\t.L17\n.L58:\n\tmovslq\t%ebx, %rdx\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rax\n\tmovl\t$1, 36+f(%rip)\n\tmovl\t$9, (%rax,%rdx,4)\n\tcall\trec\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovl\t$0, 36+f(%rip)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L54:\n\t.cfi_restore_state\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 20+f(%rip)\n\tmovl\t$5, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 20+f(%rip)\n\tjmp\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L55:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 24+f(%rip)\n\tmovl\t$6, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 24+f(%rip)\n\tjmp\t.L15\n.L56:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 28+f(%rip)\n\tmovl\t$7, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 28+f(%rip)\n\tjmp\t.L16\n.L19:\n\txorl\t%edx, %edx\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE35:\n\t.size\trec, .-rec\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%s %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.LFB36:\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\tleaq\tn(%rip), %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\t.LC1(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\tg(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\tans(%rip), %rbx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%r14, %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tmovq\t$0, 32+ans(%rip)\n\tmovq\t$0, 32+f(%rip)\n\tmovl\t$0, max(%rip)\n\tmovaps\t%xmm0, ans(%rip)\n\tmovaps\t%xmm0, 16+ans(%rip)\n\tmovaps\t%xmm0, f(%rip)\n\tmovaps\t%xmm0, 16+f(%rip)\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L68\n\tleaq\tg(%rip), %r15\n\tmovl\t$0, %r13d\n\tjle\t.L66\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\tleaq\t24(%r15), %rcx\n\tleaq\t28(%r15), %rdx\n\tmovq\t%r15, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rdi\n\taddl\t$1, %r13d\n\taddq\t$32, %r15\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t%r13d, n(%rip)\n\tjg\t.L65\n.L66:\n\txorl\t%edi, %edi\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, n(%rip)\n\tjs\t.L67\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tcltq\n\tmovslq\t(%rbx,%rax,4), %rdi\n\tsalq\t$5, %rdi\n\taddq\t%rbp, %rdi\n\tcall\tputs@PLT\n\tmovl\tn(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, n(%rip)\n\tjns\t.L63\n\tjmp\t.L67\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE36:\n\t.size\tmain, .-main\n\t.globl\tmax\n\t.bss\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.globl\tans\n\t.align 32\n\t.type\tans, @object\n\t.size\tans, 40\nans:\n\t.zero\t40\n\t.globl\tf\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 40\nf:\n\t.zero\t40\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 40\nt:\n\t.zero\t40\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tg\n\t.align 32\n\t.type\tg, @object\n\t.size\tg, 320\ng:\n\t.zero\t320\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tf(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L49\n\tcmpl\t$1, %eax\n\tjle\t.L1\n.L59:\n\tmovl\t4+f(%rip), %r11d\n\ttestl\t%r11d, %r11d\n\tje\t.L50\n.L10:\n\tcmpl\t$2, %eax\n\tjle\t.L1\n\tmovl\t8+f(%rip), %r10d\n\ttestl\t%r10d, %r10d\n\tje\t.L51\n.L11:\n\tcmpl\t$3, %eax\n\tjle\t.L1\n\tmovl\t12+f(%rip), %r9d\n\ttestl\t%r9d, %r9d\n\tje\t.L52\n.L12:\n\tcmpl\t$4, %eax\n\tjle\t.L1\n\tmovl\t16+f(%rip), %r8d\n\ttestl\t%r8d, %r8d\n\tje\t.L53\n.L13:\n\tcmpl\t$5, %eax\n\tjle\t.L1\n\tmovl\t20+f(%rip), %edi\n\ttestl\t%edi, %edi\n\tje\t.L54\n.L14:\n\tcmpl\t$6, %eax\n\tjle\t.L1\n\tmovl\t24+f(%rip), %esi\n\ttestl\t%esi, %esi\n\tje\t.L55\n.L15:\n\tcmpl\t$7, %eax\n\tjle\t.L1\n\tmovl\t28+f(%rip), %ecx\n\ttestl\t%ecx, %ecx\n\tje\t.L56\n.L16:\n\tcmpl\t$8, %eax\n\tjle\t.L1\n\tmovl\t32+f(%rip), %edx\n\ttestl\t%edx, %edx\n\tje\t.L57\n.L17:\n\tcmpl\t$9, %eax\n\tjle\t.L1\n\tmovl\t36+f(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L58\n.L1:\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\t.cfi_restore_state\n\ttestl\t%edi, %edi\n\tjle\t.L19\n\tmovslq\tt(%rip), %rax\n\tleaq\tg(%rip), %rcx\n\tsalq\t$5, %rax\n\taddq\t%rcx, %rax\n\tmovl\t24(%rax), %esi\n\ttestl\t%esi, %esi\n\tjs\t.L1\n\tmovl\t28(%rax), %edx\n\tcmpl\t$1, %edi\n\tje\t.L5\n\tmovslq\t4+t(%rip), %rax\n\tsalq\t$5, %rax\n\taddq\t%rcx, %rax\n\tcmpl\t24(%rax), %edx\n\tjg\t.L1\n\tmovl\t28(%rax), %esi\n\tleal\t(%rdx,%rsi), %eax\n\tleal\t(%rsi,%rax), %edx\n\tcmpl\t$2, %edi\n\tje\t.L5\n\tmovslq\t8+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,2), %esi\n\taddl\t%esi, %edx\n\tcmpl\t$3, %edi\n\tje\t.L5\n\tmovslq\t12+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rdx,%rsi,4), %edx\n\tcmpl\t$4, %edi\n\tje\t.L5\n\tmovslq\t16+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,4), %esi\n\taddl\t%esi, %edx\n\tcmpl\t$5, %edi\n\tje\t.L5\n\tmovslq\t20+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,2), %esi\n\tleal\t(%rdx,%rsi,2), %edx\n\tcmpl\t$6, %edi\n\tje\t.L5\n\tmovslq\t24+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\tleal\t(%rdx,%rsi,8), %edx\n\taddl\t%esi, %eax\n\tsubl\t%esi, %edx\n\tcmpl\t$7, %edi\n\tje\t.L5\n\tmovslq\t28+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rdx,%rsi,8), %edx\n\tcmpl\t$8, %edi\n\tje\t.L5\n\tmovslq\t32+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rcx, %rsi\n\tcmpl\t24(%rsi), %eax\n\tjg\t.L1\n\tmovl\t28(%rsi), %esi\n\taddl\t%esi, %eax\n\tleal\t(%rsi,%rsi,8), %esi\n\taddl\t%esi, %edx\n\tcmpl\t$9, %edi\n\tje\t.L5\n\tmovslq\t36+t(%rip), %rsi\n\tsalq\t$5, %rsi\n\taddq\t%rsi, %rcx\n\tcmpl\t%eax, 24(%rcx)\n\tjl\t.L1\n\tmovl\t28(%rcx), %eax\n\tleal\t(%rax,%rax,4), %eax\n\tleal\t(%rdx,%rax,2), %edx\n.L5:\n\tcmpl\t%edx, max(%rip)\n\tjge\t.L1\n\tmovdqa\tt(%rip), %xmm0\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovl\t%edx, max(%rip)\n\tmovdqa\t16+t(%rip), %xmm1\n\tmovq\t32+t(%rip), %rax\n\tmovaps\t%xmm0, ans(%rip)\n\tmovq\t%rax, 32+ans(%rip)\n\tmovaps\t%xmm1, 16+ans(%rip)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L49:\n\t.cfi_restore_state\n\tmovslq\t%edi, %rax\n\tleal\t1(%rdi), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, f(%rip)\n\tmovl\t$0, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, f(%rip)\n\tcmpl\t$1, %eax\n\tjg\t.L59\n\tjmp\t.L1\n\t.p2align 4,,10\n\t.p2align 3\n.L52:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 12+f(%rip)\n\tmovl\t$3, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 12+f(%rip)\n\tjmp\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L50:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 4+f(%rip)\n\tmovl\t$1, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 4+f(%rip)\n\tjmp\t.L10\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 8+f(%rip)\n\tmovl\t$2, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 8+f(%rip)\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L53:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 16+f(%rip)\n\tmovl\t$4, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 16+f(%rip)\n\tjmp\t.L13\n.L57:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 32+f(%rip)\n\tmovl\t$8, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 32+f(%rip)\n\tjmp\t.L17\n.L58:\n\tmovslq\t%ebx, %rdx\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rax\n\tmovl\t$1, 36+f(%rip)\n\tmovl\t$9, (%rax,%rdx,4)\n\tcall\trec\n\tpopq\t%rbx\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tmovl\t$0, 36+f(%rip)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L54:\n\t.cfi_restore_state\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 20+f(%rip)\n\tmovl\t$5, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 20+f(%rip)\n\tjmp\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L55:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 24+f(%rip)\n\tmovl\t$6, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 24+f(%rip)\n\tjmp\t.L15\n.L56:\n\tmovslq\t%ebx, %rax\n\tleal\t1(%rbx), %edi\n\tleaq\tt(%rip), %rdx\n\tmovl\t$1, 28+f(%rip)\n\tmovl\t$7, (%rdx,%rax,4)\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tmovl\t$0, 28+f(%rip)\n\tjmp\t.L16\n.L19:\n\txorl\t%edx, %edx\n\tjmp\t.L5\n\t.cfi_endproc\n.LFE35:\n\t.size\trec, .-rec\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%s %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.LFB36:\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\tleaq\tn(%rip), %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\t.LC1(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tleaq\tg(%rip), %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tleaq\tans(%rip), %rbx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\t.p2align 4,,10\n\t.p2align 3\n.L67:\n\tpxor\t%xmm0, %xmm0\n\tmovq\t%r14, %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tmovq\t$0, 32+ans(%rip)\n\tmovq\t$0, 32+f(%rip)\n\tmovl\t$0, max(%rip)\n\tmovaps\t%xmm0, ans(%rip)\n\tmovaps\t%xmm0, 16+ans(%rip)\n\tmovaps\t%xmm0, f(%rip)\n\tmovaps\t%xmm0, 16+f(%rip)\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tje\t.L68\n\tleaq\tg(%rip), %r15\n\tmovl\t$0, %r13d\n\tjle\t.L66\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\tleaq\t24(%r15), %rcx\n\tleaq\t28(%r15), %rdx\n\tmovq\t%r15, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%r12, %rdi\n\taddl\t$1, %r13d\n\taddq\t$32, %r15\n\tcall\t__isoc99_scanf@PLT\n\tcmpl\t%r13d, n(%rip)\n\tjg\t.L65\n.L66:\n\txorl\t%edi, %edi\n\tcall\trec\n\tmovl\tn(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, n(%rip)\n\tjs\t.L67\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tcltq\n\tmovslq\t(%rbx,%rax,4), %rdi\n\tsalq\t$5, %rdi\n\taddq\t%rbp, %rdi\n\tcall\tputs@PLT\n\tmovl\tn(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, n(%rip)\n\tjns\t.L63\n\tjmp\t.L67\n\t.p2align 4,,10\n\t.p2align 3\n.L68:\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE36:\n\t.size\tmain, .-main\n\t.globl\tmax\n\t.bss\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.globl\tans\n\t.align 32\n\t.type\tans, @object\n\t.size\tans, 40\nans:\n\t.zero\t40\n\t.globl\tf\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 40\nf:\n\t.zero\t40\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 40\nt:\n\t.zero\t40\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tg\n\t.align 32\n\t.type\tg, @object\n\t.size\tg, 320\ng:\n\t.zero\t320\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(w>g[t[i]].s)\n\t\t\t\treturn;\n\t\t\tw+=g[t[i]].w;\n\t\t\tG+=g[t[i]].w*(i+1);\n\t\t}\n\t\tif(max<G)\n\t\t{\n\t\t\tmax=G;\n\t\t\tmemcpy(ans,t,40);\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(!f[i])\n\t\t\t{\n\t\t\t\tf[i]=1;\n\t\t\t\tt[d]=i;\n\t\t\t\trec(d+1);\n\t\t\t\tf[i]=0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint i;\n\tfor(;;)\n\t{\n\t\tmemset(ans,0,40);\n\t\tmemset(f,0,40);\n\t\tmax=0;\n\t\tscanf(\"%d\",&n);\n\t\tif(!n)\n\t\t\treturn 0;\n\t\tfor(i=0;i<n;i++)\n\t\t\tscanf(\"%s %d%d\",g[i].f,&g[i].w,&g[i].s);\n\t\trec(0);\n\t\twhile(-- n>=0)\n\t\t\tputs(g[ans[n]].f);\n\t}\n\treturn 0;\n}", "index": 104, "inputs": [ "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 30 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\netalocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwidh 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemuynak 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemuynak 110 500\neualocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwhch 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\nekac 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\ntandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\netalocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\ntandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nnapna 70 280\nmikan 50 80\nkanzume 100 500\netalocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanp`n 70 280\nmnkai 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanpan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 26\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 159\nmikan 50 80\nkanzume 101 500\nchocolaud 31 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 26\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 159\nmikan 50 80\nkanzume 101 500\nchocolaud 31 350\ncookie 30 80\npuqin 40 400\ncracker 40 160\n0\n", "4\nsandwich 30 120\nelppa 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nampan 70 280\nmikan 50 80\nemuynak 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\nourni 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 280\nnikan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 21 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\n`pple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 101 500\nchocolaud 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwici 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 213\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\ntandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nnapna 70 280\nmikan 50 80\nkanzume 100 500\netamocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkan 50 80\namuynek 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 26\ncbke 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 159\nmikan 50 80\nkanyume 101 500\nchocolaud 31 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwici 80 120\napple 50 200\ncheese 20 40\ncakf 100 100\n9\nonigiri 66 213\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 49\nqurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkam 50 80\namuynek 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwici 80 120\napple 50 200\ncheese 20 40\ncakf 100 100\n9\nonigiri 66 213\nonigiri 80 300\nanpan 70 280\nmiakn 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 80 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 217\nonigiri 80 300\nanp`n 70 280\niaknm 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 30 120\nelppa 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 101 500\nchocolate 50 350\niookce 30 132\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 80 120\napple 80 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 217\nonigiri 80 300\naop`n 70 280\niaknm 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napple 80 200\ncheese 20 40\ncale 100 100\n9\nonigiri 66 217\nonigiri 80 300\naop`n 70 280\niaknm 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 17 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napelp 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\naopan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nirigino 66 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanpan 70 85\nmikan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 213\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 14 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nirigino 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napple 50 200\neheesc 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 101 500\nchocolaud 31 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanp`n 70 280\nmnkai 50 80\nkanyume 100 500\ndualocohc 50 350\ncookie 30 80\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanpan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 50 350\neookic 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nnikan 50 107\nemuynak 110 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 41 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemuynak 110 500\neualocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 22 160\n0\n", "4\nsandwich 21 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\ncholocaue 50 350\ncookie 30 80\npusin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\nchocaloud 50 350\ncookie 30 49\npurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 217\nonigiri 80 300\nanp`n 70 280\nmnkai 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\nrekcarc 40 306\n0\n", "4\nrandwich 80 120\napple 50 200\ncheese 20 26\ncbke 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 159\nmikan 50 80\nkanyume 101 500\nchocolaud 31 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 22 120\nbpple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncracker 40 160\n0\n", "4\nsandwici 80 120\napple 50 200\ncheese 20 40\ncakf 100 100\n9\nonigiri 66 213\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolavd 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\noiignri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 49\nqurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 22 120\nappke 50 300\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkam 50 80\namuynek 100 807\nchocolaud 50 350\neikooc 30 80\npusni 40 400\ncracker 40 275\n0\n", "4\nsandwich 17 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nnikam 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 167\nonigiri 80 300\naopan 70 280\nmikan 50 80\nkanyume 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 30 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmkian 50 80\nkanzume 101 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 159\nmikan 50 80\nkanyume 101 500\nchocolatd 31 350\ncookie 30 80\npurin 40 775\ncracker 40 160\n0\n", "4\nsandwhch 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 50 350\ncookie 30 80\npusni 40 703\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 41 200\ncheese 20 40\ncbke 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemuynak 110 500\neualocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 22 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonighri 66 217\nonigiri 80 300\nanp`n 70 280\nmnkai 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 80\npurni 40 400\nrekcarc 40 306\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 41\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nampan 70 280\nmikan 50 80\nemuynbk 100 500\nchocolaue 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 22 120\nbpelp 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\nbake 100 100\n9\nonigiri 66 300\noiignri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\nchocolaud 50 350\ncookie 30 49\nqurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 22 120\nappke 50 300\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncradker 40 160\n0\n", "4\ntandwich 80 120\napple 50 200\ncheese 20 24\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\netalocohc 32 350\ncookei 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napole 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 159\nmikan 50 80\nkanyume 101 500\nchocolatd 31 350\ncookie 30 80\npurin 40 775\ncracker 40 160\n0\n", "4\nsandwhch 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkan 50 80\nkenyuma 100 500\nchocolaud 18 350\ncookie 30 80\npusni 40 703\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 41 200\ncheese 20 40\ncbke 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemuznak 110 500\neualocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 22 160\n0\n", "4\nsandwich 21 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzemu 100 500\ncholocaue 50 350\ncookie 30 80\npusin 40 783\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 57 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigiri 80 300\nann`p 70 280\nmikan 50 80\nkanyume 100 500\nchocaloud 50 350\ncookie 30 49\npurni 40 400\ncracker 40 306\n0\n", "4\ntandwich 80 120\napple 50 200\ncheese 14 5\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nnapna 70 280\nmikan 50 80\nkanzume 100 500\netamocohc 50 350\ncookie 30 80\npurim 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonighri 66 217\nonigiri 80 300\nanp`n 70 280\nmnkai 50 80\nkanyume 100 500\nchocolaud 50 350\ncookif 30 80\npurni 40 400\nrekcarc 40 306\n0\n", "4\nsandwich 24 120\nelppa 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 315\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 101 500\nchcoolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 154\n0\n", "4\nsandwich 22 120\nbpelp 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncradker 40 160\n0\n", "4\nsandwici 52 120\napple 50 200\ncheese 20 40\ncakf 100 100\n9\noniiirg 66 213\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanyume 100 500\nchocolavd 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\nbake 100 100\n9\nonigiri 66 300\noiignri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\ndhocolauc 50 350\ncookie 30 49\nqurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 22 120\nappke 50 300\neseehc 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncradker 40 160\n0\n", "4\nsandwici 80 120\napple 50 200\ncheese 20 40\ncakf 100 110\n9\nonigiri 66 213\nonigiri 80 300\nanpan 70 280\nmiakn 50 80\nkanyume 100 977\nchocolaud 50 350\ncookie 30 80\npurim 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemuynak 100 500\neualocohc 50 350\ncookie 30 80\npurin 61 400\ncrackfr 40 270\n0\n", "4\ntandwich 80 120\napple 50 200\ncheese 20 24\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\netalocohc 32 350\noockei 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwhch 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\nonigirh 80 300\nanoan 70 280\nmhkan 50 80\nkeoyuma 100 500\nchocolaud 18 350\ncookie 30 80\npusni 40 703\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 41 200\ncheese 20 40\ncbke 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nemtznak 110 500\neualocohc 50 350\ncookie 30 80\npurin 40 400\ncracker 22 160\n0\n", "4\ntacdwinh 80 120\napple 50 200\ncheese 14 5\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nnapna 70 280\nmikan 50 80\nkanzume 100 500\netamocohc 50 350\ncookie 30 80\npurim 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonighri 66 217\nonigiri 80 300\nanp`n 70 280\nmnkai 50 80\nkanyume 100 500\nchocolbud 50 350\ncookif 30 80\npurni 40 400\nrekcarc 40 306\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\nbake 100 100\n9\nonigiri 66 300\noiignri 80 300\nanp`n 70 280\nmikan 50 80\nkanyume 100 500\ndhpcolauc 50 350\ncookie 30 49\nqurni 40 400\ncracker 40 306\n0\n", "4\nsandwich 22 120\nappke 50 300\neseehd 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolaue 50 350\ncookie 30 80\npusin 40 400\ncradker 40 160\n0\n", "4\ntbndwich 80 120\napple 50 200\ncheese 20 24\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\netalocohc 32 350\noockei 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwhch 80 120\napqle 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 66 300\npnigirh 80 300\nanoan 70 280\nmhkan 50 80\nkeoyuma 100 500\nchocolaud 18 350\ncookie 30 80\npusni 40 703\ncracker 40 275\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n", "4\nsandwich 80 120\napple 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 100 500\nchocolate 50 350\ncookie 30 80\npurin 40 400\ncracker 40 160\n0\n" ], "outputs": [ "apple\ncake\nsandwich\ncheese\nkanzume\npurin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "cake\napple\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanzume\npurin\netalocohc\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwidh\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nemuynak\npurin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nemuynak\npurin\neualocohc\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkenyuma\npurni\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigiri\nanpan\nonigiri\nmhkan\ncracker\ncookie\n", "apple\ncake\nsandwhch\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\nekac\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\ntandwich\ncheese\nkanzume\npurin\netalocohc\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigiri\nanpan\nonigiri\nmhkan\ncracker\ncookie\n", "apple\ncake\ntandwich\ncheese\nkanzume\npurin\netalocohc\nonigiri\nonigiri\nnapna\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanp`n\nonigiri\nmnkai\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigirh\nanpan\nonigiri\nmhkan\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigirh\nanoan\nonigiri\nmhkan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanzume\npurin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanzume\npuqin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "cake\nelppa\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nemuynak\npurin\nchocolaue\nonigiri\nonigiri\nampan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\nourni\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigiri\nanpan\nonigiri\nnikan\ncracker\ncookie\n", "cake\napple\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "`pple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwici\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\ntandwich\ncheese\nkanzume\npurin\netamocohc\nonigiri\nonigiri\nnapna\nmikan\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\namuynek\npusni\nchocolaud\nonigirh\nanoan\nonigiri\nmhkan\ncracker\ncookie\n", "apple\ncbke\nsandwich\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncakf\nsandwici\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\nqurni\nchocolaud\nonigiri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\namuynek\npusni\nchocolaud\nonigirh\nanoan\nonigiri\nmhkam\ncracker\ncookie\n", "apple\ncakf\nsandwici\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nanpan\nonigiri\nmiakn\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanp`n\nonigiri\niaknm\ncracker\ncookie\n", "cake\nelppa\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\niookce\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\naop`n\nonigiri\niaknm\ncracker\ncookie\n", "apple\ncale\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\naop`n\nonigiri\niaknm\ncracker\ncookie\n", "cake\napple\ncheese\nsandwich\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apelp\ncake\nsandwich\ncheese\nkanzume\npurin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolaue\nonigiri\nonigiri\naopan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanpan\nirigino\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigiri\nonigiri\ncracker\nanpan\nmikan\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nonigiri\nanpan\nonigiri\ncracker\nmikan\ncookie\nchocolaud\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nirigino\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\neheesc\nkanyume\npurin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\ndualocohc\nonigiri\nanp`n\nonigiri\nmnkai\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\nkenyuma\npusni\nchocolaud\nonigirh\nanpan\nonigiri\nmhkan\ncracker\neookic\n", "apple\ncake\nsandwich\ncheese\nemuynak\npurin\nchocolaue\nonigiri\nonigiri\nanpan\nnikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nemuynak\npurin\neualocohc\nonigiri\nonigiri\nanpan\nmikan\ncookie\ncracker\n", "cake\napple\nsandwich\ncheese\nkanzume\npusin\ncholocaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocaloud\nonigiri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanp`n\nonigiri\nmnkai\nrekcarc\ncookie\n", "apple\ncbke\nrandwich\ncheese\nkanyume\npurin\nchocolaud\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "cake\nbpple\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncakf\nsandwici\ncheese\nkanyume\npurin\nchocolavd\nonigiri\nanpan\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\nqurni\nchocolaud\noiignri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "cake\nappke\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apqle\ncake\nsandwich\ncheese\namuynek\npusni\nchocolaud\nonigirh\nanoan\nonigiri\nmhkam\ncracker\neikooc\n", "cake\napple\ncheese\nsandwich\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nnikam\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolaue\nonigiri\naopan\nonigiri\nmikan\ncracker\ncookie\n", "cake\napple\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmkian\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolatd\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apqle\ncake\nsandwhch\ncheese\nkenyuma\npusni\nchocolaud\nonigirh\nanoan\nonigiri\nmhkan\ncracker\ncookie\n", "apple\ncbke\nsandwich\ncheese\nemuynak\npurin\neualocohc\nonigiri\nonigiri\nanpan\nmikan\ncookie\ncracker\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanp`n\nonighri\nmnkai\nrekcarc\ncookie\n", "apple\ncake\nsandwich\ncheese\nemuynbk\npurin\nchocolaue\nonigiri\nonigiri\nampan\nmikan\ncracker\ncookie\n", "cake\nbpelp\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\nbake\nsandwich\ncheese\nkanyume\nqurni\nchocolaud\noiignri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "cake\nappke\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncradker\ncookie\n", "apple\ncake\ntandwich\ncheese\nkanzume\npurin\netalocohc\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookei\n", "apole\ncake\nsandwich\ncheese\nkanyume\npurin\nchocolatd\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apqle\ncake\nsandwhch\ncheese\nkenyuma\npusni\nonigirh\nanoan\nonigiri\ncracker\nmhkan\ncookie\nchocolaud\n", "apple\ncbke\nsandwich\ncheese\nemuznak\npurin\neualocohc\nonigiri\nonigiri\nanpan\nmikan\ncookie\ncracker\n", "cake\napple\nsandwich\ncheese\nkanzemu\npusin\ncholocaue\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocaloud\nonigiri\nann`p\nonigiri\nmikan\ncracker\ncookie\n", "apple\ncake\ntandwich\ncheese\nkanzume\npurim\netamocohc\nonigiri\nonigiri\nnapna\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolaud\nonigiri\nanp`n\nonighri\nmnkai\nrekcarc\ncookif\n", "cake\nelppa\nsandwich\ncheese\nkanzume\npurin\nchcoolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "cake\nbpelp\nsandwich\ncheese\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncradker\ncookie\n", "apple\ncakf\nsandwici\ncheese\nkanyume\npurin\nchocolavd\nonigiri\nanpan\noniiirg\nmikan\ncracker\ncookie\n", "apple\nbake\nsandwich\ncheese\nkanyume\nqurni\ndhocolauc\noiignri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "cake\nappke\nsandwich\neseehc\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncradker\ncookie\n", "apple\ncakf\nsandwici\ncheese\nkanyume\npurim\nchocolaud\nonigiri\nanpan\nonigiri\nmiakn\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nemuynak\npurin\neualocohc\nonigiri\nonigiri\nanpan\nmikan\ncrackfr\ncookie\n", "apple\ncake\ntandwich\ncheese\nkanzume\npurin\netalocohc\nonigiri\nonigiri\nanpan\nmikan\ncracker\noockei\n", "apqle\ncake\nsandwhch\ncheese\nkeoyuma\npusni\nonigirh\nanoan\nonigiri\ncracker\nmhkan\ncookie\nchocolaud\n", "apple\ncbke\nsandwich\ncheese\nemtznak\npurin\neualocohc\nonigiri\nonigiri\nanpan\nmikan\ncookie\ncracker\n", "apple\ncake\ntacdwinh\ncheese\nkanzume\npurim\netamocohc\nonigiri\nonigiri\nnapna\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanyume\npurni\nchocolbud\nonigiri\nanp`n\nonighri\nmnkai\nrekcarc\ncookif\n", "apple\nbake\nsandwich\ncheese\nkanyume\nqurni\ndhpcolauc\noiignri\nanp`n\nonigiri\nmikan\ncracker\ncookie\n", "cake\nappke\nsandwich\neseehd\nkanzume\npusin\nchocolaue\nonigiri\nonigiri\nanpan\nmikan\ncradker\ncookie\n", "apple\ncake\ntbndwich\ncheese\nkanzume\npurin\netalocohc\nonigiri\nonigiri\nanpan\nmikan\ncracker\noockei\n", "apqle\ncake\nsandwhch\ncheese\nkeoyuma\npusni\npnigirh\nanoan\nonigiri\ncracker\nmhkan\ncookie\nchocolaud\n", "apple\ncake\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n", "apple\ncake\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\ncracker\ncookie\n" ], "question": "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)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(w>g[t[i]].s)\n\t\t\t\treturn;\n\t\t\tw+=g[t[i]].w;\n\t\t\tG+=g[t[i]].w*(i+1);\n\t\t}\n\t\tif(max<G)\n\t\t{\n\t\t\tmax=G;\n\t\t\tmemcpy(ans,t,40);\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(!f[i])\n\t\t\t{\n\t\t\t\tf[i]=1;\n\t\t\t\tt[d]=i;\n\t\t\t\trec(d+1);\n\t\t\t\tf[i]=0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint i;\n\tfor(;;)\n\t{\n\t\tmemset(ans,0,40);\n\t\tmemset(f,0,40);\n\t\tmax=0;\n\t\tscanf(\"%d\",&n);\n\t\tif(!n)\n\t\t\treturn 0;\n\t\tfor(i=0;i<n;i++)\n\t\t\tscanf(\"%s %d%d\",g[i].f,&g[i].w,&g[i].s);\n\t\trec(0);\n\t\twhile(-- n>=0)\n\t\t\tputs(g[ans[n]].f);\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tg\n\t.bss\n\t.align 32\n\t.type\tg, @object\n\t.size\tg, 320\ng:\n\t.zero\t320\n\t.globl\tn\n\t.align 4\n\t.type\tn, @object\n\t.size\tn, 4\nn:\n\t.zero\t4\n\t.globl\tt\n\t.align 32\n\t.type\tt, @object\n\t.size\tt, 40\nt:\n\t.zero\t40\n\t.globl\tf\n\t.align 32\n\t.type\tf, @object\n\t.size\tf, 40\nf:\n\t.zero\t40\n\t.globl\tans\n\t.align 32\n\t.type\tans, @object\n\t.size\tans, 40\nans:\n\t.zero\t40\n\t.globl\tmax\n\t.align 4\n\t.type\tmax, @object\n\t.size\tmax, 4\nmax:\n\t.zero\t4\n\t.text\n\t.globl\trec\n\t.type\trec, @function\nrec:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjne\t.L2\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L3\n.L6:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t24+g(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -8(%rbp)\n\tjg\t.L10\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t28+g(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\taddl\t%eax, -8(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tt(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\t28+g(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t-12(%rbp), %edx\n\taddl\t$1, %edx\n\timull\t%edx, %eax\n\taddl\t%eax, -4(%rbp)\n\taddl\t$1, -12(%rbp)\n.L3:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L6\n\tmovl\tmax(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjle\t.L1\n\tmovl\t-4(%rbp), %eax\n\tmovl\t%eax, max(%rip)\n\tmovq\tt(%rip), %rax\n\tmovq\t8+t(%rip), %rdx\n\tmovq\t%rax, ans(%rip)\n\tmovq\t%rdx, 8+ans(%rip)\n\tmovq\t16+t(%rip), %rax\n\tmovq\t24+t(%rip), %rdx\n\tmovq\t%rax, 16+ans(%rip)\n\tmovq\t%rdx, 24+ans(%rip)\n\tmovq\t32+t(%rip), %rax\n\tmovq\t%rax, 32+ans(%rip)\n\tjmp\t.L1\n.L2:\n\tmovl\t$0, -12(%rbp)\n\tjmp\t.L7\n.L9:\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L8\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t$1, (%rdx,%rax)\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tt(%rip), %rdx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edi\n\tcall\trec\n\tmovl\t-12(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tf(%rip), %rax\n\tmovl\t$0, (%rdx,%rax)\n.L8:\n\taddl\t$1, -12(%rbp)\n.L7:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -12(%rbp)\n\tjl\t.L9\n\tjmp\t.L1\n.L10:\n\tnop\n.L1:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\trec, .-rec\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%s %d%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n.L18:\n\tmovl\t$40, %edx\n\tmovl\t$0, %esi\n\tleaq\tans(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$40, %edx\n\tmovl\t$0, %esi\n\tleaq\tf(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tmovl\t$0, max(%rip)\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L12\n\tmovl\t$0, %eax\n\tjmp\t.L19\n.L12:\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L14\n.L15:\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tleaq\t16(%rax), %rdx\n\tleaq\tg(%rip), %rax\n\taddq\t%rdx, %rax\n\tleaq\t8(%rax), %rcx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tleaq\t16(%rax), %rdx\n\tleaq\tg(%rip), %rax\n\taddq\t%rdx, %rax\n\tleaq\t12(%rax), %rdx\n\tmovl\t-4(%rbp), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rsi\n\tleaq\tg(%rip), %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -4(%rbp)\n.L14:\n\tmovl\tn(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjl\t.L15\n\tmovl\t$0, %edi\n\tcall\trec\n\tjmp\t.L16\n.L17:\n\tmovl\tn(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tans(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcltq\n\tsalq\t$5, %rax\n\tmovq\t%rax, %rdx\n\tleaq\tg(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L16:\n\tmovl\tn(%rip), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, n(%rip)\n\tmovl\tn(%rip), %eax\n\ttestl\t%eax, %eax\n\tjns\t.L17\n\tjmp\t.L18\n.L19:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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>g[t[i]].s) return; w+=g[t[i]].w; G+=g[t[i]].w*(i+1); } if(max<G) { max=G; memcpy(ans,t,40); } } else { for(i=0;i<n;i++) { if(!f[i]) { f[i]=1; t[d]=i; rec(d+1); f[i]=0; } } } } int main() { int i; for(;;) { memset(ans,0,40); memset(f,0,40); max=0; scanf("%d",&n); if(!n) return 0; for(i=0;i<n;i++) scanf("%s %d%d",g[i].f,&g[i].w,&g[i].s); rec(0); while(-- n>=0) puts(g[ans[n]].f); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl g .bss .align 32 .type g, @object .size g, 320 g: .zero 320 .globl n .align 4 .type n, @object .size n, 4 n: .zero 4 .globl t .align 32 .type t, @object .size t, 40 t: .zero 40 .globl f .align 32 .type f, @object .size f, 40 f: .zero 40 .globl ans .align 32 .type ans, @object .size ans, 40 ans: .zero 40 .globl max .align 4 .type max, @object .size max, 4 max: .zero 4 .text .globl rec .type rec, @function rec: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl $0, -8(%rbp) movl $0, -4(%rbp) movl n(%rip), %eax cmpl %eax, -20(%rbp) jne .L2 movl $0, -12(%rbp) jmp .L3 .L6: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq t(%rip), %rax movl (%rdx,%rax), %eax cltq salq $5, %rax movq %rax, %rdx leaq 24+g(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -8(%rbp) jg .L10 movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq t(%rip), %rax movl (%rdx,%rax), %eax cltq salq $5, %rax movq %rax, %rdx leaq 28+g(%rip), %rax movl (%rdx,%rax), %eax addl %eax, -8(%rbp) movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq t(%rip), %rax movl (%rdx,%rax), %eax cltq salq $5, %rax movq %rax, %rdx leaq 28+g(%rip), %rax movl (%rdx,%rax), %eax movl -12(%rbp), %edx addl $1, %edx imull %edx, %eax addl %eax, -4(%rbp) addl $1, -12(%rbp) .L3: movl n(%rip), %eax cmpl %eax, -12(%rbp) jl .L6 movl max(%rip), %eax cmpl %eax, -4(%rbp) jle .L1 movl -4(%rbp), %eax movl %eax, max(%rip) movq t(%rip), %rax movq 8+t(%rip), %rdx movq %rax, ans(%rip) movq %rdx, 8+ans(%rip) movq 16+t(%rip), %rax movq 24+t(%rip), %rdx movq %rax, 16+ans(%rip) movq %rdx, 24+ans(%rip) movq 32+t(%rip), %rax movq %rax, 32+ans(%rip) jmp .L1 .L2: movl $0, -12(%rbp) jmp .L7 .L9: movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl (%rdx,%rax), %eax testl %eax, %eax jne .L8 movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl $1, (%rdx,%rax) movl -20(%rbp), %eax cltq leaq 0(,%rax,4), %rcx leaq t(%rip), %rdx movl -12(%rbp), %eax movl %eax, (%rcx,%rdx) movl -20(%rbp), %eax addl $1, %eax movl %eax, %edi call rec movl -12(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq f(%rip), %rax movl $0, (%rdx,%rax) .L8: addl $1, -12(%rbp) .L7: movl n(%rip), %eax cmpl %eax, -12(%rbp) jl .L9 jmp .L1 .L10: nop .L1: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size rec, .-rec .section .rodata .LC0: .string "%d" .LC1: .string "%s %d%d" .text .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp .L18: movl $40, %edx movl $0, %esi leaq ans(%rip), %rax movq %rax, %rdi call memset@PLT movl $40, %edx movl $0, %esi leaq f(%rip), %rax movq %rax, %rdi call memset@PLT movl $0, max(%rip) leaq n(%rip), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl n(%rip), %eax testl %eax, %eax jne .L12 movl $0, %eax jmp .L19 .L12: movl $0, -4(%rbp) jmp .L14 .L15: movl -4(%rbp), %eax cltq salq $5, %rax leaq 16(%rax), %rdx leaq g(%rip), %rax addq %rdx, %rax leaq 8(%rax), %rcx movl -4(%rbp), %eax cltq salq $5, %rax leaq 16(%rax), %rdx leaq g(%rip), %rax addq %rdx, %rax leaq 12(%rax), %rdx movl -4(%rbp), %eax cltq salq $5, %rax movq %rax, %rsi leaq g(%rip), %rax addq %rsi, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -4(%rbp) .L14: movl n(%rip), %eax cmpl %eax, -4(%rbp) jl .L15 movl $0, %edi call rec jmp .L16 .L17: movl n(%rip), %eax cltq leaq 0(,%rax,4), %rdx leaq ans(%rip), %rax movl (%rdx,%rax), %eax cltq salq $5, %rax movq %rax, %rdx leaq g(%rip), %rax addq %rdx, %rax movq %rax, %rdi call puts@PLT .L16: movl n(%rip), %eax subl $1, %eax movl %eax, n(%rip) movl n(%rip), %eax testl %eax, %eax jns .L17 jmp .L18 .L19: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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 = LLONG_MAX, xx;\n\tscanf(\"%lld %lld\", &dd, &gg);\n\tint64 pp[dd], cc[dd], score[dd];\n\tfor(int64 ii = 0;ii < dd;ii++)\n\t{\n\t\tscanf(\"%lld %lld\", &pp[ii], &cc[ii]);\n\t\tscore[ii] = pp[ii] * (ii + 1) * 100 + cc[ii];\n\t}\n\tint64 tmp, kosu;\n\tfor(int64 bit = 0;bit < (1 << dd);bit++)\n\t{\n\t\ttmp = 0;\n\t\tkosu = 0;\n\t\tfor(int64 ii = 0;ii < dd;ii++)\n\t\t{\n\t\t\tif(bit & (1 << ii))\n\t\t\t{\n\t\t\t\ttmp += score[ii];\n\t\t\t\tkosu += pp[ii];\n\t\t\t}\n\t\t}\n\t\tif(tmp < gg)\n\t\t{\n\t\t\tfor(int64 ii = dd - 1;ii >= 0;ii--)\n\t\t\t{\n\t\t\t\tif(!(bit & (1 << ii)))\n\t\t\t\t{\n\t\t\t\t\txx = (gg - tmp) / ((ii + 1) * 100);\n\t\t\t\t\tif((gg - tmp) % ((ii + 1) * 100))\n\t\t\t\t\t{\n\t\t\t\t\t\txx++;\n\t\t\t\t\t}\n\t\t\t\t\tif(xx > pp[ii])\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttmp += xx * (ii + 1) * 100;\n\t\t\t\t\tkosu += xx;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(min > kosu && tmp >= gg)\n\t\t{\n\t\t\tmin = kosu;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", min);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld %lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$216, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tmovabsq\t$9223372036854775807, %rax\n\tmovq\t%rax, -168(%rbp)\n\tleaq\t-176(%rbp), %rax\n\tleaq\t-184(%rbp), %rcx\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-184(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -104(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -208(%rbp)\n\tmovq\t$0, -200(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -224(%rbp)\n\tmovq\t$0, -216(%rbp)\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -96(%rbp)\n\tmovq\t-184(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -240(%rbp)\n\tmovq\t$0, -232(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -256(%rbp)\n\tmovq\t$0, -248(%rbp)\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %edi\n\tmovl\t$0, %edx\n\tdivq\t%rdi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L5:\n\tcmpq\t%rdx, %rsp\n\tje\t.L6\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L5\n.L6:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L7\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L7:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -80(%rbp)\n\tmovq\t-184(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L8:\n\tcmpq\t%rdx, %rsp\n\tje\t.L9\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L8\n.L9:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L10\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L10:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t$0, -152(%rbp)\n\tjmp\t.L11\n.L12:\n\tmovq\t-152(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-152(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-96(%rbp), %rax\n\tmovq\t-152(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tmovq\t-152(%rbp), %rdx\n\taddq\t$1, %rdx\n\timulq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t-152(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t-152(%rbp), %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddq\t$1, -152(%rbp)\n.L11:\n\tmovq\t-184(%rbp), %rax\n\tcmpq\t%rax, -152(%rbp)\n\tjl\t.L12\n\tmovq\t$0, -128(%rbp)\n\tjmp\t.L13\n.L24:\n\tmovq\t$0, -144(%rbp)\n\tmovq\t$0, -136(%rbp)\n\tmovq\t$0, -120(%rbp)\n\tjmp\t.L14\n.L16:\n\tmovq\t-120(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tandq\t-128(%rbp), %rax\n\ttestq\t%rax, %rax\n\tje\t.L15\n\tmovq\t-64(%rbp), %rax\n\tmovq\t-120(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, -144(%rbp)\n\tmovq\t-96(%rbp), %rax\n\tmovq\t-120(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, -136(%rbp)\n.L15:\n\taddq\t$1, -120(%rbp)\n.L14:\n\tmovq\t-184(%rbp), %rax\n\tcmpq\t%rax, -120(%rbp)\n\tjl\t.L16\n\tmovq\t-176(%rbp), %rax\n\tcmpq\t%rax, -144(%rbp)\n\tjge\t.L17\n\tmovq\t-184(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -112(%rbp)\n\tjmp\t.L18\n.L22:\n\tmovq\t-112(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tandq\t-128(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjne\t.L19\n\tmovq\t-176(%rbp), %rax\n\tsubq\t-144(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-112(%rbp), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rax, -160(%rbp)\n\tmovq\t-176(%rbp), %rax\n\tsubq\t-144(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-112(%rbp), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tje\t.L20\n\taddq\t$1, -160(%rbp)\n.L20:\n\tmovq\t-96(%rbp), %rax\n\tmovq\t-112(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tcmpq\t%rax, -160(%rbp)\n\tjg\t.L27\n\tmovq\t-112(%rbp), %rax\n\taddq\t$1, %rax\n\timulq\t-160(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rax, -144(%rbp)\n\tmovq\t-160(%rbp), %rax\n\taddq\t%rax, -136(%rbp)\n\tjmp\t.L17\n.L19:\n\tsubq\t$1, -112(%rbp)\n.L18:\n\tcmpq\t$0, -112(%rbp)\n\tjns\t.L22\n\tjmp\t.L17\n.L27:\n\tnop\n.L17:\n\tmovq\t-168(%rbp), %rax\n\tcmpq\t-136(%rbp), %rax\n\tjle\t.L23\n\tmovq\t-176(%rbp), %rax\n\tcmpq\t%rax, -144(%rbp)\n\tjl\t.L23\n\tmovq\t-136(%rbp), %rax\n\tmovq\t%rax, -168(%rbp)\n.L23:\n\taddq\t$1, -128(%rbp)\n.L13:\n\tmovq\t-184(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tcmpq\t%rax, -128(%rbp)\n\tjl\t.L24\n\tmovq\t-168(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L26\n\tcall\t__stack_chk_fail@PLT\n.L26:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tleaq\t-64(%rbp), %rdx\n\tleaq\t-72(%rbp), %rsi\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-72(%rbp), %rdi\n\tmovq\t%rsp, %rcx\n\tleaq\t15(,%rdi,8), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rsi\n\tandq\t$-16, %rdx\n\tsubq\t%rsi, %rcx\n\tcmpq\t%rcx, %rsp\n\tje\t.L3\n.L62:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L62\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L63\n.L4:\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, %rdx\n\tmovq\t%rsp, %rcx\n\tmovq\t%rsp, %r12\n\tandq\t$-4096, %rsi\n\tandq\t$-16, %rdx\n\tsubq\t%rsi, %rcx\n.L5:\n\tcmpq\t%rcx, %rsp\n\tje\t.L6\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L5\n.L63:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L6:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L64\n.L7:\n\tmovq\t%rax, %rdx\n\tmovq\t%rsp, %rcx\n\tandq\t$-4096, %rax\n\tmovq\t%rsp, %r15\n\tandq\t$-16, %rdx\n\tsubq\t%rax, %rcx\n.L8:\n\tcmpq\t%rcx, %rsp\n\tje\t.L9\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L8\n.L64:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L7\n.L9:\n\tmovq\t%rdx, %rax\n\tandl\t$4095, %eax\n\tsubq\t%rax, %rsp\n\ttestq\t%rax, %rax\n\tje\t.L10\n\torq\t$0, -8(%rsp,%rax)\n.L10:\n\tmovq\t%rsp, %rbx\n\ttestq\t%rdi, %rdi\n\tjle\t.L11\n\tmovq\t%r12, %r14\n\txorl\t%r13d, %r13d\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t%r15, %rdx\n\tmovq\t%r14, %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%r14), %rax\n\taddq\t$1, %r13\n\tmovq\t-72(%rbp), %rdi\n\taddq\t$8, %r14\n\taddq\t$8, %r15\n\timulq\t%r13, %rax\n\tleaq\t(%rax,%rax,4), %rax\n\tleaq\t(%rax,%rax,4), %rdx\n\tmovq\t-8(%r15), %rax\n\tleaq\t(%rax,%rdx,4), %rax\n\tmovq\t%rax, -8(%rbx,%r13,8)\n\tcmpq\t%rdi, %r13\n\tjl\t.L12\n.L11:\n\tmovl\t$1, %eax\n\tmovl\t%edi, %ecx\n\tmovabsq\t$9223372036854775807, %r14\n\tsall\t%cl, %eax\n\tcltq\n\tmovq\t%rax, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjle\t.L13\n\tleaq\t-1(%rdi), %rax\n\tmovq\t-64(%rbp), %r15\n\txorl\t%esi, %esi\n\tmovl\t$1, %r10d\n\tmovq\t%rax, -96(%rbp)\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\txorl\t%ecx, %ecx\n\txorl\t%r9d, %r9d\n\txorl\t%r11d, %r11d\n\ttestq\t%rdi, %rdi\n\tjle\t.L65\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovl\t%r10d, %eax\n\tsall\t%cl, %eax\n\tcltq\n\ttestq\t%rsi, %rax\n\tje\t.L15\n\taddq\t(%rbx,%rcx,8), %r11\n\taddq\t(%r12,%rcx,8), %r9\n.L15:\n\taddq\t$1, %rcx\n\tcmpq\t%rdi, %rcx\n\tjne\t.L16\n\tcmpq\t%r11, %r15\n\tjg\t.L66\n.L18:\n\tcmpq\t%r9, %r14\n\tcmovg\t%r9, %r14\n.L19:\n\taddq\t$1, %rsi\n\tcmpq\t-88(%rbp), %rsi\n\tjne\t.L14\n.L13:\n\txorl\t%eax, %eax\n\tmovq\t%r14, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L67\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L66:\n\t.cfi_restore_state\n\tmovq\t-96(%rbp), %r8\n.L27:\n\tmovzbl\t-96(%rbp), %ecx\n\tmovl\t%r10d, %eax\n\tsall\t%cl, %eax\n\tcltq\n\ttestq\t%rsi, %rax\n\tje\t.L68\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovq\t%r8, %r13\n\tsubq\t$1, %r8\n\tjb\t.L19\n\tmovl\t%r10d, %eax\n\tmovl\t%r8d, %ecx\n\tsall\t%cl, %eax\n\tcltq\n\ttestq\t%rsi, %rax\n\tjne\t.L21\n.L22:\n\tleaq\t0(%r13,%r13,4), %rdx\n\tmovq\t%r15, %rax\n\tsubq\t%r11, %rax\n\tleaq\t(%rdx,%rdx,4), %rcx\n\tsalq\t$2, %rcx\n\tcqto\n\tidivq\t%rcx\n\tcmpq\t$1, %rdx\n\tsbbq\t$-1, %rax\n\tcmpq\t%rax, (%r12,%r8,8)\n\tjl\t.L19\n\taddq\t%rax, %r9\n\timulq\t%r13, %rax\n\timulq\t$100, %rax, %rax\n\taddq\t%r11, %rax\n\tcmpq\t%rax, %r15\n\tjg\t.L19\n\tcmpq\t%r14, %r9\n\tcmovle\t%r9, %r14\n\tjmp\t.L19\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\ttestq\t%r15, %r15\n\tjle\t.L18\n\tmovq\t-96(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjs\t.L19\n\tmovq\t%rax, %r8\n\tjmp\t.L27\n.L68:\n\tmovq\t-96(%rbp), %rax\n\tleaq\t1(%rax), %r13\n\tjmp\t.L22\n.L67:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tleaq\t-64(%rbp), %rdx\n\tleaq\t-72(%rbp), %rsi\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-72(%rbp), %rdi\n\tmovq\t%rsp, %rcx\n\tleaq\t15(,%rdi,8), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rsi\n\tandq\t$-16, %rdx\n\tsubq\t%rsi, %rcx\n\tcmpq\t%rcx, %rsp\n\tje\t.L3\n.L62:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L62\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L63\n.L4:\n\tmovq\t%rax, %rsi\n\tmovq\t%rax, %rdx\n\tmovq\t%rsp, %rcx\n\tmovq\t%rsp, %r12\n\tandq\t$-4096, %rsi\n\tandq\t$-16, %rdx\n\tsubq\t%rsi, %rcx\n.L5:\n\tcmpq\t%rcx, %rsp\n\tje\t.L6\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L5\n.L63:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L6:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L64\n.L7:\n\tmovq\t%rax, %rdx\n\tmovq\t%rsp, %rcx\n\tandq\t$-4096, %rax\n\tmovq\t%rsp, %r15\n\tandq\t$-16, %rdx\n\tsubq\t%rax, %rcx\n.L8:\n\tcmpq\t%rcx, %rsp\n\tje\t.L9\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L8\n.L64:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L7\n.L9:\n\tmovq\t%rdx, %rax\n\tandl\t$4095, %eax\n\tsubq\t%rax, %rsp\n\ttestq\t%rax, %rax\n\tje\t.L10\n\torq\t$0, -8(%rsp,%rax)\n.L10:\n\tmovq\t%rsp, %rbx\n\ttestq\t%rdi, %rdi\n\tjle\t.L11\n\tmovq\t%r12, %r14\n\txorl\t%r13d, %r13d\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t%r15, %rdx\n\tmovq\t%r14, %rsi\n\tleaq\t.LC0(%rip), %rdi\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%r14), %rax\n\taddq\t$1, %r13\n\tmovq\t-72(%rbp), %rdi\n\taddq\t$8, %r14\n\taddq\t$8, %r15\n\timulq\t%r13, %rax\n\tleaq\t(%rax,%rax,4), %rax\n\tleaq\t(%rax,%rax,4), %rdx\n\tmovq\t-8(%r15), %rax\n\tleaq\t(%rax,%rdx,4), %rax\n\tmovq\t%rax, -8(%rbx,%r13,8)\n\tcmpq\t%rdi, %r13\n\tjl\t.L12\n.L11:\n\tmovl\t$1, %eax\n\tmovl\t%edi, %ecx\n\tmovabsq\t$9223372036854775807, %r14\n\tsall\t%cl, %eax\n\tcltq\n\tmovq\t%rax, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjle\t.L13\n\tleaq\t-1(%rdi), %rax\n\tmovq\t-64(%rbp), %r15\n\txorl\t%esi, %esi\n\tmovl\t$1, %r10d\n\tmovq\t%rax, -96(%rbp)\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\txorl\t%ecx, %ecx\n\txorl\t%r9d, %r9d\n\txorl\t%r11d, %r11d\n\ttestq\t%rdi, %rdi\n\tjle\t.L65\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovl\t%r10d, %eax\n\tsall\t%cl, %eax\n\tcltq\n\ttestq\t%rsi, %rax\n\tje\t.L15\n\taddq\t(%rbx,%rcx,8), %r11\n\taddq\t(%r12,%rcx,8), %r9\n.L15:\n\taddq\t$1, %rcx\n\tcmpq\t%rdi, %rcx\n\tjne\t.L16\n\tcmpq\t%r11, %r15\n\tjg\t.L66\n.L18:\n\tcmpq\t%r9, %r14\n\tcmovg\t%r9, %r14\n.L19:\n\taddq\t$1, %rsi\n\tcmpq\t-88(%rbp), %rsi\n\tjne\t.L14\n.L13:\n\txorl\t%eax, %eax\n\tmovq\t%r14, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L67\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L66:\n\t.cfi_restore_state\n\tmovq\t-96(%rbp), %r8\n.L27:\n\tmovzbl\t-96(%rbp), %ecx\n\tmovl\t%r10d, %eax\n\tsall\t%cl, %eax\n\tcltq\n\ttestq\t%rsi, %rax\n\tje\t.L68\n\t.p2align 4,,10\n\t.p2align 3\n.L21:\n\tmovq\t%r8, %r13\n\tsubq\t$1, %r8\n\tjb\t.L19\n\tmovl\t%r10d, %eax\n\tmovl\t%r8d, %ecx\n\tsall\t%cl, %eax\n\tcltq\n\ttestq\t%rsi, %rax\n\tjne\t.L21\n.L22:\n\tleaq\t0(%r13,%r13,4), %rdx\n\tmovq\t%r15, %rax\n\tsubq\t%r11, %rax\n\tleaq\t(%rdx,%rdx,4), %rcx\n\tsalq\t$2, %rcx\n\tcqto\n\tidivq\t%rcx\n\tcmpq\t$1, %rdx\n\tsbbq\t$-1, %rax\n\tcmpq\t%rax, (%r12,%r8,8)\n\tjl\t.L19\n\taddq\t%rax, %r9\n\timulq\t%r13, %rax\n\timulq\t$100, %rax, %rax\n\taddq\t%r11, %rax\n\tcmpq\t%rax, %r15\n\tjg\t.L19\n\tcmpq\t%r14, %r9\n\tcmovle\t%r9, %r14\n\tjmp\t.L19\n\t.p2align 4,,10\n\t.p2align 3\n.L65:\n\ttestq\t%r15, %r15\n\tjle\t.L18\n\tmovq\t-96(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjs\t.L19\n\tmovq\t%rax, %r8\n\tjmp\t.L27\n.L68:\n\tmovq\t-96(%rbp), %rax\n\tleaq\t1(%rax), %r13\n\tjmp\t.L22\n.L67:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE51:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 = LLONG_MAX, xx;\n\tscanf(\"%lld %lld\", &dd, &gg);\n\tint64 pp[dd], cc[dd], score[dd];\n\tfor(int64 ii = 0;ii < dd;ii++)\n\t{\n\t\tscanf(\"%lld %lld\", &pp[ii], &cc[ii]);\n\t\tscore[ii] = pp[ii] * (ii + 1) * 100 + cc[ii];\n\t}\n\tint64 tmp, kosu;\n\tfor(int64 bit = 0;bit < (1 << dd);bit++)\n\t{\n\t\ttmp = 0;\n\t\tkosu = 0;\n\t\tfor(int64 ii = 0;ii < dd;ii++)\n\t\t{\n\t\t\tif(bit & (1 << ii))\n\t\t\t{\n\t\t\t\ttmp += score[ii];\n\t\t\t\tkosu += pp[ii];\n\t\t\t}\n\t\t}\n\t\tif(tmp < gg)\n\t\t{\n\t\t\tfor(int64 ii = dd - 1;ii >= 0;ii--)\n\t\t\t{\n\t\t\t\tif(!(bit & (1 << ii)))\n\t\t\t\t{\n\t\t\t\t\txx = (gg - tmp) / ((ii + 1) * 100);\n\t\t\t\t\tif((gg - tmp) % ((ii + 1) * 100))\n\t\t\t\t\t{\n\t\t\t\t\t\txx++;\n\t\t\t\t\t}\n\t\t\t\t\tif(xx > pp[ii])\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttmp += xx * (ii + 1) * 100;\n\t\t\t\t\tkosu += xx;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(min > kosu && tmp >= gg)\n\t\t{\n\t\t\tmin = kosu;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", min);\n\treturn 0;\n}", "index": 80, "inputs": [ "5 25000\n20 0000\n40 1000\n50 1000\n30 1000\n1 1000\n", "2 431\n3 500\n5 800\n", "2 1328\n3 500\n5 800\n", "2 2000\n3 500\n7 800\n", "5 25000\n20 0010\n40 1000\n50 1000\n60 1000\n1 1000\n", "5 10847\n20 0010\n40 1000\n50 1000\n60 1000\n1 1000\n", "2 1328\n3 890\n10 800\n", "3 10847\n26 0010\n40 0100\n61 1000\n60 1000\n1 1000\n", "3 10847\n26 0010\n40 0100\n6 1000\n60 1000\n1 1000\n", "3 10847\n15 0110\n50 0100\n7 0000\n14 1001\n1 1000\n", "3 10847\n15 0110\n50 0100\n4 0000\n14 1001\n1 1000\n", "5 25000\n20 1000\n2 1000\n50 1000\n30 1000\n1 1000\n", "2 400\n3 500\n5 1354\n", "2 110\n3 500\n5 800\n", "2 3015\n3 957\n7 800\n", "3 25000\n20 0010\n40 1000\n50 1000\n60 1000\n1 1000\n", "3 10847\n3 1010\n40 0100\n7 1000\n60 1000\n1 1000\n", "5 10847\n15 1110\n40 0100\n7 1000\n14 1001\n1 1000\n", "3 12310\n15 0110\n50 0100\n7 1000\n14 1001\n1 1000\n", "3 25000\n20 0010\n40 0000\n50 1000\n60 1000\n1 1000\n", "3 9659\n26 0110\n40 0100\n61 1000\n60 1000\n1 1000\n", "3 10847\n4 1010\n40 0100\n6 1000\n60 1000\n2 1000\n", "3 10847\n3 1010\n40 0100\n12 1000\n60 1000\n1 1000\n", "5 10847\n15 1110\n40 0100\n7 0000\n14 1001\n1 1000\n", "3 4814\n15 1110\n59 0100\n7 1100\n14 1001\n1 1000\n", "3 10847\n26 0110\n50 0100\n1 0000\n14 1001\n1 1000\n", "5 10847\n20 0010\n40 1100\n50 1010\n60 1000\n3 1000\n", "4 10847\n15 0110\n40 1100\n50 1000\n60 1000\n1 1000\n", "3 10847\n4 1010\n40 0100\n10 1000\n60 1000\n2 1000\n", "3 4053\n15 1110\n59 0100\n7 1000\n14 1001\n1 1000\n", "2 1328\n1 406\n7 800\n", "3 25000\n26 0010\n40 0000\n50 1100\n60 1100\n1 1000\n", "5 12115\n26 1010\n7 0100\n5 1000\n60 1001\n1 1000\n", "5 10847\n20 0110\n59 1000\n3 1000\n57 1000\n1 1000\n", "3 15755\n3 1010\n53 0100\n12 1000\n60 1010\n2 1000\n", "3 13259\n13 0111\n40 0100\n61 1000\n60 0000\n0 1000\n", "3 4053\n15 1110\n17 0100\n5 1000\n14 1001\n4 1000\n", "3 15610\n2 0110\n57 1100\n50 1000\n60 0001\n1 1100\n", "4 13259\n13 0111\n40 0100\n61 1100\n43 0000\n0 1000\n", "3 3814\n1 1110\n20 0000\n1 1011\n14 1011\n4 1000\n", "5 25000\n20 0000\n40 1000\n50 1000\n24 1000\n1 1000\n", "3 3705\n26 1010\n40 0100\n7 1000\n60 1000\n1 1000\n", "2 10847\n26 1110\n40 0100\n7 1000\n60 1001\n1 1000\n", "5 25000\n20 0010\n40 1100\n50 1000\n20 1100\n1 1000\n", "5 20244\n15 0110\n40 1100\n50 1000\n60 1000\n1 1000\n", "2 10847\n26 1010\n40 0100\n7 1000\n60 1101\n1 0000\n", "3 25000\n26 0010\n40 0000\n64 1000\n60 1100\n1 1000\n", "5 10847\n26 0110\n50 0100\n1 0001\n14 1001\n1 1001\n", "3 25000\n26 0010\n37 0000\n50 1100\n60 1100\n1 1000\n", "3 25000\n20 0000\n70 1011\n50 1000\n48 1000\n2 1000\n", "5 8870\n20 0010\n40 1110\n50 1010\n37 1000\n3 1010\n", "3 8690\n15 1111\n40 0100\n7 1100\n4 1001\n1 1001\n", "3 3814\n2 1110\n20 0001\n5 1001\n14 1011\n4 1000\n", "2 3814\n1 1110\n20 0100\n1 1011\n14 1011\n3 1000\n", "5 25000\n20 0000\n40 1000\n50 1000\n13 1000\n1 1000\n", "3 25000\n20 0010\n40 1000\n77 1000\n28 1000\n1 1000\n", "5 10847\n19 1110\n40 0100\n7 0000\n13 1001\n1 0001\n", "3 9027\n24 0111\n78 0100\n43 1100\n38 0001\n0 1100\n", "5 25000\n20 0000\n40 1000\n70 1000\n13 1000\n1 1000\n", "2 10847\n17 1110\n40 0100\n7 1000\n60 1000\n1 1000\n", "5 25000\n2 1000\n2 1010\n50 1001\n30 1100\n1 1000\n", "3 10847\n4 1010\n40 0110\n10 0000\n60 1000\n2 1100\n", "5 25000\n20 0010\n40 1000\n50 1000\n30 1000\n1 1000\n", "2 1328\n3 750\n5 800\n", "2 2000\n3 957\n7 800\n", "2 1328\n3 750\n10 800\n", "5 10847\n20 0010\n40 1100\n50 1000\n60 1000\n1 1000\n", "5 10847\n26 0010\n40 1100\n50 1000\n60 1000\n1 1000\n", "5 10847\n26 0010\n40 0100\n50 1000\n60 1000\n1 1000\n", "5 10847\n26 0010\n40 0100\n61 1000\n60 1000\n1 1000\n", "3 10847\n26 1010\n40 0100\n6 1000\n60 1000\n1 1000\n", "3 10847\n26 1010\n40 0100\n7 1000\n60 1000\n1 1000\n", "3 10847\n26 1010\n40 0100\n7 1000\n60 1001\n1 1000\n", "3 10847\n26 1110\n40 0100\n7 1000\n60 1001\n1 1000\n", "3 10847\n15 1110\n40 0100\n7 1000\n60 1001\n1 1000\n", "3 10847\n15 1110\n40 0100\n7 1000\n14 1001\n1 1000\n", "3 10847\n15 1110\n59 0100\n7 1000\n14 1001\n1 1000\n", "3 10847\n15 1110\n50 0100\n7 1000\n14 1001\n1 1000\n", "3 10847\n15 0110\n50 0100\n7 1000\n14 1001\n1 1000\n", "2 2000\n3 322\n5 800\n", "5 25000\n20 0010\n40 1001\n50 1000\n30 1000\n1 1000\n", "2 431\n3 896\n5 800\n", "2 1328\n3 816\n5 800\n", "2 2000\n1 500\n7 800\n", "5 25000\n20 0010\n40 1000\n50 1000\n30 1100\n1 1000\n", "2 1328\n5 750\n5 800\n", "2 1328\n2 750\n10 800\n", "5 10847\n20 0010\n40 1000\n50 1000\n81 1000\n1 1000\n", "2 301\n3 890\n10 800\n", "5 10847\n20 0010\n40 1100\n50 1000\n60 1000\n2 1000\n", "5 10847\n26 0110\n40 1100\n50 1000\n60 1000\n1 1000\n", "5 10847\n26 0010\n40 0110\n50 1000\n60 1000\n1 1000\n", "5 10847\n26 1010\n40 0100\n61 1000\n60 1000\n1 1000\n", "3 10847\n26 0110\n40 0100\n61 1000\n60 1000\n1 1000\n", "3 10847\n26 1010\n40 0100\n6 1000\n60 1000\n2 1000\n", "3 10847\n26 1010\n40 0100\n7 1000\n60 1101\n1 1000\n", "3 10847\n26 1110\n40 0100\n7 1000\n60 1001\n1 1010\n", "3 10847\n15 1111\n40 0100\n7 1000\n60 1001\n1 1000\n", "3 10847\n15 1110\n59 0100\n7 1100\n14 1001\n1 1000\n", "3 10847\n15 1110\n50 0101\n7 1000\n14 1001\n1 1000\n", "2 2000\n3 500\n5 800\n", "5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n", "2 700\n3 500\n5 800\n", "2 700\n3 500\n5 800\n", "2 400\n3 500\n5 800\n" ], "outputs": [ "66\n", "3\n", "5\n", "7\n", "60\n", "25\n", "4\n", "37\n", "46\n", "51\n", "53\n", "64\n", "2\n", "1\n", "10\n", "90\n", "43\n", "22\n", "54\n", "100\n", "33\n", "44\n", "40\n", "26\n", "16\n", "56\n", "24\n", "28\n", "42\n", "12\n", "6\n", "99\n", "27\n", "23\n", "65\n", "45\n", "13\n", "50\n", "34\n", "9\n", "68\n", "11\n", "62\n", "69\n", "48\n", "63\n", "88\n", "29\n", "102\n", "95\n", "19\n", "35\n", "8\n", "15\n", "71\n", "82\n", "32\n", "31\n", "72\n", "57\n", "61\n", "47\n", "66\n", "5\n", "7\n", "5\n", "25\n", "25\n", "25\n", "25\n", "46\n", "46\n", "46\n", "46\n", "46\n", "46\n", "46\n", "46\n", "46\n", "7\n", "66\n", "3\n", "5\n", "7\n", "66\n", "5\n", "4\n", "25\n", "2\n", "25\n", "25\n", "25\n", "25\n", "37\n", "46\n", "46\n", "46\n", "46\n", "46\n", "46\n", "7\n", "66\n", "3\n", "3\n", "2\n" ], "question": "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 = LLONG_MAX, xx;\n\tscanf(\"%lld %lld\", &dd, &gg);\n\tint64 pp[dd], cc[dd], score[dd];\n\tfor(int64 ii = 0;ii < dd;ii++)\n\t{\n\t\tscanf(\"%lld %lld\", &pp[ii], &cc[ii]);\n\t\tscore[ii] = pp[ii] * (ii + 1) * 100 + cc[ii];\n\t}\n\tint64 tmp, kosu;\n\tfor(int64 bit = 0;bit < (1 << dd);bit++)\n\t{\n\t\ttmp = 0;\n\t\tkosu = 0;\n\t\tfor(int64 ii = 0;ii < dd;ii++)\n\t\t{\n\t\t\tif(bit & (1 << ii))\n\t\t\t{\n\t\t\t\ttmp += score[ii];\n\t\t\t\tkosu += pp[ii];\n\t\t\t}\n\t\t}\n\t\tif(tmp < gg)\n\t\t{\n\t\t\tfor(int64 ii = dd - 1;ii >= 0;ii--)\n\t\t\t{\n\t\t\t\tif(!(bit & (1 << ii)))\n\t\t\t\t{\n\t\t\t\t\txx = (gg - tmp) / ((ii + 1) * 100);\n\t\t\t\t\tif((gg - tmp) % ((ii + 1) * 100))\n\t\t\t\t\t{\n\t\t\t\t\t\txx++;\n\t\t\t\t\t}\n\t\t\t\t\tif(xx > pp[ii])\n\t\t\t\t\t{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\ttmp += xx * (ii + 1) * 100;\n\t\t\t\t\tkosu += xx;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(min > kosu && tmp >= gg)\n\t\t{\n\t\t\tmin = kosu;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", min);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lld %lld\"\n.LC1:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$216, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tmovabsq\t$9223372036854775807, %rax\n\tmovq\t%rax, -168(%rbp)\n\tleaq\t-176(%rbp), %rax\n\tleaq\t-184(%rbp), %rcx\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-184(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -104(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -208(%rbp)\n\tmovq\t$0, -200(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -224(%rbp)\n\tmovq\t$0, -216(%rbp)\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -96(%rbp)\n\tmovq\t-184(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -240(%rbp)\n\tmovq\t$0, -232(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, -256(%rbp)\n\tmovq\t$0, -248(%rbp)\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %edi\n\tmovl\t$0, %edx\n\tdivq\t%rdi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L5:\n\tcmpq\t%rdx, %rsp\n\tje\t.L6\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L5\n.L6:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L7\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L7:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -80(%rbp)\n\tmovq\t-184(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L8:\n\tcmpq\t%rdx, %rsp\n\tje\t.L9\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L8\n.L9:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L10\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L10:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovq\t$0, -152(%rbp)\n\tjmp\t.L11\n.L12:\n\tmovq\t-152(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-152(%rbp), %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-96(%rbp), %rax\n\tmovq\t-152(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tmovq\t-152(%rbp), %rdx\n\taddq\t$1, %rdx\n\timulq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t-152(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t-152(%rbp), %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddq\t$1, -152(%rbp)\n.L11:\n\tmovq\t-184(%rbp), %rax\n\tcmpq\t%rax, -152(%rbp)\n\tjl\t.L12\n\tmovq\t$0, -128(%rbp)\n\tjmp\t.L13\n.L24:\n\tmovq\t$0, -144(%rbp)\n\tmovq\t$0, -136(%rbp)\n\tmovq\t$0, -120(%rbp)\n\tjmp\t.L14\n.L16:\n\tmovq\t-120(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tandq\t-128(%rbp), %rax\n\ttestq\t%rax, %rax\n\tje\t.L15\n\tmovq\t-64(%rbp), %rax\n\tmovq\t-120(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, -144(%rbp)\n\tmovq\t-96(%rbp), %rax\n\tmovq\t-120(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, -136(%rbp)\n.L15:\n\taddq\t$1, -120(%rbp)\n.L14:\n\tmovq\t-184(%rbp), %rax\n\tcmpq\t%rax, -120(%rbp)\n\tjl\t.L16\n\tmovq\t-176(%rbp), %rax\n\tcmpq\t%rax, -144(%rbp)\n\tjge\t.L17\n\tmovq\t-184(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, -112(%rbp)\n\tjmp\t.L18\n.L22:\n\tmovq\t-112(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tandq\t-128(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjne\t.L19\n\tmovq\t-176(%rbp), %rax\n\tsubq\t-144(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-112(%rbp), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rax, -160(%rbp)\n\tmovq\t-176(%rbp), %rax\n\tsubq\t-144(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-112(%rbp), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t%rdx, %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tje\t.L20\n\taddq\t$1, -160(%rbp)\n.L20:\n\tmovq\t-96(%rbp), %rax\n\tmovq\t-112(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tcmpq\t%rax, -160(%rbp)\n\tjg\t.L27\n\tmovq\t-112(%rbp), %rax\n\taddq\t$1, %rax\n\timulq\t-160(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rax, -144(%rbp)\n\tmovq\t-160(%rbp), %rax\n\taddq\t%rax, -136(%rbp)\n\tjmp\t.L17\n.L19:\n\tsubq\t$1, -112(%rbp)\n.L18:\n\tcmpq\t$0, -112(%rbp)\n\tjns\t.L22\n\tjmp\t.L17\n.L27:\n\tnop\n.L17:\n\tmovq\t-168(%rbp), %rax\n\tcmpq\t-136(%rbp), %rax\n\tjle\t.L23\n\tmovq\t-176(%rbp), %rax\n\tcmpq\t%rax, -144(%rbp)\n\tjl\t.L23\n\tmovq\t-136(%rbp), %rax\n\tmovq\t%rax, -168(%rbp)\n.L23:\n\taddq\t$1, -128(%rbp)\n.L13:\n\tmovq\t-184(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tcltq\n\tcmpq\t%rax, -128(%rbp)\n\tjl\t.L24\n\tmovq\t-168(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L26\n\tcall\t__stack_chk_fail@PLT\n.L26:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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, &gg); int64 pp[dd], cc[dd], score[dd]; for(int64 ii = 0;ii < dd;ii++) { scanf("%lld %lld", &pp[ii], &cc[ii]); score[ii] = pp[ii] * (ii + 1) * 100 + cc[ii]; } int64 tmp, kosu; for(int64 bit = 0;bit < (1 << dd);bit++) { tmp = 0; kosu = 0; for(int64 ii = 0;ii < dd;ii++) { if(bit & (1 << ii)) { tmp += score[ii]; kosu += pp[ii]; } } if(tmp < gg) { for(int64 ii = dd - 1;ii >= 0;ii--) { if(!(bit & (1 << ii))) { xx = (gg - tmp) / ((ii + 1) * 100); if((gg - tmp) % ((ii + 1) * 100)) { xx++; } if(xx > pp[ii]) { break; } tmp += xx * (ii + 1) * 100; kosu += xx; break; } } } if(min > kosu && tmp >= gg) { min = kosu; } } printf("%lld\n", min); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lld %lld" .LC1: .string "%lld\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $216, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 13, -40 .cfi_offset 12, -48 .cfi_offset 3, -56 movq %fs:40, %rax movq %rax, -56(%rbp) xorl %eax, %eax movq %rsp, %rax movq %rax, %rbx movabsq $9223372036854775807, %rax movq %rax, -168(%rbp) leaq -176(%rbp), %rax leaq -184(%rbp), %rcx movq %rax, %rdx movq %rcx, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -184(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -104(%rbp) movq %rax, %rdx movq %rdx, -208(%rbp) movq $0, -200(%rbp) movq %rax, %rdx movq %rdx, -224(%rbp) movq $0, -216(%rbp) leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %esi movl $0, %edx divq %rsi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L2: cmpq %rdx, %rsp je .L3 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L2 .L3: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L4 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L4: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -96(%rbp) movq -184(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -88(%rbp) movq %rax, %rdx movq %rdx, -240(%rbp) movq $0, -232(%rbp) movq %rax, %rdx movq %rdx, -256(%rbp) movq $0, -248(%rbp) leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %edi movl $0, %edx divq %rdi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L5: cmpq %rdx, %rsp je .L6 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L5 .L6: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L7 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L7: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -80(%rbp) movq -184(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -72(%rbp) movq %rax, %rdx movq %rdx, %r14 movl $0, %r15d movq %rax, %rdx movq %rdx, %r12 movl $0, %r13d leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %esi movl $0, %edx divq %rsi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L8: cmpq %rdx, %rsp je .L9 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L8 .L9: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L10 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L10: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -64(%rbp) movq $0, -152(%rbp) jmp .L11 .L12: movq -152(%rbp), %rax leaq 0(,%rax,8), %rdx movq -80(%rbp), %rax addq %rax, %rdx movq -152(%rbp), %rax leaq 0(,%rax,8), %rcx movq -96(%rbp), %rax addq %rcx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -96(%rbp), %rax movq -152(%rbp), %rdx movq (%rax,%rdx,8), %rax movq -152(%rbp), %rdx addq $1, %rdx imulq %rax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax movq %rax, %rcx movq -80(%rbp), %rax movq -152(%rbp), %rdx movq (%rax,%rdx,8), %rax addq %rax, %rcx movq -64(%rbp), %rax movq -152(%rbp), %rdx movq %rcx, (%rax,%rdx,8) addq $1, -152(%rbp) .L11: movq -184(%rbp), %rax cmpq %rax, -152(%rbp) jl .L12 movq $0, -128(%rbp) jmp .L13 .L24: movq $0, -144(%rbp) movq $0, -136(%rbp) movq $0, -120(%rbp) jmp .L14 .L16: movq -120(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq andq -128(%rbp), %rax testq %rax, %rax je .L15 movq -64(%rbp), %rax movq -120(%rbp), %rdx movq (%rax,%rdx,8), %rax addq %rax, -144(%rbp) movq -96(%rbp), %rax movq -120(%rbp), %rdx movq (%rax,%rdx,8), %rax addq %rax, -136(%rbp) .L15: addq $1, -120(%rbp) .L14: movq -184(%rbp), %rax cmpq %rax, -120(%rbp) jl .L16 movq -176(%rbp), %rax cmpq %rax, -144(%rbp) jge .L17 movq -184(%rbp), %rax subq $1, %rax movq %rax, -112(%rbp) jmp .L18 .L22: movq -112(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq andq -128(%rbp), %rax testq %rax, %rax jne .L19 movq -176(%rbp), %rax subq -144(%rbp), %rax movq %rax, %rdx movq -112(%rbp), %rax leaq 1(%rax), %rcx movq %rcx, %rax salq $2, %rax addq %rcx, %rax leaq 0(,%rax,4), %rcx addq %rcx, %rax salq $2, %rax movq %rax, %rcx movq %rdx, %rax cqto idivq %rcx movq %rax, -160(%rbp) movq -176(%rbp), %rax subq -144(%rbp), %rax movq %rax, %rdx movq -112(%rbp), %rax leaq 1(%rax), %rcx movq %rcx, %rax salq $2, %rax addq %rcx, %rax leaq 0(,%rax,4), %rcx addq %rcx, %rax salq $2, %rax movq %rax, %rcx movq %rdx, %rax cqto idivq %rcx movq %rdx, %rax testq %rax, %rax je .L20 addq $1, -160(%rbp) .L20: movq -96(%rbp), %rax movq -112(%rbp), %rdx movq (%rax,%rdx,8), %rax cmpq %rax, -160(%rbp) jg .L27 movq -112(%rbp), %rax addq $1, %rax imulq -160(%rbp), %rax movq %rax, %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx addq %rdx, %rax salq $2, %rax addq %rax, -144(%rbp) movq -160(%rbp), %rax addq %rax, -136(%rbp) jmp .L17 .L19: subq $1, -112(%rbp) .L18: cmpq $0, -112(%rbp) jns .L22 jmp .L17 .L27: nop .L17: movq -168(%rbp), %rax cmpq -136(%rbp), %rax jle .L23 movq -176(%rbp), %rax cmpq %rax, -144(%rbp) jl .L23 movq -136(%rbp), %rax movq %rax, -168(%rbp) .L23: addq $1, -128(%rbp) .L13: movq -184(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax cltq cmpq %rax, -128(%rbp) jl .L24 movq -168(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq %rbx, %rsp movq -56(%rbp), %rdx subq %fs:40, %rdx je .L26 call __stack_chk_fail@PLT .L26: leaq -40(%rbp), %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\\n%d\\n%d\\n\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rcx\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-16(%rbp), %eax\n\timull\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L3\n\tcall\t__stack_chk_fail@PLT\n.L3:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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$40, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rdx\n\tleaq\t12(%rsp), %rsi\n\tleaq\t20(%rsp), %rcx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t16(%rsp), %eax\n\taddl\t12(%rsp), %eax\n\tleaq\t.LC1(%rip), %rsi\n\timull\t20(%rsp), %eax\n\tmovl\t$1, %edi\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%eax, %edx\n\txorl\t%eax, %eax\n\tsarl\t%edx\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L5\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rdx\n\tleaq\t12(%rsp), %rsi\n\tleaq\t20(%rsp), %rcx\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t16(%rsp), %eax\n\taddl\t12(%rsp), %eax\n\tleaq\t.LC1(%rip), %rsi\n\timull\t20(%rsp), %eax\n\tmovl\t$1, %edi\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%eax, %edx\n\txorl\t%eax, %eax\n\tsarl\t%edx\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L5\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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", "index": 96, "inputs": [ "4\n4\n7\n", "3\n6\n2\n", "4\n8\n7\n", "3\n10\n2\n", "4\n8\n6\n", "3\n10\n3\n", "4\n9\n6\n", "3\n12\n2\n", "4\n5\n6\n", "3\n2\n2\n", "4\n5\n12\n", "3\n1\n2\n", "4\n5\n0\n", "3\n2\n3\n", "4\n5\n-1\n", "4\n4\n-1\n", "3\n0\n1\n", "3\n0\n2\n", "3\n-1\n2\n", "4\n0\n-1\n", "4\n1\n-1\n", "3\n1\n3\n", "4\n0\n4\n", "3\n1\n-4\n", "3\n2\n-4\n", "3\n2\n-8\n", "3\n2\n-7\n", "3\n2\n-10\n", "3\n0\n-10\n", "3\n1\n-12\n", "3\n1\n-24\n", "3\n1\n-36\n", "3\n1\n-70\n", "3\n1\n-135\n", "3\n2\n-135\n", "3\n2\n-98\n", "3\n2\n-65\n", "3\n4\n-65\n", "3\n7\n-65\n", "4\n6\n4\n", "3\n10\n-65\n", "4\n6\n6\n", "3\n5\n-65\n", "3\n5\n-103\n", "3\n5\n-107\n", "3\n5\n-168\n", "3\n1\n-168\n", "4\n13\n2\n", "3\n1\n-281\n", "4\n6\n2\n", "3\n0\n-281\n", "3\n1\n-156\n", "4\n5\n-2\n", "3\n1\n-7\n", "3\n0\n-7\n", "3\n3\n-7\n", "3\n5\n-7\n", "4\n8\n-6\n", "4\n15\n-6\n", "4\n10\n-6\n", "4\n10\n-8\n", "4\n10\n-5\n", "4\n10\n-10\n", "3\n-1\n-1\n", "4\n2\n-10\n", "3\n0\n-4\n", "4\n2\n-4\n", "4\n0\n-11\n", "4\n-1\n-11\n", "3\n5\n-4\n", "4\n-27\n-1\n", "3\n-12\n7\n", "4\n-44\n-2\n", "3\n0\n8\n", "3\n-1\n29\n", "4\n-109\n1\n", "3\n0\n29\n", "3\n1\n29\n", "3\n-2\n29\n", "4\n-144\n3\n", "4\n-92\n3\n", "4\n-68\n-1\n", "4\n-52\n-1\n", "3\n-36\n-1\n", "3\n-36\n-2\n", "3\n-65\n-2\n", "3\n-86\n-2\n", "4\n-5\n14\n", "4\n-12\n17\n", "4\n-19\n17\n", "4\n-38\n17\n", "4\n-38\n22\n", "3\n2\n-5\n", "4\n-38\n14\n", "4\n-51\n14\n", "4\n-1\n14\n", "3\n0\n17\n", "3\n0\n12\n", "3\n0\n15\n", "3\n1\n17\n", "4\n4\n4\n", "3\n4\n2\n", "3\n4\n2\n" ], "outputs": [ "28\n", "9\n", "42\n", "13\n", "36\n", "19\n", "39\n", "15\n", "27\n", "5\n", "54\n", "4\n", "0\n", "7\n", "-4\n", "-4\n", "1\n", "3\n", "2\n", "-2\n", "-2\n", "6\n", "8\n", "-8\n", "-10\n", "-20\n", "-17\n", "-25\n", "-15\n", "-24\n", "-48\n", "-72\n", "-140\n", "-270\n", "-337\n", "-245\n", "-162\n", "-227\n", "-325\n", "20\n", "-422\n", "30\n", "-260\n", "-412\n", "-428\n", "-672\n", "-336\n", "17\n", "-562\n", "10\n", "-421\n", "-312\n", "-9\n", "-14\n", "-10\n", "-21\n", "-28\n", "-36\n", "-57\n", "-42\n", "-56\n", "-35\n", "-70\n", "-1\n", "-30\n", "-6\n", "-12\n", "-22\n", "-16\n", "-16\n", "11\n", "-31\n", "40\n", "12\n", "29\n", "-52\n", "43\n", "58\n", "14\n", "-210\n", "-132\n", "32\n", "24\n", "16\n", "33\n", "62\n", "83\n", "-7\n", "-68\n", "-127\n", "-289\n", "-374\n", "-12\n", "-238\n", "-329\n", "21\n", "25\n", "18\n", "22\n", "34\n", "16\n", "7\n", "7\n" ], "question": "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 Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\\n%d\\n%d\\n\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-16(%rbp), %rcx\n\tleaq\t-20(%rbp), %rdx\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-16(%rbp), %eax\n\timull\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L3\n\tcall\t__stack_chk_fail@PLT\n.L3:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 .section .rodata .LC0: .string "%d\n%d\n%d\n" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -16(%rbp), %rcx leaq -20(%rbp), %rdx leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %edx movl -20(%rbp), %eax addl %eax, %edx movl -16(%rbp), %eax imull %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -12(%rbp) movl -12(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L3 call __stack_chk_fail@PLT .L3: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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 if(a[i]%4==0)\n c++;\n }\n if((b-1<=c && n%2==1) || (b<=c && n%2==0))\n puts(\"Yes\");\n else\n puts(\"No\");\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tmovl\t$0, -80(%rbp)\n\tmovl\t$0, -76(%rbp)\n\tleaq\t-88(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$3, %rax\n\tshrq\t$2, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t$0, -84(%rbp)\n\tjmp\t.L5\n.L8:\n\tmovl\t-84(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-84(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L6\n\taddl\t$1, -80(%rbp)\n.L6:\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-84(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\tandl\t$3, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L7\n\taddl\t$1, -76(%rbp)\n.L7:\n\taddl\t$1, -84(%rbp)\n.L5:\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, -84(%rbp)\n\tjl\t.L8\n\tmovl\t-80(%rbp), %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjl\t.L9\n\tmovl\t-88(%rbp), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tje\t.L10\n.L9:\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t-76(%rbp), %eax\n\tjg\t.L11\n\tmovl\t-88(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L11\n.L10:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L12\n.L11:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L12:\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tleaq\t-60(%rbp), %rsi\n\tpushq\t%r13\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\tmovq\t%r13, %rdi\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-60(%rbp), %ecx\n\tmovq\t%rsp, %rsi\n\tleal\t1(%rcx), %eax\n\tcltq\n\tleaq\t15(,%rax,4), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rsi\n\tandq\t$-16, %rdx\n\tcmpq\t%rsi, %rsp\n\tje\t.L3\n.L23:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rsi, %rsp\n\tjne\t.L23\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L24\n.L4:\n\tmovq\t%rsp, %r14\n\ttestl\t%ecx, %ecx\n\tjle\t.L5\n\txorl\t%ebx, %ebx\n\txorl\t%r12d, %r12d\n\txorl\t%r15d, %r15d\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovq\t%r14, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%r13, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%r14), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\tleal\t(%rax,%rcx), %edx\n\tandl\t$1, %edx\n\tsubl\t%ecx, %edx\n\tmovl\t-60(%rbp), %ecx\n\tcmpl\t$1, %edx\n\tsete\t%dl\n\tandl\t$3, %eax\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %r12d\n\tcmpl\t$1, %eax\n\tadcl\t$0, %ebx\n\taddl\t$1, %r15d\n\taddq\t$4, %r14\n\tcmpl\t%r15d, %ecx\n\tjg\t.L8\n\tleal\t-1(%r12), %eax\n\tcmpl\t%ebx, %eax\n\tjle\t.L25\n.L9:\n\tcmpl\t%ebx, %r12d\n\tjg\t.L11\n.L5:\n\tandb\t$1, %cl\n\tjne\t.L11\n.L12:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n.L10:\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n.L11:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L10\n.L25:\n\tmovl\t%ecx, %eax\n\tmovl\t$2, %esi\n\tcltd\n\tidivl\t%esi\n\tsubl\t$1, %edx\n\tjne\t.L9\n\tjmp\t.L12\n.L24:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L26:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tleaq\t-60(%rbp), %rsi\n\tpushq\t%r13\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\tleaq\t.LC0(%rip), %r13\n\tpushq\t%r12\n\tmovq\t%r13, %rdi\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-60(%rbp), %ecx\n\tmovq\t%rsp, %rsi\n\tleal\t1(%rcx), %eax\n\tcltq\n\tleaq\t15(,%rax,4), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rsi\n\tandq\t$-16, %rdx\n\tcmpq\t%rsi, %rsp\n\tje\t.L3\n.L23:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rsi, %rsp\n\tjne\t.L23\n.L3:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L24\n.L4:\n\tmovq\t%rsp, %r14\n\ttestl\t%ecx, %ecx\n\tjle\t.L5\n\txorl\t%ebx, %ebx\n\txorl\t%r12d, %r12d\n\txorl\t%r15d, %r15d\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovq\t%r14, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%r13, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%r14), %eax\n\tmovl\t%eax, %ecx\n\tshrl\t$31, %ecx\n\tleal\t(%rax,%rcx), %edx\n\tandl\t$1, %edx\n\tsubl\t%ecx, %edx\n\tmovl\t-60(%rbp), %ecx\n\tcmpl\t$1, %edx\n\tsete\t%dl\n\tandl\t$3, %eax\n\tmovzbl\t%dl, %edx\n\taddl\t%edx, %r12d\n\tcmpl\t$1, %eax\n\tadcl\t$0, %ebx\n\taddl\t$1, %r15d\n\taddq\t$4, %r14\n\tcmpl\t%r15d, %ecx\n\tjg\t.L8\n\tleal\t-1(%r12), %eax\n\tcmpl\t%ebx, %eax\n\tjle\t.L25\n.L9:\n\tcmpl\t%ebx, %r12d\n\tjg\t.L11\n.L5:\n\tandb\t$1, %cl\n\tjne\t.L11\n.L12:\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n.L10:\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n.L11:\n\t.cfi_restore_state\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L10\n.L25:\n\tmovl\t%ecx, %eax\n\tmovl\t$2, %esi\n\tcltd\n\tidivl\t%esi\n\tsubl\t$1, %edx\n\tjne\t.L9\n\tjmp\t.L12\n.L24:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L4\n.L26:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 if(a[i]%4==0)\n c++;\n }\n if((b-1<=c && n%2==1) || (b<=c && n%2==0))\n puts(\"Yes\");\n else\n puts(\"No\");\n return 0;\n}\n", "index": 89, "inputs": [ "6\n2 7 2 8 2 8\n", "3\n-1 1 1\n", "3\n0 4 1\n", "3\n2 10 100\n", "4\n2 2 3 4\n", "6\n4 7 2 8 2 8\n", "3\n0 1 1\n", "3\n0 10 100\n", "4\n0 2 3 4\n", "6\n6 7 2 8 2 8\n", "3\n0 11 100\n", "4\n0 2 3 7\n", "6\n6 7 0 8 2 8\n", "3\n-1 1 0\n", "3\n0 11 101\n", "6\n6 7 0 8 2 5\n", "3\n-1 0 0\n", "3\n0 11 111\n", "6\n6 7 0 8 2 9\n", "3\n-1 -1 0\n", "3\n0 14 111\n", "6\n6 7 0 8 3 9\n", "3\n-1 -2 0\n", "3\n0 14 011\n", "6\n6 7 0 8 4 9\n", "3\n-1 0 -1\n", "3\n0 14 010\n", "6\n6 7 0 8 6 9\n", "3\n-1 -1 -1\n", "3\n0 28 010\n", "6\n5 7 0 8 6 9\n", "3\n0 -1 -1\n", "3\n1 28 010\n", "6\n5 7 0 0 6 9\n", "3\n0 -1 -2\n", "6\n4 7 0 0 6 9\n", "3\n0 0 -2\n", "6\n4 7 0 -1 6 9\n", "3\n0 1 -2\n", "6\n4 7 0 -1 6 4\n", "3\n1 1 -2\n", "3\n1 1 -3\n", "3\n1 0 -3\n", "3\n1 0 -5\n", "3\n0 0 -5\n", "3\n0 0 0\n", "3\n0 0 1\n", "3\n0 1 0\n", "3\n1 1 0\n", "3\n1 2 0\n", "3\n0 1 2\n", "3\n0 0 2\n", "3\n0 -1 2\n", "3\n0 -1 3\n", "3\n0 -1 1\n", "3\n0 -1 0\n", "3\n1 -1 0\n", "3\n1 -2 0\n", "3\n0 -2 0\n", "3\n0 -3 0\n", "3\n1 -3 0\n", "3\n1 -3 -1\n", "3\n1 -5 0\n", "3\n1 -8 0\n", "3\n1 -16 0\n", "3\n0 -16 0\n", "3\n1 -16 1\n", "3\n1 -10 0\n", "3\n1 -15 0\n", "3\n2 -5 0\n", "3\n2 -5 -1\n", "3\n3 -5 -1\n", "3\n3 -8 -1\n", "3\n3 -4 -1\n", "3\n3 -4 0\n", "3\n1 -4 -1\n", "3\n1 -4 -2\n", "3\n1 -3 -2\n", "3\n1 -6 0\n", "3\n2 -6 0\n", "6\n2 7 1 8 4 8\n", "3\n1 2 1\n", "3\n1 7 100\n", "2\n0 0\n", "6\n2 7 2 12 2 8\n", "3\n0 4 2\n", "3\n2 10 110\n", "4\n2 2 0 4\n", "6\n4 7 2 8 2 10\n", "3\n0 -1 5\n", "3\n0 10 101\n", "6\n3 7 2 8 2 8\n", "3\n0 2 1\n", "3\n0 18 100\n", "4\n-1 2 3 7\n", "6\n6 7 0 8 0 8\n", "3\n-1 1 -1\n", "3\n0 22 101\n", "6\n6 7 0 8 3 5\n", "3\n-2 1 0\n", "2\n1 1\n", "6\n2 7 1 8 2 8\n", "3\n1 10 100\n", "4\n1 2 3 4\n", "3\n1 10 100\n", "3\n1 4 1\n" ], "outputs": [ "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "No\n", "Yes\n", "Yes\n", "No\n", "Yes\n", "Yes\n" ], "question": "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 if(a[i]%4==0)\n c++;\n }\n if((b-1<=c && n%2==1) || (b<=c && n%2==0))\n puts(\"Yes\");\n else\n puts(\"No\");\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.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"Yes\"\n.LC2:\n\t.string\t\"No\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$56, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tmovl\t$0, -80(%rbp)\n\tmovl\t$0, -76(%rbp)\n\tleaq\t-88(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-88(%rbp), %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$3, %rax\n\tshrq\t$2, %rax\n\tsalq\t$2, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t$0, -84(%rbp)\n\tjmp\t.L5\n.L8:\n\tmovl\t-84(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-64(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-84(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L6\n\taddl\t$1, -80(%rbp)\n.L6:\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-84(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rax,%rdx,4), %eax\n\tandl\t$3, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L7\n\taddl\t$1, -76(%rbp)\n.L7:\n\taddl\t$1, -84(%rbp)\n.L5:\n\tmovl\t-88(%rbp), %eax\n\tcmpl\t%eax, -84(%rbp)\n\tjl\t.L8\n\tmovl\t-80(%rbp), %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjl\t.L9\n\tmovl\t-88(%rbp), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tje\t.L10\n.L9:\n\tmovl\t-80(%rbp), %eax\n\tcmpl\t-76(%rbp), %eax\n\tjg\t.L11\n\tmovl\t-88(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L11\n.L10:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tjmp\t.L12\n.L11:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n.L12:\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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<=c && n%2==1) || (b<=c && n%2==0)) puts("Yes"); else puts("No"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "Yes" .LC2: .string "No" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $56, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 13, -40 .cfi_offset 12, -48 .cfi_offset 3, -56 movq %fs:40, %rax movq %rax, -56(%rbp) xorl %eax, %eax movq %rsp, %rax movq %rax, %rbx movl $0, -80(%rbp) movl $0, -76(%rbp) leaq -88(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -88(%rbp), %eax addl $1, %eax movslq %eax, %rdx subq $1, %rdx movq %rdx, -72(%rbp) movslq %eax, %rdx movq %rdx, %r14 movl $0, %r15d movslq %eax, %rdx movq %rdx, %r12 movl $0, %r13d cltq leaq 0(,%rax,4), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %esi movl $0, %edx divq %rsi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L2: cmpq %rdx, %rsp je .L3 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L2 .L3: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L4 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L4: movq %rsp, %rax addq $3, %rax shrq $2, %rax salq $2, %rax movq %rax, -64(%rbp) movl $0, -84(%rbp) jmp .L5 .L8: movl -84(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -64(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq -64(%rbp), %rax movl -84(%rbp), %edx movslq %edx, %rdx movl (%rax,%rdx,4), %eax cltd shrl $31, %edx addl %edx, %eax andl $1, %eax subl %edx, %eax cmpl $1, %eax jne .L6 addl $1, -80(%rbp) .L6: movq -64(%rbp), %rax movl -84(%rbp), %edx movslq %edx, %rdx movl (%rax,%rdx,4), %eax andl $3, %eax testl %eax, %eax jne .L7 addl $1, -76(%rbp) .L7: addl $1, -84(%rbp) .L5: movl -88(%rbp), %eax cmpl %eax, -84(%rbp) jl .L8 movl -80(%rbp), %eax subl $1, %eax cmpl %eax, -76(%rbp) jl .L9 movl -88(%rbp), %eax cltd shrl $31, %edx addl %edx, %eax andl $1, %eax subl %edx, %eax cmpl $1, %eax je .L10 .L9: movl -80(%rbp), %eax cmpl -76(%rbp), %eax jg .L11 movl -88(%rbp), %eax andl $1, %eax testl %eax, %eax jne .L11 .L10: leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT jmp .L12 .L11: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT .L12: movl $0, %eax movq %rbx, %rsp movq -56(%rbp), %rdx subq %fs:40, %rdx je .L14 call __stack_chk_fail@PLT .L14: leaq -40(%rbp), %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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'){\n\t\t\tcnt++;\n\t\t}\n\t\telse{\n\t\t\tcnt=0;\n\t\t}\n\t\tmax=max<cnt?cnt:max;\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -28(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tleaq\t-18(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$65, %al\n\tje\t.L3\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$67, %al\n\tje\t.L3\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$71, %al\n\tje\t.L3\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$84, %al\n\tjne\t.L4\n.L3:\n\taddl\t$1, -24(%rbp)\n\tjmp\t.L5\n.L4:\n\tmovl\t$0, -24(%rbp)\n.L5:\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovge\t%edx, %eax\n\tmovl\t%eax, -28(%rbp)\n\taddl\t$1, -32(%rbp)\n.L2:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L6\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t14(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t14(%rsp), %ecx\n\ttestb\t%cl, %cl\n\tje\t.L14\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L15\n\tmovl\t$524357, %edx\n\tshrq\t%cl, %rdx\n\tandl\t$1, %edx\n.L3:\n\tmovzbl\t15(%rsp), %ecx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L16\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tje\t.L5\n\tleal\t1(%rdx), %eax\n.L5:\n\tmovzbl\t16(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L18\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\tmovq\t%rsi, %rcx\n\txorl\t%esi, %esi\n\tandb\t$1, %cl\n\tjne\t.L66\n.L6:\n\tmovzbl\t17(%rsp), %ecx\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L20\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tjne\t.L67\n.L7:\n\tmovzbl\t18(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L22\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\tmovq\t%rsi, %rcx\n\txorl\t%esi, %esi\n\tandb\t$1, %cl\n\tje\t.L8\n\tleal\t1(%rax), %esi\n.L8:\n\tmovzbl\t19(%rsp), %ecx\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L24\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tje\t.L9\n\tleal\t1(%rsi), %eax\n.L9:\n\tmovzbl\t20(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L26\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\tmovq\t%rsi, %rcx\n\txorl\t%esi, %esi\n\tandb\t$1, %cl\n\tje\t.L10\n\tleal\t1(%rax), %esi\n.L10:\n\tmovzbl\t21(%rsp), %ecx\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L28\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tje\t.L11\n\tleal\t1(%rsi), %eax\n.L11:\n\tmovzbl\t22(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L30\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\txorl\t%ecx, %ecx\n\tandb\t$1, %sil\n\tje\t.L12\n\tleal\t1(%rax), %ecx\n.L12:\n\tcmpl\t%ecx, %edx\n\tcmovl\t%ecx, %edx\n.L2:\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L68\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L66:\n\t.cfi_restore_state\n\tleal\t1(%rax), %esi\n\tjmp\t.L6\n.L67:\n\tleal\t1(%rsi), %eax\n\tjmp\t.L7\n.L22:\n\txorl\t%esi, %esi\n\tjmp\t.L8\n.L15:\n\txorl\t%edx, %edx\n\tjmp\t.L3\n.L16:\n\txorl\t%eax, %eax\n\tjmp\t.L5\n.L18:\n\txorl\t%esi, %esi\n\tjmp\t.L6\n.L20:\n\txorl\t%eax, %eax\n\tjmp\t.L7\n.L14:\n\txorl\t%edx, %edx\n\tjmp\t.L2\n.L24:\n\txorl\t%eax, %eax\n\tjmp\t.L9\n.L26:\n\txorl\t%esi, %esi\n\tjmp\t.L10\n.L28:\n\txorl\t%eax, %eax\n\tjmp\t.L11\n.L30:\n\txorl\t%ecx, %ecx\n\tjmp\t.L12\n.L68:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 48\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t14(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovzbl\t14(%rsp), %ecx\n\ttestb\t%cl, %cl\n\tje\t.L14\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L15\n\tmovl\t$524357, %edx\n\tshrq\t%cl, %rdx\n\tandl\t$1, %edx\n.L3:\n\tmovzbl\t15(%rsp), %ecx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L16\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tje\t.L5\n\tleal\t1(%rdx), %eax\n.L5:\n\tmovzbl\t16(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L18\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\tmovq\t%rsi, %rcx\n\txorl\t%esi, %esi\n\tandb\t$1, %cl\n\tjne\t.L66\n.L6:\n\tmovzbl\t17(%rsp), %ecx\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L20\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tjne\t.L67\n.L7:\n\tmovzbl\t18(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L22\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\tmovq\t%rsi, %rcx\n\txorl\t%esi, %esi\n\tandb\t$1, %cl\n\tje\t.L8\n\tleal\t1(%rax), %esi\n.L8:\n\tmovzbl\t19(%rsp), %ecx\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L24\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tje\t.L9\n\tleal\t1(%rsi), %eax\n.L9:\n\tmovzbl\t20(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L26\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\tmovq\t%rsi, %rcx\n\txorl\t%esi, %esi\n\tandb\t$1, %cl\n\tje\t.L10\n\tleal\t1(%rax), %esi\n.L10:\n\tmovzbl\t21(%rsp), %ecx\n\tcmpl\t%esi, %edx\n\tcmovl\t%esi, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L28\n\tmovl\t$524357, %eax\n\tshrq\t%cl, %rax\n\tmovq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tandb\t$1, %cl\n\tje\t.L11\n\tleal\t1(%rsi), %eax\n.L11:\n\tmovzbl\t22(%rsp), %ecx\n\tcmpl\t%eax, %edx\n\tcmovl\t%eax, %edx\n\ttestb\t%cl, %cl\n\tje\t.L2\n\tsubl\t$65, %ecx\n\tcmpb\t$19, %cl\n\tja\t.L30\n\tmovl\t$524357, %esi\n\tshrq\t%cl, %rsi\n\txorl\t%ecx, %ecx\n\tandb\t$1, %sil\n\tje\t.L12\n\tleal\t1(%rax), %ecx\n.L12:\n\tcmpl\t%ecx, %edx\n\tcmovl\t%ecx, %edx\n.L2:\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L68\n\txorl\t%eax, %eax\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L66:\n\t.cfi_restore_state\n\tleal\t1(%rax), %esi\n\tjmp\t.L6\n.L67:\n\tleal\t1(%rsi), %eax\n\tjmp\t.L7\n.L22:\n\txorl\t%esi, %esi\n\tjmp\t.L8\n.L15:\n\txorl\t%edx, %edx\n\tjmp\t.L3\n.L16:\n\txorl\t%eax, %eax\n\tjmp\t.L5\n.L18:\n\txorl\t%esi, %esi\n\tjmp\t.L6\n.L20:\n\txorl\t%eax, %eax\n\tjmp\t.L7\n.L14:\n\txorl\t%edx, %edx\n\tjmp\t.L2\n.L24:\n\txorl\t%eax, %eax\n\tjmp\t.L9\n.L26:\n\txorl\t%esi, %esi\n\tjmp\t.L10\n.L28:\n\txorl\t%eax, %eax\n\tjmp\t.L11\n.L30:\n\txorl\t%ecx, %ecx\n\tjmp\t.L12\n.L68:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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'){\n\t\t\tcnt++;\n\t\t}\n\t\telse{\n\t\t\tcnt=0;\n\t\t}\n\t\tmax=max<cnt?cnt:max;\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}", "index": 92, "inputs": [ "SHINJUKV\n", "ATCPDER\n", "HATAGBYA\n", "HASAGBYA\n", "VKUJNIHT\n", "HATAGCYA\n", "VKUJNIHS\n", "ATCPCER\n", "ATCPBER\n", "HASAGCYA\n", "VUKJNIHT\n", "REBPCTA\n", "THINJKUV\n", "RDBPCTA\n", "AYCGATAH\n", "JUKVNIHT\n", "RTBPCDA\n", "HATAHCYA\n", "JUKVMIHT\n", "RPBTCDA\n", "AYCHATAH\n", "THIMVKUJ\n", "RPBSCDA\n", "AYCH@TAH\n", "THIMUKUJ\n", "RPBSCEA\n", "AXCH@TAH\n", "TIHMUKUJ\n", "RPBSCE@\n", "HAT@HCXA\n", "TJHMUKUJ\n", "RPBSDE@\n", "HAT@HCX@\n", "TJHMUKVJ\n", "RPBRDE@\n", "@XCH@TAH\n", "VJHMUKTJ\n", "RPBREE@\n", "HAT?HCX@\n", "VJHMVKTJ\n", "RPBSEE@\n", "HAT?GCX@\n", "WJHMVKTJ\n", "@EESBPR\n", "@XCG?TAH\n", "WJHMVKSJ\n", "?EESBPR\n", "@XCG>TAH\n", "WKHMVJSJ\n", "RPBSEE?\n", "HAT>GCX@\n", "WKHMVJRJ\n", "RPBREE?\n", "HBT>GCX@\n", "WKHNVJRJ\n", "RPAREE@\n", "HBT>GDX@\n", "JRJVNHKW\n", "RPRAEE@\n", "HBT?GDX@\n", "JRJVNIKW\n", "RPRAED@\n", "@XDG?TBH\n", "JRJVMIKW\n", "RPEARD@\n", "@XDG?SBH\n", "RJJVMIKW\n", "RPEASD@\n", "@XDG?RBH\n", "RJJVLIKW\n", "@DSAEPR\n", "@XDGBR?H\n", "WKILVJJR\n", "RPE@SD@\n", "@XEGBR?H\n", "RJJVLIJW\n", "@DS@EPR\n", "H?RBGEX@\n", "QJJVLIJW\n", "RPEDS@@\n", "H?RBFEX@\n", "RJJVLIJV\n", "RPEDT@@\n", "H?RBFEW@\n", "RIJVLIJV\n", "@@TDEPR\n", "H?RBFEV@\n", "VJILVJIR\n", "@@UDEPR\n", "H?REFBV@\n", "RIJVILJV\n", "@AUDEPR\n", "H?REFAV@\n", "RIJVHLJV\n", "RPEDUA@\n", "H@REFAV@\n", "RJJVHLJV\n", "RDEPUA@\n", "@VAFER@H\n", "VJLHVJJR\n", "SHINJUKU\n", "ATCODER\n", "HATAGAYA\n", "ATCODER\n" ], "outputs": [ "0", "3", "4", "2", "1", "5", "0", "3", "3", "3", "1", "3", "1", "3", "5", "1", "1", "3", "1", "2", "3", "1", "1", "2", "1", "1", "2", "1", "1", "2", "1", "0", "2", "1", "0", "2", "1", "0", "2", "1", "0", "2", "1", "0", "2", "0", "0", "2", "0", "0", "2", "0", "0", "2", "0", "1", "1", "0", "1", "1", "0", "1", "1", "0", "1", "1", "0", "1", "1", "0", "1", "1", "0", "0", "1", "0", "0", "1", "0", "0", "0", "0", "1", "0", "0", "1", "0", "0", "0", "0", "0", "1", "1", "0", "1", "1", "0", "1", "1", "0", "0", "3", "5", "3" ], "question": "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'){\n\t\t\tcnt++;\n\t\t}\n\t\telse{\n\t\t\tcnt=0;\n\t\t}\n\t\tmax=max<cnt?cnt:max;\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovl\t$0, -28(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tleaq\t-18(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$65, %al\n\tje\t.L3\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$67, %al\n\tje\t.L3\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$71, %al\n\tje\t.L3\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\tcmpb\t$84, %al\n\tjne\t.L4\n.L3:\n\taddl\t$1, -24(%rbp)\n\tjmp\t.L5\n.L4:\n\tmovl\t$0, -24(%rbp)\n.L5:\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovge\t%edx, %eax\n\tmovl\t%eax, -28(%rbp)\n\taddl\t$1, -32(%rbp)\n.L2:\n\tmovl\t-32(%rbp), %eax\n\tcltq\n\tmovzbl\t-18(%rbp,%rax), %eax\n\ttestb\t%al, %al\n\tjne\t.L6\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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; } max=max<cnt?cnt:max; } printf("%d",max); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "%d" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movl $0, -28(%rbp) movl $0, -24(%rbp) leaq -18(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $0, -32(%rbp) jmp .L2 .L6: movl -32(%rbp), %eax cltq movzbl -18(%rbp,%rax), %eax cmpb $65, %al je .L3 movl -32(%rbp), %eax cltq movzbl -18(%rbp,%rax), %eax cmpb $67, %al je .L3 movl -32(%rbp), %eax cltq movzbl -18(%rbp,%rax), %eax cmpb $71, %al je .L3 movl -32(%rbp), %eax cltq movzbl -18(%rbp,%rax), %eax cmpb $84, %al jne .L4 .L3: addl $1, -24(%rbp) jmp .L5 .L4: movl $0, -24(%rbp) .L5: movl -28(%rbp), %edx movl -24(%rbp), %eax cmpl %eax, %edx cmovge %edx, %eax movl %eax, -28(%rbp) addl $1, -32(%rbp) .L2: movl -32(%rbp), %eax cltq movzbl -18(%rbp,%rax), %eax testb %al, %al jne .L6 movl -28(%rbp), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<stdint.h>\n#include<inttypes.h>\n\ntypedef struct binaryHeap{\n void *array;\n size_t heap_size;\n size_t max_size;\n size_t val_size;\n int (*cmp) (const void *, const void *);\n} heap;\n\nheap* new_binary_heap (const size_t val_size, int (*cmpF) (const void *, const void *)) {\n heap *h = (heap *) calloc (1, sizeof (heap));\n h->array = malloc (val_size * (1 + 1));\n h->heap_size = 0;\n h->max_size = 1;\n h->val_size = val_size;\n h->cmp = cmpF;\n return h;\n}\n\nvoid init_heap (heap *h) {\n h->heap_size = 0;\n}\n\nstatic void heap_func_swap (void * restrict a, void * restrict b, size_t val_size) {\n if ((val_size & 7) == 0) {\n uint64_t *p = (uint64_t *) a;\n uint64_t *q = (uint64_t *) b;\n val_size /= sizeof (uint64_t);\n while (val_size--) {\n uint64_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n } else if ((val_size & 3) == 0) {\n uint32_t *p = (uint32_t *) a;\n uint32_t *q = (uint32_t *) b;\n val_size /= sizeof (uint32_t);\n while (val_size--) {\n uint32_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n } else {\n uint8_t *p = (uint8_t *) a;\n uint8_t *q = (uint8_t *) b;\n while (val_size--) {\n uint8_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n }\n}\n\nstatic void heap_func_copy (void * restrict dst, const void * restrict src, size_t val_size) {\n if ((val_size & 7) == 0) {\n uint64_t *p = (uint64_t *) src;\n uint64_t *q = (uint64_t *) dst;\n val_size /= sizeof (uint64_t);\n while (val_size--) {\n *q++ = *p++;\n }\n } else if ((val_size & 3) == 0) {\n uint32_t *p = (uint32_t *) src;\n uint32_t *q = (uint32_t *) dst;\n val_size /= sizeof (uint32_t);\n while (val_size--) {\n *q++ = *p++;\n }\n } else {\n uint8_t *p = (uint8_t *) src;\n uint8_t *q = (uint8_t *) dst;\n while (val_size--) {\n *q++ = *p++;\n }\n }\n}\n\nvoid push (heap *h, const void *val) {\n if (h->heap_size == h->max_size) {\n h->max_size = 2 * h->max_size + 1;\n h->array = realloc (h->array, h->val_size * (h->max_size + 1));\n }\n h->heap_size++;\n uint8_t *array = (uint8_t *) h->array;\n size_t k = h->heap_size;\n const size_t val_size = h->val_size;\n int (*cmp) (const void *, const void *) = h->cmp;\n heap_func_copy(array + k * val_size, val, val_size);\n while(k>1){\n size_t parent = k / 2;\n if (cmp (array + parent * val_size, array + k * val_size) <= 0) {\n return;\n }\n heap_func_swap (array + parent * val_size, array + k * val_size, val_size);\n k = parent;\n }\n}\n\nvoid pop (heap *h, void *res) {\n uint8_t *array = (uint8_t *) h->array;\n const size_t val_size = h->val_size;\n if (res != NULL) {\n heap_func_copy (res, array + val_size, val_size);\n }\n heap_func_copy (array + val_size, array + val_size * h->heap_size, val_size);\n h->heap_size--;\n int (* const cmp) (const void *, const void *) = h->cmp;\n const size_t n = h->heap_size;\n size_t k = 1;\n while (2 * k + 1 <= n) {\n int c = cmp (array + val_size * 2 * k, array + val_size * (2 * k + 1));\n size_t next = 2 * k + (c <= 0 ? 0 : 1);\n if (cmp (array + val_size * k, array + val_size * next) <= 0) return;\n heap_func_swap (array + val_size * k, array + val_size * next, val_size);\n k = next;\n }\n if (2 * k <= n && cmp (array + val_size * k, array + val_size * 2 * k) > 0) {\n heap_func_swap (array + val_size * k, array + val_size * 2 * k, val_size);\n }\n}\n\ntypedef int32_t i32;\ntypedef int64_t i64;\n\nint cmp (const void *a, const void *b) {\n i32 d = *(i32 *)a - *(i32 *)b;\n return d == 0 ? 0 : d < 0 ? -1 : 1;\n}\n\nvoid run (void) {\n i32 n;\n scanf (\"%\" SCNi32, &n);\n i32 *a = (i32 *) calloc (3 * n, sizeof (i32));\n for (i32 i = 0; i < 3 * n; ++i) {\n scanf (\"%\" SCNi32, a + i);\n }\n i64 sum = 0;\n heap *h = new_binary_heap (sizeof (i32), cmp);\n for (i32 i = 0; i < n; ++i) {\n i32 v = a[i];\n sum += v;\n push (h, &v);\n }\n i64 *front = (i64 *) calloc (n + 1, sizeof (i64));\n front[0] = sum;\n for (i32 i = 1; i <= n; ++i) {\n i32 v = a[n - 1 + i];\n sum += v;\n push (h, &v);\n pop (h, &v);\n sum -= v;\n front[i] = sum;\n }\n init_heap (h);\n sum = 0;\n for (i32 i = 0; i < n; ++i) {\n i32 v = -a[3 * n - 1 - i];\n sum += v;\n push (h, &v);\n }\n i64 max = front[n] + sum;\n for (i32 i = 1; i <= n; ++i) {\n i32 v = -a[2 * n - i];\n sum += v;\n push (h, &v);\n pop (h, &v);\n sum -= v;\n i64 d = front[n - i] + sum;\n if (d > max) max = d;\n }\n printf (\"%\" PRIi64 \"\\n\", max);\n}\n\nint main (void) {\n run ();\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tnew_binary_heap\n\t.type\tnew_binary_heap, @function\nnew_binary_heap:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t$40, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$1, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rdx, 24(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t%rdx, 32(%rax)\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnew_binary_heap, .-new_binary_heap\n\t.globl\tinit_heap\n\t.type\tinit_heap, @function\ninit_heap:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tinit_heap, .-init_heap\n\t.type\theap_func_swap, @function\nheap_func_swap:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t%rdx, -88(%rbp)\n\tmovq\t-88(%rbp), %rax\n\tandl\t$7, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L5\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-88(%rbp), %rax\n\tshrq\t$3, %rax\n\tmovq\t%rax, -88(%rbp)\n\tjmp\t.L6\n.L7:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tleaq\t8(%rax), %rdx\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t(%rdx), %rdx\n\tmovq\t%rdx, (%rax)\n\tmovq\t-48(%rbp), %rax\n\tleaq\t8(%rax), %rdx\n\tmovq\t%rdx, -48(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, (%rax)\n.L6:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L7\n\tjmp\t.L14\n.L5:\n\tmovq\t-88(%rbp), %rax\n\tandl\t$3, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L9\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-88(%rbp), %rax\n\tshrq\t$2, %rax\n\tmovq\t%rax, -88(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -60(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tleaq\t4(%rax), %rdx\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-32(%rbp), %rax\n\tleaq\t4(%rax), %rdx\n\tmovq\t%rdx, -32(%rbp)\n\tmovl\t-60(%rbp), %edx\n\tmovl\t%edx, (%rax)\n.L10:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L11\n\tjmp\t.L14\n.L9:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -61(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovzbl\t(%rdx), %edx\n\tmovb\t%dl, (%rax)\n\tmovq\t-16(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -16(%rbp)\n\tmovzbl\t-61(%rbp), %edx\n\tmovb\t%dl, (%rax)\n.L12:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L13\n.L14:\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\theap_func_swap, .-heap_func_swap\n\t.type\theap_func_copy, @function\nheap_func_copy:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -56(%rbp)\n\tmovq\t%rsi, -64(%rbp)\n\tmovq\t%rdx, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tandl\t$7, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L16\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tshrq\t$3, %rax\n\tmovq\t%rax, -72(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovq\t-48(%rbp), %rdx\n\tleaq\t8(%rdx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tleaq\t8(%rax), %rcx\n\tmovq\t%rcx, -40(%rbp)\n\tmovq\t(%rdx), %rdx\n\tmovq\t%rdx, (%rax)\n.L17:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L18\n\tjmp\t.L25\n.L16:\n\tmovq\t-72(%rbp), %rax\n\tandl\t$3, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L20\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tshrq\t$2, %rax\n\tmovq\t%rax, -72(%rbp)\n\tjmp\t.L21\n.L22:\n\tmovq\t-32(%rbp), %rdx\n\tleaq\t4(%rdx), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t4(%rax), %rcx\n\tmovq\t%rcx, -24(%rbp)\n\tmovl\t(%rdx), %edx\n\tmovl\t%edx, (%rax)\n.L21:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L22\n\tjmp\t.L25\n.L20:\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L23\n.L24:\n\tmovq\t-16(%rbp), %rdx\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, -8(%rbp)\n\tmovzbl\t(%rdx), %edx\n\tmovb\t%dl, (%rax)\n.L23:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L24\n.L25:\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\theap_func_copy, .-heap_func_copy\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%rdi, -56(%rbp)\n\tmovq\t%rsi, -64(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L27\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\taddq\t%rax, %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t24(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\taddq\t$1, %rax\n\timulq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\trealloc@PLT\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n.L27:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t32(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-40(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_copy\n\tjmp\t.L28\n.L31:\n\tmovq\t-40(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-40(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L32\n\tmovq\t-40(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_swap\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -40(%rbp)\n.L28:\n\tcmpq\t$1, -40(%rbp)\n\tja\t.L31\n\tjmp\t.L26\n.L32:\n\tnop\n.L26:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tpush, .-push\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tcmpq\t$0, -80(%rbp)\n\tje\t.L34\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\theap_func_copy\n.L34:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\timulq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_copy\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t32(%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t$1, -48(%rbp)\n\tjmp\t.L35\n.L38:\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rax, %rax\n\taddq\t$1, %rax\n\timulq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\tmovl\t%eax, -52(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tcmpl\t$0, -52(%rbp)\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcltq\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L39\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_swap\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n.L35:\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rax, %rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjnb\t.L38\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rax, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjb\t.L33\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L33\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_swap\n\tjmp\t.L33\n.L39:\n\tnop\n.L33:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tpop, .-pop\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tje\t.L41\n\tcmpl\t$0, -4(%rbp)\n\tjns\t.L42\n\tmovl\t$-1, %eax\n\tjmp\t.L45\n.L42:\n\tmovl\t$1, %eax\n\tjmp\t.L45\n.L41:\n\tmovl\t$0, %eax\n.L45:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tcmp, .-cmp\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%i\"\n.LC1:\n\t.string\t\"%li\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-84(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-84(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -40(%rbp)\n\tmovl\t$0, -76(%rbp)\n\tjmp\t.L47\n.L48:\n\tmovl\t-76(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -76(%rbp)\n.L47:\n\tmovl\t-84(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjl\t.L48\n\tmovq\t$0, -56(%rbp)\n\tleaq\tcmp(%rip), %rax\n\tmovq\t%rax, %rsi\n\tmovl\t$4, %edi\n\tcall\tnew_binary_heap\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tjmp\t.L49\n.L50:\n\tmovl\t-72(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\taddl\t$1, -72(%rbp)\n.L49:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -72(%rbp)\n\tjl\t.L50\n\tmovl\t-84(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t%rdx, (%rax)\n\tmovl\t$1, -68(%rbp)\n\tjmp\t.L51\n.L52:\n\tmovl\t-84(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-68(%rbp), %eax\n\taddl\t%edx, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpop\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tsubq\t%rax, -56(%rbp)\n\tmovl\t-68(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\taddl\t$1, -68(%rbp)\n.L51:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -68(%rbp)\n\tjle\t.L52\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tinit_heap\n\tmovq\t$0, -56(%rbp)\n\tmovl\t$0, -64(%rbp)\n\tjmp\t.L53\n.L54:\n\tmovl\t-84(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tsubl\t$1, %eax\n\tsubl\t-64(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tnegl\t%eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\taddl\t$1, -64(%rbp)\n.L53:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -64(%rbp)\n\tjl\t.L54\n\tmovl\t-84(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovl\t$1, -60(%rbp)\n\tjmp\t.L55\n.L57:\n\tmovl\t-84(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tnegl\t%eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpop\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tsubq\t%rax, -56(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tsubl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-48(%rbp), %rax\n\tjle\t.L56\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n.L56:\n\taddl\t$1, -60(%rbp)\n.L55:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -60(%rbp)\n\tjle\t.L57\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L58\n\tcall\t__stack_chk_fail@PLT\n.L58:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\theap_func_swap, @function\nheap_func_swap:\n.LFB41:\n\t.cfi_startproc\n\tmovq\t%rsi, %rcx\n\tmovq\t%rdi, %rax\n\tmovq\t%rdx, %rsi\n\tandl\t$7, %edx\n\tjne\t.L9\n\tmovq\t%rsi, %r8\n\tshrq\t$3, %r8\n\tje\t.L8\n\tcmpq\t$1, %r8\n\tje\t.L11\n\tmovq\t%rsi, %rdi\n\tandq\t$-16, %rsi\n\tshrq\t$4, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovdqu\t(%rax,%rdx), %xmm0\n\tmovdqu\t(%rcx,%rdx), %xmm1\n\tmovups\t%xmm0, (%rcx,%rdx)\n\tmovups\t%xmm1, (%rax,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%rsi, %rdx\n\tjne\t.L12\n\tleaq\t(%rdi,%rdi), %rsi\n\tsalq\t$4, %rdi\n\taddq\t%rdi, %rax\n\taddq\t%rdi, %rcx\n\tcmpq\t%rsi, %r8\n\tje\t.L8\n.L11:\n\tmovq\t(%rax), %rdx\n\tmovq\t(%rcx), %rsi\n\tmovq\t%rdx, (%rcx)\n\tmovq\t%rsi, (%rax)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovq\t%rsi, %rdx\n\tandl\t$3, %edx\n\tje\t.L16\n\tleaq\t-1(%rsi), %r9\n\tcmpq\t$14, %r9\n\tjbe\t.L29\n\tleaq\t-16(%rsi), %rdx\n\txorl\t%r8d, %r8d\n\tshrq\t$4, %rdx\n\tleaq\t1(%rdx), %rdi\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovdqu\t(%rax,%rdx), %xmm0\n\tmovdqu\t(%rcx,%rdx), %xmm2\n\taddq\t$1, %r8\n\tmovups\t%xmm2, (%rax,%rdx)\n\tmovups\t%xmm0, (%rcx,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%r8, %rdi\n\tja\t.L18\n\tsalq\t$4, %rdi\n\tmovq\t%rdi, %rdx\n\tleaq\t(%rax,%rdi), %r8\n\tleaq\t(%rcx,%rdi), %rdi\n\tsubq\t%rdx, %r9\n\tcmpq\t%rdx, %rsi\n\tje\t.L62\n.L17:\n\tsubq\t%rdx, %rsi\n\tleaq\t-1(%rsi), %r10\n\tcmpq\t$6, %r10\n\tjbe\t.L26\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rdx\n\tmovq\t(%rdx), %r10\n\tmovq\t(%rax), %rcx\n\tmovq\t%r10, (%rax)\n\tmovq\t%rsi, %rax\n\tandq\t$-8, %rax\n\tmovq\t%rcx, (%rdx)\n\taddq\t%rax, %r8\n\taddq\t%rax, %rdi\n\tsubq\t%rax, %r9\n\tcmpq\t%rax, %rsi\n\tje\t.L8\n.L26:\n\tmovzbl\t(%r8), %eax\n\tmovzbl\t(%rdi), %edx\n\tmovb\t%al, (%rdi)\n\tmovb\t%dl, (%r8)\n\ttestq\t%r9, %r9\n\tjne\t.L63\n.L8:\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovq\t%rsi, %rdi\n\tshrq\t$2, %rdi\n\tleaq\t-1(%rdi), %r8\n\tje\t.L8\n\tcmpq\t$2, %r8\n\tjbe\t.L30\n\tmovq\t%rsi, %r8\n\tandq\t$-16, %rsi\n\tshrq\t$4, %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tmovdqu\t(%rax,%rdx), %xmm0\n\tmovdqu\t(%rcx,%rdx), %xmm3\n\tmovups\t%xmm0, (%rcx,%rdx)\n\tmovups\t%xmm3, (%rax,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%rdx, %rsi\n\tjne\t.L20\n\tmovq\t%r8, %rsi\n\tleaq\t0(,%r8,4), %rdx\n\tsalq\t$4, %rsi\n\tleaq\t(%rax,%rsi), %r8\n\taddq\t%rcx, %rsi\n\tcmpq\t%rdx, %rdi\n\tje\t.L64\n.L19:\n\tsubq\t%rdx, %rdi\n\tcmpq\t$1, %rdi\n\tje\t.L23\n\tsalq\t$2, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rdx\n\tmovq\t(%rdx), %r9\n\tmovq\t(%rax), %rcx\n\tmovq\t%r9, (%rax)\n\tmovq\t%rdi, %rax\n\tandq\t$-2, %rax\n\tmovq\t%rcx, (%rdx)\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %r8\n\taddq\t%rdx, %rsi\n\tcmpq\t%rax, %rdi\n\tje\t.L8\n.L23:\n\tmovl\t(%r8), %eax\n\tmovl\t(%rsi), %edx\n\tmovl\t%eax, (%rsi)\n\tmovl\t%edx, (%r8)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovzbl\t1(%r8), %eax\n\tmovzbl\t1(%rdi), %edx\n\tmovb\t%al, 1(%rdi)\n\tmovb\t%dl, 1(%r8)\n\tcmpq\t$1, %r9\n\tje\t.L8\n\tmovzbl\t2(%r8), %eax\n\tmovzbl\t2(%rdi), %edx\n\tmovb\t%al, 2(%rdi)\n\tmovb\t%dl, 2(%r8)\n\tcmpq\t$2, %r9\n\tje\t.L8\n\tmovzbl\t3(%r8), %eax\n\tmovzbl\t3(%rdi), %edx\n\tmovb\t%al, 3(%rdi)\n\tmovb\t%dl, 3(%r8)\n\tcmpq\t$3, %r9\n\tje\t.L8\n\tmovzbl\t4(%r8), %eax\n\tmovzbl\t4(%rdi), %edx\n\tmovb\t%al, 4(%rdi)\n\tmovb\t%dl, 4(%r8)\n\tcmpq\t$4, %r9\n\tje\t.L8\n\tmovzbl\t5(%r8), %eax\n\tmovzbl\t5(%rdi), %edx\n\tmovb\t%al, 5(%rdi)\n\tmovb\t%dl, 5(%r8)\n\tcmpq\t$5, %r9\n\tje\t.L8\n\tmovzbl\t6(%r8), %eax\n\tmovzbl\t6(%rdi), %edx\n\tmovb\t%al, 6(%rdi)\n\tmovb\t%dl, 6(%r8)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tret\n.L29:\n\tmovq\t%rcx, %rdi\n\tmovq\t%rax, %r8\n\txorl\t%edx, %edx\n\tjmp\t.L17\n.L30:\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %r8\n\tjmp\t.L19\n.L62:\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\theap_func_swap, .-heap_func_swap\n\t.p2align 4\n\t.globl\tnew_binary_heap\n\t.type\tnew_binary_heap, @function\nnew_binary_heap:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovq\t%rsi, %rbp\n\tmovl\t$40, %esi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rdi, %rbx\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tleaq\t(%rbx,%rbx), %rdi\n\tmovq\t%rax, %r12\n\tcall\tmalloc@PLT\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovq\t%rbx, 24(%r12)\n\tmovq\t%rax, (%r12)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tmovq\t%r12, %rax\n\tmovq\t%rbp, 32(%r12)\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tmovups\t%xmm0, 8(%r12)\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tnew_binary_heap, .-new_binary_heap\n\t.p2align 4\n\t.globl\tinit_heap\n\t.type\tinit_heap, @function\ninit_heap:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t$0, 8(%rdi)\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tinit_heap, .-init_heap\n\t.p2align 4\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB43:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tmovq\t%rsi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rdi, %rbx\n\tsubq\t$120, %rsp\n\t.cfi_def_cfa_offset 176\n\tmovq\t8(%rdi), %rcx\n\tmovq\t(%rdi), %r10\n\tcmpq\t16(%rdi), %rcx\n\tje\t.L135\n.L69:\n\tmovq\t24(%rbx), %r14\n\tleaq\t1(%rcx), %r13\n\tmovq\t32(%rbx), %rax\n\tmovq\t%r13, %rdi\n\tmovq\t%r13, 8(%rbx)\n\timulq\t%r14, %rdi\n\tmovq\t%rax, 24(%rsp)\n\tmovq\t%r14, %rax\n\taddq\t%r10, %rdi\n\tandl\t$7, %eax\n\tmovq\t%rax, 32(%rsp)\n\tjne\t.L70\n\tmovq\t%r14, %rax\n\tshrq\t$3, %rax\n\tje\t.L74\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t(%rsp), %r10\n.L74:\n\tcmpq\t$1, %r13\n\tjbe\t.L68\n\tmovq\t%r14, %rax\n\tleaq\t-1(%r14), %rdx\n\tmovq\t%r14, %r15\n\tandl\t$3, %eax\n\tmovq\t%rdx, 64(%rsp)\n\tandq\t$-16, %r15\n\tmovq\t%rax, 48(%rsp)\n\tmovq\t%r14, %rax\n\tmovq\t%r15, %r8\n\tmovq\t%r14, %r15\n\tshrq\t$2, %rax\n\tmovq\t%rax, 40(%rsp)\n\tsubq\t$1, %rax\n\tmovq\t%rax, 72(%rsp)\n\tmovq\t%r14, %rax\n\tshrq\t$3, %rax\n\tmovq\t%rax, 16(%rsp)\n\tleaq\t-16(%r14), %rax\n\tshrq\t$4, %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, 80(%rsp)\n\tsalq\t$4, %rax\n\tsubq\t%rax, %rdx\n\tmovq\t%rax, 88(%rsp)\n\tmovq\t%r14, %rax\n\tmovq\t%r10, %r14\n\tshrq\t$4, %rax\n\tmovq\t%rdx, 96(%rsp)\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rax, %rax\n\tmovq\t%rdx, 104(%rsp)\n\tmovq\t%rax, 56(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t%r13, %rcx\n\tmovq\t%r15, %r12\n\tshrq\t%r13\n\tmovq\t%r8, 8(%rsp)\n\timulq\t%r15, %rcx\n\tmovq\t24(%rsp), %rax\n\timulq\t%r13, %r12\n\tleaq\t(%r14,%rcx), %rbp\n\tmovq\t%rcx, (%rsp)\n\tleaq\t(%r14,%r12), %rbx\n\tmovq\t%rbp, %rsi\n\tmovq\t%rbx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L68\n\tcmpq\t$0, 32(%rsp)\n\tmovq\t(%rsp), %rcx\n\tmovq\t8(%rsp), %r8\n\tjne\t.L76\n\tcmpq\t$0, 16(%rsp)\n\tje\t.L82\n\tcmpq\t$1, 16(%rsp)\n\tje\t.L79\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L80:\n\tmovdqu\t(%rbx,%rax), %xmm0\n\tmovdqu\t0(%rbp,%rax), %xmm1\n\tmovups\t%xmm0, 0(%rbp,%rax)\n\tmovups\t%xmm1, (%rbx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rax, %r8\n\tjne\t.L80\n\tmovq\t56(%rsp), %rdx\n\taddq\t%r8, %rbx\n\taddq\t%r8, %rbp\n\tcmpq\t%rdx, 16(%rsp)\n\tje\t.L82\n.L79:\n\tmovq\t(%rbx), %rax\n\tmovq\t0(%rbp), %rcx\n\tmovq\t%rax, 0(%rbp)\n\tmovq\t%rcx, (%rbx)\n.L82:\n\tcmpq\t$1, %r13\n\tjne\t.L78\n.L68:\n\taddq\t$120, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\t.cfi_restore_state\n\tcmpq\t$0, 48(%rsp)\n\tje\t.L84\n\tcmpq\t$14, 64(%rsp)\n\tjbe\t.L97\n\tmovq\t80(%rsp), %rdx\n\txorl\t%eax, %eax\n\txorl\t%esi, %esi\n\t.p2align 4,,10\n\t.p2align 3\n.L86:\n\tmovdqu\t(%rbx,%rax), %xmm0\n\tmovdqu\t0(%rbp,%rax), %xmm2\n\taddq\t$1, %rsi\n\tmovups\t%xmm2, (%rbx,%rax)\n\tmovups\t%xmm0, 0(%rbp,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rsi, %rdx\n\tja\t.L86\n\tmovq\t88(%rsp), %rax\n\taddq\t%rax, %rbx\n\taddq\t%rax, %rbp\n\tcmpq\t%rax, %r15\n\tje\t.L82\n\tmovq\t96(%rsp), %rsi\n.L85:\n\tmovq\t%r15, %rdi\n\tsubq\t%rax, %rdi\n\tleaq\t-1(%rdi), %r11\n\tcmpq\t$6, %r11\n\tjbe\t.L94\n\taddq\t%rax, %r12\n\taddq\t%rcx, %rax\n\taddq\t%r14, %r12\n\taddq\t%r14, %rax\n\tmovq\t(%r12), %rcx\n\tmovq\t(%rax), %r11\n\tmovq\t%rcx, (%rax)\n\tmovq\t%rdi, %rax\n\tandq\t$-8, %rax\n\tmovq\t%r11, (%r12)\n\taddq\t%rax, %rbx\n\taddq\t%rax, %rbp\n\tsubq\t%rax, %rsi\n\tcmpq\t%rax, %rdi\n\tje\t.L82\n.L94:\n\tmovzbl\t(%rbx), %eax\n\tmovzbl\t0(%rbp), %ecx\n\tmovb\t%al, 0(%rbp)\n\tmovb\t%cl, (%rbx)\n\ttestq\t%rsi, %rsi\n\tje\t.L82\n\tmovzbl\t1(%rbx), %eax\n\tmovzbl\t1(%rbp), %ecx\n\tmovb\t%al, 1(%rbp)\n\tmovb\t%cl, 1(%rbx)\n\tcmpq\t$1, %rsi\n\tje\t.L82\n\tmovzbl\t2(%rbx), %eax\n\tmovzbl\t2(%rbp), %ecx\n\tmovb\t%al, 2(%rbp)\n\tmovb\t%cl, 2(%rbx)\n\tcmpq\t$2, %rsi\n\tje\t.L82\n\tmovzbl\t3(%rbx), %eax\n\tmovzbl\t3(%rbp), %ecx\n\tmovb\t%al, 3(%rbp)\n\tmovb\t%cl, 3(%rbx)\n\tcmpq\t$3, %rsi\n\tje\t.L82\n\tmovzbl\t4(%rbx), %eax\n\tmovzbl\t4(%rbp), %ecx\n\tmovb\t%al, 4(%rbp)\n\tmovb\t%cl, 4(%rbx)\n\tcmpq\t$4, %rsi\n\tje\t.L82\n\tmovzbl\t5(%rbx), %eax\n\tmovzbl\t5(%rbp), %ecx\n\tmovb\t%al, 5(%rbp)\n\tmovb\t%cl, 5(%rbx)\n\tcmpq\t$5, %rsi\n\tje\t.L82\n\tmovzbl\t6(%rbx), %eax\n\tmovzbl\t6(%rbp), %ecx\n\tmovb\t%al, 6(%rbp)\n\tmovb\t%cl, 6(%rbx)\n\tjmp\t.L82\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tcmpq\t$0, 40(%rsp)\n\tje\t.L82\n\txorl\t%eax, %eax\n\tcmpq\t$2, 72(%rsp)\n\tjbe\t.L98\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\tmovdqu\t(%rbx,%rax), %xmm0\n\tmovdqu\t0(%rbp,%rax), %xmm3\n\tmovups\t%xmm0, 0(%rbp,%rax)\n\tmovups\t%xmm3, (%rbx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%r8, %rax\n\tjne\t.L88\n\tmovq\t40(%rsp), %rdx\n\tmovq\t104(%rsp), %rax\n\taddq\t%r8, %rbx\n\taddq\t%r8, %rbp\n\tmovq\t%rdx, %rsi\n\tcmpq\t%rdx, %rax\n\tje\t.L82\n.L87:\n\tsubq\t%rax, %rsi\n\tcmpq\t$1, %rsi\n\tje\t.L91\n\tsalq\t$2, %rax\n\taddq\t%rax, %r12\n\taddq\t%rcx, %rax\n\taddq\t%r14, %r12\n\taddq\t%r14, %rax\n\tmovq\t(%r12), %rcx\n\tmovq\t(%rax), %rdi\n\tmovq\t%rcx, (%rax)\n\tmovq\t%rsi, %rax\n\tandq\t$-2, %rax\n\tmovq\t%rdi, (%r12)\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rbx\n\taddq\t%rcx, %rbp\n\tcmpq\t%rax, %rsi\n\tje\t.L82\n.L91:\n\tmovl\t(%rbx), %eax\n\tmovl\t0(%rbp), %ecx\n\tmovl\t%eax, 0(%rbp)\n\tmovl\t%ecx, (%rbx)\n\tjmp\t.L82\n\t.p2align 4,,10\n\t.p2align 3\n.L70:\n\ttestb\t$3, %r14b\n\tjne\t.L136\n\tmovq\t%r14, %rax\n\tshrq\t$2, %rax\n\tje\t.L74\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t(%rsp), %r10\n\tjmp\t.L74\n.L136:\n\tmovq\t%r14, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t(%rsp), %r10\n\tjmp\t.L74\n.L97:\n\tmovq\t64(%rsp), %rsi\n\txorl\t%eax, %eax\n\tjmp\t.L85\n.L135:\n\tleaq\t1(%rcx,%rcx), %rax\n\taddq\t$1, %rcx\n\timulq\t24(%rdi), %rcx\n\tmovq\t%rax, 16(%rdi)\n\tmovq\t%r10, %rdi\n\tleaq\t(%rcx,%rcx), %rsi\n\tcall\trealloc@PLT\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rax, %r10\n\tjmp\t.L69\n.L98:\n\tmovq\t40(%rsp), %rsi\n\tjmp\t.L87\n\t.cfi_endproc\n.LFE43:\n\t.size\tpush, .-push\n\t.p2align 4\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB44:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rdi, %rbx\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t24(%rdi), %r12\n\tmovq\t(%rdi), %rbp\n\tmovq\t%r12, %rax\n\tleaq\t0(%rbp,%r12), %r15\n\tandl\t$7, %eax\n\ttestq\t%rsi, %rsi\n\tje\t.L138\n\tmovq\t%rsi, %rdi\n\tmovq\t%r12, %r13\n\ttestq\t%rax, %rax\n\tjne\t.L139\n\tshrq\t$3, %r13\n\tleaq\t-1(%r13), %r14\n\tje\t.L140\n\tleaq\t0(,%r13,8), %rdx\n\tmovq\t%r15, %rsi\n\tcall\tmemmove@PLT\n.L140:\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%r12, %rsi\n\timulq\t%rcx, %rsi\n\taddq\t%rbp, %rsi\n.L152:\n\ttestq\t%r13, %r13\n\tje\t.L144\n\tleaq\t8(,%r14,8), %rdx\n\tmovq\t%r15, %rdi\n\tcall\tmemmove@PLT\n\tmovq\t8(%rbx), %rcx\n.L144:\n\tleaq\t-1(%rcx), %rax\n\tmovq\t32(%rbx), %r13\n\tmovq\t%rax, 24(%rsp)\n\tmovq\t%rax, 8(%rbx)\n\tcmpq\t$2, %rax\n\tjbe\t.L153\n\tmovl\t$1, %ebx\n\tmovl\t$3, %esi\n\tmovl\t$2, %ecx\n\tjmp\t.L149\n\t.p2align 4,,10\n\t.p2align 3\n.L168:\n\tmovq\t8(%rsp), %rdi\n\tmovq\t%r15, %rsi\n\tmovq\t%r12, %rdx\n\tcall\theap_func_swap\n\tleaq\t(%rbx,%rbx), %rcx\n\tleaq\t1(%rcx), %rsi\n\tcmpq\t%rsi, 24(%rsp)\n\tjb\t.L146\n.L149:\n\tmovq\t%rbx, %rdx\n\timulq\t%r12, %rsi\n\tmovq\t%rcx, 16(%rsp)\n\txorl\t%ebx, %ebx\n\timulq\t%r12, %rdx\n\tmovq\t%r12, %r14\n\taddq\t%rbp, %rsi\n\tleaq\t0(%rbp,%rdx,2), %rdi\n\tmovq\t%rdx, 8(%rsp)\n\tcall\t*%r13\n\tmovq\t16(%rsp), %rcx\n\tmovq\t8(%rsp), %rdx\n\ttestl\t%eax, %eax\n\tsetg\t%bl\n\tleaq\t0(%rbp,%rdx), %rdi\n\taddq\t%rcx, %rbx\n\tmovq\t%rdi, 8(%rsp)\n\timulq\t%rbx, %r14\n\tleaq\t0(%rbp,%r14), %r15\n\tmovq\t%r15, %rsi\n\tcall\t*%r13\n\ttestl\t%eax, %eax\n\tjg\t.L168\n.L137:\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L139:\n\t.cfi_restore_state\n\tandl\t$3, %r13d\n\tjne\t.L169\n\tmovq\t%r12, %rax\n\tshrq\t$2, %rax\n\tje\t.L142\n\tmovq\t%r15, %rsi\n\tleaq\t0(,%rax,4), %rdx\n\tcall\tmemmove@PLT\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%rcx, %rsi\n\timulq\t%r12, %rsi\n\taddq\t%rbp, %rsi\n.L151:\n\tmovq\t%r12, %rdx\n\ttestq\t%r13, %r13\n\tje\t.L145\n\tmovq\t%r15, %rdi\n\tcall\tmemmove@PLT\n\tmovq\t8(%rbx), %rcx\n\tjmp\t.L144\n.L153:\n\tmovq\t%r12, %r14\n\tmovl\t$2, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L146:\n\tcmpq\t%rcx, 24(%rsp)\n\tjb\t.L137\n\tleaq\t0(%rbp,%r14,2), %rbp\n\tmovq\t%r15, %rdi\n\tmovq\t%rbp, %rsi\n\tcall\t*%r13\n\ttestl\t%eax, %eax\n\tjle\t.L137\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovq\t%r12, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r15, %rdi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tjmp\theap_func_swap\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\t.cfi_restore_state\n\tmovq\t8(%rdi), %rcx\n\tmovq\t%r12, %r13\n\tandl\t$3, %r13d\n\tmovq\t%rcx, %rsi\n\timulq\t%r12, %rsi\n\taddq\t%rbp, %rsi\n\ttestq\t%rax, %rax\n\tjne\t.L151\n\tmovq\t%r12, %r13\n\tshrq\t$3, %r13\n\tleaq\t-1(%r13), %r14\n\tjmp\t.L152\n\t.p2align 4,,10\n\t.p2align 3\n.L145:\n\tshrq\t$2, %rdx\n\tje\t.L144\n\tsalq\t$2, %rdx\n\tmovq\t%r15, %rdi\n\tmovq\t%rcx, 8(%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t8(%rsp), %rcx\n\tjmp\t.L144\n\t.p2align 4,,10\n\t.p2align 3\n.L169:\n\tmovq\t%r12, %rdx\n\tmovq\t%r15, %rsi\n\tcall\tmemmove@PLT\n.L142:\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%rcx, %rsi\n\timulq\t%r12, %rsi\n\taddq\t%rbp, %rsi\n\tjmp\t.L151\n\t.cfi_endproc\n.LFE44:\n\t.size\tpop, .-pop\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%i\"\n.LC2:\n\t.string\t\"%li\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB46:\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\tleaq\t.LC1(%rip), %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tmovq\t%r14, %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t16(%rsp), %rbx\n\tmovl\t$4, %esi\n\tleal\t(%rbx,%rbx,2), %ebp\n\tmovslq\t%ebp, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %r13\n\ttestl\t%ebp, %ebp\n\tjle\t.L171\n\tmovq\t%rax, %r12\n\txorl\t%ebp, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L172:\n\tmovq\t%r12, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t16(%rsp), %rbx\n\taddq\t$4, %r12\n\tleal\t(%rbx,%rbx,2), %eax\n\tcmpl\t%ebp, %eax\n\tjg\t.L172\n.L171:\n\tmovl\t$40, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$8, %edi\n\tmovq\t%rax, %rbp\n\tcall\tmalloc@PLT\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovq\t$4, 24(%rbp)\n\tmovq\t%rax, 0(%rbp)\n\tleaq\tcmp(%rip), %rax\n\tmovq\t%rax, 32(%rbp)\n\tmovups\t%xmm0, 8(%rbp)\n\ttestl\t%ebx, %ebx\n\tjle\t.L173\n\txorl\t%r14d, %r14d\n\txorl\t%edx, %edx\n\tleaq\t20(%rsp), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L174:\n\tmovslq\t0(%r13,%r14,4), %rax\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\taddq\t$1, %r14\n\taddq\t%rax, %rdx\n\tmovl\t%eax, 20(%rsp)\n\tmovq\t%rdx, (%rsp)\n\tcall\tpush\n\tmovslq\t16(%rsp), %rbx\n\tmovq\t(%rsp), %rdx\n\tcmpl\t%r14d, %ebx\n\tjg\t.L174\n\tleal\t1(%rbx), %edi\n\tmovl\t$8, %esi\n\tmovslq\t%edi, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t(%rsp), %rdx\n\tmovq\t%rax, %r14\n\tmovq\t%rdx, (%rax)\n\ttestl\t%ebx, %ebx\n\tjle\t.L177\n\tmovl\t$1, %r15d\n\t.p2align 4,,10\n\t.p2align 3\n.L176:\n\tleal\t-1(%rbx,%r15), %eax\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tcltq\n\tmovslq\t0(%r13,%rax,4), %rax\n\tleaq\t(%rax,%rdx), %rbx\n\tmovl\t%eax, 20(%rsp)\n\tcall\tpush\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tcall\tpop\n\tmovslq\t20(%rsp), %rax\n\tmovq\t%rbx, %rdx\n\tmovslq\t16(%rsp), %rbx\n\tsubq\t%rax, %rdx\n\tmovq\t%rdx, (%r14,%r15,8)\n\taddq\t$1, %r15\n\tcmpl\t%r15d, %ebx\n\tjge\t.L176\n\tmovq\t$0, 8(%rbp)\n\ttestl\t%ebx, %ebx\n\tjle\t.L177\n\txorl\t%ecx, %ecx\n\txorl\t%r15d, %r15d\n\t.p2align 4,,10\n\t.p2align 3\n.L178:\n\tleal\t-1(%rbx,%rbx,2), %eax\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tmovl\t%ecx, (%rsp)\n\tsubl\t%ecx, %eax\n\tcltq\n\tmovl\t0(%r13,%rax,4), %edx\n\tnegl\t%edx\n\tmovl\t%edx, 20(%rsp)\n\tmovslq\t%edx, %rdx\n\taddq\t%rdx, %r15\n\tcall\tpush\n\tmovl\t(%rsp), %ecx\n\tmovl\t16(%rsp), %ebx\n\taddl\t$1, %ecx\n\tcmpl\t%ecx, %ebx\n\tjg\t.L178\n\tmovslq\t%ebx, %rax\n\tmovq\t(%r14,%rax,8), %r8\n\taddq\t%r15, %r8\n\ttestl\t%ebx, %ebx\n\tjle\t.L179\n\tmovl\t$1, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L180:\n\taddl\t%ebx, %ebx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tmovq\t%r8, 8(%rsp)\n\tsubl\t%edx, %ebx\n\tmovl\t%edx, (%rsp)\n\tmovslq\t%ebx, %rbx\n\tmovl\t0(%r13,%rbx,4), %eax\n\tnegl\t%eax\n\tmovl\t%eax, 20(%rsp)\n\tcltq\n\taddq\t%rax, %r15\n\tcall\tpush\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tcall\tpop\n\tmovslq\t20(%rsp), %rax\n\tmovl\t16(%rsp), %ebx\n\tmovl\t(%rsp), %edx\n\tmovq\t8(%rsp), %r8\n\tsubq\t%rax, %r15\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tcltq\n\tmovq\t(%r14,%rax,8), %rcx\n\taddq\t%r15, %rcx\n\tcmpq\t%rcx, %r8\n\tcmovl\t%rcx, %r8\n\taddl\t$1, %edx\n\tcmpl\t%edx, %ebx\n\tjge\t.L180\n.L179:\n\txorl\t%eax, %eax\n\tmovq\t%r8, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L189\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L173:\n\t.cfi_restore_state\n\tleal\t1(%rbx), %edi\n\tmovl\t$8, %esi\n\tmovslq\t%edi, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t$0, (%rax)\n\tmovq\t%rax, %r14\n.L177:\n\tmovq\t(%r14,%rbx,8), %r8\n\tjmp\t.L179\n.L189:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE46:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.quad\t0\n\t.quad\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_func_swap, @function\nheap_func_swap:\n.LFB41:\n\t.cfi_startproc\n\tmovq\t%rsi, %rcx\n\tmovq\t%rdi, %rax\n\tmovq\t%rdx, %rsi\n\tandl\t$7, %edx\n\tjne\t.L9\n\tmovq\t%rsi, %r8\n\tshrq\t$3, %r8\n\tje\t.L8\n\tcmpq\t$1, %r8\n\tje\t.L11\n\tmovq\t%rsi, %rdi\n\tandq\t$-16, %rsi\n\tshrq\t$4, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovdqu\t(%rax,%rdx), %xmm0\n\tmovdqu\t(%rcx,%rdx), %xmm1\n\tmovups\t%xmm0, (%rcx,%rdx)\n\tmovups\t%xmm1, (%rax,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%rsi, %rdx\n\tjne\t.L12\n\tleaq\t(%rdi,%rdi), %rsi\n\tsalq\t$4, %rdi\n\taddq\t%rdi, %rax\n\taddq\t%rdi, %rcx\n\tcmpq\t%rsi, %r8\n\tje\t.L8\n.L11:\n\tmovq\t(%rax), %rdx\n\tmovq\t(%rcx), %rsi\n\tmovq\t%rdx, (%rcx)\n\tmovq\t%rsi, (%rax)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L9:\n\tmovq\t%rsi, %rdx\n\tandl\t$3, %edx\n\tje\t.L16\n\tleaq\t-1(%rsi), %r9\n\tcmpq\t$14, %r9\n\tjbe\t.L29\n\tleaq\t-16(%rsi), %rdx\n\txorl\t%r8d, %r8d\n\tshrq\t$4, %rdx\n\tleaq\t1(%rdx), %rdi\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L18:\n\tmovdqu\t(%rax,%rdx), %xmm0\n\tmovdqu\t(%rcx,%rdx), %xmm2\n\taddq\t$1, %r8\n\tmovups\t%xmm2, (%rax,%rdx)\n\tmovups\t%xmm0, (%rcx,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%r8, %rdi\n\tja\t.L18\n\tsalq\t$4, %rdi\n\tmovq\t%rdi, %rdx\n\tleaq\t(%rax,%rdi), %r8\n\tleaq\t(%rcx,%rdi), %rdi\n\tsubq\t%rdx, %r9\n\tcmpq\t%rdx, %rsi\n\tje\t.L62\n.L17:\n\tsubq\t%rdx, %rsi\n\tleaq\t-1(%rsi), %r10\n\tcmpq\t$6, %r10\n\tjbe\t.L26\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rdx\n\tmovq\t(%rdx), %r10\n\tmovq\t(%rax), %rcx\n\tmovq\t%r10, (%rax)\n\tmovq\t%rsi, %rax\n\tandq\t$-8, %rax\n\tmovq\t%rcx, (%rdx)\n\taddq\t%rax, %r8\n\taddq\t%rax, %rdi\n\tsubq\t%rax, %r9\n\tcmpq\t%rax, %rsi\n\tje\t.L8\n.L26:\n\tmovzbl\t(%r8), %eax\n\tmovzbl\t(%rdi), %edx\n\tmovb\t%al, (%rdi)\n\tmovb\t%dl, (%r8)\n\ttestq\t%r9, %r9\n\tjne\t.L63\n.L8:\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovq\t%rsi, %rdi\n\tshrq\t$2, %rdi\n\tleaq\t-1(%rdi), %r8\n\tje\t.L8\n\tcmpq\t$2, %r8\n\tjbe\t.L30\n\tmovq\t%rsi, %r8\n\tandq\t$-16, %rsi\n\tshrq\t$4, %r8\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\tmovdqu\t(%rax,%rdx), %xmm0\n\tmovdqu\t(%rcx,%rdx), %xmm3\n\tmovups\t%xmm0, (%rcx,%rdx)\n\tmovups\t%xmm3, (%rax,%rdx)\n\taddq\t$16, %rdx\n\tcmpq\t%rdx, %rsi\n\tjne\t.L20\n\tmovq\t%r8, %rsi\n\tleaq\t0(,%r8,4), %rdx\n\tsalq\t$4, %rsi\n\tleaq\t(%rax,%rsi), %r8\n\taddq\t%rcx, %rsi\n\tcmpq\t%rdx, %rdi\n\tje\t.L64\n.L19:\n\tsubq\t%rdx, %rdi\n\tcmpq\t$1, %rdi\n\tje\t.L23\n\tsalq\t$2, %rdx\n\taddq\t%rdx, %rax\n\taddq\t%rcx, %rdx\n\tmovq\t(%rdx), %r9\n\tmovq\t(%rax), %rcx\n\tmovq\t%r9, (%rax)\n\tmovq\t%rdi, %rax\n\tandq\t$-2, %rax\n\tmovq\t%rcx, (%rdx)\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rdx, %r8\n\taddq\t%rdx, %rsi\n\tcmpq\t%rax, %rdi\n\tje\t.L8\n.L23:\n\tmovl\t(%r8), %eax\n\tmovl\t(%rsi), %edx\n\tmovl\t%eax, (%rsi)\n\tmovl\t%edx, (%r8)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L63:\n\tmovzbl\t1(%r8), %eax\n\tmovzbl\t1(%rdi), %edx\n\tmovb\t%al, 1(%rdi)\n\tmovb\t%dl, 1(%r8)\n\tcmpq\t$1, %r9\n\tje\t.L8\n\tmovzbl\t2(%r8), %eax\n\tmovzbl\t2(%rdi), %edx\n\tmovb\t%al, 2(%rdi)\n\tmovb\t%dl, 2(%r8)\n\tcmpq\t$2, %r9\n\tje\t.L8\n\tmovzbl\t3(%r8), %eax\n\tmovzbl\t3(%rdi), %edx\n\tmovb\t%al, 3(%rdi)\n\tmovb\t%dl, 3(%r8)\n\tcmpq\t$3, %r9\n\tje\t.L8\n\tmovzbl\t4(%r8), %eax\n\tmovzbl\t4(%rdi), %edx\n\tmovb\t%al, 4(%rdi)\n\tmovb\t%dl, 4(%r8)\n\tcmpq\t$4, %r9\n\tje\t.L8\n\tmovzbl\t5(%r8), %eax\n\tmovzbl\t5(%rdi), %edx\n\tmovb\t%al, 5(%rdi)\n\tmovb\t%dl, 5(%r8)\n\tcmpq\t$5, %r9\n\tje\t.L8\n\tmovzbl\t6(%r8), %eax\n\tmovzbl\t6(%rdi), %edx\n\tmovb\t%al, 6(%rdi)\n\tmovb\t%dl, 6(%r8)\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L64:\n\tret\n.L29:\n\tmovq\t%rcx, %rdi\n\tmovq\t%rax, %r8\n\txorl\t%edx, %edx\n\tjmp\t.L17\n.L30:\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %r8\n\tjmp\t.L19\n.L62:\n\tret\n\t.cfi_endproc\n.LFE41:\n\t.size\theap_func_swap, .-heap_func_swap\n\t.p2align 4\n\t.globl\tnew_binary_heap\n\t.type\tnew_binary_heap, @function\nnew_binary_heap:\n.LFB39:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tmovq\t%rsi, %rbp\n\tmovl\t$40, %esi\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tmovq\t%rdi, %rbx\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tleaq\t(%rbx,%rbx), %rdi\n\tmovq\t%rax, %r12\n\tcall\tmalloc@PLT\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovq\t%rbx, 24(%r12)\n\tmovq\t%rax, (%r12)\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tmovq\t%r12, %rax\n\tmovq\t%rbp, 32(%r12)\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tmovups\t%xmm0, 8(%r12)\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE39:\n\t.size\tnew_binary_heap, .-new_binary_heap\n\t.p2align 4\n\t.globl\tinit_heap\n\t.type\tinit_heap, @function\ninit_heap:\n.LFB40:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t$0, 8(%rdi)\n\tret\n\t.cfi_endproc\n.LFE40:\n\t.size\tinit_heap, .-init_heap\n\t.p2align 4\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB43:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tmovq\t%rsi, %rbp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rdi, %rbx\n\tsubq\t$120, %rsp\n\t.cfi_def_cfa_offset 176\n\tmovq\t8(%rdi), %rcx\n\tmovq\t(%rdi), %r10\n\tcmpq\t16(%rdi), %rcx\n\tje\t.L135\n.L69:\n\tmovq\t24(%rbx), %r14\n\tleaq\t1(%rcx), %r13\n\tmovq\t32(%rbx), %rax\n\tmovq\t%r13, %rdi\n\tmovq\t%r13, 8(%rbx)\n\timulq\t%r14, %rdi\n\tmovq\t%rax, 24(%rsp)\n\tmovq\t%r14, %rax\n\taddq\t%r10, %rdi\n\tandl\t$7, %eax\n\tmovq\t%rax, 32(%rsp)\n\tjne\t.L70\n\tmovq\t%r14, %rax\n\tshrq\t$3, %rax\n\tje\t.L74\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t(%rsp), %r10\n.L74:\n\tcmpq\t$1, %r13\n\tjbe\t.L68\n\tmovq\t%r14, %rax\n\tleaq\t-1(%r14), %rdx\n\tmovq\t%r14, %r15\n\tandl\t$3, %eax\n\tmovq\t%rdx, 64(%rsp)\n\tandq\t$-16, %r15\n\tmovq\t%rax, 48(%rsp)\n\tmovq\t%r14, %rax\n\tmovq\t%r15, %r8\n\tmovq\t%r14, %r15\n\tshrq\t$2, %rax\n\tmovq\t%rax, 40(%rsp)\n\tsubq\t$1, %rax\n\tmovq\t%rax, 72(%rsp)\n\tmovq\t%r14, %rax\n\tshrq\t$3, %rax\n\tmovq\t%rax, 16(%rsp)\n\tleaq\t-16(%r14), %rax\n\tshrq\t$4, %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, 80(%rsp)\n\tsalq\t$4, %rax\n\tsubq\t%rax, %rdx\n\tmovq\t%rax, 88(%rsp)\n\tmovq\t%r14, %rax\n\tmovq\t%r10, %r14\n\tshrq\t$4, %rax\n\tmovq\t%rdx, 96(%rsp)\n\tleaq\t0(,%rax,4), %rdx\n\taddq\t%rax, %rax\n\tmovq\t%rdx, 104(%rsp)\n\tmovq\t%rax, 56(%rsp)\n\t.p2align 4,,10\n\t.p2align 3\n.L78:\n\tmovq\t%r13, %rcx\n\tmovq\t%r15, %r12\n\tshrq\t%r13\n\tmovq\t%r8, 8(%rsp)\n\timulq\t%r15, %rcx\n\tmovq\t24(%rsp), %rax\n\timulq\t%r13, %r12\n\tleaq\t(%r14,%rcx), %rbp\n\tmovq\t%rcx, (%rsp)\n\tleaq\t(%r14,%r12), %rbx\n\tmovq\t%rbp, %rsi\n\tmovq\t%rbx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L68\n\tcmpq\t$0, 32(%rsp)\n\tmovq\t(%rsp), %rcx\n\tmovq\t8(%rsp), %r8\n\tjne\t.L76\n\tcmpq\t$0, 16(%rsp)\n\tje\t.L82\n\tcmpq\t$1, 16(%rsp)\n\tje\t.L79\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L80:\n\tmovdqu\t(%rbx,%rax), %xmm0\n\tmovdqu\t0(%rbp,%rax), %xmm1\n\tmovups\t%xmm0, 0(%rbp,%rax)\n\tmovups\t%xmm1, (%rbx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rax, %r8\n\tjne\t.L80\n\tmovq\t56(%rsp), %rdx\n\taddq\t%r8, %rbx\n\taddq\t%r8, %rbp\n\tcmpq\t%rdx, 16(%rsp)\n\tje\t.L82\n.L79:\n\tmovq\t(%rbx), %rax\n\tmovq\t0(%rbp), %rcx\n\tmovq\t%rax, 0(%rbp)\n\tmovq\t%rcx, (%rbx)\n.L82:\n\tcmpq\t$1, %r13\n\tjne\t.L78\n.L68:\n\taddq\t$120, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L76:\n\t.cfi_restore_state\n\tcmpq\t$0, 48(%rsp)\n\tje\t.L84\n\tcmpq\t$14, 64(%rsp)\n\tjbe\t.L97\n\tmovq\t80(%rsp), %rdx\n\txorl\t%eax, %eax\n\txorl\t%esi, %esi\n\t.p2align 4,,10\n\t.p2align 3\n.L86:\n\tmovdqu\t(%rbx,%rax), %xmm0\n\tmovdqu\t0(%rbp,%rax), %xmm2\n\taddq\t$1, %rsi\n\tmovups\t%xmm2, (%rbx,%rax)\n\tmovups\t%xmm0, 0(%rbp,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rsi, %rdx\n\tja\t.L86\n\tmovq\t88(%rsp), %rax\n\taddq\t%rax, %rbx\n\taddq\t%rax, %rbp\n\tcmpq\t%rax, %r15\n\tje\t.L82\n\tmovq\t96(%rsp), %rsi\n.L85:\n\tmovq\t%r15, %rdi\n\tsubq\t%rax, %rdi\n\tleaq\t-1(%rdi), %r11\n\tcmpq\t$6, %r11\n\tjbe\t.L94\n\taddq\t%rax, %r12\n\taddq\t%rcx, %rax\n\taddq\t%r14, %r12\n\taddq\t%r14, %rax\n\tmovq\t(%r12), %rcx\n\tmovq\t(%rax), %r11\n\tmovq\t%rcx, (%rax)\n\tmovq\t%rdi, %rax\n\tandq\t$-8, %rax\n\tmovq\t%r11, (%r12)\n\taddq\t%rax, %rbx\n\taddq\t%rax, %rbp\n\tsubq\t%rax, %rsi\n\tcmpq\t%rax, %rdi\n\tje\t.L82\n.L94:\n\tmovzbl\t(%rbx), %eax\n\tmovzbl\t0(%rbp), %ecx\n\tmovb\t%al, 0(%rbp)\n\tmovb\t%cl, (%rbx)\n\ttestq\t%rsi, %rsi\n\tje\t.L82\n\tmovzbl\t1(%rbx), %eax\n\tmovzbl\t1(%rbp), %ecx\n\tmovb\t%al, 1(%rbp)\n\tmovb\t%cl, 1(%rbx)\n\tcmpq\t$1, %rsi\n\tje\t.L82\n\tmovzbl\t2(%rbx), %eax\n\tmovzbl\t2(%rbp), %ecx\n\tmovb\t%al, 2(%rbp)\n\tmovb\t%cl, 2(%rbx)\n\tcmpq\t$2, %rsi\n\tje\t.L82\n\tmovzbl\t3(%rbx), %eax\n\tmovzbl\t3(%rbp), %ecx\n\tmovb\t%al, 3(%rbp)\n\tmovb\t%cl, 3(%rbx)\n\tcmpq\t$3, %rsi\n\tje\t.L82\n\tmovzbl\t4(%rbx), %eax\n\tmovzbl\t4(%rbp), %ecx\n\tmovb\t%al, 4(%rbp)\n\tmovb\t%cl, 4(%rbx)\n\tcmpq\t$4, %rsi\n\tje\t.L82\n\tmovzbl\t5(%rbx), %eax\n\tmovzbl\t5(%rbp), %ecx\n\tmovb\t%al, 5(%rbp)\n\tmovb\t%cl, 5(%rbx)\n\tcmpq\t$5, %rsi\n\tje\t.L82\n\tmovzbl\t6(%rbx), %eax\n\tmovzbl\t6(%rbp), %ecx\n\tmovb\t%al, 6(%rbp)\n\tmovb\t%cl, 6(%rbx)\n\tjmp\t.L82\n\t.p2align 4,,10\n\t.p2align 3\n.L84:\n\tcmpq\t$0, 40(%rsp)\n\tje\t.L82\n\txorl\t%eax, %eax\n\tcmpq\t$2, 72(%rsp)\n\tjbe\t.L98\n\t.p2align 4,,10\n\t.p2align 3\n.L88:\n\tmovdqu\t(%rbx,%rax), %xmm0\n\tmovdqu\t0(%rbp,%rax), %xmm3\n\tmovups\t%xmm0, 0(%rbp,%rax)\n\tmovups\t%xmm3, (%rbx,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%r8, %rax\n\tjne\t.L88\n\tmovq\t40(%rsp), %rdx\n\tmovq\t104(%rsp), %rax\n\taddq\t%r8, %rbx\n\taddq\t%r8, %rbp\n\tmovq\t%rdx, %rsi\n\tcmpq\t%rdx, %rax\n\tje\t.L82\n.L87:\n\tsubq\t%rax, %rsi\n\tcmpq\t$1, %rsi\n\tje\t.L91\n\tsalq\t$2, %rax\n\taddq\t%rax, %r12\n\taddq\t%rcx, %rax\n\taddq\t%r14, %r12\n\taddq\t%r14, %rax\n\tmovq\t(%r12), %rcx\n\tmovq\t(%rax), %rdi\n\tmovq\t%rcx, (%rax)\n\tmovq\t%rsi, %rax\n\tandq\t$-2, %rax\n\tmovq\t%rdi, (%r12)\n\tleaq\t0(,%rax,4), %rcx\n\taddq\t%rcx, %rbx\n\taddq\t%rcx, %rbp\n\tcmpq\t%rax, %rsi\n\tje\t.L82\n.L91:\n\tmovl\t(%rbx), %eax\n\tmovl\t0(%rbp), %ecx\n\tmovl\t%eax, 0(%rbp)\n\tmovl\t%ecx, (%rbx)\n\tjmp\t.L82\n\t.p2align 4,,10\n\t.p2align 3\n.L70:\n\ttestb\t$3, %r14b\n\tjne\t.L136\n\tmovq\t%r14, %rax\n\tshrq\t$2, %rax\n\tje\t.L74\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t(%rsp), %r10\n\tjmp\t.L74\n.L136:\n\tmovq\t%r14, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r10, (%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t(%rsp), %r10\n\tjmp\t.L74\n.L97:\n\tmovq\t64(%rsp), %rsi\n\txorl\t%eax, %eax\n\tjmp\t.L85\n.L135:\n\tleaq\t1(%rcx,%rcx), %rax\n\taddq\t$1, %rcx\n\timulq\t24(%rdi), %rcx\n\tmovq\t%rax, 16(%rdi)\n\tmovq\t%r10, %rdi\n\tleaq\t(%rcx,%rcx), %rsi\n\tcall\trealloc@PLT\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%rax, (%rbx)\n\tmovq\t%rax, %r10\n\tjmp\t.L69\n.L98:\n\tmovq\t40(%rsp), %rsi\n\tjmp\t.L87\n\t.cfi_endproc\n.LFE43:\n\t.size\tpush, .-push\n\t.p2align 4\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB44:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovq\t%rdi, %rbx\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t24(%rdi), %r12\n\tmovq\t(%rdi), %rbp\n\tmovq\t%r12, %rax\n\tleaq\t0(%rbp,%r12), %r15\n\tandl\t$7, %eax\n\ttestq\t%rsi, %rsi\n\tje\t.L138\n\tmovq\t%rsi, %rdi\n\tmovq\t%r12, %r13\n\ttestq\t%rax, %rax\n\tjne\t.L139\n\tshrq\t$3, %r13\n\tleaq\t-1(%r13), %r14\n\tje\t.L140\n\tleaq\t0(,%r13,8), %rdx\n\tmovq\t%r15, %rsi\n\tcall\tmemmove@PLT\n.L140:\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%r12, %rsi\n\timulq\t%rcx, %rsi\n\taddq\t%rbp, %rsi\n.L152:\n\ttestq\t%r13, %r13\n\tje\t.L144\n\tleaq\t8(,%r14,8), %rdx\n\tmovq\t%r15, %rdi\n\tcall\tmemmove@PLT\n\tmovq\t8(%rbx), %rcx\n.L144:\n\tleaq\t-1(%rcx), %rax\n\tmovq\t32(%rbx), %r13\n\tmovq\t%rax, 24(%rsp)\n\tmovq\t%rax, 8(%rbx)\n\tcmpq\t$2, %rax\n\tjbe\t.L153\n\tmovl\t$1, %ebx\n\tmovl\t$3, %esi\n\tmovl\t$2, %ecx\n\tjmp\t.L149\n\t.p2align 4,,10\n\t.p2align 3\n.L168:\n\tmovq\t8(%rsp), %rdi\n\tmovq\t%r15, %rsi\n\tmovq\t%r12, %rdx\n\tcall\theap_func_swap\n\tleaq\t(%rbx,%rbx), %rcx\n\tleaq\t1(%rcx), %rsi\n\tcmpq\t%rsi, 24(%rsp)\n\tjb\t.L146\n.L149:\n\tmovq\t%rbx, %rdx\n\timulq\t%r12, %rsi\n\tmovq\t%rcx, 16(%rsp)\n\txorl\t%ebx, %ebx\n\timulq\t%r12, %rdx\n\tmovq\t%r12, %r14\n\taddq\t%rbp, %rsi\n\tleaq\t0(%rbp,%rdx,2), %rdi\n\tmovq\t%rdx, 8(%rsp)\n\tcall\t*%r13\n\tmovq\t16(%rsp), %rcx\n\tmovq\t8(%rsp), %rdx\n\ttestl\t%eax, %eax\n\tsetg\t%bl\n\tleaq\t0(%rbp,%rdx), %rdi\n\taddq\t%rcx, %rbx\n\tmovq\t%rdi, 8(%rsp)\n\timulq\t%rbx, %r14\n\tleaq\t0(%rbp,%r14), %r15\n\tmovq\t%r15, %rsi\n\tcall\t*%r13\n\ttestl\t%eax, %eax\n\tjg\t.L168\n.L137:\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L139:\n\t.cfi_restore_state\n\tandl\t$3, %r13d\n\tjne\t.L169\n\tmovq\t%r12, %rax\n\tshrq\t$2, %rax\n\tje\t.L142\n\tmovq\t%r15, %rsi\n\tleaq\t0(,%rax,4), %rdx\n\tcall\tmemmove@PLT\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%rcx, %rsi\n\timulq\t%r12, %rsi\n\taddq\t%rbp, %rsi\n.L151:\n\tmovq\t%r12, %rdx\n\ttestq\t%r13, %r13\n\tje\t.L145\n\tmovq\t%r15, %rdi\n\tcall\tmemmove@PLT\n\tmovq\t8(%rbx), %rcx\n\tjmp\t.L144\n.L153:\n\tmovq\t%r12, %r14\n\tmovl\t$2, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L146:\n\tcmpq\t%rcx, 24(%rsp)\n\tjb\t.L137\n\tleaq\t0(%rbp,%r14,2), %rbp\n\tmovq\t%r15, %rdi\n\tmovq\t%rbp, %rsi\n\tcall\t*%r13\n\ttestl\t%eax, %eax\n\tjle\t.L137\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovq\t%r12, %rdx\n\tmovq\t%rbp, %rsi\n\tmovq\t%r15, %rdi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tjmp\theap_func_swap\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\t.cfi_restore_state\n\tmovq\t8(%rdi), %rcx\n\tmovq\t%r12, %r13\n\tandl\t$3, %r13d\n\tmovq\t%rcx, %rsi\n\timulq\t%r12, %rsi\n\taddq\t%rbp, %rsi\n\ttestq\t%rax, %rax\n\tjne\t.L151\n\tmovq\t%r12, %r13\n\tshrq\t$3, %r13\n\tleaq\t-1(%r13), %r14\n\tjmp\t.L152\n\t.p2align 4,,10\n\t.p2align 3\n.L145:\n\tshrq\t$2, %rdx\n\tje\t.L144\n\tsalq\t$2, %rdx\n\tmovq\t%r15, %rdi\n\tmovq\t%rcx, 8(%rsp)\n\tcall\tmemmove@PLT\n\tmovq\t8(%rsp), %rcx\n\tjmp\t.L144\n\t.p2align 4,,10\n\t.p2align 3\n.L169:\n\tmovq\t%r12, %rdx\n\tmovq\t%r15, %rsi\n\tcall\tmemmove@PLT\n.L142:\n\tmovq\t8(%rbx), %rcx\n\tmovq\t%rcx, %rsi\n\timulq\t%r12, %rsi\n\taddq\t%rbp, %rsi\n\tjmp\t.L151\n\t.cfi_endproc\n.LFE44:\n\t.size\tpop, .-pop\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC1:\n\t.string\t\"%i\"\n.LC2:\n\t.string\t\"%li\\n\"\n\t.text\n\t.p2align 4\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB46:\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\tleaq\t.LC1(%rip), %r14\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tmovq\t%r14, %rdi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t16(%rsp), %rbx\n\tmovl\t$4, %esi\n\tleal\t(%rbx,%rbx,2), %ebp\n\tmovslq\t%ebp, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, %r13\n\ttestl\t%ebp, %ebp\n\tjle\t.L171\n\tmovq\t%rax, %r12\n\txorl\t%ebp, %ebp\n\t.p2align 4,,10\n\t.p2align 3\n.L172:\n\tmovq\t%r12, %rsi\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebp\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t16(%rsp), %rbx\n\taddq\t$4, %r12\n\tleal\t(%rbx,%rbx,2), %eax\n\tcmpl\t%ebp, %eax\n\tjg\t.L172\n.L171:\n\tmovl\t$40, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovl\t$8, %edi\n\tmovq\t%rax, %rbp\n\tcall\tmalloc@PLT\n\tmovdqa\t.LC0(%rip), %xmm0\n\tmovq\t$4, 24(%rbp)\n\tmovq\t%rax, 0(%rbp)\n\tleaq\tcmp(%rip), %rax\n\tmovq\t%rax, 32(%rbp)\n\tmovups\t%xmm0, 8(%rbp)\n\ttestl\t%ebx, %ebx\n\tjle\t.L173\n\txorl\t%r14d, %r14d\n\txorl\t%edx, %edx\n\tleaq\t20(%rsp), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L174:\n\tmovslq\t0(%r13,%r14,4), %rax\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\taddq\t$1, %r14\n\taddq\t%rax, %rdx\n\tmovl\t%eax, 20(%rsp)\n\tmovq\t%rdx, (%rsp)\n\tcall\tpush\n\tmovslq\t16(%rsp), %rbx\n\tmovq\t(%rsp), %rdx\n\tcmpl\t%r14d, %ebx\n\tjg\t.L174\n\tleal\t1(%rbx), %edi\n\tmovl\t$8, %esi\n\tmovslq\t%edi, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t(%rsp), %rdx\n\tmovq\t%rax, %r14\n\tmovq\t%rdx, (%rax)\n\ttestl\t%ebx, %ebx\n\tjle\t.L177\n\tmovl\t$1, %r15d\n\t.p2align 4,,10\n\t.p2align 3\n.L176:\n\tleal\t-1(%rbx,%r15), %eax\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tcltq\n\tmovslq\t0(%r13,%rax,4), %rax\n\tleaq\t(%rax,%rdx), %rbx\n\tmovl\t%eax, 20(%rsp)\n\tcall\tpush\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tcall\tpop\n\tmovslq\t20(%rsp), %rax\n\tmovq\t%rbx, %rdx\n\tmovslq\t16(%rsp), %rbx\n\tsubq\t%rax, %rdx\n\tmovq\t%rdx, (%r14,%r15,8)\n\taddq\t$1, %r15\n\tcmpl\t%r15d, %ebx\n\tjge\t.L176\n\tmovq\t$0, 8(%rbp)\n\ttestl\t%ebx, %ebx\n\tjle\t.L177\n\txorl\t%ecx, %ecx\n\txorl\t%r15d, %r15d\n\t.p2align 4,,10\n\t.p2align 3\n.L178:\n\tleal\t-1(%rbx,%rbx,2), %eax\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tmovl\t%ecx, (%rsp)\n\tsubl\t%ecx, %eax\n\tcltq\n\tmovl\t0(%r13,%rax,4), %edx\n\tnegl\t%edx\n\tmovl\t%edx, 20(%rsp)\n\tmovslq\t%edx, %rdx\n\taddq\t%rdx, %r15\n\tcall\tpush\n\tmovl\t(%rsp), %ecx\n\tmovl\t16(%rsp), %ebx\n\taddl\t$1, %ecx\n\tcmpl\t%ecx, %ebx\n\tjg\t.L178\n\tmovslq\t%ebx, %rax\n\tmovq\t(%r14,%rax,8), %r8\n\taddq\t%r15, %r8\n\ttestl\t%ebx, %ebx\n\tjle\t.L179\n\tmovl\t$1, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L180:\n\taddl\t%ebx, %ebx\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tmovq\t%r8, 8(%rsp)\n\tsubl\t%edx, %ebx\n\tmovl\t%edx, (%rsp)\n\tmovslq\t%ebx, %rbx\n\tmovl\t0(%r13,%rbx,4), %eax\n\tnegl\t%eax\n\tmovl\t%eax, 20(%rsp)\n\tcltq\n\taddq\t%rax, %r15\n\tcall\tpush\n\tmovq\t%r12, %rsi\n\tmovq\t%rbp, %rdi\n\tcall\tpop\n\tmovslq\t20(%rsp), %rax\n\tmovl\t16(%rsp), %ebx\n\tmovl\t(%rsp), %edx\n\tmovq\t8(%rsp), %r8\n\tsubq\t%rax, %r15\n\tmovl\t%ebx, %eax\n\tsubl\t%edx, %eax\n\tcltq\n\tmovq\t(%r14,%rax,8), %rcx\n\taddq\t%r15, %rcx\n\tcmpq\t%rcx, %r8\n\tcmovl\t%rcx, %r8\n\taddl\t$1, %edx\n\tcmpl\t%edx, %ebx\n\tjge\t.L180\n.L179:\n\txorl\t%eax, %eax\n\tmovq\t%r8, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L189\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L173:\n\t.cfi_restore_state\n\tleal\t1(%rbx), %edi\n\tmovl\t$8, %esi\n\tmovslq\t%edi, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t$0, (%rax)\n\tmovq\t%rax, %r14\n.L177:\n\tmovq\t(%r14,%rbx,8), %r8\n\tjmp\t.L179\n.L189:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE46:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB47:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE47:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC0:\n\t.quad\t0\n\t.quad\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 size_t val_size;\n int (*cmp) (const void *, const void *);\n} heap;\n\nheap* new_binary_heap (const size_t val_size, int (*cmpF) (const void *, const void *)) {\n heap *h = (heap *) calloc (1, sizeof (heap));\n h->array = malloc (val_size * (1 + 1));\n h->heap_size = 0;\n h->max_size = 1;\n h->val_size = val_size;\n h->cmp = cmpF;\n return h;\n}\n\nvoid init_heap (heap *h) {\n h->heap_size = 0;\n}\n\nstatic void heap_func_swap (void * restrict a, void * restrict b, size_t val_size) {\n if ((val_size & 7) == 0) {\n uint64_t *p = (uint64_t *) a;\n uint64_t *q = (uint64_t *) b;\n val_size /= sizeof (uint64_t);\n while (val_size--) {\n uint64_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n } else if ((val_size & 3) == 0) {\n uint32_t *p = (uint32_t *) a;\n uint32_t *q = (uint32_t *) b;\n val_size /= sizeof (uint32_t);\n while (val_size--) {\n uint32_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n } else {\n uint8_t *p = (uint8_t *) a;\n uint8_t *q = (uint8_t *) b;\n while (val_size--) {\n uint8_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n }\n}\n\nstatic void heap_func_copy (void * restrict dst, const void * restrict src, size_t val_size) {\n if ((val_size & 7) == 0) {\n uint64_t *p = (uint64_t *) src;\n uint64_t *q = (uint64_t *) dst;\n val_size /= sizeof (uint64_t);\n while (val_size--) {\n *q++ = *p++;\n }\n } else if ((val_size & 3) == 0) {\n uint32_t *p = (uint32_t *) src;\n uint32_t *q = (uint32_t *) dst;\n val_size /= sizeof (uint32_t);\n while (val_size--) {\n *q++ = *p++;\n }\n } else {\n uint8_t *p = (uint8_t *) src;\n uint8_t *q = (uint8_t *) dst;\n while (val_size--) {\n *q++ = *p++;\n }\n }\n}\n\nvoid push (heap *h, const void *val) {\n if (h->heap_size == h->max_size) {\n h->max_size = 2 * h->max_size + 1;\n h->array = realloc (h->array, h->val_size * (h->max_size + 1));\n }\n h->heap_size++;\n uint8_t *array = (uint8_t *) h->array;\n size_t k = h->heap_size;\n const size_t val_size = h->val_size;\n int (*cmp) (const void *, const void *) = h->cmp;\n heap_func_copy(array + k * val_size, val, val_size);\n while(k>1){\n size_t parent = k / 2;\n if (cmp (array + parent * val_size, array + k * val_size) <= 0) {\n return;\n }\n heap_func_swap (array + parent * val_size, array + k * val_size, val_size);\n k = parent;\n }\n}\n\nvoid pop (heap *h, void *res) {\n uint8_t *array = (uint8_t *) h->array;\n const size_t val_size = h->val_size;\n if (res != NULL) {\n heap_func_copy (res, array + val_size, val_size);\n }\n heap_func_copy (array + val_size, array + val_size * h->heap_size, val_size);\n h->heap_size--;\n int (* const cmp) (const void *, const void *) = h->cmp;\n const size_t n = h->heap_size;\n size_t k = 1;\n while (2 * k + 1 <= n) {\n int c = cmp (array + val_size * 2 * k, array + val_size * (2 * k + 1));\n size_t next = 2 * k + (c <= 0 ? 0 : 1);\n if (cmp (array + val_size * k, array + val_size * next) <= 0) return;\n heap_func_swap (array + val_size * k, array + val_size * next, val_size);\n k = next;\n }\n if (2 * k <= n && cmp (array + val_size * k, array + val_size * 2 * k) > 0) {\n heap_func_swap (array + val_size * k, array + val_size * 2 * k, val_size);\n }\n}\n\ntypedef int32_t i32;\ntypedef int64_t i64;\n\nint cmp (const void *a, const void *b) {\n i32 d = *(i32 *)a - *(i32 *)b;\n return d == 0 ? 0 : d < 0 ? -1 : 1;\n}\n\nvoid run (void) {\n i32 n;\n scanf (\"%\" SCNi32, &n);\n i32 *a = (i32 *) calloc (3 * n, sizeof (i32));\n for (i32 i = 0; i < 3 * n; ++i) {\n scanf (\"%\" SCNi32, a + i);\n }\n i64 sum = 0;\n heap *h = new_binary_heap (sizeof (i32), cmp);\n for (i32 i = 0; i < n; ++i) {\n i32 v = a[i];\n sum += v;\n push (h, &v);\n }\n i64 *front = (i64 *) calloc (n + 1, sizeof (i64));\n front[0] = sum;\n for (i32 i = 1; i <= n; ++i) {\n i32 v = a[n - 1 + i];\n sum += v;\n push (h, &v);\n pop (h, &v);\n sum -= v;\n front[i] = sum;\n }\n init_heap (h);\n sum = 0;\n for (i32 i = 0; i < n; ++i) {\n i32 v = -a[3 * n - 1 - i];\n sum += v;\n push (h, &v);\n }\n i64 max = front[n] + sum;\n for (i32 i = 1; i <= n; ++i) {\n i32 v = -a[2 * n - i];\n sum += v;\n push (h, &v);\n pop (h, &v);\n sum -= v;\n i64 d = front[n - i] + sum;\n if (d > max) max = d;\n }\n printf (\"%\" PRIi64 \"\\n\", max);\n}\n\nint main (void) {\n run ();\n return 0;\n}\n", "index": 113, "inputs": [ "2\n3 1 4 1 5 9\n" ], "outputs": [ "1\n" ], "question": "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 size_t val_size;\n int (*cmp) (const void *, const void *);\n} heap;\n\nheap* new_binary_heap (const size_t val_size, int (*cmpF) (const void *, const void *)) {\n heap *h = (heap *) calloc (1, sizeof (heap));\n h->array = malloc (val_size * (1 + 1));\n h->heap_size = 0;\n h->max_size = 1;\n h->val_size = val_size;\n h->cmp = cmpF;\n return h;\n}\n\nvoid init_heap (heap *h) {\n h->heap_size = 0;\n}\n\nstatic void heap_func_swap (void * restrict a, void * restrict b, size_t val_size) {\n if ((val_size & 7) == 0) {\n uint64_t *p = (uint64_t *) a;\n uint64_t *q = (uint64_t *) b;\n val_size /= sizeof (uint64_t);\n while (val_size--) {\n uint64_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n } else if ((val_size & 3) == 0) {\n uint32_t *p = (uint32_t *) a;\n uint32_t *q = (uint32_t *) b;\n val_size /= sizeof (uint32_t);\n while (val_size--) {\n uint32_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n } else {\n uint8_t *p = (uint8_t *) a;\n uint8_t *q = (uint8_t *) b;\n while (val_size--) {\n uint8_t tmp = *p;\n *p++ = *q;\n *q++ = tmp;\n }\n }\n}\n\nstatic void heap_func_copy (void * restrict dst, const void * restrict src, size_t val_size) {\n if ((val_size & 7) == 0) {\n uint64_t *p = (uint64_t *) src;\n uint64_t *q = (uint64_t *) dst;\n val_size /= sizeof (uint64_t);\n while (val_size--) {\n *q++ = *p++;\n }\n } else if ((val_size & 3) == 0) {\n uint32_t *p = (uint32_t *) src;\n uint32_t *q = (uint32_t *) dst;\n val_size /= sizeof (uint32_t);\n while (val_size--) {\n *q++ = *p++;\n }\n } else {\n uint8_t *p = (uint8_t *) src;\n uint8_t *q = (uint8_t *) dst;\n while (val_size--) {\n *q++ = *p++;\n }\n }\n}\n\nvoid push (heap *h, const void *val) {\n if (h->heap_size == h->max_size) {\n h->max_size = 2 * h->max_size + 1;\n h->array = realloc (h->array, h->val_size * (h->max_size + 1));\n }\n h->heap_size++;\n uint8_t *array = (uint8_t *) h->array;\n size_t k = h->heap_size;\n const size_t val_size = h->val_size;\n int (*cmp) (const void *, const void *) = h->cmp;\n heap_func_copy(array + k * val_size, val, val_size);\n while(k>1){\n size_t parent = k / 2;\n if (cmp (array + parent * val_size, array + k * val_size) <= 0) {\n return;\n }\n heap_func_swap (array + parent * val_size, array + k * val_size, val_size);\n k = parent;\n }\n}\n\nvoid pop (heap *h, void *res) {\n uint8_t *array = (uint8_t *) h->array;\n const size_t val_size = h->val_size;\n if (res != NULL) {\n heap_func_copy (res, array + val_size, val_size);\n }\n heap_func_copy (array + val_size, array + val_size * h->heap_size, val_size);\n h->heap_size--;\n int (* const cmp) (const void *, const void *) = h->cmp;\n const size_t n = h->heap_size;\n size_t k = 1;\n while (2 * k + 1 <= n) {\n int c = cmp (array + val_size * 2 * k, array + val_size * (2 * k + 1));\n size_t next = 2 * k + (c <= 0 ? 0 : 1);\n if (cmp (array + val_size * k, array + val_size * next) <= 0) return;\n heap_func_swap (array + val_size * k, array + val_size * next, val_size);\n k = next;\n }\n if (2 * k <= n && cmp (array + val_size * k, array + val_size * 2 * k) > 0) {\n heap_func_swap (array + val_size * k, array + val_size * 2 * k, val_size);\n }\n}\n\ntypedef int32_t i32;\ntypedef int64_t i64;\n\nint cmp (const void *a, const void *b) {\n i32 d = *(i32 *)a - *(i32 *)b;\n return d == 0 ? 0 : d < 0 ? -1 : 1;\n}\n\nvoid run (void) {\n i32 n;\n scanf (\"%\" SCNi32, &n);\n i32 *a = (i32 *) calloc (3 * n, sizeof (i32));\n for (i32 i = 0; i < 3 * n; ++i) {\n scanf (\"%\" SCNi32, a + i);\n }\n i64 sum = 0;\n heap *h = new_binary_heap (sizeof (i32), cmp);\n for (i32 i = 0; i < n; ++i) {\n i32 v = a[i];\n sum += v;\n push (h, &v);\n }\n i64 *front = (i64 *) calloc (n + 1, sizeof (i64));\n front[0] = sum;\n for (i32 i = 1; i <= n; ++i) {\n i32 v = a[n - 1 + i];\n sum += v;\n push (h, &v);\n pop (h, &v);\n sum -= v;\n front[i] = sum;\n }\n init_heap (h);\n sum = 0;\n for (i32 i = 0; i < n; ++i) {\n i32 v = -a[3 * n - 1 - i];\n sum += v;\n push (h, &v);\n }\n i64 max = front[n] + sum;\n for (i32 i = 1; i <= n; ++i) {\n i32 v = -a[2 * n - i];\n sum += v;\n push (h, &v);\n pop (h, &v);\n sum -= v;\n i64 d = front[n - i] + sum;\n if (d > max) max = d;\n }\n printf (\"%\" PRIi64 \"\\n\", max);\n}\n\nint main (void) {\n run ();\n return 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tnew_binary_heap\n\t.type\tnew_binary_heap, @function\nnew_binary_heap:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t$40, %esi\n\tmovl\t$1, %edi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rax\n\tmovq\t%rax, %rdi\n\tcall\tmalloc@PLT\n\tmovq\t%rax, %rdx\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rdx, (%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$1, 16(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rdx, 24(%rax)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t%rdx, 32(%rax)\n\tmovq\t-8(%rbp), %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tnew_binary_heap, .-new_binary_heap\n\t.globl\tinit_heap\n\t.type\tinit_heap, @function\ninit_heap:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t$0, 8(%rax)\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tinit_heap, .-init_heap\n\t.type\theap_func_swap, @function\nheap_func_swap:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t%rdx, -88(%rbp)\n\tmovq\t-88(%rbp), %rax\n\tandl\t$7, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L5\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, -56(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-88(%rbp), %rax\n\tshrq\t$3, %rax\n\tmovq\t%rax, -88(%rbp)\n\tjmp\t.L6\n.L7:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tleaq\t8(%rax), %rdx\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t-48(%rbp), %rdx\n\tmovq\t(%rdx), %rdx\n\tmovq\t%rdx, (%rax)\n\tmovq\t-48(%rbp), %rax\n\tleaq\t8(%rax), %rdx\n\tmovq\t%rdx, -48(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rdx, (%rax)\n.L6:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L7\n\tjmp\t.L14\n.L5:\n\tmovq\t-88(%rbp), %rax\n\tandl\t$3, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L9\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-88(%rbp), %rax\n\tshrq\t$2, %rax\n\tmovq\t%rax, -88(%rbp)\n\tjmp\t.L10\n.L11:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -60(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tleaq\t4(%rax), %rdx\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovl\t(%rdx), %edx\n\tmovl\t%edx, (%rax)\n\tmovq\t-32(%rbp), %rax\n\tleaq\t4(%rax), %rdx\n\tmovq\t%rdx, -32(%rbp)\n\tmovl\t-60(%rbp), %edx\n\tmovl\t%edx, (%rax)\n.L10:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L11\n\tjmp\t.L14\n.L9:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -61(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovzbl\t(%rdx), %edx\n\tmovb\t%dl, (%rax)\n\tmovq\t-16(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, -16(%rbp)\n\tmovzbl\t-61(%rbp), %edx\n\tmovb\t%dl, (%rax)\n.L12:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -88(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L13\n.L14:\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\theap_func_swap, .-heap_func_swap\n\t.type\theap_func_copy, @function\nheap_func_copy:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -56(%rbp)\n\tmovq\t%rsi, -64(%rbp)\n\tmovq\t%rdx, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tandl\t$7, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L16\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tshrq\t$3, %rax\n\tmovq\t%rax, -72(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovq\t-48(%rbp), %rdx\n\tleaq\t8(%rdx), %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tleaq\t8(%rax), %rcx\n\tmovq\t%rcx, -40(%rbp)\n\tmovq\t(%rdx), %rdx\n\tmovq\t%rdx, (%rax)\n.L17:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L18\n\tjmp\t.L25\n.L16:\n\tmovq\t-72(%rbp), %rax\n\tandl\t$3, %eax\n\ttestq\t%rax, %rax\n\tjne\t.L20\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tshrq\t$2, %rax\n\tmovq\t%rax, -72(%rbp)\n\tjmp\t.L21\n.L22:\n\tmovq\t-32(%rbp), %rdx\n\tleaq\t4(%rdx), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t4(%rax), %rcx\n\tmovq\t%rcx, -24(%rbp)\n\tmovl\t(%rdx), %edx\n\tmovl\t%edx, (%rax)\n.L21:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L22\n\tjmp\t.L25\n.L20:\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tjmp\t.L23\n.L24:\n\tmovq\t-16(%rbp), %rdx\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, -8(%rbp)\n\tmovzbl\t(%rdx), %edx\n\tmovb\t%dl, (%rax)\n.L23:\n\tmovq\t-72(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -72(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L24\n.L25:\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\theap_func_copy, .-heap_func_copy\n\t.globl\tpush\n\t.type\tpush, @function\npush:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$64, %rsp\n\tmovq\t%rdi, -56(%rbp)\n\tmovq\t%rsi, -64(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjne\t.L27\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\taddq\t%rax, %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 16(%rax)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t24(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t16(%rax), %rax\n\taddq\t$1, %rax\n\timulq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\trealloc@PLT\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n.L27:\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-56(%rbp), %rax\n\tmovq\t32(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-40(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_copy\n\tjmp\t.L28\n.L31:\n\tmovq\t-40(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-40(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L32\n\tmovq\t-40(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_swap\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -40(%rbp)\n.L28:\n\tcmpq\t$1, -40(%rbp)\n\tja\t.L31\n\tjmp\t.L26\n.L32:\n\tnop\n.L26:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tpush, .-push\n\t.globl\tpop\n\t.type\tpop, @function\npop:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovq\t%rdi, -72(%rbp)\n\tmovq\t%rsi, -80(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t24(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tcmpq\t$0, -80(%rbp)\n\tje\t.L34\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-80(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\theap_func_copy\n.L34:\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\timulq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-40(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_copy\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rdx, 8(%rax)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t32(%rax), %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t8(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t$1, -48(%rbp)\n\tjmp\t.L35\n.L38:\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rax, %rax\n\taddq\t$1, %rax\n\timulq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\tmovl\t%eax, -52(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tcmpl\t$0, -52(%rbp)\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcltq\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L39\n\tmovq\t-32(%rbp), %rax\n\timulq\t-8(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_swap\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n.L35:\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rax, %rax\n\taddq\t$1, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjnb\t.L38\n\tmovq\t-48(%rbp), %rax\n\taddq\t%rax, %rax\n\tcmpq\t%rax, -16(%rbp)\n\tjb\t.L33\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\t*%rax\n\ttestl\t%eax, %eax\n\tjle\t.L33\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tleaq\t(%rax,%rax), %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rsi\n\tmovq\t-32(%rbp), %rax\n\timulq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-40(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t%rcx, %rdi\n\tcall\theap_func_swap\n\tjmp\t.L33\n.L39:\n\tnop\n.L33:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tpop, .-pop\n\t.globl\tcmp\n\t.type\tcmp, @function\ncmp:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t(%rax), %edx\n\tmovq\t-32(%rbp), %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$0, -4(%rbp)\n\tje\t.L41\n\tcmpl\t$0, -4(%rbp)\n\tjns\t.L42\n\tmovl\t$-1, %eax\n\tjmp\t.L45\n.L42:\n\tmovl\t$1, %eax\n\tjmp\t.L45\n.L41:\n\tmovl\t$0, %eax\n.L45:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tcmp, .-cmp\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%i\"\n.LC1:\n\t.string\t\"%li\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-84(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-84(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcltq\n\tmovl\t$4, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -40(%rbp)\n\tmovl\t$0, -76(%rbp)\n\tjmp\t.L47\n.L48:\n\tmovl\t-76(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -76(%rbp)\n.L47:\n\tmovl\t-84(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -76(%rbp)\n\tjl\t.L48\n\tmovq\t$0, -56(%rbp)\n\tleaq\tcmp(%rip), %rax\n\tmovq\t%rax, %rsi\n\tmovl\t$4, %edi\n\tcall\tnew_binary_heap\n\tmovq\t%rax, -32(%rbp)\n\tmovl\t$0, -72(%rbp)\n\tjmp\t.L49\n.L50:\n\tmovl\t-72(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\taddl\t$1, -72(%rbp)\n.L49:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -72(%rbp)\n\tjl\t.L50\n\tmovl\t-84(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$8, %esi\n\tmovq\t%rax, %rdi\n\tcall\tcalloc@PLT\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t-56(%rbp), %rdx\n\tmovq\t%rdx, (%rax)\n\tmovl\t$1, -68(%rbp)\n\tjmp\t.L51\n.L52:\n\tmovl\t-84(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-68(%rbp), %eax\n\taddl\t%edx, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpop\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tsubq\t%rax, -56(%rbp)\n\tmovl\t-68(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-56(%rbp), %rax\n\tmovq\t%rax, (%rdx)\n\taddl\t$1, -68(%rbp)\n.L51:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -68(%rbp)\n\tjle\t.L52\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tinit_heap\n\tmovq\t$0, -56(%rbp)\n\tmovl\t$0, -64(%rbp)\n\tjmp\t.L53\n.L54:\n\tmovl\t-84(%rbp), %edx\n\tmovl\t%edx, %eax\n\taddl\t%eax, %eax\n\taddl\t%edx, %eax\n\tsubl\t$1, %eax\n\tsubl\t-64(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tnegl\t%eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\taddl\t$1, -64(%rbp)\n.L53:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -64(%rbp)\n\tjl\t.L54\n\tmovl\t-84(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovl\t$1, -60(%rbp)\n\tjmp\t.L55\n.L57:\n\tmovl\t-84(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tmovq\t-40(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %eax\n\tnegl\t%eax\n\tmovl\t%eax, -80(%rbp)\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\taddq\t%rax, -56(%rbp)\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpush\n\tleaq\t-80(%rbp), %rdx\n\tmovq\t-32(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tpop\n\tmovl\t-80(%rbp), %eax\n\tcltq\n\tsubq\t%rax, -56(%rbp)\n\tmovl\t-84(%rbp), %eax\n\tsubl\t-60(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-24(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-56(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-48(%rbp), %rax\n\tjle\t.L56\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, -48(%rbp)\n.L56:\n\taddl\t$1, -60(%rbp)\n.L55:\n\tmovl\t-84(%rbp), %eax\n\tcmpl\t%eax, -60(%rbp)\n\tjle\t.L57\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L58\n\tcall\t__stack_chk_fail@PLT\n.L58:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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) (const void *, const void *); } heap; heap* new_binary_heap (const size_t val_size, int (*cmpF) (const void *, const void *)) { heap *h = (heap *) calloc (1, sizeof (heap)); h->array = malloc (val_size * (1 + 1)); h->heap_size = 0; h->max_size = 1; h->val_size = val_size; h->cmp = cmpF; return h; } void init_heap (heap *h) { h->heap_size = 0; } static void heap_func_swap (void * restrict a, void * restrict b, size_t val_size) { if ((val_size & 7) == 0) { uint64_t *p = (uint64_t *) a; uint64_t *q = (uint64_t *) b; val_size /= sizeof (uint64_t); while (val_size--) { uint64_t tmp = *p; *p++ = *q; *q++ = tmp; } } else if ((val_size & 3) == 0) { uint32_t *p = (uint32_t *) a; uint32_t *q = (uint32_t *) b; val_size /= sizeof (uint32_t); while (val_size--) { uint32_t tmp = *p; *p++ = *q; *q++ = tmp; } } else { uint8_t *p = (uint8_t *) a; uint8_t *q = (uint8_t *) b; while (val_size--) { uint8_t tmp = *p; *p++ = *q; *q++ = tmp; } } } static void heap_func_copy (void * restrict dst, const void * restrict src, size_t val_size) { if ((val_size & 7) == 0) { uint64_t *p = (uint64_t *) src; uint64_t *q = (uint64_t *) dst; val_size /= sizeof (uint64_t); while (val_size--) { *q++ = *p++; } } else if ((val_size & 3) == 0) { uint32_t *p = (uint32_t *) src; uint32_t *q = (uint32_t *) dst; val_size /= sizeof (uint32_t); while (val_size--) { *q++ = *p++; } } else { uint8_t *p = (uint8_t *) src; uint8_t *q = (uint8_t *) dst; while (val_size--) { *q++ = *p++; } } } void push (heap *h, const void *val) { if (h->heap_size == h->max_size) { h->max_size = 2 * h->max_size + 1; h->array = realloc (h->array, h->val_size * (h->max_size + 1)); } h->heap_size++; uint8_t *array = (uint8_t *) h->array; size_t k = h->heap_size; const size_t val_size = h->val_size; int (*cmp) (const void *, const void *) = h->cmp; heap_func_copy(array + k * val_size, val, val_size); while(k>1){ size_t parent = k / 2; if (cmp (array + parent * val_size, array + k * val_size) <= 0) { return; } heap_func_swap (array + parent * val_size, array + k * val_size, val_size); k = parent; } } void pop (heap *h, void *res) { uint8_t *array = (uint8_t *) h->array; const size_t val_size = h->val_size; if (res != NULL) { heap_func_copy (res, array + val_size, val_size); } heap_func_copy (array + val_size, array + val_size * h->heap_size, val_size); h->heap_size--; int (* const cmp) (const void *, const void *) = h->cmp; const size_t n = h->heap_size; size_t k = 1; while (2 * k + 1 <= n) { int c = cmp (array + val_size * 2 * k, array + val_size * (2 * k + 1)); size_t next = 2 * k + (c <= 0 ? 0 : 1); if (cmp (array + val_size * k, array + val_size * next) <= 0) return; heap_func_swap (array + val_size * k, array + val_size * next, val_size); k = next; } if (2 * k <= n && cmp (array + val_size * k, array + val_size * 2 * k) > 0) { heap_func_swap (array + val_size * k, array + val_size * 2 * k, val_size); } } typedef int32_t i32; typedef int64_t i64; int cmp (const void *a, const void *b) { i32 d = *(i32 *)a - *(i32 *)b; return d == 0 ? 0 : d < 0 ? -1 : 1; } void run (void) { i32 n; scanf ("%" SCNi32, &n); i32 *a = (i32 *) calloc (3 * n, sizeof (i32)); for (i32 i = 0; i < 3 * n; ++i) { scanf ("%" SCNi32, a + i); } i64 sum = 0; heap *h = new_binary_heap (sizeof (i32), cmp); for (i32 i = 0; i < n; ++i) { i32 v = a[i]; sum += v; push (h, &v); } i64 *front = (i64 *) calloc (n + 1, sizeof (i64)); front[0] = sum; for (i32 i = 1; i <= n; ++i) { i32 v = a[n - 1 + i]; sum += v; push (h, &v); pop (h, &v); sum -= v; front[i] = sum; } init_heap (h); sum = 0; for (i32 i = 0; i < n; ++i) { i32 v = -a[3 * n - 1 - i]; sum += v; push (h, &v); } i64 max = front[n] + sum; for (i32 i = 1; i <= n; ++i) { i32 v = -a[2 * n - i]; sum += v; push (h, &v); pop (h, &v); sum -= v; i64 d = front[n - i] + sum; if (d > max) max = d; } printf ("%" PRIi64 "\n", max); } int main (void) { run (); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl new_binary_heap .type new_binary_heap, @function new_binary_heap: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movl $40, %esi movl $1, %edi call calloc@PLT movq %rax, -8(%rbp) movq -24(%rbp), %rax addq %rax, %rax movq %rax, %rdi call malloc@PLT movq %rax, %rdx movq -8(%rbp), %rax movq %rdx, (%rax) movq -8(%rbp), %rax movq $0, 8(%rax) movq -8(%rbp), %rax movq $1, 16(%rax) movq -8(%rbp), %rax movq -24(%rbp), %rdx movq %rdx, 24(%rax) movq -8(%rbp), %rax movq -32(%rbp), %rdx movq %rdx, 32(%rax) movq -8(%rbp), %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size new_binary_heap, .-new_binary_heap .globl init_heap .type init_heap, @function init_heap: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq -8(%rbp), %rax movq $0, 8(%rax) nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size init_heap, .-init_heap .type heap_func_swap, @function heap_func_swap: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -72(%rbp) movq %rsi, -80(%rbp) movq %rdx, -88(%rbp) movq -88(%rbp), %rax andl $7, %eax testq %rax, %rax jne .L5 movq -72(%rbp), %rax movq %rax, -56(%rbp) movq -80(%rbp), %rax movq %rax, -48(%rbp) movq -88(%rbp), %rax shrq $3, %rax movq %rax, -88(%rbp) jmp .L6 .L7: movq -56(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -56(%rbp), %rax leaq 8(%rax), %rdx movq %rdx, -56(%rbp) movq -48(%rbp), %rdx movq (%rdx), %rdx movq %rdx, (%rax) movq -48(%rbp), %rax leaq 8(%rax), %rdx movq %rdx, -48(%rbp) movq -8(%rbp), %rdx movq %rdx, (%rax) .L6: movq -88(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -88(%rbp) testq %rax, %rax jne .L7 jmp .L14 .L5: movq -88(%rbp), %rax andl $3, %eax testq %rax, %rax jne .L9 movq -72(%rbp), %rax movq %rax, -40(%rbp) movq -80(%rbp), %rax movq %rax, -32(%rbp) movq -88(%rbp), %rax shrq $2, %rax movq %rax, -88(%rbp) jmp .L10 .L11: movq -40(%rbp), %rax movl (%rax), %eax movl %eax, -60(%rbp) movq -40(%rbp), %rax leaq 4(%rax), %rdx movq %rdx, -40(%rbp) movq -32(%rbp), %rdx movl (%rdx), %edx movl %edx, (%rax) movq -32(%rbp), %rax leaq 4(%rax), %rdx movq %rdx, -32(%rbp) movl -60(%rbp), %edx movl %edx, (%rax) .L10: movq -88(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -88(%rbp) testq %rax, %rax jne .L11 jmp .L14 .L9: movq -72(%rbp), %rax movq %rax, -24(%rbp) movq -80(%rbp), %rax movq %rax, -16(%rbp) jmp .L12 .L13: movq -24(%rbp), %rax movzbl (%rax), %eax movb %al, -61(%rbp) movq -24(%rbp), %rax leaq 1(%rax), %rdx movq %rdx, -24(%rbp) movq -16(%rbp), %rdx movzbl (%rdx), %edx movb %dl, (%rax) movq -16(%rbp), %rax leaq 1(%rax), %rdx movq %rdx, -16(%rbp) movzbl -61(%rbp), %edx movb %dl, (%rax) .L12: movq -88(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -88(%rbp) testq %rax, %rax jne .L13 .L14: nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size heap_func_swap, .-heap_func_swap .type heap_func_copy, @function heap_func_copy: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -56(%rbp) movq %rsi, -64(%rbp) movq %rdx, -72(%rbp) movq -72(%rbp), %rax andl $7, %eax testq %rax, %rax jne .L16 movq -64(%rbp), %rax movq %rax, -48(%rbp) movq -56(%rbp), %rax movq %rax, -40(%rbp) movq -72(%rbp), %rax shrq $3, %rax movq %rax, -72(%rbp) jmp .L17 .L18: movq -48(%rbp), %rdx leaq 8(%rdx), %rax movq %rax, -48(%rbp) movq -40(%rbp), %rax leaq 8(%rax), %rcx movq %rcx, -40(%rbp) movq (%rdx), %rdx movq %rdx, (%rax) .L17: movq -72(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -72(%rbp) testq %rax, %rax jne .L18 jmp .L25 .L16: movq -72(%rbp), %rax andl $3, %eax testq %rax, %rax jne .L20 movq -64(%rbp), %rax movq %rax, -32(%rbp) movq -56(%rbp), %rax movq %rax, -24(%rbp) movq -72(%rbp), %rax shrq $2, %rax movq %rax, -72(%rbp) jmp .L21 .L22: movq -32(%rbp), %rdx leaq 4(%rdx), %rax movq %rax, -32(%rbp) movq -24(%rbp), %rax leaq 4(%rax), %rcx movq %rcx, -24(%rbp) movl (%rdx), %edx movl %edx, (%rax) .L21: movq -72(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -72(%rbp) testq %rax, %rax jne .L22 jmp .L25 .L20: movq -64(%rbp), %rax movq %rax, -16(%rbp) movq -56(%rbp), %rax movq %rax, -8(%rbp) jmp .L23 .L24: movq -16(%rbp), %rdx leaq 1(%rdx), %rax movq %rax, -16(%rbp) movq -8(%rbp), %rax leaq 1(%rax), %rcx movq %rcx, -8(%rbp) movzbl (%rdx), %edx movb %dl, (%rax) .L23: movq -72(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -72(%rbp) testq %rax, %rax jne .L24 .L25: nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size heap_func_copy, .-heap_func_copy .globl push .type push, @function push: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $64, %rsp movq %rdi, -56(%rbp) movq %rsi, -64(%rbp) movq -56(%rbp), %rax movq 8(%rax), %rdx movq -56(%rbp), %rax movq 16(%rax), %rax cmpq %rax, %rdx jne .L27 movq -56(%rbp), %rax movq 16(%rax), %rax addq %rax, %rax leaq 1(%rax), %rdx movq -56(%rbp), %rax movq %rdx, 16(%rax) movq -56(%rbp), %rax movq 24(%rax), %rdx movq -56(%rbp), %rax movq 16(%rax), %rax addq $1, %rax imulq %rax, %rdx movq -56(%rbp), %rax movq (%rax), %rax movq %rdx, %rsi movq %rax, %rdi call realloc@PLT movq -56(%rbp), %rdx movq %rax, (%rdx) .L27: movq -56(%rbp), %rax movq 8(%rax), %rax leaq 1(%rax), %rdx movq -56(%rbp), %rax movq %rdx, 8(%rax) movq -56(%rbp), %rax movq (%rax), %rax movq %rax, -32(%rbp) movq -56(%rbp), %rax movq 8(%rax), %rax movq %rax, -40(%rbp) movq -56(%rbp), %rax movq 24(%rax), %rax movq %rax, -24(%rbp) movq -56(%rbp), %rax movq 32(%rax), %rax movq %rax, -16(%rbp) movq -40(%rbp), %rax imulq -24(%rbp), %rax movq %rax, %rdx movq -32(%rbp), %rax leaq (%rdx,%rax), %rcx movq -24(%rbp), %rdx movq -64(%rbp), %rax movq %rax, %rsi movq %rcx, %rdi call heap_func_copy jmp .L28 .L31: movq -40(%rbp), %rax shrq %rax movq %rax, -8(%rbp) movq -40(%rbp), %rax imulq -24(%rbp), %rax movq %rax, %rdx movq -32(%rbp), %rax leaq (%rdx,%rax), %rcx movq -8(%rbp), %rax imulq -24(%rbp), %rax movq %rax, %rdx movq -32(%rbp), %rax addq %rax, %rdx movq -16(%rbp), %rax movq %rcx, %rsi movq %rdx, %rdi call *%rax testl %eax, %eax jle .L32 movq -40(%rbp), %rax imulq -24(%rbp), %rax movq %rax, %rdx movq -32(%rbp), %rax leaq (%rdx,%rax), %rsi movq -8(%rbp), %rax imulq -24(%rbp), %rax movq %rax, %rdx movq -32(%rbp), %rax leaq (%rdx,%rax), %rcx movq -24(%rbp), %rax movq %rax, %rdx movq %rcx, %rdi call heap_func_swap movq -8(%rbp), %rax movq %rax, -40(%rbp) .L28: cmpq $1, -40(%rbp) ja .L31 jmp .L26 .L32: nop .L26: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size push, .-push .globl pop .type pop, @function pop: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $80, %rsp movq %rdi, -72(%rbp) movq %rsi, -80(%rbp) movq -72(%rbp), %rax movq (%rax), %rax movq %rax, -40(%rbp) movq -72(%rbp), %rax movq 24(%rax), %rax movq %rax, -32(%rbp) cmpq $0, -80(%rbp) je .L34 movq -40(%rbp), %rdx movq -32(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rdx movq -80(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call heap_func_copy .L34: movq -72(%rbp), %rax movq 8(%rax), %rax imulq -32(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rsi movq -40(%rbp), %rdx movq -32(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rax movq %rax, %rdx movq %rcx, %rdi call heap_func_copy movq -72(%rbp), %rax movq 8(%rax), %rax leaq -1(%rax), %rdx movq -72(%rbp), %rax movq %rdx, 8(%rax) movq -72(%rbp), %rax movq 32(%rax), %rax movq %rax, -24(%rbp) movq -72(%rbp), %rax movq 8(%rax), %rax movq %rax, -16(%rbp) movq $1, -48(%rbp) jmp .L35 .L38: movq -48(%rbp), %rax addq %rax, %rax addq $1, %rax imulq -32(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rax imulq -48(%rbp), %rax leaq (%rax,%rax), %rdx movq -40(%rbp), %rax addq %rax, %rdx movq -24(%rbp), %rax movq %rcx, %rsi movq %rdx, %rdi call *%rax movl %eax, -52(%rbp) movq -48(%rbp), %rax leaq (%rax,%rax), %rdx cmpl $0, -52(%rbp) setg %al movzbl %al, %eax cltq addq %rdx, %rax movq %rax, -8(%rbp) movq -32(%rbp), %rax imulq -8(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rax imulq -48(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax addq %rax, %rdx movq -24(%rbp), %rax movq %rcx, %rsi movq %rdx, %rdi call *%rax testl %eax, %eax jle .L39 movq -32(%rbp), %rax imulq -8(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rsi movq -32(%rbp), %rax imulq -48(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rax movq %rax, %rdx movq %rcx, %rdi call heap_func_swap movq -8(%rbp), %rax movq %rax, -48(%rbp) .L35: movq -48(%rbp), %rax addq %rax, %rax addq $1, %rax cmpq %rax, -16(%rbp) jnb .L38 movq -48(%rbp), %rax addq %rax, %rax cmpq %rax, -16(%rbp) jb .L33 movq -32(%rbp), %rax imulq -48(%rbp), %rax leaq (%rax,%rax), %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rax imulq -48(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax addq %rax, %rdx movq -24(%rbp), %rax movq %rcx, %rsi movq %rdx, %rdi call *%rax testl %eax, %eax jle .L33 movq -32(%rbp), %rax imulq -48(%rbp), %rax leaq (%rax,%rax), %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rsi movq -32(%rbp), %rax imulq -48(%rbp), %rax movq %rax, %rdx movq -40(%rbp), %rax leaq (%rdx,%rax), %rcx movq -32(%rbp), %rax movq %rax, %rdx movq %rcx, %rdi call heap_func_swap jmp .L33 .L39: nop .L33: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size pop, .-pop .globl cmp .type cmp, @function cmp: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movl (%rax), %edx movq -32(%rbp), %rax movl (%rax), %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -4(%rbp) cmpl $0, -4(%rbp) je .L41 cmpl $0, -4(%rbp) jns .L42 movl $-1, %eax jmp .L45 .L42: movl $1, %eax jmp .L45 .L41: movl $0, %eax .L45: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size cmp, .-cmp .section .rodata .LC0: .string "%i" .LC1: .string "%li\n" .text .globl run .type run, @function run: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $96, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -84(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -84(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax cltq movl $4, %esi movq %rax, %rdi call calloc@PLT movq %rax, -40(%rbp) movl $0, -76(%rbp) jmp .L47 .L48: movl -76(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -40(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -76(%rbp) .L47: movl -84(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax cmpl %eax, -76(%rbp) jl .L48 movq $0, -56(%rbp) leaq cmp(%rip), %rax movq %rax, %rsi movl $4, %edi call new_binary_heap movq %rax, -32(%rbp) movl $0, -72(%rbp) jmp .L49 .L50: movl -72(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -80(%rbp) movl -80(%rbp), %eax cltq addq %rax, -56(%rbp) leaq -80(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call push addl $1, -72(%rbp) .L49: movl -84(%rbp), %eax cmpl %eax, -72(%rbp) jl .L50 movl -84(%rbp), %eax addl $1, %eax cltq movl $8, %esi movq %rax, %rdi call calloc@PLT movq %rax, -24(%rbp) movq -24(%rbp), %rax movq -56(%rbp), %rdx movq %rdx, (%rax) movl $1, -68(%rbp) jmp .L51 .L52: movl -84(%rbp), %eax leal -1(%rax), %edx movl -68(%rbp), %eax addl %edx, %eax cltq leaq 0(,%rax,4), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl (%rax), %eax movl %eax, -80(%rbp) movl -80(%rbp), %eax cltq addq %rax, -56(%rbp) leaq -80(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call push leaq -80(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call pop movl -80(%rbp), %eax cltq subq %rax, -56(%rbp) movl -68(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rax, %rdx movq -56(%rbp), %rax movq %rax, (%rdx) addl $1, -68(%rbp) .L51: movl -84(%rbp), %eax cmpl %eax, -68(%rbp) jle .L52 movq -32(%rbp), %rax movq %rax, %rdi call init_heap movq $0, -56(%rbp) movl $0, -64(%rbp) jmp .L53 .L54: movl -84(%rbp), %edx movl %edx, %eax addl %eax, %eax addl %edx, %eax subl $1, %eax subl -64(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl (%rax), %eax negl %eax movl %eax, -80(%rbp) movl -80(%rbp), %eax cltq addq %rax, -56(%rbp) leaq -80(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call push addl $1, -64(%rbp) .L53: movl -84(%rbp), %eax cmpl %eax, -64(%rbp) jl .L54 movl -84(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -56(%rbp), %rax addq %rdx, %rax movq %rax, -48(%rbp) movl $1, -60(%rbp) jmp .L55 .L57: movl -84(%rbp), %eax addl %eax, %eax subl -60(%rbp), %eax cltq leaq 0(,%rax,4), %rdx movq -40(%rbp), %rax addq %rdx, %rax movl (%rax), %eax negl %eax movl %eax, -80(%rbp) movl -80(%rbp), %eax cltq addq %rax, -56(%rbp) leaq -80(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call push leaq -80(%rbp), %rdx movq -32(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call pop movl -80(%rbp), %eax cltq subq %rax, -56(%rbp) movl -84(%rbp), %eax subl -60(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -24(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -56(%rbp), %rax addq %rdx, %rax movq %rax, -16(%rbp) movq -16(%rbp), %rax cmpq -48(%rbp), %rax jle .L56 movq -16(%rbp), %rax movq %rax, -48(%rbp) .L56: addl $1, -60(%rbp) .L55: movl -84(%rbp), %eax cmpl %eax, -60(%rbp) jle .L57 movq -48(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT nop movq -8(%rbp), %rax subq %fs:40, %rax je .L58 call __stack_chk_fail@PLT .L58: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size run, .-run .globl main .type main, @function main: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 call run movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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)goto END;\n for(i=n;i--;){\n if(a%d[i])a+=d[i]-a%d[i];\n b+=d[i]-b%d[i]-1;\n }\n p=a;\n for(i=0;i<n;i++)p-=p%d[i];\n if(p-2)goto END;\n p=b;\n for(i=0;i<n;i++)p-=p%d[i];\n if(p-2)goto END;\n printf(\"%lld %lld\\n\",a,b);\n return 0;\n END:;\n printf(\"-1\\n\");\n return 0;\n}\n \n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-798720(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$1424, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-800136(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -800128(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-800096(%rbp), %rdx\n\tmovq\t-800128(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -800128(%rbp)\n.L2:\n\tmovq\t-800136(%rbp), %rax\n\tcmpq\t%rax, -800128(%rbp)\n\tjl\t.L3\n\tmovq\t$2, -800112(%rbp)\n\tmovq\t-800112(%rbp), %rax\n\tmovq\t%rax, -800120(%rbp)\n\tmovq\t-800136(%rbp), %rax\n\tmovq\t$1000000000, -800096(%rbp,%rax,8)\n\tmovq\t-800136(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t-800096(%rbp,%rax,8), %rax\n\tcmpq\t$2, %rax\n\tjne\t.L18\n\tmovq\t-800136(%rbp), %rax\n\tmovq\t%rax, -800128(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800120(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tje\t.L7\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rsi\n\tmovq\t-800120(%rbp), %rax\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\taddq\t%rax, -800120(%rbp)\n.L7:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rsi\n\tmovq\t-800112(%rbp), %rax\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tsubq\t$1, %rax\n\taddq\t%rax, -800112(%rbp)\n.L6:\n\tmovq\t-800128(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -800128(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L8\n\tmovq\t-800120(%rbp), %rax\n\tmovq\t%rax, -800104(%rbp)\n\tmovq\t$0, -800128(%rbp)\n\tjmp\t.L9\n.L10:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800104(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rax, -800104(%rbp)\n\taddq\t$1, -800128(%rbp)\n.L9:\n\tmovq\t-800136(%rbp), %rax\n\tcmpq\t%rax, -800128(%rbp)\n\tjl\t.L10\n\tcmpq\t$2, -800104(%rbp)\n\tjne\t.L19\n\tmovq\t-800112(%rbp), %rax\n\tmovq\t%rax, -800104(%rbp)\n\tmovq\t$0, -800128(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800104(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rax, -800104(%rbp)\n\taddq\t$1, -800128(%rbp)\n.L12:\n\tmovq\t-800136(%rbp), %rax\n\tcmpq\t%rax, -800128(%rbp)\n\tjl\t.L13\n\tcmpq\t$2, -800104(%rbp)\n\tjne\t.L20\n\tmovq\t-800112(%rbp), %rdx\n\tmovq\t-800120(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L16\n.L18:\n\tnop\n\tjmp\t.L5\n.L19:\n\tnop\n\tjmp\t.L5\n.L20:\n\tnop\n.L5:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n.L16:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L17\n\tcall\t__stack_chk_fail@PLT\n.L17:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_startproc\n\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t-798720(%rsp), %r11\n\t.cfi_def_cfa 11, 798752\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$1392, %rsp\n\t.cfi_def_cfa_offset 800144\n\tleaq\t.LC0(%rip), %r12\n\tmovq\t%r12, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 800104(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rdi\n\ttestq\t%rdi, %rdi\n\tjle\t.L2\n\tleaq\t16(%rsp), %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rdi\n\taddq\t$8, %rbp\n\tcmpq\t%rbx, %rdi\n\tjg\t.L3\n.L2:\n\tmovq\t$1000000000, 16(%rsp,%rdi,8)\n\tleaq\t-1(%rdi), %rax\n\tmovq\t16(%rsp,%rax,8), %r8\n\tcmpq\t$2, %r8\n\tjne\t.L4\n\ttestq\t%rdi, %rdi\n\tje\t.L16\n\ttestq\t%rax, %rax\n\tje\t.L17\n\tleaq\t16(%rsp), %r10\n\tleaq\t24(%rsp), %r11\n\tmovl\t$3, %esi\n\tleaq\t(%r10,%rdi,8), %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovq\t-16(%r9), %rcx\n\tmovq\t%r8, %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\taddq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tcmovne\t%rax, %r8\n\tmovq\t%rsi, %rax\n\tsubq\t$8, %r9\n\tcqto\n\tidivq\t%rcx\n\tsubq\t%rdx, %rcx\n\tleaq\t-1(%rsi,%rcx), %rsi\n\tcmpq\t%r9, %r11\n\tjne\t.L8\n\ttestq\t%rdi, %rdi\n\tjle\t.L9\n\tmovq\t%rsi, %r11\n.L6:\n\tmovq\t%r10, %r9\n\tleaq\t(%r10,%rdi,8), %rdi\n\tmovq\t%r10, %rcx\n\tmovq\t%r8, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovq\t%rsi, %rax\n\tcqto\n\tidivq\t(%rcx)\n\taddq\t$8, %rcx\n\tsubq\t%rdx, %rsi\n\tcmpq\t%rdi, %rcx\n\tjne\t.L10\n\tcmpq\t$2, %rsi\n\tjne\t.L4\n\tmovq\t%r11, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t%rsi, %rax\n\tcqto\n\tidivq\t(%r9)\n\taddq\t$8, %r9\n\tsubq\t%rdx, %rsi\n\tcmpq\t%r9, %rdi\n\tjne\t.L12\n.L14:\n\tcmpq\t$2, %rsi\n\tje\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L13:\n\tmovq\t800104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L28\n\taddq\t$800112, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tmovl\t$2, %r11d\n.L5:\n\tmovq\t%r11, %rcx\n\tmovq\t%r8, %rdx\n\tleaq\t.LC1(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L13\n.L17:\n\tmovl\t$3, %r11d\n\tleaq\t16(%rsp), %r10\n\tjmp\t.L6\n.L9:\n\tmovq\t%rsi, %r11\n\tcmpq\t$2, %r8\n\tje\t.L14\n\tjmp\t.L4\n.L28:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t-798720(%rsp), %r11\n\t.cfi_def_cfa 11, 798752\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$1392, %rsp\n\t.cfi_def_cfa_offset 800144\n\tleaq\t.LC0(%rip), %r12\n\tmovq\t%r12, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 800104(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rdi\n\ttestq\t%rdi, %rdi\n\tjle\t.L2\n\tleaq\t16(%rsp), %rbp\n\txorl\t%ebx, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbx\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t8(%rsp), %rdi\n\taddq\t$8, %rbp\n\tcmpq\t%rbx, %rdi\n\tjg\t.L3\n.L2:\n\tmovq\t$1000000000, 16(%rsp,%rdi,8)\n\tleaq\t-1(%rdi), %rax\n\tmovq\t16(%rsp,%rax,8), %r8\n\tcmpq\t$2, %r8\n\tjne\t.L4\n\ttestq\t%rdi, %rdi\n\tje\t.L16\n\ttestq\t%rax, %rax\n\tje\t.L17\n\tleaq\t16(%rsp), %r10\n\tleaq\t24(%rsp), %r11\n\tmovl\t$3, %esi\n\tleaq\t(%r10,%rdi,8), %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovq\t-16(%r9), %rcx\n\tmovq\t%r8, %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\taddq\t%r8, %rax\n\ttestq\t%rdx, %rdx\n\tcmovne\t%rax, %r8\n\tmovq\t%rsi, %rax\n\tsubq\t$8, %r9\n\tcqto\n\tidivq\t%rcx\n\tsubq\t%rdx, %rcx\n\tleaq\t-1(%rsi,%rcx), %rsi\n\tcmpq\t%r9, %r11\n\tjne\t.L8\n\ttestq\t%rdi, %rdi\n\tjle\t.L9\n\tmovq\t%rsi, %r11\n.L6:\n\tmovq\t%r10, %r9\n\tleaq\t(%r10,%rdi,8), %rdi\n\tmovq\t%r10, %rcx\n\tmovq\t%r8, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovq\t%rsi, %rax\n\tcqto\n\tidivq\t(%rcx)\n\taddq\t$8, %rcx\n\tsubq\t%rdx, %rsi\n\tcmpq\t%rdi, %rcx\n\tjne\t.L10\n\tcmpq\t$2, %rsi\n\tjne\t.L4\n\tmovq\t%r11, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t%rsi, %rax\n\tcqto\n\tidivq\t(%r9)\n\taddq\t$8, %r9\n\tsubq\t%rdx, %rsi\n\tcmpq\t%r9, %rdi\n\tjne\t.L12\n.L14:\n\tcmpq\t$2, %rsi\n\tje\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n.L13:\n\tmovq\t800104(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L28\n\taddq\t$800112, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L16:\n\t.cfi_restore_state\n\tmovl\t$2, %r11d\n.L5:\n\tmovq\t%r11, %rcx\n\tmovq\t%r8, %rdx\n\tleaq\t.LC1(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tjmp\t.L13\n.L17:\n\tmovl\t$3, %r11d\n\tleaq\t16(%rsp), %r10\n\tjmp\t.L6\n.L9:\n\tmovq\t%rsi, %r11\n\tcmpq\t$2, %r8\n\tje\t.L14\n\tjmp\t.L4\n.L28:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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)goto END;\n for(i=n;i--;){\n if(a%d[i])a+=d[i]-a%d[i];\n b+=d[i]-b%d[i]-1;\n }\n p=a;\n for(i=0;i<n;i++)p-=p%d[i];\n if(p-2)goto END;\n p=b;\n for(i=0;i<n;i++)p-=p%d[i];\n if(p-2)goto END;\n printf(\"%lld %lld\\n\",a,b);\n return 0;\n END:;\n printf(\"-1\\n\");\n return 0;\n}\n \n", "index": 101, "inputs": [ "5\n3 7 100 3 2\n", "10\n2 3 2 2 2 2 2 2 2 2\n", "4\n3 3 2 2\n", "4\n4 3 2 2\n", "4\n3 5 3 2\n", "4\n1 1 2 2\n", "4\n3 4 2 2\n", "5\n3 7 100 5 2\n", "5\n3 7 100 2 2\n", "5\n3 4 100 3 3\n", "5\n3 7 101 3 2\n", "4\n3 6 2 2\n", "5\n3 12 100 5 2\n", "5\n3 7 100 1 2\n", "10\n2 3 2 2 2 2 4 2 2 2\n", "5\n3 9 101 3 2\n", "5\n3 12 100 3 2\n", "5\n6 7 100 1 2\n", "10\n2 3 2 2 2 2 4 1 2 2\n", "5\n2 9 101 3 2\n", "5\n3 12 100 3 4\n", "5\n6 1 100 1 2\n", "10\n2 3 2 2 2 2 4 1 4 2\n", "5\n2 12 101 3 2\n", "5\n3 12 100 3 3\n", "5\n2 12 101 3 4\n", "5\n2 12 100 3 4\n", "5\n2 20 100 3 4\n", "5\n2 20 100 5 4\n", "5\n2 20 100 5 1\n", "5\n2 4 100 3 2\n", "5\n2 7 100 3 2\n", "5\n3 4 100 3 6\n", "10\n2 3 3 2 2 2 2 2 2 2\n", "5\n3 7 111 3 2\n", "4\n3 6 4 2\n", "5\n3 24 100 5 2\n", "5\n3 7 110 1 2\n", "5\n3 9 001 3 2\n", "5\n6 6 100 1 2\n", "10\n2 3 2 2 1 2 4 1 2 2\n", "5\n2 14 101 3 2\n", "5\n3 12 100 3 5\n", "5\n6 1 101 1 2\n", "10\n2 3 2 2 2 2 7 1 4 2\n", "5\n2 12 111 3 2\n", "5\n3 12 100 6 3\n", "5\n2 12 101 3 6\n", "5\n2 12 111 3 4\n", "5\n2 20 110 3 4\n", "5\n2 32 100 5 4\n", "5\n2 20 101 5 1\n", "5\n2 7 101 3 2\n", "4\n3 10 2 2\n", "5\n3 4 100 3 12\n", "10\n2 3 3 2 2 2 2 2 2 4\n", "5\n3 47 100 5 2\n", "5\n3 7 111 1 2\n", "5\n6 6 100 2 2\n", "10\n2 3 2 2 1 3 4 1 2 2\n", "5\n2 8 101 3 2\n", "5\n5 1 101 1 2\n", "10\n4 3 2 2 2 2 7 1 4 2\n", "5\n2 12 111 1 2\n", "5\n3 12 101 6 3\n", "5\n2 18 101 3 6\n", "5\n2 12 111 3 7\n", "5\n2 12 110 3 4\n", "5\n2 32 100 7 4\n", "5\n2 20 101 7 1\n", "5\n2 7 101 3 4\n", "4\n3 19 2 2\n", "5\n3 4 100 3 7\n", "5\n3 47 100 9 2\n", "5\n3 7 111 2 2\n", "5\n5 6 100 2 2\n", "5\n1 8 101 3 2\n", "5\n5 1 100 1 2\n", "10\n4 1 2 2 2 2 7 1 4 2\n", "5\n3 12 111 1 2\n", "5\n6 12 100 6 3\n", "5\n2 18 101 6 6\n", "5\n2 12 111 5 7\n", "5\n2 32 100 8 4\n", "5\n2 7 101 3 3\n", "4\n2 19 2 2\n", "5\n6 4 100 3 7\n", "5\n3 47 110 9 2\n", "5\n1 7 111 2 2\n", "5\n2 6 100 2 2\n", "5\n1 8 101 5 2\n", "5\n5 1 110 1 2\n", "10\n4 1 2 3 2 2 7 1 4 2\n", "5\n3 12 101 1 2\n", "5\n6 22 100 6 3\n", "5\n2 18 100 6 6\n", "5\n2 12 111 10 7\n", "5\n2 45 100 8 4\n", "5\n2 7 101 4 3\n", "4\n2 34 2 2\n", "5\n3 4 100 3 2\n", "4\n3 4 3 2\n", "4\n3 4 3 2\n", "10\n2 2 2 2 2 2 2 2 2 2\n" ], "outputs": [ "-1\n", "4 5\n", "3 5\n", "4 7\n", "6 11\n", "2 3\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "4 5\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "-1\n", "6 8\n", "6 8\n", "2 3\n" ], "question": "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)goto END;\n for(i=n;i--;){\n if(a%d[i])a+=d[i]-a%d[i];\n b+=d[i]-b%d[i]-1;\n }\n p=a;\n for(i=0;i<n;i++)p-=p%d[i];\n if(p-2)goto END;\n p=b;\n for(i=0;i<n;i++)p-=p%d[i];\n if(p-2)goto END;\n printf(\"%lld %lld\\n\",a,b);\n return 0;\n END:;\n printf(\"-1\\n\");\n return 0;\n}\n \n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-798720(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$1424, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-800136(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t$0, -800128(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-800096(%rbp), %rdx\n\tmovq\t-800128(%rbp), %rax\n\tsalq\t$3, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$1, -800128(%rbp)\n.L2:\n\tmovq\t-800136(%rbp), %rax\n\tcmpq\t%rax, -800128(%rbp)\n\tjl\t.L3\n\tmovq\t$2, -800112(%rbp)\n\tmovq\t-800112(%rbp), %rax\n\tmovq\t%rax, -800120(%rbp)\n\tmovq\t-800136(%rbp), %rax\n\tmovq\t$1000000000, -800096(%rbp,%rax,8)\n\tmovq\t-800136(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t-800096(%rbp,%rax,8), %rax\n\tcmpq\t$2, %rax\n\tjne\t.L18\n\tmovq\t-800136(%rbp), %rax\n\tmovq\t%rax, -800128(%rbp)\n\tjmp\t.L6\n.L8:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800120(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\ttestq\t%rax, %rax\n\tje\t.L7\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rsi\n\tmovq\t-800120(%rbp), %rax\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\taddq\t%rax, -800120(%rbp)\n.L7:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rsi\n\tmovq\t-800112(%rbp), %rax\n\tcqto\n\tidivq\t%rsi\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tsubq\t$1, %rax\n\taddq\t%rax, -800112(%rbp)\n.L6:\n\tmovq\t-800128(%rbp), %rax\n\tleaq\t-1(%rax), %rdx\n\tmovq\t%rdx, -800128(%rbp)\n\ttestq\t%rax, %rax\n\tjne\t.L8\n\tmovq\t-800120(%rbp), %rax\n\tmovq\t%rax, -800104(%rbp)\n\tmovq\t$0, -800128(%rbp)\n\tjmp\t.L9\n.L10:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800104(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rax, -800104(%rbp)\n\taddq\t$1, -800128(%rbp)\n.L9:\n\tmovq\t-800136(%rbp), %rax\n\tcmpq\t%rax, -800128(%rbp)\n\tjl\t.L10\n\tcmpq\t$2, -800104(%rbp)\n\tjne\t.L19\n\tmovq\t-800112(%rbp), %rax\n\tmovq\t%rax, -800104(%rbp)\n\tmovq\t$0, -800128(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-800128(%rbp), %rax\n\tmovq\t-800096(%rbp,%rax,8), %rcx\n\tmovq\t-800104(%rbp), %rax\n\tcqto\n\tidivq\t%rcx\n\tmovq\t%rdx, %rax\n\tsubq\t%rax, -800104(%rbp)\n\taddq\t$1, -800128(%rbp)\n.L12:\n\tmovq\t-800136(%rbp), %rax\n\tcmpq\t%rax, -800128(%rbp)\n\tjl\t.L13\n\tcmpq\t$2, -800104(%rbp)\n\tjne\t.L20\n\tmovq\t-800112(%rbp), %rdx\n\tmovq\t-800120(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L16\n.L18:\n\tnop\n\tjmp\t.L5\n.L19:\n\tnop\n\tjmp\t.L5\n.L20:\n\tnop\n.L5:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n.L16:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L17\n\tcall\t__stack_chk_fail@PLT\n.L17:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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[i])a+=d[i]-a%d[i]; b+=d[i]-b%d[i]-1; } p=a; for(i=0;i<n;i++)p-=p%d[i]; if(p-2)goto END; p=b; for(i=0;i<n;i++)p-=p%d[i]; if(p-2)goto END; printf("%lld %lld\n",a,b); return 0; END:; printf("-1\n"); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lld" .LC1: .string "%lld %lld\n" .LC2: .string "-1" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -798720(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $1424, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -800136(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movq $0, -800128(%rbp) jmp .L2 .L3: leaq -800096(%rbp), %rdx movq -800128(%rbp), %rax salq $3, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addq $1, -800128(%rbp) .L2: movq -800136(%rbp), %rax cmpq %rax, -800128(%rbp) jl .L3 movq $2, -800112(%rbp) movq -800112(%rbp), %rax movq %rax, -800120(%rbp) movq -800136(%rbp), %rax movq $1000000000, -800096(%rbp,%rax,8) movq -800136(%rbp), %rax subq $1, %rax movq -800096(%rbp,%rax,8), %rax cmpq $2, %rax jne .L18 movq -800136(%rbp), %rax movq %rax, -800128(%rbp) jmp .L6 .L8: movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rcx movq -800120(%rbp), %rax cqto idivq %rcx movq %rdx, %rax testq %rax, %rax je .L7 movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rcx movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rsi movq -800120(%rbp), %rax cqto idivq %rsi movq %rcx, %rax subq %rdx, %rax addq %rax, -800120(%rbp) .L7: movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rcx movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rsi movq -800112(%rbp), %rax cqto idivq %rsi movq %rcx, %rax subq %rdx, %rax subq $1, %rax addq %rax, -800112(%rbp) .L6: movq -800128(%rbp), %rax leaq -1(%rax), %rdx movq %rdx, -800128(%rbp) testq %rax, %rax jne .L8 movq -800120(%rbp), %rax movq %rax, -800104(%rbp) movq $0, -800128(%rbp) jmp .L9 .L10: movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rcx movq -800104(%rbp), %rax cqto idivq %rcx movq %rdx, %rax subq %rax, -800104(%rbp) addq $1, -800128(%rbp) .L9: movq -800136(%rbp), %rax cmpq %rax, -800128(%rbp) jl .L10 cmpq $2, -800104(%rbp) jne .L19 movq -800112(%rbp), %rax movq %rax, -800104(%rbp) movq $0, -800128(%rbp) jmp .L12 .L13: movq -800128(%rbp), %rax movq -800096(%rbp,%rax,8), %rcx movq -800104(%rbp), %rax cqto idivq %rcx movq %rdx, %rax subq %rax, -800104(%rbp) addq $1, -800128(%rbp) .L12: movq -800136(%rbp), %rax cmpq %rax, -800128(%rbp) jl .L13 cmpq $2, -800104(%rbp) jne .L20 movq -800112(%rbp), %rdx movq -800120(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax jmp .L16 .L18: nop jmp .L5 .L19: nop jmp .L5 .L20: nop .L5: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax .L16: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L17 call __stack_chk_fail@PLT .L17: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 int sup = 1 << 30;\n\tint dp[100002];\n\tfor (i = 2, dp[1] = 0; i <= N; i++) dp[i] = sup;\n\tfor (i = 1; i < N; i++) {\n\t\tif (dp[i] + abs(h[i+1] - h[i]) < dp[i+1]) dp[i+1] = dp[i] + abs(h[i+1] - h[i]);\n\t\tif (dp[i] + abs(h[i+2] - h[i]) < dp[i+2]) dp[i+2] = dp[i] + abs(h[i+2] - h[i]);\n\t}\n\tprintf(\"%d\\n\", dp[N]);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-798720(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$1328, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-800044(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -800040(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-800032(%rbp), %rdx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -800040(%rbp)\n.L2:\n\tmovl\t-800044(%rbp), %eax\n\tcmpl\t%eax, -800040(%rbp)\n\tjle\t.L3\n\tmovl\t$1073741824, -800036(%rbp)\n\tmovl\t$2, -800040(%rbp)\n\tmovl\t$0, -400012(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800036(%rbp), %edx\n\tmovl\t%edx, -400016(%rbp,%rax,4)\n\taddl\t$1, -800040(%rbp)\n.L4:\n\tmovl\t-800044(%rbp), %eax\n\tcmpl\t%eax, -800040(%rbp)\n\tjle\t.L5\n\tmovl\t$1, -800040(%rbp)\n\tjmp\t.L6\n.L9:\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovns\t%edx, %eax\n\tleal\t(%rcx,%rax), %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L7\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovs\t%eax, %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\taddl\t%ecx, %edx\n\tcltq\n\tmovl\t%edx, -400016(%rbp,%rax,4)\n.L7:\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovns\t%edx, %eax\n\tleal\t(%rcx,%rax), %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovs\t%eax, %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\taddl\t%ecx, %edx\n\tcltq\n\tmovl\t%edx, -400016(%rbp,%rax,4)\n.L8:\n\taddl\t$1, -800040(%rbp)\n.L6:\n\tmovl\t-800044(%rbp), %eax\n\tcmpl\t%eax, -800040(%rbp)\n\tjl\t.L9\n\tmovl\t-800044(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_def_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t-798720(%rsp), %r11\n\t.cfi_def_cfa 11, 798752\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$1328, %rsp\n\t.cfi_def_cfa_offset 800080\n\tleaq\t.LC0(%rip), %r12\n\tmovq\t%r12, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 800040(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t12(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L2\n\tleaq\t20(%rsp), %rbp\n\tmovl\t$1, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t12(%rsp), %rsi\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %esi\n\tjge\t.L3\n\tmovl\t$0, 400036(%rsp)\n\tcmpl\t$1, %esi\n\tjle\t.L13\n\tleal\t-2(%rsi), %eax\n\tleal\t-1(%rsi), %ecx\n\tcmpl\t$2, %eax\n\tjbe\t.L5\n\tmovl\t%ecx, %edx\n\tleaq\t400040(%rsp), %rdi\n\tmovdqa\t.LC2(%rip), %xmm0\n\tshrl\t$2, %edx\n\tmovq\t%rdi, %rax\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t400056(%rsp,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovups\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L6\n\tmovl\t%ecx, %eax\n\tandl\t$-4, %eax\n\tleal\t2(%rax), %edx\n\tcmpl\t%eax, %ecx\n\tje\t.L14\n\tmovslq\t%edx, %rdx\n\taddl\t$3, %eax\n\tmovl\t$1073741824, 400032(%rsp,%rdx,4)\n\tcmpl\t%eax, %esi\n\tjl\t.L14\n.L15:\n\tmovslq\t%eax, %rdx\n\taddl\t$1, %eax\n\tmovl\t$1073741824, 400032(%rsp,%rdx,4)\n\tcmpl\t%eax, %esi\n\tjl\t.L9\n\tcltq\n\tleaq\t400040(%rsp), %rdi\n\tmovl\t$1073741824, 400032(%rsp,%rax,4)\n.L14:\n\tleal\t-4(%rsi), %ecx\n\tmovl\t20(%rsp), %r11d\n\tmovl\t24(%rsp), %r10d\n\tmovl\t$3, %r9d\n\tshrl\t%ecx\n\tmovl\t400040(%rsp), %edx\n\tmovl\t400036(%rsp), %eax\n\tleaq\t5(%rcx,%rcx), %rbx\n\tleaq\t16(%rsp), %rcx\n.L11:\n\tmovl\t%r10d, %r8d\n\tsubl\t%r11d, %r8d\n\tmovl\t%r8d, %ebp\n\tnegl\t%ebp\n\tcmovs\t%r8d, %ebp\n\tmovl\t%r9d, %r8d\n\taddl\t%eax, %ebp\n\tcmpl\t%edx, %ebp\n\tcmovg\t%edx, %ebp\n\tmovl\t%r11d, %edx\n\tmovl\t(%rcx,%r9,4), %r11d\n\tmovl\t%r11d, %r12d\n\tmovl\t%ebp, (%rdi)\n\tsubl\t%edx, %r12d\n\tmovl\t%r12d, %edx\n\tnegl\t%edx\n\tcmovs\t%r12d, %edx\n\tmovl\t%r11d, %r12d\n\taddl\t%eax, %edx\n\tmovl\t4(%rdi), %eax\n\tcmpl\t%eax, %edx\n\tcmovg\t%eax, %edx\n\tsubl\t%r10d, %r12d\n\tmovl\t%r12d, %eax\n\tnegl\t%eax\n\tcmovs\t%r12d, %eax\n\taddl\t%ebp, %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t%r10d, %edx\n\tmovl\t4(%rcx,%r9,4), %r10d\n\tmovl\t%r10d, %r12d\n\tmovl\t%eax, 4(%rdi)\n\tsubl\t%edx, %r12d\n\tmovl\t%r12d, %edx\n\tnegl\t%edx\n\tcmovs\t%r12d, %edx\n\taddl\t%ebp, %edx\n\tmovl\t8(%rdi), %ebp\n\tcmpl\t%ebp, %edx\n\tcmovg\t%ebp, %edx\n\taddq\t$2, %r9\n\taddq\t$8, %rdi\n\tmovl\t%edx, (%rdi)\n\tcmpq\t%rbx, %r9\n\tjne\t.L11\n.L10:\n\tmovslq\t%r8d, %rdx\n\tsalq\t$2, %rdx\n\tleaq\t400032(%rsp,%rdx), %rax\n\taddq\t%rdx, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovl\t4(%rcx), %edx\n\tsubl\t(%rcx), %edx\n\taddl\t$1, %r8d\n\tmovl\t%edx, %edi\n\tmovl\t(%rax), %r9d\n\tnegl\t%edi\n\tcmovns\t%edi, %edx\n\tmovl\t4(%rax), %edi\n\taddl\t%r9d, %edx\n\tcmpl\t%edi, %edx\n\tcmovg\t%edi, %edx\n\tmovl\t%edx, 4(%rax)\n\tmovl\t8(%rcx), %edx\n\tsubl\t(%rcx), %edx\n\tmovl\t%edx, %edi\n\tnegl\t%edi\n\tcmovns\t%edi, %edx\n\tmovl\t8(%rax), %edi\n\taddl\t%r9d, %edx\n\tcmpl\t%edi, %edx\n\tcmovg\t%edi, %edx\n\taddq\t$4, %rax\n\taddq\t$4, %rcx\n\tmovl\t%edx, 4(%rax)\n\tcmpl\t%r8d, %esi\n\tjg\t.L12\n.L13:\n\tmovl\t400032(%rsp,%rsi,4), %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t800040(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L29\n\taddq\t$800048, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tmovl\t$0, 400036(%rsp)\n\tjmp\t.L13\n.L5:\n\tmovl\t$1073741824, 400040(%rsp)\n\tcmpl\t$2, %esi\n\tje\t.L18\n\tmovl\t$3, %eax\n\tjmp\t.L15\n.L9:\n\tcmpl\t$3, %esi\n\tjg\t.L30\n.L18:\n\tmovl\t$1, %r8d\n\tleaq\t16(%rsp), %rcx\n\tjmp\t.L10\n.L30:\n\tleaq\t400040(%rsp), %rdi\n\tjmp\t.L14\n.L29:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC2:\n\t.long\t1073741824\n\t.long\t1073741824\n\t.long\t1073741824\n\t.long\t1073741824\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_cfa_offset 16\n\t.cfi_offset 12, -16\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 6, -24\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 3, -32\n\tleaq\t-798720(%rsp), %r11\n\t.cfi_def_cfa 11, 798752\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$1328, %rsp\n\t.cfi_def_cfa_offset 800080\n\tleaq\t.LC0(%rip), %r12\n\tmovq\t%r12, %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 800040(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t12(%rsp), %rsi\n\ttestl\t%esi, %esi\n\tjle\t.L2\n\tleaq\t20(%rsp), %rbp\n\tmovl\t$1, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rbp, %rsi\n\tmovq\t%r12, %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__isoc99_scanf@PLT\n\tmovslq\t12(%rsp), %rsi\n\taddq\t$4, %rbp\n\tcmpl\t%ebx, %esi\n\tjge\t.L3\n\tmovl\t$0, 400036(%rsp)\n\tcmpl\t$1, %esi\n\tjle\t.L13\n\tleal\t-2(%rsi), %eax\n\tleal\t-1(%rsi), %ecx\n\tcmpl\t$2, %eax\n\tjbe\t.L5\n\tmovl\t%ecx, %edx\n\tleaq\t400040(%rsp), %rdi\n\tmovdqa\t.LC2(%rip), %xmm0\n\tshrl\t$2, %edx\n\tmovq\t%rdi, %rax\n\tsubl\t$1, %edx\n\tsalq\t$4, %rdx\n\tleaq\t400056(%rsp,%rdx), %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovups\t%xmm0, (%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L6\n\tmovl\t%ecx, %eax\n\tandl\t$-4, %eax\n\tleal\t2(%rax), %edx\n\tcmpl\t%eax, %ecx\n\tje\t.L14\n\tmovslq\t%edx, %rdx\n\taddl\t$3, %eax\n\tmovl\t$1073741824, 400032(%rsp,%rdx,4)\n\tcmpl\t%eax, %esi\n\tjl\t.L14\n.L15:\n\tmovslq\t%eax, %rdx\n\taddl\t$1, %eax\n\tmovl\t$1073741824, 400032(%rsp,%rdx,4)\n\tcmpl\t%eax, %esi\n\tjl\t.L9\n\tcltq\n\tleaq\t400040(%rsp), %rdi\n\tmovl\t$1073741824, 400032(%rsp,%rax,4)\n.L14:\n\tleal\t-4(%rsi), %ecx\n\tmovl\t20(%rsp), %r11d\n\tmovl\t24(%rsp), %r10d\n\tmovl\t$3, %r9d\n\tshrl\t%ecx\n\tmovl\t400040(%rsp), %edx\n\tmovl\t400036(%rsp), %eax\n\tleaq\t5(%rcx,%rcx), %rbx\n\tleaq\t16(%rsp), %rcx\n.L11:\n\tmovl\t%r10d, %r8d\n\tsubl\t%r11d, %r8d\n\tmovl\t%r8d, %ebp\n\tnegl\t%ebp\n\tcmovs\t%r8d, %ebp\n\tmovl\t%r9d, %r8d\n\taddl\t%eax, %ebp\n\tcmpl\t%edx, %ebp\n\tcmovg\t%edx, %ebp\n\tmovl\t%r11d, %edx\n\tmovl\t(%rcx,%r9,4), %r11d\n\tmovl\t%r11d, %r12d\n\tmovl\t%ebp, (%rdi)\n\tsubl\t%edx, %r12d\n\tmovl\t%r12d, %edx\n\tnegl\t%edx\n\tcmovs\t%r12d, %edx\n\tmovl\t%r11d, %r12d\n\taddl\t%eax, %edx\n\tmovl\t4(%rdi), %eax\n\tcmpl\t%eax, %edx\n\tcmovg\t%eax, %edx\n\tsubl\t%r10d, %r12d\n\tmovl\t%r12d, %eax\n\tnegl\t%eax\n\tcmovs\t%r12d, %eax\n\taddl\t%ebp, %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t%r10d, %edx\n\tmovl\t4(%rcx,%r9,4), %r10d\n\tmovl\t%r10d, %r12d\n\tmovl\t%eax, 4(%rdi)\n\tsubl\t%edx, %r12d\n\tmovl\t%r12d, %edx\n\tnegl\t%edx\n\tcmovs\t%r12d, %edx\n\taddl\t%ebp, %edx\n\tmovl\t8(%rdi), %ebp\n\tcmpl\t%ebp, %edx\n\tcmovg\t%ebp, %edx\n\taddq\t$2, %r9\n\taddq\t$8, %rdi\n\tmovl\t%edx, (%rdi)\n\tcmpq\t%rbx, %r9\n\tjne\t.L11\n.L10:\n\tmovslq\t%r8d, %rdx\n\tsalq\t$2, %rdx\n\tleaq\t400032(%rsp,%rdx), %rax\n\taddq\t%rdx, %rcx\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovl\t4(%rcx), %edx\n\tsubl\t(%rcx), %edx\n\taddl\t$1, %r8d\n\tmovl\t%edx, %edi\n\tmovl\t(%rax), %r9d\n\tnegl\t%edi\n\tcmovns\t%edi, %edx\n\tmovl\t4(%rax), %edi\n\taddl\t%r9d, %edx\n\tcmpl\t%edi, %edx\n\tcmovg\t%edi, %edx\n\tmovl\t%edx, 4(%rax)\n\tmovl\t8(%rcx), %edx\n\tsubl\t(%rcx), %edx\n\tmovl\t%edx, %edi\n\tnegl\t%edi\n\tcmovns\t%edi, %edx\n\tmovl\t8(%rax), %edi\n\taddl\t%r9d, %edx\n\tcmpl\t%edi, %edx\n\tcmovg\t%edi, %edx\n\taddq\t$4, %rax\n\taddq\t$4, %rcx\n\tmovl\t%edx, 4(%rax)\n\tcmpl\t%r8d, %esi\n\tjg\t.L12\n.L13:\n\tmovl\t400032(%rsp,%rsi,4), %edx\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t800040(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L29\n\taddq\t$800048, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 32\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tmovl\t$0, 400036(%rsp)\n\tjmp\t.L13\n.L5:\n\tmovl\t$1073741824, 400040(%rsp)\n\tcmpl\t$2, %esi\n\tje\t.L18\n\tmovl\t$3, %eax\n\tjmp\t.L15\n.L9:\n\tcmpl\t$3, %esi\n\tjg\t.L30\n.L18:\n\tmovl\t$1, %r8d\n\tleaq\t16(%rsp), %rcx\n\tjmp\t.L10\n.L30:\n\tleaq\t400040(%rsp), %rdi\n\tjmp\t.L14\n.L29:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC2:\n\t.long\t1073741824\n\t.long\t1073741824\n\t.long\t1073741824\n\t.long\t1073741824\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 int sup = 1 << 30;\n\tint dp[100002];\n\tfor (i = 2, dp[1] = 0; i <= N; i++) dp[i] = sup;\n\tfor (i = 1; i < N; i++) {\n\t\tif (dp[i] + abs(h[i+1] - h[i]) < dp[i+1]) dp[i+1] = dp[i] + abs(h[i+1] - h[i]);\n\t\tif (dp[i] + abs(h[i+2] - h[i]) < dp[i+2]) dp[i+2] = dp[i] + abs(h[i+2] - h[i]);\n\t}\n\tprintf(\"%d\\n\", dp[N]);\n\tfflush(stdout);\n\treturn 0;\n}", "index": 94, "inputs": [ "6\n30 10 60 10 60 57\n", "4\n10 14 40 20\n", "2\n18 10\n", "4\n5 14 40 20\n", "2\n33 10\n", "6\n30 12 60 10 60 9\n", "2\n9 10\n", "6\n30 12 60 17 60 9\n", "2\n9 18\n", "6\n30 12 60 33 60 9\n", "6\n30 12 60 33 60 18\n", "2\n9 5\n", "6\n30 12 21 33 60 18\n", "2\n11 5\n", "6\n30 0 26 33 60 18\n", "4\n10 11 1 12\n", "6\n30 0 26 33 122 14\n", "2\n14 2\n", "6\n2 0 26 33 122 14\n", "4\n12 11 1 24\n", "2\n14 3\n", "4\n17 11 1 24\n", "2\n18 2\n", "2\n31 2\n", "2\n44 1\n", "2\n62 1\n", "6\n2 0 18 50 65 14\n", "2\n112 1\n", "2\n39 1\n", "6\n2 0 26 92 65 14\n", "2\n6 1\n", "6\n2 0 26 92 52 14\n", "6\n3 0 26 92 52 14\n", "2\n5 2\n", "4\n29 7 0 1\n", "2\n2 2\n", "6\n3 0 1 92 52 14\n", "4\n29 7 0 2\n", "6\n3 0 1 92 52 26\n", "6\n3 0 1 45 52 26\n", "6\n3 0 1 45 52 10\n", "2\n7 0\n", "6\n0 0 1 45 52 10\n", "2\n12 -1\n", "4\n43 11 -2 2\n", "2\n47 -1\n", "4\n34 11 -4 0\n", "4\n34 11 -4 -1\n", "6\n2 -2 0 4 49 15\n", "6\n2 -2 0 4 65 18\n", "6\n2 -2 1 4 65 18\n", "6\n0 -1 1 11 65 -2\n", "4\n-1 -1 -2 24\n", "4\n0 -1 -2 43\n", "4\n0 -4 2 22\n", "2\n-51 0\n", "2\n-48 -1\n", "2\n-48 -2\n", "2\n-48 1\n", "6\n30 10 99 10 60 50\n", "2\n50 10\n", "4\n9 77 54 37\n", "4\n2 77 54 37\n", "4\n2 77 54 23\n", "4\n2 77 54 13\n", "4\n2 77 98 13\n", "6\n30 10 35 18 154 1\n", "4\n2 77 45 13\n", "4\n2 91 52 13\n", "4\n2 91 71 13\n", "4\n2 91 105 13\n", "4\n2 91 105 15\n", "4\n2 91 105 14\n", "4\n4 91 105 14\n", "4\n4 91 105 28\n", "4\n4 146 105 28\n", "4\n8 146 105 28\n", "4\n8 146 162 28\n", "4\n8 289 2 28\n", "4\n30 283 0 7\n", "4\n39 283 1 7\n", "2\n-2 55\n", "2\n-3 55\n", "4\n0 0 -1 -68\n", "4\n0 0 -1 -101\n", "4\n1 0 0 -101\n", "4\n1 -1 2 -156\n", "4\n0 -1 2 -156\n", "4\n0 -1 2 -258\n", "4\n0 -1 2 -52\n", "4\n-1 1 2 -52\n", "4\n-2 1 2 -52\n", "4\n-2 0 2 -92\n", "4\n0 0 2 -92\n", "4\n1 0 2 -66\n", "4\n1 0 2 -77\n", "4\n0 1 2 -111\n", "2\n-1 169\n", "2\n-2 169\n", "2\n-2 255\n", "6\n30 10 60 10 60 50\n", "4\n10 30 40 20\n", "2\n10 10\n", "4\n10 30 40 20\n" ], "outputs": [ "33\n", "10\n", "8\n", "15\n", "23\n", "21\n", "1\n", "31\n", "9\n", "63\n", "54\n", "4\n", "36\n", "6\n", "26\n", "2\n", "30\n", "12\n", "50\n", "14\n", "11\n", "19\n", "16\n", "29\n", "43\n", "61\n", "84\n", "111\n", "38\n", "114\n", "5\n", "88\n", "87\n", "3\n", "28\n", "0\n", "91\n", "27\n", "79\n", "65\n", "81\n", "7\n", "80\n", "13\n", "41\n", "48\n", "34\n", "35\n", "17\n", "20\n", "18\n", "24\n", "25\n", "45\n", "22\n", "51\n", "47\n", "46\n", "49\n", "60\n", "40\n", "62\n", "69\n", "83\n", "93\n", "139\n", "39\n", "75\n", "89\n", "127\n", "167\n", "165\n", "166\n", "164\n", "150\n", "178\n", "174\n", "256\n", "32\n", "37\n", "44\n", "57\n", "58\n", "68\n", "101\n", "102\n", "157\n", "156\n", "258\n", "52\n", "55\n", "56\n", "94\n", "92\n", "67\n", "78\n", "113\n", "170\n", "171\n", "257\n", "40\n", "30\n", "0\n", "30\n" ], "question": "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 int sup = 1 << 30;\n\tint dp[100002];\n\tfor (i = 2, dp[1] = 0; i <= N; i++) dp[i] = sup;\n\tfor (i = 1; i < N; i++) {\n\t\tif (dp[i] + abs(h[i+1] - h[i]) < dp[i+1]) dp[i+1] = dp[i] + abs(h[i+1] - h[i]);\n\t\tif (dp[i] + abs(h[i+2] - h[i]) < dp[i+2]) dp[i+2] = dp[i] + abs(h[i+2] - h[i]);\n\t}\n\tprintf(\"%d\\n\", dp[N]);\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-798720(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$1328, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-800044(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -800040(%rbp)\n\tjmp\t.L2\n.L3:\n\tleaq\t-800032(%rbp), %rdx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -800040(%rbp)\n.L2:\n\tmovl\t-800044(%rbp), %eax\n\tcmpl\t%eax, -800040(%rbp)\n\tjle\t.L3\n\tmovl\t$1073741824, -800036(%rbp)\n\tmovl\t$2, -800040(%rbp)\n\tmovl\t$0, -400012(%rbp)\n\tjmp\t.L4\n.L5:\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800036(%rbp), %edx\n\tmovl\t%edx, -400016(%rbp,%rax,4)\n\taddl\t$1, -800040(%rbp)\n.L4:\n\tmovl\t-800044(%rbp), %eax\n\tcmpl\t%eax, -800040(%rbp)\n\tjle\t.L5\n\tmovl\t$1, -800040(%rbp)\n\tjmp\t.L6\n.L9:\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovns\t%edx, %eax\n\tleal\t(%rcx,%rax), %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L7\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovs\t%eax, %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$1, %eax\n\taddl\t%ecx, %edx\n\tcltq\n\tmovl\t%edx, -400016(%rbp,%rax,4)\n.L7:\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovns\t%edx, %eax\n\tleal\t(%rcx,%rax), %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %eax\n\tcmpl\t%eax, %edx\n\tjge\t.L8\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %ecx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovl\t-800040(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %esi\n\tmovl\t%edx, %eax\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %edx\n\tnegl\t%edx\n\tcmovs\t%eax, %edx\n\tmovl\t-800040(%rbp), %eax\n\taddl\t$2, %eax\n\taddl\t%ecx, %edx\n\tcltq\n\tmovl\t%edx, -400016(%rbp,%rax,4)\n.L8:\n\taddl\t$1, -800040(%rbp)\n.L6:\n\tmovl\t-800044(%rbp), %eax\n\tcmpl\t%eax, -800040(%rbp)\n\tjl\t.L9\n\tmovl\t-800044(%rbp), %eax\n\tcltq\n\tmovl\t-400016(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 = 2, dp[1] = 0; i <= N; i++) dp[i] = sup; for (i = 1; i < N; i++) { if (dp[i] + abs(h[i+1] - h[i]) < dp[i+1]) dp[i+1] = dp[i] + abs(h[i+1] - h[i]); if (dp[i] + abs(h[i+2] - h[i]) < dp[i+2]) dp[i+2] = dp[i] + abs(h[i+2] - h[i]); } printf("%d\n", dp[N]); fflush(stdout); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -798720(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $1328, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -800044(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -800040(%rbp) jmp .L2 .L3: leaq -800032(%rbp), %rdx movl -800040(%rbp), %eax cltq salq $2, %rax addq %rdx, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -800040(%rbp) .L2: movl -800044(%rbp), %eax cmpl %eax, -800040(%rbp) jle .L3 movl $1073741824, -800036(%rbp) movl $2, -800040(%rbp) movl $0, -400012(%rbp) jmp .L4 .L5: movl -800040(%rbp), %eax cltq movl -800036(%rbp), %edx movl %edx, -400016(%rbp,%rax,4) addl $1, -800040(%rbp) .L4: movl -800044(%rbp), %eax cmpl %eax, -800040(%rbp) jle .L5 movl $1, -800040(%rbp) jmp .L6 .L9: movl -800040(%rbp), %eax cltq movl -400016(%rbp,%rax,4), %ecx movl -800040(%rbp), %eax addl $1, %eax cltq movl -800032(%rbp,%rax,4), %edx movl -800040(%rbp), %eax cltq movl -800032(%rbp,%rax,4), %esi movl %edx, %eax subl %esi, %eax movl %eax, %edx negl %edx cmovns %edx, %eax leal (%rcx,%rax), %edx movl -800040(%rbp), %eax addl $1, %eax cltq movl -400016(%rbp,%rax,4), %eax cmpl %eax, %edx jge .L7 movl -800040(%rbp), %eax cltq movl -400016(%rbp,%rax,4), %ecx movl -800040(%rbp), %eax addl $1, %eax cltq movl -800032(%rbp,%rax,4), %edx movl -800040(%rbp), %eax cltq movl -800032(%rbp,%rax,4), %esi movl %edx, %eax subl %esi, %eax movl %eax, %edx negl %edx cmovs %eax, %edx movl -800040(%rbp), %eax addl $1, %eax addl %ecx, %edx cltq movl %edx, -400016(%rbp,%rax,4) .L7: movl -800040(%rbp), %eax cltq movl -400016(%rbp,%rax,4), %ecx movl -800040(%rbp), %eax addl $2, %eax cltq movl -800032(%rbp,%rax,4), %edx movl -800040(%rbp), %eax cltq movl -800032(%rbp,%rax,4), %esi movl %edx, %eax subl %esi, %eax movl %eax, %edx negl %edx cmovns %edx, %eax leal (%rcx,%rax), %edx movl -800040(%rbp), %eax addl $2, %eax cltq movl -400016(%rbp,%rax,4), %eax cmpl %eax, %edx jge .L8 movl -800040(%rbp), %eax cltq movl -400016(%rbp,%rax,4), %ecx movl -800040(%rbp), %eax addl $2, %eax cltq movl -800032(%rbp,%rax,4), %edx movl -800040(%rbp), %eax cltq movl -800032(%rbp,%rax,4), %esi movl %edx, %eax subl %esi, %eax movl %eax, %edx negl %edx cmovs %eax, %edx movl -800040(%rbp), %eax addl $2, %eax addl %ecx, %edx cltq movl %edx, -400016(%rbp,%rax,4) .L8: addl $1, -800040(%rbp) .L6: movl -800044(%rbp), %eax cmpl %eax, -800040(%rbp) jl .L9 movl -800044(%rbp), %eax cltq movl -400016(%rbp,%rax,4), %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L11 call __stack_chk_fail@PLT .L11: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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/*\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>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#include <time.h>\n\n#define BIG 2000000007\n#define VERYBIG 200000000000007LL\n\n#define MOD 1000000007\ntypedef uint64_t ull;\ntypedef int64_t sll;\n\n#define N_MAX 1000000\n#define M_MAX 200000\n\n#ifdef __cplusplus\n#include <queue>\n#include <stack>\n// #include <tuple>\n#include <set>\n#include <map>\n\n// using namespace std; // HELL\nusing std::queue;\nusing std::priority_queue;\nusing std::stack;\n// using std::tuple;\nusing std::set;\nusing std::map;\nusing std::vector;\nusing std::greater;\nusing std::pair;\n\n#endif\n\ntypedef struct {\n\tint32_t a;\n\tint32_t b;\n} hw;\n\ntypedef struct {\n\tsll a;\n\tsll b;\n} hwll;\n\ntypedef struct {\n\thwll a;\n\thwll b;\n} linell;\n\n\ntypedef struct {\n\tull s;\n\tull t;\n\tint32_t c;\n} struct_a;\n\ntypedef struct {\n\tint32_t from;\n\tint32_t to;\n\tsll cost;\n} struct_b;\n\n\n\nconst hw vector8[8] = {\n\t{-1, -1},\n\t{-1, 0},\n\t{-1, +1},\n\t{ 0, -1},\n\t{ 0, +1},\n\t{+1, -1},\n\t{+1, 0},\n\t{+1, +1}\n};\n\null n, m;\null h, w;\null k;\null q;\null vua, vub, vuc, vud, vue, vuf;\nsll vsa, vsb, vsc, vsd, vse, vsf;\nlong double vra, vrb, vrc;\ndouble vda, vdb, vdc;\nsize_t slen;\nsize_t tlen;\nchar ch, dh;\n\null umin (ull x, ull y) {\n\treturn (x < y) ? x : y;\n}\n\null umax (ull x, ull y) {\n\treturn (x > y) ? x : y;\n}\n\nsll smin (sll x, sll y) {\n\treturn (x < y) ? x : y;\n}\n\nsll smax (sll x, sll y) {\n\treturn (x > y) ? x : y;\n}\n\null gcd (ull x, ull y) {\n\tif (x < y) {\n\t\treturn gcd(y, x);\n\t} else if (y == 0) {\n\t\treturn x;\n\t} else {\n\t\treturn gcd(y, x % y);\n\t}\n}\n\null bitpow (ull a, ull x, ull modulo) {\n\tull result = 1;\n\twhile (x) {\n\t\tif (x & 1) {\n\t\t\tresult *= a;\n\t\t\tresult %= modulo;\n\t\t}\n\t\tx /= 2;\n\t\ta = (a * a) % modulo;\n\t}\n\treturn result;\n}\n\null divide (ull a, ull b, ull modulo) {\n\treturn (a * bitpow(b, modulo - 2, modulo)) % modulo;\n}\n\null udiff (ull a, ull b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nsll sdiff (sll a, sll b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nvoid printUquotient (ull left, ull right) {\n\tconst int32_t digits = 20;\n\n\tprintf(\"%llu.\", left / right);\n\tleft %= right;\n\tfor (int32_t i = 0; i < digits; i++) {\n\t\tleft *= 10;\n\t\tprintf(\"%1d\", left / right);\n\t\tleft %= right;\n\t}\n\tputs(\"\");\n\n\treturn;\n}\n\nvoid printSquotient (sll left, sll right) {\n\tif (left * right < 0) putchar('-');\n\tprintUquotient(sdiff(left, 0), sdiff(right, 0));\n\n\treturn;\n}\n\nint bitcount (ull n) {\n\tint result = 0;\n\twhile (n) {\n\t\tif (n & 1) result++;\n\t\tn /= 2;\n\t}\n\treturn result;\n}\n\n#ifdef __cplusplus\n\nbool setfind (set<ull> s, ull x) {\n\treturn (s.find(x) != s.end());\n}\n\n#endif\n\nsll dist[N_MAX];\nstruct_b path[M_MAX * 2];\n\n// ull a[N_MAX];\n// ull a[M_MAX];\nsll a[N_MAX];\n// ull a[N_MAX][N_MAX];\n// ull a[M_MAX][M_MAX];\n// sll a[N_MAX][N_MAX];\n// ull b[N_MAX];\n// ull b[M_MAX];\nsll b[N_MAX];\null c[N_MAX];\n// sll c[M_MAX];\n// char c[N_MAX];\nchar s[N_MAX + 1];\n// char s[N_MAX + 1][N_MAX + 1];\n// char s[N_MAX + 1][M_MAX + 1];\n// char t[N_MAX + 1];\n\null alphabets[26];\n// ull blphabets[26];\n// char alphabets[26];\n\null dp[N_MAX + 1];\n// sll dp[N_MAX + 1];\n// ull dp[N_MAX + 1][N_MAX + 1];\n// sll dp[N_MAX + 1][N_MAX + 1];\n// bool dp[N_MAX + 1];\n// bool dp[N_MAX + 1][N_MAX + 1];\n// bool dq[N_MAX];\nhwll arr[N_MAX + 1];\n// hwll arr[M_MAX];\nhwll brr[N_MAX];\n\n// sll dp[N_MAX + 1];\n// ull color[N_MAX];\n// set<sll> children[N_MAX];\n// set<sll> leaf[N_MAX];\n\n\n\ndouble distance (sll x1, sll y1, sll x2, sll y2) {\n\tdouble xdist2, ydist2, origindist, dist;\n\n\txdist2 = (x1 - x2) * (x1 - x2);\n\tydist2 = (y1 - y2) * (y1 - y2);\n\treturn sqrt(xdist2 + ydist2);\n}\n\nint32_t pullcomp (const void *left, const void *right) {\n\tull l = *(ull*)left;\n\tull r = *(ull*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t psllcomp (const void *left, const void *right) {\n\tull l = *(sll*)left;\n\tull r = *(sll*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t pcharcomp (const void *left, const void *right) {\n\tchar l = *(char*)left;\n\tchar r = *(char*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t pstrcomp (const void *left, const void *right) {\n\tchar* l = *(char**)left;\n\tchar* r = *(char**)right;\n\n\treturn strcmp(l, r);\n}\n\nint32_t phwllABcomp (const void *left, const void *right) {\n\thwll l = *(hwll*)left;\n\thwll r = *(hwll*)right;\n\tif (l.a < r.a) {\n\t\treturn -1;\n\t}\n\tif (l.a > r.a) {\n\t\treturn +1;\n\t}\n\tif (l.b < r.b) {\n\t\treturn -1;\n\t}\n\tif (l.b > r.b) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nbool isinrange (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right);\n}\n\null bitdp[2][1 << 20];\n\null mergeteq (ull a[], ull n) {\n\tull l = n / 2, r = n - l;\n\tif (n == 1) return 0;\n\tull ret = mergeteq(a, l) + mergeteq(a + l, r);\n\n\tull tmp[n];\n\tsll i = 0, j = 0;\n\twhile (i < l || j < r) {\n\t\tif (i == l) {\n\t\t\ttmp[i + j] = a[i + j];\n\t\t\tj++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (j == r) {\n\t\t\ttmp[i + j] = a[i];\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (a[i] > a[l + j]) {\n\t\t\ttmp[i + j] = a[l + j];\n\t\t\tret += l - i;\n\t\t\tj++;\n\t\t} else {\n\t\t\ttmp[i + j] = a[i];\n\t\t\ti++;\n\t\t}\n\t}\n\n\tfor (i = 0; i < n; i++) {\n\t\ta[i] = tmp[i];\n\t}\n\treturn ret;\n}\n\null solve () {\n\tsll i, j, ki, li;\n\tull result = 0;\n\t// sll result = 0;\n\t// double result = 0;\n\t// ull maybe = 0;\n\tsll maybe = 0;\n\t// ull sum = 0;\n\tsll sum = 0;\n\tull item;\n\tull *dpcell;\n\n\tull fuck = (1 << (vua + vub + vuc)) + (1 << (vub + vuc)) + (1 << vuc) + 1;\n\tull bitlen = (vua + vub + vuc + 1);\n\tull ablemask = (1 << bitlen) - 1;\n\n\tbitdp[0][1] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tull curri = (i & 1);\n\t\tull nexti = curri ^ 1;\n\n\t\tfor (j = 0; !(j >> bitlen); j++) {\n\t\t\tbitdp[nexti][j] = 0;\n\t\t}\n\n\t\tfor (j = 1; !(j >> bitlen); j++) {\n\t\t\tif (!bitdp[curri][j]) continue;\n\t\t\t\n\t\t\tfor (ki = 1; ki <= 10; ki++) {\n\t\t\t\tdpcell = &bitdp[nexti][((j << ki) & ablemask) + 1];\n\t\t\t\t*dpcell = (*dpcell + bitdp[curri][j]) % MOD;\n\t\t\t}\n\t\t}\n\n\t\tfor (j = 0; !(j >> bitlen); j++) {\n\t\t\tif ((j & fuck) == fuck) {\n\t\t\t\tbitdp[nexti][j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tresult = 0;\n\tfor (j = 0; !(j >> bitlen); j++) {\n\t\tresult = (result + bitdp[n & 1][j]) % MOD;\n\t}\n\n\tresult = (bitpow(10, n, MOD) + MOD - result) % MOD;\n\n\tprintf(\"%lld\\n\", result);\n\t// printf(\"%.12lf\\n\", (double)result);\n\t// puts(s);\n\n\treturn 0;\n\n\tsuccess:\n\tputs(\"YES\");\n\t// puts(\"Yes\");\n\t// printf(\"%llu\\n\", result);\n\t// puts(\"0\");\n\t// puts(\"First\");\n\treturn 0;\n\n\tfail:\n\t// puts(\"NO\");\n\t// puts(\"No\");\n\t// puts(\"0\");\n\tputs(\"-1\");\n\t// puts(\"-1 -1 -1\");\n\t// puts(\"Second\");\n\treturn 1;\n}\n\nint32_t main (void) {\n\tint32_t i, j;\n\tint32_t x, y;\n\n\t// scanf(\"%lf\", &vda, &vdb);\n\t// scanf(\"%lld%lld%lld%lld\", &vsa, &vsb, &vsc, &vsd);\n\t// scanf(\"%llu%llu\", &vua, &vub, &vuc, &vud);\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%*llu%*llu\");\n\tscanf(\"%llu\", &n, &m);\n\t// scanf(\"%llu\", &k, &n);\n\tscanf(\"%llu%llu%llu\", &vua, &vub, &vuc, &vud, &vue, &vuf);\n\t// scanf(\"%lld%lld\", &vsa, &vsb, &vsc);\n\t// scanf(\"%s\", s);\n\t// scanf(\"%s\", t);\n\t// scanf(\"%llu\", &m);\n\t// scanf(\"%llu\", &q);\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &b[i]);\n\t// \t// scanf(\"%llu\", &c[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// }\n\t// for (i = 0; i < m; i++) {\n\t// \tscanf(\"%lld\", &a[n + i]);\n\t// \tscanf(\"%lld\", &b[n + i]);\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%llu\", &b[i]);\n\t// }\n\t// for (i = 0; i < h; i++) {\n\t// \tfor (j = 0; j < w; j++) {\n\t// \t\tscanf(\"%llu\", &a[i][j]);\n\t// \t}\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%s\", &s[i]);\n\t// }\n\n\t// scanf(\"%llu\", &k);\n\t// scanf(\"%llu\", &q);\n\tsolve();\n\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tvector8\n\t.section\t.rodata\n\t.align 32\n\t.type\tvector8, @object\n\t.size\tvector8, 64\nvector8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.globl\tn\n\t.bss\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tvua\n\t.align 8\n\t.type\tvua, @object\n\t.size\tvua, 8\nvua:\n\t.zero\t8\n\t.globl\tvub\n\t.align 8\n\t.type\tvub, @object\n\t.size\tvub, 8\nvub:\n\t.zero\t8\n\t.globl\tvuc\n\t.align 8\n\t.type\tvuc, @object\n\t.size\tvuc, 8\nvuc:\n\t.zero\t8\n\t.globl\tvud\n\t.align 8\n\t.type\tvud, @object\n\t.size\tvud, 8\nvud:\n\t.zero\t8\n\t.globl\tvue\n\t.align 8\n\t.type\tvue, @object\n\t.size\tvue, 8\nvue:\n\t.zero\t8\n\t.globl\tvuf\n\t.align 8\n\t.type\tvuf, @object\n\t.size\tvuf, 8\nvuf:\n\t.zero\t8\n\t.globl\tvsa\n\t.align 8\n\t.type\tvsa, @object\n\t.size\tvsa, 8\nvsa:\n\t.zero\t8\n\t.globl\tvsb\n\t.align 8\n\t.type\tvsb, @object\n\t.size\tvsb, 8\nvsb:\n\t.zero\t8\n\t.globl\tvsc\n\t.align 8\n\t.type\tvsc, @object\n\t.size\tvsc, 8\nvsc:\n\t.zero\t8\n\t.globl\tvsd\n\t.align 8\n\t.type\tvsd, @object\n\t.size\tvsd, 8\nvsd:\n\t.zero\t8\n\t.globl\tvse\n\t.align 8\n\t.type\tvse, @object\n\t.size\tvse, 8\nvse:\n\t.zero\t8\n\t.globl\tvsf\n\t.align 8\n\t.type\tvsf, @object\n\t.size\tvsf, 8\nvsf:\n\t.zero\t8\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tslen\n\t.align 8\n\t.type\tslen, @object\n\t.size\tslen, 8\nslen:\n\t.zero\t8\n\t.globl\ttlen\n\t.align 8\n\t.type\ttlen, @object\n\t.size\ttlen, 8\ntlen:\n\t.zero\t8\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.text\n\t.globl\tumin\n\t.type\tumin, @function\numin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovbe\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tumin, .-umin\n\t.globl\tumax\n\t.type\tumax, @function\numax:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovnb\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tumax, .-umax\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsmin, .-smin\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovge\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tsmax, .-smax\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjnb\t.L10\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tgcd\n\tjmp\t.L11\n.L10:\n\tcmpq\t$0, -16(%rbp)\n\tjne\t.L12\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L11\n.L12:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tgcd\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tgcd, .-gcd\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tjmp\t.L14\n.L16:\n\tmovq\t-32(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L15\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n.L15:\n\tmovq\t-32(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n.L14:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L16\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tbitpow, .-bitpow\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-2(%rax), %rcx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tbitpow\n\timulq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-24(%rbp)\n\tmovq\t%rdx, %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tdivide, .-divide\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjb\t.L21\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L22\n.L21:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L22:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tudiff, .-udiff\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjl\t.L24\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L25\n.L24:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L25:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tsdiff, .-sdiff\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%llu.\"\n.LC1:\n\t.string\t\"%1d\"\n.LC2:\n\t.string\t\"\"\n\t.text\n\t.globl\tprintUquotient\n\t.type\tprintUquotient, @function\nprintUquotient:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t$20, -4(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L27\n.L28:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\taddl\t$1, -8(%rbp)\n.L27:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjl\t.L28\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tprintUquotient, .-printUquotient\n\t.globl\tprintSquotient\n\t.type\tprintSquotient, @function\nprintSquotient:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t-32(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjns\t.L31\n\tmovl\t$45, %edi\n\tcall\tputchar@PLT\n.L31:\n\tmovq\t-32(%rbp), %rax\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsdiff\n\tmovq\t%rax, %rbx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsdiff\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tprintUquotient\n\tnop\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tprintSquotient, .-printSquotient\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L34\n.L36:\n\tmovq\t-24(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L35\n\taddl\t$1, -4(%rbp)\n.L35:\n\tmovq\t-24(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -24(%rbp)\n.L34:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L36\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tbitcount, .-bitcount\n\t.globl\tdist\n\t.bss\n\t.align 32\n\t.type\tdist, @object\n\t.size\tdist, 8000000\ndist:\n\t.zero\t8000000\n\t.globl\tpath\n\t.align 32\n\t.type\tpath, @object\n\t.size\tpath, 6400000\npath:\n\t.zero\t6400000\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8000000\na:\n\t.zero\t8000000\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8000000\nb:\n\t.zero\t8000000\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8000000\nc:\n\t.zero\t8000000\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 1000001\ns:\n\t.zero\t1000001\n\t.globl\talphabets\n\t.align 32\n\t.type\talphabets, @object\n\t.size\talphabets, 208\nalphabets:\n\t.zero\t208\n\t.globl\tdp\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 8000008\ndp:\n\t.zero\t8000008\n\t.globl\tarr\n\t.align 32\n\t.type\tarr, @object\n\t.size\tarr, 16000016\narr:\n\t.zero\t16000016\n\t.globl\tbrr\n\t.align 32\n\t.type\tbrr, @object\n\t.size\tbrr, 16000000\nbrr:\n\t.zero\t16000000\n\t.text\n\t.globl\tdistance\n\t.type\tdistance, @function\ndistance:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t%rcx, -48(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tsubq\t-40(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tsubq\t-40(%rbp), %rax\n\timulq\t%rdx, %rax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdq\t%rax, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tsubq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsubq\t-48(%rbp), %rax\n\timulq\t%rdx, %rax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdq\t%rax, %xmm0\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t-16(%rbp), %xmm0\n\taddsd\t-8(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsqrt@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tdistance, .-distance\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjnb\t.L41\n\tmovl\t$-1, %eax\n\tjmp\t.L42\n.L41:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjbe\t.L43\n\tmovl\t$1, %eax\n\tjmp\t.L42\n.L43:\n\tmovl\t$0, %eax\n.L42:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tpullcomp, .-pullcomp\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjnb\t.L45\n\tmovl\t$-1, %eax\n\tjmp\t.L46\n.L45:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjbe\t.L47\n\tmovl\t$1, %eax\n\tjmp\t.L46\n.L47:\n\tmovl\t$0, %eax\n.L46:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tpsllcomp, .-psllcomp\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -2(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -1(%rbp)\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjge\t.L49\n\tmovl\t$-1, %eax\n\tjmp\t.L50\n.L49:\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjle\t.L51\n\tmovl\t$1, %eax\n\tjmp\t.L50\n.L51:\n\tmovl\t$0, %eax\n.L50:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tpcharcomp, .-pcharcomp\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tpstrcomp, .-pstrcomp\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L55\n\tmovl\t$-1, %eax\n\tjmp\t.L60\n.L55:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L57\n\tmovl\t$1, %eax\n\tjmp\t.L60\n.L57:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L58\n\tmovl\t$-1, %eax\n\tjmp\t.L60\n.L58:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L59\n\tmovl\t$1, %eax\n\tjmp\t.L60\n.L59:\n\tmovl\t$0, %eax\n.L60:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjg\t.L62\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjg\t.L62\n\tmovl\t$1, %eax\n\tjmp\t.L63\n.L62:\n\tmovl\t$0, %eax\n.L63:\n\tandl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tisinrange, .-isinrange\n\t.globl\tbitdp\n\t.bss\n\t.align 32\n\t.type\tbitdp, @object\n\t.size\tbitdp, 16777216\nbitdp:\n\t.zero\t16777216\n\t.text\n\t.globl\tmergeteq\n\t.type\tmergeteq, @function\nmergeteq:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$96, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 12, -40\n\t.cfi_offset 3, -48\n\tmovq\t%rdi, -104(%rbp)\n\tmovq\t%rsi, -112(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -40(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %r12\n\tmovq\t-112(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-112(%rbp), %rax\n\tsubq\t-72(%rbp), %rax\n\tmovq\t%rax, -64(%rbp)\n\tcmpq\t$1, -112(%rbp)\n\tjne\t.L66\n\tmovl\t$0, %eax\n\tjmp\t.L67\n.L66:\n\tmovq\t-72(%rbp), %rdx\n\tmovq\t-104(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmergeteq\n\tmovq\t%rax, %rbx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\tmergeteq\n\taddq\t%rbx, %rax\n\tmovq\t%rax, -96(%rbp)\n\tmovq\t-112(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t%rax, -128(%rbp)\n\tmovq\t$0, -120(%rbp)\n\tmovq\t%rax, %r14\n\tmovl\t$0, %r15d\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %ebx\n\tmovl\t$0, %edx\n\tdivq\t%rbx\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L68:\n\tcmpq\t%rdx, %rsp\n\tje\t.L69\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L68\n.L69:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L70\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L70:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t$0, -80(%rbp)\n\tjmp\t.L71\n.L75:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -88(%rbp)\n\tjne\t.L72\n\tmovq\t-88(%rbp), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$1, -80(%rbp)\n\tjmp\t.L71\n.L72:\n\tmovq\t-64(%rbp), %rax\n\tcmpq\t%rax, -80(%rbp)\n\tjne\t.L73\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$1, -88(%rbp)\n\tjmp\t.L71\n.L73:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t-72(%rbp), %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjbe\t.L74\n\tmovq\t-80(%rbp), %rdx\n\tmovq\t-72(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\tmovq\t-88(%rbp), %rdx\n\tmovq\t-72(%rbp), %rax\n\tsubq\t%rdx, %rax\n\taddq\t%rax, -96(%rbp)\n\taddq\t$1, -80(%rbp)\n\tjmp\t.L71\n.L74:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$1, -88(%rbp)\n.L71:\n\tmovq\t-88(%rbp), %rax\n\tcmpq\t%rax, -72(%rbp)\n\tja\t.L75\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tja\t.L75\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L76\n.L77:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t-88(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tmovq\t%rax, (%rcx)\n\taddq\t$1, -88(%rbp)\n.L76:\n\tmovq\t-88(%rbp), %rax\n\tcmpq\t%rax, -112(%rbp)\n\tja\t.L77\n\tmovq\t-96(%rbp), %rax\n.L67:\n\tmovq\t%r12, %rsp\n\tmovq\t-40(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L79\n\tcall\t__stack_chk_fail@PLT\n.L79:\n\tleaq\t-32(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tmergeteq, .-mergeteq\n\t.section\t.rodata\n.LC3:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tmovq\t$0, -56(%rbp)\n\tmovq\tvua(%rip), %rax\n\tmovl\t%eax, %edx\n\tmovq\tvub(%rip), %rax\n\taddl\t%eax, %edx\n\tmovq\tvuc(%rip), %rax\n\taddl\t%edx, %eax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovq\tvub(%rip), %rax\n\tmovl\t%eax, %ecx\n\tmovq\tvuc(%rip), %rax\n\taddl\t%ecx, %eax\n\tmovl\t$1, %esi\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %esi\n\tmovl\t%esi, %eax\n\taddl\t%eax, %edx\n\tmovq\tvuc(%rip), %rax\n\tmovl\t$1, %esi\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %esi\n\tmovl\t%esi, %eax\n\taddl\t%edx, %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovq\t%rax, -48(%rbp)\n\tmovq\tvua(%rip), %rdx\n\tmovq\tvub(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovq\tvuc(%rip), %rax\n\taddq\t%rdx, %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t$1, 8+bitdp(%rip)\n\tmovq\t$0, -96(%rbp)\n\tjmp\t.L81\n.L93:\n\tmovq\t-96(%rbp), %rax\n\tandl\t$1, %eax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\txorq\t$1, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L82\n.L83:\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t$0, (%rdx,%rax)\n\taddq\t$1, -88(%rbp)\n.L82:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L83\n\tmovq\t$1, -88(%rbp)\n\tjmp\t.L84\n.L89:\n\tmovq\t-24(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\ttestq\t%rax, %rax\n\tje\t.L97\n\tmovq\t$1, -80(%rbp)\n\tjmp\t.L87\n.L88:\n\tmovq\t-80(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsalq\t%cl, %rax\n\tandq\t-32(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$20, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-24(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$29, %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n\taddq\t$1, -80(%rbp)\n.L87:\n\tcmpq\t$10, -80(%rbp)\n\tjle\t.L88\n\tjmp\t.L86\n.L97:\n\tnop\n.L86:\n\taddq\t$1, -88(%rbp)\n.L84:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L89\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L90\n.L92:\n\tmovq\t-88(%rbp), %rax\n\tandq\t-48(%rbp), %rax\n\tcmpq\t%rax, -48(%rbp)\n\tjne\t.L91\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t$0, (%rdx,%rax)\n.L91:\n\taddq\t$1, -88(%rbp)\n.L90:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L92\n\taddq\t$1, -96(%rbp)\n.L81:\n\tmovq\t-96(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L93\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L94\n.L95:\n\tmovq\tn(%rip), %rax\n\tandl\t$1, %eax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$29, %rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -72(%rbp)\n\taddq\t$1, -88(%rbp)\n.L94:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L95\n\tmovq\tn(%rip), %rax\n\tmovl\t$1000000007, %edx\n\tmovq\t%rax, %rsi\n\tmovl\t$10, %edi\n\tcall\tbitpow\n\tsubq\t-72(%rbp), %rax\n\tleaq\t1000000007(%rax), %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$29, %rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tsolve, .-solve\n\t.section\t.rodata\n.LC4:\n\t.string\t\"%llu\"\n.LC5:\n\t.string\t\"%llu%llu%llu\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\tm(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tsubq\t$8, %rsp\n\tleaq\tvuf(%rip), %rax\n\tpushq\t%rax\n\tleaq\tvue(%rip), %r9\n\tleaq\tvud(%rip), %r8\n\tleaq\tvuc(%rip), %rax\n\tmovq\t%rax, %rcx\n\tleaq\tvub(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tvua(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC5(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$16, %rsp\n\tmovl\t$0, %eax\n\tcall\tsolve\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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, @function\numax:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovnb\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tumax, .-umax\n\t.p2align 4\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovle\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tsmin, .-smin\n\t.p2align 4\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovge\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tsmax, .-smax\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\txorl\t%edx, %edx\n\tdivq\t%rsi\n.L8:\n\tmovq\t%rdx, %rax\n\tmovq\t%rsi, %rdx\n\tmovq\t%rax, %rsi\n.L7:\n\tcmpq\t%rsi, %rdx\n\tjb\t.L8\n\tmovq\t%rdx, %rax\n\ttestq\t%rsi, %rsi\n\tjne\t.L11\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovl\t$1, %r8d\n\ttestq\t%rsi, %rsi\n\tje\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\ttestb\t$1, %sil\n\tje\t.L14\n\tmovq\t%r8, %rax\n\txorl\t%edx, %edx\n\timulq\t%rdi, %rax\n\tdivq\t%rcx\n\tmovq\t%rdx, %r8\n.L14:\n\timulq\t%rdi, %rdi\n\txorl\t%edx, %edx\n\tmovq\t%rdi, %rax\n\tdivq\t%rcx\n\tshrq\t%rsi\n\tmovq\t%rdx, %rdi\n\tjne\t.L15\n.L12:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tbitpow, .-bitpow\n\t.p2align 4\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovq\t%rdx, %r8\n\tsubq\t$2, %rcx\n\tje\t.L22\n\tmovl\t$1, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\ttestb\t$1, %cl\n\tje\t.L23\n\tmovq\t%r9, %rax\n\txorl\t%edx, %edx\n\timulq\t%rsi, %rax\n\tdivq\t%r8\n\tmovq\t%rdx, %r9\n.L23:\n\timulq\t%rsi, %rsi\n\txorl\t%edx, %edx\n\tmovq\t%rsi, %rax\n\tdivq\t%r8\n\tshrq\t%rcx\n\tmovq\t%rdx, %rsi\n\tjne\t.L24\n\timulq\t%r9, %rdi\n.L22:\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\tdivq\t%r8\n\tmovq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tdivide, .-divide\n\t.p2align 4\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovnb\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tudiff, .-udiff\n\t.p2align 4\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovge\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tsdiff, .-sdiff\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%llu.\"\n.LC1:\n\t.string\t\"%1d\"\n.LC2:\n\t.string\t\"\"\n\t.text\n\t.p2align 4\n\t.globl\tprintUquotient\n\t.type\tprintUquotient, @function\nprintUquotient:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t$1, %edi\n\tdivq\t%rsi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rsi, %rbp\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rsi\n\tleaq\t.LC1(%rip), %r12\n\tmovq\t%rdx, %rbx\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%rbx, %rdx\n\tmovl\t$20, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tleaq\t(%rdx,%rdx,4), %rax\n\txorl\t%edx, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\taddq\t%rax, %rax\n\tdivq\t%rbp\n\tmovq\t%rdx, %r13\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%r13, %rdx\n\tsubl\t$1, %ebx\n\tjne\t.L39\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 40\n\tleaq\t.LC2(%rip), %rdi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tjmp\tputs@PLT\n\t.cfi_endproc\n.LFE60:\n\t.size\tprintUquotient, .-printUquotient\n\t.p2align 4\n\t.globl\tprintSquotient\n\t.type\tprintSquotient, @function\nprintSquotient:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\timulq\t%rsi, %rax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%rsi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rdi, %rbx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\ttestq\t%rax, %rax\n\tjs\t.L47\n.L43:\n\tmovq\t%r12, %rbp\n\tmovq\t%rbx, %rax\n\tmovl\t$1, %edi\n\tnegq\t%rbp\n\tleaq\t.LC0(%rip), %rsi\n\tcmovs\t%r12, %rbp\n\tnegq\t%rax\n\tleaq\t.LC1(%rip), %r12\n\tcmovs\t%rbx, %rax\n\txorl\t%edx, %edx\n\tdivq\t%rbp\n\tmovq\t%rdx, %rbx\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%rbx, %rdx\n\tmovl\t$20, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L44:\n\tleaq\t(%rdx,%rdx,4), %rax\n\txorl\t%edx, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\taddq\t%rax, %rax\n\tdivq\t%rbp\n\tmovq\t%rdx, %r13\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%r13, %rdx\n\tsubl\t$1, %ebx\n\tjne\t.L44\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tleaq\t.LC2(%rip), %rdi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tjmp\tputs@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\t.cfi_restore_state\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$45, %edi\n\tcall\tputc@PLT\n\tjmp\t.L43\n\t.cfi_endproc\n.LFE61:\n\t.size\tprintSquotient, .-printSquotient\n\t.p2align 4\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L52\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovq\t%rdi, %rdx\n\tandl\t$1, %edx\n\taddl\t%edx, %eax\n\tshrq\t%rdi\n\tjne\t.L51\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L52:\n\tret\n\t.cfi_endproc\n.LFE62:\n\t.size\tbitcount, .-bitcount\n\t.p2align 4\n\t.globl\tdistance\n\t.type\tdistance, @function\ndistance:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t%rdx, %rdi\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tsubq\t%rcx, %rsi\n\timulq\t%rdi, %rdi\n\timulq\t%rsi, %rsi\n\tcvtsi2sdq\t%rdi, %xmm0\n\tcvtsi2sdq\t%rsi, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tucomisd\t%xmm0, %xmm1\n\tja\t.L64\n\tsqrtsd\t%xmm0, %xmm0\n\tret\n.L64:\n\tjmp\tsqrt@PLT\n\t.cfi_endproc\n.LFE63:\n\t.size\tdistance, .-distance\n\t.p2align 4\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tseta\t%al\n\tmovzbl\t%al, %eax\n\tcmovb\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tpullcomp, .-pullcomp\n\t.p2align 4\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB65:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tseta\t%al\n\tmovzbl\t%al, %eax\n\tcmovb\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE65:\n\t.size\tpsllcomp, .-psllcomp\n\t.p2align 4\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %eax\n\tcmpb\t%al, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE66:\n\t.size\tpcharcomp, .-pcharcomp\n\t.p2align 4\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rsi\n\tmovq\t(%rdi), %rdi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE67:\n\t.size\tpstrcomp, .-pstrcomp\n\t.p2align 4\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L75\n\tmovl\t$1, %eax\n\tjg\t.L75\n\tmovq\t8(%rsi), %rax\n\tcmpq\t%rax, 8(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L75:\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.p2align 4\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tsetle\t%al\n\tcmpq\t%rdx, %rsi\n\tsetle\t%dl\n\tandl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tisinrange, .-isinrange\n\t.section\t.text.unlikely,\"ax\",@progbits\n.LCOLDB4:\n\t.text\n.LHOTB4:\n\t.p2align 4\n\t.globl\tmergeteq\n\t.type\tmergeteq, @function\nmergeteq:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\txorl\t%r13d, %r13d\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcmpq\t$1, %rsi\n\tje\t.L81\n\tmovq\t%rsi, %rbx\n\tmovq\t%rsi, %r14\n\tmovq\t%rdi, %r12\n\tmovq\t%rsi, %r15\n\tshrq\t%rbx\n\tmovq\t%rbx, %rsi\n\tsubq\t%rbx, %r14\n\tcall\tmergeteq\n\tleaq\t(%r12,%rbx,8), %rdi\n\tmovq\t%r14, %rsi\n\tmovq\t%rax, %r13\n\tcall\tmergeteq\n\tleaq\t0(,%r15,8), %r8\n\tmovq\t%rsp, %rcx\n\taddq\t%rax, %r13\n\tleaq\t15(%r8), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rcx\n\tandq\t$-16, %rdx\n\tcmpq\t%rcx, %rsp\n\tje\t.L84\n.L110:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L110\n.L84:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tje\t.L85\n\torq\t$0, -8(%rsp,%rdx)\n.L85:\n\tmovq\t%rbx, %rax\n\tmovq\t%rsp, %rsi\n\torq\t%r14, %rax\n\tje\t.L81\n\txorl\t%eax, %eax\n\txorl\t%edx, %edx\n\txorl\t%ecx, %ecx\n\txorl\t%r10d, %r10d\n.L103:\n\tleaq\t(%rdx,%rax), %r9\n\tcmpq\t%rdx, %rbx\n\tje\t.L111\n.L86:\n\tmovq\t(%r12,%r10,8), %rdi\n\tcmpq\t%rax, %r14\n\tje\t.L91\n\taddq\t%rbx, %rcx\n\tmovq\t(%r12,%rcx,8), %rcx\n\tcmpq\t%rdi, %rcx\n\tjnb\t.L91\n\taddq\t%rbx, %r13\n\taddq\t$1, %rax\n\tmovq\t%rcx, %rdi\n\tsubq\t%r10, %r13\n.L90:\n\tmovq\t%rdi, (%rsi,%r9,8)\n\tmovq\t%rdx, %r10\n\tmovq\t%rax, %rcx\n\tcmpq\t%r14, %rax\n\tjb\t.L103\n\tcmpq\t%rdx, %rbx\n\tjbe\t.L88\n\tleaq\t(%rdx,%rax), %r9\n\tcmpq\t%rdx, %rbx\n\tjne\t.L86\n.L111:\n\tmovq\t(%r12,%r9,8), %rdx\n\taddq\t$1, %rax\n\tmovq\t%rdx, (%rsi,%r9,8)\n\tcmpq\t%r14, %rax\n\tjb\t.L112\n.L88:\n\ttestq\t%r15, %r15\n\tje\t.L81\n\tmovq\t%r8, %rdx\n\tmovq\t%r12, %rdi\n\tcall\tmemcpy@PLT\n.L81:\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L113\n\tleaq\t-40(%rbp), %rsp\n\tmovq\t%r13, %rax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\t.cfi_restore_state\n\taddq\t$1, %rdx\n\tjmp\t.L90\n\t.p2align 4,,10\n\t.p2align 3\n.L112:\n\tjmp\t.L87\n.L113:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n\t.section\t.text.unlikely\n\t.cfi_startproc\n\t.type\tmergeteq.cold, @function\nmergeteq.cold:\n.LFSB70:\n.L87:\n\t.cfi_def_cfa 6, 16\n\t.cfi_offset 3, -56\n\t.cfi_offset 6, -16\n\t.cfi_offset 12, -48\n\t.cfi_offset 13, -40\n\t.cfi_offset 14, -32\n\t.cfi_offset 15, -24\n\tsalq\t$3, %rbx\n\tleaq\t(%r12,%rbx), %rdx\n\taddq\t%rsi, %rbx\n.L92:\n\tmovq\t(%rdx,%rax,8), %rcx\n\taddq\t$1, %rax\n\tmovq\t%rcx, -8(%rbx,%rax,8)\n\tcmpq\t%r14, %rax\n\tjnb\t.L88\n\tjmp\t.L92\n\t.cfi_endproc\n.LFE70:\n\t.text\n\t.size\tmergeteq, .-mergeteq\n\t.section\t.text.unlikely\n\t.size\tmergeteq.cold, .-mergeteq.cold\n.LCOLDE4:\n\t.text\n.LHOTE4:\n\t.section\t.rodata.str1.1\n.LC5:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.p2align 4\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t$1, %eax\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tmovl\t%eax, %edi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovl\t%eax, %ebx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\tvub(%rip), %rsi\n\tmovq\tvua(%rip), %r8\n\tmovq\t$1, 8+bitdp(%rip)\n\tmovq\tvuc(%rip), %rdx\n\tmovq\tn(%rip), %r13\n\tleal\t(%rsi,%r8), %ecx\n\taddl\t%edx, %ecx\n\tsall\t%cl, %edi\n\tleal\t(%rdx,%rsi), %ecx\n\tsall\t%cl, %ebx\n\tmovl\t%edx, %ecx\n\taddl\t%ebx, %edi\n\tmovl\t%eax, %ebx\n\tsall\t%cl, %ebx\n\tleaq\t1(%r8,%rsi), %rcx\n\taddq\t%rdx, %rcx\n\tleal\t1(%rdi,%rbx), %ebp\n\tsall\t%cl, %eax\n\tmovl\t%ecx, %ebx\n\tleal\t-1(%rax), %r10d\n\tmovl\t$1, %eax\n\tsarq\t%cl, %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestq\t%r13, %r13\n\tje\t.L128\n\tmovslq\t%ebp, %rbp\n\tmovslq\t%r10d, %r10\n\txorl\t%r14d, %r14d\n\tmovq\t%r13, %r15\n\tleaq\tbitdp(%rip), %rsi\n\tmovabsq\t$-8543223828751151131, %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L123:\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\tandl\t$1, %edi\n\tmovq\t%rdi, %r9\n\txorq\t$1, %r9\n\tmovq\t%r9, %r13\n\tsalq\t$23, %r13\n\taddq\t%rsi, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L116:\n\tmovq\t$0, 0(%r13,%rax,8)\n\taddq\t$1, %rax\n\tmovq\t%rax, %rdx\n\tsarq\t%cl, %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L116\n\tcmpq\t$0, 8(%rsp)\n\tjne\t.L121\n\tsalq\t$23, %rdi\n\tsalq\t$20, %r9\n\tleaq\t8(%rsi,%rdi), %r8\n\tmovl\t$1, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L120:\n\tmovq\t(%r8), %rbx\n\ttestq\t%rbx, %rbx\n\tje\t.L119\n\tleaq\t(%rdi,%rdi), %rax\n\tandq\t%r10, %rax\n\tleaq\t1(%rax,%r9), %r12\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tleaq\t0(,%rdi,4), %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tleaq\t0(,%rdi,8), %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$4, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$5, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tsalq\t$6, %rax\n\tandq\t%r10, %rax\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tmovq\t(%r8), %rbx\n\tleaq\t1(%rax,%r9), %r12\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$7, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$8, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$9, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$10, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n.L119:\n\taddq\t$1, %rdi\n\taddq\t$8, %r8\n\tmovq\t%rdi, %rax\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L120\n.L121:\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L118:\n\tmovq\t%rbp, %rdx\n\tandq\t%rax, %rdx\n\tcmpq\t%rbp, %rdx\n\tjne\t.L122\n\tmovq\t$0, 0(%r13,%rax,8)\n.L122:\n\taddq\t$1, %rax\n\tmovq\t%rax, %rdx\n\tsarq\t%cl, %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L118\n\taddq\t$1, %r14\n\tcmpq\t%r15, %r14\n\tjne\t.L123\n\tmovq\t%r15, %rax\n\tmovl\t%ecx, %ebx\n\tmovq\t%r15, %r13\n\tandl\t$1, %eax\n.L115:\n\tsalq\t$23, %rax\n\txorl\t%edi, %edi\n\txorl\t%r8d, %r8d\n\tmovl\t%ebx, %ecx\n\tmovabsq\t$-8543223828751151131, %r9\n\taddq\t%rax, %rsi\n\tmovq\t%rdi, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L124:\n\tmovq\t(%rsi,%r8,8), %rdi\n\taddq\t$1, %r8\n\taddq\t%rdx, %rdi\n\tmovq\t%rdi, %rax\n\tmulq\t%r9\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tsubq\t%rax, %rdi\n\tmovq\t%r8, %rax\n\tsarq\t%cl, %rax\n\tmovq\t%rdi, %rdx\n\ttestq\t%rax, %rax\n\tje\t.L124\n\tmovl\t$1, %esi\n\ttestq\t%r13, %r13\n\tje\t.L125\n\tmovabsq\t$-8543223828751151131, %r9\n\tmovl\t$10, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L127:\n\ttestb\t$1, %r13b\n\tje\t.L126\n\timulq\t%rcx, %rsi\n\tmovq\t%rsi, %rax\n\tmovq\t%rsi, %r8\n\tmulq\t%r9\n\tmovq\t%rdx, %rsi\n\tshrq\t$29, %rsi\n\timulq\t$1000000007, %rsi, %rax\n\tmovq\t%r8, %rsi\n\tsubq\t%rax, %rsi\n.L126:\n\timulq\t%rcx, %rcx\n\tmovq\t%rcx, %rax\n\tmovq\t%rcx, %r8\n\tmulq\t%r9\n\tmovq\t%rdx, %rcx\n\tshrq\t$29, %rcx\n\timulq\t$1000000007, %rcx, %rax\n\tmovq\t%r8, %rcx\n\tsubq\t%rax, %rcx\n\tshrq\t%r13\n\tjne\t.L127\n.L125:\n\tmovabsq\t$-8543223828751151131, %rdx\n\tsubq\t%rdi, %rsi\n\tmovl\t$1, %edi\n\tleaq\t1000000007(%rsi), %rcx\n\tleaq\t.LC5(%rip), %rsi\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tsubq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tmovq\t%rcx, %rdx\n\tcall\t__printf_chk@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L128:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tleaq\tbitdp(%rip), %rsi\n\tjmp\t.L115\n\t.cfi_endproc\n.LFE71:\n\t.size\tsolve, .-solve\n\t.section\t.rodata.str1.1\n.LC6:\n\t.string\t\"%llu\"\n.LC7:\n\t.string\t\"%llu%llu%llu\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tleaq\tm(%rip), %rdx\n\tleaq\tn(%rip), %rsi\n\txorl\t%eax, %eax\n\tleaq\t.LC6(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 24\n\tleaq\tvuf(%rip), %rax\n\tleaq\tvue(%rip), %r9\n\tpushq\t%rax\n\t.cfi_def_cfa_offset 32\n\tleaq\tvud(%rip), %r8\n\txorl\t%eax, %eax\n\tleaq\tvuc(%rip), %rcx\n\tleaq\tvub(%rip), %rdx\n\tleaq\tvua(%rip), %rsi\n\tleaq\t.LC7(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\txorl\t%eax, %eax\n\tcall\tsolve\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tmain, .-main\n\t.globl\tbitdp\n\t.bss\n\t.align 32\n\t.type\tbitdp, @object\n\t.size\tbitdp, 16777216\nbitdp:\n\t.zero\t16777216\n\t.globl\tbrr\n\t.align 32\n\t.type\tbrr, @object\n\t.size\tbrr, 16000000\nbrr:\n\t.zero\t16000000\n\t.globl\tarr\n\t.align 32\n\t.type\tarr, @object\n\t.size\tarr, 16000016\narr:\n\t.zero\t16000016\n\t.globl\tdp\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 8000008\ndp:\n\t.zero\t8000008\n\t.globl\talphabets\n\t.align 32\n\t.type\talphabets, @object\n\t.size\talphabets, 208\nalphabets:\n\t.zero\t208\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 1000001\ns:\n\t.zero\t1000001\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8000000\nc:\n\t.zero\t8000000\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8000000\nb:\n\t.zero\t8000000\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8000000\na:\n\t.zero\t8000000\n\t.globl\tpath\n\t.align 32\n\t.type\tpath, @object\n\t.size\tpath, 6400000\npath:\n\t.zero\t6400000\n\t.globl\tdist\n\t.align 32\n\t.type\tdist, @object\n\t.size\tdist, 8000000\ndist:\n\t.zero\t8000000\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\ttlen\n\t.align 8\n\t.type\ttlen, @object\n\t.size\ttlen, 8\ntlen:\n\t.zero\t8\n\t.globl\tslen\n\t.align 8\n\t.type\tslen, @object\n\t.size\tslen, 8\nslen:\n\t.zero\t8\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tvsf\n\t.align 8\n\t.type\tvsf, @object\n\t.size\tvsf, 8\nvsf:\n\t.zero\t8\n\t.globl\tvse\n\t.align 8\n\t.type\tvse, @object\n\t.size\tvse, 8\nvse:\n\t.zero\t8\n\t.globl\tvsd\n\t.align 8\n\t.type\tvsd, @object\n\t.size\tvsd, 8\nvsd:\n\t.zero\t8\n\t.globl\tvsc\n\t.align 8\n\t.type\tvsc, @object\n\t.size\tvsc, 8\nvsc:\n\t.zero\t8\n\t.globl\tvsb\n\t.align 8\n\t.type\tvsb, @object\n\t.size\tvsb, 8\nvsb:\n\t.zero\t8\n\t.globl\tvsa\n\t.align 8\n\t.type\tvsa, @object\n\t.size\tvsa, 8\nvsa:\n\t.zero\t8\n\t.globl\tvuf\n\t.align 8\n\t.type\tvuf, @object\n\t.size\tvuf, 8\nvuf:\n\t.zero\t8\n\t.globl\tvue\n\t.align 8\n\t.type\tvue, @object\n\t.size\tvue, 8\nvue:\n\t.zero\t8\n\t.globl\tvud\n\t.align 8\n\t.type\tvud, @object\n\t.size\tvud, 8\nvud:\n\t.zero\t8\n\t.globl\tvuc\n\t.align 8\n\t.type\tvuc, @object\n\t.size\tvuc, 8\nvuc:\n\t.zero\t8\n\t.globl\tvub\n\t.align 8\n\t.type\tvub, @object\n\t.size\tvub, 8\nvub:\n\t.zero\t8\n\t.globl\tvua\n\t.align 8\n\t.type\tvua, @object\n\t.size\tvua, 8\nvua:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\tn\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.globl\tvector8\n\t.section\t.rodata\n\t.align 32\n\t.type\tvector8, @object\n\t.size\tvector8, 64\nvector8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\numax:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovnb\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE52:\n\t.size\tumax, .-umax\n\t.p2align 4\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovle\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE53:\n\t.size\tsmin, .-smin\n\t.p2align 4\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rdi, %rsi\n\tmovq\t%rdi, %rax\n\tcmovge\t%rsi, %rax\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tsmax, .-smax\n\t.p2align 4\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB55:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\txorl\t%edx, %edx\n\tdivq\t%rsi\n.L8:\n\tmovq\t%rdx, %rax\n\tmovq\t%rsi, %rdx\n\tmovq\t%rax, %rsi\n.L7:\n\tcmpq\t%rsi, %rdx\n\tjb\t.L8\n\tmovq\t%rdx, %rax\n\ttestq\t%rsi, %rsi\n\tjne\t.L11\n\tret\n\t.cfi_endproc\n.LFE55:\n\t.size\tgcd, .-gcd\n\t.p2align 4\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovl\t$1, %r8d\n\ttestq\t%rsi, %rsi\n\tje\t.L12\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\ttestb\t$1, %sil\n\tje\t.L14\n\tmovq\t%r8, %rax\n\txorl\t%edx, %edx\n\timulq\t%rdi, %rax\n\tdivq\t%rcx\n\tmovq\t%rdx, %r8\n.L14:\n\timulq\t%rdi, %rdi\n\txorl\t%edx, %edx\n\tmovq\t%rdi, %rax\n\tdivq\t%rcx\n\tshrq\t%rsi\n\tmovq\t%rdx, %rdi\n\tjne\t.L15\n.L12:\n\tmovq\t%r8, %rax\n\tret\n\t.cfi_endproc\n.LFE56:\n\t.size\tbitpow, .-bitpow\n\t.p2align 4\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB57:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdx, %rcx\n\tmovq\t%rdx, %r8\n\tsubq\t$2, %rcx\n\tje\t.L22\n\tmovl\t$1, %r9d\n\t.p2align 4,,10\n\t.p2align 3\n.L24:\n\ttestb\t$1, %cl\n\tje\t.L23\n\tmovq\t%r9, %rax\n\txorl\t%edx, %edx\n\timulq\t%rsi, %rax\n\tdivq\t%r8\n\tmovq\t%rdx, %r9\n.L23:\n\timulq\t%rsi, %rsi\n\txorl\t%edx, %edx\n\tmovq\t%rsi, %rax\n\tdivq\t%r8\n\tshrq\t%rcx\n\tmovq\t%rdx, %rsi\n\tjne\t.L24\n\timulq\t%r9, %rdi\n.L22:\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\tdivq\t%r8\n\tmovq\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE57:\n\t.size\tdivide, .-divide\n\t.p2align 4\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB58:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovnb\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE58:\n\t.size\tudiff, .-udiff\n\t.p2align 4\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB59:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rdx\n\tmovq\t%rsi, %rax\n\tsubq\t%rsi, %rdx\n\tsubq\t%rdi, %rax\n\tcmpq\t%rsi, %rdi\n\tcmovge\t%rdx, %rax\n\tret\n\t.cfi_endproc\n.LFE59:\n\t.size\tsdiff, .-sdiff\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC0:\n\t.string\t\"%llu.\"\n.LC1:\n\t.string\t\"%1d\"\n.LC2:\n\t.string\t\"\"\n\t.text\n\t.p2align 4\n\t.globl\tprintUquotient\n\t.type\tprintUquotient, @function\nprintUquotient:\n.LFB60:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\txorl\t%edx, %edx\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tmovl\t$1, %edi\n\tdivq\t%rsi\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rsi, %rbp\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\tleaq\t.LC0(%rip), %rsi\n\tleaq\t.LC1(%rip), %r12\n\tmovq\t%rdx, %rbx\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%rbx, %rdx\n\tmovl\t$20, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L39:\n\tleaq\t(%rdx,%rdx,4), %rax\n\txorl\t%edx, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\taddq\t%rax, %rax\n\tdivq\t%rbp\n\tmovq\t%rdx, %r13\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%r13, %rdx\n\tsubl\t$1, %ebx\n\tjne\t.L39\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 40\n\tleaq\t.LC2(%rip), %rdi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tjmp\tputs@PLT\n\t.cfi_endproc\n.LFE60:\n\t.size\tprintUquotient, .-printUquotient\n\t.p2align 4\n\t.globl\tprintSquotient\n\t.type\tprintSquotient, @function\nprintSquotient:\n.LFB61:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t%rdi, %rax\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\timulq\t%rsi, %rax\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tmovq\t%rsi, %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tmovq\t%rdi, %rbx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 48\n\ttestq\t%rax, %rax\n\tjs\t.L47\n.L43:\n\tmovq\t%r12, %rbp\n\tmovq\t%rbx, %rax\n\tmovl\t$1, %edi\n\tnegq\t%rbp\n\tleaq\t.LC0(%rip), %rsi\n\tcmovs\t%r12, %rbp\n\tnegq\t%rax\n\tleaq\t.LC1(%rip), %r12\n\tcmovs\t%rbx, %rax\n\txorl\t%edx, %edx\n\tdivq\t%rbp\n\tmovq\t%rdx, %rbx\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%rbx, %rdx\n\tmovl\t$20, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L44:\n\tleaq\t(%rdx,%rdx,4), %rax\n\txorl\t%edx, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\taddq\t%rax, %rax\n\tdivq\t%rbp\n\tmovq\t%rdx, %r13\n\tmovq\t%rax, %rdx\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovq\t%r13, %rdx\n\tsubl\t$1, %ebx\n\tjne\t.L44\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\tleaq\t.LC2(%rip), %rdi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tjmp\tputs@PLT\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\t.cfi_restore_state\n\tmovq\tstdout(%rip), %rsi\n\tmovl\t$45, %edi\n\tcall\tputc@PLT\n\tjmp\t.L43\n\t.cfi_endproc\n.LFE61:\n\t.size\tprintSquotient, .-printSquotient\n\t.p2align 4\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB62:\n\t.cfi_startproc\n\tendbr64\n\txorl\t%eax, %eax\n\ttestq\t%rdi, %rdi\n\tje\t.L52\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tmovq\t%rdi, %rdx\n\tandl\t$1, %edx\n\taddl\t%edx, %eax\n\tshrq\t%rdi\n\tjne\t.L51\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L52:\n\tret\n\t.cfi_endproc\n.LFE62:\n\t.size\tbitcount, .-bitcount\n\t.p2align 4\n\t.globl\tdistance\n\t.type\tdistance, @function\ndistance:\n.LFB63:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t%rdx, %rdi\n\tpxor\t%xmm0, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tsubq\t%rcx, %rsi\n\timulq\t%rdi, %rdi\n\timulq\t%rsi, %rsi\n\tcvtsi2sdq\t%rdi, %xmm0\n\tcvtsi2sdq\t%rsi, %xmm1\n\taddsd\t%xmm1, %xmm0\n\tpxor\t%xmm1, %xmm1\n\tucomisd\t%xmm0, %xmm1\n\tja\t.L64\n\tsqrtsd\t%xmm0, %xmm0\n\tret\n.L64:\n\tjmp\tsqrt@PLT\n\t.cfi_endproc\n.LFE63:\n\t.size\tdistance, .-distance\n\t.p2align 4\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB64:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tseta\t%al\n\tmovzbl\t%al, %eax\n\tcmovb\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE64:\n\t.size\tpullcomp, .-pullcomp\n\t.p2align 4\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB65:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rax\n\tcmpq\t%rax, (%rdi)\n\tmovl\t$-1, %edx\n\tseta\t%al\n\tmovzbl\t%al, %eax\n\tcmovb\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE65:\n\t.size\tpsllcomp, .-psllcomp\n\t.p2align 4\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB66:\n\t.cfi_startproc\n\tendbr64\n\tmovzbl\t(%rsi), %eax\n\tcmpb\t%al, (%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE66:\n\t.size\tpcharcomp, .-pcharcomp\n\t.p2align 4\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB67:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rsi\n\tmovq\t(%rdi), %rdi\n\tjmp\tstrcmp@PLT\n\t.cfi_endproc\n.LFE67:\n\t.size\tpstrcomp, .-pstrcomp\n\t.p2align 4\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB68:\n\t.cfi_startproc\n\tendbr64\n\tmovq\t(%rsi), %rcx\n\tmovl\t$-1, %eax\n\tcmpq\t%rcx, (%rdi)\n\tjl\t.L75\n\tmovl\t$1, %eax\n\tjg\t.L75\n\tmovq\t8(%rsi), %rax\n\tcmpq\t%rax, 8(%rdi)\n\tmovl\t$-1, %edx\n\tsetg\t%al\n\tmovzbl\t%al, %eax\n\tcmovl\t%edx, %eax\n.L75:\n\tret\n\t.cfi_endproc\n.LFE68:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.p2align 4\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB69:\n\t.cfi_startproc\n\tendbr64\n\tcmpq\t%rsi, %rdi\n\tsetle\t%al\n\tcmpq\t%rdx, %rsi\n\tsetle\t%dl\n\tandl\t%edx, %eax\n\tret\n\t.cfi_endproc\n.LFE69:\n\t.size\tisinrange, .-isinrange\n\t.section\t.text.unlikely,\"ax\",@progbits\n.LCOLDB4:\n\t.text\n.LHOTB4:\n\t.p2align 4\n\t.globl\tmergeteq\n\t.type\tmergeteq, @function\nmergeteq:\n.LFB70:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\txorl\t%r13d, %r13d\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcmpq\t$1, %rsi\n\tje\t.L81\n\tmovq\t%rsi, %rbx\n\tmovq\t%rsi, %r14\n\tmovq\t%rdi, %r12\n\tmovq\t%rsi, %r15\n\tshrq\t%rbx\n\tmovq\t%rbx, %rsi\n\tsubq\t%rbx, %r14\n\tcall\tmergeteq\n\tleaq\t(%r12,%rbx,8), %rdi\n\tmovq\t%r14, %rsi\n\tmovq\t%rax, %r13\n\tcall\tmergeteq\n\tleaq\t0(,%r15,8), %r8\n\tmovq\t%rsp, %rcx\n\taddq\t%rax, %r13\n\tleaq\t15(%r8), %rax\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tsubq\t%rax, %rcx\n\tandq\t$-16, %rdx\n\tcmpq\t%rcx, %rsp\n\tje\t.L84\n.L110:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L110\n.L84:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tje\t.L85\n\torq\t$0, -8(%rsp,%rdx)\n.L85:\n\tmovq\t%rbx, %rax\n\tmovq\t%rsp, %rsi\n\torq\t%r14, %rax\n\tje\t.L81\n\txorl\t%eax, %eax\n\txorl\t%edx, %edx\n\txorl\t%ecx, %ecx\n\txorl\t%r10d, %r10d\n.L103:\n\tleaq\t(%rdx,%rax), %r9\n\tcmpq\t%rdx, %rbx\n\tje\t.L111\n.L86:\n\tmovq\t(%r12,%r10,8), %rdi\n\tcmpq\t%rax, %r14\n\tje\t.L91\n\taddq\t%rbx, %rcx\n\tmovq\t(%r12,%rcx,8), %rcx\n\tcmpq\t%rdi, %rcx\n\tjnb\t.L91\n\taddq\t%rbx, %r13\n\taddq\t$1, %rax\n\tmovq\t%rcx, %rdi\n\tsubq\t%r10, %r13\n.L90:\n\tmovq\t%rdi, (%rsi,%r9,8)\n\tmovq\t%rdx, %r10\n\tmovq\t%rax, %rcx\n\tcmpq\t%r14, %rax\n\tjb\t.L103\n\tcmpq\t%rdx, %rbx\n\tjbe\t.L88\n\tleaq\t(%rdx,%rax), %r9\n\tcmpq\t%rdx, %rbx\n\tjne\t.L86\n.L111:\n\tmovq\t(%r12,%r9,8), %rdx\n\taddq\t$1, %rax\n\tmovq\t%rdx, (%rsi,%r9,8)\n\tcmpq\t%r14, %rax\n\tjb\t.L112\n.L88:\n\ttestq\t%r15, %r15\n\tje\t.L81\n\tmovq\t%r8, %rdx\n\tmovq\t%r12, %rdi\n\tcall\tmemcpy@PLT\n.L81:\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L113\n\tleaq\t-40(%rbp), %rsp\n\tmovq\t%r13, %rax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L91:\n\t.cfi_restore_state\n\taddq\t$1, %rdx\n\tjmp\t.L90\n\t.p2align 4,,10\n\t.p2align 3\n.L112:\n\tjmp\t.L87\n.L113:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n\t.section\t.text.unlikely\n\t.cfi_startproc\n\t.type\tmergeteq.cold, @function\nmergeteq.cold:\n.LFSB70:\n.L87:\n\t.cfi_def_cfa 6, 16\n\t.cfi_offset 3, -56\n\t.cfi_offset 6, -16\n\t.cfi_offset 12, -48\n\t.cfi_offset 13, -40\n\t.cfi_offset 14, -32\n\t.cfi_offset 15, -24\n\tsalq\t$3, %rbx\n\tleaq\t(%r12,%rbx), %rdx\n\taddq\t%rsi, %rbx\n.L92:\n\tmovq\t(%rdx,%rax,8), %rcx\n\taddq\t$1, %rax\n\tmovq\t%rcx, -8(%rbx,%rax,8)\n\tcmpq\t%r14, %rax\n\tjnb\t.L88\n\tjmp\t.L92\n\t.cfi_endproc\n.LFE70:\n\t.text\n\t.size\tmergeteq, .-mergeteq\n\t.section\t.text.unlikely\n\t.size\tmergeteq.cold, .-mergeteq.cold\n.LCOLDE4:\n\t.text\n.LHOTE4:\n\t.section\t.rodata.str1.1\n.LC5:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.p2align 4\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB71:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t$1, %eax\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 14, -24\n\tmovl\t%eax, %edi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tmovl\t%eax, %ebx\n\tsubq\t$24, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\tvub(%rip), %rsi\n\tmovq\tvua(%rip), %r8\n\tmovq\t$1, 8+bitdp(%rip)\n\tmovq\tvuc(%rip), %rdx\n\tmovq\tn(%rip), %r13\n\tleal\t(%rsi,%r8), %ecx\n\taddl\t%edx, %ecx\n\tsall\t%cl, %edi\n\tleal\t(%rdx,%rsi), %ecx\n\tsall\t%cl, %ebx\n\tmovl\t%edx, %ecx\n\taddl\t%ebx, %edi\n\tmovl\t%eax, %ebx\n\tsall\t%cl, %ebx\n\tleaq\t1(%r8,%rsi), %rcx\n\taddq\t%rdx, %rcx\n\tleal\t1(%rdi,%rbx), %ebp\n\tsall\t%cl, %eax\n\tmovl\t%ecx, %ebx\n\tleal\t-1(%rax), %r10d\n\tmovl\t$1, %eax\n\tsarq\t%cl, %rax\n\tmovq\t%rax, 8(%rsp)\n\ttestq\t%r13, %r13\n\tje\t.L128\n\tmovslq\t%ebp, %rbp\n\tmovslq\t%r10d, %r10\n\txorl\t%r14d, %r14d\n\tmovq\t%r13, %r15\n\tleaq\tbitdp(%rip), %rsi\n\tmovabsq\t$-8543223828751151131, %r11\n\t.p2align 4,,10\n\t.p2align 3\n.L123:\n\tmovq\t%r14, %rdi\n\txorl\t%eax, %eax\n\tandl\t$1, %edi\n\tmovq\t%rdi, %r9\n\txorq\t$1, %r9\n\tmovq\t%r9, %r13\n\tsalq\t$23, %r13\n\taddq\t%rsi, %r13\n\t.p2align 4,,10\n\t.p2align 3\n.L116:\n\tmovq\t$0, 0(%r13,%rax,8)\n\taddq\t$1, %rax\n\tmovq\t%rax, %rdx\n\tsarq\t%cl, %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L116\n\tcmpq\t$0, 8(%rsp)\n\tjne\t.L121\n\tsalq\t$23, %rdi\n\tsalq\t$20, %r9\n\tleaq\t8(%rsi,%rdi), %r8\n\tmovl\t$1, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L120:\n\tmovq\t(%r8), %rbx\n\ttestq\t%rbx, %rbx\n\tje\t.L119\n\tleaq\t(%rdi,%rdi), %rax\n\tandq\t%r10, %rax\n\tleaq\t1(%rax,%r9), %r12\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tleaq\t0(,%rdi,4), %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tleaq\t0(,%rdi,8), %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$4, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$5, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tsalq\t$6, %rax\n\tandq\t%r10, %rax\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tmovq\t(%r8), %rbx\n\tleaq\t1(%rax,%r9), %r12\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$7, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$8, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$9, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tmovq\t%rdi, %rax\n\tsalq\t$10, %rax\n\tandq\t%r10, %rax\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n\tleaq\t1(%rax,%r9), %r12\n\tmovq\t(%r8), %rbx\n\taddq\t(%rsi,%r12,8), %rbx\n\tmovq\t%rbx, %rax\n\tmulq\t%r11\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rdx\n\tsubq\t%rdx, %rbx\n\tmovq\t%rbx, (%rsi,%r12,8)\n.L119:\n\taddq\t$1, %rdi\n\taddq\t$8, %r8\n\tmovq\t%rdi, %rax\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L120\n.L121:\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L118:\n\tmovq\t%rbp, %rdx\n\tandq\t%rax, %rdx\n\tcmpq\t%rbp, %rdx\n\tjne\t.L122\n\tmovq\t$0, 0(%r13,%rax,8)\n.L122:\n\taddq\t$1, %rax\n\tmovq\t%rax, %rdx\n\tsarq\t%cl, %rdx\n\ttestq\t%rdx, %rdx\n\tje\t.L118\n\taddq\t$1, %r14\n\tcmpq\t%r15, %r14\n\tjne\t.L123\n\tmovq\t%r15, %rax\n\tmovl\t%ecx, %ebx\n\tmovq\t%r15, %r13\n\tandl\t$1, %eax\n.L115:\n\tsalq\t$23, %rax\n\txorl\t%edi, %edi\n\txorl\t%r8d, %r8d\n\tmovl\t%ebx, %ecx\n\tmovabsq\t$-8543223828751151131, %r9\n\taddq\t%rax, %rsi\n\tmovq\t%rdi, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L124:\n\tmovq\t(%rsi,%r8,8), %rdi\n\taddq\t$1, %r8\n\taddq\t%rdx, %rdi\n\tmovq\t%rdi, %rax\n\tmulq\t%r9\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tsubq\t%rax, %rdi\n\tmovq\t%r8, %rax\n\tsarq\t%cl, %rax\n\tmovq\t%rdi, %rdx\n\ttestq\t%rax, %rax\n\tje\t.L124\n\tmovl\t$1, %esi\n\ttestq\t%r13, %r13\n\tje\t.L125\n\tmovabsq\t$-8543223828751151131, %r9\n\tmovl\t$10, %ecx\n\t.p2align 4,,10\n\t.p2align 3\n.L127:\n\ttestb\t$1, %r13b\n\tje\t.L126\n\timulq\t%rcx, %rsi\n\tmovq\t%rsi, %rax\n\tmovq\t%rsi, %r8\n\tmulq\t%r9\n\tmovq\t%rdx, %rsi\n\tshrq\t$29, %rsi\n\timulq\t$1000000007, %rsi, %rax\n\tmovq\t%r8, %rsi\n\tsubq\t%rax, %rsi\n.L126:\n\timulq\t%rcx, %rcx\n\tmovq\t%rcx, %rax\n\tmovq\t%rcx, %r8\n\tmulq\t%r9\n\tmovq\t%rdx, %rcx\n\tshrq\t$29, %rcx\n\timulq\t$1000000007, %rcx, %rax\n\tmovq\t%r8, %rcx\n\tsubq\t%rax, %rcx\n\tshrq\t%r13\n\tjne\t.L127\n.L125:\n\tmovabsq\t$-8543223828751151131, %rdx\n\tsubq\t%rdi, %rsi\n\tmovl\t$1, %edi\n\tleaq\t1000000007(%rsi), %rcx\n\tleaq\t.LC5(%rip), %rsi\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tshrq\t$29, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tsubq\t%rax, %rcx\n\txorl\t%eax, %eax\n\tmovq\t%rcx, %rdx\n\tcall\t__printf_chk@PLT\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L128:\n\t.cfi_restore_state\n\txorl\t%eax, %eax\n\tleaq\tbitdp(%rip), %rsi\n\tjmp\t.L115\n\t.cfi_endproc\n.LFE71:\n\t.size\tsolve, .-solve\n\t.section\t.rodata.str1.1\n.LC6:\n\t.string\t\"%llu\"\n.LC7:\n\t.string\t\"%llu%llu%llu\"\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB72:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tleaq\tm(%rip), %rdx\n\tleaq\tn(%rip), %rsi\n\txorl\t%eax, %eax\n\tleaq\t.LC6(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 24\n\tleaq\tvuf(%rip), %rax\n\tleaq\tvue(%rip), %r9\n\tpushq\t%rax\n\t.cfi_def_cfa_offset 32\n\tleaq\tvud(%rip), %r8\n\txorl\t%eax, %eax\n\tleaq\tvuc(%rip), %rcx\n\tleaq\tvub(%rip), %rdx\n\tleaq\tvua(%rip), %rsi\n\tleaq\t.LC7(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\txorl\t%eax, %eax\n\tcall\tsolve\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE72:\n\t.size\tmain, .-main\n\t.globl\tbitdp\n\t.bss\n\t.align 32\n\t.type\tbitdp, @object\n\t.size\tbitdp, 16777216\nbitdp:\n\t.zero\t16777216\n\t.globl\tbrr\n\t.align 32\n\t.type\tbrr, @object\n\t.size\tbrr, 16000000\nbrr:\n\t.zero\t16000000\n\t.globl\tarr\n\t.align 32\n\t.type\tarr, @object\n\t.size\tarr, 16000016\narr:\n\t.zero\t16000016\n\t.globl\tdp\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 8000008\ndp:\n\t.zero\t8000008\n\t.globl\talphabets\n\t.align 32\n\t.type\talphabets, @object\n\t.size\talphabets, 208\nalphabets:\n\t.zero\t208\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 1000001\ns:\n\t.zero\t1000001\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8000000\nc:\n\t.zero\t8000000\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8000000\nb:\n\t.zero\t8000000\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8000000\na:\n\t.zero\t8000000\n\t.globl\tpath\n\t.align 32\n\t.type\tpath, @object\n\t.size\tpath, 6400000\npath:\n\t.zero\t6400000\n\t.globl\tdist\n\t.align 32\n\t.type\tdist, @object\n\t.size\tdist, 8000000\ndist:\n\t.zero\t8000000\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\ttlen\n\t.align 8\n\t.type\ttlen, @object\n\t.size\ttlen, 8\ntlen:\n\t.zero\t8\n\t.globl\tslen\n\t.align 8\n\t.type\tslen, @object\n\t.size\tslen, 8\nslen:\n\t.zero\t8\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tvsf\n\t.align 8\n\t.type\tvsf, @object\n\t.size\tvsf, 8\nvsf:\n\t.zero\t8\n\t.globl\tvse\n\t.align 8\n\t.type\tvse, @object\n\t.size\tvse, 8\nvse:\n\t.zero\t8\n\t.globl\tvsd\n\t.align 8\n\t.type\tvsd, @object\n\t.size\tvsd, 8\nvsd:\n\t.zero\t8\n\t.globl\tvsc\n\t.align 8\n\t.type\tvsc, @object\n\t.size\tvsc, 8\nvsc:\n\t.zero\t8\n\t.globl\tvsb\n\t.align 8\n\t.type\tvsb, @object\n\t.size\tvsb, 8\nvsb:\n\t.zero\t8\n\t.globl\tvsa\n\t.align 8\n\t.type\tvsa, @object\n\t.size\tvsa, 8\nvsa:\n\t.zero\t8\n\t.globl\tvuf\n\t.align 8\n\t.type\tvuf, @object\n\t.size\tvuf, 8\nvuf:\n\t.zero\t8\n\t.globl\tvue\n\t.align 8\n\t.type\tvue, @object\n\t.size\tvue, 8\nvue:\n\t.zero\t8\n\t.globl\tvud\n\t.align 8\n\t.type\tvud, @object\n\t.size\tvud, 8\nvud:\n\t.zero\t8\n\t.globl\tvuc\n\t.align 8\n\t.type\tvuc, @object\n\t.size\tvuc, 8\nvuc:\n\t.zero\t8\n\t.globl\tvub\n\t.align 8\n\t.type\tvub, @object\n\t.size\tvub, 8\nvub:\n\t.zero\t8\n\t.globl\tvua\n\t.align 8\n\t.type\tvua, @object\n\t.size\tvua, 8\nvua:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\tn\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.globl\tvector8\n\t.section\t.rodata\n\t.align 32\n\t.type\tvector8, @object\n\t.size\tvector8, 64\nvector8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "/*\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>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#include <time.h>\n\n#define BIG 2000000007\n#define VERYBIG 200000000000007LL\n\n#define MOD 1000000007\ntypedef uint64_t ull;\ntypedef int64_t sll;\n\n#define N_MAX 1000000\n#define M_MAX 200000\n\n#ifdef __cplusplus\n#include <queue>\n#include <stack>\n// #include <tuple>\n#include <set>\n#include <map>\n\n// using namespace std; // HELL\nusing std::queue;\nusing std::priority_queue;\nusing std::stack;\n// using std::tuple;\nusing std::set;\nusing std::map;\nusing std::vector;\nusing std::greater;\nusing std::pair;\n\n#endif\n\ntypedef struct {\n\tint32_t a;\n\tint32_t b;\n} hw;\n\ntypedef struct {\n\tsll a;\n\tsll b;\n} hwll;\n\ntypedef struct {\n\thwll a;\n\thwll b;\n} linell;\n\n\ntypedef struct {\n\tull s;\n\tull t;\n\tint32_t c;\n} struct_a;\n\ntypedef struct {\n\tint32_t from;\n\tint32_t to;\n\tsll cost;\n} struct_b;\n\n\n\nconst hw vector8[8] = {\n\t{-1, -1},\n\t{-1, 0},\n\t{-1, +1},\n\t{ 0, -1},\n\t{ 0, +1},\n\t{+1, -1},\n\t{+1, 0},\n\t{+1, +1}\n};\n\null n, m;\null h, w;\null k;\null q;\null vua, vub, vuc, vud, vue, vuf;\nsll vsa, vsb, vsc, vsd, vse, vsf;\nlong double vra, vrb, vrc;\ndouble vda, vdb, vdc;\nsize_t slen;\nsize_t tlen;\nchar ch, dh;\n\null umin (ull x, ull y) {\n\treturn (x < y) ? x : y;\n}\n\null umax (ull x, ull y) {\n\treturn (x > y) ? x : y;\n}\n\nsll smin (sll x, sll y) {\n\treturn (x < y) ? x : y;\n}\n\nsll smax (sll x, sll y) {\n\treturn (x > y) ? x : y;\n}\n\null gcd (ull x, ull y) {\n\tif (x < y) {\n\t\treturn gcd(y, x);\n\t} else if (y == 0) {\n\t\treturn x;\n\t} else {\n\t\treturn gcd(y, x % y);\n\t}\n}\n\null bitpow (ull a, ull x, ull modulo) {\n\tull result = 1;\n\twhile (x) {\n\t\tif (x & 1) {\n\t\t\tresult *= a;\n\t\t\tresult %= modulo;\n\t\t}\n\t\tx /= 2;\n\t\ta = (a * a) % modulo;\n\t}\n\treturn result;\n}\n\null divide (ull a, ull b, ull modulo) {\n\treturn (a * bitpow(b, modulo - 2, modulo)) % modulo;\n}\n\null udiff (ull a, ull b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nsll sdiff (sll a, sll b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nvoid printUquotient (ull left, ull right) {\n\tconst int32_t digits = 20;\n\n\tprintf(\"%llu.\", left / right);\n\tleft %= right;\n\tfor (int32_t i = 0; i < digits; i++) {\n\t\tleft *= 10;\n\t\tprintf(\"%1d\", left / right);\n\t\tleft %= right;\n\t}\n\tputs(\"\");\n\n\treturn;\n}\n\nvoid printSquotient (sll left, sll right) {\n\tif (left * right < 0) putchar('-');\n\tprintUquotient(sdiff(left, 0), sdiff(right, 0));\n\n\treturn;\n}\n\nint bitcount (ull n) {\n\tint result = 0;\n\twhile (n) {\n\t\tif (n & 1) result++;\n\t\tn /= 2;\n\t}\n\treturn result;\n}\n\n#ifdef __cplusplus\n\nbool setfind (set<ull> s, ull x) {\n\treturn (s.find(x) != s.end());\n}\n\n#endif\n\nsll dist[N_MAX];\nstruct_b path[M_MAX * 2];\n\n// ull a[N_MAX];\n// ull a[M_MAX];\nsll a[N_MAX];\n// ull a[N_MAX][N_MAX];\n// ull a[M_MAX][M_MAX];\n// sll a[N_MAX][N_MAX];\n// ull b[N_MAX];\n// ull b[M_MAX];\nsll b[N_MAX];\null c[N_MAX];\n// sll c[M_MAX];\n// char c[N_MAX];\nchar s[N_MAX + 1];\n// char s[N_MAX + 1][N_MAX + 1];\n// char s[N_MAX + 1][M_MAX + 1];\n// char t[N_MAX + 1];\n\null alphabets[26];\n// ull blphabets[26];\n// char alphabets[26];\n\null dp[N_MAX + 1];\n// sll dp[N_MAX + 1];\n// ull dp[N_MAX + 1][N_MAX + 1];\n// sll dp[N_MAX + 1][N_MAX + 1];\n// bool dp[N_MAX + 1];\n// bool dp[N_MAX + 1][N_MAX + 1];\n// bool dq[N_MAX];\nhwll arr[N_MAX + 1];\n// hwll arr[M_MAX];\nhwll brr[N_MAX];\n\n// sll dp[N_MAX + 1];\n// ull color[N_MAX];\n// set<sll> children[N_MAX];\n// set<sll> leaf[N_MAX];\n\n\n\ndouble distance (sll x1, sll y1, sll x2, sll y2) {\n\tdouble xdist2, ydist2, origindist, dist;\n\n\txdist2 = (x1 - x2) * (x1 - x2);\n\tydist2 = (y1 - y2) * (y1 - y2);\n\treturn sqrt(xdist2 + ydist2);\n}\n\nint32_t pullcomp (const void *left, const void *right) {\n\tull l = *(ull*)left;\n\tull r = *(ull*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t psllcomp (const void *left, const void *right) {\n\tull l = *(sll*)left;\n\tull r = *(sll*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t pcharcomp (const void *left, const void *right) {\n\tchar l = *(char*)left;\n\tchar r = *(char*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t pstrcomp (const void *left, const void *right) {\n\tchar* l = *(char**)left;\n\tchar* r = *(char**)right;\n\n\treturn strcmp(l, r);\n}\n\nint32_t phwllABcomp (const void *left, const void *right) {\n\thwll l = *(hwll*)left;\n\thwll r = *(hwll*)right;\n\tif (l.a < r.a) {\n\t\treturn -1;\n\t}\n\tif (l.a > r.a) {\n\t\treturn +1;\n\t}\n\tif (l.b < r.b) {\n\t\treturn -1;\n\t}\n\tif (l.b > r.b) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nbool isinrange (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right);\n}\n\null bitdp[2][1 << 20];\n\null mergeteq (ull a[], ull n) {\n\tull l = n / 2, r = n - l;\n\tif (n == 1) return 0;\n\tull ret = mergeteq(a, l) + mergeteq(a + l, r);\n\n\tull tmp[n];\n\tsll i = 0, j = 0;\n\twhile (i < l || j < r) {\n\t\tif (i == l) {\n\t\t\ttmp[i + j] = a[i + j];\n\t\t\tj++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (j == r) {\n\t\t\ttmp[i + j] = a[i];\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (a[i] > a[l + j]) {\n\t\t\ttmp[i + j] = a[l + j];\n\t\t\tret += l - i;\n\t\t\tj++;\n\t\t} else {\n\t\t\ttmp[i + j] = a[i];\n\t\t\ti++;\n\t\t}\n\t}\n\n\tfor (i = 0; i < n; i++) {\n\t\ta[i] = tmp[i];\n\t}\n\treturn ret;\n}\n\null solve () {\n\tsll i, j, ki, li;\n\tull result = 0;\n\t// sll result = 0;\n\t// double result = 0;\n\t// ull maybe = 0;\n\tsll maybe = 0;\n\t// ull sum = 0;\n\tsll sum = 0;\n\tull item;\n\tull *dpcell;\n\n\tull fuck = (1 << (vua + vub + vuc)) + (1 << (vub + vuc)) + (1 << vuc) + 1;\n\tull bitlen = (vua + vub + vuc + 1);\n\tull ablemask = (1 << bitlen) - 1;\n\n\tbitdp[0][1] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tull curri = (i & 1);\n\t\tull nexti = curri ^ 1;\n\n\t\tfor (j = 0; !(j >> bitlen); j++) {\n\t\t\tbitdp[nexti][j] = 0;\n\t\t}\n\n\t\tfor (j = 1; !(j >> bitlen); j++) {\n\t\t\tif (!bitdp[curri][j]) continue;\n\t\t\t\n\t\t\tfor (ki = 1; ki <= 10; ki++) {\n\t\t\t\tdpcell = &bitdp[nexti][((j << ki) & ablemask) + 1];\n\t\t\t\t*dpcell = (*dpcell + bitdp[curri][j]) % MOD;\n\t\t\t}\n\t\t}\n\n\t\tfor (j = 0; !(j >> bitlen); j++) {\n\t\t\tif ((j & fuck) == fuck) {\n\t\t\t\tbitdp[nexti][j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tresult = 0;\n\tfor (j = 0; !(j >> bitlen); j++) {\n\t\tresult = (result + bitdp[n & 1][j]) % MOD;\n\t}\n\n\tresult = (bitpow(10, n, MOD) + MOD - result) % MOD;\n\n\tprintf(\"%lld\\n\", result);\n\t// printf(\"%.12lf\\n\", (double)result);\n\t// puts(s);\n\n\treturn 0;\n\n\tsuccess:\n\tputs(\"YES\");\n\t// puts(\"Yes\");\n\t// printf(\"%llu\\n\", result);\n\t// puts(\"0\");\n\t// puts(\"First\");\n\treturn 0;\n\n\tfail:\n\t// puts(\"NO\");\n\t// puts(\"No\");\n\t// puts(\"0\");\n\tputs(\"-1\");\n\t// puts(\"-1 -1 -1\");\n\t// puts(\"Second\");\n\treturn 1;\n}\n\nint32_t main (void) {\n\tint32_t i, j;\n\tint32_t x, y;\n\n\t// scanf(\"%lf\", &vda, &vdb);\n\t// scanf(\"%lld%lld%lld%lld\", &vsa, &vsb, &vsc, &vsd);\n\t// scanf(\"%llu%llu\", &vua, &vub, &vuc, &vud);\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%*llu%*llu\");\n\tscanf(\"%llu\", &n, &m);\n\t// scanf(\"%llu\", &k, &n);\n\tscanf(\"%llu%llu%llu\", &vua, &vub, &vuc, &vud, &vue, &vuf);\n\t// scanf(\"%lld%lld\", &vsa, &vsb, &vsc);\n\t// scanf(\"%s\", s);\n\t// scanf(\"%s\", t);\n\t// scanf(\"%llu\", &m);\n\t// scanf(\"%llu\", &q);\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &b[i]);\n\t// \t// scanf(\"%llu\", &c[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// }\n\t// for (i = 0; i < m; i++) {\n\t// \tscanf(\"%lld\", &a[n + i]);\n\t// \tscanf(\"%lld\", &b[n + i]);\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%llu\", &b[i]);\n\t// }\n\t// for (i = 0; i < h; i++) {\n\t// \tfor (j = 0; j < w; j++) {\n\t// \t\tscanf(\"%llu\", &a[i][j]);\n\t// \t}\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%s\", &s[i]);\n\t// }\n\n\t// scanf(\"%llu\", &k);\n\t// scanf(\"%llu\", &q);\n\tsolve();\n\n\treturn 0;\n}\n", "index": 103, "inputs": [ "37 4 3 3\n", "5 4 3 3\n", "5 4 2 3\n", "0 4 2 3\n", "8 5 7 5\n", "3 3 7 5\n", "7 4 2 3\n", "37 3 3 3\n", "5 8 3 3\n", "8 4 2 3\n", "8 5 7 3\n", "7 4 1 3\n", "37 3 2 3\n", "7 8 3 3\n", "8 5 2 3\n", "8 4 7 3\n", "7 5 1 3\n", "7 3 3 3\n", "15 5 2 3\n", "5 4 7 3\n", "7 7 1 3\n", "7 3 1 3\n", "15 10 2 3\n", "5 6 7 3\n", "7 7 1 5\n", "5 6 3 3\n", "7 4 1 5\n", "7 3 1 2\n", "37 7 2 3\n", "5 4 1 3\n", "5 6 2 3\n", "8 5 5 5\n", "37 3 3 2\n", "5 7 3 3\n", "8 4 1 3\n", "8 5 5 3\n", "10 4 1 3\n", "5 8 3 4\n", "18 5 2 3\n", "7 10 1 3\n", "7 6 3 3\n", "15 8 2 3\n", "5 4 7 2\n", "5 6 3 6\n", "10 3 1 3\n", "37 7 2 5\n", "11 5 5 5\n", "37 1 3 2\n", "8 5 5 1\n", "10 4 1 4\n", "18 5 2 2\n", "7 1 3 3\n", "15 8 3 3\n", "4 6 3 6\n", "37 8 2 5\n", "11 5 7 5\n", "35 1 3 2\n", "17 4 1 4\n", "18 5 2 4\n", "15 1 3 3\n", "4 3 3 2\n", "37 8 2 1\n", "9 5 7 5\n", "35 1 1 2\n", "17 4 2 4\n", "18 5 2 5\n", "6 1 3 3\n", "22 1 1 2\n", "18 5 2 1\n", "10 1 3 3\n", "9 1 3 3\n", "15 4 3 3\n", "4 4 2 3\n", "7 4 2 6\n", "8 2 7 3\n", "9 3 2 3\n", "8 5 2 4\n", "8 4 7 6\n", "7 6 1 3\n", "7 3 4 3\n", "15 5 4 3\n", "11 3 1 3\n", "7 8 3 1\n", "7 7 1 7\n", "11 3 1 5\n", "7 4 1 1\n", "5 3 1 2\n", "5 2 2 3\n", "8 6 5 5\n", "5 7 3 2\n", "8 4 1 6\n", "6 5 5 3\n", "5 8 4 4\n", "8 5 1 3\n", "7 10 2 3\n", "6 6 1 3\n", "15 4 2 3\n", "10 3 2 3\n", "37 7 2 6\n", "11 5 2 5\n", "37 4 2 3\n", "40 5 7 5\n", "3 5 7 5\n", "3 5 7 5\n", "4 5 7 5\n" ], "outputs": [ "180978943\n", "460\n", "435\n", "0\n", "1761124\n", "1\n", "78735\n", "632821729\n", "574\n", "962894\n", "1534983\n", "72629\n", "2649067\n", "113357\n", "1034575\n", "1421256\n", "78736\n", "71884\n", "179274801\n", "575\n", "91391\n", "66979\n", "138603924\n", "638\n", "105891\n", "514\n", "84361\n", "62433\n", "211566209\n", "409\n", "488\n", "1376801\n", "428261576\n", "544\n", "884377\n", "1307147\n", "119979319\n", "606\n", "196326604\n", "113901\n", "97400\n", "158792215\n", "545\n", "604\n", "109662940\n", "449943478\n", "174735979\n", "407675011\n", "1118706\n", "129345022\n", "244413776\n", "67360\n", "292615880\n", "32\n", "465535936\n", "843770940\n", "30163696\n", "70632472\n", "310860807\n", "402177643\n", "25\n", "361030684\n", "21236123\n", "542042576\n", "263340538\n", "756985997\n", "5295\n", "998021346\n", "354317090\n", "110458251\n", "9611289\n", "379088942\n", "26\n", "97824\n", "1217285\n", "10349705\n", "1126207\n", "1788662\n", "84846\n", "83869\n", "600843741\n", "238502958\n", "98395\n", "121017\n", "487677148\n", "62474\n", "362\n", "385\n", "1647087\n", "516\n", "1126233\n", "7983\n", "636\n", "962918\n", "122455\n", "6549\n", "86345156\n", "119098948\n", "146884182\n", "881029400\n", "863912418\n", "562805100\n", "1\n", "1\n", "34\n" ], "question": "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>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#include <time.h>\n\n#define BIG 2000000007\n#define VERYBIG 200000000000007LL\n\n#define MOD 1000000007\ntypedef uint64_t ull;\ntypedef int64_t sll;\n\n#define N_MAX 1000000\n#define M_MAX 200000\n\n#ifdef __cplusplus\n#include <queue>\n#include <stack>\n// #include <tuple>\n#include <set>\n#include <map>\n\n// using namespace std; // HELL\nusing std::queue;\nusing std::priority_queue;\nusing std::stack;\n// using std::tuple;\nusing std::set;\nusing std::map;\nusing std::vector;\nusing std::greater;\nusing std::pair;\n\n#endif\n\ntypedef struct {\n\tint32_t a;\n\tint32_t b;\n} hw;\n\ntypedef struct {\n\tsll a;\n\tsll b;\n} hwll;\n\ntypedef struct {\n\thwll a;\n\thwll b;\n} linell;\n\n\ntypedef struct {\n\tull s;\n\tull t;\n\tint32_t c;\n} struct_a;\n\ntypedef struct {\n\tint32_t from;\n\tint32_t to;\n\tsll cost;\n} struct_b;\n\n\n\nconst hw vector8[8] = {\n\t{-1, -1},\n\t{-1, 0},\n\t{-1, +1},\n\t{ 0, -1},\n\t{ 0, +1},\n\t{+1, -1},\n\t{+1, 0},\n\t{+1, +1}\n};\n\null n, m;\null h, w;\null k;\null q;\null vua, vub, vuc, vud, vue, vuf;\nsll vsa, vsb, vsc, vsd, vse, vsf;\nlong double vra, vrb, vrc;\ndouble vda, vdb, vdc;\nsize_t slen;\nsize_t tlen;\nchar ch, dh;\n\null umin (ull x, ull y) {\n\treturn (x < y) ? x : y;\n}\n\null umax (ull x, ull y) {\n\treturn (x > y) ? x : y;\n}\n\nsll smin (sll x, sll y) {\n\treturn (x < y) ? x : y;\n}\n\nsll smax (sll x, sll y) {\n\treturn (x > y) ? x : y;\n}\n\null gcd (ull x, ull y) {\n\tif (x < y) {\n\t\treturn gcd(y, x);\n\t} else if (y == 0) {\n\t\treturn x;\n\t} else {\n\t\treturn gcd(y, x % y);\n\t}\n}\n\null bitpow (ull a, ull x, ull modulo) {\n\tull result = 1;\n\twhile (x) {\n\t\tif (x & 1) {\n\t\t\tresult *= a;\n\t\t\tresult %= modulo;\n\t\t}\n\t\tx /= 2;\n\t\ta = (a * a) % modulo;\n\t}\n\treturn result;\n}\n\null divide (ull a, ull b, ull modulo) {\n\treturn (a * bitpow(b, modulo - 2, modulo)) % modulo;\n}\n\null udiff (ull a, ull b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nsll sdiff (sll a, sll b) {\n\tif (a >= b) {\n\t\treturn a - b;\n\t} else {\n\t\treturn b - a;\n\t}\n}\n\nvoid printUquotient (ull left, ull right) {\n\tconst int32_t digits = 20;\n\n\tprintf(\"%llu.\", left / right);\n\tleft %= right;\n\tfor (int32_t i = 0; i < digits; i++) {\n\t\tleft *= 10;\n\t\tprintf(\"%1d\", left / right);\n\t\tleft %= right;\n\t}\n\tputs(\"\");\n\n\treturn;\n}\n\nvoid printSquotient (sll left, sll right) {\n\tif (left * right < 0) putchar('-');\n\tprintUquotient(sdiff(left, 0), sdiff(right, 0));\n\n\treturn;\n}\n\nint bitcount (ull n) {\n\tint result = 0;\n\twhile (n) {\n\t\tif (n & 1) result++;\n\t\tn /= 2;\n\t}\n\treturn result;\n}\n\n#ifdef __cplusplus\n\nbool setfind (set<ull> s, ull x) {\n\treturn (s.find(x) != s.end());\n}\n\n#endif\n\nsll dist[N_MAX];\nstruct_b path[M_MAX * 2];\n\n// ull a[N_MAX];\n// ull a[M_MAX];\nsll a[N_MAX];\n// ull a[N_MAX][N_MAX];\n// ull a[M_MAX][M_MAX];\n// sll a[N_MAX][N_MAX];\n// ull b[N_MAX];\n// ull b[M_MAX];\nsll b[N_MAX];\null c[N_MAX];\n// sll c[M_MAX];\n// char c[N_MAX];\nchar s[N_MAX + 1];\n// char s[N_MAX + 1][N_MAX + 1];\n// char s[N_MAX + 1][M_MAX + 1];\n// char t[N_MAX + 1];\n\null alphabets[26];\n// ull blphabets[26];\n// char alphabets[26];\n\null dp[N_MAX + 1];\n// sll dp[N_MAX + 1];\n// ull dp[N_MAX + 1][N_MAX + 1];\n// sll dp[N_MAX + 1][N_MAX + 1];\n// bool dp[N_MAX + 1];\n// bool dp[N_MAX + 1][N_MAX + 1];\n// bool dq[N_MAX];\nhwll arr[N_MAX + 1];\n// hwll arr[M_MAX];\nhwll brr[N_MAX];\n\n// sll dp[N_MAX + 1];\n// ull color[N_MAX];\n// set<sll> children[N_MAX];\n// set<sll> leaf[N_MAX];\n\n\n\ndouble distance (sll x1, sll y1, sll x2, sll y2) {\n\tdouble xdist2, ydist2, origindist, dist;\n\n\txdist2 = (x1 - x2) * (x1 - x2);\n\tydist2 = (y1 - y2) * (y1 - y2);\n\treturn sqrt(xdist2 + ydist2);\n}\n\nint32_t pullcomp (const void *left, const void *right) {\n\tull l = *(ull*)left;\n\tull r = *(ull*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t psllcomp (const void *left, const void *right) {\n\tull l = *(sll*)left;\n\tull r = *(sll*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t pcharcomp (const void *left, const void *right) {\n\tchar l = *(char*)left;\n\tchar r = *(char*)right;\n\tif (l < r) {\n\t\treturn -1;\n\t}\n\tif (l > r) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nint32_t pstrcomp (const void *left, const void *right) {\n\tchar* l = *(char**)left;\n\tchar* r = *(char**)right;\n\n\treturn strcmp(l, r);\n}\n\nint32_t phwllABcomp (const void *left, const void *right) {\n\thwll l = *(hwll*)left;\n\thwll r = *(hwll*)right;\n\tif (l.a < r.a) {\n\t\treturn -1;\n\t}\n\tif (l.a > r.a) {\n\t\treturn +1;\n\t}\n\tif (l.b < r.b) {\n\t\treturn -1;\n\t}\n\tif (l.b > r.b) {\n\t\treturn +1;\n\t}\n\treturn 0;\n}\n\nbool isinrange (sll left, sll x, sll right) {\n\treturn (left <= x && x <= right);\n}\n\null bitdp[2][1 << 20];\n\null mergeteq (ull a[], ull n) {\n\tull l = n / 2, r = n - l;\n\tif (n == 1) return 0;\n\tull ret = mergeteq(a, l) + mergeteq(a + l, r);\n\n\tull tmp[n];\n\tsll i = 0, j = 0;\n\twhile (i < l || j < r) {\n\t\tif (i == l) {\n\t\t\ttmp[i + j] = a[i + j];\n\t\t\tj++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (j == r) {\n\t\t\ttmp[i + j] = a[i];\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (a[i] > a[l + j]) {\n\t\t\ttmp[i + j] = a[l + j];\n\t\t\tret += l - i;\n\t\t\tj++;\n\t\t} else {\n\t\t\ttmp[i + j] = a[i];\n\t\t\ti++;\n\t\t}\n\t}\n\n\tfor (i = 0; i < n; i++) {\n\t\ta[i] = tmp[i];\n\t}\n\treturn ret;\n}\n\null solve () {\n\tsll i, j, ki, li;\n\tull result = 0;\n\t// sll result = 0;\n\t// double result = 0;\n\t// ull maybe = 0;\n\tsll maybe = 0;\n\t// ull sum = 0;\n\tsll sum = 0;\n\tull item;\n\tull *dpcell;\n\n\tull fuck = (1 << (vua + vub + vuc)) + (1 << (vub + vuc)) + (1 << vuc) + 1;\n\tull bitlen = (vua + vub + vuc + 1);\n\tull ablemask = (1 << bitlen) - 1;\n\n\tbitdp[0][1] = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tull curri = (i & 1);\n\t\tull nexti = curri ^ 1;\n\n\t\tfor (j = 0; !(j >> bitlen); j++) {\n\t\t\tbitdp[nexti][j] = 0;\n\t\t}\n\n\t\tfor (j = 1; !(j >> bitlen); j++) {\n\t\t\tif (!bitdp[curri][j]) continue;\n\t\t\t\n\t\t\tfor (ki = 1; ki <= 10; ki++) {\n\t\t\t\tdpcell = &bitdp[nexti][((j << ki) & ablemask) + 1];\n\t\t\t\t*dpcell = (*dpcell + bitdp[curri][j]) % MOD;\n\t\t\t}\n\t\t}\n\n\t\tfor (j = 0; !(j >> bitlen); j++) {\n\t\t\tif ((j & fuck) == fuck) {\n\t\t\t\tbitdp[nexti][j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tresult = 0;\n\tfor (j = 0; !(j >> bitlen); j++) {\n\t\tresult = (result + bitdp[n & 1][j]) % MOD;\n\t}\n\n\tresult = (bitpow(10, n, MOD) + MOD - result) % MOD;\n\n\tprintf(\"%lld\\n\", result);\n\t// printf(\"%.12lf\\n\", (double)result);\n\t// puts(s);\n\n\treturn 0;\n\n\tsuccess:\n\tputs(\"YES\");\n\t// puts(\"Yes\");\n\t// printf(\"%llu\\n\", result);\n\t// puts(\"0\");\n\t// puts(\"First\");\n\treturn 0;\n\n\tfail:\n\t// puts(\"NO\");\n\t// puts(\"No\");\n\t// puts(\"0\");\n\tputs(\"-1\");\n\t// puts(\"-1 -1 -1\");\n\t// puts(\"Second\");\n\treturn 1;\n}\n\nint32_t main (void) {\n\tint32_t i, j;\n\tint32_t x, y;\n\n\t// scanf(\"%lf\", &vda, &vdb);\n\t// scanf(\"%lld%lld%lld%lld\", &vsa, &vsb, &vsc, &vsd);\n\t// scanf(\"%llu%llu\", &vua, &vub, &vuc, &vud);\n\t// scanf(\"%llu%llu\", &h, &w);\n\t// scanf(\"%*llu%*llu\");\n\tscanf(\"%llu\", &n, &m);\n\t// scanf(\"%llu\", &k, &n);\n\tscanf(\"%llu%llu%llu\", &vua, &vub, &vuc, &vud, &vue, &vuf);\n\t// scanf(\"%lld%lld\", &vsa, &vsb, &vsc);\n\t// scanf(\"%s\", s);\n\t// scanf(\"%s\", t);\n\t// scanf(\"%llu\", &m);\n\t// scanf(\"%llu\", &q);\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%lld\", &a[i]);\n\t// \t// scanf(\"%lld\", &b[i]);\n\t// \t// scanf(\"%llu\", &c[i]);\n\t// \t// a[i]--;\n\t// \t// b[i]--;\n\t// }\n\t// for (i = 0; i < m; i++) {\n\t// \tscanf(\"%lld\", &a[n + i]);\n\t// \tscanf(\"%lld\", &b[n + i]);\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%llu\", &b[i]);\n\t// }\n\t// for (i = 0; i < h; i++) {\n\t// \tfor (j = 0; j < w; j++) {\n\t// \t\tscanf(\"%llu\", &a[i][j]);\n\t// \t}\n\t// }\n\t// for (i = 0; i < n; i++) {\n\t// \tscanf(\"%s\", &s[i]);\n\t// }\n\n\t// scanf(\"%llu\", &k);\n\t// scanf(\"%llu\", &q);\n\tsolve();\n\n\treturn 0;\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tvector8\n\t.section\t.rodata\n\t.align 32\n\t.type\tvector8, @object\n\t.size\tvector8, 64\nvector8:\n\t.long\t-1\n\t.long\t-1\n\t.long\t-1\n\t.long\t0\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t-1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.long\t-1\n\t.long\t1\n\t.long\t0\n\t.long\t1\n\t.long\t1\n\t.globl\tn\n\t.bss\n\t.align 8\n\t.type\tn, @object\n\t.size\tn, 8\nn:\n\t.zero\t8\n\t.globl\tm\n\t.align 8\n\t.type\tm, @object\n\t.size\tm, 8\nm:\n\t.zero\t8\n\t.globl\th\n\t.align 8\n\t.type\th, @object\n\t.size\th, 8\nh:\n\t.zero\t8\n\t.globl\tw\n\t.align 8\n\t.type\tw, @object\n\t.size\tw, 8\nw:\n\t.zero\t8\n\t.globl\tk\n\t.align 8\n\t.type\tk, @object\n\t.size\tk, 8\nk:\n\t.zero\t8\n\t.globl\tq\n\t.align 8\n\t.type\tq, @object\n\t.size\tq, 8\nq:\n\t.zero\t8\n\t.globl\tvua\n\t.align 8\n\t.type\tvua, @object\n\t.size\tvua, 8\nvua:\n\t.zero\t8\n\t.globl\tvub\n\t.align 8\n\t.type\tvub, @object\n\t.size\tvub, 8\nvub:\n\t.zero\t8\n\t.globl\tvuc\n\t.align 8\n\t.type\tvuc, @object\n\t.size\tvuc, 8\nvuc:\n\t.zero\t8\n\t.globl\tvud\n\t.align 8\n\t.type\tvud, @object\n\t.size\tvud, 8\nvud:\n\t.zero\t8\n\t.globl\tvue\n\t.align 8\n\t.type\tvue, @object\n\t.size\tvue, 8\nvue:\n\t.zero\t8\n\t.globl\tvuf\n\t.align 8\n\t.type\tvuf, @object\n\t.size\tvuf, 8\nvuf:\n\t.zero\t8\n\t.globl\tvsa\n\t.align 8\n\t.type\tvsa, @object\n\t.size\tvsa, 8\nvsa:\n\t.zero\t8\n\t.globl\tvsb\n\t.align 8\n\t.type\tvsb, @object\n\t.size\tvsb, 8\nvsb:\n\t.zero\t8\n\t.globl\tvsc\n\t.align 8\n\t.type\tvsc, @object\n\t.size\tvsc, 8\nvsc:\n\t.zero\t8\n\t.globl\tvsd\n\t.align 8\n\t.type\tvsd, @object\n\t.size\tvsd, 8\nvsd:\n\t.zero\t8\n\t.globl\tvse\n\t.align 8\n\t.type\tvse, @object\n\t.size\tvse, 8\nvse:\n\t.zero\t8\n\t.globl\tvsf\n\t.align 8\n\t.type\tvsf, @object\n\t.size\tvsf, 8\nvsf:\n\t.zero\t8\n\t.globl\tvra\n\t.align 16\n\t.type\tvra, @object\n\t.size\tvra, 16\nvra:\n\t.zero\t16\n\t.globl\tvrb\n\t.align 16\n\t.type\tvrb, @object\n\t.size\tvrb, 16\nvrb:\n\t.zero\t16\n\t.globl\tvrc\n\t.align 16\n\t.type\tvrc, @object\n\t.size\tvrc, 16\nvrc:\n\t.zero\t16\n\t.globl\tvda\n\t.align 8\n\t.type\tvda, @object\n\t.size\tvda, 8\nvda:\n\t.zero\t8\n\t.globl\tvdb\n\t.align 8\n\t.type\tvdb, @object\n\t.size\tvdb, 8\nvdb:\n\t.zero\t8\n\t.globl\tvdc\n\t.align 8\n\t.type\tvdc, @object\n\t.size\tvdc, 8\nvdc:\n\t.zero\t8\n\t.globl\tslen\n\t.align 8\n\t.type\tslen, @object\n\t.size\tslen, 8\nslen:\n\t.zero\t8\n\t.globl\ttlen\n\t.align 8\n\t.type\ttlen, @object\n\t.size\ttlen, 8\ntlen:\n\t.zero\t8\n\t.globl\tch\n\t.type\tch, @object\n\t.size\tch, 1\nch:\n\t.zero\t1\n\t.globl\tdh\n\t.type\tdh, @object\n\t.size\tdh, 1\ndh:\n\t.zero\t1\n\t.text\n\t.globl\tumin\n\t.type\tumin, @function\numin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovbe\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tumin, .-umin\n\t.globl\tumax\n\t.type\tumax, @function\numax:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovnb\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tumax, .-umax\n\t.globl\tsmin\n\t.type\tsmin, @function\nsmin:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsmin, .-smin\n\t.globl\tsmax\n\t.type\tsmax, @function\nsmax:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-16(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tcmovge\t%rdx, %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tsmax, .-smax\n\t.globl\tgcd\n\t.type\tgcd, @function\ngcd:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjnb\t.L10\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tgcd\n\tjmp\t.L11\n.L10:\n\tcmpq\t$0, -16(%rbp)\n\tjne\t.L12\n\tmovq\t-8(%rbp), %rax\n\tjmp\t.L11\n.L12:\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tgcd\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tgcd, .-gcd\n\t.globl\tbitpow\n\t.type\tbitpow, @function\nbitpow:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t$1, -8(%rbp)\n\tjmp\t.L14\n.L16:\n\tmovq\t-32(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L15\n\tmovq\t-8(%rbp), %rax\n\timulq\t-24(%rbp), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n.L15:\n\tmovq\t-32(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t%rax, %rax\n\tmovl\t$0, %edx\n\tdivq\t-40(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n.L14:\n\tcmpq\t$0, -32(%rbp)\n\tjne\t.L16\n\tmovq\t-8(%rbp), %rax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tbitpow, .-bitpow\n\t.globl\tdivide\n\t.type\tdivide, @function\ndivide:\n.LFB12:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$24, %rsp\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tleaq\t-2(%rax), %rcx\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tbitpow\n\timulq\t-8(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-24(%rbp)\n\tmovq\t%rdx, %rax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE12:\n\t.size\tdivide, .-divide\n\t.globl\tudiff\n\t.type\tudiff, @function\nudiff:\n.LFB13:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjb\t.L21\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L22\n.L21:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L22:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE13:\n\t.size\tudiff, .-udiff\n\t.globl\tsdiff\n\t.type\tsdiff, @function\nsdiff:\n.LFB14:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjl\t.L24\n\tmovq\t-8(%rbp), %rax\n\tsubq\t-16(%rbp), %rax\n\tjmp\t.L25\n.L24:\n\tmovq\t-16(%rbp), %rax\n\tsubq\t-8(%rbp), %rax\n.L25:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE14:\n\t.size\tsdiff, .-sdiff\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%llu.\"\n.LC1:\n\t.string\t\"%1d\"\n.LC2:\n\t.string\t\"\"\n\t.text\n\t.globl\tprintUquotient\n\t.type\tprintUquotient, @function\nprintUquotient:\n.LFB15:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovl\t$20, -4(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovl\t$0, -8(%rbp)\n\tjmp\t.L27\n.L28:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t%rdx, %rax\n\tsalq\t$2, %rax\n\taddq\t%rdx, %rax\n\taddq\t%rax, %rax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %edx\n\tdivq\t-32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\taddl\t$1, -8(%rbp)\n.L27:\n\tmovl\t-8(%rbp), %eax\n\tcmpl\t-4(%rbp), %eax\n\tjl\t.L28\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE15:\n\t.size\tprintUquotient, .-printUquotient\n\t.globl\tprintSquotient\n\t.type\tprintSquotient, @function\nprintSquotient:\n.LFB16:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%rbx\n\tsubq\t$24, %rsp\n\t.cfi_offset 3, -24\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\timulq\t-32(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjns\t.L31\n\tmovl\t$45, %edi\n\tcall\tputchar@PLT\n.L31:\n\tmovq\t-32(%rbp), %rax\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsdiff\n\tmovq\t%rax, %rbx\n\tmovq\t-24(%rbp), %rax\n\tmovl\t$0, %esi\n\tmovq\t%rax, %rdi\n\tcall\tsdiff\n\tmovq\t%rbx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tprintUquotient\n\tnop\n\tmovq\t-8(%rbp), %rbx\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE16:\n\t.size\tprintSquotient, .-printSquotient\n\t.globl\tbitcount\n\t.type\tbitcount, @function\nbitcount:\n.LFB17:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovl\t$0, -4(%rbp)\n\tjmp\t.L34\n.L36:\n\tmovq\t-24(%rbp), %rax\n\tandl\t$1, %eax\n\ttestq\t%rax, %rax\n\tje\t.L35\n\taddl\t$1, -4(%rbp)\n.L35:\n\tmovq\t-24(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -24(%rbp)\n.L34:\n\tcmpq\t$0, -24(%rbp)\n\tjne\t.L36\n\tmovl\t-4(%rbp), %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE17:\n\t.size\tbitcount, .-bitcount\n\t.globl\tdist\n\t.bss\n\t.align 32\n\t.type\tdist, @object\n\t.size\tdist, 8000000\ndist:\n\t.zero\t8000000\n\t.globl\tpath\n\t.align 32\n\t.type\tpath, @object\n\t.size\tpath, 6400000\npath:\n\t.zero\t6400000\n\t.globl\ta\n\t.align 32\n\t.type\ta, @object\n\t.size\ta, 8000000\na:\n\t.zero\t8000000\n\t.globl\tb\n\t.align 32\n\t.type\tb, @object\n\t.size\tb, 8000000\nb:\n\t.zero\t8000000\n\t.globl\tc\n\t.align 32\n\t.type\tc, @object\n\t.size\tc, 8000000\nc:\n\t.zero\t8000000\n\t.globl\ts\n\t.align 32\n\t.type\ts, @object\n\t.size\ts, 1000001\ns:\n\t.zero\t1000001\n\t.globl\talphabets\n\t.align 32\n\t.type\talphabets, @object\n\t.size\talphabets, 208\nalphabets:\n\t.zero\t208\n\t.globl\tdp\n\t.align 32\n\t.type\tdp, @object\n\t.size\tdp, 8000008\ndp:\n\t.zero\t8000008\n\t.globl\tarr\n\t.align 32\n\t.type\tarr, @object\n\t.size\tarr, 16000016\narr:\n\t.zero\t16000016\n\t.globl\tbrr\n\t.align 32\n\t.type\tbrr, @object\n\t.size\tbrr, 16000000\nbrr:\n\t.zero\t16000000\n\t.text\n\t.globl\tdistance\n\t.type\tdistance, @function\ndistance:\n.LFB18:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t%rdx, -40(%rbp)\n\tmovq\t%rcx, -48(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tsubq\t-40(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-24(%rbp), %rax\n\tsubq\t-40(%rbp), %rax\n\timulq\t%rdx, %rax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdq\t%rax, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tsubq\t-48(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-32(%rbp), %rax\n\tsubq\t-48(%rbp), %rax\n\timulq\t%rdx, %rax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdq\t%rax, %xmm0\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovsd\t-16(%rbp), %xmm0\n\taddsd\t-8(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tcall\tsqrt@PLT\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE18:\n\t.size\tdistance, .-distance\n\t.globl\tpullcomp\n\t.type\tpullcomp, @function\npullcomp:\n.LFB19:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjnb\t.L41\n\tmovl\t$-1, %eax\n\tjmp\t.L42\n.L41:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjbe\t.L43\n\tmovl\t$1, %eax\n\tjmp\t.L42\n.L43:\n\tmovl\t$0, %eax\n.L42:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE19:\n\t.size\tpullcomp, .-pullcomp\n\t.globl\tpsllcomp\n\t.type\tpsllcomp, @function\npsllcomp:\n.LFB20:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjnb\t.L45\n\tmovl\t$-1, %eax\n\tjmp\t.L46\n.L45:\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-8(%rbp), %rax\n\tjbe\t.L47\n\tmovl\t$1, %eax\n\tjmp\t.L46\n.L47:\n\tmovl\t$0, %eax\n.L46:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE20:\n\t.size\tpsllcomp, .-psllcomp\n\t.globl\tpcharcomp\n\t.type\tpcharcomp, @function\npcharcomp:\n.LFB21:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -2(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovzbl\t(%rax), %eax\n\tmovb\t%al, -1(%rbp)\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjge\t.L49\n\tmovl\t$-1, %eax\n\tjmp\t.L50\n.L49:\n\tmovzbl\t-2(%rbp), %eax\n\tcmpb\t-1(%rbp), %al\n\tjle\t.L51\n\tmovl\t$1, %eax\n\tjmp\t.L50\n.L51:\n\tmovl\t$0, %eax\n.L50:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE21:\n\t.size\tpcharcomp, .-pcharcomp\n\t.globl\tpstrcomp\n\t.type\tpstrcomp, @function\npstrcomp:\n.LFB22:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%rdi, -24(%rbp)\n\tmovq\t%rsi, -32(%rbp)\n\tmovq\t-24(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-32(%rbp), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE22:\n\t.size\tpstrcomp, .-pstrcomp\n\t.globl\tphwllABcomp\n\t.type\tphwllABcomp, @function\nphwllABcomp:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -40(%rbp)\n\tmovq\t%rsi, -48(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-48(%rbp), %rax\n\tmovq\t8(%rax), %rdx\n\tmovq\t(%rax), %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t%rdx, -8(%rbp)\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L55\n\tmovl\t$-1, %eax\n\tjmp\t.L60\n.L55:\n\tmovq\t-32(%rbp), %rdx\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L57\n\tmovl\t$1, %eax\n\tjmp\t.L60\n.L57:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjge\t.L58\n\tmovl\t$-1, %eax\n\tjmp\t.L60\n.L58:\n\tmovq\t-24(%rbp), %rdx\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t%rax, %rdx\n\tjle\t.L59\n\tmovl\t$1, %eax\n\tjmp\t.L60\n.L59:\n\tmovl\t$0, %eax\n.L60:\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\tphwllABcomp, .-phwllABcomp\n\t.globl\tisinrange\n\t.type\tisinrange, @function\nisinrange:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovq\t%rdi, -8(%rbp)\n\tmovq\t%rsi, -16(%rbp)\n\tmovq\t%rdx, -24(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tcmpq\t-16(%rbp), %rax\n\tjg\t.L62\n\tmovq\t-16(%rbp), %rax\n\tcmpq\t-24(%rbp), %rax\n\tjg\t.L62\n\tmovl\t$1, %eax\n\tjmp\t.L63\n.L62:\n\tmovl\t$0, %eax\n.L63:\n\tandl\t$1, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tisinrange, .-isinrange\n\t.globl\tbitdp\n\t.bss\n\t.align 32\n\t.type\tbitdp, @object\n\t.size\tbitdp, 16777216\nbitdp:\n\t.zero\t16777216\n\t.text\n\t.globl\tmergeteq\n\t.type\tmergeteq, @function\nmergeteq:\n.LFB25:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$96, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 12, -40\n\t.cfi_offset 3, -48\n\tmovq\t%rdi, -104(%rbp)\n\tmovq\t%rsi, -112(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -40(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %r12\n\tmovq\t-112(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-112(%rbp), %rax\n\tsubq\t-72(%rbp), %rax\n\tmovq\t%rax, -64(%rbp)\n\tcmpq\t$1, -112(%rbp)\n\tjne\t.L66\n\tmovl\t$0, %eax\n\tjmp\t.L67\n.L66:\n\tmovq\t-72(%rbp), %rdx\n\tmovq\t-104(%rbp), %rax\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmergeteq\n\tmovq\t%rax, %rbx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tmovq\t%rdx, %rdi\n\tcall\tmergeteq\n\taddq\t%rbx, %rax\n\tmovq\t%rax, -96(%rbp)\n\tmovq\t-112(%rbp), %rax\n\tmovq\t%rax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -56(%rbp)\n\tmovq\t%rax, -128(%rbp)\n\tmovq\t$0, -120(%rbp)\n\tmovq\t%rax, %r14\n\tmovl\t$0, %r15d\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %ebx\n\tmovl\t$0, %edx\n\tdivq\t%rbx\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L68:\n\tcmpq\t%rdx, %rsp\n\tje\t.L69\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L68\n.L69:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L70\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L70:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -48(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tmovq\t$0, -80(%rbp)\n\tjmp\t.L71\n.L75:\n\tmovq\t-72(%rbp), %rax\n\tcmpq\t%rax, -88(%rbp)\n\tjne\t.L72\n\tmovq\t-88(%rbp), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$1, -80(%rbp)\n\tjmp\t.L71\n.L72:\n\tmovq\t-64(%rbp), %rax\n\tcmpq\t%rax, -80(%rbp)\n\tjne\t.L73\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$1, -88(%rbp)\n\tjmp\t.L71\n.L73:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t(%rax), %rdx\n\tmovq\t-80(%rbp), %rcx\n\tmovq\t-72(%rbp), %rax\n\taddq\t%rcx, %rax\n\tleaq\t0(,%rax,8), %rcx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rcx, %rax\n\tmovq\t(%rax), %rax\n\tcmpq\t%rax, %rdx\n\tjbe\t.L74\n\tmovq\t-80(%rbp), %rdx\n\tmovq\t-72(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\tmovq\t-88(%rbp), %rdx\n\tmovq\t-72(%rbp), %rax\n\tsubq\t%rdx, %rax\n\taddq\t%rax, -96(%rbp)\n\taddq\t$1, -80(%rbp)\n\tjmp\t.L71\n.L74:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t-88(%rbp), %rcx\n\tmovq\t-80(%rbp), %rdx\n\taddq\t%rdx, %rcx\n\tmovq\t(%rax), %rdx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$1, -88(%rbp)\n.L71:\n\tmovq\t-88(%rbp), %rax\n\tcmpq\t%rax, -72(%rbp)\n\tja\t.L75\n\tmovq\t-80(%rbp), %rax\n\tcmpq\t%rax, -64(%rbp)\n\tja\t.L75\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L76\n.L77:\n\tmovq\t-88(%rbp), %rax\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-104(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovq\t-48(%rbp), %rax\n\tmovq\t-88(%rbp), %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\tmovq\t%rax, (%rcx)\n\taddq\t$1, -88(%rbp)\n.L76:\n\tmovq\t-88(%rbp), %rax\n\tcmpq\t%rax, -112(%rbp)\n\tja\t.L77\n\tmovq\t-96(%rbp), %rax\n.L67:\n\tmovq\t%r12, %rsp\n\tmovq\t-40(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L79\n\tcall\t__stack_chk_fail@PLT\n.L79:\n\tleaq\t-32(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE25:\n\t.size\tmergeteq, .-mergeteq\n\t.section\t.rodata\n.LC3:\n\t.string\t\"%lld\\n\"\n\t.text\n\t.globl\tsolve\n\t.type\tsolve, @function\nsolve:\n.LFB26:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$96, %rsp\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -64(%rbp)\n\tmovq\t$0, -56(%rbp)\n\tmovq\tvua(%rip), %rax\n\tmovl\t%eax, %edx\n\tmovq\tvub(%rip), %rax\n\taddl\t%eax, %edx\n\tmovq\tvuc(%rip), %rax\n\taddl\t%edx, %eax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovq\tvub(%rip), %rax\n\tmovl\t%eax, %ecx\n\tmovq\tvuc(%rip), %rax\n\taddl\t%ecx, %eax\n\tmovl\t$1, %esi\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %esi\n\tmovl\t%esi, %eax\n\taddl\t%eax, %edx\n\tmovq\tvuc(%rip), %rax\n\tmovl\t$1, %esi\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %esi\n\tmovl\t%esi, %eax\n\taddl\t%edx, %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovq\t%rax, -48(%rbp)\n\tmovq\tvua(%rip), %rdx\n\tmovq\tvub(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovq\tvuc(%rip), %rax\n\taddq\t%rdx, %rax\n\taddq\t$1, %rax\n\tmovq\t%rax, -40(%rbp)\n\tmovq\t-40(%rbp), %rax\n\tmovl\t$1, %edx\n\tmovl\t%eax, %ecx\n\tsall\t%cl, %edx\n\tmovl\t%edx, %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovq\t%rax, -32(%rbp)\n\tmovq\t$1, 8+bitdp(%rip)\n\tmovq\t$0, -96(%rbp)\n\tjmp\t.L81\n.L93:\n\tmovq\t-96(%rbp), %rax\n\tandl\t$1, %eax\n\tmovq\t%rax, -24(%rbp)\n\tmovq\t-24(%rbp), %rax\n\txorq\t$1, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L82\n.L83:\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t$0, (%rdx,%rax)\n\taddq\t$1, -88(%rbp)\n.L82:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L83\n\tmovq\t$1, -88(%rbp)\n\tjmp\t.L84\n.L89:\n\tmovq\t-24(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\ttestq\t%rax, %rax\n\tje\t.L97\n\tmovq\t$1, -80(%rbp)\n\tjmp\t.L87\n.L88:\n\tmovq\t-80(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsalq\t%cl, %rax\n\tandq\t-32(%rbp), %rax\n\tleaq\t1(%rax), %rdx\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$20, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t(%rax), %rcx\n\tmovq\t-24(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t(%rdx,%rax), %rax\n\taddq\t%rax, %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$29, %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t-8(%rbp), %rdx\n\tmovq\t%rax, (%rdx)\n\taddq\t$1, -80(%rbp)\n.L87:\n\tcmpq\t$10, -80(%rbp)\n\tjle\t.L88\n\tjmp\t.L86\n.L97:\n\tnop\n.L86:\n\taddq\t$1, -88(%rbp)\n.L84:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L89\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L90\n.L92:\n\tmovq\t-88(%rbp), %rax\n\tandq\t-48(%rbp), %rax\n\tcmpq\t%rax, -48(%rbp)\n\tjne\t.L91\n\tmovq\t-16(%rbp), %rax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t$0, (%rdx,%rax)\n.L91:\n\taddq\t$1, -88(%rbp)\n.L90:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L92\n\taddq\t$1, -96(%rbp)\n.L81:\n\tmovq\t-96(%rbp), %rdx\n\tmovq\tn(%rip), %rax\n\tcmpq\t%rax, %rdx\n\tjb\t.L93\n\tmovq\t$0, -72(%rbp)\n\tmovq\t$0, -88(%rbp)\n\tjmp\t.L94\n.L95:\n\tmovq\tn(%rip), %rax\n\tandl\t$1, %eax\n\tsalq\t$20, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-88(%rbp), %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,8), %rdx\n\tleaq\tbitdp(%rip), %rax\n\tmovq\t(%rdx,%rax), %rdx\n\tmovq\t-72(%rbp), %rax\n\tleaq\t(%rdx,%rax), %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$29, %rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -72(%rbp)\n\taddq\t$1, -88(%rbp)\n.L94:\n\tmovq\t-40(%rbp), %rax\n\tmovl\t%eax, %edx\n\tmovq\t-88(%rbp), %rax\n\tmovl\t%edx, %ecx\n\tsarq\t%cl, %rax\n\ttestq\t%rax, %rax\n\tje\t.L95\n\tmovq\tn(%rip), %rax\n\tmovl\t$1000000007, %edx\n\tmovq\t%rax, %rsi\n\tmovl\t$10, %edi\n\tcall\tbitpow\n\tsubq\t-72(%rbp), %rax\n\tleaq\t1000000007(%rax), %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\tmulq\t%rdx\n\tmovq\t%rdx, %rax\n\tshrq\t$29, %rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -72(%rbp)\n\tmovq\t-72(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE26:\n\t.size\tsolve, .-solve\n\t.section\t.rodata\n.LC4:\n\t.string\t\"%llu\"\n.LC5:\n\t.string\t\"%llu%llu%llu\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB27:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\tm(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tn(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tsubq\t$8, %rsp\n\tleaq\tvuf(%rip), %rax\n\tpushq\t%rax\n\tleaq\tvue(%rip), %r9\n\tleaq\tvud(%rip), %r8\n\tleaq\tvuc(%rip), %rax\n\tmovq\t%rax, %rcx\n\tleaq\tvub(%rip), %rax\n\tmovq\t%rax, %rdx\n\tleaq\tvua(%rip), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC5(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddq\t$16, %rsp\n\tmovl\t$0, %eax\n\tcall\tsolve\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE27:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 <string.h> #include <stdbool.h> #include <math.h> #include <time.h> #define BIG 2000000007 #define VERYBIG 200000000000007LL #define MOD 1000000007 typedef uint64_t ull; typedef int64_t sll; #define N_MAX 1000000 #define M_MAX 200000 #ifdef __cplusplus #include <queue> #include <stack> // #include <tuple> #include <set> #include <map> // using namespace std; // HELL using std::queue; using std::priority_queue; using std::stack; // using std::tuple; using std::set; using std::map; using std::vector; using std::greater; using std::pair; #endif typedef struct { int32_t a; int32_t b; } hw; typedef struct { sll a; sll b; } hwll; typedef struct { hwll a; hwll b; } linell; typedef struct { ull s; ull t; int32_t c; } struct_a; typedef struct { int32_t from; int32_t to; sll cost; } struct_b; const hw vector8[8] = { {-1, -1}, {-1, 0}, {-1, +1}, { 0, -1}, { 0, +1}, {+1, -1}, {+1, 0}, {+1, +1} }; ull n, m; ull h, w; ull k; ull q; ull vua, vub, vuc, vud, vue, vuf; sll vsa, vsb, vsc, vsd, vse, vsf; long double vra, vrb, vrc; double vda, vdb, vdc; size_t slen; size_t tlen; char ch, dh; ull umin (ull x, ull y) { return (x < y) ? x : y; } ull umax (ull x, ull y) { return (x > y) ? x : y; } sll smin (sll x, sll y) { return (x < y) ? x : y; } sll smax (sll x, sll y) { return (x > y) ? x : y; } ull gcd (ull x, ull y) { if (x < y) { return gcd(y, x); } else if (y == 0) { return x; } else { return gcd(y, x % y); } } ull bitpow (ull a, ull x, ull modulo) { ull result = 1; while (x) { if (x & 1) { result *= a; result %= modulo; } x /= 2; a = (a * a) % modulo; } return result; } ull divide (ull a, ull b, ull modulo) { return (a * bitpow(b, modulo - 2, modulo)) % modulo; } ull udiff (ull a, ull b) { if (a >= b) { return a - b; } else { return b - a; } } sll sdiff (sll a, sll b) { if (a >= b) { return a - b; } else { return b - a; } } void printUquotient (ull left, ull right) { const int32_t digits = 20; printf("%llu.", left / right); left %= right; for (int32_t i = 0; i < digits; i++) { left *= 10; printf("%1d", left / right); left %= right; } puts(""); return; } void printSquotient (sll left, sll right) { if (left * right < 0) putchar('-'); printUquotient(sdiff(left, 0), sdiff(right, 0)); return; } int bitcount (ull n) { int result = 0; while (n) { if (n & 1) result++; n /= 2; } return result; } #ifdef __cplusplus bool setfind (set<ull> s, ull x) { return (s.find(x) != s.end()); } #endif sll dist[N_MAX]; struct_b path[M_MAX * 2]; // ull a[N_MAX]; // ull a[M_MAX]; sll a[N_MAX]; // ull a[N_MAX][N_MAX]; // ull a[M_MAX][M_MAX]; // sll a[N_MAX][N_MAX]; // ull b[N_MAX]; // ull b[M_MAX]; sll b[N_MAX]; ull c[N_MAX]; // sll c[M_MAX]; // char c[N_MAX]; char s[N_MAX + 1]; // char s[N_MAX + 1][N_MAX + 1]; // char s[N_MAX + 1][M_MAX + 1]; // char t[N_MAX + 1]; ull alphabets[26]; // ull blphabets[26]; // char alphabets[26]; ull dp[N_MAX + 1]; // sll dp[N_MAX + 1]; // ull dp[N_MAX + 1][N_MAX + 1]; // sll dp[N_MAX + 1][N_MAX + 1]; // bool dp[N_MAX + 1]; // bool dp[N_MAX + 1][N_MAX + 1]; // bool dq[N_MAX]; hwll arr[N_MAX + 1]; // hwll arr[M_MAX]; hwll brr[N_MAX]; // sll dp[N_MAX + 1]; // ull color[N_MAX]; // set<sll> children[N_MAX]; // set<sll> leaf[N_MAX]; double distance (sll x1, sll y1, sll x2, sll y2) { double xdist2, ydist2, origindist, dist; xdist2 = (x1 - x2) * (x1 - x2); ydist2 = (y1 - y2) * (y1 - y2); return sqrt(xdist2 + ydist2); } int32_t pullcomp (const void *left, const void *right) { ull l = *(ull*)left; ull r = *(ull*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t psllcomp (const void *left, const void *right) { ull l = *(sll*)left; ull r = *(sll*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pcharcomp (const void *left, const void *right) { char l = *(char*)left; char r = *(char*)right; if (l < r) { return -1; } if (l > r) { return +1; } return 0; } int32_t pstrcomp (const void *left, const void *right) { char* l = *(char**)left; char* r = *(char**)right; return strcmp(l, r); } int32_t phwllABcomp (const void *left, const void *right) { hwll l = *(hwll*)left; hwll r = *(hwll*)right; if (l.a < r.a) { return -1; } if (l.a > r.a) { return +1; } if (l.b < r.b) { return -1; } if (l.b > r.b) { return +1; } return 0; } bool isinrange (sll left, sll x, sll right) { return (left <= x && x <= right); } ull bitdp[2][1 << 20]; ull mergeteq (ull a[], ull n) { ull l = n / 2, r = n - l; if (n == 1) return 0; ull ret = mergeteq(a, l) + mergeteq(a + l, r); ull tmp[n]; sll i = 0, j = 0; while (i < l || j < r) { if (i == l) { tmp[i + j] = a[i + j]; j++; continue; } if (j == r) { tmp[i + j] = a[i]; i++; continue; } if (a[i] > a[l + j]) { tmp[i + j] = a[l + j]; ret += l - i; j++; } else { tmp[i + j] = a[i]; i++; } } for (i = 0; i < n; i++) { a[i] = tmp[i]; } return ret; } ull solve () { sll i, j, ki, li; ull result = 0; // sll result = 0; // double result = 0; // ull maybe = 0; sll maybe = 0; // ull sum = 0; sll sum = 0; ull item; ull *dpcell; ull fuck = (1 << (vua + vub + vuc)) + (1 << (vub + vuc)) + (1 << vuc) + 1; ull bitlen = (vua + vub + vuc + 1); ull ablemask = (1 << bitlen) - 1; bitdp[0][1] = 1; for (i = 0; i < n; i++) { ull curri = (i & 1); ull nexti = curri ^ 1; for (j = 0; !(j >> bitlen); j++) { bitdp[nexti][j] = 0; } for (j = 1; !(j >> bitlen); j++) { if (!bitdp[curri][j]) continue; for (ki = 1; ki <= 10; ki++) { dpcell = &bitdp[nexti][((j << ki) & ablemask) + 1]; *dpcell = (*dpcell + bitdp[curri][j]) % MOD; } } for (j = 0; !(j >> bitlen); j++) { if ((j & fuck) == fuck) { bitdp[nexti][j] = 0; } } } result = 0; for (j = 0; !(j >> bitlen); j++) { result = (result + bitdp[n & 1][j]) % MOD; } result = (bitpow(10, n, MOD) + MOD - result) % MOD; printf("%lld\n", result); // printf("%.12lf\n", (double)result); // puts(s); return 0; success: puts("YES"); // puts("Yes"); // printf("%llu\n", result); // puts("0"); // puts("First"); return 0; fail: // puts("NO"); // puts("No"); // puts("0"); puts("-1"); // puts("-1 -1 -1"); // puts("Second"); return 1; } int32_t main (void) { int32_t i, j; int32_t x, y; // scanf("%lf", &vda, &vdb); // scanf("%lld%lld%lld%lld", &vsa, &vsb, &vsc, &vsd); // scanf("%llu%llu", &vua, &vub, &vuc, &vud); // scanf("%llu%llu", &h, &w); // scanf("%*llu%*llu"); scanf("%llu", &n, &m); // scanf("%llu", &k, &n); scanf("%llu%llu%llu", &vua, &vub, &vuc, &vud, &vue, &vuf); // scanf("%lld%lld", &vsa, &vsb, &vsc); // scanf("%s", s); // scanf("%s", t); // scanf("%llu", &m); // scanf("%llu", &q); // for (i = 0; i < n; i++) { // scanf("%lld", &a[i]); // // scanf("%lld", &b[i]); // // scanf("%llu", &c[i]); // // a[i]--; // // b[i]--; // } // for (i = 0; i < m; i++) { // scanf("%lld", &a[n + i]); // scanf("%lld", &b[n + i]); // } // for (i = 0; i < n; i++) { // scanf("%llu", &b[i]); // } // for (i = 0; i < h; i++) { // for (j = 0; j < w; j++) { // scanf("%llu", &a[i][j]); // } // } // for (i = 0; i < n; i++) { // scanf("%s", &s[i]); // } // scanf("%llu", &k); // scanf("%llu", &q); solve(); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl vector8 .section .rodata .align 32 .type vector8, @object .size vector8, 64 vector8: .long -1 .long -1 .long -1 .long 0 .long -1 .long 1 .long 0 .long -1 .long 0 .long 1 .long 1 .long -1 .long 1 .long 0 .long 1 .long 1 .globl n .bss .align 8 .type n, @object .size n, 8 n: .zero 8 .globl m .align 8 .type m, @object .size m, 8 m: .zero 8 .globl h .align 8 .type h, @object .size h, 8 h: .zero 8 .globl w .align 8 .type w, @object .size w, 8 w: .zero 8 .globl k .align 8 .type k, @object .size k, 8 k: .zero 8 .globl q .align 8 .type q, @object .size q, 8 q: .zero 8 .globl vua .align 8 .type vua, @object .size vua, 8 vua: .zero 8 .globl vub .align 8 .type vub, @object .size vub, 8 vub: .zero 8 .globl vuc .align 8 .type vuc, @object .size vuc, 8 vuc: .zero 8 .globl vud .align 8 .type vud, @object .size vud, 8 vud: .zero 8 .globl vue .align 8 .type vue, @object .size vue, 8 vue: .zero 8 .globl vuf .align 8 .type vuf, @object .size vuf, 8 vuf: .zero 8 .globl vsa .align 8 .type vsa, @object .size vsa, 8 vsa: .zero 8 .globl vsb .align 8 .type vsb, @object .size vsb, 8 vsb: .zero 8 .globl vsc .align 8 .type vsc, @object .size vsc, 8 vsc: .zero 8 .globl vsd .align 8 .type vsd, @object .size vsd, 8 vsd: .zero 8 .globl vse .align 8 .type vse, @object .size vse, 8 vse: .zero 8 .globl vsf .align 8 .type vsf, @object .size vsf, 8 vsf: .zero 8 .globl vra .align 16 .type vra, @object .size vra, 16 vra: .zero 16 .globl vrb .align 16 .type vrb, @object .size vrb, 16 vrb: .zero 16 .globl vrc .align 16 .type vrc, @object .size vrc, 16 vrc: .zero 16 .globl vda .align 8 .type vda, @object .size vda, 8 vda: .zero 8 .globl vdb .align 8 .type vdb, @object .size vdb, 8 vdb: .zero 8 .globl vdc .align 8 .type vdc, @object .size vdc, 8 vdc: .zero 8 .globl slen .align 8 .type slen, @object .size slen, 8 slen: .zero 8 .globl tlen .align 8 .type tlen, @object .size tlen, 8 tlen: .zero 8 .globl ch .type ch, @object .size ch, 1 ch: .zero 1 .globl dh .type dh, @object .size dh, 1 dh: .zero 1 .text .globl umin .type umin, @function umin: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovbe %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size umin, .-umin .globl umax .type umax, @function umax: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovnb %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size umax, .-umax .globl smin .type smin, @function smin: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovle %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size smin, .-smin .globl smax .type smax, @function smax: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx cmovge %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size smax, .-smax .globl gcd .type gcd, @function gcd: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jnb .L10 movq -8(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call gcd jmp .L11 .L10: cmpq $0, -16(%rbp) jne .L12 movq -8(%rbp), %rax jmp .L11 .L12: movq -8(%rbp), %rax movl $0, %edx divq -16(%rbp) movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call gcd .L11: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size gcd, .-gcd .globl bitpow .type bitpow, @function bitpow: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq %rdx, -40(%rbp) movq $1, -8(%rbp) jmp .L14 .L16: movq -32(%rbp), %rax andl $1, %eax testq %rax, %rax je .L15 movq -8(%rbp), %rax imulq -24(%rbp), %rax movq %rax, -8(%rbp) movq -8(%rbp), %rax movl $0, %edx divq -40(%rbp) movq %rdx, -8(%rbp) .L15: movq -32(%rbp), %rax shrq %rax movq %rax, -32(%rbp) movq -24(%rbp), %rax imulq %rax, %rax movl $0, %edx divq -40(%rbp) movq %rdx, -24(%rbp) .L14: cmpq $0, -32(%rbp) jne .L16 movq -8(%rbp), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size bitpow, .-bitpow .globl divide .type divide, @function divide: .LFB12: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $24, %rsp movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -24(%rbp), %rax leaq -2(%rax), %rcx movq -24(%rbp), %rdx movq -16(%rbp), %rax movq %rcx, %rsi movq %rax, %rdi call bitpow imulq -8(%rbp), %rax movl $0, %edx divq -24(%rbp) movq %rdx, %rax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE12: .size divide, .-divide .globl udiff .type udiff, @function udiff: .LFB13: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jb .L21 movq -8(%rbp), %rax subq -16(%rbp), %rax jmp .L22 .L21: movq -16(%rbp), %rax subq -8(%rbp), %rax .L22: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE13: .size udiff, .-udiff .globl sdiff .type sdiff, @function sdiff: .LFB14: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jl .L24 movq -8(%rbp), %rax subq -16(%rbp), %rax jmp .L25 .L24: movq -16(%rbp), %rax subq -8(%rbp), %rax .L25: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE14: .size sdiff, .-sdiff .section .rodata .LC0: .string "%llu." .LC1: .string "%1d" .LC2: .string "" .text .globl printUquotient .type printUquotient, @function printUquotient: .LFB15: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movl $20, -4(%rbp) movq -24(%rbp), %rax movl $0, %edx divq -32(%rbp) movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq -24(%rbp), %rax movl $0, %edx divq -32(%rbp) movq %rdx, -24(%rbp) movl $0, -8(%rbp) jmp .L27 .L28: movq -24(%rbp), %rdx movq %rdx, %rax salq $2, %rax addq %rdx, %rax addq %rax, %rax movq %rax, -24(%rbp) movq -24(%rbp), %rax movl $0, %edx divq -32(%rbp) movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movq -24(%rbp), %rax movl $0, %edx divq -32(%rbp) movq %rdx, -24(%rbp) addl $1, -8(%rbp) .L27: movl -8(%rbp), %eax cmpl -4(%rbp), %eax jl .L28 leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE15: .size printUquotient, .-printUquotient .globl printSquotient .type printSquotient, @function printSquotient: .LFB16: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $24, %rsp .cfi_offset 3, -24 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax imulq -32(%rbp), %rax testq %rax, %rax jns .L31 movl $45, %edi call putchar@PLT .L31: movq -32(%rbp), %rax movl $0, %esi movq %rax, %rdi call sdiff movq %rax, %rbx movq -24(%rbp), %rax movl $0, %esi movq %rax, %rdi call sdiff movq %rbx, %rsi movq %rax, %rdi call printUquotient nop movq -8(%rbp), %rbx leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE16: .size printSquotient, .-printSquotient .globl bitcount .type bitcount, @function bitcount: .LFB17: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movl $0, -4(%rbp) jmp .L34 .L36: movq -24(%rbp), %rax andl $1, %eax testq %rax, %rax je .L35 addl $1, -4(%rbp) .L35: movq -24(%rbp), %rax shrq %rax movq %rax, -24(%rbp) .L34: cmpq $0, -24(%rbp) jne .L36 movl -4(%rbp), %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE17: .size bitcount, .-bitcount .globl dist .bss .align 32 .type dist, @object .size dist, 8000000 dist: .zero 8000000 .globl path .align 32 .type path, @object .size path, 6400000 path: .zero 6400000 .globl a .align 32 .type a, @object .size a, 8000000 a: .zero 8000000 .globl b .align 32 .type b, @object .size b, 8000000 b: .zero 8000000 .globl c .align 32 .type c, @object .size c, 8000000 c: .zero 8000000 .globl s .align 32 .type s, @object .size s, 1000001 s: .zero 1000001 .globl alphabets .align 32 .type alphabets, @object .size alphabets, 208 alphabets: .zero 208 .globl dp .align 32 .type dp, @object .size dp, 8000008 dp: .zero 8000008 .globl arr .align 32 .type arr, @object .size arr, 16000016 arr: .zero 16000016 .globl brr .align 32 .type brr, @object .size brr, 16000000 brr: .zero 16000000 .text .globl distance .type distance, @function distance: .LFB18: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq %rdx, -40(%rbp) movq %rcx, -48(%rbp) movq -24(%rbp), %rax subq -40(%rbp), %rax movq %rax, %rdx movq -24(%rbp), %rax subq -40(%rbp), %rax imulq %rdx, %rax pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 movsd %xmm0, -16(%rbp) movq -32(%rbp), %rax subq -48(%rbp), %rax movq %rax, %rdx movq -32(%rbp), %rax subq -48(%rbp), %rax imulq %rdx, %rax pxor %xmm0, %xmm0 cvtsi2sdq %rax, %xmm0 movsd %xmm0, -8(%rbp) movsd -16(%rbp), %xmm0 addsd -8(%rbp), %xmm0 movq %xmm0, %rax movq %rax, %xmm0 call sqrt@PLT movq %xmm0, %rax movq %rax, %xmm0 leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE18: .size distance, .-distance .globl pullcomp .type pullcomp, @function pullcomp: .LFB19: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -16(%rbp), %rax cmpq -8(%rbp), %rax jnb .L41 movl $-1, %eax jmp .L42 .L41: movq -16(%rbp), %rax cmpq -8(%rbp), %rax jbe .L43 movl $1, %eax jmp .L42 .L43: movl $0, %eax .L42: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE19: .size pullcomp, .-pullcomp .globl psllcomp .type psllcomp, @function psllcomp: .LFB20: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -16(%rbp), %rax cmpq -8(%rbp), %rax jnb .L45 movl $-1, %eax jmp .L46 .L45: movq -16(%rbp), %rax cmpq -8(%rbp), %rax jbe .L47 movl $1, %eax jmp .L46 .L47: movl $0, %eax .L46: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE20: .size psllcomp, .-psllcomp .globl pcharcomp .type pcharcomp, @function pcharcomp: .LFB21: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movzbl (%rax), %eax movb %al, -2(%rbp) movq -32(%rbp), %rax movzbl (%rax), %eax movb %al, -1(%rbp) movzbl -2(%rbp), %eax cmpb -1(%rbp), %al jge .L49 movl $-1, %eax jmp .L50 .L49: movzbl -2(%rbp), %eax cmpb -1(%rbp), %al jle .L51 movl $1, %eax jmp .L50 .L51: movl $0, %eax .L50: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE21: .size pcharcomp, .-pcharcomp .globl pstrcomp .type pstrcomp, @function pstrcomp: .LFB22: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -24(%rbp) movq %rsi, -32(%rbp) movq -24(%rbp), %rax movq (%rax), %rax movq %rax, -16(%rbp) movq -32(%rbp), %rax movq (%rax), %rax movq %rax, -8(%rbp) movq -8(%rbp), %rdx movq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE22: .size pstrcomp, .-pstrcomp .globl phwllABcomp .type phwllABcomp, @function phwllABcomp: .LFB23: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -40(%rbp) movq %rsi, -48(%rbp) movq -40(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -32(%rbp) movq %rdx, -24(%rbp) movq -48(%rbp), %rax movq 8(%rax), %rdx movq (%rax), %rax movq %rax, -16(%rbp) movq %rdx, -8(%rbp) movq -32(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jge .L55 movl $-1, %eax jmp .L60 .L55: movq -32(%rbp), %rdx movq -16(%rbp), %rax cmpq %rax, %rdx jle .L57 movl $1, %eax jmp .L60 .L57: movq -24(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx jge .L58 movl $-1, %eax jmp .L60 .L58: movq -24(%rbp), %rdx movq -8(%rbp), %rax cmpq %rax, %rdx jle .L59 movl $1, %eax jmp .L60 .L59: movl $0, %eax .L60: popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE23: .size phwllABcomp, .-phwllABcomp .globl isinrange .type isinrange, @function isinrange: .LFB24: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq %rdx, -24(%rbp) movq -8(%rbp), %rax cmpq -16(%rbp), %rax jg .L62 movq -16(%rbp), %rax cmpq -24(%rbp), %rax jg .L62 movl $1, %eax jmp .L63 .L62: movl $0, %eax .L63: andl $1, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE24: .size isinrange, .-isinrange .globl bitdp .bss .align 32 .type bitdp, @object .size bitdp, 16777216 bitdp: .zero 16777216 .text .globl mergeteq .type mergeteq, @function mergeteq: .LFB25: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $96, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 12, -40 .cfi_offset 3, -48 movq %rdi, -104(%rbp) movq %rsi, -112(%rbp) movq %fs:40, %rax movq %rax, -40(%rbp) xorl %eax, %eax movq %rsp, %rax movq %rax, %r12 movq -112(%rbp), %rax shrq %rax movq %rax, -72(%rbp) movq -112(%rbp), %rax subq -72(%rbp), %rax movq %rax, -64(%rbp) cmpq $1, -112(%rbp) jne .L66 movl $0, %eax jmp .L67 .L66: movq -72(%rbp), %rdx movq -104(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call mergeteq movq %rax, %rbx movq -72(%rbp), %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax addq %rax, %rdx movq -64(%rbp), %rax movq %rax, %rsi movq %rdx, %rdi call mergeteq addq %rbx, %rax movq %rax, -96(%rbp) movq -112(%rbp), %rax movq %rax, %rdx subq $1, %rdx movq %rdx, -56(%rbp) movq %rax, -128(%rbp) movq $0, -120(%rbp) movq %rax, %r14 movl $0, %r15d leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %ebx movl $0, %edx divq %rbx imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L68: cmpq %rdx, %rsp je .L69 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L68 .L69: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L70 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L70: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -48(%rbp) movq $0, -88(%rbp) movq $0, -80(%rbp) jmp .L71 .L75: movq -72(%rbp), %rax cmpq %rax, -88(%rbp) jne .L72 movq -88(%rbp), %rdx movq -80(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax addq %rdx, %rax movq -88(%rbp), %rcx movq -80(%rbp), %rdx addq %rdx, %rcx movq (%rax), %rdx movq -48(%rbp), %rax movq %rdx, (%rax,%rcx,8) addq $1, -80(%rbp) jmp .L71 .L72: movq -64(%rbp), %rax cmpq %rax, -80(%rbp) jne .L73 movq -88(%rbp), %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax addq %rdx, %rax movq -88(%rbp), %rcx movq -80(%rbp), %rdx addq %rdx, %rcx movq (%rax), %rdx movq -48(%rbp), %rax movq %rdx, (%rax,%rcx,8) addq $1, -88(%rbp) jmp .L71 .L73: movq -88(%rbp), %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax addq %rdx, %rax movq (%rax), %rdx movq -80(%rbp), %rcx movq -72(%rbp), %rax addq %rcx, %rax leaq 0(,%rax,8), %rcx movq -104(%rbp), %rax addq %rcx, %rax movq (%rax), %rax cmpq %rax, %rdx jbe .L74 movq -80(%rbp), %rdx movq -72(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax addq %rdx, %rax movq -88(%rbp), %rcx movq -80(%rbp), %rdx addq %rdx, %rcx movq (%rax), %rdx movq -48(%rbp), %rax movq %rdx, (%rax,%rcx,8) movq -88(%rbp), %rdx movq -72(%rbp), %rax subq %rdx, %rax addq %rax, -96(%rbp) addq $1, -80(%rbp) jmp .L71 .L74: movq -88(%rbp), %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax addq %rdx, %rax movq -88(%rbp), %rcx movq -80(%rbp), %rdx addq %rdx, %rcx movq (%rax), %rdx movq -48(%rbp), %rax movq %rdx, (%rax,%rcx,8) addq $1, -88(%rbp) .L71: movq -88(%rbp), %rax cmpq %rax, -72(%rbp) ja .L75 movq -80(%rbp), %rax cmpq %rax, -64(%rbp) ja .L75 movq $0, -88(%rbp) jmp .L76 .L77: movq -88(%rbp), %rax leaq 0(,%rax,8), %rdx movq -104(%rbp), %rax leaq (%rdx,%rax), %rcx movq -48(%rbp), %rax movq -88(%rbp), %rdx movq (%rax,%rdx,8), %rax movq %rax, (%rcx) addq $1, -88(%rbp) .L76: movq -88(%rbp), %rax cmpq %rax, -112(%rbp) ja .L77 movq -96(%rbp), %rax .L67: movq %r12, %rsp movq -40(%rbp), %rdx subq %fs:40, %rdx je .L79 call __stack_chk_fail@PLT .L79: leaq -32(%rbp), %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE25: .size mergeteq, .-mergeteq .section .rodata .LC3: .string "%lld\n" .text .globl solve .type solve, @function solve: .LFB26: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $96, %rsp movq $0, -72(%rbp) movq $0, -64(%rbp) movq $0, -56(%rbp) movq vua(%rip), %rax movl %eax, %edx movq vub(%rip), %rax addl %eax, %edx movq vuc(%rip), %rax addl %edx, %eax movl $1, %edx movl %eax, %ecx sall %cl, %edx movq vub(%rip), %rax movl %eax, %ecx movq vuc(%rip), %rax addl %ecx, %eax movl $1, %esi movl %eax, %ecx sall %cl, %esi movl %esi, %eax addl %eax, %edx movq vuc(%rip), %rax movl $1, %esi movl %eax, %ecx sall %cl, %esi movl %esi, %eax addl %edx, %eax addl $1, %eax cltq movq %rax, -48(%rbp) movq vua(%rip), %rdx movq vub(%rip), %rax addq %rax, %rdx movq vuc(%rip), %rax addq %rdx, %rax addq $1, %rax movq %rax, -40(%rbp) movq -40(%rbp), %rax movl $1, %edx movl %eax, %ecx sall %cl, %edx movl %edx, %eax subl $1, %eax cltq movq %rax, -32(%rbp) movq $1, 8+bitdp(%rip) movq $0, -96(%rbp) jmp .L81 .L93: movq -96(%rbp), %rax andl $1, %eax movq %rax, -24(%rbp) movq -24(%rbp), %rax xorq $1, %rax movq %rax, -16(%rbp) movq $0, -88(%rbp) jmp .L82 .L83: movq -16(%rbp), %rax salq $20, %rax movq %rax, %rdx movq -88(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx leaq bitdp(%rip), %rax movq $0, (%rdx,%rax) addq $1, -88(%rbp) .L82: movq -40(%rbp), %rax movl %eax, %edx movq -88(%rbp), %rax movl %edx, %ecx sarq %cl, %rax testq %rax, %rax je .L83 movq $1, -88(%rbp) jmp .L84 .L89: movq -24(%rbp), %rax salq $20, %rax movq %rax, %rdx movq -88(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx leaq bitdp(%rip), %rax movq (%rdx,%rax), %rax testq %rax, %rax je .L97 movq $1, -80(%rbp) jmp .L87 .L88: movq -80(%rbp), %rax movl %eax, %edx movq -88(%rbp), %rax movl %edx, %ecx salq %cl, %rax andq -32(%rbp), %rax leaq 1(%rax), %rdx movq -16(%rbp), %rax salq $20, %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx leaq bitdp(%rip), %rax addq %rdx, %rax movq %rax, -8(%rbp) movq -8(%rbp), %rax movq (%rax), %rcx movq -24(%rbp), %rax salq $20, %rax movq %rax, %rdx movq -88(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx leaq bitdp(%rip), %rax movq (%rdx,%rax), %rax addq %rax, %rcx movabsq $-8543223828751151131, %rdx movq %rcx, %rax mulq %rdx movq %rdx, %rax shrq $29, %rax imulq $1000000007, %rax, %rdx movq %rcx, %rax subq %rdx, %rax movq -8(%rbp), %rdx movq %rax, (%rdx) addq $1, -80(%rbp) .L87: cmpq $10, -80(%rbp) jle .L88 jmp .L86 .L97: nop .L86: addq $1, -88(%rbp) .L84: movq -40(%rbp), %rax movl %eax, %edx movq -88(%rbp), %rax movl %edx, %ecx sarq %cl, %rax testq %rax, %rax je .L89 movq $0, -88(%rbp) jmp .L90 .L92: movq -88(%rbp), %rax andq -48(%rbp), %rax cmpq %rax, -48(%rbp) jne .L91 movq -16(%rbp), %rax salq $20, %rax movq %rax, %rdx movq -88(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx leaq bitdp(%rip), %rax movq $0, (%rdx,%rax) .L91: addq $1, -88(%rbp) .L90: movq -40(%rbp), %rax movl %eax, %edx movq -88(%rbp), %rax movl %edx, %ecx sarq %cl, %rax testq %rax, %rax je .L92 addq $1, -96(%rbp) .L81: movq -96(%rbp), %rdx movq n(%rip), %rax cmpq %rax, %rdx jb .L93 movq $0, -72(%rbp) movq $0, -88(%rbp) jmp .L94 .L95: movq n(%rip), %rax andl $1, %eax salq $20, %rax movq %rax, %rdx movq -88(%rbp), %rax addq %rdx, %rax leaq 0(,%rax,8), %rdx leaq bitdp(%rip), %rax movq (%rdx,%rax), %rdx movq -72(%rbp), %rax leaq (%rdx,%rax), %rcx movabsq $-8543223828751151131, %rdx movq %rcx, %rax mulq %rdx movq %rdx, %rax shrq $29, %rax movq %rax, -72(%rbp) movq -72(%rbp), %rax imulq $1000000007, %rax, %rdx movq %rcx, %rax subq %rdx, %rax movq %rax, -72(%rbp) addq $1, -88(%rbp) .L94: movq -40(%rbp), %rax movl %eax, %edx movq -88(%rbp), %rax movl %edx, %ecx sarq %cl, %rax testq %rax, %rax je .L95 movq n(%rip), %rax movl $1000000007, %edx movq %rax, %rsi movl $10, %edi call bitpow subq -72(%rbp), %rax leaq 1000000007(%rax), %rcx movabsq $-8543223828751151131, %rdx movq %rcx, %rax mulq %rdx movq %rdx, %rax shrq $29, %rax movq %rax, -72(%rbp) movq -72(%rbp), %rax imulq $1000000007, %rax, %rdx movq %rcx, %rax subq %rdx, %rax movq %rax, -72(%rbp) movq -72(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE26: .size solve, .-solve .section .rodata .LC4: .string "%llu" .LC5: .string "%llu%llu%llu" .text .globl main .type main, @function main: .LFB27: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq m(%rip), %rax movq %rax, %rdx leaq n(%rip), %rax movq %rax, %rsi leaq .LC4(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT subq $8, %rsp leaq vuf(%rip), %rax pushq %rax leaq vue(%rip), %r9 leaq vud(%rip), %r8 leaq vuc(%rip), %rax movq %rax, %rcx leaq vub(%rip), %rax movq %rax, %rdx leaq vua(%rip), %rax movq %rax, %rsi leaq .LC5(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addq $16, %rsp movl $0, %eax call solve movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE27: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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 {\n double ans=1+q*((x-1)/2/q)+(1-q)*((x+1)/2/q);\n printf(\"%.7f\\n\",ans);\n }\n}\n\nint main(void){\n run();\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC2:\n\t.string\t\"%.7f\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-28(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-28(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t.LC1(%rip), %xmm1\n\tdivsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -24(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-24(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L5\n.L2:\n\tmovl\t-32(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-24(%rbp), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmulsd\t-24(%rbp), %xmm1\n\tmovsd\t.LC3(%rip), %xmm0\n\taddsd\t%xmm0, %xmm1\n\tmovsd\t.LC3(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm2\n\tsubsd\t-24(%rbp), %xmm2\n\tmovl\t-32(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-24(%rbp), %xmm0\n\tmulsd\t%xmm2, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n.L5:\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L4\n\tcall\t__stack_chk_fail@PLT\n.L4:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC1:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1072693248\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t4(%rsp), %xmm1\n\tdivsd\t.LC1(%rip), %xmm1\n\ttestb\t$1, %al\n\tjne\t.L2\n\tmovl\t%eax, %edx\n\tpxor\t%xmm0, %xmm0\n\tmovl\t$1, %edi\n\tshrl\t$31, %edx\n\tleaq\t.LC2(%rip), %rsi\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovl\t%eax, (%rsp)\n\tmovl\t$1, %eax\n\tdivsd\t%xmm1, %xmm0\n\tcall\t__printf_chk@PLT\n.L1:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\t.cfi_restore_state\n\tleal\t-1(%rax), %ecx\n\tpxor\t%xmm0, %xmm0\n\taddl\t$1, %eax\n\tmovl\t$1, %edi\n\tmovl\t%ecx, %edx\n\tpxor\t%xmm2, %xmm2\n\tmovsd\t.LC3(%rip), %xmm3\n\tleaq\t.LC2(%rip), %rsi\n\tshrl\t$31, %edx\n\taddl\t%ecx, %edx\n\tsarl\t%edx\n\tcvtsi2sdl\t%edx, %xmm0\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tdivsd\t%xmm1, %xmm0\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovl\t$1, %eax\n\tdivsd\t%xmm1, %xmm2\n\tmulsd\t%xmm1, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tsubsd\t%xmm1, %xmm3\n\tmulsd\t%xmm3, %xmm2\n\taddsd\t%xmm2, %xmm0\n\tcall\t__printf_chk@PLT\n\tjmp\t.L1\n.L7:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC1:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1072693248\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rdx\n\tmovq\t%rsp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t(%rsp), %eax\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t4(%rsp), %xmm1\n\tdivsd\t.LC1(%rip), %xmm1\n\ttestb\t$1, %al\n\tjne\t.L2\n\tmovl\t%eax, %edx\n\tpxor\t%xmm0, %xmm0\n\tmovl\t$1, %edi\n\tshrl\t$31, %edx\n\tleaq\t.LC2(%rip), %rsi\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovl\t%eax, (%rsp)\n\tmovl\t$1, %eax\n\tdivsd\t%xmm1, %xmm0\n\tcall\t__printf_chk@PLT\n.L1:\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L7\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\t.cfi_restore_state\n\tleal\t-1(%rax), %ecx\n\tpxor\t%xmm0, %xmm0\n\taddl\t$1, %eax\n\tmovl\t$1, %edi\n\tmovl\t%ecx, %edx\n\tpxor\t%xmm2, %xmm2\n\tmovsd\t.LC3(%rip), %xmm3\n\tleaq\t.LC2(%rip), %rsi\n\tshrl\t$31, %edx\n\taddl\t%ecx, %edx\n\tsarl\t%edx\n\tcvtsi2sdl\t%edx, %xmm0\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tdivsd\t%xmm1, %xmm0\n\tcvtsi2sdl\t%eax, %xmm2\n\tmovl\t$1, %eax\n\tdivsd\t%xmm1, %xmm2\n\tmulsd\t%xmm1, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tsubsd\t%xmm1, %xmm3\n\tmulsd\t%xmm3, %xmm2\n\taddsd\t%xmm2, %xmm0\n\tcall\t__printf_chk@PLT\n\tjmp\t.L1\n.L7:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\trun, .-run\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 16\n\tcall\trun\n\txorl\t%eax, %eax\n\taddq\t$8, %rsp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC1:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1072693248\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 {\n double ans=1+q*((x-1)/2/q)+(1-q)*((x+1)/2/q);\n printf(\"%.7f\\n\",ans);\n }\n}\n\nint main(void){\n run();\n return 0;\n}", "index": 102, "inputs": [ "6\n36\n", "101\n141\n", "3\n101\n", "6\n38\n", "101\n233\n", "3\n111\n", "6\n59\n", "101\n416\n", "3\n001\n", "6\n106\n", "101\n221\n", "3\n011\n", "6\n174\n", "101\n27\n", "3\n010\n", "6\n95\n", "101\n37\n", "3\n110\n", "6\n180\n", "101\n67\n", "3\n000\n", "6\n274\n", "101\n133\n", "6\n138\n", "101\n122\n", "6\n232\n", "101\n25\n", "6\n397\n", "101\n36\n", "6\n414\n", "101\n65\n", "6\n534\n", "101\n102\n", "6\n805\n", "101\n56\n", "6\n944\n", "101\n4\n", "6\n857\n", "101\n8\n", "6\n813\n", "6\n819\n", "101\n-1\n", "6\n1401\n", "101\n1\n", "6\n1772\n", "101\n2\n", "6\n1247\n", "101\n-2\n", "6\n160\n", "101\n3\n", "6\n20\n", "101\n6\n", "6\n25\n", "101\n13\n", "6\n19\n", "101\n24\n", "6\n37\n", "101\n11\n", "6\n56\n", "101\n9\n", "6\n30\n", "101\n5\n", "6\n35\n", "101\n10\n", "6\n61\n", "101\n16\n", "6\n85\n", "101\n46\n", "6\n121\n", "101\n82\n", "6\n169\n", "101\n132\n", "6\n254\n", "101\n131\n", "6\n463\n", "101\n216\n", "6\n370\n", "101\n14\n", "6\n473\n", "101\n15\n", "6\n603\n", "101\n20\n", "6\n472\n", "101\n23\n", "6\n866\n", "101\n29\n", "6\n1673\n", "101\n47\n", "6\n2959\n", "101\n57\n", "6\n2729\n", "101\n83\n", "6\n2101\n", "101\n71\n", "6\n3231\n", "101\n105\n", "6\n4715\n", "101\n117\n", "6\n1098\n", "101\n197\n", "6\n40\n", "3\n100\n", "3\n100\n", "101\n80\n" ], "outputs": [ "8.3333333\n", "36.1702128\n", "1.9801980\n", "7.8947368\n", "21.8884120\n", "1.8018018\n", "5.0847458\n", "12.2596154\n", "200.0000000\n", "2.8301887\n", "23.0769231\n", "18.1818182\n", "1.7241379\n", "188.8888889\n", "20.0000000\n", "3.1578947\n", "137.8378378\n", "1.8181818\n", "1.6666667\n", "76.1194030\n", "-nan\n", "1.0948905\n", "38.3458647\n", "2.1739130\n", "41.8032787\n", "1.2931034\n", "204.0000000\n", "0.7556675\n", "141.6666667\n", "0.7246377\n", "78.4615385\n", "0.5617978\n", "50.0000000\n", "0.3726708\n", "91.0714286\n", "0.3177966\n", "1275.0000000\n", "0.3500583\n", "637.5000000\n", "0.3690037\n", "0.3663004\n", "-5100.0000000\n", "0.2141328\n", "5100.0000000\n", "0.1693002\n", "2550.0000000\n", "0.2405774\n", "-2550.0000000\n", "1.8750000\n", "1700.0000000\n", "15.0000000\n", "850.0000000\n", "12.0000000\n", "392.3076923\n", "15.7894737\n", "212.5000000\n", "8.1081081\n", "463.6363636\n", "5.3571429\n", "566.6666667\n", "10.0000000\n", "1020.0000000\n", "8.5714286\n", "510.0000000\n", "4.9180328\n", "318.7500000\n", "3.5294118\n", "110.8695652\n", "2.4793388\n", "62.1951220\n", "1.7751479\n", "38.6363636\n", "1.1811024\n", "38.9312977\n", "0.6479482\n", "23.6111111\n", "0.8108108\n", "364.2857143\n", "0.6342495\n", "340.0000000\n", "0.4975124\n", "255.0000000\n", "0.6355932\n", "221.7391304\n", "0.3464203\n", "175.8620690\n", "0.1793186\n", "108.5106383\n", "0.1013856\n", "89.4736842\n", "0.1099304\n", "61.4457831\n", "0.1427891\n", "71.8309859\n", "0.0928505\n", "48.5714286\n", "0.0636267\n", "43.5897436\n", "0.2732240\n", "25.8883249\n", "7.5000000\n", "2.0000000\n", "2.0000000\n", "63.7500000\n" ], "question": "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 {\n double ans=1+q*((x-1)/2/q)+(1-q)*((x+1)/2/q);\n printf(\"%.7f\\n\",ans);\n }\n}\n\nint main(void){\n run();\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d%d\"\n.LC2:\n\t.string\t\"%.7f\\n\"\n\t.text\n\t.globl\trun\n\t.type\trun, @function\nrun:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-28(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-28(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tmovsd\t.LC1(%rip), %xmm1\n\tdivsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -24(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tandl\t$1, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L2\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -32(%rbp)\n\tmovl\t-32(%rbp), %eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-24(%rbp), %xmm0\n\tmovq\t%xmm0, %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n\tjmp\t.L5\n.L2:\n\tmovl\t-32(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-24(%rbp), %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tmulsd\t-24(%rbp), %xmm1\n\tmovsd\t.LC3(%rip), %xmm0\n\taddsd\t%xmm0, %xmm1\n\tmovsd\t.LC3(%rip), %xmm0\n\tmovapd\t%xmm0, %xmm2\n\tsubsd\t-24(%rbp), %xmm2\n\tmovl\t-32(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%eax, %xmm0\n\tdivsd\t-24(%rbp), %xmm0\n\tmulsd\t%xmm2, %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$1, %eax\n\tcall\tprintf@PLT\n.L5:\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L4\n\tcall\t__stack_chk_fail@PLT\n.L4:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\trun, .-run\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tcall\trun\n\tmovl\t$0, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC1:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC3:\n\t.long\t0\n\t.long\t1072693248\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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)*((x+1)/2/q); printf("%.7f\n",ans); } } int main(void){ run(); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d%d" .LC2: .string "%.7f\n" .text .globl run .type run, @function run: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -28(%rbp), %rdx leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -28(%rbp), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 movsd .LC1(%rip), %xmm1 divsd %xmm1, %xmm0 movsd %xmm0, -24(%rbp) movl -32(%rbp), %eax andl $1, %eax testl %eax, %eax jne .L2 movl -32(%rbp), %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, -32(%rbp) movl -32(%rbp), %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 divsd -24(%rbp), %xmm0 movq %xmm0, %rax movq %rax, %xmm0 leaq .LC2(%rip), %rax movq %rax, %rdi movl $1, %eax call printf@PLT jmp .L5 .L2: movl -32(%rbp), %eax subl $1, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 divsd -24(%rbp), %xmm0 movapd %xmm0, %xmm1 mulsd -24(%rbp), %xmm1 movsd .LC3(%rip), %xmm0 addsd %xmm0, %xmm1 movsd .LC3(%rip), %xmm0 movapd %xmm0, %xmm2 subsd -24(%rbp), %xmm2 movl -32(%rbp), %eax addl $1, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax pxor %xmm0, %xmm0 cvtsi2sdl %eax, %xmm0 divsd -24(%rbp), %xmm0 mulsd %xmm2, %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, -16(%rbp) movq -16(%rbp), %rax movq %rax, %xmm0 leaq .LC2(%rip), %rax movq %rax, %rdi movl $1, %eax call printf@PLT .L5: nop movq -8(%rbp), %rax subq %fs:40, %rax je .L4 call __stack_chk_fail@PLT .L4: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size run, .-run .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 call run movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .section .rodata .align 8 .LC1: .long 0 .long 1079574528 .align 8 .LC3: .long 0 .long 1072693248 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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, \"keyence\")==0 ? 1 : 0);\n\n for(int i=0; i<=len; i++)\n for(int j=i; j<=len; j++){\n char t[105];\n int tlen = 0;\n for(int l=0; l<len; l++){\n\tif(l>=i && l<j) continue;\n\tt[tlen++] = s[l];\n }\n \n int flag = (tlen==7 ? 1 : 0);\n for(int k=0; k<tlen; k++)\n\tif(t[k] != key[k]) flag = 0;\n if(flag){\n\tans = 1;\n\tbreak;\n }\n }\n \n printf(\"%s\\n\", (ans ? \"YES\" : \"NO\"));\n\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.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"keyence\"\n.LC2:\n\t.string\t\"YES\"\n.LC3:\n\t.string\t\"NO\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$288, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-240(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-240(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tmovl\t%eax, -252(%rbp)\n\tmovabsq\t$28538298447783275, %rax\n\tmovq\t%rax, -248(%rbp)\n\tleaq\t-240(%rbp), %rax\n\tleaq\t.LC1(%rip), %rdx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, -280(%rbp)\n\tmovl\t$0, -276(%rbp)\n\tjmp\t.L2\n.L14:\n\tmovl\t-276(%rbp), %eax\n\tmovl\t%eax, -272(%rbp)\n\tjmp\t.L3\n.L13:\n\tmovl\t$0, -268(%rbp)\n\tmovl\t$0, -264(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovl\t-264(%rbp), %eax\n\tcmpl\t-276(%rbp), %eax\n\tjl\t.L5\n\tmovl\t-264(%rbp), %eax\n\tcmpl\t-272(%rbp), %eax\n\tjl\t.L19\n.L5:\n\tmovl\t-268(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -268(%rbp)\n\tmovl\t-264(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovzbl\t-240(%rbp,%rdx), %edx\n\tcltq\n\tmovb\t%dl, -128(%rbp,%rax)\n\tjmp\t.L6\n.L19:\n\tnop\n.L6:\n\taddl\t$1, -264(%rbp)\n.L4:\n\tmovl\t-264(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjl\t.L7\n\tcmpl\t$7, -268(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, -260(%rbp)\n\tmovl\t$0, -256(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-256(%rbp), %eax\n\tcltq\n\tmovzbl\t-128(%rbp,%rax), %edx\n\tmovl\t-256(%rbp), %eax\n\tcltq\n\tmovzbl\t-248(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L9\n\tmovl\t$0, -260(%rbp)\n.L9:\n\taddl\t$1, -256(%rbp)\n.L8:\n\tmovl\t-256(%rbp), %eax\n\tcmpl\t-268(%rbp), %eax\n\tjl\t.L10\n\tcmpl\t$0, -260(%rbp)\n\tje\t.L11\n\tmovl\t$1, -280(%rbp)\n\tjmp\t.L12\n.L11:\n\taddl\t$1, -272(%rbp)\n.L3:\n\tmovl\t-272(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjle\t.L13\n.L12:\n\taddl\t$1, -276(%rbp)\n.L2:\n\tmovl\t-276(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjle\t.L14\n\tcmpl\t$0, -280(%rbp)\n\tje\t.L15\n\tleaq\t.LC2(%rip), %rax\n\tjmp\t.L16\n.L15:\n\tleaq\t.LC3(%rip), %rax\n.L16:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L18\n\tcall\t__stack_chk_fail@PLT\n.L18:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.LFB35:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC2(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$264, %rsp\n\t.cfi_def_cfa_offset 320\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 248(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\tleaq\t.LC3(%rip), %rsi\n\tmovq\t%rbp, %rdi\n\tmovq\t%rax, %rbx\n\tmovl\t%eax, %r13d\n\tcall\tstrcmp@PLT\n\tmovl\t.LC3(%rip), %r11d\n\tmovq\t.LC3(%rip), %r14\n\ttestl\t%eax, %eax\n\tmovq\t.LC3(%rip), %r15\n\tsete\t%al\n\tsall\t$8, %r11d\n\txorl\t%esi, %esi\n\txorl\t%r8d, %r8d\n\tsalq\t$24, %r14\n\tmovzbl\t%al, %eax\n\tsalq\t$16, %r15\n\tmovl\t%eax, 12(%rsp)\n\tsarl\t$24, %r11d\n\tsarq\t$56, %r14\n\tsarq\t$56, %r15\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t.LC3(%rip), %r10\n\tmovzwl\t.LC3(%rip), %r9d\n\tmovl\t%esi, %edi\n\tsalq\t$8, %r10\n\tsarw\t$8, %r9w\n\tsarq\t$56, %r10\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\ttestq\t%rbx, %rbx\n\tje\t.L15\n\txorl\t%eax, %eax\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tcmpl\t%eax, %esi\n\tjg\t.L24\n\tcmpl\t%eax, %edi\n\tjg\t.L3\n.L24:\n\tmovzbl\t0(%rbp,%rax), %r12d\n\tmovslq\t%edx, %rcx\n\taddl\t$1, %edx\n\tmovb\t%r12b, 128(%rsp,%rcx)\n.L3:\n\taddq\t$1, %rax\n\tcmpq\t%rax, %rbx\n\tjne\t.L5\n\txorl\t%eax, %eax\n\tcmpl\t$7, %edx\n\tsete\t%al\n\ttestl\t%edx, %edx\n\tje\t.L6\n\tmovzbl\t.LC3(%rip), %ecx\n\tcmpb\t%cl, 128(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$1, %edx\n\tje\t.L6\n\tcmpb\t%r9b, 129(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$2, %edx\n\tje\t.L6\n\tcmpb\t%r11b, 130(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$3, %edx\n\tje\t.L6\n\tmovl\t.LC3(%rip), %ecx\n\tsarl\t$24, %ecx\n\tcmpb\t%cl, 131(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$4, %edx\n\tje\t.L6\n\tcmpb\t%r14b, 132(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$5, %edx\n\tje\t.L6\n\tcmpb\t%r15b, 133(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$6, %edx\n\tje\t.L6\n\tcmpb\t%r10b, 134(%rsp)\n\tje\t.L59\n.L14:\n\taddl\t$1, %edi\n\tcmpl\t%edi, %r13d\n\tjge\t.L19\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L59:\n\tcmpl\t$7, %edx\n\tje\t.L6\n\tcmpb\t$0, 135(%rsp)\n\tjne\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\ttestl\t%eax, %eax\n\tje\t.L14\n\tmovl\t%eax, 12(%rsp)\n.L15:\n\taddl\t$1, %esi\n\tcmpl\t%esi, %r13d\n\tjge\t.L2\n\tmovl\t12(%rsp), %eax\n\tleaq\t.LC0(%rip), %rdi\n\ttestl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rax\n\tcmove\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\t248(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L60\n\taddq\t$264, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L60:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tleaq\t.LC2(%rip), %rdi\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$264, %rsp\n\t.cfi_def_cfa_offset 320\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 248(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t16(%rsp), %rbp\n\tmovq\t%rbp, %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t%rbp, %rdi\n\tcall\tstrlen@PLT\n\tleaq\t.LC3(%rip), %rsi\n\tmovq\t%rbp, %rdi\n\tmovq\t%rax, %rbx\n\tmovl\t%eax, %r13d\n\tcall\tstrcmp@PLT\n\tmovl\t.LC3(%rip), %r11d\n\tmovq\t.LC3(%rip), %r14\n\ttestl\t%eax, %eax\n\tmovq\t.LC3(%rip), %r15\n\tsete\t%al\n\tsall\t$8, %r11d\n\txorl\t%esi, %esi\n\txorl\t%r8d, %r8d\n\tsalq\t$24, %r14\n\tmovzbl\t%al, %eax\n\tsalq\t$16, %r15\n\tmovl\t%eax, 12(%rsp)\n\tsarl\t$24, %r11d\n\tsarq\t$56, %r14\n\tsarq\t$56, %r15\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovq\t.LC3(%rip), %r10\n\tmovzwl\t.LC3(%rip), %r9d\n\tmovl\t%esi, %edi\n\tsalq\t$8, %r10\n\tsarw\t$8, %r9w\n\tsarq\t$56, %r10\n\t.p2align 4,,10\n\t.p2align 3\n.L19:\n\ttestq\t%rbx, %rbx\n\tje\t.L15\n\txorl\t%eax, %eax\n\txorl\t%edx, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tcmpl\t%eax, %esi\n\tjg\t.L24\n\tcmpl\t%eax, %edi\n\tjg\t.L3\n.L24:\n\tmovzbl\t0(%rbp,%rax), %r12d\n\tmovslq\t%edx, %rcx\n\taddl\t$1, %edx\n\tmovb\t%r12b, 128(%rsp,%rcx)\n.L3:\n\taddq\t$1, %rax\n\tcmpq\t%rax, %rbx\n\tjne\t.L5\n\txorl\t%eax, %eax\n\tcmpl\t$7, %edx\n\tsete\t%al\n\ttestl\t%edx, %edx\n\tje\t.L6\n\tmovzbl\t.LC3(%rip), %ecx\n\tcmpb\t%cl, 128(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$1, %edx\n\tje\t.L6\n\tcmpb\t%r9b, 129(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$2, %edx\n\tje\t.L6\n\tcmpb\t%r11b, 130(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$3, %edx\n\tje\t.L6\n\tmovl\t.LC3(%rip), %ecx\n\tsarl\t$24, %ecx\n\tcmpb\t%cl, 131(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$4, %edx\n\tje\t.L6\n\tcmpb\t%r14b, 132(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$5, %edx\n\tje\t.L6\n\tcmpb\t%r15b, 133(%rsp)\n\tcmovne\t%r8d, %eax\n\tcmpl\t$6, %edx\n\tje\t.L6\n\tcmpb\t%r10b, 134(%rsp)\n\tje\t.L59\n.L14:\n\taddl\t$1, %edi\n\tcmpl\t%edi, %r13d\n\tjge\t.L19\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L59:\n\tcmpl\t$7, %edx\n\tje\t.L6\n\tcmpb\t$0, 135(%rsp)\n\tjne\t.L14\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\ttestl\t%eax, %eax\n\tje\t.L14\n\tmovl\t%eax, 12(%rsp)\n.L15:\n\taddl\t$1, %esi\n\tcmpl\t%esi, %r13d\n\tjge\t.L2\n\tmovl\t12(%rsp), %eax\n\tleaq\t.LC0(%rip), %rdi\n\ttestl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rax\n\tcmove\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovq\t248(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L60\n\taddq\t$264, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L60:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE35:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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, \"keyence\")==0 ? 1 : 0);\n\n for(int i=0; i<=len; i++)\n for(int j=i; j<=len; j++){\n char t[105];\n int tlen = 0;\n for(int l=0; l<len; l++){\n\tif(l>=i && l<j) continue;\n\tt[tlen++] = s[l];\n }\n \n int flag = (tlen==7 ? 1 : 0);\n for(int k=0; k<tlen; k++)\n\tif(t[k] != key[k]) flag = 0;\n if(flag){\n\tans = 1;\n\tbreak;\n }\n }\n \n printf(\"%s\\n\", (ans ? \"YES\" : \"NO\"));\n\n return 0;\n}\n", "index": 105, "inputs": [ "ecneyek\n", "ashkfyha\n", "eeyofscienck\n", "mnyszsbzpf\n", "ecneyel\n", "arhkfyha\n", "eeyofsciencj\n", "mnyszsb{pf\n", "ecleyen\n", "arhkyfha\n", "eeyofscienci\n", "mnzszsb{pf\n", "neyelce\n", "ahfykhra\n", "eeyofscjenci\n", "mnzs{sb{pf\n", "neyemce\n", "ahfzkhra\n", "icnejcsfoyee\n", "snzs{mb{pf\n", "oeyemce\n", "arhkzfha\n", "icnyjcsfoeee\n", "snzs{mbfp{\n", "oemeyce\n", "arhkzfhb\n", "icmyjcsfoeee\n", "{pfbm{szns\n", "oemeycd\n", "arhkzfib\n", "eeeofscjymci\n", "{pfbl{szns\n", "dcyemeo\n", "arhkzfjb\n", "eeeofsjcymci\n", "{pfbn{szls\n", "dcyemen\n", "arhkzbjf\n", "eeeofsjdymci\n", "|pfbn{szls\n", "dcxemen\n", "arhkzjbf\n", "eeeofsjdyicm\n", "slzs{nbfp|\n", "dcxenen\n", "arhkzjaf\n", "eeeofsjdyjcm\n", "slzs|nbfp|\n", "dcxenfn\n", "arhkzkaf\n", "mcjydjsfoeee\n", "|pfbn|szls\n", "dcyenfn\n", "arhkzlaf\n", "mcjydjsfodee\n", "|pfbn}szls\n", "nfneycd\n", "akhrzlaf\n", "mcjyejsfodee\n", "slzs}nbfp|\n", "nfncyed\n", "akhrzlbf\n", "mcjyejsgodee\n", "|zfbn}spls\n", "nfmcyed\n", "`khrzlbf\n", "eedogsjeyjcm\n", "|yfbn}spls\n", "deycmfn\n", "fblzrhk`\n", "eedojsjeygcm\n", "|xfbn}spls\n", "deydmfn\n", "fbmzrhk`\n", "eedojrjeygcm\n", "bxf|n}spls\n", "deycmnf\n", "hbmzrfk`\n", "eedoirjeygcm\n", "slps}n|fxb\n", "dexcmnf\n", "hbmzrfka\n", "mcgyejriodee\n", "slpt}n|fxb\n", "dmxcenf\n", "hcmzrfka\n", "mcgyejriodfe\n", "slpt}n{fxb\n", "emxcenf\n", "hcmarfkz\n", "mcygejriodfe\n", "slpt}n{exb\n", "emxceof\n", "hczarfkm\n", "lcygejriodfe\n", "sxpt}n{elb\n", "foecxme\n", "mkfrazch\n", "lcygfjriodfe\n", "sxpt}nzelb\n", "mpyszsbznf\n", "keyence\n", "keyofscience\n", "keyofscience\n", "ashlfyha\n" ], "outputs": [ "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "NO\n", "YES\n", "YES\n", "YES\n", "NO\n" ], "question": "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, \"keyence\")==0 ? 1 : 0);\n\n for(int i=0; i<=len; i++)\n for(int j=i; j<=len; j++){\n char t[105];\n int tlen = 0;\n for(int l=0; l<len; l++){\n\tif(l>=i && l<j) continue;\n\tt[tlen++] = s[l];\n }\n \n int flag = (tlen==7 ? 1 : 0);\n for(int k=0; k<tlen; k++)\n\tif(t[k] != key[k]) flag = 0;\n if(flag){\n\tans = 1;\n\tbreak;\n }\n }\n \n printf(\"%s\\n\", (ans ? \"YES\" : \"NO\"));\n\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.LC0:\n\t.string\t\"%s\"\n.LC1:\n\t.string\t\"keyence\"\n.LC2:\n\t.string\t\"YES\"\n.LC3:\n\t.string\t\"NO\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$288, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-240(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tleaq\t-240(%rbp), %rax\n\tmovq\t%rax, %rdi\n\tcall\tstrlen@PLT\n\tmovl\t%eax, -252(%rbp)\n\tmovabsq\t$28538298447783275, %rax\n\tmovq\t%rax, -248(%rbp)\n\tleaq\t-240(%rbp), %rax\n\tleaq\t.LC1(%rip), %rdx\n\tmovq\t%rdx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tstrcmp@PLT\n\ttestl\t%eax, %eax\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, -280(%rbp)\n\tmovl\t$0, -276(%rbp)\n\tjmp\t.L2\n.L14:\n\tmovl\t-276(%rbp), %eax\n\tmovl\t%eax, -272(%rbp)\n\tjmp\t.L3\n.L13:\n\tmovl\t$0, -268(%rbp)\n\tmovl\t$0, -264(%rbp)\n\tjmp\t.L4\n.L7:\n\tmovl\t-264(%rbp), %eax\n\tcmpl\t-276(%rbp), %eax\n\tjl\t.L5\n\tmovl\t-264(%rbp), %eax\n\tcmpl\t-272(%rbp), %eax\n\tjl\t.L19\n.L5:\n\tmovl\t-268(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -268(%rbp)\n\tmovl\t-264(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovzbl\t-240(%rbp,%rdx), %edx\n\tcltq\n\tmovb\t%dl, -128(%rbp,%rax)\n\tjmp\t.L6\n.L19:\n\tnop\n.L6:\n\taddl\t$1, -264(%rbp)\n.L4:\n\tmovl\t-264(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjl\t.L7\n\tcmpl\t$7, -268(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t%eax, -260(%rbp)\n\tmovl\t$0, -256(%rbp)\n\tjmp\t.L8\n.L10:\n\tmovl\t-256(%rbp), %eax\n\tcltq\n\tmovzbl\t-128(%rbp,%rax), %edx\n\tmovl\t-256(%rbp), %eax\n\tcltq\n\tmovzbl\t-248(%rbp,%rax), %eax\n\tcmpb\t%al, %dl\n\tje\t.L9\n\tmovl\t$0, -260(%rbp)\n.L9:\n\taddl\t$1, -256(%rbp)\n.L8:\n\tmovl\t-256(%rbp), %eax\n\tcmpl\t-268(%rbp), %eax\n\tjl\t.L10\n\tcmpl\t$0, -260(%rbp)\n\tje\t.L11\n\tmovl\t$1, -280(%rbp)\n\tjmp\t.L12\n.L11:\n\taddl\t$1, -272(%rbp)\n.L3:\n\tmovl\t-272(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjle\t.L13\n.L12:\n\taddl\t$1, -276(%rbp)\n.L2:\n\tmovl\t-276(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjle\t.L14\n\tcmpl\t$0, -280(%rbp)\n\tje\t.L15\n\tleaq\t.LC2(%rip), %rax\n\tjmp\t.L16\n.L15:\n\tleaq\t.LC3(%rip), %rax\n.L16:\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L18\n\tcall\t__stack_chk_fail@PLT\n.L18:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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=0; i<=len; i++) for(int j=i; j<=len; j++){ char t[105]; int tlen = 0; for(int l=0; l<len; l++){ if(l>=i && l<j) continue; t[tlen++] = s[l]; } int flag = (tlen==7 ? 1 : 0); for(int k=0; k<tlen; k++) if(t[k] != key[k]) flag = 0; if(flag){ ans = 1; break; } } printf("%s\n", (ans ? "YES" : "NO")); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%s" .LC1: .string "keyence" .LC2: .string "YES" .LC3: .string "NO" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $288, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -240(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT leaq -240(%rbp), %rax movq %rax, %rdi call strlen@PLT movl %eax, -252(%rbp) movabsq $28538298447783275, %rax movq %rax, -248(%rbp) leaq -240(%rbp), %rax leaq .LC1(%rip), %rdx movq %rdx, %rsi movq %rax, %rdi call strcmp@PLT testl %eax, %eax sete %al movzbl %al, %eax movl %eax, -280(%rbp) movl $0, -276(%rbp) jmp .L2 .L14: movl -276(%rbp), %eax movl %eax, -272(%rbp) jmp .L3 .L13: movl $0, -268(%rbp) movl $0, -264(%rbp) jmp .L4 .L7: movl -264(%rbp), %eax cmpl -276(%rbp), %eax jl .L5 movl -264(%rbp), %eax cmpl -272(%rbp), %eax jl .L19 .L5: movl -268(%rbp), %eax leal 1(%rax), %edx movl %edx, -268(%rbp) movl -264(%rbp), %edx movslq %edx, %rdx movzbl -240(%rbp,%rdx), %edx cltq movb %dl, -128(%rbp,%rax) jmp .L6 .L19: nop .L6: addl $1, -264(%rbp) .L4: movl -264(%rbp), %eax cmpl -252(%rbp), %eax jl .L7 cmpl $7, -268(%rbp) sete %al movzbl %al, %eax movl %eax, -260(%rbp) movl $0, -256(%rbp) jmp .L8 .L10: movl -256(%rbp), %eax cltq movzbl -128(%rbp,%rax), %edx movl -256(%rbp), %eax cltq movzbl -248(%rbp,%rax), %eax cmpb %al, %dl je .L9 movl $0, -260(%rbp) .L9: addl $1, -256(%rbp) .L8: movl -256(%rbp), %eax cmpl -268(%rbp), %eax jl .L10 cmpl $0, -260(%rbp) je .L11 movl $1, -280(%rbp) jmp .L12 .L11: addl $1, -272(%rbp) .L3: movl -272(%rbp), %eax cmpl -252(%rbp), %eax jle .L13 .L12: addl $1, -276(%rbp) .L2: movl -276(%rbp), %eax cmpl -252(%rbp), %eax jle .L14 cmpl $0, -280(%rbp) je .L15 leaq .LC2(%rip), %rax jmp .L16 .L15: leaq .LC3(%rip), %rax .L16: movq %rax, %rdi call puts@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L18 call __stack_chk_fail@PLT .L18: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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\tfor (j = i + 1; j <= N; j++) if (j != N - i + p) printf(\"%d %d\\n\", i, j);\n\t}\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\timull\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$1, -20(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t$1, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L3\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tsubl\t-20(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -16(%rbp)\n\tje\t.L4\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L4:\n\taddl\t$1, -16(%rbp)\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjle\t.L5\n\taddl\t$1, -20(%rbp)\n.L2:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L6\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC2(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tmovl\t$1, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tleal\t-1(%rax), %edx\n\txorl\t%eax, %eax\n\timull\t%edx, %edx\n\tsarl\t%edx\n\tcall\t__printf_chk@PLT\n\tmovl\t4(%rsp), %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\tleal\t(%rdx,%rax), %ecx\n\tandl\t$1, %ecx\n\tsubl\t%ecx, %eax\n\tleal\t1(%rax), %r14d\n\tcmpl\t$1, %edx\n\tjle\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovl\t%ebp, %r13d\n\taddl\t$1, %ebp\n\tcmpl\t%ebp, %edx\n\tjl\t.L3\n\tmovl\t%ebp, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t%edx, %eax\n\tsubl\t%r13d, %eax\n\taddl\t%r14d, %eax\n\tcmpl\t%ebx, %eax\n\tje\t.L4\n\tmovl\t%ebx, %ecx\n\tmovl\t%r13d, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__printf_chk@PLT\n\tmovl\t4(%rsp), %edx\n\tcmpl\t%ebx, %edx\n\tjge\t.L6\n.L3:\n\tcmpl\t%edx, %ebp\n\tjl\t.L2\n.L7:\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\t.cfi_restore_state\n\taddl\t$1, %ebx\n\tcmpl\t%edx, %ebx\n\tjle\t.L6\n\tcmpl\t%edx, %ebp\n\tjl\t.L2\n\tjmp\t.L7\n.L16:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tpushq\t%r14\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 14, -16\n\tleaq\t.LC0(%rip), %rdi\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 13, -24\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 12, -32\n\tleaq\t.LC2(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 6, -40\n\tmovl\t$1, %ebp\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 3, -48\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 64\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\tmovl\t$1, %edi\n\tleaq\t.LC1(%rip), %rsi\n\tleal\t-1(%rax), %edx\n\txorl\t%eax, %eax\n\timull\t%edx, %edx\n\tsarl\t%edx\n\tcall\t__printf_chk@PLT\n\tmovl\t4(%rsp), %edx\n\tmovl\t%edx, %eax\n\tshrl\t$31, %eax\n\tleal\t(%rdx,%rax), %ecx\n\tandl\t$1, %ecx\n\tsubl\t%ecx, %eax\n\tleal\t1(%rax), %r14d\n\tcmpl\t$1, %edx\n\tjle\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L2:\n\tmovl\t%ebp, %r13d\n\taddl\t$1, %ebp\n\tcmpl\t%ebp, %edx\n\tjl\t.L3\n\tmovl\t%ebp, %ebx\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovl\t%edx, %eax\n\tsubl\t%r13d, %eax\n\taddl\t%r14d, %eax\n\tcmpl\t%ebx, %eax\n\tje\t.L4\n\tmovl\t%ebx, %ecx\n\tmovl\t%r13d, %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddl\t$1, %ebx\n\tcall\t__printf_chk@PLT\n\tmovl\t4(%rsp), %edx\n\tcmpl\t%ebx, %edx\n\tjge\t.L6\n.L3:\n\tcmpl\t%edx, %ebp\n\tjl\t.L2\n.L7:\n\tmovq\tstdout(%rip), %rdi\n\tcall\tfflush@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L16\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 48\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 40\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\t.cfi_restore_state\n\taddl\t$1, %ebx\n\tcmpl\t%edx, %ebx\n\tjle\t.L6\n\tcmpl\t%edx, %ebp\n\tjl\t.L2\n\tjmp\t.L7\n.L16:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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\tfor (j = i + 1; j <= N; j++) if (j != N - i + p) printf(\"%d %d\\n\", i, j);\n\t}\n\tfflush(stdout);\n\treturn 0;\n}", "index": 120, "inputs": [ "0\n", "4\n", "1\n", "2\n", "000\n", "001\n", "2\n", "0\n", "1\n", "4\n", "001\n", "000\n", "3\n", "3\n" ], "outputs": [ "0\n", "4\n1 2\n1 3\n2 4\n3 4\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "0\n", "4\n1 2\n1 3\n2 4\n3 4\n", "0\n", "0\n", "2\n1 3\n2 3\n", "2\n1 3\n2 3\n" ], "question": "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\tfor (j = i + 1; j <= N; j++) if (j != N - i + p) printf(\"%d %d\\n\", i, j);\n\t}\n\tfflush(stdout);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-24(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\timull\t%edx, %eax\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$1, -20(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tcltd\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, %edx\n\tmovl\t$1, %eax\n\tsubl\t%edx, %eax\n\tmovl\t%eax, -12(%rbp)\n\tjmp\t.L2\n.L6:\n\tmovl\t-20(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -16(%rbp)\n\tjmp\t.L3\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tsubl\t-20(%rbp), %eax\n\tmovl\t%eax, %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tcmpl\t%eax, -16(%rbp)\n\tje\t.L4\n\tmovl\t-16(%rbp), %edx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L4:\n\taddl\t$1, -16(%rbp)\n.L3:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjle\t.L5\n\taddl\t$1, -20(%rbp)\n.L2:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L6\n\tmovq\tstdout(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tfflush@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L8\n\tcall\t__stack_chk_fail@PLT\n.L8:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 + p) printf("%d %d\n", i, j); } fflush(stdout); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%d\n" .LC2: .string "%d %d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -24(%rbp), %eax leal -1(%rax), %edx movl -24(%rbp), %eax subl $1, %eax imull %edx, %eax movl %eax, %edx shrl $31, %edx addl %edx, %eax sarl %eax movl %eax, %esi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $1, -20(%rbp) movl -24(%rbp), %eax cltd shrl $31, %edx addl %edx, %eax andl $1, %eax subl %edx, %eax movl %eax, %edx movl $1, %eax subl %edx, %eax movl %eax, -12(%rbp) jmp .L2 .L6: movl -20(%rbp), %eax addl $1, %eax movl %eax, -16(%rbp) jmp .L3 .L5: movl -24(%rbp), %eax subl -20(%rbp), %eax movl %eax, %edx movl -12(%rbp), %eax addl %edx, %eax cmpl %eax, -16(%rbp) je .L4 movl -16(%rbp), %edx movl -20(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L4: addl $1, -16(%rbp) .L3: movl -24(%rbp), %eax cmpl %eax, -16(%rbp) jle .L5 addl $1, -20(%rbp) .L2: movl -24(%rbp), %eax cmpl %eax, -20(%rbp) jl .L6 movq stdout(%rip), %rax movq %rax, %rdi call fflush@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L8 call __stack_chk_fail@PLT .L8: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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#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];\n\tfor(int i = 0;i < n;i++)scanf(\"%ld\",&ar[i]);\n\tfor(int i = 0;i < n;i++)ar[i+n] = ar[i];\n\tlong timmin[n];\n\tfor(int i = 0;i < n;i++)timmin[i] = ar[i];\n\tull minans = 1llu<<63;\n\tfor(int emc = 0;emc < n;emc++){\n\t\tull tmp = 0;\n\t\tfor(int i = 0;i < n;i++)timmin[i] = stmin(timmin[i],ar[i+emc]);\n\t\tfor(int i = 0;i < n;i++)tmp += timmin[i];\n\t\tminans = stmin(minans,emc*(long long)x + tmp);\n\t}\n\tprintf(\"%llu\",minans);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %ld\"\n.LC1:\n\t.string\t\"%ld\"\n.LC2:\n\t.string\t\"%llu\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$136, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tleaq\t-112(%rbp), %rdx\n\tleaq\t-140(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-140(%rbp), %eax\n\taddl\t%eax, %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -88(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, -160(%rbp)\n\tmovq\t$0, -152(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, -176(%rbp)\n\tmovq\t$0, -168(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %edi\n\tmovl\t$0, %edx\n\tdivq\t%rdi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -80(%rbp)\n\tmovl\t$0, -136(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t-136(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -136(%rbp)\n.L5:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -136(%rbp)\n\tjl\t.L6\n\tmovl\t$0, -132(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-140(%rbp), %edx\n\tmovl\t-132(%rbp), %eax\n\tleal\t(%rdx,%rax), %esi\n\tmovq\t-80(%rbp), %rax\n\tmovl\t-132(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovq\t-80(%rbp), %rax\n\tmovslq\t%esi, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddl\t$1, -132(%rbp)\n.L7:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -132(%rbp)\n\tjl\t.L8\n\tmovl\t-140(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L9:\n\tcmpq\t%rdx, %rsp\n\tje\t.L10\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L9\n.L10:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L11\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L11:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t$0, -128(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-80(%rbp), %rax\n\tmovl\t-128(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-128(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddl\t$1, -128(%rbp)\n.L12:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -128(%rbp)\n\tjl\t.L13\n\tmovabsq\t$-9223372036854775808, %rax\n\tmovq\t%rax, -104(%rbp)\n\tmovl\t$0, -124(%rbp)\n\tjmp\t.L14\n.L19:\n\tmovq\t$0, -96(%rbp)\n\tmovl\t$0, -120(%rbp)\n\tjmp\t.L15\n.L16:\n\tmovl\t-120(%rbp), %edx\n\tmovl\t-124(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovq\t-80(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-120(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tmovq\t(%rax,%rcx,8), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-120(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddl\t$1, -120(%rbp)\n.L15:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -120(%rbp)\n\tjl\t.L16\n\tmovl\t$0, -116(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-116(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, -96(%rbp)\n\taddl\t$1, -116(%rbp)\n.L17:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -116(%rbp)\n\tjl\t.L18\n\tmovl\t-124(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-112(%rbp), %rax\n\timulq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-104(%rbp), %rax\n\tcmpq\t%rdx, %rax\n\tcmova\t%rdx, %rax\n\tmovq\t%rax, -104(%rbp)\n\taddl\t$1, -124(%rbp)\n.L14:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -124(%rbp)\n\tjl\t.L19\n\tmovq\t-104(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L21\n\tcall\t__stack_chk_fail@PLT\n.L21:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tleaq\t-64(%rbp), %rdx\n\tleaq\t-68(%rbp), %rsi\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-68(%rbp), %edx\n\tmovq\t%rsp, %rcx\n\tleal\t(%rdx,%rdx), %eax\n\tcltq\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rsi\n\tandq\t$-4096, %rsi\n\tsubq\t%rsi, %rcx\n\tcmpq\t%rcx, %rsp\n\tje\t.L3\n.L38:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L38\n.L3:\n\tandl\t$4095, %eax\n\tsubq\t%rax, %rsp\n\ttestq\t%rax, %rax\n\tjne\t.L39\n.L4:\n\tmovq\t%rsp, %r14\n\ttestl\t%edx, %edx\n\tjle\t.L5\n\tmovq\t%r14, %rbx\n\tmovq\t%r14, %r15\n\txorl\t%r12d, %r12d\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r15, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r12d\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-68(%rbp), %r13d\n\taddq\t$8, %r15\n\tcmpl\t%r12d, %r13d\n\tjg\t.L6\n\ttestl\t%r13d, %r13d\n\tjle\t.L5\n\tleal\t-1(%r13), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L7\n\tmovl\t%r13d, %edx\n\tmovslq\t%r13d, %rcx\n\txorl\t%eax, %eax\n\tshrl\t%edx\n\tleaq\t(%r14,%rcx,8), %rsi\n\tsalq\t$4, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovdqu\t(%r14,%rax), %xmm3\n\tmovups\t%xmm3, (%rsi,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L8\n\tmovl\t%r13d, %eax\n\tmovl\t%r13d, %r12d\n\tandl\t$-2, %eax\n\ttestb\t$1, %r13b\n\tje\t.L11\n\tmovslq\t%eax, %rdx\n\taddl\t%r13d, %eax\n\tmovq\t(%r14,%rdx,8), %rdx\n\tcltq\n\tmovq\t%rdx, (%r14,%rax,8)\n.L11:\n\tleaq\t15(,%rcx,8), %rax\n\tmovq\t%rsp, %rcx\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tandq\t$-16, %rdx\n\tsubq\t%rax, %rcx\n.L17:\n\tcmpq\t%rcx, %rsp\n\tje\t.L18\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L17\n.L18:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L40\n.L19:\n\tmovq\t%rsp, %rcx\n\tmovq\t%r14, %rsi\n\tleaq\t0(,%r12,8), %rdx\n\tmovq\t%rcx, %rdi\n\tcall\tmemcpy@PLT\n\tmovl\t%r13d, %r10d\n\tmovq\t-64(%rbp), %r11\n\txorl\t%r9d, %r9d\n\tmovq\t%rax, %rcx\n\tmovl\t%r13d, %eax\n\tandl\t$-2, %r10d\n\txorl\t%edi, %edi\n\tmovabsq\t$-9223372036854775808, %r8\n\tshrl\t%eax\n\tleal\t-1(%rax), %esi\n\taddq\t$1, %rsi\n\tsalq\t$4, %rsi\n\taddq\t%rcx, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t(%rcx,%rax,8), %rdx\n\tmovq\t(%rbx,%rax,8), %r14\n\tcmpq\t%r14, %rdx\n\tcmovg\t%r14, %rdx\n\tmovq\t%rdx, (%rcx,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%rax, %r12\n\tjne\t.L12\n\tcmpl\t$1, %r13d\n\tje\t.L22\n\tmovq\t%rcx, %rax\n\tpxor\t%xmm0, %xmm0\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovdqu\t(%rax), %xmm2\n\taddq\t$16, %rax\n\tpaddq\t%xmm2, %xmm0\n\tcmpq\t%rax, %rsi\n\tjne\t.L14\n\tmovdqa\t%xmm0, %xmm1\n\tmovslq\t%r10d, %rdx\n\tpsrldq\t$8, %xmm1\n\tpaddq\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tcmpl\t%r13d, %r10d\n\tje\t.L15\n.L13:\n\taddq\t(%rcx,%rdx,8), %rax\n.L15:\n\taddq\t%r9, %rax\n\tcmpq\t%rax, %r8\n\tcmova\t%rax, %r8\n\taddl\t$1, %edi\n\taddq\t%r11, %r9\n\taddq\t$8, %rbx\n\tcmpl\t%edi, %r13d\n\tjne\t.L20\n.L16:\n\txorl\t%eax, %eax\n\tmovq\t%r8, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L41\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n.L22:\n\t.cfi_restore_state\n\txorl\t%edx, %edx\n\txorl\t%eax, %eax\n\tjmp\t.L13\n.L39:\n\torq\t$0, -8(%rsp,%rax)\n\tjmp\t.L4\n.L40:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L19\n.L7:\n\tmovl\t%r13d, %r12d\n\tmovq\t%r14, %rax\n\tmovslq\t%r13d, %rcx\n\tleaq\t(%r14,%r12,8), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovq\t(%rax), %rdx\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$8, %rax\n\tcmpq\t%rsi, %rax\n\tjne\t.L10\n\tjmp\t.L11\n.L5:\n\tmovabsq\t$-9223372036854775808, %r8\n\tjmp\t.L16\n.L41:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tleaq\t-64(%rbp), %rdx\n\tleaq\t-68(%rbp), %rsi\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$40, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-68(%rbp), %edx\n\tmovq\t%rsp, %rcx\n\tleal\t(%rdx,%rdx), %eax\n\tcltq\n\tsalq\t$3, %rax\n\tmovq\t%rax, %rsi\n\tandq\t$-4096, %rsi\n\tsubq\t%rsi, %rcx\n\tcmpq\t%rcx, %rsp\n\tje\t.L3\n.L38:\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tcmpq\t%rcx, %rsp\n\tjne\t.L38\n.L3:\n\tandl\t$4095, %eax\n\tsubq\t%rax, %rsp\n\ttestq\t%rax, %rax\n\tjne\t.L39\n.L4:\n\tmovq\t%rsp, %r14\n\ttestl\t%edx, %edx\n\tjle\t.L5\n\tmovq\t%r14, %rbx\n\tmovq\t%r14, %r15\n\txorl\t%r12d, %r12d\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r15, %rsi\n\tleaq\t.LC1(%rip), %rdi\n\txorl\t%eax, %eax\n\taddl\t$1, %r12d\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-68(%rbp), %r13d\n\taddq\t$8, %r15\n\tcmpl\t%r12d, %r13d\n\tjg\t.L6\n\ttestl\t%r13d, %r13d\n\tjle\t.L5\n\tleal\t-1(%r13), %eax\n\tcmpl\t$2, %eax\n\tjbe\t.L7\n\tmovl\t%r13d, %edx\n\tmovslq\t%r13d, %rcx\n\txorl\t%eax, %eax\n\tshrl\t%edx\n\tleaq\t(%r14,%rcx,8), %rsi\n\tsalq\t$4, %rdx\n\t.p2align 4,,10\n\t.p2align 3\n.L8:\n\tmovdqu\t(%r14,%rax), %xmm3\n\tmovups\t%xmm3, (%rsi,%rax)\n\taddq\t$16, %rax\n\tcmpq\t%rdx, %rax\n\tjne\t.L8\n\tmovl\t%r13d, %eax\n\tmovl\t%r13d, %r12d\n\tandl\t$-2, %eax\n\ttestb\t$1, %r13b\n\tje\t.L11\n\tmovslq\t%eax, %rdx\n\taddl\t%r13d, %eax\n\tmovq\t(%r14,%rdx,8), %rdx\n\tcltq\n\tmovq\t%rdx, (%r14,%rax,8)\n.L11:\n\tleaq\t15(,%rcx,8), %rax\n\tmovq\t%rsp, %rcx\n\tmovq\t%rax, %rdx\n\tandq\t$-4096, %rax\n\tandq\t$-16, %rdx\n\tsubq\t%rax, %rcx\n.L17:\n\tcmpq\t%rcx, %rsp\n\tje\t.L18\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L17\n.L18:\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\ttestq\t%rdx, %rdx\n\tjne\t.L40\n.L19:\n\tmovq\t%rsp, %rcx\n\tmovq\t%r14, %rsi\n\tleaq\t0(,%r12,8), %rdx\n\tmovq\t%rcx, %rdi\n\tcall\tmemcpy@PLT\n\tmovl\t%r13d, %r10d\n\tmovq\t-64(%rbp), %r11\n\txorl\t%r9d, %r9d\n\tmovq\t%rax, %rcx\n\tmovl\t%r13d, %eax\n\tandl\t$-2, %r10d\n\txorl\t%edi, %edi\n\tmovabsq\t$-9223372036854775808, %r8\n\tshrl\t%eax\n\tleal\t-1(%rax), %esi\n\taddq\t$1, %rsi\n\tsalq\t$4, %rsi\n\taddq\t%rcx, %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L20:\n\txorl\t%eax, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t(%rcx,%rax,8), %rdx\n\tmovq\t(%rbx,%rax,8), %r14\n\tcmpq\t%r14, %rdx\n\tcmovg\t%r14, %rdx\n\tmovq\t%rdx, (%rcx,%rax,8)\n\taddq\t$1, %rax\n\tcmpq\t%rax, %r12\n\tjne\t.L12\n\tcmpl\t$1, %r13d\n\tje\t.L22\n\tmovq\t%rcx, %rax\n\tpxor\t%xmm0, %xmm0\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovdqu\t(%rax), %xmm2\n\taddq\t$16, %rax\n\tpaddq\t%xmm2, %xmm0\n\tcmpq\t%rax, %rsi\n\tjne\t.L14\n\tmovdqa\t%xmm0, %xmm1\n\tmovslq\t%r10d, %rdx\n\tpsrldq\t$8, %xmm1\n\tpaddq\t%xmm1, %xmm0\n\tmovq\t%xmm0, %rax\n\tcmpl\t%r13d, %r10d\n\tje\t.L15\n.L13:\n\taddq\t(%rcx,%rdx,8), %rax\n.L15:\n\taddq\t%r9, %rax\n\tcmpq\t%rax, %r8\n\tcmova\t%rax, %r8\n\taddl\t$1, %edi\n\taddq\t%r11, %r9\n\taddq\t$8, %rbx\n\tcmpl\t%edi, %r13d\n\tjne\t.L20\n.L16:\n\txorl\t%eax, %eax\n\tmovq\t%r8, %rdx\n\tmovl\t$1, %edi\n\tleaq\t.LC2(%rip), %rsi\n\tcall\t__printf_chk@PLT\n\tmovq\t-56(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L41\n\tleaq\t-40(%rbp), %rsp\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_remember_state\n\t.cfi_def_cfa 7, 8\n\tret\n.L22:\n\t.cfi_restore_state\n\txorl\t%edx, %edx\n\txorl\t%eax, %eax\n\tjmp\t.L13\n.L39:\n\torq\t$0, -8(%rsp,%rax)\n\tjmp\t.L4\n.L40:\n\torq\t$0, -8(%rsp,%rdx)\n\tjmp\t.L19\n.L7:\n\tmovl\t%r13d, %r12d\n\tmovq\t%r14, %rax\n\tmovslq\t%r13d, %rcx\n\tleaq\t(%r14,%r12,8), %rsi\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tmovq\t(%rax), %rdx\n\tmovq\t%rdx, (%rax,%rcx,8)\n\taddq\t$8, %rax\n\tcmpq\t%rsi, %rax\n\tjne\t.L10\n\tjmp\t.L11\n.L5:\n\tmovabsq\t$-9223372036854775808, %r8\n\tjmp\t.L16\n.L41:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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];\n\tfor(int i = 0;i < n;i++)scanf(\"%ld\",&ar[i]);\n\tfor(int i = 0;i < n;i++)ar[i+n] = ar[i];\n\tlong timmin[n];\n\tfor(int i = 0;i < n;i++)timmin[i] = ar[i];\n\tull minans = 1llu<<63;\n\tfor(int emc = 0;emc < n;emc++){\n\t\tull tmp = 0;\n\t\tfor(int i = 0;i < n;i++)timmin[i] = stmin(timmin[i],ar[i+emc]);\n\t\tfor(int i = 0;i < n;i++)tmp += timmin[i];\n\t\tminans = stmin(minans,emc*(long long)x + tmp);\n\t}\n\tprintf(\"%llu\",minans);\n\treturn 0;\n}", "index": 106, "inputs": [ "4 10\n1 1 3 4\n", "2 10\n1 101\n", "3 12\n100 1 100\n", "3 12\n000 1 100\n", "3 12\n010 1 100\n", "3 12\n011 1 100\n", "3 18\n011 1 100\n", "3 18\n011 2 100\n", "3 35\n011 2 100\n", "3 35\n011 4 100\n", "3 35\n011 4 001\n", "4 10\n1 2 3 1\n", "3 7\n100 1 100\n", "4 10\n1 1 5 4\n", "2 6\n1 101\n", "4 4\n2 1 3 4\n", "3 18\n001 2 100\n", "3 53\n011 4 100\n", "3 35\n011 2 001\n", "3 72\n011 4 100\n", "3 35\n010 4 111\n", "3 72\n011 6 100\n", "3 17\n001 0 100\n", "3 72\n011 7 100\n", "3 35\n010 2 110\n", "3 17\n101 0 100\n", "3 28\n010 1 100\n", "3 72\n011 5 100\n", "3 35\n000 2 110\n", "3 47\n010 1 100\n", "3 21\n101 1 100\n", "3 72\n010 5 101\n", "3 66\n000 2 100\n", "3 22\n111 0 110\n", "3 21\n101 2 100\n", "2 3\n1 101\n", "3 18\n001 1 100\n", "3 35\n111 2 100\n", "3 9\n011 4 001\n", "3 7\n100 2 100\n", "3 19\n001 2 100\n", "3 42\n011 4 100\n", "3 35\n010 1 111\n", "3 0\n000 0 110\n", "3 23\n011 4 100\n", "3 53\n010 4 111\n", "3 17\n001 0 000\n", "3 18\n100 2 010\n", "3 35\n010 3 110\n", "3 87\n011 5 100\n", "3 64\n000 2 110\n", "3 19\n111 0 110\n", "3 83\n011 5 101\n", "3 72\n010 8 101\n", "3 66\n000 4 100\n", "2 2\n1 100\n", "3 12\n111 2 100\n", "3 18\n000 1 100\n", "3 20\n011 2 101\n", "3 35\n111 4 100\n", "3 9\n001 4 001\n", "3 30\n001 4 110\n", "3 53\n010 3 111\n", "3 44\n011 6 100\n", "3 18\n100 0 010\n", "3 28\n011 2 100\n", "3 83\n011 10 101\n", "2 0\n1 100\n", "3 20\n111 2 101\n", "3 35\n111 4 000\n", "3 0\n001 2 100\n", "3 0\n100 -1 110\n", "3 53\n000 3 111\n", "3 130\n011 10 101\n", "3 43\n110 0 101\n", "3 42\n111 7 100\n", "3 18\n011 0 100\n", "3 130\n111 10 101\n", "3 35\n110 4 001\n", "3 130\n111 10 100\n", "3 130\n111 7 100\n", "3 -1\n000 -1 100\n", "3 130\n101 7 100\n", "3 24\n010 11 110\n", "3 27\n111 -1 001\n", "3 35\n011 6 111\n", "3 72\n011 8 100\n", "3 72\n011 10 100\n", "3 72\n001 5 101\n", "3 72\n110 5 101\n", "3 87\n010 5 100\n", "3 72\n000 8 101\n", "3 66\n010 4 100\n", "3 -1\n100 0 110\n", "3 39\n101 0 111\n", "3 42\n111 6 101\n", "3 130\n011 10 100\n", "3 84\n111 7 100\n", "3 33\n010 11 110\n", "3 103\n100 7 100\n", "4 10\n1 2 3 4\n", "2 10\n1 100\n", "3 10\n100 1 100\n", "2 10\n1 100\n" ], "outputs": [ "9", "12", "27", "13", "24", "25", "31", "33", "50", "54", "16", "7", "17", "11", "8", "10", "22", "72", "14", "91", "53", "95", "18", "97", "49", "34", "40", "93", "37", "59", "45", "92", "68", "44", "48", "5", "21", "76", "15", "20", "23", "61", "47", "0", "42", "71", "1", "32", "51", "108", "66", "38", "104", "98", "70", "4", "30", "19", "35", "82", "6", "36", "69", "67", "28", "43", "114", "2", "46", "39", "3", "98", "56", "122", "86", "105", "29", "222", "41", "221", "218", "99", "208", "55", "26", "58", "99", "103", "79", "159", "107", "80", "84", "99", "78", "102", "121", "189", "64", "207", "10", "12", "23", "12" ], "question": "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];\n\tfor(int i = 0;i < n;i++)scanf(\"%ld\",&ar[i]);\n\tfor(int i = 0;i < n;i++)ar[i+n] = ar[i];\n\tlong timmin[n];\n\tfor(int i = 0;i < n;i++)timmin[i] = ar[i];\n\tull minans = 1llu<<63;\n\tfor(int emc = 0;emc < n;emc++){\n\t\tull tmp = 0;\n\t\tfor(int i = 0;i < n;i++)timmin[i] = stmin(timmin[i],ar[i+emc]);\n\t\tfor(int i = 0;i < n;i++)tmp += timmin[i];\n\t\tminans = stmin(minans,emc*(long long)x + tmp);\n\t}\n\tprintf(\"%llu\",minans);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d %ld\"\n.LC1:\n\t.string\t\"%ld\"\n.LC2:\n\t.string\t\"%llu\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tpushq\t%r15\n\tpushq\t%r14\n\tpushq\t%r13\n\tpushq\t%r12\n\tpushq\t%rbx\n\tsubq\t$136, %rsp\n\t.cfi_offset 15, -24\n\t.cfi_offset 14, -32\n\t.cfi_offset 13, -40\n\t.cfi_offset 12, -48\n\t.cfi_offset 3, -56\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -56(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rax\n\tmovq\t%rax, %rbx\n\tleaq\t-112(%rbp), %rdx\n\tleaq\t-140(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-140(%rbp), %eax\n\taddl\t%eax, %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -88(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, -160(%rbp)\n\tmovq\t$0, -152(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, -176(%rbp)\n\tmovq\t$0, -168(%rbp)\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %edi\n\tmovl\t$0, %edx\n\tdivq\t%rdi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L2:\n\tcmpq\t%rdx, %rsp\n\tje\t.L3\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L2\n.L3:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L4\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L4:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -80(%rbp)\n\tmovl\t$0, -136(%rbp)\n\tjmp\t.L5\n.L6:\n\tmovl\t-136(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovq\t-80(%rbp), %rax\n\taddq\t%rdx, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\taddl\t$1, -136(%rbp)\n.L5:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -136(%rbp)\n\tjl\t.L6\n\tmovl\t$0, -132(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-140(%rbp), %edx\n\tmovl\t-132(%rbp), %eax\n\tleal\t(%rdx,%rax), %esi\n\tmovq\t-80(%rbp), %rax\n\tmovl\t-132(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovq\t-80(%rbp), %rax\n\tmovslq\t%esi, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddl\t$1, -132(%rbp)\n.L7:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -132(%rbp)\n\tjl\t.L8\n\tmovl\t-140(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tsubq\t$1, %rdx\n\tmovq\t%rdx, -72(%rbp)\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r14\n\tmovl\t$0, %r15d\n\tmovslq\t%eax, %rdx\n\tmovq\t%rdx, %r12\n\tmovl\t$0, %r13d\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tmovl\t$16, %eax\n\tsubq\t$1, %rax\n\taddq\t%rdx, %rax\n\tmovl\t$16, %esi\n\tmovl\t$0, %edx\n\tdivq\t%rsi\n\timulq\t$16, %rax, %rax\n\tmovq\t%rax, %rcx\n\tandq\t$-4096, %rcx\n\tmovq\t%rsp, %rdx\n\tsubq\t%rcx, %rdx\n.L9:\n\tcmpq\t%rdx, %rsp\n\tje\t.L10\n\tsubq\t$4096, %rsp\n\torq\t$0, 4088(%rsp)\n\tjmp\t.L9\n.L10:\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\tsubq\t%rdx, %rsp\n\tmovq\t%rax, %rdx\n\tandl\t$4095, %edx\n\ttestq\t%rdx, %rdx\n\tje\t.L11\n\tandl\t$4095, %eax\n\tsubq\t$8, %rax\n\taddq\t%rsp, %rax\n\torq\t$0, (%rax)\n.L11:\n\tmovq\t%rsp, %rax\n\taddq\t$7, %rax\n\tshrq\t$3, %rax\n\tsalq\t$3, %rax\n\tmovq\t%rax, -64(%rbp)\n\tmovl\t$0, -128(%rbp)\n\tjmp\t.L12\n.L13:\n\tmovq\t-80(%rbp), %rax\n\tmovl\t-128(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-128(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddl\t$1, -128(%rbp)\n.L12:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -128(%rbp)\n\tjl\t.L13\n\tmovabsq\t$-9223372036854775808, %rax\n\tmovq\t%rax, -104(%rbp)\n\tmovl\t$0, -124(%rbp)\n\tjmp\t.L14\n.L19:\n\tmovq\t$0, -96(%rbp)\n\tmovl\t$0, -120(%rbp)\n\tjmp\t.L15\n.L16:\n\tmovl\t-120(%rbp), %edx\n\tmovl\t-124(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovq\t-80(%rbp), %rax\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rdx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-120(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tmovq\t(%rax,%rcx,8), %rax\n\tcmpq\t%rax, %rdx\n\tcmovle\t%rdx, %rax\n\tmovq\t%rax, %rcx\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-120(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t%rcx, (%rax,%rdx,8)\n\taddl\t$1, -120(%rbp)\n.L15:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -120(%rbp)\n\tjl\t.L16\n\tmovl\t$0, -116(%rbp)\n\tjmp\t.L17\n.L18:\n\tmovq\t-64(%rbp), %rax\n\tmovl\t-116(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovq\t(%rax,%rdx,8), %rax\n\taddq\t%rax, -96(%rbp)\n\taddl\t$1, -116(%rbp)\n.L17:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -116(%rbp)\n\tjl\t.L18\n\tmovl\t-124(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovq\t-112(%rbp), %rax\n\timulq\t%rdx, %rax\n\tmovq\t%rax, %rdx\n\tmovq\t-96(%rbp), %rax\n\taddq\t%rax, %rdx\n\tmovq\t-104(%rbp), %rax\n\tcmpq\t%rdx, %rax\n\tcmova\t%rdx, %rax\n\tmovq\t%rax, -104(%rbp)\n\taddl\t$1, -124(%rbp)\n.L14:\n\tmovl\t-140(%rbp), %eax\n\tcmpl\t%eax, -124(%rbp)\n\tjl\t.L19\n\tmovq\t-104(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t%rbx, %rsp\n\tmovq\t-56(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L21\n\tcall\t__stack_chk_fail@PLT\n.L21:\n\tleaq\t-40(%rbp), %rsp\n\tpopq\t%rbx\n\tpopq\t%r12\n\tpopq\t%r13\n\tpopq\t%r14\n\tpopq\t%r15\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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",&ar[i]); for(int i = 0;i < n;i++)ar[i+n] = ar[i]; long timmin[n]; for(int i = 0;i < n;i++)timmin[i] = ar[i]; ull minans = 1llu<<63; for(int emc = 0;emc < n;emc++){ ull tmp = 0; for(int i = 0;i < n;i++)timmin[i] = stmin(timmin[i],ar[i+emc]); for(int i = 0;i < n;i++)tmp += timmin[i]; minans = stmin(minans,emc*(long long)x + tmp); } printf("%llu",minans); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %ld" .LC1: .string "%ld" .LC2: .string "%llu" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $136, %rsp .cfi_offset 15, -24 .cfi_offset 14, -32 .cfi_offset 13, -40 .cfi_offset 12, -48 .cfi_offset 3, -56 movq %fs:40, %rax movq %rax, -56(%rbp) xorl %eax, %eax movq %rsp, %rax movq %rax, %rbx leaq -112(%rbp), %rdx leaq -140(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -140(%rbp), %eax addl %eax, %eax movslq %eax, %rdx subq $1, %rdx movq %rdx, -88(%rbp) movslq %eax, %rdx movq %rdx, -160(%rbp) movq $0, -152(%rbp) movslq %eax, %rdx movq %rdx, -176(%rbp) movq $0, -168(%rbp) cltq leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %edi movl $0, %edx divq %rdi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L2: cmpq %rdx, %rsp je .L3 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L2 .L3: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L4 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L4: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -80(%rbp) movl $0, -136(%rbp) jmp .L5 .L6: movl -136(%rbp), %eax cltq leaq 0(,%rax,8), %rdx movq -80(%rbp), %rax addq %rdx, %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT addl $1, -136(%rbp) .L5: movl -140(%rbp), %eax cmpl %eax, -136(%rbp) jl .L6 movl $0, -132(%rbp) jmp .L7 .L8: movl -140(%rbp), %edx movl -132(%rbp), %eax leal (%rdx,%rax), %esi movq -80(%rbp), %rax movl -132(%rbp), %edx movslq %edx, %rdx movq (%rax,%rdx,8), %rcx movq -80(%rbp), %rax movslq %esi, %rdx movq %rcx, (%rax,%rdx,8) addl $1, -132(%rbp) .L7: movl -140(%rbp), %eax cmpl %eax, -132(%rbp) jl .L8 movl -140(%rbp), %eax movslq %eax, %rdx subq $1, %rdx movq %rdx, -72(%rbp) movslq %eax, %rdx movq %rdx, %r14 movl $0, %r15d movslq %eax, %rdx movq %rdx, %r12 movl $0, %r13d cltq leaq 0(,%rax,8), %rdx movl $16, %eax subq $1, %rax addq %rdx, %rax movl $16, %esi movl $0, %edx divq %rsi imulq $16, %rax, %rax movq %rax, %rcx andq $-4096, %rcx movq %rsp, %rdx subq %rcx, %rdx .L9: cmpq %rdx, %rsp je .L10 subq $4096, %rsp orq $0, 4088(%rsp) jmp .L9 .L10: movq %rax, %rdx andl $4095, %edx subq %rdx, %rsp movq %rax, %rdx andl $4095, %edx testq %rdx, %rdx je .L11 andl $4095, %eax subq $8, %rax addq %rsp, %rax orq $0, (%rax) .L11: movq %rsp, %rax addq $7, %rax shrq $3, %rax salq $3, %rax movq %rax, -64(%rbp) movl $0, -128(%rbp) jmp .L12 .L13: movq -80(%rbp), %rax movl -128(%rbp), %edx movslq %edx, %rdx movq (%rax,%rdx,8), %rcx movq -64(%rbp), %rax movl -128(%rbp), %edx movslq %edx, %rdx movq %rcx, (%rax,%rdx,8) addl $1, -128(%rbp) .L12: movl -140(%rbp), %eax cmpl %eax, -128(%rbp) jl .L13 movabsq $-9223372036854775808, %rax movq %rax, -104(%rbp) movl $0, -124(%rbp) jmp .L14 .L19: movq $0, -96(%rbp) movl $0, -120(%rbp) jmp .L15 .L16: movl -120(%rbp), %edx movl -124(%rbp), %eax addl %eax, %edx movq -80(%rbp), %rax movslq %edx, %rdx movq (%rax,%rdx,8), %rdx movq -64(%rbp), %rax movl -120(%rbp), %ecx movslq %ecx, %rcx movq (%rax,%rcx,8), %rax cmpq %rax, %rdx cmovle %rdx, %rax movq %rax, %rcx movq -64(%rbp), %rax movl -120(%rbp), %edx movslq %edx, %rdx movq %rcx, (%rax,%rdx,8) addl $1, -120(%rbp) .L15: movl -140(%rbp), %eax cmpl %eax, -120(%rbp) jl .L16 movl $0, -116(%rbp) jmp .L17 .L18: movq -64(%rbp), %rax movl -116(%rbp), %edx movslq %edx, %rdx movq (%rax,%rdx,8), %rax addq %rax, -96(%rbp) addl $1, -116(%rbp) .L17: movl -140(%rbp), %eax cmpl %eax, -116(%rbp) jl .L18 movl -124(%rbp), %eax movslq %eax, %rdx movq -112(%rbp), %rax imulq %rdx, %rax movq %rax, %rdx movq -96(%rbp), %rax addq %rax, %rdx movq -104(%rbp), %rax cmpq %rdx, %rax cmova %rdx, %rax movq %rax, -104(%rbp) addl $1, -124(%rbp) .L14: movl -140(%rbp), %eax cmpl %eax, -124(%rbp) jl .L19 movq -104(%rbp), %rax movq %rax, %rsi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq %rbx, %rsp movq -56(%rbp), %rdx subq %fs:40, %rdx je .L21 call __stack_chk_fail@PLT .L21: leaq -40(%rbp), %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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>\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(\"No\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"Yes\\n\");\n\tif (n == 2)\n\t{\n\t\tprintf(\"1\\n2\\n3\\n\");\n\t\treturn 0;\n\t}\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t\tb[i] = a[i] = 0;\n\tif (x != 2)\n\t{\n\t\ta[n - 2] = 1;\n\t\ta[n - 1] = x;\n\t\ta[n] = 2 * n - 1;\n\t\ta[n + 1] = 2;\n\t\tb[1] = b[x] = b[2 * n - 1] = b[2] = 1;\n\t}\n\telse\n\t{\n\t\ta[n - 2] = 2 * n - 2;\n\t\ta[n - 1] = x;\n\t\ta[n] = 1;\n\t\ta[n + 1] = 2 * n - 1;\n\t\tb[2 * n - 2] = b[x] = b[1] = b[2 * n - 2] = 1;\n\t}\n\tj = 1;\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t{\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\twhile (b[j] > 0)\n\t\t\t\tj++;\n\t\t\ta[i] = j;\n\t\t\tj++;\n\t\t}\n\t}\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t\tprintf(\"%d\\n\", a[i]);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.LC4:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-1597440(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2640, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-1600076(%rbp), %rdx\n\tleaq\t-1600080(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1600076(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L2\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-1600076(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L3\n.L2:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L3:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t-1600080(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L5\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L5:\n\tmovl\t$0, -1600072(%rbp)\n\tjmp\t.L6\n.L7:\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t$0, -1600064(%rbp,%rax,4)\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600064(%rbp,%rax,4), %edx\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -800032(%rbp,%rax,4)\n\taddl\t$1, -1600072(%rbp)\n.L6:\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -1600072(%rbp)\n\tjl\t.L7\n\tmovl\t-1600076(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L8\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$2, %eax\n\tcltq\n\tmovl\t$1, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1600076(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$2, -1600064(%rbp,%rax,4)\n\tmovl\t$1, -800024(%rbp)\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-800024(%rbp), %ecx\n\tmovslq\t%edx, %rax\n\tmovl\t%ecx, -800032(%rbp,%rax,4)\n\tmovl\t-1600076(%rbp), %eax\n\tmovslq\t%edx, %rdx\n\tmovl\t-800032(%rbp,%rdx,4), %ecx\n\tmovslq\t%eax, %rdx\n\tmovl\t%ecx, -800032(%rbp,%rdx,4)\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %eax\n\tmovl\t%eax, -800028(%rbp)\n\tjmp\t.L9\n.L8:\n\tmovl\t-1600080(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$2, %eax\n\taddl\t%edx, %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1600076(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tcltq\n\tmovl\t$1, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t$1, %eax\n\tsubl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %eax\n\taddl\t%eax, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t$1, -800032(%rbp,%rdx,4)\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %eax\n\tmovl\t%eax, -800028(%rbp)\n\tmovl\t-1600076(%rbp), %eax\n\tmovl\t-800028(%rbp), %ecx\n\tmovslq\t%eax, %rdx\n\tmovl\t%ecx, -800032(%rbp,%rdx,4)\n\tmovl\t-1600080(%rbp), %edx\n\tsubl\t$1, %edx\n\tleal\t(%rdx,%rdx), %ecx\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovslq\t%ecx, %rax\n\tmovl\t%edx, -800032(%rbp,%rax,4)\n.L9:\n\tmovl\t$1, -1600068(%rbp)\n\tmovl\t$0, -1600072(%rbp)\n\tjmp\t.L10\n.L14:\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600064(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L11\n\tjmp\t.L12\n.L13:\n\taddl\t$1, -1600068(%rbp)\n.L12:\n\tmovl\t-1600068(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L13\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600068(%rbp), %edx\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\taddl\t$1, -1600068(%rbp)\n.L11:\n\taddl\t$1, -1600072(%rbp)\n.L10:\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -1600072(%rbp)\n\tjl\t.L14\n\tmovl\t$0, -1600072(%rbp)\n\tjmp\t.L15\n.L16:\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600064(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -1600072(%rbp)\n.L15:\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -1600072(%rbp)\n\tjl\t.L16\n\tmovl\t$0, %eax\n.L17:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L18\n\tcall\t__stack_chk_fail@PLT\n.L18:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.type\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t-1597440(%rsp), %r11\n\t.cfi_def_cfa 11, 1597480\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2648, %rsp\n\t.cfi_def_cfa_offset 1600128\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1600072(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L2\n\tmovl\t8(%rsp), %edx\n\tleal\t-1(%rdx,%rdx), %edx\n\tcmpl\t%edx, %eax\n\tje\t.L2\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tmovslq\t8(%rsp), %rbx\n\tcmpl\t$2, %ebx\n\tje\t.L5\n\tleal\t(%rbx,%rbx), %r12d\n\tleal\t-1(%r12), %ebp\n\ttestl\t%ebp, %ebp\n\tjle\t.L9\n\tleal\t-2(%r12), %eax\n\tleaq\t16(%rsp), %rdi\n\txorl\t%esi, %esi\n\tleaq\t4(,%rax,4), %r13\n\tmovq\t%r13, %rdx\n\tcall\tmemset@PLT\n\tleaq\t800048(%rsp), %rdi\n\tmovq\t%r13, %rdx\n\txorl\t%esi, %esi\n\tcall\tmemset@PLT\n.L9:\n\tmovslq\t12(%rsp), %rax\n\tleal\t-1(%rbx), %ecx\n\tleal\t-2(%rbx), %esi\n\tleal\t1(%rbx), %edx\n\tcmpl\t$2, %eax\n\tje\t.L28\n\tmovslq\t%edx, %rdx\n\tmovslq\t%esi, %rsi\n\tmovslq\t%ecx, %rcx\n\tmovl\t$1, 800056(%rsp)\n\tmovl\t$1, 16(%rsp,%rsi,4)\n\tmovl\t%eax, 16(%rsp,%rcx,4)\n\tmovl\t%ebp, 16(%rsp,%rbx,4)\n\tmovl\t$2, 16(%rsp,%rdx,4)\n\tmovslq\t%ebp, %rdx\n\tmovl\t$1, 800048(%rsp,%rdx,4)\n\tmovl\t$1, 800048(%rsp,%rax,4)\n\tmovl\t$1, 800052(%rsp)\n.L11:\n\ttestl\t%ebp, %ebp\n\tjle\t.L4\n\tleaq\t16(%rsp), %rbp\n\tsubl\t$2, %r12d\n\tmovl\t$1, %ecx\n\tmovq\t%rbp, %rdx\n\tleaq\t20(%rsp,%r12,4), %rdi\n\tleaq\t800048(%rsp), %rsi\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\taddq\t$4, %rdx\n\tcmpq\t%rdi, %rdx\n\tje\t.L29\n.L15:\n\tmovl\t(%rdx), %r10d\n\ttestl\t%r10d, %r10d\n\tjne\t.L12\n\tmovslq\t%ecx, %rax\n\tmovl\t800048(%rsp,%rax,4), %r9d\n\ttestl\t%r9d, %r9d\n\tjle\t.L13\n\taddl\t$1, %ecx\n\tmovslq\t%ecx, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovl\t%eax, %ecx\n\taddq\t$1, %rax\n\tmovl\t-4(%rsi,%rax,4), %r8d\n\ttestl\t%r8d, %r8d\n\tjg\t.L14\n.L13:\n\tmovl\t%ecx, (%rdx)\n\taddq\t$4, %rdx\n\taddl\t$1, %ecx\n\tcmpq\t%rdi, %rdx\n\tjne\t.L15\n.L29:\n\txorl\t%ebx, %ebx\n\tleaq\t.LC5(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovl\t0(%rbp,%rbx,4), %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbx\n\tcall\t__printf_chk@PLT\n\tmovl\t8(%rsp), %eax\n\tleal\t-1(%rax,%rax), %eax\n\tcmpl\t%ebx, %eax\n\tjg\t.L16\n.L4:\n\tmovq\t1600072(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L30\n\taddq\t$1600088, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L28:\n\tleal\t-2(%r12), %eax\n\tmovslq\t%edx, %rdx\n\tmovslq\t%esi, %rsi\n\tmovslq\t%ecx, %rcx\n\tmovl\t%eax, 16(%rsp,%rsi,4)\n\tcltq\n\tmovl\t$2, 16(%rsp,%rcx,4)\n\tmovl\t$1, 16(%rsp,%rbx,4)\n\tmovl\t%ebp, 16(%rsp,%rdx,4)\n\tmovq\t.LC4(%rip), %rdx\n\tmovq\t%rdx, 800052(%rsp)\n\tmovl\t$1, 800048(%rsp,%rax,4)\n\tjmp\t.L11\n.L5:\n\tleaq\t.LC3(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L30:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC4:\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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\tmain, @function\nmain:\n.LFB23:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t-1597440(%rsp), %r11\n\t.cfi_def_cfa 11, 1597480\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\t.cfi_def_cfa_register 7\n\tsubq\t$2648, %rsp\n\t.cfi_def_cfa_offset 1600128\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 1600072(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t12(%rsp), %rdx\n\tleaq\t8(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L2\n\tmovl\t8(%rsp), %edx\n\tleal\t-1(%rdx,%rdx), %edx\n\tcmpl\t%edx, %eax\n\tje\t.L2\n\tleaq\t.LC2(%rip), %rdi\n\tcall\tputs@PLT\n\tmovslq\t8(%rsp), %rbx\n\tcmpl\t$2, %ebx\n\tje\t.L5\n\tleal\t(%rbx,%rbx), %r12d\n\tleal\t-1(%r12), %ebp\n\ttestl\t%ebp, %ebp\n\tjle\t.L9\n\tleal\t-2(%r12), %eax\n\tleaq\t16(%rsp), %rdi\n\txorl\t%esi, %esi\n\tleaq\t4(,%rax,4), %r13\n\tmovq\t%r13, %rdx\n\tcall\tmemset@PLT\n\tleaq\t800048(%rsp), %rdi\n\tmovq\t%r13, %rdx\n\txorl\t%esi, %esi\n\tcall\tmemset@PLT\n.L9:\n\tmovslq\t12(%rsp), %rax\n\tleal\t-1(%rbx), %ecx\n\tleal\t-2(%rbx), %esi\n\tleal\t1(%rbx), %edx\n\tcmpl\t$2, %eax\n\tje\t.L28\n\tmovslq\t%edx, %rdx\n\tmovslq\t%esi, %rsi\n\tmovslq\t%ecx, %rcx\n\tmovl\t$1, 800056(%rsp)\n\tmovl\t$1, 16(%rsp,%rsi,4)\n\tmovl\t%eax, 16(%rsp,%rcx,4)\n\tmovl\t%ebp, 16(%rsp,%rbx,4)\n\tmovl\t$2, 16(%rsp,%rdx,4)\n\tmovslq\t%ebp, %rdx\n\tmovl\t$1, 800048(%rsp,%rdx,4)\n\tmovl\t$1, 800048(%rsp,%rax,4)\n\tmovl\t$1, 800052(%rsp)\n.L11:\n\ttestl\t%ebp, %ebp\n\tjle\t.L4\n\tleaq\t16(%rsp), %rbp\n\tsubl\t$2, %r12d\n\tmovl\t$1, %ecx\n\tmovq\t%rbp, %rdx\n\tleaq\t20(%rsp,%r12,4), %rdi\n\tleaq\t800048(%rsp), %rsi\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\taddq\t$4, %rdx\n\tcmpq\t%rdi, %rdx\n\tje\t.L29\n.L15:\n\tmovl\t(%rdx), %r10d\n\ttestl\t%r10d, %r10d\n\tjne\t.L12\n\tmovslq\t%ecx, %rax\n\tmovl\t800048(%rsp,%rax,4), %r9d\n\ttestl\t%r9d, %r9d\n\tjle\t.L13\n\taddl\t$1, %ecx\n\tmovslq\t%ecx, %rax\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tmovl\t%eax, %ecx\n\taddq\t$1, %rax\n\tmovl\t-4(%rsi,%rax,4), %r8d\n\ttestl\t%r8d, %r8d\n\tjg\t.L14\n.L13:\n\tmovl\t%ecx, (%rdx)\n\taddq\t$4, %rdx\n\taddl\t$1, %ecx\n\tcmpq\t%rdi, %rdx\n\tjne\t.L15\n.L29:\n\txorl\t%ebx, %ebx\n\tleaq\t.LC5(%rip), %r12\n\t.p2align 4,,10\n\t.p2align 3\n.L16:\n\tmovl\t0(%rbp,%rbx,4), %edx\n\tmovq\t%r12, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\taddq\t$1, %rbx\n\tcall\t__printf_chk@PLT\n\tmovl\t8(%rsp), %eax\n\tleal\t-1(%rax,%rax), %eax\n\tcmpl\t%ebx, %eax\n\tjg\t.L16\n.L4:\n\tmovq\t1600072(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L30\n\taddq\t$1600088, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L2:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L28:\n\tleal\t-2(%r12), %eax\n\tmovslq\t%edx, %rdx\n\tmovslq\t%esi, %rsi\n\tmovslq\t%ecx, %rcx\n\tmovl\t%eax, 16(%rsp,%rsi,4)\n\tcltq\n\tmovl\t$2, 16(%rsp,%rcx,4)\n\tmovl\t$1, 16(%rsp,%rbx,4)\n\tmovl\t%ebp, 16(%rsp,%rdx,4)\n\tmovq\t.LC4(%rip), %rdx\n\tmovq\t%rdx, 800052(%rsp)\n\tmovl\t$1, 800048(%rsp,%rax,4)\n\tjmp\t.L11\n.L5:\n\tleaq\t.LC3(%rip), %rdi\n\tcall\tputs@PLT\n\tjmp\t.L4\n.L30:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC4:\n\t.long\t1\n\t.long\t1\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(\"No\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"Yes\\n\");\n\tif (n == 2)\n\t{\n\t\tprintf(\"1\\n2\\n3\\n\");\n\t\treturn 0;\n\t}\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t\tb[i] = a[i] = 0;\n\tif (x != 2)\n\t{\n\t\ta[n - 2] = 1;\n\t\ta[n - 1] = x;\n\t\ta[n] = 2 * n - 1;\n\t\ta[n + 1] = 2;\n\t\tb[1] = b[x] = b[2 * n - 1] = b[2] = 1;\n\t}\n\telse\n\t{\n\t\ta[n - 2] = 2 * n - 2;\n\t\ta[n - 1] = x;\n\t\ta[n] = 1;\n\t\ta[n + 1] = 2 * n - 1;\n\t\tb[2 * n - 2] = b[x] = b[1] = b[2 * n - 2] = 1;\n\t}\n\tj = 1;\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t{\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\twhile (b[j] > 0)\n\t\t\t\tj++;\n\t\t\ta[i] = j;\n\t\t\tj++;\n\t\t}\n\t}\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t\tprintf(\"%d\\n\", a[i]);\n\treturn 0;\n}", "index": 107, "inputs": [ "1 1\n", "2 2\n", "3 3\n", "7 7\n", "6 6\n", "5 5\n", "8 8\n", "4 1\n", "2 3\n", "3 1\n", "0 1\n", "7 1\n", "5 1\n", "9 1\n", "-1 1\n", "16 1\n", "-2 1\n", "13 1\n", "11 1\n", "0 -1\n", "10 1\n", "15 1\n", "17 1\n", "4 7\n", "-3 1\n", "8 1\n", "-4 1\n", "6 1\n", "19 1\n", "14 1\n", "25 1\n", "-8 1\n", "12 1\n", "39 1\n", "-10 1\n", "-1 -3\n", "3 5\n", "20 1\n", "-6 1\n", "-5 1\n", "29 1\n", "41 1\n", "24 1\n", "37 1\n", "18 1\n", "30 1\n", "22 1\n", "-7 1\n", "42 1\n", "63 1\n", "44 1\n", "26 1\n", "23 1\n", "33 1\n", "-18 1\n", "27 1\n", "-9 1\n", "36 1\n", "32 1\n", "31 1\n", "79 1\n", "65 1\n", "60 1\n", "-24 1\n", "34 1\n", "97 1\n", "61 1\n", "142 1\n", "107 1\n", "111 1\n", "011 1\n", "21 1\n", "59 1\n", "28 1\n", "50 1\n", "-11 1\n", "54 1\n", "40 1\n", "-12 1\n", "124 1\n", "-30 1\n", "104 1\n", "62 1\n", "38 1\n", "101 1\n", "173 1\n", "270 1\n", "-15 1\n", "58 1\n", "35 1\n", "-14 1\n", "52 1\n", "87 1\n", "66 1\n", "-33 1\n", "57 1\n", "-2 -5\n", "-35 1\n", "157 1\n", "119 1\n", "4 4\n", "4 4\n", "2 1\n" ], "outputs": [ "No\n", "Yes\n1\n2\n3\n", "Yes\n4\n1\n3\n5\n2\n", "Yes\n3\n4\n5\n6\n8\n1\n7\n13\n2\n9\n10\n11\n12\n", "Yes\n3\n4\n5\n7\n1\n6\n11\n2\n8\n9\n10\n", "Yes\n3\n4\n6\n1\n5\n9\n2\n7\n8\n", "Yes\n3\n4\n5\n6\n7\n9\n1\n8\n15\n2\n10\n11\n12\n13\n14\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "No\n", "Yes\n3\n5\n1\n4\n7\n2\n6\n", "Yes\n3\n5\n1\n4\n7\n2\n6\n", "No\n" ], "question": "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(\"No\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"Yes\\n\");\n\tif (n == 2)\n\t{\n\t\tprintf(\"1\\n2\\n3\\n\");\n\t\treturn 0;\n\t}\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t\tb[i] = a[i] = 0;\n\tif (x != 2)\n\t{\n\t\ta[n - 2] = 1;\n\t\ta[n - 1] = x;\n\t\ta[n] = 2 * n - 1;\n\t\ta[n + 1] = 2;\n\t\tb[1] = b[x] = b[2 * n - 1] = b[2] = 1;\n\t}\n\telse\n\t{\n\t\ta[n - 2] = 2 * n - 2;\n\t\ta[n - 1] = x;\n\t\ta[n] = 1;\n\t\ta[n + 1] = 2 * n - 1;\n\t\tb[2 * n - 2] = b[x] = b[1] = b[2 * n - 2] = 1;\n\t}\n\tj = 1;\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t{\n\t\tif (a[i] == 0)\n\t\t{\n\t\t\twhile (b[j] > 0)\n\t\t\t\tj++;\n\t\t\ta[i] = j;\n\t\t\tj++;\n\t\t}\n\t}\n\tfor (i = 0; i < 2 * n - 1; i++)\n\t\tprintf(\"%d\\n\", a[i]);\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.LC4:\n\t.string\t\"%d\\n\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tleaq\t-1597440(%rsp), %r11\n.LPSRL0:\n\tsubq\t$4096, %rsp\n\torq\t$0, (%rsp)\n\tcmpq\t%r11, %rsp\n\tjne\t.LPSRL0\n\tsubq\t$2640, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-1600076(%rbp), %rdx\n\tleaq\t-1600080(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-1600076(%rbp), %eax\n\tcmpl\t$1, %eax\n\tje\t.L2\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-1600076(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L3\n.L2:\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L3:\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t-1600080(%rbp), %eax\n\tcmpl\t$2, %eax\n\tjne\t.L5\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tputs@PLT\n\tmovl\t$0, %eax\n\tjmp\t.L17\n.L5:\n\tmovl\t$0, -1600072(%rbp)\n\tjmp\t.L6\n.L7:\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t$0, -1600064(%rbp,%rax,4)\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600064(%rbp,%rax,4), %edx\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -800032(%rbp,%rax,4)\n\taddl\t$1, -1600072(%rbp)\n.L6:\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -1600072(%rbp)\n\tjl\t.L7\n\tmovl\t-1600076(%rbp), %eax\n\tcmpl\t$2, %eax\n\tje\t.L8\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$2, %eax\n\tcltq\n\tmovl\t$1, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1600076(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$2, -1600064(%rbp,%rax,4)\n\tmovl\t$1, -800024(%rbp)\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-800024(%rbp), %ecx\n\tmovslq\t%edx, %rax\n\tmovl\t%ecx, -800032(%rbp,%rax,4)\n\tmovl\t-1600076(%rbp), %eax\n\tmovslq\t%edx, %rdx\n\tmovl\t-800032(%rbp,%rdx,4), %ecx\n\tmovslq\t%eax, %rdx\n\tmovl\t%ecx, -800032(%rbp,%rdx,4)\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %eax\n\tmovl\t%eax, -800028(%rbp)\n\tjmp\t.L9\n.L8:\n\tmovl\t-1600080(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$2, %eax\n\taddl\t%edx, %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t-1600076(%rbp), %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tcltq\n\tmovl\t$1, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t$1, %eax\n\tsubl\t$1, %edx\n\tcltq\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\tmovl\t-1600080(%rbp), %eax\n\tsubl\t$1, %eax\n\taddl\t%eax, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t$1, -800032(%rbp,%rdx,4)\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %eax\n\tmovl\t%eax, -800028(%rbp)\n\tmovl\t-1600076(%rbp), %eax\n\tmovl\t-800028(%rbp), %ecx\n\tmovslq\t%eax, %rdx\n\tmovl\t%ecx, -800032(%rbp,%rdx,4)\n\tmovl\t-1600080(%rbp), %edx\n\tsubl\t$1, %edx\n\tleal\t(%rdx,%rdx), %ecx\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %edx\n\tmovslq\t%ecx, %rax\n\tmovl\t%edx, -800032(%rbp,%rax,4)\n.L9:\n\tmovl\t$1, -1600068(%rbp)\n\tmovl\t$0, -1600072(%rbp)\n\tjmp\t.L10\n.L14:\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600064(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjne\t.L11\n\tjmp\t.L12\n.L13:\n\taddl\t$1, -1600068(%rbp)\n.L12:\n\tmovl\t-1600068(%rbp), %eax\n\tcltq\n\tmovl\t-800032(%rbp,%rax,4), %eax\n\ttestl\t%eax, %eax\n\tjg\t.L13\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600068(%rbp), %edx\n\tmovl\t%edx, -1600064(%rbp,%rax,4)\n\taddl\t$1, -1600068(%rbp)\n.L11:\n\taddl\t$1, -1600072(%rbp)\n.L10:\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -1600072(%rbp)\n\tjl\t.L14\n\tmovl\t$0, -1600072(%rbp)\n\tjmp\t.L15\n.L16:\n\tmovl\t-1600072(%rbp), %eax\n\tcltq\n\tmovl\t-1600064(%rbp,%rax,4), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -1600072(%rbp)\n.L15:\n\tmovl\t-1600080(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$1, %eax\n\tcmpl\t%eax, -1600072(%rbp)\n\tjl\t.L16\n\tmovl\t$0, %eax\n.L17:\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L18\n\tcall\t__stack_chk_fail@PLT\n.L18:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 (n == 2) { printf("1\n2\n3\n"); return 0; } for (i = 0; i < 2 * n - 1; i++) b[i] = a[i] = 0; if (x != 2) { a[n - 2] = 1; a[n - 1] = x; a[n] = 2 * n - 1; a[n + 1] = 2; b[1] = b[x] = b[2 * n - 1] = b[2] = 1; } else { a[n - 2] = 2 * n - 2; a[n - 1] = x; a[n] = 1; a[n + 1] = 2 * n - 1; b[2 * n - 2] = b[x] = b[1] = b[2 * n - 2] = 1; } j = 1; for (i = 0; i < 2 * n - 1; i++) { if (a[i] == 0) { while (b[j] > 0) j++; a[i] = j; j++; } } for (i = 0; i < 2 * n - 1; i++) printf("%d\n", a[i]); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d %d" .LC1: .string "No" .LC2: .string "Yes" .LC3: .string "1\n2\n3" .LC4: .string "%d\n" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 leaq -1597440(%rsp), %r11 .LPSRL0: subq $4096, %rsp orq $0, (%rsp) cmpq %r11, %rsp jne .LPSRL0 subq $2640, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -1600076(%rbp), %rdx leaq -1600080(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -1600076(%rbp), %eax cmpl $1, %eax je .L2 movl -1600080(%rbp), %eax addl %eax, %eax leal -1(%rax), %edx movl -1600076(%rbp), %eax cmpl %eax, %edx jne .L3 .L2: leaq .LC1(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L17 .L3: leaq .LC2(%rip), %rax movq %rax, %rdi call puts@PLT movl -1600080(%rbp), %eax cmpl $2, %eax jne .L5 leaq .LC3(%rip), %rax movq %rax, %rdi call puts@PLT movl $0, %eax jmp .L17 .L5: movl $0, -1600072(%rbp) jmp .L6 .L7: movl -1600072(%rbp), %eax cltq movl $0, -1600064(%rbp,%rax,4) movl -1600072(%rbp), %eax cltq movl -1600064(%rbp,%rax,4), %edx movl -1600072(%rbp), %eax cltq movl %edx, -800032(%rbp,%rax,4) addl $1, -1600072(%rbp) .L6: movl -1600080(%rbp), %eax addl %eax, %eax subl $1, %eax cmpl %eax, -1600072(%rbp) jl .L7 movl -1600076(%rbp), %eax cmpl $2, %eax je .L8 movl -1600080(%rbp), %eax subl $2, %eax cltq movl $1, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax subl $1, %eax movl -1600076(%rbp), %edx cltq movl %edx, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax leal (%rax,%rax), %edx movl -1600080(%rbp), %eax subl $1, %edx cltq movl %edx, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax addl $1, %eax cltq movl $2, -1600064(%rbp,%rax,4) movl $1, -800024(%rbp) movl -1600080(%rbp), %eax addl %eax, %eax leal -1(%rax), %edx movl -800024(%rbp), %ecx movslq %edx, %rax movl %ecx, -800032(%rbp,%rax,4) movl -1600076(%rbp), %eax movslq %edx, %rdx movl -800032(%rbp,%rdx,4), %ecx movslq %eax, %rdx movl %ecx, -800032(%rbp,%rdx,4) cltq movl -800032(%rbp,%rax,4), %eax movl %eax, -800028(%rbp) jmp .L9 .L8: movl -1600080(%rbp), %eax leal -1(%rax), %edx movl -1600080(%rbp), %eax subl $2, %eax addl %edx, %edx cltq movl %edx, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax subl $1, %eax movl -1600076(%rbp), %edx cltq movl %edx, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax cltq movl $1, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax leal (%rax,%rax), %edx movl -1600080(%rbp), %eax addl $1, %eax subl $1, %edx cltq movl %edx, -1600064(%rbp,%rax,4) movl -1600080(%rbp), %eax subl $1, %eax addl %eax, %eax movslq %eax, %rdx movl $1, -800032(%rbp,%rdx,4) cltq movl -800032(%rbp,%rax,4), %eax movl %eax, -800028(%rbp) movl -1600076(%rbp), %eax movl -800028(%rbp), %ecx movslq %eax, %rdx movl %ecx, -800032(%rbp,%rdx,4) movl -1600080(%rbp), %edx subl $1, %edx leal (%rdx,%rdx), %ecx cltq movl -800032(%rbp,%rax,4), %edx movslq %ecx, %rax movl %edx, -800032(%rbp,%rax,4) .L9: movl $1, -1600068(%rbp) movl $0, -1600072(%rbp) jmp .L10 .L14: movl -1600072(%rbp), %eax cltq movl -1600064(%rbp,%rax,4), %eax testl %eax, %eax jne .L11 jmp .L12 .L13: addl $1, -1600068(%rbp) .L12: movl -1600068(%rbp), %eax cltq movl -800032(%rbp,%rax,4), %eax testl %eax, %eax jg .L13 movl -1600072(%rbp), %eax cltq movl -1600068(%rbp), %edx movl %edx, -1600064(%rbp,%rax,4) addl $1, -1600068(%rbp) .L11: addl $1, -1600072(%rbp) .L10: movl -1600080(%rbp), %eax addl %eax, %eax subl $1, %eax cmpl %eax, -1600072(%rbp) jl .L14 movl $0, -1600072(%rbp) jmp .L15 .L16: movl -1600072(%rbp), %eax cltq movl -1600064(%rbp,%rax,4), %eax movl %eax, %esi leaq .LC4(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT addl $1, -1600072(%rbp) .L15: movl -1600080(%rbp), %eax addl %eax, %eax subl $1, %eax cmpl %eax, -1600072(%rbp) jl .L16 movl $0, %eax .L17: movq -8(%rbp), %rdx subq %fs:40, %rdx je .L18 call __stack_chk_fail@PLT .L18: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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 <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)(pow(10, 9)+7);\n printf(\"%lld\", power);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%lld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$1, -16(%rbp)\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -20(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tleaq\t(%rdx,%rcx), %rax\n\tsarq\t$29, %rax\n\tmovq\t%rcx, %rdx\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n\taddl\t$1, -20(%rbp)\n.L2:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L3\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.cfi_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L5\n\tleal\t1(%rax), %r8d\n\tmovl\t$1, %esi\n\tmovl\t$1, %edx\n\tmovabsq\t$-8543223828751151131, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rdx, %rcx\n\timulq\t%rsi, %rcx\n\taddq\t$1, %rsi\n\tmovq\t%rcx, %rax\n\timulq\t%rdi\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\tcmpq\t%r8, %rsi\n\tjne\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tmovl\t$1, %edx\n\tjmp\t.L2\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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_def_cfa_offset 32\n\tleaq\t.LC0(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t4(%rsp), %rsi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t4(%rsp), %eax\n\ttestl\t%eax, %eax\n\tjle\t.L5\n\tleal\t1(%rax), %r8d\n\tmovl\t$1, %esi\n\tmovl\t$1, %edx\n\tmovabsq\t$-8543223828751151131, %rdi\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\tmovq\t%rdx, %rcx\n\timulq\t%rsi, %rcx\n\taddq\t$1, %rsi\n\tmovq\t%rcx, %rax\n\timulq\t%rdi\n\tmovq\t%rcx, %rax\n\tsarq\t$63, %rax\n\taddq\t%rcx, %rdx\n\tsarq\t$29, %rdx\n\tsubq\t%rax, %rdx\n\timulq\t$1000000007, %rdx, %rax\n\tsubq\t%rax, %rcx\n\tmovq\t%rcx, %rdx\n\tcmpq\t%r8, %rsi\n\tjne\t.L3\n.L2:\n\txorl\t%eax, %eax\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\txorl\t%eax, %eax\n\taddq\t$24, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n.L5:\n\t.cfi_restore_state\n\tmovl\t$1, %edx\n\tjmp\t.L2\n.L9:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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)(pow(10, 9)+7);\n printf(\"%lld\", power);\n return 0;\n}", "index": 108, "inputs": [ "100001\n", "1\n", "15\n", "110001\n", "21\n", "110011\n", "39\n", "11\n", "6\n", "4\n", "7\n", "2\n", "101001\n", "8\n", "18\n", "110000\n", "111011\n", "30\n", "110111\n", "65\n", "5\n", "101000\n", "12\n", "110100\n", "111010\n", "40\n", "110010\n", "22\n", "9\n", "111000\n", "16\n", "110110\n", "36\n", "14\n", "111001\n", "17\n", "53\n", "13\n", "101011\n", "20\n", "99\n", "27\n", "177\n", "26\n", "109\n", "38\n", "175\n", "34\n", "52\n", "24\n", "51\n", "33\n", "28\n", "31\n", "25\n", "23\n", "44\n", "50\n", "32\n", "55\n", "83\n", "54\n", "42\n", "35\n", "100100\n", "37\n", "77\n", "46\n", "59\n", "101101\n", "57\n", "80\n", "43\n", "101100\n", "47\n", "101110\n", "111110\n", "61\n", "101111\n", "19\n", "100110\n", "76\n", "56\n", "111100\n", "169\n", "48\n", "75\n", "162\n", "214\n", "72\n", "193\n", "63\n", "29\n", "90\n", "68\n", "45\n", "78\n", "41\n", "126\n", "89\n", "100000\n", "3\n", "10\n", "3\n" ], "outputs": [ "755072381", "1", "674358851", "817497558", "72847302", "422312314", "444985875", "39916800", "720", "24", "5040", "2", "249638241", "40320", "660911389", "559938709", "864631379", "109361473", "246839490", "536698543", "120", "810232079", "479001600", "645894938", "521433597", "799434881", "893005454", "602640637", "362880", "477645764", "789741546", "887588411", "523095984", "178290591", "157078631", "425606191", "272481214", "227020758", "557593479", "146326063", "104379182", "394134213", "420330952", "459042011", "260451868", "472948359", "318708924", "943272305", "948537388", "657629300", "249010336", "57155068", "35757887", "390205642", "440732388", "860734560", "10503098", "318608048", "486580460", "269199917", "671814275", "713985458", "626855450", "14530444", "573468634", "354551275", "661063309", "741412713", "133605669", "511008164", "286129051", "766523501", "954784168", "650720680", "846397273", "175005504", "910389867", "996745124", "981391086", "557316307", "97369367", "878715114", "75195247", "759241785", "903643190", "627068824", "932614679", "674190056", "497191232", "518459667", "98399701", "286427093", "36978716", "749079870", "103956247", "472639410", "562937745", "776829897", "750244778", "674989781", "457992974", "6", "3628800", "6" ], "question": "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)(pow(10, 9)+7);\n printf(\"%lld\", power);\n return 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%d\"\n.LC1:\n\t.string\t\"%lld\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$1, -16(%rbp)\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t$1, -20(%rbp)\n\tjmp\t.L2\n.L3:\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\timulq\t-16(%rbp), %rax\n\tmovq\t%rax, %rcx\n\tmovabsq\t$-8543223828751151131, %rdx\n\tmovq\t%rcx, %rax\n\timulq\t%rdx\n\tleaq\t(%rdx,%rcx), %rax\n\tsarq\t$29, %rax\n\tmovq\t%rcx, %rdx\n\tsarq\t$63, %rdx\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n\tmovq\t-16(%rbp), %rax\n\timulq\t$1000000007, %rax, %rdx\n\tmovq\t%rcx, %rax\n\tsubq\t%rdx, %rax\n\tmovq\t%rax, -16(%rbp)\n\taddl\t$1, -20(%rbp)\n.L2:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjle\t.L3\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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", power); return 0; } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "%lld" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movq $1, -16(%rbp) leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl $1, -20(%rbp) jmp .L2 .L3: movl -20(%rbp), %eax cltq imulq -16(%rbp), %rax movq %rax, %rcx movabsq $-8543223828751151131, %rdx movq %rcx, %rax imulq %rdx leaq (%rdx,%rcx), %rax sarq $29, %rax movq %rcx, %rdx sarq $63, %rdx subq %rdx, %rax movq %rax, -16(%rbp) movq -16(%rbp), %rax imulq $1000000007, %rax, %rdx movq %rcx, %rax subq %rdx, %rax movq %rax, -16(%rbp) addl $1, -20(%rbp) .L2: movl -24(%rbp), %eax cmpl %eax, -20(%rbp) jle .L3 movq -16(%rbp), %rax movq %rax, %rsi leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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// 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#define pc(c) putchar_unlocked(c)\n#else\n#define gc() getchar()\n#define pc(c) putchar(c)\n#endif\nint in()\n{\n\tint n = 0, c = gc();\n\tdo n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');\n\treturn n;\n}\n\nvoid out(int n)\n{\n\tint i;\n\tchar ob[30];\n\n\tif (!n) pc('0');\n\telse {\n\t\ti = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;\n\t\twhile (i--) pc(ob[i]);\n\t}\n\tpc('\\n');\n}\n\n\n//// セグメント木\nint seg[2][1 << 19]; int sz;\n\nvoid segInit(int n) {\n\tsz = 1; while (sz < n) sz <<= 1;\n\tmemset(seg, INF, sizeof(seg));\n}\n\n// k番目(0-index)の値を v に変更\nvoid update(int id, int k, int v)\n{\n\tint a, b;\n\n\tk += sz - 1;\n//\tif (seg[id][k] == v) return;\n\tseg[id][k] = v;\n\twhile (k > 0) {\n\t\tk = (k - 1) >> 1;\n\t\ta = seg[id][(k << 1) + 1];\n\t\tb = seg[id][(k << 1) + 2];\n\t\tseg[id][k] = (a <= b)? a: b;\n\t}\n}\n\n// 空間 [a, b) 内の最小値\nint getMin(int id, int a, int b, int k, int l, int r)\n{\n\tint left, right;\n\n\tif (r <= a || b <= l) return INF;\n\tif (a <= l && r <= b) return seg[id][k];\n\tleft = getMin(id, a, b, (k << 1) + 1, l, (l + r) >> 1);\n\tright = getMin(id, a, b, (k << 1) + 2, (l + r) >> 1, r);\n\treturn left <= right ? left : right;\n}\n\n\n//// 本問題\ntypedef struct { int y, p, n; } T; // 位置と更新前後の値\nT memo[2][200005]; int len[2];\n\nint main()\n{\n\tint i, k, N, Q, x, y, z;\n\tint syn;\n\n\tN = in();\n\tsegInit(N); // セグメント木の初期化\n\tfor (i = 0; i < N; i++) update(0, i, in());\n\tfor (i = 0; i < N; i++) update(1, i, in());\n\n\tQ = in(), syn = 0;\n\twhile (Q--) {\n\t\tx = in(), y = in()-1, z = in(); // 0-index\n\t\tif (x == 1 || x == 2) {\n\t\t\tx--; // 0と1にする. 0->A, 1->B\n\t\t\tif (syn) {\n\t\t\t\t// 位置と更新前後の値を記録\n\t\t\t\tk = len[x]++;\n\t\t\t\tmemo[x][k].y = y, memo[x][k].n = z;\n\t\t\t\tmemo[x][k].p = seg[x][y+(sz-1)]; // 元の値は y+(sz-1) の位置にある\n\t\t\t}\n\t\t\tupdate(x, y, z);\n\t\t}\n\t\telse if (x == 3 || x == 4) out(getMin(x-3, y, z, 0, 0, sz));\n\t\telse {\n\t\t\tx -= 5; // 0と1にする. 0->A, 1->B\n\t\t\tif (syn) {\n\t\t\t\t// 元に戻して、相手のしてきた変更を施し、相手と同じにする\n\t\t\t\tfor (i = len[x] - 1; i >= 0; i--) // 戻す作業\n\t\t\t\t\tupdate(x, memo[x][i].y, memo[x][i].p);\n\t\t\t\tfor (i = 0; i < len[!x]; i++) // 相手に同期\n\t\t\t\t\tupdate(x, memo[!x][i].y, memo[!x][i].n);\n\t\t\t\tlen[0] = len[1] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmemcpy(seg[x], seg[!x], sizeof(int)*sz*2);\n\t\t\t\tsyn = 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tandl\t$15, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$47, -4(%rbp)\n\tjg\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tin, .-in\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovl\t%edi, -68(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L5\n\tmovl\t$48, %edi\n\tcall\tputchar_unlocked@PLT\n\tjmp\t.L6\n.L5:\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-68(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tleal\t48(%rax), %ecx\n\tmovl\t-52(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t%ecx, %edx\n\tcltq\n\tmovb\t%dl, -48(%rbp,%rax)\n\tmovl\t-68(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -68(%rbp)\n.L7:\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L8\n\tjmp\t.L9\n.L10:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar_unlocked@PLT\n.L9:\n\tmovl\t-52(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L10\n.L6:\n\tmovl\t$10, %edi\n\tcall\tputchar_unlocked@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tout, .-out\n\t.globl\tseg\n\t.bss\n\t.align 32\n\t.type\tseg, @object\n\t.size\tseg, 4194304\nseg:\n\t.zero\t4194304\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.text\n\t.globl\tsegInit\n\t.type\tsegInit, @function\nsegInit:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t$1, sz(%rip)\n\tjmp\t.L13\n.L14:\n\tmovl\tsz(%rip), %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, sz(%rip)\n.L13:\n\tmovl\tsz(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjg\t.L14\n\tmovl\t$4194304, %edx\n\tmovl\t$2147483647, %esi\n\tleaq\tseg(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsegInit, .-segInit\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovl\tsz(%rip), %eax\n\tsubl\t$1, %eax\n\taddl\t%eax, -24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tseg(%rip), %rdx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tjmp\t.L16\n.L17:\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t$2, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t-24(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovl\t-20(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rdx\n\taddq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tseg(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n.L16:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L17\n\tnop\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tupdate, .-update\n\t.globl\tgetMin\n\t.type\tgetMin, @function\ngetMin:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovl\t%ecx, -32(%rbp)\n\tmovl\t%r8d, -36(%rbp)\n\tmovl\t%r9d, -40(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L19\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjg\t.L20\n.L19:\n\tmovl\t$2147483647, %eax\n\tjmp\t.L21\n.L20:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjg\t.L22\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjg\t.L22\n\tmovl\t-32(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tjmp\t.L21\n.L22:\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %r8d\n\tmovl\t-32(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-36(%rbp), %edi\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-24(%rbp), %esi\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%r8d, %r9d\n\tmovl\t%edi, %r8d\n\tmovl\t%eax, %edi\n\tcall\tgetMin\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %r8d\n\tmovl\t-32(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t2(%rax), %ecx\n\tmovl\t-40(%rbp), %edi\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-24(%rbp), %esi\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edi, %r9d\n\tmovl\t%eax, %edi\n\tcall\tgetMin\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n.L21:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tgetMin, .-getMin\n\t.globl\tmemo\n\t.bss\n\t.align 32\n\t.type\tmemo, @object\n\t.size\tmemo, 4800120\nmemo:\n\t.zero\t4800120\n\t.globl\tlen\n\t.align 8\n\t.type\tlen, @object\n\t.size\tlen, 8\nlen:\n\t.zero\t8\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tsegInit\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L24\n.L25:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, %edx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t$0, %edi\n\tcall\tupdate\n\taddl\t$1, -32(%rbp)\n.L24:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L25\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, %edx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t$1, %edi\n\tcall\tupdate\n\taddl\t$1, -32(%rbp)\n.L26:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L27\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L28\n.L39:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t$0, %eax\n\tcall\tin\n\tsubl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -8(%rbp)\n\tcmpl\t$1, -16(%rbp)\n\tje\t.L29\n\tcmpl\t$2, -16(%rbp)\n\tjne\t.L30\n.L29:\n\tsubl\t$1, -16(%rbp)\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L31\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tleaq\t0(,%rcx,4), %rsi\n\tleaq\tlen(%rip), %rcx\n\tmovl\t%edx, (%rsi,%rcx)\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\t8+memo(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\tsz(%rip), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rsi, %rcx\n\taddq\t%rax, %rcx\n\tleaq\t4+memo(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, (%rax)\n.L31:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-12(%rbp), %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tupdate\n\tjmp\t.L28\n.L30:\n\tcmpl\t$3, -16(%rbp)\n\tje\t.L32\n\tcmpl\t$4, -16(%rbp)\n\tjne\t.L33\n.L32:\n\tmovl\tsz(%rip), %ecx\n\tmovl\t-16(%rbp), %eax\n\tleal\t-3(%rax), %edi\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%ecx, %r9d\n\tmovl\t$0, %r8d\n\tmovl\t$0, %ecx\n\tmovl\t%eax, %esi\n\tcall\tgetMin\n\tmovl\t%eax, %edi\n\tcall\tout\n\tjmp\t.L28\n.L33:\n\tsubl\t$5, -16(%rbp)\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L34\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -32(%rbp)\n\tjmp\t.L35\n.L36:\n\tmovl\t-32(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\t4+memo(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-32(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rsi, %rcx\n\taddq\t%rax, %rcx\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tupdate\n\tsubl\t$1, -32(%rbp)\n.L35:\n\tcmpl\t$0, -32(%rbp)\n\tjns\t.L36\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L37\n.L38:\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t-32(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\t8+memo(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t-32(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tmovslq\t%eax, %rsi\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rsi, %rcx\n\taddq\t%rax, %rcx\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tupdate\n\taddl\t$1, -32(%rbp)\n.L37:\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -32(%rbp)\n\tjl\t.L38\n\tmovl\t$0, 4+len(%rip)\n\tmovl\t4+len(%rip), %eax\n\tmovl\t%eax, len(%rip)\n\tjmp\t.L28\n.L34:\n\tmovl\tsz(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tcltq\n\tsalq\t$21, %rax\n\tmovq\t%rax, %rcx\n\tleaq\tseg(%rip), %rax\n\taddq\t%rax, %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$21, %rax\n\tmovq\t%rax, %rsi\n\tleaq\tseg(%rip), %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmemcpy@PLT\n\tmovl\t$1, -24(%rbp)\n.L28:\n\tmovl\t-28(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -28(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L39\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L3:\n\txorl\t%r12d, %r12d\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L1\n.L5:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L7:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L4\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L1\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L1:\n\tmovl\t%r12d, %eax\n\tpopq\t%r12\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L3\n\t.cfi_endproc\n.LFE51:\n\t.size\tin, .-in\n\t.p2align 4\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovl\t%edi, %edx\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t48(%rdi), %rcx\n\tmovq\t40(%rdi), %rax\n\ttestl\t%edx, %edx\n\tjne\t.L22\n\tcmpq\t%rcx, %rax\n\tjnb\t.L27\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$48, (%rax)\n.L15:\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L28\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$10, (%rax)\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\t.cfi_restore_state\n\txorl\t%ecx, %ecx\n\tmovq\t%rsp, %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovslq\t%edx, %rax\n\tmovl\t%edx, %esi\n\tmovslq\t%ecx, %r8\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %esi\n\tsarq\t$34, %rax\n\tsubl\t%esi, %eax\n\tleal\t(%rax,%rax,4), %esi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %edx\n\taddl\t$48, %edx\n\tmovb\t%dl, (%rbx,%rcx)\n\tmovl\t%eax, %edx\n\tmovq\t%rcx, %rax\n\taddq\t$1, %rcx\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tleaq\t-1(%rsp,%r8), %rbp\n\taddq\t%r8, %rbx\n\tsubq\t%rax, %rbp\n\tjmp\t.L18\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovq\tstdout(%rip), %rdi\n.L18:\n\tmovzbl\t(%rbx), %esi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L29\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t%sil, (%rax)\n.L17:\n\tsubq\t$1, %rbx\n\tcmpq\t%rbx, %rbp\n\tjne\t.L30\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tcall\t__overflow@PLT\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\tmovl\t$48, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %esi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\t__overflow@PLT\n.L26:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tout, .-out\n\t.p2align 4\n\t.globl\tsegInit\n\t.type\tsegInit, @function\nsegInit:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$1, sz(%rip)\n\tcmpl\t$1, %edi\n\tjle\t.L32\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\taddl\t%eax, %eax\n\tcmpl\t%edi, %eax\n\tjl\t.L33\n\tmovl\t%eax, sz(%rip)\n.L32:\n\tmovl\t$4194304, %edx\n\tmovl\t$2147483647, %esi\n\tleaq\tseg(%rip), %rdi\n\tjmp\tmemset@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tsegInit, .-segInit\n\t.p2align 4\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tsz(%rip), %eax\n\tmovslq\t%edi, %rdi\n\tleaq\tseg(%rip), %r8\n\tsalq\t$19, %rdi\n\tleal\t-1(%rax,%rsi), %ecx\n\tmovslq\t%ecx, %rax\n\taddq\t%rdi, %rax\n\tmovl\t%edx, (%r8,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L35\n\t.p2align 4,,10\n\t.p2align 3\n.L37:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\taddq\t%rdi, %rax\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%r8,%rax,4), %eax\n\taddq\t%rdi, %rsi\n\taddq\t%rdi, %rdx\n\tmovl\t(%r8,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%r8,%rsi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L37\n.L35:\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tupdate, .-update\n\t.p2align 4\n\t.globl\tgetMin\n\t.type\tgetMin, @function\ngetMin:\n.LFB55:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tcmpl\t%esi, %r9d\n\tjle\t.L54\n\tmovl\t%edx, %r12d\n\tcmpl\t%r8d, %edx\n\tjle\t.L54\n\tcmpl\t%r8d, %esi\n\tmovslq\t%edi, %rbp\n\tmovl\t%r9d, %ebx\n\tsetle\t%al\n\tcmpl\t%edx, %r9d\n\tsetle\t%r10b\n\ttestb\t%al, %al\n\tje\t.L41\n\ttestb\t%r10b, %r10b\n\tje\t.L41\n\tmovslq\t%ecx, %rcx\n\tsalq\t$19, %rbp\n\tleaq\tseg(%rip), %rax\n\taddq\t%rcx, %rbp\n\tmovl\t(%rax,%rbp,4), %r13d\n.L39:\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovl\t%r13d, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\t.cfi_restore_state\n\taddl\t%ecx, %ecx\n\tleal\t(%rbx,%r8), %r15d\n\tleal\t2(%rcx), %edi\n\tsarl\t%r15d\n\tleal\t1(%rcx), %edx\n\tmovl\t%edi, 8(%rsp)\n\tcmpl\t%r15d, %esi\n\tjge\t.L55\n\tcmpl\t%r15d, %r12d\n\tmovl\t%eax, %ecx\n\tsetge\t%r11b\n\tandb\t%r11b, %cl\n\tje\t.L43\n\tmovslq\t%ebp, %rax\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\tseg(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %r13d\n\tcmpl\t%r15d, %r12d\n\tje\t.L39\n.L45:\n\tmovl\t8(%rsp), %eax\n\tleal\t(%rbx,%r15), %r14d\n\tsarl\t%r14d\n\taddl\t%eax, %eax\n\tleal\t1(%rax), %edx\n\taddl\t$2, %eax\n\tmovl\t%eax, 8(%rsp)\n\tcmpl\t%r14d, %esi\n\tjge\t.L57\n\tcmpl\t%r14d, %r12d\n\tjl\t.L51\n\ttestb\t%cl, %cl\n\tje\t.L51\n\tmovslq\t%ebp, %rax\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\tseg(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %r15d\n\tcmpl\t%r14d, %r12d\n\tje\t.L52\n.L53:\n\tmovl\t8(%rsp), %r10d\n\tleal\t(%rbx,%r14), %r11d\n\tmovl\t%r14d, %r8d\n\tmovl\t%r12d, %edx\n\tsarl\t%r11d\n\tmovl\t%ebp, %edi\n\tmovl\t%esi, 8(%rsp)\n\taddl\t%r10d, %r10d\n\tmovl\t%r11d, %r9d\n\tmovl\t%r11d, 12(%rsp)\n\tleal\t1(%r10), %ecx\n\tmovl\t%r10d, 16(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %r10d\n\tmovl\t8(%rsp), %esi\n\tmovl\t%ebp, %edi\n\tmovl\t12(%rsp), %r8d\n\tmovl\t%eax, %r14d\n\tmovl\t%ebx, %r9d\n\tmovl\t%r12d, %edx\n\tleal\t2(%r10), %ecx\n\tcall\tgetMin\n\tcmpl\t%r14d, %r15d\n\tcmovle\t%r15d, %r14d\n\tcmpl\t%eax, %r14d\n\tcmovle\t%r14d, %eax\n\tmovl\t%eax, %r15d\n.L52:\n\tcmpl\t%r15d, %r13d\n\tcmovg\t%r15d, %r13d\n\tjmp\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L54:\n\tmovl\t$2147483647, %r13d\n\tjmp\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tleal\t(%r8,%r15), %ecx\n\taddl\t%edx, %edx\n\tsarl\t%ecx\n\tleal\t2(%rdx), %edi\n\tmovl\t%ecx, %r14d\n\tmovl\t%edi, 12(%rsp)\n\tleal\t1(%rdx), %ecx\n\tcmpl\t%r14d, %esi\n\tjge\t.L56\n\tcmpl\t%r14d, %r12d\n\tjl\t.L47\n\ttestb\t%al, %al\n\tje\t.L47\n\tmovslq\t%ebp, %rax\n\tmovslq\t%ecx, %rcx\n\tleaq\tseg(%rip), %rdx\n\tsalq\t$19, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rdx,%rax,4), %r13d\n\tcmpl\t%r14d, %r12d\n\tje\t.L42\n.L49:\n\tleal\t(%r15,%r14), %eax\n\tmovl\t%r14d, %r8d\n\tmovl\t%r12d, %edx\n\tmovl\t%ebp, %edi\n\tsarl\t%eax\n\tmovb\t%r10b, 24(%rsp)\n\tmovl\t%eax, %r11d\n\tmovl\t12(%rsp), %eax\n\tmovl\t%esi, 16(%rsp)\n\tmovl\t%r11d, %r9d\n\tmovl\t%r11d, 20(%rsp)\n\taddl\t%eax, %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t%eax, 12(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %esi\n\tmovl\t20(%rsp), %r8d\n\tmovl\t%ebp, %edi\n\tmovl\t%eax, %r14d\n\tmovl\t12(%rsp), %eax\n\tmovl\t%r15d, %r9d\n\tmovl\t%r12d, %edx\n\tmovl\t%esi, 12(%rsp)\n\tleal\t2(%rax), %ecx\n\tcall\tgetMin\n\tcmpl\t%r13d, %r14d\n\tmovl\t12(%rsp), %esi\n\tmovzbl\t24(%rsp), %r10d\n\tcmovg\t%r13d, %r14d\n\tcmpl\t%eax, %r14d\n\tcmovle\t%r14d, %eax\n\tmovl\t%eax, %r13d\n.L42:\n\tcmpl\t%r15d, %r12d\n\tjle\t.L39\n\tcmpl\t%r15d, %esi\n\tsetle\t%al\n\tmovl\t%eax, %ecx\n\ttestb\t%r10b, %r10b\n\tje\t.L45\n\ttestb\t%al, %al\n\tje\t.L45\n\tmovslq\t8(%rsp), %rax\n\tsalq\t$19, %rbp\n\taddq\t%rax, %rbp\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rax,%rbp,4), %eax\n\tcmpl\t%eax, %r13d\n\tcmovg\t%eax, %r13d\n\tjmp\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L55:\n\tmovl\t$2147483647, %r13d\n\tjmp\t.L42\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tleal\t(%r15,%r14), %eax\n\tmovl\t%r15d, %r8d\n\tmovl\t%ebp, %edi\n\tmovb\t%r10b, 24(%rsp)\n\tsarl\t%eax\n\tmovl\t%esi, 16(%rsp)\n\tmovl\t%eax, %r11d\n\tleal\t(%rdx,%rdx), %eax\n\tmovl\t%r12d, %edx\n\tmovl\t%r11d, %r9d\n\tleal\t1(%rax), %ecx\n\tmovl\t%r11d, 20(%rsp)\n\tmovl\t%eax, 12(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %esi\n\tmovl\t20(%rsp), %r8d\n\tmovl\t%ebp, %edi\n\tmovl\t%eax, %r15d\n\tmovl\t12(%rsp), %eax\n\tmovl\t%r14d, %r9d\n\tmovl\t%r12d, %edx\n\tmovl\t%esi, 12(%rsp)\n\tleal\t2(%rax), %ecx\n\tcall\tgetMin\n\tmovl\t12(%rsp), %esi\n\tmovzbl\t24(%rsp), %r10d\n\tcmpl\t%eax, %r15d\n\tcmovg\t%eax, %r15d\n.L50:\n\tcmpl\t%r14d, %r12d\n\tjle\t.L52\n\tcmpl\t%r14d, %esi\n\tjg\t.L53\n\ttestb\t%r10b, %r10b\n\tje\t.L53\n\tmovslq\t8(%rsp), %rax\n\tsalq\t$19, %rbp\n\tleaq\tseg(%rip), %rdx\n\taddq\t%rbp, %rax\n\tmovl\t(%rdx,%rax,4), %eax\n\tcmpl\t%eax, %r15d\n\tcmovg\t%eax, %r15d\n\tjmp\t.L52\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\tleal\t(%r8,%r14), %eax\n\tmovl\t%r12d, %edx\n\tmovl\t%ebp, %edi\n\tmovb\t%r10b, 31(%rsp)\n\tsarl\t%eax\n\tmovb\t%r11b, 30(%rsp)\n\tmovl\t%eax, %r13d\n\tleal\t(%rcx,%rcx), %eax\n\tmovl\t%esi, 24(%rsp)\n\tmovl\t%r13d, %r9d\n\tleal\t1(%rax), %ecx\n\tmovl\t%eax, 16(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %edx\n\tmovl\t24(%rsp), %esi\n\tmovl\t%r13d, %r8d\n\tmovl\t%ebp, %edi\n\tmovl\t%r14d, %r9d\n\tmovl\t%eax, 20(%rsp)\n\tleal\t2(%rdx), %ecx\n\tmovl\t%r12d, %edx\n\tmovl\t%esi, 16(%rsp)\n\tcall\tgetMin\n\tmovl\t20(%rsp), %edi\n\tmovl\t16(%rsp), %esi\n\tmovzbl\t30(%rsp), %r11d\n\tmovzbl\t31(%rsp), %r10d\n\tcmpl\t%eax, %edi\n\tmovl\t%edi, %r13d\n\tcmovg\t%eax, %r13d\n.L46:\n\tcmpl\t%r14d, %r12d\n\tjle\t.L42\n\tcmpl\t%r14d, %esi\n\tjg\t.L49\n\ttestb\t%r11b, %r11b\n\tje\t.L49\n\tmovslq\t12(%rsp), %rdx\n\tmovslq\t%ebp, %rax\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\tseg(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %eax\n\tcmpl\t%eax, %r13d\n\tcmovg\t%eax, %r13d\n\tjmp\t.L42\n\t.p2align 4,,10\n\t.p2align 3\n.L57:\n\tmovl\t$2147483647, %r15d\n\tjmp\t.L50\n\t.p2align 4,,10\n\t.p2align 3\n.L56:\n\tmovl\t$2147483647, %r13d\n\tjmp\t.L46\n\t.cfi_endproc\n.LFE55:\n\t.size\tgetMin, .-getMin\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\tseg(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\txorl\t%ebx, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcall\tin\n\tmovl\t%eax, %edi\n\tmovl\t%eax, %ebp\n\tcall\tsegInit\n\tmovq\tstdin(%rip), %rdi\n\ttestl\t%ebp, %ebp\n\tjle\t.L115\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L183\n\t.p2align 4,,10\n\t.p2align 3\n.L99:\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L100:\n\txorl\t%r13d, %r13d\n\tjmp\t.L104\n\t.p2align 4,,10\n\t.p2align 3\n.L101:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L103\n.L102:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L104:\n\tleal\t0(%r13,%r13,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r13d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L101\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tcmpl\t$47, %eax\n\tjg\t.L102\n\t.p2align 4,,10\n\t.p2align 3\n.L103:\n\tmovl\tsz(%rip), %eax\n\tleal\t-1(%rbx,%rax), %ecx\n\tmovslq\t%ecx, %rax\n\tmovl\t%r13d, (%r12,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L107\n\t.p2align 4,,10\n\t.p2align 3\n.L105:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\tmovl\t(%r12,%rax,4), %eax\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%r12,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%r12,%rsi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L105\n.L107:\n\tleal\t1(%rbx), %eax\n\tcmpl\t%eax, %ebp\n\tje\t.L184\n\tmovl\t%eax, %ebx\n\tmovq\t16(%rdi), %rcx\n\tmovq\t8(%rdi), %rax\n\tcmpq\t%rcx, %rax\n\tjb\t.L99\n.L183:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L100\n.L115:\n\txorl\t%eax, %eax\n\txorl\t%r12d, %r12d\n\tleaq\tseg(%rip), %rbx\n\tcall\tin\n\tmovl\t%eax, %ebp\n\ttestl\t%eax, %eax\n\tje\t.L174\n\t.p2align 4,,10\n\t.p2align 3\n.L151:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rdx\n\tcmpq\t%rdx, %rax\n\tjnb\t.L185\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L118:\n\txorl\t%r14d, %r14d\n\tjmp\t.L122\n\t.p2align 4,,10\n\t.p2align 3\n.L119:\n\tleaq\t1(%rcx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L121\n.L120:\n\tmovq\t%rsi, %rcx\n.L122:\n\tleal\t(%r14,%r14,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r14d\n\tcmpq\t%rdx, %rcx\n\tjb\t.L119\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L120\n\t.p2align 4,,10\n\t.p2align 3\n.L121:\n\tcmpq\t%rsi, %rdx\n\tjbe\t.L186\n\tleaq\t1(%rsi), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L124:\n\txorl\t%r13d, %r13d\n\tjmp\t.L128\n\t.p2align 4,,10\n\t.p2align 3\n.L125:\n\tleaq\t1(%rcx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L127\n.L126:\n\tmovq\t%rsi, %rcx\n.L128:\n\tleal\t0(%r13,%r13,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r13d\n\tcmpq\t%rdx, %rcx\n\tjb\t.L125\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L126\n\t.p2align 4,,10\n\t.p2align 3\n.L127:\n\tsubl\t$1, %r13d\n\tcmpq\t%rsi, %rdx\n\tjbe\t.L187\n\tleaq\t1(%rsi), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L130:\n\txorl\t%r15d, %r15d\n\tjmp\t.L134\n\t.p2align 4,,10\n\t.p2align 3\n.L131:\n\tleaq\t1(%rcx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L133\n.L132:\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n.L134:\n\tleal\t(%r15,%r15,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r15d\n\tcmpq\t%rdx, %rcx\n\tjb\t.L131\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L133\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L132\n\t.p2align 4,,10\n\t.p2align 3\n.L133:\n\tleal\t-1(%r14), %esi\n\tcmpl\t$1, %esi\n\tjbe\t.L188\n\tleal\t-3(%r14), %edi\n\tcmpl\t$1, %edi\n\tjbe\t.L189\n\tmovl\t%r14d, %ecx\n\tsubl\t$5, %ecx\n\tsete\t%r14b\n\tsete\t%r11b\n\tmovslq\t%ecx, %rcx\n\tmovzbl\t%r14b, %r14d\n\ttestl\t%r12d, %r12d\n\tjne\t.L190\n\tmovslq\tsz(%rip), %rdx\n\tmovzbl\t%r11b, %esi\n\tsalq\t$21, %rcx\n\tmovl\t$1, %r12d\n\tsalq\t$21, %rsi\n\tleaq\t(%rbx,%rcx), %rdi\n\tsalq\t$3, %rdx\n\tleaq\t(%rbx,%rsi), %rsi\n\tcall\tmemcpy@PLT\n.L137:\n\tsubl\t$1, %ebp\n\tjne\t.L151\n.L174:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L188:\n\t.cfi_restore_state\n\tmovl\tsz(%rip), %ecx\n\tmovslq\t%esi, %rsi\n\ttestl\t%r12d, %r12d\n\tjne\t.L175\n\tsubl\t$1, %ecx\n.L136:\n\taddl\t%r13d, %ecx\n\tsalq\t$19, %rsi\n\tmovslq\t%ecx, %rax\n\taddq\t%rsi, %rax\n\tmovl\t%r15d, (%rbx,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\taddq\t%rsi, %rax\n\tmovslq\t%ecx, %rdi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rbx,%rax,4), %eax\n\taddq\t%rsi, %rdi\n\taddq\t%rsi, %rdx\n\tmovl\t(%rbx,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%rbx,%rdi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L138\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L175:\n\tleaq\tlen(%rip), %rdi\n\tsubl\t$1, %ecx\n\tmovd\t%r13d, %xmm0\n\tmovslq\t(%rdi,%rsi,4), %rax\n\tleaq\tmemo(%rip), %r11\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, (%rdi,%rsi,4)\n\tleaq\t(%rax,%rax,2), %rdx\n\timulq\t$2400060, %rsi, %rax\n\tleaq\t(%rax,%rdx,4), %rdi\n\tleal\t(%rcx,%r13), %edx\n\tmovq\t%rsi, %rax\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rax\n\tmovl\t%r15d, 8(%r11,%rdi)\n\taddq\t%rdx, %rax\n\tmovl\t(%rbx,%rax,4), %eax\n\tmovd\t%eax, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%r11,%rdi)\n\tjmp\t.L136\n\t.p2align 4,,10\n\t.p2align 3\n.L190:\n\tleaq\tlen(%rip), %rax\n\tmovslq\t(%rax,%rcx,4), %rax\n\tmovl\t%eax, %r10d\n\tsubl\t$1, %r10d\n\tjs\t.L146\n\timulq\t$2400060, %rcx, %rdx\n\tleaq\t(%rax,%rax,2), %rax\n\tmovl\tsz(%rip), %edi\n\tmovq\t%rcx, %r8\n\tsalq\t$19, %r8\n\tleal\t-1(%rdi), %r13d\n\tleaq\t(%rdx,%rax,4), %r9\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rax, %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L145:\n\tmovl\t-12(%r9), %esi\n\tmovl\t-8(%r9), %edx\n\taddl\t%r13d, %esi\n\tmovslq\t%esi, %rax\n\taddq\t%r8, %rax\n\tmovl\t%edx, (%rbx,%rax,4)\n\ttestl\t%esi, %esi\n\tjle\t.L147\n\t.p2align 4,,10\n\t.p2align 3\n.L144:\n\tleal\t-1(%rsi), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %esi\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%esi\n\taddl\t$2, %edx\n\taddq\t%r8, %rax\n\tmovslq\t%esi, %rdi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rbx,%rax,4), %eax\n\taddq\t%r8, %rdi\n\taddq\t%r8, %rdx\n\tmovl\t(%rbx,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%rbx,%rdi,4)\n\ttestl\t%esi, %esi\n\tjne\t.L144\n.L147:\n\tsubl\t$1, %r10d\n\tsubq\t$12, %r9\n\tcmpl\t$-1, %r10d\n\tjne\t.L145\n.L146:\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rax,%r14,4), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L143\n\tmovl\tsz(%rip), %eax\n\tleaq\tmemo(%rip), %rdi\n\tsalq\t$19, %rcx\n\tleaq\t12(%rdi), %rdx\n\tleal\t-1(%rax), %r9d\n\tmovzbl\t%r11b, %eax\n\timulq\t$2400060, %rax, %rax\n\tleaq\t(%rax,%rdi), %r8\n\taddq\t%rdx, %rax\n\tleal\t-1(%rsi), %edx\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rax,%rdx,4), %r10\n\t.p2align 4,,10\n\t.p2align 3\n.L149:\n\tmovl\t(%r8), %esi\n\tmovl\t8(%r8), %edx\n\taddl\t%r9d, %esi\n\tmovslq\t%esi, %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, (%rbx,%rax,4)\n\ttestl\t%esi, %esi\n\tjle\t.L150\n\t.p2align 4,,10\n\t.p2align 3\n.L148:\n\tleal\t-1(%rsi), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %esi\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%esi\n\taddl\t$2, %edx\n\taddq\t%rcx, %rax\n\tmovslq\t%esi, %rdi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rbx,%rax,4), %eax\n\taddq\t%rcx, %rdi\n\taddq\t%rcx, %rdx\n\tmovl\t(%rbx,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%rbx,%rdi,4)\n\ttestl\t%esi, %esi\n\tjne\t.L148\n.L150:\n\taddq\t$12, %r8\n\tcmpq\t%r8, %r10\n\tjne\t.L149\n.L143:\n\tmovq\t$0, len(%rip)\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L189:\n\tmovl\tsz(%rip), %r9d\n\txorl\t%r8d, %r8d\n\txorl\t%ecx, %ecx\n\tmovl\t%r15d, %edx\n\tmovl\t%r13d, %esi\n\tcall\tgetMin\n\tmovl\t%eax, %edi\n\tcall\tout\n\tjmp\t.L137\n.L184:\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\txorl\t%ebp, %ebp\n\tcmpq\t%rcx, %rax\n\tjnb\t.L191\n\t.p2align 4,,10\n\t.p2align 3\n.L108:\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L109:\n\txorl\t%r13d, %r13d\n\tjmp\t.L113\n\t.p2align 4,,10\n\t.p2align 3\n.L110:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L112\n.L111:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L113:\n\tleal\t0(%r13,%r13,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r13d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L110\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L112\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L111\n\t.p2align 4,,10\n\t.p2align 3\n.L112:\n\tmovl\tsz(%rip), %eax\n\tleal\t-1(%rbp,%rax), %ecx\n\tmovslq\t%ecx, %rax\n\tmovl\t%r13d, 2097152(%r12,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L116\n\t.p2align 4,,10\n\t.p2align 3\n.L114:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\tmovl\t2097152(%r12,%rax,4), %eax\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovl\t2097152(%r12,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, 2097152(%r12,%rsi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L114\n.L116:\n\tleal\t1(%rbp), %eax\n\tcmpl\t%ebx, %ebp\n\tje\t.L115\n\tmovq\tstdin(%rip), %rdi\n\tmovl\t%eax, %ebp\n\tmovq\t16(%rdi), %rcx\n\tmovq\t8(%rdi), %rax\n\tcmpq\t%rcx, %rax\n\tjb\t.L108\n.L191:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L109\n.L185:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L118\n.L187:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L130\n.L186:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L124\n\t.cfi_endproc\n.LFE56:\n\t.size\tmain, .-main\n\t.globl\tlen\n\t.bss\n\t.align 8\n\t.type\tlen, @object\n\t.size\tlen, 8\nlen:\n\t.zero\t8\n\t.globl\tmemo\n\t.align 32\n\t.type\tmemo, @object\n\t.size\tmemo, 4800120\nmemo:\n\t.zero\t4800120\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tseg\n\t.align 32\n\t.type\tseg, @object\n\t.size\tseg, 4194304\nseg:\n\t.zero\t4194304\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L3:\n\txorl\t%r12d, %r12d\n\tjmp\t.L7\n\t.p2align 4,,10\n\t.p2align 3\n.L4:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L1\n.L5:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L7:\n\tleal\t(%r12,%r12,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r12d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L4\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L1\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L5\n\t.p2align 4,,10\n\t.p2align 3\n.L1:\n\tmovl\t%r12d, %eax\n\tpopq\t%r12\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L11:\n\t.cfi_restore_state\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L3\n\t.cfi_endproc\n.LFE51:\n\t.size\tin, .-in\n\t.p2align 4\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB52:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovl\t%edi, %edx\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 3, -24\n\tsubq\t$56, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 40(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t48(%rdi), %rcx\n\tmovq\t40(%rdi), %rax\n\ttestl\t%edx, %edx\n\tjne\t.L22\n\tcmpq\t%rcx, %rax\n\tjnb\t.L27\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$48, (%rax)\n.L15:\n\tmovq\tstdout(%rip), %rdi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L28\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t$10, (%rax)\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\t.cfi_restore_state\n\txorl\t%ecx, %ecx\n\tmovq\t%rsp, %rbx\n\t.p2align 4,,10\n\t.p2align 3\n.L13:\n\tmovslq\t%edx, %rax\n\tmovl\t%edx, %esi\n\tmovslq\t%ecx, %r8\n\timulq\t$1717986919, %rax, %rax\n\tsarl\t$31, %esi\n\tsarq\t$34, %rax\n\tsubl\t%esi, %eax\n\tleal\t(%rax,%rax,4), %esi\n\taddl\t%esi, %esi\n\tsubl\t%esi, %edx\n\taddl\t$48, %edx\n\tmovb\t%dl, (%rbx,%rcx)\n\tmovl\t%eax, %edx\n\tmovq\t%rcx, %rax\n\taddq\t$1, %rcx\n\ttestl\t%edx, %edx\n\tjne\t.L13\n\tleaq\t-1(%rsp,%r8), %rbp\n\taddq\t%r8, %rbx\n\tsubq\t%rax, %rbp\n\tjmp\t.L18\n\t.p2align 4,,10\n\t.p2align 3\n.L30:\n\tmovq\tstdout(%rip), %rdi\n.L18:\n\tmovzbl\t(%rbx), %esi\n\tmovq\t40(%rdi), %rax\n\tcmpq\t48(%rdi), %rax\n\tjnb\t.L29\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 40(%rdi)\n\tmovb\t%sil, (%rax)\n.L17:\n\tsubq\t$1, %rbx\n\tcmpq\t%rbx, %rbp\n\tjne\t.L30\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L29:\n\tcall\t__overflow@PLT\n\tjmp\t.L17\n\t.p2align 4,,10\n\t.p2align 3\n.L27:\n\tmovl\t$48, %esi\n\tcall\t__overflow@PLT\n\tjmp\t.L15\n\t.p2align 4,,10\n\t.p2align 3\n.L28:\n\tmovq\t40(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L26\n\taddq\t$56, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 24\n\tmovl\t$10, %esi\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 16\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tjmp\t__overflow@PLT\n.L26:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE52:\n\t.size\tout, .-out\n\t.p2align 4\n\t.globl\tsegInit\n\t.type\tsegInit, @function\nsegInit:\n.LFB53:\n\t.cfi_startproc\n\tendbr64\n\tmovl\t$1, sz(%rip)\n\tcmpl\t$1, %edi\n\tjle\t.L32\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L33:\n\taddl\t%eax, %eax\n\tcmpl\t%edi, %eax\n\tjl\t.L33\n\tmovl\t%eax, sz(%rip)\n.L32:\n\tmovl\t$4194304, %edx\n\tmovl\t$2147483647, %esi\n\tleaq\tseg(%rip), %rdi\n\tjmp\tmemset@PLT\n\t.cfi_endproc\n.LFE53:\n\t.size\tsegInit, .-segInit\n\t.p2align 4\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB54:\n\t.cfi_startproc\n\tendbr64\n\tmovl\tsz(%rip), %eax\n\tmovslq\t%edi, %rdi\n\tleaq\tseg(%rip), %r8\n\tsalq\t$19, %rdi\n\tleal\t-1(%rax,%rsi), %ecx\n\tmovslq\t%ecx, %rax\n\taddq\t%rdi, %rax\n\tmovl\t%edx, (%r8,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L35\n\t.p2align 4,,10\n\t.p2align 3\n.L37:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\taddq\t%rdi, %rax\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%r8,%rax,4), %eax\n\taddq\t%rdi, %rsi\n\taddq\t%rdi, %rdx\n\tmovl\t(%r8,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%r8,%rsi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L37\n.L35:\n\tret\n\t.cfi_endproc\n.LFE54:\n\t.size\tupdate, .-update\n\t.p2align 4\n\t.globl\tgetMin\n\t.type\tgetMin, @function\ngetMin:\n.LFB55:\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 96\n\tcmpl\t%esi, %r9d\n\tjle\t.L54\n\tmovl\t%edx, %r12d\n\tcmpl\t%r8d, %edx\n\tjle\t.L54\n\tcmpl\t%r8d, %esi\n\tmovslq\t%edi, %rbp\n\tmovl\t%r9d, %ebx\n\tsetle\t%al\n\tcmpl\t%edx, %r9d\n\tsetle\t%r10b\n\ttestb\t%al, %al\n\tje\t.L41\n\ttestb\t%r10b, %r10b\n\tje\t.L41\n\tmovslq\t%ecx, %rcx\n\tsalq\t$19, %rbp\n\tleaq\tseg(%rip), %rax\n\taddq\t%rcx, %rbp\n\tmovl\t(%rax,%rbp,4), %r13d\n.L39:\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\tmovl\t%r13d, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L41:\n\t.cfi_restore_state\n\taddl\t%ecx, %ecx\n\tleal\t(%rbx,%r8), %r15d\n\tleal\t2(%rcx), %edi\n\tsarl\t%r15d\n\tleal\t1(%rcx), %edx\n\tmovl\t%edi, 8(%rsp)\n\tcmpl\t%r15d, %esi\n\tjge\t.L55\n\tcmpl\t%r15d, %r12d\n\tmovl\t%eax, %ecx\n\tsetge\t%r11b\n\tandb\t%r11b, %cl\n\tje\t.L43\n\tmovslq\t%ebp, %rax\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\tseg(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %r13d\n\tcmpl\t%r15d, %r12d\n\tje\t.L39\n.L45:\n\tmovl\t8(%rsp), %eax\n\tleal\t(%rbx,%r15), %r14d\n\tsarl\t%r14d\n\taddl\t%eax, %eax\n\tleal\t1(%rax), %edx\n\taddl\t$2, %eax\n\tmovl\t%eax, 8(%rsp)\n\tcmpl\t%r14d, %esi\n\tjge\t.L57\n\tcmpl\t%r14d, %r12d\n\tjl\t.L51\n\ttestb\t%cl, %cl\n\tje\t.L51\n\tmovslq\t%ebp, %rax\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\tseg(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %r15d\n\tcmpl\t%r14d, %r12d\n\tje\t.L52\n.L53:\n\tmovl\t8(%rsp), %r10d\n\tleal\t(%rbx,%r14), %r11d\n\tmovl\t%r14d, %r8d\n\tmovl\t%r12d, %edx\n\tsarl\t%r11d\n\tmovl\t%ebp, %edi\n\tmovl\t%esi, 8(%rsp)\n\taddl\t%r10d, %r10d\n\tmovl\t%r11d, %r9d\n\tmovl\t%r11d, 12(%rsp)\n\tleal\t1(%r10), %ecx\n\tmovl\t%r10d, 16(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %r10d\n\tmovl\t8(%rsp), %esi\n\tmovl\t%ebp, %edi\n\tmovl\t12(%rsp), %r8d\n\tmovl\t%eax, %r14d\n\tmovl\t%ebx, %r9d\n\tmovl\t%r12d, %edx\n\tleal\t2(%r10), %ecx\n\tcall\tgetMin\n\tcmpl\t%r14d, %r15d\n\tcmovle\t%r15d, %r14d\n\tcmpl\t%eax, %r14d\n\tcmovle\t%r14d, %eax\n\tmovl\t%eax, %r15d\n.L52:\n\tcmpl\t%r15d, %r13d\n\tcmovg\t%r15d, %r13d\n\tjmp\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L54:\n\tmovl\t$2147483647, %r13d\n\tjmp\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L43:\n\tleal\t(%r8,%r15), %ecx\n\taddl\t%edx, %edx\n\tsarl\t%ecx\n\tleal\t2(%rdx), %edi\n\tmovl\t%ecx, %r14d\n\tmovl\t%edi, 12(%rsp)\n\tleal\t1(%rdx), %ecx\n\tcmpl\t%r14d, %esi\n\tjge\t.L56\n\tcmpl\t%r14d, %r12d\n\tjl\t.L47\n\ttestb\t%al, %al\n\tje\t.L47\n\tmovslq\t%ebp, %rax\n\tmovslq\t%ecx, %rcx\n\tleaq\tseg(%rip), %rdx\n\tsalq\t$19, %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rdx,%rax,4), %r13d\n\tcmpl\t%r14d, %r12d\n\tje\t.L42\n.L49:\n\tleal\t(%r15,%r14), %eax\n\tmovl\t%r14d, %r8d\n\tmovl\t%r12d, %edx\n\tmovl\t%ebp, %edi\n\tsarl\t%eax\n\tmovb\t%r10b, 24(%rsp)\n\tmovl\t%eax, %r11d\n\tmovl\t12(%rsp), %eax\n\tmovl\t%esi, 16(%rsp)\n\tmovl\t%r11d, %r9d\n\tmovl\t%r11d, 20(%rsp)\n\taddl\t%eax, %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t%eax, 12(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %esi\n\tmovl\t20(%rsp), %r8d\n\tmovl\t%ebp, %edi\n\tmovl\t%eax, %r14d\n\tmovl\t12(%rsp), %eax\n\tmovl\t%r15d, %r9d\n\tmovl\t%r12d, %edx\n\tmovl\t%esi, 12(%rsp)\n\tleal\t2(%rax), %ecx\n\tcall\tgetMin\n\tcmpl\t%r13d, %r14d\n\tmovl\t12(%rsp), %esi\n\tmovzbl\t24(%rsp), %r10d\n\tcmovg\t%r13d, %r14d\n\tcmpl\t%eax, %r14d\n\tcmovle\t%r14d, %eax\n\tmovl\t%eax, %r13d\n.L42:\n\tcmpl\t%r15d, %r12d\n\tjle\t.L39\n\tcmpl\t%r15d, %esi\n\tsetle\t%al\n\tmovl\t%eax, %ecx\n\ttestb\t%r10b, %r10b\n\tje\t.L45\n\ttestb\t%al, %al\n\tje\t.L45\n\tmovslq\t8(%rsp), %rax\n\tsalq\t$19, %rbp\n\taddq\t%rax, %rbp\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rax,%rbp,4), %eax\n\tcmpl\t%eax, %r13d\n\tcmovg\t%eax, %r13d\n\tjmp\t.L39\n\t.p2align 4,,10\n\t.p2align 3\n.L55:\n\tmovl\t$2147483647, %r13d\n\tjmp\t.L42\n\t.p2align 4,,10\n\t.p2align 3\n.L51:\n\tleal\t(%r15,%r14), %eax\n\tmovl\t%r15d, %r8d\n\tmovl\t%ebp, %edi\n\tmovb\t%r10b, 24(%rsp)\n\tsarl\t%eax\n\tmovl\t%esi, 16(%rsp)\n\tmovl\t%eax, %r11d\n\tleal\t(%rdx,%rdx), %eax\n\tmovl\t%r12d, %edx\n\tmovl\t%r11d, %r9d\n\tleal\t1(%rax), %ecx\n\tmovl\t%r11d, 20(%rsp)\n\tmovl\t%eax, 12(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %esi\n\tmovl\t20(%rsp), %r8d\n\tmovl\t%ebp, %edi\n\tmovl\t%eax, %r15d\n\tmovl\t12(%rsp), %eax\n\tmovl\t%r14d, %r9d\n\tmovl\t%r12d, %edx\n\tmovl\t%esi, 12(%rsp)\n\tleal\t2(%rax), %ecx\n\tcall\tgetMin\n\tmovl\t12(%rsp), %esi\n\tmovzbl\t24(%rsp), %r10d\n\tcmpl\t%eax, %r15d\n\tcmovg\t%eax, %r15d\n.L50:\n\tcmpl\t%r14d, %r12d\n\tjle\t.L52\n\tcmpl\t%r14d, %esi\n\tjg\t.L53\n\ttestb\t%r10b, %r10b\n\tje\t.L53\n\tmovslq\t8(%rsp), %rax\n\tsalq\t$19, %rbp\n\tleaq\tseg(%rip), %rdx\n\taddq\t%rbp, %rax\n\tmovl\t(%rdx,%rax,4), %eax\n\tcmpl\t%eax, %r15d\n\tcmovg\t%eax, %r15d\n\tjmp\t.L52\n\t.p2align 4,,10\n\t.p2align 3\n.L47:\n\tleal\t(%r8,%r14), %eax\n\tmovl\t%r12d, %edx\n\tmovl\t%ebp, %edi\n\tmovb\t%r10b, 31(%rsp)\n\tsarl\t%eax\n\tmovb\t%r11b, 30(%rsp)\n\tmovl\t%eax, %r13d\n\tleal\t(%rcx,%rcx), %eax\n\tmovl\t%esi, 24(%rsp)\n\tmovl\t%r13d, %r9d\n\tleal\t1(%rax), %ecx\n\tmovl\t%eax, 16(%rsp)\n\tcall\tgetMin\n\tmovl\t16(%rsp), %edx\n\tmovl\t24(%rsp), %esi\n\tmovl\t%r13d, %r8d\n\tmovl\t%ebp, %edi\n\tmovl\t%r14d, %r9d\n\tmovl\t%eax, 20(%rsp)\n\tleal\t2(%rdx), %ecx\n\tmovl\t%r12d, %edx\n\tmovl\t%esi, 16(%rsp)\n\tcall\tgetMin\n\tmovl\t20(%rsp), %edi\n\tmovl\t16(%rsp), %esi\n\tmovzbl\t30(%rsp), %r11d\n\tmovzbl\t31(%rsp), %r10d\n\tcmpl\t%eax, %edi\n\tmovl\t%edi, %r13d\n\tcmovg\t%eax, %r13d\n.L46:\n\tcmpl\t%r14d, %r12d\n\tjle\t.L42\n\tcmpl\t%r14d, %esi\n\tjg\t.L49\n\ttestb\t%r11b, %r11b\n\tje\t.L49\n\tmovslq\t12(%rsp), %rdx\n\tmovslq\t%ebp, %rax\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\tseg(%rip), %rdx\n\tmovl\t(%rdx,%rax,4), %eax\n\tcmpl\t%eax, %r13d\n\tcmovg\t%eax, %r13d\n\tjmp\t.L42\n\t.p2align 4,,10\n\t.p2align 3\n.L57:\n\tmovl\t$2147483647, %r15d\n\tjmp\t.L50\n\t.p2align 4,,10\n\t.p2align 3\n.L56:\n\tmovl\t$2147483647, %r13d\n\tjmp\t.L46\n\t.cfi_endproc\n.LFE55:\n\t.size\tgetMin, .-getMin\n\t.section\t.text.startup,\"ax\",@progbits\n\t.p2align 4\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB56:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r15\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\txorl\t%eax, %eax\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tleaq\tseg(%rip), %r12\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\txorl\t%ebx, %ebx\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 64\n\tcall\tin\n\tmovl\t%eax, %edi\n\tmovl\t%eax, %ebp\n\tcall\tsegInit\n\tmovq\tstdin(%rip), %rdi\n\ttestl\t%ebp, %ebp\n\tjle\t.L115\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\tcmpq\t%rcx, %rax\n\tjnb\t.L183\n\t.p2align 4,,10\n\t.p2align 3\n.L99:\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L100:\n\txorl\t%r13d, %r13d\n\tjmp\t.L104\n\t.p2align 4,,10\n\t.p2align 3\n.L101:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L103\n.L102:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L104:\n\tleal\t0(%r13,%r13,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r13d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L101\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tcmpl\t$47, %eax\n\tjg\t.L102\n\t.p2align 4,,10\n\t.p2align 3\n.L103:\n\tmovl\tsz(%rip), %eax\n\tleal\t-1(%rbx,%rax), %ecx\n\tmovslq\t%ecx, %rax\n\tmovl\t%r13d, (%r12,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L107\n\t.p2align 4,,10\n\t.p2align 3\n.L105:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\tmovl\t(%r12,%rax,4), %eax\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%r12,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%r12,%rsi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L105\n.L107:\n\tleal\t1(%rbx), %eax\n\tcmpl\t%eax, %ebp\n\tje\t.L184\n\tmovl\t%eax, %ebx\n\tmovq\t16(%rdi), %rcx\n\tmovq\t8(%rdi), %rax\n\tcmpq\t%rcx, %rax\n\tjb\t.L99\n.L183:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L100\n.L115:\n\txorl\t%eax, %eax\n\txorl\t%r12d, %r12d\n\tleaq\tseg(%rip), %rbx\n\tcall\tin\n\tmovl\t%eax, %ebp\n\ttestl\t%eax, %eax\n\tje\t.L174\n\t.p2align 4,,10\n\t.p2align 3\n.L151:\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rdx\n\tcmpq\t%rdx, %rax\n\tjnb\t.L185\n\tleaq\t1(%rax), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L118:\n\txorl\t%r14d, %r14d\n\tjmp\t.L122\n\t.p2align 4,,10\n\t.p2align 3\n.L119:\n\tleaq\t1(%rcx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L121\n.L120:\n\tmovq\t%rsi, %rcx\n.L122:\n\tleal\t(%r14,%r14,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r14d\n\tcmpq\t%rdx, %rcx\n\tjb\t.L119\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L120\n\t.p2align 4,,10\n\t.p2align 3\n.L121:\n\tcmpq\t%rsi, %rdx\n\tjbe\t.L186\n\tleaq\t1(%rsi), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L124:\n\txorl\t%r13d, %r13d\n\tjmp\t.L128\n\t.p2align 4,,10\n\t.p2align 3\n.L125:\n\tleaq\t1(%rcx), %rsi\n\tmovq\t%rsi, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L127\n.L126:\n\tmovq\t%rsi, %rcx\n.L128:\n\tleal\t0(%r13,%r13,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r13d\n\tcmpq\t%rdx, %rcx\n\tjb\t.L125\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rsi\n\tmovq\t16(%rdi), %rdx\n\tcmpl\t$47, %eax\n\tjg\t.L126\n\t.p2align 4,,10\n\t.p2align 3\n.L127:\n\tsubl\t$1, %r13d\n\tcmpq\t%rsi, %rdx\n\tjbe\t.L187\n\tleaq\t1(%rsi), %rcx\n\tmovq\t%rcx, 8(%rdi)\n\tmovzbl\t(%rsi), %eax\n.L130:\n\txorl\t%r15d, %r15d\n\tjmp\t.L134\n\t.p2align 4,,10\n\t.p2align 3\n.L131:\n\tleaq\t1(%rcx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rcx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L133\n.L132:\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n.L134:\n\tleal\t(%r15,%r15,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r15d\n\tcmpq\t%rdx, %rcx\n\tjb\t.L131\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L133\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L132\n\t.p2align 4,,10\n\t.p2align 3\n.L133:\n\tleal\t-1(%r14), %esi\n\tcmpl\t$1, %esi\n\tjbe\t.L188\n\tleal\t-3(%r14), %edi\n\tcmpl\t$1, %edi\n\tjbe\t.L189\n\tmovl\t%r14d, %ecx\n\tsubl\t$5, %ecx\n\tsete\t%r14b\n\tsete\t%r11b\n\tmovslq\t%ecx, %rcx\n\tmovzbl\t%r14b, %r14d\n\ttestl\t%r12d, %r12d\n\tjne\t.L190\n\tmovslq\tsz(%rip), %rdx\n\tmovzbl\t%r11b, %esi\n\tsalq\t$21, %rcx\n\tmovl\t$1, %r12d\n\tsalq\t$21, %rsi\n\tleaq\t(%rbx,%rcx), %rdi\n\tsalq\t$3, %rdx\n\tleaq\t(%rbx,%rsi), %rsi\n\tcall\tmemcpy@PLT\n.L137:\n\tsubl\t$1, %ebp\n\tjne\t.L151\n.L174:\n\taddq\t$8, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n\t.p2align 4,,10\n\t.p2align 3\n.L188:\n\t.cfi_restore_state\n\tmovl\tsz(%rip), %ecx\n\tmovslq\t%esi, %rsi\n\ttestl\t%r12d, %r12d\n\tjne\t.L175\n\tsubl\t$1, %ecx\n.L136:\n\taddl\t%r13d, %ecx\n\tsalq\t$19, %rsi\n\tmovslq\t%ecx, %rax\n\taddq\t%rsi, %rax\n\tmovl\t%r15d, (%rbx,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L138:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\taddq\t%rsi, %rax\n\tmovslq\t%ecx, %rdi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rbx,%rax,4), %eax\n\taddq\t%rsi, %rdi\n\taddq\t%rsi, %rdx\n\tmovl\t(%rbx,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%rbx,%rdi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L138\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L175:\n\tleaq\tlen(%rip), %rdi\n\tsubl\t$1, %ecx\n\tmovd\t%r13d, %xmm0\n\tmovslq\t(%rdi,%rsi,4), %rax\n\tleaq\tmemo(%rip), %r11\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, (%rdi,%rsi,4)\n\tleaq\t(%rax,%rax,2), %rdx\n\timulq\t$2400060, %rsi, %rax\n\tleaq\t(%rax,%rdx,4), %rdi\n\tleal\t(%rcx,%r13), %edx\n\tmovq\t%rsi, %rax\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rax\n\tmovl\t%r15d, 8(%r11,%rdi)\n\taddq\t%rdx, %rax\n\tmovl\t(%rbx,%rax,4), %eax\n\tmovd\t%eax, %xmm1\n\tpunpckldq\t%xmm1, %xmm0\n\tmovq\t%xmm0, (%r11,%rdi)\n\tjmp\t.L136\n\t.p2align 4,,10\n\t.p2align 3\n.L190:\n\tleaq\tlen(%rip), %rax\n\tmovslq\t(%rax,%rcx,4), %rax\n\tmovl\t%eax, %r10d\n\tsubl\t$1, %r10d\n\tjs\t.L146\n\timulq\t$2400060, %rcx, %rdx\n\tleaq\t(%rax,%rax,2), %rax\n\tmovl\tsz(%rip), %edi\n\tmovq\t%rcx, %r8\n\tsalq\t$19, %r8\n\tleal\t-1(%rdi), %r13d\n\tleaq\t(%rdx,%rax,4), %r9\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rax, %r9\n\t.p2align 4,,10\n\t.p2align 3\n.L145:\n\tmovl\t-12(%r9), %esi\n\tmovl\t-8(%r9), %edx\n\taddl\t%r13d, %esi\n\tmovslq\t%esi, %rax\n\taddq\t%r8, %rax\n\tmovl\t%edx, (%rbx,%rax,4)\n\ttestl\t%esi, %esi\n\tjle\t.L147\n\t.p2align 4,,10\n\t.p2align 3\n.L144:\n\tleal\t-1(%rsi), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %esi\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%esi\n\taddl\t$2, %edx\n\taddq\t%r8, %rax\n\tmovslq\t%esi, %rdi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rbx,%rax,4), %eax\n\taddq\t%r8, %rdi\n\taddq\t%r8, %rdx\n\tmovl\t(%rbx,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%rbx,%rdi,4)\n\ttestl\t%esi, %esi\n\tjne\t.L144\n.L147:\n\tsubl\t$1, %r10d\n\tsubq\t$12, %r9\n\tcmpl\t$-1, %r10d\n\tjne\t.L145\n.L146:\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rax,%r14,4), %esi\n\ttestl\t%esi, %esi\n\tjle\t.L143\n\tmovl\tsz(%rip), %eax\n\tleaq\tmemo(%rip), %rdi\n\tsalq\t$19, %rcx\n\tleaq\t12(%rdi), %rdx\n\tleal\t-1(%rax), %r9d\n\tmovzbl\t%r11b, %eax\n\timulq\t$2400060, %rax, %rax\n\tleaq\t(%rax,%rdi), %r8\n\taddq\t%rdx, %rax\n\tleal\t-1(%rsi), %edx\n\tleaq\t(%rdx,%rdx,2), %rdx\n\tleaq\t(%rax,%rdx,4), %r10\n\t.p2align 4,,10\n\t.p2align 3\n.L149:\n\tmovl\t(%r8), %esi\n\tmovl\t8(%r8), %edx\n\taddl\t%r9d, %esi\n\tmovslq\t%esi, %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, (%rbx,%rax,4)\n\ttestl\t%esi, %esi\n\tjle\t.L150\n\t.p2align 4,,10\n\t.p2align 3\n.L148:\n\tleal\t-1(%rsi), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %esi\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%esi\n\taddl\t$2, %edx\n\taddq\t%rcx, %rax\n\tmovslq\t%esi, %rdi\n\tmovslq\t%edx, %rdx\n\tmovl\t(%rbx,%rax,4), %eax\n\taddq\t%rcx, %rdi\n\taddq\t%rcx, %rdx\n\tmovl\t(%rbx,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, (%rbx,%rdi,4)\n\ttestl\t%esi, %esi\n\tjne\t.L148\n.L150:\n\taddq\t$12, %r8\n\tcmpq\t%r8, %r10\n\tjne\t.L149\n.L143:\n\tmovq\t$0, len(%rip)\n\tjmp\t.L137\n\t.p2align 4,,10\n\t.p2align 3\n.L189:\n\tmovl\tsz(%rip), %r9d\n\txorl\t%r8d, %r8d\n\txorl\t%ecx, %ecx\n\tmovl\t%r15d, %edx\n\tmovl\t%r13d, %esi\n\tcall\tgetMin\n\tmovl\t%eax, %edi\n\tcall\tout\n\tjmp\t.L137\n.L184:\n\tmovq\t8(%rdi), %rax\n\tmovq\t16(%rdi), %rcx\n\txorl\t%ebp, %ebp\n\tcmpq\t%rcx, %rax\n\tjnb\t.L191\n\t.p2align 4,,10\n\t.p2align 3\n.L108:\n\tleaq\t1(%rax), %rdx\n\tmovq\t%rdx, 8(%rdi)\n\tmovzbl\t(%rax), %eax\n.L109:\n\txorl\t%r13d, %r13d\n\tjmp\t.L113\n\t.p2align 4,,10\n\t.p2align 3\n.L110:\n\tleaq\t1(%rdx), %rax\n\tmovq\t%rax, 8(%rdi)\n\tmovzbl\t(%rdx), %eax\n\tcmpl\t$47, %eax\n\tjle\t.L112\n.L111:\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n.L113:\n\tleal\t0(%r13,%r13,4), %esi\n\tandl\t$15, %eax\n\tleal\t(%rax,%rsi,2), %r13d\n\tcmpq\t%rcx, %rdx\n\tjb\t.L110\n\tcall\t__uflow@PLT\n\tcmpl\t$47, %eax\n\tjle\t.L112\n\tmovq\tstdin(%rip), %rdi\n\tjmp\t.L111\n\t.p2align 4,,10\n\t.p2align 3\n.L112:\n\tmovl\tsz(%rip), %eax\n\tleal\t-1(%rbp,%rax), %ecx\n\tmovslq\t%ecx, %rax\n\tmovl\t%r13d, 2097152(%r12,%rax,4)\n\ttestl\t%ecx, %ecx\n\tjle\t.L116\n\t.p2align 4,,10\n\t.p2align 3\n.L114:\n\tleal\t-1(%rcx), %eax\n\tmovl\t%eax, %edx\n\tmovl\t%eax, %ecx\n\torl\t$1, %eax\n\tandl\t$-2, %edx\n\tcltq\n\tsarl\t%ecx\n\taddl\t$2, %edx\n\tmovl\t2097152(%r12,%rax,4), %eax\n\tmovslq\t%ecx, %rsi\n\tmovslq\t%edx, %rdx\n\tmovl\t2097152(%r12,%rdx,4), %edx\n\tcmpl\t%edx, %eax\n\tcmovg\t%edx, %eax\n\tmovl\t%eax, 2097152(%r12,%rsi,4)\n\ttestl\t%ecx, %ecx\n\tjne\t.L114\n.L116:\n\tleal\t1(%rbp), %eax\n\tcmpl\t%ebx, %ebp\n\tje\t.L115\n\tmovq\tstdin(%rip), %rdi\n\tmovl\t%eax, %ebp\n\tmovq\t16(%rdi), %rcx\n\tmovq\t8(%rdi), %rax\n\tcmpq\t%rcx, %rax\n\tjb\t.L108\n.L191:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rdx\n\tmovq\t16(%rdi), %rcx\n\tjmp\t.L109\n.L185:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L118\n.L187:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L130\n.L186:\n\tcall\t__uflow@PLT\n\tmovq\tstdin(%rip), %rdi\n\tmovq\t8(%rdi), %rcx\n\tmovq\t16(%rdi), %rdx\n\tjmp\t.L124\n\t.cfi_endproc\n.LFE56:\n\t.size\tmain, .-main\n\t.globl\tlen\n\t.bss\n\t.align 8\n\t.type\tlen, @object\n\t.size\tlen, 8\nlen:\n\t.zero\t8\n\t.globl\tmemo\n\t.align 32\n\t.type\tmemo, @object\n\t.size\tmemo, 4800120\nmemo:\n\t.zero\t4800120\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.globl\tseg\n\t.align 32\n\t.type\tseg, @object\n\t.size\tseg, 4194304\nseg:\n\t.zero\t4194304\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "// 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#define pc(c) putchar_unlocked(c)\n#else\n#define gc() getchar()\n#define pc(c) putchar(c)\n#endif\nint in()\n{\n\tint n = 0, c = gc();\n\tdo n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');\n\treturn n;\n}\n\nvoid out(int n)\n{\n\tint i;\n\tchar ob[30];\n\n\tif (!n) pc('0');\n\telse {\n\t\ti = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;\n\t\twhile (i--) pc(ob[i]);\n\t}\n\tpc('\\n');\n}\n\n\n//// セグメント木\nint seg[2][1 << 19]; int sz;\n\nvoid segInit(int n) {\n\tsz = 1; while (sz < n) sz <<= 1;\n\tmemset(seg, INF, sizeof(seg));\n}\n\n// k番目(0-index)の値を v に変更\nvoid update(int id, int k, int v)\n{\n\tint a, b;\n\n\tk += sz - 1;\n//\tif (seg[id][k] == v) return;\n\tseg[id][k] = v;\n\twhile (k > 0) {\n\t\tk = (k - 1) >> 1;\n\t\ta = seg[id][(k << 1) + 1];\n\t\tb = seg[id][(k << 1) + 2];\n\t\tseg[id][k] = (a <= b)? a: b;\n\t}\n}\n\n// 空間 [a, b) 内の最小値\nint getMin(int id, int a, int b, int k, int l, int r)\n{\n\tint left, right;\n\n\tif (r <= a || b <= l) return INF;\n\tif (a <= l && r <= b) return seg[id][k];\n\tleft = getMin(id, a, b, (k << 1) + 1, l, (l + r) >> 1);\n\tright = getMin(id, a, b, (k << 1) + 2, (l + r) >> 1, r);\n\treturn left <= right ? left : right;\n}\n\n\n//// 本問題\ntypedef struct { int y, p, n; } T; // 位置と更新前後の値\nT memo[2][200005]; int len[2];\n\nint main()\n{\n\tint i, k, N, Q, x, y, z;\n\tint syn;\n\n\tN = in();\n\tsegInit(N); // セグメント木の初期化\n\tfor (i = 0; i < N; i++) update(0, i, in());\n\tfor (i = 0; i < N; i++) update(1, i, in());\n\n\tQ = in(), syn = 0;\n\twhile (Q--) {\n\t\tx = in(), y = in()-1, z = in(); // 0-index\n\t\tif (x == 1 || x == 2) {\n\t\t\tx--; // 0と1にする. 0->A, 1->B\n\t\t\tif (syn) {\n\t\t\t\t// 位置と更新前後の値を記録\n\t\t\t\tk = len[x]++;\n\t\t\t\tmemo[x][k].y = y, memo[x][k].n = z;\n\t\t\t\tmemo[x][k].p = seg[x][y+(sz-1)]; // 元の値は y+(sz-1) の位置にある\n\t\t\t}\n\t\t\tupdate(x, y, z);\n\t\t}\n\t\telse if (x == 3 || x == 4) out(getMin(x-3, y, z, 0, 0, sz));\n\t\telse {\n\t\t\tx -= 5; // 0と1にする. 0->A, 1->B\n\t\t\tif (syn) {\n\t\t\t\t// 元に戻して、相手のしてきた変更を施し、相手と同じにする\n\t\t\t\tfor (i = len[x] - 1; i >= 0; i--) // 戻す作業\n\t\t\t\t\tupdate(x, memo[x][i].y, memo[x][i].p);\n\t\t\t\tfor (i = 0; i < len[!x]; i++) // 相手に同期\n\t\t\t\t\tupdate(x, memo[!x][i].y, memo[!x][i].n);\n\t\t\t\tlen[0] = len[1] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmemcpy(seg[x], seg[!x], sizeof(int)*sz*2);\n\t\t\t\tsyn = 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n", "index": 109, "inputs": [ "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 16\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 4 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n2 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n6\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 0 9\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 1\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n2 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 0 2 6\n6\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n2 3 5 7 11\n6 2 3 2 0\n10\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 1\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n2 2 5\n5 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 0 2 6\n6\n1 3 6\n3 4 5\n3 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n6\n1 3 6\n3 3 5\n4 2 3\n5 -1 -1\n2 3 2\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 7\n", "5\n2 3 5 7 11\n6 2 3 2 0\n3\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 4 5 7 9\n12 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 0\n2 3 16\n3 2 5\n1 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n4 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 14 9\n6 2 0 2 6\n6\n1 3 6\n3 4 5\n3 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n0 3 5 7 9\n0 2 3 2 6\n10\n1 0 4\n3 4 5\n4 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n0 3 5 7 9\n0 2 3 2 6\n10\n1 1 4\n2 4 5\n4 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n1 3 5 7 9\n8 2 3 2 4\n6\n1 3 11\n3 3 5\n4 2 4\n5 -1 -1\n2 3 0\n2 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 0\n", "5\n0 3 5 7 9\n0 2 3 2 6\n10\n1 1 4\n2 4 5\n4 2 5\n5 -1 -1\n2 3 16\n1 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 2 5\n", "5\n2 0 5 7 11\n6 2 1 2 0\n3\n1 5 6\n3 4 5\n4 2 3\n9 -1 -1\n2 3 8\n6 2 2\n4 3 2\n2 0 1\n6 -1 0\n3 1 1\n", "5\n1 3 5 7 0\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 1 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 16\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 2 2 6\n10\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n2 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 0 9\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 3 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n6 2 4 2 6\n10\n1 3 3\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 1\n10\n1 3 4\n3 5 5\n4 2 3\n5 -1 -1\n2 3 8\n2 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n1 0 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 4 5 7 9\n12 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 0\n2 3 16\n3 2 5\n1 3 3\n1 1 0\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 1\n1 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n4 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n2 0 5 7 11\n6 4 3 2 0\n3\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 2 0\n6 2 3 2 6\n10\n1 3 1\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n4 3 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n0 3 5 7 9\n0 2 3 0 6\n10\n1 1 4\n3 4 5\n4 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n1 3 5 2 1\n6 2 3 2 6\n4\n1 3 1\n3 4 5\n4 2 3\n5 -2 -1\n1 3 8\n4 3 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n0 3 5 7 9\n0 2 3 2 6\n10\n1 1 4\n2 4 0\n4 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 2 5\n", "5\n1 3 5 7 9\n8 2 3 2 4\n6\n1 3 11\n3 2 5\n4 2 4\n5 -1 -1\n2 3 0\n2 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 0\n", "5\n2 3 5 7 11\n6 2 3 2 0\n10\n1 5 6\n3 4 4\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 1\n3 1 5\n", "5\n1 3 5 7 9\n6 3 4 2 1\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 3\n2 2 5\n5 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 14 9\n6 2 0 2 6\n6\n1 3 6\n1 4 5\n3 2 3\n5 -1 -1\n2 5 8\n3 0 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 0\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 4 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n12 2 3 2 6\n10\n1 3 4\n3 4 5\n4 1 3\n5 -1 -1\n2 3 16\n3 2 5\n4 3 3\n1 1 2\n6 -2 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 0 2 6\n6\n1 3 6\n3 4 5\n3 2 3\n5 -1 -1\n2 3 1\n3 4 5\n4 5 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n2 3 5 7 1\n1 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n4 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 6 4 2 1\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 3\n2 2 5\n5 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 2 0\n6 2 3 2 6\n10\n1 3 1\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n4 3 5\n4 3 3\n2 1 1\n6 -1 0\n5 1 5\n", "5\n1 3 5 14 9\n7 2 0 2 6\n4\n1 3 6\n3 4 5\n3 2 3\n5 -1 -1\n2 6 8\n3 0 5\n7 3 3\n2 1 1\n6 -1 -1\n3 1 6\n", "5\n1 3 5 7 9\n8 2 3 2 4\n6\n1 3 6\n2 3 5\n2 2 4\n5 -1 -1\n2 3 0\n3 2 5\n4 3 3\n3 1 1\n6 -1 -1\n3 1 7\n", "5\n0 3 5 7 9\n0 2 3 0 8\n10\n1 1 4\n3 4 5\n1 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n0 3 7 7 7\n0 0 3 2 6\n10\n1 1 4\n2 4 5\n4 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n1 3 5 7 9\n8 2 3 2 4\n6\n1 3 11\n3 2 5\n4 2 4\n5 -1 -1\n2 3 0\n3 2 5\n8 3 3\n2 1 1\n6 -1 -1\n3 1 0\n", "5\n2 0 5 7 11\n6 2 1 4 0\n3\n1 5 6\n3 4 5\n4 2 6\n9 -1 -1\n2 3 8\n6 2 2\n4 3 2\n3 0 1\n6 -1 1\n3 1 1\n", "5\n1 3 5 7 0\n6 2 3 2 6\n10\n1 5 4\n3 4 5\n4 2 3\n5 -1 -1\n2 4 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n6 2 4 2 6\n10\n1 1 8\n3 4 5\n4 2 3\n5 -1 -1\n2 3 13\n6 2 5\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n2 3 5 7 11\n6 2 4 2 0\n10\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n7 5 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n2 0 5 4 11\n10 2 3 3 0\n3\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 2\n4 3 3\n2 0 1\n6 -1 0\n3 1 1\n", "5\n0 3 5 7 9\n0 2 3 0 8\n10\n1 1 4\n3 4 5\n1 2 5\n5 -1 -1\n2 2 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n0 3 7 7 7\n0 -1 3 2 6\n10\n1 1 4\n2 4 5\n4 2 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n6 1 5\n", "5\n1 3 5 2 1\n6 2 3 2 8\n10\n1 3 1\n3 4 5\n4 2 3\n5 0 -1\n1 3 11\n4 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 1\n", "5\n1 1 5 7 9\n8 2 3 2 4\n6\n1 3 11\n3 2 5\n4 2 4\n5 -1 -1\n2 3 0\n3 2 5\n8 3 3\n2 1 1\n6 -1 -1\n3 1 0\n", "5\n1 0 5 7 9\n6 2 3 4 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 3\n6 2 5\n4 3 3\n2 1 1\n6 -1 -1\n6 1 4\n", "5\n1 3 5 6 9\n6 2 3 0 6\n3\n1 3 6\n4 4 5\n4 2 3\n5 -1 -1\n2 3 1\n3 2 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 7 7 1\n6 2 2 2 6\n10\n2 4 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 0 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 0 1 6\n7\n1 3 6\n3 4 5\n4 2 3\n5 -1 -2\n2 3 8\n3 2 5\n4 3 3\n2 2 1\n6 -2 -1\n3 1 5\n", "5\n1 3 5 24 9\n6 2 0 2 6\n6\n1 3 6\n1 4 5\n3 1 3\n5 -1 -1\n2 5 8\n3 1 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n2 3 5 7 9\n6 2 7 2 1\n10\n1 5 4\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n2 3 5\n5 3 1\n2 1 1\n6 -1 -2\n3 1 5\n", "5\n1 3 5 2 0\n6 2 3 2 6\n10\n1 3 1\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n4 3 5\n4 1 3\n2 2 1\n6 -1 0\n5 1 5\n", "5\n0 3 5 7 9\n0 2 3 2 6\n10\n1 1 5\n2 5 5\n4 2 5\n1 -1 -1\n2 2 16\n1 2 5\n4 2 3\n1 2 1\n6 -1 -1\n6 2 5\n", "5\n1 3 5 7 9\n6 2 4 3 6\n10\n2 3 3\n3 4 5\n4 2 3\n5 -1 -2\n2 3 8\n6 0 5\n4 3 3\n1 1 1\n6 -1 -2\n3 1 5\n", "5\n1 3 5 7 9\n6 2 0 2 6\n2\n1 3 6\n3 4 5\n3 2 3\n5 -1 -1\n2 3 1\n3 4 5\n8 5 5\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n2 6 5 7 9\n8 2 3 2 4\n6\n1 0 6\n3 3 4\n4 2 4\n5 -1 -1\n2 6 0\n3 4 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 0\n", "5\n2 0 5 7 11\n6 2 1 4 0\n3\n1 5 5\n3 4 5\n4 2 6\n9 -1 -1\n1 3 8\n6 2 2\n4 0 2\n3 0 1\n6 -1 1\n3 1 1\n", "5\n1 3 7 7 1\n6 2 2 2 2\n10\n2 4 6\n4 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 0 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n2 3 5 7 9\n6 2 7 2 1\n3\n1 5 4\n3 4 5\n5 2 3\n5 -1 -1\n1 3 8\n2 3 5\n5 3 1\n2 1 1\n6 -1 -2\n3 2 5\n", "5\n2 0 5 6 11\n6 0 3 2 1\n3\n1 5 6\n2 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 1 2\n4 3 1\n2 0 0\n6 -2 0\n3 1 5\n", "5\n1 4 5 2 1\n6 2 3 0 6\n10\n1 3 0\n3 4 5\n4 2 3\n5 -1 -1\n1 4 8\n4 3 5\n4 1 3\n2 2 1\n6 -1 0\n5 1 5\n", "5\n2 0 5 7 11\n6 2 1 4 0\n3\n1 5 5\n3 5 5\n6 3 6\n9 -1 -1\n1 3 8\n6 2 2\n4 0 0\n3 -1 1\n6 -1 1\n3 1 1\n", "5\n1 4 5 7 9\n6 2 4 3 2\n10\n2 3 3\n3 4 4\n3 2 3\n5 -1 -2\n2 0 8\n6 0 5\n4 3 3\n1 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 10 9\n9 2 8 1 1\n10\n1 3 4\n3 4 5\n4 2 3\n5 1 -2\n2 3 8\n2 3 5\n5 4 0\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 0 9\n9 2 8 1 1\n10\n1 5 4\n3 4 5\n4 2 3\n5 1 -2\n2 3 8\n2 3 5\n5 4 0\n2 1 1\n6 -2 -1\n3 1 5\n", "5\n1 4 5 7 1\n8 2 4 3 2\n10\n2 1 3\n3 4 4\n3 2 3\n5 -1 -3\n2 0 8\n6 0 5\n4 3 3\n1 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 1\n8 2 4 3 2\n10\n2 1 3\n3 4 4\n3 2 3\n5 -1 -3\n2 0 8\n6 0 5\n4 3 3\n1 1 1\n6 -1 0\n3 1 5\n", "5\n1 0 5 7 9\n6 1 0 1 6\n2\n1 2 6\n3 5 5\n3 2 3\n5 -1 -1\n2 6 1\n3 3 9\n8 5 5\n2 1 1\n7 -2 -1\n3 2 5\n", "5\n2 -1 0 13 22\n10 3 1 1 0\n3\n1 2 6\n3 5 5\n4 2 3\n9 -1 -1\n2 -1 8\n6 2 0\n2 3 1\n2 0 3\n6 -1 1\n3 1 1\n", "5\n2 -1 0 13 22\n10 3 1 1 -1\n3\n1 2 6\n2 5 5\n4 2 3\n9 -1 -1\n2 -1 7\n6 2 0\n2 3 1\n2 0 3\n6 -1 1\n3 1 1\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 6 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 3 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n6 2 4 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n2 -1 -1\n2 3 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n2 3 5 7 11\n6 2 3 2 6\n10\n1 5 6\n4 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n2 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 0 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n2 3 5 7 11\n6 2 3 2 0\n10\n1 5 6\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n6 2 1\n4 3 3\n3 1 1\n6 -1 0\n3 1 5\n", "5\n1 3 5 7 1\n6 2 3 2 6\n10\n1 3 6\n3 4 5\n4 2 3\n5 -1 -1\n1 3 8\n4 2 5\n4 1 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n0 3 5 7 9\n0 2 3 2 6\n10\n1 0 4\n3 4 5\n4 0 5\n5 -1 -1\n2 3 16\n3 2 5\n4 2 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 2 1\n6 2 3 2 6\n10\n1 3 1\n3 4 5\n4 2 3\n5 -1 -1\n1 3 0\n4 3 5\n4 3 3\n2 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n", "5\n1 3 5 7 9\n6 2 3 2 6\n10\n1 3 4\n3 4 5\n4 2 3\n5 -1 -1\n2 3 8\n3 2 5\n4 3 3\n1 1 1\n6 -1 -1\n3 1 5\n" ], "outputs": [ "7\n2\n2\n8\n2\n", "7\n2\n2\n16\n1\n", "7\n2\n3\n2\n", "7\n2\n2\n8\n1\n", "7\n2\n8\n2\n", "7\n2\n2\n", "6\n2\n3\n2\n", "7\n2\n2\n2\n1\n", "1\n2\n3\n2\n", "0\n2\n3\n2\n", "7\n2\n8\n1\n", "7\n0\n0\n", "6\n2\n3\n0\n", "1\n2\n8\n2\n", "7\n2\n1\n", "7\n3\n0\n", "6\n2\n2\n", "6\n2\n", "7\n2\n2\n1\n", "1\n2\n2\n3\n2\n", "9\n3\n0\n", "7\n2\n2\n2\n", "2\n2\n2\n", "7\n2\n", "2\n2\n", "6\n1\n", "0\n2\n2\n8\n1\n", "7\n2\n1\n16\n1\n", "6\n2\n2\n2\n", "1\n2\n6\n2\n", "0\n3\n3\n2\n", "7\n2\n4\n1\n", "9\n2\n8\n1\n", "1\n2\n2\n2\n1\n", "7\n2\n2\n0\n", "1\n2\n2\n3\n1\n", "6\n3\n", "0\n2\n2\n3\n2\n", "7\n0\n0\n2\n", "1\n2\n", "0\n0\n2\n", "3\n2\n", "7\n2\n3\n0\n", "7\n3\n1\n", "3\n0\n", "0\n2\n2\n3\n1\n", "7\n2\n2\n16\n2\n", "7\n3\n2\n", "1\n2\n2\n8\n1\n", "7\n4\n1\n", "0\n2\n2\n3\n", "9\n3\n", "2\n", "7\n0\n2\n", "0\n0\n0\n", "3\n2\n2\n", "6\n/\n", "4\n2\n2\n3\n1\n", "7\n2\n4\n2\n", "6\n2\n0\n", "4\n2\n", "7\n0\n3\n", "3\n3\n16\n", "1\n2\n2\n3\n6\n", "1\n2\n2\n", "7\n2\n3\n", "0\n2\n", "1\n2\n2\n2\n", "7\n0\n0\n8\n", "1\n0\n", "4\n2\n1\n", "0\n2\n2\n2\n", "2\n3\n", "7\n2\n3\n1\n", "7\n", "5\n2\n2\n", "5\n/\n", "2\n2\n2\n2\n", "4\n", "0\n", "1\n2\n0\n2\n", "5\n", "7\n4\n3\n1\n", "9\n2\n1\n", "0\n2\n1\n", "7\n4\n4\n1\n", "7\n3\n4\n1\n", "9\n", "22\n1\n", "1\n", "7\n2\n2\n3\n1\n", "7\n3\n3\n2\n", "7\n2\n3\n8\n1\n", "2\n2\n3\n2\n", "7\n2\n0\n2\n0\n", "1\n2\n3\n1\n", "6\n2\n3\n6\n0\n", "1\n2\n2\n2\n2\n", "7\n0\n2\n2\n1\n", "1\n2\n2\n3\n0\n", "7\n2\n2\n8\n1\n", "7\n2\n2\n8\n1\n" ], "question": "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#define pc(c) putchar_unlocked(c)\n#else\n#define gc() getchar()\n#define pc(c) putchar(c)\n#endif\nint in()\n{\n\tint n = 0, c = gc();\n\tdo n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');\n\treturn n;\n}\n\nvoid out(int n)\n{\n\tint i;\n\tchar ob[30];\n\n\tif (!n) pc('0');\n\telse {\n\t\ti = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;\n\t\twhile (i--) pc(ob[i]);\n\t}\n\tpc('\\n');\n}\n\n\n//// セグメント木\nint seg[2][1 << 19]; int sz;\n\nvoid segInit(int n) {\n\tsz = 1; while (sz < n) sz <<= 1;\n\tmemset(seg, INF, sizeof(seg));\n}\n\n// k番目(0-index)の値を v に変更\nvoid update(int id, int k, int v)\n{\n\tint a, b;\n\n\tk += sz - 1;\n//\tif (seg[id][k] == v) return;\n\tseg[id][k] = v;\n\twhile (k > 0) {\n\t\tk = (k - 1) >> 1;\n\t\ta = seg[id][(k << 1) + 1];\n\t\tb = seg[id][(k << 1) + 2];\n\t\tseg[id][k] = (a <= b)? a: b;\n\t}\n}\n\n// 空間 [a, b) 内の最小値\nint getMin(int id, int a, int b, int k, int l, int r)\n{\n\tint left, right;\n\n\tif (r <= a || b <= l) return INF;\n\tif (a <= l && r <= b) return seg[id][k];\n\tleft = getMin(id, a, b, (k << 1) + 1, l, (l + r) >> 1);\n\tright = getMin(id, a, b, (k << 1) + 2, (l + r) >> 1, r);\n\treturn left <= right ? left : right;\n}\n\n\n//// 本問題\ntypedef struct { int y, p, n; } T; // 位置と更新前後の値\nT memo[2][200005]; int len[2];\n\nint main()\n{\n\tint i, k, N, Q, x, y, z;\n\tint syn;\n\n\tN = in();\n\tsegInit(N); // セグメント木の初期化\n\tfor (i = 0; i < N; i++) update(0, i, in());\n\tfor (i = 0; i < N; i++) update(1, i, in());\n\n\tQ = in(), syn = 0;\n\twhile (Q--) {\n\t\tx = in(), y = in()-1, z = in(); // 0-index\n\t\tif (x == 1 || x == 2) {\n\t\t\tx--; // 0と1にする. 0->A, 1->B\n\t\t\tif (syn) {\n\t\t\t\t// 位置と更新前後の値を記録\n\t\t\t\tk = len[x]++;\n\t\t\t\tmemo[x][k].y = y, memo[x][k].n = z;\n\t\t\t\tmemo[x][k].p = seg[x][y+(sz-1)]; // 元の値は y+(sz-1) の位置にある\n\t\t\t}\n\t\t\tupdate(x, y, z);\n\t\t}\n\t\telse if (x == 3 || x == 4) out(getMin(x-3, y, z, 0, 0, sz));\n\t\telse {\n\t\t\tx -= 5; // 0と1にする. 0->A, 1->B\n\t\t\tif (syn) {\n\t\t\t\t// 元に戻して、相手のしてきた変更を施し、相手と同じにする\n\t\t\t\tfor (i = len[x] - 1; i >= 0; i--) // 戻す作業\n\t\t\t\t\tupdate(x, memo[x][i].y, memo[x][i].p);\n\t\t\t\tfor (i = 0; i < len[!x]; i++) // 相手に同期\n\t\t\t\t\tupdate(x, memo[!x][i].y, memo[!x][i].n);\n\t\t\t\tlen[0] = len[1] = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmemcpy(seg[x], seg[!x], sizeof(int)*sz*2);\n\t\t\t\tsyn = 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\tin\n\t.type\tin, @function\nin:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t$0, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n.L2:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t%edx, %eax\n\tsall\t$2, %eax\n\taddl\t%edx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, %edx\n\tmovl\t-4(%rbp), %eax\n\tandl\t$15, %eax\n\taddl\t%edx, %eax\n\tmovl\t%eax, -8(%rbp)\n\tcall\tgetchar_unlocked@PLT\n\tmovl\t%eax, -4(%rbp)\n\tcmpl\t$47, -4(%rbp)\n\tjg\t.L2\n\tmovl\t-8(%rbp), %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tin, .-in\n\t.globl\tout\n\t.type\tout, @function\nout:\n.LFB7:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$80, %rsp\n\tmovl\t%edi, -68(%rbp)\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L5\n\tmovl\t$48, %edi\n\tcall\tputchar_unlocked@PLT\n\tjmp\t.L6\n.L5:\n\tmovl\t$0, -52(%rbp)\n\tjmp\t.L7\n.L8:\n\tmovl\t-68(%rbp), %edx\n\tmovslq\t%edx, %rax\n\timulq\t$1717986919, %rax, %rax\n\tshrq\t$32, %rax\n\tsarl\t$2, %eax\n\tmovl\t%edx, %esi\n\tsarl\t$31, %esi\n\tsubl\t%esi, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tsall\t$2, %eax\n\taddl\t%ecx, %eax\n\taddl\t%eax, %eax\n\tmovl\t%edx, %ecx\n\tsubl\t%eax, %ecx\n\tmovl\t%ecx, %eax\n\tleal\t48(%rax), %ecx\n\tmovl\t-52(%rbp), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\tmovl\t%ecx, %edx\n\tcltq\n\tmovb\t%dl, -48(%rbp,%rax)\n\tmovl\t-68(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\timulq\t$1717986919, %rdx, %rdx\n\tshrq\t$32, %rdx\n\tsarl\t$2, %edx\n\tsarl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tmovl\t%edx, %eax\n\tsubl\t%ecx, %eax\n\tmovl\t%eax, -68(%rbp)\n.L7:\n\tcmpl\t$0, -68(%rbp)\n\tjne\t.L8\n\tjmp\t.L9\n.L10:\n\tmovl\t-52(%rbp), %eax\n\tcltq\n\tmovzbl\t-48(%rbp,%rax), %eax\n\tmovsbl\t%al, %eax\n\tmovl\t%eax, %edi\n\tcall\tputchar_unlocked@PLT\n.L9:\n\tmovl\t-52(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -52(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L10\n.L6:\n\tmovl\t$10, %edi\n\tcall\tputchar_unlocked@PLT\n\tnop\n\tmovq\t-8(%rbp), %rax\n\tsubq\t%fs:40, %rax\n\tje\t.L11\n\tcall\t__stack_chk_fail@PLT\n.L11:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE7:\n\t.size\tout, .-out\n\t.globl\tseg\n\t.bss\n\t.align 32\n\t.type\tseg, @object\n\t.size\tseg, 4194304\nseg:\n\t.zero\t4194304\n\t.globl\tsz\n\t.align 4\n\t.type\tsz, @object\n\t.size\tsz, 4\nsz:\n\t.zero\t4\n\t.text\n\t.globl\tsegInit\n\t.type\tsegInit, @function\nsegInit:\n.LFB8:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$16, %rsp\n\tmovl\t%edi, -4(%rbp)\n\tmovl\t$1, sz(%rip)\n\tjmp\t.L13\n.L14:\n\tmovl\tsz(%rip), %eax\n\taddl\t%eax, %eax\n\tmovl\t%eax, sz(%rip)\n.L13:\n\tmovl\tsz(%rip), %eax\n\tcmpl\t%eax, -4(%rbp)\n\tjg\t.L14\n\tmovl\t$4194304, %edx\n\tmovl\t$2147483647, %esi\n\tleaq\tseg(%rip), %rax\n\tmovq\t%rax, %rdi\n\tcall\tmemset@PLT\n\tnop\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE8:\n\t.size\tsegInit, .-segInit\n\t.globl\tupdate\n\t.type\tupdate, @function\nupdate:\n.LFB9:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovl\tsz(%rip), %eax\n\tsubl\t$1, %eax\n\taddl\t%eax, -24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rcx\n\tleaq\tseg(%rip), %rdx\n\tmovl\t-28(%rbp), %eax\n\tmovl\t%eax, (%rcx,%rdx)\n\tjmp\t.L16\n.L17:\n\tmovl\t-24(%rbp), %eax\n\tsubl\t$1, %eax\n\tsarl\t%eax\n\tmovl\t%eax, -24(%rbp)\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t$1, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-24(%rbp), %eax\n\taddl\t%eax, %eax\n\taddl\t$2, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n\tmovl\t-24(%rbp), %edx\n\tmovslq\t%edx, %rcx\n\tmovl\t-20(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tsalq\t$19, %rdx\n\taddq\t%rcx, %rdx\n\tleaq\t0(,%rdx,4), %rcx\n\tleaq\tseg(%rip), %rdx\n\tmovl\t%eax, (%rcx,%rdx)\n.L16:\n\tcmpl\t$0, -24(%rbp)\n\tjg\t.L17\n\tnop\n\tnop\n\tpopq\t%rbp\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE9:\n\t.size\tupdate, .-update\n\t.globl\tgetMin\n\t.type\tgetMin, @function\ngetMin:\n.LFB10:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tmovl\t%ecx, -32(%rbp)\n\tmovl\t%r8d, -36(%rbp)\n\tmovl\t%r9d, -40(%rbp)\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t-24(%rbp), %eax\n\tjle\t.L19\n\tmovl\t-28(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjg\t.L20\n.L19:\n\tmovl\t$2147483647, %eax\n\tjmp\t.L21\n.L20:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t-36(%rbp), %eax\n\tjg\t.L22\n\tmovl\t-40(%rbp), %eax\n\tcmpl\t-28(%rbp), %eax\n\tjg\t.L22\n\tmovl\t-32(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-20(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tjmp\t.L21\n.L22:\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %r8d\n\tmovl\t-32(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t1(%rax), %ecx\n\tmovl\t-36(%rbp), %edi\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-24(%rbp), %esi\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%r8d, %r9d\n\tmovl\t%edi, %r8d\n\tmovl\t%eax, %edi\n\tcall\tgetMin\n\tmovl\t%eax, -8(%rbp)\n\tmovl\t-36(%rbp), %edx\n\tmovl\t-40(%rbp), %eax\n\taddl\t%edx, %eax\n\tsarl\t%eax\n\tmovl\t%eax, %r8d\n\tmovl\t-32(%rbp), %eax\n\taddl\t%eax, %eax\n\tleal\t2(%rax), %ecx\n\tmovl\t-40(%rbp), %edi\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-24(%rbp), %esi\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%edi, %r9d\n\tmovl\t%eax, %edi\n\tcall\tgetMin\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-4(%rbp), %eax\n\tcmpl\t%eax, %edx\n\tcmovle\t%edx, %eax\n.L21:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE10:\n\t.size\tgetMin, .-getMin\n\t.globl\tmemo\n\t.bss\n\t.align 32\n\t.type\tmemo, @object\n\t.size\tmemo, 4800120\nmemo:\n\t.zero\t4800120\n\t.globl\tlen\n\t.align 8\n\t.type\tlen, @object\n\t.size\tlen, 8\nlen:\n\t.zero\t8\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB11:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -20(%rbp)\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%eax, %edi\n\tcall\tsegInit\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L24\n.L25:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, %edx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t$0, %edi\n\tcall\tupdate\n\taddl\t$1, -32(%rbp)\n.L24:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L25\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L26\n.L27:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, %edx\n\tmovl\t-32(%rbp), %eax\n\tmovl\t%eax, %esi\n\tmovl\t$1, %edi\n\tcall\tupdate\n\taddl\t$1, -32(%rbp)\n.L26:\n\tmovl\t-32(%rbp), %eax\n\tcmpl\t-20(%rbp), %eax\n\tjl\t.L27\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -28(%rbp)\n\tmovl\t$0, -24(%rbp)\n\tjmp\t.L28\n.L39:\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -16(%rbp)\n\tmovl\t$0, %eax\n\tcall\tin\n\tsubl\t$1, %eax\n\tmovl\t%eax, -12(%rbp)\n\tmovl\t$0, %eax\n\tcall\tin\n\tmovl\t%eax, -8(%rbp)\n\tcmpl\t$1, -16(%rbp)\n\tje\t.L29\n\tcmpl\t$2, -16(%rbp)\n\tjne\t.L30\n.L29:\n\tsubl\t$1, -16(%rbp)\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L31\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tleal\t1(%rax), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tleaq\t0(,%rcx,4), %rsi\n\tleaq\tlen(%rip), %rcx\n\tmovl\t%edx, (%rsi,%rcx)\n\tmovl\t%eax, -4(%rbp)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\t8+memo(%rip), %rax\n\taddq\t%rax, %rdx\n\tmovl\t-8(%rbp), %eax\n\tmovl\t%eax, (%rdx)\n\tmovl\tsz(%rip), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t-12(%rbp), %eax\n\taddl\t%edx, %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$19, %rax\n\taddq\t%rdx, %rax\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tseg(%rip), %rax\n\tmovl\t(%rdx,%rax), %edx\n\tmovl\t-4(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rsi, %rcx\n\taddq\t%rax, %rcx\n\tleaq\t4+memo(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovl\t%edx, (%rax)\n.L31:\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-12(%rbp), %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tupdate\n\tjmp\t.L28\n.L30:\n\tcmpl\t$3, -16(%rbp)\n\tje\t.L32\n\tcmpl\t$4, -16(%rbp)\n\tjne\t.L33\n.L32:\n\tmovl\tsz(%rip), %ecx\n\tmovl\t-16(%rbp), %eax\n\tleal\t-3(%rax), %edi\n\tmovl\t-8(%rbp), %edx\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%ecx, %r9d\n\tmovl\t$0, %r8d\n\tmovl\t$0, %ecx\n\tmovl\t%eax, %esi\n\tcall\tgetMin\n\tmovl\t%eax, %edi\n\tcall\tout\n\tjmp\t.L28\n.L33:\n\tsubl\t$5, -16(%rbp)\n\tcmpl\t$0, -24(%rbp)\n\tje\t.L34\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -32(%rbp)\n\tjmp\t.L35\n.L36:\n\tmovl\t-32(%rbp), %eax\n\tmovslq\t%eax, %rdx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\t4+memo(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tmovl\t-32(%rbp), %eax\n\tmovslq\t%eax, %rcx\n\tmovl\t-16(%rbp), %eax\n\tmovslq\t%eax, %rsi\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rsi, %rcx\n\taddq\t%rax, %rcx\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tupdate\n\tsubl\t$1, -32(%rbp)\n.L35:\n\tcmpl\t$0, -32(%rbp)\n\tjns\t.L36\n\tmovl\t$0, -32(%rbp)\n\tjmp\t.L37\n.L38:\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t-32(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovslq\t%eax, %rcx\n\tmovq\t%rdx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rdx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rcx, %rdx\n\taddq\t%rax, %rdx\n\tleaq\t8+memo(%rip), %rax\n\taddq\t%rdx, %rax\n\tmovl\t(%rax), %edx\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tmovl\t-32(%rbp), %ecx\n\tmovslq\t%ecx, %rcx\n\tmovslq\t%eax, %rsi\n\tmovq\t%rcx, %rax\n\taddq\t%rax, %rax\n\taddq\t%rcx, %rax\n\tsalq\t$2, %rax\n\timulq\t$2400060, %rsi, %rcx\n\taddq\t%rax, %rcx\n\tleaq\tmemo(%rip), %rax\n\taddq\t%rcx, %rax\n\tmovl\t(%rax), %ecx\n\tmovl\t-16(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\tupdate\n\taddl\t$1, -32(%rbp)\n.L37:\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tcltq\n\tleaq\t0(,%rax,4), %rdx\n\tleaq\tlen(%rip), %rax\n\tmovl\t(%rdx,%rax), %eax\n\tcmpl\t%eax, -32(%rbp)\n\tjl\t.L38\n\tmovl\t$0, 4+len(%rip)\n\tmovl\t4+len(%rip), %eax\n\tmovl\t%eax, len(%rip)\n\tjmp\t.L28\n.L34:\n\tmovl\tsz(%rip), %eax\n\tcltq\n\tleaq\t0(,%rax,8), %rdx\n\tcmpl\t$0, -16(%rbp)\n\tsete\t%al\n\tmovzbl\t%al, %eax\n\tcltq\n\tsalq\t$21, %rax\n\tmovq\t%rax, %rcx\n\tleaq\tseg(%rip), %rax\n\taddq\t%rax, %rcx\n\tmovl\t-16(%rbp), %eax\n\tcltq\n\tsalq\t$21, %rax\n\tmovq\t%rax, %rsi\n\tleaq\tseg(%rip), %rax\n\taddq\t%rsi, %rax\n\tmovq\t%rcx, %rsi\n\tmovq\t%rax, %rdi\n\tcall\tmemcpy@PLT\n\tmovl\t$1, -24(%rbp)\n.L28:\n\tmovl\t-28(%rbp), %eax\n\tleal\t-1(%rax), %edx\n\tmovl\t%edx, -28(%rbp)\n\ttestl\t%eax, %eax\n\tjne\t.L39\n\tmovl\t$0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE11:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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) #else #define gc() getchar() #define pc(c) putchar(c) #endif int in() { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } void out(int n) { int i; char ob[30]; if (!n) pc('0'); else { i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10; while (i--) pc(ob[i]); } pc('\n'); } //// セグメント木 int seg[2][1 << 19]; int sz; void segInit(int n) { sz = 1; while (sz < n) sz <<= 1; memset(seg, INF, sizeof(seg)); } // k番目(0-index)の値を v に変更 void update(int id, int k, int v) { int a, b; k += sz - 1; // if (seg[id][k] == v) return; seg[id][k] = v; while (k > 0) { k = (k - 1) >> 1; a = seg[id][(k << 1) + 1]; b = seg[id][(k << 1) + 2]; seg[id][k] = (a <= b)? a: b; } } // 空間 [a, b) 内の最小値 int getMin(int id, int a, int b, int k, int l, int r) { int left, right; if (r <= a || b <= l) return INF; if (a <= l && r <= b) return seg[id][k]; left = getMin(id, a, b, (k << 1) + 1, l, (l + r) >> 1); right = getMin(id, a, b, (k << 1) + 2, (l + r) >> 1, r); return left <= right ? left : right; } //// 本問題 typedef struct { int y, p, n; } T; // 位置と更新前後の値 T memo[2][200005]; int len[2]; int main() { int i, k, N, Q, x, y, z; int syn; N = in(); segInit(N); // セグメント木の初期化 for (i = 0; i < N; i++) update(0, i, in()); for (i = 0; i < N; i++) update(1, i, in()); Q = in(), syn = 0; while (Q--) { x = in(), y = in()-1, z = in(); // 0-index if (x == 1 || x == 2) { x--; // 0と1にする. 0->A, 1->B if (syn) { // 位置と更新前後の値を記録 k = len[x]++; memo[x][k].y = y, memo[x][k].n = z; memo[x][k].p = seg[x][y+(sz-1)]; // 元の値は y+(sz-1) の位置にある } update(x, y, z); } else if (x == 3 || x == 4) out(getMin(x-3, y, z, 0, 0, sz)); else { x -= 5; // 0と1にする. 0->A, 1->B if (syn) { // 元に戻して、相手のしてきた変更を施し、相手と同じにする for (i = len[x] - 1; i >= 0; i--) // 戻す作業 update(x, memo[x][i].y, memo[x][i].p); for (i = 0; i < len[!x]; i++) // 相手に同期 update(x, memo[!x][i].y, memo[!x][i].n); len[0] = len[1] = 0; } else { memcpy(seg[x], seg[!x], sizeof(int)*sz*2); syn = 1; } } } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl in .type in, @function in: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl $0, -8(%rbp) call getchar_unlocked@PLT movl %eax, -4(%rbp) .L2: movl -8(%rbp), %edx movl %edx, %eax sall $2, %eax addl %edx, %eax addl %eax, %eax movl %eax, %edx movl -4(%rbp), %eax andl $15, %eax addl %edx, %eax movl %eax, -8(%rbp) call getchar_unlocked@PLT movl %eax, -4(%rbp) cmpl $47, -4(%rbp) jg .L2 movl -8(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size in, .-in .globl out .type out, @function out: .LFB7: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $80, %rsp movl %edi, -68(%rbp) movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax cmpl $0, -68(%rbp) jne .L5 movl $48, %edi call putchar_unlocked@PLT jmp .L6 .L5: movl $0, -52(%rbp) jmp .L7 .L8: movl -68(%rbp), %edx movslq %edx, %rax imulq $1717986919, %rax, %rax shrq $32, %rax sarl $2, %eax movl %edx, %esi sarl $31, %esi subl %esi, %eax movl %eax, %ecx movl %ecx, %eax sall $2, %eax addl %ecx, %eax addl %eax, %eax movl %edx, %ecx subl %eax, %ecx movl %ecx, %eax leal 48(%rax), %ecx movl -52(%rbp), %eax leal 1(%rax), %edx movl %edx, -52(%rbp) movl %ecx, %edx cltq movb %dl, -48(%rbp,%rax) movl -68(%rbp), %eax movslq %eax, %rdx imulq $1717986919, %rdx, %rdx shrq $32, %rdx sarl $2, %edx sarl $31, %eax movl %eax, %ecx movl %edx, %eax subl %ecx, %eax movl %eax, -68(%rbp) .L7: cmpl $0, -68(%rbp) jne .L8 jmp .L9 .L10: movl -52(%rbp), %eax cltq movzbl -48(%rbp,%rax), %eax movsbl %al, %eax movl %eax, %edi call putchar_unlocked@PLT .L9: movl -52(%rbp), %eax leal -1(%rax), %edx movl %edx, -52(%rbp) testl %eax, %eax jne .L10 .L6: movl $10, %edi call putchar_unlocked@PLT nop movq -8(%rbp), %rax subq %fs:40, %rax je .L11 call __stack_chk_fail@PLT .L11: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size out, .-out .globl seg .bss .align 32 .type seg, @object .size seg, 4194304 seg: .zero 4194304 .globl sz .align 4 .type sz, @object .size sz, 4 sz: .zero 4 .text .globl segInit .type segInit, @function segInit: .LFB8: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl $1, sz(%rip) jmp .L13 .L14: movl sz(%rip), %eax addl %eax, %eax movl %eax, sz(%rip) .L13: movl sz(%rip), %eax cmpl %eax, -4(%rbp) jg .L14 movl $4194304, %edx movl $2147483647, %esi leaq seg(%rip), %rax movq %rax, %rdi call memset@PLT nop leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE8: .size segInit, .-segInit .globl update .type update, @function update: .LFB9: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl %edx, -28(%rbp) movl sz(%rip), %eax subl $1, %eax addl %eax, -24(%rbp) movl -24(%rbp), %eax movslq %eax, %rdx movl -20(%rbp), %eax cltq salq $19, %rax addq %rdx, %rax leaq 0(,%rax,4), %rcx leaq seg(%rip), %rdx movl -28(%rbp), %eax movl %eax, (%rcx,%rdx) jmp .L16 .L17: movl -24(%rbp), %eax subl $1, %eax sarl %eax movl %eax, -24(%rbp) movl -24(%rbp), %eax addl %eax, %eax addl $1, %eax movslq %eax, %rdx movl -20(%rbp), %eax cltq salq $19, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq seg(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -8(%rbp) movl -24(%rbp), %eax addl %eax, %eax addl $2, %eax movslq %eax, %rdx movl -20(%rbp), %eax cltq salq $19, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq seg(%rip), %rax movl (%rdx,%rax), %eax movl %eax, -4(%rbp) movl -8(%rbp), %edx movl -4(%rbp), %eax cmpl %eax, %edx cmovle %edx, %eax movl -24(%rbp), %edx movslq %edx, %rcx movl -20(%rbp), %edx movslq %edx, %rdx salq $19, %rdx addq %rcx, %rdx leaq 0(,%rdx,4), %rcx leaq seg(%rip), %rdx movl %eax, (%rcx,%rdx) .L16: cmpl $0, -24(%rbp) jg .L17 nop nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE9: .size update, .-update .globl getMin .type getMin, @function getMin: .LFB10: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl %edx, -28(%rbp) movl %ecx, -32(%rbp) movl %r8d, -36(%rbp) movl %r9d, -40(%rbp) movl -40(%rbp), %eax cmpl -24(%rbp), %eax jle .L19 movl -28(%rbp), %eax cmpl -36(%rbp), %eax jg .L20 .L19: movl $2147483647, %eax jmp .L21 .L20: movl -24(%rbp), %eax cmpl -36(%rbp), %eax jg .L22 movl -40(%rbp), %eax cmpl -28(%rbp), %eax jg .L22 movl -32(%rbp), %eax movslq %eax, %rdx movl -20(%rbp), %eax cltq salq $19, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq seg(%rip), %rax movl (%rdx,%rax), %eax jmp .L21 .L22: movl -36(%rbp), %edx movl -40(%rbp), %eax addl %edx, %eax sarl %eax movl %eax, %r8d movl -32(%rbp), %eax addl %eax, %eax leal 1(%rax), %ecx movl -36(%rbp), %edi movl -28(%rbp), %edx movl -24(%rbp), %esi movl -20(%rbp), %eax movl %r8d, %r9d movl %edi, %r8d movl %eax, %edi call getMin movl %eax, -8(%rbp) movl -36(%rbp), %edx movl -40(%rbp), %eax addl %edx, %eax sarl %eax movl %eax, %r8d movl -32(%rbp), %eax addl %eax, %eax leal 2(%rax), %ecx movl -40(%rbp), %edi movl -28(%rbp), %edx movl -24(%rbp), %esi movl -20(%rbp), %eax movl %edi, %r9d movl %eax, %edi call getMin movl %eax, -4(%rbp) movl -8(%rbp), %edx movl -4(%rbp), %eax cmpl %eax, %edx cmovle %edx, %eax .L21: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE10: .size getMin, .-getMin .globl memo .bss .align 32 .type memo, @object .size memo, 4800120 memo: .zero 4800120 .globl len .align 8 .type len, @object .size len, 8 len: .zero 8 .text .globl main .type main, @function main: .LFB11: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl $0, %eax call in movl %eax, -20(%rbp) movl -20(%rbp), %eax movl %eax, %edi call segInit movl $0, -32(%rbp) jmp .L24 .L25: movl $0, %eax call in movl %eax, %edx movl -32(%rbp), %eax movl %eax, %esi movl $0, %edi call update addl $1, -32(%rbp) .L24: movl -32(%rbp), %eax cmpl -20(%rbp), %eax jl .L25 movl $0, -32(%rbp) jmp .L26 .L27: movl $0, %eax call in movl %eax, %edx movl -32(%rbp), %eax movl %eax, %esi movl $1, %edi call update addl $1, -32(%rbp) .L26: movl -32(%rbp), %eax cmpl -20(%rbp), %eax jl .L27 movl $0, %eax call in movl %eax, -28(%rbp) movl $0, -24(%rbp) jmp .L28 .L39: movl $0, %eax call in movl %eax, -16(%rbp) movl $0, %eax call in subl $1, %eax movl %eax, -12(%rbp) movl $0, %eax call in movl %eax, -8(%rbp) cmpl $1, -16(%rbp) je .L29 cmpl $2, -16(%rbp) jne .L30 .L29: subl $1, -16(%rbp) cmpl $0, -24(%rbp) je .L31 movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax leal 1(%rax), %edx movl -16(%rbp), %ecx movslq %ecx, %rcx leaq 0(,%rcx,4), %rsi leaq len(%rip), %rcx movl %edx, (%rsi,%rcx) movl %eax, -4(%rbp) movl -4(%rbp), %eax movslq %eax, %rdx movl -16(%rbp), %eax movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax imulq $2400060, %rcx, %rdx addq %rax, %rdx leaq memo(%rip), %rax addq %rax, %rdx movl -12(%rbp), %eax movl %eax, (%rdx) movl -4(%rbp), %eax movslq %eax, %rdx movl -16(%rbp), %eax movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax imulq $2400060, %rcx, %rdx addq %rax, %rdx leaq 8+memo(%rip), %rax addq %rax, %rdx movl -8(%rbp), %eax movl %eax, (%rdx) movl sz(%rip), %eax leal -1(%rax), %edx movl -12(%rbp), %eax addl %edx, %eax movslq %eax, %rdx movl -16(%rbp), %eax cltq salq $19, %rax addq %rdx, %rax leaq 0(,%rax,4), %rdx leaq seg(%rip), %rax movl (%rdx,%rax), %edx movl -4(%rbp), %eax movslq %eax, %rcx movl -16(%rbp), %eax movslq %eax, %rsi movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $2, %rax imulq $2400060, %rsi, %rcx addq %rax, %rcx leaq 4+memo(%rip), %rax addq %rcx, %rax movl %edx, (%rax) .L31: movl -8(%rbp), %edx movl -12(%rbp), %ecx movl -16(%rbp), %eax movl %ecx, %esi movl %eax, %edi call update jmp .L28 .L30: cmpl $3, -16(%rbp) je .L32 cmpl $4, -16(%rbp) jne .L33 .L32: movl sz(%rip), %ecx movl -16(%rbp), %eax leal -3(%rax), %edi movl -8(%rbp), %edx movl -12(%rbp), %eax movl %ecx, %r9d movl $0, %r8d movl $0, %ecx movl %eax, %esi call getMin movl %eax, %edi call out jmp .L28 .L33: subl $5, -16(%rbp) cmpl $0, -24(%rbp) je .L34 movl -16(%rbp), %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax subl $1, %eax movl %eax, -32(%rbp) jmp .L35 .L36: movl -32(%rbp), %eax movslq %eax, %rdx movl -16(%rbp), %eax movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax imulq $2400060, %rcx, %rdx addq %rax, %rdx leaq 4+memo(%rip), %rax addq %rdx, %rax movl (%rax), %edx movl -32(%rbp), %eax movslq %eax, %rcx movl -16(%rbp), %eax movslq %eax, %rsi movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $2, %rax imulq $2400060, %rsi, %rcx addq %rax, %rcx leaq memo(%rip), %rax addq %rcx, %rax movl (%rax), %ecx movl -16(%rbp), %eax movl %ecx, %esi movl %eax, %edi call update subl $1, -32(%rbp) .L35: cmpl $0, -32(%rbp) jns .L36 movl $0, -32(%rbp) jmp .L37 .L38: cmpl $0, -16(%rbp) sete %al movzbl %al, %eax movl -32(%rbp), %edx movslq %edx, %rdx movslq %eax, %rcx movq %rdx, %rax addq %rax, %rax addq %rdx, %rax salq $2, %rax imulq $2400060, %rcx, %rdx addq %rax, %rdx leaq 8+memo(%rip), %rax addq %rdx, %rax movl (%rax), %edx cmpl $0, -16(%rbp) sete %al movzbl %al, %eax movl -32(%rbp), %ecx movslq %ecx, %rcx movslq %eax, %rsi movq %rcx, %rax addq %rax, %rax addq %rcx, %rax salq $2, %rax imulq $2400060, %rsi, %rcx addq %rax, %rcx leaq memo(%rip), %rax addq %rcx, %rax movl (%rax), %ecx movl -16(%rbp), %eax movl %ecx, %esi movl %eax, %edi call update addl $1, -32(%rbp) .L37: cmpl $0, -16(%rbp) sete %al movzbl %al, %eax cltq leaq 0(,%rax,4), %rdx leaq len(%rip), %rax movl (%rdx,%rax), %eax cmpl %eax, -32(%rbp) jl .L38 movl $0, 4+len(%rip) movl 4+len(%rip), %eax movl %eax, len(%rip) jmp .L28 .L34: movl sz(%rip), %eax cltq leaq 0(,%rax,8), %rdx cmpl $0, -16(%rbp) sete %al movzbl %al, %eax cltq salq $21, %rax movq %rax, %rcx leaq seg(%rip), %rax addq %rax, %rcx movl -16(%rbp), %eax cltq salq $21, %rax movq %rax, %rsi leaq seg(%rip), %rax addq %rsi, %rax movq %rcx, %rsi movq %rax, %rdi call memcpy@PLT movl $1, -24(%rbp) .L28: movl -28(%rbp), %eax leal -1(%rax), %edx movl %edx, -28(%rbp) testl %eax, %eax jne .L39 movl $0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE11: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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 floor(x)+floor(y);\n}\n\nint main()\n{\n\tint x,y,s,i,j,r;\n\tfor(;scanf(\"%d%d%d\",&x,&y,&s),x+y+s;)\n\t{\n\t\tr=0;\n\t\tfor(i=1;i<s;i++)\n\t\t\tfor(j=1;j<s;j++)\n\t\t\t{\n\t\t\t\tif(toT(i,j,x)==s)\n\t\t\t\t\tr=r>toT(i,j,y)?r:toT(i,j,y);\n\t\t\t}\n\t\tprintf(\"%d\\n\",r);\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ttoT\n\t.type\ttoT, @function\ntoT:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t-20(%rbp), %xmm1\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t-28(%rbp), %xmm2\n\tmovsd\t.LC0(%rip), %xmm0\n\taddsd\t%xmm2, %xmm0\n\tmovsd\t.LC0(%rip), %xmm2\n\tdivsd\t%xmm2, %xmm0\n\tmulsd\t%xmm0, %xmm1\n\tmovsd\t.LC1(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t-24(%rbp), %xmm1\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t-28(%rbp), %xmm2\n\tmovsd\t.LC0(%rip), %xmm0\n\taddsd\t%xmm2, %xmm0\n\tmovsd\t.LC0(%rip), %xmm2\n\tdivsd\t%xmm2, %xmm0\n\tmulsd\t%xmm0, %xmm1\n\tmovsd\t.LC1(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tfloor@PLT\n\tmovsd\t%xmm0, -40(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tfloor@PLT\n\taddsd\t-40(%rbp), %xmm0\n\tcvttsd2sil\t%xmm0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\ttoT, .-toT\n\t.section\t.rodata\n.LC2:\n\t.string\t\"%d\\n\"\n.LC3:\n\t.string\t\"%d%d%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L4\n.L12:\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$1, -20(%rbp)\n\tjmp\t.L5\n.L11:\n\tmovl\t$1, -16(%rbp)\n\tjmp\t.L6\n.L10:\n\tmovl\t-32(%rbp), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\ttoT\n\tmovl\t-24(%rbp), %edx\n\tcmpl\t%edx, %eax\n\tjne\t.L7\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\ttoT\n\tcmpl\t%eax, -12(%rbp)\n\tjg\t.L8\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\ttoT\n\tjmp\t.L9\n.L8:\n\tmovl\t-12(%rbp), %eax\n.L9:\n\tmovl\t%eax, -12(%rbp)\n.L7:\n\taddl\t$1, -16(%rbp)\n.L6:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L10\n\taddl\t$1, -20(%rbp)\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L11\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L4:\n\tleaq\t-24(%rbp), %rcx\n\tleaq\t-28(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-32(%rbp), %edx\n\tmovl\t-28(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-24(%rbp), %eax\n\taddl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L12\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC1:\n\t.long\t-400107883\n\t.long\t1041313291\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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%xmm3, %xmm4\n\taddsd\t%xmm0, %xmm2\n\tdivsd\t%xmm0, %xmm2\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%esi, %xmm0\n\tmulsd\t%xmm2, %xmm0\n\taddsd\t%xmm6, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tandpd\t%xmm3, %xmm1\n\tucomisd\t%xmm1, %xmm5\n\tjbe\t.L2\n\tcvttsd2siq\t%xmm0, %rax\n\tpxor\t%xmm1, %xmm1\n\tandnpd\t%xmm0, %xmm4\n\tmovsd\t.LC4(%rip), %xmm8\n\tcvtsi2sdq\t%rax, %xmm1\n\tmovapd\t%xmm1, %xmm7\n\tcmpnlesd\t%xmm0, %xmm7\n\tandpd\t%xmm8, %xmm7\n\tsubsd\t%xmm7, %xmm1\n\tmovapd\t%xmm1, %xmm0\n\torpd\t%xmm4, %xmm0\n.L2:\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%edi, %xmm1\n\tmulsd\t%xmm2, %xmm1\n\taddsd\t%xmm6, %xmm1\n\tmovapd\t%xmm1, %xmm2\n\tandpd\t%xmm3, %xmm2\n\tucomisd\t%xmm2, %xmm5\n\tjbe\t.L3\n\tcvttsd2siq\t%xmm1, %rax\n\tpxor\t%xmm2, %xmm2\n\tmovsd\t.LC4(%rip), %xmm5\n\tandnpd\t%xmm1, %xmm3\n\tcvtsi2sdq\t%rax, %xmm2\n\tmovapd\t%xmm2, %xmm4\n\tcmpnlesd\t%xmm1, %xmm4\n\tandpd\t%xmm5, %xmm4\n\tsubsd\t%xmm4, %xmm2\n\torpd\t%xmm3, %xmm2\n\tmovapd\t%xmm2, %xmm1\n.L3:\n\taddsd\t%xmm1, %xmm0\n\tcvttsd2sil\t%xmm0, %eax\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\ttoT, .-toT\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC5:\n\t.string\t\"%d\\n\"\n.LC6:\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.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t.LC6(%rip), %rbx\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t20(%rsp), %r13\n\tleaq\t16(%rsp), %r12\n\tleaq\t12(%rsp), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r13, %rcx\n\tmovq\t%r12, %rdx\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %ecx\n\tmovl\t16(%rsp), %esi\n\tmovl\t20(%rsp), %edx\n\tleal\t(%rcx,%rsi), %eax\n\taddl\t%edx, %eax\n\tje\t.L16\n\tmovq\t.LC7(%rip), %rax\n\txorl\t%r8d, %r8d\n\tcmpl\t$1, %edx\n\tmovq\t%rax, %xmm9\n\tjle\t.L18\n\tpxor\t%xmm5, %xmm5\n\tmovsd\t.LC0(%rip), %xmm7\n\tmovsd\t.LC1(%rip), %xmm3\n\txorl\t%r8d, %r8d\n\tcvtsi2sdl\t%ecx, %xmm5\n\tmovsd\t.LC2(%rip), %xmm2\n\tmovsd\t.LC4(%rip), %xmm6\n\tmovl\t$1, %ecx\n\taddsd\t%xmm7, %xmm5\n\tdivsd\t%xmm7, %xmm5\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tpxor\t%xmm8, %xmm8\n\tcvtsi2sdl\t%ecx, %xmm8\n\tmovapd\t%xmm8, %xmm4\n\tmulsd\t%xmm5, %xmm4\n\taddsd\t%xmm3, %xmm4\n\tmovapd\t%xmm4, %xmm0\n\tandpd\t%xmm9, %xmm0\n\tucomisd\t%xmm0, %xmm2\n\tjbe\t.L7\n\tcvttsd2siq\t%xmm4, %rax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdq\t%rax, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tcmpnlesd\t%xmm4, %xmm1\n\tandpd\t%xmm6, %xmm1\n\tsubsd\t%xmm1, %xmm0\n\tmovapd\t%xmm9, %xmm1\n\tandnpd\t%xmm4, %xmm1\n\tmovapd\t%xmm0, %xmm4\n\torpd\t%xmm1, %xmm4\n.L7:\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tpxor\t%xmm1, %xmm1\n\tmovapd\t%xmm5, %xmm0\n\tcvtsi2sdl\t%eax, %xmm1\n\tmulsd\t%xmm1, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tmovapd\t%xmm0, %xmm10\n\tandpd\t%xmm9, %xmm10\n\tucomisd\t%xmm10, %xmm2\n\tjbe\t.L8\n\tcvttsd2siq\t%xmm0, %rdi\n\tpxor\t%xmm10, %xmm10\n\tcvtsi2sdq\t%rdi, %xmm10\n\tmovapd\t%xmm10, %xmm11\n\tcmpnlesd\t%xmm0, %xmm11\n\tandpd\t%xmm6, %xmm11\n\tsubsd\t%xmm11, %xmm10\n\tmovapd\t%xmm9, %xmm11\n\tandnpd\t%xmm0, %xmm11\n\tmovapd\t%xmm10, %xmm0\n\torpd\t%xmm11, %xmm0\n.L8:\n\taddsd\t%xmm4, %xmm0\n\tcvttsd2sil\t%xmm0, %edi\n\tcmpl\t%edi, %edx\n\tje\t.L22\n\taddl\t$1, %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L14\n\taddl\t$1, %ecx\n\tcmpl\t%ecx, %edx\n\tjne\t.L15\n.L18:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC5(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%esi, %xmm0\n\taddsd\t%xmm7, %xmm0\n\tdivsd\t%xmm7, %xmm0\n\tmulsd\t%xmm0, %xmm1\n\taddsd\t%xmm3, %xmm1\n\tmovapd\t%xmm1, %xmm10\n\tandpd\t%xmm9, %xmm10\n\tucomisd\t%xmm10, %xmm2\n\tjbe\t.L10\n\tcvttsd2siq\t%xmm1, %rdi\n\tpxor\t%xmm10, %xmm10\n\tcvtsi2sdq\t%rdi, %xmm10\n\tmovapd\t%xmm10, %xmm11\n\tcmpnlesd\t%xmm1, %xmm11\n\tandpd\t%xmm6, %xmm11\n\tsubsd\t%xmm11, %xmm10\n\tmovapd\t%xmm9, %xmm11\n\tandnpd\t%xmm1, %xmm11\n\tmovapd\t%xmm10, %xmm1\n\torpd\t%xmm11, %xmm1\n.L10:\n\tmulsd\t%xmm8, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tmovapd\t%xmm0, %xmm10\n\tandpd\t%xmm9, %xmm10\n\tucomisd\t%xmm10, %xmm2\n\tjbe\t.L11\n\tcvttsd2siq\t%xmm0, %rdi\n\tpxor\t%xmm10, %xmm10\n\tcvtsi2sdq\t%rdi, %xmm10\n\tmovapd\t%xmm10, %xmm11\n\tcmpnlesd\t%xmm0, %xmm11\n\tandpd\t%xmm6, %xmm11\n\tsubsd\t%xmm11, %xmm10\n\tmovapd\t%xmm9, %xmm11\n\tandnpd\t%xmm0, %xmm11\n\tmovapd\t%xmm10, %xmm0\n\torpd\t%xmm11, %xmm0\n.L11:\n\taddsd\t%xmm0, %xmm1\n\tcvttsd2sil\t%xmm1, %edi\n\tcmpl\t%edi, %r8d\n\tcmovl\t%edi, %r8d\n\taddl\t$1, %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L14\n\taddl\t$1, %ecx\n\tcmpl\t%ecx, %edx\n\tjne\t.L15\n\tjmp\t.L18\n.L16:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L23\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L23:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC1:\n\t.long\t-400107883\n\t.long\t1041313291\n\t.align 8\n.LC2:\n\t.long\t0\n\t.long\t1127219200\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC3:\n\t.long\t-1\n\t.long\t2147483647\n\t.long\t0\n\t.long\t0\n\t.section\t.rodata.cst8\n\t.align 8\n.LC4:\n\t.long\t0\n\t.long\t1072693248\n\t.set\t.LC7,.LC3\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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, %xmm4\n\taddsd\t%xmm0, %xmm2\n\tdivsd\t%xmm0, %xmm2\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%esi, %xmm0\n\tmulsd\t%xmm2, %xmm0\n\taddsd\t%xmm6, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tandpd\t%xmm3, %xmm1\n\tucomisd\t%xmm1, %xmm5\n\tjbe\t.L2\n\tcvttsd2siq\t%xmm0, %rax\n\tpxor\t%xmm1, %xmm1\n\tandnpd\t%xmm0, %xmm4\n\tmovsd\t.LC4(%rip), %xmm8\n\tcvtsi2sdq\t%rax, %xmm1\n\tmovapd\t%xmm1, %xmm7\n\tcmpnlesd\t%xmm0, %xmm7\n\tandpd\t%xmm8, %xmm7\n\tsubsd\t%xmm7, %xmm1\n\tmovapd\t%xmm1, %xmm0\n\torpd\t%xmm4, %xmm0\n.L2:\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t%edi, %xmm1\n\tmulsd\t%xmm2, %xmm1\n\taddsd\t%xmm6, %xmm1\n\tmovapd\t%xmm1, %xmm2\n\tandpd\t%xmm3, %xmm2\n\tucomisd\t%xmm2, %xmm5\n\tjbe\t.L3\n\tcvttsd2siq\t%xmm1, %rax\n\tpxor\t%xmm2, %xmm2\n\tmovsd\t.LC4(%rip), %xmm5\n\tandnpd\t%xmm1, %xmm3\n\tcvtsi2sdq\t%rax, %xmm2\n\tmovapd\t%xmm2, %xmm4\n\tcmpnlesd\t%xmm1, %xmm4\n\tandpd\t%xmm5, %xmm4\n\tsubsd\t%xmm4, %xmm2\n\torpd\t%xmm3, %xmm2\n\tmovapd\t%xmm2, %xmm1\n.L3:\n\taddsd\t%xmm1, %xmm0\n\tcvttsd2sil\t%xmm0, %eax\n\tret\n\t.cfi_endproc\n.LFE23:\n\t.size\ttoT, .-toT\n\t.section\t.rodata.str1.1,\"aMS\",@progbits,1\n.LC5:\n\t.string\t\"%d\\n\"\n.LC6:\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.LFB24:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%r13\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 13, -16\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 24\n\t.cfi_offset 12, -24\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 32\n\t.cfi_offset 6, -32\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 3, -40\n\tleaq\t.LC6(%rip), %rbx\n\tsubq\t$40, %rsp\n\t.cfi_def_cfa_offset 80\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 24(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t20(%rsp), %r13\n\tleaq\t16(%rsp), %r12\n\tleaq\t12(%rsp), %rbp\n\t.p2align 4,,10\n\t.p2align 3\n.L6:\n\tmovq\t%r13, %rcx\n\tmovq\t%r12, %rdx\n\tmovq\t%rbp, %rsi\n\txorl\t%eax, %eax\n\tmovq\t%rbx, %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t12(%rsp), %ecx\n\tmovl\t16(%rsp), %esi\n\tmovl\t20(%rsp), %edx\n\tleal\t(%rcx,%rsi), %eax\n\taddl\t%edx, %eax\n\tje\t.L16\n\tmovq\t.LC7(%rip), %rax\n\txorl\t%r8d, %r8d\n\tcmpl\t$1, %edx\n\tmovq\t%rax, %xmm9\n\tjle\t.L18\n\tpxor\t%xmm5, %xmm5\n\tmovsd\t.LC0(%rip), %xmm7\n\tmovsd\t.LC1(%rip), %xmm3\n\txorl\t%r8d, %r8d\n\tcvtsi2sdl\t%ecx, %xmm5\n\tmovsd\t.LC2(%rip), %xmm2\n\tmovsd\t.LC4(%rip), %xmm6\n\tmovl\t$1, %ecx\n\taddsd\t%xmm7, %xmm5\n\tdivsd\t%xmm7, %xmm5\n\t.p2align 4,,10\n\t.p2align 3\n.L15:\n\tpxor\t%xmm8, %xmm8\n\tcvtsi2sdl\t%ecx, %xmm8\n\tmovapd\t%xmm8, %xmm4\n\tmulsd\t%xmm5, %xmm4\n\taddsd\t%xmm3, %xmm4\n\tmovapd\t%xmm4, %xmm0\n\tandpd\t%xmm9, %xmm0\n\tucomisd\t%xmm0, %xmm2\n\tjbe\t.L7\n\tcvttsd2siq\t%xmm4, %rax\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdq\t%rax, %xmm0\n\tmovapd\t%xmm0, %xmm1\n\tcmpnlesd\t%xmm4, %xmm1\n\tandpd\t%xmm6, %xmm1\n\tsubsd\t%xmm1, %xmm0\n\tmovapd\t%xmm9, %xmm1\n\tandnpd\t%xmm4, %xmm1\n\tmovapd\t%xmm0, %xmm4\n\torpd\t%xmm1, %xmm4\n.L7:\n\tmovl\t$1, %eax\n\t.p2align 4,,10\n\t.p2align 3\n.L14:\n\tpxor\t%xmm1, %xmm1\n\tmovapd\t%xmm5, %xmm0\n\tcvtsi2sdl\t%eax, %xmm1\n\tmulsd\t%xmm1, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tmovapd\t%xmm0, %xmm10\n\tandpd\t%xmm9, %xmm10\n\tucomisd\t%xmm10, %xmm2\n\tjbe\t.L8\n\tcvttsd2siq\t%xmm0, %rdi\n\tpxor\t%xmm10, %xmm10\n\tcvtsi2sdq\t%rdi, %xmm10\n\tmovapd\t%xmm10, %xmm11\n\tcmpnlesd\t%xmm0, %xmm11\n\tandpd\t%xmm6, %xmm11\n\tsubsd\t%xmm11, %xmm10\n\tmovapd\t%xmm9, %xmm11\n\tandnpd\t%xmm0, %xmm11\n\tmovapd\t%xmm10, %xmm0\n\torpd\t%xmm11, %xmm0\n.L8:\n\taddsd\t%xmm4, %xmm0\n\tcvttsd2sil\t%xmm0, %edi\n\tcmpl\t%edi, %edx\n\tje\t.L22\n\taddl\t$1, %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L14\n\taddl\t$1, %ecx\n\tcmpl\t%ecx, %edx\n\tjne\t.L15\n.L18:\n\tmovl\t%r8d, %edx\n\tleaq\t.LC5(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tjmp\t.L6\n\t.p2align 4,,10\n\t.p2align 3\n.L22:\n\tpxor\t%xmm0, %xmm0\n\tcvtsi2sdl\t%esi, %xmm0\n\taddsd\t%xmm7, %xmm0\n\tdivsd\t%xmm7, %xmm0\n\tmulsd\t%xmm0, %xmm1\n\taddsd\t%xmm3, %xmm1\n\tmovapd\t%xmm1, %xmm10\n\tandpd\t%xmm9, %xmm10\n\tucomisd\t%xmm10, %xmm2\n\tjbe\t.L10\n\tcvttsd2siq\t%xmm1, %rdi\n\tpxor\t%xmm10, %xmm10\n\tcvtsi2sdq\t%rdi, %xmm10\n\tmovapd\t%xmm10, %xmm11\n\tcmpnlesd\t%xmm1, %xmm11\n\tandpd\t%xmm6, %xmm11\n\tsubsd\t%xmm11, %xmm10\n\tmovapd\t%xmm9, %xmm11\n\tandnpd\t%xmm1, %xmm11\n\tmovapd\t%xmm10, %xmm1\n\torpd\t%xmm11, %xmm1\n.L10:\n\tmulsd\t%xmm8, %xmm0\n\taddsd\t%xmm3, %xmm0\n\tmovapd\t%xmm0, %xmm10\n\tandpd\t%xmm9, %xmm10\n\tucomisd\t%xmm10, %xmm2\n\tjbe\t.L11\n\tcvttsd2siq\t%xmm0, %rdi\n\tpxor\t%xmm10, %xmm10\n\tcvtsi2sdq\t%rdi, %xmm10\n\tmovapd\t%xmm10, %xmm11\n\tcmpnlesd\t%xmm0, %xmm11\n\tandpd\t%xmm6, %xmm11\n\tsubsd\t%xmm11, %xmm10\n\tmovapd\t%xmm9, %xmm11\n\tandnpd\t%xmm0, %xmm11\n\tmovapd\t%xmm10, %xmm0\n\torpd\t%xmm11, %xmm0\n.L11:\n\taddsd\t%xmm0, %xmm1\n\tcvttsd2sil\t%xmm1, %edi\n\tcmpl\t%edi, %r8d\n\tcmovl\t%edi, %r8d\n\taddl\t$1, %eax\n\tcmpl\t%eax, %edx\n\tjne\t.L14\n\taddl\t$1, %ecx\n\tcmpl\t%ecx, %edx\n\tjne\t.L15\n\tjmp\t.L18\n.L16:\n\tmovq\t24(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L23\n\taddq\t$40, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 40\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 32\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 8\n\tret\n.L23:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE24:\n\t.size\tmain, .-main\n\t.section\t.rodata.cst8,\"aM\",@progbits,8\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC1:\n\t.long\t-400107883\n\t.long\t1041313291\n\t.align 8\n.LC2:\n\t.long\t0\n\t.long\t1127219200\n\t.section\t.rodata.cst16,\"aM\",@progbits,16\n\t.align 16\n.LC3:\n\t.long\t-1\n\t.long\t2147483647\n\t.long\t0\n\t.long\t0\n\t.section\t.rodata.cst8\n\t.align 8\n.LC4:\n\t.long\t0\n\t.long\t1072693248\n\t.set\t.LC7,.LC3\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 floor(x)+floor(y);\n}\n\nint main()\n{\n\tint x,y,s,i,j,r;\n\tfor(;scanf(\"%d%d%d\",&x,&y,&s),x+y+s;)\n\t{\n\t\tr=0;\n\t\tfor(i=1;i<s;i++)\n\t\t\tfor(j=1;j<s;j++)\n\t\t\t{\n\t\t\t\tif(toT(i,j,x)==s)\n\t\t\t\t\tr=r>toT(i,j,y)?r:toT(i,j,y);\n\t\t\t}\n\t\tprintf(\"%d\\n\",r);\n\t}\n\treturn 0;\n}", "index": 110, "inputs": [ "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n2 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 2 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 14\n1 82 61\n1 84 125\n1 2 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 42\n3 24 50\n2 82 89\n1 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 50\n2 82 89\n1 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 50\n2 82 89\n1 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 50\n2 82 89\n1 84 125\n1 0 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 71\n2 82 89\n1 84 125\n1 0 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 6 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 1739\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 1 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 100\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 178\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 2 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 11\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 22\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n2 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 2 999\n99 1 999\n98 99 999\n2 99 11\n99 1 8\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 29\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 14\n1 82 61\n1 84 125\n1 2 999\n137 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n78 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 3 1912\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 42\n3 24 50\n2 82 89\n2 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 97\n2 82 89\n1 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 71\n2 82 89\n1 84 125\n1 1 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 95\n8 5 105\n1 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 6 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n6 5 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 142 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 300\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 100\n1 84 125\n1 99 999\n99 1 999\n128 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 178\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 244\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 11\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 22\n0 0 0\n", "5 8 105\n8 5 22\n1 2 24\n4 98 24\n12 5 26\n1 22 11\n1 13 201\n13 13 112\n3 24 50\n2 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 11 125\n1 2 999\n99 1 999\n98 99 999\n2 99 11\n99 1 8\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 29\n1 84 125\n1 99 999\n99 4 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 14\n1 82 61\n1 84 125\n1 2 999\n137 1 999\n98 99 748\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 11 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n78 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 3 24\n4 98 3\n12 5 26\n1 22 23\n0 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n4 82 89\n1 84 125\n1 3 1912\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 42\n3 22 50\n2 82 89\n2 84 125\n1 3 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 97\n2 82 89\n1 48 125\n1 3 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 50\n2 89 89\n1 84 125\n1 0 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 96\n8 5 105\n1 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 6 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n6 5 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 142 125\n1 99 999\n99 1 999\n98 99 1877\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 3106\n98 99 999\n1 99 11\n99 2 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 124\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 1 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n0 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 107 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 300\n13 16 112\n2 48 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 000\n1 84 125\n1 99 999\n99 1 999\n128 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 178\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 244\n13 16 112\n2 24 73\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 2 105\n1 3 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 19\n1 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 32\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 11 125\n1 2 999\n99 1 999\n98 99 999\n2 99 11\n99 1 8\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 14\n1 82 61\n1 84 125\n1 2 999\n137 1 999\n98 99 748\n2 27 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 11 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 146 999\n78 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 3 24\n4 98 3\n12 5 26\n1 22 23\n0 13 201\n13 13 28\n3 24 61\n2 82 89\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 1\n12 5 26\n1 21 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n4 82 89\n1 84 125\n1 3 1912\n99 3 999\n98 99 999\n1 99 9\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 13 42\n3 22 50\n2 82 89\n2 84 125\n1 6 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 68\n3 24 50\n2 89 89\n1 84 125\n1 0 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 4 24\n4 98 3\n12 5 26\n1 22 23\n1 13 201\n13 0 42\n3 24 71\n2 82 89\n1 84 125\n1 1 999\n99 5 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 96\n8 5 105\n1 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 6 50\n1 82 61\n1 84 125\n1 93 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n9 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 124\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 1 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n0 24 50\n1 82 82\n1 84 125\n1 99 999\n99 1 999\n98 107 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 300\n13 18 112\n2 48 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 000\n1 84 39\n1 99 999\n99 1 999\n128 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 178\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 244\n13 16 112\n2 24 73\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n2 99 0\n99 1 12\n0 0 0\n", "5 8 105\n8 2 105\n1 3 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 19\n1 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 21\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n3 24 50\n1 82 11\n1 44 125\n1 99 999\n99 1 999\n98 99 999\n2 99 11\n99 1 22\n0 0 0\n", "5 8 105\n8 5 22\n1 2 24\n4 98 24\n12 5 26\n2 13 11\n1 13 201\n13 13 112\n3 24 50\n2 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 32\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 11 125\n1 0 999\n99 1 999\n98 99 999\n2 99 11\n99 1 8\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n155 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n2 24 14\n1 82 61\n1 84 125\n1 2 999\n137 1 999\n98 99 748\n2 27 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 11 24\n12 5 26\n1 22 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 146 598\n78 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 3 24\n4 98 3\n12 5 43\n1 22 23\n0 13 201\n13 13 28\n3 24 61\n2 82 89\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 7\n8 5 105\n2 2 24\n4 98 1\n12 5 26\n1 21 23\n1 13 201\n13 13 28\n3 24 50\n2 82 89\n1 84 125\n1 99 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 3\n12 5 26\n1 22 40\n1 13 201\n13 13 42\n3 22 50\n2 82 89\n2 84 125\n1 6 999\n99 3 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 3\n12 0 26\n1 22 23\n1 13 201\n13 0 68\n3 24 50\n2 89 89\n1 84 125\n1 0 999\n99 3 999\n98 99 999\n1 99 12\n99 1 12\n0 0 0\n", "5 8 96\n8 5 105\n1 2 24\n4 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 6 50\n1 82 61\n2 84 125\n1 93 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n4 98 24\n6 5 46\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 142 125\n1 99 999\n99 1 999\n98 99 1877\n1 99 11\n99 2 12\n0 0 0\n", "5 8 105\n8 5 105\n2 2 24\n4 98 24\n12 13 26\n1 10 23\n1 13 201\n9 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 124\n1 99 11\n99 1 12\n0 0 0\n", "1 8 105\n8 1 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n0 24 50\n1 82 82\n1 84 125\n1 99 999\n99 1 999\n98 107 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 5 24\n12 13 26\n2 22 23\n1 19 300\n13 18 112\n2 48 50\n1 82 61\n1 84 125\n1 99 999\n99 0 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n14 5 105\n1 2 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 50\n1 82 000\n1 84 39\n1 99 999\n99 1 999\n128 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 178\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n2 22 23\n1 19 244\n13 16 112\n2 24 73\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 56 999\n2 99 0\n99 1 12\n0 0 0\n", "5 8 105\n8 2 105\n1 3 24\n4 98 24\n12 5 26\n1 22 23\n1 13 201\n13 13 112\n3 24 19\n1 82 61\n1 84 79\n1 99 999\n99 2 999\n98 99 999\n1 99 21\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n11 13 26\n2 22 23\n1 19 201\n13 16 112\n3 24 50\n1 82 11\n1 44 125\n1 99 999\n99 1 999\n98 173 999\n2 99 11\n99 1 22\n0 0 0\n", "5 8 105\n8 5 22\n1 2 33\n4 98 24\n12 5 26\n2 13 11\n1 13 201\n13 13 112\n3 24 50\n2 82 61\n1 84 125\n1 99 999\n99 2 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n155 98 24\n11 3 26\n2 22 23\n1 19 201\n13 16 112\n2 24 14\n1 82 61\n1 84 125\n1 2 999\n137 1 999\n98 99 748\n2 27 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 3 24\n4 98 3\n12 5 43\n1 22 23\n0 13 201\n13 13 28\n3 24 61\n2 82 89\n1 84 125\n1 99 999\n99 2 359\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n", "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 13 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 999\n98 99 999\n1 99 11\n99 1 12\n0 0 0\n" ], "outputs": [ "109\n103\n24\n46\n26\n27\n225\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n111\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n110\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n111\n230\n1009\n508\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n28\n62\n110\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n17\n111\n230\n1009\n508\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n28\n62\n161\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n28\n62\n161\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n28\n62\n161\n230\n1972\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n28\n62\n161\n230\n1019\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n42\n62\n161\n230\n1019\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n62\n161\n230\n1019\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n62\n161\n230\n1019\n518\n1004\n22\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n62\n161\n230\n991\n518\n1004\n22\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n86\n161\n230\n991\n518\n1004\n22\n7\n", "109\n103\n24\n46\n26\n27\n225\n116\n52\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n882\n1004\n20\n7\n", "109\n103\n24\n46\n26\n27\n225\n116\n62\n111\n230\n1972\n513\n1004\n20\n7\n", "109\n99\n24\n46\n25\n27\n225\n112\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n503\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n182\n230\n1972\n508\n1004\n20\n7\n", "184\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n100\n24\n46\n25\n27\n225\n112\n62\n111\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n19\n230\n1972\n508\n1004\n20\n7\n", "109\n22\n24\n46\n25\n27\n225\n112\n62\n110\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n111\n230\n1009\n508\n1004\n20\n5\n", "109\n103\n24\n46\n25\n27\n225\n28\n62\n52\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n17\n111\n230\n1009\n426\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n28\n62\n161\n230\n1972\n573\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n28\n62\n161\n230\n1950\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n42\n62\n161\n228\n1019\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n118\n161\n230\n1019\n518\n1004\n22\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n86\n161\n230\n999\n518\n1004\n22\n7\n", "99\n103\n24\n46\n26\n27\n225\n116\n52\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n26\n27\n225\n116\n62\n111\n302\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n26\n27\n225\n116\n62\n111\n230\n1972\n503\n1004\n20\n7\n", "109\n103\n24\n24\n26\n27\n354\n116\n62\n111\n230\n1972\n503\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n182\n230\n1972\n508\n873\n20\n7\n", "184\n103\n24\n24\n26\n27\n289\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n19\n230\n1972\n508\n1004\n20\n12\n", "109\n22\n24\n46\n25\n13\n225\n112\n62\n110\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n111\n138\n1009\n508\n1004\n20\n5\n", "109\n103\n24\n46\n25\n27\n225\n28\n62\n52\n230\n1972\n523\n1004\n20\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n17\n111\n230\n1009\n426\n752\n20\n7\n", "109\n103\n24\n26\n25\n27\n225\n28\n62\n161\n230\n1972\n573\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n227\n28\n62\n161\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n28\n62\n158\n230\n1950\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n42\n60\n161\n228\n1019\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n118\n161\n185\n1019\n518\n1004\n22\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n62\n168\n230\n991\n518\n1004\n22\n7\n", "100\n103\n24\n46\n26\n27\n225\n116\n52\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n46\n26\n27\n225\n116\n62\n111\n302\n1972\n508\n1886\n20\n7\n", "109\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n1576\n1004\n20\n7\n", "109\n103\n24\n46\n26\n27\n225\n116\n62\n111\n230\n1972\n503\n124\n20\n7\n", "109\n99\n24\n46\n25\n27\n225\n112\n62\n111\n230\n1972\n508\n1045\n20\n7\n", "109\n103\n24\n24\n26\n27\n354\n116\n74\n111\n230\n1972\n503\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n0\n230\n1972\n508\n873\n20\n7\n", "184\n103\n24\n24\n26\n27\n289\n116\n90\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n100\n24\n46\n25\n27\n225\n112\n23\n111\n230\n1972\n513\n1004\n20\n7\n", "109\n32\n24\n24\n28\n27\n237\n116\n62\n111\n138\n1009\n508\n1004\n20\n5\n", "109\n103\n24\n24\n28\n27\n237\n116\n17\n111\n230\n1009\n426\n752\n13\n7\n", "109\n103\n24\n26\n25\n27\n225\n28\n62\n161\n230\n2437\n573\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n227\n28\n75\n161\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n0\n25\n27\n225\n28\n62\n161\n230\n1972\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n28\n62\n158\n230\n1950\n518\n1004\n16\n7\n", "109\n103\n24\n4\n25\n27\n225\n42\n60\n161\n228\n1049\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n27\n225\n61\n62\n168\n230\n991\n518\n1004\n22\n7\n", "109\n103\n24\n4\n25\n27\n225\n38\n86\n161\n230\n999\n528\n1004\n22\n7\n", "100\n103\n24\n46\n26\n27\n225\n116\n52\n111\n230\n1912\n508\n1004\n20\n7\n", "109\n103\n24\n46\n26\n27\n225\n120\n62\n111\n230\n1972\n503\n124\n20\n7\n", "109\n99\n24\n46\n25\n27\n225\n112\n62\n149\n230\n1972\n508\n1045\n20\n7\n", "109\n103\n24\n24\n26\n27\n354\n118\n74\n111\n230\n1972\n503\n1004\n20\n7\n", "109\n103\n24\n46\n25\n27\n225\n112\n62\n0\n71\n1972\n508\n873\n20\n7\n", "184\n103\n24\n24\n26\n27\n289\n116\n90\n111\n230\n1972\n508\n1004\n0\n7\n", "109\n100\n24\n46\n25\n27\n225\n112\n23\n111\n230\n1972\n513\n1004\n40\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n19\n180\n1972\n508\n1004\n20\n12\n", "109\n22\n24\n46\n25\n12\n225\n112\n62\n110\n230\n1972\n513\n1004\n20\n7\n", "109\n32\n24\n24\n28\n27\n237\n116\n62\n111\n138\n991\n508\n1004\n20\n5\n", "109\n103\n24\n18\n28\n27\n237\n116\n17\n111\n230\n1009\n426\n752\n13\n7\n", "109\n103\n24\n26\n25\n27\n225\n28\n62\n161\n230\n1461\n573\n1004\n20\n7\n", "109\n103\n24\n4\n41\n27\n227\n28\n75\n161\n230\n1972\n513\n1004\n20\n7\n", "7\n103\n24\n0\n25\n27\n225\n28\n62\n161\n230\n1972\n518\n1004\n20\n7\n", "109\n103\n24\n4\n25\n48\n225\n42\n60\n161\n228\n1049\n518\n1004\n20\n7\n", "109\n103\n24\n4\n24\n27\n225\n61\n62\n168\n230\n991\n518\n1004\n22\n7\n", "100\n103\n24\n46\n26\n27\n225\n116\n52\n111\n228\n1912\n508\n1004\n20\n7\n", "109\n103\n24\n46\n46\n27\n225\n116\n62\n111\n302\n1972\n508\n1886\n20\n7\n", "109\n103\n24\n46\n26\n25\n225\n120\n62\n111\n230\n1972\n503\n124\n20\n7\n", "113\n99\n24\n46\n25\n27\n225\n112\n62\n149\n230\n1972\n508\n1045\n20\n7\n", "109\n103\n24\n13\n26\n27\n354\n118\n74\n111\n230\n1972\n503\n1004\n20\n7\n", "109\n97\n24\n46\n25\n27\n225\n112\n62\n0\n71\n1972\n508\n873\n20\n7\n", "184\n103\n24\n24\n26\n27\n289\n116\n90\n111\n230\n1972\n508\n787\n0\n7\n", "109\n100\n24\n46\n25\n27\n225\n112\n23\n111\n145\n1972\n513\n1004\n40\n7\n", "109\n103\n24\n24\n28\n27\n237\n116\n62\n19\n180\n1972\n508\n1378\n20\n12\n", "109\n22\n33\n46\n25\n12\n225\n112\n62\n110\n230\n1972\n513\n1004\n20\n7\n", "109\n103\n24\n18\n25\n27\n237\n116\n17\n111\n230\n1009\n426\n752\n13\n7\n", "109\n103\n24\n4\n41\n27\n227\n28\n75\n161\n230\n1972\n184\n1004\n20\n7\n", "109\n103\n24\n24\n26\n27\n225\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n", "109\n103\n24\n24\n26\n27\n225\n116\n62\n111\n230\n1972\n508\n1004\n20\n7\n" ], "question": "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 floor(x)+floor(y);\n}\n\nint main()\n{\n\tint x,y,s,i,j,r;\n\tfor(;scanf(\"%d%d%d\",&x,&y,&s),x+y+s;)\n\t{\n\t\tr=0;\n\t\tfor(i=1;i<s;i++)\n\t\t\tfor(j=1;j<s;j++)\n\t\t\t{\n\t\t\t\tif(toT(i,j,x)==s)\n\t\t\t\t\tr=r>toT(i,j,y)?r:toT(i,j,y);\n\t\t\t}\n\t\tprintf(\"%d\\n\",r);\n\t}\n\treturn 0;\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.globl\ttoT\n\t.type\ttoT, @function\ntoT:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$48, %rsp\n\tmovl\t%edi, -20(%rbp)\n\tmovl\t%esi, -24(%rbp)\n\tmovl\t%edx, -28(%rbp)\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t-20(%rbp), %xmm1\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t-28(%rbp), %xmm2\n\tmovsd\t.LC0(%rip), %xmm0\n\taddsd\t%xmm2, %xmm0\n\tmovsd\t.LC0(%rip), %xmm2\n\tdivsd\t%xmm2, %xmm0\n\tmulsd\t%xmm0, %xmm1\n\tmovsd\t.LC1(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -16(%rbp)\n\tpxor\t%xmm1, %xmm1\n\tcvtsi2sdl\t-24(%rbp), %xmm1\n\tpxor\t%xmm2, %xmm2\n\tcvtsi2sdl\t-28(%rbp), %xmm2\n\tmovsd\t.LC0(%rip), %xmm0\n\taddsd\t%xmm2, %xmm0\n\tmovsd\t.LC0(%rip), %xmm2\n\tdivsd\t%xmm2, %xmm0\n\tmulsd\t%xmm0, %xmm1\n\tmovsd\t.LC1(%rip), %xmm0\n\taddsd\t%xmm1, %xmm0\n\tmovsd\t%xmm0, -8(%rbp)\n\tmovq\t-8(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tfloor@PLT\n\tmovsd\t%xmm0, -40(%rbp)\n\tmovq\t-16(%rbp), %rax\n\tmovq\t%rax, %xmm0\n\tcall\tfloor@PLT\n\taddsd\t-40(%rbp), %xmm0\n\tcvttsd2sil\t%xmm0, %eax\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\ttoT, .-toT\n\t.section\t.rodata\n.LC2:\n\t.string\t\"%d\\n\"\n.LC3:\n\t.string\t\"%d%d%d\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB1:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tjmp\t.L4\n.L12:\n\tmovl\t$0, -12(%rbp)\n\tmovl\t$1, -20(%rbp)\n\tjmp\t.L5\n.L11:\n\tmovl\t$1, -16(%rbp)\n\tjmp\t.L6\n.L10:\n\tmovl\t-32(%rbp), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\ttoT\n\tmovl\t-24(%rbp), %edx\n\tcmpl\t%edx, %eax\n\tjne\t.L7\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\ttoT\n\tcmpl\t%eax, -12(%rbp)\n\tjg\t.L8\n\tmovl\t-28(%rbp), %edx\n\tmovl\t-16(%rbp), %ecx\n\tmovl\t-20(%rbp), %eax\n\tmovl\t%ecx, %esi\n\tmovl\t%eax, %edi\n\tcall\ttoT\n\tjmp\t.L9\n.L8:\n\tmovl\t-12(%rbp), %eax\n.L9:\n\tmovl\t%eax, -12(%rbp)\n.L7:\n\taddl\t$1, -16(%rbp)\n.L6:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -16(%rbp)\n\tjl\t.L10\n\taddl\t$1, -20(%rbp)\n.L5:\n\tmovl\t-24(%rbp), %eax\n\tcmpl\t%eax, -20(%rbp)\n\tjl\t.L11\n\tmovl\t-12(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L4:\n\tleaq\t-24(%rbp), %rcx\n\tleaq\t-28(%rbp), %rdx\n\tleaq\t-32(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-32(%rbp), %edx\n\tmovl\t-28(%rbp), %eax\n\taddl\t%eax, %edx\n\tmovl\t-24(%rbp), %eax\n\taddl\t%edx, %eax\n\ttestl\t%eax, %eax\n\tjne\t.L12\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE1:\n\t.size\tmain, .-main\n\t.section\t.rodata\n\t.align 8\n.LC0:\n\t.long\t0\n\t.long\t1079574528\n\t.align 8\n.LC1:\n\t.long\t-400107883\n\t.long\t1041313291\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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,y,s,i,j,r; for(;scanf("%d%d%d",&x,&y,&s),x+y+s;) { r=0; for(i=1;i<s;i++) for(j=1;j<s;j++) { if(toT(i,j,x)==s) r=r>toT(i,j,y)?r:toT(i,j,y); } printf("%d\n",r); } return 0; } Unoptimized Assembly Code: .file "temp.c" .text .globl toT .type toT, @function toT: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $48, %rsp movl %edi, -20(%rbp) movl %esi, -24(%rbp) movl %edx, -28(%rbp) pxor %xmm1, %xmm1 cvtsi2sdl -20(%rbp), %xmm1 pxor %xmm2, %xmm2 cvtsi2sdl -28(%rbp), %xmm2 movsd .LC0(%rip), %xmm0 addsd %xmm2, %xmm0 movsd .LC0(%rip), %xmm2 divsd %xmm2, %xmm0 mulsd %xmm0, %xmm1 movsd .LC1(%rip), %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, -16(%rbp) pxor %xmm1, %xmm1 cvtsi2sdl -24(%rbp), %xmm1 pxor %xmm2, %xmm2 cvtsi2sdl -28(%rbp), %xmm2 movsd .LC0(%rip), %xmm0 addsd %xmm2, %xmm0 movsd .LC0(%rip), %xmm2 divsd %xmm2, %xmm0 mulsd %xmm0, %xmm1 movsd .LC1(%rip), %xmm0 addsd %xmm1, %xmm0 movsd %xmm0, -8(%rbp) movq -8(%rbp), %rax movq %rax, %xmm0 call floor@PLT movsd %xmm0, -40(%rbp) movq -16(%rbp), %rax movq %rax, %xmm0 call floor@PLT addsd -40(%rbp), %xmm0 cvttsd2sil %xmm0, %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size toT, .-toT .section .rodata .LC2: .string "%d\n" .LC3: .string "%d%d%d" .text .globl main .type main, @function main: .LFB1: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax jmp .L4 .L12: movl $0, -12(%rbp) movl $1, -20(%rbp) jmp .L5 .L11: movl $1, -16(%rbp) jmp .L6 .L10: movl -32(%rbp), %edx movl -16(%rbp), %ecx movl -20(%rbp), %eax movl %ecx, %esi movl %eax, %edi call toT movl -24(%rbp), %edx cmpl %edx, %eax jne .L7 movl -28(%rbp), %edx movl -16(%rbp), %ecx movl -20(%rbp), %eax movl %ecx, %esi movl %eax, %edi call toT cmpl %eax, -12(%rbp) jg .L8 movl -28(%rbp), %edx movl -16(%rbp), %ecx movl -20(%rbp), %eax movl %ecx, %esi movl %eax, %edi call toT jmp .L9 .L8: movl -12(%rbp), %eax .L9: movl %eax, -12(%rbp) .L7: addl $1, -16(%rbp) .L6: movl -24(%rbp), %eax cmpl %eax, -16(%rbp) jl .L10 addl $1, -20(%rbp) .L5: movl -24(%rbp), %eax cmpl %eax, -20(%rbp) jl .L11 movl -12(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L4: leaq -24(%rbp), %rcx leaq -28(%rbp), %rdx leaq -32(%rbp), %rax movq %rax, %rsi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -32(%rbp), %edx movl -28(%rbp), %eax addl %eax, %edx movl -24(%rbp), %eax addl %edx, %eax testl %eax, %eax jne .L12 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L14 call __stack_chk_fail@PLT .L14: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE1: .size main, .-main .section .rodata .align 8 .LC0: .long 0 .long 1079574528 .align 8 .LC1: .long -400107883 .long 1041313291 .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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<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 (n == 1) { printf(\"2 1\\n1 2 0\"); }\n\tfor (int i = 1; i <= 20; i++) {\n\t\ttwo[i] = 2 * two[i - 1];\n\t}\n\tfor (int i = 0; i <= 19; i++) {\n\t\tif ((n / two[i]) % 2 == 1) { \n\t\t\tnum[i+1] = 1;\n\t\t\tkosuu = i+1; \n\t\t\then++;\n\t\t}\n\t}\n \t\n \n\then += 2 * kosuu-3;\n\tprintf(\"%d %d\\n\", kosuu, hen);\n\tfor (int i = 1; i < kosuu; i++) {\n\t\tprintf(\"%d %d 0\\n%d %d %d\\n\", i, i + 1, i, i + 1, two[i - 1]);\n\t}\n\tmemo = two[kosuu-1];\n\tfor (int i = kosuu-1; i >0; i--) {\n\t\tif (num[i] == 1) {\n\t\t\tprintf(\"%d %d %d\\n\", i, kosuu, memo);\n\t\t\tmemo += two[i-1];\n\t\t}\n\t}\n\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$256, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-224(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$12, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tleaq\t-112(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$12, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tmovl\t$0, -248(%rbp)\n\tmovl\t$1, -224(%rbp)\n\tleaq\t-256(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-256(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L2\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L2:\n\tmovl\t$1, -240(%rbp)\n\tjmp\t.L3\n.L4:\n\tmovl\t-240(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-240(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -224(%rbp,%rax,4)\n\taddl\t$1, -240(%rbp)\n.L3:\n\tcmpl\t$20, -240(%rbp)\n\tjle\t.L4\n\tmovl\t$0, -236(%rbp)\n\tjmp\t.L5\n.L7:\n\tmovl\t-256(%rbp), %eax\n\tmovl\t-236(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t-224(%rbp,%rdx,4), %esi\n\tcltd\n\tidivl\t%esi\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tshrl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L6\n\tmovl\t-236(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$1, -112(%rbp,%rax,4)\n\tmovl\t-236(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -252(%rbp)\n\taddl\t$1, -248(%rbp)\n.L6:\n\taddl\t$1, -236(%rbp)\n.L5:\n\tcmpl\t$19, -236(%rbp)\n\tjle\t.L7\n\tmovl\t-252(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$3, %eax\n\taddl\t%eax, -248(%rbp)\n\tmovl\t-248(%rbp), %edx\n\tmovl\t-252(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$1, -232(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-232(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %ecx\n\tmovl\t-232(%rbp), %eax\n\tleal\t1(%rax), %edi\n\tmovl\t-232(%rbp), %eax\n\tleal\t1(%rax), %esi\n\tmovl\t-232(%rbp), %edx\n\tmovl\t-232(%rbp), %eax\n\tmovl\t%ecx, %r9d\n\tmovl\t%edi, %r8d\n\tmovl\t%edx, %ecx\n\tmovl\t%esi, %edx\n\tmovl\t%eax, %esi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -232(%rbp)\n.L8:\n\tmovl\t-232(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjl\t.L9\n\tmovl\t-252(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %eax\n\tmovl\t%eax, -244(%rbp)\n\tmovl\t-252(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -228(%rbp)\n\tjmp\t.L10\n.L12:\n\tmovl\t-228(%rbp), %eax\n\tcltq\n\tmovl\t-112(%rbp,%rax,4), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L11\n\tmovl\t-244(%rbp), %ecx\n\tmovl\t-252(%rbp), %edx\n\tmovl\t-228(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t-228(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %eax\n\taddl\t%eax, -244(%rbp)\n.L11:\n\tsubl\t$1, -228(%rbp)\n.L10:\n\tcmpl\t$0, -228(%rbp)\n\tjg\t.L12\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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.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.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t$12, %ecx\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$264, %rsp\n\t.cfi_def_cfa_offset 320\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 248(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t32(%rsp), %r12\n\tleaq\t28(%rsp), %rsi\n\tmovq\t%r12, %rdi\n\tleaq\t144(%rsp), %rbx\n\trep stosq\n\tmovl\t$12, %ecx\n\tmovl\t$1, 32(%rsp)\n\tmovl\t$0, (%rdi)\n\tmovq\t%rbx, %rdi\n\trep stosq\n\tmovl\t$0, (%rdi)\n\tleaq\t.LC0(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %esi\n\tcmpl\t$1, %esi\n\tje\t.L23\n.L2:\n\tleaq\t36(%rsp), %rax\n\tleaq\t116(%rsp), %rcx\n\tmovl\t$1, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddl\t%edx, %edx\n\taddq\t$4, %rax\n\tmovl\t%edx, -4(%rax)\n\tcmpq\t%rax, %rcx\n\tjne\t.L3\n\tmovl\t$1, %ecx\n\txorl\t%edi, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t%esi, %eax\n\tcltd\n\tidivl\t-4(%r12,%rcx,4)\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L4\n\tmovl\t$1, (%rbx,%rcx,4)\n\taddl\t$1, %edi\n\tmovl\t%ecx, %ebp\n.L4:\n\taddq\t$1, %rcx\n\tcmpq\t$21, %rcx\n\tjne\t.L5\n\tleal\t-3(%rdi,%rbp,2), %ecx\n\tmovl\t%ebp, %edx\n\tleaq\t.LC2(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tleal\t-1(%rbp), %eax\n\tmovl\t%eax, 12(%rsp)\n\tcmpl\t$1, %ebp\n\tje\t.L6\n\tmovslq\t%ebp, %r15\n\tmovl\t$1, %r13d\n\tleaq\t.LC3(%rip), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t-4(%r12,%r13,4), %eax\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 328\n\tleal\t1(%r13), %ecx\n\tmovl\t%r13d, %edx\n\tmovl\t%r13d, %r8d\n\tmovl\t%ecx, %r9d\n\tmovq\t%r14, %rsi\n\tmovl\t$1, %edi\n\tpushq\t%rax\n\t.cfi_def_cfa_offset 336\n\taddq\t$1, %r13\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tpopq\t%rax\n\t.cfi_def_cfa_offset 328\n\tpopq\t%rdx\n\t.cfi_def_cfa_offset 320\n\tcmpq\t%r15, %r13\n\tjne\t.L7\n.L9:\n\tmovslq\t12(%rsp), %r13\n\tleaq\t.LC4(%rip), %r15\n\tmovl\t32(%rsp,%r13,4), %r14d\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tsubq\t$1, %r13\n\ttestl\t%r13d, %r13d\n\tje\t.L12\n.L11:\n\tcmpl\t$1, (%rbx,%r13,4)\n\tmovl\t%r13d, %edx\n\tjne\t.L10\n\tmovl\t%r14d, %r8d\n\tmovl\t%ebp, %ecx\n\tmovq\t%r15, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\taddl\t-4(%r12,%r13,4), %r14d\n\tsubq\t$1, %r13\n\ttestl\t%r13d, %r13d\n\tjne\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t248(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L24\n\taddq\t$264, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L23:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovl\t28(%rsp), %esi\n\tjmp\t.L2\n.L6:\n\tcmpl\t$0, 12(%rsp)\n\tje\t.L12\n\tjmp\t.L9\n.L24:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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 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.cfi_def_cfa_offset 16\n\t.cfi_offset 15, -16\n\tmovl\t$12, %ecx\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.cfi_offset 13, -32\n\tpushq\t%r12\n\t.cfi_def_cfa_offset 40\n\t.cfi_offset 12, -40\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 48\n\t.cfi_offset 6, -48\n\tpushq\t%rbx\n\t.cfi_def_cfa_offset 56\n\t.cfi_offset 3, -56\n\tsubq\t$264, %rsp\n\t.cfi_def_cfa_offset 320\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 248(%rsp)\n\txorl\t%eax, %eax\n\tleaq\t32(%rsp), %r12\n\tleaq\t28(%rsp), %rsi\n\tmovq\t%r12, %rdi\n\tleaq\t144(%rsp), %rbx\n\trep stosq\n\tmovl\t$12, %ecx\n\tmovl\t$1, 32(%rsp)\n\tmovl\t$0, (%rdi)\n\tmovq\t%rbx, %rdi\n\trep stosq\n\tmovl\t$0, (%rdi)\n\tleaq\t.LC0(%rip), %rdi\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t28(%rsp), %esi\n\tcmpl\t$1, %esi\n\tje\t.L23\n.L2:\n\tleaq\t36(%rsp), %rax\n\tleaq\t116(%rsp), %rcx\n\tmovl\t$1, %edx\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddl\t%edx, %edx\n\taddq\t$4, %rax\n\tmovl\t%edx, -4(%rax)\n\tcmpq\t%rax, %rcx\n\tjne\t.L3\n\tmovl\t$1, %ecx\n\txorl\t%edi, %edi\n\t.p2align 4,,10\n\t.p2align 3\n.L5:\n\tmovl\t%esi, %eax\n\tcltd\n\tidivl\t-4(%r12,%rcx,4)\n\tmovl\t%eax, %edx\n\tshrl\t$31, %edx\n\taddl\t%edx, %eax\n\tandl\t$1, %eax\n\tsubl\t%edx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L4\n\tmovl\t$1, (%rbx,%rcx,4)\n\taddl\t$1, %edi\n\tmovl\t%ecx, %ebp\n.L4:\n\taddq\t$1, %rcx\n\tcmpq\t$21, %rcx\n\tjne\t.L5\n\tleal\t-3(%rdi,%rbp,2), %ecx\n\tmovl\t%ebp, %edx\n\tleaq\t.LC2(%rip), %rsi\n\txorl\t%eax, %eax\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tleal\t-1(%rbp), %eax\n\tmovl\t%eax, 12(%rsp)\n\tcmpl\t$1, %ebp\n\tje\t.L6\n\tmovslq\t%ebp, %r15\n\tmovl\t$1, %r13d\n\tleaq\t.LC3(%rip), %r14\n\t.p2align 4,,10\n\t.p2align 3\n.L7:\n\tmovl\t-4(%r12,%r13,4), %eax\n\tsubq\t$8, %rsp\n\t.cfi_def_cfa_offset 328\n\tleal\t1(%r13), %ecx\n\tmovl\t%r13d, %edx\n\tmovl\t%r13d, %r8d\n\tmovl\t%ecx, %r9d\n\tmovq\t%r14, %rsi\n\tmovl\t$1, %edi\n\tpushq\t%rax\n\t.cfi_def_cfa_offset 336\n\taddq\t$1, %r13\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tpopq\t%rax\n\t.cfi_def_cfa_offset 328\n\tpopq\t%rdx\n\t.cfi_def_cfa_offset 320\n\tcmpq\t%r15, %r13\n\tjne\t.L7\n.L9:\n\tmovslq\t12(%rsp), %r13\n\tleaq\t.LC4(%rip), %r15\n\tmovl\t32(%rsp,%r13,4), %r14d\n\tjmp\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L10:\n\tsubq\t$1, %r13\n\ttestl\t%r13d, %r13d\n\tje\t.L12\n.L11:\n\tcmpl\t$1, (%rbx,%r13,4)\n\tmovl\t%r13d, %edx\n\tjne\t.L10\n\tmovl\t%r14d, %r8d\n\tmovl\t%ebp, %ecx\n\tmovq\t%r15, %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\taddl\t-4(%r12,%r13,4), %r14d\n\tsubq\t$1, %r13\n\ttestl\t%r13d, %r13d\n\tjne\t.L11\n\t.p2align 4,,10\n\t.p2align 3\n.L12:\n\tmovq\t248(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L24\n\taddq\t$264, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 56\n\txorl\t%eax, %eax\n\tpopq\t%rbx\n\t.cfi_def_cfa_offset 48\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 40\n\tpopq\t%r12\n\t.cfi_def_cfa_offset 32\n\tpopq\t%r13\n\t.cfi_def_cfa_offset 24\n\tpopq\t%r14\n\t.cfi_def_cfa_offset 16\n\tpopq\t%r15\n\t.cfi_def_cfa_offset 8\n\tret\n.L23:\n\t.cfi_restore_state\n\tleaq\t.LC1(%rip), %rsi\n\tmovl\t$1, %edi\n\txorl\t%eax, %eax\n\tcall\t__printf_chk@PLT\n\tmovl\t28(%rsp), %esi\n\tjmp\t.L2\n.L6:\n\tcmpl\t$0, 12(%rsp)\n\tje\t.L12\n\tjmp\t.L9\n.L24:\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE39:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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 (n == 1) { printf(\"2 1\\n1 2 0\"); }\n\tfor (int i = 1; i <= 20; i++) {\n\t\ttwo[i] = 2 * two[i - 1];\n\t}\n\tfor (int i = 0; i <= 19; i++) {\n\t\tif ((n / two[i]) % 2 == 1) { \n\t\t\tnum[i+1] = 1;\n\t\t\tkosuu = i+1; \n\t\t\then++;\n\t\t}\n\t}\n \t\n \n\then += 2 * kosuu-3;\n\tprintf(\"%d %d\\n\", kosuu, hen);\n\tfor (int i = 1; i < kosuu; i++) {\n\t\tprintf(\"%d %d 0\\n%d %d %d\\n\", i, i + 1, i, i + 1, two[i - 1]);\n\t}\n\tmemo = two[kosuu-1];\n\tfor (int i = kosuu-1; i >0; i--) {\n\t\tif (num[i] == 1) {\n\t\t\tprintf(\"%d %d %d\\n\", i, kosuu, memo);\n\t\t\tmemo += two[i-1];\n\t\t}\n\t}\n\n}", "index": 127, "inputs": [ "8\n", "2\n", "1\n", "9\n", "6\n", "3\n", "10\n", "17\n", "18\n", "33\n", "16\n", "12\n", "20\n", "40\n", "36\n", "32\n", "65\n", "24\n", "34\n", "66\n", "48\n", "68\n", "72\n", "129\n", "64\n", "130\n", "136\n", "80\n", "160\n", "96\n", "144\n", "132\n", "192\n", "257\n", "128\n", "260\n", "288\n", "264\n", "320\n", "258\n", "256\n", "384\n", "272\n", "512\n", "576\n", "516\n", "514\n", "001\n", "1\n", "3\n", "2\n", "6\n", "12\n", "8\n", "10\n", "16\n", "9\n", "17\n", "20\n", "18\n", "24\n", "32\n", "40\n", "65\n", "48\n", "34\n", "33\n", "64\n", "36\n", "66\n", "72\n", "128\n", "001\n", "68\n", "129\n", "132\n", "160\n", "130\n", "80\n", "136\n", "96\n", "256\n", "192\n", "258\n", "144\n", "272\n", "264\n", "288\n", "257\n", "320\n", "260\n", "4\n", "4\n", "5\n" ], "outputs": [ "4 6\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n", "2 2\n1 2 0\n1 2 1\n", "2 1\n1 2 01 0\n", "4 7\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n1 4 8\n", "3 5\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n2 3 4\n", "2 3\n1 2 0\n1 2 1\n1 2 2\n", "4 7\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n2 4 8\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n1 5 16\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n2 5 16\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n1 6 32\n", "5 8\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n", "4 7\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n3 4 8\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n3 5 16\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n4 6 32\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n3 6 32\n", "6 10\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n1 7 64\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n4 5 16\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n2 6 32\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n2 7 64\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n5 6 32\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n3 7 64\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n4 7 64\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n1 8 128\n", "7 12\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n2 8 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n4 8 128\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n5 7 64\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n6 8 128\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n6 7 64\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n5 8 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n3 8 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n7 8 128\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n1 9 256\n", "8 14\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n3 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n6 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n4 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n7 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n2 9 256\n", "9 16\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n8 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n5 9 256\n", "10 18\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n9 10 0\n9 10 256\n", "10 19\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n9 10 0\n9 10 256\n7 10 512\n", "10 19\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n9 10 0\n9 10 256\n3 10 512\n", "10 19\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n9 10 0\n9 10 256\n2 10 512\n", "2 1\n1 2 01 0\n", "2 1\n1 2 01 0\n", "2 3\n1 2 0\n1 2 1\n1 2 2\n", "2 2\n1 2 0\n1 2 1\n", "3 5\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n2 3 4\n", "4 7\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n3 4 8\n", "4 6\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n", "4 7\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n2 4 8\n", "5 8\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n", "4 7\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n1 4 8\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n1 5 16\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n3 5 16\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n2 5 16\n", "5 9\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n4 5 16\n", "6 10\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n4 6 32\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n1 7 64\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n5 6 32\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n2 6 32\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n1 6 32\n", "7 12\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n", "6 11\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n3 6 32\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n2 7 64\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n4 7 64\n", "8 14\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n", "2 1\n1 2 01 0\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n3 7 64\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n1 8 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n3 8 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n6 8 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n2 8 128\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n5 7 64\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n4 8 128\n", "7 13\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n6 7 64\n", "9 16\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n7 8 128\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n2 9 256\n", "8 15\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n5 8 128\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n5 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n4 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n6 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n1 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n7 9 256\n", "9 17\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n3 4 0\n3 4 4\n4 5 0\n4 5 8\n5 6 0\n5 6 16\n6 7 0\n6 7 32\n7 8 0\n7 8 64\n8 9 0\n8 9 128\n3 9 256\n", "3 4\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n", "3 4\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n", "3 5\n1 2 0\n1 2 1\n2 3 0\n2 3 2\n1 3 4\n" ], "question": "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 (n == 1) { printf(\"2 1\\n1 2 0\"); }\n\tfor (int i = 1; i <= 20; i++) {\n\t\ttwo[i] = 2 * two[i - 1];\n\t}\n\tfor (int i = 0; i <= 19; i++) {\n\t\tif ((n / two[i]) % 2 == 1) { \n\t\t\tnum[i+1] = 1;\n\t\t\tkosuu = i+1; \n\t\t\then++;\n\t\t}\n\t}\n \t\n \n\then += 2 * kosuu-3;\n\tprintf(\"%d %d\\n\", kosuu, hen);\n\tfor (int i = 1; i < kosuu; i++) {\n\t\tprintf(\"%d %d 0\\n%d %d %d\\n\", i, i + 1, i, i + 1, two[i - 1]);\n\t}\n\tmemo = two[kosuu-1];\n\tfor (int i = kosuu-1; i >0; i--) {\n\t\tif (num[i] == 1) {\n\t\t\tprintf(\"%d %d %d\\n\", i, kosuu, memo);\n\t\t\tmemo += two[i-1];\n\t\t}\n\t}\n\n}\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\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.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB6:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$256, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tleaq\t-224(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$12, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tleaq\t-112(%rbp), %rdx\n\tmovl\t$0, %eax\n\tmovl\t$12, %ecx\n\tmovq\t%rdx, %rdi\n\trep stosq\n\tmovq\t%rdi, %rdx\n\tmovl\t%eax, (%rdx)\n\taddq\t$4, %rdx\n\tmovl\t$0, -248(%rbp)\n\tmovl\t$1, -224(%rbp)\n\tleaq\t-256(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tmovl\t-256(%rbp), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L2\n\tleaq\t.LC1(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n.L2:\n\tmovl\t$1, -240(%rbp)\n\tjmp\t.L3\n.L4:\n\tmovl\t-240(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %eax\n\tleal\t(%rax,%rax), %edx\n\tmovl\t-240(%rbp), %eax\n\tcltq\n\tmovl\t%edx, -224(%rbp,%rax,4)\n\taddl\t$1, -240(%rbp)\n.L3:\n\tcmpl\t$20, -240(%rbp)\n\tjle\t.L4\n\tmovl\t$0, -236(%rbp)\n\tjmp\t.L5\n.L7:\n\tmovl\t-256(%rbp), %eax\n\tmovl\t-236(%rbp), %edx\n\tmovslq\t%edx, %rdx\n\tmovl\t-224(%rbp,%rdx,4), %esi\n\tcltd\n\tidivl\t%esi\n\tmovl\t%eax, %edx\n\tmovl\t%edx, %eax\n\tsarl\t$31, %eax\n\tshrl\t$31, %eax\n\tmovl\t%eax, %ecx\n\tleal\t(%rdx,%rcx), %eax\n\tandl\t$1, %eax\n\tsubl\t%ecx, %eax\n\tcmpl\t$1, %eax\n\tjne\t.L6\n\tmovl\t-236(%rbp), %eax\n\taddl\t$1, %eax\n\tcltq\n\tmovl\t$1, -112(%rbp,%rax,4)\n\tmovl\t-236(%rbp), %eax\n\taddl\t$1, %eax\n\tmovl\t%eax, -252(%rbp)\n\taddl\t$1, -248(%rbp)\n.L6:\n\taddl\t$1, -236(%rbp)\n.L5:\n\tcmpl\t$19, -236(%rbp)\n\tjle\t.L7\n\tmovl\t-252(%rbp), %eax\n\taddl\t%eax, %eax\n\tsubl\t$3, %eax\n\taddl\t%eax, -248(%rbp)\n\tmovl\t-248(%rbp), %edx\n\tmovl\t-252(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC2(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$1, -232(%rbp)\n\tjmp\t.L8\n.L9:\n\tmovl\t-232(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %ecx\n\tmovl\t-232(%rbp), %eax\n\tleal\t1(%rax), %edi\n\tmovl\t-232(%rbp), %eax\n\tleal\t1(%rax), %esi\n\tmovl\t-232(%rbp), %edx\n\tmovl\t-232(%rbp), %eax\n\tmovl\t%ecx, %r9d\n\tmovl\t%edi, %r8d\n\tmovl\t%edx, %ecx\n\tmovl\t%esi, %edx\n\tmovl\t%eax, %esi\n\tleaq\t.LC3(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\taddl\t$1, -232(%rbp)\n.L8:\n\tmovl\t-232(%rbp), %eax\n\tcmpl\t-252(%rbp), %eax\n\tjl\t.L9\n\tmovl\t-252(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %eax\n\tmovl\t%eax, -244(%rbp)\n\tmovl\t-252(%rbp), %eax\n\tsubl\t$1, %eax\n\tmovl\t%eax, -228(%rbp)\n\tjmp\t.L10\n.L12:\n\tmovl\t-228(%rbp), %eax\n\tcltq\n\tmovl\t-112(%rbp,%rax,4), %eax\n\tcmpl\t$1, %eax\n\tjne\t.L11\n\tmovl\t-244(%rbp), %ecx\n\tmovl\t-252(%rbp), %edx\n\tmovl\t-228(%rbp), %eax\n\tmovl\t%eax, %esi\n\tleaq\t.LC4(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t-228(%rbp), %eax\n\tsubl\t$1, %eax\n\tcltq\n\tmovl\t-224(%rbp,%rax,4), %eax\n\taddl\t%eax, -244(%rbp)\n.L11:\n\tsubl\t$1, -228(%rbp)\n.L10:\n\tcmpl\t$0, -228(%rbp)\n\tjg\t.L12\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L14\n\tcall\t__stack_chk_fail@PLT\n.L14:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE6:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 (int i = 1; i <= 20; i++) { two[i] = 2 * two[i - 1]; } for (int i = 0; i <= 19; i++) { if ((n / two[i]) % 2 == 1) { num[i+1] = 1; kosuu = i+1; hen++; } } hen += 2 * kosuu-3; printf("%d %d\n", kosuu, hen); for (int i = 1; i < kosuu; i++) { printf("%d %d 0\n%d %d %d\n", i, i + 1, i, i + 1, two[i - 1]); } memo = two[kosuu-1]; for (int i = kosuu-1; i >0; i--) { if (num[i] == 1) { printf("%d %d %d\n", i, kosuu, memo); memo += two[i-1]; } } } Unoptimized Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%d" .LC1: .string "2 1\n1 2 0" .LC2: .string "%d %d\n" .LC3: .string "%d %d 0\n%d %d %d\n" .LC4: .string "%d %d %d\n" .text .globl main .type main, @function main: .LFB6: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $256, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax leaq -224(%rbp), %rdx movl $0, %eax movl $12, %ecx movq %rdx, %rdi rep stosq movq %rdi, %rdx movl %eax, (%rdx) addq $4, %rdx leaq -112(%rbp), %rdx movl $0, %eax movl $12, %ecx movq %rdx, %rdi rep stosq movq %rdi, %rdx movl %eax, (%rdx) addq $4, %rdx movl $0, -248(%rbp) movl $1, -224(%rbp) leaq -256(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT movl -256(%rbp), %eax cmpl $1, %eax jne .L2 leaq .LC1(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT .L2: movl $1, -240(%rbp) jmp .L3 .L4: movl -240(%rbp), %eax subl $1, %eax cltq movl -224(%rbp,%rax,4), %eax leal (%rax,%rax), %edx movl -240(%rbp), %eax cltq movl %edx, -224(%rbp,%rax,4) addl $1, -240(%rbp) .L3: cmpl $20, -240(%rbp) jle .L4 movl $0, -236(%rbp) jmp .L5 .L7: movl -256(%rbp), %eax movl -236(%rbp), %edx movslq %edx, %rdx movl -224(%rbp,%rdx,4), %esi cltd idivl %esi movl %eax, %edx movl %edx, %eax sarl $31, %eax shrl $31, %eax movl %eax, %ecx leal (%rdx,%rcx), %eax andl $1, %eax subl %ecx, %eax cmpl $1, %eax jne .L6 movl -236(%rbp), %eax addl $1, %eax cltq movl $1, -112(%rbp,%rax,4) movl -236(%rbp), %eax addl $1, %eax movl %eax, -252(%rbp) addl $1, -248(%rbp) .L6: addl $1, -236(%rbp) .L5: cmpl $19, -236(%rbp) jle .L7 movl -252(%rbp), %eax addl %eax, %eax subl $3, %eax addl %eax, -248(%rbp) movl -248(%rbp), %edx movl -252(%rbp), %eax movl %eax, %esi leaq .LC2(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $1, -232(%rbp) jmp .L8 .L9: movl -232(%rbp), %eax subl $1, %eax cltq movl -224(%rbp,%rax,4), %ecx movl -232(%rbp), %eax leal 1(%rax), %edi movl -232(%rbp), %eax leal 1(%rax), %esi movl -232(%rbp), %edx movl -232(%rbp), %eax movl %ecx, %r9d movl %edi, %r8d movl %edx, %ecx movl %esi, %edx movl %eax, %esi leaq .LC3(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT addl $1, -232(%rbp) .L8: movl -232(%rbp), %eax cmpl -252(%rbp), %eax jl .L9 movl -252(%rbp), %eax subl $1, %eax cltq movl -224(%rbp,%rax,4), %eax movl %eax, -244(%rbp) movl -252(%rbp), %eax subl $1, %eax movl %eax, -228(%rbp) jmp .L10 .L12: movl -228(%rbp), %eax cltq movl -112(%rbp,%rax,4), %eax cmpl $1, %eax jne .L11 movl -244(%rbp), %ecx movl -252(%rbp), %edx movl -228(%rbp), %eax movl %eax, %esi leaq .LC4(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl -228(%rbp), %eax subl $1, %eax cltq movl -224(%rbp,%rax,4), %eax addl %eax, -244(%rbp) .L11: subl $1, -228(%rbp) .L10: cmpl $0, -228(%rbp) jg .L12 movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L14 call __stack_chk_fail@PLT .L14: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other 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\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(\"%lu\", r - 1);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lu\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tjmp\t.L2\n.L3:\n\tmovq\t-24(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -24(%rbp)\n\tsalq\t-16(%rbp)\n.L2:\n\tmovq\t-24(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjne\t.L3\n\tmovq\t-16(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "role": "user" } ]
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_offset 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tmovq\t$0, (%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rax\n\tmovl\t$1, %edx\n\ttestq\t%rax, %rax\n\tje\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t%rdx, %rdx\n\tshrq\t%rax\n\tjne\t.L3\n\tmovq\t$0, (%rsp)\n.L2:\n\tsubq\t$1, %rdx\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L9:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "style": "rule" }
{ "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 6, -16\n\tleaq\t.LC0(%rip), %rbp\n\tmovq\t%rbp, %rdi\n\tsubq\t$16, %rsp\n\t.cfi_def_cfa_offset 32\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, 8(%rsp)\n\txorl\t%eax, %eax\n\tmovq\t%rsp, %rsi\n\tmovq\t$0, (%rsp)\n\tcall\t__isoc99_scanf@PLT\n\tmovq\t(%rsp), %rax\n\tmovl\t$1, %edx\n\ttestq\t%rax, %rax\n\tje\t.L2\n\t.p2align 4,,10\n\t.p2align 3\n.L3:\n\taddq\t%rdx, %rdx\n\tshrq\t%rax\n\tjne\t.L3\n\tmovq\t$0, (%rsp)\n.L2:\n\tsubq\t$1, %rdx\n\txorl\t%eax, %eax\n\tmovq\t%rbp, %rsi\n\tmovl\t$1, %edi\n\tcall\t__printf_chk@PLT\n\tmovq\t8(%rsp), %rax\n\tsubq\t%fs:40, %rax\n\tjne\t.L9\n\taddq\t$16, %rsp\n\t.cfi_remember_state\n\t.cfi_def_cfa_offset 16\n\txorl\t%eax, %eax\n\tpopq\t%rbp\n\t.cfi_def_cfa_offset 8\n\tret\n.L9:\n\t.cfi_restore_state\n\tcall\t__stack_chk_fail@PLT\n\t.cfi_endproc\n.LFE23:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n", "code": "#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(\"%lu\", r - 1);\n}\n", "index": 111, "inputs": [ "8\n", "1010000000000\n", "3\n", "7\n", "1\n", "18\n", "1110100001000\n", "46\n", "77\n", "140\n", "426\n", "635\n", "1010000001000\n", "5\n", "1011000000000\n", "6\n", "14\n", "1010001000000\n", "12\n", "1010100001000\n", "10\n", "1011000000010\n", "1010001000010\n", "13\n", "15\n", "1111000000010\n", "31\n", "1010001000011\n", "22\n", "19\n", "1111000001010\n", "11\n", "1111000001110\n", "1111000011110\n", "1111100011110\n", "126\n", "1011000011110\n", "200\n", "1011000011100\n", "47\n", "1011000011101\n", "32\n", "1011000011111\n", "20\n", "1011000010111\n", "9\n", "1011000000111\n", "17\n", "1011000000011\n", "23\n", "43\n", "1000001000000\n", "34\n", "16\n", "1010000010000\n", "33\n", "1010000001001\n", "21\n", "1010000000010\n", "28\n", "1010001001000\n", "1010100001010\n", "26\n", "1001000000011\n", "25\n", "1010101000010\n", "37\n", "1110100001001\n", "51\n", "1111000001011\n", "61\n", "1011001000011\n", "36\n", "24\n", "1111010001010\n", "81\n", "29\n", "1111000101110\n", "153\n", "1111000010110\n", "79\n", "1110000011110\n", "53\n", "1011000111110\n", "171\n", "1010000011100\n", "60\n", "1010000011101\n", "90\n", "1011001011111\n", "1111000000011\n", "35\n", "27\n", "38\n", "40\n", "1010000010010\n", "39\n", "1010000000001\n", "63\n", "1011000000110\n", "4\n", "2\n", "2\n", "1000000000000\n" ], "outputs": [ "15", "1099511627775", "3", "7", "1", "31", "2199023255551", "63", "127", "255", "511", "1023", "1099511627775", "7", "1099511627775", "7", "15", "1099511627775", "15", "1099511627775", "15", "1099511627775", "1099511627775", "15", "15", "2199023255551", "31", "1099511627775", "31", "31", "2199023255551", "15", "2199023255551", "2199023255551", "2199023255551", "127", "1099511627775", "255", "1099511627775", "63", "1099511627775", "63", "1099511627775", "31", "1099511627775", "15", "1099511627775", "31", "1099511627775", "31", "63", "1099511627775", "63", "31", "1099511627775", "63", "1099511627775", "31", "1099511627775", "31", "1099511627775", "1099511627775", "31", "1099511627775", "31", "1099511627775", "63", "2199023255551", "63", "2199023255551", "63", "1099511627775", "63", "31", "2199023255551", "127", "31", "2199023255551", "255", "2199023255551", "127", "2199023255551", "63", "1099511627775", "255", "1099511627775", "63", "1099511627775", "127", "1099511627775", "2199023255551", "63", "31", "63", "63", "1099511627775", "63", "1099511627775", "63", "1099511627775", "7", "3", "3", "1099511627775" ], "question": "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(\"%lu\", r - 1);\n}\n\n\nUnoptimized Assembly Code:\n\n\t.file\t\"temp.c\"\n\t.text\n\t.section\t.rodata\n.LC0:\n\t.string\t\"%lu\"\n\t.text\n\t.globl\tmain\n\t.type\tmain, @function\nmain:\n.LFB0:\n\t.cfi_startproc\n\tendbr64\n\tpushq\t%rbp\n\t.cfi_def_cfa_offset 16\n\t.cfi_offset 6, -16\n\tmovq\t%rsp, %rbp\n\t.cfi_def_cfa_register 6\n\tsubq\t$32, %rsp\n\tmovq\t%fs:40, %rax\n\tmovq\t%rax, -8(%rbp)\n\txorl\t%eax, %eax\n\tmovq\t$0, -24(%rbp)\n\tmovq\t$1, -16(%rbp)\n\tleaq\t-24(%rbp), %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\t__isoc99_scanf@PLT\n\tjmp\t.L2\n.L3:\n\tmovq\t-24(%rbp), %rax\n\tshrq\t%rax\n\tmovq\t%rax, -24(%rbp)\n\tsalq\t-16(%rbp)\n.L2:\n\tmovq\t-24(%rbp), %rax\n\ttestq\t%rax, %rax\n\tjne\t.L3\n\tmovq\t-16(%rbp), %rax\n\tsubq\t$1, %rax\n\tmovq\t%rax, %rsi\n\tleaq\t.LC0(%rip), %rax\n\tmovq\t%rax, %rdi\n\tmovl\t$0, %eax\n\tcall\tprintf@PLT\n\tmovl\t$0, %eax\n\tmovq\t-8(%rbp), %rdx\n\tsubq\t%fs:40, %rdx\n\tje\t.L5\n\tcall\t__stack_chk_fail@PLT\n.L5:\n\tleave\n\t.cfi_def_cfa 7, 8\n\tret\n\t.cfi_endproc\n.LFE0:\n\t.size\tmain, .-main\n\t.ident\t\"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0\"\n\t.section\t.note.GNU-stack,\"\",@progbits\n\t.section\t.note.gnu.property,\"a\"\n\t.align 8\n\t.long\t1f - 0f\n\t.long\t4f - 1f\n\t.long\t5\n0:\n\t.string\t\"GNU\"\n1:\n\t.align 8\n\t.long\t0xc0000002\n\t.long\t3f - 2f\n2:\n\t.long\t0x3\n3:\n\t.align 8\n4:\n\n\nOnly output the optimized assembly code. Do not include any other text.", "split": "train" }
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 Assembly Code: .file "temp.c" .text .section .rodata .LC0: .string "%lu" .text .globl main .type main, @function main: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %fs:40, %rax movq %rax, -8(%rbp) xorl %eax, %eax movq $0, -24(%rbp) movq $1, -16(%rbp) leaq -24(%rbp), %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call __isoc99_scanf@PLT jmp .L2 .L3: movq -24(%rbp), %rax shrq %rax movq %rax, -24(%rbp) salq -16(%rbp) .L2: movq -24(%rbp), %rax testq %rax, %rax jne .L3 movq -16(%rbp), %rax subq $1, %rax movq %rax, %rsi leaq .LC0(%rip), %rax movq %rax, %rdi movl $0, %eax call printf@PLT movl $0, %eax movq -8(%rbp), %rdx subq %fs:40, %rdx je .L5 call __stack_chk_fail@PLT .L5: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: Only output the optimized assembly code. Do not include any other text.