// File: /workspace/github_cpp_makefile_star2_O3/Konano[P]UselessDatabase/Table.cpp
// Function: Table::constraintRowKey(Any*, Key*)
int Table::constraintRowKey(Any* data, Key* key) {
    if (key->ty() == 1) {
        for (auto i: key->v) if (data[i].isNull()) return -1;
        Anys val;
        for (auto i: key->v) val.push_back(data[i]);
        vector<int> ans;
        if(this->index[p_key_index].fileID == -1){
            this->index[p_key_index].open();
            ans = this->index[p_key_index].queryRecord(&val);
            this->index[p_key_index].close();
        }
        else ans = this->index[p_key_index].queryRecord(&val);
        if (ans.size() != 0) return -2;
    } else {
        Anys val;
        for (auto i: key->v) val.push_back(data[i]);
        vector <int> ans;
        //if(key->v.size() == 2)printf("%d %d\n",*val[0].anyCast<int>(),*val[1].anyCast<int>());
        Table* p_table = dynamic_cast<ForeignKey*>(key)->p->table;
        if(p_table->index[p_table->p_key_index].fileID == -1){
            p_table->index[p_table->p_key_index].open();
            ans = p_table->index[p_table->p_key_index].queryRecord(&val);
            p_table->index[p_table->p_key_index].close();
        }
        else {ans = p_table->index[p_table->p_key_index].queryRecord(&val);}
        if (ans.size() == 0){
            return -3;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdx), %rax
movq %rdx, %rdi
callq *(%rax)
cmpl $0x1, %eax
jne 0x257ca
movq 0x30(%r15), %r13
movq 0x38(%r15), %rbp
cmpq %rbp, %r13
je 0x2588f
movq %r13, %rax
movl (%rax), %ecx
cmpq $0x0, (%rbx,%rcx,8)
je 0x25966
addq $0x4, %rax
cmpq %rbp, %rax
jne 0x2574e
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpq %rbp, %r13
je 0x2589f
movq %rsp, %r15
leaq 0x40(%rsp), %r12
movl (%r13), %eax
movq (%rbx,%rax,8), %rdi
testq %rdi, %rdi
je 0x2579a
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x2579c
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x9f9a
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x257bc
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x4, %r13
cmpq %rbp, %r13
jne 0x25785
jmp 0x2589f
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x30(%r15), %r13
movq 0x38(%r15), %rbp
cmpq %rbp, %r13
je 0x2582f
movq %rsp, %r14
leaq 0x38(%rsp), %r12
movl (%r13), %eax
movq (%rbx,%rax,8), %rdi
testq %rdi, %rdi
je 0x25804
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x25806
xorl %eax, %eax
movq %rax, 0x38(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x9f9a
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x25826
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x4, %r13
cmpq %rbp, %r13
jne 0x257ef
leaq 0x2d33a(%rip), %rsi     # 0x52b70
leaq 0x2d343(%rip), %rdx     # 0x52b80
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5430
movq 0x50(%rax), %rax
movq 0x48(%rax), %r13
movslq 0x778(%r13), %rax
imulq $0x98, %rax, %rax
leaq (%rax,%r13), %rsi
addq $0x7a0, %rsi            # imm = 0x7A0
cmpl $-0x1, 0x74(%rsi)
je 0x258e3
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x19a30
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r12
movq 0x30(%rsp), %r15
jmp 0x25938
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movslq 0x778(%r14), %rax
imulq $0x98, %rax, %rax
leaq (%r14,%rax), %rsi
addq $0x7a0, %rsi            # imm = 0x7A0
cmpl $-0x1, 0x74(%rsi)
je 0x2596d
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x19a30
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %r12
jmp 0x259c2
movq %rsi, %rdi
callq 0x19088
leaq 0x7a0(%r13), %rbx
movslq 0x778(%r13), %rax
imulq $0x98, %rax, %rsi
addq %rbx, %rsi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x19a30
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r12
movq 0x30(%rsp), %r15
movslq 0x778(%r13), %rax
imulq $0x98, %rax, %rax
addq %rax, %rbx
movq %rbx, %rdi
callq 0x190c8
testq %r14, %r14
je 0x2594b
subq %r14, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x53a0
movq %rsp, %rdi
callq 0xa37e
cmpq %r14, %r12
jne 0x259e7
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jmp 0x259e9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x259e9
movq %rsi, %rdi
callq 0x19088
leaq 0x7a0(%r14), %rbx
movslq 0x778(%r14), %rax
imulq $0x98, %rax, %rsi
addq %rbx, %rsi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x19a30
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %r13
movq 0x30(%rsp), %r12
movslq 0x778(%r14), %rax
imulq $0x98, %rax, %rax
addq %rax, %rbx
movq %rbx, %rdi
callq 0x190c8
testq %r15, %r15
je 0x259d5
subq %r15, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x53a0
movq %rsp, %rdi
callq 0xa37e
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq %r15, %r13
jne 0x259e9
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
testq %r15, %r15
je 0x25a53
subq %r15, %r12
movq %r15, %rdi
movq %r12, %rsi
jmp 0x25a20
jmp 0x25a3b
jmp 0x25a3b
movq %rax, %rbx
testq %r14, %r14
je 0x25a53
subq %r14, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x53a0
jmp 0x25a53
jmp 0x25a3b
jmp 0x25a3b
jmp 0x25a3b
jmp 0x25a3b
jmp 0x25a3b
movq %rax, %rbx
movq 0x40(%rsp), %rdi
jmp 0x25a48
movq %rax, %rbx
jmp 0x25a53
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x25a53
movq (%rdi), %rax
callq *0x8(%rax)
movq %rsp, %rdi
callq 0xa37e
movq %rbx, %rdi
callq 0x56e0
nop