// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movabsq $0x100000000, %r14      # imm = 0x100000000
leaq 0x32(%rdi), %r15
leaq 0x8149(%rip), %r12      # 0xf1d0
pushq $0x1
popq %r13
movl 0x124048(%rbx), %esi
cmpl 0x12404c(%rbx), %esi
jge 0x722b
movslq %esi, %rdx
cmpb $0x40, 0x31(%rbx,%rdx)
jne 0x7242
leaq (%r15,%rdx), %rax
shlq $0x20, %rdx
addq %r14, %rdx
xorl %edi, %edi
cmpl $0x1fff, %edi           # imm = 0x1FFF
je 0x7110
leaq 0x1(%rdi), %rcx
addq %r14, %rdx
cmpb $0xa, (%rax,%rdi)
movq %rcx, %rdi
jne 0x70b8
movl 0x12405c(%rbx), %eax
sarq $0x20, %rdx
addq %r15, %rdx
movq %r13, %rdi
movl %eax, %r8d
cmpq $0xffff, %rdi           # imm = 0xFFFF
ja 0x710c
testl %r8d, %r8d
jne 0x710c
xorl %r8d, %r8d
cmpb $0xa, (%rdx)
jne 0x7104
movl %edi, 0x12405c(%rbx)
movl %edi, %eax
movl %edi, %r8d
incq %rdi
incq %rdx
jmp 0x70e3
testl %eax, %eax
jne 0x7123
incq (%r12)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7648
jmp 0x708b
leal (%rax,%rsi), %edx
addl %ecx, %edx
addl $0x2, %edx
movslq %edx, %rdx
cmpb $0x2b, 0x31(%rbx,%rdx)
jne 0x7291
leaq (%rsi,%rcx), %rdi
incq %rdi
leal (%rax,%rsi), %edx
addl %edx, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
xorl %r14d, %r14d
pushq $0x1
popq %rdx
movzbl 0x32(%rbx,%rcx), %esi
incq %rcx
cmpl $0x20, %esi
je 0x7151
cmpl $0xa, %esi
je 0x7168
movq %rdx, %r14
jmp 0x7151
movb 0x124064(%rbx), %cl
movslq %eax, %rdx
movslq %edi, %rax
addq %rbx, %rax
pushq $0x32
popq %rsi
xorl %r8d, %r8d
movl $0x80045, %edi          # imm = 0x80045
leaq -0x31(%rsi), %r9
cmpq %rdx, %r9
jge 0x71cf
testb $0x1, %r8b
jne 0x71cf
testb $0x1, %cl
jne 0x71d4
movzbl (%rax,%rsi), %r8d
orl $0x20, %r8d
leal -0x61(%r8), %r9d
cmpl $0x13, %r9d
jbe 0x71c1
addl $-0x30, %r8d
cmpl $0x4, %r8d
jae 0x71bc
movb $0x1, 0x124064(%rbx)
movb $0x1, %cl
xorl %r8d, %r8d
jmp 0x71ca
btl %r9d, %edi
jae 0x71a9
movb $0x1, %r8b
incq %rsi
jmp 0x7182
testb $0x1, %cl
je 0x71fa
leaq 0xa175(%rip), %rdi      # 0x11350
leaq 0x2c2d(%rip), %rsi      # 0x9e0f
pushq $0x1
popq %rdx
callq 0x309e
movslq 0x12405c(%rbx), %rdx
decq %rdx
movl %edx, 0x12405c(%rbx)
leaq 0xa14f(%rip), %rbx      # 0x11350
leaq 0x302e(%rip), %rsi      # 0xa236
movq %rbx, %rdi
callq 0x309e
leaq 0x3024(%rip), %rsi      # 0xa23b
movq %rbx, %rdi
movq %r14, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x309e
leaq 0xa11e(%rip), %rax      # 0x11350
cmpb $0x0, 0xe(%rax)
je 0x7250
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x2f6b(%rip), %rdi      # 0xa1b4
xorl %eax, %eax
callq 0x2350
movq 0x124098(%rbx), %rdi
callq 0x8890
movq 0x7d6d(%rip), %rcx      # 0xefd0
movq (%rcx), %rcx
testq %rax, %rax
jne 0x7276
leaq 0x2f24(%rip), %rdi      # 0xa196
pushq $0x1d
jmp 0x727f
leaq 0x2ef5(%rip), %rdi      # 0xa172
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2330
leaq 0x2f5b(%rip), %rdi      # 0xa1f3
jmp 0x7249