// File: /workspace/github_cpp_makefile_star2_O1/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 0x1e94e(%rip), %al      # 0x2b830
testb %al, %al
je 0xd1df
leaq 0x20(%rbx), %rax
movq %rax, -0x50(%rbp)
movq 0x20(%rbx), %r15
cmpq 0x28(%rbx), %r15
je 0xcf17
cmpq $0x0, 0x8(%r15)
je 0xcf09
addq $0x20, %r15
jmp 0xcef6
movq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x1ca32
jmp 0xcef6
movq 0x20(%rbx), %r15
cmpq %r15, 0x28(%rbx)
je 0xd1d0
xorl %r12d, %r12d
movq %r12, %r13
shlq $0x5, %r13
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movq (%r15,%r13), %rdi
movq 0x8(%r15,%r13), %rsi
addq %rdi, %rsi
leaq -0x90(%rbp), %rdx
leaq 0x1e8b9(%rip), %rcx     # 0x2b810
xorl %r8d, %r8d
callq 0x1c102
testb %al, %al
je 0xd1a4
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
cmpq %rcx, %rax
je 0xcfa0
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
addq $-0x5, %rdx
cmpq $-0x2, %rdx
setb %sil
jmp 0xcfa2
xorl %esi, %esi
addq %r13, %r15
leaq 0x18(%rax), %rdi
leaq -0x48(%rcx), %rdx
testb %sil, %sil
cmoveq %rdx, %rdi
movq 0x8(%rdi), %rsi
subq (%rdi), %rsi
cmpb $0x0, 0x10(%rdi)
movl $0x0, %edi
cmoveq %rdi, %rsi
cmpq 0x8(%r15), %rsi
je 0xd1a4
cmpq %rcx, %rax
je 0xcff9
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rcx
addq $-0x6, %rcx
cmpq $-0x3, %rcx
setb %cl
jmp 0xcffb
xorl %ecx, %ecx
addq $0x30, %rax
testb %cl, %cl
cmovneq %rax, %rdx
cmpb $0x1, 0x10(%rdx)
jne 0xd025
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1c502
jmp 0xd039
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movb $0x0, -0x60(%rbp)
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rax
cmpq %rax, %rcx
leaq -0x48(%rbp), %rdi
je 0xd075
movq %rax, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
addq $-0x5, %rdx
cmpq $-0x2, %rdx
setb %dl
jmp 0xd077
xorl %edx, %edx
addq $0x18, %rcx
addq $-0x48, %rax
testb %dl, %dl
cmovneq %rcx, %rax
cmpb $0x1, 0x10(%rax)
jne 0xd0a1
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x1c502
jmp 0xd0b5
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rcx
xorl %r14d, %r14d
movq %r15, %rdi
xorl %edx, %edx
callq 0x5540
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
cmpq %rcx, %rdx
je 0xd101
movq %rcx, %rsi
subq %rdx, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rsi
addq $-0x5, %rsi
cmpq $-0x2, %rsi
setb %r14b
addq $0x18, %rdx
addq $-0x48, %rcx
testb %r14b, %r14b
cmovneq %rdx, %rcx
movq 0x8(%rcx), %rdx
subq (%rcx), %rdx
cmpb $0x0, 0x10(%rcx)
movl $0x0, %ecx
cmoveq %rcx, %rdx
movq %r15, %rdi
movq %rax, %rsi
callq 0x5090
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %r15
cmpq %r15, %rdi
je 0xd141
callq 0x52d0
movq -0x50(%rbp), %rax
addq (%rax), %r13
movq %r15, -0x48(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x9e42
movq %r14, %rdi
leaq 0x142a3(%rip), %rsi     # 0x21410
callq 0x55e0
movq -0x50(%rbp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xa3a2
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0xd18f
callq 0x52d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xd1a1
callq 0x52d0
incq %r12
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0xd1b5
callq 0x52d0
incq %r12
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rax
subq %r15, %rax
sarq $0x5, %rax
cmpq %rax, %r12
jb 0xcf28
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e64a(%rip), %rdi     # 0x2b830
callq 0x5580
testl %eax, %eax
je 0xceea
leaq 0x1e616(%rip), %rdi     # 0x2b810
leaq 0x14226(%rip), %rsi     # 0x21427
movl $0x10, %edx
callq 0xd66a
leaq 0x4c4(%rip), %rdi       # 0xd6d6
leaq 0x1e5f7(%rip), %rsi     # 0x2b810
leaq 0x1e0f8(%rip), %rdx     # 0x2b318
callq 0x52b0
leaq 0x1e604(%rip), %rdi     # 0x2b830
callq 0x5200
jmp 0xceea
movq %rax, %rbx
leaq 0x1e5f0(%rip), %rdi     # 0x2b830
callq 0x51f0
jmp 0xd29d
jmp 0xd25b
jmp 0xd289
jmp 0xd24d
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0xd270
jmp 0xd275
movq %rax, %rbx
jmp 0xd275
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xd275
callq 0x52d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xd28c
callq 0x52d0
jmp 0xd28c
movq %rax, %rbx
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0xd29d
callq 0x52d0
movq %rbx, %rdi
callq 0x5560
nop