#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 *, double *, double *, double *, double *);
int main() {
  double a, b, c, d, m, n, p;
  printf("Please enter 4 numbers separated by spaces > ");
  scanf("%lf"
        "%lf"
        "%lf"
        "%lf",
        &a, &b, &c, &d);
  if (a > b)
    m = b;
  else if (a < b)
    m = a;
  if (m > c)
    n = c;
  else if (m < c)
    n = m;
  if (n > d)
    p = d;
  else if (n < d)
    p = n;
  printf("%.0f is the smallest\n", p);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1178 <main+0x58>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    119b <main+0x7b>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1196 <main+0x76>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    119b <main+0x7b>
movsd  -0x30(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ba <main+0x9a>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11dd <main+0xbd>
movsd  -0x30(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d8 <main+0xb8>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11dd <main+0xbd>
movsd  -0x38(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11fc <main+0xdc>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    121f <main+0xff>
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    121a <main+0xfa>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    121f <main+0xff>
movsd  -0x40(%rbp),%xmm0
lea    0xe10(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
movsd  0x18(%rsp),%xmm0
minsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
minsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
minsd  %xmm1,%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Please enter 4 numbers separated by spaces > \00"
@.str.1 = [13 x i8] c"%lf%lf%lf%lf\00"
@.str.2 = [22 x i8] c"%.0f is the smallest\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4, double* %5)
%11 = load double, double* %2
%12 = load double, double* %3
%13 = fcmp ogt double %11, %12
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = load double, double* %3
store double %15, double* %6
br label %23
16: ; preds = %0
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fcmp olt double %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load double, double* %2
store double %21, double* %6
br label %22
22: ; preds = %20, %16
br label %23
23: ; preds = %22, %14
%24 = load double, double* %6
%25 = load double, double* %4
%26 = fcmp ogt double %24, %25
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load double, double* %4
store double %28, double* %7
br label %36
29: ; preds = %23
%30 = load double, double* %6
%31 = load double, double* %4
%32 = fcmp olt double %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = load double, double* %6
store double %34, double* %7
br label %35
35: ; preds = %33, %29
br label %36
36: ; preds = %35, %27
%37 = load double, double* %7
%38 = load double, double* %5
%39 = fcmp ogt double %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load double, double* %5
store double %41, double* %8
br label %49
42: ; preds = %36
%43 = load double, double* %7
%44 = load double, double* %5
%45 = fcmp olt double %43, %44
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load double, double* %7
store double %47, double* %8
br label %48
48: ; preds = %46, %42
br label %49
49: ; preds = %48, %40
%50 = load double, double* %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"Please enter 4 numbers separated by spaces > \00"
@.str.1 = [13 x i8] c"%lf%lf%lf%lf\00"
@.str.2 = [22 x i8] c"%.0f is the smallest\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3, double* %4)
%11 = load double, double* %1
%12 = load double, double* %2
%13 = fcmp ogt double %11, %12
%14 = select i1 %13, double %12, double %11
%15 = load double, double* %3
%16 = fcmp ogt double %14, %15
%17 = select i1 %16, double %15, double %14
%18 = load double, double* %4
%19 = fcmp ogt double %17, %18
%20 = select i1 %19, double %18, double %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %20)
ret i32 0
}