#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 *, float);
float round(int);
int main() {
  float alpha = 20;
  int totalMachines = 10;
  float total;
  total = round(totalMachines * (alpha / 100));
  printf("total antes validacao: %f\n", total);
  if (total == 0)
    total = 1;
  printf("total: %f\n", total);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xecd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xeab(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1040 <round@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a0 <main+0x80>
jp     11a0 <main+0x80>
movss  0xe6d(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    $0x2,%edi
call   1040 <round@plt>
movaps %xmm0,(%rsp)
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movaps (%rsp),%xmm2
cmpeqss %xmm2,%xmm0
movss  0xeae(%rip),%xmm1
andps  %xmm0,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"total antes validacao: %f\0A\00"
@.str.1 = [11 x i8] c"total: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
store float 2.000000e+01, float* %2
store i32 10, i32* %3
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to float
%7 = load float, float* %2
%8 = fdiv float %7, 1.000000e+02
%9 = fmul float %6, %8
%10 = fptosi float %9 to i32
%11 = call float @round(i32 %10)
store float %11, float* %4
%12 = load float, float* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float %12)
%14 = load float, float* %4
%15 = fcmp oeq float %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %0
store float 1.000000e+00, float* %4
br label %17
17: ; preds = %16, %0
%18 = load float, float* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), float %18)
ret i32 -1
}

LLVM IR (-O2):
@.str = [27 x i8] c"total antes validacao: %f\0A\00"
@.str.1 = [11 x i8] c"total: %f\0A\00"
define i32 @main() {
%1 = tail call float @round(i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float %1)
%3 = fcmp oeq float %1, 0.000000e+00
%4 = select i1 %3, float 1.000000e+00, float %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), float %4)
ret i32 -1
}