#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 */
typedef int /*<<< orphan*/ miles;
typedef int /*<<< orphan*/ kilometers;

/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float miles, kilometers;
  float *pmiles, *k_address;
  printf("Enter a value in miles %c ", 16);
  scanf("%f", &miles);
  kilometers = miles * 1.609344;
  printf("\n%.2f miles works out to %.2f kilometers\n", miles, kilometers);
  pmiles = &miles;
  printf("\nVariable 'miles' is %d bytes long at %p adress\n", sizeof(miles),
         pmiles);
  k_address = &kilometers;
  printf("Variable 'kilometers' is %d bytes long and lives at %p",
         sizeof(kilometers), k_address);
  while (getchar() != '\n')
    continue;
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8d(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cvttss2si -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    0xea1(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
lea    0xeb3(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11f2 <main+0xc2>
jmp    11da <main+0xaa>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
mulsd  0xe92(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x8(%rsp)
cvttss2si %xmm0,%esi
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe9c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x4,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0x8(%rsp),%rdx
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    11c0 <main+0x90>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter a value in miles %c \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [42 x i8] c"\0A%.2f miles works out to %.2f kilometers\0A\00"
@.str.3 = [49 x i8] c"\0AVariable 'miles' is %d bytes long at %p adress\0A\00"
@.str.4 = [55 x i8] c"Variable 'kilometers' is %d bytes long and lives at %p\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 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 16)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = fmul double %9, 0x3FF9BFDF7E8038A0
%11 = fptrunc double %10 to float
store float %11, float* %3
%12 = load float, float* %2
%13 = fptosi float %12 to i32
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %15)
store float* %2, float** %4
%17 = load float*, float** %4
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 4, float* %17)
store float* %3, float** %5
%19 = load float*, float** %5
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), i32 4, float* %19)
br label %21
21: ; preds = %25, %0
%22 = call signext i8 (...) @getchar()
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 10
br i1 %24, label %25, label %26
25: ; preds = %21
br label %21
26: ; preds = %21
%27 = call signext i8 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter a value in miles %c \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [42 x i8] c"\0A%.2f miles works out to %.2f kilometers\0A\00"
@.str.3 = [49 x i8] c"\0AVariable 'miles' is %d bytes long at %p adress\0A\00"
@.str.4 = [55 x i8] c"Variable 'kilometers' is %d bytes long and lives at %p\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 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 16)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fpext float %7 to double
%9 = fmul double %8, 0x3FF9BFDF7E8038A0
%10 = fptrunc double %9 to float
store float %10, float* %2
%11 = fptosi float %7 to i32
%12 = fpext float %10 to double
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %11, double %12)
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 4, float* %1)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), i32 4, float* %2)
br label %16
16: ; preds = %16, %0
%17 = call signext i8 (...) @getchar()
%18 = icmp eq i8 %17, 10
br i1 %18, label %19, label %16
19: ; preds = %16
%20 = call signext i8 (...) @getchar()
ret i32 0
}