#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() {
  float tinggi, berat, beratSeharusnya, selisihBerat, bmi;
  printf("Berat(kg) : ");
  scanf("%f", &berat);
  printf("Tinggi(cm) : ");
  scanf("%f", &tinggi);
  tinggi = tinggi / 100;
  bmi = berat / (tinggi * tinggi);
  printf("\n=============================\n");
  printf("BMI Anda adalah %.2f \n", bmi);
  if (bmi < 18.00) {
    beratSeharusnya = 18 * tinggi * tinggi;
    selisihBerat = beratSeharusnya - berat;
  } else if (bmi > 21.00) {
    beratSeharusnya = 21 * tinggi * tinggi;
    selisihBerat = berat - beratSeharusnya;
  };
  if (bmi >= 18 && bmi <= 21) {
    printf("Berat badan Anda normal.");
  } else if (bmi <= 18) {
    printf("Underweight, Anda perlu menaikkan menaikkan berat badan Anda "
           "sebesar %.2f kg",
           selisihBerat);
  } else {
    printf("Overweight, Anda perlu menurunkan berat badan Anda sebesar %.2f kg",
           selisihBerat);
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe98(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1204 <main+0xe4>
movss  0xe37(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    124a <main+0x12a>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1245 <main+0x125>
movss  0xded(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    124a <main+0x12a>
movss  -0x18(%rbp),%xmm0
movss  0xdc1(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1285 <main+0x165>
movss  0xdac(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jb     1285 <main+0x165>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cf <main+0x1af>
movss  0xd8b(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jb     12b3 <main+0x193>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12ca <main+0x1aa>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe14(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12cf <main+0x1af>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
divss  0xe80(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm1
mulss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe77(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm3
movss  0xe38(%rip),%xmm0
ucomiss %xmm3,%xmm0
jbe    11ef <main+0xbf>
movss  0x4(%rsp),%xmm2
movss  0xe25(%rip),%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
subss  0x8(%rsp),%xmm1
jmp    1214 <main+0xe4>
ucomiss 0xe12(%rip),%xmm3
jbe    1214 <main+0xe4>
movss  0x4(%rsp),%xmm2
movss  0xe06(%rip),%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
addss  0x8(%rsp),%xmm1
ucomiss 0xde9(%rip),%xmm3
jb     123a <main+0x10a>
movss  0xde3(%rip),%xmm2
ucomiss %xmm3,%xmm2
jb     123a <main+0x10a>
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    125d <main+0x12d>
ucomiss %xmm3,%xmm0
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jae    124f <main+0x11f>
lea    0xe5e(%rip),%rdi
jmp    1256 <main+0x126>
lea    0xe08(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Berat(kg) : \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"Tinggi(cm) : \00"
@.str.3 = [32 x i8] c"\0A=============================\0A\00"
@.str.4 = [23 x i8] c"BMI Anda adalah %.2f \0A\00"
@.str.5 = [25 x i8] c"Berat badan Anda normal.\00"
@.str.6 = [77 x i8] c"Underweight, Anda perlu menaikkan menaikkan berat badan Anda sebesar %.2f kg\00"
@.str.7 = [67 x i8] c"Overweight, Anda perlu menurunkan berat badan Anda sebesar %.2f kg\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = load float, float* %2
%12 = fdiv float %11, 1.000000e+02
store float %12, float* %2
%13 = load float, float* %3
%14 = load float, float* %2
%15 = load float, float* %2
%16 = fmul float %14, %15
%17 = fdiv float %13, %16
store float %17, float* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), double %20)
%22 = load float, float* %6
%23 = fpext float %22 to double
%24 = fcmp olt double %23, 1.800000e+01
br i1 %24, label %25, label %33
25: ; preds = %0
%26 = load float, float* %2
%27 = fmul float 1.800000e+01, %26
%28 = load float, float* %2
%29 = fmul float %27, %28
store float %29, float* %4
%30 = load float, float* %4
%31 = load float, float* %3
%32 = fsub float %30, %31
store float %32, float* %5
br label %46
33: ; preds = %0
%34 = load float, float* %6
%35 = fpext float %34 to double
%36 = fcmp ogt double %35, 2.100000e+01
br i1 %36, label %37, label %45
37: ; preds = %33
%38 = load float, float* %2
%39 = fmul float 2.100000e+01, %38
%40 = load float, float* %2
%41 = fmul float %39, %40
store float %41, float* %4
%42 = load float, float* %3
%43 = load float, float* %4
%44 = fsub float %42, %43
store float %44, float* %5
br label %45
45: ; preds = %37, %33
br label %46
46: ; preds = %45, %25
%47 = load float, float* %6
%48 = fcmp oge float %47, 1.800000e+01
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load float, float* %6
%51 = fcmp ole float %50, 2.100000e+01
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %66
54: ; preds = %49, %46
%55 = load float, float* %6
%56 = fcmp ole float %55, 1.800000e+01
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = load float, float* %5
%59 = fpext float %58 to double
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.6, i64 0, i64 0), double %59)
br label %65
61: ; preds = %54
%62 = load float, float* %5
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0), double %63)
br label %65
65: ; preds = %61, %57
br label %66
66: ; preds = %65, %52
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Berat(kg) : \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"Tinggi(cm) : \00"
@.str.4 = [23 x i8] c"BMI Anda adalah %.2f \0A\00"
@.str.5 = [25 x i8] c"Berat badan Anda normal.\00"
@.str.6 = [77 x i8] c"Underweight, Anda perlu menaikkan menaikkan berat badan Anda sebesar %.2f kg\00"
@.str.7 = [67 x i8] c"Overweight, Anda perlu menurunkan berat badan Anda sebesar %.2f kg\00"
@str = [31 x i8] c"\0A=============================\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = load float, float* %1
%10 = fdiv float %9, 1.000000e+02
store float %10, float* %1
%11 = load float, float* %2
%12 = fmul float %10, %10
%13 = fdiv float %11, %12
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%15 = fpext float %13 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = fcmp olt float %13, 1.800000e+01
br i1 %17, label %18, label %24
18: ; preds = %0
%19 = load float, float* %1
%20 = fmul float %19, 1.800000e+01
%21 = fmul float %19, %20
%22 = load float, float* %2
%23 = fsub float %21, %22
br label %32
24: ; preds = %0
%25 = fcmp ogt float %13, 2.100000e+01
br i1 %25, label %26, label %32
26: ; preds = %24
%27 = load float, float* %1
%28 = fmul float %27, 2.100000e+01
%29 = fmul float %27, %28
%30 = load float, float* %2
%31 = fsub float %30, %29
br label %32
32: ; preds = %24, %26, %18
%33 = phi float [ %23, %18 ], [ %31, %26 ], [ undef, %24 ]
%34 = fcmp oge float %13, 1.800000e+01
%35 = fcmp ole float %13, 2.100000e+01
%36 = and i1 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %46
39: ; preds = %32
%40 = fcmp ugt float %13, 1.800000e+01
%41 = fpext float %33 to double
br i1 %40, label %44, label %42
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.6, i64 0, i64 0), double %41)
br label %46
44: ; preds = %39
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.7, i64 0, i64 0), double %41)
br label %46
46: ; preds = %42, %44, %37
ret i32 0
}