// File: /workspace/github_cpp_makefile_star2_O2/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 0x31dc(%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 0xd28(%rip), %rsi       # 0x200d
movq %r14, %rdi
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125b
leaq 0x2da2(%rip), %r15      # 0x40a0
movq %r15, %rdi
callq 0x1090
cvtsd2ss %xmm0, %xmm0
movslq 0x35b7(%rip), %rax      # 0x48c8
leal 0x1(%rax), %ecx
movl %ecx, 0x35ae(%rip)      # 0x48c8
leaq 0x357f(%rip), %r13      # 0x48a0
movss %xmm0, (%r13,%rax,4)
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
leaq 0xce5(%rip), %rdi       # 0x2023
callq 0x125b
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
cmpq $0x80, %r12
je 0x1398
leaq 0x1(%r12), %rax
cmpb $0xa, -0x130(%rbp,%r12)
movq %rax, %r12
jne 0x1374
movb $0x0, -0x131(%rbp,%rax)
leaq 0x3101(%rip), %rdi      # 0x44a0
xorl %r14d, %r14d
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x1060
leaq 0xc7e(%rip), %rdi       # 0x2033
callq 0x125b
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 0x2cb6(%rip), %rsi      # 0x40a0
callq 0x1080
cmpq $0x80, %r14
je 0x1412
leaq 0x1(%r14), %rax
cmpb $0xa, -0xb0(%rbp,%r14)
movq %rax, %r14
jne 0x13ef
movb $0x0, -0xb1(%rbp,%rax)
leaq 0x3087(%rip), %r14      # 0x44a0
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
movq 0x8(%rbx), %rdx
leaq 0xc10(%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 0x125b
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 0x125b
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
leaq 0xbb9(%rip), %rsi       # 0x2053
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125b
leaq 0x2be7(%rip), %rdi      # 0x40a0
callq 0x1090
cvtsd2ss %xmm0, %xmm0
movslq 0x33ff(%rip), %rax      # 0x48c8
leal 0x1(%rax), %ecx
movl %ecx, 0x33f6(%rip)      # 0x48c8
movss %xmm0, (%r13,%rax,4)
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x1060
leaq 0xb7e(%rip), %r12       # 0x206d
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x125b
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 0x125b
callq 0x120c
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq