// File: /workspace/github_c_makefile_star2_O2/martincameron[P]towntalk/towntalk.c
// Function: evaluate_arithmetic_expression
enum result evaluate_arithmetic_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	struct expression *parameter = this->parameters;
	number lhs, rhs;
	if( !evaluate_number( parameter, vars, &lhs ) ) {
		return EXCEPTION;
	}
	while( parameter->next ) {
		parameter = parameter->next;
		if( !evaluate_number( parameter, vars, &rhs ) ) {
			return EXCEPTION;
		}
		switch( this->index ) {
			case '!': lhs = lhs != rhs; break;
			case '%':
				if( rhs != 0 ) {
					lhs = ( long_int ) lhs % ( long_int ) rhs;
				} else {
					return throw( vars, this, 0, "Modulo division by zero." );
				}
				break;
			case '&': lhs = ( long_int ) lhs & ( long_int ) rhs; break;
			case '(': lhs = lhs <= rhs; break;
			case ')': lhs = lhs >= rhs; break;
			case '*': lhs = lhs  * rhs; break;
			case '+': lhs = lhs  + rhs; break;
			case '-': lhs = lhs  - rhs; break;
			case '/':
				if( rhs != 0 ) {
					lhs = ( long_int ) lhs / ( long_int ) rhs;
				} else {
					return throw( vars, this, 0, "Integer division by zero." );
				}
				break;
			case '0': lhs = lhs / rhs; break;
			case '1': lhs = ( long_int ) lhs << ( long_int ) rhs; break;
			case '2': lhs = ( long_int ) lhs >> ( long_int ) rhs; break;
			case '3': lhs = ( long_int ) lhs  ^ ( long_int ) rhs; break;
			case ':': lhs = ( long_int ) lhs  | ( long_int ) rhs; break;
			case '<': lhs = lhs  < rhs; break;
			case '=': lhs = lhs == rhs; break;
			case '>': lhs = lhs  > rhs; break;
			default :
				return throw( vars, this, 0, "Unhandled integer operator." );
		}
	}
	result->number_value = lhs;
	return OKAY;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %r13
leaq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4449
xorl %ebx, %ebx
testl %eax, %eax
je 0x4b21
movq %r12, 0x10(%rsp)
leaq 0xc(%rsp), %rbp
leaq 0xc713(%rip), %r12      # 0x110b8
movq 0x10(%r13), %r13
testq %r13, %r13
je 0x4b13
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x4449
testl %eax, %eax
je 0x4b21
movl 0x4(%r14), %eax
addl $-0x21, %eax
cmpl $0x1d, %eax
ja 0x4b32
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setne %cl
movl %ecx, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setge %cl
movl %ecx, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x4b3b
movl 0x8(%rsp), %eax
cltd
idivl %ecx
movl %eax, 0x8(%rsp)
jmp 0x49a5
movb 0xc(%rsp), %cl
sarl %cl, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %eax
orl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %eax
addl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %eax
andl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x4b44
movl 0x8(%rsp), %eax
cltd
idivl %ecx
movl %edx, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setle %cl
movl %ecx, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
cltd
idivl 0xc(%rsp)
movl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %eax
imull 0x8(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %eax
xorl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0xc(%rsp), %eax
subl %eax, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
sete %cl
movl %ecx, 0x8(%rsp)
jmp 0x49a5
movb 0xc(%rsp), %cl
shll %cl, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setl %cl
movl %ecx, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setg %cl
movl %ecx, 0x8(%rsp)
jmp 0x49a5
movl 0x8(%rsp), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc732(%rip), %rcx      # 0x1126b
jmp 0x4b4b
leaq 0xc70f(%rip), %rcx      # 0x11251
jmp 0x4b4b
leaq 0xc6ed(%rip), %rcx      # 0x11238
xorl %ebx, %ebx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3bb2
jmp 0x4b21