// File: /workspace/github_c_makefile_star2_O3/rafa9811[P]theIndiependenceGame/background.c
// Function: bg_changeRoom
int bg_changeRoom(Player *c,short direction,int room,Map*map,char*desc){
    int newroom;
    if(!c || direction<0 || direction > 3 || room < 0 || !map) return -1;
    switch (direction){
        case(UP):{
            newroom = place_getUp(map->map[room]);
            if (newroom == -1) return B_NOTHING;
            player_set_room(c,newroom);
            strcpy(desc,place_getDesc(map->map[newroom]));
            player_move(c,player_get_px(c),YLIMIT);
            return B_SCREEN;
        }
        case(LEFT):{
            newroom = place_getLeft(map->map[room]);
            if (newroom == -1) return B_NOTHING;
            player_set_room(c,newroom);
            strcpy(desc,place_getDesc(map->map[newroom]));
            player_move(c,XLIMIT,player_get_py(c));
            return B_SCREEN;
        }
        case(DOWN):{
            newroom = place_getDown(map->map[room]);
            if (newroom == -1) return B_NOTHING;
            player_set_room(c,newroom);
            strcpy(desc,place_getDesc(map->map[newroom]));
            player_move(c,player_get_px(c),0);
            return B_SCREEN;
        }
        case(RIGHT):{
            newroom = place_getRight(map->map[room]);
            if (newroom == -1) return B_NOTHING;
            player_set_room(c,newroom);
            strcpy(desc,place_getDesc(map->map[newroom]));
            player_move(c,2,player_get_py(c));
            return B_SCREEN;
        }
        default: return -1;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdi, %rbx
testq %rdi, %rdi
sete %al
cmpw $0x4, %si
setae %cl
orb %al, %cl
testl %edx, %edx
sets %al
testq %r15, %r15
sete %dil
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
orb %al, %dil
orb %cl, %dil
jne 0x2eb4
movq %r8, %r14
movq (%r15), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
movswl %si, %eax
leaq 0x33b2(%rip), %rcx      # 0x6114
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x3c70
cmpl $-0x1, %eax
je 0x2eb2
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3de2
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cac
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3dfd
movq %rbx, %rdi
movl %eax, %esi
movl $0x24, %edx
jmp 0x2ea4
callq 0x3c7f
cmpl $-0x1, %eax
je 0x2eb2
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3de2
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cac
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3dfd
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
jmp 0x2ea4
callq 0x3c9d
cmpl $-0x1, %eax
je 0x2eb2
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3de2
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cac
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e0b
movl $0x2, %ebp
movq %rbx, %rdi
movl $0x2, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x3dd4
jmp 0x2eb4
callq 0x3c8e
cmpl $-0x1, %eax
je 0x2eb2
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3de2
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cac
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e0b
movq %rbx, %rdi
movl $0x50, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x3dd4
movl $0x2, %ebp
jmp 0x2eb4
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq