#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 *, int *, int *);
main() {
  int a[3], max, i, k;
  printf("Input some numbers\n");
  scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
  max = a[0];
  for (i = 0; i < 4; i++)
    for (k = i; k < 4; k++)
      if (a[k] > max)
        max = a[k];
  printf("number %d is max\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    -0x10(%rbp),%rdx
add    $0x4,%rdx
lea    -0x10(%rbp),%rcx
add    $0x8,%rcx
lea    -0x10(%rbp),%r8
add    $0xc,%r8
lea    0xeb4(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    11ce <main+0xae>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11bb <main+0x9b>
movslq -0x1c(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
cmp    -0x14(%rbp),%eax
jle    11a8 <main+0x88>
movslq -0x1c(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
mov    %eax,-0x14(%rbp)
jmp    11ad <main+0x8d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <main+0x62>
jmp    11c0 <main+0xa0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <main+0x52>
mov    -0x14(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
mov    0x14(%rsp),%ecx
cmp    %esi,%ecx
cmovg  %ecx,%esi
mov    0x18(%rsp),%edx
cmp    %esi,%edx
cmovg  %edx,%esi
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %esi,%ecx
cmovg  %ecx,%esi
cmp    %esi,%edx
cmovg  %edx,%esi
cmp    %esi,%ecx
cmovg  %ecx,%esi
cmp    %esi,%edx
cmovg  %edx,%esi
cmp    %esi,%edx
cmovg  %edx,%esi
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [18 x i8] c"number %d is max\0A\00"
@str = [19 x i8] c"Input some numbers\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 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 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 3
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %7)
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = icmp sgt i32 %10, %9
%12 = select i1 %11, i32 %10, i32 %9
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, %12
%15 = select i1 %14, i32 %13, i32 %12
%16 = load i32, i32* %7
%17 = icmp sgt i32 %16, %15
%18 = select i1 %17, i32 %16, i32 %15
%19 = load i32, i32* %5
%20 = icmp sgt i32 %19, %18
%21 = select i1 %20, i32 %19, i32 %18
%22 = load i32, i32* %6
%23 = icmp sgt i32 %22, %21
%24 = select i1 %23, i32 %22, i32 %21
%25 = load i32, i32* %7
%26 = icmp sgt i32 %25, %24
%27 = select i1 %26, i32 %25, i32 %24
%28 = icmp sgt i32 %22, %27
%29 = select i1 %28, i32 %22, i32 %27
%30 = icmp sgt i32 %25, %29
%31 = select i1 %30, i32 %25, i32 %29
%32 = load i32, i32* %7
%33 = icmp sgt i32 %32, %31
%34 = select i1 %33, i32 %32, i32 %31
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %34)
ret i32 0
}