// File: /workspace/github_cpp_makefile_star2_O2/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 0x423f
pushq %rbx
movq %rdi, %rbx
movq (%rdx), %rdi
testq %rdi, %rdi
je 0x423e
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x2030
movq %rax, %rsi
movl (%rbx), %ecx
pushq $0x40
popq %rdi
movl %ecx, %eax
cltd
idivl %edi
cmpl $0x3f, %ecx
jg 0x4104
movslq %edx, %rax
leaq 0xc13b9(%rip), %rdx     # 0xc54b0
movq %rsi, 0x600(%rdx,%rax,8)
jmp 0x423a
cmpl $0x7f, %ecx
ja 0x411f
movl %edx, %eax
leaq 0xc139e(%rip), %rdx     # 0xc54b0
movq %rsi, 0x1200(%rdx,%rax,8)
jmp 0x423a
cmpl $0xbf, %ecx
ja 0x413d
movl %edx, %eax
leaq 0xc1380(%rip), %rdx     # 0xc54b0
movq %rsi, 0xa00(%rdx,%rax,8)
jmp 0x423a
cmpl $0xff, %ecx
ja 0x415b
movl %edx, %eax
leaq 0xc1362(%rip), %rdx     # 0xc54b0
movq %rsi, 0xe00(%rdx,%rax,8)
jmp 0x423a
cmpl $0x13f, %ecx            # imm = 0x13F
ja 0x4179
movl %edx, %eax
leaq 0xc1344(%rip), %rdx     # 0xc54b0
movq %rsi, 0x1600(%rdx,%rax,8)
jmp 0x423a
cmpl $0x17f, %ecx            # imm = 0x17F
ja 0x4197
movl %edx, %eax
leaq 0xc1326(%rip), %rdx     # 0xc54b0
movq %rsi, 0x1a00(%rdx,%rax,8)
jmp 0x423a
cmpl $0x1bf, %ecx            # imm = 0x1BF
ja 0x41b5
movl %edx, %eax
leaq 0xc1308(%rip), %rdx     # 0xc54b0
movq %rsi, 0x400(%rdx,%rax,8)
jmp 0x423a
cmpl $0x1ff, %ecx            # imm = 0x1FF
ja 0x41d0
movl %edx, %eax
leaq 0xc12ea(%rip), %rdx     # 0xc54b0
movq %rsi, 0x1000(%rdx,%rax,8)
jmp 0x423a
cmpl $0x23f, %ecx            # imm = 0x23F
ja 0x41eb
movl %edx, %eax
leaq 0xc12cf(%rip), %rdx     # 0xc54b0
movq %rsi, 0x800(%rdx,%rax,8)
jmp 0x423a
cmpl $0x27f, %ecx            # imm = 0x27F
ja 0x4206
movl %edx, %eax
leaq 0xc12b4(%rip), %rdx     # 0xc54b0
movq %rsi, 0xc00(%rdx,%rax,8)
jmp 0x423a
cmpl $0x2bf, %ecx            # imm = 0x2BF
ja 0x4221
movl %edx, %eax
leaq 0xc1299(%rip), %rdx     # 0xc54b0
movq %rsi, 0x1400(%rdx,%rax,8)
jmp 0x423a
cmpl $0x2ff, %ecx            # imm = 0x2FF
ja 0x4242
movl %edx, %eax
leaq 0xc127e(%rip), %rdx     # 0xc54b0
movq %rsi, 0x1800(%rdx,%rax,8)
incl %ecx
movl %ecx, (%rbx)
popq %rbx
xorl %eax, %eax
retq
leal -0x300(%rcx), %eax
cmpl $0x5, %eax
ja 0x4293
leaq 0x230ec(%rip), %rdx     # 0x27340
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %rsi, 0xc2e54(%rip)     # 0xc70b8
jmp 0x423a
movq %rsi, 0xc2e63(%rip)     # 0xc70d0
jmp 0x423a
movq %rsi, 0xc2e4a(%rip)     # 0xc70c0
jmp 0x423a
movq %rsi, 0xc2e49(%rip)     # 0xc70c8
jmp 0x423a
movq %rsi, 0xc2e28(%rip)     # 0xc70b0
jmp 0x423a
movq %rsi, 0xc2e47(%rip)     # 0xc70d8
jmp 0x423a
cmpl $0x345, %ecx            # imm = 0x345
ja 0x423a
leal -0x306(%rcx), %eax
leaq 0xc2e38(%rip), %rdx     # 0xc70e0
movq %rsi, (%rdx,%rax,8)
jmp 0x423a