// File: /workspace/github_c_makefile_star2_O0/martincameron[P]towntalk/towntalk.c
// Function: evaluate_index_expression
enum result evaluate_index_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	int idx;
	struct array *arr;
	enum result ret = OKAY;
	struct expression *parameter = this->parameters;
	struct variable src = { 0, NULL };
	if( parameter->evaluate == evaluate_local ) {
		arr = ( struct array * ) vars->locals[ parameter->index ].string_value;
	} else {
		ret = parameter->evaluate( parameter, vars, &src );
		arr = ( struct array * ) src.string_value;
	}
	if( ret ) {
		if( arr && arr->str.type == ARRAY ) {
			ret = evaluate_integer( parameter->next, vars, &idx );
			if( ret ) {
				if( ( unsigned int ) idx < ( unsigned int ) arr->length ) {
					result->number_value = arr->number_values[ idx ];
					if( arr->string_values && arr->string_values[ idx ] ) {
						result->string_value = arr->string_values[ idx ];
						result->string_value->reference_count++;
					}
				} else {
					ret = throw( vars, this, idx, "Array index out of bounds." );
				}
			}
		} else {
			ret = throw( vars, this, 0, "Not an array." );
		}
		dispose_temporary( &src );
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x30f0
movq -0x38(%rbp), %rax
leaq -0xe32(%rip), %rcx      # 0x4bc0
cmpq %rcx, 0x18(%rax)
jne 0x5a19
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movslq 0x4(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x5a3a
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq *%rax
movl %eax, -0x2c(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5b2d
cmpq $0x0, -0x28(%rbp)
je 0x5b0b
movq -0x28(%rbp), %rax
movsbl 0x14(%rax), %eax
cmpl $0x2, %eax
jne 0x5b0b
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x5460
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5b09
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jae 0x5aed
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x5aeb
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x5aeb
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x5b07
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq 0x15b94(%rip), %rcx     # 0x1b693
callq 0x4330
movl %eax, -0x2c(%rbp)
jmp 0x5b09
jmp 0x5b24
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %edx, %edx
leaq 0x15b92(%rip), %rcx     # 0x1b6ae
callq 0x4330
movl %eax, -0x2c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3ce0
movl -0x2c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)