// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3b30
cmpq $0x0, -0x18(%rbp)
je 0x3b30
cmpq $0x0, -0x20(%rbp)
jne 0x3b3c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3d83
movq -0x20(%rbp), %rdi
callq 0x58e0
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl $0xa, -0x30(%rbp)
movb %al, -0x3b(%rbp)
jge 0x3b71
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
movb %al, -0x3b(%rbp)
movb -0x3b(%rbp), %al
testb $0x1, %al
jne 0x3b7d
jmp 0x3d7c
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4dd0
movw %ax, -0x36(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4cb0
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4ce0
movl %eax, -0x2c(%rbp)
movswl -0x36(%rbp), %eax
cmpl $0x1, %eax
jne 0x3d6e
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4d10
movw %ax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4d50
movw %ax, -0x3a(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c40
movl %eax, -0x34(%rbp)
movswl -0x3a(%rbp), %eax
cmpl $0x1, %eax
jne 0x3c74
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
movl $0x58, %ecx
callq 0x56f0
jmp 0x3d6c
movswl -0x38(%rbp), %eax
cmpl $0x1, %eax
jne 0x3ca1
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
movl $0x40, %ecx
callq 0x56f0
jmp 0x3d6a
movl -0x34(%rbp), %eax
movl %eax, -0x40(%rbp)
testl %eax, %eax
je 0x3cc4
jmp 0x3cad
movl -0x40(%rbp), %eax
subl $0x1, %eax
je 0x3d07
jmp 0x3cb7
movl -0x40(%rbp), %eax
subl $0x2, %eax
je 0x3d28
jmp 0x3d49
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4d90
cwtl
cmpl $0x0, %eax
je 0x3d05
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
movl $0x4f, %ecx
callq 0x56f0
jmp 0x3d68
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
movl $0x2a, %ecx
callq 0x56f0
jmp 0x3d68
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
movl $0x58, %ecx
callq 0x56f0
jmp 0x3d68
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
movl $0x2a, %ecx
callq 0x56f0
jmp 0x3d6a
jmp 0x3d6c
jmp 0x3d6e
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3b48
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)