#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef unsigned long long uint64_t;

/* Variables and functions */
double grisu3_cast_double_from_uint64(int);
scalar_t__ grisu3_diy_fp_encode_double(unsigned long long, int, int, int,
                                       double *);
double strtod(char const *, char **);
const char *grisu3_encode_double(const char *buf, const char *end, int sign,
                                 uint64_t fraction, int exponent,
                                 int fraction_exp, int ulp_half_error,
                                 double *result) {
  const int max_d_exp = 309;
  const int min_d_exp = -324;
  char *v_end;
  if (fraction == 0 || exponent < min_d_exp) {
    *result = 0.0;
    goto done;
  }
  if (exponent - 1 > max_d_exp) {
    *result = grisu3_cast_double_from_uint64(0x7FF0000000000000ULL);
    goto done;
  }
  if (fraction < (1ULL << 53) && exponent >= 0 && exponent <= 22) {
    double v = (double)fraction;
    switch (exponent - fraction_exp) {
    case -22:
      v /= 1e22;
      break;
    case -21:
      v /= 1e21;
      break;
    case -20:
      v /= 1e20;
      break;
    case -19:
      v /= 1e19;
      break;
    case -18:
      v /= 1e18;
      break;
    case -17:
      v /= 1e17;
      break;
    case -16:
      v /= 1e16;
      break;
    case -15:
      v /= 1e15;
      break;
    case -14:
      v /= 1e14;
      break;
    case -13:
      v /= 1e13;
      break;
    case -12:
      v /= 1e12;
      break;
    case -11:
      v /= 1e11;
      break;
    case -10:
      v /= 1e10;
      break;
    case -9:
      v /= 1e9;
      break;
    case -8:
      v /= 1e8;
      break;
    case -7:
      v /= 1e7;
      break;
    case -6:
      v /= 1e6;
      break;
    case -5:
      v /= 1e5;
      break;
    case -4:
      v /= 1e4;
      break;
    case -3:
      v /= 1e3;
      break;
    case -2:
      v /= 1e2;
      break;
    case -1:
      v /= 1e1;
      break;
    case 0:
      break;
    case 1:
      v *= 1e1;
      break;
    case 2:
      v *= 1e2;
      break;
    case 3:
      v *= 1e3;
      break;
    case 4:
      v *= 1e4;
      break;
    case 5:
      v *= 1e5;
      break;
    case 6:
      v *= 1e6;
      break;
    case 7:
      v *= 1e7;
      break;
    case 8:
      v *= 1e8;
      break;
    case 9:
      v *= 1e9;
      break;
    case 10:
      v *= 1e10;
      break;
    case 11:
      v *= 1e11;
      break;
    case 12:
      v *= 1e12;
      break;
    case 13:
      v *= 1e13;
      break;
    case 14:
      v *= 1e14;
      break;
    case 15:
      v *= 1e15;
      break;
    case 16:
      v *= 1e16;
      break;
    case 17:
      v *= 1e17;
      break;
    case 18:
      v *= 1e18;
      break;
    case 19:
      v *= 1e19;
      break;
    case 20:
      v *= 1e20;
      break;
    case 21:
      v *= 1e21;
      break;
    case 22:
      v *= 1e22;
      break;
    }
    *result = v;
    goto done;
  }
  if (grisu3_diy_fp_encode_double(fraction, exponent, fraction_exp,
                                  ulp_half_error, result)) {
    goto done;
  }
  *result = strtod(buf, &v_end);
  if (v_end < end) {
    return v_end;
  }
  return end;
done:
  if (sign) {
    *result = -*result;
  }
  return end;
}


x86 assembly (clang, -O0):
<grisu3_encode_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
movl   $0x135,-0x34(%rbp)
movl   $0xfffffebc,-0x38(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     117c <grisu3_encode_double+0x4c>
cmpl   $0xfffffebc,-0x2c(%rbp)
jge    118c <grisu3_encode_double+0x5c>
mov    0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    16f3 <grisu3_encode_double+0x5c3>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cmp    $0x135,%eax
jle    11b1 <grisu3_encode_double+0x81>
xor    %edi,%edi
call   1050 <grisu3_cast_double_from_uint64@plt>
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    16f3 <grisu3_encode_double+0x5c3>
movabs $0x20000000000000,%rax
cmp    %rax,-0x28(%rbp)
jae    1691 <grisu3_encode_double+0x561>
cmpl   $0x0,-0x2c(%rbp)
jl     1691 <grisu3_encode_double+0x561>
cmpl   $0x16,-0x2c(%rbp)
jg     1691 <grisu3_encode_double+0x561>
movaps 0xe20(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe1f(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
sub    %ecx,%eax
add    $0x16,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0x2c,%eax
ja     167f <grisu3_encode_double+0x54f>
mov    -0x50(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x48(%rbp),%xmm0
movsd  0xde0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xdcd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xdba(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xda7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd81(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd6e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd5b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd48(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd35(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd22(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xd0f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xcfc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xce9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xcd6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xcc3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xcb0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xc9d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xc8a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xc77(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xc64(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  -0x48(%rbp),%xmm0
movsd  0xc51(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xc36(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xc17(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xbf8(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xbd9(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xbba(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xb9b(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xb7c(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xb5d(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xb3e(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xb1f(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xb00(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xae1(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xac2(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xaa3(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xa84(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xa65(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xa46(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xa27(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0xa08(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0x9e9(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0x9ca(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    167f <grisu3_encode_double+0x54f>
movsd  0x9ab(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    16f3 <grisu3_encode_double+0x5c3>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    0x18(%rbp),%r8
call   1040 <grisu3_diy_fp_encode_double@plt>
cmp    $0x0,%rax
je     16b6 <grisu3_encode_double+0x586>
jmp    16f3 <grisu3_encode_double+0x5c3>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <strtod@plt>
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    16e6 <grisu3_encode_double+0x5b6>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    172c <grisu3_encode_double+0x5fc>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    172c <grisu3_encode_double+0x5fc>
cmpl   $0x0,-0x1c(%rbp)
je     1724 <grisu3_encode_double+0x5f4>
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grisu3_encode_double>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%rbx
mov    0x38(%rsp),%r14
xorpd  %xmm0,%xmm0
test   %rcx,%rcx
je     1164 <grisu3_encode_double+0x34>
cmp    $0xfffffebc,%r8d
jl     1164 <grisu3_encode_double+0x34>
cmp    $0x137,%r8d
jl     118e <grisu3_encode_double+0x5e>
xor    %edi,%edi
call   1050 <grisu3_cast_double_from_uint64@plt>
movsd  %xmm0,(%r14)
test   %r15d,%r15d
je     1180 <grisu3_encode_double+0x50>
movsd  (%r14),%xmm0
xorpd  0xea5(%rip),%xmm0
movlpd %xmm0,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdi,%rbp
mov    %rcx,%rax
shr    $0x35,%rax
jne    11eb <grisu3_encode_double+0xbb>
cmp    $0x16,%r8d
ja     11eb <grisu3_encode_double+0xbb>
movq   %rcx,%xmm1
punpckldq 0xe53(%rip),%xmm1
subpd  0xe5b(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
sub    %r9d,%r8d
add    $0x16,%r8d
cmp    $0x2c,%r8d
ja     1164 <grisu3_encode_double+0x34>
lea    0xf0b(%rip),%rax
movslq (%rax,%r8,4),%rcx
add    %rax,%rcx
jmp    *%rcx
divsd  0xef2(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mov    0x30(%rsp),%eax
mov    %rcx,%rdi
mov    %r8d,%esi
mov    %r9d,%edx
mov    %eax,%ecx
mov    %r14,%r8
call   1040 <grisu3_diy_fp_encode_double@plt>
test   %rax,%rax
jne    1169 <grisu3_encode_double+0x39>
mov    %rsp,%rsi
mov    %rbp,%rdi
call   1030 <strtod@plt>
movsd  %xmm0,(%r14)
mov    (%rsp),%rax
cmp    %rbx,%rax
cmovb  %rax,%rbx
jmp    1180 <grisu3_encode_double+0x50>
divsd  0xdfd(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdf8(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdf3(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdee(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xde9(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xde4(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xddf(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdda(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdd5(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdd0(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdcb(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdc6(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdc1(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdbc(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdb7(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdb2(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xdad(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xda8(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xda3(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xd9e(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
divsd  0xd99(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd8c(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd77(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd62(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd4d(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd38(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd23(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xd0e(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xcf9(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xce4(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xccf(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xcba(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xca5(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc90(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc7b(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc66(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc51(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc3c(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc27(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc12(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xbfd(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xbe8(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>
mulsd  0xc83(%rip),%xmm0
jmp    1164 <grisu3_encode_double+0x34>

LLVM IR (-O0):
define i8* @grisu3_encode_double(i8* %0, i8* %1, i32 %2, i64 %3, i32 %4, i32 %5, i32 %6, double* %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
%21 = alloca double
store i8* %0, i8** %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i64 %3, i64* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store double* %7, double** %17
store i32 309, i32* %18
store i32 -324, i32* %19
%22 = load i64, i64* %13
%23 = icmp eq i64 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %8
%25 = load i32, i32* %14
%26 = icmp slt i32 %25, -324
br i1 %26, label %27, label %29
27: ; preds = %24, %8
%28 = load double*, double** %17
store double 0.000000e+00, double* %28
br label %207
29: ; preds = %24
%30 = load i32, i32* %14
%31 = sub nsw i32 %30, 1
%32 = icmp sgt i32 %31, 309
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = call double @grisu3_cast_double_from_uint64(i32 0)
%35 = load double*, double** %17
store double %34, double* %35
br label %207
36: ; preds = %29
%37 = load i64, i64* %13
%38 = icmp ult i64 %37, 9007199254740992
br i1 %38, label %39, label %187
39: ; preds = %36
%40 = load i32, i32* %14
%41 = icmp sge i32 %40, 0
br i1 %41, label %42, label %187
42: ; preds = %39
%43 = load i32, i32* %14
%44 = icmp sle i32 %43, 22
br i1 %44, label %45, label %187
45: ; preds = %42
%46 = load i64, i64* %13
%47 = uitofp i64 %46 to double
store double %47, double* %21
%48 = load i32, i32* %14
%49 = load i32, i32* %15
%50 = sub nsw i32 %48, %49
switch i32 %50, label %184 [
i32 -22, label %51
i32 -21, label %54
i32 -20, label %57
i32 -19, label %60
i32 -18, label %63
i32 -17, label %66
i32 -16, label %69
i32 -15, label %72
i32 -14, label %75
i32 -13, label %78
i32 -12, label %81
i32 -11, label %84
i32 -10, label %87
i32 -9, label %90
i32 -8, label %93
i32 -7, label %96
i32 -6, label %99
i32 -5, label %102
i32 -4, label %105
i32 -3, label %108
i32 -2, label %111
i32 -1, label %114
i32 0, label %117
i32 1, label %118
i32 2, label %121
i32 3, label %124
i32 4, label %127
i32 5, label %130
i32 6, label %133
i32 7, label %136
i32 8, label %139
i32 9, label %142
i32 10, label %145
i32 11, label %148
i32 12, label %151
i32 13, label %154
i32 14, label %157
i32 15, label %160
i32 16, label %163
i32 17, label %166
i32 18, label %169
i32 19, label %172
i32 20, label %175
i32 21, label %178
i32 22, label %181
]
51: ; preds = %45
%52 = load double, double* %21
%53 = fdiv double %52, 1.000000e+22
store double %53, double* %21
br label %184
54: ; preds = %45
%55 = load double, double* %21
%56 = fdiv double %55, 1.000000e+21
store double %56, double* %21
br label %184
57: ; preds = %45
%58 = load double, double* %21
%59 = fdiv double %58, 1.000000e+20
store double %59, double* %21
br label %184
60: ; preds = %45
%61 = load double, double* %21
%62 = fdiv double %61, 1.000000e+19
store double %62, double* %21
br label %184
63: ; preds = %45
%64 = load double, double* %21
%65 = fdiv double %64, 1.000000e+18
store double %65, double* %21
br label %184
66: ; preds = %45
%67 = load double, double* %21
%68 = fdiv double %67, 1.000000e+17
store double %68, double* %21
br label %184
69: ; preds = %45
%70 = load double, double* %21
%71 = fdiv double %70, 1.000000e+16
store double %71, double* %21
br label %184
72: ; preds = %45
%73 = load double, double* %21
%74 = fdiv double %73, 1.000000e+15
store double %74, double* %21
br label %184
75: ; preds = %45
%76 = load double, double* %21
%77 = fdiv double %76, 1.000000e+14
store double %77, double* %21
br label %184
78: ; preds = %45
%79 = load double, double* %21
%80 = fdiv double %79, 1.000000e+13
store double %80, double* %21
br label %184
81: ; preds = %45
%82 = load double, double* %21
%83 = fdiv double %82, 1.000000e+12
store double %83, double* %21
br label %184
84: ; preds = %45
%85 = load double, double* %21
%86 = fdiv double %85, 1.000000e+11
store double %86, double* %21
br label %184
87: ; preds = %45
%88 = load double, double* %21
%89 = fdiv double %88, 1.000000e+10
store double %89, double* %21
br label %184
90: ; preds = %45
%91 = load double, double* %21
%92 = fdiv double %91, 1.000000e+09
store double %92, double* %21
br label %184
93: ; preds = %45
%94 = load double, double* %21
%95 = fdiv double %94, 1.000000e+08
store double %95, double* %21
br label %184
96: ; preds = %45
%97 = load double, double* %21
%98 = fdiv double %97, 1.000000e+07
store double %98, double* %21
br label %184
99: ; preds = %45
%100 = load double, double* %21
%101 = fdiv double %100, 1.000000e+06
store double %101, double* %21
br label %184
102: ; preds = %45
%103 = load double, double* %21
%104 = fdiv double %103, 1.000000e+05
store double %104, double* %21
br label %184
105: ; preds = %45
%106 = load double, double* %21
%107 = fdiv double %106, 1.000000e+04
store double %107, double* %21
br label %184
108: ; preds = %45
%109 = load double, double* %21
%110 = fdiv double %109, 1.000000e+03
store double %110, double* %21
br label %184
111: ; preds = %45
%112 = load double, double* %21
%113 = fdiv double %112, 1.000000e+02
store double %113, double* %21
br label %184
114: ; preds = %45
%115 = load double, double* %21
%116 = fdiv double %115, 1.000000e+01
store double %116, double* %21
br label %184
117: ; preds = %45
br label %184
118: ; preds = %45
%119 = load double, double* %21
%120 = fmul double %119, 1.000000e+01
store double %120, double* %21
br label %184
121: ; preds = %45
%122 = load double, double* %21
%123 = fmul double %122, 1.000000e+02
store double %123, double* %21
br label %184
124: ; preds = %45
%125 = load double, double* %21
%126 = fmul double %125, 1.000000e+03
store double %126, double* %21
br label %184
127: ; preds = %45
%128 = load double, double* %21
%129 = fmul double %128, 1.000000e+04
store double %129, double* %21
br label %184
130: ; preds = %45
%131 = load double, double* %21
%132 = fmul double %131, 1.000000e+05
store double %132, double* %21
br label %184
133: ; preds = %45
%134 = load double, double* %21
%135 = fmul double %134, 1.000000e+06
store double %135, double* %21
br label %184
136: ; preds = %45
%137 = load double, double* %21
%138 = fmul double %137, 1.000000e+07
store double %138, double* %21
br label %184
139: ; preds = %45
%140 = load double, double* %21
%141 = fmul double %140, 1.000000e+08
store double %141, double* %21
br label %184
142: ; preds = %45
%143 = load double, double* %21
%144 = fmul double %143, 1.000000e+09
store double %144, double* %21
br label %184
145: ; preds = %45
%146 = load double, double* %21
%147 = fmul double %146, 1.000000e+10
store double %147, double* %21
br label %184
148: ; preds = %45
%149 = load double, double* %21
%150 = fmul double %149, 1.000000e+11
store double %150, double* %21
br label %184
151: ; preds = %45
%152 = load double, double* %21
%153 = fmul double %152, 1.000000e+12
store double %153, double* %21
br label %184
154: ; preds = %45
%155 = load double, double* %21
%156 = fmul double %155, 1.000000e+13
store double %156, double* %21
br label %184
157: ; preds = %45
%158 = load double, double* %21
%159 = fmul double %158, 1.000000e+14
store double %159, double* %21
br label %184
160: ; preds = %45
%161 = load double, double* %21
%162 = fmul double %161, 1.000000e+15
store double %162, double* %21
br label %184
163: ; preds = %45
%164 = load double, double* %21
%165 = fmul double %164, 1.000000e+16
store double %165, double* %21
br label %184
166: ; preds = %45
%167 = load double, double* %21
%168 = fmul double %167, 1.000000e+17
store double %168, double* %21
br label %184
169: ; preds = %45
%170 = load double, double* %21
%171 = fmul double %170, 1.000000e+18
store double %171, double* %21
br label %184
172: ; preds = %45
%173 = load double, double* %21
%174 = fmul double %173, 1.000000e+19
store double %174, double* %21
br label %184
175: ; preds = %45
%176 = load double, double* %21
%177 = fmul double %176, 1.000000e+20
store double %177, double* %21
br label %184
178: ; preds = %45
%179 = load double, double* %21
%180 = fmul double %179, 1.000000e+21
store double %180, double* %21
br label %184
181: ; preds = %45
%182 = load double, double* %21
%183 = fmul double %182, 1.000000e+22
store double %183, double* %21
br label %184
184: ; preds = %45, %181, %178, %175, %172, %169, %166, %163, %160, %157, %154, %151, %148, %145, %142, %139, %136, %133, %130, %127, %124, %121, %118, %117, %114, %111, %108, %105, %102, %99, %96, %93, %90, %87, %84, %81, %78, %75, %72, %69, %66, %63, %60, %57, %54, %51
%185 = load double, double* %21
%186 = load double*, double** %17
store double %185, double* %186
br label %207
187: ; preds = %42, %39, %36
%188 = load i64, i64* %13
%189 = load i32, i32* %14
%190 = load i32, i32* %15
%191 = load i32, i32* %16
%192 = load double*, double** %17
%193 = call i64 @grisu3_diy_fp_encode_double(i64 %188, i32 %189, i32 %190, i32 %191, double* %192)
%194 = icmp ne i64 %193, 0
br i1 %194, label %195, label %196
195: ; preds = %187
br label %207
196: ; preds = %187
%197 = load i8*, i8** %10
%198 = call double @strtod(i8* %197, i8** %20)
%199 = load double*, double** %17
store double %198, double* %199
%200 = load i8*, i8** %20
%201 = load i8*, i8** %11
%202 = icmp ult i8* %200, %201
br i1 %202, label %203, label %205
203: ; preds = %196
%204 = load i8*, i8** %20
store i8* %204, i8** %9
br label %217
205: ; preds = %196
%206 = load i8*, i8** %11
store i8* %206, i8** %9
br label %217
207: ; preds = %195, %184, %33, %27
%208 = load i32, i32* %12
%209 = icmp ne i32 %208, 0
br i1 %209, label %210, label %215
210: ; preds = %207
%211 = load double*, double** %17
%212 = load double, double* %211
%213 = fneg double %212
%214 = load double*, double** %17
store double %213, double* %214
br label %215
215: ; preds = %210, %207
%216 = load i8*, i8** %11
store i8* %216, i8** %9
br label %217
217: ; preds = %215, %205, %203
%218 = load i8*, i8** %9
ret i8* %218
}

LLVM IR (-O2):
define i8* @grisu3_encode_double(i8* %0, i8* readnone %1, i32 %2, i64 %3, i32 %4, i32 %5, i32 %6, double* %7) {
%9 = alloca i8*
%10 = bitcast i8** %9 to i8*
%11 = icmp eq i64 %3, 0
%12 = icmp slt i32 %4, -324
%13 = or i1 %11, %12
br i1 %13, label %121, label %14
14: ; preds = %8
%15 = icmp sgt i32 %4, 310
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = tail call double @grisu3_cast_double_from_uint64(i32 0)
br label %121
18: ; preds = %14
%19 = icmp ult i64 %3, 9007199254740992
%20 = icmp ult i32 %4, 23
%21 = and i1 %19, %20
br i1 %21, label %22, label %113
22: ; preds = %18
%23 = uitofp i64 %3 to double
%24 = sub nsw i32 %4, %5
switch i32 %24, label %121 [
i32 -22, label %25
i32 -21, label %27
i32 -20, label %29
i32 -19, label %31
i32 -18, label %33
i32 -17, label %35
i32 -16, label %37
i32 -15, label %39
i32 -14, label %41
i32 -13, label %43
i32 -12, label %45
i32 -11, label %47
i32 -10, label %49
i32 -9, label %51
i32 -8, label %53
i32 -7, label %55
i32 -6, label %57
i32 -5, label %59
i32 -4, label %61
i32 -3, label %63
i32 -2, label %65
i32 -1, label %67
i32 22, label %111
i32 1, label %69
i32 2, label %71
i32 3, label %73
i32 4, label %75
i32 5, label %77
i32 6, label %79
i32 7, label %81
i32 8, label %83
i32 9, label %85
i32 10, label %87
i32 11, label %89
i32 12, label %91
i32 13, label %93
i32 14, label %95
i32 15, label %97
i32 16, label %99
i32 17, label %101
i32 18, label %103
i32 19, label %105
i32 20, label %107
i32 21, label %109
]
25: ; preds = %22
%26 = fdiv double %23, 1.000000e+22
br label %121
27: ; preds = %22
%28 = fdiv double %23, 1.000000e+21
br label %121
29: ; preds = %22
%30 = fdiv double %23, 1.000000e+20
br label %121
31: ; preds = %22
%32 = fdiv double %23, 1.000000e+19
br label %121
33: ; preds = %22
%34 = fdiv double %23, 1.000000e+18
br label %121
35: ; preds = %22
%36 = fdiv double %23, 1.000000e+17
br label %121
37: ; preds = %22
%38 = fdiv double %23, 1.000000e+16
br label %121
39: ; preds = %22
%40 = fdiv double %23, 1.000000e+15
br label %121
41: ; preds = %22
%42 = fdiv double %23, 1.000000e+14
br label %121
43: ; preds = %22
%44 = fdiv double %23, 1.000000e+13
br label %121
45: ; preds = %22
%46 = fdiv double %23, 1.000000e+12
br label %121
47: ; preds = %22
%48 = fdiv double %23, 1.000000e+11
br label %121
49: ; preds = %22
%50 = fdiv double %23, 1.000000e+10
br label %121
51: ; preds = %22
%52 = fdiv double %23, 1.000000e+09
br label %121
53: ; preds = %22
%54 = fdiv double %23, 1.000000e+08
br label %121
55: ; preds = %22
%56 = fdiv double %23, 1.000000e+07
br label %121
57: ; preds = %22
%58 = fdiv double %23, 1.000000e+06
br label %121
59: ; preds = %22
%60 = fdiv double %23, 1.000000e+05
br label %121
61: ; preds = %22
%62 = fdiv double %23, 1.000000e+04
br label %121
63: ; preds = %22
%64 = fdiv double %23, 1.000000e+03
br label %121
65: ; preds = %22
%66 = fdiv double %23, 1.000000e+02
br label %121
67: ; preds = %22
%68 = fdiv double %23, 1.000000e+01
br label %121
69: ; preds = %22
%70 = fmul double %23, 1.000000e+01
br label %121
71: ; preds = %22
%72 = fmul double %23, 1.000000e+02
br label %121
73: ; preds = %22
%74 = fmul double %23, 1.000000e+03
br label %121
75: ; preds = %22
%76 = fmul double %23, 1.000000e+04
br label %121
77: ; preds = %22
%78 = fmul double %23, 1.000000e+05
br label %121
79: ; preds = %22
%80 = fmul double %23, 1.000000e+06
br label %121
81: ; preds = %22
%82 = fmul double %23, 1.000000e+07
br label %121
83: ; preds = %22
%84 = fmul double %23, 1.000000e+08
br label %121
85: ; preds = %22
%86 = fmul double %23, 1.000000e+09
br label %121
87: ; preds = %22
%88 = fmul double %23, 1.000000e+10
br label %121
89: ; preds = %22
%90 = fmul double %23, 1.000000e+11
br label %121
91: ; preds = %22
%92 = fmul double %23, 1.000000e+12
br label %121
93: ; preds = %22
%94 = fmul double %23, 1.000000e+13
br label %121
95: ; preds = %22
%96 = fmul double %23, 1.000000e+14
br label %121
97: ; preds = %22
%98 = fmul double %23, 1.000000e+15
br label %121
99: ; preds = %22
%100 = fmul double %23, 1.000000e+16
br label %121
101: ; preds = %22
%102 = fmul double %23, 1.000000e+17
br label %121
103: ; preds = %22
%104 = fmul double %23, 1.000000e+18
br label %121
105: ; preds = %22
%106 = fmul double %23, 1.000000e+19
br label %121
107: ; preds = %22
%108 = fmul double %23, 1.000000e+20
br label %121
109: ; preds = %22
%110 = fmul double %23, 1.000000e+21
br label %121
111: ; preds = %22
%112 = fmul double %23, 1.000000e+22
br label %121
113: ; preds = %18
%114 = tail call i64 @grisu3_diy_fp_encode_double(i64 %3, i32 %4, i32 %5, i32 %6, double* %7)
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %123
116: ; preds = %113
%117 = call double @strtod(i8* %0, i8** %9)
store double %117, double* %7
%118 = load i8*, i8** %9
%119 = icmp ult i8* %118, %1
%120 = select i1 %119, i8* %118, i8* %1
br label %128
121: ; preds = %25, %27, %29, %31, %33, %35, %37, %39, %41, %43, %45, %47, %49, %51, %53, %55, %57, %59, %61, %63, %65, %67, %69, %71, %73, %75, %77, %79, %81, %83, %85, %87, %89, %91, %93, %95, %97, %99, %101, %103, %105, %107, %109, %111, %22, %8, %16
%122 = phi double [ %17, %16 ], [ 0.000000e+00, %8 ], [ %23, %22 ], [ %110, %109 ], [ %108, %107 ], [ %106, %105 ], [ %104, %103 ], [ %102, %101 ], [ %100, %99 ], [ %98, %97 ], [ %96, %95 ], [ %94, %93 ], [ %92, %91 ], [ %90, %89 ], [ %88, %87 ], [ %86, %85 ], [ %84, %83 ], [ %82, %81 ], [ %80, %79 ], [ %78, %77 ], [ %76, %75 ], [ %74, %73 ], [ %72, %71 ], [ %70, %69 ], [ %112, %111 ], [ %68, %67 ], [ %66, %65 ], [ %64, %63 ], [ %62, %61 ], [ %60, %59 ], [ %58, %57 ], [ %56, %55 ], [ %54, %53 ], [ %52, %51 ], [ %50, %49 ], [ %48, %47 ], [ %46, %45 ], [ %44, %43 ], [ %42, %41 ], [ %40, %39 ], [ %38, %37 ], [ %36, %35 ], [ %34, %33 ], [ %32, %31 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ]
store double %122, double* %7
br label %123
123: ; preds = %121, %113
%124 = icmp eq i32 %2, 0
br i1 %124, label %128, label %125
125: ; preds = %123
%126 = load double, double* %7
%127 = fneg double %126
store double %127, double* %7
br label %128
128: ; preds = %123, %125, %116
%129 = phi i8* [ %120, %116 ], [ %1, %125 ], [ %1, %123 ]
ret i8* %129
}