// File: /workspace/github_cpp_makefile_star2_O1/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 0x178b2(%rip), %r14     # 0x29630
movl (%r14), %ebx
leal -0x13(%rbx), %eax
cmpl $0x1, %eax
movq %rsi, -0x60(%rbp)
ja 0x11e3c
callq 0x19e44
cmpl $0x14, %ebx
jne 0x11e4c
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x12311
leaq -0xb0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x16448
testb %al, %al
je 0x11ee2
movq %r12, -0x38(%rbp)
movl -0x90(%rbp), %r12d
movl %r12d, %ebx
negl %ebx
cmovsl %r12d, %ebx
movl $0x1, %r15d
cmpl $0xa, %ebx
jb 0x11f9c
movl $0x4, %r15d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebx, %ecx
cmpl $0x63, %ecx
jbe 0x11f8d
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x11f99
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x11f9c
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r15d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x11dfa
addl $-0x3, %r15d
jmp 0x11f9c
movq %r12, %rdi
movq %r15, %rsi
callq 0x12311
jmp 0x1206f
movq %r12, %rdi
movq %r15, %rsi
callq 0x12311
leaq -0x90(%rbp), %rsi
movq %r12, %rdi
callq 0x16448
testb %al, %al
je 0x12068
movq %r12, -0x38(%rbp)
movl -0x90(%rbp), %ebx
movl %ebx, %r15d
negl %r15d
cmovsl %ebx, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x1200d
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x11f93
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x1200a
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x1200d
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x11ea0
addl $-0x3, %r12d
jmp 0x1200d
leaq -0x58(%rbp), %rdi
callq 0x15c69
leaq -0x58(%rbp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3370
movq (%rbx), %rdi
leaq -0x48(%rbp), %r14
cmpq %r14, %rdi
je 0x11f0b
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 0x13047(%rip), %rcx     # 0x24f80
movq %r12, %rdx
callq 0x151b0
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x11f4f
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 0x151b0
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x12001
callq 0x32a0
jmp 0x12001
addl $-0x2, %r15d
jmp 0x11f9c
addl $-0x2, %r12d
jmp 0x1200d
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 0x13f04
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x3370
movq (%r12), %rdi
cmpq %r14, %rdi
je 0x11ff3
callq 0x32a0
movq -0x60(%rbp), %rax
movl $0x1, (%rax)
movq -0x38(%rbp), %r12
leaq 0x17628(%rip), %r14     # 0x29630
jmp 0x1206f
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 0x13f04
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x3370
movq (%r13), %rdi
cmpq %r14, %rdi
je 0x1205d
callq 0x32a0
movq -0x60(%rbp), %r15
leaq 0x175c8(%rip), %r14     # 0x29630
movl $0x1, (%r15)
movl (%r14), %eax
leal -0x13(%rax), %ecx
cmpl $0x1, %ecx
ja 0x12273
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 0x19e44
movq %rbx, %rdi
leaq -0x70(%rbp), %rsi
callq 0x12311
movq %r12, %rdi
leaq -0x6c(%rbp), %rsi
callq 0x16448
testb %al, %al
je 0x1214b
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
callq 0x16448
testb %al, %al
je 0x1214b
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 0x121f2
movl $0x4, %r13d
movl %r12d, %eax
cmpl $0x63, %eax
jbe 0x121e9
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x121ef
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x121f2
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 0x12107
addl $-0x3, %r13d
jmp 0x121f2
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0x15c69
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 0x12dec(%rip), %rcx     # 0x24f80
callq 0x151b0
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x121aa
callq 0x32a0
leaq -0x2c(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x151b0
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 0x12264
callq 0x32a0
jmp 0x12264
addl $-0x2, %r13d
jmp 0x121f2
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 0x13f04
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3370
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x12249
callq 0x32a0
movq -0x60(%rbp), %rax
movl $0x1, (%rax)
leaq 0x173d6(%rip), %r14     # 0x29630
movq %rbx, %r15
leaq -0xb0(%rbp), %rbx
movl (%r14), %eax
leal -0x13(%rax), %ecx
cmpl $0x2, %ecx
jb 0x1208d
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x1228b
callq 0x32a0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1229f
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
jne 0x122e7
jmp 0x122f1
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
jmp 0x122ee
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x122da
callq 0x32a0
jmp 0x122da
jmp 0x122ee
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x122f1
callq 0x32a0
jmp 0x122f1
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x12309
callq 0x32a0
movq %rbx, %rdi
callq 0x3480