// File: /workspace/github_c_makefile_star2_O3/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 0x9bd5(%rip), %rsi      # 0x19f90
movq %r13, %rdi
movq %r15, %rdx
callq 0x47d8
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x10407
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x18(%rsp), %r12
movq 0x10(%r13), %r13
incl %edx
testq %r13, %r13
jne 0x103d8
movq 0x3b8(%r12), %rax
cmpl %edx, 0x1c(%rax)
jne 0x1040b
leaq 0xc(%rsp), %rax
cmpq %rax, (%r14)
jbe 0x1041a
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4e98
jmp 0x10439
xorl %eax, %eax
jmp 0x1044b
leaq 0x22a9(%rip), %rcx      # 0x126bb
movq %r15, %rdi
movq %rbp, %rsi
jmp 0x10434
cmpb $0x0, 0x3f8(%r12)
je 0x1045a
leaq 0x2ea6(%rip), %rcx      # 0x132d2
movq %r15, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x3c96
movl %eax, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3a57
movl 0xc(%rsp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbp), %rax
movq 0x10(%rax), %r13
testq %r13, %r13
je 0x1059e
movq %rbp, 0x30(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movl $0x20, %ebx
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x3c8(%r12), %rdi
addq %rbp, %rdi
callq 0x392b
movq 0x3c8(%r12), %rdx
addq %rbp, %rdx
movq %r13, %rdi
movq %r15, %rsi
callq *0x18(%r13)
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x1056b
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 0x1050a
movzbl 0x14(%rcx), %esi
testl %esi, %esi
je 0x1051b
cmpl $0x2, %esi
jne 0x104ee
cmpq $0x0, 0x20(%rcx)
je 0x1051b
movq %r15, %rdi
movq 0x30(%rsp), %rsi
xorl %edx, %edx
leaq 0x2da2(%rip), %rcx      # 0x132a1
callq 0x3c96
movl %eax, 0xc(%rsp)
jmp 0x1056b
movq $0x0, (%rax,%rbx)
leaq -0xca7f(%rip), %rcx     # 0x3a9a
jmp 0x10566
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 0x10558
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 -0xcac1(%rip), %rcx     # 0x3aa5
movq %rcx, 0x18(%rax,%rbp,2)
movq 0x10(%r13), %r13
movl 0xc(%rsp), %eax
testq %r13, %r13
je 0x1058c
addq $0x48, %r14
addq $0x10, %rbp
addq $0x30, %rbx
testl %eax, %eax
jne 0x10484
testl %eax, %eax
movq 0x28(%rsp), %rbx
movq 0x20(%rsp), %r14
je 0x1043d
movl $0x1, 0x418(%r12)
leaq 0x3d0(%r12), %rdi
callq 0x392b
leaq 0x3e0(%r12), %rdi
callq 0x392b
movq %r12, 0x3a0(%r14)
movb 0x18(%r14), %al
movb %al, 0x38(%r12)
movq %r12, %rdi
callq 0xfcae
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rbx)
incq (%rax)
movq $0x0, 0x3a0(%r14)
jmp 0x1043d