// File: /workspace/github_cpp_makefile_star2_O1/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 0x4403
pushq %rbx
movq %rdi, %rbx
movq (%rdx), %rdi
testq %rdi, %rdi
je 0x4402
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 0x42c8
movslq %edx, %rdx
leaq 0xbe1f5(%rip), %rsi     # 0xc24b0
movq %rax, 0x600(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x7f, %ecx
jg 0x42e3
movl %edx, %edx
leaq 0xbe1da(%rip), %rsi     # 0xc24b0
movq %rax, 0x1200(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0xbf, %ecx
jg 0x4301
movl %edx, %edx
leaq 0xbe1bc(%rip), %rsi     # 0xc24b0
movq %rax, 0xa00(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0xff, %ecx
jg 0x431f
movl %edx, %edx
leaq 0xbe19e(%rip), %rsi     # 0xc24b0
movq %rax, 0xe00(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x13f, %ecx            # imm = 0x13F
jg 0x433d
movl %edx, %edx
leaq 0xbe180(%rip), %rsi     # 0xc24b0
movq %rax, 0x1600(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x17f, %ecx            # imm = 0x17F
jg 0x435b
movl %edx, %edx
leaq 0xbe162(%rip), %rsi     # 0xc24b0
movq %rax, 0x1a00(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x1bf, %ecx            # imm = 0x1BF
jg 0x4379
movl %edx, %edx
leaq 0xbe144(%rip), %rsi     # 0xc24b0
movq %rax, 0x400(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x1ff, %ecx            # imm = 0x1FF
jg 0x4394
movl %edx, %edx
leaq 0xbe126(%rip), %rsi     # 0xc24b0
movq %rax, 0x1000(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x23f, %ecx            # imm = 0x23F
jg 0x43af
movl %edx, %edx
leaq 0xbe10b(%rip), %rsi     # 0xc24b0
movq %rax, 0x800(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x27f, %ecx            # imm = 0x27F
jg 0x43ca
movl %edx, %edx
leaq 0xbe0f0(%rip), %rsi     # 0xc24b0
movq %rax, 0xc00(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x2bf, %ecx            # imm = 0x2BF
jg 0x43e5
movl %edx, %edx
leaq 0xbe0d5(%rip), %rsi     # 0xc24b0
movq %rax, 0x1400(%rsi,%rdx,8)
jmp 0x43fe
cmpl $0x2ff, %ecx            # imm = 0x2FF
jg 0x4406
movl %edx, %edx
leaq 0xbe0ba(%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 0x4457
leaq 0x24f28(%rip), %rsi     # 0x29340
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movq %rax, 0xbfc90(%rip)     # 0xc40b8
jmp 0x43fe
movq %rax, 0xbfc9f(%rip)     # 0xc40d0
jmp 0x43fe
movq %rax, 0xbfc86(%rip)     # 0xc40c0
jmp 0x43fe
movq %rax, 0xbfc85(%rip)     # 0xc40c8
jmp 0x43fe
movq %rax, 0xbfc64(%rip)     # 0xc40b0
jmp 0x43fe
movq %rax, 0xbfc83(%rip)     # 0xc40d8
jmp 0x43fe
cmpl $0x345, %ecx            # imm = 0x345
jg 0x43fe
leal -0x306(%rcx), %edx
leaq 0xbfc74(%rip), %rsi     # 0xc40e0
movq %rax, (%rsi,%rdx,8)
jmp 0x43fe