// File: /workspace/github_c_makefile_star2_O2/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 $0x918, %rsp            # imm = 0x918
xorl %eax, %eax
callq 0x308c
xorl %eax, %eax
callq 0x39b4
movq %rax, %rbx
xorl %eax, %eax
callq 0x3600
movq %rax, %r14
leaq 0x4cf3(%rip), %rdi      # 0x6004
callq 0x1a43
movq %rax, %r15
testq %rax, %rax
je 0x15af
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x1c5c
cmpl $-0x1, %eax
je 0x15d0
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x1c5c
movl %eax, 0xc(%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x1cd7
movq %rax, %r13
testq %rax, %rax
je 0x15f1
movq %r15, %rdi
callq 0x1d29
cmpw $0x1, %ax
je 0x1871
movzwl %ax, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x1847
movq %r15, %rdi
movq %r13, %rsi
callq 0x1cf3
movq %rax, %r15
testq %rax, %rax
je 0x1612
leaq 0x4d61(%rip), %rdi      # 0x60fa
callq 0x1a43
movq %rax, %r12
testq %rax, %rax
je 0x1633
pushq $0x2
popq %rcx
leaq 0x10(%rsp), %r8
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2d2a
cmpw $-0x1, %ax
je 0x1892
movzwl %ax, %eax
testl %eax, %eax
je 0x185c
leaq 0x4d62(%rip), %rdi      # 0x613e
callq 0x21f1
movq %rax, %r12
testq %rax, %rax
je 0x1654
pushq $0x17
popq %rsi
movq %r12, %rdi
callq 0x2408
movq %rax, %rbp
testq %rax, %rax
je 0x1675
movq %rbp, %rdi
callq 0x128c
leaq 0x4d66(%rip), %rdi      # 0x6179
callq 0x1d9e
movq %rax, %rbp
testq %rax, %rax
je 0x1696
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1fba
cmpl $-0x1, %eax
je 0x16b7
pushq $0xc
popq %rsi
pushq $0x4
popq %rdx
pushq $0x5
popq %rcx
movq %rbp, %rdi
callq 0x2020
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x16d8
pushq $0xe
popq %rsi
movq %rbp, %rdi
xorl %edx, %edx
callq 0x2129
testq %rax, %rax
je 0x16f9
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbp, %rdi
callq 0x214d
movq %rax, %r13
testq %rax, %rax
je 0x171a
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x27d2
cmpl $-0x1, %eax
je 0x173b
movq %r12, %rdi
xorl %esi, %esi
callq 0x2408
movq %rax, %rbp
testq %rax, %rax
je 0x175c
movq %rbp, %rdi
callq 0x128c
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x28e8
cmpw $-0x1, %ax
je 0x177d
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %r8
callq 0x294f
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x179e
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r12
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r12, %r8
callq 0x2bf5
movl %eax, (%r12)
cmpl $-0x1, %eax
je 0x17bf
testl %eax, %eax
je 0x17e4
leaq 0x4da0(%rip), %rdi      # 0x62cc
callq 0x248a
movq %rax, %r15
leaq 0x4d9e(%rip), %rdi      # 0x62d9
callq 0x1915
leaq 0x510(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2e05
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1805
leaq 0x110(%rsp), %rax
pushq $0x1
popq %r8
pushq $0x2
popq %r9
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
pushq %r12
pushq %rax
callq 0x2f0f
popq %rcx
popq %rdx
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
je 0x1826
xorl %eax, %eax
addq $0x918, %rsp            # imm = 0x918
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9a42(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4a52(%rip), %rdi      # 0x6012
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1322
movq 0x9a21(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4a50(%rip), %rdi      # 0x6031
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1336
movq 0x9a00(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4a5c(%rip), %rdi      # 0x605e
pushq $0x16
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x135b
movq 0x99df(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4abd(%rip), %rdi      # 0x60e0
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1392
movq 0x99be(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4abf(%rip), %rdi      # 0x6103
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x13aa
movq 0x999d(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ae1(%rip), %rdi      # 0x6146
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x13ed
movq 0x997c(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ad9(%rip), %rdi      # 0x615f
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1404
movq 0x995b(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ade(%rip), %rdi      # 0x6185
pushq $0x1d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1424
movq 0x993a(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4adb(%rip), %rdi      # 0x61a3
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1438
movq 0x9919(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ae3(%rip), %rdi      # 0x61cc
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1456
movq 0x98f8(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4aeb(%rip), %rdi      # 0x61f5
pushq $0x26
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x146c
movq 0x98d7(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4af1(%rip), %rdi      # 0x621c
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1486
movq 0x98b6(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4afc(%rip), %rdi      # 0x6248
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x149d
movq 0x9895(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x49f2(%rip), %rdi      # 0x615f
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x14b3
movq 0x9874(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ace(%rip), %rdi      # 0x625c
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x14d3
movq 0x9853(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ac6(%rip), %rdi      # 0x6275
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x14f6
movq 0x9832(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4abe(%rip), %rdi      # 0x628e
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
movl 0xc(%rsp), %eax
jmp 0x151d
movq 0x980d(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ab1(%rip), %rdi      # 0x62a6
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1525
movq 0x97ec(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4acf(%rip), %rdi      # 0x62e5
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x1568
movq 0x97cb(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4ac7(%rip), %rdi      # 0x62fe
pushq $0x1b
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x159b
movq 0x97aa(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x481d(%rip), %rdi      # 0x6075
pushq $0x3b
jmp 0x1884
movq 0x9795(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x48b0(%rip), %rdi      # 0x611d
pushq $0xe
jmp 0x18a5
movq 0x9780(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x482f(%rip), %rdi      # 0x60b1
pushq $0x2e
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x137b
movq 0x975f(%rip), %rax      # 0xaff8
movq (%rax), %rcx
leaq 0x4889(%rip), %rdi      # 0x612c
pushq $0x11
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x13d5
nop