#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 roundf(float);
float get_normalized(float top, float bottom) {
  if (top == -1 || bottom == -1 || bottom == 0) {
    return -1;
  }
  return roundf((top / bottom) * 10000) / 100;
}


x86 assembly (clang, -O0):
<get_normalized>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xed1(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1143 <get_normalized+0x33>
jp     1143 <get_normalized+0x33>
jmp    117b <get_normalized+0x6b>
movss  -0xc(%rbp),%xmm0
movss  0xeb0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1164 <get_normalized+0x54>
jp     1164 <get_normalized+0x54>
jmp    117b <get_normalized+0x6b>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    118d <get_normalized+0x7d>
jp     118d <get_normalized+0x7d>
movss  0xe7d(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b9 <get_normalized+0xa9>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  0xe65(%rip),%xmm1
mulss  %xmm1,%xmm0
call   1030 <roundf@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_normalized>:
push   %rax
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
movss  0xede(%rip),%xmm0
jne    1126 <get_normalized+0x16>
jnp    116d <get_normalized+0x5d>
ucomiss 0xed3(%rip),%xmm2
jne    1131 <get_normalized+0x21>
jnp    116d <get_normalized+0x5d>
ucomiss 0xec8(%rip),%xmm1
jne    113c <get_normalized+0x2c>
jnp    116d <get_normalized+0x5d>
divss  %xmm1,%xmm2
mulss  0xebc(%rip),%xmm2
movaps %xmm2,%xmm0
call   1030 <roundf@plt>
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @get_normalized(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = fcmp oeq float %6, -1.000000e+00
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load float, float* %5
%10 = fcmp oeq float %9, -1.000000e+00
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load float, float* %5
%13 = fcmp oeq float %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %11, %8, %2
store float -1.000000e+00, float* %3
br label %23
15: ; preds = %11
%16 = load float, float* %4
%17 = load float, float* %5
%18 = fdiv float %16, %17
%19 = fmul float %18, 1.000000e+04
%20 = call i32 @roundf(float %19)
%21 = sdiv i32 %20, 100
%22 = sitofp i32 %21 to float
store float %22, float* %3
br label %23
23: ; preds = %15, %14
%24 = load float, float* %3
ret float %24
}

LLVM IR (-O2):
define float @get_normalized(float %0, float %1) {
%3 = fcmp oeq float %0, -1.000000e+00
%4 = fcmp oeq float %1, -1.000000e+00
%5 = or i1 %3, %4
%6 = fcmp oeq float %1, 0.000000e+00
%7 = or i1 %6, %5
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = fdiv float %0, %1
%10 = fmul float %9, 1.000000e+04
%11 = tail call i32 @roundf(float %10)
%12 = sdiv i32 %11, 100
%13 = sitofp i32 %12 to float
br label %14
14: ; preds = %2, %8
%15 = phi float [ %13, %8 ], [ -1.000000e+00, %2 ]
ret float %15
}