#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float F[5];
  float F1[10] = {1.2F, 1.1F, -10.9F, 7.34F};
  int TableA[3][4] = {{6, 15, -2, 0}, {12, 90, 5, 43}, {-50, 20, 1, 10}};
  int i, j, sum;
  printf("Array Example 3\n\n");
  for (i = 0; i < 5; i++)
    scanf("%f", &F[i]);
  printf("\n");
  for (i = 0; i < 5; i++)
    printf("%2.2f\n", F[i]);
  sum = 0;
  for (i = 0; i < 3; i++)
    for (j = 0; j < 4; j++)
      sum += TableA[i][j];
  printf("Sum of TableA is %d.\n\n", sum);
  for (i = 0; i < 3; i++)
    for (j = 0; j < 4; j++)
      if (TableA[i][j] > 0)
        printf("Position %d,%d is positive: %d\n", i, j, TableA[i][j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  0xe91(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  0xe80(%rip),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xe6f(%rip),%xmm0
movss  %xmm0,-0x44(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
cmpl   $0x5,-0x84(%rbp)
jge    1202 <main+0xc2>
movslq -0x84(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe69(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11c3 <main+0x83>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
cmpl   $0x5,-0x84(%rbp)
jge    125a <main+0x11a>
movslq -0x84(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe16(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    121a <main+0xda>
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x3,-0x84(%rbp)
jge    12e7 <main+0x1a7>
movl   $0x0,-0x88(%rbp)
cmpl   $0x4,-0x88(%rbp)
jge    12ce <main+0x18e>
movslq -0x84(%rbp),%rcx
lea    -0x80(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x8c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1285 <main+0x145>
jmp    12d3 <main+0x193>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    126e <main+0x12e>
mov    -0x8c(%rbp),%esi
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
cmpl   $0x3,-0x84(%rbp)
jge    13b4 <main+0x274>
movl   $0x0,-0x88(%rbp)
cmpl   $0x4,-0x88(%rbp)
jge    139b <main+0x25b>
movslq -0x84(%rbp),%rcx
lea    -0x80(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x88(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    1382 <main+0x242>
mov    -0x84(%rbp),%esi
mov    -0x88(%rbp),%edx
movslq -0x84(%rbp),%rcx
lea    -0x80(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1387 <main+0x247>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    131c <main+0x1dc>
jmp    13a0 <main+0x260>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1305 <main+0x1c5>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xef5(%rip),%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe52(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdf8(%rip),%rdi
mov    $0x96,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdfc(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x6,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0xf,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0xc,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x5a,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x5,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x2b,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    $0x14,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.TableA = [3 x [4 x i32]] [[4 x i32] [i32 6, i32 15, i32 -2, i32 0], [4 x i32] [i32 12, i32 90, i32 5, i32 43], [4 x i32] [i32 -50, i32 20, i32 1, i32 10]]
@.str = [18 x i8] c"Array Example 3\0A\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [7 x i8] c"%2.2f\0A\00"
@.str.4 = [23 x i8] c"Sum of TableA is %d.\0A\0A\00"
@.str.5 = [32 x i8] c"Position %d,%d is positive: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x float]
%3 = alloca [10 x float]
%4 = alloca [3 x [4 x i32]]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x float]* %3 to i8*
%9 = bitcast i8* %8 to [10 x float]*
%10 = getelementptr inbounds [10 x float], [10 x float]* %9, i32 0, i32 0
store float 0x3FF3333340000000, float* %10
%11 = getelementptr inbounds [10 x float], [10 x float]* %9, i32 0, i32 1
store float 0x3FF19999A0000000, float* %11
%12 = getelementptr inbounds [10 x float], [10 x float]* %9, i32 0, i32 2
store float 0xC025CCCCC0000000, float* %12
%13 = getelementptr inbounds [10 x float], [10 x float]* %9, i32 0, i32 3
store float 0x401D5C2900000000, float* %13
%14 = bitcast [3 x [4 x i32]]* %4 to i8*
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %16
16: ; preds = %24, %0
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %16
27: ; preds = %16
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %29
29: ; preds = %39, %27
%30 = load i32, i32* %5
%31 = icmp slt i32 %30, 5
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x float], [5 x float]* %2, i64 0, i64 %34
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %37)
br label %39
39: ; preds = %32
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %29
42: ; preds = %29
store i32 0, i32* %7
store i32 0, i32* %5
br label %43
43: ; preds = %64, %42
%44 = load i32, i32* %5
%45 = icmp slt i32 %44, 3
br i1 %45, label %46, label %67
46: ; preds = %43
store i32 0, i32* %6
br label %47
47: ; preds = %60, %46
%48 = load i32, i32* %6
%49 = icmp slt i32 %48, 4
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %4, i64 0, i64 %52
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [4 x i32], [4 x i32]* %53, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, %57
store i32 %59, i32* %7
br label %60
60: ; preds = %50
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
store i32 %62, i32* %6
br label %47
63: ; preds = %47
br label %64
64: ; preds = %63
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %43
67: ; preds = %43
%68 = load i32, i32* %7
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %68)
store i32 0, i32* %5
br label %70
70: ; preds = %102, %67
%71 = load i32, i32* %5
%72 = icmp slt i32 %71, 3
br i1 %72, label %73, label %105
73: ; preds = %70
store i32 0, i32* %6
br label %74
74: ; preds = %98, %73
%75 = load i32, i32* %6
%76 = icmp slt i32 %75, 4
br i1 %76, label %77, label %101
77: ; preds = %74
%78 = load i32, i32* %5
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %4, i64 0, i64 %79
%81 = load i32, i32* %6
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [4 x i32], [4 x i32]* %80, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = icmp sgt i32 %84, 0
br i1 %85, label %86, label %97
86: ; preds = %77
%87 = load i32, i32* %5
%88 = load i32, i32* %6
%89 = load i32, i32* %5
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %4, i64 0, i64 %90
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [4 x i32], [4 x i32]* %91, i64 0, i64 %93
%95 = load i32, i32* %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %87, i32 %88, i32 %95)
br label %97
97: ; preds = %86, %77
br label %98
98: ; preds = %97
%99 = load i32, i32* %6
%100 = add nsw i32 %99, 1
store i32 %100, i32* %6
br label %74
101: ; preds = %74
br label %102
102: ; preds = %101
%103 = load i32, i32* %5
%104 = add nsw i32 %103, 1
store i32 %104, i32* %5
br label %70
105: ; preds = %70
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [7 x i8] c"%2.2f\0A\00"
@.str.4 = [23 x i8] c"Sum of TableA is %d.\0A\0A\00"
@.str.5 = [32 x i8] c"Position %d,%d is positive: %d\0A\00"
@str = [17 x i8] c"Array Example 3\0A\00"
define i32 @main() {
%1 = alloca [5 x float]
%2 = bitcast [5 x float]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%6 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%8 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%10 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 3
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%12 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 4
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %12)
%14 = call i32 @putchar(i32 10)
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %16)
%18 = load float, float* %6
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = load float, float* %8
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %22)
%24 = load float, float* %10
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %25)
%27 = load float, float* %12
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 150)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 0, i32 0, i32 6)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 0, i32 1, i32 15)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 0, i32 12)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 1, i32 90)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 2, i32 5)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 3, i32 43)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 2, i32 1, i32 20)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 2, i32 2, i32 1)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 2, i32 3, i32 10)
ret i32 0
}