// File: /workspace/github_c_makefile_star2_O2/martincameron[P]towntalk/towntalk.c
// Function: evaluate_load_expression
static enum result evaluate_load_expression( struct expression *this,
	struct variables *vars, struct variable *result ) {
	long len;
	char message[ 64 ];
	struct string *str;
	struct variable file = { 0 };
	int offset = 0, count = -1;
	struct expression *parameter = this->parameters;
	enum result ret = evaluate_string( parameter, vars, &file );
	if( ret ) {
		parameter = parameter->next;
		if( parameter ) {
			ret = evaluate_integer( parameter, vars, &offset );
			parameter = parameter->next;
		}
		if( ret && parameter ) {
			ret = evaluate_integer( parameter, vars, &count );
			if( ret && parameter->next ) {
				ret = throw( vars, this, 0, "Too many parameters." );
			}
		}
		if( ret ) {
			len = load_file( file.string_value->string, NULL, offset, 0, message );
			if( len >= 0 ) {
				if( count >= 0 && count < len ) {
					len = count;
				}
				if( len < MAX_INTEGER ) {
					str = new_string( len );
					if( str ) {
						len = load_file( file.string_value->string, str->string, offset, len, message );
						if( len >= 0 ) {
							str->length = len;
							str->string[ len ] = 0;
							result->string_value = str;
						} else {
							unref_string( str );
							ret = throw( vars, this, 0, message );
						}
					} else {
						ret = throw_out_of_memory( vars, this );
					}
				} else {
					ret = throw( vars, this, 0, "File too large." );
				}
			} else {
				ret = throw( vars, this, 0, message );
			}
		}
		dispose_temporary( &file );
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
andl $0x0, 0xc(%rsp)
orl $-0x1, 0x8(%rsp)
movq 0x8(%rdi), %r12
movq %r12, %rdi
callq 0x4284
testl %eax, %eax
je 0xc638
movq 0x10(%r12), %r12
testq %r12, %r12
je 0xc63f
leaq 0xc(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4514
movl %eax, %ebx
movq 0x10(%r12), %r12
testl %eax, %eax
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xc643
leaq 0x8(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4514
testl %eax, %eax
je 0xc712
cmpq $0x0, 0x10(%r12)
je 0xc63f
leaq 0x5a8f(%rip), %rcx      # 0x120c2
jmp 0xc6f6
xorl %ebx, %ebx
jmp 0xc71e
movl %eax, %ebx
jmp 0xc64b
testl %ebx, %ebx
je 0xc712
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movslq 0xc(%rsp), %r13
leaq 0x30(%rsp), %r8
xorl %esi, %esi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x3788
testq %rax, %rax
js 0xc6db
movslq 0x8(%rsp), %rcx
cmpq %rcx, %rax
movq %rcx, %r12
cmovbq %rax, %r12
testq %rcx, %rcx
cmovsq %rax, %r12
cmpq $0x7ffffffe, %r12       # imm = 0x7FFFFFFE
ja 0xc6ef
movq %rbp, 0x28(%rsp)
movl %r12d, %edi
callq 0x3723
testq %rax, %rax
je 0xc707
movq %rax, %rbp
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x8(%rbp), %rsi
leaq 0x30(%rsp), %r8
movq %r13, %rdx
movq %r12, %rcx
callq 0x3788
testq %rax, %rax
js 0xc72f
movl %eax, 0x10(%rbp)
movq 0x8(%rbp), %rcx
movb $0x0, (%rcx,%rax)
movq 0x28(%rsp), %rax
movq %rbp, 0x8(%rax)
jmp 0xc714
leaq 0x30(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3bb2
jmp 0xc712
leaq 0x556a(%rip), %rcx      # 0x11c60
xorl %ebx, %ebx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3bb2
jmp 0xc714
movq %r15, %rdi
movq %r14, %rsi
callq 0x4c90
xorl %ebx, %ebx
leaq 0x10(%rsp), %rdi
callq 0x3988
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x38b2
xorl %ebx, %ebx
leaq 0x30(%rsp), %rcx
jmp 0xc6f8