// File: /workspace/github_cpp_makefile_star2_O2/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 0x4638c(%rip), %rdi     # 0x8afd8
leaq 0x168ec(%rip), %rsi     # 0x5b53f
callq 0x5250
movq 0x8(%r14), %rax
movq 0x8(%rax), %rsi
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x44e6a
movq (%rbx), %rbp
movq 0x10(%r14), %rax
movq %r14, 0x8(%rsp)
subq 0x8(%r14), %rax
cmpq $0x11, %rax
jb 0x44dc2
leaq 0x50(%rsp), %rdi
leaq 0x1447c(%rip), %rsi     # 0x5910f
callq 0x5450
movq %r15, 0x10(%rsp)
pushq $0x1
popq %r15
movb $0x1, %al
xorl %r12d, %r12d
leaq 0xb8(%rsp), %r14
leaq 0x98(%rsp), %r13
movq %rbp, 0x18(%rsp)
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rcx
movq 0x10(%rdx), %rdx
subq %rcx, %rdx
sarq $0x4, %rdx
cmpq %rdx, %r15
jae 0x44dbd
movq %r15, 0x20(%rsp)
movq %rbp, %rbx
testb $0x1, %al
je 0x44d40
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbx
movq %r14, %rdi
leaq 0x478d7(%rip), %rsi     # 0x8c5d0
callq 0x3bb90
movq 0x18(%rsp), %rbp
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x5340
movq %r13, %r15
movq %rbx, %rdi
movq %r14, %r13
movq %r14, %rsi
movq %r15, %rdx
callq 0x46fc0
movq %r15, %rdi
callq 0x5120
movq %r13, %rdi
callq 0x5120
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rcx
movq %r15, %r13
movq 0x18(%rcx,%r12), %rsi
leaq 0x70(%rsp), %rdi
callq 0x44e6a
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax,%r12), %rax
movsbl 0xc(%rax), %edx
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x52e0
movq 0x70(%rsp), %r8
leaq 0x47849(%rip), %rdi     # 0x8c5d0
movq %r15, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x46a38
movq %r15, %rdi
callq 0x5120
leaq 0x78(%rsp), %rdi
callq 0x5120
movq 0x20(%rsp), %r15
incq %r15
addq $0x10, %r12
xorl %eax, %eax
movq %rbx, %rbp
jmp 0x44cbb
movq 0x10(%rsp), %r15
leaq 0x50(%rsp), %rbx
leaq 0x28(%rbp), %rdi
movq %rbx, %rsi
callq 0x5160
movq %rbp, (%r15)
leaq 0x8(%r15), %rdi
movq %rbx, %rsi
callq 0x5340
movq %rbx, %rdi
callq 0x5120
movq %r15, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x44e55
movq %rax, %r14
jmp 0x44e28
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0x5120
jmp 0x44e1b
movq %rax, %r14
leaq 0xb8(%rsp), %rdi
callq 0x5120
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x5270
jmp 0x44e58
jmp 0x44e55
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x5120
jmp 0x44e49
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0x5120
jmp 0x44e58
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x5120
movq %r14, %rdi
callq 0x53f0