#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 *, float *, float *, float *);
int main() {
  float num1, num2, num3, greatest;
  printf("Enter three numbers: ");
  scanf("%f %f %f", &num1, &num2, &num3);
  num1 > num2 ? (num1 > num3 ? (greatest = num1) : (greatest = num3))
              : (num2 > num3 ? (greatest = num2) : (greatest = num3));
  printf("Greatest of %.2f, %.2f and %.2f = %.2f\n", num1, num2, num3,
         greatest);
}


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    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11a0 <main+0x80>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1187 <main+0x67>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  %xmm0,-0x18(%rbp)
jmp    1196 <main+0x76>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
jmp    11d7 <main+0xb7>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11c3 <main+0xa3>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  %xmm0,-0x1c(%rbp)
jmp    11d2 <main+0xb2>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x14(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe1d(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
movss  0x14(%rsp),%xmm3
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
cvtss2sd %xmm3,%xmm0
maxss  %xmm1,%xmm3
maxss  %xmm2,%xmm3
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
lea    0xea1(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"Enter three numbers: \00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [40 x i8] c"Greatest of %.2f, %.2f and %.2f = %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fcmp ogt float %9, %10
%12 = load float, float* %3
%13 = select i1 %11, float %9, float %10
%14 = fcmp ogt float %13, %12
%15 = select i1 %14, float %13, float %12
%16 = fpext float %9 to double
%17 = fpext float %10 to double
%18 = fpext float %12 to double
%19 = fpext float %15 to double
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double %16, double %17, double %18, double %19)
ret i32 0
}