LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 0x1e36
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
cmpq $0xf, %r12
je 0x1e1a
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x1e22
callq 0x1030
incq %r12
jmp 0x1e01
cmpq $0x1c, %r14
jbe 0x1e2d
jmp 0x1e36
testq %r12, %r12
je 0x1e36
cmpq $0x1d, %r14
jae 0x1e36
incq %r14
addq $0x78, %r15
jmp 0x1dfe
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0xc(%rsp)
andl $0x0, 0x8(%rsp)
testq %rdi, %rdi
je 0x1f1a
movq %rdi, %r14
movl $0xe10, %edi            # imm = 0xE10
callq 0x1130
testq %rax, %rax
je 0x1f1a
movq %rax, %rbx
leaq 0x41ad(%rip), %rsi      # 0x603a
movq %r14, %rdi
callq 0x11a0
testq %rax, %rax
je 0x1f12
movq %rax, %r14
leaq 0x42cd(%rip), %r15      # 0x6171
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x1f08
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
jmp 0x1eb3
movq %r14, %rdi
callq 0x1070
jmp 0x1f1c
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_O2/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 0x1f76
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x1f67
xorl %r14d, %r14d
movq (%rdi,%r14), %rax
testq %rax, %rax
je 0x1f62
movq %rax, %rdi
callq 0x360c
movq (%rbx), %rdi
addq $0x8, %r14
jmp 0x1f48
callq 0x1030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O2/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
je 0x21a3
pushq $-0x1
popq %rax
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
movl 0x8(%rbx), %eax
cmpl %r14d, %eax
jle 0x21f1
movq (%rbx), %rcx
movq (%rcx,%r14,8), %rdi
testq %rdi, %rdi
je 0x21f1
callq 0x360c
movq (%rbx), %rax
movq 0x8(%rax,%r14,8), %rdi
movl 0x8(%rbx), %eax
testq %rdi, %rdi
je 0x21f1
leaq 0x1(%r14), %r15
cmpq %rax, %r15
je 0x21f1
callq 0x380c
movq (%rbx), %rcx
movq %rax, (%rcx,%r14,8)
movq %r15, %r14
jmp 0x21ae
decl %eax
movl %eax, 0x8(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2256
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x380c
movq (%rbx), %rcx
movslq 0x8(%rbx), %rdx
movq %rax, (%rcx,%rdx,8)
leal 0x1(%rdx), %eax
movl %eax, 0x8(%rbx)
jmp 0x2258
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x22bf
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
cmpq $0xa, %r12
je 0x22a3
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x22ab
callq 0x360c
incq %r12
jmp 0x228a
cmpq $0x18, %r14
jbe 0x22b6
jmp 0x22bf
testq %r12, %r12
je 0x22bf
cmpq $0x19, %r14
jae 0x22bf
incq %r14
addq $0x50, %r15
jmp 0x2287
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/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 %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x2550
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3766
movswq %ax, %rax
imulq $0x50, %rax, %rax
addq %rax, %rbx
xorl %r15d, %r15d
movq %r15, %rcx
incq %r15
cmpq $0x9, %rcx
ja 0x2532
cmpq $0x0, (%rbx,%rcx,8)
jne 0x251f
xorl %eax, %eax
cmpq $0x9, %rcx
ja 0x254a
movq %r14, %rdi
callq 0x380c
movq %rax, -0x8(%rbx,%r15,8)
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %r15
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x1
popq %rax
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0x264e
movl %esi, %r12d
cmpl $0x1a, %esi
ja 0x264e
movl %edx, %r15d
cmpl $0x50, %edx
ja 0x264e
movl %ecx, %r14d
cmpl $0x24, %ecx
ja 0x264e
movl %r12d, %eax
imulq $0x50, %rax, %rax
addq %rax, 0x10(%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %rbx
movq 0x10(%rsp), %rax
movq (%rax,%r13,8), %rdi
cmpq $0xa, %r13
jb 0x25c3
testq %rdi, %rdi
je 0x2646
callq 0x3766
movswl %ax, %ebp
movq (%rbx,%r13,8), %rdi
callq 0x3775
movq %r13, %rcx
movl %eax, %r13d
movq %rcx, 0x8(%rsp)
movq (%rbx,%rcx,8), %rdi
callq 0x3782
cmpl %r12d, %ebp
jne 0x25fb
leal 0x1(%r13), %edi
cmpl %r15d, %edi
jne 0x25fb
cmpl %r14d, %eax
je 0x263f
cmpl %r12d, %ebp
jne 0x260e
leal -0x1(%r13), %edi
cmpl %r15d, %edi
jne 0x260e
cmpl %r14d, %eax
je 0x263f
xorl %r12d, %ebp
xorl %r15d, %r13d
orl %ebp, %r13d
sete %r8b
jne 0x2625
leal 0x1(%rax), %edi
cmpl %r14d, %edi
je 0x263f
decl %eax
cmpl %r14d, %eax
sete %al
testb %al, %r8b
movq 0x8(%rsp), %r13
jne 0x264b
incq %r13
jmp 0x25ab
movq 0x8(%rsp), %rax
jmp 0x264e
pushq $-0x1
popq %rax
jmp 0x264e
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x26cc
movq %rdi, %rbx
movl %esi, %eax
movslq %edx, %rcx
imulq $0x50, %rax, %rax
leaq (%rax,%rcx,8), %r14
addq %rdi, %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x26d0
callq 0x360c
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x26d0
callq 0x380c
movq %rax, (%r14)
addq $0x8, %r14
jmp 0x26a8
xorl %ebx, %ebx
jmp 0x26d4
andq $0x0, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2724
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x2715
xorl %r14d, %r14d
movq (%rdi,%r14), %rax
testq %rax, %rax
je 0x2710
movq %rax, %rdi
callq 0x388c
movq (%rbx), %rdi
addq $0x8, %r14
jmp 0x26f6
callq 0x1030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x29ab
xorl %r14d, %r14d
movq %rbx, %r15
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0x298f
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x2997
callq 0x1030
incq %r12
jmp 0x2976
cmpq $0x3, %r14
jbe 0x29a2
jmp 0x29ab
testq %r12, %r12
je 0x29ab
cmpq $0x4, %r14
jae 0x29ab
incq %r14
addq $0x18, %r15
jmp 0x2973
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0xc(%rsp)
andl $0x0, 0x8(%rsp)
andw $0x0, 0x6(%rsp)
testq %rdi, %rdi
je 0x2aa9
movq %rdi, %r14
movl $0x98, %edi
callq 0x1130
testq %rax, %rax
je 0x2aa9
movq %rax, %rbx
leaq 0x3632(%rip), %rsi      # 0x603a
movq %r14, %rdi
callq 0x11a0
testq %rax, %rax
je 0x2aa1
movq %rax, %r14
leaq 0x78(%rbx), %r12
leaq 0x10(%rsp), %r15
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
jne 0x2a97
movq %r14, %rdi
leaq 0x3742(%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), %r13
movslq 0x8(%rsp), %rbp
imulq $0x18, %r13, %rcx
addq %rbx, %rcx
movq %rax, (%rcx,%rbp,8)
movq %rax, %rdi
movq %r15, %rsi
callq 0x1050
movzwl 0x6(%rsp), %eax
imulq $0x6, %r13, %rcx
addq %r12, %rcx
movw %ax, (%rcx,%rbp,2)
jmp 0x2a25
movq %r14, %rdi
callq 0x1070
jmp 0x2aab
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_O2/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, %r15
testq %rdi, %rdi
sete %al
testq %rcx, %rcx
sete %cl
orb %al, %cl
jne 0x2af5
movq %r8, %r14
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %rbx
callq 0x3b74
cmpl $0x1, %r12d
jg 0x2b01
pushq $0x1
jmp 0x2b12
pushq $-0x1
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x25, %ebp
jl 0x2b0a
pushq $0x2
jmp 0x2b12
cmpl $0x51, %r12d
jb 0x2b2b
pushq $0x3
popq %rsi
movq %rbx, %rdi
movl %eax, %edx
movq %r15, %rcx
movq %r14, %r8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2b65
testl %ebp, %ebp
js 0x2b5e
movq (%r15), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x3b04
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x1, %ecx
jne 0x2af8
movq %rbx, %rdi
movl %r12d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3b5a
pushq $0x1
jmp 0x2af7
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x2b16
// File: /workspace/github_c_makefile_star2_O2/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 %al
orb %cl, %al
jne 0x2e06
movq %rdi, %r14
movq %rdx, %rdi
callq 0x3b74
movslq %eax, %rcx
movq %rcx, 0x8(%rsp)
imulq $0x50, %rcx, %rax
addq %rax, %r14
xorl %ebx, %ebx
cmpq $0xa, %rbx
je 0x2e0b
movq (%r14,%rbx,8), %rdi
testq %rdi, %rdi
je 0x2e0b
callq 0x37bc
movl %eax, %r13d
movq (%r14,%rbx,8), %rdi
callq 0x3775
movl %eax, %ebp
movq (%r14,%rbx,8), %rdi
callq 0x3782
cmpw $0x1, %r13w
jne 0x2dfe
movl %eax, %r12d
movq (%r14,%rbx,8), %rdi
callq 0x378f
movl %eax, %r13d
movq (%r14,%rbx,8), %rdi
callq 0x379e
movl %eax, %r15d
movq (%r14,%rbx,8), %rdi
callq 0x3759
movb $0x58, %cl
cmpw $0x1, %r15w
je 0x2de0
movb $0x40, %cl
cmpw $0x1, %r13w
je 0x2de0
cmpl $0x2, %eax
je 0x2dde
movb $0x2a, %cl
testl %eax, %eax
jne 0x2de0
movq (%r14,%rbx,8), %rdi
callq 0x37ad
movb $0x4f, %cl
testw %ax, %ax
jne 0x2de0
jmp 0x2dfe
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 0x3ad3
incq %rbx
jmp 0x2d51
pushq $-0x1
popq %rax
jmp 0x2e0d
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_O2/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 0x2e76
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0x3ff1
movl %eax, %ebp
movq (%r15), %r15
movq %r14, %rdi
callq 0x3b74
cltq
movq (%r15,%rax,8), %rdi
callq 0x3a06
cmpl $-0x1, %ebp
je 0x2e76
cmpl $-0x1, %eax
je 0x2e76
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_O2/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
orb %cl, %al
jne 0x30e1
movl %r8d, %ebp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq (%rdx), %r13
movq %rsi, %rdi
callq 0x3b74
cltq
movq (%r13,%rax,8), %rdi
callq 0x39e8
cmpw $0x1, %ax
jne 0x30be
movq (%r14), %r13
movq %rbx, %rdi
callq 0x3b74
cltq
movq (%r13,%rax,8), %rdi
callq 0x39f7
testw %ax, %ax
je 0x30f5
movq (%r14), %r14
movq %rbx, %rdi
callq 0x3b74
cltq
movq (%r14,%rax,8), %rdi
callq 0x39e8
xorl %ebx, %ebx
cmpw $0x1, %ax
sete %bl
addl %ebx, %ebx
jmp 0x30e4
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movl %ebp, %esi
callq 0x2190
movq %r15, %rdi
movl $0xfa, %esi
callq 0x3f16
movq (%r14), %r14
movq %rbx, %rdi
callq 0x3b74
cltq
movq (%r14,%rax,8), %rdi
pushq $0x1
popq %rbx
movl %ebx, %esi
callq 0x38e1
jmp 0x30e4
// File: /workspace/github_c_makefile_star2_O2/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
je 0x315b
pushq $-0x1
popq %r15
jmp 0x3245
movl %edx, %ebx
movq %rdi, %r14
xorl %r15d, %r15d
cmpl %edx, 0x8(%rdi)
jle 0x3245
movq (%r14), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x3245
movq %rsi, %r13
movq %r8, 0x10(%rsp)
movq %rbp, %rdi
callq 0x3759
testl %eax, %eax
je 0x3257
movq %rbp, %rdi
callq 0x37cb
testl %eax, %eax
je 0x3245
movq %rax, 0x8(%rsp)
leal -0x1(%rax), %esi
movq %rbp, %rdi
callq 0x3703
movq %rbp, %rdi
callq 0x37f2
testl %eax, %eax
je 0x31cc
movq %r13, %rdi
movl %eax, %esi
callq 0x3f39
movq %rbp, %rdi
callq 0x37e5
testl %eax, %eax
je 0x31e2
movq %r13, %rdi
movl %eax, %esi
callq 0x3fa6
movq %rbp, %rdi
callq 0x37d8
testl %eax, %eax
je 0x31f8
movq %r13, %rdi
movl %eax, %esi
callq 0x3f16
movq %rbp, %rdi
callq 0x37ff
testl %eax, %eax
je 0x320e
movq %r13, %rdi
movl %eax, %esi
callq 0x3f8d
movq %rbp, %rdi
callq 0x374d
movq %r12, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbp, %rdi
callq 0x3759
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
pushq $0x1
popq %r15
cmpl $0x1, 0x8(%rsp)
jne 0x3245
movq %r14, %rdi
movl %ebx, %esi
callq 0x2190
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x6
jmp 0x3154
// File: /workspace/github_c_makefile_star2_O2/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 0x3297
movw $0xffff, %ax            # imm = 0xFFFF
jmp 0x332a
movq %rsi, %r15
movw $0xb, %ax
cmpl $0xa, 0x8(%rsi)
je 0x332a
movq %rdi, %r14
movq (%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x328e
movq %r8, (%rsp)
movq %rbp, %rdi
callq 0x37ff
movl %eax, %r12d
movq %r13, %rdi
callq 0x3f99
cmpl %r12d, %eax
jge 0x32d9
xorl %eax, %eax
jmp 0x332a
negl %r12d
movq %r13, %rdi
movl %r12d, %esi
callq 0x3f8d
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3741
movq %rbp, %rdi
callq 0x374d
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x1050
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2227
movq %rax, %rcx
movw $0xffff, %ax            # imm = 0xFFFF
testq %rcx, %rcx
je 0x332a
movq %r14, %rdi
movl %ebx, %esi
callq 0x2190
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_O2/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
pushq $-0x1
popq %rbp
orb %al, %dl
jne 0x3432
movq %rsi, %rbx
movq %rdi, %r14
movq %r8, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %rsi, %rdi
callq 0x3b74
movl %eax, %r13d
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3b81
movl %eax, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3b8d
movq %r12, %rdi
movl %r13d, %esi
movl %r15d, %edx
movl %eax, %ecx
callq 0x2554
cmpl $-0x1, %eax
je 0x3432
cmpl $0x1a, %r13d
ja 0x33c6
movl %r13d, %ecx
cltq
imulq $0x50, %rcx, %rcx
addq %rcx, %r12
movq (%r12,%rax,8), %r12
jmp 0x33c9
xorl %r12d, %r12d
pushq $-0x1
popq %rbp
movq %r12, %rdi
callq 0x378f
cmpw $0x1, %ax
jne 0x3432
movq %r12, %rdi
callq 0x374d
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1050
movq %r12, %rdi
callq 0x3759
movl %eax, %ebp
movq %r12, %rdi
callq 0x37cb
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
pushq $0x1
popq %rbp
testl %r15d, %r15d
jle 0x3432
decl %ebx
movq %r12, %rdi
movl %ebx, %esi
callq 0x3703
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_O2/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, %xmm0
movq %rdi, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %rcx, %xmm0
movq %rdx, %xmm2
punpcklqdq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0]
pxor %xmm0, %xmm0
cmpl $0x4, %r8d
setge %al
pcmpeqd %xmm0, %xmm2
pcmpeqd %xmm0, %xmm1
movdqa %xmm1, %xmm0
shufps $0xdd, %xmm2, %xmm0     # xmm0 = xmm0[1,3],xmm2[1,3]
shufps $0x88, %xmm2, %xmm1     # xmm1 = xmm1[0,2],xmm2[0,2]
andps %xmm0, %xmm1
movmskps %xmm1, %edx
testl %edx, %edx
setne %dl
orb %al, %dl
je 0x34a5
pushq $-0x1
jmp 0x35ae
movl %r8d, %ebp
movq %rsi, %r15
movl %r9d, 0x4(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq %rsi, %rdi
callq 0x3b74
movl %eax, %r14d
xorl %r12d, %r12d
movq %r15, %rdi
xorl %eax, %eax
callq 0x3b81
movl %eax, %ebx
movq %r15, %rdi
xorl %eax, %eax
callq 0x3b8d
movq %r13, %rdi
movl %r14d, %esi
movl %ebx, %edx
movl %eax, %ecx
callq 0x2554
cmpl $0x1a, %r14d
ja 0x3504
movl %r14d, %ecx
cltq
imulq $0x50, %rcx, %rcx
addq %rcx, %r13
movq (%r13,%rax,8), %r12
movq %r12, %rdi
callq 0x3759
movl %eax, %r14d
movq %r12, %rdi
callq 0x37cb
testl %eax, %eax
jle 0x3585
movq 0x50(%rsp), %rdi
movl 0x4(%rsp), %ecx
movl %ecx, %eax
orl %ebp, %eax
je 0x3589
movslq %r14d, %rbx
imulq $0x6, %rbx, %rax
movq 0x8(%rsp), %r13
addq %r13, %rax
movslq %ebp, %r14
movswl 0x78(%rax,%r14,2), %eax
xorl %r15d, %r15d
cmpl %ecx, %eax
sete %r15b
pushq $0x64
popq %rax
pushq $-0x64
popq %rsi
cmovel %eax, %esi
movq 0x10(%rsp), %rdi
callq 0x3f39
movq 0x58(%rsp), %rax
movl %r15d, (%rax)
cmpl $0x1, %ebp
jg 0x35a2
imulq $0x18, %rbx, %rax
addq %rax, %r13
movq 0x8(%r13,%r14,8), %rsi
movq 0x50(%rsp), %rdi
callq 0x1050
pushq $0x1
jmp 0x35ae
pushq $0x3
jmp 0x35ae
movslq %r14d, %rax
imulq $0x18, %rax, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax), %rsi
callq 0x1050
xorl %eax, %eax
jmp 0x35af
movq %r12, %rdi
xorl %esi, %esi
callq 0x3703
pushq $0x2
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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, %rbx
callq 0x35c0
movq %rax, %r14
testq %rax, %rax
je 0x385b
movq (%r14), %rdi
movq (%rbx), %rsi
callq 0x1050
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r14)
movzwl 0xc(%rbx), %eax
movw %ax, 0xc(%r14)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r14)
movups 0x20(%rbx), %xmm0
movups %xmm0, 0x20(%r14)
movl 0x30(%rbx), %eax
movl %eax, 0x30(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 0x388a
andw $0x0, 0x4(%rax)
andl $0x0, 0xc(%rax)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x10(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3ac6
movq %rdi, %r14
callq 0x3868
testq %rax, %rax
je 0x3ac6
movq %rax, %rbx
movl (%r14), %eax
movl %eax, (%rbx)
movzwl 0x4(%r14), %eax
movw %ax, 0x4(%rbx)
movl 0xc(%r14), %eax
movl %eax, 0xc(%rbx)
movl 0x6(%r14), %eax
movl %eax, 0x6(%rbx)
movups 0x10(%r14), %xmm0
movups %xmm0, 0x10(%rbx)
movl $0x420, %esi            # imm = 0x420
leaq (%rbx,%rsi), %rdi
addq %r14, %rsi
callq 0x1050
movq %rbx, %rdi
addq $0x20, %rdi
addq $0x20, %r14
movq %r14, %rsi
callq 0x1050
jmp 0x3ac8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3aef
xorl %eax, %eax
retq
imull $0x50, %edx, %edx
addl %esi, %edx
cmpl $0x4, %edx
jl 0x3b03
addl $-0x2, %edx
movb %cl, 0x420(%rax,%rdx)
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0xc
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x3b53
movabsq $0x1400000046, %rcx     # imm = 0x1400000046
movq %rcx, (%rax)
andl $0x0, 0x8(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/rafa9811[P]theIndiependenceGame/player.c
// Function: player_move
Player* player_move(Player *c,int x, int y){
	if(!c) return NULL;
	c->px=x;
	c->py=y;
	return c;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
je 0x3b67
movl %esi, (%rax)
movl %edx, 0x4(%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1(%rax,%rsi), %ecx
leaq 0x256f(%rip), %rdi      # 0x618d
pushq $0x1b
popq %rsi
xorl %eax, %eax
jmp 0x10a0
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x28
popq %rdi
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_O2/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
andl $0x0, 0x18(%rdi)
movslq 0xc(%rdi), %r15
leaq 0x1(%r15), %rdi
callq 0x1130
movq %rax, %r14
pushq $0x20
popq %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x10c0
movb $0x0, (%r14,%r15)
movq %rbx, %rdi
callq 0x3d02
movl 0x4(%rbx), %eax
leaq 0x2e95(%rip), %r15      # 0x6b49
movl %eax, %ebp
movl 0x8(%rbx), %ecx
addl %eax, %ecx
cmpl %ecx, %ebp
jge 0x3ce1
movl %ebp, %esi
subl %eax, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3be8
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x10a0
incl %ebp
movl 0x4(%rbx), %eax
jmp 0x3cb6
movq 0x62f0(%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_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
callq 0x3d4b
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x3e7b
cmpl %ebx, 0x8(%r14)
jle 0x3e7b
movl 0xc(%r14), %r12d
cmpl %ebp, %r12d
jle 0x3e7b
pushq $0xa
popq %rsi
movq %r15, %rdi
callq 0x1090
testq %rax, %rax
je 0x3dee
movb $0x0, (%rax)
movl 0xc(%r14), %r12d
movq %rax, (%rsp)
subl %ebp, %r12d
movq %r15, %rdi
callq 0x1080
movsbq %r12b, %rcx
movb $-0x1, %r13b
cmpq %rcx, %rax
jbe 0x3e18
movsbq %r12b, %rax
movb -0x1(%r15,%rax), %r13b
movb $0x0, -0x1(%r15,%rax)
movq %r14, %rdi
callq 0x3d02
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x3be8
leaq 0x2d16(%rip), %rdi      # 0x6b49
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
movq 0x6194(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x1140
testb %r13b, %r13b
jle 0x3e5c
movsbq %r12b, %rax
movb %r13b, -0x1(%r15,%rax)
jmp 0x3e67
movq %r15, %rdi
callq 0x1080
movq %rax, %r12
movq (%rsp), %rax
testq %rax, %rax
je 0x3e73
movb $0xa, (%rax)
movl %ebx, 0x18(%r14)
movsbl %r12b, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
callq 0x3d4b
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x3edb
cmpl %r14d, 0x8(%r15)
jle 0x3edb
cmpl %ebp, 0xc(%r15)
jle 0x3edb
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x3be8
movsbl %bl, %edi
callq 0x1040
movq 0x6108(%rip), %rax      # 0x9fd8
movq (%rax), %rdi
callq 0x1140
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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:
movq %rdi, %rax
testq %rdi, %rdi
je 0x3f4e
addl 0x4(%rax), %esi
xorl %ecx, %ecx
testl %esi, %esi
cmovgl %esi, %ecx
movl %ecx, 0x4(%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3fe6
movl 0x8(%rdi), %ecx
cmpl $0x176f, %ecx           # imm = 0x176F
jle 0x3fd4
pushq $0x5
popq %rax
jmp 0x3fea
movl $0x3e8, %esi            # imm = 0x3E8
movl %ecx, %eax
cltd
idivl %esi
cmpl $0xfffffc19, %ecx       # imm = 0xFFFFFC19
jge 0x3fea
xorl %edi, %edi
jmp 0x3fed
movl %eax, 0xc(%rdi)
movq %rdi, %rax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x4396
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x4396
movsd %xmm0, 0x8(%rsp)
callq 0x3f21
movl %eax, %ebp
movq 0x8(%rbx), %rdi
callq 0x3f4f
movl %eax, %r14d
movq 0x8(%rbx), %rdi
callq 0x3fb2
movl %eax, %ecx
movsd 0x1cb1(%rip), %xmm0     # 0x6010
subsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %eax
imull %eax, %eax
pushq $0x21
popq %rsi
xorl %edx, %edx
divl %esi
addl %eax, %ebp
subl %r14d, %ebp
addl %ecx, %ebp
movq 0x8(%rbx), %rdi
movl %ebp, %esi
callq 0x3f5c
movq 0x8(%rbx), %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x3fbf
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rafa9811[P]theIndiependenceGame/interface.c
// Function: interface_ini
Interface* interface_ini(){
    Interface *interface;
    interface = (Interface*)malloc(sizeof(Interface));
    /*The screen win, where our player moves, picks up objects, interacts... The main action in the game*/
    interface->screen = win_new(0, 0, SCREENY+2, SCREENX+3, BGCOLOR, CHARCOLOR);
    /*The dialogs window is where every dialog stored in interact_play will be printed:*/
    interface->dlgs = win_new(SCREENY+2, 0, DLGY, DLGX, BGCOLOR, CHARCOLOR);
    /*The clk window, that won't be used here, but in the main c, where it is constantly updating for showing the remaining time.
    If it was printed at the same pace as the rest of the windows, we would only get an update of the remaining time when we do something.*/
    interface->clk = win_new(0,SCREENX+5,CLKY,CLKX,BGCOLOR,CHARCOLOR);
    /*Stat screen, updated every time we do something, for showing our money, number of printers activated and so on:*/
    interface->stats = win_new(CLKY, SCREENX+2, STATY, STATX, BGCOLOR, CHARCOLOR);
    return interface;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x20
popq %rdi
callq 0x1130
movq %rax, %rbx
pushq $0x26
popq %r14
pushq $0x53
popq %rcx
pushq $0x1
popq %rbp
xorl %edi, %edi
xorl %esi, %esi
movl %r14d, %edx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x3c28
movq %rax, (%rbx)
pushq $0xa
popq %rdx
pushq $0x78
popq %rcx
movl %r14d, %edi
xorl %esi, %esi
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x3c28
movq %rax, 0x8(%rbx)
pushq $0x55
popq %rsi
pushq $0x5
popq %r14
pushq $0x28
popq %r15
xorl %edi, %edi
movl %r14d, %edx
movl %r15d, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x3c28
movq %rax, 0x18(%rbx)
pushq $0x52
popq %rsi
pushq $0x1f
popq %rdx
movl %r14d, %edi
movl %r15d, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x3c28
movq %rax, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rafa9811[P]theIndiependenceGame/interface.c
// Function: interface_printDialog
int interface_printDialog(Interact* interact, Interface* interface){
    char *dialog,*ini,line[2*DLG_LINE];
    int len,i=0,linenumber=2;
    if(!interact || !interface) return -1;
    win_cls(interface->dlgs);
    dialog=(char*)malloc(1024);
    strcpy(dialog,interact_getDialog(interact));
    len = strlen(dialog);
    if(len>DLG_LINE){
        ini=dialog;
        while(i<len && linenumber<DLG_LINE){
        dialog = ini + i;
        memcpy(line,dialog,DLG_LINE);
        win_write_line_at(interface->dlgs,linenumber,2,line);
        i+=DLG_LINE;
        linenumber++;
        }
    }
    else win_write_line_at(interface->dlgs,linenumber,2,dialog);
    dialog=ini;
    if(dialog)free(dialog);
    return 0;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x4d09
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq 0x8(%rsi), %rdi
callq 0x3c71
movl $0x400, %edi            # imm = 0x400
callq 0x1130
movq %rax, %r14
movq %r15, %rdi
callq 0x426c
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %r14, %rdi
callq 0x1080
movq %rax, %r15
cmpl $0x6a, %r15d
jl 0x4d0d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
pushq $0x2
popq %rbp
xorl %r13d, %r13d
movq %rsp, %r12
cmpq %r15, %r13
jae 0x4d1e
cmpl $0x68, %ebp
ja 0x4d1e
leaq (%r14,%r13), %rsi
movq %r12, %rdi
pushq $0x69
popq %rdx
callq 0x1100
movq 0x8(%rbx), %rdi
movl %ebp, %esi
pushq $0x2
popq %rdx
movq %r12, %rcx
callq 0x3d9a
addq $0x69, %r13
incl %ebp
jmp 0x4cd7
pushq $-0x1
popq %rax
retq
movq 0x8(%rbx), %rdi
pushq $0x2
popq %rdx
movl %edx, %esi
movq %r14, %rcx
callq 0x3d9a
movq %r14, %rdi
callq 0x1030
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rafa9811[P]theIndiependenceGame/interface.c
// Function: interface_printScreen
int interface_printScreen(Interact *interact, Interface* interface){
    int linenumber=0,room;
    char line[SCREEN_LINE*2],*draw,*ini;
    int i=0;
    if(!interact || !interface) return -1;
    win_cls(interface->screen);
    room=player_get_room(interact_getPlayer(interact));
    draw=map_getRoomDraw(interact_getMap(interact),room);
    if(!draw)return -1;
    ini=draw;
    while(linenumber<=YLIMIT){
      draw = ini + i;
      memcpy(line,draw,SCREEN_LINE);
      win_write_line_at(interface->screen,linenumber,2,line);
      i+=SCREEN_LINE;
      linenumber++;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x1
popq %r15
orb %al, %cl
jne 0x4fc5
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rdi
callq 0x3c71
movq %r14, %rdi
callq 0x42ba
movq %rax, %rdi
callq 0x3b74
movl %eax, %ebp
movq %r14, %rdi
callq 0x42c6
movq %rax, %rdi
movl %ebp, %esi
callq 0x293c
testq %rax, %rax
je 0x4fc5
movq %rax, %r14
movq %rsp, %r15
pushq $0x50
popq %r12
pushq $0x2
popq %r13
xorl %ebp, %ebp
cmpl $0x25, %ebp
je 0x4fc2
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1100
movq (%rbx), %rdi
movl %ebp, %esi
movl %r13d, %edx
movq %r15, %rcx
callq 0x3d9a
incl %ebp
addq $0x50, %r14
jmp 0x4f97
xorl %r15d, %r15d
movl %r15d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rafa9811[P]theIndiependenceGame/interface.c
// Function: interface_printPlayer
int interface_printPlayer(Interact *interact, Interface* interface){
  int px,py;
  Player*player;
  if(!interact||!interface) return -1;
  player=interact_getPlayer(interact);
  if(!player) return -1;
  px=player_get_px(player);
  py=player_get_py(player);
  if(px<0||py<0||px>XLIMIT||py>YLIMIT) return -1;
  win_write_char_at(interface->screen,py,px,PLAYER_CHAR);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x1
popq %rbp
orb %al, %cl
jne 0x503e
movq %rsi, %rbx
callq 0x42ba
testq %rax, %rax
je 0x503e
movq %rax, %r15
movq %rax, %rdi
xorl %eax, %eax
callq 0x3b81
movl %eax, %r14d
movq %r15, %rdi
xorl %eax, %eax
callq 0x3b8d
cmpl $0x51, %r14d
setae %cl
cmpl $0x25, %eax
setae %dl
orb %cl, %dl
jne 0x503e
movq (%rbx), %rdi
pushq $0x40
popq %rcx
movl %eax, %esi
movl %r14d, %edx
callq 0x3e8a
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq