// File: /workspace/github_cpp_makefile_star2_O1/lhydave[P]SysYCompilerLab/back/eeyore_AST.cpp
// Function: eeyore_AST::parseop(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static shared_ptr<op_node> parseop(const string &line)
{
	std::istringstream line_f(line);
	shared_ptr<op_node> ret;
	switch (line[0])
	{
	// function call
	case 'c':
	{
		string temp, func_name;
		line_f >> temp >> func_name;
		auto func_call = make_shared<call_node>(func_name);
		while (!params.empty())
		{
			func_call->params.push_back(params.front());
			params.pop();
		}
		ret = func_call;
		break;
	}
	// unary operator
	case '-':
	case '!':
	{
		char ch;
		string subline;
		line_f >> ch;
		auto op = line.substr(0, 1);
		// number
		if (isdigit(line_f.peek()))
		{
			int num;
			line_f >> num;
			num = op == "!" ? !num : -num;
			ret = make_shared<num_node>(num);
			break;
		}
		// variable
		line_f >> subline;
		auto var = make_shared<var_node>(subline);
		ret = make_shared<op_node>(EXP_OP, op, var);
		break;
	}
	// binary, number, or variable
	default:
	{
		auto first_sq = line.find('[');
		auto last_sq = line.find(']');
		if (first_sq != std::string::npos) // array
		{
			auto left = line.substr(0, first_sq);
			auto right = line.substr(first_sq + 1, last_sq - first_sq - 1);
			ret = make_shared<op_node>(
				EXP_ARRAY, "m", parse_var_num(left), parse_var_num(right));
			break;
		}
		string left, op, right;
		line_f >> left;
		if (line_f.peek() == EOF) // a number of variable
			ret = parse_var_num(left);
		else // a binary operator
		{
			line_f >> op >> right;
			ret = make_shared<op_node>(
				EXP_OP, op, parse_var_num(left), parse_var_num(right));
			dbg_printf("left: %s, right: %s\n", left.c_str(), right.c_str());
		}
		break;
	}
	} // switch
	return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xb0(%rsp), %rdi
movl $0x8, %edx
callq 0x5480
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq (%r14), %rax
movzbl (%rax), %eax
cmpl $0x21, %eax
je 0x17e5f
cmpl $0x2d, %eax
je 0x17e5f
cmpl $0x63, %eax
jne 0x17f29
leaq 0x80(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0xb0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5320
leaq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x5320
leaq 0x38(%rsp), %r14
movq $0x0, -0x8(%r14)
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
callq 0x19a6e
movq 0x1d9dc(%rip), %rsi     # 0x357b8
cmpq %rsi, 0x1d9f5(%rip)     # 0x357d8
je 0x17e12
leaq 0x1d9bc(%rip), %r15     # 0x357a8
movq 0x30(%rsp), %rdi
addq $0x50, %rdi
callq 0x19a2e
movq %r15, %rdi
callq 0x1b0b2
movq 0x1d9af(%rip), %rsi     # 0x357b8
cmpq %rsi, 0x1d9c8(%rip)     # 0x357d8
jne 0x17dec
movq 0x30(%rsp), %rax
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x19e70
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x17e35
callq 0x18722
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x17e4c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
jne 0x18134
jmp 0x18144
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0xb0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x5340
leaq 0x50(%rsp), %rdi
movl $0x1, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0x5260
leaq 0xb0(%rsp), %rdi
callq 0x50f0
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x18069
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x5160
leaq 0x11103(%rip), %rsi     # 0x28fd2
leaq 0x50(%rsp), %rdi
callq 0x50a0
leaq 0x10(%rsp), %rcx
movl (%rcx), %edx
xorl %esi, %esi
testl %edx, %edx
sete %sil
negl %edx
testl %eax, %eax
cmovnel %edx, %esi
movl %esi, (%rcx)
leaq 0x38(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x30(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x1962e
movaps 0x30(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x30(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
jmp 0x180f6
movq %r14, %rdi
movl $0x5b, %esi
xorl %edx, %edx
callq 0x5330
movq %rax, %r15
movq %r14, %rdi
movl $0x5d, %esi
xorl %edx, %edx
callq 0x5330
cmpq $-0x1, %r15
je 0x18179
movq %rax, %r12
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x5260
leaq 0x1(%r15), %rdx
notq %r15
addq %r15, %r12
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x5260
movl $0x2, 0xa0(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x17c26
leaq 0x90(%rsp), %r14
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x17c26
leaq 0x38(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r14, (%rsp)
leaq 0x11817(%rip), %r8      # 0x297e1
leaq 0x30(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0xa0(%rsp), %rcx
leaq 0x10(%rsp), %r9
callq 0x1a1c4
movaps 0x30(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x30(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x18004
callq 0x18722
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x18013
callq 0x18722
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x18025
callq 0x18722
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18034
callq 0x18722
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1804f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5240
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x18134
jmp 0x18144
leaq 0xb0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5320
leaq 0x38(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x70(%rsp), %rcx
callq 0x19eb6
leaq 0x90(%rsp), %rcx
movl $0x3, (%rcx)
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x50(%rsp), %r8
leaq 0x30(%rsp), %r9
callq 0x19f28
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x180f1
callq 0x18722
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18100
callq 0x18722
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x1810f
callq 0x18722
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1812a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x18144
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x1ce7d(%rip), %rsi     # 0x34fc8
leaq 0xb0(%rsp), %rdi
callq 0x5390
leaq 0x128(%rsp), %rdi
callq 0x50d0
movq %rbx, %rax
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0xb0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x5320
leaq 0xb0(%rsp), %rdi
callq 0x50f0
cmpl $-0x1, %eax
je 0x182a3
leaq 0xb0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x5320
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0x5320
movl $0x3, 0x28(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x17c26
leaq 0xa0(%rsp), %r14
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x17c26
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r14, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0x2f(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x50(%rsp), %r8
leaq 0x90(%rsp), %r9
callq 0x1a302
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x18278
callq 0x18722
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18287
callq 0x18722
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x18299
callq 0x18722
movq 0x98(%rsp), %rdi
jmp 0x182d5
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x17c26
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x8(%rbx), %rdi
movups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x182d0
callq 0x18722
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x182df
callq 0x18722
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x182f6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
jne 0x1811d
jmp 0x1812a
jmp 0x183d4
movq %rax, %r14
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x18328
callq 0x18722
jmp 0x18328
movq %rax, %r14
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x183d7
callq 0x18722
jmp 0x183d7
jmp 0x183d4
movq %rax, %r14
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x18362
callq 0x18722
jmp 0x18362
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18376
callq 0x18722
jmp 0x18376
movq %rax, %r14
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18396
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0x18396
movq %rax, %r14
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x18463
jmp 0x18473
movq %rax, %r14
jmp 0x18473
movq %rax, %r14
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x18409
callq 0x18722
jmp 0x18409
jmp 0x18406
jmp 0x18406
jmp 0x18406
jmp 0x183fc
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x183ee
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
jne 0x18417
jmp 0x18424
jmp 0x18401
movq %rax, %r14
jmp 0x18442
movq %rax, %r14
jmp 0x18424
movq %rax, %r14
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18424
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
jne 0x18463
jmp 0x18473
movq %rax, %r14
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x18442
callq 0x18722
movq 0x50(%rsp), %rdi
cmpq %r13, %rdi
je 0x18459
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x18473
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x18481
callq 0x18722
movq 0x1cb40(%rip), %rsi     # 0x34fc8
leaq 0xb0(%rsp), %rdi
callq 0x5390
leaq 0x128(%rsp), %rdi
callq 0x50d0
movq %r14, %rdi
callq 0x54c0