#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 abs(float);
int floorf(float);
int roundNumberFloor(float seed) {
  int count = 0;
  while (abs(seed) > 10) {
    seed /= 10;
    count++;
  }
  int ret = floorf(seed);
  while (count > 0) {
    ret *= 10;
    count--;
  }
  return ret;
}


x86 assembly (clang, -O0):
<roundNumberFloor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <abs@plt>
cmp    $0xa,%eax
jle    116b <roundNumberFloor+0x4b>
movss  -0x4(%rbp),%xmm0
movss  0xeac(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <roundNumberFloor+0x14>
movss  -0x4(%rbp),%xmm0
call   1040 <floorf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1197 <roundNumberFloor+0x77>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1178 <roundNumberFloor+0x58>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundNumberFloor>:
push   %rbp
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <abs@plt>
cmp    $0xb,%eax
jl     11ae <roundNumberFloor+0x8e>
xor    %ebp,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm0
divss  0xeb2(%rip),%xmm0
add    $0x1,%ebx
movss  %xmm0,0x4(%rsp)
call   1030 <abs@plt>
add    $0xffffffff,%ebp
cmp    $0xa,%eax
jg     1140 <roundNumberFloor+0x20>
movd   0x4(%rsp),%xmm0
call   1040 <floorf@plt>
mov    %ebp,%ecx
neg    %ecx
mov    %ebp,%edx
not    %edx
cmp    $0x7,%edx
jb     12b4 <roundNumberFloor+0x194>
mov    %ecx,%edx
and    $0xfffffff8,%edx
movd   %eax,%xmm1
movaps 0xe80(%rip),%xmm0
movss  %xmm1,%xmm0
lea    -0x8(%rdx),%esi
mov    %esi,%eax
shr    $0x3,%eax
add    $0x1,%eax
cmp    $0x38,%esi
jae    11bf <roundNumberFloor+0x9f>
movdqa 0xe74(%rip),%xmm1
jmp    121b <roundNumberFloor+0xfb>
movss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <floorf@plt>
mov    %eax,%esi
and    $0xfffffff8,%esi
movdqa 0xe54(%rip),%xmm1
movdqa 0xe5c(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm2,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm2,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm0
pshufd $0xf5,%xmm1,%xmm3
pmuludq %xmm2,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm2,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm1
add    $0xfffffff8,%esi
jne    11e0 <roundNumberFloor+0xc0>
test   $0x7,%al
je     127b <roundNumberFloor+0x15b>
mov    %ecx,%eax
and    $0x38,%al
add    $0xf8,%al
shr    $0x3,%al
add    $0x1,%al
movzbl %al,%eax
and    $0x7,%eax
movdqa 0xe08(%rip),%xmm2
nopl   0x0(%rax,%rax,1)
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm2,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm2,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm0
pshufd $0xf5,%xmm1,%xmm3
pmuludq %xmm2,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm2,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm1
add    $0xffffffff,%eax
jne    1240 <roundNumberFloor+0x120>
pshufd $0xf5,%xmm0,%xmm2
pshufd $0xf5,%xmm1,%xmm3
pmuludq %xmm2,%xmm3
pmuludq %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
pmuludq %xmm1,%xmm0
pshufd $0xaa,%xmm3,%xmm1
pmuludq %xmm3,%xmm1
pmuludq %xmm0,%xmm1
movd   %xmm1,%eax
cmp    %edx,%ecx
je     12cd <roundNumberFloor+0x1ad>
and    $0xfffffff8,%ebx
add    %ebp,%ebx
neg    %ebx
mov    %ebx,%ecx
add    $0x1,%ecx
nopw   0x0(%rax,%rax,1)
add    %eax,%eax
lea    (%rax,%rax,4),%eax
add    $0xffffffff,%ecx
cmp    $0x1,%ecx
jg     12c0 <roundNumberFloor+0x1a0>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @roundNumberFloor(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store float %0, float* %2
store i32 0, i32* %3
br label %5
5: ; preds = %9, %1
%6 = load float, float* %2
%7 = call i32 @abs(float %6)
%8 = icmp sgt i32 %7, 10
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load float, float* %2
%11 = fdiv float %10, 1.000000e+01
store float %11, float* %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %5
14: ; preds = %5
%15 = load float, float* %2
%16 = call i32 @floorf(float %15)
store i32 %16, i32* %4
br label %17
17: ; preds = %20, %14
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %4
%22 = mul nsw i32 %21, 10
store i32 %22, i32* %4
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
store i32 %24, i32* %3
br label %17
25: ; preds = %17
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @roundNumberFloor(float %0) {
%2 = tail call i32 @abs(float %0)
%3 = icmp sgt i32 %2, 10
br i1 %3, label %4, label %11
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi float [ %7, %4 ], [ %0, %1 ]
%7 = fdiv float %6, 1.000000e+01
%8 = add nuw nsw i32 %5, 1
%9 = tail call i32 @abs(float %7)
%10 = icmp sgt i32 %9, 10
br i1 %10, label %4, label %13
11: ; preds = %1
%12 = tail call i32 @floorf(float %0)
br label %65
13: ; preds = %4
%14 = tail call i32 @floorf(float %7)
%15 = add nuw i32 %5, 1
%16 = icmp ult i32 %5, 7
br i1 %16, label %56, label %17
17: ; preds = %13
%18 = and i32 %15, -8
%19 = sub i32 %8, %18
%20 = insertelement <4 x i32> <i32 poison, i32 1, i32 1, i32 1>, i32 %14, i64 0
%21 = add i32 %18, -8
%22 = lshr exact i32 %21, 3
%23 = add nuw nsw i32 %22, 1
%24 = and i32 %23, 7
%25 = icmp ult i32 %21, 56
br i1 %25, label %36, label %26
26: ; preds = %17
%27 = and i32 %23, 1073741816
br label %28
28: ; preds = %28, %26
%29 = phi <4 x i32> [ %20, %26 ], [ %32, %28 ]
%30 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %26 ], [ %33, %28 ]
%31 = phi i32 [ 0, %26 ], [ %34, %28 ]
%32 = mul <4 x i32> %29, <i32 100000000, i32 100000000, i32 100000000, i32 100000000>
%33 = mul <4 x i32> %30, <i32 100000000, i32 100000000, i32 100000000, i32 100000000>
%34 = add nuw i32 %31, 8
%35 = icmp eq i32 %34, %27
br i1 %35, label %36, label %28
36: ; preds = %28, %17
%37 = phi <4 x i32> [ undef, %17 ], [ %32, %28 ]
%38 = phi <4 x i32> [ undef, %17 ], [ %33, %28 ]
%39 = phi <4 x i32> [ %20, %17 ], [ %32, %28 ]
%40 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %17 ], [ %33, %28 ]
%41 = icmp eq i32 %24, 0
br i1 %41, label %50, label %42
42: ; preds = %36, %42
%43 = phi <4 x i32> [ %46, %42 ], [ %39, %36 ]
%44 = phi <4 x i32> [ %47, %42 ], [ %40, %36 ]
%45 = phi i32 [ %48, %42 ], [ 0, %36 ]
%46 = mul <4 x i32> %43, <i32 10, i32 10, i32 10, i32 10>
%47 = mul <4 x i32> %44, <i32 10, i32 10, i32 10, i32 10>
%48 = add i32 %45, 1
%49 = icmp eq i32 %48, %24
br i1 %49, label %50, label %42
50: ; preds = %42, %36
%51 = phi <4 x i32> [ %37, %36 ], [ %46, %42 ]
%52 = phi <4 x i32> [ %38, %36 ], [ %47, %42 ]
%53 = mul <4 x i32> %52, %51
%54 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %53)
%55 = icmp eq i32 %15, %18
br i1 %55, label %65, label %56
56: ; preds = %13, %50
%57 = phi i32 [ %14, %13 ], [ %54, %50 ]
%58 = phi i32 [ %8, %13 ], [ %19, %50 ]
br label %59
59: ; preds = %56, %59
%60 = phi i32 [ %62, %59 ], [ %57, %56 ]
%61 = phi i32 [ %63, %59 ], [ %58, %56 ]
%62 = mul nsw i32 %60, 10
%63 = add nsw i32 %61, -1
%64 = icmp sgt i32 %61, 1
br i1 %64, label %59, label %65
65: ; preds = %59, %50, %11
%66 = phi i32 [ %12, %11 ], [ %54, %50 ], [ %62, %59 ]
ret i32 %66
}