// File: /workspace/github_c_makefile_star2_O1/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 0x425a5d
movl $0x1, %r14d
movl $0x1, %r8d
movq %rdi, %rcx
jmp 0x425abe
movl $0x3, %eax
subl %ecx, %eax
cmpl %edx, %eax
setge %r8b
jge 0x425aa9
movl %ecx, %r9d
movl $0x3, %eax
subq %r9, %rax
cmpb $0x0, (%rdi,%rax)
jne 0x425aa9
movslq %edx, %rdx
movzbl %cl, %r8d
movl $0x5, %eax
subq %r8, %rax
cmpq %rdx, %rax
setge %r8b
jge 0x425aa9
leaq 0x2(%rax), %r9
cmpb $0x0, (%rdi,%rax)
movq %r9, %rax
je 0x425a8c
addl $-0x2, %r9d
movl %r9d, %eax
xorl $0x1, %eax
andl $0x1, %ecx
addq %rdi, %rcx
movzbl %r8b, %r8d
movl $0x2, %r14d
movl %eax, %edx
movslq %edx, %rax
addq %rax, %rdi
xorl %eax, %eax
cmpq %rdi, %rcx
setb %r9b
jae 0x425e6f
movzbl (%rcx), %r10d
leaq 0x126a22(%rip), %rdx    # 0x54c500
testb $0x1, (%r10,%rdx)
je 0x425afb
addq %r14, %rcx
cmpq %rdi, %rcx
setb %r9b
jae 0x425e6f
movzbl (%rcx), %r10d
jmp 0x425ade
testb %r9b, %r9b
je 0x425e6f
movb (%rcx), %bpl
leal -0x2b(%rbp), %r9d
xorl %eax, %eax
testb $-0x3, %r9b
movl $0x0, %r9d
cmoveq %r14, %r9
addq %rcx, %r9
cmpq %rdi, %r9
jae 0x425b62
xorl %r10d, %r10d
movabsq $0xccccccccccccccb, %r11 # imm = 0xCCCCCCCCCCCCCCB
xorl %ecx, %ecx
movzbl (%r9), %ebx
leaq -0x30(%rbx), %r15
cmpq $0x9, %r15
ja 0x425b67
cmpq %r11, %rcx
jge 0x425b67
movsbq %bl, %rbx
leaq (%rcx,%rcx,4), %rcx
leaq (%rbx,%rcx,2), %rcx
addq $-0x30, %rcx
addq %r14, %r9
incl %r10d
cmpq %rdi, %r9
jb 0x425b32
jmp 0x425b67
xorl %ecx, %ecx
xorl %r10d, %r10d
movl $0x1, %r15d
cmpq %rdi, %r9
setb %r11b
movq %rbp, -0x30(%rsp)
jae 0x425c66
movzbl (%r9), %eax
addq $-0x3a, %rax
xorl %ebx, %ebx
cmpq $-0xa, %rax
jae 0x425b93
xorl %eax, %eax
jmp 0x425bbf
xorl %r12d, %r12d
addq %r14, %r9
leal 0x1(%r12), %eax
cmpq %rdi, %r9
setb %r11b
jae 0x425c60
movzbl (%r9), %r13d
addq $-0x3a, %r13
movl %eax, %r12d
cmpq $-0xa, %r13
jae 0x425b96
addl %eax, %r10d
testb %r11b, %r11b
je 0x425c68
cmpb $0x2e, (%r9)
jne 0x425c11
addq %r14, %r9
cmpq %rdi, %r9
jae 0x425c11
movabsq $0xccccccccccccccb, %r11 # imm = 0xCCCCCCCCCCCCCCB
movzbl (%r9), %r12d
leaq -0x3a(%r12), %r13
cmpq $-0xa, %r13
jb 0x425c11
cmpq %r11, %rcx
jge 0x425c06
movsbq %r12b, %r12
leaq (%rcx,%rcx,4), %rcx
leaq (%r12,%rcx,2), %rcx
addq $-0x30, %rcx
decl %eax
incl %r10d
addq %r14, %r9
cmpq %rdi, %r9
jb 0x425be0
cmpq %rdi, %r9
jae 0x425c68
movzbl (%r9), %r11d
orl $0x20, %r11d
cmpl $0x65, %r11d
jne 0x425e7a
addq %r14, %r9
cmpq %rdi, %r9
jae 0x425e8c
movzbl (%r9), %r11d
movl $0x1, %r15d
cmpl $0x2b, %r11d
je 0x425e9b
cmpl $0x2d, %r11d
jne 0x425e9e
addq %r14, %r9
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x425e9e
addl %r12d, %r10d
incl %r10d
xorl %ebx, %ebx
movl $0x1, %ebp
testq %rcx, %rcx
je 0x425d4b
imull %r15d, %ebx
addl %eax, %ebx
movl %ebx, %r14d
negl %r14d
cmovsl %ebx, %r14d
jae 0x425cfa
movabsq $0xccccccccccccccb, %r15 # imm = 0xCCCCCCCCCCCCCCB
movabsq $0x6666666666666667, %r12 # imm = 0x6666666666666667
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
movabsq $0x1999999999999998, %r11 # imm = 0x1999999999999998
testl %ebx, %ebx
js 0x425cc2
cmpq %r15, %rcx
jg 0x425cfa
addq %rcx, %rcx
leaq (%rcx,%rcx,4), %rcx
jmp 0x425ceb
movq %rcx, %rax
imulq %r12
movq %rcx, %rax
imulq %r13, %rax
addq %r11, %rax
rorq %rax
cmpq %r11, %rax
ja 0x425cfa
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x2, %rdx
addq %rax, %rdx
movq %rdx, %rcx
leal -0x1(%r14), %edx
cmpl $0x1, %r14d
movl %edx, %r14d
jg 0x425cb0
jmp 0x425cfd
movl %r14d, %edx
movq %rcx, %rax
negq %rax
cmpb $0x2d, -0x30(%rsp)
cmovneq %rcx, %rax
testl %edx, %edx
je 0x425d5b
cmpl $0x134, %edx            # imm = 0x134
jl 0x425d65
cmpl $0x155, %edx            # imm = 0x155
jg 0x425d90
leal -0x134(%rdx), %ecx
testb $0x1, %dl
fld1
flds 0x12a68b(%rip)          # 0x5503bc
fld %st(0)
fcmove %st(2), %st
fstp %st(2)
cmpl $0x2, %ecx
jae 0x425ded
fstp %st(0)
fldz
fldz
jmp 0x425e0d
cmpb $0x2d, -0x30(%rsp)
je 0x425d83
xorpd %xmm0, %xmm0
jmp 0x425e52
cvtsi2sd %rax, %xmm0
jmp 0x425e52
testb $0x1, %dl
fld1
flds 0x12a64c(%rip)          # 0x5503bc
fld %st(0)
fcmove %st(2), %st
fstp %st(2)
cmpl $0x1, %edx
jne 0x425daa
fstp %st(0)
fldz
fldz
jmp 0x425dca
movsd 0x12a685(%rip), %xmm0   # 0x550410
jmp 0x425e52
cvtsi2sd %rax, %xmm0
testl %ebx, %ebx
js 0x425e34
mulsd 0x12a65b(%rip), %xmm0   # 0x550400
jmp 0x425e52
movl %edx, %ecx
fldz
fxch %st(2)
fstp %st(2)
shrl %ecx
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 %ecx, %edx
ja 0x425db0
fstp %st(1)
fstp %st(0)
movq %rax, -0x8(%rsp)
fildll -0x8(%rsp)
testl %ebx, %ebx
js 0x425ddf
fmulp %st, %st(1)
jmp 0x425de1
fdivp %st, %st(1)
fstpl -0x10(%rsp)
movsd -0x10(%rsp), %xmm0
jmp 0x425e52
movl %ecx, %edx
fldz
fxch %st(2)
fstp %st(2)
shrl %edx
fmul %st, %st(0)
testb $0x2, %cl
fld %st(1)
fmul %st(1), %st
fcmove %st(2), %st
fstp %st(2)
fld %st(1)
cmpl $0x3, %ecx
movl %edx, %ecx
ja 0x425df3
fstp %st(1)
fstp %st(0)
movq %rax, -0x18(%rsp)
fildll -0x18(%rsp)
testl %ebx, %ebx
js 0x425e3e
fmulp %st, %st(1)
fstpl -0x20(%rsp)
movsd -0x20(%rsp), %xmm0
mulsd 0x12a5d6(%rip), %xmm0   # 0x550408
jmp 0x425e52
andpd 0x12a6b4(%rip), %xmm0   # 0x5504f0
jmp 0x425e52
fdivp %st, %st(1)
fstpl -0x28(%rsp)
movsd -0x28(%rsp), %xmm0
divsd 0x12a5b6(%rip), %xmm0   # 0x550408
xorl %eax, %eax
testl %r10d, %r10d
cmovlel %eax, %r8d
movsd %xmm0, (%rsi)
cmpq %rdi, %r9
cmovnel %eax, %r8d
testl %ebp, %ebp
cmovel %ebp, %r8d
movl %r8d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
movl $0x1, %r15d
movl $0x1, %ebp
jmp 0x425f1c
xorl %ebx, %ebx
movl $0x1, %r15d
xorl %ebp, %ebp
jmp 0x425c6d
addq %r14, %r9
xorl %ebx, %ebx
cmpq %rdi, %r9
jae 0x425ebc
movl %r15d, -0x34(%rsp)
movzbl (%r9), %r15d
leaq -0x3a(%r15), %r11
cmpq $-0xa, %r11
jae 0x425ec0
xorl %ebp, %ebp
jmp 0x425f03
xorl %ebp, %ebp
jmp 0x425f1c
addq %r14, %r9
xorl %ebx, %ebx
movl $0x2710, %r11d          # imm = 0x2710
movq %r9, %r13
movl $0x1, %ebp
movq %r13, %r9
cmpl %r11d, %ebx
leal (%rbx,%rbx,4), %ebx
movsbl %r15b, %r15d
leal -0x30(%r15,%rbx,2), %ebx
cmovgel %r11d, %ebx
cmpq %rdi, %r13
jae 0x425f03
movzbl (%r9), %r15d
movq %r15, %r12
addq $-0x3a, %r12
leaq (%r9,%r14), %r13
cmpq $-0xa, %r12
jae 0x425ed3
movl -0x34(%rsp), %r15d
jmp 0x425f1c
movzbl (%r9), %r11d
testb $0x1, (%r11,%rdx)
je 0x425c6d
addq %r14, %r9
cmpq %rdi, %r9
jb 0x425f0a
jmp 0x425c6d