// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x30f0
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xab91(%rip), %rsi      # 0x21f80
leaq -0x30(%rbp), %rcx
callq 0x55d0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x17665
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl 0x3f8(%rax), %eax
cmpl $0x0, %eax
jne 0x17643
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x40(%rax), %rax
movq %rcx, 0x3a0(%rax)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x40(%rax), %rax
movsbl 0x18(%rax), %esi
callq 0x16760
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x40(%rax), %rax
movq $0x0, 0x3a0(%rax)
movq -0x38(%rbp), %rax
movq 0x3b8(%rax), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x17573
movq -0x38(%rbp), %rax
movq 0x3c8(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x17563
movq -0x38(%rbp), %rax
movq 0x3c8(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x3d8(%rax)
je 0x17518
movq -0x38(%rbp), %rax
movq 0x3d8(%rax), %rax
movq 0x8(%rax), %rax
cmpq -0x48(%rbp), %rax
jne 0x17518
movq -0x38(%rbp), %rax
movq 0x3c8(%rax), %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x38(%rbp), %rsi
addq $0x3d0, %rsi            # imm = 0x3D0
callq 0x3d10
movq -0x38(%rbp), %rax
cmpq $0x0, 0x3e8(%rax)
je 0x17561
movq -0x38(%rbp), %rax
movq 0x3e8(%rax), %rax
movq 0x8(%rax), %rax
cmpq -0x48(%rbp), %rax
jne 0x17561
movq -0x38(%rbp), %rax
movq 0x3c8(%rax), %rdi
movslq -0x40(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x38(%rbp), %rsi
addq $0x3e0, %rsi            # imm = 0x3E0
callq 0x3d10
jmp 0x17563
jmp 0x17565
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x17480
movq -0x38(%rbp), %rax
cmpl $0x1, 0x418(%rax)
jne 0x175d3
movq -0x38(%rbp), %rax
cmpq $0x0, 0x3d8(%rax)
je 0x175bd
movq -0x38(%rbp), %rax
movq 0x3d8(%rax), %rax
movsbl 0x14(%rax), %eax
cmpl $0x1, %eax
jle 0x175bd
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %edx, %edx
leaq 0x51e6(%rip), %rcx      # 0x1c799
callq 0x4330
movl %eax, -0x4c(%rbp)
jmp 0x175d1
movq -0x38(%rbp), %rdi
addq $0x3d0, %rdi            # imm = 0x3D0
movq -0x18(%rbp), %rsi
callq 0x3d10
jmp 0x17641
movq -0x38(%rbp), %rax
cmpq $0x0, 0x3e8(%rax)
je 0x17620
movq -0x38(%rbp), %rax
movq 0x3e8(%rax), %rax
movsbl 0x14(%rax), %eax
cmpl $0x1, %eax
jle 0x17620
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x38(%rbp), %rax
movl 0x3e0(%rax), %edx
movq -0x38(%rbp), %rax
movq 0x3e8(%rax), %rax
movq 0x8(%rax), %rcx
callq 0x4330
movl %eax, -0x4c(%rbp)
jmp 0x1763f
movq -0x38(%rbp), %rdi
addq $0x3e0, %rdi            # imm = 0x3E0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3d10
movl $0x0, -0x4c(%rbp)
jmp 0x17641
jmp 0x1765c
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %edx, %edx
leaq 0x5136(%rip), %rcx      # 0x1c78a
callq 0x4330
movl %eax, -0x4c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3ce0
movl -0x4c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop