#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 */
float density(int, int);
double eval(int, int);
int /*<<< orphan*/ printf(char *, int, int, double, float);
int main(void) {
  int x, y;
  float data[5][5];
  for (y = 0; y < 5; y++) {
    for (x = 0; x < 5; x++) {
      data[x][y] = density(x, y);
    }
  }
  for (y = 0; y < 5; y++) {
    for (x = 0; x < 5; x++) {
      printf("data[%i][%i] should be %f, is %f\n", x, y, eval(x, y) / 5.0,
             data[x][y]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11a8 <main+0x78>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1195 <main+0x65>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <density@plt>
movslq -0x8(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <main+0x2a>
jmp    119a <main+0x6a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <main+0x19>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1238 <main+0x108>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1225 <main+0xf5>
mov    -0x8(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <eval@plt>
mov    -0x78(%rbp),%esi
mov    -0x74(%rbp),%edx
movsd  0xe11(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0x8(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c0 <main+0x90>
jmp    122a <main+0xfa>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11af <main+0x7f>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <density@plt>
movss  %xmm0,(%rsp)
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <density@plt>
movss  %xmm0,0x14(%rsp)
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <density@plt>
movss  %xmm0,0x28(%rsp)
mov    $0x3,%edi
xor    %esi,%esi
call   1040 <density@plt>
movss  %xmm0,0x3c(%rsp)
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <density@plt>
movss  %xmm0,0x50(%rsp)
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <density@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <density@plt>
movss  %xmm0,0x18(%rsp)
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <density@plt>
movss  %xmm0,0x2c(%rsp)
mov    $0x3,%edi
mov    $0x1,%esi
call   1040 <density@plt>
movss  %xmm0,0x40(%rsp)
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <density@plt>
movss  %xmm0,0x54(%rsp)
xor    %edi,%edi
mov    $0x2,%esi
call   1040 <density@plt>
movss  %xmm0,0x8(%rsp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <density@plt>
movss  %xmm0,0x1c(%rsp)
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <density@plt>
movss  %xmm0,0x30(%rsp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1040 <density@plt>
movss  %xmm0,0x44(%rsp)
mov    $0x4,%edi
mov    $0x2,%esi
call   1040 <density@plt>
movss  %xmm0,0x58(%rsp)
xor    %edi,%edi
mov    $0x3,%esi
call   1040 <density@plt>
movss  %xmm0,0xc(%rsp)
mov    $0x1,%edi
mov    $0x3,%esi
call   1040 <density@plt>
movss  %xmm0,0x20(%rsp)
mov    $0x2,%edi
mov    $0x3,%esi
call   1040 <density@plt>
movss  %xmm0,0x34(%rsp)
mov    $0x3,%edi
mov    $0x3,%esi
call   1040 <density@plt>
movss  %xmm0,0x48(%rsp)
mov    $0x4,%edi
mov    $0x3,%esi
call   1040 <density@plt>
movss  %xmm0,0x5c(%rsp)
xor    %edi,%edi
mov    $0x4,%esi
call   1040 <density@plt>
movss  %xmm0,0x10(%rsp)
mov    $0x1,%edi
mov    $0x4,%esi
call   1040 <density@plt>
movss  %xmm0,0x24(%rsp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1040 <density@plt>
movss  %xmm0,0x38(%rsp)
mov    $0x3,%edi
mov    $0x4,%esi
call   1040 <density@plt>
movss  %xmm0,0x4c(%rsp)
mov    $0x4,%edi
mov    $0x4,%esi
call   1040 <density@plt>
movss  %xmm0,0x60(%rsp)
lea    0xcda(%rip),%r14
xchg   %ax,%ax
xor    %edi,%edi
mov    %ebx,%esi
call   1050 <eval@plt>
movsd  0xcbf(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  (%rsp,%rbx,4),%xmm1
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1050 <eval@plt>
divsd  0xc96(%rip),%xmm0
movss  0x14(%rsp,%rbx,4),%xmm1
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    $0x2,%edi
mov    %ebx,%esi
call   1050 <eval@plt>
divsd  0xc6d(%rip),%xmm0
movss  0x28(%rsp,%rbx,4),%xmm1
mov    %r14,%rdi
mov    $0x2,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    $0x3,%edi
mov    %ebx,%esi
call   1050 <eval@plt>
divsd  0xc44(%rip),%xmm0
movss  0x3c(%rsp,%rbx,4),%xmm1
mov    %r14,%rdi
mov    $0x3,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    $0x4,%edi
mov    %ebx,%esi
call   1050 <eval@plt>
divsd  0xc1b(%rip),%xmm0
movss  0x50(%rsp,%rbx,4),%xmm1
mov    %r14,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x5,%rbx
jne    1330 <main+0x200>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [34 x i8] c"data[%i][%i] should be %f, is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x [5 x float]]
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %26, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %29
8: ; preds = %5
store i32 0, i32* %2
br label %9
9: ; preds = %22, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call float @density(i32 %13, i32 %14)
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %4, i64 0, i64 %17
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x float], [5 x float]* %18, i64 0, i64 %20
store float %15, float* %21
br label %22
22: ; preds = %12
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %9
25: ; preds = %9
br label %26
26: ; preds = %25
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %5
29: ; preds = %5
store i32 0, i32* %3
br label %30
30: ; preds = %56, %29
%31 = load i32, i32* %3
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %59
33: ; preds = %30
store i32 0, i32* %2
br label %34
34: ; preds = %52, %33
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 5
br i1 %36, label %37, label %55
37: ; preds = %34
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = call double @eval(i32 %40, i32 %41)
%43 = fdiv double %42, 5.000000e+00
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %4, i64 0, i64 %45
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [5 x float], [5 x float]* %46, i64 0, i64 %48
%50 = load float, float* %49
%51 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %38, i32 %39, double %43, float %50)
br label %52
52: ; preds = %37
%53 = load i32, i32* %2
%54 = add nsw i32 %53, 1
store i32 %54, i32* %2
br label %34
55: ; preds = %34
br label %56
56: ; preds = %55
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %30
59: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"data[%i][%i] should be %f, is %f\0A\00"
define i32 @main() {
%1 = alloca [5 x [5 x float]]
%2 = bitcast [5 x [5 x float]]* %1 to i8*
%3 = tail call float @density(i32 0, i32 0)
%4 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 0, i64 0
store float %3, float* %4
%5 = tail call float @density(i32 1, i32 0)
%6 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 1, i64 0
store float %5, float* %6
%7 = tail call float @density(i32 2, i32 0)
%8 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 2, i64 0
store float %7, float* %8
%9 = tail call float @density(i32 3, i32 0)
%10 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 3, i64 0
store float %9, float* %10
%11 = tail call float @density(i32 4, i32 0)
%12 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 4, i64 0
store float %11, float* %12
%13 = tail call float @density(i32 0, i32 1)
%14 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 0, i64 1
store float %13, float* %14
%15 = tail call float @density(i32 1, i32 1)
%16 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 1, i64 1
store float %15, float* %16
%17 = tail call float @density(i32 2, i32 1)
%18 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 2, i64 1
store float %17, float* %18
%19 = tail call float @density(i32 3, i32 1)
%20 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 3, i64 1
store float %19, float* %20
%21 = tail call float @density(i32 4, i32 1)
%22 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 4, i64 1
store float %21, float* %22
%23 = tail call float @density(i32 0, i32 2)
%24 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 0, i64 2
store float %23, float* %24
%25 = tail call float @density(i32 1, i32 2)
%26 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 1, i64 2
store float %25, float* %26
%27 = tail call float @density(i32 2, i32 2)
%28 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 2, i64 2
store float %27, float* %28
%29 = tail call float @density(i32 3, i32 2)
%30 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 3, i64 2
store float %29, float* %30
%31 = tail call float @density(i32 4, i32 2)
%32 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 4, i64 2
store float %31, float* %32
%33 = tail call float @density(i32 0, i32 3)
%34 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 0, i64 3
store float %33, float* %34
%35 = tail call float @density(i32 1, i32 3)
%36 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 1, i64 3
store float %35, float* %36
%37 = tail call float @density(i32 2, i32 3)
%38 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 2, i64 3
store float %37, float* %38
%39 = tail call float @density(i32 3, i32 3)
%40 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 3, i64 3
store float %39, float* %40
%41 = tail call float @density(i32 4, i32 3)
%42 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 4, i64 3
store float %41, float* %42
%43 = tail call float @density(i32 0, i32 4)
%44 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 0, i64 4
store float %43, float* %44
%45 = tail call float @density(i32 1, i32 4)
%46 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 1, i64 4
store float %45, float* %46
%47 = tail call float @density(i32 2, i32 4)
%48 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 2, i64 4
store float %47, float* %48
%49 = tail call float @density(i32 3, i32 4)
%50 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 3, i64 4
store float %49, float* %50
%51 = tail call float @density(i32 4, i32 4)
%52 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 4, i64 4
store float %51, float* %52
br label %53
53: ; preds = %0, %53
%54 = phi i64 [ 0, %0 ], [ %81, %53 ]
%55 = trunc i64 %54 to i32
%56 = tail call double @eval(i32 0, i32 %55)
%57 = fdiv double %56, 5.000000e+00
%58 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 0, i64 %54
%59 = load float, float* %58
%60 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 0, i32 %55, double %57, float %59)
%61 = tail call double @eval(i32 1, i32 %55)
%62 = fdiv double %61, 5.000000e+00
%63 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 1, i64 %54
%64 = load float, float* %63
%65 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 1, i32 %55, double %62, float %64)
%66 = tail call double @eval(i32 2, i32 %55)
%67 = fdiv double %66, 5.000000e+00
%68 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 2, i64 %54
%69 = load float, float* %68
%70 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 2, i32 %55, double %67, float %69)
%71 = tail call double @eval(i32 3, i32 %55)
%72 = fdiv double %71, 5.000000e+00
%73 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 3, i64 %54
%74 = load float, float* %73
%75 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 3, i32 %55, double %72, float %74)
%76 = tail call double @eval(i32 4, i32 %55)
%77 = fdiv double %76, 5.000000e+00
%78 = getelementptr inbounds [5 x [5 x float]], [5 x [5 x float]]* %1, i64 0, i64 4, i64 %54
%79 = load float, float* %78
%80 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 4, i32 %55, double %77, float %79)
%81 = add nuw nsw i64 %54, 1
%82 = icmp eq i64 %81, 5
br i1 %82, label %83, label %53
83: ; preds = %53
ret i32 0
}