// File: /workspace/github_cpp_makefile_star2_O3/sighingnow[P]compile-pascal/pl0_tac_gen.cpp
// Function: pl0_tac_term[abi:cxx11](pl0_ast_term const*)
pair<Value *, string> pl0_tac_term(pl0_ast_term const *term) {
    cout << __func__;
    bool needtmp = true;
    pair<Value *, string> head = pl0_tac_factor(term->factors[0].second);
    Value *ans = head.first, *prev = head.first;
    if (term->factors.size() > 1) {
        head.second = "integer"; // type casting.
        for (size_t i = 1; i < term->factors.size(); ++i) {
            if (needtmp) { ans = new Value(irb.maketmp(), head.second); }
            auto element = pl0_tac_factor(term->factors[i].second);
            // if (element.second != head.second) {
            //     pl0_ast_error(term->factors[i].second->loc, "do *// operation on two factors with different types.");
            // }
            irb.emit(string(1, term->factors[i].first->op), ans, needtmp ? prev : ans, element.first);
            needtmp = false; // no more temporary variable.
        }
    }
    ans->dt = head.second;
    return make_pair(ans, head.second);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq 0x47a52(%rip), %rdi     # 0xb9fd8
leaq 0x20f82(%rip), %rsi     # 0x9350f
xorl %edx, %edx
callq 0x52e0
movq 0x8(%r14), %rax
movq 0x8(%rax), %rsi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x728d1
movq (%rbx), %rbp
movq 0x10(%r14), %rax
movq %r14, 0x10(%rsp)
subq 0x8(%r14), %rax
cmpq $0x11, %rax
movq %r15, 0x88(%rsp)
jb 0x72791
leaq 0x68(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x1eb34(%rip), %rcx     # 0x9110f
movl $0x7, %r8d
xorl %esi, %esi
callq 0x5370
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rax
subq 0x8(%rcx), %rax
cmpq $0x11, %rax
jb 0x72791
movb $0x1, %al
movl $0x1, %r12d
xorl %ebx, %ebx
leaq 0x40(%rsp), %r13
leaq 0x20(%rsp), %r14
movq %rbp, 0x18(%rsp)
movq %rbp, 0x8(%rsp)
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r15
testb $0x1, %al
je 0x726cf
movl $0x48, %edi
callq 0x5250
movq %rax, 0x8(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x48f5b(%rip), %rsi     # 0xbb5a8
callq 0x632b2
movq %r13, %r15
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x351dc
movq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movq %r15, %rdx
callq 0x7653e
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x726a5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x726ca
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x18(%rsp), %r15
movq 0x8(%rbp), %rax
movq 0x18(%rax,%rbx), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x728d1
movq 0x8(%rbp), %rax
movq 0x10(%rax,%rbx), %rax
movsbl 0xc(%rax), %edx
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x1, %esi
movq %r14, %rbp
movq %r14, %rdi
callq 0x5300
movq 0xb0(%rsp), %r8
leaq 0x48e8d(%rip), %rdi     # 0xbb5a8
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rcx
callq 0x75c2c
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
movq 0x10(%rsp), %rbp
je 0x7274c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x72771
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5260
incq %r12
movq 0x10(%rbp), %rcx
subq 0x8(%rbp), %rcx
sarq $0x4, %rcx
addq $0x10, %rbx
xorl %eax, %eax
cmpq %rcx, %r12
jb 0x72622
jmp 0x72796
movq %rbp, 0x8(%rsp)
leaq 0x68(%rsp), %rsi
movq 0x8(%rsp), %r14
leaq 0x28(%r14), %rdi
callq 0x5150
movq 0x88(%rsp), %rbx
movq %r14, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x18(%rbx), %rax
movq %rax, 0x8(%rbx)
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
addq %rsi, %rdx
callq 0x351dc
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x727ed
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5260
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x72860
jmp 0x72860
movq %rax, %r14
jmp 0x7282f
movq %rax, %r14
jmp 0x72854
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7282f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x72854
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5260
movl $0x48, %esi
movq 0x8(%rsp), %rdi
jmp 0x728a9
movq %rax, %r14
jmp 0x728ae
movq %rax, %r14
jmp 0x72889
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x72889
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x728ae
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x728c9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5260
movq %r14, %rdi
callq 0x53d0