#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 calc_with_for(double);
double calc_with_pow(double);
int /*<<< orphan*/ printf(char *, ...);
main() {
  printf(" x         for loop      pow()\n");
  double min = 0.0;
  double max = 10.0;
  double split = max / 100;
  double x = min;
  while (x <= max) {
    double result1 = calc_with_for(x);
    double result2 = calc_with_pow(x);
    printf("%9.6lf %13.6lf %13.6lf\n", x, result1, result2);
    x += split;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe91(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11e5 <main+0xb5>
movsd  -0x28(%rbp),%xmm0
call   1030 <calc_with_for@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <calc_with_pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    0xe66(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1182 <main+0x52>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
xorpd  %xmm0,%xmm0
lea    0xeb4(%rip),%rbx
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1030 <calc_with_for@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1060 <calc_with_pow@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe5c(%rip),%xmm0
movsd  0xe5c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1160 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c" x for loop pow()\0A\00"
@.str.1 = [24 x i8] c"%9.6lf %13.6lf %13.6lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %2
store double 1.000000e+01, double* %3
%9 = load double, double* %3
%10 = fdiv double %9, 1.000000e+02
store double %10, double* %4
%11 = load double, double* %2
store double %11, double* %5
br label %12
12: ; preds = %16, %0
%13 = load double, double* %5
%14 = load double, double* %3
%15 = fcmp ole double %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load double, double* %5
%18 = call double @calc_with_for(double %17)
store double %18, double* %6
%19 = load double, double* %5
%20 = call double @calc_with_pow(double %19)
store double %20, double* %7
%21 = load double, double* %5
%22 = load double, double* %6
%23 = load double, double* %7
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %21, double %22, double %23)
%25 = load double, double* %4
%26 = load double, double* %5
%27 = fadd double %26, %25
store double %27, double* %5
br label %12
28: ; preds = %12
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"%9.6lf %13.6lf %13.6lf\0A\00"
@str = [31 x i8] c" x for loop pow()\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi double [ 0.000000e+00, %0 ], [ %7, %2 ]
%4 = tail call double @calc_with_for(double %3)
%5 = tail call double @calc_with_pow(double %3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %3, double %4, double %5)
%7 = fadd double %3, 1.000000e-01
%8 = fcmp ugt double %7, 1.000000e+01
br i1 %8, label %9, label %2
9: ; preds = %2
ret i32 0
}