// File: /workspace/github_c_makefile_star2_O1/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 0x32cc
xorl %eax, %eax
callq 0x3d08
movq %rax, %r14
xorl %eax, %eax
callq 0x3904
movq %rax, 0x10(%rsp)
leaq 0x49f9(%rip), %rdi      # 0x6004
callq 0x1bcd
movq %rax, %r15
testq %rax, %rax
je 0x1938
movq %r15, %rdi
movl $0x1, %esi
callq 0x1df1
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1942
movq %r15, %rdi
movl $0x1, %esi
callq 0x1df1
movl %eax, 0xc(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x1e6f
movq %rax, %r13
testq %rax, %rax
je 0x194c
movq %r15, %rdi
callq 0x1ec1
cmpw $0x1, %ax
je 0x1a14
movzwl %ax, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x1a00
movq %r15, %rdi
movq %r13, %rsi
callq 0x1e8b
movq %rax, %r15
testq %rax, %rax
je 0x1956
leaq 0x4a5f(%rip), %rdi      # 0x60fa
callq 0x1bcd
movq %rax, %rbx
testq %rax, %rax
je 0x1960
leaq 0x20(%rsp), %r8
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x2, %ecx
callq 0x2f63
cmpw $-0x1, %ax
je 0x1a1e
movzwl %ax, %eax
testl %eax, %eax
je 0x1a0a
leaq 0x4a5e(%rip), %rdi      # 0x613e
callq 0x23c0
movq %rax, %r12
testq %rax, %rax
je 0x196a
movq %r14, 0x18(%rsp)
movq %r12, %rdi
movl $0x17, %esi
callq 0x25d3
movq %rax, %rbp
testq %rax, %rax
je 0x1974
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 0x171a
leaq 0x4a32(%rip), %rdi      # 0x6179
callq 0x1f34
movq %rax, %rbp
testq %rax, %rax
je 0x197e
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2165
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
movq 0x10(%rsp), %rbx
je 0x1988
movq %rbp, %rdi
movl $0xc, %esi
movl $0x4, %edx
movl $0x5, %ecx
callq 0x21d2
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1992
movq %rbp, %rdi
movl $0xe, %esi
xorl %edx, %edx
callq 0x22df
testq %rax, %rax
je 0x199c
movq %rbp, %rdi
movl $0x3, %esi
movl $0x1, %edx
callq 0x2307
movq %rax, %r13
testq %rax, %rax
je 0x19a6
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x29e8
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x19b0
movq %r12, %rdi
xorl %esi, %esi
callq 0x25d3
movq %rax, %rbp
testq %rax, %rax
je 0x19ba
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 0x180b
movq %r12, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
callq 0x2afe
cmpw $-0x1, %ax
je 0x19c4
leaq 0x20(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %r8
callq 0x2b65
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x19ce
leaq 0x20(%rsp), %rcx
leaq 0xc(%rsp), %r12
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r12, %r8
callq 0x2e2a
movl %eax, (%r12)
cmpl $-0x1, %eax
je 0x19d8
cmpl $0x0, 0xc(%rsp)
je 0x19e2
leaq 0x4a1d(%rip), %rdi      # 0x62cc
callq 0x2653
movq %rax, %r15
leaq 0x4a1b(%rip), %rdi      # 0x62d9
callq 0x1a87
leaq 0x120(%rsp), %rcx
leaq 0x20(%rsp), %r8
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x304a
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x19ec
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 0x315e
addq $0x10, %rsp
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x19f6
xorl %eax, %eax
addq $0x928, %rsp            # imm = 0x928
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1190
jmp 0x161c
callq 0x11ac
jmp 0x1636
callq 0x11c8
jmp 0x165d
callq 0x121c
jmp 0x1694
callq 0x1238
jmp 0x16ac
callq 0x1298
jmp 0x16f1
callq 0x12ba
jmp 0x170f
callq 0x12dc
jmp 0x1758
callq 0x12fe
jmp 0x1775
callq 0x1320
jmp 0x1799
callq 0x1342
jmp 0x17b1
callq 0x1364
jmp 0x17cf
callq 0x1386
jmp 0x17ea
callq 0x13a8
jmp 0x1800
callq 0x13ca
jmp 0x1853
callq 0x13ec
jmp 0x1876
callq 0x140e
jmp 0x189d
callq 0x1430
jmp 0x18a8
callq 0x1452
jmp 0x18eb
callq 0x1474
jmp 0x1924
callq 0x1200
jmp 0x167d
callq 0x1276
jmp 0x16d9
callq 0x11e4
jmp 0x167d
callq 0x1254
jmp 0x16d9