// File: /workspace/github_c_makefile_star2_O1/martincameron[P]towntalk/worker.c
// Function: evaluate_result_expression
enum result evaluate_result_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	struct expression *parameter = this->parameters;
	struct variable var = { 0, NULL };
	struct worker *work;
	int count, idx;
	char *str;
	enum result ret = evaluate_custom( parameter, &worker_type, vars, &var );
	if( ret ) {
		work = ( struct worker * ) var.string_value;
		if( work->locked == 0 ) {
			vars->func->env->worker = &work->custom;
			await_worker( work, vars->func->env->interrupted );
			vars->func->env->worker = NULL;
			count = work->env.entry_point->num_parameters;
			for( idx = 0; idx < count; idx++ ) {
				if( work->args[ idx ].string_value ) {
					/* Reassociate parameter strings if necessary. */
					str = work->args[ idx ].string_value->string;
					if( work->result.string_value && work->result.string_value->string == str ) {
						assign_variable( &work->args[ idx ], &work->result );
					}
					if( work->exception.string_value && work->exception.string_value->string == str ) {
						assign_variable( &work->args[ idx ], &work->exception );
					}
				}
			}
			if( work->ret == OKAY ) {
				if( work->result.string_value && work->result.string_value->type > ELEMENT ) {
					/* Only strings and elements can safely be assigned from another environment. */
					ret = throw( vars, this, 0, "Values of this type cannot be returned from workers." );
				} else {
					assign_variable( &work->result, result );
				}
			} else if( work->exception.string_value && work->exception.string_value->type > ELEMENT ) {
				ret = throw( vars, this, work->exception.number_value, work->exception.string_value->string );
			} else {
				assign_variable( &work->exception, vars->exception );
				ret = EXCEPTION;
			}
		} else {
			ret = throw( vars, this, 0, "Worker locked." );
		}
		dispose_temporary( &var );
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %rdi
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rcx
movaps %xmm0, (%rcx)
leaq 0x9672(%rip), %rsi      # 0x19f90
movq %r15, %rdx
callq 0x4805
testl %eax, %eax
je 0x1095b
movq 0x28(%rsp), %r13
cmpb $0x0, 0x3f8(%r13)
je 0x1096e
leaq 0x2966(%rip), %rcx      # 0x132a6
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3cc3
movl %eax, %ebx
leaq 0x20(%rsp), %rdi
callq 0x3a87
jmp 0x1095d
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
movq %r12, 0x8(%rsp)
movq %r14, (%rsp)
movq 0x18(%r15), %rax
movq 0x40(%rax), %rax
movq $0x0, 0x3a0(%rax)
movq 0x3b8(%r13), %rax
movslq 0x1c(%rax), %rbp
testq %rbp, %rbp
jle 0x10a22
leaq 0x3d0(%r13), %rax
movq %rax, 0x18(%rsp)
leaq 0x3e0(%r13), %rax
movq %rax, 0x10(%rsp)
shlq $0x4, %rbp
xorl %r12d, %r12d
movq 0x3c8(%r13), %rdi
movq 0x8(%rdi,%r12), %rax
testq %rax, %rax
je 0x10a19
movq 0x8(%rax), %r14
movq 0x3d8(%r13), %rax
testq %rax, %rax
je 0x109f3
cmpq %r14, 0x8(%rax)
jne 0x109f3
addq %r12, %rdi
movq 0x18(%rsp), %rsi
callq 0x3a95
movq 0x3e8(%r13), %rax
testq %rax, %rax
je 0x10a19
cmpq %r14, 0x8(%rax)
jne 0x10a19
movq 0x3c8(%r13), %rdi
addq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x3a95
addq $0x10, %r12
cmpq %r12, %rbp
jne 0x109bf
cmpl $0x1, 0x418(%r13)
jne 0x10a51
movq 0x3d8(%r13), %rax
testq %rax, %rax
movq (%rsp), %rsi
je 0x10a7e
cmpb $0x2, 0x14(%rax)
jl 0x10a7e
leaq 0x286c(%rip), %rcx      # 0x132b5
movq %r15, %rdi
jmp 0x10946
movq 0x3e8(%r13), %rax
addq $0x3e0, %r13            # imm = 0x3E0
testq %rax, %rax
movq (%rsp), %rsi
je 0x10a97
cmpb $0x2, 0x14(%rax)
jl 0x10a97
movl (%r13), %edx
movq 0x8(%rax), %rcx
movq %r15, %rdi
jmp 0x10948
addq $0x3d0, %r13            # imm = 0x3D0
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x3a95
jmp 0x1094f
movq 0x8(%r15), %rsi
movq %r13, %rdi
callq 0x3a95
xorl %ebx, %ebx
jmp 0x1094f