#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 */
double GetReal();
int /*<<< orphan*/ printf(char *, ...);
main() {
  double totalInches, cm, inch;
  int feet;
  printf("This program converts centimeters to feet and inches.\n");
  printf("Length in centimeters? ");
  cm = GetReal();
  totalInches = cm / 2.54;
  feet = totalInches / 12;
  inch = totalInches - feet * 12;
  printf("%g cm = %d ft %g in\n", cm, feet, inch);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <GetReal@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe8d(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
imul   $0xc,-0x1c(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x1c(%rbp),%esi
movsd  -0x18(%rbp),%xmm1
lea    0xeb7(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf05(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <GetReal@plt>
movapd %xmm0,%xmm1
divsd  0xea2(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  0xe9e(%rip),%xmm2
cvttsd2si %xmm2,%esi
lea    0x0(,%rsi,4),%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
subsd  %xmm2,%xmm1
lea    0xe9e(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [55 x i8] c"This program converts centimeters to feet and inches.\0A\00"
@.str.1 = [24 x i8] c"Length in centimeters? \00"
@.str.2 = [21 x i8] c"%g cm = %d ft %g in\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = call double (...) @GetReal()
store double %7, double* %2
%8 = load double, double* %2
%9 = fdiv double %8, 2.540000e+00
store double %9, double* %1
%10 = load double, double* %1
%11 = fdiv double %10, 1.200000e+01
%12 = fptosi double %11 to i32
store i32 %12, i32* %4
%13 = load double, double* %1
%14 = load i32, i32* %4
%15 = mul nsw i32 %14, 12
%16 = sitofp i32 %15 to double
%17 = fsub double %13, %16
store double %17, double* %3
%18 = load double, double* %2
%19 = load i32, i32* %4
%20 = load double, double* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %18, i32 %19, double %20)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"Length in centimeters? \00"
@.str.2 = [21 x i8] c"%g cm = %d ft %g in\0A\00"
@str = [54 x i8] c"This program converts centimeters to feet and inches.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call double (...) @GetReal()
%4 = fdiv double %3, 2.540000e+00
%5 = fdiv double %4, 1.200000e+01
%6 = fptosi double %5 to i32
%7 = mul nsw i32 %6, 12
%8 = sitofp i32 %7 to double
%9 = fsub double %4, %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %3, i32 %6, double %9)
ret i32 0
}