// File: Teris45[P]Maze-Game/main.cpp
// Function: main
int main(int argc, char *argv[]) {
    initscr();
    cbreak();
    keypad(stdscr, TRUE);
    clear();

    char name[10];
    addstr("Enter Player's name: ");

    getstr(name);



    noecho();

    if(argc<3)
        throw "NOT ENOUGH ARGUMENTS";

    auto* engine = new Engine(argv[1],argv[2],name);
    engine->printMaze();
    refresh();
    sleep(1);

    while(!engine->getGameEnded()){
        engine->gameLoop();
    }

    engine->updateHG(argv[2]);
//    engine->makeMove();

//    refresh();
    //    engine->printMaze();

//    sleep(2);

    delete engine;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x3360
callq 0x30b0
movq 0x108c6(%rip), %rax     # 0x13fd0
movq (%rax), %rdi
movl $0x1, %esi
callq 0x30f0
callq 0x3420
movq 0x108ad(%rip), %rax     # 0x13fd0
movq (%rax), %rdi
leaq 0xa8d7(%rip), %rsi      # 0xe004
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x30c0
movq 0x10892(%rip), %rax     # 0x13fd0
movq (%rax), %rdi
leaq -0x1a(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3370
callq 0x32a0
cmpl $0x3, -0x8(%rbp)
jge 0x3781
movl $0x8, %edi
callq 0x3120
movq %rax, %rdi
leaq 0xa8ac(%rip), %rax      # 0xe01a
movq %rax, (%rdi)
movq 0x10848(%rip), %rsi     # 0x13fc0
xorl %eax, %eax
movl %eax, %edx
callq 0x3400
movl $0x1a0, %edi            # imm = 0x1A0
callq 0x3240
movq %rax, -0xc8(%rbp)
movb $0x1, -0x82(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc0(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x3440
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x3310
jmp 0x37d1
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xd8(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x3440
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x3310
jmp 0x380c
movq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x80(%rbp), %rdx
leaq -0x1a(%rbp), %rcx
callq 0x3e40
jmp 0x3826
movb $0x0, -0x82(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3160
leaq -0x81(%rbp), %rdi
callq 0x3290
leaq -0x48(%rbp), %rdi
callq 0x3160
leaq -0x49(%rbp), %rdi
callq 0x3290
movq -0xc8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4b30
callq 0x33f0
movl $0x1, %edi
callq 0x31a0
movq -0x28(%rbp), %rdi
callq 0x55f0
xorb $-0x1, %al
testb $0x1, %al
jne 0x3888
jmp 0x3903
movq -0x28(%rbp), %rdi
callq 0x4e40
jmp 0x3877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x38d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x38c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3160
leaq -0x81(%rbp), %rdi
callq 0x3290
leaq -0x48(%rbp), %rdi
callq 0x3160
leaq -0x49(%rbp), %rdi
callq 0x3290
testb $0x1, -0x82(%rbp)
jne 0x38ed
jmp 0x38fe
movq -0xc8(%rbp), %rdi
movl $0x1a0, %esi            # imm = 0x1A0
callq 0x3250
jmp 0x39e4
movq -0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xe8(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x3440
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x3310
jmp 0x394c
movq -0xf0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x5720
jmp 0x3961
leaq -0xa8(%rbp), %rdi
callq 0x3160
leaq -0xa9(%rbp), %rdi
callq 0x3290
movq -0x28(%rbp), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, %rax
je 0x39a7
movq -0xf8(%rbp), %rdi
callq 0x4d70
movq -0xf8(%rbp), %rdi
movl $0x1a0, %esi            # imm = 0x1A0
callq 0x3250
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x39d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x3160
leaq -0xa9(%rbp), %rdi
callq 0x3290
movq -0x58(%rbp), %rdi
callq 0x3430
nopl (%rax)