#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 *, double *);
int main(void) {
  double input;
  while (true) {
    printf("Insert a value for inches or miles: ");
    scanf("%lf", &input);
    printf("  -> %.3f cm in %.3f inches\n", input * 2.54, input);
    printf("  -> %.3f km in %.3f miles\n\n", input * 1.609, input);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeb3(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
lea    0xece(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe86(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
lea    0xec6(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%r14
lea    0xefa(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xef2(%rip),%r13
lea    0xf08(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  0xe89(%rip),%xmm0
mov    %r13,%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  0xe75(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1150 <main+0x30>

LLVM IR (-O0):
@.str = [37 x i8] c"Insert a value for inches or miles: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [29 x i8] c" -> %.3f cm in %.3f inches\0A\00"
@.str.3 = [29 x i8] c" -> %.3f km in %.3f miles\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = fmul double %6, 2.540000e+00
%8 = load double, double* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %7, double %8)
%10 = load double, double* %2
%11 = fmul double %10, 1.609000e+00
%12 = load double, double* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), double %11, double %12)
br label %3
}

LLVM IR (-O2):
@.str = [37 x i8] c"Insert a value for inches or miles: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [29 x i8] c" -> %.3f cm in %.3f inches\0A\00"
@.str.3 = [29 x i8] c" -> %.3f km in %.3f miles\0A\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%6 = load double, double* %1
%7 = fmul double %6, 2.540000e+00
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), double %7, double %6)
%9 = load double, double* %1
%10 = fmul double %9, 1.609000e+00
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), double %10, double %9)
br label %3
}