#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*/ assert(int);
int /*<<< orphan*/ printf(char *, float);
double y(int, float *);
int main() {
  int i;
  float total = 0;
  float x[10];
  x[0] = 1;
  for (i = 1; i < 10; i++)
    x[i] = 0;
  for (i = 0; i < 10; i++) {
    printf("%f\n", y(i, x));
    total += y(i, x);
  }
  assert(total <= 2);
  printf("total: %f\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xeb1(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1180 <main+0x50>
movslq -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x2b>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11e0 <main+0xb0>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1050 <y@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1187 <main+0x57>
movss  0xe1c(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movss  -0xc(%rbp),%xmm0
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movl   $0x3f800000,0x10(%rsp)
3f
xorps  %xmm0,%xmm0
movups %xmm0,0x14(%rsp)
movups %xmm0,0x24(%rsp)
movl   $0x0,0x34(%rsp)
lea    0x10(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x1,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x2,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x3,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x4,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x5,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x6,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x7,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x7,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x8,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x8,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
mov    $0x9,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
cvtsd2ss %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1050 <y@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0xc1d(%rip),%xmm0
xor    %edi,%edi
ucomiss %xmm1,%xmm0
setae  %dil
call   1040 <assert@plt>
lea    0xc0c(%rip),%rdi
movss  0xc(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [11 x i8] c"total: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca [10 x float]
store i32 0, i32* %1
store float 0.000000e+00, float* %3
%5 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 0
store float 1.000000e+00, float* %5
store i32 1, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 %11
store float 0.000000e+00, float* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %6
16: ; preds = %6
store i32 0, i32* %2
br label %17
17: ; preds = %33, %16
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %36
20: ; preds = %17
%21 = load i32, i32* %2
%22 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 0
%23 = call double @y(i32 %21, float* %22)
%24 = fptrunc double %23 to float
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %24)
%26 = load i32, i32* %2
%27 = getelementptr inbounds [10 x float], [10 x float]* %4, i64 0, i64 0
%28 = call double @y(i32 %26, float* %27)
%29 = load float, float* %3
%30 = fpext float %29 to double
%31 = fadd double %30, %28
%32 = fptrunc double %31 to float
store float %32, float* %3
br label %33
33: ; preds = %20
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %17
36: ; preds = %17
%37 = load float, float* %3
%38 = fcmp ole float %37, 2.000000e+00
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = load float, float* %3
%42 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), float %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [11 x i8] c"total: %f\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
store float 1.000000e+00, float* %3
%4 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 1
%5 = bitcast float* %4 to i8*
%6 = call double @y(i32 0, float* %3)
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %7)
%9 = call double @y(i32 0, float* %3)
%10 = fadd double %9, 0.000000e+00
%11 = fptrunc double %10 to float
%12 = call double @y(i32 1, float* %3)
%13 = fptrunc double %12 to float
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %13)
%15 = call double @y(i32 1, float* %3)
%16 = fpext float %11 to double
%17 = fadd double %15, %16
%18 = fptrunc double %17 to float
%19 = call double @y(i32 2, float* %3)
%20 = fptrunc double %19 to float
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %20)
%22 = call double @y(i32 2, float* %3)
%23 = fpext float %18 to double
%24 = fadd double %22, %23
%25 = fptrunc double %24 to float
%26 = call double @y(i32 3, float* %3)
%27 = fptrunc double %26 to float
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %27)
%29 = call double @y(i32 3, float* %3)
%30 = fpext float %25 to double
%31 = fadd double %29, %30
%32 = fptrunc double %31 to float
%33 = call double @y(i32 4, float* %3)
%34 = fptrunc double %33 to float
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %34)
%36 = call double @y(i32 4, float* %3)
%37 = fpext float %32 to double
%38 = fadd double %36, %37
%39 = fptrunc double %38 to float
%40 = call double @y(i32 5, float* %3)
%41 = fptrunc double %40 to float
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %41)
%43 = call double @y(i32 5, float* %3)
%44 = fpext float %39 to double
%45 = fadd double %43, %44
%46 = fptrunc double %45 to float
%47 = call double @y(i32 6, float* %3)
%48 = fptrunc double %47 to float
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %48)
%50 = call double @y(i32 6, float* %3)
%51 = fpext float %46 to double
%52 = fadd double %50, %51
%53 = fptrunc double %52 to float
%54 = call double @y(i32 7, float* %3)
%55 = fptrunc double %54 to float
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %55)
%57 = call double @y(i32 7, float* %3)
%58 = fpext float %53 to double
%59 = fadd double %57, %58
%60 = fptrunc double %59 to float
%61 = call double @y(i32 8, float* %3)
%62 = fptrunc double %61 to float
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %62)
%64 = call double @y(i32 8, float* %3)
%65 = fpext float %60 to double
%66 = fadd double %64, %65
%67 = fptrunc double %66 to float
%68 = call double @y(i32 9, float* %3)
%69 = fptrunc double %68 to float
%70 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %69)
%71 = call double @y(i32 9, float* %3)
%72 = fpext float %67 to double
%73 = fadd double %71, %72
%74 = fptrunc double %73 to float
%75 = fcmp ole float %74, 2.000000e+00
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), float %74)
ret i32 0
}