// File: /workspace/github_c_makefile_star2_O3/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)
movl $0x0, 0xc(%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movq 0x8(%rdi), %r12
movq %r12, %rdi
callq 0x442e
testl %eax, %eax
je 0xd0d9
movq 0x10(%r12), %r12
testq %r12, %r12
je 0xd0e0
leaq 0xc(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x46e7
movl %eax, %ebx
movq 0x10(%r12), %r12
testl %eax, %eax
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd0e4
leaq 0x8(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x46e7
testl %eax, %eax
je 0xd1ba
cmpq $0x0, 0x10(%r12)
je 0xd0e0
leaq 0x5fae(%rip), %rcx      # 0x13082
jmp 0xd1ce
xorl %ebx, %ebx
jmp 0xd1ec
movl %eax, %ebx
jmp 0xd0ec
testl %ebx, %ebx
je 0xd1ba
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 0x381a
testq %rax, %rax
js 0xd1a8
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 0xd1be
movq %rbp, 0x28(%rsp)
leaq 0x19(%r12), %rdi
callq 0x31b0
testq %rax, %rax
je 0xd1c7
movq %rax, %rbp
movq $0x0, 0x10(%rax)
addq $0x18, %rax
movq %rax, 0x8(%rbp)
movb $0x0, 0x18(%rbp,%r12)
movq $0x1, (%rbp)
movl %r12d, 0x10(%rbp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x8(%rbp), %rsi
leaq 0x30(%rsp), %r8
movq %r13, %rdx
movq %r12, %rcx
callq 0x381a
testq %rax, %rax
js 0xd1fd
movl %eax, 0x10(%rbp)
movq 0x8(%rbp), %rcx
movb $0x0, (%rcx,%rax)
movq 0x28(%rsp), %rax
movq %rbp, 0x8(%rax)
jmp 0xd1dd
leaq 0x30(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3c96
xorl %ebx, %ebx
jmp 0xd1dd
leaq 0x5a5b(%rip), %rcx      # 0x12c20
jmp 0xd1ce
movq 0xbfa2(%rip), %rcx      # 0x19170
xorl %ebx, %ebx
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3c96
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xd1ec
callq 0x394d
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x394d
xorl %ebx, %ebx
leaq 0x30(%rsp), %rcx
jmp 0xd1d0