// File: /workspace/github_c_makefile_star2_O1/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 0x98ec(%rip), %rsi      # 0x19f90
movq %r13, %rdi
movq %r15, %rdx
callq 0x4805
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x1072c
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x18(%rsp), %r12
movq 0x10(%r13), %r13
incl %edx
testq %r13, %r13
jne 0x106c1
movq 0x3b8(%r12), %rax
cmpl %edx, 0x1c(%rax)
jne 0x106f0
leaq 0xc(%rsp), %rax
cmpq %rax, (%r14)
jbe 0x106ff
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4ed1
jmp 0x1071e
leaq 0x1fbf(%rip), %rcx      # 0x126b6
movq %r15, %rdi
movq %rbp, %rsi
jmp 0x10719
cmpb $0x0, 0x3f8(%r12)
je 0x1073f
leaq 0x2b95(%rip), %rcx      # 0x132a6
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3cc3
movl %eax, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3a87
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), %rax
movq 0x10(%rax), %r13
testq %r13, %r13
setne %cl
cmpl $0x0, 0xc(%rsp)
setne %al
andb %al, %cl
cmpb $0x1, %cl
jne 0x10886
movl $0x20, %ebx
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x3c8(%r12), %rdi
addq %rbp, %rdi
callq 0x3957
movq 0x3c8(%r12), %rdx
addq %rbp, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq *0x18(%r13)
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x10860
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 0x107ff
movzbl 0x14(%rcx), %esi
testl %esi, %esi
je 0x10810
cmpl $0x2, %esi
jne 0x107e3
cmpq $0x0, 0x20(%rcx)
je 0x10810
movq %r15, %rdi
movq 0x30(%rsp), %rsi
xorl %edx, %edx
leaq 0x2a81(%rip), %rcx      # 0x13275
callq 0x3cc3
movl %eax, 0xc(%rsp)
jmp 0x10860
movq $0x0, (%rax,%rbx)
leaq -0xcd44(%rip), %rcx     # 0x3aca
jmp 0x1085b
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 0x1084d
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 -0xcd86(%rip), %rcx     # 0x3ad5
movq %rcx, 0x18(%rax,%rbp,2)
movq 0x10(%r13), %r13
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
setne %al
testq %r13, %r13
je 0x10886
addq $0x48, %r14
addq $0x10, %rbp
addq $0x30, %rbx
testl %ecx, %ecx
jne 0x10779
testb %al, %al
je 0x10722
movl $0x1, 0x418(%r12)
leaq 0x3d0(%r12), %rdi
callq 0x3957
leaq 0x3e0(%r12), %rdi
callq 0x3957
movq 0x20(%rsp), %rbx
movq %r12, 0x3a0(%rbx)
movb 0x18(%rbx), %al
movb %al, 0x38(%r12)
movq %r12, %rdi
callq 0x1000e
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rax, 0x8(%rcx)
incq (%rax)
movq $0x0, 0x3a0(%rbx)
jmp 0x10722