#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 pow10(int value) {
  double res = 1.0;
  while (value >= 4) {
    res *= 10000.0;
    value -= 5;
  }
  while (value >= 2) {
    res *= 100.0;
    value -= 2;
  }
  while (value >= 1) {
    res *= 10.0;
    value -= 1;
  }
  return res;
}


x86 assembly (clang, -O0):
<pow10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  0xef1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
jl     113e <pow10+0x3e>
movsd  0xef2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x4(%rbp)
jmp    1114 <pow10+0x14>
jmp    1143 <pow10+0x43>
cmpl   $0x2,-0x4(%rbp)
jl     116d <pow10+0x6d>
movsd  0xebb(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1143 <pow10+0x43>
jmp    1172 <pow10+0x72>
cmpl   $0x1,-0x4(%rbp)
jl     119c <pow10+0x9c>
movsd  0xe84(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1172 <pow10+0x72>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow10>:
movsd  0xef8(%rip),%xmm0
cmp    $0x4,%edi
jl     112e <pow10+0x2e>
movsd  0xef3(%rip),%xmm1
mov    %edi,%eax
nopw   0x0(%rax,%rax,1)
mulsd  %xmm1,%xmm0
lea    -0x5(%rax),%edi
cmp    $0x8,%eax
mov    %edi,%eax
ja     1120 <pow10+0x20>
cmp    $0x2,%edi
jl     115b <pow10+0x5b>
movsd  0xed5(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
mulsd  %xmm1,%xmm0
lea    -0x2(%rdi),%eax
cmp    $0x3,%edi
mov    %eax,%edi
ja     1140 <pow10+0x40>
test   %eax,%eax
jle    115a <pow10+0x5a>
mulsd  0xebe(%rip),%xmm0
ret
mov    %edi,%eax
test   %eax,%eax
jg     1152 <pow10+0x52>
jmp    115a <pow10+0x5a>

LLVM IR (-O0):
define double @pow10(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
store double 1.000000e+00, double* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 4
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load double, double* %3
%9 = fmul double %8, 1.000000e+04
store double %9, double* %3
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 5
store i32 %11, i32* %2
br label %4
12: ; preds = %4
br label %13
13: ; preds = %16, %12
%14 = load i32, i32* %2
%15 = icmp sge i32 %14, 2
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load double, double* %3
%18 = fmul double %17, 1.000000e+02
store double %18, double* %3
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 2
store i32 %20, i32* %2
br label %13
21: ; preds = %13
br label %22
22: ; preds = %25, %21
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load double, double* %3
%27 = fmul double %26, 1.000000e+01
store double %27, double* %3
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 1
store i32 %29, i32* %2
br label %22
30: ; preds = %22
%31 = load double, double* %3
ret double %31
}

LLVM IR (-O2):
define double @pow10(i32 %0) {
%2 = icmp sgt i32 %0, 3
br i1 %2, label %7, label %3
3: ; preds = %7, %1
%4 = phi i32 [ %0, %1 ], [ %11, %7 ]
%5 = phi double [ 1.000000e+00, %1 ], [ %10, %7 ]
%6 = icmp sgt i32 %4, 1
br i1 %6, label %19, label %13
7: ; preds = %1, %7
%8 = phi double [ %10, %7 ], [ 1.000000e+00, %1 ]
%9 = phi i32 [ %11, %7 ], [ %0, %1 ]
%10 = fmul double %8, 1.000000e+04
%11 = add nsw i32 %9, -5
%12 = icmp ugt i32 %9, 8
br i1 %12, label %7, label %3
13: ; preds = %19, %3
%14 = phi i32 [ %4, %3 ], [ %23, %19 ]
%15 = phi double [ %5, %3 ], [ %22, %19 ]
%16 = icmp sgt i32 %14, 0
%17 = fmul double %15, 1.000000e+01
%18 = select i1 %16, double %17, double %15
ret double %18
19: ; preds = %3, %19
%20 = phi double [ %22, %19 ], [ %5, %3 ]
%21 = phi i32 [ %23, %19 ], [ %4, %3 ]
%22 = fmul double %20, 1.000000e+02
%23 = add nsw i32 %21, -2
%24 = icmp ugt i32 %21, 3
br i1 %24, label %19, label %13
}