#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 num1, num2, num3;
  double sum, product, min, max;
  printf("Wprowadz trzy liczby calkowite: ");
  scanf("%lf%lf%lf", &num1, &num2, &num3);
  sum = num1 + num2 + num3;
  printf("Suma wynosi: %.2lf\n", sum);
  product = num1 * num2 * num3;
  printf("Iloczyn wynosi: %.2lf\n", product);
  max = num1;
  min = num1;
  if (num2 > num1)
    max = num2;
  else
    min = num2;
  if (num3 > max)
    max = num3;
  if (num3 < min)
    min = num3;
  printf("Najmniejsza liczba to: %.2lf\n", min);
  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    0xedd(%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    0xeb6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11d6 <main+0xb6>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11e0 <main+0xc0>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    11fa <main+0xda>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1218 <main+0xf8>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xe32(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xe3d(%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    0xee8(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <scanf@plt>
movsd  0x18(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xec5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
lea    0xeb9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movapd %xmm0,%xmm2
minsd  %xmm1,%xmm2
maxsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm3
maxsd  %xmm1,%xmm3
movsd  %xmm3,0x20(%rsp)
minsd  %xmm2,%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@.str = [33 x i8] c"Wprowadz trzy liczby calkowite: \00"
@.str.1 = [10 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 = [29 x i8] c"Najwieksza liczba to: %.2lf\0A\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 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 ogt double %22, %21
%24 = select i1 %23, double %21, double %22
%25 = select i1 %23, double %22, double %21
%26 = load double, double* %3
%27 = fcmp ogt double %26, %25
%28 = select i1 %27, double %26, double %25
%29 = fcmp olt double %26, %24
%30 = select i1 %29, double %26, double %24
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %28)
ret i32 0
}