// File: /workspace/github_cpp_makefile_star2_O2/exrd[P]neteruhsp/neteruhsp/neteruhsp.cc
// Function: neteruhsp::evaluate_ast_node(neteruhsp::ast_node_t*, neteruhsp::value_stack_t*)
bool evaluate_ast_node( ast_node_t* n, value_stack_t* stack )
{
	switch( n->tag_ )
	{
		case NODE_EMPTY: break;

		case NODE_EXPRESSION:
			assert( n->left_ != nullptr );
			return evaluate_ast_node( n->left_, stack );

		case NODE_BOR:
		case NODE_BAND:
		case NODE_BXOR:
		case NODE_EQ:
		case NODE_NEQ:
		case NODE_GT:
		case NODE_GTOE:
		case NODE_LT:
		case NODE_LTOE:
		case NODE_ADD:
		case NODE_SUB:
		case NODE_MUL:
		case NODE_DIV:
		case NODE_MOD:
		{
			assert( n->left_ != nullptr );
			if ( !evaluate_ast_node( n->left_, stack ) )
			{
				return false;
			}
			assert( n->right_ != nullptr );
			if ( !evaluate_ast_node( n->right_, stack ) )
			{
				return false;
			}

			if ( stack->top_ < 2 )
			{
				print_error( "式評価：二項演算時に対象の値が存在してません：\n" );
				return false;
			}

			auto* left = stack_peek( stack, -2 );
			auto* right = stack_peek( stack, -1 );
			value_isolate( *left );

			switch( n->tag_ )
			{
				case NODE_BOR:		value_bor( left, *right ); break;
				case NODE_BAND:		value_band( left, *right ); break;
				case NODE_BXOR:		value_bxor( left, *right ); break;
				case NODE_EQ:		value_eq( left, *right ); break;
				case NODE_NEQ:		value_neq( left, *right ); break;
				case NODE_GT:		value_gt( left, *right ); break;
				case NODE_GTOE:		value_gtoe( left, *right ); break;
				case NODE_LT:		value_lt( left, *right ); break;
				case NODE_LTOE:		value_ltoe( left, *right ); break;
				case NODE_ADD:		value_add( left, *right ); break;
				case NODE_SUB:		value_sub( left, *right ); break;
				case NODE_MUL:		value_mul( left, *right ); break;
				case NODE_DIV:		value_div( left, *right ); break;
				case NODE_MOD:		value_mod( left, *right ); break;
				default: assert( false ); break;
			}

			stack_pop( stack, 1 );
			break;
		}

		case NODE_UNARY_MINUS:
		{
			assert( n->left_ != nullptr );
			if ( !evaluate_ast_node( n->left_, stack ) )
			{
				return false;
			}
			if ( stack->top_ < 1 )
			{
				print_error( "式評価：単項演算時に対象の値が存在してません：\n" );
				return false;
			}
			auto* const v = stack_peek( stack, -1 );
			value_isolate( *v );
			value_unary_minus( v );
			break;
		}

		case NODE_PRIMITIVE_VALUE:
		{
			switch( n->token_->tag_ )
			{
				case TOKEN_INTEGER:	stack_push( stack, create_value( atoi( n->token_->content_ ) ) ); break;
				case TOKEN_REAL:	stack_push( stack, create_value( atof( n->token_->content_ ) ) ); break;
				case TOKEN_STRING:	stack_push( stack, create_value( n->token_->content_ ) ); break;
				default: assert( false ); break;
			}
			break;
		}
		default:
			print_error( "式評価：サポートされてないノードの呼び出し（%s）@@ %d行目\n", n->token_->content_, n->token_->appear_line_ + 1 );
			return false;
	}
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x312f(%rip), %rax      # 0xb5d8
movl (%r14), %ecx
cmpq $0x1f, %rcx
ja 0x8607
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x84a9
leaq 0x65ca(%rip), %rdi      # 0xea99
leaq 0x33c3(%rip), %rsi      # 0xb899
leaq 0x65d0(%rip), %rcx      # 0xeaad
movl $0x176d, %edx           # imm = 0x176D
callq 0x20e0
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x8729
movq %rbx, %rsi
callq 0x8494
testb %al, %al
je 0x85d5
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x8748
movq %rbx, %rsi
callq 0x8494
testb %al, %al
je 0x85d5
cmpl $0x1, 0x8(%rbx)
jg 0x853c
leaq 0x65d5(%rip), %rdi      # 0xeb03
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x87c4
jmp 0x871b
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x6d39
movq %rax, %r12
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x6d39
movq %rax, %r15
movq %r12, %rdi
callq 0x47ad
movl (%r14), %eax
addl $-0x10, %eax
cmpl $0xd, %eax
ja 0x87a5
leaq 0x30e2(%rip), %rcx      # 0xb658
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r12, %rdi
movq %r15, %rsi
callq 0x6440
jmp 0x870e
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x8767
movq %rbx, %rsi
callq 0x8494
testb %al, %al
je 0x85d5
cmpl $0x0, 0x8(%rbx)
jle 0x8652
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x6d39
movq %rax, %rbx
movq %rax, %rdi
callq 0x47ad
movq %rbx, %rdi
callq 0x6b92
jmp 0x8719
xorl %ebx, %ebx
jmp 0x871b
movq 0x8(%r14), %rax
movl (%rax), %ecx
cmpl $0xb, %ecx
je 0x8639
cmpl $0xa, %ecx
je 0x8629
cmpl $0x9, %ecx
jne 0x8786
movq 0x8(%rax), %rdi
callq 0x2250
movl %eax, %edi
callq 0x60e2
jmp 0x8642
movq 0x8(%r14), %rax
movq 0x8(%rax), %rsi
movl 0x18(%rax), %edx
incl %edx
leaq 0x6576(%rip), %rdi      # 0xeb91
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x87c4
jmp 0x871b
movq 0x8(%rax), %rdi
callq 0x21c0
callq 0x611f
jmp 0x8642
movq 0x8(%rax), %rdi
callq 0x613c
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6cdd
jmp 0x8719
leaq 0x64f1(%rip), %rdi      # 0xeb4a
jmp 0x852e
movq %r12, %rdi
movq %r15, %rsi
callq 0x69ec
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x662e
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x6a59
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x68c6
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x652c
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x65a2
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x67c0
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x64b6
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x66ba
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x6aee
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x673d
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x6983
jmp 0x870e
movq %r12, %rdi
movq %r15, %rsi
callq 0x6843
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x6c55
movb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6369(%rip), %rdi      # 0xea99
leaq 0x3162(%rip), %rsi      # 0xb899
leaq 0x636f(%rip), %rcx      # 0xeaad
movl $0x177f, %edx           # imm = 0x177F
callq 0x20e0
leaq 0x639f(%rip), %rdi      # 0xeaee
leaq 0x3143(%rip), %rsi      # 0xb899
leaq 0x6350(%rip), %rcx      # 0xeaad
movl $0x1784, %edx           # imm = 0x1784
callq 0x20e0
leaq 0x632b(%rip), %rdi      # 0xea99
leaq 0x3124(%rip), %rsi      # 0xb899
leaq 0x6331(%rip), %rcx      # 0xeaad
movl $0x17ad, %edx           # imm = 0x17AD
callq 0x20e0
leaq 0x3ff8(%rip), %rdi      # 0xc785
leaq 0x3105(%rip), %rsi      # 0xb899
leaq 0x6312(%rip), %rcx      # 0xeaad
movl $0x17c4, %edx           # imm = 0x17C4
callq 0x20e0
leaq 0x3fd9(%rip), %rdi      # 0xc785
leaq 0x30e6(%rip), %rsi      # 0xb899
leaq 0x62f3(%rip), %rcx      # 0xeaad
movl $0x17a4, %edx           # imm = 0x17A4
callq 0x20e0