#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 *, int *);
int main(void) {
  int marks[15], sum = 0;
  printf("Enter 15 students mark: ");
  for (int i = 0; i < 15; i++) {
    scanf("%d", &marks[i]);
    sum += marks[i];
  }
  printf("\nThe average mark is %d", sum / 15);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0xf,-0x48(%rbp)
jge    118c <main+0x6c>
movslq -0x48(%rbp),%rax
lea    -0x40(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec3(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    114b <main+0x2b>
mov    -0x44(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee8(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%eax
mov    %eax,0x4c(%rsp)
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,0x48(%rsp)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%r12d
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r13d
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x10(%rsp),%ebp
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%r14d
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x18(%rsp),%r15d
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
movss  0x1c(%rsp),%xmm0
movaps %xmm0,0x60(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x24(%rsp),%rsi
movss  0x20(%rsp),%xmm0
unpcklps 0x60(%rsp),%xmm0
movaps %xmm0,0x60(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x28(%rsp),%rsi
movss  0x24(%rsp),%xmm0
movaps %xmm0,0x50(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x2c(%rsp),%rsi
movss  0x28(%rsp),%xmm0
unpcklps 0x50(%rsp),%xmm0
unpcklpd 0x60(%rsp),%xmm0
movaps %xmm0,0x60(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x30(%rsp),%rsi
movss  0x2c(%rsp),%xmm0
movaps %xmm0,0x50(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x34(%rsp),%rsi
movss  0x30(%rsp),%xmm0
unpcklps 0x50(%rsp),%xmm0
movaps %xmm0,0x50(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x38(%rsp),%rsi
movss  0x34(%rsp),%xmm0
movaps %xmm0,0x70(%rsp)
mov    %rbx,%rdi
call   1040 <scanf@plt>
movd   0x38(%rsp),%xmm0
punpckldq 0x70(%rsp),%xmm0
punpcklqdq 0x50(%rsp),%xmm0
paddd  0x60(%rsp),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
add    %r15d,%eax
add    %r14d,%eax
add    %ebp,%eax
add    %r13d,%eax
add    %r12d,%eax
add    0x48(%rsp),%eax
add    0x4c(%rsp),%eax
movslq %eax,%rsi
imul   $0xffffffff88888889,%rsi,%rax
shr    $0x20,%rax
add    %eax,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x3,%esi
add    %eax,%esi
lea    0xd24(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter 15 students mark: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"\0AThe average mark is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 15
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, %17
store i32 %19, i32* %3
br label %20
20: ; preds = %9
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %6
%24 = load i32, i32* %3
%25 = sdiv i32 %24, 15
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter 15 students mark: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"\0AThe average mark is %d\00"
define i32 @main() {
%1 = alloca [15 x i32]
%2 = bitcast [15 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
%7 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = load i32, i32* %7
%10 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = load i32, i32* %10
%13 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %13
%16 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = load i32, i32* %19
%22 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 6
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %22
%25 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 7
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
%27 = load i32, i32* %25
%28 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 8
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %28)
%30 = load i32, i32* %28
%31 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 9
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = load i32, i32* %31
%34 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 10
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
%36 = load i32, i32* %34
%37 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 11
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %37)
%39 = load i32, i32* %37
%40 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 12
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %40)
%42 = load i32, i32* %40
%43 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 13
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %43)
%45 = load i32, i32* %43
%46 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 14
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %46)
%48 = load i32, i32* %46
%49 = insertelement <8 x i32> poison, i32 %48, i64 0
%50 = insertelement <8 x i32> %49, i32 %45, i64 1
%51 = insertelement <8 x i32> %50, i32 %42, i64 2
%52 = insertelement <8 x i32> %51, i32 %39, i64 3
%53 = insertelement <8 x i32> %52, i32 %36, i64 4
%54 = insertelement <8 x i32> %53, i32 %33, i64 5
%55 = insertelement <8 x i32> %54, i32 %30, i64 6
%56 = insertelement <8 x i32> %55, i32 %27, i64 7
%57 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %56)
%58 = add nsw i32 %57, %24
%59 = add nsw i32 %58, %21
%60 = add nsw i32 %59, %18
%61 = add nsw i32 %60, %15
%62 = add nsw i32 %61, %12
%63 = add nsw i32 %62, %9
%64 = add nsw i32 %63, %6
%65 = sdiv i32 %64, 15
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %65)
ret i32 0
}