#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 n1, n2, n3;
  printf("enter three numbers:\n");
  scanf("%d%d%d", &n1, &n2, &n3);
  if (n1 > n2 && n1 > n3)
    printf("%d is largest\n", n1);
  else if (n2 > n1 && n2 > n3)
    printf("%d is largest\n", n2);
  else if (n3 > n1 && n3 > n2)
    printf("%d is largest\n", n3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1183 <main+0x63>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1183 <main+0x63>
mov    -0x8(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e4 <main+0xc4>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11b1 <main+0x91>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11b1 <main+0x91>
mov    -0xc(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <main+0xbf>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11da <main+0xba>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11da <main+0xba>
mov    -0x10(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <main+0xbf>
jmp    11e4 <main+0xc4>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%esi
cmp    %eax,%ecx
jle    1173 <main+0x43>
cmp    %esi,%ecx
jle    1173 <main+0x43>
mov    %ecx,%esi
jmp    1187 <main+0x57>
cmp    %ecx,%eax
jle    117f <main+0x4f>
cmp    %esi,%eax
jle    117f <main+0x4f>
mov    %eax,%esi
jmp    1187 <main+0x57>
cmp    %ecx,%esi
jle    1195 <main+0x65>
cmp    %eax,%esi
jle    1195 <main+0x65>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%d%d%d\00"
@.str.2 = [15 x i8] c"%d is largest\0A\00"
@str = [21 x i8] c"enter three numbers:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
%12 = load i32, i32* %3
%13 = icmp sgt i32 %9, %12
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %23, label %15
15: ; preds = %0
%16 = icmp sgt i32 %10, %9
%17 = icmp sgt i32 %10, %12
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = icmp sgt i32 %12, %9
%21 = icmp sgt i32 %12, %10
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %23, label %26
23: ; preds = %19, %15, %0
%24 = phi i32 [ %9, %0 ], [ %10, %15 ], [ %12, %19 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %19
ret i32 0
}