void main(void) {
  static int score[10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
  int i;
  int average;
  printf("	Memory Loc	Array Element	Content\n");
  for (i = 0; i < sizeof(score) / sizeof(score[0]); i++) {
    printf("	%d		score[%d]	%d\n", &score[i], i, score[i]);
  }
  average = compute_avg(score, sizeof(score) / sizeof(score[0]));
  printf("\n Score Average = %d \n", average);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xa,%rax
jae    118a <main+0x6a>
movslq -0x4(%rbp),%rax
lea    0x2eea(%rip),%rsi
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x4(%rbp),%edx
movslq -0x4(%rbp),%rcx
lea    0x2ed5(%rip),%rax
mov    (%rax,%rcx,4),%ecx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <main+0x1d>
lea    0x2eaf(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1040 <compute_avg@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
mov    0x2efa(%rip),%ecx
lea    0x2ef3(%rip),%r14
lea    0xeac(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2edb(%rip),%ecx
lea    0x2ed4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ec3(%rip),%ecx
lea    0x2ebc(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2eab(%rip),%ecx
lea    0x2ea4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e93(%rip),%ecx
lea    0x2e8c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e7b(%rip),%ecx
lea    0x2e74(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e63(%rip),%ecx
lea    0x2e5c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e4b(%rip),%ecx
lea    0x2e44(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e33(%rip),%ecx
lea    0x2e2c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e1b(%rip),%ecx
lea    0x2e14(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <compute_avg@plt>
lea    0xd9e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@main.score = internal global [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100]
@.str = [35 x i8] c"\09Memory Loc\09Array Element\09Content\0A\00"
@.str.1 = [19 x i8] c"\09%d\09\09score[%d]\09%d\0A\00"
@.str.2 = [23 x i8] c"\0A Score Average = %d \0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %4
4: ; preds = %18, %0
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = icmp ult i64 %6, 10
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* @main.score, i64 0, i64 %10
%12 = load i32, i32* %1
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* @main.score, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %11, i32 %12, i32 %16)
br label %18
18: ; preds = %8
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %4
21: ; preds = %4
%22 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @compute_avg to i32 (i32*, i64, ...)*)(i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 0), i64 10)
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %23)
ret void
}

LLVM IR (-O2):
@main.score = internal global [10 x i32] [i32 10, i32 20, i32 30, i32 40, i32 50, i32 60, i32 70, i32 80, i32 90, i32 100]
@.str.1 = [19 x i8] c"\09%d\09\09score[%d]\09%d\0A\00"
@.str.2 = [23 x i8] c"\0A Score Average = %d \0A\00"
@str = [34 x i8] c"\09Memory Loc\09Array Element\09Content\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 0), i32 0, i32 %2)
%4 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 1)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 1), i32 1, i32 %4)
%6 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 2), i32 2, i32 %6)
%8 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 3), i32 3, i32 %8)
%10 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 4)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 4), i32 4, i32 %10)
%12 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 5)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 5), i32 5, i32 %12)
%14 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 6)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 6), i32 6, i32 %14)
%16 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 7)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 7), i32 7, i32 %16)
%18 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 8)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 8), i32 8, i32 %18)
%20 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 9)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 9), i32 9, i32 %20)
%22 = tail call i32 (i32*, i64, ...) bitcast (i32 (...)* @compute_avg to i32 (i32*, i64, ...)*)(i32* getelementptr inbounds ([10 x i32], [10 x i32]* @main.score, i64 0, i64 0), i64 10)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %22)
ret void
}