#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);
int main(void) {
  int numbers[4] = {6, 4, 12, 8};
  int i;
  int maxnum;
  for (i = 0; i < 4; i++) {
    if (i == 0) {
      maxnum = numbers[i];
    } else {
      if (numbers[i] > maxnum) {
        maxnum = numbers[i];
      }
    }
  }
  printf("Maximum number is %d", maxnum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1194 <main+0x84>
cmpl   $0x0,-0x24(%rbp)
jne    1160 <main+0x50>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x28(%rbp)
jmp    1181 <main+0x71>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
cmp    -0x28(%rbp),%eax
jle    117c <main+0x6c>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x28(%rbp)
jmp    1181 <main+0x71>
jmp    1186 <main+0x76>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113c <main+0x2c>
mov    -0x28(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"Maximum number is %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 12)
ret i32 0
}