// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
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(%r14), %r12
callq *0x18(%rdi)
testl %eax, %eax
je 0x85fa
movq %rsp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x43d7
testl %eax, %eax
je 0x8681
movq 0x8(%rsp), %rax
movl 0x4(%r14), %ecx
movl %ecx, %edx
sarl $0x8, %edx
movq 0x20(%rax), %rsi
movslq %edx, %rdx
testq %rsi, %rsi
je 0x8601
movq (%rsi,%rdx,8), %r12
jmp 0x8604
xorl %ebx, %ebx
jmp 0x8692
xorl %r12d, %r12d
testq %r12, %r12
je 0x8668
cmpb $0x6, 0x14(%r12)
jne 0x8668
movzbl %cl, %edx
leaq 0x40(%rsp), %rcx
movq %rax, 0x20(%rcx)
leaq -0x4b4f(%rip), %rax     # 0x3ad5
movq %rax, 0x18(%rcx)
movq 0x8(%r14), %rax
movq 0x10(%rax), %rax
movq %rax, 0x10(%rcx)
movl (%r14), %eax
movl %eax, 0x10(%rsp)
movq %r12, 0x30(%rsp)
movq %rcx, 0x18(%rsp)
cmpl %edx, 0x1c(%r12)
jne 0x86a0
incq (%r12)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x7519
movl %eax, %ebx
decq (%r12)
jmp 0x8683
movq 0x18(%rax), %rax
movl (%rax,%rdx,4), %edx
leaq 0xa06c(%rip), %rcx      # 0x126e2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3cc3
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x8692
callq 0x3979
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xa00f(%rip), %rcx      # 0x126b6
jmp 0x8676