// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rsi, %rdx
movq %rdi, %r13
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq -0x7182b(%rip), %rsi    # 0xf065
callq 0x9e08
testl %eax, %eax
js 0x80a1e
movq 0x10(%rsp), %rcx
leaq 0x2(%rcx), %rax
cmpq %rax, 0x18(%rsp)
jae 0x808ee
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %r14
shrq %r14
xorl %r15d, %r15d
testq %rcx, %rcx
cmovneq %r15, %r14
addq %rax, %r14
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x80a21
movq %rax, 0x20(%rsp)
movq %r14, 0x18(%rsp)
movq 0x10(%rsp), %rcx
jmp 0x808f3
movq 0x20(%rsp), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rsp)
xorl %r14d, %r14d
movb %r14b, (%rax,%rcx)
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movb %r14b, (%rcx,%rax)
movq 0x20(%rsp), %rbp
movb (%rbp), %r15b
testb %r15b, %r15b
je 0x80957
movq %r13, 0x8(%rsp)
callq 0x4510
movq (%rax), %rax
movl $0x16, %r12d
xorl %edx, %edx
xorl %r13d, %r13d
movzbl %r15b, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x8095e
movb 0x1(%rbp,%r13), %r15b
incq %r13
decq %r12
testb %r15b, %r15b
jne 0x80937
jmp 0x80a35
xorl %edx, %edx
jmp 0x80a3a
callq 0x4510
movq (%rax), %rax
movq %rbp, %rdx
addq %r13, %rdx
movq %rdx, %rbx
movzbl %r15b, %ecx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x80986
movb 0x1(%rbx), %r15b
incq %rbx
testb %r15b, %r15b
jne 0x8096f
cmpq %rdx, %rbx
jbe 0x80a33
movq %rdx, 0x30(%rsp)
movl $0x24, %edi
callq 0x4680
testq %rax, %rax
je 0x80a1e
movq %rax, %r15
movups 0x2098a(%rip), %xmm0    # 0xa1337
movups %xmm0, (%rax)
movabsq $0x2072657261654220, %rax # imm = 0x2072657261654220
movq %rax, 0xe(%r15)
movb $0x0, 0x16(%r15)
movq %rbx, %rdx
subq %rbp, %rdx
subq %r13, %rdx
leaq 0x18(%rdx), %rax
cmpq $0x16, %rax
jbe 0x80a71
cmpq $0x25, %rax
jb 0x80a7e
movq %rax, %rcx
shrq $0x3e, %rcx
shrq %rax
xorl %esi, %esi
testq %rcx, %rcx
cmoveq %rax, %rsi
addq %rbx, %rsi
subq %rbp, %rsi
subq %r13, %rsi
addq $0x18, %rsi
movq %r15, %rdi
movq %rdx, %r13
callq 0x4840
movq %r13, %rdx
testq %rax, %rax
movq 0x8(%rsp), %r13
jne 0x80a86
jmp 0x80a21
xorl %r15d, %r15d
movq 0x20(%rsp), %rdi
callq 0x45c0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x80a57
xorl %edx, %edx
movq 0x8(%rsp), %r13
movq 0x8(%r13), %rdi
movq %rdx, %rbx
callq 0x45c0
movq %rbx, 0x8(%r13)
movq $0x0, 0x10(%r13)
movq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x45c0
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4050
movl $0x4b, (%rax)
jmp 0x80a21
movq %r15, %rax
movq 0x8(%rsp), %r13
leaq 0x16(%rax), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %r15
movq %rdx, 0x28(%rsp)
callq 0x43c0
movq %r15, %rdx
addq %r15, %rbx
subq %rbp, %rbx
movb $0x0, (%rbx,%r12)
cmpl $0x0, 0x28(%rsp)
js 0x80a21
jmp 0x80a3a