// File: WeiqiangZhou[P]BIRD/source/predict_function.cpp
// Function: MatchExon(char**, Exondata*, int, int*)
int MatchExon(char **lib_TC, Exondata *indata, int Length, int *match_idx)
{
    int error_flag = 1;
    std::unordered_map<std::string, int> id_map;
    
    for (int i = 0; i < indata->TC_name.size(); i++)
    {
        id_map[indata->TC_name[i].c_str()] = i+1;
    }
    
    for (int i = 0; i < Length; i++)
    {
        match_idx[i] = id_map[lib_TC[i]] - 1;
    }
    
    for (int i = 0; i < Length; i++)
    {
        if(match_idx[i] != -1)
        {
            error_flag = 0;
            break;
        }
    }
    
    if(error_flag == 1)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x1, -0x2c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x9970
movl $0x0, -0x6c(%rbp)
movslq -0x6c(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x4a90
movq %rax, %rcx
movq -0xe0(%rbp), %rax
cmpq %rcx, %rax
jae 0x6d86
movslq -0x6c(%rbp), %rsi
movl %esi, %eax
incl %eax
movl %eax, -0xf4(%rbp)
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x9950
movq %rax, %rdi
callq 0x20d0
movq %rax, -0xf0(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x23c0
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x22a0
jmp 0x6cf5
leaq -0x68(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x99e0
movq %rax, -0x100(%rbp)
jmp 0x6d0e
movq -0x100(%rbp), %rax
movl -0xf4(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x90(%rbp), %rdi
callq 0x2140
leaq -0x91(%rbp), %rdi
callq 0x2210
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x6c71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x6d75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2140
leaq -0x91(%rbp), %rdi
callq 0x2210
jmp 0x6f07
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6e86
movq -0x10(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x110(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x23c0
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x22a0
jmp 0x6de4
leaq -0x68(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x99e0
movq %rax, -0x118(%rbp)
jmp 0x6dfd
movq -0x118(%rbp), %rax
movl (%rax), %edx
subl $0x1, %edx
movq -0x28(%rbp), %rax
movslq -0xa8(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
leaq -0xc8(%rbp), %rdi
callq 0x2140
leaq -0xc9(%rbp), %rdi
callq 0x2210
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x6d90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x6e75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x2140
leaq -0xc9(%rbp), %rdi
callq 0x2210
jmp 0x6f07
movl $0x0, -0xd0(%rbp)
movl -0xd0(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6ec8
movq -0x28(%rbp), %rax
movslq -0xd0(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x6eb5
movl $0x0, -0x2c(%rbp)
jmp 0x6ec8
jmp 0x6eb7
movl -0xd0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
jmp 0x6e90
cmpl $0x1, -0x2c(%rbp)
jne 0x6ee1
movl $0x1, -0x4(%rbp)
movl $0x1, -0xd4(%rbp)
jmp 0x6ef2
movl $0x0, -0x4(%rbp)
movl $0x1, -0xd4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x99c0
movl -0x4(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x99c0
movq -0xa0(%rbp), %rdi
callq 0x23b0
nopl (%rax)