// File: /workspace/github_cpp_makefile_star2_O1/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 0x480ca(%rip), %rdi     # 0xbffd8
leaq 0x215fa(%rip), %rsi     # 0x9950f
xorl %edx, %edx
callq 0x52e0
movq 0x8(%r14), %rax
movq 0x8(%rax), %rsi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x78259
movq (%rbx), %rbp
movq 0x10(%r14), %rax
movq %r14, 0x10(%rsp)
subq 0x8(%r14), %rax
cmpq $0x11, %rax
movq %r15, 0x88(%rsp)
jb 0x78119
leaq 0x68(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x1f1ac(%rip), %rcx     # 0x9710f
movl $0x7, %r8d
xorl %esi, %esi
callq 0x5370
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rax
subq 0x8(%rcx), %rax
cmpq $0x11, %rax
jb 0x78119
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 0x78057
movl $0x48, %edi
callq 0x5250
movq %rax, 0x8(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x495d3(%rip), %rsi     # 0xc15a8
callq 0x69190
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 0x36590
movq 0x8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movq %r15, %rdx
callq 0x7be1c
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7802d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x78052
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 0x78259
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 0x49505(%rip), %rdi     # 0xc15a8
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rcx
callq 0x7b53e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
movq 0x10(%rsp), %rbp
je 0x780d4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x780f9
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 0x77faa
jmp 0x7811e
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 0x36590
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x78175
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 0x781e8
jmp 0x781e8
movq %rax, %r14
jmp 0x781b7
movq %rax, %r14
jmp 0x781dc
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x781b7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x781dc
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x5260
movl $0x48, %esi
movq 0x8(%rsp), %rdi
jmp 0x78231
movq %rax, %r14
jmp 0x78236
movq %rax, %r14
jmp 0x78211
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x78211
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x78236
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x78251
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x5260
movq %r14, %rdi
callq 0x53d0