// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts.c
// Function: hts_idx_load3
hts_idx_t *hts_idx_load3(const char *fn, const char *fnidx, int fmt, int flags)
{
    const char *local_fn = NULL;
    char *local_fnidx = NULL;
    int local_len;
    if (!fnidx)
        return idx_find_and_load(fn, fmt, flags);

    // Check that the index file is up to date, the main file might have changed
    struct stat stat_idx,stat_main;
    int remote_fn = hisremote(fn), remote_fnidx = hisremote(fnidx);
    if ( !remote_fn && !remote_fnidx
         && !stat(fn, &stat_main) && !stat(fnidx, &stat_idx) )
    {
        if ( stat_idx.st_mtime < stat_main.st_mtime )
            hts_log_warning("The index file is older than the data file: %s", fnidx);
    }

    if (remote_fnidx && (flags & HTS_IDX_SAVE_REMOTE))
    {
        int ret = idx_test_and_fetch(fnidx, &local_fn, &local_len, 1);
        if (ret == 0) {
            local_fnidx = strdup(local_fn);
            if (local_fnidx) {
                local_fnidx[local_len] = '\0';
                fnidx = local_fnidx;
            }
        }
    }

    hts_idx_t *idx = idx_read(fnidx);
    if (!idx && !(flags & HTS_IDX_SILENT_FAIL))
        hts_log_error("Could not load local index file '%s'%s%s", fnidx,
                      errno ? " : " : "", errno ? strerror(errno) : "");


    free(local_fnidx);

    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movl %ecx, %ebp
movq %rdi, %r14
andq $0x0, 0x8(%rsp)
testq %rsi, %rsi
je 0x175ed
movq %rsi, %rbx
movq %r14, %rdi
callq 0xe4f2
movl %eax, %r15d
movq %rbx, %rdi
callq 0xe4f2
orl %eax, %r15d
je 0x17608
testl %eax, %eax
sete %al
testb $0x1, %bpl
sete %cl
orb %al, %cl
jne 0x1765c
leaq 0x8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x176d3
testl %eax, %eax
jne 0x1765c
movq 0x8(%rsp), %rdi
callq 0x4930
testq %rax, %rax
je 0x1765c
movq %rax, %r14
movslq 0x10(%rsp), %rax
movb $0x0, (%r14,%rax)
movq %r14, %rbx
jmp 0x1765f
movq %r14, %rdi
movl %edx, %esi
movl %ebp, %edx
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x173b9
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
callq 0x4420
testl %eax, %eax
jne 0x1765c
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x4420
testl %eax, %eax
jne 0x1765c
movq 0x68(%rsp), %rax
cmpq 0xf8(%rsp), %rax
jge 0x1765c
leaq 0x61335(%rip), %rsi     # 0x78978
leaq 0x6133c(%rip), %rdx     # 0x78986
xorl %r14d, %r14d
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x110c6
jmp 0x1765f
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x17c67
movq %rax, %r15
testb $0x2, %bpl
jne 0x176b8
testq %r15, %r15
jne 0x176b8
callq 0x4050
movl (%rax), %edi
leaq 0x606d3(%rip), %r9      # 0x77d56
leaq 0x6087c(%rip), %r12     # 0x77f06
testl %edi, %edi
cmoveq %r9, %r12
je 0x1769a
callq 0x4150
movq %rax, %r9
leaq 0x612d7(%rip), %rsi     # 0x78978
leaq 0x6130d(%rip), %rdx     # 0x789b5
pushq $0x1
popq %rdi
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x110c6
movq %r14, %rdi
callq 0x45c0
movq %r15, %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq