#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 *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  printf("CS 350 Lab 1 for %s\n\n", "***Jamal Kharrat Section 1 ***");
  int n = 5, a[5] = {1, 3, 5, 7, 9};
  int sum;
  for (int i = 1; i <= n; i++) {
    sum = sum + a[i];
  }
  int x;
  scanf("%d", &x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
mov    0xef0(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeed(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeeb(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1197 <main+0x77>
mov    -0x24(%rbp),%eax
movslq -0x28(%rbp),%rcx
add    -0x20(%rbp,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    116f <main+0x4f>
lea    0xe97(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xee7(%rip),%rsi
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"CS 350 Lab 1 for %s\0A\0A\00"
@.str.1 = [31 x i8] c"***Jamal Kharrat Section 1 ***\00"
@__const.main.a = [5 x i32] [i32 1, i32 3, i32 5, i32 7, i32 9]
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 5, i32* %2
%8 = bitcast [5 x i32]* %3 to i8*
store i32 1, i32* %5
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = add nsw i32 %14, %18
store i32 %19, i32* %4
br label %20
20: ; preds = %13
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %9
23: ; preds = %9
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"CS 350 Lab 1 for %s\0A\0A\00"
@.str.1 = [31 x i8] c"***Jamal Kharrat Section 1 ***\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
ret i32 0
}