745 lines
13 KiB
ArmAsm
745 lines
13 KiB
ArmAsm
.file "cnibbles.c"
|
|
.local p_screen
|
|
.comm p_screen,8,8
|
|
.text
|
|
.globl nib_poll_kbd
|
|
.type nib_poll_kbd, @function
|
|
nib_poll_kbd:
|
|
.LFB0:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $16, %rsp
|
|
movq stdscr@GOTPCREL(%rip), %rax
|
|
movq (%rax), %rax
|
|
movq %rax, %rdi
|
|
call wgetch@PLT
|
|
movl %eax, -4(%rbp)
|
|
movl -4(%rbp), %eax
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE0:
|
|
.size nib_poll_kbd, .-nib_poll_kbd
|
|
.section .rodata
|
|
.LC0:
|
|
.string "%c"
|
|
.text
|
|
.globl nib_put_scr
|
|
.type nib_put_scr, @function
|
|
nib_put_scr:
|
|
.LFB1:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $16, %rsp
|
|
movl %edi, -4(%rbp)
|
|
movl %esi, -8(%rbp)
|
|
movl %edx, -12(%rbp)
|
|
movl -12(%rbp), %edx
|
|
movl -4(%rbp), %esi
|
|
movl -8(%rbp), %eax
|
|
movl %edx, %ecx
|
|
leaq .LC0(%rip), %rdx
|
|
movl %eax, %edi
|
|
movl $0, %eax
|
|
call mvprintw@PLT
|
|
movq p_screen(%rip), %rax
|
|
movq %rax, %rdi
|
|
call wrefresh@PLT
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE1:
|
|
.size nib_put_scr, .-nib_put_scr
|
|
.globl nib_init
|
|
.type nib_init, @function
|
|
nib_init:
|
|
.LFB2:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
movl $0, %edi
|
|
call time@PLT
|
|
movl %eax, %edi
|
|
call srand@PLT
|
|
call initscr@PLT
|
|
movq %rax, p_screen(%rip)
|
|
call start_color@PLT
|
|
movl $0, %edi
|
|
call curs_set@PLT
|
|
call noecho@PLT
|
|
movq p_screen(%rip), %rax
|
|
movl $1, %esi
|
|
movq %rax, %rdi
|
|
call keypad@PLT
|
|
movq p_screen(%rip), %rax
|
|
movl $1, %esi
|
|
movq %rax, %rdi
|
|
call nodelay@PLT
|
|
popq %rbp
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE2:
|
|
.size nib_init, .-nib_init
|
|
.globl nib_end
|
|
.type nib_end, @function
|
|
nib_end:
|
|
.LFB3:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
call endwin@PLT
|
|
movl $0, %edi
|
|
call exit@PLT
|
|
.cfi_endproc
|
|
.LFE3:
|
|
.size nib_end, .-nib_end
|
|
.globl startLength
|
|
.bss
|
|
.align 4
|
|
.type startLength, @object
|
|
.size startLength, 4
|
|
startLength:
|
|
.zero 4
|
|
.globl startApples
|
|
.align 4
|
|
.type startApples, @object
|
|
.size startApples, 4
|
|
startApples:
|
|
.zero 4
|
|
.comm currentTick,4,4
|
|
.comm snake,9600,64
|
|
.comm snakeLength,4,4
|
|
.comm snakeX,4,4
|
|
.comm snakeY,4,4
|
|
.comm snakeDirX,4,4
|
|
.comm snakeDirY,4,4
|
|
.comm numApples,4,4
|
|
.text
|
|
.globl start_game
|
|
.type start_game, @function
|
|
start_game:
|
|
.LFB4:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $48, %rsp
|
|
movl %edi, -36(%rbp)
|
|
movl %esi, -40(%rbp)
|
|
movl startLength(%rip), %eax
|
|
testl %eax, %eax
|
|
jne .L7
|
|
movl -36(%rbp), %eax
|
|
movl %eax, startLength(%rip)
|
|
.L7:
|
|
movl startApples(%rip), %eax
|
|
testl %eax, %eax
|
|
jne .L8
|
|
movl -40(%rbp), %eax
|
|
movl %eax, startApples(%rip)
|
|
.L8:
|
|
movq currentTick@GOTPCREL(%rip), %rax
|
|
movl $0, (%rax)
|
|
movl -36(%rbp), %edx
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl %edx, (%rax)
|
|
movl -40(%rbp), %edx
|
|
movq numApples@GOTPCREL(%rip), %rax
|
|
movl %edx, (%rax)
|
|
call nib_init
|
|
movl $0, -20(%rbp)
|
|
jmp .L9
|
|
.L10:
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
movl %eax, %ecx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl -20(%rbp), %edx
|
|
movl %ecx, (%rax,%rdx,4)
|
|
addl $1, -20(%rbp)
|
|
.L9:
|
|
cmpl $2399, -20(%rbp)
|
|
jbe .L10
|
|
movq snakeX@GOTPCREL(%rip), %rax
|
|
movl $30, (%rax)
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl $20, (%rax)
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl $0, (%rax)
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl $-1, (%rax)
|
|
movl $0, -16(%rbp)
|
|
jmp .L11
|
|
.L12:
|
|
movq snakeX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %ecx
|
|
movl $-2004318071, %edx
|
|
movl %ecx, %eax
|
|
mull %edx
|
|
movl %edx, %eax
|
|
shrl $5, %eax
|
|
movl %eax, -8(%rbp)
|
|
movl -8(%rbp), %eax
|
|
movl %eax, %edx
|
|
leal 0(,%rdx,4), %eax
|
|
movl %eax, %edx
|
|
movl %edx, %eax
|
|
sall $4, %eax
|
|
subl %edx, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %eax
|
|
movl %eax, -8(%rbp)
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %edx
|
|
movl -16(%rbp), %eax
|
|
leal (%rdx,%rax), %ecx
|
|
movl $-858993459, %edx
|
|
movl %ecx, %eax
|
|
mull %edx
|
|
movl %edx, %eax
|
|
shrl $5, %eax
|
|
movl %eax, -4(%rbp)
|
|
movl -4(%rbp), %edx
|
|
movl %edx, %eax
|
|
sall $2, %eax
|
|
addl %edx, %eax
|
|
sall $3, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %eax
|
|
movl %eax, -4(%rbp)
|
|
movl -4(%rbp), %eax
|
|
sall $2, %eax
|
|
movl %eax, %edx
|
|
sall $4, %edx
|
|
subl %eax, %edx
|
|
movl -8(%rbp), %eax
|
|
leal (%rdx,%rax), %ecx
|
|
movl -16(%rbp), %edx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl %ecx, %ecx
|
|
movl %edx, (%rax,%rcx,4)
|
|
addl $1, -16(%rbp)
|
|
.L11:
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, -16(%rbp)
|
|
jb .L12
|
|
movl $0, %edi
|
|
call time@PLT
|
|
movl %eax, %edi
|
|
call srand@PLT
|
|
movl $0, -12(%rbp)
|
|
jmp .L13
|
|
.L14:
|
|
movl $0, %eax
|
|
call spawnApple
|
|
addl $1, -12(%rbp)
|
|
.L13:
|
|
movq numApples@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, -12(%rbp)
|
|
jb .L14
|
|
.L15:
|
|
movl $0, %eax
|
|
call tick
|
|
movl $0, %eax
|
|
call draw
|
|
jmp .L15
|
|
.cfi_endproc
|
|
.LFE4:
|
|
.size start_game, .-start_game
|
|
.globl spawnApple
|
|
.type spawnApple, @function
|
|
spawnApple:
|
|
.LFB5:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $16, %rsp
|
|
call rand@PLT
|
|
movl %eax, %ecx
|
|
movl $-2004318071, %edx
|
|
movl %ecx, %eax
|
|
imull %edx
|
|
leal (%rdx,%rcx), %eax
|
|
sarl $5, %eax
|
|
movl %eax, %edx
|
|
movl %ecx, %eax
|
|
sarl $31, %eax
|
|
subl %eax, %edx
|
|
movl %edx, %eax
|
|
movl %eax, %edx
|
|
leal 0(,%rdx,4), %eax
|
|
movl %eax, %edx
|
|
movl %edx, %eax
|
|
sall $4, %eax
|
|
subl %edx, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %eax
|
|
movl %eax, -8(%rbp)
|
|
call rand@PLT
|
|
movl %eax, %ecx
|
|
movl $1717986919, %edx
|
|
movl %ecx, %eax
|
|
imull %edx
|
|
sarl $4, %edx
|
|
movl %ecx, %eax
|
|
sarl $31, %eax
|
|
subl %eax, %edx
|
|
movl %edx, %eax
|
|
sall $2, %eax
|
|
addl %edx, %eax
|
|
sall $3, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %edx
|
|
movl %edx, -4(%rbp)
|
|
jmp .L17
|
|
.L18:
|
|
call rand@PLT
|
|
movl %eax, %ecx
|
|
movl $-2004318071, %edx
|
|
movl %ecx, %eax
|
|
imull %edx
|
|
leal (%rdx,%rcx), %eax
|
|
sarl $5, %eax
|
|
movl %eax, %edx
|
|
movl %ecx, %eax
|
|
sarl $31, %eax
|
|
subl %eax, %edx
|
|
movl %edx, %eax
|
|
movl %eax, %edx
|
|
leal 0(,%rdx,4), %eax
|
|
movl %eax, %edx
|
|
movl %edx, %eax
|
|
sall $4, %eax
|
|
subl %edx, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %eax
|
|
movl %eax, -8(%rbp)
|
|
call rand@PLT
|
|
movl %eax, %ecx
|
|
movl $1717986919, %edx
|
|
movl %ecx, %eax
|
|
imull %edx
|
|
sarl $4, %edx
|
|
movl %ecx, %eax
|
|
sarl $31, %eax
|
|
subl %eax, %edx
|
|
movl %edx, %eax
|
|
sall $2, %eax
|
|
addl %edx, %eax
|
|
sall $3, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %edx
|
|
movl %edx, -4(%rbp)
|
|
.L17:
|
|
movl -4(%rbp), %eax
|
|
sall $2, %eax
|
|
movl %eax, %edx
|
|
sall $4, %edx
|
|
subl %eax, %edx
|
|
movl -8(%rbp), %eax
|
|
addl %eax, %edx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl %edx, %edx
|
|
movl (%rax,%rdx,4), %eax
|
|
movl %eax, %edx
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, %edx
|
|
jb .L18
|
|
movl -4(%rbp), %eax
|
|
sall $2, %eax
|
|
movl %eax, %edx
|
|
sall $4, %edx
|
|
subl %eax, %edx
|
|
movl -8(%rbp), %eax
|
|
addl %eax, %edx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl %edx, %edx
|
|
movl $-1, (%rax,%rdx,4)
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE5:
|
|
.size spawnApple, .-spawnApple
|
|
.globl tick
|
|
.type tick, @function
|
|
tick:
|
|
.LFB6:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $16, %rsp
|
|
movq currentTick@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
leal 1(%rax), %edx
|
|
movq currentTick@GOTPCREL(%rip), %rax
|
|
movl %edx, (%rax)
|
|
movl $0, -16(%rbp)
|
|
jmp .L20
|
|
.L22:
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl -16(%rbp), %edx
|
|
movl (%rax,%rdx,4), %eax
|
|
movl %eax, -12(%rbp)
|
|
cmpl $0, -12(%rbp)
|
|
js .L21
|
|
cmpl $0, -12(%rbp)
|
|
js .L21
|
|
movl -12(%rbp), %edx
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, %edx
|
|
ja .L21
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl -16(%rbp), %edx
|
|
movl (%rax,%rdx,4), %eax
|
|
leal 1(%rax), %ecx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl -16(%rbp), %edx
|
|
movl %ecx, (%rax,%rdx,4)
|
|
.L21:
|
|
addl $1, -16(%rbp)
|
|
.L20:
|
|
cmpl $2399, -16(%rbp)
|
|
jbe .L22
|
|
call nib_poll_kbd
|
|
movl %eax, -8(%rbp)
|
|
cmpl $119, -8(%rbp)
|
|
jne .L23
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl $1, %eax
|
|
je .L23
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl $0, (%rax)
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl $-1, (%rax)
|
|
.L23:
|
|
cmpl $115, -8(%rbp)
|
|
jne .L24
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl $-1, %eax
|
|
je .L24
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl $0, (%rax)
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl $1, (%rax)
|
|
.L24:
|
|
cmpl $97, -8(%rbp)
|
|
jne .L25
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl $1, %eax
|
|
je .L25
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl $-1, (%rax)
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl $0, (%rax)
|
|
.L25:
|
|
cmpl $100, -8(%rbp)
|
|
jne .L26
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl $-1, %eax
|
|
je .L26
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl $1, (%rax)
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl $0, (%rax)
|
|
.L26:
|
|
movq snakeX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %edx
|
|
movq snakeDirX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
addl %edx, %eax
|
|
leal 60(%rax), %ecx
|
|
movl $-2004318071, %edx
|
|
movl %ecx, %eax
|
|
mull %edx
|
|
movl %edx, %eax
|
|
shrl $5, %eax
|
|
movl %eax, %edx
|
|
leal 0(,%rdx,4), %eax
|
|
movl %eax, %edx
|
|
movl %edx, %eax
|
|
sall $4, %eax
|
|
subl %edx, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %eax
|
|
movq snakeX@GOTPCREL(%rip), %rdx
|
|
movl %eax, (%rdx)
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %edx
|
|
movq snakeDirY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
addl %edx, %eax
|
|
leal 40(%rax), %ecx
|
|
movl $-858993459, %edx
|
|
movl %ecx, %eax
|
|
mull %edx
|
|
shrl $5, %edx
|
|
movl %edx, %eax
|
|
sall $2, %eax
|
|
addl %edx, %eax
|
|
sall $3, %eax
|
|
subl %eax, %ecx
|
|
movl %ecx, %edx
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl %edx, (%rax)
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
sall $2, %eax
|
|
movl %eax, %edx
|
|
sall $4, %edx
|
|
subl %eax, %edx
|
|
movq snakeX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
addl %eax, %edx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl %edx, %edx
|
|
movl (%rax,%rdx,4), %eax
|
|
movl %eax, -4(%rbp)
|
|
movl -4(%rbp), %edx
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, %edx
|
|
jae .L27
|
|
cmpl $0, -4(%rbp)
|
|
js .L27
|
|
movl startApples(%rip), %eax
|
|
movl %eax, %edx
|
|
movl startLength(%rip), %eax
|
|
movl %edx, %esi
|
|
movl %eax, %edi
|
|
call start_game
|
|
.L27:
|
|
cmpl $0, -4(%rbp)
|
|
jns .L28
|
|
movl $0, %eax
|
|
call spawnApple
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
leal 1(%rax), %edx
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl %edx, (%rax)
|
|
.L28:
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
sall $2, %eax
|
|
movl %eax, %edx
|
|
sall $4, %edx
|
|
subl %eax, %edx
|
|
movq snakeX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
addl %eax, %edx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movl %edx, %edx
|
|
movl $0, (%rax,%rdx,4)
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE6:
|
|
.size tick, .-tick
|
|
.globl draw
|
|
.type draw, @function
|
|
draw:
|
|
.LFB7:
|
|
.cfi_startproc
|
|
pushq %rbp
|
|
.cfi_def_cfa_offset 16
|
|
.cfi_offset 6, -16
|
|
movq %rsp, %rbp
|
|
.cfi_def_cfa_register 6
|
|
subq $64, %rsp
|
|
movq %fs:40, %rax
|
|
movq %rax, -8(%rbp)
|
|
xorl %eax, %eax
|
|
movabsq $23438616898455886, %rax
|
|
movq %rax, -16(%rbp)
|
|
movl $-1, -52(%rbp)
|
|
jmp .L30
|
|
.L43:
|
|
movl $-1, -48(%rbp)
|
|
jmp .L31
|
|
.L42:
|
|
cmpl $-1, -48(%rbp)
|
|
je .L32
|
|
cmpl $-1, -52(%rbp)
|
|
je .L32
|
|
cmpl $60, -48(%rbp)
|
|
je .L32
|
|
cmpl $40, -52(%rbp)
|
|
jne .L33
|
|
.L32:
|
|
cmpl $-1, -48(%rbp)
|
|
je .L34
|
|
cmpl $-1, -52(%rbp)
|
|
jne .L35
|
|
.L34:
|
|
movl -48(%rbp), %eax
|
|
addl $1, %eax
|
|
movl %eax, -24(%rbp)
|
|
movl -52(%rbp), %eax
|
|
addl $1, %eax
|
|
movl %eax, -20(%rbp)
|
|
movl -20(%rbp), %ecx
|
|
movl -24(%rbp), %eax
|
|
movl $35, %edx
|
|
movl %ecx, %esi
|
|
movl %eax, %edi
|
|
call nib_put_scr
|
|
nop
|
|
jmp .L37
|
|
.L35:
|
|
movl -48(%rbp), %eax
|
|
addl $1, %eax
|
|
movl %eax, -32(%rbp)
|
|
movl -52(%rbp), %eax
|
|
addl $1, %eax
|
|
movl %eax, -28(%rbp)
|
|
movl -28(%rbp), %ecx
|
|
movl -32(%rbp), %eax
|
|
movl $35, %edx
|
|
movl %ecx, %esi
|
|
movl %eax, %edi
|
|
call nib_put_scr
|
|
jmp .L37
|
|
.L33:
|
|
movl -52(%rbp), %eax
|
|
sall $2, %eax
|
|
movl %eax, %edx
|
|
sall $4, %edx
|
|
subl %eax, %edx
|
|
movl -48(%rbp), %eax
|
|
addl %eax, %edx
|
|
movq snake@GOTPCREL(%rip), %rax
|
|
movslq %edx, %rdx
|
|
movl (%rax,%rdx,4), %eax
|
|
movl %eax, -44(%rbp)
|
|
movl -48(%rbp), %eax
|
|
addl $1, %eax
|
|
movl %eax, -40(%rbp)
|
|
movl -52(%rbp), %eax
|
|
addl $1, %eax
|
|
movl %eax, -36(%rbp)
|
|
cmpl $0, -44(%rbp)
|
|
js .L38
|
|
movl -44(%rbp), %edx
|
|
movq snakeLength@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, %edx
|
|
jae .L38
|
|
movl -48(%rbp), %edx
|
|
movq snakeX@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, %edx
|
|
jne .L39
|
|
movl -52(%rbp), %edx
|
|
movq snakeY@GOTPCREL(%rip), %rax
|
|
movl (%rax), %eax
|
|
cmpl %eax, %edx
|
|
jne .L39
|
|
movl -36(%rbp), %ecx
|
|
movl -40(%rbp), %eax
|
|
movl $64, %edx
|
|
movl %ecx, %esi
|
|
movl %eax, %edi
|
|
call nib_put_scr
|
|
jmp .L37
|
|
.L39:
|
|
movl -44(%rbp), %eax
|
|
leal -1(%rax), %ecx
|
|
movl $-1840700269, %edx
|
|
movl %ecx, %eax
|
|
imull %edx
|
|
leal (%rdx,%rcx), %eax
|
|
sarl $2, %eax
|
|
movl %eax, %edx
|
|
movl %ecx, %eax
|
|
sarl $31, %eax
|
|
subl %eax, %edx
|
|
movl %edx, %eax
|
|
movl %eax, %edx
|
|
sall $3, %edx
|
|
subl %eax, %edx
|
|
movl %ecx, %eax
|
|
subl %edx, %eax
|
|
cltq
|
|
movzbl -16(%rbp,%rax), %eax
|
|
movsbl %al, %edx
|
|
movl -36(%rbp), %ecx
|
|
movl -40(%rbp), %eax
|
|
movl %ecx, %esi
|
|
movl %eax, %edi
|
|
call nib_put_scr
|
|
jmp .L37
|
|
.L38:
|
|
cmpl $0, -44(%rbp)
|
|
jns .L41
|
|
movl -36(%rbp), %ecx
|
|
movl -40(%rbp), %eax
|
|
movl $111, %edx
|
|
movl %ecx, %esi
|
|
movl %eax, %edi
|
|
call nib_put_scr
|
|
jmp .L37
|
|
.L41:
|
|
movl -36(%rbp), %ecx
|
|
movl -40(%rbp), %eax
|
|
movl $32, %edx
|
|
movl %ecx, %esi
|
|
movl %eax, %edi
|
|
call nib_put_scr
|
|
.L37:
|
|
addl $1, -48(%rbp)
|
|
.L31:
|
|
cmpl $60, -48(%rbp)
|
|
jle .L42
|
|
addl $1, -52(%rbp)
|
|
.L30:
|
|
cmpl $40, -52(%rbp)
|
|
jle .L43
|
|
movq -8(%rbp), %rax
|
|
xorq %fs:40, %rax
|
|
je .L44
|
|
call __stack_chk_fail@PLT
|
|
.L44:
|
|
leave
|
|
.cfi_def_cfa 7, 8
|
|
ret
|
|
.cfi_endproc
|
|
.LFE7:
|
|
.size draw, .-draw
|
|
.ident "GCC: (GNU) 4.9.2"
|
|
.section .note.GNU-stack,"",@progbits
|