// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdx), %rax
movq %rdx, %rdi
callq *(%rax)
cmpl $0x1, %eax
jne 0x1edd3
movq 0x30(%r15), %r13
movq 0x38(%r15), %rbp
pushq $-0x1
popq %rax
movq %r13, %rcx
cmpq %rbp, %rcx
je 0x1eeaf
movl (%rcx), %edx
addq $0x4, %rcx
cmpq $0x0, (%rbx,%rdx,8)
jne 0x1edb8
jmp 0x1f071
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r14
andq $0x0, 0x10(%r14)
movaps %xmm0, (%r14)
movq 0x30(%r15), %r13
movq 0x38(%r15), %rbp
leaq 0x20(%rsp), %r12
cmpq %rbp, %r13
je 0x1ee33
movl (%r13), %eax
movq (%rbx,%rax,8), %rdi
testq %rdi, %rdi
je 0x1ee0b
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x1ee0d
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x8ea0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1ee2d
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x4, %r13
jmp 0x1edf1
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x30df9(%rip), %rsi     # 0x4fc40
leaq 0x30e02(%rip), %rdx     # 0x4fc50
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5470
movq 0x50(%rax), %rax
movq 0x48(%rax), %r15
movslq 0x778(%r15), %rax
imulq $0x98, %rax, %rax
leaq (%r15,%rax), %rsi
addq $0x7a0, %rsi            # imm = 0x7A0
cmpl $-0x1, 0x74(%rsi)
je 0x1ef63
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x15da2
movq %rsp, %rdi
leaq 0x50(%rsp), %rbx
movq %rbx, %rsi
callq 0x21d54
movq %rbx, %rdi
callq 0x8c8c
jmp 0x1efc3
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x28(%rsp), %r12
cmpq %rbp, %r13
je 0x1ef07
movl (%r13), %eax
movq (%rbx,%rax,8), %rdi
testq %rdi, %rdi
je 0x1eedf
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x1eee1
xorl %eax, %eax
movq %rax, 0x28(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8ea0
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x1ef01
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x4, %r13
jmp 0x1eec5
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $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 0x1efec
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x15da2
movq %rsp, %rdi
leaq 0x50(%rsp), %rbx
movq %rbx, %rsi
callq 0x21d54
movq %rbx, %rdi
callq 0x8c8c
jmp 0x1f04c
movq %rsi, %rdi
callq 0x155f8
leaq 0x7a0(%r15), %rbx
movslq 0x778(%r15), %rax
imulq $0x98, %rax, %rsi
addq %rbx, %rsi
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x15da2
movq %rsp, %rdi
leaq 0x50(%rsp), %r14
movq %r14, %rsi
callq 0x21d54
movq %r14, %rdi
callq 0x8c8c
movslq 0x778(%r15), %rax
imulq $0x98, %rax, %rax
addq %rax, %rbx
movq %rbx, %rdi
callq 0x15638
movq %rsp, %rdi
movq 0x8(%rdi), %rbx
movq (%rdi), %r14
callq 0x8c8c
leaq 0x30(%rsp), %rdi
callq 0x9268
cmpq %r14, %rbx
jne 0x1f06f
pushq $-0x3
jmp 0x1f06c
movq %rsi, %rdi
callq 0x155f8
leaq 0x7a0(%r14), %rbx
movslq 0x778(%r14), %rax
imulq $0x98, %rax, %rsi
addq %rbx, %rsi
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x15da2
movq %rsp, %rdi
leaq 0x50(%rsp), %r15
movq %r15, %rsi
callq 0x21d54
movq %r15, %rdi
callq 0x8c8c
movslq 0x778(%r14), %rax
imulq $0x98, %rax, %rax
addq %rax, %rbx
movq %rbx, %rdi
callq 0x15638
movq %rsp, %rdi
movq 0x8(%rdi), %rbx
movq (%rdi), %r14
callq 0x8c8c
leaq 0x30(%rsp), %rdi
callq 0x9268
cmpq %r14, %rbx
je 0x1f06f
pushq $-0x2
popq %rax
jmp 0x1f071
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f08a
jmp 0x1f08a
jmp 0x1f08a
jmp 0x1f08a
jmp 0x1f08a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x8c8c
jmp 0x1f0bb
jmp 0x1f0a3
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x1f0b0
movq %rax, %rbx
jmp 0x1f0bb
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1f0bb
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x30(%rsp), %rdi
callq 0x9268
movq %rbx, %rdi
callq 0x56f0
nop