// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: simple_expression(int)
int simple_expression(int k)
{
	TreeNode tNode= tree.node[k];
	TreeNode childNode;
    int flag1, flag2;
    if(lookahead(k) == 33)//33是term
    {
        flag1 = term(tree.node[k].child[0]);
        
        flag2 = simple_expression1(tree.node[k].child[1]);
        
        if (flag1 >= flag2)
            return flag1;
        else if (flag1 <= flag2)
            return flag2;
        else
        {
            cout<<"type not match where simple_expression"<<endl;
            return -1;
        }
    }
    else if (lookahead(k) == 37)//37是sign
    {
        sign(tree.node[k].child[0]);
        
        flag1 = term(tree.node[k].child[1]);
        
        flag2 = simple_expression1(tree.node[k].child[2]);
        
        if (flag1 >= flag2)
            return flag1;
        else if (flag1 <= flag2)
            return flag2;
        else
        {
            cout<<"type not match where simple_expression"<<endl;
            return -1;
        }
    }
    else
    {
        cout<<"simple_expression error!"<<endl;
        return -1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movl %edi, -0x8(%rbp)
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb4348(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x14920
leaq -0x158(%rbp), %rdi
callq 0x149d0
movl -0x8(%rbp), %edi
callq 0xca50
movl %eax, -0x174(%rbp)
jmp 0x11e1d
movl -0x174(%rbp), %eax
cmpl $0x21, %eax
jne 0x11f4c
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb42fa(%rip), %rax     # 0xc6138
movl 0xc(%rax,%rcx), %edi
callq 0x125a0
movl %eax, -0x178(%rbp)
jmp 0x11e4f
movl -0x178(%rbp), %eax
movl %eax, -0x15c(%rbp)
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb42cb(%rip), %rax     # 0xc6138
movl 0x10(%rax,%rcx), %edi
callq 0x12690
movl %eax, -0x17c(%rbp)
jmp 0x11e7e
movl -0x17c(%rbp), %eax
movl %eax, -0x160(%rbp)
movl -0x15c(%rbp), %eax
cmpl -0x160(%rbp), %eax
jl 0x11edf
movl -0x15c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x170(%rbp)
jmp 0x120b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x14a90
leaq -0xb0(%rbp), %rdi
callq 0x14a90
jmp 0x120dc
movl -0x15c(%rbp), %eax
cmpl -0x160(%rbp), %eax
jg 0x11f05
movl -0x160(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x170(%rbp)
jmp 0x120b8
movq 0x140bc(%rip), %rdi     # 0x25fc8
leaq 0xcb81(%rip), %rsi      # 0x1ea94
callq 0x3280
movq %rax, -0x188(%rbp)
jmp 0x11f21
movq -0x188(%rbp), %rdi
movq 0x14081(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x11f36
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x170(%rbp)
jmp 0x120b8
movl -0x8(%rbp), %edi
callq 0xca50
movl %eax, -0x18c(%rbp)
jmp 0x11f5c
movl -0x18c(%rbp), %eax
cmpl $0x25, %eax
jne 0x12076
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb41bb(%rip), %rax     # 0xc6138
movl 0xc(%rax,%rcx), %edi
callq 0x128d0
jmp 0x11f88
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb419e(%rip), %rax     # 0xc6138
movl 0x10(%rax,%rcx), %edi
callq 0x125a0
movl %eax, -0x190(%rbp)
jmp 0x11fab
movl -0x190(%rbp), %eax
movl %eax, -0x15c(%rbp)
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb416f(%rip), %rax     # 0xc6138
movl 0x14(%rax,%rcx), %edi
callq 0x12690
movl %eax, -0x194(%rbp)
jmp 0x11fda
movl -0x194(%rbp), %eax
movl %eax, -0x160(%rbp)
movl -0x15c(%rbp), %eax
cmpl -0x160(%rbp), %eax
jl 0x1200c
movl -0x15c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x170(%rbp)
jmp 0x120b8
movl -0x15c(%rbp), %eax
cmpl -0x160(%rbp), %eax
jg 0x12032
movl -0x160(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x170(%rbp)
jmp 0x120b8
movq 0x13f8f(%rip), %rdi     # 0x25fc8
leaq 0xca54(%rip), %rsi      # 0x1ea94
callq 0x3280
movq %rax, -0x1a0(%rbp)
jmp 0x1204e
movq -0x1a0(%rbp), %rdi
movq 0x13f54(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x12063
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x170(%rbp)
jmp 0x120b8
movq 0x13f4b(%rip), %rdi     # 0x25fc8
leaq 0xca37(%rip), %rsi      # 0x1eabb
callq 0x3280
movq %rax, -0x1a8(%rbp)
jmp 0x12092
movq -0x1a8(%rbp), %rdi
movq 0x13f10(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x120a7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x170(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x14a90
leaq -0xb0(%rbp), %rdi
callq 0x14a90
movl -0x4(%rbp), %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x168(%rbp), %rdi
callq 0x3450
nopl (%rax,%rax)