// File: /workspace/github_cpp_makefile_star2_O3/Leeingnyo[P]newPuyoC/main.cpp
// Function: main
int main() {
    srand(time(NULL));
    Console::ScreenClear();
    Console::HideCursor();
    if (Socket::StartUp()) {
        std::cout << "Winsock 초기화 실패" << std::endl;
        return -1;
    }
    
    bool app_alive = true;
    while (app_alive) {
        int choice;
        std::shared_ptr<Game> game;
        
        Console::ScreenClear();
        std::cout << Console::GotoXY(X(0), Y(0));
        std::cout << Console::white;
        std::cout << "선택해주세요" << std::endl;
        std::cout << "0. 게임설명" << std::endl;
        std::cout << "1. 혼자하기" << std::endl;
        std::cout << "2. 둘이하기(같은컴)" << std::endl;
        std::cout << "3. 둘이하기(멀티플레이)" << std::endl;
        std::cout << "4. 끝내기" << std::endl;
        
        choice = getch();
        switch(choice) {
            case '0': {
                help();
            }   continue;
            case '1': {
                game = std::make_shared<SingleGame>();
            }   break;
            case '2': {
                game = std::make_shared<VSGame>();
            }   break;
            case '3': {
                game = std::make_shared<VSRemoteGame>();
            }   break;
            case '4': {
                app_alive = false;
            }   continue;
            default: continue;
        }
        
        if (game->GameInit()) {
            game->GameLoop();
            game->GameResult();
        }
    }
    
    std::cout << Console::gray;
    Console::ShowCursor();
    Console::ScreenClear();
    Socket::CleanUp();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %edi, %edi
callq 0x3240
movl %eax, %edi
callq 0x3280
callq 0x3dd8
callq 0x3df5
callq 0x383c
movq 0x6f7f(%rip), %rbx      # 0x10fd0
testl %eax, %eax
je 0xa09a
leaq 0x2ad4(%rip), %rsi      # 0xcb30
movl $0x18, %edx
movq %rbx, %rdi
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xa3e3
leaq 0x2b17(%rip), %r13      # 0xcbb8
leaq 0x2a74(%rip), %r12      # 0xcb1c
leaq 0x68f9(%rip), %rax      # 0x109a8
addq $0x10, %rax
movq %rax, -0x40(%rbp)
leaq 0x6932(%rip), %rax      # 0x109f0
addq $0x10, %rax
movq %rax, -0x38(%rbp)
leaq 0x696b(%rip), %rax      # 0x10a38
addq $0x10, %rax
movq %rax, -0x30(%rbp)
callq 0x3dd8
movq $0x0, -0x48(%rbp)
movq %rbx, %rdi
leaq -0x48(%rbp), %rsi
callq 0x3e76
movq %rbx, %rdi
leaq 0x71cc(%rip), %rsi      # 0x112c4
callq 0x3e2f
movl $0x12, %edx
movq %rbx, %rdi
leaq 0x2a3d(%rip), %rsi      # 0xcb49
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movl $0xf, %edx
movq %rbx, %rdi
leaq 0x2a15(%rip), %rsi      # 0xcb5c
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movl $0xf, %edx
movq %rbx, %rdi
leaq 0x29ea(%rip), %rsi      # 0xcb6c
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movl $0x1a, %edx
movq %rbx, %rdi
leaq 0x29bf(%rip), %rsi      # 0xcb7c
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movl $0x20, %edx
movq %rbx, %rdi
leaq 0x299f(%rip), %rsi      # 0xcb97
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
movl $0xc, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3310
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
callq 0x3d57
addl $-0x30, %eax
cmpl $0x4, %eax
ja 0xa0d5
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
callq 0xa405
jmp 0xa0d5
movl $0xa0, %edi
callq 0x32a0
movq %rax, %r14
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r14)
leaq 0x6a57(%rip), %rax      # 0x10cf8
movq %rax, (%r14)
leaq 0x10(%r14), %r15
movq $0x0, 0x18(%r14)
movq -0x38(%rbp), %rax
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x50(%r14)
movups %xmm0, 0x60(%r14)
movups %xmm0, 0x70(%r14)
movups %xmm0, 0x80(%r14)
movups %xmm0, 0x90(%r14)
jmp 0xa397
movl $0xb8, %edi
callq 0x32a0
movq %rax, %r14
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r14)
leaq 0x6a38(%rip), %rax      # 0x10d48
movq %rax, (%r14)
leaq 0x10(%r14), %r15
leaq 0x18(%r14), %rdi
movl $0x88, %edx
xorl %esi, %esi
callq 0x3190
movq -0x30(%rbp), %rax
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%r14)
movq $0x0, 0xb0(%r14)
jmp 0xa397
movl $0x60, %edi
callq 0x32a0
movq %rax, %r14
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r14)
leaq 0x693f(%rip), %rax      # 0x10ca8
movq %rax, (%r14)
leaq 0x10(%r14), %r15
movq $0x0, 0x18(%r14)
movq -0x40(%rbp), %rax
movq %rax, 0x10(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x50(%r14)
movq %r15, %rdi
callq *(%rax)
testb %al, %al
je 0xa3b2
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movq %r14, %rdi
callq 0x7f4e
jmp 0xa0d5
movq 0x6c0a(%rip), %rdi      # 0x10fd0
leaq 0x6ed7(%rip), %rsi      # 0x112a4
callq 0x3e2f
callq 0x3e12
callq 0x3dd8
callq 0x3844
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x7f4e
movq %rbx, %rdi
callq 0x3480