// File: /workspace/github_c_makefile_star2_O1/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 0x463a
xorl %ebx, %ebx
testl %eax, %eax
je 0x4d42
movq %r12, 0x10(%rsp)
movq 0x10(%r13), %r13
testq %r13, %r13
je 0x4d32
leaq 0xc(%rsp), %rbp
leaq 0xd4be(%rip), %r12      # 0x120b8
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x463a
testl %eax, %eax
je 0x4d42
movl 0x4(%r14), %eax
addl $-0x21, %eax
cmpl $0x1d, %eax
ja 0x4d53
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setne %cl
jmp 0x4d21
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setge %cl
jmp 0x4d21
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x4d5c
movl 0x8(%rsp), %eax
cltd
idivl %ecx
jmp 0x4cd2
movb 0xc(%rsp), %cl
sarl %cl, 0x8(%rsp)
jmp 0x4d25
movl 0xc(%rsp), %eax
orl %eax, 0x8(%rsp)
jmp 0x4d25
movl 0xc(%rsp), %eax
addl %eax, 0x8(%rsp)
jmp 0x4d25
movl 0xc(%rsp), %eax
andl %eax, 0x8(%rsp)
jmp 0x4d25
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
je 0x4d65
movl 0x8(%rsp), %eax
cltd
idivl %ecx
movl %edx, 0x8(%rsp)
jmp 0x4d25
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setle %cl
jmp 0x4d21
movl 0x8(%rsp), %eax
cltd
idivl 0xc(%rsp)
jmp 0x4cd2
movl 0xc(%rsp), %eax
imull 0x8(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x4d25
movl 0xc(%rsp), %eax
xorl %eax, 0x8(%rsp)
jmp 0x4d25
movl 0xc(%rsp), %eax
subl %eax, 0x8(%rsp)
jmp 0x4d25
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
sete %cl
jmp 0x4d21
movb 0xc(%rsp), %cl
shll %cl, 0x8(%rsp)
jmp 0x4d25
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setl %cl
jmp 0x4d21
movl 0x8(%rsp), %eax
xorl %ecx, %ecx
cmpl 0xc(%rsp), %eax
setg %cl
movl %ecx, 0x8(%rsp)
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0x4bfa
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 0xd4c9(%rip), %rcx      # 0x12223
jmp 0x4d6c
leaq 0xd4a6(%rip), %rcx      # 0x12209
jmp 0x4d6c
leaq 0xd484(%rip), %rcx      # 0x121f0
xorl %ebx, %ebx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3cc3
jmp 0x4d42