#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) {
  float cm, height, feet, inches;
  printf("Enter a height in centimetres: ");
  scanf("%f", &cm);
  while (cm > 0) {
    height = cm / 2.54;
    feet = height / 12;
    inches = (feet - (int)feet) * 12;
    printf("%.1f cm = %d feet, %.1f inches\n", cm, (int)feet, inches);
    printf("Enter a height in centimeters (<=0 to quit):");
    scanf("%f", &cm);
  }
  printf("bye\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11fd <main+0xdd>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe99(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe77(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvttss2si -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm1
subss  %xmm1,%xmm0
movss  0xe54(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvttss2si -0x10(%rbp),%esi
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe60(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe41(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
lea    0xe7c(%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    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11e3 <main+0xb3>
lea    0xec3(%rip),%r14
lea    0xedc(%rip),%r15
lea    0xeb2(%rip),%r12
lea    0x4(%rsp),%rbx
nop
cvtss2sd %xmm0,%xmm0
movaps %xmm0,%xmm1
divsd  0xe71(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0xe6d(%rip),%xmm3
divss  %xmm3,%xmm1
cvttss2si %xmm1,%esi
cvttps2dq %xmm1,%xmm2
cvtdq2ps %xmm2,%xmm2
subss  %xmm2,%xmm1
mulss  %xmm3,%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  %xmm1,%xmm1
movss  0x4(%rsp),%xmm0
ucomiss %xmm1,%xmm0
ja     1180 <main+0x50>
lea    0xe92(%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 = [32 x i8] c"Enter a height in centimetres: \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 = [45 x i8] c"Enter a height in centimeters (<=0 to quit):\00"
@.str.4 = [5 x i8] c"bye\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
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %8
8: ; preds = %11, %0
%9 = load float, float* %2
%10 = fcmp ogt float %9, 0.000000e+00
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fdiv double %13, 2.540000e+00
%15 = fptrunc double %14 to float
store float %15, float* %3
%16 = load float, float* %3
%17 = fdiv float %16, 1.200000e+01
store float %17, float* %4
%18 = load float, float* %4
%19 = load float, float* %4
%20 = fptosi float %19 to i32
%21 = sitofp i32 %20 to float
%22 = fsub float %18, %21
%23 = fmul float %22, 1.200000e+01
store float %23, float* %5
%24 = load float, float* %2
%25 = fpext float %24 to double
%26 = load float, float* %4
%27 = fptosi float %26 to i32
%28 = load float, float* %5
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %25, i32 %27, double %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
br label %8
33: ; preds = %8
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Enter a height in centimetres: \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 = [45 x i8] c"Enter a height in centimeters (<=0 to quit):\00"
@str = [4 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 ([32 x i8], [32 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 %23
7: ; preds = %0, %7
%8 = phi float [ %21, %7 ], [ %5, %0 ]
%9 = fpext float %8 to double
%10 = fdiv double %9, 2.540000e+00
%11 = fptrunc double %10 to float
%12 = fdiv float %11, 1.200000e+01
%13 = fptosi float %12 to i32
%14 = sitofp i32 %13 to float
%15 = fsub float %12, %14
%16 = fmul float %15, 1.200000e+01
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %9, i32 %13, double %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%21 = load float, float* %1
%22 = fcmp ogt float %21, 0.000000e+00
br i1 %22, label %7, label %23
23: ; preds = %7, %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}