#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 f(float, float);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  float x = -1, y = -2;
  printf("x\ty\tResult\n");
  while (x < 1) {
    printf("%.3f\t%.3f\t%.3f\n", x, y, f(x, y));
    if (y < 2)
      y += 0.5;
    else {
      x += 0.2;
      y = -2;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  0xea9(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1214 <main+0xf4>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <f@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
lea    0xe84(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movss  0xe55(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11e4 <main+0xc4>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe46(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    120f <main+0xef>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xdf6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1157 <main+0x37>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
movss  0xeb7(%rip),%xmm0
movss  0xeb3(%rip),%xmm1
lea    0xec8(%rip),%rbx
jmp    1187 <main+0x57>
nopw   0x0(%rax,%rax,1)
cmpltss %xmm3,%xmm1
andps  %xmm1,%xmm2
movss  0xe94(%rip),%xmm3
andnps %xmm3,%xmm1
orps   %xmm2,%xmm1
movss  0xe92(%rip),%xmm2
ucomiss %xmm0,%xmm2
jbe    120d <main+0xdd>
movss  %xmm0,0xc(%rsp)
movaps %xmm1,0x20(%rsp)
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
movaps 0x20(%rsp),%xmm1
call   1040 <f@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x10(%rsp),%xmm4
movss  0xe2e(%rip),%xmm3
movss  0xc(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
ucomiss %xmm1,%xmm3
movaps %xmm1,%xmm2
addss  0xe19(%rip),%xmm2
addsd  0xe1d(%rip),%xmm4
ja     1160 <main+0x30>
xorps  %xmm0,%xmm0
cvtsd2ss %xmm4,%xmm0
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"x\09y\09Result\0A\00"
@.str.1 = [16 x i8] c"%.3f\09%.3f\09%.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float -1.000000e+00, float* %2
store float -2.000000e+00, float* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %29, %0
%6 = load float, float* %2
%7 = fcmp olt float %6, 1.000000e+00
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = load float, float* %2
%14 = load float, float* %3
%15 = call double @f(float %13, float %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %10, double %12, double %15)
%17 = load float, float* %3
%18 = fcmp olt float %17, 2.000000e+00
br i1 %18, label %19, label %24
19: ; preds = %8
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = fadd double %21, 5.000000e-01
%23 = fptrunc double %22 to float
store float %23, float* %3
br label %29
24: ; preds = %8
%25 = load float, float* %2
%26 = fpext float %25 to double
%27 = fadd double %26, 2.000000e-01
%28 = fptrunc double %27 to float
store float %28, float* %2
store float -2.000000e+00, float* %3
br label %29
29: ; preds = %24, %19
br label %5
30: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"%.3f\09%.3f\09%.3f\0A\00"
@str = [11 x i8] c"x\09y\09Result\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi float [ -2.000000e+00, %0 ], [ %14, %2 ]
%4 = phi float [ -1.000000e+00, %0 ], [ %13, %2 ]
%5 = fpext float %4 to double
%6 = fpext float %3 to double
%7 = tail call double @f(float %4, float %3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %5, double %6, double %7)
%9 = fcmp olt float %3, 2.000000e+00
%10 = fadd float %3, 5.000000e-01
%11 = fadd double %5, 2.000000e-01
%12 = fptrunc double %11 to float
%13 = select i1 %9, float %4, float %12
%14 = select i1 %9, float %10, float -2.000000e+00
%15 = fcmp olt float %13, 1.000000e+00
br i1 %15, label %2, label %16
16: ; preds = %2
ret i32 0
}