#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*/ flushall();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int /*<<< orphan*/ swap(float *, float *);
main() {
  float num1, num2;
  printf("Enter two numbers\n");
  scanf("%f", &num1);
  scanf("%f", &num2);
  flushall();
  if (num1 > num2) {
    swap(&num1, &num2);
  }
  printf("\nnum1 is %f and num2 is %f", num1, num2);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xea7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <flushall@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11b0 <main+0x60>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <swap@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <flushall@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jbe    11c5 <main+0x65>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1080 <swap@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe2c(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter two numbers\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [27 x i8] c"\0Anum1 is %f and num2 is %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%7 = call i32 (...) @flushall()
%8 = load float, float* %2
%9 = load float, float* %3
%10 = fcmp ogt float %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @swap(float* %2, float* %3)
br label %13
13: ; preds = %11, %0
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), double %15, double %17)
%19 = call i32 (...) @getchar()
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [27 x i8] c"\0Anum1 is %f and num2 is %f\00"
@str = [18 x i8] c"Enter two numbers\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = call i32 (...) @flushall()
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fcmp ogt float %9, %10
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = call i32 @swap(float* %1, float* %2)
%14 = load float, float* %1
%15 = load float, float* %2
br label %16
16: ; preds = %12, %0
%17 = phi float [ %15, %12 ], [ %10, %0 ]
%18 = phi float [ %14, %12 ], [ %9, %0 ]
%19 = fpext float %18 to double
%20 = fpext float %17 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), double %19, double %20)
%22 = call i32 (...) @getchar()
ret i32 0
}