// File: Eronana[P]strawberry/src/assembler.cpp
// Function: load_asmfile(char const*)
bool load_asmfile(const char *filename)
{
    ifstream asms(filename);
    if(!asms)return false;
    string line;
    for(int lines=0;;)
    {
        int read_lines=get_asm_line(asms,line);
        if(read_lines<0)break;
        lines+=read_lines;
        int pos=line.find(' ');
        string oper=line.substr(0,pos);
        toUpperCase(oper);
        string opnd;
        if(pos!=string::npos)
        {
            opnd=line.substr(pos+1);
            if(opnd.length()&&opnd[0]!='\''&&opnd[0]!='"')toUpperCase(opnd);
        }
        if(opnd.empty()&&*oper.rbegin()==':')
        {
            string label=string(oper,0,oper.size()-1);
            labels[toUpperCase(label)]=s_code.size();
        }
        else
        {
            s_code.push_back({lines,oper,opnd});
        }
    }
    asms.close();
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x7620
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x7160
movb %al, -0x329(%rbp)
jmp 0x42c74
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x42c80
jmp 0x42caa
movb $0x0, -0x1(%rbp)
movl $0x1, -0x228(%rbp)
jmp 0x430bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x430d5
leaq -0x248(%rbp), %rdi
callq 0x7470
movl $0x0, -0x24c(%rbp)
leaq -0x218(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x421b0
movl %eax, -0x330(%rbp)
jmp 0x42cdb
movl -0x330(%rbp), %eax
movl %eax, -0x250(%rbp)
cmpl $0x0, -0x250(%rbp)
jge 0x42d0c
jmp 0x43083
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x430ad
movl -0x250(%rbp), %ecx
movl -0x24c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24c(%rbp)
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x338(%rbp)
leaq -0x248(%rbp), %rdi
movq %rdi, -0x340(%rbp)
movl $0x20, %esi
callq 0x7440
movq -0x340(%rbp), %rsi
movq -0x338(%rbp), %rdx
movl %eax, -0x254(%rbp)
movslq -0x254(%rbp), %rcx
leaq -0x278(%rbp), %rdi
callq 0x72e0
jmp 0x42d6c
leaq -0x278(%rbp), %rdi
callq 0x42ba0
jmp 0x42d7a
leaq -0x298(%rbp), %rdi
callq 0x7470
movslq -0x254(%rbp), %rax
cmpq $-0x1, %rax
je 0x42e83
movl -0x254(%rbp), %eax
incl %eax
movslq %eax, %rdx
leaq -0x2b8(%rbp), %rdi
leaq -0x248(%rbp), %rsi
movq $-0x1, %rcx
callq 0x72e0
jmp 0x42dbe
leaq -0x298(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x73c0
leaq -0x2b8(%rbp), %rdi
callq 0x71d0
leaq -0x298(%rbp), %rdi
callq 0x74f0
cmpq $0x0, %rax
je 0x42e81
xorl %eax, %eax
movl %eax, %esi
leaq -0x298(%rbp), %rdi
callq 0x7660
movq %rax, -0x348(%rbp)
jmp 0x42e0c
movq -0x348(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
je 0x42e81
xorl %eax, %eax
movl %eax, %esi
leaq -0x298(%rbp), %rdi
callq 0x7660
movq %rax, -0x350(%rbp)
jmp 0x42e34
movq -0x350(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x42e81
leaq -0x298(%rbp), %rdi
callq 0x42ba0
jmp 0x42e51
jmp 0x42e81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x43075
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x43069
jmp 0x42e83
leaq -0x298(%rbp), %rdi
callq 0x75a0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x351(%rbp)
jne 0x42ea0
jmp 0x42ee5
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x368(%rbp)
leaq -0x278(%rbp), %rsi
callq 0x75d0
movq -0x368(%rbp), %rdi
callq 0x44710
movq %rax, -0x360(%rbp)
jmp 0x42ecf
movq -0x360(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
sete %al
movb %al, -0x351(%rbp)
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0x42ef4
jmp 0x42fac
leaq -0x278(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x7210
movq -0x370(%rbp), %rsi
movq %rax, %rcx
decq %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x2e0(%rbp), %rdi
callq 0x7460
jmp 0x42f26
leaq 0x47c33(%rip), %rdi     # 0x8ab60
callq 0x44740
movl %eax, -0x37c(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x42ba0
movq %rax, -0x378(%rbp)
jmp 0x42f4d
movq -0x378(%rbp), %rsi
leaq 0x47ab5(%rip), %rdi     # 0x8aa10
callq 0x188b0
movq %rax, -0x388(%rbp)
jmp 0x42f69
movq -0x388(%rbp), %rax
movl -0x37c(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x2e0(%rbp), %rdi
callq 0x71d0
jmp 0x4304c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x71d0
jmp 0x43069
movl -0x24c(%rbp), %eax
movl %eax, -0x328(%rbp)
leaq -0x320(%rbp), %rdi
movq %rdi, -0x390(%rbp)
leaq -0x278(%rbp), %rsi
callq 0x7130
jmp 0x42fd4
leaq -0x300(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x7130
jmp 0x42fe9
leaq 0x47b70(%rip), %rdi     # 0x8ab60
leaq -0x328(%rbp), %rsi
callq 0x44770
jmp 0x42ffe
leaq -0x328(%rbp), %rdi
callq 0x447a0
jmp 0x4304c
movq -0x390(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
callq 0x71d0
jmp 0x43069
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x447a0
jmp 0x43069
leaq -0x298(%rbp), %rdi
callq 0x71d0
leaq -0x278(%rbp), %rdi
callq 0x71d0
jmp 0x42cc0
leaq -0x298(%rbp), %rdi
callq 0x71d0
leaq -0x278(%rbp), %rdi
callq 0x71d0
jmp 0x430ad
leaq -0x218(%rbp), %rdi
callq 0x70a0
jmp 0x43091
movb $0x1, -0x1(%rbp)
movl $0x1, -0x228(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x71d0
jmp 0x430bb
leaq -0x248(%rbp), %rdi
callq 0x71d0
jmp 0x430d5
leaq -0x218(%rbp), %rdi
callq 0x70b0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
leaq -0x218(%rbp), %rdi
callq 0x70b0
movq -0x220(%rbp), %rdi
callq 0x75e0
nopl (%rax)