// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/header.c
// Function: sam_hrecs_parse_lines
static int sam_hrecs_parse_lines(sam_hrecs_t *hrecs, const char *hdr, size_t len) {
    size_t i, lno;

    if (!hrecs || len > SSIZE_MAX)
        return -1;

    if (!len)
        len = strlen(hdr);

    if (len < 3) {
        if (len == 0 || *hdr == '\0') return 0;
        sam_hrecs_error("Header line too short", hdr, len, 1);
        return -1;
    }

    for (i = 0, lno = 1; i < len - 3 && hdr[i] != '\0'; i++, lno++) {
        khint32_t type;
        khint_t k;

        int l_start = i, new;
        sam_hrec_type_t *h_type;
        sam_hrec_tag_t *h_tag, *last;

        if (hdr[i] != '@') {
            sam_hrecs_error("Header line does not start with '@'",
                          &hdr[l_start], len - l_start, lno);
            return -1;
        }

        if (!isalpha_c(hdr[i+1]) || !isalpha_c(hdr[i+2])) {
            sam_hrecs_error("Header line does not have a two character key",
                          &hdr[l_start], len - l_start, lno);
            return -1;
        }
        type = TYPEKEY(&hdr[i+1]);

        i += 3;
        if (i == len || hdr[i] == '\n')
            continue;

        // Add the header line type
        if (!(h_type = pool_alloc(hrecs->type_pool)))
            return -1;
        k = kh_put(sam_hrecs_t, hrecs->h, type, &new);
        if (new < 0)
            return -1;

        h_type->type = type;

        // Add to end of global list
        sam_hrecs_global_list_add(hrecs, h_type, NULL);

        // Form the ring, either with self or other lines of this type
        if (!new) {
            sam_hrec_type_t *t = kh_val(hrecs->h, k), *p;
            p = t->prev;

            assert(p->next == t);
            p->next = h_type;
            h_type->prev = p;

            t->prev = h_type;
            h_type->next = t;
        } else {
            kh_val(hrecs->h, k) = h_type;
            h_type->prev = h_type->next = h_type;
        }

        // Parse the tags on this line
        last = NULL;
        if (type == TYPEKEY("CO")) {
            size_t j;

            if (i == len || hdr[i] != '\t') {
                sam_hrecs_error("Missing tab",
                              &hdr[l_start], len - l_start, lno);
                return -1;
            }

            for (j = ++i; j < len && hdr[j] != '\0' && hdr[j] != '\n'; j++)
                ;

            if (!(h_type->tag = h_tag = pool_alloc(hrecs->tag_pool)))
                return -1;
            h_tag->str = string_ndup(hrecs->str_pool, &hdr[i], j-i);
            h_tag->len = j-i;
            h_tag->next = NULL;
            if (!h_tag->str)
                return -1;

            i = j;

        } else {
            do {
                size_t j;

                if (i == len || hdr[i] != '\t') {
                    sam_hrecs_error("Missing tab",
                                  &hdr[l_start], len - l_start, lno);
                    return -1;
                }

                for (j = ++i; j < len && hdr[j] != '\0' && hdr[j] != '\n' && hdr[j] != '\t'; j++)
                    ;

                if (j - i < 3 || hdr[i + 2] != ':') {
                    sam_hrecs_error("Malformed key:value pair",
                                   &hdr[l_start], len - l_start, lno);
                    return -1;
                }

                if (!(h_tag = pool_alloc(hrecs->tag_pool)))
                    return -1;
                h_tag->str = string_ndup(hrecs->str_pool, &hdr[i], j-i);
                h_tag->len = j-i;
                h_tag->next = NULL;
                if (!h_tag->str)
                    return -1;

                if (last)
                    last->next = h_tag;
                else
                    h_type->tag = h_tag;

                last = h_tag;
                i = j;
            } while (i < len && hdr[i] != '\0' && hdr[i] != '\n');
        }

        /* Update RG/SQ hashes */
        if (-1 == sam_hrecs_update_hashes(hrecs, type, h_type))
            return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xd7cee
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, -0x20(%rbp)
jbe 0xd7cfa
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
cmpq $0x0, -0x20(%rbp)
jne 0xd7d0e
movq -0x18(%rbp), %rdi
callq 0x41b0
movq %rax, -0x20(%rbp)
cmpq $0x3, -0x20(%rbp)
jae 0xd7d59
cmpq $0x0, -0x20(%rbp)
je 0xd7d28
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xd7d34
movl $0x0, -0x4(%rbp)
jmp 0xd8390
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0x20770(%rip), %rdi     # 0xf84b3
movl $0x1, %ecx
callq 0xdeaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq $0x0, -0x28(%rbp)
movq $0x1, -0x30(%rbp)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rdx
subq $0x3, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x79(%rbp)
jae 0xd7d94
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0xd7da0
jmp 0xd8389
movq -0x28(%rbp), %rax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x40, %eax
je 0xd7dea
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x20(%rbp), %rdx
movslq -0x3c(%rbp), %rax
subq %rax, %rdx
movq -0x30(%rbp), %rcx
leaq 0x206f0(%rip), %rdi     # 0xf84c9
callq 0xdeaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %edi
callq 0xdeb40
cmpl $0x0, %eax
je 0xd7e18
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl 0x2(%rax,%rcx), %edi
callq 0xdeb40
cmpl $0x0, %eax
jne 0xd7e4a
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x20(%rbp), %rdx
movslq -0x3c(%rbp), %rax
subq %rax, %rdx
movq -0x30(%rbp), %rcx
leaq 0x206b4(%rip), %rdi     # 0xf84ed
callq 0xdeaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
addq $0x1, %rax
addq %rax, %rdi
callq 0xdabd0
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xd7e88
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0xd7e8d
jmp 0xd836c
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x82110
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
jne 0xd7eb0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %esi
leaq -0x40(%rbp), %rdx
callq 0xdeb70
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x40(%rbp)
jge 0xd7ed8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movl -0x34(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xdeec0
cmpl $0x0, -0x40(%rbp)
jne 0xd7f7d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movl -0x38(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
cmpq -0x60(%rbp), %rax
jne 0xd7f2e
jmp 0xd7f4d
leaq 0x205e6(%rip), %rdi     # 0xf851b
leaq 0x2020b(%rip), %rsi     # 0xf8147
movl $0x33f, %edx            # imm = 0x33F
leaq 0x205e0(%rip), %rcx     # 0xf8528
callq 0x42e0
movq -0x48(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
jmp 0xd7fa6
movq -0x48(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movl -0x38(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, -0x58(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x80(%rbp)
leaq 0x1a863(%rip), %rdi     # 0xf281e
callq 0xdabd0
movl %eax, %ecx
movl -0x80(%rbp), %eax
cmpl %ecx, %eax
jne 0xd811c
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xd7fe8
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
je 0xd801a
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x20(%rbp), %rdx
movslq -0x3c(%rbp), %rax
subq %rax, %rdx
movq -0x30(%rbp), %rcx
leaq 0x2055e(%rip), %rdi     # 0xf8567
callq 0xdeaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x81(%rbp)
jae 0xd806d
movq -0x18(%rbp), %rax
movq -0x70(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x81(%rbp)
je 0xd806d
movq -0x18(%rbp), %rax
movq -0x70(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0xd8079
jmp 0xd8089
jmp 0xd807b
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0xd802a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x82110
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rcx
movq %rax, 0x20(%rcx)
cmpq $0x0, %rax
jne 0xd80b4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
addq -0x28(%rbp), %rsi
movq -0x70(%rbp), %rdx
subq -0x28(%rbp), %rdx
callq 0x82650
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x70(%rbp), %rax
subq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x50(%rbp), %rax
movq $0x0, (%rax)
movq -0x50(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xd810f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xd8346
jmp 0xd811e
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xd8139
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
je 0xd816b
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x20(%rbp), %rdx
movslq -0x3c(%rbp), %rax
subq %rax, %rdx
movq -0x30(%rbp), %rcx
leaq 0x2040d(%rip), %rdi     # 0xf8567
callq 0xdeaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x82(%rbp)
jae 0xd81d7
movq -0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x82(%rbp)
je 0xd81d7
movq -0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x82(%rbp)
je 0xd81d7
movq -0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
setne %al
movb %al, -0x82(%rbp)
movb -0x82(%rbp), %al
testb $0x1, %al
jne 0xd81e3
jmp 0xd81f3
jmp 0xd81e5
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0xd817b
movq -0x78(%rbp), %rax
subq -0x28(%rbp), %rax
cmpq $0x3, %rax
jb 0xd8213
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl 0x2(%rax,%rcx), %eax
cmpl $0x3a, %eax
je 0xd8245
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x20(%rbp), %rdx
movslq -0x3c(%rbp), %rax
subq %rax, %rdx
movq -0x30(%rbp), %rcx
leaq 0x2033f(%rip), %rdi     # 0xf8573
callq 0xdeaa0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x82110
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jne 0xd8268
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
addq -0x28(%rbp), %rsi
movq -0x78(%rbp), %rdx
subq -0x28(%rbp), %rdx
callq 0x82650
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x78(%rbp), %rax
subq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x50(%rbp), %rax
movq $0x0, (%rax)
movq -0x50(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xd82c3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
cmpq $0x0, -0x58(%rbp)
je 0xd82d7
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
jmp 0xd82e3
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x83(%rbp)
jae 0xd8336
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x83(%rbp)
je 0xd8336
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x83(%rbp)
movb -0x83(%rbp), %al
testb $0x1, %al
jne 0xd811e
jmp 0xd8346
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %esi
movq -0x48(%rbp), %rdx
callq 0xdb3f0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0xd836a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd8390
jmp 0xd836c
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xd7d69
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)