// File: sighingnow[P]compile-pascal/pl0_opt.cpp
// Function: BasicBlock::buildDAG()
void BasicBlock::buildDAG() {
    size_t p = this->s;
    int rd, rs, rt, t;
    for (p = 1; code[p].op != "cmp" && code[p].op != "goto" && code[p].op != "call"
            && code[p].op != "loadret" && code[p].op != "exit" && code[p].op != "endproc"; ++p)
    {
        if (code[p].op == "*" || code[p].op == "/" || code[p].op == "%"
                || code[p].op == "+" || code[p].op == "-"
                || code[p].op == "cmp"
                || code[p].op == "=[]" || code[p].op == "[]=") {
            rs = findNode(code[p].rs);
            setMap(code[p].rs, rs);
            rt = findNode(code[p].rt);
            setMap(code[p].rt, rt);
            rd = findNode(code[p].op, code[p].rd, rs, rt);
            setMap(code[p].rd, rd);
        }
        else if (code[p].op == "=") {
            // rs = findNode(code[p].rs);
            // setMap(code[p].rs, rs);
            // setMap(code[p].rd, rs);
            code[p].rt = new Value(0, "integer");
            rs = findNode(code[p].rs);
            setMap(code[p].rs, rs);
            rt = findNode(code[p].rt);
            setMap(code[p].rt, rt);
            rd = findNode(code[p].op, code[p].rd, rs, rt);
            setMap(code[p].rd, rd);
        }
        else if (code[p].op == "write_s") {
            IOBuf.emplace_back(make_pair(p, code[p]));
        }
        else if (code[p].op == "write_e") {
            rd = findNode(code[p].rd);
            t = G.size();
            G.emplace_back(DAGNode(t, "write_e", new Value("~write_e", "cmd"), rd, p));
            G[rd].moreFa();
        }
        else if (code[p].op == "read") {
            rd = findNode(code[p].rd);
            t = G.size();
            G.emplace_back(DAGNode(t, "read", code[p].rd, rd, p));
            G[rd].moreFa();
            setMap(code[p].rd, t);
        }
    }
    this->t = p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x248(%rbp)
movslq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
movq $0x1, -0x10(%rbp)
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x27826(%rip), %rsi     # 0xf11ce
callq 0xc02b0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x249(%rbp)
jne 0xc99c1
jmp 0xc9ac0
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x277f3(%rip), %rsi     # 0xf11d2
callq 0xc02b0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x249(%rbp)
jne 0xc99f8
jmp 0xc9ac0
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x26795(%rip), %rsi     # 0xf01ab
callq 0xc02b0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x249(%rbp)
jne 0xc9a2f
jmp 0xc9ac0
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2768b(%rip), %rsi     # 0xf10d8
callq 0xc02b0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x249(%rbp)
jne 0xc9a63
jmp 0xc9ac0
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x275e5(%rip), %rsi     # 0xf1066
callq 0xc02b0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x249(%rbp)
jne 0xc9a97
jmp 0xc9ac0
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x275b6(%rip), %rsi     # 0xf106b
callq 0xc02b0
movb %al, -0x249(%rbp)
movb -0x249(%rbp), %al
testb $0x1, %al
jne 0xc9acf
jmp 0xca4e5
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x27d41(%rip), %rsi     # 0xf182e
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x278f6(%rip), %rsi     # 0xf140e
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x278cd(%rip), %rsi     # 0xf1410
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2775a(%rip), %rsi     # 0xf12c8
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x27c2e(%rip), %rsi     # 0xf17c7
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2760e(%rip), %rsi     # 0xf11ce
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2776f(%rip), %rsi     # 0xf1356
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2759a(%rip), %rsi     # 0xf11a8
callq 0x2a580
testb $0x1, %al
jne 0xc9c1c
jmp 0xc9d64
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x260(%rbp)
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x28(%rax), %rsi
callq 0xca510
movq -0x260(%rbp), %rdi
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x28(%rax), %rsi
movl -0x18(%rbp), %edx
callq 0xca5f0
movq -0x260(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x30(%rax), %rsi
callq 0xca510
movq -0x260(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x30(%rax), %rsi
movl -0x1c(%rbp), %edx
callq 0xca5f0
movq -0x260(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x5150
movq -0x260(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq -0x258(%rbp), %rsi
movq 0x20(%rax), %rdx
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0xca7e0
movl %eax, -0x250(%rbp)
jmp 0xc9d0c
movl -0x250(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5200
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x20(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0xca5f0
jmp 0xca4d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5200
jmp 0xca4fc
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2569a(%rip), %rsi     # 0xef41c
callq 0x2a580
testb $0x1, %al
jne 0xc9d90
jmp 0xc9fae
movl $0x48, %edi
callq 0x5340
movq %rax, -0x270(%rbp)
movb $0x1, -0x72(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x55d0
movq -0x268(%rbp), %rdx
leaq 0x25484(%rip), %rsi     # 0xef247
leaq -0x70(%rbp), %rdi
callq 0x19840
jmp 0xc9dce
movq -0x270(%rbp), %rdi
xorl %esi, %esi
leaq -0x70(%rbp), %rdx
callq 0xbdfe0
jmp 0xc9de2
movq -0x248(%rbp), %rdi
movb $0x0, -0x72(%rbp)
addq $0x18, %rdi
movq %rdi, -0x288(%rbp)
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x270(%rbp), %rcx
movq %rcx, 0x30(%rax)
leaq -0x70(%rbp), %rdi
callq 0x5200
leaq -0x71(%rbp), %rdi
callq 0x53c0
movq -0x288(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x28(%rax), %rsi
callq 0xca510
movq -0x288(%rbp), %rdi
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x28(%rax), %rsi
movl -0x18(%rbp), %edx
callq 0xca5f0
movq -0x288(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x30(%rax), %rsi
callq 0xca510
movq -0x288(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x30(%rax), %rsi
movl -0x1c(%rbp), %edx
callq 0xca5f0
movq -0x288(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x5150
movq -0x288(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq -0x280(%rbp), %rsi
movq 0x20(%rax), %rdx
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0xca7e0
movl %eax, -0x274(%rbp)
jmp 0xc9f06
movl -0x274(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x5200
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x20(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0xca5f0
jmp 0xca4d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xc9f6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5200
leaq -0x71(%rbp), %rdi
callq 0x53c0
testb $0x1, -0x72(%rbp)
jne 0xc9f7b
jmp 0xc9f8c
movq -0x270(%rbp), %rdi
movl $0x48, %esi
callq 0x5350
jmp 0xca4fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x5200
jmp 0xca4fc
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2731a(%rip), %rsi     # 0xf12e6
callq 0x2a580
testb $0x1, %al
jne 0xc9fda
jmp 0xca05b
movq -0x248(%rbp), %rdi
movq %rdi, %rax
addq $0xa8, %rax
movq %rax, -0x298(%rbp)
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdx
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x290(%rbp)
leaq -0x10(%rbp), %rsi
callq 0xccf50
movq -0x298(%rbp), %rdi
movq -0x290(%rbp), %rsi
callq 0xcced0
jmp 0xca02d
leaq -0xf0(%rbp), %rdi
callq 0xccf90
jmp 0xca4ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0xccf90
jmp 0xca4fc
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2739a(%rip), %rsi     # 0xf1413
callq 0x2a580
testb $0x1, %al
jne 0xca087
jmp 0xca31e
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x20(%rax), %rsi
callq 0xca510
movq -0x248(%rbp), %rdi
movl %eax, -0x14(%rbp)
addq $0x60, %rdi
movq %rdi, -0x2b0(%rbp)
callq 0xccfb0
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x2a4(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x55d0
movq -0x2a0(%rbp), %rdx
leaq 0x27321(%rip), %rsi     # 0xf1413
leaq -0x168(%rbp), %rdi
callq 0x19840
jmp 0xca100
movl $0x48, %edi
callq 0x5340
movq %rax, -0x2b8(%rbp)
jmp 0xca113
movb $0x1, -0x1ba(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x55d0
movq -0x2c0(%rbp), %rdx
leaq 0x272d7(%rip), %rsi     # 0xf1412
leaq -0x190(%rbp), %rdi
callq 0x19840
jmp 0xca149
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x55d0
movq -0x2c8(%rbp), %rdx
leaq 0x272b1(%rip), %rsi     # 0xf141b
leaq -0x1b8(%rbp), %rdi
callq 0x19840
jmp 0xca178
movq -0x2b8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
callq 0xbeae0
jmp 0xca194
movq -0x2b8(%rbp), %rcx
movl -0x2a4(%rbp), %esi
movb $0x0, -0x1ba(%rbp)
movl -0x14(%rbp), %r8d
movl -0x10(%rbp), %r9d
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rdx
callq 0xcd060
jmp 0xca1c5
movq -0x2b0(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0xccfe0
jmp 0xca1da
leaq -0x148(%rbp), %rdi
callq 0xcd100
leaq -0x1b8(%rbp), %rdi
callq 0x5200
leaq -0x1b9(%rbp), %rdi
callq 0x53c0
leaq -0x190(%rbp), %rdi
callq 0x5200
leaq -0x191(%rbp), %rdi
callq 0x53c0
leaq -0x168(%rbp), %rdi
callq 0x5200
leaq -0x169(%rbp), %rdi
callq 0x53c0
movq -0x248(%rbp), %rdi
addq $0x60, %rdi
movslq -0x14(%rbp), %rsi
callq 0xcd130
movq %rax, %rdi
callq 0xcd150
jmp 0xca4cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca30d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca301
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca2d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca2bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca2b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0xcd100
leaq -0x1b8(%rbp), %rdi
callq 0x5200
leaq -0x1b9(%rbp), %rdi
callq 0x53c0
leaq -0x190(%rbp), %rdi
callq 0x5200
leaq -0x191(%rbp), %rdi
callq 0x53c0
testb $0x1, -0x1ba(%rbp)
jne 0xca2ee
jmp 0xca2ff
movq -0x2b8(%rbp), %rdi
movl $0x48, %esi
callq 0x5350
jmp 0xca301
leaq -0x168(%rbp), %rdi
callq 0x5200
leaq -0x169(%rbp), %rdi
callq 0x53c0
jmp 0xca4fc
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq %rax, %rdi
leaq 0x2527b(%rip), %rsi     # 0xef5b7
callq 0x2a580
testb $0x1, %al
jne 0xca34a
jmp 0xca4ca
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x20(%rax), %rsi
callq 0xca510
movq -0x248(%rbp), %rdi
movl %eax, -0x14(%rbp)
addq $0x60, %rdi
movq %rdi, -0x2e0(%rbp)
callq 0xccfb0
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x2d4(%rbp)
leaq -0x239(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x55d0
movq -0x2d0(%rbp), %rdx
leaq 0x25202(%rip), %rsi     # 0xef5b7
leaq -0x238(%rbp), %rdi
callq 0x19840
jmp 0xca3c3
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movl -0x2d4(%rbp), %esi
movq 0x20(%rax), %rcx
movl -0x14(%rbp), %r8d
movl -0x10(%rbp), %r9d
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rdx
callq 0xcd060
jmp 0xca3fe
movq -0x2e0(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0xccfe0
jmp 0xca413
leaq -0x218(%rbp), %rdi
callq 0xcd100
leaq -0x238(%rbp), %rdi
callq 0x5200
leaq -0x239(%rbp), %rdi
callq 0x53c0
movq -0x248(%rbp), %rdi
addq $0x60, %rdi
movslq -0x14(%rbp), %rsi
callq 0xcd130
movq %rax, %rdi
callq 0xcd150
movq -0x248(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0xcceb0
movq -0x248(%rbp), %rdi
movq 0x20(%rax), %rsi
movl -0x20(%rbp), %edx
callq 0xca5f0
jmp 0xca4ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca4bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xca4b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0xcd100
leaq -0x238(%rbp), %rdi
callq 0x5200
leaq -0x239(%rbp), %rdi
callq 0x53c0
jmp 0xca4fc
jmp 0xca4cc
jmp 0xca4ce
jmp 0xca4d0
jmp 0xca4d2
jmp 0xca4d4
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xc998a
movq -0x248(%rbp), %rax
movq -0x10(%rbp), %rcx
movl %ecx, 0x14(%rax)
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x55b0
nopw %cs:(%rax,%rax)