// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/multipart.c
// Function: hopen_htsget_redirect
hFILE *hopen_htsget_redirect(hFILE *hfile, const char *mode)
{
    hFILE_multipart *fp;
    kstring_t s1 = { 0, 0, NULL }, s2 = { 0, 0, NULL };
    char ret;

    fp = (hFILE_multipart *) hfile_init(sizeof (hFILE_multipart), mode, 0);
    if (fp == NULL) return NULL;

    fp->parts = NULL;
    fp->nparts = fp->maxparts = 0;

    ret = parse_ga4gh_redirect_json(fp, hfile, &s1, &s2);
    free(s1.s);
    free(s2.s);
    if (ret != 'v') {
        free_all_parts(fp);
        hfile_destroy((hFILE *) fp);
        errno = (ret == '?' || ret == '\0')? EPROTO : EINVAL;
        return NULL;
    }

    fp->current = 0;
    fp->currentfp = NULL;
    fp->base.backend = &multipart_backend;
    return &fp->base;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %r15d, %r15d
movq %r15, 0x60(%rsp)
movq %r15, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movl $0x60, %edi
xorl %edx, %edx
callq 0xee3c
testq %rax, %rax
je 0x1ff03
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rax)
movq $0x0, 0x48(%rax)
leaq 0x90(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r13, %rdi
callq 0x364be
cmpb $0x7b, %al
movq %rbx, %r15
jne 0x1fe79
movq %r15, %rax
addq $0x38, %rax
movq %rax, 0xa0(%rsp)
leaq 0x50(%rsp), %rbp
movl %eax, 0x4c(%rsp)
movq %r15, 0x40(%rsp)
movq %r13, 0x78(%rsp)
movq %r13, %rdi
leaq 0x90(%rsp), %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7d, %al
je 0x1fe82
movb $0x3f, %bl
cmpb $0x73, 0x90(%rsp)
jne 0x1fea6
movq 0x98(%rsp), %rdi
leaq 0x793d6(%rip), %rsi     # 0x98d83
callq 0x46c0
testl %eax, %eax
jne 0x1fea6
movq %r13, %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7b, %al
jne 0x1fe58
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7d, %al
jne 0x1f9ef
movb $0x76, %r12b
jmp 0x1fe5d
movb $0x3f, %r12b
cmpb $0x73, 0x10(%rsp)
jne 0x1fe5d
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
leaq 0x7a396(%rip), %rsi     # 0x99da2
callq 0x46c0
testl %eax, %eax
je 0x1fa43
movq %rbx, %rdi
leaq 0x784fa(%rip), %rsi     # 0x97f19
callq 0x46c0
movq %r13, %rdi
testl %eax, %eax
je 0x1fe0b
xorl %esi, %esi
callq 0x36d24
cmpb $0x76, %al
je 0x1fe3b
jmp 0x1fe5d
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x5b, %al
jne 0x1fe58
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x5d, %al
je 0x1fe3b
movq 0x40(%r15), %rdi
movq 0x48(%r15), %rsi
incq %rdi
cmpq %rsi, %rdi
jbe 0x1faac
leaq 0x7a31d(%rip), %rax     # 0x99da7
movq %rax, (%rsp)
movl $0x8, %edx
movl $0x10, %ecx
xorl %r8d, %r8d
movq 0xa0(%rsp), %r9
callq 0x1c440
movq %rax, 0x48(%r15)
movq 0x38(%r15), %rbx
movq 0x40(%r15), %r14
leaq 0x1(%r14), %rax
movq %rax, 0x40(%r15)
shlq $0x4, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rbx,%r14)
movb 0x10(%rsp), %r12b
cmpb $0x7b, %r12b
jne 0x1fb13
leaq (%rbx,%r14), %rax
movq %rax, 0x70(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7d, %al
jne 0x1fb1a
movq 0x70(%rsp), %rax
cmpq $0x0, (%rax)
setne %bl
movzbl 0xf(%rsp), %r12d
movl $0x69, %eax
cmovel %eax, %r12d
jmp 0x1fdf7
xorl %ebx, %ebx
jmp 0x1fdfc
leaq (%rbx,%r14), %rax
addq $0x8, %rax
movq $0x0, 0x88(%rsp)
xorl %r14d, %r14d
movq %rax, 0x80(%rsp)
movb $0x3f, %r12b
cmpb $0x73, 0x10(%rsp)
jne 0x1fdf5
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
leaq 0x7ec53(%rip), %rsi     # 0x9e7a9
callq 0x46c0
testl %eax, %eax
je 0x1fb87
movq %rbx, %rdi
leaq 0x76a67(%rip), %rsi     # 0x965d0
callq 0x46c0
testl %eax, %eax
je 0x1fbd6
xorl %ebx, %ebx
movq %r13, %rdi
xorl %esi, %esi
callq 0x36d24
cmpb $0x76, %al
je 0x1fbbb
jmp 0x1fdf7
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x73, %al
jne 0x1fdf0
movq 0x60(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x70(%rsp), %rcx
movq %rax, (%rcx)
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7d, %al
jne 0x1fb39
jmp 0x1faf3
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7b, %al
jne 0x1fdf0
movq %r13, %rdi
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0x364be
cmpb $0x7d, %al
je 0x1fbbb
cmpb $0x73, 0x10(%rsp)
jne 0x1fdf5
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x73, %al
jne 0x1fdf0
movq 0x20(%rsp), %rax
subq $-0x4, %rax
jae 0x1fc99
cmpq %rax, 0x28(%rsp)
jae 0x1fc6f
movq %rax, %rcx
shrq %rcx
movabsq $0x3fffffffffffffff, %rdx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rdx, %rax
movl $0x0, %r13d
cmovbeq %rcx, %r13
addq %rax, %r13
movq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x1fca4
movq %rax, 0x30(%rsp)
movq %r13, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rcx
movw $0x203a, (%rcx,%rax)    # imm = 0x203A
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq 0x2(%rax), %rdx
movq %rdx, 0x20(%rsp)
movb $0x0, 0x2(%rcx,%rax)
jmp 0x1fca4
callq 0x4050
movl $0x4b, (%rax)
movq %rbp, %r15
movq 0x18(%rsp), %r13
testq %r13, %r13
je 0x1fd3d
movq %r13, %rdi
callq 0x41d0
movq %rax, %rbp
movq 0x20(%rsp), %rcx
addq %rcx, %rax
addq $0x2, %rax
cmpq %rcx, %rax
jbe 0x1fd4a
cmpq %rax, 0x28(%rsp)
jae 0x1fd13
movq %rax, %rcx
shrq %rcx
movabsq $0x3fffffffffffffff, %rdx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rdx, %rax
movl $0x0, %ebx
cmovbeq %rcx, %rbx
addq %rax, %rbx
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x4840
testq %rax, %rax
je 0x1fd55
movq %rax, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
movq 0x30(%rsp), %rdi
addq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x43c0
addq 0x20(%rsp), %rbp
movq %rbp, 0x20(%rsp)
movq 0x30(%rsp), %rax
movb $0x0, (%rax,%rbp)
jmp 0x1fd55
callq 0x4050
movl $0xe, (%rax)
jmp 0x1fd55
callq 0x4050
movl $0x4b, (%rax)
leaq 0x2(%r14), %rdi
movq 0x88(%rsp), %rsi
cmpq %rsi, %rdi
jbe 0x1fda0
leaq 0x7a03a(%rip), %rax     # 0x99da7
movq %rax, (%rsp)
movl $0x8, %edx
movl $0x8, %ecx
xorl %r8d, %r8d
movq 0x80(%rsp), %rbx
movq %rbx, %r9
callq 0x1c440
movq %rax, 0x88(%rsp)
movq 0x78(%rsp), %r13
movq %r15, %rbp
jmp 0x1fdb0
movq 0x78(%rsp), %r13
movq %r15, %rbp
movq 0x80(%rsp), %rbx
movq 0x30(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %edx, %edx
movq %rdx, 0x30(%rsp)
movq (%rbx), %rcx
movq %rax, (%rcx,%r14,8)
movq (%rbx), %rax
movq %rdx, 0x8(%rax,%r14,8)
movq %r13, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0x364be
incq %r14
jmp 0x1fbfc
movb 0x10(%rsp), %r12b
xorl %ebx, %ebx
movq 0x40(%rsp), %r15
movb %r12b, 0xf(%rsp)
testb %bl, %bl
jne 0x1fa5b
jmp 0x1fe5d
leaq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x73, %al
jne 0x1fe58
movq 0x18(%rsp), %rcx
movl $0x5, %edi
leaq 0x79f7a(%rip), %rsi     # 0x99da7
leaq 0x79f89(%rip), %rdx     # 0x99dbd
xorl %eax, %eax
callq 0x14378
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x364be
cmpb $0x7d, %al
jne 0x1f9ef
jmp 0x1f9e7
movb 0x10(%rsp), %r12b
movzbl 0x4c(%rsp), %eax
movzbl %r12b, %ebx
cmpb $0x76, %r12b
cmovel %eax, %ebx
movl %ebx, 0x4c(%rsp)
je 0x1f973
jmp 0x1fea6
movb 0x90(%rsp), %bl
jmp 0x1fea6
leaq 0x90(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %r13, %rdi
callq 0x364be
testb %al, %al
movl $0x76, %eax
movl $0x3f, %ebx
cmovel %eax, %ebx
movq 0x60(%rsp), %rdi
callq 0x45c0
movq 0x30(%rsp), %rdi
callq 0x45c0
cmpb $0x76, %bl
jne 0x1fed4
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r15)
leaq 0x98a32(%rip), %rax     # 0xb8900
movq %rax, 0x20(%r15)
jmp 0x1ff03
movq %r15, %rdi
callq 0x1ff18
movq %r15, %rdi
callq 0xef0b
testb %bl, %bl
movl $0x47, %eax
movl $0x16, %ebp
cmovel %eax, %ebp
cmpb $0x3f, %bl
cmovel %eax, %ebp
callq 0x4050
movl %ebp, (%rax)
xorl %r15d, %r15d
movq %r15, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq