#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 */
scalar_t__ log(double);
scalar_t__ log10(double);
scalar_t__ log1p(double);
scalar_t__ log2(double);
scalar_t__ logb(double);
int /*<<< orphan*/ printf(char *, unsigned long long, double);
unsigned long long rdtsc();
int main() {
  unsigned long long t0, t1;
  double a = 0;
  t0 = rdtsc();
  for (int i = 1; i < 10000000; i++)
    a += log((double)i);
  t1 = rdtsc();
  printf("log: %g → %f\n", (t1 - t0) / (double)10000000, a);
  a = 0;
  t0 = rdtsc();
  for (int i = 1; i < 10000000; i++)
    a += log10((double)i);
  t1 = rdtsc();
  printf("log10: %g → %f\n", (t1 - t0) / (double)10000000, a);
  a = 0;
  t0 = rdtsc();
  for (int i = 1; i < 10000000; i++)
    a += log1p((double)i);
  t1 = rdtsc();
  printf("log1p: %g → %f\n", (t1 - t0) / (double)10000000, a);
  a = 0;
  t0 = rdtsc();
  for (int i = 1; i < 10000000; i++)
    a += log2((double)i);
  t1 = rdtsc();
  printf("log2: %g → %f\n", (t1 - t0) / (double)10000000, a);
  a = 0;
  t0 = rdtsc();
  for (int i = 1; i < 10000000; i++)
    a += logb((double)i);
  t1 = rdtsc();
  printf("logb: %g → %f\n", (t1 - t0) / (double)10000000, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rdtsc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x989680,-0x24(%rbp)
jge    11cd <main+0x5d>
cvtsi2sdl -0x24(%rbp),%xmm0
call   1070 <log@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1199 <main+0x29>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xe11(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xe15(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe0e(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rsi
mov    %rsi,%rcx
sar    $0x3f,%rcx
movsd  0xdfb(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rsi
movsd  -0x20(%rbp),%xmm0
lea    0xde8(%rip),%rdi
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rdtsc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x28(%rbp)
cmpl   $0x989680,-0x28(%rbp)
jge    129b <main+0x12b>
cvtsi2sdl -0x28(%rbp),%xmm0
call   1080 <log10@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1267 <main+0xf7>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xd43(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xd47(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd40(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rsi
mov    %rsi,%rcx
sar    $0x3f,%rcx
movsd  0xd2d(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rsi
movsd  -0x20(%rbp),%xmm0
lea    0xd2a(%rip),%rdi
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rdtsc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x989680,-0x2c(%rbp)
jge    1369 <main+0x1f9>
cvtsi2sdl -0x2c(%rbp),%xmm0
call   1090 <log1p@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1335 <main+0x1c5>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xc75(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xc79(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc72(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rsi
mov    %rsi,%rcx
sar    $0x3f,%rcx
movsd  0xc5f(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rsi
movsd  -0x20(%rbp),%xmm0
lea    0xc6e(%rip),%rdi
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rdtsc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x30(%rbp)
cmpl   $0x989680,-0x30(%rbp)
jge    1437 <main+0x2c7>
cvtsi2sdl -0x30(%rbp),%xmm0
call   1030 <log2@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1403 <main+0x293>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xba7(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xbab(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xba4(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rsi
mov    %rsi,%rcx
sar    $0x3f,%rcx
movsd  0xb91(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rsi
movsd  -0x20(%rbp),%xmm0
lea    0xbb2(%rip),%rdi
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1060 <rdtsc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x34(%rbp)
cmpl   $0x989680,-0x34(%rbp)
jge    1505 <main+0x395>
cvtsi2sdl -0x34(%rbp),%xmm0
call   1040 <logb@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14d1 <main+0x361>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
movq   %rax,%xmm0
movaps 0xad9(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xadd(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xad6(%rip),%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%rsi
mov    %rsi,%rcx
sar    $0x3f,%rcx
movsd  0xac3(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rcx,%rax
or     %rax,%rsi
movsd  -0x20(%rbp),%xmm0
lea    0xaf5(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe6f(%rip),%xmm0
mov    $0x98967f,%ebp
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1070 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
addsd  0xe29(%rip),%xmm0
add    $0xffffffff,%ebp
jne    11a0 <main+0x30>
xor    %eax,%eax
call   1060 <rdtsc@plt>
sub    %rbx,%rax
movq   %rax,%xmm0
punpckldq 0xe2d(%rip),%xmm0
subpd  0xe35(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xdf9(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xded(%rip),%xmm1
cvttsd2si %xmm1,%rsi
and    %rcx,%rsi
or     %rax,%rsi
lea    0xe0b(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xda5(%rip),%xmm0
mov    $0x98967f,%ebp
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1080 <log10@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
addsd  0xd69(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1260 <main+0xf0>
xor    %eax,%eax
call   1060 <rdtsc@plt>
sub    %rbx,%rax
movq   %rax,%xmm0
punpckldq 0xd6d(%rip),%xmm0
subpd  0xd75(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xd39(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xd2d(%rip),%xmm1
cvttsd2si %xmm1,%rsi
and    %rcx,%rsi
or     %rax,%rsi
lea    0xd5b(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xce5(%rip),%xmm0
mov    $0x98967f,%ebp
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1090 <log1p@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
addsd  0xca9(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1320 <main+0x1b0>
xor    %eax,%eax
call   1060 <rdtsc@plt>
sub    %rbx,%rax
movq   %rax,%xmm0
punpckldq 0xcad(%rip),%xmm0
subpd  0xcb5(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xc79(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xc6d(%rip),%xmm1
cvttsd2si %xmm1,%rsi
and    %rcx,%rsi
or     %rax,%rsi
lea    0xcad(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xc25(%rip),%xmm0
mov    $0x98967f,%ebp
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <log2@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
addsd  0xbe9(%rip),%xmm0
add    $0xffffffff,%ebp
jne    13e0 <main+0x270>
xor    %eax,%eax
call   1060 <rdtsc@plt>
sub    %rbx,%rax
movq   %rax,%xmm0
punpckldq 0xbed(%rip),%xmm0
subpd  0xbf5(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xbb9(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xbad(%rip),%xmm1
cvttsd2si %xmm1,%rsi
and    %rcx,%rsi
or     %rax,%rsi
lea    0xbff(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <rdtsc@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xb65(%rip),%xmm0
mov    $0x98967f,%ebp
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <logb@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
addsd  0xb29(%rip),%xmm0
add    $0xffffffff,%ebp
jne    14a0 <main+0x330>
xor    %eax,%eax
call   1060 <rdtsc@plt>
sub    %rbx,%rax
movq   %rax,%xmm0
punpckldq 0xb2d(%rip),%xmm0
subpd  0xb35(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xaf9(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xaed(%rip),%xmm1
cvttsd2si %xmm1,%rsi
and    %rcx,%rsi
or     %rax,%rsi
lea    0xb50(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"log: %g \E2\86\92 %f\0A\00"
@.str.1 = [18 x i8] c"log10: %g \E2\86\92 %f\0A\00"
@.str.2 = [18 x i8] c"log1p: %g \E2\86\92 %f\0A\00"
@.str.3 = [17 x i8] c"log2: %g \E2\86\92 %f\0A\00"
@.str.4 = [17 x i8] c"logb: %g \E2\86\92 %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %4
%10 = call i64 (...) @rdtsc()
store i64 %10, i64* %2
store i32 1, i32* %5
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 10000000
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = call i64 @log(double %16)
%18 = sitofp i64 %17 to double
%19 = load double, double* %4
%20 = fadd double %19, %18
store double %20, double* %4
br label %21
21: ; preds = %14
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = call i64 (...) @rdtsc()
store i64 %25, i64* %3
%26 = load i64, i64* %3
%27 = load i64, i64* %2
%28 = sub i64 %26, %27
%29 = uitofp i64 %28 to double
%30 = fdiv double %29, 1.000000e+07
%31 = fptoui double %30 to i64
%32 = load double, double* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %31, double %32)
store double 0.000000e+00, double* %4
%34 = call i64 (...) @rdtsc()
store i64 %34, i64* %2
store i32 1, i32* %6
br label %35
35: ; preds = %45, %24
%36 = load i32, i32* %6
%37 = icmp slt i32 %36, 10000000
br i1 %37, label %38, label %48
38: ; preds = %35
%39 = load i32, i32* %6
%40 = sitofp i32 %39 to double
%41 = call i64 @log10(double %40)
%42 = sitofp i64 %41 to double
%43 = load double, double* %4
%44 = fadd double %43, %42
store double %44, double* %4
br label %45
45: ; preds = %38
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %35
48: ; preds = %35
%49 = call i64 (...) @rdtsc()
store i64 %49, i64* %3
%50 = load i64, i64* %3
%51 = load i64, i64* %2
%52 = sub i64 %50, %51
%53 = uitofp i64 %52 to double
%54 = fdiv double %53, 1.000000e+07
%55 = fptoui double %54 to i64
%56 = load double, double* %4
%57 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 %55, double %56)
store double 0.000000e+00, double* %4
%58 = call i64 (...) @rdtsc()
store i64 %58, i64* %2
store i32 1, i32* %7
br label %59
59: ; preds = %69, %48
%60 = load i32, i32* %7
%61 = icmp slt i32 %60, 10000000
br i1 %61, label %62, label %72
62: ; preds = %59
%63 = load i32, i32* %7
%64 = sitofp i32 %63 to double
%65 = call i64 @log1p(double %64)
%66 = sitofp i64 %65 to double
%67 = load double, double* %4
%68 = fadd double %67, %66
store double %68, double* %4
br label %69
69: ; preds = %62
%70 = load i32, i32* %7
%71 = add nsw i32 %70, 1
store i32 %71, i32* %7
br label %59
72: ; preds = %59
%73 = call i64 (...) @rdtsc()
store i64 %73, i64* %3
%74 = load i64, i64* %3
%75 = load i64, i64* %2
%76 = sub i64 %74, %75
%77 = uitofp i64 %76 to double
%78 = fdiv double %77, 1.000000e+07
%79 = fptoui double %78 to i64
%80 = load double, double* %4
%81 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %79, double %80)
store double 0.000000e+00, double* %4
%82 = call i64 (...) @rdtsc()
store i64 %82, i64* %2
store i32 1, i32* %8
br label %83
83: ; preds = %93, %72
%84 = load i32, i32* %8
%85 = icmp slt i32 %84, 10000000
br i1 %85, label %86, label %96
86: ; preds = %83
%87 = load i32, i32* %8
%88 = sitofp i32 %87 to double
%89 = call i64 @log2(double %88)
%90 = sitofp i64 %89 to double
%91 = load double, double* %4
%92 = fadd double %91, %90
store double %92, double* %4
br label %93
93: ; preds = %86
%94 = load i32, i32* %8
%95 = add nsw i32 %94, 1
store i32 %95, i32* %8
br label %83
96: ; preds = %83
%97 = call i64 (...) @rdtsc()
store i64 %97, i64* %3
%98 = load i64, i64* %3
%99 = load i64, i64* %2
%100 = sub i64 %98, %99
%101 = uitofp i64 %100 to double
%102 = fdiv double %101, 1.000000e+07
%103 = fptoui double %102 to i64
%104 = load double, double* %4
%105 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 %103, double %104)
store double 0.000000e+00, double* %4
%106 = call i64 (...) @rdtsc()
store i64 %106, i64* %2
store i32 1, i32* %9
br label %107
107: ; preds = %117, %96
%108 = load i32, i32* %9
%109 = icmp slt i32 %108, 10000000
br i1 %109, label %110, label %120
110: ; preds = %107
%111 = load i32, i32* %9
%112 = sitofp i32 %111 to double
%113 = call i64 @logb(double %112)
%114 = sitofp i64 %113 to double
%115 = load double, double* %4
%116 = fadd double %115, %114
store double %116, double* %4
br label %117
117: ; preds = %110
%118 = load i32, i32* %9
%119 = add nsw i32 %118, 1
store i32 %119, i32* %9
br label %107
120: ; preds = %107
%121 = call i64 (...) @rdtsc()
store i64 %121, i64* %3
%122 = load i64, i64* %3
%123 = load i64, i64* %2
%124 = sub i64 %122, %123
%125 = uitofp i64 %124 to double
%126 = fdiv double %125, 1.000000e+07
%127 = fptoui double %126 to i64
%128 = load double, double* %4
%129 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i64 %127, double %128)
%130 = load i32, i32* %1
ret i32 %130
}

LLVM IR (-O2):
@.str = [16 x i8] c"log: %g \E2\86\92 %f\0A\00"
@.str.1 = [18 x i8] c"log10: %g \E2\86\92 %f\0A\00"
@.str.2 = [18 x i8] c"log1p: %g \E2\86\92 %f\0A\00"
@.str.3 = [17 x i8] c"log2: %g \E2\86\92 %f\0A\00"
@.str.4 = [17 x i8] c"logb: %g \E2\86\92 %f\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @rdtsc()
br label %10
2: ; preds = %10
%3 = tail call i64 (...) @rdtsc()
%4 = sub i64 %3, %1
%5 = uitofp i64 %4 to double
%6 = fdiv double %5, 1.000000e+07
%7 = fptoui double %6 to i64
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %7, double %16)
%9 = tail call i64 (...) @rdtsc()
br label %27
10: ; preds = %0, %10
%11 = phi i32 [ 1, %0 ], [ %17, %10 ]
%12 = phi double [ 0.000000e+00, %0 ], [ %16, %10 ]
%13 = sitofp i32 %11 to double
%14 = tail call i64 @log(double %13)
%15 = sitofp i64 %14 to double
%16 = fadd double %12, %15
%17 = add nuw nsw i32 %11, 1
%18 = icmp eq i32 %17, 10000000
br i1 %18, label %2, label %10
19: ; preds = %27
%20 = tail call i64 (...) @rdtsc()
%21 = sub i64 %20, %9
%22 = uitofp i64 %21 to double
%23 = fdiv double %22, 1.000000e+07
%24 = fptoui double %23 to i64
%25 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 %24, double %33)
%26 = tail call i64 (...) @rdtsc()
br label %44
27: ; preds = %2, %27
%28 = phi i32 [ 1, %2 ], [ %34, %27 ]
%29 = phi double [ 0.000000e+00, %2 ], [ %33, %27 ]
%30 = sitofp i32 %28 to double
%31 = tail call i64 @log10(double %30)
%32 = sitofp i64 %31 to double
%33 = fadd double %29, %32
%34 = add nuw nsw i32 %28, 1
%35 = icmp eq i32 %34, 10000000
br i1 %35, label %19, label %27
36: ; preds = %44
%37 = tail call i64 (...) @rdtsc()
%38 = sub i64 %37, %26
%39 = uitofp i64 %38 to double
%40 = fdiv double %39, 1.000000e+07
%41 = fptoui double %40 to i64
%42 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 %41, double %50)
%43 = tail call i64 (...) @rdtsc()
br label %61
44: ; preds = %19, %44
%45 = phi i32 [ 1, %19 ], [ %51, %44 ]
%46 = phi double [ 0.000000e+00, %19 ], [ %50, %44 ]
%47 = sitofp i32 %45 to double
%48 = tail call i64 @log1p(double %47)
%49 = sitofp i64 %48 to double
%50 = fadd double %46, %49
%51 = add nuw nsw i32 %45, 1
%52 = icmp eq i32 %51, 10000000
br i1 %52, label %36, label %44
53: ; preds = %61
%54 = tail call i64 (...) @rdtsc()
%55 = sub i64 %54, %43
%56 = uitofp i64 %55 to double
%57 = fdiv double %56, 1.000000e+07
%58 = fptoui double %57 to i64
%59 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 %58, double %67)
%60 = tail call i64 (...) @rdtsc()
br label %77
61: ; preds = %36, %61
%62 = phi i32 [ 1, %36 ], [ %68, %61 ]
%63 = phi double [ 0.000000e+00, %36 ], [ %67, %61 ]
%64 = sitofp i32 %62 to double
%65 = tail call i64 @log2(double %64)
%66 = sitofp i64 %65 to double
%67 = fadd double %63, %66
%68 = add nuw nsw i32 %62, 1
%69 = icmp eq i32 %68, 10000000
br i1 %69, label %53, label %61
70: ; preds = %77
%71 = tail call i64 (...) @rdtsc()
%72 = sub i64 %71, %60
%73 = uitofp i64 %72 to double
%74 = fdiv double %73, 1.000000e+07
%75 = fptoui double %74 to i64
%76 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i64 %75, double %83)
ret i32 0
77: ; preds = %53, %77
%78 = phi i32 [ 1, %53 ], [ %84, %77 ]
%79 = phi double [ 0.000000e+00, %53 ], [ %83, %77 ]
%80 = sitofp i32 %78 to double
%81 = tail call i64 @logb(double %80)
%82 = sitofp i64 %81 to double
%83 = fadd double %79, %82
%84 = add nuw nsw i32 %78, 1
%85 = icmp eq i32 %84, 10000000
br i1 %85, label %70, label %77
}