// File: /workspace/github_cpp_makefile_star2_O2/pollow[P]MIPSClide/assembler.cpp
// Function: Assembler::format()
void Assembler::format() {
    static regex label("(\\s*(\\w+)\\s*:\\s*).*");
    // 0. remove empty line
    {
        auto i = statements.begin();
        while( i != statements.end() ) {
            if (i->length() < 1) statements.erase(i);
            else i++;
        }
    }
    // 1. extract label into new line:
    size_t i = 0;
    while ( i < statements.size() ) {
        string &str = statements[i];
        smatch result;
        if ( regex_match(str, result, label) ) {
            if ( (size_t) result[1].length() != str.length() ) {
                string tmp = result[2].str();
                str.erase( str.find(result[1].str()), result[1].length() );
                statements.insert(statements.begin()+i,tmp+":");
                i++;
            }
            i++;
        } else i++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movb 0x1f18c(%rip), %al      # 0x2a840
testb %al, %al
movq %rdi, -0x30(%rbp)
je 0xb8bd
leaq 0x20(%rbx), %r14
movq 0x20(%rbx), %r13
cmpq 0x28(%rbx), %r13
je 0xb6e8
cmpq $0x0, 0x8(%r13)
jne 0xb6e2
movq %r14, %rdi
movq %r13, %rsi
callq 0xc41c
jmp 0xb6c8
addq $0x20, %r13
jmp 0xb6c8
xorl %r12d, %r12d
movq (%r14), %r15
subq %r15, %r13
sarq $0x5, %r13
cmpq %r13, %r12
jae 0xb8ae
movq %r12, %r13
shlq $0x5, %r13
addq %r13, %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
leaq 0x1f0ff(%rip), %rdx     # 0x2a820
xorl %ecx, %ecx
callq 0xbdc1
testb %al, %al
je 0xb895
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdi
movq %rdi, %rcx
subq %rsi, %rcx
je 0xb75c
movq %rcx, %rax
cqto
pushq $0x18
popq %r8
idivq %r8
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xb75c
leaq 0x18(%rsi), %rax
jmp 0xb764
leaq (%rsi,%rcx), %rax
addq $-0x48, %rax
movq 0x8(%rax), %rdx
subq (%rax), %rdx
cmpb $0x0, 0x10(%rax)
movl $0x0, %eax
cmoveq %rax, %rdx
cmpq 0x8(%r15), %rdx
je 0xb895
cmpq %rdi, %rsi
je 0xb7a2
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xb7a2
addq $0x30, %rsi
jmp 0xb7a9
addq %rcx, %rsi
addq $-0x48, %rsi
leaq -0x90(%rbp), %rdi
callq 0xbe22
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rcx
subq %rsi, %rcx
je 0xb7dd
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xb7dd
addq $0x18, %rsi
jmp 0xb7e4
addq %rcx, %rsi
addq $-0x48, %rsi
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0xbe22
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x5610
movq %rax, %rsi
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rcx
subq %rdi, %rcx
je 0xb829
movq %rcx, %rax
cqto
pushq $0x18
popq %r8
idivq %r8
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xb829
addq $0x18, %rdi
jmp 0xb830
addq %rcx, %rdi
addq $-0x48, %rdi
movq 0x8(%rdi), %rdx
subq (%rdi), %rdx
cmpb $0x0, 0x10(%rdi)
movl $0x0, %eax
cmoveq %rax, %rdx
movq %r15, %rdi
callq 0x5080
movq %rbx, %rdi
callq 0x5160
movq (%r14), %r15
movq %rbx, %rdi
leaq -0x90(%rbp), %rsi
leaq 0x10b88(%rip), %rdx     # 0x1c3f0
callq 0x946c
addq %r13, %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x9a42
movq %rbx, %rdi
callq 0x5160
incq %r12
leaq -0x90(%rbp), %rdi
callq 0x5160
movq -0x30(%rbp), %rbx
incq %r12
leaq -0x50(%rbp), %rdi
callq 0xc500
movq 0x28(%rbx), %r13
jmp 0xb6eb
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ef7c(%rip), %rdi     # 0x2a840
callq 0x5580
testl %eax, %eax
je 0xb6c0
leaq 0x1ef48(%rip), %rdi     # 0x2a820
leaq 0x10b28(%rip), %rsi     # 0x1c407
pushq $0x10
popq %rdx
callq 0xbb98
leaq 0x314(%rip), %rdi       # 0xbc02
leaq 0x1ef2b(%rip), %rsi     # 0x2a820
leaq 0x1ea2c(%rip), %rdx     # 0x2a328
callq 0x52b0
leaq 0x1ef38(%rip), %rdi     # 0x2a840
callq 0x5210
movq -0x30(%rbp), %rbx
jmp 0xb6c0
movq %rax, %rbx
leaq 0x1ef20(%rip), %rdi     # 0x2a840
callq 0x5200
jmp 0xb958
jmp 0xb930
jmp 0xb92b
movq %rax, %rbx
jmp 0xb93c
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x5160
leaq -0x90(%rbp), %rdi
callq 0x5160
jmp 0xb94f
jmp 0xb94c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0xc500
movq %rbx, %rdi
callq 0x5560