// File: /workspace/github_cpp_makefile_star2_O1/shengzh-oOoO[P]CodeSim/src/test.cpp
// Function: main
int main(int argc, char **argv){
    memset(input,0,sizeof(input));
    sprintf(input,"./bin/text_moss %s %s", argv[1], argv[2]);
    Shell(input);
    result[len++] = atof(buffer);

    memset(input,0,sizeof(input));
    Shell((char *)"mktemp 1.s.XXXX");
    char sfile1[128] = {0};
    strcpy(sfile1, buffer);
    for (int i = 0 ;i < 128 ;i++){
        if (sfile1[i] == '\n'){
            sfile1[i] = 0;
            break;
        }
    }
    memset(input,0,sizeof(input));
    Shell((char *)"mktemp 2.s.XXXX");
    char sfile2[128] = {0};
    strcpy(sfile2, buffer);
    for (int i = 0 ;i < 128 ;i++){
        if (sfile2[i] == '\n'){
            sfile2[i] = 0;
            break;
        }
    }

    memset(input,0,sizeof(input));
    sprintf(input,"g++ -S %s -o %s", argv[1], sfile1);
    Shell(input);

    memset(input,0,sizeof(input));
    sprintf(input,"g++ -S %s -o %s", argv[2], sfile2);
    Shell(input);
    
    memset(input,0,sizeof(input));
    sprintf(input,"./bin/assembly_moss %s %s", sfile1, sfile2);
    Shell(input);
    result[len++] = atof(buffer);

    memset(input,0,sizeof(input));
    sprintf(input,"rm %s", sfile1);
    Shell(input);
    memset(input,0,sizeof(input));
    sprintf(input,"rm %s", sfile2);
    Shell(input);


    PrintFinalResult();
    return 0;    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %rbx
leaq 0x31d7(%rip), %r14      # 0x44a0
xorl %r12d, %r12d
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
leaq 0xd23(%rip), %rsi       # 0x200d
movq %r14, %rdi
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125e
leaq 0x2d9d(%rip), %r15      # 0x40a0
movq %r15, %rdi
callq 0x1090
cvtsd2ss %xmm0, %xmm0
movslq 0x35b2(%rip), %rax      # 0x48c8
leal 0x1(%rax), %ecx
movl %ecx, 0x35a9(%rip)      # 0x48c8
leaq 0x357a(%rip), %r13      # 0x48a0
movss %xmm0, (%r13,%rax,4)
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
leaq 0xce0(%rip), %rdi       # 0x2023
callq 0x125e
xorps %xmm0, %xmm0
leaq -0x130(%rbp), %rdi
movaps %xmm0, 0x70(%rdi)
movaps %xmm0, 0x60(%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq %r15, %rsi
callq 0x1080
cmpb $0xa, -0x130(%rbp,%r12)
je 0x1392
incq %r12
cmpq $0x80, %r12
jne 0x1379
jmp 0x139b
movb $0x0, -0x130(%rbp,%r12)
leaq 0x30fe(%rip), %rdi      # 0x44a0
xorl %r14d, %r14d
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x1060
leaq 0xc7b(%rip), %rdi       # 0x2033
callq 0x125e
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %rdi
movaps %xmm0, 0x70(%rdi)
movaps %xmm0, 0x60(%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
leaq 0x2cb3(%rip), %rsi      # 0x40a0
callq 0x1080
cmpb $0xa, -0xb0(%rbp,%r14)
je 0x140b
incq %r14
cmpq $0x80, %r14
jne 0x13f2
jmp 0x1414
movb $0x0, -0xb0(%rbp,%r14)
leaq 0x3085(%rip), %r14      # 0x44a0
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
movq 0x8(%rbx), %rdx
leaq 0xc0e(%rip), %r12       # 0x2043
leaq -0x130(%rbp), %r15
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125e
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
movq 0x10(%rbx), %rdx
leaq -0xb0(%rbp), %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125e
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
leaq 0xbb7(%rip), %rsi       # 0x2053
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125e
leaq 0x2be5(%rip), %rdi      # 0x40a0
callq 0x1090
cvtsd2ss %xmm0, %xmm0
movslq 0x33fd(%rip), %rax      # 0x48c8
leal 0x1(%rax), %ecx
movl %ecx, 0x33f4(%rip)      # 0x48c8
movss %xmm0, (%r13,%rax,4)
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
leaq 0xb7c(%rip), %r12       # 0x206d
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125e
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125e
callq 0x120c
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq