#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 */
int /*<<< orphan*/ file_write(double, char *);
double log(double);
int /*<<< orphan*/ report(double);
void test_log() {
  double x, step;
  for (x = 0.1; x <= 10.0; x += 0.1) {
    report(x);
    file_write(x, "x_7");
    file_write(log(x), "log_x");
  }
}


x86 assembly (clang, -O0):
<test_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xebb(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     11a0 <test_log+0x70>
movsd  -0x8(%rbp),%xmm0
call   1050 <report@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xea2(%rip),%rdi
call   1040 <file_write@plt>
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
lea    0xe90(%rip),%rdi
call   1040 <file_write@plt>
movsd  0xe6f(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1145 <test_log+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_log>:
push   %r14
push   %rbx
push   %rax
movsd  0xec4(%rip),%xmm0
lea    0xecd(%rip),%r14
lea    0xeca(%rip),%rbx
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1050 <report@plt>
movsd  (%rsp),%xmm0
mov    %r14,%rdi
call   1040 <file_write@plt>
movsd  (%rsp),%xmm0
call   1030 <log@plt>
mov    %rbx,%rdi
call   1040 <file_write@plt>
movsd  (%rsp),%xmm0
addsd  0xe75(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe70(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
jae    1150 <test_log+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"x_7\00"
@.str.1 = [6 x i8] c"log_x\00"
define void @test_log() {
%1 = alloca double
%2 = alloca double
store double 1.000000e-01, double* %1
br label %3
3: ; preds = %14, %0
%4 = load double, double* %1
%5 = fcmp ole double %4, 1.000000e+01
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load double, double* %1
%8 = call i32 @report(double %7)
%9 = load double, double* %1
%10 = call i32 @file_write(double %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = load double, double* %1
%12 = call double @log(double %11)
%13 = call i32 @file_write(double %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %6
%15 = load double, double* %1
%16 = fadd double %15, 1.000000e-01
store double %16, double* %1
br label %3
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"x_7\00"
@.str.1 = [6 x i8] c"log_x\00"
define void @test_log() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 1.000000e-01, %0 ], [ %7, %1 ]
%3 = tail call i32 @report(double %2)
%4 = tail call i32 @file_write(double %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call double @log(double %2)
%6 = tail call i32 @file_write(double %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = fadd double %2, 1.000000e-01
%8 = fcmp ugt double %7, 1.000000e+01
br i1 %8, label %9, label %1
9: ; preds = %1
ret void
}