#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ system(char *);
int main() {
  float n1, n2, n3, mayor, mediano, pequeno;
  printf("Dados tres números positivos por teclado, indicar");
  printf("\n cual es el mayor, el menor y el mediano.");
  getchar();
  do {
    system("clear");
    printf("\nIntroduce el primer número que no sea negativo: ");
    scanf("%f", &n1);
  } while (n1 < 0);
  do {
    system("clear");
    printf("\nIntroduce el segundo número que no sea negativo: ");
    scanf("%f", &n2);
  } while (n2 < 0);
  do {
    system("clear");
    printf("\nIntroduce el tercer número que no sea negativo: ");
    scanf("%f", &n3);
  } while (n3 < 0);
  system("clear");
  if (n1 > n2 && n1 > n3) {
    mayor = n1;
    if (n2 > n3) {
      mediano = n2, pequeno = n3;
    } else {
      mediano = n3, pequeno = n2;
    }
  } else {
    if (n2 > n1 && n2 > n3) {
      mayor = n2;
      if (n1 > n3) {
        mediano = n1, pequeno = n3;
      } else {
        mediano = n3, pequeno = n1;
      }
    } else {
      mayor = n3;
      if (n1 > n2) {
        mediano = n1, pequeno = n2;
      } else {
        mediano = n2, pequeno = n1;
      }
    }
  }
  printf("\nEl mayor es %g, el mediano es %g y el pequeño es %g", mayor,
         mediano, pequeno);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
ja     1172 <main+0x32>
jmp    11ae <main+0x6e>
lea    0xea9(%rip),%rdi
call   1030 <system@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
ja     11ae <main+0x6e>
jmp    11ea <main+0xaa>
lea    0xe6d(%rip),%rdi
call   1030 <system@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
ja     11ea <main+0xaa>
lea    0xe36(%rip),%rdi
call   1030 <system@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1296 <main+0x156>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1296 <main+0x156>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    127d <main+0x13d>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1291 <main+0x151>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    134f <main+0x20f>
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    12ff <main+0x1bf>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    12ff <main+0x1bf>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    12e6 <main+0x1a6>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    12fa <main+0x1ba>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    134a <main+0x20a>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1331 <main+0x1f1>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1345 <main+0x205>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    134a <main+0x20a>
jmp    134f <main+0x20f>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xd90(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xeed(%rip),%r14
lea    0xeec(%rip),%r15
lea    0xf18(%rip),%r12
lea    0x14(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <system@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss 0x14(%rsp),%xmm0
ja     1190 <main+0x50>
lea    0xea4(%rip),%r14
lea    0xed9(%rip),%r15
lea    0xecf(%rip),%r12
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <system@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss 0x10(%rsp),%xmm0
ja     11e0 <main+0xa0>
lea    0xe54(%rip),%r14
lea    0xebd(%rip),%r15
lea    0xe7f(%rip),%r12
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <system@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss 0xc(%rsp),%xmm0
ja     1230 <main+0xf0>
lea    0xe04(%rip),%rdi
call   1030 <system@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm2
ucomiss %xmm2,%xmm0
jbe    1292 <main+0x152>
movss  0xc(%rsp),%xmm4
ucomiss %xmm4,%xmm0
jbe    1292 <main+0x152>
movaps %xmm2,%xmm3
maxss  %xmm4,%xmm3
minss  %xmm2,%xmm4
movaps %xmm0,%xmm1
movaps %xmm4,%xmm2
jmp    12c3 <main+0x183>
ucomiss %xmm0,%xmm2
movss  0xc(%rsp),%xmm1
jbe    12b8 <main+0x178>
ucomiss %xmm1,%xmm2
jbe    12b8 <main+0x178>
movaps %xmm0,%xmm3
maxss  %xmm1,%xmm3
movaps %xmm1,%xmm4
minss  %xmm0,%xmm4
movaps %xmm2,%xmm1
movaps %xmm4,%xmm2
jmp    12c3 <main+0x183>
movaps %xmm0,%xmm3
maxss  %xmm2,%xmm3
minss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xe29(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Dados tres n\C3\BAmeros positivos por teclado, indicar\00"
@.str.1 = [43 x i8] c"\0A cual es el mayor, el menor y el mediano.\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [51 x i8] c"\0AIntroduce el primer n\C3\BAmero que no sea negativo: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [52 x i8] c"\0AIntroduce el segundo n\C3\BAmero que no sea negativo: \00"
@.str.6 = [51 x i8] c"\0AIntroduce el tercer n\C3\BAmero que no sea negativo: \00"
@.str.7 = [54 x i8] c"\0AEl mayor es %g, el mediano es %g y el peque\C3\B1o es %g\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @getchar()
br label %11
11: ; preds = %15, %0
%12 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
br label %15
15: ; preds = %11
%16 = load float, float* %2
%17 = fcmp olt float %16, 0.000000e+00
br i1 %17, label %11, label %18
18: ; preds = %15
br label %19
19: ; preds = %23, %18
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
br label %23
23: ; preds = %19
%24 = load float, float* %3
%25 = fcmp olt float %24, 0.000000e+00
br i1 %25, label %19, label %26
26: ; preds = %23
br label %27
27: ; preds = %31, %26
%28 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
br label %31
31: ; preds = %27
%32 = load float, float* %4
%33 = fcmp olt float %32, 0.000000e+00
br i1 %33, label %27, label %34
34: ; preds = %31
%35 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%36 = load float, float* %2
%37 = load float, float* %3
%38 = fcmp ogt float %36, %37
br i1 %38, label %39, label %55
39: ; preds = %34
%40 = load float, float* %2
%41 = load float, float* %4
%42 = fcmp ogt float %40, %41
br i1 %42, label %43, label %55
43: ; preds = %39
%44 = load float, float* %2
store float %44, float* %5
%45 = load float, float* %3
%46 = load float, float* %4
%47 = fcmp ogt float %45, %46
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load float, float* %3
store float %49, float* %6
%50 = load float, float* %4
store float %50, float* %7
br label %54
51: ; preds = %43
%52 = load float, float* %4
store float %52, float* %6
%53 = load float, float* %3
store float %53, float* %7
br label %54
54: ; preds = %51, %48
br label %88
55: ; preds = %39, %34
%56 = load float, float* %3
%57 = load float, float* %2
%58 = fcmp ogt float %56, %57
br i1 %58, label %59, label %75
59: ; preds = %55
%60 = load float, float* %3
%61 = load float, float* %4
%62 = fcmp ogt float %60, %61
br i1 %62, label %63, label %75
63: ; preds = %59
%64 = load float, float* %3
store float %64, float* %5
%65 = load float, float* %2
%66 = load float, float* %4
%67 = fcmp ogt float %65, %66
br i1 %67, label %68, label %71
68: ; preds = %63
%69 = load float, float* %2
store float %69, float* %6
%70 = load float, float* %4
store float %70, float* %7
br label %74
71: ; preds = %63
%72 = load float, float* %4
store float %72, float* %6
%73 = load float, float* %2
store float %73, float* %7
br label %74
74: ; preds = %71, %68
br label %87
75: ; preds = %59, %55
%76 = load float, float* %4
store float %76, float* %5
%77 = load float, float* %2
%78 = load float, float* %3
%79 = fcmp ogt float %77, %78
br i1 %79, label %80, label %83
80: ; preds = %75
%81 = load float, float* %2
store float %81, float* %6
%82 = load float, float* %3
store float %82, float* %7
br label %86
83: ; preds = %75
%84 = load float, float* %3
store float %84, float* %6
%85 = load float, float* %2
store float %85, float* %7
br label %86
86: ; preds = %83, %80
br label %87
87: ; preds = %86, %74
br label %88
88: ; preds = %87, %54
%89 = load float, float* %5
%90 = fpext float %89 to double
%91 = load float, float* %6
%92 = fpext float %91 to double
%93 = load float, float* %7
%94 = fpext float %93 to double
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), double %90, double %92, double %94)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"Dados tres n\C3\BAmeros positivos por teclado, indicar\00"
@.str.1 = [43 x i8] c"\0A cual es el mayor, el menor y el mediano.\00"
@.str.2 = [6 x i8] c"clear\00"
@.str.3 = [51 x i8] c"\0AIntroduce el primer n\C3\BAmero que no sea negativo: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [52 x i8] c"\0AIntroduce el segundo n\C3\BAmero que no sea negativo: \00"
@.str.6 = [51 x i8] c"\0AIntroduce el tercer n\C3\BAmero que no sea negativo: \00"
@.str.7 = [54 x i8] c"\0AEl mayor es %g, el mediano es %g y el peque\C3\B1o es %g\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (...) @getchar()
br label %10
10: ; preds = %10, %0
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %1)
%14 = load float, float* %1
%15 = fcmp olt float %14, 0.000000e+00
br i1 %15, label %10, label %16
16: ; preds = %10, %16
%17 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%20 = load float, float* %2
%21 = fcmp olt float %20, 0.000000e+00
br i1 %21, label %16, label %22
22: ; preds = %16, %22
%23 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%26 = load float, float* %3
%27 = fcmp olt float %26, 0.000000e+00
br i1 %27, label %22, label %28
28: ; preds = %22
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%30 = load float, float* %1
%31 = load float, float* %2
%32 = fcmp ogt float %30, %31
br i1 %32, label %33, label %40
33: ; preds = %28
%34 = load float, float* %3
%35 = fcmp ogt float %30, %34
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = fcmp ogt float %31, %34
%38 = select i1 %37, float %31, float %34
%39 = select i1 %37, float %34, float %31
br label %52
40: ; preds = %33, %28
%41 = fcmp ogt float %31, %30
%42 = load float, float* %3
%43 = fcmp ogt float %31, %42
%44 = select i1 %41, i1 %43, i1 false
br i1 %44, label %45, label %49
45: ; preds = %40
%46 = fcmp ogt float %30, %42
%47 = select i1 %46, float %30, float %42
%48 = select i1 %46, float %42, float %30
br label %52
49: ; preds = %40
%50 = select i1 %32, float %30, float %31
%51 = select i1 %32, float %31, float %30
br label %52
52: ; preds = %49, %45, %36
%53 = phi float [ %30, %36 ], [ %31, %45 ], [ %42, %49 ]
%54 = phi float [ %38, %36 ], [ %47, %45 ], [ %50, %49 ]
%55 = phi float [ %39, %36 ], [ %48, %45 ], [ %51, %49 ]
%56 = fpext float %53 to double
%57 = fpext float %54 to double
%58 = fpext float %55 to double
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), double %56, double %57, double %58)
ret i32 0
}