#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 pow(float, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float height_cm;
  float height_m;
  float weight;
  printf("height(cm)?\n");
  scanf("%f", &height_cm);
  printf("weight(kg)?\n");
  scanf("%f", &weight);
  height_m = height_cm / 100;
  int bmi;
  int sw;
  bmi = (int)(weight / pow(height_m, 2.0));
  sw = (int)(pow(height_m, 2.0) * 22);
  printf("BMI=%d\nSW(kg)=%d\n", bmi, sw);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
movss  0xe87(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movsd  0xe5f(%rip),%xmm1
call   1050 <pow@plt>
movss  -0x18(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movsd  0xe39(%rip),%xmm1
call   1050 <pow@plt>
imul   $0x16,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
divss  0xe74(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm1
movss  %xmm1,(%rsp)
movsd  0xe63(%rip),%xmm1
call   1060 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  (%rsp),%xmm1
divss  %xmm0,%xmm1
cvttss2si %xmm1,%ebx
movss  0x4(%rsp),%xmm0
movsd  0xe3c(%rip),%xmm1
call   1060 <pow@plt>
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%edx
add    %eax,%edx
lea    0xe33(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"height(cm)?\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c"weight(kg)?\0A\00"
@.str.3 = [18 x i8] c"BMI=%d\0ASW(kg)=%d\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 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* %1)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = load float, float* %1
%11 = fdiv float %10, 1.000000e+02
store float %11, float* %2
%12 = load float, float* %3
%13 = load float, float* %2
%14 = call i32 @pow(float %13, double 2.000000e+00)
%15 = sitofp i32 %14 to float
%16 = fdiv float %12, %15
%17 = fptosi float %16 to i32
store i32 %17, i32* %4
%18 = load float, float* %2
%19 = call i32 @pow(float %18, double 2.000000e+00)
%20 = mul nsw i32 %19, 22
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [18 x i8] c"BMI=%d\0ASW(kg)=%d\0A\00"
@str = [12 x i8] c"height(cm)?\00"
@str.4 = [12 x i8] c"weight(kg)?\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = fdiv float %9, 1.000000e+02
%11 = load float, float* %2
%12 = call i32 @pow(float %10, double 2.000000e+00)
%13 = sitofp i32 %12 to float
%14 = fdiv float %11, %13
%15 = fptosi float %14 to i32
%16 = call i32 @pow(float %10, double 2.000000e+00)
%17 = mul nsw i32 %16, 22
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %17)
ret i32 0
}