#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 main() {
  int A[10], C[5] = {5, 4, 3, 2, 1}, i, j;
  double D[3][2] = {0.0};
  printf("Array Example 1 - Index Referencing\n\n");
  printf("%d\n", C[0]);
  A[3] = C[1];
  printf("%d\n", A[3]);
  A[6] = C[2] + C[3] + 3;
  printf("%d\n\n", A[6]);
  printf("%d %d %d %d %d\n\n", C[0], C[1], C[2], C[3], C[4]);
  D[2][1] = 127.3;
  D[0][0] = 45.75;
  D[0][1] = -65.8;
  for (i = 0; i < 5; i++)
    printf("%d ", C[i]);
  printf("\n\n");
  for (i = 0; i < 3; i++)
    for (j = 0; j < 2; j++)
      printf("%2.2lf ", D[i][j]);
  printf("\n\n");
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 2; j++)
      printf("%2.2lf ", D[i][j]);
    printf("\n");
  }
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xee7(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xee4(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xee2(%rip),%eax
mov    %eax,-0x40(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%esi
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    -0x44(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    -0x40(%rbp),%r9d
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe32(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe1d(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe05(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1238 <main+0x118>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    120a <main+0xea>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jge    12b2 <main+0x192>
movl   $0x0,-0x58(%rbp)
cmpl   $0x2,-0x58(%rbp)
jge    129f <main+0x17f>
movslq -0x54(%rbp),%rcx
lea    -0x90(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xde9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    125e <main+0x13e>
jmp    12a4 <main+0x184>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    124d <main+0x12d>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jge    1335 <main+0x215>
movl   $0x0,-0x58(%rbp)
cmpl   $0x2,-0x58(%rbp)
jge    1319 <main+0x1f9>
movslq -0x54(%rbp),%rcx
lea    -0x90(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xd6f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    12d8 <main+0x1b8>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12c7 <main+0x1a7>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x5,%esi
mov    $0x4,%edx
mov    $0x3,%ecx
mov    $0x2,%r8d
mov    $0x1,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe85(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe31(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe28(%rip),%rbx
movsd  0xdef(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xde5(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xdb4(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
movsd  0xd87(%rip),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0xd7d(%rip),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0xd38(%rip),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [5 x i8] c"%d\0A\0A\00"
@.str.3 = [17 x i8] c"%d %d %d %d %d\0A\0A\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.6 = [8 x i8] c"%2.2lf \00"
@str = [37 x i8] c"Array Example 1 - Index Referencing\0A\00"
@str.10 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 8)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 5, i32 4, i32 3, i32 2, i32 1)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 4)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 2)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 1)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 4.575000e+01)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double -6.580000e+01)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 1.273000e+02)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 4.575000e+01)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double -6.580000e+01)
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00)
%24 = tail call i32 @putchar(i32 10)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double 1.273000e+02)
%27 = tail call i32 @putchar(i32 10)
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}