void main() {
  int score[5], i, total = 0;
  char subjects[5][25] = {"Math", "Khmer", "C Programming", "English",
                          "Speech and Oral"};
  printf("===Enter your points: \n");
  for (i = 0; i < 85; i++)
    printf("+");
  for (i = 0; i < 5; i++) {
    printf("\n--> %s : ", subjects[i]);
    scanf("%d", &score[i]);
    total = total + score[i];
  }
  for (i = 0; i < 85; i++)
    printf("+");
  printf("\nThe addition of five subjects is: %d\n", total);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x28(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x7d,%edx
call   1040 <memcpy@plt>
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x55,-0x24(%rbp)
jge    1195 <main+0x65>
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116f <main+0x3f>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11ff <main+0xcf>
movslq -0x24(%rbp),%rax
lea    -0xb0(%rbp),%rsi
imul   $0x19,%rax,%rax
add    %rax,%rsi
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x28(%rbp),%eax
movslq -0x24(%rbp),%rcx
add    -0x20(%rbp,%rcx,4),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119c <main+0x6c>
movl   $0x0,-0x24(%rbp)
cmpl   $0x55,-0x24(%rbp)
jge    122c <main+0xfc>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1206 <main+0xd6>
mov    -0x28(%rbp),%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
movups 0xf15(%rip),%xmm0
movups %xmm0,0x8d(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xea2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe6a(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe4e(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xef4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x55,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x2b,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11d0 <main+0x90>
lea    0xe97(%rip),%r14
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8c(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    (%rsp),%eax
mov    %eax,0x1c(%rsp)
lea    0x39(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%r12d
lea    0x52(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%r13d
lea    0x6b(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%r15d
lea    0x84(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    $0x55,%ebp
mov    0x10(%rsp),%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2b,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    12b0 <main+0x170>
add    0x1c(%rsp),%r12d
add    %r12d,%r13d
add    %r13d,%r15d
add    %r15d,%ebx
lea    0xdb7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.subjects = [5 x [25 x i8]] [[25 x i8] c"Math\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"Khmer\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"C Programming\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"English\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"Speech and Oral\00\00\00\00\00\00\00\00\00\00"]
@.str = [24 x i8] c"===Enter your points: \0A\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [11 x i8] c"\0A--> %s : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [39 x i8] c"\0AThe addition of five subjects is: %d\0A\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x [25 x i8]]
store i32 0, i32* %3
%5 = bitcast [5 x [25 x i8]]* %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %12, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 85
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %7
15: ; preds = %7
store i32 0, i32* %2
br label %16
16: ; preds = %35, %15
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %38
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x [25 x i8]], [5 x [25 x i8]]* %4, i64 0, i64 %21
%23 = getelementptr inbounds [25 x i8], [25 x i8]* %22, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %26
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %27)
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nsw i32 %29, %33
store i32 %34, i32* %3
br label %35
35: ; preds = %19
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %16
38: ; preds = %16
store i32 0, i32* %2
br label %39
39: ; preds = %44, %38
%40 = load i32, i32* %2
%41 = icmp slt i32 %40, 85
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %39
47: ; preds = %39
%48 = load i32, i32* %3
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %48)
ret void
}

LLVM IR (-O2):
@__const.main.subjects = [5 x [25 x i8]] [[25 x i8] c"Math\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"Khmer\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"C Programming\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"English\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [25 x i8] c"Speech and Oral\00\00\00\00\00\00\00\00\00\00"]
@.str.2 = [11 x i8] c"\0A--> %s : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [39 x i8] c"\0AThe addition of five subjects is: %d\0A\00"
@str = [23 x i8] c"===Enter your points: \00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x [25 x i8]]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x [25 x i8]], [5 x [25 x i8]]* %2, i64 0, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 0, %0 ], [ %9, %6 ]
%8 = tail call i32 @putchar(i32 43)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, 85
br i1 %10, label %11, label %6
11: ; preds = %6
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %13
%16 = getelementptr inbounds [5 x [25 x i8]], [5 x [25 x i8]]* %2, i64 0, i64 1, i64 0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %18)
%20 = load i32, i32* %18
%21 = getelementptr inbounds [5 x [25 x i8]], [5 x [25 x i8]]* %2, i64 0, i64 2, i64 0
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %23)
%25 = load i32, i32* %23
%26 = getelementptr inbounds [5 x [25 x i8]], [5 x [25 x i8]]* %2, i64 0, i64 3, i64 0
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %28)
%30 = load i32, i32* %28
%31 = getelementptr inbounds [5 x [25 x i8]], [5 x [25 x i8]]* %2, i64 0, i64 4, i64 0
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %33)
%35 = load i32, i32* %33
br label %36
36: ; preds = %11, %36
%37 = phi i32 [ 0, %11 ], [ %39, %36 ]
%38 = call i32 @putchar(i32 43)
%39 = add nuw nsw i32 %37, 1
%40 = icmp eq i32 %39, 85
br i1 %40, label %41, label %36
41: ; preds = %36
%42 = add nsw i32 %20, %15
%43 = add nsw i32 %25, %42
%44 = add nsw i32 %30, %43
%45 = add nsw i32 %35, %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %45)
ret void
}