// File: /workspace/github_cpp_makefile_star2_O3/jswaff[P]prophet3/src/book.cpp
// Function: load_zkeys_callback(void*, int, char**, char**)
static int load_zkeys_callback(void *data, int argc, char **argv, char **azColName){
    int* num_keys = (int*)data;

    if (argc==1 && argv[0]) {
        int64 key = strtoll(argv[0],(char **)NULL, 10);
        int32 sq_ind = (*num_keys) % 64;
        if (*num_keys < 64) {
            bk_pieces[PAWN][WHITE][sq_ind] = key;
        } else if (*num_keys < 128) {
            bk_pieces[ROOK][WHITE][sq_ind] = key;
        } else if (*num_keys < 192) {
            bk_pieces[KNIGHT][WHITE][sq_ind] = key;
        } else if (*num_keys < 256) {
            bk_pieces[BISHOP][WHITE][sq_ind] = key;
        } else if (*num_keys < 320) {
            bk_pieces[QUEEN][WHITE][sq_ind] = key;
        } else if (*num_keys < 384) {
            bk_pieces[KING][WHITE][sq_ind] = key;
        } else if (*num_keys < 448) {
            bk_pieces[PAWN][BLACK][sq_ind] = key;
        } else if (*num_keys < 512) {
            bk_pieces[ROOK][BLACK][sq_ind] = key;
        } else if (*num_keys < 576) {
            bk_pieces[KNIGHT][BLACK][sq_ind] = key;
        } else if (*num_keys < 640) {
            bk_pieces[BISHOP][BLACK][sq_ind] = key;
        } else if (*num_keys < 704) {
            bk_pieces[QUEEN][BLACK][sq_ind] = key;
        } else if (*num_keys < 768) {
            bk_pieces[KING][BLACK][sq_ind] = key;
        } else if (*num_keys==768) {
            bk_ptm[WHITE] = key;
        } else if (*num_keys==769) {
            bk_ptm[BLACK] = key;
        } else if (*num_keys==770) {
            bk_castling_rights[bk_cr_bq] = key;
        } else if (*num_keys==771) {
            bk_castling_rights[bk_cr_bk] = key;
        } else if (*num_keys==772) {
            bk_castling_rights[bk_cr_wq] = key;
        } else if (*num_keys==773) {
            bk_castling_rights[bk_cr_wk] = key;
        } else if (*num_keys < 838) {
            int32 ep_sq_ind = *num_keys-774;
            bk_ep[ep_sq_ind] = key;
        }

        (*num_keys)++;
    }


    return 0;
}

// Assembly:
cmpl $0x1, %esi
jne 0x445b
pushq %rbx
movq %rdi, %rbx
movq (%rdx), %rdi
testq %rdi, %rdi
je 0x445a
xorl %esi, %esi
movl $0xa, %edx
callq 0x2030
movl (%rbx), %ecx
leal 0x3f(%rcx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
andl $-0x40, %esi
movl %ecx, %edx
subl %esi, %edx
cmpl $0x3f, %ecx
jg 0x4320
movslq %edx, %rdx
leaq 0xbe19d(%rip), %rsi     # 0xc24b0
movq %rax, 0x600(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x7f, %ecx
ja 0x433b
movl %edx, %edx
leaq 0xbe182(%rip), %rsi     # 0xc24b0
movq %rax, 0x1200(%rsi,%rdx,8)
jmp 0x4456
cmpl $0xbf, %ecx
ja 0x4359
movl %edx, %edx
leaq 0xbe164(%rip), %rsi     # 0xc24b0
movq %rax, 0xa00(%rsi,%rdx,8)
jmp 0x4456
cmpl $0xff, %ecx
ja 0x4377
movl %edx, %edx
leaq 0xbe146(%rip), %rsi     # 0xc24b0
movq %rax, 0xe00(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x13f, %ecx            # imm = 0x13F
ja 0x4395
movl %edx, %edx
leaq 0xbe128(%rip), %rsi     # 0xc24b0
movq %rax, 0x1600(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x17f, %ecx            # imm = 0x17F
ja 0x43b3
movl %edx, %edx
leaq 0xbe10a(%rip), %rsi     # 0xc24b0
movq %rax, 0x1a00(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x1bf, %ecx            # imm = 0x1BF
ja 0x43d1
movl %edx, %edx
leaq 0xbe0ec(%rip), %rsi     # 0xc24b0
movq %rax, 0x400(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x1ff, %ecx            # imm = 0x1FF
ja 0x43ec
movl %edx, %edx
leaq 0xbe0ce(%rip), %rsi     # 0xc24b0
movq %rax, 0x1000(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x23f, %ecx            # imm = 0x23F
ja 0x4407
movl %edx, %edx
leaq 0xbe0b3(%rip), %rsi     # 0xc24b0
movq %rax, 0x800(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x27f, %ecx            # imm = 0x27F
ja 0x4422
movl %edx, %edx
leaq 0xbe098(%rip), %rsi     # 0xc24b0
movq %rax, 0xc00(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x2bf, %ecx            # imm = 0x2BF
ja 0x443d
movl %edx, %edx
leaq 0xbe07d(%rip), %rsi     # 0xc24b0
movq %rax, 0x1400(%rsi,%rdx,8)
jmp 0x4456
cmpl $0x2ff, %ecx            # imm = 0x2FF
ja 0x445e
movl %edx, %edx
leaq 0xbe062(%rip), %rsi     # 0xc24b0
movq %rax, 0x1800(%rsi,%rdx,8)
incl %ecx
movl %ecx, (%rbx)
popq %rbx
xorl %eax, %eax
retq
leal -0x300(%rcx), %edx
cmpl $0x5, %edx
ja 0x44af
leaq 0x24f00(%rip), %rsi     # 0x29370
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movq %rax, 0xbfc38(%rip)     # 0xc40b8
jmp 0x4456
movq %rax, 0xbfc47(%rip)     # 0xc40d0
jmp 0x4456
movq %rax, 0xbfc2e(%rip)     # 0xc40c0
jmp 0x4456
movq %rax, 0xbfc2d(%rip)     # 0xc40c8
jmp 0x4456
movq %rax, 0xbfc0c(%rip)     # 0xc40b0
jmp 0x4456
movq %rax, 0xbfc2b(%rip)     # 0xc40d8
jmp 0x4456
cmpl $0x345, %ecx            # imm = 0x345
ja 0x4456
leal -0x306(%rcx), %edx
leaq 0xbfc1c(%rip), %rsi     # 0xc40e0
movq %rax, (%rsi,%rdx,8)
jmp 0x4456