// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/./textutils_internal.h
// Function: hts_str2uint
static inline uint64_t hts_str2uint(const char *in, char **end, int bits,
                                    int *failed) {
    uint64_t n = 0, limit = (bits < 64 ? (1ULL << bits) : 0) - 1;
    const unsigned char *v = (const unsigned char *) in;
    const unsigned int ascii_zero = '0'; // Prevents conversion to signed
    uint32_t fast = bits * 1000 / 3322 + 1; // log(10)/log(2) ~= 3.322
    unsigned int d;

    if (*v == '+')
        v++;

    while (--fast && *v>='0' && *v<='9')
        n = n*10 + *v++ - ascii_zero;

    if ((unsigned)(*v - ascii_zero) < 10 && !fast) {
        uint64_t limit_d_10 = limit / 10;
        uint64_t limit_m_10 = limit - 10 * limit_d_10;
        while ((d = *v - ascii_zero) < 10) {
            if (n < limit_d_10 || (n == limit_d_10 && d <= limit_m_10)) {
                n = n*10 + d;
                v++;
            } else {
                do { v++; } while (*v - ascii_zero < 10);
                n = limit;
                *failed = 1;
                break;
            }
        }
    }

    *end = (char *)v;
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
cmpl $0x40, -0x14(%rbp)
jge 0x3a4d4
movl -0x14(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x60(%rbp)
jmp 0x3a4dc
xorl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0x3a4dc
movq -0x60(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x30, -0x3c(%rbp)
imull $0x3e8, -0x14(%rbp), %eax # imm = 0x3E8
movl $0xcfa, %ecx            # imm = 0xCFA
cltd
idivl %ecx
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x3a524
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x3a526
movl -0x40(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x40(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x61(%rbp)
je 0x3a55a
movq -0x38(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x30, %ecx
movb %al, -0x61(%rbp)
jl 0x3a55a
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x39, %eax
setle %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x3a563
jmp 0x3a587
imulq $0xa, -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movzbl (%rcx), %ecx
addq %rcx, %rax
subq $0x30, %rax
movq %rax, -0x28(%rbp)
jmp 0x3a526
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
subl $0x30, %eax
cmpl $0xa, %eax
jae 0x3a647
cmpl $0x0, -0x40(%rbp)
jne 0x3a647
movq -0x30(%rbp), %rax
movl $0xa, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
imulq $0xa, -0x50(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
cmpl $0xa, %eax
jae 0x3a645
movq -0x28(%rbp), %rax
cmpq -0x50(%rbp), %rax
jb 0x3a5f5
movq -0x28(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x3a612
movl -0x44(%rbp), %eax
cmpq -0x58(%rbp), %rax
ja 0x3a612
imulq $0xa, -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x3a643
jmp 0x3a614
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
subl $0x30, %eax
cmpl $0xa, %eax
jb 0x3a614
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
jmp 0x3a645
jmp 0x3a5c6
jmp 0x3a647
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
popq %rbp
retq
nopl (%rax,%rax)