#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 */
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;
  const double infinity = (double)0x7FF0000000000000ULL;
  char *v_end;
  if (fraction == 0 || exponent < min_d_exp) {
    *result = 0.0;
    goto done;
  }
  if (exponent - 1 > max_d_exp) {
    *result = infinity;
    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    $0x60,%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)
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1179 <grisu3_encode_double+0x59>
cmpl   $0xfffffebc,-0x2c(%rbp)
jge    1189 <grisu3_encode_double+0x69>
mov    0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    16f1 <grisu3_encode_double+0x5d1>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cmp    $0x135,%eax
jle    11af <grisu3_encode_double+0x8f>
mov    0x18(%rbp),%rax
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    16f1 <grisu3_encode_double+0x5d1>
movabs $0x20000000000000,%rax
cmp    %rax,-0x28(%rbp)
jae    168f <grisu3_encode_double+0x56f>
cmpl   $0x0,-0x2c(%rbp)
jl     168f <grisu3_encode_double+0x56f>
cmpl   $0x16,-0x2c(%rbp)
jg     168f <grisu3_encode_double+0x56f>
movaps 0xee2(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xee1(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
sub    %ecx,%eax
add    $0x16,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x2c,%eax
ja     167d <grisu3_encode_double+0x55d>
mov    -0x58(%rbp),%rax
lea    0xeb8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x50(%rbp),%xmm0
movsd  0xdca(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xdb7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xda4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd91(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd7e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd6b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd58(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd45(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd32(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd1f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xd0c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xcf9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xce6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xcd3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xcc0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xcad(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xc9a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xc87(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xc74(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xc61(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xc4e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  -0x50(%rbp),%xmm0
movsd  0xc3b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xc20(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xc01(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xbe2(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xbc3(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xba4(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xb85(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xb66(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xb47(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xb28(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xb09(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xaea(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xacb(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xaac(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xa8d(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xa6e(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xa4f(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xa30(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0xa11(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0x9f2(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0x9d3(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0x9b4(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    167d <grisu3_encode_double+0x55d>
movsd  0x995(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    16f1 <grisu3_encode_double+0x5d1>
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     16b4 <grisu3_encode_double+0x594>
jmp    16f1 <grisu3_encode_double+0x5d1>
mov    -0x10(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1030 <strtod@plt>
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    16e4 <grisu3_encode_double+0x5c4>
mov    -0x48(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    172a <grisu3_encode_double+0x60a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    172a <grisu3_encode_double+0x60a>
cmpl   $0x0,-0x1c(%rbp)
je     1722 <grisu3_encode_double+0x602>
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    $0x60,%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     1155 <grisu3_encode_double+0x35>
cmp    $0xfffffebc,%r8d
jl     1155 <grisu3_encode_double+0x35>
cmp    $0x136,%r8d
jle    117f <grisu3_encode_double+0x5f>
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,(%r14)
test   %r15d,%r15d
je     1171 <grisu3_encode_double+0x51>
movsd  (%r14),%xmm0
xorpd  0xf74(%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    11dc <grisu3_encode_double+0xbc>
cmp    $0x16,%r8d
ja     11dc <grisu3_encode_double+0xbc>
movq   %rcx,%xmm1
punpckldq 0xf22(%rip),%xmm1
subpd  0xf2a(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
sub    %r9d,%r8d
add    $0x16,%r8d
cmp    $0x2c,%r8d
ja     1155 <grisu3_encode_double+0x35>
lea    0xf2a(%rip),%rax
movslq (%rax,%r8,4),%rcx
add    %rax,%rcx
jmp    *%rcx
divsd  0xed9(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
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    115a <grisu3_encode_double+0x3a>
mov    %rsp,%rsi
mov    %rbp,%rdi
call   1030 <strtod@plt>
movsd  %xmm0,(%r14)
mov    (%rsp),%rax
cmp    %rbx,%rax
cmovb  %rax,%rbx
jmp    1171 <grisu3_encode_double+0x51>
divsd  0xde4(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xddf(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdda(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdd5(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdd0(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdcb(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdc6(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdc1(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdbc(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdb7(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdb2(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xdad(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xda8(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xda3(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd9e(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd99(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd94(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd8f(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd8a(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd85(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
divsd  0xd80(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xd73(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xd5e(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xd49(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xd34(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xd1f(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xd0a(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xcf5(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xce0(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xccb(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xcb6(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xca1(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc8c(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc77(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc62(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc4d(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc38(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc23(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc0e(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xbf9(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xbe4(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xbcf(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>
mulsd  0xc6a(%rip),%xmm0
jmp    1155 <grisu3_encode_double+0x35>

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