#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 *);
int main() {
  double a, b, c, x;
  double min, max;
  printf("Wprowadz trzy liczby: \n");
  scanf("%lf %lf %lf", &a, &b, &c);
  x = a + b + c;
  printf("Suma wynosi: %.2lf\n", x);
  x = a * b * c;
  printf("Iloczyn wynosi: %.2lf\n", x);
  min = a;
  if (b < min) {
    min = b;
  }
  if (c < min) {
    min = c;
  }
  printf("Najmniejsza liczba to: %.2lf\n", min);
  max = a;
  if (b > max) {
    max = b;
  }
  if (c > max) {
    max = c;
  }
  printf("Najwieksza liczba to : %.2lf\n", max);
  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    0xed4(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xeaf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe9c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11cb <main+0xab>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e9 <main+0xc9>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe5a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1220 <main+0x100>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    123a <main+0x11a>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xe27(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   1050 <scanf@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  (%rsp),%xmm0
lea    0xe90(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm1
minsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm0
minsd  %xmm1,%xmm0
lea    0xe84(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm1
maxsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm0
maxsd  %xmm1,%xmm0
lea    0xe7f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Wprowadz trzy liczby: \0A\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [20 x i8] c"Suma wynosi: %.2lf\0A\00"
@.str.3 = [23 x i8] c"Iloczyn wynosi: %.2lf\0A\00"
@.str.4 = [30 x i8] c"Najmniejsza liczba to: %.2lf\0A\00"
@.str.5 = [30 x i8] c"Najwieksza liczba to : %.2lf\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
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%10 = load double, double* %2
%11 = load double, double* %3
%12 = fadd double %10, %11
%13 = load double, double* %4
%14 = fadd double %12, %13
store double %14, double* %5
%15 = load double, double* %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %15)
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = load double, double* %4
%21 = fmul double %19, %20
store double %21, double* %5
%22 = load double, double* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %22)
%24 = load double, double* %2
store double %24, double* %6
%25 = load double, double* %3
%26 = load double, double* %6
%27 = fcmp olt double %25, %26
br i1 %27, label %28, label %30
28: ; preds = %0
%29 = load double, double* %3
store double %29, double* %6
br label %30
30: ; preds = %28, %0
%31 = load double, double* %4
%32 = load double, double* %6
%33 = fcmp olt double %31, %32
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load double, double* %4
store double %35, double* %6
br label %36
36: ; preds = %34, %30
%37 = load double, double* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %37)
%39 = load double, double* %2
store double %39, double* %7
%40 = load double, double* %3
%41 = load double, double* %7
%42 = fcmp ogt double %40, %41
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = load double, double* %3
store double %44, double* %7
br label %45
45: ; preds = %43, %36
%46 = load double, double* %4
%47 = load double, double* %7
%48 = fcmp ogt double %46, %47
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = load double, double* %4
store double %50, double* %7
br label %51
51: ; preds = %49, %45
%52 = load double, double* %7
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %52)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [20 x i8] c"Suma wynosi: %.2lf\0A\00"
@.str.3 = [23 x i8] c"Iloczyn wynosi: %.2lf\0A\00"
@.str.4 = [30 x i8] c"Najmniejsza liczba to: %.2lf\0A\00"
@.str.5 = [30 x i8] c"Najwieksza liczba to : %.2lf\0A\00"
@str = [23 x i8] c"Wprowadz trzy liczby: \00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%9 = load double, double* %1
%10 = load double, double* %2
%11 = fadd double %9, %10
%12 = load double, double* %3
%13 = fadd double %11, %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %13)
%15 = load double, double* %1
%16 = load double, double* %2
%17 = fmul double %15, %16
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = load double, double* %1
%22 = load double, double* %2
%23 = fcmp olt double %22, %21
%24 = select i1 %23, double %22, double %21
%25 = load double, double* %3
%26 = fcmp olt double %25, %24
%27 = select i1 %26, double %25, double %24
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %27)
%29 = load double, double* %1
%30 = load double, double* %2
%31 = fcmp ogt double %30, %29
%32 = select i1 %31, double %30, double %29
%33 = load double, double* %3
%34 = fcmp ogt double %33, %32
%35 = select i1 %34, double %33, double %32
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %35)
ret i32 0
}