#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);
void largest(int a, int b, int c) {
  if (a > b && a > c) {
    printf("The largest number is %d \n", a);
  } else if (b > a && b > c) {
    printf("The largest number is %d \n", b);
  } else {
    printf("The largest number is %d \n", c);
  }
}


x86 assembly (clang, -O0):
<largest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    114d <largest+0x3d>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    114d <largest+0x3d>
mov    -0x4(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    118d <largest+0x7d>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1179 <largest+0x69>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1179 <largest+0x69>
mov    -0x8(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
jmp    1188 <largest+0x78>
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
jmp    118d <largest+0x7d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<largest>:
cmp    %edx,%esi
mov    %edx,%ecx
cmovg  %esi,%ecx
cmp    %edi,%esi
cmovle %edx,%ecx
cmp    %edx,%edi
mov    %ecx,%eax
cmovg  %edi,%eax
cmp    %esi,%edi
cmovle %ecx,%eax
lea    0xed1(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [27 x i8] c"The largest number is %d \0A\00"
define void @largest(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = and i1 %4, %5
%7 = icmp sgt i32 %1, %0
%8 = icmp sgt i32 %1, %2
%9 = and i1 %7, %8
%10 = select i1 %9, i32 %1, i32 %2
%11 = select i1 %6, i32 %0, i32 %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %11)
ret void
}