#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 */

/* Variables and functions */
double integral(double, double *);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ isxdigit(char);
char *numtoa(double number, int base, int precision, char **fract) {
  register int i, j;
  double ip, fp;
  double fraction;
  int digits = 99 + 1 - 1;
  static char integral_part[99 + 1];
  static char fraction_part[29 + 1];
  double sign;
  int ch;
  if (number == 0.) {
    integral_part[0] = '0';
    integral_part[1] = '\0';
    fraction_part[0] = '0';
    fraction_part[1] = '\0';
    return integral_part;
  }
  if ((sign = number) < 0.) {
    number = -number;
    digits--;
  }
  fraction = integral(number, &ip);
  number = ip;
  if (ip == 0.) {
    integral_part[0] = '0';
    i = 1;
  } else {
    for (i = 0; i < digits && number != 0.; ++i) {
      number /= base;
      fp = integral(number, &ip);
      ch = (int)((fp + 1.e-6) * base);
      integral_part[i] = (ch <= 9) ? ch + '0' : ch + 'a' - 10;
      if (!isxdigit(integral_part[i]))
        break;
      number = ip;
    }
  }
  if (number != 0.)
    for (i = 0; i < digits; ++i)
      integral_part[i] = '9';
  if (sign < 0.)
    integral_part[i++] = '-';
  integral_part[i] = '\0';
  for (i--, j = 0; j < i; j++, i--) {
    int t;
    t = (integral_part[i]);
    (integral_part[i]) = (integral_part[j]);
    (integral_part[j]) = t;
  };
  for (i = 0, fp = fraction; precision > 0 && i < 29 + 1; i++, precision--) {
    fraction_part[i] = (int)((fp + 1.e-6) * 10. + '0');
    if (!isdigit(fraction_part[i]))
      break;
    fp = (fp * 10.0) - (double)(long)((fp + 1.e-6) * 10.);
  }
  fraction_part[i] = '\0';
  if (fract != (char **)0)
    *fract = fraction_part;
  return integral_part;
}


x86 assembly (clang, -O0):
<numtoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x63,-0x44(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1192 <numtoa+0x62>
jp     1192 <numtoa+0x62>
movb   $0x30,0x2ee3(%rip)
movb   $0x0,0x2edd(%rip)
movb   $0x30,0x2f45(%rip)
movb   $0x0,0x2f3f(%rip)
lea    0x2ec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1542 <numtoa+0x412>
movsd  -0x10(%rbp),%xmm1
movsd  %xmm1,-0x50(%rbp)
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11d3 <numtoa+0xa3>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1040 <integral@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    121b <numtoa+0xeb>
jp     121b <numtoa+0xeb>
movb   $0x30,0x2e41(%rip)
movl   $0x1,-0x24(%rbp)
jmp    1313 <numtoa+0x1e3>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
xor    %eax,%eax
cmp    -0x44(%rbp),%ecx
mov    %al,-0x59(%rbp)
jge    124a <numtoa+0x11a>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    125a <numtoa+0x12a>
jmp    130e <numtoa+0x1de>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1040 <integral@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xd78(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x9,-0x54(%rbp)
jg     12b5 <numtoa+0x185>
mov    -0x54(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x60(%rbp)
jmp    12c1 <numtoa+0x191>
mov    -0x54(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    %al,%dl
movslq -0x24(%rbp),%rcx
lea    0x2d7f(%rip),%rax
mov    %dl,(%rax,%rcx,1)
movslq -0x24(%rbp),%rcx
lea    0x2d71(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%eax
jne    12f6 <numtoa+0x1c6>
jmp    130e <numtoa+0x1de>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1222 <numtoa+0xf2>
jmp    1313 <numtoa+0x1e3>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1330 <numtoa+0x200>
jp     1330 <numtoa+0x200>
jmp    1365 <numtoa+0x235>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1360 <numtoa+0x230>
movslq -0x24(%rbp),%rcx
lea    0x2d02(%rip),%rax
movb   $0x39,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1337 <numtoa+0x207>
jmp    1365 <numtoa+0x235>
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    138c <numtoa+0x25c>
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
movslq %eax,%rcx
lea    0x2cc8(%rip),%rax
movb   $0x2d,(%rax,%rcx,1)
movslq -0x24(%rbp),%rcx
lea    0x2cb9(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    140f <numtoa+0x2df>
movslq -0x24(%rbp),%rcx
lea    0x2c8e(%rip),%rax
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x58(%rbp)
movslq -0x28(%rbp),%rcx
lea    0x2c7c(%rip),%rax
mov    (%rax,%rcx,1),%dl
movslq -0x24(%rbp),%rcx
lea    0x2c6e(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x58(%rbp),%eax
mov    %al,%dl
movslq -0x28(%rbp),%rcx
lea    0x2c5b(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    13ab <numtoa+0x27b>
movl   $0x0,-0x24(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x18(%rbp)
mov    %al,-0x61(%rbp)
jle    1439 <numtoa+0x309>
cmpl   $0x1e,-0x24(%rbp)
setl   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    1449 <numtoa+0x319>
jmp    150f <numtoa+0x3df>
movsd  0xbaf(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xbaa(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xba6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %al,%dl
movslq -0x24(%rbp),%rcx
lea    0x2c41(%rip),%rax
mov    %dl,(%rax,%rcx,1)
movslq -0x24(%rbp),%rcx
lea    0x2c33(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    14a4 <numtoa+0x374>
jmp    150f <numtoa+0x3df>
movsd  -0x38(%rbp),%xmm0
movsd  0xb4f(%rip),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xb4a(%rip),%xmm2
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rax
cvtsi2sd %rax,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xb1d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1420 <numtoa+0x2f0>
movslq -0x24(%rbp),%rcx
lea    0x2ba6(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x20(%rbp)
je     1537 <numtoa+0x407>
mov    -0x20(%rbp),%rax
lea    0x2b8c(%rip),%rcx
mov    %rcx,(%rax)
lea    0x2b12(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numtoa>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <numtoa+0x31>
jp     1171 <numtoa+0x31>
movw   $0x30,0x2eed(%rip)
movw   $0x30,0x2f54(%rip)
jmp    13c0 <numtoa+0x280>
mov    %rdx,%r12
mov    %esi,%r15d
mov    %edi,%ebx
xor    %r13d,%r13d
ucomisd %xmm0,%xmm1
seta   %r13b
movapd %xmm0,0x30(%rsp)
jbe    119c <numtoa+0x5c>
movapd %xmm0,%xmm1
movapd 0xe68(%rip),%xmm0
xorpd  %xmm1,%xmm0
xor    $0x63,%r13d
lea    0x18(%rsp),%rdi
call   1040 <integral@plt>
movsd  0x18(%rsp),%xmm1
ucomisd 0xe70(%rip),%xmm1
movsd  %xmm0,0x10(%rsp)
jne    11d3 <numtoa+0x93>
jp     11d3 <numtoa+0x93>
movb   $0x30,0x2e87(%rip)
mov    $0x1,%ebx
jmp    1274 <numtoa+0x134>
mov    %r12,0x20(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r13d,%ebp
xor    %ebx,%ebx
lea    0x18(%rsp),%r12
lea    0x2e5a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
divsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x28(%rsp)
movapd %xmm1,%xmm0
mov    %r12,%rdi
call   1040 <integral@plt>
addsd  0xdf0(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%eax
lea    0x57(%rax),%ecx
lea    0x30(%rax),%edx
cmp    $0xa,%eax
cmovge %ecx,%edx
mov    %dl,(%rbx,%r14,1)
movsbl %dl,%edi
call   1060 <isxdigit@plt>
test   %eax,%eax
je     1263 <numtoa+0x123>
movsd  0x18(%rsp),%xmm1
add    $0x1,%rbx
cmp    %rbp,%rbx
jae    1269 <numtoa+0x129>
ucomisd 0xdcb(%rip),%xmm1
jne    1200 <numtoa+0xc0>
jp     1200 <numtoa+0xc0>
jmp    1269 <numtoa+0x129>
movsd  0x28(%rsp),%xmm1
mov    0x20(%rsp),%r12
movsd  0x10(%rsp),%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    1280 <numtoa+0x140>
jnp    12a1 <numtoa+0x161>
mov    %r13d,%edx
lea    0x2dc6(%rip),%rdi
mov    $0x39,%esi
call   1050 <memset@plt>
xorpd  %xmm2,%xmm2
movsd  0x10(%rsp),%xmm0
mov    %r13d,%ebx
ucomisd 0x30(%rsp),%xmm2
jbe    12ba <numtoa+0x17a>
movslq %ebx,%rax
add    $0x1,%ebx
lea    0x2d9a(%rip),%rcx
movb   $0x2d,(%rax,%rcx,1)
movslq %ebx,%rcx
lea    0x2d8c(%rip),%rsi
movb   $0x0,(%rcx,%rsi,1)
cmp    $0x2,%ecx
jl     1300 <numtoa+0x1c0>
mov    %ebx,%ecx
add    $0xfffffffffffffffe,%rcx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x1(%rcx,%rsi,1),%ebx
movzbl (%rdx,%rsi,1),%eax
mov    %al,0x1(%rcx,%rsi,1)
mov    %bl,(%rdx,%rsi,1)
add    $0x1,%rdx
lea    -0x1(%rcx),%rax
cmp    %rcx,%rdx
mov    %rax,%rcx
jl     12e0 <numtoa+0x1a0>
test   %r15d,%r15d
jle    13a4 <numtoa+0x264>
add    $0xffffffff,%r15d
cmp    $0x1d,%r15d
mov    $0x1d,%ebp
cmovb  %r15d,%ebp
add    $0x1,%ebp
xor    %ebx,%ebx
movsd  0xcf1(%rip),%xmm2
lea    0x2d92(%rip),%r14
xchg   %ax,%ax
movsd  %xmm0,0x10(%rsp)
movapd %xmm0,%xmm1
addsd  0xcce(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm2,%xmm1
addsd  0xccc(%rip),%xmm1
cvttsd2si %xmm1,%eax
mov    %al,(%rbx,%r14,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     13a8 <numtoa+0x268>
movsd  0xca8(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm0,%xmm1
add    $0x1,%rbx
cmp    %rbx,%rbp
movapd %xmm1,%xmm0
jne    1330 <numtoa+0x1f0>
jmp    13aa <numtoa+0x26a>
xor    %ebp,%ebp
jmp    13aa <numtoa+0x26a>
mov    %ebx,%ebp
mov    %ebp,%ecx
lea    0x2d0d(%rip),%rax
movb   $0x0,(%rcx,%rax,1)
test   %r12,%r12
je     13c0 <numtoa+0x280>
mov    %rax,(%r12)
lea    0x2c89(%rip),%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@numtoa.integral_part = internal global [100 x i8] zeroinitializer
@numtoa.fraction_part = internal global [30 x i8] zeroinitializer
define i8* @numtoa(double %0, i32 %1, i32 %2, i8** %3) {
%5 = alloca i8*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
store double %0, double* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i32 99, i32* %15
%19 = load double, double* %6
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %4
store i8 48, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 1)
store i8 48, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 1)
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0), i8** %5
br label %194
22: ; preds = %4
%23 = load double, double* %6
store double %23, double* %16
%24 = fcmp olt double %23, 0.000000e+00
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load double, double* %6
%27 = fneg double %26
store double %27, double* %6
%28 = load i32, i32* %15
%29 = add nsw i32 %28, -1
store i32 %29, i32* %15
br label %30
30: ; preds = %25, %22
%31 = load double, double* %6
%32 = call double @integral(double %31, double* %12)
store double %32, double* %14
%33 = load double, double* %12
store double %33, double* %6
%34 = load double, double* %12
%35 = fcmp oeq double %34, 0.000000e+00
br i1 %35, label %36, label %37
36: ; preds = %30
store i8 48, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0)
store i32 1, i32* %10
br label %88
37: ; preds = %30
store i32 0, i32* %10
br label %38
38: ; preds = %84, %37
%39 = load i32, i32* %10
%40 = load i32, i32* %15
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load double, double* %6
%44 = fcmp une double %43, 0.000000e+00
br label %45
45: ; preds = %42, %38
%46 = phi i1 [ false, %38 ], [ %44, %42 ]
br i1 %46, label %47, label %87
47: ; preds = %45
%48 = load i32, i32* %7
%49 = sitofp i32 %48 to double
%50 = load double, double* %6
%51 = fdiv double %50, %49
store double %51, double* %6
%52 = load double, double* %6
%53 = call double @integral(double %52, double* %12)
store double %53, double* %13
%54 = load double, double* %13
%55 = fadd double %54, 0x3EB0C6F7A0B5ED8D
%56 = load i32, i32* %7
%57 = sitofp i32 %56 to double
%58 = fmul double %55, %57
%59 = fptosi double %58 to i32
store i32 %59, i32* %17
%60 = load i32, i32* %17
%61 = icmp sle i32 %60, 9
br i1 %61, label %62, label %65
62: ; preds = %47
%63 = load i32, i32* %17
%64 = add nsw i32 %63, 48
br label %69
65: ; preds = %47
%66 = load i32, i32* %17
%67 = add nsw i32 %66, 97
%68 = sub nsw i32 %67, 10
br label %69
69: ; preds = %65, %62
%70 = phi i32 [ %64, %62 ], [ %68, %65 ]
%71 = trunc i32 %70 to i8
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %73
store i8 %71, i8* %74
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %76
%78 = load i8, i8* %77
%79 = call i32 @isxdigit(i8 signext %78)
%80 = icmp ne i32 %79, 0
br i1 %80, label %82, label %81
81: ; preds = %69
br label %87
82: ; preds = %69
%83 = load double, double* %12
store double %83, double* %6
br label %84
84: ; preds = %82
%85 = load i32, i32* %10
%86 = add nsw i32 %85, 1
store i32 %86, i32* %10
br label %38
87: ; preds = %81, %45
br label %88
88: ; preds = %87, %36
%89 = load double, double* %6
%90 = fcmp une double %89, 0.000000e+00
br i1 %90, label %91, label %104
91: ; preds = %88
store i32 0, i32* %10
br label %92
92: ; preds = %100, %91
%93 = load i32, i32* %10
%94 = load i32, i32* %15
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %103
96: ; preds = %92
%97 = load i32, i32* %10
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %98
store i8 57, i8* %99
br label %100
100: ; preds = %96
%101 = load i32, i32* %10
%102 = add nsw i32 %101, 1
store i32 %102, i32* %10
br label %92
103: ; preds = %92
br label %104
104: ; preds = %103, %88
%105 = load double, double* %16
%106 = fcmp olt double %105, 0.000000e+00
br i1 %106, label %107, label %112
107: ; preds = %104
%108 = load i32, i32* %10
%109 = add nsw i32 %108, 1
store i32 %109, i32* %10
%110 = sext i32 %108 to i64
%111 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %110
store i8 45, i8* %111
br label %112
112: ; preds = %107, %104
%113 = load i32, i32* %10
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %114
store i8 0, i8* %115
%116 = load i32, i32* %10
%117 = add nsw i32 %116, -1
store i32 %117, i32* %10
store i32 0, i32* %11
br label %118
118: ; preds = %140, %112
%119 = load i32, i32* %11
%120 = load i32, i32* %10
%121 = icmp slt i32 %119, %120
br i1 %121, label %122, label %145
122: ; preds = %118
%123 = load i32, i32* %10
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %124
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
store i32 %127, i32* %18
%128 = load i32, i32* %11
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %129
%131 = load i8, i8* %130
%132 = load i32, i32* %10
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %133
store i8 %131, i8* %134
%135 = load i32, i32* %18
%136 = trunc i32 %135 to i8
%137 = load i32, i32* %11
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %138
store i8 %136, i8* %139
br label %140
140: ; preds = %122
%141 = load i32, i32* %11
%142 = add nsw i32 %141, 1
store i32 %142, i32* %11
%143 = load i32, i32* %10
%144 = add nsw i32 %143, -1
store i32 %144, i32* %10
br label %118
145: ; preds = %118
store i32 0, i32* %10
%146 = load double, double* %14
store double %146, double* %13
br label %147
147: ; preds = %180, %145
%148 = load i32, i32* %8
%149 = icmp sgt i32 %148, 0
br i1 %149, label %150, label %153
150: ; preds = %147
%151 = load i32, i32* %10
%152 = icmp slt i32 %151, 30
br label %153
153: ; preds = %150, %147
%154 = phi i1 [ false, %147 ], [ %152, %150 ]
br i1 %154, label %155, label %185
155: ; preds = %153
%156 = load double, double* %13
%157 = fadd double %156, 0x3EB0C6F7A0B5ED8D
%158 = call double @llvm.fmuladd.f64(double %157, double 1.000000e+01, double 4.800000e+01)
%159 = fptosi double %158 to i32
%160 = trunc i32 %159 to i8
%161 = load i32, i32* %10
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds [30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 %162
store i8 %160, i8* %163
%164 = load i32, i32* %10
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 %165
%167 = load i8, i8* %166
%168 = call i32 @isdigit(i8 signext %167)
%169 = icmp ne i32 %168, 0
br i1 %169, label %171, label %170
170: ; preds = %155
br label %185
171: ; preds = %155
%172 = load double, double* %13
%173 = load double, double* %13
%174 = fadd double %173, 0x3EB0C6F7A0B5ED8D
%175 = fmul double %174, 1.000000e+01
%176 = fptosi double %175 to i64
%177 = sitofp i64 %176 to double
%178 = fneg double %177
%179 = call double @llvm.fmuladd.f64(double %172, double 1.000000e+01, double %178)
store double %179, double* %13
br label %180
180: ; preds = %171
%181 = load i32, i32* %10
%182 = add nsw i32 %181, 1
store i32 %182, i32* %10
%183 = load i32, i32* %8
%184 = add nsw i32 %183, -1
store i32 %184, i32* %8
br label %147
185: ; preds = %170, %153
%186 = load i32, i32* %10
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 %187
store i8 0, i8* %188
%189 = load i8**, i8*** %9
%190 = icmp ne i8** %189, null
br i1 %190, label %191, label %193
191: ; preds = %185
%192 = load i8**, i8*** %9
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 0), i8** %192
br label %193
193: ; preds = %191, %185
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0), i8** %5
br label %194
194: ; preds = %193, %21
%195 = load i8*, i8** %5
ret i8* %195
}

LLVM IR (-O2):
@numtoa.integral_part = internal global [100 x i8] zeroinitializer
@numtoa.fraction_part = internal global [30 x i8] zeroinitializer
define i8* @numtoa(double %0, i32 %1, i32 %2, i8** writeonly %3) {
%5 = alloca double
%6 = bitcast double* %5 to i8*
%7 = fcmp oeq double %0, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %4
store i8 48, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 1)
store i8 48, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 1)
br label %109
9: ; preds = %4
%10 = fcmp olt double %0, 0.000000e+00
%11 = fneg double %0
%12 = select i1 %10, i32 98, i32 99
%13 = select i1 %10, double %11, double %0
%14 = call double @integral(double %13, double* %5)
%15 = load double, double* %5
%16 = fcmp oeq double %15, 0.000000e+00
br i1 %16, label %20, label %17
17: ; preds = %9
%18 = sitofp i32 %1 to double
%19 = zext i32 %12 to i64
br label %21
20: ; preds = %9
store i8 48, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0)
br label %46
21: ; preds = %17, %36
%22 = phi i64 [ 0, %17 ], [ %38, %36 ]
%23 = phi double [ %15, %17 ], [ %37, %36 ]
%24 = fdiv double %23, %18
%25 = call double @integral(double %24, double* %5)
%26 = fadd double %25, 0x3EB0C6F7A0B5ED8D
%27 = fmul double %26, %18
%28 = fptosi double %27 to i32
%29 = icmp slt i32 %28, 10
%30 = select i1 %29, i32 48, i32 87
%31 = add nsw i32 %30, %28
%32 = trunc i32 %31 to i8
%33 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %22
store i8 %32, i8* %33
%34 = call i32 @isxdigit(i8 signext %32)
%35 = icmp eq i32 %34, 0
br i1 %35, label %42, label %36
36: ; preds = %21
%37 = load double, double* %5
%38 = add nuw nsw i64 %22, 1
%39 = icmp ult i64 %38, %19
%40 = fcmp une double %37, 0.000000e+00
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %21, label %42
42: ; preds = %36, %21
%43 = phi i64 [ %38, %36 ], [ %22, %21 ]
%44 = phi double [ %37, %36 ], [ %24, %21 ]
%45 = trunc i64 %43 to i32
br label %46
46: ; preds = %42, %20
%47 = phi i32 [ 1, %20 ], [ %45, %42 ]
%48 = phi double [ %15, %20 ], [ %44, %42 ]
%49 = fcmp une double %48, 0.000000e+00
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = zext i32 %12 to i64
br label %52
52: ; preds = %50, %46
%53 = phi i32 [ %47, %46 ], [ %12, %50 ]
br i1 %10, label %54, label %58
54: ; preds = %52
%55 = add nsw i32 %53, 1
%56 = sext i32 %53 to i64
%57 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %56
store i8 45, i8* %57
br label %58
58: ; preds = %54, %52
%59 = phi i32 [ %55, %54 ], [ %53, %52 ]
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %60
store i8 0, i8* %61
%62 = icmp sgt i32 %59, 1
br i1 %62, label %63, label %66
63: ; preds = %58
%64 = zext i32 %59 to i64
%65 = add nsw i64 %64, -1
br label %73
66: ; preds = %73, %58
%67 = icmp sgt i32 %2, 0
br i1 %67, label %68, label %103
68: ; preds = %66
%69 = add nsw i32 %2, -1
%70 = call i32 @llvm.umin.i32(i32 %69, i32 29)
%71 = add nuw nsw i32 %70, 1
%72 = zext i32 %71 to i64
br label %83
73: ; preds = %63, %73
%74 = phi i64 [ 0, %63 ], [ %80, %73 ]
%75 = phi i64 [ %65, %63 ], [ %81, %73 ]
%76 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = getelementptr inbounds [100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 %74
%79 = load i8, i8* %78
store i8 %79, i8* %76
store i8 %77, i8* %78
%80 = add nuw nsw i64 %74, 1
%81 = add nsw i64 %75, -1
%82 = icmp slt i64 %80, %81
br i1 %82, label %73, label %66
83: ; preds = %68, %93
%84 = phi i64 [ 0, %68 ], [ %99, %93 ]
%85 = phi double [ %14, %68 ], [ %98, %93 ]
%86 = fadd double %85, 0x3EB0C6F7A0B5ED8D
%87 = call double @llvm.fmuladd.f64(double %86, double 1.000000e+01, double 4.800000e+01)
%88 = fptosi double %87 to i32
%89 = trunc i32 %88 to i8
%90 = getelementptr inbounds [30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 %84
store i8 %89, i8* %90
%91 = call i32 @isdigit(i8 signext %89)
%92 = icmp eq i32 %91, 0
br i1 %92, label %101, label %93
93: ; preds = %83
%94 = fmul double %86, 1.000000e+01
%95 = fptosi double %94 to i64
%96 = sitofp i64 %95 to double
%97 = fneg double %96
%98 = call double @llvm.fmuladd.f64(double %85, double 1.000000e+01, double %97)
%99 = add nuw nsw i64 %84, 1
%100 = icmp eq i64 %99, %72
br i1 %100, label %103, label %83
101: ; preds = %83
%102 = trunc i64 %84 to i32
br label %103
103: ; preds = %93, %101, %66
%104 = phi i32 [ 0, %66 ], [ %102, %101 ], [ %71, %93 ]
%105 = zext i32 %104 to i64
%106 = getelementptr inbounds [30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 %105
store i8 0, i8* %106
%107 = icmp eq i8** %3, null
br i1 %107, label %109, label %108
108: ; preds = %103
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @numtoa.fraction_part, i64 0, i64 0), i8** %3
br label %109
109: ; preds = %103, %108, %8
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @numtoa.integral_part, i64 0, i64 0)
}