#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*/ add(float);
int /*<<< orphan*/ printf(char *, float, ...);
int main() {
  float x;
  extern float z;
  int i;
  x = 0.0;
  for (i = 1; i <= 3; i++) {
    add(x);
    printf("%f %f\n", x, z);
  }
  printf("Final Value: %f\n", z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jg     1182 <main+0x62>
movss  -0x8(%rbp),%xmm0
call   1030 <add@plt>
movss  -0x8(%rbp),%xmm0
mov    0x2e82(%rip),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe93(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113e <main+0x1e>
mov    0x2e57(%rip),%rax
movss  (%rax),%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xorps  %xmm0,%xmm0
call   1030 <add@plt>
mov    0x2ead(%rip),%rbx
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm1
lea    0xebe(%rip),%r14
xorps  %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
call   1030 <add@plt>
movss  (%rbx),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
call   1030 <add@plt>
movss  (%rbx),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  (%rbx),%xmm0
lea    0xe6d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%f %f\0A\00"
@z = external global float
@.str.1 = [17 x i8] c"Final Value: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store i32 1, i32* %3
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 3
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load float, float* %2
%9 = call i32 @add(float %8)
%10 = load float, float* %2
%11 = load float, float* @z
%12 = fpext float %11 to double
%13 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float %10, double %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
%18 = load float, float* @z
%19 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%f %f\0A\00"
@z = external global float
@.str.1 = [17 x i8] c"Final Value: %f\0A\00"
define i32 @main() {
%1 = tail call i32 @add(float 0.000000e+00)
%2 = load float, float* @z
%3 = fpext float %2 to double
%4 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float 0.000000e+00, double %3)
%5 = tail call i32 @add(float 0.000000e+00)
%6 = load float, float* @z
%7 = fpext float %6 to double
%8 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float 0.000000e+00, double %7)
%9 = tail call i32 @add(float 0.000000e+00)
%10 = load float, float* @z
%11 = fpext float %10 to double
%12 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float 0.000000e+00, double %11)
%13 = load float, float* @z
%14 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), float %13)
ret i32 0
}