#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_long_ticks(float x) {
  float q = 1;
  x = fabs(x);
  while (x > 10) {
    x /= 10;
    q /= 10;
  }
  while (x < 1 && x > 0) {
    x *= 10;
    q *= 10;
  }
  return q;
}


x86 assembly (clang, -O0):
<get_long_ticks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xebe(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1180 <get_long_ticks+0x70>
movss  -0x4(%rbp),%xmm0
movss  0xea8(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe92(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1139 <get_long_ticks+0x29>
jmp    1185 <get_long_ticks+0x75>
xor    %eax,%eax
movss  0xe71(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
mov    %al,-0x9(%rbp)
jbe    11ad <get_long_ticks+0x9d>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11bd <get_long_ticks+0xad>
jmp    11e6 <get_long_ticks+0xd6>
movss  0xe3f(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xe2d(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1185 <get_long_ticks+0x75>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_long_ticks>:
movaps %xmm0,%xmm1
andps  0xef6(%rip),%xmm1
ucomiss 0xf1f(%rip),%xmm1
movaps 0xef8(%rip),%xmm0
unpcklps %xmm1,%xmm0
jbe    113f <get_long_ticks+0x3f>
movaps 0xefc(%rip),%xmm1
movss  0xf04(%rip),%xmm2
nopl   0x0(%rax)
divps  %xmm1,%xmm0
movaps %xmm0,%xmm3
shufps $0x55,%xmm0,%xmm3
ucomiss %xmm2,%xmm3
ja     1130 <get_long_ticks+0x30>
movaps %xmm0,%xmm3
shufps $0x55,%xmm0,%xmm3
movss  0xee6(%rip),%xmm1
ucomiss %xmm3,%xmm1
jbe    1184 <get_long_ticks+0x84>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm3
jbe    1184 <get_long_ticks+0x84>
movaps 0xebe(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulps  %xmm3,%xmm0
movaps %xmm0,%xmm4
shufps $0x55,%xmm0,%xmm4
ucomiss %xmm4,%xmm1
jbe    1184 <get_long_ticks+0x84>
ucomiss %xmm2,%xmm4
ja     1170 <get_long_ticks+0x70>
ret

LLVM IR (-O0):
define float @get_long_ticks(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 1.000000e+00, float* %3
%4 = load float, float* %2
%5 = call float @fabs(float %4)
store float %5, float* %2
br label %6
6: ; preds = %9, %1
%7 = load float, float* %2
%8 = fcmp ogt float %7, 1.000000e+01
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load float, float* %2
%11 = fdiv float %10, 1.000000e+01
store float %11, float* %2
%12 = load float, float* %3
%13 = fdiv float %12, 1.000000e+01
store float %13, float* %3
br label %6
14: ; preds = %6
br label %15
15: ; preds = %23, %14
%16 = load float, float* %2
%17 = fcmp olt float %16, 1.000000e+00
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load float, float* %2
%20 = fcmp ogt float %19, 0.000000e+00
br label %21
21: ; preds = %18, %15
%22 = phi i1 [ false, %15 ], [ %20, %18 ]
br i1 %22, label %23, label %28
23: ; preds = %21
%24 = load float, float* %2
%25 = fmul float %24, 1.000000e+01
store float %25, float* %2
%26 = load float, float* %3
%27 = fmul float %26, 1.000000e+01
store float %27, float* %3
br label %15
28: ; preds = %21
%29 = load float, float* %3
ret float %29
}

LLVM IR (-O2):
define float @get_long_ticks(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
%3 = fcmp ogt float %2, 1.000000e+01
%4 = insertelement <2 x float> <float 1.000000e+00, float poison>, float %2, i64 1
br i1 %3, label %12, label %5
5: ; preds = %12, %1
%6 = phi <2 x float> [ %4, %1 ], [ %14, %12 ]
%7 = extractelement <2 x float> %6, i64 1
%8 = fcmp olt float %7, 1.000000e+00
%9 = fcmp ogt float %7, 0.000000e+00
%10 = and i1 %8, %9
%11 = extractelement <2 x float> %6, i64 0
br i1 %10, label %17, label %26
12: ; preds = %1, %12
%13 = phi <2 x float> [ %14, %12 ], [ %4, %1 ]
%14 = fdiv <2 x float> %13, <float 1.000000e+01, float 1.000000e+01>
%15 = extractelement <2 x float> %14, i64 1
%16 = fcmp ogt float %15, 1.000000e+01
br i1 %16, label %12, label %5
17: ; preds = %5, %17
%18 = phi <2 x float> [ %19, %17 ], [ %6, %5 ]
%19 = fmul <2 x float> %18, <float 1.000000e+01, float 1.000000e+01>
%20 = extractelement <2 x float> %19, i64 1
%21 = fcmp olt float %20, 1.000000e+00
%22 = fcmp ogt float %20, 0.000000e+00
%23 = and i1 %21, %22
br i1 %23, label %17, label %24
24: ; preds = %17
%25 = extractelement <2 x float> %19, i64 0
br label %26
26: ; preds = %24, %5
%27 = phi float [ %11, %5 ], [ %25, %24 ]
ret float %27
}