// File: /workspace/github_c_makefile_star2_O0/rafa9811[P]theIndiependenceGame/background.c
// Function: inventory_load
Inventory* inventory_load(char*filename){
	Object* Oaux;
	Inventory* inv;
	FILE *in;
	char buff[1024];
	int i=0;

	char name[256];
	int id,roomid,px,py,uses,motivation,danger,chaos,money;
	short npc,ispick,onoff,meeting;

	if(!filename) return NULL;

	inv=(Inventory*)malloc(sizeof(Inventory));
	if(!inv) return NULL;
	in = (FILE*) fopen(filename, "r");
	if(!in){
		free(inv);
		return NULL;
	}

    Oaux=object_ini();
    if(!Oaux){
		fclose(in);
		free(inv);
		return NULL;
	}

	inv->inv=(Object**)malloc(sizeof(Object*)*MAX_INV);

    while(!feof(in)){
			fgets(buff,1024,in);
      if(14 != sscanf(buff,"%[^\t]%d\t%d\t%d\t%d\t%hd\t%hd\t%hd\t%hd\t%d\t%d\t%d\t%d\t%d",name,&id,&roomid,&px,&py,&npc,&meeting,&ispick,&onoff,&uses,&motivation,&danger,&chaos,&money)) exit(-1);
      object_setName(Oaux,name);
      object_setId(Oaux,id);
      object_setRoomId(Oaux,roomid);
      object_setPosition(Oaux,px,py);
      object_setNPC(Oaux,npc);
      object_setMeeting(Oaux,meeting);
      object_setIsPick(Oaux,ispick);
      object_setOnOff(Oaux,onoff);
      object_setUses(Oaux,uses);
      object_setMotivation(Oaux,motivation);
      object_setDanger(Oaux,danger);
      object_setChaos(Oaux,chaos);
      object_setMoney(Oaux,money);
      inv->inv[i]=object_copy(Oaux);
      i++;
    }
    inv->max=i;
	object_destroy(Oaux);
	fclose(in);

	return(inv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5d8, %rsp            # imm = 0x5D8
movq %rdi, -0x38(%rbp)
movl $0x0, -0x454(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x24a6
movq $0x0, -0x30(%rbp)
jmp 0x277e
movl $0x10, %edi
callq 0x1130
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x24c8
movq $0x0, -0x30(%rbp)
jmp 0x277e
movq -0x38(%rbp), %rdi
leaq 0x6b5f(%rip), %rsi      # 0x9032
callq 0x1190
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x24f9
movq -0x48(%rbp), %rdi
callq 0x1030
movq $0x0, -0x30(%rbp)
jmp 0x277e
movb $0x0, %al
callq 0x4710
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x252a
movq -0x50(%rbp), %rdi
callq 0x1060
movq -0x48(%rbp), %rdi
callq 0x1030
movq $0x0, -0x30(%rbp)
jmp 0x277e
movl $0x50, %edi
callq 0x1130
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rdi
callq 0x10f0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2558
jmp 0x2757
leaq -0x450(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x10d0
leaq -0x450(%rbp), %rdi
leaq -0x560(%rbp), %rdx
leaq 0x6b9a(%rip), %rsi      # 0x911c
leaq -0x564(%rbp), %rcx
leaq -0x568(%rbp), %r8
leaq -0x56c(%rbp), %r9
leaq -0x570(%rbp), %rax
movq %rax, -0x5a8(%rbp)
leaq -0x586(%rbp), %rax
movq %rax, -0x5a0(%rbp)
leaq -0x58c(%rbp), %r13
leaq -0x588(%rbp), %r12
leaq -0x58a(%rbp), %r15
leaq -0x574(%rbp), %r14
leaq -0x578(%rbp), %rbx
leaq -0x57c(%rbp), %r11
leaq -0x580(%rbp), %r10
leaq -0x584(%rbp), %rax
movq %rax, -0x598(%rbp)
movq -0x5a8(%rbp), %rax
movq %rax, (%rsp)
movq -0x5a0(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x598(%rbp), %rax
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r11, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movb $0x0, %al
callq 0x1150
movl %eax, %ecx
movl $0xe, %eax
cmpl %ecx, %eax
je 0x2654
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x11b0
movq -0x40(%rbp), %rdi
leaq -0x560(%rbp), %rsi
callq 0x4850
movq -0x40(%rbp), %rdi
movl -0x564(%rbp), %esi
callq 0x48a0
movq -0x40(%rbp), %rdi
movl -0x568(%rbp), %eax
movswl %ax, %esi
callq 0x48e0
movq -0x40(%rbp), %rdi
movl -0x56c(%rbp), %esi
movl -0x570(%rbp), %edx
callq 0x4930
movq -0x40(%rbp), %rdi
movswl -0x586(%rbp), %esi
callq 0x4980
movq -0x40(%rbp), %rdi
movswl -0x58c(%rbp), %esi
callq 0x49d0
movq -0x40(%rbp), %rdi
movswl -0x588(%rbp), %esi
callq 0x4a20
movq -0x40(%rbp), %rdi
movswl -0x58a(%rbp), %esi
callq 0x4a70
movq -0x40(%rbp), %rdi
movl -0x574(%rbp), %esi
callq 0x4ac0
movq -0x40(%rbp), %rdi
movl -0x578(%rbp), %esi
callq 0x4b00
movq -0x40(%rbp), %rdi
movl -0x57c(%rbp), %esi
callq 0x4b40
movq -0x40(%rbp), %rdi
movl -0x580(%rbp), %esi
callq 0x4b80
movq -0x40(%rbp), %rdi
movl -0x584(%rbp), %esi
callq 0x4bc0
movq -0x40(%rbp), %rdi
callq 0x4f00
movq %rax, %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x454(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x454(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x454(%rbp)
jmp 0x253e
movl -0x454(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x40(%rbp), %rdi
callq 0x4810
movq -0x50(%rbp), %rdi
callq 0x1060
movq -0x48(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x5d8, %rsp            # imm = 0x5D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)