#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t decimalLength9(const uint32_t v) {
  assert(v >= 0);
  assert(v < 1000000000);
  if (v >= 100000000) {
    return 9;
  }
  if (v >= 10000000) {
    return 8;
  }
  if (v >= 1000000) {
    return 7;
  }
  if (v >= 100000) {
    return 6;
  }
  if (v >= 10000) {
    return 5;
  }
  if (v >= 1000) {
    return 4;
  }
  if (v >= 100) {
    return 3;
  }
  if (v >= 10) {
    return 2;
  }
  return 1;
}


x86 assembly (clang, -O0):
<decimalLength9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x3b9aca00,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x5f5e100,-0x8(%rbp)
jl     1159 <decimalLength9+0x49>
movl   $0x9,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0x989680,-0x8(%rbp)
jl     1172 <decimalLength9+0x62>
movl   $0x8,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0xf4240,-0x8(%rbp)
jl     118b <decimalLength9+0x7b>
movl   $0x7,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0x186a0,-0x8(%rbp)
jl     11a4 <decimalLength9+0x94>
movl   $0x6,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0x2710,-0x8(%rbp)
jl     11bd <decimalLength9+0xad>
movl   $0x5,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0x3e8,-0x8(%rbp)
jl     11d6 <decimalLength9+0xc6>
movl   $0x4,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0x64,-0x8(%rbp)
jl     11ec <decimalLength9+0xdc>
movl   $0x3,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
cmpl   $0xa,-0x8(%rbp)
jl     1202 <decimalLength9+0xf2>
movl   $0x2,-0x4(%rbp)
jmp    1209 <decimalLength9+0xf9>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimalLength9>:
push   %rbx
mov    %edi,%ebx
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmp    $0x3b9aca00,%ebx
setl   %dil
call   1030 <assert@plt>
mov    $0x9,%eax
cmp    $0x5f5e0ff,%ebx
jg     1191 <decimalLength9+0x81>
mov    $0x8,%eax
cmp    $0x98967f,%ebx
jg     1191 <decimalLength9+0x81>
mov    $0x7,%eax
cmp    $0xf423f,%ebx
jg     1191 <decimalLength9+0x81>
mov    $0x6,%eax
cmp    $0x1869f,%ebx
jg     1191 <decimalLength9+0x81>
mov    $0x5,%eax
cmp    $0x270f,%ebx
jg     1191 <decimalLength9+0x81>
mov    $0x4,%eax
cmp    $0x3e7,%ebx
jg     1191 <decimalLength9+0x81>
mov    $0x3,%eax
cmp    $0x63,%ebx
jg     1191 <decimalLength9+0x81>
xor    %eax,%eax
cmp    $0xa,%ebx
setge  %al
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @decimalLength9(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 1000000000
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 100000000
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 9, i32* %2
br label %44
15: ; preds = %1
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 10000000
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 8, i32* %2
br label %44
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp sge i32 %20, 1000000
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 7, i32* %2
br label %44
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp sge i32 %24, 100000
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 6, i32* %2
br label %44
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp sge i32 %28, 10000
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 5, i32* %2
br label %44
31: ; preds = %27
%32 = load i32, i32* %3
%33 = icmp sge i32 %32, 1000
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 4, i32* %2
br label %44
35: ; preds = %31
%36 = load i32, i32* %3
%37 = icmp sge i32 %36, 100
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 3, i32* %2
br label %44
39: ; preds = %35
%40 = load i32, i32* %3
%41 = icmp sge i32 %40, 10
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 2, i32* %2
br label %44
43: ; preds = %39
store i32 1, i32* %2
br label %44
44: ; preds = %43, %42, %38, %34, %30, %26, %22, %18, %14
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @decimalLength9(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
%4 = tail call i32 @assert(i32 %3)
%5 = icmp slt i32 %0, 1000000000
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp sgt i32 %0, 99999999
br i1 %8, label %24, label %9
9: ; preds = %1
%10 = icmp sgt i32 %0, 9999999
br i1 %10, label %24, label %11
11: ; preds = %9
%12 = icmp sgt i32 %0, 999999
br i1 %12, label %24, label %13
13: ; preds = %11
%14 = icmp sgt i32 %0, 99999
br i1 %14, label %24, label %15
15: ; preds = %13
%16 = icmp sgt i32 %0, 9999
br i1 %16, label %24, label %17
17: ; preds = %15
%18 = icmp sgt i32 %0, 999
br i1 %18, label %24, label %19
19: ; preds = %17
%20 = icmp sgt i32 %0, 99
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = icmp sgt i32 %0, 9
%23 = select i1 %22, i32 2, i32 1
br label %24
24: ; preds = %21, %19, %17, %15, %13, %11, %9, %1
%25 = phi i32 [ 9, %1 ], [ 8, %9 ], [ 7, %11 ], [ 6, %13 ], [ 5, %15 ], [ 4, %17 ], [ 3, %19 ], [ %23, %21 ]
ret i32 %25
}