// File: sighingnow[P]compile-pascal/pl0_opt.cpp
// Function: BasicBlock::releaseLeaf(std::vector<TAC, std::allocator<TAC>>&, Value*)
void BasicBlock::releaseLeaf(std::vector<TAC> & irs, Value *item) {
    auto iter = G.begin();
    while (iter != G.end()) {
        DAGNode & node = *iter; // reference.
        if (node.leaf && record[*item] != node.no) {
            if (node.item == item && !node.items.empty()) {
                auto i_iter = node.items.begin();
                node.item = *i_iter;
                node.items.erase(i_iter);
                releaseLeaf(irs, node.item);
                if (node.item->str() != item->str()) {
                    irs.push_back(TAC("=", node.item, item));
                }
            }
        }
        iter++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x120(%rbp)
addq $0x60, %rdi
callq 0xcd370
movq %rax, -0x20(%rbp)
movq -0x120(%rbp), %rdi
addq $0x60, %rdi
callq 0xcd3a0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xcd3d0
testb $0x1, %al
jne 0xcb2e9
jmp 0xcb55a
leaq -0x20(%rbp), %rdi
callq 0xcdf20
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x9(%rax)
je 0xcb543
movq -0x120(%rbp), %rdi
addq $0x78, %rdi
movq -0x18(%rbp), %rsi
callq 0xcd290
movl (%rax), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
je 0xcb543
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0xcb541
movq -0x30(%rbp), %rdi
addq $0x18, %rdi
callq 0xcdf40
testb $0x1, %al
jne 0xcb541
movq -0x30(%rbp), %rdi
addq $0x18, %rdi
callq 0xcd540
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0xcd5e0
movq -0x130(%rbp), %rsi
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x128(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xcd710
movq -0x128(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xcd6a0
movq -0x120(%rbp), %rdi
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0xcb290
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x68(%rbp), %rdi
callq 0x9f9b0
movq -0x18(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x9f9b0
jmp 0xcb3e7
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x1a4a0
movb %al, -0x131(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5200
leaq -0x68(%rbp), %rdi
callq 0x5200
movb -0x131(%rbp), %al
testb $0x1, %al
jne 0xcb421
jmp 0xcb53f
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x55d0
movq -0x140(%rbp), %rdx
leaq 0x23fcf(%rip), %rsi     # 0xef41c
leaq -0x108(%rbp), %rdi
callq 0x19840
jmp 0xcb45b
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xc15f0
jmp 0xcb481
movq -0x148(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0xcdcf0
jmp 0xcb496
leaq -0xe8(%rbp), %rdi
callq 0xa3cd0
leaq -0x108(%rbp), %rdi
callq 0x5200
leaq -0x109(%rbp), %rdi
callq 0x53c0
jmp 0xcb53f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5200
jmp 0xcb563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xcb531
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xcb525
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xa3cd0
leaq -0x108(%rbp), %rdi
callq 0x5200
leaq -0x109(%rbp), %rdi
callq 0x53c0
jmp 0xcb563
jmp 0xcb541
jmp 0xcb543
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xcdf80
movq %rax, -0x118(%rbp)
jmp 0xcb2bf
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x55b0
nop