// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
movq %rdi, %rbx
leaq 0x32(%rdi), %r14
leaq 0x7e23(%rip), %r15      # 0x101a0
movl 0x124048(%rbx), %esi
cmpl 0x12404c(%rbx), %esi
jge 0x8513
movslq %esi, %rcx
cmpb $0x40, 0x31(%rbx,%rcx)
jne 0x8521
movq %rcx, %rax
addq %r14, %rax
leal 0x1(%rsi), %r8d
xorl %edi, %edi
cmpl $0x1fff, %edi           # imm = 0x1FFF
je 0x83fc
leaq 0x1(%rdi), %rdx
incl %r8d
cmpb $0xa, (%rax,%rdi)
movq %rdx, %rdi
jne 0x83a9
movl 0x12405c(%rbx), %edi
movslq %r8d, %rax
addq %r14, %rax
xorl %r8d, %r8d
testl %edi, %edi
jne 0x83f1
cmpb $0xa, (%rax,%r8)
jne 0x83e5
leal 0x1(%r8), %edi
movl %edi, 0x12405c(%rbx)
incq %r8
cmpq $0xffff, %r8            # imm = 0xFFFF
jne 0x83d0
movl 0x12405c(%rbx), %eax
testq %rax, %rax
jne 0x840e
incq (%r15)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x88f0
jmp 0x837d
addl %eax, %ecx
addl %edx, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
cmpb $0x2b, 0x31(%rbx,%rcx)
jne 0x8526
leaq (%rsi,%rdx), %rdi
incq %rdi
leal (%rsi,%rax), %ecx
addl %edx, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
xorl %r14d, %r14d
movzbl 0x32(%rbx,%rcx), %edx
incq %rcx
cmpl $0x20, %edx
je 0x8438
cmpl $0xa, %edx
je 0x8452
movl $0x1, %r14d
jmp 0x8438
cmpl $0x2, %eax
jl 0x84b8
movb 0x124064(%rbx), %cl
movslq %edi, %rdx
addq %rbx, %rdx
addq $0x32, %rdx
decq %rax
xorl %esi, %esi
movl $0x80045, %edi          # imm = 0x80045
xorl %r8d, %r8d
testb $0x1, %r8b
jne 0x84b8
testb $0x1, %cl
jne 0x84b8
movzbl (%rdx,%rsi), %r9d
orl $0x20, %r9d
leal -0x61(%r9), %r10d
cmpl $0x13, %r10d
jbe 0x84a7
addl $-0x30, %r9d
cmpl $0x4, %r9d
jae 0x84b0
movb $0x1, 0x124064(%rbx)
movb $0x1, %cl
jmp 0x84b0
btl %r10d, %edi
jae 0x8492
movb $0x1, %r8b
incq %rsi
cmpq %rsi, %rax
jne 0x8474
cmpb $0x0, 0x124064(%rbx)
je 0x84df
leaq 0x9e58(%rip), %rdi      # 0x12320
leaq 0x2962(%rip), %rsi      # 0xae31
movl $0x1, %edx
callq 0x3d22
decl 0x12405c(%rbx)
movslq 0x12405c(%rbx), %rdx
leaq 0x9e33(%rip), %rbx      # 0x12320
leaq 0x2d82(%rip), %rsi      # 0xb276
movq %rbx, %rdi
callq 0x3d22
leaq 0x2d78(%rip), %rsi      # 0xb27b
movq %rbx, %rdi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x3d22
movq %rbx, %rdi
callq 0x2a20
popq %rbx
popq %r14
popq %r15
retq
callq 0x2a6c
callq 0x2a7b
nop