#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("Wprowadź 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;
  }
  max = a;
  if (b > max) {
    max = b;
  }
  if (c > max) {
    max = c;
  }
  printf("Najmniejsza liczba to: %.2lf\n", min);
  printf("Największa 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    0xed5(%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    0xeb0(%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    0xe9d(%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  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    120d <main+0xed>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    1227 <main+0x107>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe1d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xe28(%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    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1050 <scanf@plt>
movsd  0x18(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
lea    0xe8c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm3
minsd  %xmm1,%xmm3
movsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm0
minsd  %xmm3,%xmm0
maxsd  %xmm1,%xmm2
maxsd  %xmm2,%xmm4
movsd  %xmm4,0x20(%rsp)
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe75(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Wprowad\C5\BA 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"Najwi\C4\99ksza 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 ([25 x i8], [25 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* %2
store double %37, double* %7
%38 = load double, double* %3
%39 = load double, double* %7
%40 = fcmp ogt double %38, %39
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = load double, double* %3
store double %42, double* %7
br label %43
43: ; preds = %41, %36
%44 = load double, double* %4
%45 = load double, double* %7
%46 = fcmp ogt double %44, %45
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = load double, double* %4
store double %48, double* %7
br label %49
49: ; preds = %47, %43
%50 = load double, double* %6
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %50)
%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"Najwi\C4\99ksza liczba to: %.2lf\0A\00"
@str = [24 x i8] c"Wprowad\C5\BA 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 ([24 x i8], [24 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 = fcmp ogt double %22, %21
%29 = select i1 %28, double %22, double %21
%30 = fcmp ogt double %25, %29
%31 = select i1 %30, double %25, double %29
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %27)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %31)
ret i32 0
}