// File: /workspace/github_c_makefile_star2_O1/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 0x2ecb
movswl %si, %eax
cmpl $0x3, %eax
ja 0x2ecb
movq %r8, %r14
leaq 0x33bf(%rip), %rcx      # 0x6114
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r15), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x3c80
cmpl $-0x1, %eax
je 0x2ec9
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3e39
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cbc
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e57
movq %rbx, %rdi
movl %eax, %esi
movl $0x24, %edx
jmp 0x2ebb
movq (%r15), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x3c8f
cmpl $-0x1, %eax
je 0x2ec9
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3e39
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cbc
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e57
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
jmp 0x2ebb
movq (%r15), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x3cad
cmpl $-0x1, %eax
je 0x2ec9
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3e39
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cbc
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e65
movl $0x2, %ebp
movq %rbx, %rdi
movl $0x2, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x3e28
jmp 0x2ecb
movq (%r15), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x3c9e
cmpl $-0x1, %eax
je 0x2ec9
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3e39
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3cbc
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3e65
movq %rbx, %rdi
movl $0x50, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x3e28
movl $0x2, %ebp
jmp 0x2ecb
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq