#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 /*<<< orphan*/ system(char *);
main() {
  system("title Programa para ordenar tres números reais de menor a maior");
  system("cls");
  system("color 89");
  printf("ORDENAR OS TRES NUMEROS DE MENOR A MAIOR:\n");
  printf("========================================\n");
  float a, b, c;
  printf("Escribimos o primeiro n\243mero:\n");
  scanf("%f", &a);
  printf("Escribimos o segundo n\243mero:\n");
  scanf("%f", &b);
  printf("Escribimos o terceiro n\243mero:\n");
  scanf("%f", &c);
  float aux;
  if (a > b) {
    aux = a;
    a = b;
    b = aux;
  }
  if (b > c) {
    aux = c;
    c = b;
    b = aux;
  }
  if (a > b) {
    aux = a;
    a = b;
    b = aux;
  }
  printf("%.2f\n", a);
  printf("%.2f\n", b);
  printf("%.2f\n", c);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
lea    0xeef(%rip),%rdi
call   1030 <system@plt>
lea    0xee7(%rip),%rdi
call   1030 <system@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf2e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf10(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1206 <main+0xd6>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1233 <main+0x103>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1260 <main+0x130>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <system@plt>
lea    0xee9(%rip),%rdi
call   1040 <system@plt>
lea    0xee1(%rip),%rdi
call   1040 <system@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf28(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm2
movss  0x4(%rsp),%xmm1
ucomiss %xmm1,%xmm2
jbe    11f5 <main+0xb5>
movss  %xmm1,0xc(%rsp)
movss  %xmm2,0x4(%rsp)
movaps %xmm1,%xmm0
jmp    11fb <main+0xbb>
movaps %xmm2,%xmm0
movaps %xmm1,%xmm2
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm2
jbe    121c <main+0xdc>
movss  %xmm2,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
ucomiss %xmm1,%xmm0
ja     1224 <main+0xe4>
movaps %xmm0,%xmm1
jmp    1230 <main+0xf0>
movaps %xmm2,%xmm1
ucomiss %xmm1,%xmm0
jbe    1217 <main+0xd7>
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe13(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xde0(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [65 x i8] c"title Programa para ordenar tres n\C3\BAmeros reais de menor a maior\00"
@.str.1 = [4 x i8] c"cls\00"
@.str.2 = [9 x i8] c"color 89\00"
@.str.3 = [43 x i8] c"ORDENAR OS TRES NUMEROS DE MENOR A MAIOR:\0A\00"
@.str.4 = [42 x i8] c"========================================\0A\00"
@.str.5 = [31 x i8] c"Escribimos o primeiro n\A3mero:\0A\00"
@.str.6 = [3 x i8] c"%f\00"
@.str.7 = [30 x i8] c"Escribimos o segundo n\A3mero:\0A\00"
@.str.8 = [31 x i8] c"Escribimos o terceiro n\A3mero:\0A\00"
@.str.9 = [6 x i8] c"%.2f\0A\00"
@.str.10 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 @system(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %3)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %4)
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fcmp ogt float %17, %18
br i1 %19, label %20, label %24
20: ; preds = %0
%21 = load float, float* %2
store float %21, float* %5
%22 = load float, float* %3
store float %22, float* %2
%23 = load float, float* %5
store float %23, float* %3
br label %24
24: ; preds = %20, %0
%25 = load float, float* %3
%26 = load float, float* %4
%27 = fcmp ogt float %25, %26
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load float, float* %4
store float %29, float* %5
%30 = load float, float* %3
store float %30, float* %4
%31 = load float, float* %5
store float %31, float* %3
br label %32
32: ; preds = %28, %24
%33 = load float, float* %2
%34 = load float, float* %3
%35 = fcmp ogt float %33, %34
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load float, float* %2
store float %37, float* %5
%38 = load float, float* %3
store float %38, float* %2
%39 = load float, float* %5
store float %39, float* %3
br label %40
40: ; preds = %36, %32
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %42)
%44 = load float, float* %3
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %45)
%47 = load float, float* %4
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %48)
%50 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [65 x i8] c"title Programa para ordenar tres n\C3\BAmeros reais de menor a maior\00"
@.str.1 = [4 x i8] c"cls\00"
@.str.2 = [9 x i8] c"color 89\00"
@.str.6 = [3 x i8] c"%f\00"
@.str.9 = [6 x i8] c"%.2f\0A\00"
@.str.10 = [6 x i8] c"pause\00"
@str = [42 x i8] c"ORDENAR OS TRES NUMEROS DE MENOR A MAIOR:\00"
@str.11 = [41 x i8] c"========================================\00"
@str.12 = [30 x i8] c"Escribimos o primeiro n\A3mero:\00"
@str.13 = [29 x i8] c"Escribimos o segundo n\A3mero:\00"
@str.14 = [30 x i8] c"Escribimos o terceiro n\A3mero:\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = tail call i32 @system(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.11, i64 0, i64 0))
%9 = bitcast float* %1 to i8*
%10 = bitcast float* %2 to i8*
%11 = bitcast float* %3 to i8*
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.12, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %1)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.13, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %2)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.14, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), float* %3)
%18 = load float, float* %1
%19 = load float, float* %2
%20 = fcmp ogt float %18, %19
br i1 %20, label %21, label %22
21: ; preds = %0
store float %19, float* %1
store float %18, float* %2
br label %22
22: ; preds = %21, %0
%23 = phi float [ %19, %21 ], [ %18, %0 ]
%24 = phi float [ %18, %21 ], [ %19, %0 ]
%25 = load float, float* %3
%26 = fcmp ogt float %24, %25
br i1 %26, label %27, label %28
27: ; preds = %22
store float %24, float* %3
store float %25, float* %2
br label %28
28: ; preds = %27, %22
%29 = phi float [ %25, %27 ], [ %24, %22 ]
%30 = fcmp ogt float %23, %29
br i1 %30, label %31, label %32
31: ; preds = %28
store float %29, float* %1
store float %23, float* %2
br label %32
32: ; preds = %31, %28
%33 = phi float [ %29, %31 ], [ %23, %28 ]
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %34)
%36 = load float, float* %2
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %37)
%39 = load float, float* %3
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), double %40)
%42 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}