// File: 5hubh4m[P]snake-ncurses/snake_ncurses.cpp
// Function: classic_game()
int classic_game(void) {
	Classic_Snake S;
	int ch, d;
	initscr();
	keypad(stdscr, TRUE);
	noecho();
	timeout(TIMEOUT);
	curs_set(0);
	while(1) {
		ch=getch();
		if(ch=='q') {
			return S.getscore();
		}
		else if(ch==KEY_UP || ch==KEY_DOWN || ch==KEY_RIGHT || ch==KEY_LEFT) {
			switch(ch) {
				case KEY_UP:
					d=UP;
					break;
				case KEY_DOWN:
					d=DOWN;
					break;
				case KEY_RIGHT:
					d=RIGHT;
					break;
				case KEY_LEFT:
					d=LEFT;
					break;
			}
			if(diff(S.getfdir(), d)!=2 && d!=S.getfdir()) {
				S.createNode(d);
			}
		}
		S.movesnake();
		S.render();
		if(S.getcoll()) {
			timeout(TIMEOUT_LONG);
			getch();
			show_gameover(S.getscore());
			return S.getscore();
		}
		attron(A_STANDOUT);
		mvprintw(23, 25, "PRESS 'Q' to EXIT BACK TO MENU.");
		attroff(A_STANDOUT);
		refresh();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
leaq -0xd0(%rbp), %rdi
callq 0x2920
callq 0x2270
jmp 0x71ce
movq 0x5e03(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
movl $0x1, %esi
callq 0x20c0
jmp 0x71e4
callq 0x21d0
jmp 0x71eb
movq 0x5de6(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
movl $0x64, %esi
callq 0x21e0
jmp 0x7201
xorl %edi, %edi
callq 0x2130
jmp 0x720a
jmp 0x720c
jmp 0x720e
movq 0x5dc3(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
callq 0x20b0
movl %eax, -0xec(%rbp)
jmp 0x7225
movl -0xec(%rbp), %eax
movl %eax, -0xd4(%rbp)
cmpl $0x71, -0xd4(%rbp)
jne 0x7289
leaq -0xd0(%rbp), %rdi
callq 0x2e20
movl %eax, -0xf0(%rbp)
jmp 0x724e
movl -0xf0(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0xe8(%rbp)
jmp 0x74a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x7930
jmp 0x74bb
cmpl $0x103, -0xd4(%rbp)     # imm = 0x103
je 0x72bd
cmpl $0x102, -0xd4(%rbp)     # imm = 0x102
je 0x72bd
cmpl $0x105, -0xd4(%rbp)     # imm = 0x105
je 0x72bd
cmpl $0x104, -0xd4(%rbp)     # imm = 0x104
jne 0x739b
movl -0xd4(%rbp), %eax
addl $0xfffffefe, %eax       # imm = 0xFFFFFEFE
movl %eax, %ecx
movq %rcx, -0xf8(%rbp)
subl $0x3, %eax
ja 0x731b
movq -0xf8(%rbp), %rax
leaq 0xddc(%rip), %rcx       # 0x80c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0xd8(%rbp)
jmp 0x731b
movl $0x2, -0xd8(%rbp)
jmp 0x731b
movl $0x1, -0xd8(%rbp)
jmp 0x731b
movl $0x3, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x28e0
movl %eax, -0xfc(%rbp)
jmp 0x732f
movl -0xfc(%rbp), %edi
movl -0xd8(%rbp), %esi
callq 0x74d0
movl %eax, -0x100(%rbp)
jmp 0x7348
movl -0x100(%rbp), %eax
cmpl $0x2, %eax
je 0x7399
movl -0xd8(%rbp), %eax
movl %eax, -0x108(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x28e0
movl %eax, -0x104(%rbp)
jmp 0x7373
movl -0x108(%rbp), %eax
movl -0x104(%rbp), %ecx
cmpl %ecx, %eax
je 0x7399
movl -0xd8(%rbp), %esi
leaq -0xd0(%rbp), %rdi
callq 0x2670
jmp 0x7397
jmp 0x7399
jmp 0x739b
jmp 0x739d
leaq -0xd0(%rbp), %rdi
callq 0x2a40
jmp 0x73ab
leaq -0xd0(%rbp), %rdi
callq 0x2cf0
jmp 0x73b9
leaq -0xd0(%rbp), %rdi
callq 0x2e00
movl %eax, -0x10c(%rbp)
jmp 0x73cd
movl -0x10c(%rbp), %eax
cmpl $0x0, %eax
je 0x7449
movq 0x5bf9(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x21e0
jmp 0x73ee
movq 0x5be3(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
callq 0x20b0
jmp 0x73ff
leaq -0xd0(%rbp), %rdi
callq 0x2e20
movl %eax, -0x110(%rbp)
jmp 0x7413
movl -0x110(%rbp), %edi
callq 0x6fa0
jmp 0x7420
leaq -0xd0(%rbp), %rdi
callq 0x2e20
movl %eax, -0x114(%rbp)
jmp 0x7434
movl -0x114(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0xe8(%rbp)
jmp 0x74a3
movq 0x5b88(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x10000, %esi          # imm = 0x10000
callq 0x20e0
jmp 0x7463
leaq 0xc23(%rip), %rdx       # 0x808d
xorl %eax, %eax
movl $0x17, %edi
movl $0x19, %esi
callq 0x2220
jmp 0x747d
movq 0x5b54(%rip), %rax      # 0xcfd8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x10000, %esi          # imm = 0x10000
callq 0x2210
jmp 0x7497
callq 0x22d0
jmp 0x749e
jmp 0x720c
leaq -0xd0(%rbp), %rdi
callq 0x7930
movl -0x4(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0xe0(%rbp), %rdi
callq 0x22e0
nopw (%rax,%rax)