#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 *, float *);
int main(void) {
  const float CENTIMETERS_PER_INCH = 2.54f;
  const float INCHES_PER_FEET = 12.0f;
  float cents;
  int feets;
  float inches, remaining;
  printf("Enter a height in centimeters (<=0 to quit): ");
  scanf("%f", &cents);
  while (cents > 0) {
    inches = cents / CENTIMETERS_PER_INCH;
    feets = (int)(inches / INCHES_PER_FEET);
    remaining = inches - (float)feets * INCHES_PER_FEET;
    printf("%.1f cm = %d feet, %.1f inches\n", cents, feets, remaining);
    printf("Enter a height in centimeters (<=0 to quit): ");
    scanf("%f", &cents);
  }
  printf("Bye!\n");
  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,-0x8(%rbp)
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1218 <main+0xf8>
movss  -0x10(%rbp),%xmm0
movss  0xe7f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xe65(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
movss  -0x18(%rbp),%xmm1
cvtsi2ssl -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe3b(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x14(%rbp),%esi
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4b(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1167 <main+0x47>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jbe    11e2 <main+0xb2>
lea    0xecd(%rip),%r14
lea    0xe95(%rip),%r15
lea    0xebc(%rip),%r12
lea    0x4(%rsp),%rbx
nop
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
divss  0xe71(%rip),%xmm1
movaps %xmm1,%xmm2
movss  0xe6a(%rip),%xmm3
divss  %xmm3,%xmm2
cvttss2si %xmm2,%esi
cvttps2dq %xmm2,%xmm2
cvtdq2ps %xmm2,%xmm2
mulss  %xmm3,%xmm2
subss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     1180 <main+0x50>
lea    0xe70(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Enter a height in centimeters (<=0 to quit): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"%.1f cm = %d feet, %.1f inches\0A\00"
@.str.3 = [6 x i8] c"Bye!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store float 0x400451EB80000000, float* %2
store float 1.200000e+01, float* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
br label %10
10: ; preds = %13, %0
%11 = load float, float* %4
%12 = fcmp ogt float %11, 0.000000e+00
br i1 %12, label %13, label %32
13: ; preds = %10
%14 = load float, float* %4
%15 = fdiv float %14, 0x400451EB80000000
store float %15, float* %6
%16 = load float, float* %6
%17 = fdiv float %16, 1.200000e+01
%18 = fptosi float %17 to i32
store i32 %18, i32* %5
%19 = load float, float* %6
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to float
%22 = fneg float %21
%23 = call float @llvm.fmuladd.f32(float %22, float 1.200000e+01, float %19)
store float %23, float* %7
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = load i32, i32* %5
%27 = load float, float* %7
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %25, i32 %26, double %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
br label %10
32: ; preds = %10
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"Enter a height in centimeters (<=0 to quit): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"%.1f cm = %d feet, %.1f inches\0A\00"
@str = [5 x i8] c"Bye!\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp ogt float %5, 0.000000e+00
br i1 %6, label %7, label %22
7: ; preds = %0, %7
%8 = phi float [ %20, %7 ], [ %5, %0 ]
%9 = fdiv float %8, 0x400451EB80000000
%10 = fdiv float %9, 1.200000e+01
%11 = fptosi float %10 to i32
%12 = sitofp i32 %11 to float
%13 = fneg float %12
%14 = call float @llvm.fmuladd.f32(float %13, float 1.200000e+01, float %9)
%15 = fpext float %8 to double
%16 = fpext float %14 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %15, i32 %11, double %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%20 = load float, float* %1
%21 = fcmp ogt float %20, 0.000000e+00
br i1 %21, label %7, label %22
22: ; preds = %7, %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}