#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 km, metres, feet, inches, cm;
  printf("Enter the distance in (km): ");
  scanf("%f", &km);
  metres = km * 1000;
  feet = km * 3280.83;
  inches = km * 39370.0787;
  cm = metres * 100;
  printf("km = %f\nmetres = %f\nfeet = %f\ninches = %f\ncm = %f\n", km, metres,
         feet, inches, cm);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xeaf(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe5d(%rip),%xmm0
mulss  -0xc(%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    0xe57(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm1
movss  0xeb2(%rip),%xmm4
cvtss2sd %xmm1,%xmm0
movsd  0xeae(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsd2ss %xmm2,%xmm2
movsd  0xea6(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsd2ss %xmm3,%xmm3
mulss  %xmm1,%xmm4
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
mulss  0xe7f(%rip),%xmm4
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
cvtss2sd %xmm4,%xmm4
lea    0xea0(%rip),%rdi
mov    $0x5,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Enter the distance in (km): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [51 x i8] c"km = %f\0Ametres = %f\0Afeet = %f\0Ainches = %f\0Acm = %f\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 ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %2
%10 = fmul float %9, 1.000000e+03
store float %10, float* %3
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = fmul double %12, 3.280830e+03
%14 = fptrunc double %13 to float
store float %14, float* %4
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = fmul double %16, 0x40E3394284B5DCC6
%18 = fptrunc double %17 to float
store float %18, float* %5
%19 = load float, float* %3
%20 = fmul float %19, 1.000000e+02
store float %20, float* %6
%21 = load float, float* %2
%22 = fpext float %21 to double
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = load float, float* %6
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), double %22, double %24, double %26, double %28, double %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter the distance in (km): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [51 x i8] c"km = %f\0Ametres = %f\0Afeet = %f\0Ainches = %f\0Acm = %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fmul float %5, 1.000000e+03
%7 = fpext float %5 to double
%8 = fmul double %7, 3.280830e+03
%9 = fptrunc double %8 to float
%10 = fmul double %7, 0x40E3394284B5DCC6
%11 = fptrunc double %10 to float
%12 = fmul float %6, 1.000000e+02
%13 = fpext float %6 to double
%14 = fpext float %9 to double
%15 = fpext float %11 to double
%16 = fpext float %12 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), double %7, double %13, double %14, double %15, double %16)
ret i32 0
}