// File: /workspace/github_c_makefile_star2_O3/ukontainer[P]sqlite-bench/sqlite3.c
// Function: sqlite3AtoF
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){
#ifndef SQLITE_OMIT_FLOATING_POINT
  int incr;
  const char *zEnd = z + length;
  /* sign * significand * (10 ^ (esign * exponent)) */
  int sign = 1;    /* sign of significand */
  i64 s = 0;       /* significand */
  int d = 0;       /* adjust exponent for shifting decimal point */
  int esign = 1;   /* sign of exponent */
  int e = 0;       /* exponent */
  int eValid = 1;  /* True exponent is either not used or is well-formed */
  double result;
  int nDigits = 0;
  int nonNum = 0;  /* True if input contains UTF16 with high byte non-zero */

  assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
  *pResult = 0.0;   /* Default return value, in case of an error */

  if( enc==SQLITE_UTF8 ){
    incr = 1;
  }else{
    int i;
    incr = 2;
    assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
    for(i=3-enc; i<length && z[i]==0; i+=2){}
    nonNum = i<length;
    zEnd = &z[i^1];
    z += (enc&1);
  }

  /* skip leading spaces */
  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;
  if( z>=zEnd ) return 0;

  /* get sign of significand */
  if( *z=='-' ){
    sign = -1;
    z+=incr;
  }else if( *z=='+' ){
    z+=incr;
  }

  /* copy max significant digits to significand */
  while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){
    s = s*10 + (*z - '0');
    z+=incr; nDigits++;
  }

  /* skip non-significant significand digits
  ** (increase exponent by d to shift decimal left) */
  while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; nDigits++; d++; }
  if( z>=zEnd ) goto do_atof_calc;

  /* if decimal point is present */
  if( *z=='.' ){
    z+=incr;
    /* copy digits from after decimal to significand
    ** (decrease exponent by d to shift decimal right) */
    while( z<zEnd && sqlite3Isdigit(*z) ){
      if( s<((LARGEST_INT64-9)/10) ){
        s = s*10 + (*z - '0');
        d--;
      }
      z+=incr; nDigits++;
    }
  }
  if( z>=zEnd ) goto do_atof_calc;

  /* if exponent is present */
  if( *z=='e' || *z=='E' ){
    z+=incr;
    eValid = 0;

    /* This branch is needed to avoid a (harmless) buffer overread.  The 
    ** special comment alerts the mutation tester that the correct answer
    ** is obtained even if the branch is omitted */
    if( z>=zEnd ) goto do_atof_calc;              /*PREVENTS-HARMLESS-OVERREAD*/

    /* get sign of exponent */
    if( *z=='-' ){
      esign = -1;
      z+=incr;
    }else if( *z=='+' ){
      z+=incr;
    }
    /* copy digits to exponent */
    while( z<zEnd && sqlite3Isdigit(*z) ){
      e = e<10000 ? (e*10 + (*z - '0')) : 10000;
      z+=incr;
      eValid = 1;
    }
  }

  /* skip trailing spaces */
  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;

do_atof_calc:
  /* adjust exponent by d, and update sign */
  e = (e*esign) + d;
  if( e<0 ) {
    esign = -1;
    e *= -1;
  } else {
    esign = 1;
  }

  if( s==0 ) {
    /* In the IEEE 754 standard, zero is signed. */
    result = sign<0 ? -(double)0 : (double)0;
  } else {
    /* Attempt to reduce exponent.
    **
    ** Branches that are not required for the correct answer but which only
    ** help to obtain the correct answer faster are marked with special
    ** comments, as a hint to the mutation tester.
    */
    while( e>0 ){                                       /*OPTIMIZATION-IF-TRUE*/
      if( esign>0 ){
        if( s>=(LARGEST_INT64/10) ) break;             /*OPTIMIZATION-IF-FALSE*/
        s *= 10;
      }else{
        if( s%10!=0 ) break;                           /*OPTIMIZATION-IF-FALSE*/
        s /= 10;
      }
      e--;
    }

    /* adjust the sign of significand */
    s = sign<0 ? -s : s;

    if( e==0 ){                                         /*OPTIMIZATION-IF-TRUE*/
      result = (double)s;
    }else{
      /* attempt to handle extremely small/large numbers better */
      if( e>307 ){                                      /*OPTIMIZATION-IF-TRUE*/
        if( e<342 ){                                    /*OPTIMIZATION-IF-TRUE*/
          LONGDOUBLE_TYPE scale = sqlite3Pow10(e-308);
          if( esign<0 ){
            result = s / scale;
            result /= 1.0e+308;
          }else{
            result = s * scale;
            result *= 1.0e+308;
          }
        }else{ assert( e>=342 );
          if( esign<0 ){
            result = 0.0*s;
          }else{
#ifdef INFINITY
            result = INFINITY*s;
#else
            result = 1e308*1e308*s;  /* Infinity */
#endif
          }
        }
      }else{
        LONGDOUBLE_TYPE scale = sqlite3Pow10(e);
        if( esign<0 ){
          result = s / scale;
        }else{
          result = s * scale;
        }
      }
    }
  }

  /* store the result */
  *pResult = result;

  /* return true if number and no extra non-whitespace chracters after */
  return z==zEnd && nDigits>0 && eValid && nonNum==0;
#else
  return !sqlite3Atoi64(z, pResult, length, enc);
#endif /* SQLITE_OMIT_FLOATING_POINT */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq $0x0, (%rsi)
cmpl $0x1, %ecx
jne 0x425930
movl $0x1, %r14d
movl $0x1, %r9d
movq %rdi, %rcx
jmp 0x42597a
movl $0x3, %r8d
movl $0x3, %eax
subl %ecx, %eax
movl $0x1, %r9d
cmpl %edx, %eax
jge 0x425969
subl %ecx, %r8d
movslq %r8d, %rax
movslq %edx, %r8
movb (%rdi,%rax), %dl
testb %dl, %dl
jne 0x425960
addq $0x2, %rax
cmpq %r8, %rax
jl 0x425950
xorl %r9d, %r9d
testb %dl, %dl
sete %r9b
xorl $0x1, %eax
andl $0x1, %ecx
addq %rdi, %rcx
movl $0x2, %r14d
movl %eax, %edx
movslq %edx, %rax
addq %rax, %rdi
xorl %eax, %eax
cmpq %rdi, %rcx
jae 0x425c9d
leaq 0x126b3e(%rip), %rdx    # 0x54c4d0
movzbl (%rcx), %r11d
testb $0x1, (%r11,%rdx)
je 0x4259aa
addq %r14, %rcx
cmpq %rdi, %rcx
jb 0x425992
jmp 0x425c9d
leal -0x2b(%r11), %r8d
xorl %eax, %eax
testb $-0x3, %r8b
movl $0x0, %r8d
cmoveq %r14, %r8
addq %r8, %rcx
cmpq %rdi, %rcx
jae 0x425a06
xorl %r10d, %r10d
movabsq $0xccccccccccccccb, %rbx # imm = 0xCCCCCCCCCCCCCCB
xorl %r8d, %r8d
movzbl (%rcx), %r15d
leaq -0x30(%r15), %r12
cmpq $0x9, %r12
ja 0x425a0c
cmpq %rbx, %r8
jge 0x425a0c
movsbq %r15b, %r15
leaq (%r8,%r8,4), %r8
leaq (%r15,%r8,2), %r8
addq $-0x30, %r8
addq %r14, %rcx
incl %r10d
cmpq %rdi, %rcx
jb 0x4259d6
jmp 0x425a0c
xorl %r8d, %r8d
xorl %r10d, %r10d
movl $0x1, %r13d
cmpq %rdi, %rcx
jae 0x425a37
xorl %eax, %eax
movzbl (%rcx), %ebx
leaq -0x3a(%rbx), %r15
cmpq $-0xa, %r15
jb 0x425af4
addq %r14, %rcx
incl %eax
cmpq %rdi, %rcx
jb 0x425a19
addl %eax, %r10d
xorl %r15d, %r15d
movl $0x1, %ebp
testq %r8, %r8
je 0x425ae1
movl %ebp, -0x2c(%rsp)
imull %r13d, %r15d
addl %eax, %r15d
movl %r15d, %r14d
negl %r14d
cmovsl %r15d, %r14d
jae 0x425b8e
movabsq $0xccccccccccccccb, %r12 # imm = 0xCCCCCCCCCCCCCCB
movabsq $0x6666666666666667, %r13 # imm = 0x6666666666666667
movabsq $-0x3333333333333333, %rbp # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x1999999999999998, %rbx # imm = 0x1999999999999998
testl %r15d, %r15d
js 0x425aa2
cmpq %r12, %r8
jg 0x425bac
addq %r8, %r8
leaq (%r8,%r8,4), %r8
jmp 0x425acf
movq %r8, %rax
imulq %r13
movq %r8, %rax
imulq %rbp, %rax
addq %rbx, %rax
rorq %rax
cmpq %rbx, %rax
ja 0x425bac
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
movq %rdx, %r8
leal -0x1(%r14), %edx
cmpl $0x1, %r14d
movl %edx, %r14d
jg 0x425a8b
jmp 0x425b91
cmpb $0x2d, %r11b
je 0x425c25
xorpd %xmm0, %xmm0
jmp 0x425c80
addl %eax, %r10d
cmpb $0x2e, %bl
jne 0x425b3e
addq %r14, %rcx
cmpq %rdi, %rcx
jae 0x425b3e
movabsq $0xccccccccccccccb, %rbx # imm = 0xCCCCCCCCCCCCCCB
movzbl (%rcx), %r15d
leaq -0x3a(%r15), %r12
cmpq $-0xa, %r12
jb 0x425b3e
cmpq %rbx, %r8
jge 0x425b33
movsbq %r15b, %r15
leaq (%r8,%r8,4), %r8
leaq (%r15,%r8,2), %r8
addq $-0x30, %r8
decl %eax
incl %r10d
addq %r14, %rcx
cmpq %rdi, %rcx
jb 0x425b0e
xorl %r15d, %r15d
cmpq %rdi, %rcx
jae 0x425a3a
movzbl (%rcx), %ebx
orl $0x20, %ebx
cmpl $0x65, %ebx
jne 0x425cbc
addq %r14, %rcx
cmpq %rdi, %rcx
jae 0x425ccf
movzbl (%rcx), %ebx
movl $0x1, %r13d
cmpl $0x2b, %ebx
je 0x425d53
cmpl $0x2d, %ebx
jne 0x425d56
addq %r14, %rcx
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x425d56
movl %r14d, %edx
movq %r8, %rax
negq %rax
cmpb $0x2d, %r11b
cmovneq %r8, %rax
testl %edx, %edx
je 0x425c69
movl %edx, %r14d
jmp 0x425c01
movq %r8, %rax
negq %rax
cmpb $0x2d, %r11b
cmovneq %r8, %rax
cmpl $0x134, %r14d           # imm = 0x134
jb 0x425c01
cmpl $0x155, %r14d           # imm = 0x155
movl -0x2c(%rsp), %ebp
ja 0x425ca8
leal -0x134(%r14), %edx
testb $0x1, %r14b
fld1
flds 0x12a8e1(%rip)          # 0x5504c8
fld %st(0)
fcmove %st(2), %st
fstp %st(2)
cmpl $0x2, %edx
jae 0x425cdf
fstp %st(0)
fldz
fldz
jmp 0x425d02
movl -0x2c(%rsp), %ebp
testb $0x1, %r14b
fld1
flds 0x12a8b7(%rip)          # 0x5504c8
fld %st(0)
fcmove %st(2), %st
fstp %st(2)
cmpl $0x2, %r14d
jae 0x425c2f
fstp %st(0)
fldz
fldz
jmp 0x425c53
movsd 0x12a8f3(%rip), %xmm0   # 0x550520
jmp 0x425c80
movl %r14d, %edx
fldz
fxch %st(2)
fstp %st(2)
shrl %edx
fmul %st, %st(0)
testb $0x2, %r14b
fld %st(1)
fmul %st(1), %st
fcmove %st(2), %st
fstp %st(2)
fld %st(1)
cmpl $0x3, %r14d
movl %edx, %r14d
ja 0x425c36
fstp %st(1)
fstp %st(0)
movq %rax, -0x20(%rsp)
fildll -0x20(%rsp)
testl %r15d, %r15d
js 0x425c74
fmulp %st, %st(1)
jmp 0x425c76
cvtsi2sd %rax, %xmm0
movl -0x2c(%rsp), %ebp
jmp 0x425c80
fdivp %st, %st(1)
fstpl -0x28(%rsp)
movsd -0x28(%rsp), %xmm0
xorl %eax, %eax
testl %r10d, %r10d
cmovlel %eax, %r9d
movsd %xmm0, (%rsi)
cmpq %rdi, %rcx
cmovnel %eax, %r9d
testl %ebp, %ebp
cmovel %ebp, %r9d
movl %r9d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cvtsi2sd %rax, %xmm0
testl %r15d, %r15d
js 0x425d2d
mulsd 0x12a856(%rip), %xmm0   # 0x550510
jmp 0x425c80
xorl %r15d, %r15d
movl $0x1, %r13d
movl $0x1, %ebp
jmp 0x425dd3
xorl %r15d, %r15d
movl $0x1, %r13d
xorl %ebp, %ebp
jmp 0x425a3f
movl %edx, %r8d
fldz
fxch %st(2)
fstp %st(2)
shrl %r8d
fmul %st, %st(0)
testb $0x2, %dl
fld %st(1)
fmul %st(1), %st
fcmove %st(2), %st
fstp %st(2)
fld %st(1)
cmpl $0x3, %edx
movl %r8d, %edx
ja 0x425ce6
fstp %st(1)
fstp %st(0)
movq %rax, -0x8(%rsp)
fildll -0x8(%rsp)
testl %r15d, %r15d
js 0x425d3a
fmulp %st, %st(1)
fstpl -0x10(%rsp)
movsd -0x10(%rsp), %xmm0
mulsd 0x12a7f0(%rip), %xmm0   # 0x550518
jmp 0x425c80
andpd 0x12a6db(%rip), %xmm0   # 0x550410
jmp 0x425c80
fdivp %st, %st(1)
fstpl -0x18(%rsp)
movsd -0x18(%rsp), %xmm0
divsd 0x12a7ca(%rip), %xmm0   # 0x550518
jmp 0x425c80
addq %r14, %rcx
xorl %r15d, %r15d
cmpq %rdi, %rcx
jae 0x425d6b
movzbl (%rcx), %ebp
leaq -0x3a(%rbp), %rbx
cmpq $-0xa, %rbx
jae 0x425d6f
xorl %ebp, %ebp
jmp 0x425dd3
movl %r13d, -0x2c(%rsp)
addq %r14, %rcx
xorl %r15d, %r15d
movl $0x2710, %ebx           # imm = 0x2710
movq %rcx, %r13
movq %r13, %rcx
cmpl %ebx, %r15d
leal (%r15,%r15,4), %r15d
movsbl %bpl, %r12d
leal -0x30(%r12,%r15,2), %r15d
cmovgel %ebx, %r15d
movl $0x1, %ebp
cmpq %rdi, %r13
jae 0x425dbc
movzbl (%rcx), %ebp
movq %rbp, %r12
addq $-0x3a, %r12
leaq (%rcx,%r14), %r13
cmpq $-0xa, %r12
jae 0x425d82
movl $0x1, %ebp
movl -0x2c(%rsp), %r13d
jmp 0x425dd3
movzbl (%rcx), %ebx
testb $0x1, (%rbx,%rdx)
je 0x425a3f
addq %r14, %rcx
cmpq %rdi, %rcx
jb 0x425dc3
jmp 0x425a3f