// File: /workspace/github_c_makefile_star2_O3/rafa9811[P]theIndiependenceGame/m_background.c
// Function: main
int main(int argc, char const *argv[]) {
Inventory *shop,*in;
Stat *stat;
short x;
char name[256],*roomdraw,dial[1024],nextq[1024];
Map *map;
Mobjects *mobj;
Object * obj;
int err;
Player *c;
Meeting *meeting;
Dialogs *dialog;

obj=object_ini();
stat=stat_ini ();
c=player_ini();

/*funciones de inventory*/

in = inventory_load("inventory.txt");
if (!in) fprintf(stderr, "Error in loading the inventory");

err= inventory_erase(in, 1);
if (err==-1) fprintf(stderr, "Error in erasing the object in the inventory");

err= inventory_erase(in,1);

obj=inventory_get(in,0);
if (!obj) fprintf(stderr, "Error in inventory get");

x=inventory_full(in);
if (x==-1) fprintf(stderr, "Error in inventory full: error en los parametros de entrada");
if (x==1) fprintf(stderr, "Error in inventory full: the inventory is full");

in=inventory_insert(in, obj);
if (!in) fprintf(stderr, "Error in inventory insert");


/*funciones de shop*/

shop = inventory_load("shop.txt");
if (!shop) fprintf(stderr, "Error in loading the shop");

x=bg_buy(shop, in, stat, 2, name);
if(x==0)fprintf(stderr, "Error no money");
if(x==-1)fprintf(stderr, "Error in function");


/*funciones de map*/

map=map_load ("map.txt");
if (!map) fprintf(stderr, "Error in loading the map");

roomdraw=map_getRoomDraw (map, 23);
if (!roomdraw) fprintf(stderr, "Error in drawing the room");

printScreen(roomdraw);

/*funciones de objects*/

mobj=mobjects_load("objects.txt");
if (!mobj) fprintf(stderr, "Error in loading the mobjects");

err=mobjects_insert(mobj, obj);
if (err==-1) fprintf(stderr, "Error in inserting the object in mboject");

err=mobjects_search(mobj, 12, 4, 5);
if (err==-1) fprintf(stderr, "Error in searching the object in mboject");

obj=mobjects_get(mobj, 14, 0);
if (!obj) fprintf(stderr, "Error in getting the object in mboject");

mobj= mobjects_erase(mobj, 3, 1);
if (!mobj) fprintf(stderr, "Error in erasing an element of the mobjects");

/*funciones de background*/
err=bg_updateRoom(mobj, map, c);
if(err==-1) fprintf(stderr, "Error in updateRoom");

roomdraw=map_getRoomDraw (map, 0);
if (!roomdraw) fprintf(stderr, "Error in drawing the room");

printScreen(roomdraw);


x=bg_checkDanger(map, c, stat);
if (x==-1) fprintf(stderr, "Error in checking danger");

err=bg_pick(in, c, mobj, name,map);
if(err==-1) fprintf(stderr, "Error in background pick");

err= bg_use(in, stat, 0, name,&err);
if(err==-1)  fprintf(stderr, "Error in background use");
if(err==0)  fprintf(stderr, "There are no more uses for the object");

meeting = meeting_load("meetings.txt");
dialog = dialogs_load("dialogs.txt");
/*Meeting*/
/*lo que falta de bg*/
err=bg_talk(dialog, c, mobj, dial, name);
if (err==-1) fprintf(stderr, "Error in background talk");

err= bg_meeting(meeting, c, mobj, stat, 1, 2, nextq,&err);
if (err==-1) fprintf(stderr, "Error in background meeting");

return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x928, %rsp            # imm = 0x928
xorl %eax, %eax
callq 0x3358
xorl %eax, %eax
callq 0x3d10
movq %rax, %r14
xorl %eax, %eax
callq 0x3904
movq %rax, 0x10(%rsp)
leaq 0x49a9(%rip), %rdi      # 0x6004
callq 0x1c2c
movq %rax, %r15
testq %rax, %rax
je 0x1979
movq %r15, %rdi
movl $0x1, %esi
callq 0x1e50
cmpl $-0x1, %eax
je 0x1983
movq %r15, %rdi
movl $0x1, %esi
callq 0x1e50
movl %eax, 0xc(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x1edf
movq %rax, %r13
testq %rax, %rax
je 0x198d
movq %r15, %rdi
callq 0x1f31
cmpw $0x1, %ax
je 0x1a74
movzwl %ax, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x1a60
movq %r15, %rdi
movq %r13, %rsi
callq 0x1efb
movq %rax, %r15
testq %rax, %rax
je 0x1997
leaq 0x4a13(%rip), %rdi      # 0x60fa
callq 0x1c2c
movq %rax, %rbx
testq %rax, %rax
je 0x19a1
leaq 0x20(%rsp), %r8
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x2, %ecx
callq 0x2fc8
cmpw $-0x1, %ax
je 0x1a7e
movzwl %ax, %eax
testl %eax, %eax
je 0x1a6a
movq %r14, 0x18(%rsp)
leaq 0x4a0d(%rip), %rdi      # 0x613e
callq 0x241d
movq %rax, %r12
testq %rax, %rax
je 0x19ab
movq %r12, %rdi
movl $0x17, %esi
callq 0x2630
testq %rax, %rax
je 0x19b5
movq %rax, %rbp
xorl %r14d, %r14d
leaq 0x120(%rsp), %rbx
leaq (%r14,%rbp), %rsi
movl $0x50, %edx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x1070
addq $0x50, %r14
cmpl $0xd20, %r14d           # imm = 0xD20
jne 0x1766
leaq 0x49e6(%rip), %rdi      # 0x6179
callq 0x1fa4
movq %rax, %rbp
testq %rax, %rax
movq 0x10(%rsp), %r14
je 0x19bf
movq %rbp, %rdi
movq %r13, %rsi
callq 0x21d5
cmpl $-0x1, %eax
je 0x19c9
movq %rbp, %rdi
movl $0xc, %esi
movl $0x4, %edx
movl $0x5, %ecx
callq 0x2242
cmpl $-0x1, %eax
je 0x19d3
movq %rbp, %rdi
movl $0xe, %esi
xorl %edx, %edx
callq 0x233d
testq %rax, %rax
je 0x19dd
movq %rbp, %rdi
movl $0x3, %esi
movl $0x1, %edx
callq 0x2365
movq %rax, %r13
testq %rax, %rax
je 0x19e7
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2a21
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x19f1
movq %r12, %rdi
xorl %esi, %esi
callq 0x2630
testq %rax, %rax
je 0x19fb
movq %rax, %rbp
xorl %r14d, %r14d
leaq 0x120(%rsp), %rbx
leaq (%r14,%rbp), %rsi
movl $0x50, %edx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x1070
addq $0x50, %r14
cmpl $0xd20, %r14d           # imm = 0xD20
jne 0x184f
movq 0x10(%rsp), %r14
movq %r12, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
callq 0x2b37
cmpw $-0x1, %ax
je 0x1a05
leaq 0x20(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %r8
callq 0x2b9e
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1a0f
leaq 0x20(%rsp), %rcx
leaq 0xc(%rsp), %r12
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r12, %r8
callq 0x2e8f
movl %eax, (%r12)
cmpl $-0x1, %eax
je 0x1a19
testl %eax, %eax
je 0x1a42
leaq 0x49dc(%rip), %rdi      # 0x62cc
callq 0x26b0
movq %rax, %r15
leaq 0x49da(%rip), %rdi      # 0x62d9
callq 0x1ae7
leaq 0x120(%rsp), %rcx
leaq 0x20(%rsp), %r8
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x30a9
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1a4c
leaq 0x520(%rsp), %rax
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
movl $0x1, %r8d
movl $0x2, %r9d
pushq %r12
pushq %rax
callq 0x31bd
addq $0x10, %rsp
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1a56
xorl %eax, %eax
addq $0x928, %rsp            # imm = 0x928
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1190
jmp 0x166c
callq 0x11ac
jmp 0x1682
callq 0x11c8
jmp 0x16a9
callq 0x121c
jmp 0x16e0
callq 0x1238
jmp 0x16f8
callq 0x1298
jmp 0x1742
callq 0x12ba
jmp 0x178c
callq 0x1318
jmp 0x17a9
callq 0x133a
jmp 0x17bd
callq 0x135c
jmp 0x17dd
callq 0x137e
jmp 0x17f5
callq 0x13a0
jmp 0x1813
callq 0x13c2
jmp 0x182e
callq 0x13e4
jmp 0x187a
callq 0x1442
jmp 0x1897
callq 0x1464
jmp 0x18ba
movq 0x85d8(%rip), %rax      # 0x9ff8
movq (%rax), %rcx
leaq 0x4864(%rip), %rdi      # 0x628e
movl $0x17, %esi
movl $0x1, %edx
callq 0x1170
movl 0xc(%rsp), %eax
jmp 0x18e1
callq 0x1486
jmp 0x18e9
callq 0x14a8
jmp 0x192c
callq 0x14ca
jmp 0x1965
callq 0x1200
jmp 0x16c9
callq 0x1276
jmp 0x1725
callq 0x11e4
jmp 0x16c9
callq 0x1254
jmp 0x1725