// File: /workspace/github_cpp_makefile_star2_O3/Infinidat[P]slimfastq/usrs.cpp
// Function: UsrSave::determine_record()
void UsrSave::determine_record() {

    int q = m_cur;

    rarely_if(m_cur >= m_end) {
        if (not conf.quiet) {
            if (x_lrec->tell())
                fprintf(stderr, "::: HEY all records were oversized\n");
            else
                fprintf(stderr, "::: HEY no records were found");
        }
        return;
    }

    rarely_if(m_buff[q++] != '@')
        croak("first record: Missing prefix '@', is it really a fastq format?");

    int sanity = MAX_ID_LLEN;
    while (--  sanity and m_buff[q] != '\n')
        q ++ ;
    rarely_if( not sanity) {
        // croak("first record: REC is too long");
        g_record_count++;
        get_oversized_record(m_cur, false);
        return determine_record();
    }

    if (m_buff[q++] != '\n')
        croak("first record: Expected newline, got '%c'", m_buff[q-1]);

    int qg = q;
    // LLEN
    for (int i = 1;
         i < MAX_GN_LLEN and not m_llen;
         i++)
        if (m_buff[q + i] == '\n')
            m_llen = i;

    if (not m_llen) {
        // croak("first record: GEN is too long");
        g_record_count++;
        get_oversized_record(m_cur, false);
        return determine_record();
    }

    q += m_llen + 1;
    if (m_buff[q] != '+')
        croak("first record: Missing 2nd prefix '+', is it really a fastq format?");

    // 2ND ID
    bool has_2nd_id = false;
    while (m_buff[++ q ] != '\n')
        if (m_buff[ q ] != ' ' )
            has_2nd_id = true;

    // SOLID
    bool d_solid = false;
    for (int i = 1;
         i < m_llen and not d_solid and not m_solid;
         i ++ )
        switch (m_buff[qg + i] | 0x20) {
        case '0': case '1': case '2': case '3':
            m_solid = true;
            break;

        case 'a': case 'c' : case 'g' : case 't':
            d_solid = true;
            break;

        default:
            // TODO: what if first record is all Ns ?
            // - seek in other records
            break;
        }

    if (m_solid) {
        conf.set_info("usr.solid", m_solid);
        m_llen --;
    }
    conf.set_info("llen", m_llen);
    conf.set_info("usr.2id", has_2nd_id); // TODO
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x124048(%rdi), %eax
cmpl 0x12404c(%rdi), %eax
jge 0x8eab
movabsq $0x100000000, %r14      # imm = 0x100000000
leaq 0x32(%rbx), %r15
leaq 0x838c(%rip), %r12      # 0x111a0
movslq %eax, %rcx
cmpb $0x40, 0x31(%rbx,%rcx)
jne 0x8fc0
movl %ecx, %esi
leaq (%r15,%rcx), %rdx
shlq $0x20, %rcx
addq %r14, %rcx
xorl %r8d, %r8d
cmpl $0x1fff, %r8d           # imm = 0x1FFF
je 0x8e8b
leaq 0x1(%r8), %rdi
addq %r14, %rcx
cmpb $0xa, (%rdx,%r8)
movq %rdi, %r8
jne 0x8e32
movl 0x12405c(%rbx), %edx
sarq $0x20, %rcx
addq %r15, %rcx
xorl %r8d, %r8d
movl %edx, %r9d
testl %r9d, %r9d
jne 0x8e87
xorl %r9d, %r9d
cmpb $0xa, (%rcx,%r8)
jne 0x8e7b
leal 0x1(%r8), %edx
movl %edx, 0x12405c(%rbx)
movl %edx, %r9d
incq %r8
cmpq $0xffff, %r8            # imm = 0xFFFF
jne 0x8e5f
testl %edx, %edx
jne 0x8ebf
incq (%r12)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x938e
movl 0x124048(%rbx), %eax
cmpl 0x12404c(%rbx), %eax
jl 0x8e14
movq %rbx, %rdi
callq 0x309d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leal (%rsi,%rdx), %ecx
addl %edi, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
cmpb $0x2b, 0x31(%rbx,%rcx)
jne 0x8fc5
movl %edx, %ecx
addq %rdi, %rsi
incq %rsi
addl %edx, %eax
addl %edi, %eax
addl $0x2, %eax
cltq
xorl %r14d, %r14d
movzbl 0x32(%rbx,%rax), %edi
incq %rax
cmpl $0x20, %edi
je 0x8ee9
cmpl $0xa, %edi
je 0x8f03
movl $0x1, %r14d
jmp 0x8ee9
movb 0x124064(%rbx), %al
cmpl $0x2, %edx
jl 0x8f60
movslq %esi, %rdx
addq %rbx, %rdx
movl $0x32, %edi
movl $0x80045, %esi          # imm = 0x80045
testb $0x1, %al
jne 0x8f60
movzbl (%rdx,%rdi), %r8d
orl $0x20, %r8d
leal -0x30(%r8), %r9d
cmpl $0x4, %r9d
jae 0x8f50
movb $0x1, 0x124064(%rbx)
movb $0x1, %al
leaq 0x1(%rdi), %r8
addq $-0x30, %rdi
cmpq %rcx, %rdi
movq %r8, %rdi
jb 0x8f1e
jmp 0x8f60
addl $-0x61, %r8d
cmpl $0x13, %r8d
ja 0x8f3e
btl %r8d, %esi
jae 0x8f3e
testb $0x1, %al
je 0x8f8a
leaq 0xa3b5(%rip), %rdi      # 0x13320
leaq 0x2f2d(%rip), %rsi      # 0xbe9f
movl $0x1, %edx
callq 0x490a
movl 0x12405c(%rbx), %ecx
decl %ecx
movl %ecx, 0x12405c(%rbx)
movslq %ecx, %rdx
leaq 0xa38c(%rip), %rbx      # 0x13320
leaq 0x331b(%rip), %rsi      # 0xc2b6
movq %rbx, %rdi
callq 0x490a
leaq 0x3311(%rip), %rsi      # 0xc2bb
movq %rbx, %rdi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x490a
callq 0x307f
callq 0x308e