#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*/ getchar();
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float duration, *d;
  float distance = 378921.46;
  float speed = 140;
  d = &distance;
  printf("The moon is %.2f km away.\n", *d);
  d = &speed;
  printf("Travelling at %.f kph,\n", *d);
  d = &duration;
  *d = distance / speed;
  printf("it would take %.2f hours to the drive to the moon\n", *d);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee4(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
movss  0xec0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
movss  0xeb0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"The moon is %.2f km away.\0A\00"
@.str.1 = [24 x i8] c"Travelling at %.f kph,\0A\00"
@.str.2 = [51 x i8] c"it would take %.2f hours to the drive to the moon\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float*
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store float 0x411720A5E0000000, float* %4
store float 1.400000e+02, float* %5
store float* %4, float** %3
%6 = load float*, float** %3
%7 = load float, float* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float %7)
store float* %5, float** %3
%9 = load float*, float** %3
%10 = load float, float* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), float %10)
store float* %2, float** %3
%12 = load float, float* %4
%13 = load float, float* %5
%14 = fdiv float %12, %13
%15 = load float*, float** %3
store float %14, float* %15
%16 = load float*, float** %3
%17 = load float, float* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), float %17)
%19 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"The moon is %.2f km away.\0A\00"
@.str.1 = [24 x i8] c"Travelling at %.f kph,\0A\00"
@.str.2 = [51 x i8] c"it would take %.2f hours to the drive to the moon\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float 0x411720A5E0000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), float 1.400000e+02)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), float 0x40A5252A00000000)
%4 = tail call i32 (...) @getchar()
ret i32 0
}