// File: /workspace/github_c_makefile_star2_O3/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 0x460d
xorl %ebx, %ebx
testl %eax, %eax
je 0x4d0c
movq %r12, 0x10(%rsp)
movq 0x10(%r13), %r13
testq %r13, %r13
je 0x4cfc
leaq 0xc(%rsp), %rbp
leaq 0xd4fb(%rip), %r12      # 0x120b8
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x460d
testl %eax, %eax
je 0x4d0c
movl 0x4(%r14), %eax
addl $-0x21, %eax
cmpl $0x1d, %eax
ja 0x4d1d
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movl 0x8(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc(%rsp), %ecx
setne %al
jmp 0x4ce9
movl 0x8(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc(%rsp), %ecx
setge %al
jmp 0x4ce9
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x4d26
movl 0x8(%rsp), %eax
cltd
idivl %ecx
jmp 0x4ce9
movl 0x8(%rsp), %eax
movb 0xc(%rsp), %cl
sarl %cl, %eax
jmp 0x4ce9
movl 0xc(%rsp), %eax
orl 0x8(%rsp), %eax
jmp 0x4ce9
movl 0xc(%rsp), %eax
addl 0x8(%rsp), %eax
jmp 0x4ce9
movl 0xc(%rsp), %eax
andl 0x8(%rsp), %eax
jmp 0x4ce9
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x4d2f
movl 0x8(%rsp), %eax
cltd
idivl %ecx
movl %edx, %eax
movl %edx, 0x8(%rsp)
jmp 0x4ced
movl 0x8(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc(%rsp), %ecx
setle %al
jmp 0x4ce9
movl 0x8(%rsp), %eax
cltd
idivl 0xc(%rsp)
jmp 0x4ce9
movl 0xc(%rsp), %eax
imull 0x8(%rsp), %eax
jmp 0x4ce9
movl 0xc(%rsp), %eax
xorl 0x8(%rsp), %eax
jmp 0x4ce9
movl 0x8(%rsp), %eax
subl 0xc(%rsp), %eax
jmp 0x4ce9
movl 0x8(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc(%rsp), %ecx
sete %al
jmp 0x4ce9
movl 0x8(%rsp), %eax
movb 0xc(%rsp), %cl
shll %cl, %eax
jmp 0x4ce9
movl 0x8(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc(%rsp), %ecx
setl %al
jmp 0x4ce9
movl 0x8(%rsp), %ecx
xorl %eax, %eax
cmpl 0xc(%rsp), %ecx
setg %al
movl %eax, 0x8(%rsp)
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0x4bbd
jmp 0x4d00
movl 0x8(%rsp), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd507(%rip), %rcx      # 0x1222b
jmp 0x4d36
leaq 0xd4e4(%rip), %rcx      # 0x12211
jmp 0x4d36
leaq 0xd4c2(%rip), %rcx      # 0x121f8
xorl %ebx, %ebx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3c96
jmp 0x4d0c