// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rcx
movaps %xmm0, (%rcx)
leaq 0x98d1(%rip), %rsi      # 0x18f90
movq %r14, %rdx
callq 0x45f6
testl %eax, %eax
je 0xf6fc
movq 0x28(%rsp), %r15
cmpb $0x0, 0x3f8(%r15)
je 0xf70f
leaq 0x2c01(%rip), %rcx      # 0x122e2
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3bb2
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x3988
jmp 0xf6fe
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebp
movq %r12, 0x18(%rsp)
movq %rbx, 0x8(%rsp)
movq 0x18(%r14), %rax
movq 0x40(%rax), %rax
andq $0x0, 0x3a0(%rax)
movq 0x3b8(%r15), %rax
movl 0x1c(%rax), %r13d
leaq 0x3d0(%r15), %rax
movq %rax, 0x10(%rsp)
leaq 0x3e0(%r15), %rax
movq %rax, (%rsp)
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
shlq $0x4, %r13
cmpq %r12, %r13
je 0xf7bf
movq 0x3c8(%r15), %rdi
movq 0x8(%rdi,%r12), %rax
testq %rax, %rax
je 0xf7b9
movq 0x8(%rax), %rbx
movq 0x3d8(%r15), %rax
testq %rax, %rax
je 0xf794
cmpq %rbx, 0x8(%rax)
jne 0xf794
addq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x3996
movq 0x3e8(%r15), %rax
testq %rax, %rax
je 0xf7b9
cmpq %rbx, 0x8(%rax)
jne 0xf7b9
movq 0x3c8(%r15), %rdi
addq %r12, %rdi
movq (%rsp), %rsi
callq 0x3996
addq $0x10, %r12
jmp 0xf75b
cmpl $0x1, 0x418(%r15)
jne 0xf7ef
movq 0x3d8(%r15), %rax
testq %rax, %rax
movq 0x8(%rsp), %rsi
je 0xf818
cmpb $0x2, 0x14(%rax)
jl 0xf818
leaq 0x2b0a(%rip), %rcx      # 0x122f1
movq %r14, %rdi
jmp 0xf6e7
movq 0x3e8(%r15), %rax
testq %rax, %rax
movq 0x8(%rsp), %rsi
je 0xf82c
cmpb $0x2, 0x14(%rax)
jl 0xf82c
movq (%rsp), %rcx
movl (%rcx), %edx
movq 0x8(%rax), %rcx
movq %r14, %rdi
jmp 0xf6e9
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3996
jmp 0xf6f0
movq 0x8(%r14), %rsi
movq (%rsp), %rdi
callq 0x3996
xorl %ebp, %ebp
jmp 0xf6f0