// File: /workspace/github_cpp_makefile_star2_O3/fondoger[P]C0-Compiler/src/grammar.cpp
// Function: pExpression(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, DataType&)
static void pExpression(std::string &res, DataType &res_dtype)
{
    std::string temp_var;
    DataType temp_dtype;
    if (g_sym == PLUS || g_sym == MINUS) {
        bool isMinus = (g_sym == MINUS);
        readSymbol();
        if (isMinus) {
            pTerm(temp_var, temp_dtype); // no use of tempvar_dtype
            int val;
            if (isConstValue(temp_var, val)) {
                res = std::to_string(-val);
                res_dtype = DT_INT;
            } else {
                res = genTempVar();
                res_dtype = DT_INT;
                genMidCode(TEMP, "int", res, NONE);
                genMidCode(SUB, "0", temp_var, res);
            }
        } else {
            // no need to generate code for '+'
            pTerm(res, res_dtype);
            int t;
            if (isConstValue(res, t)) {
                res = std::to_string(t);
            }
            res_dtype = DT_INT;
        }
    } else {
        pTerm(res, res_dtype);
    }
    while (g_sym == PLUS || g_sym == MINUS) {
        OpCode op = (g_sym == PLUS ? ADD : SUB);
        readSymbol();
        pTerm(temp_var, temp_dtype); // no use of tempvar_dtype
        int t1, t2;
        if (isConstValue(res, t1) && isConstValue(temp_var, t2)) {
            // if both operands ares const value, we can calculate it
            res = std::to_string( op == ADD ? t1 + t2 : t1 - t2 );
            res_dtype = DT_INT;
        }
        else {
            std::string new_res = genTempVar();
            genMidCode(TEMP, "int", new_res, NONE);
            genMidCode(op, res, temp_var, new_res);
            res = new_res;
            res_dtype = DT_INT;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r15
movq %rdi, %r12
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x17977(%rip), %r14     # 0x29630
movl (%r14), %ebx
leal -0x13(%rbx), %eax
cmpl $0x1, %eax
movq %rsi, -0x60(%rbp)
ja 0x11d77
callq 0x19d18
cmpl $0x14, %ebx
jne 0x11d87
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x1224c
leaq -0xb0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x163ae
testb %al, %al
je 0x11e1d
movq %r12, -0x38(%rbp)
movl -0x90(%rbp), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %r15d
cmpl $0xa, %ebx
jb 0x11ed7
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0x11ec8
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x11ed4
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x11ed7
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x11d35
addl $-0x3, %r15d
jmp 0x11ed7
movq %r12, %rdi
movq %r15, %rsi
callq 0x1224c
jmp 0x11faa
movq %r12, %rdi
movq %r15, %rsi
callq 0x1224c
leaq -0x90(%rbp), %rsi
movq %r12, %rdi
callq 0x163ae
testb %al, %al
je 0x11fa3
movq %r12, -0x38(%rbp)
movl -0x90(%rbp), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x11f48
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x11ece
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x11f45
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x11f48
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x11ddb
addl $-0x3, %r12d
jmp 0x11f48
leaq -0x58(%rbp), %rdi
callq 0x15bcf
leaq -0x58(%rbp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3370
movq (%rbx), %rdi
leaq -0x48(%rbp), %r14
cmpq %r14, %rdi
je 0x11e46
callq 0x32a0
movl $0x1, (%r15)
leaq -0x2c(%rbp), %rdi
movl $0x17, (%rdi)
leaq -0x58(%rbp), %rsi
movq %r14, (%rsi)
movl $0x746e69, 0x10(%rsi)   # imm = 0x746E69
movq $0x3, 0x8(%rsi)
leaq 0x1310c(%rip), %rcx     # 0x24f80
movq %r12, %rdx
callq 0x150ec
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x11e8a
callq 0x32a0
leaq -0x2c(%rbp), %rdi
movl $0x2, (%rdi)
leaq -0x58(%rbp), %rsi
movq %r14, (%rsi)
movw $0x30, 0x10(%rsi)
movq $0x1, 0x8(%rsi)
leaq -0xb0(%rbp), %rdx
movq %r12, %rcx
callq 0x150ec
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x11f3c
callq 0x32a0
jmp 0x11f3c
addl $-0x2, %r15d
jmp 0x11ed7
addl $-0x2, %r12d
jmp 0x11f48
decl %r15d
xorl %esi, %esi
testl %r12d, %r12d
setg %sil
addl %r15d, %esi
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
leaq -0x58(%rbp), %rdi
movl $0x2d, %edx
callq 0x3350
xorl %edi, %edi
testl %r12d, %r12d
setg %dil
leaq -0x58(%rbp), %r12
addq (%r12), %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x13e46
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x3370
movq (%r12), %rdi
cmpq %r14, %rdi
je 0x11f2e
callq 0x32a0
movq -0x60(%rbp), %rax
movl $0x1, (%rax)
movq -0x38(%rbp), %r12
leaq 0x176ed(%rip), %r14     # 0x29630
jmp 0x11faa
decl %r12d
shrl $0x1f, %ebx
leal (%r12,%rbx), %esi
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
leaq -0x58(%rbp), %rdi
movl $0x2d, %edx
callq 0x3350
leaq -0x58(%rbp), %r13
addq (%r13), %rbx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x13e46
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x3370
movq (%r13), %rdi
cmpq %r14, %rdi
je 0x11f98
callq 0x32a0
movq -0x60(%rbp), %r15
leaq 0x1768d(%rip), %r14     # 0x29630
movl $0x1, (%r15)
movl (%r14), %eax
leal -0x13(%rax), %ecx
cmpl $0x1, %ecx
ja 0x121ae
leaq -0x80(%rbp), %r15
leaq -0xb0(%rbp), %rbx
movq %r12, -0x38(%rbp)
xorl %ecx, %ecx
cmpl $0x13, %eax
setne %cl
incl %ecx
movl %ecx, -0x2c(%rbp)
callq 0x19d18
movq %rbx, %rdi
leaq -0x70(%rbp), %rsi
callq 0x1224c
movq %r12, %rdi
leaq -0x6c(%rbp), %rsi
callq 0x163ae
testb %al, %al
je 0x12086
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
callq 0x163ae
testb %al, %al
je 0x12086
movl -0x68(%rbp), %eax
movl %eax, %r14d
negl %r14d
cmpl $0x1, -0x2c(%rbp)
cmovel %eax, %r14d
addl -0x6c(%rbp), %r14d
movl %r14d, %r12d
negl %r12d
cmovsl %r14d, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0x1212d
movl $0x4, %r13d
movl %r12d, %eax
cmpl $0x63, %eax
jbe 0x12124
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x1212a
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x1212d
movl %eax, %ecx
movl $0xd1b71759, %edx       # imm = 0xD1B71759
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r13d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x12042
addl $-0x3, %r13d
jmp 0x1212d
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0x15bcf
movl $0x17, -0x64(%rbp)
movq %r15, -0x90(%rbp)
movb $0x74, 0x2(%r15)
movw $0x6e69, (%r15)         # imm = 0x6E69
movq $0x3, -0x88(%rbp)
movb $0x0, -0x7d(%rbp)
leaq -0x64(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq %r13, %rdx
leaq 0x12eb1(%rip), %rcx     # 0x24f80
callq 0x150ec
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x120e5
callq 0x32a0
leaq -0x2c(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x150ec
movq %r12, %rdi
movq %r13, %rsi
callq 0x3160
movq -0x60(%rbp), %rax
movl $0x1, (%rax)
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x1219f
callq 0x32a0
jmp 0x1219f
addl $-0x2, %r13d
jmp 0x1212d
decl %r13d
movq %r15, %rbx
shrl $0x1f, %r14d
leal (%r14,%r13), %esi
leaq -0x48(%rbp), %r15
movq %r15, -0x58(%rbp)
leaq -0x58(%rbp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x3350
movl %r14d, %edi
addq -0x58(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x13e46
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3370
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x12184
callq 0x32a0
movq -0x60(%rbp), %rax
movl $0x1, (%rax)
leaq 0x1749b(%rip), %r14     # 0x29630
movq %rbx, %r15
leaq -0xb0(%rbp), %rbx
movl (%r14), %eax
leal -0x13(%rax), %ecx
cmpl $0x2, %ecx
jb 0x11fc8
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x121c6
callq 0x32a0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x121da
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
jne 0x12222
jmp 0x1222c
jmp 0x12229
jmp 0x12229
jmp 0x12229
jmp 0x12229
jmp 0x12229
jmp 0x12229
jmp 0x12229
jmp 0x12229
jmp 0x12229
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x12215
callq 0x32a0
jmp 0x12215
jmp 0x12229
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x1222c
callq 0x32a0
jmp 0x1222c
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x12244
callq 0x32a0
movq %rbx, %rdi
callq 0x3480