#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 *, double *);
int main(void) {
  double height;
  printf("Enter a height in centimeters: ");
  scanf("%lf", &height);
  while (height > 0) {
    int ft = height * 0.3937 / 12;
    printf("%.1f cm = %d feet, %.1f inches\n", height, ft,
           height * 0.3937 - ft * 12);
    printf("Enter a height in centimeters (<=0 to quit): ");
    scanf("%lf", &height);
  }
  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    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ec <main+0xcc>
movsd  0xe99(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%esi
movsd  -0x10(%rbp),%xmm1
imul   $0xc,-0x14(%rbp),%eax
cvtsi2sd %eax,%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  0xe4d(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
lea    0xe72(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
lea    0xe8f(%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    0xed1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11df <main+0xaf>
lea    0xec9(%rip),%r14
lea    0xee2(%rip),%r15
lea    0xeb7(%rip),%r12
mov    %rsp,%rbx
nopl   0x0(%rax)
movapd %xmm0,%xmm1
mulsd  0xe74(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  0xe70(%rip),%xmm2
cvttsd2si %xmm2,%esi
lea    0x0(,%rsi,4),%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
subsd  %xmm2,%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>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
ja     1180 <main+0x50>
lea    0xe9c(%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 centimeters: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [32 x i8] c"%.1f cm = %d feet, %.1f inches\0A\00"
@.str.3 = [46 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 double
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
br label %6
6: ; preds = %9, %0
%7 = load double, double* %2
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load double, double* %2
%11 = fmul double %10, 3.937000e-01
%12 = fdiv double %11, 1.200000e+01
%13 = fptosi double %12 to i32
store i32 %13, i32* %3
%14 = load double, double* %2
%15 = load i32, i32* %3
%16 = load double, double* %2
%17 = load i32, i32* %3
%18 = mul nsw i32 %17, 12
%19 = sitofp i32 %18 to double
%20 = fneg double %19
%21 = call double @llvm.fmuladd.f64(double %16, double 3.937000e-01, double %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %14, i32 %15, double %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
br label %6
25: ; preds = %6
%26 = 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 centimeters: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [32 x i8] c"%.1f cm = %d feet, %.1f inches\0A\00"
@.str.3 = [46 x i8] c"Enter a height in centimeters (<=0 to quit): \00"
@str = [4 x i8] c"bye\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fcmp ogt double %5, 0.000000e+00
br i1 %6, label %7, label %21
7: ; preds = %0, %7
%8 = phi double [ %19, %7 ], [ %5, %0 ]
%9 = fmul double %8, 3.937000e-01
%10 = fdiv double %9, 1.200000e+01
%11 = fptosi double %10 to i32
%12 = mul nsw i32 %11, 12
%13 = sitofp i32 %12 to double
%14 = fneg double %13
%15 = call double @llvm.fmuladd.f64(double %8, double 3.937000e-01, double %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %8, i32 %11, double %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%19 = load double, double* %1
%20 = fcmp ogt double %19, 0.000000e+00
br i1 %20, label %7, label %21
21: ; preds = %7, %0
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}