// File: /workspace/github_c_makefile_star2_O2/martincameron[P]towntalk/worker.c
// Function: evaluate_execute_expression
enum result evaluate_execute_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	struct expression *parameter = this->parameters;
	struct environment *env = vars->func->env;
	struct variable var = { 0, NULL };
	struct worker *work;
	struct string *str;
	int count, idx;
	enum result ret = evaluate_custom( parameter, &worker_type, vars, &var );
	if( ret ) {
		work = ( struct worker * ) var.string_value;
		parameter = parameter->next;
		count = 0;
		while( parameter ) {
			count++;
			parameter = parameter->next;
		}
		if( work->env.entry_point->num_parameters == count ) {
			if( ( size_t ) &ret < env->stack_limit ) {
				ret = throw_stack_overflow( vars, this );
			} else if( work->locked == 0 ) {
				await_worker( work, 1 );
				idx = 0;
				parameter = this->parameters->next;
				while( parameter && ret ) {
					dispose_variable( &work->args[ idx ] );
					ret = parameter->evaluate( parameter, vars, &work->args[ idx ] );
					if( ret ) {
						work->parameters[ idx ].index = ( long_int ) work->args[ idx ].number_value;
						( ( struct value_expression * ) work->parameters )[ idx ].num = work->args[ idx ].number_value;
						str = work->args[ idx ].string_value;
						if( str ) {
							if( str->type == STRING || ( str->type == ARRAY && !( ( struct array * ) str )->string_values ) ) {
								work->strings[ idx ].str.reference_count = 1;
								work->strings[ idx ].str.type = str->type;
								work->strings[ idx ].str.string = str->string;
								work->strings[ idx ].str.length = str->length;
								if( str->type == ARRAY ) {
									work->strings[ idx ].number_values = ( ( struct array * ) str )->number_values;
									work->strings[ idx ].length = ( ( struct array * ) str )->length;
								}
								( ( struct value_expression * ) work->parameters )[ idx ].str = &work->strings[ idx ].str;
								work->parameters[ idx ].evaluate = evaluate_string_literal_expression;
							} else {
								ret = throw( vars, this, 0, "Values of this type cannot be passed to workers." );
							}
						} else {
							( ( struct value_expression * ) work->parameters )[ idx ].str = NULL;
							work->parameters[ idx ].evaluate = evaluate_number_literal_expression;
						}
					}
					parameter = parameter->next;
					idx++;
				}
				if( ret ) {
					work->ret = OKAY;
					dispose_variable( &work->result );
					dispose_variable( &work->exception );
					env->worker = &work->custom;
					work->env.interrupted = env->interrupted;
					if( start_worker( work ) ) {
						result->string_value = var.string_value;
						result->string_value->reference_count++;
					} else {
						ret = throw( vars, this, 0, "Unable to start worker." );
					}
					env->worker = NULL;
				}
			} else {
				ret = throw( vars, this, 0, "Worker locked." );
			}
		} else {
			ret = throw( vars, this, count, "Incorrect number of parameters to function." );
		}
		dispose_temporary( &var );
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %rbp
movq 0x8(%rdi), %r13
movq 0x18(%rsi), %rax
movq 0x40(%rax), %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
leaq 0x9b2f(%rip), %rsi      # 0x18f90
movq %r13, %rdi
movq %r15, %rdx
callq 0x45f6
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0xf4ab
pushq $-0x1
popq %rdx
movq 0x18(%rsp), %r12
movq 0x10(%r13), %r13
incl %edx
testq %r13, %r13
jne 0xf47c
movq 0x3b8(%r12), %rax
cmpl %edx, 0x1c(%rax)
jne 0xf4af
leaq 0xc(%rsp), %rax
cmpq %rax, (%r14)
jbe 0xf4be
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4ca3
jmp 0xf4dd
xorl %eax, %eax
jmp 0xf4ef
leaq 0x2245(%rip), %rcx      # 0x116fb
movq %r15, %rdi
movq %rbp, %rsi
jmp 0xf4d8
cmpb $0x0, 0x3f8(%r12)
je 0xf4fe
leaq 0x2e12(%rip), %rcx      # 0x122e2
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3bb2
movl %eax, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3988
movl 0xc(%rsp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %rbp, 0x30(%rsp)
movq 0x8(%rbp), %r13
pushq $0x1
popq %rax
pushq $0x20
popq %rbx
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x10(%r13), %r13
testq %r13, %r13
je 0xf62a
testl %eax, %eax
je 0xf62a
movq 0x3c8(%r12), %rdi
addq %rbp, %rdi
callq 0x3896
movq 0x3c8(%r12), %rdx
addq %rbp, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq *0x18(%r13)
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0xf615
movq 0x3c8(%r12), %rcx
movq 0x3f0(%r12), %rax
movl (%rcx,%rbp), %edx
movl %edx, 0x4(%rax,%rbp,2)
movl %edx, 0x8(%rax,%rbx)
movq 0x8(%rcx,%rbp), %rcx
testq %rcx, %rcx
je 0xf5b7
movzbl 0x14(%rcx), %esi
testl %esi, %esi
je 0xf5c5
cmpl $0x2, %esi
jne 0xf59b
cmpq $0x0, 0x20(%rcx)
je 0xf5c5
movq %r15, %rdi
movq 0x30(%rsp), %rsi
xorl %edx, %edx
leaq 0x2d05(%rip), %rcx      # 0x122b1
callq 0x3bb2
movl %eax, 0xc(%rsp)
jmp 0xf615
andq $0x0, (%rax,%rbx)
leaq -0xbbf8(%rip), %rcx     # 0x39cb
jmp 0xf610
movq 0x400(%r12), %rdx
movq $0x1, (%rdx,%r14)
movb %sil, 0x14(%rdx,%r14)
movq 0x8(%rcx), %rsi
movq %rsi, 0x8(%rdx,%r14)
movl 0x10(%rcx), %esi
movl %esi, 0x10(%rdx,%r14)
cmpb $0x2, 0x14(%rcx)
jne 0xf602
movq 0x18(%rcx), %rsi
movq %rsi, 0x18(%rdx,%r14)
movl 0x40(%rcx), %ecx
movl %ecx, 0x40(%rdx,%r14)
addq %r14, %rdx
movq %rdx, (%rax,%rbx)
leaq -0xbc3c(%rip), %rcx     # 0x39d4
movq %rcx, 0x18(%rax,%rbp,2)
movl 0xc(%rsp), %eax
addq $0x48, %r14
addq $0x10, %rbp
addq $0x30, %rbx
jmp 0xf51c
testl %eax, %eax
je 0xf4e1
movl $0x1, 0x418(%r12)
leaq 0x3d0(%r12), %rdi
callq 0x3896
leaq 0x3e0(%r12), %rdi
callq 0x3896
movq 0x20(%rsp), %rbx
movq %r12, 0x3a0(%rbx)
movb 0x18(%rbx), %al
movb %al, 0x38(%r12)
movq %r12, %rdi
callq 0xee30
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rax, 0x8(%rcx)
incq (%rax)
andq $0x0, 0x3a0(%rbx)
jmp 0xf4e1