LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/theindiependencegame.c
// Function: term_init
void _term_init() {
	struct termios new;	          /*a termios structure contains a set of attributes about
					  how the terminal scans and outputs data*/

	tcgetattr(fileno(stdin), &initial);    /*first we get the current settings of out
						 terminal (fileno returns the file descriptor
						 of stdin) and save them in initial. We'd better
						 restore them later on*/
	new = initial;	                      /*then we copy them into another one, as we aren't going
						to change ALL the values. We'll keep the rest the same */
	new.c_lflag &= ~ICANON;	              /*here we are setting up new. This line tells to stop the
						canonical mode (which means waiting for the user to press
						enter before sending)*/
	new.c_lflag &= ~ECHO;                 /*by deactivating echo, we tell the terminal NOT TO
						show the characters the user is pressing*/
	new.c_cc[VMIN] = 1;                  /*this states the minimum number of characters we have
					       to receive before sending is 1 (it means we won't wait
					       for the user to press 2,3... letters)*/
	new.c_cc[VTIME] = 0;	              /*I really have no clue what this does, it must be somewhere in the book tho*/
	new.c_lflag &= ~ISIG;                 /*here we discard signals: the program won't end even if we
						press Ctrl+C or we tell it to finish*/

	tcsetattr(fileno(stdin), TCSANOW, &new);  /*now we SET the attributes stored in new to the
						    terminal. TCSANOW tells the program not to wait
						    before making this change*/
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq 0x8d06(%rip), %r14      # 0x9fe0
movq (%r14), %rdi
callq 0x1120
leaq 0x8e13(%rip), %rsi      # 0xa0fc
movl %eax, %edi
callq 0x1170
movups 0x8e15(%rip), %xmm0     # 0xa10c
movq %rsp, %rbx
movaps %xmm0, 0x10(%rbx)
movups 0x8df7(%rip), %xmm0     # 0xa0fc
movaps %xmm0, (%rbx)
movups 0x8e0d(%rip), %xmm0     # 0xa11c
movaps %xmm0, 0x20(%rbx)
movups 0x8e0e(%rip), %xmm0     # 0xa128
movups %xmm0, 0x2c(%rbx)
movw $0x100, 0x16(%rbx)      # imm = 0x100
andb $-0xc, 0xc(%rbx)
movq (%r14), %rdi
callq 0x1120
movl %eax, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1180
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/theindiependencegame.c
// Function: clock
void *_clock(void * cq){
  time_t clk,ini,clkDanger,iniDanger;
  double remaining,remainingDanger;
	sc_rectangle *sc_clk;
	sc_clk = win_new(0,SCREENX+2,CLKY,CLKX,BGCOLOR,CHARCOLOR);
  ini = time(&ini);
  while(inDanger==0 && end==0) {
    noDanger: clk=time(&clk);
    remaining= TIME - difftime(clk,ini);
		interface_printClock(sc_clk,remaining,inDanger);
    usleep(1000000);
  }
	if(inDanger==1){
		iniDanger = time(&iniDanger);
	}
	while(inDanger==1 && end==0){
		clkDanger = time(&clkDanger);
		remainingDanger = DANGERTIME - difftime(clkDanger,iniDanger);
		interface_printClock(sc_clk,remainingDanger,inDanger);
		usleep(1000000);
	}
	if(end!=0) return NULL;
	goto noDanger;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %edi, %edi
movl $0x52, %esi
movl $0x5, %edx
movl $0x28, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x3f23
movq %rax, %rbx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x1110
movq %rax, (%r14)
leaq 0x20(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x10(%rsp), %r12
movzwl 0x8da1(%rip), %eax      # 0xa138
movzwl 0x8d9c(%rip), %ecx      # 0xa13a
orw %ax, %cx
je 0x143a
cmpw $0x1, %ax
jne 0x13ba
movq %r15, %rdi
callq 0x1110
movq %rax, 0x8(%rsp)
cmpw $0x1, 0x8d76(%rip)      # 0xa138
sete %cl
cmpw $0x0, 0x8d6d(%rip)      # 0xa13a
sete %al
andb %al, %cl
cmpb $0x1, %cl
jne 0x1436
movq %r12, %rdi
callq 0x1110
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x10b0
movsd 0x4c0f(%rip), %xmm1     # 0x6008
subsd %xmm0, %xmm1
movswl 0x8d34(%rip), %esi      # 0xa138
movq %rbx, %rdi
movapd %xmm1, %xmm0
callq 0x582b
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x11c0
movzwl 0x8d19(%rip), %ecx      # 0xa13a
testw %cx, %cx
sete %al
cmpw $0x1, 0x8d09(%rip)      # 0xa138
jne 0x1436
testw %cx, %cx
je 0x13d7
testb %al, %al
je 0x1482
movq %r14, %rdi
callq 0x1110
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x10b0
movsd 0x4bb4(%rip), %xmm1     # 0x6010
subsd %xmm0, %xmm1
movswl 0x8cd1(%rip), %esi      # 0xa138
movq %rbx, %rdi
movapd %xmm1, %xmm0
callq 0x582b
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x11c0
jmp 0x1390
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/theindiependencegame.c
// Function: main
int main(int argc, char **argv) {
  pthread_t key;
  pthread_t clk;

  _term_init();

	_intro();
	end = 0;
	pthread_create(&clk,NULL,_clock,NULL);

	_play((void *) key);


}

// Assembly:
pushq %rax
callq 0x12cc
callq 0x1490
movw $0x0, 0x823f(%rip)      # 0xa13a
leaq -0xbbe(%rip), %rdx      # 0x1344
movq %rsp, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x1160
callq 0x1d29
xorl %eax, %eax
popq %rcx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: dialogs_destroy
void dialogs_destroy(Dialogs *d){
    int i=0,j=0;
    if(d){
        while(i<MAX_NPC){
            j = 0;
            while(j<MAX_DLG){
                if(d->dlgs[i][j]) free(d->dlgs[i][j]);
                else if(j == 0) goto freetag;
                else break;
                j++;
            }
            i++;
        }
    }
    freetag:free(d);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x1f64
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x1f50
callq 0x1030
incq %r12
cmpq $0xf, %r12
jne 0x1f31
cmpq $0x1c, %r14
jbe 0x1f5b
jmp 0x1f64
testq %r12, %r12
je 0x1f64
cmpq $0x1d, %r14
jae 0x1f64
incq %r14
addq $0x78, %r15
jmp 0x1f2e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: dialogs_load
Dialogs* dialogs_load(char* filename){
	Dialogs *d;
	int npc=0,dlg=0;
	char buff[1024];
	FILE *in;

	if(!filename) return NULL;

	d=(Dialogs*)malloc(sizeof(Dialogs));
	if(!d) return NULL;

	in = (FILE*) fopen(filename, "r");
	if(!in){
		free(d);
		return NULL;
	}

	while(!feof(in)){
		fscanf(in,"%d\t%d\t%[^\n]",&npc,&dlg,buff);
		d->dlgs[npc][dlg]=(char*)malloc(strlen(buff)+1);
        strcpy(d->dlgs[npc][dlg],buff);
	}

	fclose(in);
	return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
xorl %ebx, %ebx
movl %ebx, 0xc(%rsp)
movl %ebx, 0x8(%rsp)
testq %rdi, %rdi
je 0x2058
movq %rdi, %r14
movl $0xe10, %edi            # imm = 0xE10
callq 0x1130
testq %rax, %rax
je 0x2056
movq %rax, %rbx
leaq 0x407f(%rip), %rsi      # 0x603a
movq %r14, %rdi
callq 0x1190
testq %rax, %rax
je 0x204e
movq %rax, %r14
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x2044
leaq 0x418f(%rip), %r15      # 0x6171
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x1060
movq %rbp, %rdi
callq 0x1080
leaq 0x1(%rax), %rdi
callq 0x1130
movslq 0xc(%rsp), %rcx
movslq 0x8(%rsp), %rdx
imulq $0x78, %rcx, %rcx
addq %rbx, %rcx
movq %rax, (%rcx,%rdx,8)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x1050
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
je 0x1ff1
movq %r14, %rdi
callq 0x1070
jmp 0x2058
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: inventory_destroy
void inventory_destroy(Inventory *inv){
	int i=0;
	if(inv){
	    if(inv->inv){
	        for(i=0;inv->inv[i];i++){
	            object_destroy(inv->inv[i]);
	        }
	        free(inv->inv);
	    }
	free(inv);
	}
	return;
}

// Assembly:
testq %rdi, %rdi
je 0x20bc
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x20ad
movq (%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x20a5
movl $0x8, %r14d
callq 0x380b
movq (%rbx), %rax
movq (%rax,%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x2090
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: inventory_erase
int inventory_erase(Inventory *in, int oId){
	int i;
	if(!in || oId<0)return -1;
	for(i=oId; i<in->max && in->inv[i]!=NULL;i++){
	    if(in->inv[i]) object_destroy(in->inv[i]);
		if(in->inv[i+1] && i+1!=in->max){
			in->inv[i] = object_copy(in->inv[i+1]);
		}
		else{
			break;
		}
	}
	in->max--;
	return 0;
}

// Assembly:
testq %rdi, %rdi
sete %al
testl %esi, %esi
sets %cl
orb %al, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x234f
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
cmpl %esi, 0x8(%rdi)
jle 0x2346
movl %ebp, %r14d
incq %r14
movq (%rbx), %rax
movq -0x8(%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x2346
callq 0x380b
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x2346
movl 0x8(%rbx), %eax
cmpq %rax, %r14
je 0x2346
callq 0x3a2f
movq (%rbx), %rcx
movq %rax, -0x8(%rcx,%r14,8)
incq %r14
incl %ebp
cmpl %ebp, 0x8(%rbx)
jg 0x2309
decl 0x8(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: inventory_insert
Inventory* inventory_insert(Inventory* inv, Object *o){
	if(!inv || !o)return NULL;

	inv->inv[inv->max]=object_copy(o);
	inv->max++;
	return inv;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x23aa
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3a2f
movq (%rbx), %rcx
movslq 0x8(%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %eax
movl %eax, 0x8(%rbx)
jmp 0x23ac
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: mobjects_destroy
void mobjects_destroy(Mobjects *m){
    int i=0,j=0;
    if(m){
        if(m->objs){
            while(i<MAX_PLC){
                j = 0;
                while(j<MAX_OBJ){
                    if(m->objs[i][j]) object_destroy(m->objs[i][j]);
                    else if(j == 0) goto freetag;
                    else break;
                    j++;
                }
                i++;
            }
        }
    }
    freetag:free(m);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x2411
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x23fd
callq 0x380b
incq %r12
cmpq $0xa, %r12
jne 0x23de
cmpq $0x18, %r14
jbe 0x2408
jmp 0x2411
testq %r12, %r12
je 0x2411
cmpq $0x19, %r14
jae 0x2411
incq %r14
addq $0x50, %r15
jmp 0x23db
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: mobjects_insert
int mobjects_insert(Mobjects *m, Object *o){
	int i,roomid;
	if(!m || !o)return -1;
	roomid=object_getRoomId(o);
	for(i=0; m->objs[roomid][i]!=NULL && i<MAX_OBJ;i++);
	if(i<MAX_OBJ){
	    m->objs[roomid][i]=object_copy(o);
	    return 1;
	}
	else return 0;
}

// Assembly:
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %dl
jne 0x26c1
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x397b
movswq %ax, %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, %rbx
xorl %r15d, %r15d
movq %r15, %rcx
incq %r15
cmpq $0x9, %rcx
ja 0x26a2
cmpq $0x0, (%rbx,%rcx,8)
jne 0x268f
xorl %eax, %eax
cmpq $0x9, %rcx
ja 0x26bc
movq %r14, %rdi
callq 0x3a2f
movq %rax, -0x8(%rbx,%r15,8)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: mobjects_search
int mobjects_search(Mobjects *m, int roomid, int opx, int opy){
	int mid,mpx,mpy;
	int i=0;
	if(roomid < 0 || roomid > MAX_PLC || opx < 0 || opx > XLIMIT || opy < 0 || opy > YLIMIT || !m) return -1;
	while(i<MAX_OBJ || m->objs[roomid][i]){
		mid=object_getRoomId(m->objs[roomid][i]);
		mpx=object_getPx(m->objs[roomid][i]);
		mpy=object_getPy(m->objs[roomid][i]);
		if((roomid==mid && opx==mpx+1 && opy==mpy)||(roomid==mid && opx==mpx-1 && opy==mpy)||(roomid==mid && opx==mpx && opy==mpy+1)||(roomid==mid && opx==mpx && opy==mpy-1)){
			return i;
		}
		i++;
	}
		return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rdi, 0x8(%rsp)
testq %rdi, %rdi
je 0x27b9
cmpl $0x1a, %esi
ja 0x27b9
movl %edx, %r12d
cmpl $0x50, %edx
ja 0x27b9
movl %ecx, %r14d
cmpl $0x24, %ecx
ja 0x27b9
movl %esi, %eax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, 0x8(%rsp)
xorl %ebx, %ebx
movl %esi, 0x14(%rsp)
movq 0x8(%rsp), %rbp
cmpq $0xa, %rbx
jb 0x2734
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax,%rbx,8)
je 0x27c8
movq (%rbp,%rbx,8), %rdi
callq 0x397b
movswl %ax, %r15d
movq (%rbp,%rbx,8), %rdi
callq 0x398a
movl %eax, %r13d
movq (%rbp,%rbx,8), %rdi
callq 0x3999
movl 0x14(%rsp), %esi
xorl %esi, %r15d
leal 0x1(%r13), %r8d
xorl %r12d, %r8d
orl %r15d, %r8d
movl %eax, %edi
xorl %r14d, %edi
orl %edi, %r8d
je 0x27b7
leal -0x1(%r13), %r8d
xorl %r12d, %r8d
orl %r15d, %r8d
orl %edi, %r8d
je 0x27b7
xorl %r12d, %r13d
orl %r13d, %r15d
sete %dil
leal 0x1(%rax), %r8d
cmpl %r14d, %r8d
sete %r8b
testb %r8b, %dil
jne 0x27b7
decl %eax
cmpl %r14d, %eax
sete %al
andb %al, %dil
incq %rbx
cmpb $0x1, %dil
jne 0x271e
decl %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x27b9
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: mobjects_erase
Mobjects* mobjects_erase(Mobjects *m, int roomid, int id){
	int i=0;

	if(roomid < 0 || roomid > MAX_PLC || !m) return NULL;
	for(i=id; m->objs[roomid][i];i++){
			if(m->objs[roomid][i]) object_destroy(m->objs[roomid][i]);
		if(m->objs[roomid][i+1]){
			m->objs[roomid][i] = object_copy(m->objs[roomid][i+1]);
		}
		else{
			break;
		}
	}
	m->objs[roomid][i]=NULL;
	return m;

}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1b, %esi
setae %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x284a
movq %rdi, %rbx
movl %esi, %eax
movslq %edx, %rcx
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rdi, %rax
leaq (%rax,%rcx,8), %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x284e
callq 0x380b
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x284e
callq 0x3a2f
movq %rax, (%r14)
movq 0x8(%r14), %rdi
addq $0x8, %r14
jmp 0x2825
xorl %ebx, %ebx
jmp 0x2855
movq $0x0, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: map_destroy
void map_destroy(Map *m){
	int i=0;
	if(m){
	    if(m->map){
	        for(i=0;m->map[i];i++){
	            place_destroy(m->map[i]);
	        }
	        free(m->map);
	    }
	free(m);
	}
	return;
}

// Assembly:
testq %rdi, %rdi
je 0x28af
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x28a0
movq (%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2898
movl $0x8, %r14d
callq 0x3af0
movq (%rbx), %rax
movq (%rax,%r14), %rdi
addq $0x8, %r14
testq %rdi, %rdi
jne 0x2883
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: meeting_destroy
void meeting_destroy(Meeting *d){
    int i=0,j=0;
    if(d){
        while(i<MAX_MET){
            j = 0;
            while(j<MAX_Q){
                if(d->meet[i][j]) free(d->meet[i][j]);
                else if(j == 0) goto freetag;
                else break;
                j++;
            }
            i++;
        }
    }
    freetag:free(d);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0x2b30
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x2b1c
callq 0x1030
incq %r12
cmpq $0x3, %r12
jne 0x2afd
cmpq $0x3, %r14
jbe 0x2b27
jmp 0x2b30
testq %r12, %r12
je 0x2b30
cmpq $0x4, %r14
jae 0x2b30
incq %r14
addq $0x18, %r15
jmp 0x2afa
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: meeting_load
Meeting* meeting_load(char* filename){
	Meeting *d;
	int meet=0,q=0;
	short solution=0;
	char buff[512];
	FILE *in;

	if(!filename) return NULL;

	d=(Meeting*)malloc(sizeof(Meeting));
	if(!d) return NULL;

	in = (FILE*) fopen(filename, "r");
	if(!in){
		free(d);
		return NULL;
	}

	while(!feof(in)){
		fscanf(in,"%hd\t%d\t%d\t%[^\n]",&solution,&meet,&q,buff);
		d->meet[meet][q]=(char*)malloc(strlen(buff)+1);
    strcpy(d->meet[meet][q],buff);
		d->solution[meet][q]=solution;
	}

	fclose(in);
	return d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
xorl %ebx, %ebx
movl %ebx, 0xc(%rsp)
movl %ebx, 0x8(%rsp)
movw $0x0, 0x6(%rsp)
testq %rdi, %rdi
je 0x2c3a
movq %rdi, %r14
movl $0x98, %edi
callq 0x1130
testq %rax, %rax
je 0x2c38
movq %rax, %rbx
leaq 0x34ac(%rip), %rsi      # 0x603a
movq %r14, %rdi
callq 0x1190
testq %rax, %rax
je 0x2c30
movq %rax, %r14
movq %rax, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x2c26
leaq 0x78(%rbx), %r12
leaq 0x10(%rsp), %r15
movq %r14, %rdi
leaq 0x35bc(%rip), %rsi      # 0x617d
leaq 0x6(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r15, %r9
xorl %eax, %eax
callq 0x1060
movq %r15, %rdi
callq 0x1080
leaq 0x1(%rax), %rdi
callq 0x1130
movslq 0xc(%rsp), %rcx
movslq 0x8(%rsp), %r13
leaq (%rcx,%rcx,2), %rbp
leaq (%rbx,%rbp,8), %rcx
movq %rax, (%rcx,%r13,8)
movq %rax, %rdi
movq %r15, %rsi
callq 0x1050
movzwl 0x6(%rsp), %eax
leaq (%r12,%rbp,2), %rcx
movw %ax, (%rcx,%r13,2)
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
je 0x2bb7
movq %r14, %rdi
callq 0x1070
jmp 0x2c3a
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_move
int bg_move(Player *c, int x, int y, Map *map,char*desc){
	int room;
	if(!c || !map)return -1;
	room = player_get_room(c);
	if(x<2) return bg_changeRoom(c,LEFT,room,map,desc);
	if (y>YLIMIT) return bg_changeRoom (c,DOWN,room,map,desc);
	if (x>XLIMIT) return bg_changeRoom (c,RIGHT,room,map,desc);
	if (y<0) return bg_changeRoom (c,UP,room,map,desc);
	if(place_blankSpace(map->map[room], x, y)==1){
			c=player_move(c, x, y);
			return B_MOVE;
	}
	return B_NOTHING;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r12
movl %edx, %ebp
testq %rdi, %rdi
sete %cl
testq %r12, %r12
sete %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %dl
jne 0x2ce3
movq %r8, %r14
movl %esi, %r15d
movq %rdi, %rbx
callq 0x3e48
cmpl $0x1, %r15d
jg 0x2c8f
movq %rbx, %rdi
movl $0x1, %esi
jmp 0x2cf1
cmpl $0x25, %ebp
jl 0x2c9e
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x2cf1
cmpl $0x51, %r15d
jl 0x2cae
movq %rbx, %rdi
movl $0x3, %esi
jmp 0x2cf1
testl %ebp, %ebp
js 0x2cec
movq (%r12), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0x3dbf
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0x2ce3
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3e28
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
movq %r12, %rcx
movq %r14, %r8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2d06
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_updateRoom
int bg_updateRoom(Mobjects *m, Map* map, Player *c){
    int roomid,px,py,i=0,id;
    short onoff,npc,meeting;

    if(!m || !map || !c) return -1;

    roomid=player_get_room(c);

    while(i<MAX_OBJ && m->objs[roomid][i]){
		onoff=object_getOnOff(m->objs[roomid][i]);
		px=object_getPx(m->objs[roomid][i]);
		py=object_getPy(m->objs[roomid][i]);
		if(onoff==1){
	    	npc=object_getNPC(m->objs[roomid][i]);
	    	meeting=object_getMeeting(m->objs[roomid][i]);
	    	id=object_getId(m->objs[roomid][i]);
	    	if(meeting==1){
	    	    place_drawchar(map->map[roomid],px,py,MEETING_CHAR);
	    	}
	    	else if (npc==1){
	    	    place_drawchar(map->map[roomid],px,py,NPC_CHAR);
	    	}
	    	else switch(id){
	    	    case(ID_BOX):{
	    	        if(object_getIsPick(m->objs[roomid][i])!=0)place_drawchar(map->map[roomid],px,py,BOX_CHAR);
	    	        break;
	    	    }
	    	    case(ID_PRINTER):{
	    	        place_drawchar(map->map[roomid],px,py,PRINTER_CHAR);
	    	        break;
	    	    }
	    	    case(ID_SHOP):{
	    	        place_drawchar(map->map[roomid],px,py,SHOP_CHAR);
	    	        break;
	    	    }
	    	    default: place_drawchar(map->map[roomid],px,py,DEFAULT_CHAR);
	    	}
		}
		i++;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
sete %al
movq %rsi, 0x10(%rsp)
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %sil
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %sil
jne 0x2fdf
movq %rdi, %r14
movq %rdx, %rdi
callq 0x3e48
cltq
movq %rax, 0x8(%rsp)
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq %rax, %r14
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2fdd
callq 0x39d5
movl %eax, %r13d
movq (%r14,%rbx,8), %rdi
callq 0x398a
movl %eax, %ebp
movq (%r14,%rbx,8), %rdi
callq 0x3999
cmpw $0x1, %r13w
jne 0x2fd0
movl %eax, %r12d
movq (%r14,%rbx,8), %rdi
callq 0x39a8
movl %eax, %r13d
movq (%r14,%rbx,8), %rdi
callq 0x39b7
movl %eax, %r15d
movq (%r14,%rbx,8), %rdi
callq 0x396c
movb $0x58, %cl
cmpw $0x1, %r15w
je 0x2fb2
movb $0x40, %cl
cmpw $0x1, %r13w
je 0x2fb2
cmpl $0x2, %eax
je 0x2fb0
movb $0x2a, %cl
testl %eax, %eax
jne 0x2fb2
movq (%r14,%rbx,8), %rdi
callq 0x39c6
movb $0x4f, %cl
testw %ax, %ax
jne 0x2fb2
jmp 0x2fd0
movb $0x58, %cl
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rdx
movq (%rax,%rdx,8), %rdi
movzbl %cl, %ecx
movl %ebp, %esi
movl %r12d, %edx
callq 0x3d8b
incq %rbx
cmpq $0xa, %rbx
jne 0x2f2d
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_checkDanger
short bg_checkDanger(Map* map, Player *c, Stat *s){
    int statStars, roomStars;
    if (!map || !c || !s) return -1;
    statStars = stat_get_stars(s);
    roomStars = place_getStars(map->map[player_get_room(c)]);
    if(statStars == -1 || roomStars == -1) return -1;
		if(statStars >= roomStars) return 1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
movw $0xffff, %bx            # imm = 0xFFFF
orb %cl, %al
jne 0x3048
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0x433d
movl %eax, %ebp
movq (%r15), %r15
movq %r14, %rdi
callq 0x3e48
cltq
movq (%r15,%rax,8), %rdi
callq 0x3c71
cmpl $-0x1, %ebp
je 0x3048
cmpl $-0x1, %eax
je 0x3048
xorl %ebx, %ebx
cmpl %eax, %ebp
setge %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_box
int bg_box(Inventory* in,Player *c, Map *m, Stat*s,int oId) {
    if(!in || !c || !m) return -1;

    if(place_getLeaveBox(m->map[player_get_room(c)])==1 && place_getLeftBox(m->map[player_get_room(c)])==0 ){
        inventory_erase(in,oId);
        stat_add_motivation(s,BOX_MOTIVATION);
				place_setLeftBox(m->map[player_get_room(c)],1);
        return 1;
    }

    else if(place_getLeaveBox(m->map[player_get_room(c)])==1)return 2;
    else return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
orb %cl, %al
jne 0x32ce
movl %r8d, %ebp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq (%rdx), %r13
movq %rsi, %rdi
callq 0x3e48
cltq
movq (%r13,%rax,8), %rdi
callq 0x3c53
cmpw $0x1, %ax
jne 0x32aa
movq (%r14), %r13
movq %rbx, %rdi
callq 0x3e48
cltq
movq (%r13,%rax,8), %rdi
callq 0x3c62
testw %ax, %ax
je 0x32e0
movq (%r14), %r14
movq %rbx, %rdi
callq 0x3e48
cltq
movq (%r14,%rax,8), %rdi
callq 0x3c53
xorl %r13d, %r13d
cmpw $0x1, %ax
sete %r13b
addl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movl %ebp, %esi
callq 0x22e1
movq %r15, %rdi
movl $0xfa, %esi
callq 0x4234
movq (%r14), %r14
movq %rbx, %rdi
callq 0x3e48
cltq
movq (%r14,%rax,8), %rdi
movl $0x1, %r13d
movl $0x1, %esi
callq 0x3b4a
jmp 0x32ce
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_use
int bg_use(Inventory* in, Stat *s, int oId, char* name, int*id){
	Object* o;
	int us,nchaos,ndanger,nmot,nmoney,objectId;
	if(!in || !s || oId<0 || oId>MAX_INV)return -1;
	if(oId >= in->max) return 0;
	o=inventory_get(in,oId);
	if(!o)return 0;
	if(object_getId(o)==ID_BOX){
		return B_BOX;
	}
	us=object_getUses(o);
	if(us==0)return 0;
	object_setUses(o, us-1);
	nchaos=object_getChaos(o);
	if(nchaos!=0){
		stat_add_chaos(s,nchaos);
	}
	ndanger=object_getDanger(o);
	if(ndanger!=0){
		stat_add_nodanger(s,ndanger);
	}
	nmot=object_getMotivation(o);
	if(nmot!=0){
		stat_add_motivation(s,nmot);
	}
	nmoney=object_getMoney(o);
	if(nmoney!=0){
		stat_add_money(s,nmoney);
	}
	us--;
	strcpy(name,object_getName(o));
	*id = object_getId(o);
	if(us==0){
		inventory_erase(in, oId);
	}
	return 1;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r12
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
cmpl $0xb, %edx
setae %al
orb %cl, %al
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jne 0x3441
movl %edx, %ebx
movq %rdi, %r14
xorl %r15d, %r15d
cmpl %edx, 0x8(%rdi)
jle 0x3441
movq (%r14), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x3441
movq %rsi, %r13
movq %r8, 0x10(%rsp)
movq %rbp, %rdi
callq 0x396c
testl %eax, %eax
je 0x343b
movq %rbp, %rdi
callq 0x39e4
testl %eax, %eax
je 0x3441
movq %rax, 0x8(%rsp)
leal -0x1(%rax), %esi
movq %rbp, %rdi
callq 0x390a
movq %rbp, %rdi
callq 0x3a11
testl %eax, %eax
je 0x33be
movq %r13, %rdi
movl %eax, %esi
callq 0x425f
movq %rbp, %rdi
callq 0x3a02
testl %eax, %eax
je 0x33d4
movq %r13, %rdi
movl %eax, %esi
callq 0x42e1
movq %rbp, %rdi
callq 0x39f3
testl %eax, %eax
je 0x33ea
movq %r13, %rdi
movl %eax, %esi
callq 0x4234
movq %rbp, %rdi
callq 0x3a20
testl %eax, %eax
je 0x3400
movq %r13, %rdi
movl %eax, %esi
callq 0x42c3
movq %rbp, %rdi
callq 0x3960
movq %r12, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbp, %rdi
callq 0x396c
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl $0x1, %r15d
cmpl $0x1, 0x8(%rsp)
jne 0x3441
movq %r14, %rdi
movl %ebx, %esi
callq 0x22e1
jmp 0x3441
movl $0x6, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_buy
short bg_buy(Inventory*shop, Inventory *in, Stat *s, int id, char* name){
	Object *o;
	int price;
	if(!shop || !in || !s || id<0 || id > MAX_INV) return -1;
	if(inventory_full(in)) return B_FULL;
	o=inventory_get(shop, id);
	if(!o)return -1;
	price = -object_getMoney(o);
	if(stat_get_money(s)<(-price)){
	    return 0;
	}
	stat_add_money(s,price);
	object_setMoney(o,0);
	strcpy(name,object_getName(o));
	if((inventory_insert(in, o))==NULL)return-1;
	inventory_erase(shop,id);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r13
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
cmpl $0xb, %ebx
setae %dl
orb %al, %dl
orb %cl, %dl
je 0x348c
movw $0xffff, %ax            # imm = 0xFFFF
jmp 0x352b
movq %rsi, %r15
movw $0xb, %ax
cmpl $0xa, 0x8(%rsi)
je 0x352b
movq %rdi, %r14
movq (%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x3483
movq %r8, (%rsp)
movq %rbp, %rdi
callq 0x3a20
movl %eax, %r12d
movq %r13, %rdi
callq 0x42d2
cmpl %r12d, %eax
jge 0x34ce
xorl %eax, %eax
jmp 0x352b
negl %r12d
movq %r13, %rdi
movl %r12d, %esi
callq 0x42c3
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3951
movq %rbp, %rdi
callq 0x3960
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x1050
movw $0xffff, %ax            # imm = 0xFFFF
testq %r15, %r15
je 0x352b
movq %rbp, %rdi
callq 0x3a2f
movq (%r15), %rcx
movslq 0x8(%r15), %rdx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %eax
movl %eax, 0x8(%r15)
movq %r14, %rdi
movl %ebx, %esi
callq 0x22e1
movw $0x1, %ax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_talk
int bg_talk(Dialogs *d, Player *c, Mobjects *m, char*dialog, char*name){
    Object *npc;
    int npcid, uses, oid, roomid, px, py;
	if(!m || !d )return -1;

	roomid=player_get_room(c);
	px=player_get_px(c);
	py=player_get_py(c);

    oid = mobjects_search(m,roomid,px,py);

    if(oid==-1) return 0;

	npc = mobjects_get(m,roomid,oid);

	if(object_getNPC(npc)!=1)return -1;
	strcpy(name,object_getName(npc));
  npcid = object_getId(npc);
  uses = object_getUses(npc);
	strcpy(dialog,d->dlgs[npcid][uses]);
	if(uses>0)object_setUses(npc,uses-1);

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
testq %rdx, %rdx
sete %al
testq %rdi, %rdi
sete %dl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
orb %al, %dl
jne 0x363d
movq %rsi, %rbx
movq %rdi, %r14
movq %r8, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %rsi, %rdi
callq 0x3e48
movl %eax, %r13d
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e57
movl %eax, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e65
movq %r12, %rdi
movl %r13d, %esi
movl %r15d, %edx
movl %eax, %ecx
callq 0x26c2
cmpl $-0x1, %eax
je 0x363d
cmpl $0x1a, %r13d
ja 0x35cd
movl %r13d, %ecx
cltq
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
addq %rcx, %r12
movq (%r12,%rax,8), %r12
jmp 0x35d0
xorl %r12d, %r12d
movq %r12, %rdi
callq 0x39a8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpw $0x1, %ax
jne 0x363d
movq %r12, %rdi
callq 0x3960
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1050
movq %r12, %rdi
callq 0x396c
movl %eax, %ebp
movq %r12, %rdi
callq 0x39e4
movl %eax, %ebx
movslq %ebp, %rax
movslq %ebx, %r15
imulq $0x78, %rax, %rax
addq %rax, %r14
movq (%r14,%r15,8), %rsi
movq 0x10(%rsp), %rdi
callq 0x1050
movl $0x1, %ebp
testl %r15d, %r15d
jle 0x363d
decl %ebx
movq %r12, %rdi
movl %ebx, %esi
callq 0x390a
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_meeting
int bg_meeting(Meeting *meet, Player *c, Mobjects *m, Stat *s, int question, int answer, char *nextq, int*correct){
	int id,roomid,px,py,oid,solution,uses;
	Object *meeting;

	if(!meet || !c || !m || !s || question>MAX_Q) return -1;

	roomid=player_get_room(c);
	px=player_get_px(c);
	py=player_get_py(c);

  oid = mobjects_search(m,roomid,px,py);
	meeting = mobjects_get(m,roomid,oid);
	id = object_getId(meeting);
	uses = object_getUses(meeting);
	if(uses<=0)return 3;	

	if(question==0 && answer == 0){
		strcpy(nextq,meet->meet[id][0]);
		return 0;
	}
	solution=meet->solution[id][question];
	if(answer==solution){
		stat_add_chaos(s,MEETING_CHAOS);
		*correct = 1;
	}
	else{
		stat_add_chaos(s,-MEETING_CHAOS);
		*correct = 0;
	}
	if(question+1<MAX_Q){
		strcpy(nextq,meet->meet[id][question+1]);
		return 1;
	}
	else{
		object_setUses(meeting,0);
		return 2;
	} 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r13
movq %rsi, %r15
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %sil
orb %al, %sil
testq %rdx, %rdx
sete %al
testq %rcx, %rcx
sete %dl
orb %al, %dl
orb %sil, %dl
cmpl $0x4, %r8d
setge %al
orb %dl, %al
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x37ac
movl %r8d, %ebp
movl %r9d, 0x4(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq %r15, %rdi
callq 0x3e48
movl %eax, %r14d
xorl %r12d, %r12d
movq %r15, %rdi
xorl %eax, %eax
callq 0x3e57
movl %eax, %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x3e65
movq %r13, %rdi
movl %r14d, %esi
movl %ebx, %edx
movl %eax, %ecx
callq 0x26c2
cmpl $0x1a, %r14d
ja 0x36f7
movl %r14d, %ecx
cltq
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
addq %rcx, %r13
movq (%r13,%rax,8), %r12
movq %r12, %rdi
callq 0x396c
movl %eax, %r14d
movq %r12, %rdi
callq 0x39e4
testl %eax, %eax
jle 0x377d
movq 0x50(%rsp), %rdi
movl 0x4(%rsp), %ecx
movl %ecx, %eax
orl %ebp, %eax
je 0x3784
movslq %r14d, %rax
leaq (%rax,%rax,2), %rbx
movq 0x8(%rsp), %r15
leaq (%r15,%rbx,2), %rax
movslq %ebp, %r14
movswl 0x78(%rax,%r14,2), %eax
xorl %r13d, %r13d
cmpl %ecx, %eax
sete %r13b
movl $0x64, %eax
movl $0xffffff9c, %esi       # imm = 0xFFFFFF9C
cmovel %eax, %esi
movq 0x10(%rsp), %rdi
callq 0x425f
movq 0x58(%rsp), %rax
movl %r13d, (%rax)
cmpl $0x1, %ebp
jg 0x379d
leaq (%r15,%rbx,8), %rax
movq 0x8(%rax,%r14,8), %rsi
movq 0x50(%rsp), %rdi
callq 0x1050
movl $0x1, %eax
jmp 0x37ac
movl $0x3, %eax
jmp 0x37ac
movslq %r14d, %rax
leaq (%rax,%rax,2), %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
callq 0x1050
xorl %eax, %eax
jmp 0x37ac
movq %r12, %rdi
xorl %esi, %esi
callq 0x390a
movl $0x2, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/object.c
// Function: object_setPosition
Object* object_setPosition(Object *O, int px, int py){
  if(!O ||  px<0 || py<0)return NULL;

  O->px=px;
  O->py=py;

  return O;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
sete %cl
movl %edx, %edi
orl %esi, %edi
sets %dil
orb %cl, %dil
je 0x3893
xorl %eax, %eax
retq
movl %esi, 0x10(%rax)
movl %edx, 0x14(%rax)
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/object.c
// Function: object_copy
Object* object_copy(Object *O){
  Object *O2;

  O2=object_ini();
  if(!O2)return NULL;

  strcpy(O2->name,O->name);
  O2->id=O->id;
  O2->roomid=O->roomid;
  O2->px=O->px;
  O2->py=O->py;
	O2->npc=O->npc;
  O2->meeting=O->meeting;
  O2->ispick=O->ispick;
  O2->onoff=O->onoff;
	O2->uses=O->uses;
	O2->motivation=O->motivation;
	O2->danger=O->danger;
	O2->chaos=O->chaos;
	O2->money=O->money;

  return O2;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x37bc
testq %rax, %rax
je 0x3ab5
movq %rax, %rbx
movq (%rax), %rdi
movq (%r14), %rsi
callq 0x1050
movl 0x8(%r14), %eax
movl %eax, 0x8(%rbx)
movzwl 0xc(%r14), %eax
movw %ax, 0xc(%rbx)
movl 0x10(%r14), %eax
movl %eax, 0x10(%rbx)
movl 0x14(%r14), %eax
movl %eax, 0x14(%rbx)
movzwl 0x18(%r14), %eax
movw %ax, 0x18(%rbx)
movzwl 0x1e(%r14), %eax
movw %ax, 0x1e(%rbx)
movzwl 0x1a(%r14), %eax
movw %ax, 0x1a(%rbx)
movzwl 0x1c(%r14), %eax
movw %ax, 0x1c(%rbx)
movl 0x20(%r14), %eax
movl %eax, 0x20(%rbx)
movl 0x24(%r14), %eax
movl %eax, 0x24(%rbx)
movl 0x28(%r14), %eax
movl %eax, 0x28(%rbx)
movl 0x2c(%r14), %eax
movl %eax, 0x2c(%rbx)
movl 0x30(%r14), %eax
movl %eax, 0x30(%rbx)
jmp 0x3ab7
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/places.c
// Function: place_ini
Place* place_ini (){
	Place *p;
	p = (Place*) malloc(sizeof(Place));
	if (!p) return NULL;
	p->is_locked = 0;
	p->stars=0;
	p->up=-1;
	p->down=-1;
	p->left=-1;
	p->right=-1;
	return p;
}

// Assembly:
pushq %rax
movl $0x11cc, %edi           # imm = 0x11CC
callq 0x1130
testq %rax, %rax
je 0x3aec
movw $0x0, 0x4(%rax)
movl $0x0, 0xc(%rax)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x10(%rax)
jmp 0x3aee
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/places.c
// Function: place_copy
Place* place_copy (Place *src){
	Place *p;
	if (!src) return NULL;
	p = place_ini();
	if (!p) return NULL;
	p->placeID = src->placeID;
	p->is_locked = src->is_locked;
	p->stars = src->stars;
	p->leavebox = src -> leavebox;
	p->leftbox = src -> leftbox;
	p->up = src->up;
	p->down = src->down;
	p->left = src->left;
	p->right = src->right;

	strcpy(p->draw,src->draw);
	strcpy(p->desc,src->desc);
	return p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3d7e
movq %rdi, %r14
movl $0x11cc, %edi           # imm = 0x11CC
callq 0x1130
testq %rax, %rax
je 0x3d11
movq %rax, %rbx
movw $0x0, 0x4(%rax)
movl $0x0, 0xc(%rax)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x10(%rax)
jmp 0x3d13
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x3d7e
movl (%r14), %eax
movl %eax, (%rbx)
movzwl 0x4(%r14), %eax
movw %ax, 0x4(%rbx)
movl 0xc(%r14), %eax
movl %eax, 0xc(%rbx)
movzwl 0x6(%r14), %eax
movw %ax, 0x6(%rbx)
movzwl 0x8(%r14), %eax
movw %ax, 0x8(%rbx)
movl 0x10(%r14), %eax
movl %eax, 0x10(%rbx)
movl 0x14(%r14), %eax
movl %eax, 0x14(%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x18(%rbx)
movl 0x1c(%r14), %eax
movl %eax, 0x1c(%rbx)
movl $0x420, %esi            # imm = 0x420
leaq (%rbx,%rsi), %rdi
addq %r14, %rsi
callq 0x1050
leaq 0x20(%rbx), %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0x1050
jmp 0x3d80
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/places.c
// Function: place_drawchar
Place* place_drawchar(Place* p, int x, int y, char c){
	if (!p || x<0 || y<0) return NULL;
  if((y*ROWSPCOL+x-2)<2) return p;
	p->draw[y * ROWSPCOL + x - 2] = c;
	return p;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
sete %dil
movl %edx, %r8d
orl %esi, %r8d
sets %r8b
orb %dil, %r8b
je 0x3da7
xorl %eax, %eax
retq
leal (%rdx,%rdx,4), %edx
shll $0x4, %edx
addl %esi, %edx
cmpl $0x4, %edx
jl 0x3dbe
addl $-0x2, %edx
movb %cl, 0x420(%rax,%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/player.c
// Function: player_ini
Player* player_ini(){
	Player *c;
	c = (Player*) malloc(sizeof(Player));
	if(!c) return NULL;
	c->px = INIX;
	c->py = INIY;
	c->room_id = INIROOM;
	return c;
}

// Assembly:
pushq %rax
movl $0xc, %edi
callq 0x1130
testq %rax, %rax
je 0x3e1a
movabsq $0x1400000046, %rcx     # imm = 0x1400000046
movq %rcx, (%rax)
movl $0x0, 0x8(%rax)
jmp 0x3e1c
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/rectangles.c
// Function: move_to
void _move_to(sc_rectangle *sc, int r, int c) {

    if (r < 0) r = 0;
    if (c < 0) c = 0;
    if (r >= sc->nr) r = sc->nr - 1;
    if (c >= sc->nc) c = sc->nc - 1;
    r += (sc->r1 + 1);
    c += (sc->c1 + 1);
    printf("%c[%d;%dH", 27, r, c);
    return;
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %esi
testl %edx, %edx
cmovlel %eax, %edx
movl 0x8(%rdi), %eax
leal -0x1(%rax), %ecx
cmpl %eax, %esi
cmovll %esi, %ecx
movl 0xc(%rdi), %eax
leal -0x1(%rax), %esi
cmpl %eax, %edx
cmovll %edx, %esi
movl (%rdi), %eax
movl 0x4(%rdi), %edx
addl %ecx, %edx
incl %edx
leal (%rax,%rsi), %ecx
incl %ecx
leaq 0x2276(%rip), %rdi      # 0x618d
movl $0x1b, %esi
xorl %eax, %eax
jmp 0x10a0
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/rectangles.c
// Function: win_new
sc_rectangle *win_new(int r1, int c1, int nr, int nc, int bg, int fg) {
    sc_rectangle *src = (sc_rectangle *) malloc(sizeof (sc_rectangle));
    src->r1 = r1;
    src->c1 = c1;
    src->nr = nr;
    src->nc = nc;

    src->bg_color = bg;
    src->fg_color = fg;

    return src;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %r12d
movl %edi, %r13d
movl $0x28, %edi
callq 0x1130
movl %r13d, 0x4(%rax)
movl %r12d, (%rax)
movl %r15d, 0x8(%rax)
movl %r14d, 0xc(%rax)
movl %ebp, 0x1c(%rax)
movl %ebx, 0x20(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/rectangles.c
// Function: win_cls
void win_cls(sc_rectangle *sc) {
    char *buf;
    int i;

    sc->last_line = 0;
    //    if (!_is_visible(sc)) return;
    buf = (char *) malloc((sc->nc + 1) * sizeof (char));
    memset(buf, ' ', sc->nc);
    buf[sc->nc] = 0;
    _prepare_font(sc);
    for (i = sc->r1; i < sc->r1 + sc->nr; i++) {
        _move_to(sc, i - sc->r1, 0); /*Este -1 esta puesto de forma aleatoria, pero funciona*/
        printf("%s", buf);
        /*    printf("%d", i);
            fflush(stdout); */
    }
    fflush(stdout);
    free(buf);
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, 0x18(%rdi)
movslq 0xc(%rdi), %r15
leaq 0x1(%r15), %rdi
callq 0x1130
movq %rax, %r14
movq %rax, %rdi
movl $0x20, %esi
movq %r15, %rdx
callq 0x10c0
movb $0x0, (%r14,%r15)
movl 0x1c(%rbx), %edx
movl 0x20(%rbx), %ecx
leaq 0x21e6(%rip), %rdi      # 0x6197
movl $0x1b, %esi
xorl %eax, %eax
callq 0x10a0
cmpl $0x0, 0x8(%rbx)
jle 0x3ff8
movl 0x4(%rbx), %eax
leaq 0x2b7c(%rip), %r15      # 0x6b49
movl %eax, %ebp
movl %ebp, %esi
subl %eax, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3ee0
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x10a0
incl %ebp
movl 0x4(%rbx), %eax
movl 0x8(%rbx), %ecx
addl %eax, %ecx
cmpl %ecx, %ebp
jl 0x3fcf
movq 0x5fd9(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x1140
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/rectangles.c
// Function: win_write_line_at
int win_write_line_at(sc_rectangle *sc, int r, int c, char *str) {
    char *nl_p;
    char save, av_space, ret;

    if (!_is_visible(sc)) return 0;
    if (r >= sc->nr || c >= sc->nc) return 0;
    nl_p = strchr(str, '\n');
    if (nl_p) *nl_p = 0;

    av_space = sc->nc - c;
    save = -1;
    if (strlen(str) > av_space) {
        save = str[av_space - 1];
        str[av_space - 1] = 0;
    }

    _prepare_font(sc);
    _move_to(sc, r, c);
    printf("%s", str);
    fflush(stdout);
    if (save > 0) {
        str[av_space - 1] = save;
        ret = av_space;
    } else
        ret = strlen(str);
    if (nl_p) *nl_p = '\n';
    sc->last_line = r;
    return ret;
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x41a6
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
cmpl $0x0, 0x4(%rdi)
js 0x4198
cmpl $0x0, (%r14)
js 0x4198
cmpl $0x0, 0x8(%r14)
jle 0x4198
cmpl $0x0, 0xc(%r14)
jle 0x4198
movl %esi, %ebx
cmpl %esi, 0x8(%r14)
jle 0x4198
movl %edx, %ebp
cmpl %edx, 0xc(%r14)
jle 0x4198
movq %rcx, %r15
movq %rcx, %rdi
movl $0xa, %esi
callq 0x1090
testq %rax, %rax
je 0x40f4
movb $0x0, (%rax)
movq %rax, (%rsp)
movl 0xc(%r14), %r13d
subl %ebp, %r13d
movq %r15, %rdi
callq 0x1080
movsbq %r13b, %rcx
movb $-0x1, %r12b
cmpq %rcx, %rax
jbe 0x4122
movsbq %r13b, %rax
movb -0x1(%r15,%rax), %r12b
movb $0x0, -0x1(%r15,%rax)
movl 0x1c(%r14), %edx
movl 0x20(%r14), %ecx
leaq 0x2066(%rip), %rdi      # 0x6197
movl $0x1b, %esi
xorl %eax, %eax
callq 0x10a0
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x3ee0
leaq 0x29f9(%rip), %rdi      # 0x6b49
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
movq 0x5e77(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x1140
testb %r12b, %r12b
jle 0x4179
movsbq %r13b, %rax
movb %r12b, -0x1(%r15,%rax)
jmp 0x4184
movq %r15, %rdi
callq 0x1080
movq %rax, %r13
movq (%rsp), %rax
testq %rax, %rax
je 0x4190
movb $0xa, (%rax)
movl %ebx, 0x18(%r14)
movsbl %r13b, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/rectangles.c
// Function: win_write_char_at
int win_write_char_at(sc_rectangle *sc, int r, int c, char ch) {

    if (!_is_visible(sc)) return 0;
    if (r >= sc->nr || c >= sc->nc) return 0;

    _move_to(sc, r, c);
    printf("%c", ch);
    fflush(stdout);
    return 1;
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x41f4
cmpl $0x0, 0x4(%rdi)
js 0x41f4
cmpl $0x0, (%rdi)
js 0x41f4
cmpl $0x0, 0x8(%rdi)
jle 0x41f4
cmpl $0x0, 0xc(%rdi)
jle 0x41f4
cmpl %esi, 0x8(%rdi)
jle 0x41f4
cmpl %edx, 0xc(%rdi)
jle 0x41f4
pushq %rbx
movl %ecx, %ebx
callq 0x3ee0
movsbl %bl, %edi
callq 0x1040
movq 0x5df2(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x1140
movl $0x1, %eax
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/stats.c
// Function: stat_add_chaos
Stat* stat_add_chaos (Stat* stat, int chaos){
    if (!stat){
        return NULL;
    }
    stat->chaos+=chaos;
    if(stat->chaos<0) stat->chaos = 0;
    return stat;
}

// Assembly:
xorl %ecx, %ecx
testq %rdi, %rdi
je 0x4275
movq %rdi, %rax
addl 0x4(%rdi), %esi
testl %esi, %esi
cmovgl %esi, %ecx
movl %ecx, 0x4(%rdi)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/stats.c
// Function: stat_stars
Stat* stat_stars (Stat* stat){
    int stars;
    if (!stat){
        return NULL;
    }
    stars = (int) stat->danger/DPERSTAR;
    if (stars > 5){
        stat->stars=5;
    }
    else if (stars < 0){
        return NULL;
    }
    else{
        stat->stars=stars;
    }
    return stat;
}

// Assembly:
testq %rdi, %rdi
je 0x431f
movq %rdi, %rax
movl 0x8(%rdi), %edx
movl $0x5, %ecx
cmpl $0x176f, %edx           # imm = 0x176F
jg 0x4339
cmpl $0xfffffc19, %edx       # imm = 0xFFFFFC19
jge 0x4322
xorl %eax, %eax
retq
movslq %edx, %rcx
imulq $0x10624dd3, %rcx, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
movl %ecx, 0xc(%rax)
retq
// File: /workspace/github_c_makefile_star2_O1/rafa9811[P]theIndiependenceGame/interact.c
// Function: interact_updateClk
void interact_updateClk(double remaining, Interact *interact){
  int newDanger, motivation, chaos, remainingtime, nodanger;
  if(!interact) return;
  if(!IN(stat)) return;
  motivation = stat_get_motivation(IN(stat));
  chaos = stat_get_chaos(IN(stat));
  nodanger = stat_get_nodanger(IN(stat));
  remainingtime = TIME - remaining;
  remainingtime = (remainingtime*remainingtime)/DANGER1;
  newDanger = motivation - chaos + remainingtime + nodanger;
  /*if(newDanger<0){
    newDanger=0;
  }*/
  stat_set_danger(IN(stat),newDanger);
  stat_stars(IN(stat));
  return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x46c7
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x46c7
movsd %xmm0, 0x8(%rsp)
callq 0x4242
movl %eax, %ebp
movq 0x8(%rbx), %rdi
callq 0x4278
movl %eax, %r14d
movq 0x8(%rbx), %rdi
callq 0x42f0
movsd 0x1982(%rip), %xmm0     # 0x6010
subsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %ecx
imull %ecx, %ecx
imulq $0x3e0f83e1, %rcx, %rsi # imm = 0x3E0F83E1
shrq $0x23, %rsi
addl %ebp, %esi
subl %r14d, %esi
addl %eax, %esi
movq 0x8(%rbx), %rdi
callq 0x4287
movq 0x8(%rbx), %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x42ff
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq