#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 */
float fabs(float);
float get_label_ticks(float x) {
  float q = 1.0;
  if (x == 0.0)
    return 0.0;
  x = fabs(x);
  while (x > 10) {
    x /= 10;
    q /= 10;
  }
  while (x < 0.5) {
    x *= 10;
    q *= 10;
  }
  while (x < 4 && x >= 2) {
    x *= 2;
    q *= 2;
  }
  while (x < 2) {
    x *= 5;
    q *= 5;
  }
  return q;
}


x86 assembly (clang, -O0):
<get_label_ticks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  0xedb(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1153 <get_label_ticks+0x43>
jp     1153 <get_label_ticks+0x43>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12a7 <get_label_ticks+0x197>
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe95(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11a9 <get_label_ticks+0x99>
movss  -0x8(%rbp),%xmm0
movss  0xe7f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe69(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1162 <get_label_ticks+0x52>
jmp    11ae <get_label_ticks+0x9e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe59(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f2 <get_label_ticks+0xe2>
movss  0xe33(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe21(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11ae <get_label_ticks+0x9e>
jmp    11f7 <get_label_ticks+0xe7>
xor    %eax,%eax
movss  0xe07(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
mov    %al,-0xd(%rbp)
jbe    1224 <get_label_ticks+0x114>
movss  -0x8(%rbp),%xmm0
movss  0xdf1(%rip),%xmm1
ucomiss %xmm1,%xmm0
setae  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1234 <get_label_ticks+0x124>
jmp    125d <get_label_ticks+0x14d>
movss  0xdd0(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xdbe(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11f7 <get_label_ticks+0xe7>
jmp    1262 <get_label_ticks+0x152>
movss  0xda2(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    129d <get_label_ticks+0x18d>
movss  0xd94(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xd82(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1262 <get_label_ticks+0x152>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_label_ticks>:
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    1111 <get_label_ticks+0x11>
jnp    11ef <get_label_ticks+0xef>
andps  0xee8(%rip),%xmm1
ucomiss 0xf21(%rip),%xmm1
movaps 0xeea(%rip),%xmm0
unpcklps %xmm1,%xmm0
jbe    114f <get_label_ticks+0x4f>
movaps 0xeee(%rip),%xmm1
movss  0xf06(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
divps  %xmm1,%xmm0
movaps %xmm0,%xmm3
shufps $0x55,%xmm0,%xmm3
ucomiss %xmm2,%xmm3
ja     1140 <get_label_ticks+0x40>
movaps %xmm0,%xmm2
shufps $0x55,%xmm0,%xmm2
movss  0xee6(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    117f <get_label_ticks+0x7f>
movaps 0xeb6(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
mulps  %xmm2,%xmm0
movaps %xmm0,%xmm3
shufps $0x55,%xmm0,%xmm3
ucomiss %xmm3,%xmm1
ja     1170 <get_label_ticks+0x70>
movaps %xmm0,%xmm2
shufps $0x55,%xmm0,%xmm2
movss  0xeba(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    11c4 <get_label_ticks+0xc4>
ucomiss 0xeb2(%rip),%xmm2
jb     11c4 <get_label_ticks+0xc4>
movss  0xea8(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addps  %xmm0,%xmm0
movaps %xmm0,%xmm3
shufps $0x55,%xmm0,%xmm3
ucomiss %xmm3,%xmm1
jbe    11c4 <get_label_ticks+0xc4>
ucomiss %xmm2,%xmm3
jae    11b0 <get_label_ticks+0xb0>
movaps %xmm0,%xmm2
shufps $0x55,%xmm0,%xmm2
movss  0xe79(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    11ef <get_label_ticks+0xef>
movaps 0xe51(%rip),%xmm2
nop
mulps  %xmm2,%xmm0
movaps %xmm0,%xmm3
shufps $0x55,%xmm0,%xmm3
ucomiss %xmm3,%xmm1
ja     11e0 <get_label_ticks+0xe0>
ret

LLVM IR (-O0):
define float @get_label_ticks(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float 1.000000e+00, float* %4
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %1
store float 0.000000e+00, float* %2
br label %55
9: ; preds = %1
%10 = load float, float* %3
%11 = call float @fabs(float %10)
store float %11, float* %3
br label %12
12: ; preds = %15, %9
%13 = load float, float* %3
%14 = fcmp ogt float %13, 1.000000e+01
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load float, float* %3
%17 = fdiv float %16, 1.000000e+01
store float %17, float* %3
%18 = load float, float* %4
%19 = fdiv float %18, 1.000000e+01
store float %19, float* %4
br label %12
20: ; preds = %12
br label %21
21: ; preds = %25, %20
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = fcmp olt double %23, 5.000000e-01
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load float, float* %3
%27 = fmul float %26, 1.000000e+01
store float %27, float* %3
%28 = load float, float* %4
%29 = fmul float %28, 1.000000e+01
store float %29, float* %4
br label %21
30: ; preds = %21
br label %31
31: ; preds = %39, %30
%32 = load float, float* %3
%33 = fcmp olt float %32, 4.000000e+00
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load float, float* %3
%36 = fcmp oge float %35, 2.000000e+00
br label %37
37: ; preds = %34, %31
%38 = phi i1 [ false, %31 ], [ %36, %34 ]
br i1 %38, label %39, label %44
39: ; preds = %37
%40 = load float, float* %3
%41 = fmul float %40, 2.000000e+00
store float %41, float* %3
%42 = load float, float* %4
%43 = fmul float %42, 2.000000e+00
store float %43, float* %4
br label %31
44: ; preds = %37
br label %45
45: ; preds = %48, %44
%46 = load float, float* %3
%47 = fcmp olt float %46, 2.000000e+00
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = load float, float* %3
%50 = fmul float %49, 5.000000e+00
store float %50, float* %3
%51 = load float, float* %4
%52 = fmul float %51, 5.000000e+00
store float %52, float* %4
br label %45
53: ; preds = %45
%54 = load float, float* %4
store float %54, float* %2
br label %55
55: ; preds = %53, %8
%56 = load float, float* %2
ret float %56
}

LLVM IR (-O2):
define float @get_label_ticks(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
br i1 %2, label %46, label %3
3: ; preds = %1
%4 = tail call float @llvm.fabs.f32(float %0)
%5 = fcmp ogt float %4, 1.000000e+01
%6 = insertelement <2 x float> <float 1.000000e+00, float poison>, float %4, i64 1
br i1 %5, label %11, label %7
7: ; preds = %11, %3
%8 = phi <2 x float> [ %6, %3 ], [ %13, %11 ]
%9 = extractelement <2 x float> %8, i64 1
%10 = fcmp olt float %9, 5.000000e-01
br i1 %10, label %22, label %16
11: ; preds = %3, %11
%12 = phi <2 x float> [ %13, %11 ], [ %6, %3 ]
%13 = fdiv <2 x float> %12, <float 1.000000e+01, float 1.000000e+01>
%14 = extractelement <2 x float> %13, i64 1
%15 = fcmp ogt float %14, 1.000000e+01
br i1 %15, label %11, label %7
16: ; preds = %22, %7
%17 = phi <2 x float> [ %8, %7 ], [ %24, %22 ]
%18 = extractelement <2 x float> %17, i64 1
%19 = fcmp olt float %18, 4.000000e+00
%20 = fcmp oge float %18, 2.000000e+00
%21 = and i1 %19, %20
br i1 %21, label %32, label %27
22: ; preds = %7, %22
%23 = phi <2 x float> [ %24, %22 ], [ %8, %7 ]
%24 = fmul <2 x float> %23, <float 1.000000e+01, float 1.000000e+01>
%25 = extractelement <2 x float> %24, i64 1
%26 = fcmp olt float %25, 5.000000e-01
br i1 %26, label %22, label %16
27: ; preds = %32, %16
%28 = phi <2 x float> [ %17, %16 ], [ %34, %32 ]
%29 = extractelement <2 x float> %28, i64 1
%30 = fcmp olt float %29, 2.000000e+00
%31 = extractelement <2 x float> %28, i64 0
br i1 %30, label %39, label %46
32: ; preds = %16, %32
%33 = phi <2 x float> [ %34, %32 ], [ %17, %16 ]
%34 = fmul <2 x float> %33, <float 2.000000e+00, float 2.000000e+00>
%35 = extractelement <2 x float> %34, i64 1
%36 = fcmp olt float %35, 4.000000e+00
%37 = fcmp oge float %35, 2.000000e+00
%38 = and i1 %36, %37
br i1 %38, label %32, label %27
39: ; preds = %27, %39
%40 = phi <2 x float> [ %41, %39 ], [ %28, %27 ]
%41 = fmul <2 x float> %40, <float 5.000000e+00, float 5.000000e+00>
%42 = extractelement <2 x float> %41, i64 1
%43 = fcmp olt float %42, 2.000000e+00
br i1 %43, label %39, label %44
44: ; preds = %39
%45 = extractelement <2 x float> %41, i64 0
br label %46
46: ; preds = %44, %27, %1
%47 = phi float [ 0.000000e+00, %1 ], [ %31, %27 ], [ %45, %44 ]
ret float %47
}