// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/towntalk.c
// Function: evaluate_thiscall_expression
static enum result evaluate_thiscall_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	int idx, count;
	struct array *arr;
	struct variable obj = { 0 };
	struct string *function = NULL;
	struct function_expression call_expr = { 0 };
	struct value_expression obj_expr = { 0 };
	struct structure *struc = ( struct structure * ) ( ( struct value_expression * ) this )->str;
	enum result ret = this->parameters->evaluate( this->parameters, vars, &obj );
	if( ret ) {
		ret = is_instance( &obj, struc, vars, this );
		if( ret ) {
			arr = ( struct array * ) obj.string_value;
			idx = this->index >> 8;
			count = this->index & 0xFF;
			if( arr->string_values ) {
				function = arr->string_values[ idx ];
			}
			if( function && function->type == FUNCTION ) {
				obj_expr.str = obj.string_value;
				obj_expr.expr.evaluate = evaluate_string_literal_expression;
				obj_expr.expr.next = this->parameters->next;
				call_expr.expr.line = this->line;
				call_expr.function = ( struct function * ) function;
				call_expr.expr.parameters = &obj_expr.expr;
				if( call_expr.function->num_parameters == count ) {
					function->reference_count++;
					ret = evaluate_call_expression( &call_expr.expr, vars, result );
					function->reference_count--;
				} else {
					ret = throw( vars, this, count, "Incorrect number of parameters to function." );
				}
			} else {
				ret = throw( vars, this, arr->number_values[ idx ], "Not a function reference." );
			}
		}
		dispose_temporary( &obj );
	}
	return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x30(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq 0x8(%rdi), %rdi
movq 0x20(%r15), %rbx
callq *0x18(%rdi)
testl %eax, %eax
je 0x849a
movq %rsp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x43a6
xorl %ebx, %ebx
testl %eax, %eax
je 0x84b7
movq 0x8(%rsp), %rax
movl 0x4(%r15), %ecx
movl %ecx, %edx
sarl $0x8, %edx
movq 0x20(%rax), %rsi
movslq %edx, %rdx
testq %rsi, %rsi
je 0x849e
movq (%rsi,%rdx,8), %r13
testq %r13, %r13
je 0x849e
cmpb $0x6, 0x14(%r13)
jne 0x849e
movzbl %cl, %edx
leaq 0x40(%rsp), %rcx
movq %rax, 0x20(%rcx)
leaq -0x49b2(%rip), %rax     # 0x3aa5
movq %rax, 0x18(%rcx)
movq 0x8(%r15), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%rcx)
movl (%r15), %eax
movl %eax, 0x10(%rsp)
movq %r13, 0x30(%rsp)
movq %rcx, 0x18(%rsp)
cmpl %edx, 0x1c(%r13)
jne 0x84d6
incq (%r13)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x73da
movl %eax, %ebx
decq (%r13)
jmp 0x84b7
xorl %ebx, %ebx
jmp 0x84c6
movq 0x18(%rax), %rax
movl (%rax,%rdx,4), %edx
leaq 0xa23b(%rip), %rcx      # 0x126e7
movq %r14, %rdi
movq %r15, %rsi
callq 0x3c96
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x84c6
callq 0x394d
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0xa1de(%rip), %rcx      # 0x126bb
jmp 0x84ac