// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movw %si, %ax
movq %rdi, -0x10(%rbp)
movw %ax, -0x12(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3877
movswl -0x12(%rbp), %eax
cmpl $0x0, %eax
jl 0x3877
movswl -0x12(%rbp), %eax
cmpl $0x3, %eax
jg 0x3877
cmpl $0x0, -0x18(%rbp)
jl 0x3877
cmpq $0x0, -0x20(%rbp)
jne 0x3883
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3ae8
movswl -0x12(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x3, %eax
ja 0x3ae1
movq -0x38(%rbp), %rax
leaq 0x586b(%rip), %rcx      # 0x910c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x54c0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x38d3
movl $0x0, -0x4(%rbp)
jmp 0x3ae8
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movb $0x0, %al
callq 0x58a0
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5580
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x1040
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movb $0x0, %al
callq 0x5910
movq -0x40(%rbp), %rdi
movl %eax, %esi
movl $0x24, %edx
movb $0x0, %al
callq 0x5860
movl $0x2, -0x4(%rbp)
jmp 0x3ae8
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5520
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x3963
movl $0x0, -0x4(%rbp)
jmp 0x3ae8
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movb $0x0, %al
callq 0x58a0
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5580
movq -0x58(%rbp), %rdi
movq %rax, %rsi
callq 0x1040
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movb $0x0, %al
callq 0x5940
movq -0x50(%rbp), %rdi
movl %eax, %edx
movl $0x50, %esi
movb $0x0, %al
callq 0x5860
movl $0x2, -0x4(%rbp)
jmp 0x3ae8
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x54f0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x39f3
movl $0x0, -0x4(%rbp)
jmp 0x3ae8
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movb $0x0, %al
callq 0x58a0
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5580
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x1040
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movb $0x0, %al
callq 0x5910
movq -0x60(%rbp), %rdi
movl %eax, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0x5860
movl $0x2, -0x4(%rbp)
jmp 0x3ae8
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5550
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x3a7d
movl $0x0, -0x4(%rbp)
jmp 0x3ae8
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movb $0x0, %al
callq 0x58a0
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5580
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x1040
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movb $0x0, %al
callq 0x5940
movq -0x70(%rbp), %rdi
movl %eax, %edx
movl $0x2, %esi
movb $0x0, %al
callq 0x5860
movl $0x2, -0x4(%rbp)
jmp 0x3ae8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)