// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_parse_decimal
long long hts_parse_decimal(const char *str, char **strend, int flags)
{
    unsigned long long n = 0;
    int digits = 0, decimals = 0, e = 0, lost = 0;
    char sign = '+', esign = '+';
    const char *s, *str_orig = str;

    while (isspace_c(*str)) str++;
    s = str;

    if (*s == '+' || *s == '-') sign = *s++;
    while (*s)
        if (isdigit_c(*s)) digits++, n = push_digit(n, *s++);
        else if (*s == ',' && (flags & HTS_PARSE_THOUSANDS_SEP)) s++;
        else break;

    if (*s == '.') {
        s++;
        while (isdigit_c(*s)) decimals++, digits++, n = push_digit(n, *s++);
    }

    switch (*s) {
    case 'e': case 'E':
        s++;
        if (*s == '+' || *s == '-') esign = *s++;
        while (isdigit_c(*s)) e = push_digit(e, *s++);
        if (esign == '-') e = -e;
        break;

    case 'k': case 'K': e += 3; s++; break;
    case 'm': case 'M': e += 6; s++; break;
    case 'g': case 'G': e += 9; s++; break;
    }

    e -= decimals;
    while (e > 0) n *= 10, e--;
    while (e < 0) lost += n % 10, n /= 10, e++;

    if (lost > 0) {
        hts_log_warning("Discarding fractional part of %.*s", (int)(s - str), str);
    }

    if (strend) {
        // Set to the original input str pointer if not valid number syntax
        *strend = (digits > 0)? (char *)s : (char *)str_orig;
    } else if (digits == 0) {
        hts_log_warning("Invalid numeric value %.8s[truncated]", str);
    } else if (*s) {
        if ((flags & HTS_PARSE_THOUSANDS_SEP) || (!(flags & HTS_PARSE_THOUSANDS_SEP) && *s != ','))
            hts_log_warning("Ignoring unknown characters after %.*s[%s]", (int)(s - str), str, s);
    }

    return (sign == '+')? n : -n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, 0x10(%rsp)
movq %rdi, %r15
callq 0x4510
movq (%rax), %rax
leal -0x1(%r15), %ebx
movq %r15, %r13
movb (%r13), %dl
movzbl %dl, %ecx
incq %r13
incl %ebx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x1994e
leaq -0x1(%r13), %r11
cmpl $0x2b, %ecx
je 0x1996f
cmpl $0x2d, %ecx
jne 0x1997c
cmpb $0x2b, %dl
sete %r10b
movb (%r13), %dl
jmp 0x19982
movb $0x1, %r10b
movq %r11, %r13
testb %dl, %dl
je 0x199d2
incq %r13
xorl %r14d, %r14d
xorl %r12d, %r12d
movzbl %dl, %ecx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x199ad
testb $0x1, %bpl
je 0x19abf
cmpb $0x2c, %dl
je 0x199c0
jmp 0x19abf
incl %r14d
movsbq %dl, %rcx
leaq (%r12,%r12,4), %rdx
leaq (%rcx,%rdx,2), %r12
addq $-0x30, %r12
movb (%r13), %dl
incq %r13
testb %dl, %dl
jne 0x1998f
decq %r13
xorl %esi, %esi
jmp 0x199da
xorl %esi, %esi
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %ecx, %ecx
movl %ecx, %eax
subl %esi, %eax
jle 0x199f4
incl %eax
addq %r12, %r12
leaq (%r12,%r12,4), %r12
decl %eax
cmpl $0x1, %eax
ja 0x199e4
jmp 0x19a5d
jns 0x19a5d
subl %ecx, %esi
xorl %edi, %edi
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
movq %r12, %rcx
movq %r12, %rax
mulq %r8
movq %rdx, %r12
shrq $0x3, %r12
leal (%r12,%r12), %eax
leal (%rax,%rax,4), %eax
subl %eax, %ecx
addl %ecx, %edi
decl %esi
jne 0x19a04
testl %edi, %edi
jle 0x19a5d
movl %r13d, %ecx
subl %ebx, %ecx
leaq 0x7cc40(%rip), %rsi     # 0x96673
leaq 0x7cc4b(%rip), %rdx     # 0x96685
movl $0x3, %edi
movq %r11, %r8
movq %r11, 0x8(%rsp)
xorl %eax, %eax
movb %r10b, 0x7(%rsp)
callq 0x13de5
movq 0x8(%rsp), %r11
movb 0x7(%rsp), %r10b
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x19a76
testl %r14d, %r14d
cmovgq %r13, %r15
movq %r15, (%rax)
jmp 0x19b1d
testl %r14d, %r14d
je 0x19afa
movb (%r13), %al
testb %al, %al
je 0x19b1d
testb $0x1, %bpl
jne 0x19a95
cmpb $0x2c, %al
je 0x19b1d
movl %r13d, %ecx
subl %ebx, %ecx
leaq 0x7cbd2(%rip), %rsi     # 0x96673
leaq 0x7cc26(%rip), %rdx     # 0x966ce
movq %r11, %r8
movl $0x3, %edi
movq %r13, %r9
xorl %eax, %eax
movl %r10d, %ebx
callq 0x13de5
jmp 0x19b1a
xorl %ecx, %ecx
cmpb $0x2e, %dl
jne 0x19b39
movzbl (%r13), %edx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x19b3c
xorl %esi, %esi
incl %esi
movsbq %dl, %rdx
leaq (%r12,%r12,4), %rdi
leaq (%rdx,%rdi,2), %r12
addq $-0x30, %r12
movzbl 0x1(%r13), %edx
incq %r13
testb $0x8, 0x1(%rax,%rdx,2)
jne 0x19ad4
addl %esi, %r14d
jmp 0x19b3e
leaq 0x7cb72(%rip), %rsi     # 0x96673
leaq 0x7cba0(%rip), %rdx     # 0x966a8
movq %r11, %rcx
movl $0x3, %edi
xorl %eax, %eax
movl %r10d, %ebx
callq 0x13de5
movl %ebx, %r10d
movq %r12, %rax
negq %rax
testb %r10b, %r10b
cmovneq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decq %r13
xorl %esi, %esi
movzbl %dl, %edx
leal -0x45(%rdx), %edi
cmpl $0x8, %edi
jbe 0x19b65
addl $-0x65, %edx
cmpl $0x8, %edx
ja 0x199dc
leaq 0x7bdc8(%rip), %rdi     # 0x95924
movslq (%rdi,%rdx,4), %rdx
addq %rdi, %rdx
jmpq *%rdx
leaq 0x7bd94(%rip), %rdx     # 0x95900
movslq (%rdx,%rdi,4), %rdi
addq %rdx, %rdi
jmpq *%rdi
movzbl 0x1(%r13), %ecx
cmpl $0x2d, %ecx
je 0x19b84
cmpl $0x2b, %ecx
jne 0x19bbc
leaq 0x2(%r13), %rdx
cmpb $0x2d, %cl
sete %dil
movb 0x2(%r13), %cl
jmp 0x19bc4
incq %r13
movl $0x6, %ecx
jmp 0x199dc
incq %r13
movl $0x3, %ecx
jmp 0x199dc
incq %r13
movl $0x9, %ecx
jmp 0x199dc
incq %r13
xorl %edi, %edi
movq %r13, %rdx
movzbl %cl, %r9d
xorl %r8d, %r8d
testb $0x8, 0x1(%rax,%r9,2)
je 0x19bf3
xorl %r8d, %r8d
movsbl %cl, %ecx
leal (%r8,%r8,4), %r8d
leal (%rcx,%r8,2), %r8d
addl $-0x30, %r8d
movzbl 0x1(%rdx), %ecx
incq %rdx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x19bd6
movl %r8d, %ecx
negl %ecx
testb %dil, %dil
cmovel %r8d, %ecx
movq %rdx, %r13
jmp 0x199dc