// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile_libcurl.c
// Function: read_auth_plain
static int read_auth_plain(auth_token *tok, hFILE *auth_fp) {
    kstring_t line = {0, 0, NULL};
    kstring_t token = {0, 0, NULL};
    const char *start, *end;

    if (kgetline(&line, (char * (*)(char *, int, void *)) hgets, auth_fp) < 0) goto error;
    if (kputc('\0', &line) < 0) goto error;

    for (start = line.s; *start && isspace_c(*start); start++) {}
    for (end = start; *end && !isspace_c(*end); end++) {}

    if (end > start) {
        if (kputs("Authorization: Bearer ", &token) < 0) goto error;
        if (kputsn(start, end - start, &token) < 0) goto error;
    }

    free(tok->token);
    tok->token = ks_release(&token);
    tok->expiry = 0;
    free(line.s);
    return 0;

 error:
    free(line.s);
    free(token.s);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rdx
movq %rdi, %rbp
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq -0x73bcc(%rip), %rsi    # 0xf209
callq 0x9e4b
testl %eax, %eax
js 0x82ee8
movq (%rsp), %rax
addq $0x2, %rax
cmpq %rax, 0x8(%rsp)
jae 0x82e2b
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %r14
shrq %r14
xorl %r13d, %r13d
testq %rcx, %rcx
cmovneq %r13, %r14
addq %rax, %r14
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x82f7b
movq %rax, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rsp)
xorl %edx, %edx
movb %dl, (%rcx,%rax)
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movb %dl, (%rcx,%rax)
movq 0x10(%rsp), %r14
movb (%r14), %bl
testb %bl, %bl
je 0x82e76
callq 0x4510
movq (%rax), %rax
movzbl %bl, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x82e76
movb 0x1(%r14), %bl
incq %r14
testb %bl, %bl
jne 0x82e61
movb (%r14), %bl
movq %r14, %r12
testb %bl, %bl
je 0x82ea1
callq 0x4510
movq (%rax), %rax
movq %r14, %r12
movzbl %bl, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x82ea1
movb 0x1(%r12), %bl
incq %r12
testb %bl, %bl
jne 0x82e8b
xorl %r15d, %r15d
subq %r14, %r12
jbe 0x82ef0
movq %rbp, 0x20(%rsp)
movl $0x24, %ebx
movl $0x24, %edi
callq 0x4680
testq %rax, %rax
je 0x82ef8
movups 0x20cde(%rip), %xmm0    # 0xa3ba7
movups %xmm0, (%rax)
movabsq $0x2072657261654220, %rcx # imm = 0x2072657261654220
movq %rcx, 0xe(%rax)
movb $0x0, 0x16(%rax)
movl $0x16, %ebp
movq %rax, %r13
jmp 0x82eff
xorl %r13d, %r13d
jmp 0x82f7b
xorl %r13d, %r13d
jmp 0x82f8d
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %r13d, %r13d
testq %rax, %rax
je 0x82f7b
leaq (%r12,%rbp), %rax
addq $0x2, %rax
cmpq %rbp, %rax
jbe 0x82f41
cmpq %rax, %rbx
jae 0x82f51
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %esi, %esi
testq %rcx, %rcx
cmoveq %rdx, %rsi
addq %rax, %rsi
movq %r13, %rdi
callq 0x4840
movq %rax, %rbx
testq %rax, %rax
jne 0x82f54
jmp 0x82f4c
callq 0x4050
movl $0x4b, (%rax)
movb $0x1, %r12b
jmp 0x82f71
movq %r13, %rbx
leaq (%rbx,%rbp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, %rbp
movb $0x0, (%rbx,%rbp)
shrl $0x1f, %r12d
movq %rbx, %r13
testb %r12b, %r12b
movq 0x20(%rsp), %rbp
je 0x82f8d
movq 0x10(%rsp), %rdi
callq 0x45c0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x82fa7
movq 0x8(%rbp), %rdi
callq 0x45c0
movq %r13, 0x8(%rbp)
movq $0x0, 0x10(%rbp)
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x45c0
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq