// File: /workspace/github_cpp_makefile_star2_O3/niekh1234[P]nnchesslib/board.cpp
// Function: nnchesslib::ChessBoard::isValidFen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool ChessBoard::isValidFen(std::string fen)
{
    // Setup variables
    std::istringstream iss(fen);
    std::string board, sideToMove, castleRights, enpassant, movecount, plycount;

    // check if fen is provided
    if(!iss) return false;

    iss >> board;

    if(!iss) return false;

    iss >> sideToMove;

    if (!iss) 
    {
        castleRights = "-";
        enpassant = "-";
    } 
    else 
    {
        iss >> castleRights;
        if (iss)
            iss >> enpassant;
        else
            enpassant = "-";
    }
    
    iss >> movecount;

    iss >> plycount;

    boardinfo.plyCount = stoi(plycount);
    boardinfo.fiftyMoveRule = stoi(movecount);

    // Let's check that all components of the supposed FEN are OK.
    // Check side to move
    if (sideToMove != "w" && sideToMove != "b") return false;
    
    // Check castling rights
    if (castleRights != "-" && castleRights != "K" && castleRights != "Kk"
        && castleRights != "Kkq" && castleRights != "Kq" && castleRights !="KQ"
        && castleRights != "KQk" && castleRights != "KQq" && castleRights != "KQkq"
        && castleRights != "k" && castleRights != "q" && castleRights != "kq"
        && castleRights != "Q" && castleRights != "Qk" && castleRights != "Qq"
        && castleRights != "Qkq")
        return false;

    // Check valid en passant
    if (enpassant != "-") {
        if (enpassant.length() != 2) return false;
        if (!(enpassant[0] >= 'a' && enpassant[0] <= 'h')) return false;
        if (!((sideToMove == "w" && enpassant[1] == '6') || (sideToMove == "b" && enpassant[1] == '3')))
            return false;
    }

    // Check valid board
    // Seven board dividers
    if (std::count(board.begin(), board.end(), '/') != 7) return false;

    // Board contains only legal characters
    for (int i = 0; i < board.length(); i++)
        if (!(board[i] == '/' || (board[i] >= '1' && board[i] <= '8')
                || board[i] == 'p' || board[i] == 'P' || board[i] == 'r' || board[i] == 'R' || 
                board[i] == 'k' || board[i] == 'K' || board[i] == 'n' || board[i] == 'N' || board[i] == 'b' || board[i] == 'B'
                || board[i] == 'q' || board[i] == 'Q'))
            return false;
    
    // Check king amount
    if (std::count(board.begin(), board.end(), 'K') != 1) return false;
    if (std::count(board.begin(), board.end(), 'k') != 1) return false;

    // Count other piece amounts
    size_t wp = std::count(board.begin(), board.end(), 'P'),
        bp = std::count(board.begin(), board.end(), 'p'),
        wn = std::count(board.begin(), board.end(), 'N'),
        bn = std::count(board.begin(), board.end(), 'n'),
        wb = std::count(board.begin(), board.end(), 'B'),
        bb = std::count(board.begin(), board.end(), 'b'),
        wr = std::count(board.begin(), board.end(), 'R'),
        br = std::count(board.begin(), board.end(), 'r'),
        wq = std::count(board.begin(), board.end(), 'Q'),
        bq = std::count(board.begin(), board.end(), 'q');

    // Check if piece count is valid
    if (wp > 8 || bp > 8 || wn > 10 || bn > 10 || wb > 10 || bb > 10
        || wr > 10 || br > 10 || wq > 9 || bq > 9
        || wp + wn + wb + wr + wq > 15 || bp + bn + bb + br + bq > 15)
        return false;

    // setting some variables now that all the checks have been passed:
    // put this in dedicated function in the future.

    // changing who's turn it is.
    if(sideToMove == "w") boardinfo.whiteToMove = true;
    else boardinfo.whiteToMove = false;

    // setting the castling rights bools
    for (auto c : castleRights)
    {
        switch(c)
        {
            case 'K':
                boardinfo.whiteCastleShort = true;
                break;
            case 'Q':
                boardinfo.whiteCastleLong = true;
                break;
            case 'k':
                boardinfo.blackCastleShort = true;
                break;
            case 'q':
                boardinfo.blackCastleLong = true;
                break;
        }
    }

    // setting en passant bitboard.
    if(enpassant != "-")
    {
        if(boardinfo.whiteToMove)  boardinfo.whiteEnPassantTarget.set(getSquareInt(enpassant), true);
        if(!boardinfo.whiteToMove) boardinfo.blackEnPassantTarget.set(getSquareInt(enpassant), true);
    }
    // All checks passed
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, -0x30(%rbp)
leaq -0x2c0(%rbp), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x2250
leaq -0x80(%rbp), %r13
movq %r13, -0x10(%r13)
xorl %r14d, %r14d
movq %r14, -0x8(%r13)
movb %r14b, (%r13)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq -0xc8(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq -0x130(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq %r14, -0x8(%rbx)
movb %r14b, (%rbx)
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2a0(%rbp,%rax)
jne 0x3f9f
leaq -0x2c0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x21b0
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2a0(%rbp,%rax)
je 0x407c
xorl %r14d, %r14d
movq -0x140(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3fba
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x3fdc
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3ff5
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x400e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x4030
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0x4048
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2150
movq 0x8f81(%rip), %rsi      # 0xcfd0
leaq -0x2c0(%rbp), %rdi
callq 0x21d0
leaq -0x248(%rbp), %rdi
callq 0x2070
movl %r14d, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x2c0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x21b0
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2a0(%rbp,%rax)
je 0x40c2
leaq -0x50(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x5553(%rip), %rcx      # 0x9606
movl $0x1, %r8d
xorl %esi, %esi
callq 0x2210
jmp 0x40eb
leaq -0x2c0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x21b0
movq -0x2c0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2a0(%rbp,%rax)
je 0x47f4
leaq -0x70(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x550c(%rip), %rcx      # 0x9606
movl $0x1, %r8d
xorl %esi, %esi
callq 0x2210
leaq -0x2c0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x21b0
leaq -0x2c0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x21b0
movq -0x140(%rbp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq -0xe0(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21c0
cmpq %r15, (%r12)
je 0x4809
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x4815
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x4815
testl %ecx, %ecx
jne 0x4185
movl %r13d, (%r14)
movq -0x30(%rbp), %rcx
movl %eax, 0x4c(%rcx)
movq -0xd8(%rbp), %r15
movl (%r14), %r13d
movl $0x0, (%r14)
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21c0
cmpq %r15, (%r12)
je 0x4821
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rdx
cmpq %rcx, %rdx
jb 0x482d
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x482d
testl %ecx, %ecx
jne 0x41e4
movl %r13d, (%r14)
movq -0x30(%rbp), %rcx
movl %eax, 0x48(%rcx)
leaq 0x54c6(%rip), %rsi      # 0x96b8
leaq -0xb0(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4225
leaq 0x54b1(%rip), %rsi      # 0x96ba
leaq -0xb0(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4225
xorl %r14d, %r14d
leaq -0x80(%rbp), %r13
jmp 0x3f9f
leaq 0x53da(%rip), %rsi      # 0x9606
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
leaq -0x80(%rbp), %r13
je 0x4391
leaq 0x5560(%rip), %rsi      # 0x97a8
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x545c(%rip), %rsi      # 0x96bc
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5447(%rip), %rsi      # 0x96bf
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5433(%rip), %rsi      # 0x96c3
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x541e(%rip), %rsi      # 0x96c6
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5409(%rip), %rsi      # 0x96c9
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x53f5(%rip), %rsi      # 0x96cd
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x53e1(%rip), %rsi      # 0x96d1
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x53b5(%rip), %rsi      # 0x96bd
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x53a8(%rip), %rsi      # 0x96c4
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5390(%rip), %rsi      # 0x96c0
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5383(%rip), %rsi      # 0x96c7
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5372(%rip), %rsi      # 0x96ca
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5362(%rip), %rsi      # 0x96ce
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x4391
leaq 0x5352(%rip), %rsi      # 0x96d2
leaq -0x50(%rbp), %rdi
callq 0x2050
testl %eax, %eax
jne 0x3f9c
leaq 0x526e(%rip), %rsi      # 0x9606
leaq -0x70(%rbp), %rdi
callq 0x2050
testl %eax, %eax
je 0x440a
cmpq $0x2, -0x68(%rbp)
jne 0x3f9c
movq -0x70(%rbp), %rax
movb (%rax), %al
addb $-0x61, %al
cmpb $0x7, %al
ja 0x3f9c
leaq 0x52f1(%rip), %rsi      # 0x96b8
leaq -0xb0(%rbp), %rdi
callq 0x2050
testl %eax, %eax
jne 0x43e1
movq -0x70(%rbp), %rax
cmpb $0x36, 0x1(%rax)
je 0x440a
leaq 0x52d2(%rip), %rsi      # 0x96ba
leaq -0xb0(%rbp), %rdi
callq 0x2050
testl %eax, %eax
jne 0x3f9c
movq -0x70(%rbp), %rax
cmpb $0x33, 0x1(%rax)
jne 0x3f9c
movq -0x88(%rbp), %rax
testq %rax, %rax
je 0x3f9c
movq -0x90(%rbp), %rcx
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
cmpb $0x2f, (%rcx,%rdx)
sete %dil
addq %rdi, %rsi
incq %rdx
cmpq %rdx, %rax
jne 0x4425
cmpq $0x7, %rsi
jne 0x3f9c
xorl %edx, %edx
movabsq $0x1d2010001d201, %rsi  # imm = 0x1D2010001D201
movb (%rcx,%rdx), %dil
cmpb $0x2f, %dil
je 0x4487
cmpb $0x31, %dil
jl 0x3f9c
cmpb $0x39, %dil
jb 0x4487
movzbl %dil, %edi
xorl %r14d, %r14d
addl $-0x42, %edi
cmpl $0x30, %edi
ja 0x3f9f
btq %rdi, %rsi
jae 0x3f9f
incq %rdx
cmpq %rdx, %rax
jne 0x4450
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
cmpb $0x4b, (%rcx,%rdx)
sete %dil
addq %rdi, %rsi
incq %rdx
cmpq %rdx, %rax
jne 0x4493
cmpq $0x1, %rsi
jne 0x3f9c
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
cmpb $0x6b, (%rcx,%rdx)
sete %dil
addq %rdi, %rsi
incq %rdx
cmpq %rdx, %rax
jne 0x44b6
cmpq $0x1, %rsi
jne 0x3f9c
xorl %edx, %edx
xorl %edi, %edi
xorl %esi, %esi
cmpb $0x50, (%rcx,%rdx)
sete %sil
addq %rsi, %rdi
incq %rdx
cmpq %rdx, %rax
jne 0x44d9
movq %rdi, -0xb8(%rbp)
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
cmpb $0x70, (%rcx,%rdx)
sete %dil
addq %rdi, %rsi
incq %rdx
cmpq %rdx, %rax
jne 0x44f9
xorl %edx, %edx
xorl %edi, %edi
xorl %r8d, %r8d
cmpb $0x4e, (%rcx,%rdx)
sete %r8b
addq %r8, %rdi
incq %rdx
cmpq %rdx, %rax
jne 0x4512
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
cmpb $0x6e, (%rcx,%rdx)
sete %r9b
addq %r9, %r8
incq %rdx
cmpq %rdx, %rax
jne 0x452d
xorl %edx, %edx
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpb $0x42, (%rcx,%rdx)
sete %r10b
addq %r10, %r9
incq %rdx
cmpq %rdx, %rax
jne 0x4548
xorl %edx, %edx
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpb $0x62, (%rcx,%rdx)
sete %r11b
addq %r11, %r10
incq %rdx
cmpq %rdx, %rax
jne 0x4563
xorl %edx, %edx
xorl %r11d, %r11d
xorl %r14d, %r14d
cmpb $0x52, (%rcx,%rdx)
sete %r14b
addq %r14, %r11
incq %rdx
cmpq %rdx, %rax
jne 0x457e
xorl %edx, %edx
xorl %r15d, %r15d
xorl %r14d, %r14d
cmpb $0x72, (%rcx,%rdx)
sete %r14b
addq %r14, %r15
incq %rdx
cmpq %rdx, %rax
jne 0x4599
xorl %edx, %edx
xorl %r12d, %r12d
xorl %r14d, %r14d
cmpb $0x51, (%rcx,%rdx)
sete %r14b
addq %r14, %r12
incq %rdx
cmpq %rdx, %rax
jne 0x45b4
xorl %r14d, %r14d
xorl %edx, %edx
xorl %r13d, %r13d
cmpb $0x71, (%rcx,%r14)
sete %r13b
addq %r13, %rdx
incq %r14
cmpq %r14, %rax
jne 0x45cf
xorl %r14d, %r14d
cmpq $0x9, %rdx
ja 0x421c
cmpq $0x9, %r12
leaq -0x80(%rbp), %r13
ja 0x3f9f
cmpq $0xa, %r15
ja 0x3f9f
cmpq $0xa, %r11
ja 0x3f9f
cmpq $0xa, %r10
ja 0x3f9f
cmpq $0xa, %r9
ja 0x3f9f
cmpq $0xa, %r8
ja 0x3f9f
cmpq $0xa, %rdi
ja 0x3f9f
cmpq $0x8, -0xb8(%rbp)
ja 0x3f9f
cmpq $0x8, %rsi
ja 0x3f9f
addq %r12, %r11
addq %r9, %r11
addq -0xb8(%rbp), %rdi
addq %r11, %rdi
cmpq $0xf, %rdi
ja 0x3f9c
addq %rsi, %r8
addq %r10, %r8
addq %r15, %r8
addq %rdx, %r8
cmpq $0xf, %r8
ja 0x3f9c
leaq 0x502c(%rip), %rsi      # 0x96b8
leaq -0xb0(%rbp), %rdi
callq 0x2050
testl %eax, %eax
movq -0x30(%rbp), %rax
sete 0x40(%rax)
movq -0x48(%rbp), %rax
testq %rax, %rax
je 0x46fc
movq -0x50(%rbp), %rcx
xorl %edx, %edx
movzbl (%rcx,%rdx), %esi
cmpl $0x6a, %esi
jg 0x46ce
cmpl $0x4b, %esi
je 0x46e2
cmpl $0x51, %esi
jne 0x46f4
movq -0x30(%rbp), %rsi
movb $0x1, 0x42(%rsi)
jmp 0x46f4
cmpl $0x6b, %esi
je 0x46ec
cmpl $0x71, %esi
jne 0x46f4
movq -0x30(%rbp), %rsi
movb $0x1, 0x44(%rsi)
jmp 0x46f4
movq -0x30(%rbp), %rsi
movb $0x1, 0x41(%rsi)
jmp 0x46f4
movq -0x30(%rbp), %rsi
movb $0x1, 0x43(%rsi)
incq %rdx
cmpq %rdx, %rax
jne 0x46b1
leaq 0x4f03(%rip), %rsi      # 0x9606
leaq -0x70(%rbp), %rdi
callq 0x2050
movb $0x1, %r14b
testl %eax, %eax
je 0x3f9f
movq -0x30(%rbp), %rax
cmpb $0x1, 0x40(%rax)
jne 0x477f
leaq -0x110(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x120(%rbp), %rdi
callq 0x671c
leaq -0x120(%rbp), %rdi
callq 0x876e
movq -0x30(%rbp), %rcx
leaq 0x58(%rcx), %rdi
movl %eax, %esi
movl $0x1, %edx
callq 0x33b2
movq -0x120(%rbp), %rdi
cmpq %r12, %rdi
je 0x477f
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x30(%rbp), %rax
cmpb $0x0, 0x40(%rax)
jne 0x3f9f
leaq -0xf0(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x100(%rbp), %rdi
callq 0x671c
leaq -0x100(%rbp), %rdi
callq 0x876e
movq -0x30(%rbp), %rdi
addq $0x60, %rdi
movl %eax, %esi
movl $0x1, %edx
callq 0x33b2
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x421c
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x421c
leaq -0x2c0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x21b0
jmp 0x4107
leaq 0x5071(%rip), %rdi      # 0x9881
callq 0x20b0
leaq 0x5065(%rip), %rdi      # 0x9881
callq 0x21e0
leaq 0x5059(%rip), %rdi      # 0x9881
callq 0x20b0
leaq 0x504d(%rip), %rdi      # 0x9881
callq 0x21e0
movq %rax, %r15
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x4886
movq -0xf0(%rbp), %rsi
jmp 0x4867
movq %rax, %r15
movq -0x120(%rbp), %rdi
cmpq %r12, %rdi
je 0x4886
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x4886
jmp 0x4883
jmp 0x4875
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x4886
movl %r13d, (%r14)
jmp 0x4886
movq %rax, %r15
movq -0x140(%rbp), %rdi
cmpq %rbx, %rdi
je 0x48a1
movq -0x130(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x48c3
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x48dc
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x48f5
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x4917
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x4933
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2150
movq 0x8696(%rip), %rsi      # 0xcfd0
leaq -0x2c0(%rbp), %rdi
callq 0x21d0
leaq -0x248(%rbp), %rdi
callq 0x2070
movq %r15, %rdi
callq 0x2270