#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(float, char *);
float sqrt(float);
void main() {
  float x;
  for (x = 0.0; x <= 10.0; x += 0.1) {
    file_write(x, "x");
    file_write(sqrt(x), "sqrt_x");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebf(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1195 <main+0x75>
movss  -0x4(%rbp),%xmm0
lea    0xebe(%rip),%rdi
call   1040 <file_write@plt>
movss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
lea    0xea3(%rip),%rdi
call   1040 <file_write@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe85(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1130 <main+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeea(%rip),%r14
lea    0xede(%rip),%rbx
xorps  %xmm1,%xmm1
jmp    117f <main+0x5f>
nopw   0x0(%rax,%rax,1)
movaps %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,(%rsp)
mov    %rbx,%rdi
call   1040 <file_write@plt>
movsd  (%rsp),%xmm0
addsd  0xe95(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0xe8e(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     11a6 <main+0x86>
movss  %xmm1,(%rsp)
movaps %xmm1,%xmm0
mov    %r14,%rdi
call   1040 <file_write@plt>
movss  (%rsp),%xmm1
ucomiss 0xe71(%rip),%xmm1
jb     1140 <main+0x20>
xorps  %xmm0,%xmm0
sqrtss %xmm1,%xmm0
jmp    114d <main+0x2d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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