#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 *, double, ...);
void displaySumSmallest(double n1, double n2, double n3, double n4) {
  double sum, smallest;
  printf("Values: %2.2lf %2.2lf %2.2lf %2.2lf\n", n1, n2, n3, n4);
  sum = n1 + n2 + n3 + n4;
  printf("The sum is: %2.2f\n", sum);
  smallest = n1;
  if (n2 < smallest)
    smallest = n2;
  if (n3 < smallest)
    smallest = n3;
  if (n4 < smallest)
    smallest = n4;
  printf("The smallest was %2.2lf\n\n", smallest);
}


x86 assembly (clang, -O0):
<displaySumSmallest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
lea    0xeb9(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xeb2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a2 <displaySumSmallest+0x92>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c0 <displaySumSmallest+0xb0>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11de <displaySumSmallest+0xce>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displaySumSmallest>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
lea    0xecd(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
lea    0xecc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
minsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
minsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
minsd  %xmm1,%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
add    $0x28,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Values: %2.2lf %2.2lf %2.2lf %2.2lf\0A\00"
@.str.1 = [19 x i8] c"The sum is: %2.2f\0A\00"
@.str.2 = [26 x i8] c"The smallest was %2.2lf\0A\0A\00"
define void @displaySumSmallest(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = load double, double* %6
%13 = load double, double* %7
%14 = load double, double* %8
%15 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %11, double %12, double %13, double %14)
%16 = load double, double* %5
%17 = load double, double* %6
%18 = fadd double %16, %17
%19 = load double, double* %7
%20 = fadd double %18, %19
%21 = load double, double* %8
%22 = fadd double %20, %21
store double %22, double* %9
%23 = load double, double* %9
%24 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %23)
%25 = load double, double* %5
store double %25, double* %10
%26 = load double, double* %6
%27 = load double, double* %10
%28 = fcmp olt double %26, %27
br i1 %28, label %29, label %31
29: ; preds = %4
%30 = load double, double* %6
store double %30, double* %10
br label %31
31: ; preds = %29, %4
%32 = load double, double* %7
%33 = load double, double* %10
%34 = fcmp olt double %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load double, double* %7
store double %36, double* %10
br label %37
37: ; preds = %35, %31
%38 = load double, double* %8
%39 = load double, double* %10
%40 = fcmp olt double %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = load double, double* %8
store double %42, double* %10
br label %43
43: ; preds = %41, %37
%44 = load double, double* %10
%45 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %44)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Values: %2.2lf %2.2lf %2.2lf %2.2lf\0A\00"
@.str.1 = [19 x i8] c"The sum is: %2.2f\0A\00"
@.str.2 = [26 x i8] c"The smallest was %2.2lf\0A\0A\00"
define void @displaySumSmallest(double %0, double %1, double %2, double %3) {
%5 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %2, double %3)
%6 = fadd double %0, %1
%7 = fadd double %6, %2
%8 = fadd double %7, %3
%9 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = fcmp olt double %1, %0
%11 = select i1 %10, double %1, double %0
%12 = fcmp ogt double %11, %2
%13 = select i1 %12, double %2, double %11
%14 = fcmp ogt double %13, %3
%15 = select i1 %14, double %3, double %13
%16 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %15)
ret void
}