#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 max, num[5];
  printf("Enter the number: \n");
  for (int i = 0; i < 5; i++) {
    printf("> ");
    scanf("%d", &num[i]);
  }
  max = num[0];
  for (int i = 0; i < 5; i++) {
    if (max < num[i]) {
      max = num[i];
    }
  }
  printf("The largest number is %d", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1185 <main+0x65>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xebb(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <main+0x24>
mov    -0x20(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11cb <main+0xab>
mov    -0x8(%rbp),%eax
movslq -0x28(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jge    11b8 <main+0x98>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x8(%rbp)
jmp    11bd <main+0x9d>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1192 <main+0x72>
mov    -0x8(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0x8(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0xc(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
mov    0x10(%rsp),%eax
cmp    %eax,%esi
cmovl  %eax,%esi
lea    0xe13(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter the number: \0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [25 x i8] c"The largest number is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %14)
br label %16
16: ; preds = %10
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %7
19: ; preds = %7
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%21 = load i32, i32* %20
store i32 %21, i32* %2
store i32 0, i32* %5
br label %22
22: ; preds = %38, %19
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 5
br i1 %24, label %25, label %41
25: ; preds = %22
%26 = load i32, i32* %2
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = icmp slt i32 %26, %30
br i1 %31, label %32, label %37
32: ; preds = %25
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %2
br label %37
37: ; preds = %32, %25
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %22
41: ; preds = %22
%42 = load i32, i32* %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %42)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [25 x i8] c"The largest number is %d\00"
@str = [19 x i8] c"Enter the number: \00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
%22 = select i1 %21, i32 %20, i32 %19
%23 = load i32, i32* %11
%24 = icmp slt i32 %22, %23
%25 = select i1 %24, i32 %23, i32 %22
%26 = load i32, i32* %14
%27 = icmp slt i32 %25, %26
%28 = select i1 %27, i32 %26, i32 %25
%29 = load i32, i32* %17
%30 = icmp slt i32 %28, %29
%31 = select i1 %30, i32 %29, i32 %28
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %31)
ret i32 0
}