// File: /workspace/github_c_makefile_star2_O2/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
orb %al, %dil
orb %cl, %dil
jne 0x2c01
movq %r8, %r14
movq (%r15), %rax
movl %edx, %ecx
movq (%rax,%rcx,8), %rdi
movswl %si, %eax
leaq 0x3569(%rip), %rcx      # 0x6114
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x3a13
cmpl $-0x1, %eax
je 0x2cf7
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3b68
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3a47
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3b81
pushq $0x24
popq %rdx
movq %rbx, %rdi
movl %eax, %esi
jmp 0x2ceb
pushq $-0x1
jmp 0x2cf4
callq 0x3a20
cmpl $-0x1, %eax
je 0x2cf7
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3b68
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3a47
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3b81
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
jmp 0x2ceb
callq 0x3a3a
cmpl $-0x1, %eax
je 0x2cf7
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3b68
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3a47
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3b8d
pushq $0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x3b5a
jmp 0x2cf9
callq 0x3a2d
cmpl $-0x1, %eax
je 0x2cf7
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x3b68
movq (%r15), %rax
movslq %ebp, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3a47
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3b8d
pushq $0x50
popq %rsi
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x3b5a
pushq $0x2
popq %rbp
jmp 0x2cf9
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq