// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/htslib/hts.c
// Function: hts_parse_decimal
long long hts_parse_decimal(const char *str, char **strend, int flags)
{
    long long n = 0;
    int decimals = 0, e = 0, lost = 0;
    char sign = '+', esign = '+';
    const char *s;

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

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

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

    if (*s == 'E' || *s == 'e') {
        s++;
        if (*s == '+' || *s == '-') esign = *s++;
        while (isdigit_c(*s)) e = push_digit(e, *s++);
        if (esign == '-') e = -e;
    }

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

    if (lost > 0 && hts_verbose >= 3)
        fprintf(stderr, "[W::%s] discarding fractional part of %.*s\n",
                __func__, (int)(s - str), str);

    if (strend) *strend = (char *) s;
    else if (*s && hts_verbose >= 2)
        fprintf(stderr, "[W::%s] ignoring unknown characters after %.*s[%s]\n",
                __func__, (int)(s - str), str, s);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r12
callq 0x4580
movq (%rax), %rax
leal -0x1(%r12), %r13d
movb (%r12), %cl
movzbl %cl, %edx
incq %r12
incl %r13d
testb $0x20, 0x1(%rax,%rdx,2)
jne 0x12dd2
leaq -0x1(%r12), %r8
cmpl $0x2b, %edx
je 0x12df5
cmpl $0x2d, %edx
jne 0x12e02
cmpb $0x2b, %cl
sete %r14b
movb (%r12), %cl
jmp 0x12e08
movb $0x1, %r14b
movq %r8, %r12
testb %cl, %cl
je 0x12e52
incq %r12
xorl %r15d, %r15d
movzbl %cl, %edx
testb $0x8, 0x1(%rax,%rdx,2)
jne 0x12e30
testb $0x1, %bpl
je 0x12ef5
cmpb $0x2c, %cl
je 0x12e40
jmp 0x12ef5
movsbq %cl, %rcx
leaq (%r15,%r15,4), %rdx
leaq (%rcx,%rdx,2), %r15
addq $-0x30, %r15
movb (%r12), %cl
incq %r12
testb %cl, %cl
jne 0x12e12
decq %r12
xorl %esi, %esi
jmp 0x12e57
xorl %esi, %esi
xorl %r15d, %r15d
xorl %edx, %edx
movl %edx, %eax
subl %esi, %eax
jle 0x12e71
incl %eax
addq %r15, %r15
leaq (%r15,%r15,4), %r15
decl %eax
cmpl $0x1, %eax
ja 0x12e61
jmp 0x12ebb
jns 0x12ebb
subl %edx, %esi
xorl %edi, %edi
movabsq $0x6666666666666667, %r9 # imm = 0x6666666666666667
movq %r15, %rcx
movq %r15, %rax
imulq %r9
movq %rdx, %r15
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %r15
addq %rax, %r15
leal (%r15,%r15), %eax
leal (%rax,%rax,4), %eax
subl %eax, %ecx
addl %ecx, %edi
decl %esi
jne 0x12e81
testl %edi, %edi
jle 0x12ebb
cmpl $0x3, 0x4f69b(%rip)     # 0x62550
jge 0x12fdd
testq %rbx, %rbx
je 0x12ec5
movq %r12, (%rbx)
jmp 0x12ed9
cmpb $0x0, (%r12)
je 0x12ed9
cmpl $0x2, 0x4f67d(%rip)     # 0x62550
jge 0x12fb0
movq %r15, %rax
negq %rax
testb %r14b, %r14b
cmovneq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edx, %edx
cmpb $0x2e, %cl
jne 0x12f2e
movzbl (%r12), %ecx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x12f31
xorl %esi, %esi
incl %esi
movsbq %cl, %rcx
leaq (%r15,%r15,4), %rdi
leaq (%rcx,%rdi,2), %r15
addq $-0x30, %r15
movzbl 0x1(%r12), %ecx
incq %r12
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x12f0a
jmp 0x12f33
decq %r12
xorl %esi, %esi
movzbl %cl, %ecx
orl $0x20, %ecx
cmpl $0x65, %ecx
jne 0x12e59
movzbl 0x1(%r12), %edx
cmpl $0x2d, %edx
je 0x12f52
cmpl $0x2b, %edx
jne 0x12f65
leaq 0x2(%r12), %rcx
cmpb $0x2d, %dl
sete %dil
movb 0x2(%r12), %dl
jmp 0x12f6d
incq %r12
xorl %edi, %edi
movq %r12, %rcx
movzbl %dl, %r9d
xorl %r10d, %r10d
testb $0x8, 0x1(%rax,%r9,2)
je 0x12f9c
xorl %r10d, %r10d
movsbl %dl, %edx
leal (%r10,%r10,4), %r9d
leal (%rdx,%r9,2), %r10d
addl $-0x30, %r10d
movzbl 0x1(%rcx), %edx
incq %rcx
testb $0x8, 0x1(%rax,%rdx,2)
jne 0x12f7f
movl %r10d, %edx
negl %edx
testb %dil, %dil
cmovel %r10d, %edx
movq %rcx, %r12
jmp 0x12e59
movq 0x4f011(%rip), %rax     # 0x61fc8
movq (%rax), %rdi
movl %r12d, %ecx
subl %r13d, %ecx
leaq 0x3dff1(%rip), %rsi     # 0x50fb8
leaq 0x3dfd8(%rip), %rdx     # 0x50fa6
movq %r12, %r9
xorl %eax, %eax
callq 0x4770
jmp 0x12ed9
movq 0x4efe4(%rip), %rax     # 0x61fc8
movq (%rax), %rdi
movl %r12d, %ecx
subl %r13d, %ecx
leaq 0x3df86(%rip), %rsi     # 0x50f7a
leaq 0x3dfab(%rip), %rdx     # 0x50fa6
xorl %eax, %eax
movq %r8, %rbp
callq 0x4770
movq %rbp, %r8
jmp 0x12ebb