// File: sighingnow[P]compile-pascal/pl0_x86.cpp
// Function: pl0_x86_gen_header(BasicBlock&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
static void pl0_x86_gen_header(BasicBlock & bb, std::vector<std::string> & buffer) {
    runtime.tag(); old.emplace_back(dist); dist = 0;
    size_t p = pl0_x86_gen_param(bb.code, 0);
    buffer.emplace_back(string(""));
    buffer.emplace_back(string("    global ") + bb.code[p].rd->sv);
    buffer.emplace_back(string(bb.code[p].rd->sv) + ":");
    buffer.emplace_back(string("    push ebp"));
    buffer.emplace_back(string("    mov ebp, esp"));
    // prepare displays.
    int d = runtime.depth();
    runtime.push(LOC(string("$fn") + bb.code[p].rd->sv, d));
    buffer.emplace_back("    mov ebx, dword [ebp]");
    for (int i = 1; i < d; ++i) {
        buffer.emplace_back("    push dword [ebx-" + to_string(i*4) + "]");
    }
    dist = dist - 4 * d;
    buffer.emplace_back("    push ebp");
    if (++p < bb.size() && bb.code[p].op == "allocret") {
        dist = dist - 4;
        runtime.push(LOC(bb.code[p].rd->sv, dist));
        buffer.emplace_back(string("    sub esp, ") + to_string(4) + "\t\t;; " + bb.code[p].str());
        p = p + 1;
    }
    while (p < bb.size() && bb.code[p].op == "def") {
        buffer.emplace_back(x86_gen_def(bb.code[p++]));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x410, %rsp            # imm = 0x410
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x80836(%rip), %rdi     # 0x160820
callq 0xea1c0
leaq 0x80812(%rip), %rdi     # 0x160808
leaq 0x80973(%rip), %rsi     # 0x160970
callq 0xbfb80
movl $0x0, 0x80964(%rip)     # 0x160970
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xe0a80
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x378(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x55d0
movq -0x370(%rbp), %rdx
leaq 0x11be5(%rip), %rsi     # 0xf1c2f
leaq -0x38(%rbp), %rdi
callq 0x19840
jmp 0xe0055
movq -0x378(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xbf090
jmp 0xe0067
leaq -0x38(%rbp), %rdi
callq 0x5200
leaq -0x39(%rbp), %rdi
callq 0x53c0
movq -0x10(%rbp), %rax
movq %rax, -0x388(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x55d0
movq -0x380(%rbp), %rdx
leaq 0x1167c(%rip), %rsi     # 0xf1721
leaq -0x90(%rbp), %rdi
callq 0x19840
jmp 0xe00b3
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq 0x20(%rax), %rdx
addq $0x8, %rdx
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x1a4d0
jmp 0xe00de
movq -0x388(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xbf090
jmp 0xe00f0
leaq -0x70(%rbp), %rdi
callq 0x5200
leaq -0x90(%rbp), %rdi
callq 0x5200
leaq -0x91(%rbp), %rdi
callq 0x53c0
movq -0x10(%rbp), %rax
movq %rax, -0x398(%rbp)
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x5150
movq -0x390(%rbp), %rsi
leaq 0xf02a(%rip), %rdx      # 0xef180
leaq -0xb8(%rbp), %rdi
callq 0x1a380
jmp 0xe0164
movq -0x398(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xbf090
jmp 0xe0179
leaq -0xb8(%rbp), %rdi
callq 0x5200
leaq -0xd8(%rbp), %rdi
callq 0x5200
movq -0x10(%rbp), %rax
movq %rax, -0x3a8(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x55d0
movq -0x3a0(%rbp), %rdx
leaq 0x11570(%rip), %rsi     # 0xf172d
leaq -0xf8(%rbp), %rdi
callq 0x19840
jmp 0xe01cb
movq -0x3a8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xbf090
jmp 0xe01e0
leaq -0xf8(%rbp), %rdi
callq 0x5200
leaq -0xf9(%rbp), %rdi
callq 0x53c0
movq -0x10(%rbp), %rax
movq %rax, -0x3b8(%rbp)
leaq -0x121(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x55d0
movq -0x3b0(%rbp), %rdx
leaq 0x11516(%rip), %rsi     # 0xf173a
leaq -0x120(%rbp), %rdi
callq 0x19840
jmp 0xe0232
movq -0x3b8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xbf090
jmp 0xe0247
leaq -0x120(%rbp), %rdi
callq 0x5200
leaq -0x121(%rbp), %rdi
callq 0x53c0
leaq 0x805ba(%rip), %rdi     # 0x160820
callq 0xdb500
movl %eax, -0x128(%rbp)
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x55d0
movq -0x3c0(%rbp), %rdx
leaq 0x114b9(%rip), %rsi     # 0xf174b
leaq -0x1b0(%rbp), %rdi
callq 0x19840
jmp 0xe02a0
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq 0x20(%rax), %rdx
addq $0x8, %rdx
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x1a4d0
jmp 0xe02ce
movl -0x128(%rbp), %edx
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rsi
xorl %ecx, %ecx
callq 0xdb170
jmp 0xe02eb
leaq 0x8052e(%rip), %rdi     # 0x160820
leaq -0x170(%rbp), %rsi
callq 0xdb140
jmp 0xe0300
leaq -0x170(%rbp), %rdi
callq 0xdac70
leaq -0x190(%rbp), %rdi
callq 0x5200
leaq -0x1b0(%rbp), %rdi
callq 0x5200
leaq -0x1b1(%rbp), %rdi
callq 0x53c0
movq -0x10(%rbp), %rdi
leaq 0x11414(%rip), %rsi     # 0xf174f
callq 0xea200
movl $0x1, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
cmpl -0x128(%rbp), %eax
jge 0xe05e8
movq -0x10(%rbp), %rax
movq %rax, -0x3d0(%rbp)
movl -0x1b8(%rbp), %esi
shll $0x2, %esi
leaq -0x218(%rbp), %rdi
movq %rdi, -0x3c8(%rbp)
callq 0xa3920
movq -0x3c8(%rbp), %rdx
leaq 0x113d7(%rip), %rsi     # 0xf1768
leaq -0x1f8(%rbp), %rdi
callq 0x19ad0
jmp 0xe039f
leaq 0x10fb2(%rip), %rdx     # 0xf1358
leaq -0x1d8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x1a380
jmp 0xe03bb
movq -0x3d0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xbf090
jmp 0xe03d0
leaq -0x1d8(%rbp), %rdi
callq 0x5200
leaq -0x1f8(%rbp), %rdi
callq 0x5200
leaq -0x218(%rbp), %rdi
callq 0x5200
movl -0x1b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b8(%rbp)
jmp 0xe034a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe042b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5200
leaq -0x39(%rbp), %rdi
callq 0x53c0
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe0476
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe046a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5200
leaq -0x90(%rbp), %rdi
callq 0x5200
leaq -0x91(%rbp), %rdi
callq 0x53c0
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe04ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x5200
leaq -0xd8(%rbp), %rdi
callq 0x5200
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe04e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x5200
leaq -0xf9(%rbp), %rdi
callq 0x53c0
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe051b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x5200
leaq -0x121(%rbp), %rdi
callq 0x53c0
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe0586
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe057a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe056e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xdac70
leaq -0x190(%rbp), %rdi
callq 0x5200
leaq -0x1b0(%rbp), %rdi
callq 0x5200
leaq -0x1b1(%rbp), %rdi
callq 0x53c0
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe05d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe05cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x5200
leaq -0x1f8(%rbp), %rdi
callq 0x5200
leaq -0x218(%rbp), %rdi
callq 0x5200
jmp 0xe0a03
movl 0x80382(%rip), %eax     # 0x160970
movl -0x128(%rbp), %ecx
shll $0x2, %ecx
subl %ecx, %eax
movl %eax, 0x80371(%rip)     # 0x160970
movq -0x10(%rbp), %rdi
leaq 0x11123(%rip), %rsi     # 0xf172d
callq 0xea280
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3d8(%rbp)
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xc98a0
movq %rax, %rcx
movq -0x3d8(%rbp), %rax
cmpq %rcx, %rax
jae 0xe091f
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x10df1(%rip), %rsi     # 0xf144a
callq 0x2a580
testb $0x1, %al
jne 0xe0667
jmp 0xe091f
movl 0x80303(%rip), %eax     # 0x160970
addl $-0x4, %eax
movl %eax, 0x802fa(%rip)     # 0x160970
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq -0x280(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x5150
movq -0x3e0(%rbp), %rsi
movl 0x802c1(%rip), %edx     # 0x160970
leaq -0x260(%rbp), %rdi
xorl %ecx, %ecx
callq 0xdb170
jmp 0xe06bf
leaq 0x8015a(%rip), %rdi     # 0x160820
leaq -0x260(%rbp), %rsi
callq 0xdb140
jmp 0xe06d4
leaq -0x260(%rbp), %rdi
callq 0xdac70
leaq -0x280(%rbp), %rdi
callq 0x5200
movq -0x10(%rbp), %rax
movq %rax, -0x3f0(%rbp)
leaq -0x301(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x55d0
movq -0x3e8(%rbp), %rdx
leaq 0x11065(%rip), %rsi     # 0xf177d
leaq -0x300(%rbp), %rdi
callq 0x19840
jmp 0xe0726
leaq -0x328(%rbp), %rdi
movl $0x4, %esi
callq 0xa3920
jmp 0xe0739
leaq -0x2e0(%rbp), %rdi
leaq -0x300(%rbp), %rsi
leaq -0x328(%rbp), %rdx
callq 0x1a3d0
jmp 0xe0755
leaq 0x1102f(%rip), %rdx     # 0xf178b
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x1a380
jmp 0xe0771
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq %rax, %rsi
leaq -0x348(%rbp), %rdi
callq 0x9fa70
jmp 0xe0793
leaq -0x2a0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
leaq -0x348(%rbp), %rdx
callq 0x1a3d0
jmp 0xe07af
movq -0x3f0(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0xbf090
jmp 0xe07c4
leaq -0x2a0(%rbp), %rdi
callq 0x5200
leaq -0x348(%rbp), %rdi
callq 0x5200
leaq -0x2c0(%rbp), %rdi
callq 0x5200
leaq -0x2e0(%rbp), %rdi
callq 0x5200
leaq -0x328(%rbp), %rdi
callq 0x5200
leaq -0x300(%rbp), %rdi
callq 0x5200
leaq -0x301(%rbp), %rdi
callq 0x53c0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xe091f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe084f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0xdac70
leaq -0x280(%rbp), %rdi
callq 0x5200
jmp 0xe0a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe090e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe0902
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe08f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe08ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe08de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe08d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x5200
leaq -0x348(%rbp), %rdi
callq 0x5200
leaq -0x2c0(%rbp), %rdi
callq 0x5200
leaq -0x2e0(%rbp), %rdi
callq 0x5200
leaq -0x328(%rbp), %rdi
callq 0x5200
leaq -0x300(%rbp), %rdi
callq 0x5200
leaq -0x301(%rbp), %rdi
callq 0x53c0
jmp 0xe0a03
jmp 0xe0921
movq -0x18(%rbp), %rax
movq %rax, -0x400(%rbp)
movq -0x8(%rbp), %rdi
callq 0xc98a0
movq -0x400(%rbp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x3f1(%rbp)
jae 0xe0972
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x10744(%rip), %rsi     # 0xf10ab
callq 0x2a580
movb %al, -0x3f1(%rbp)
movb -0x3f1(%rbp), %al
testb $0x1, %al
jne 0xe097e
jmp 0xe09fa
movq -0x10(%rbp), %rax
movq %rax, -0x410(%rbp)
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
movq %rsi, %rax
incq %rax
movq %rax, -0x18(%rbp)
callq 0xcceb0
movq %rax, %rsi
leaq -0x368(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0xe0c00
movq -0x410(%rbp), %rdi
movq -0x408(%rbp), %rsi
callq 0xbf090
jmp 0xe09cf
leaq -0x368(%rbp), %rdi
callq 0x5200
jmp 0xe0921
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x5200
jmp 0xe0a03
addq $0x410, %rsp            # imm = 0x410
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x55b0
nopl (%rax)