// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/path_finder.c
// Function: pathfinder
int pathfinder(char *asg_file, char *mito_annot, char *pltd_annot, int min_len, int ext_p, int ext_m, 
        int max_copy, int max_path, double max_eval, double min_score, double min_cf, double seq_cf,
        int no_trn, int no_rrn, int do_graph_clean, int bubble_size, int tip_size, double weak_cross,
        int out_opt, char *out_pref, int VERBOSE)
{
    asg_t *asg;
    hmm_annot_db_t *annot_db;
    og_component_v *og_components;
    int ret = 0;

    asg = 0;
    annot_db = 0;
    og_components = 0;

    asg = asg_read(asg_file);
    if (asg == 0) {
        fprintf(stderr, "[E::%s] failed to read the graph: %s\n", __func__, asg_file);
        ret = 1;
        goto do_clean;
    }
    
    if (VERBOSE > 1) {
        if (VERBOSE > 2) {
            fprintf(stderr, "[M::%s] graph loaded\n", __func__);
            asg_print(asg, stderr, 1);
        }
        fprintf(stderr, "[M::%s] graph stats\n", __func__);
        asg_stat(asg, stderr);
    }

    if (mito_annot) annot_db = hmm_annot_read(mito_annot, annot_db, OG_MITO);
    if (pltd_annot) annot_db = hmm_annot_read(pltd_annot, annot_db, OG_PLTD);
    
    if (VERBOSE > 2) hmm_annot_db_print(annot_db, stderr);

    // this is not necessary
    // if (do_graph_clean && min_cf > .0) clean_graph_by_sequence_coverage(asg, min_cf, max_copy, VERBOSE);
    og_components = asg_annotation(annot_db, asg, no_trn, no_rrn, max_eval, 0, min_len, min_score, 1, VERBOSE);
    // og_components = annot_subgraph_og_type(annot_db, asg, no_trn, no_rrn, max_eval, 0, min_len, min_score, 1, VERBOSE);
    if (!og_components) {
        fprintf(stderr, "[E::%s] no organelle component found\n", __func__);
        ret = 1;
        goto do_clean;
    }

    if (VERBOSE > 1) print_og_classification_summary(asg, annot_db, og_components, stderr);

    // graph will be changed with extra copies of sequences added
    if (mito_annot)
        parse_organelle_component(asg, annot_db, og_components, min_len, max_copy, max_path, ext_m, seq_cf, do_graph_clean, 
                min_cf, min_score, max_eval, bubble_size, tip_size, weak_cross, out_pref, out_opt, OG_MITO, VERBOSE);
    if (pltd_annot)
        parse_organelle_component(asg, annot_db, og_components, min_len, max_copy, max_path, ext_p, seq_cf, do_graph_clean, 
                min_cf, min_score, max_eval, bubble_size, tip_size, weak_cross, out_pref, out_opt, OG_PLTD, VERBOSE);

do_clean:
    asg_destroy(asg);
    hmm_annot_db_destroy(annot_db);
    og_component_v_destroy(og_components);

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movl 0x58(%rbp), %eax
movq 0x50(%rbp), %rax
movl 0x48(%rbp), %eax
movl 0x40(%rbp), %eax
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movl %ecx, -0x3c(%rbp)
movl %r8d, -0x40(%rbp)
movl %r9d, -0x44(%rbp)
movsd %xmm0, -0x50(%rbp)
movsd %xmm1, -0x58(%rbp)
movsd %xmm2, -0x60(%rbp)
movsd %xmm3, -0x68(%rbp)
movsd %xmm4, -0x70(%rbp)
movl $0x0, -0x8c(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x28(%rbp), %rdi
callq 0x32930
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x7fac
movq 0x4f077(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
leaq 0x444f1(%rip), %rsi     # 0x4c480
leaq 0x44578(%rip), %rdx     # 0x4c50e
movb $0x0, %al
callq 0x3320
movl $0x1, -0x8c(%rbp)
jmp 0x8213
cmpl $0x1, 0x58(%rbp)
jle 0x8021
cmpl $0x2, 0x58(%rbp)
jle 0x7fef
movq 0x4f039(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x44550(%rip), %rsi     # 0x4c519
leaq 0x4453e(%rip), %rdx     # 0x4c50e
movb $0x0, %al
callq 0x3320
movq -0x78(%rbp), %rdi
movq 0x4f016(%rip), %rax     # 0x56ff8
movq (%rax), %rsi
movl $0x1, %edx
callq 0x32200
movq 0x4f002(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x4452f(%rip), %rsi     # 0x4c52f
leaq 0x44507(%rip), %rdx     # 0x4c50e
movb $0x0, %al
callq 0x3320
movq -0x78(%rbp), %rdi
movq 0x4efdf(%rip), %rax     # 0x56ff8
movq (%rax), %rsi
callq 0x32450
cmpq $0x0, -0x30(%rbp)
je 0x803e
movq -0x30(%rbp), %rdi
movq -0x80(%rbp), %rsi
movl $0x1, %edx
callq 0xc1a0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x805b
movq -0x38(%rbp), %rdi
movq -0x80(%rbp), %rsi
movl $0x2, %edx
callq 0xc1a0
movq %rax, -0x80(%rbp)
cmpl $0x2, 0x58(%rbp)
jle 0x8074
movq -0x80(%rbp), %rdi
movq 0x4ef8c(%rip), %rax     # 0x56ff8
movq (%rax), %rsi
callq 0xcc30
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movl 0x20(%rbp), %edx
movl 0x28(%rbp), %ecx
movsd -0x50(%rbp), %xmm0
movl -0x3c(%rbp), %r9d
cvttsd2si -0x58(%rbp), %r10d
movl 0x58(%rbp), %eax
xorl %r8d, %r8d
movl %r10d, (%rsp)
movl $0x1, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x366a0
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
jne 0x80eb
movq 0x4ef34(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0x4441a(%rip), %rsi     # 0x4c4e8
leaq 0x44439(%rip), %rdx     # 0x4c50e
movb $0x0, %al
callq 0x3320
movl $0x1, -0x8c(%rbp)
jmp 0x8213
cmpl $0x1, 0x58(%rbp)
jle 0x810f
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq 0x4eef1(%rip), %rax     # 0x56ff8
movq (%rax), %rcx
callq 0x399a0
cmpq $0x0, -0x30(%rbp)
je 0x8190
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl 0x18(%rbp), %r9d
movl -0x44(%rbp), %r12d
movsd -0x68(%rbp), %xmm0
movl 0x30(%rbp), %r15d
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movsd -0x50(%rbp), %xmm3
movl 0x38(%rbp), %r14d
movl 0x40(%rbp), %ebx
movsd -0x70(%rbp), %xmm4
movq 0x50(%rbp), %r11
movl 0x48(%rbp), %r10d
movl 0x58(%rbp), %eax
movl %r12d, (%rsp)
movl %r15d, 0x8(%rsp)
movl %r14d, 0x10(%rsp)
movl %ebx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movl %r10d, 0x28(%rsp)
movl $0x1, 0x30(%rsp)
movl %eax, 0x38(%rsp)
callq 0x8250
cmpq $0x0, -0x38(%rbp)
je 0x8211
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl 0x18(%rbp), %r9d
movl -0x40(%rbp), %r12d
movsd -0x68(%rbp), %xmm0
movl 0x30(%rbp), %r15d
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movsd -0x50(%rbp), %xmm3
movl 0x38(%rbp), %r14d
movl 0x40(%rbp), %ebx
movsd -0x70(%rbp), %xmm4
movq 0x50(%rbp), %r11
movl 0x48(%rbp), %r10d
movl 0x58(%rbp), %eax
movl %r12d, (%rsp)
movl %r15d, 0x8(%rsp)
movl %r14d, 0x10(%rsp)
movl %ebx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movl %r10d, 0x28(%rsp)
movl $0x2, 0x30(%rsp)
movl %eax, 0x38(%rsp)
callq 0x8250
jmp 0x8213
movq -0x78(%rbp), %rdi
callq 0x317a0
movq -0x80(%rbp), %rdi
callq 0xbfe0
movq -0x88(%rbp), %rdi
callq 0x33f40
movl -0x8c(%rbp), %eax
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)