#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 */
scalar_t__ convertKMStoMiles(double, double *);
scalar_t__ convertMilesToKMS(double, double *);
int /*<<< orphan*/ printf(char *, double, ...);
int main(void) {
  double five_k = 5.0;
  double five_k_miles;
  if (convertKMStoMiles(five_k, &five_k_miles)) {
    printf("%f kms = %f miles\n", five_k, five_k_miles);
  } else {
    printf("Unable to convert %f kms to miles \n", five_k);
  }
  double marathon_miles = 26.2188;
  double marathon_kms;
  if (convertMilesToKMS(marathon_miles, &marathon_kms)) {
    printf("%f miles = %f kms\n", marathon_miles, marathon_kms);
  } else {
    printf("Unable to convert %f miles to kms \n", marathon_miles);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x18(%rbp),%rdi
call   1040 <convertKMStoMiles@plt>
cmp    $0x0,%rax
je     1181 <main+0x51>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe9b(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1194 <main+0x64>
movsd  -0x10(%rbp),%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    -0x28(%rbp),%rdi
call   1050 <convertMilesToKMS@plt>
cmp    $0x0,%rax
je     11d6 <main+0xa6>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe7d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    11e9 <main+0xb9>
movsd  -0x20(%rbp),%xmm0
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movsd  0xec4(%rip),%xmm0
lea    0x10(%rsp),%rdi
call   1040 <convertKMStoMiles@plt>
test   %rax,%rax
je     1169 <main+0x39>
movsd  0x10(%rsp),%xmm1
lea    0xeb8(%rip),%rdi
movsd  0xea0(%rip),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
jmp    117f <main+0x4f>
lea    0xeb3(%rip),%rdi
movsd  0xe88(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe81(%rip),%xmm0
lea    0x8(%rsp),%rdi
call   1050 <convertMilesToKMS@plt>
test   %rax,%rax
je     11b4 <main+0x84>
movsd  0x8(%rsp),%xmm1
lea    0xea4(%rip),%rdi
movsd  0xe5d(%rip),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
jmp    11ca <main+0x9a>
lea    0xe9f(%rip),%rdi
movsd  0xe45(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%f kms = %f miles\0A\00"
@.str.1 = [36 x i8] c"Unable to convert %f kms to miles \0A\00"
@.str.2 = [19 x i8] c"%f miles = %f kms\0A\00"
@.str.3 = [36 x i8] c"Unable to convert %f miles to kms \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 5.000000e+00, double* %2
%6 = load double, double* %2
%7 = call i64 @convertKMStoMiles(double %6, double* %3)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load double, double* %2
%11 = load double, double* %3
%12 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %10, double %11)
br label %16
13: ; preds = %0
%14 = load double, double* %2
%15 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double %14)
br label %16
16: ; preds = %13, %9
store double 2.621880e+01, double* %4
%17 = load double, double* %4
%18 = call i64 @convertMilesToKMS(double %17, double* %5)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load double, double* %4
%22 = load double, double* %5
%23 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %21, double %22)
br label %27
24: ; preds = %16
%25 = load double, double* %4
%26 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %25)
br label %27
27: ; preds = %24, %20
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"%f kms = %f miles\0A\00"
@.str.1 = [36 x i8] c"Unable to convert %f kms to miles \0A\00"
@.str.2 = [19 x i8] c"%f miles = %f kms\0A\00"
@.str.3 = [36 x i8] c"Unable to convert %f miles to kms \0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = call i64 @convertKMStoMiles(double 5.000000e+00, double* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load double, double* %1
%8 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double 5.000000e+00, double %7)
br label %11
9: ; preds = %0
%10 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), double 5.000000e+00)
br label %11
11: ; preds = %9, %6
%12 = bitcast double* %2 to i8*
%13 = call i64 @convertMilesToKMS(double 2.621880e+01, double* %2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = load double, double* %2
%17 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double 2.621880e+01, double %16)
br label %20
18: ; preds = %11
%19 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double 2.621880e+01)
br label %20
20: ; preds = %18, %15
ret i32 0
}