#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 *, float *);
int main() {
  float a, b, c, d, max;
  printf("\n\t\t----------------		\n\t\tQUIN ES MES GRAN	"
         "	\n\t\t-----------------\n\n");
  printf("Entra els 4 valors a comparar:\n1.>");
  scanf("%f", &a);
  printf("2.>");
  scanf("%f", &b);
  printf("3.>");
  scanf("%f", &c);
  printf("4.>");
  scanf("%f", &d);
  max = a;
  if (max - b < 0) {
    max = b;
  }
  if (max - c < 0) {
    max = c;
  }
  if (max - d < 0) {
    max = d;
  }
  printf("Dels vlaors [%.2f,%.2f,%.2f,%.2f] el mes gran es: %.2f\n", a, b, c, d,
         max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    11df <main+0xbf>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    11ff <main+0xdf>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    121f <main+0xff>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x14(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x18(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
lea    0xe20(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
xorps  %xmm3,%xmm3
cmpltss %xmm3,%xmm2
movaps %xmm2,%xmm4
andps  %xmm1,%xmm4
andnps %xmm0,%xmm2
orps   %xmm4,%xmm2
movss  0x4(%rsp),%xmm4
movaps %xmm2,%xmm5
subss  %xmm4,%xmm5
cmpltss %xmm3,%xmm5
movaps %xmm5,%xmm6
andnps %xmm2,%xmm6
andps  %xmm4,%xmm5
orps   %xmm6,%xmm5
movss  (%rsp),%xmm6
movaps %xmm5,%xmm7
subss  %xmm6,%xmm7
cmpltss %xmm3,%xmm7
movaps %xmm7,%xmm2
andnps %xmm5,%xmm2
andps  %xmm6,%xmm7
orps   %xmm2,%xmm7
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm4,%xmm2
xorps  %xmm3,%xmm3
cvtss2sd %xmm6,%xmm3
xorps  %xmm4,%xmm4
cvtss2sd %xmm7,%xmm4
lea    0xdfa(%rip),%rdi
mov    $0x5,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [65 x i8] c"\0A\09\09----------------\09\09\0A\09\09QUIN ES MES GRAN\09\09\0A\09\09-----------------\0A\0A\00"
@.str.1 = [35 x i8] c"Entra els 4 valors a comparar:\0A1.>\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [4 x i8] c"2.>\00"
@.str.4 = [4 x i8] c"3.>\00"
@.str.5 = [4 x i8] c"4.>\00"
@.str.6 = [56 x i8] c"Dels vlaors [%.2f,%.2f,%.2f,%.2f] el mes gran es: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %5)
%16 = load float, float* %2
store float %16, float* %6
%17 = load float, float* %6
%18 = load float, float* %3
%19 = fsub float %17, %18
%20 = fcmp olt float %19, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %0
%22 = load float, float* %3
store float %22, float* %6
br label %23
23: ; preds = %21, %0
%24 = load float, float* %6
%25 = load float, float* %4
%26 = fsub float %24, %25
%27 = fcmp olt float %26, 0.000000e+00
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = load float, float* %4
store float %29, float* %6
br label %30
30: ; preds = %28, %23
%31 = load float, float* %6
%32 = load float, float* %5
%33 = fsub float %31, %32
%34 = fcmp olt float %33, 0.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = load float, float* %5
store float %36, float* %6
br label %37
37: ; preds = %35, %30
%38 = load float, float* %2
%39 = fpext float %38 to double
%40 = load float, float* %3
%41 = fpext float %40 to double
%42 = load float, float* %4
%43 = fpext float %42 to double
%44 = load float, float* %5
%45 = fpext float %44 to double
%46 = load float, float* %6
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0), double %39, double %41, double %43, double %45, double %47)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"Entra els 4 valors a comparar:\0A1.>\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [4 x i8] c"2.>\00"
@.str.4 = [4 x i8] c"3.>\00"
@.str.5 = [4 x i8] c"4.>\00"
@.str.6 = [56 x i8] c"Dels vlaors [%.2f,%.2f,%.2f,%.2f] el mes gran es: %.2f\0A\00"
@str = [64 x i8] c"\0A\09\09----------------\09\09\0A\09\09QUIN ES MES GRAN\09\09\0A\09\09-----------------\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%18 = load float, float* %1
%19 = load float, float* %2
%20 = fsub float %18, %19
%21 = fcmp olt float %20, 0.000000e+00
%22 = select i1 %21, float %19, float %18
%23 = load float, float* %3
%24 = fsub float %22, %23
%25 = fcmp olt float %24, 0.000000e+00
%26 = select i1 %25, float %23, float %22
%27 = load float, float* %4
%28 = fsub float %26, %27
%29 = fcmp olt float %28, 0.000000e+00
%30 = select i1 %29, float %27, float %26
%31 = fpext float %18 to double
%32 = fpext float %19 to double
%33 = fpext float %23 to double
%34 = fpext float %27 to double
%35 = fpext float %30 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0), double %31, double %32, double %33, double %34, double %35)
ret i32 0
}