// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x30f0
movl $0x0, -0x7c(%rbp)
movl $0xffffffff, -0x80(%rbp) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x4ff0
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
je 0x123db
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x12233
movq -0x88(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x7c(%rbp), %rdx
callq 0x5460
movl %eax, -0x8c(%rbp)
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
cmpl $0x0, -0x8c(%rbp)
je 0x12295
cmpq $0x0, -0x88(%rbp)
je 0x12295
movq -0x88(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x5460
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
je 0x12293
movq -0x88(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x12293
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %edx, %edx
leaq 0xa2c8(%rip), %rcx      # 0x1c550
callq 0x4330
movl %eax, -0x8c(%rbp)
jmp 0x12295
cmpl $0x0, -0x8c(%rbp)
je 0x123d2
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x7c(%rbp), %rdx
leaq -0x60(%rbp), %r8
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
callq 0x3a80
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jl 0x123b7
cmpl $0x0, -0x80(%rbp)
jl 0x122e5
movslq -0x80(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x122e5
movslq -0x80(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x7fffffff, -0x20(%rbp) # imm = 0x7FFFFFFF
jge 0x12399
movq -0x20(%rbp), %rax
movl %eax, %edi
callq 0x39b0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x12384
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rsi
movslq -0x7c(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq -0x60(%rbp), %r8
callq 0x3a80
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jl 0x12360
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x68(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x12382
movq -0x68(%rbp), %rdi
callq 0x3c20
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x60(%rbp), %rcx
xorl %edx, %edx
callq 0x4330
movl %eax, -0x8c(%rbp)
jmp 0x12397
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x5f20
movl %eax, -0x8c(%rbp)
jmp 0x123b5
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
xorl %edx, %edx
leaq 0x9d46(%rip), %rcx      # 0x1c0f0
callq 0x4330
movl %eax, -0x8c(%rbp)
jmp 0x123d0
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x60(%rbp), %rcx
xorl %edx, %edx
callq 0x4330
movl %eax, -0x8c(%rbp)
jmp 0x123d2
leaq -0x78(%rbp), %rdi
callq 0x3ce0
movl -0x8c(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)