int start_div(int n) {
  if (n > 999999999)
    return 1000000000;
  if (n > 99999999)
    return 100000000;
  if (n > 9999999)
    return 10000000;
  if (n > 999999)
    return 1000000;
  if (n > 99999)
    return 100000;
  if (n > 9999)
    return 10000;
  if (n > 999)
    return 1000;
  if (n > 99)
    return 100;
  if (n > 9)
    return 10;
  return 1;
}


x86 assembly (clang, -O0):
<start_div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x3b9ac9ff,-0x8(%rbp)
jle    1120 <start_div+0x20>
movl   $0x3b9aca00,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x5f5e0ff,-0x8(%rbp)
jle    1139 <start_div+0x39>
movl   $0x5f5e100,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x98967f,-0x8(%rbp)
jle    1152 <start_div+0x52>
movl   $0x989680,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0xf423f,-0x8(%rbp)
jle    116b <start_div+0x6b>
movl   $0xf4240,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x1869f,-0x8(%rbp)
jle    1184 <start_div+0x84>
movl   $0x186a0,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x270f,-0x8(%rbp)
jle    119d <start_div+0x9d>
movl   $0x2710,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x3e7,-0x8(%rbp)
jle    11b6 <start_div+0xb6>
movl   $0x3e8,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x63,-0x8(%rbp)
jle    11cc <start_div+0xcc>
movl   $0x64,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
cmpl   $0x9,-0x8(%rbp)
jle    11e2 <start_div+0xe2>
movl   $0xa,-0x4(%rbp)
jmp    11e9 <start_div+0xe9>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_div>:
mov    $0x3b9aca00,%eax
cmp    $0x3b9ac9ff,%edi
jg     1173 <start_div+0x73>
mov    $0x5f5e100,%eax
cmp    $0x5f5e0ff,%edi
jg     1173 <start_div+0x73>
mov    $0x989680,%eax
cmp    $0x98967f,%edi
jg     1173 <start_div+0x73>
mov    $0xf4240,%eax
cmp    $0xf423f,%edi
jg     1173 <start_div+0x73>
mov    $0x186a0,%eax
cmp    $0x1869f,%edi
jg     1173 <start_div+0x73>
mov    $0x2710,%eax
cmp    $0x270f,%edi
jg     1173 <start_div+0x73>
mov    $0x3e8,%eax
cmp    $0x3e7,%edi
jg     1173 <start_div+0x73>
mov    $0x64,%eax
cmp    $0x63,%edi
jg     1173 <start_div+0x73>
xor    %eax,%eax
cmp    $0xa,%edi
setge  %al
lea    (%rax,%rax,8),%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @start_div(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 999999999
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1000000000, i32* %2
br label %40
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 99999999
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 100000000, i32* %2
br label %40
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 9999999
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 10000000, i32* %2
br label %40
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 999999
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 1000000, i32* %2
br label %40
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 99999
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 100000, i32* %2
br label %40
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 9999
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 10000, i32* %2
br label %40
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp sgt i32 %28, 999
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 1000, i32* %2
br label %40
31: ; preds = %27
%32 = load i32, i32* %3
%33 = icmp sgt i32 %32, 99
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 100, i32* %2
br label %40
35: ; preds = %31
%36 = load i32, i32* %3
%37 = icmp sgt i32 %36, 9
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 10, i32* %2
br label %40
39: ; preds = %35
store i32 1, i32* %2
br label %40
40: ; preds = %39, %38, %34, %30, %26, %22, %18, %14, %10, %6
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @start_div(i32 %0) {
%2 = icmp sgt i32 %0, 999999999
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 99999999
br i1 %4, label %20, label %5
5: ; preds = %3
%6 = icmp sgt i32 %0, 9999999
br i1 %6, label %20, label %7
7: ; preds = %5
%8 = icmp sgt i32 %0, 999999
br i1 %8, label %20, label %9
9: ; preds = %7
%10 = icmp sgt i32 %0, 99999
br i1 %10, label %20, label %11
11: ; preds = %9
%12 = icmp sgt i32 %0, 9999
br i1 %12, label %20, label %13
13: ; preds = %11
%14 = icmp sgt i32 %0, 999
br i1 %14, label %20, label %15
15: ; preds = %13
%16 = icmp sgt i32 %0, 99
br i1 %16, label %20, label %17
17: ; preds = %15
%18 = icmp slt i32 %0, 10
%19 = select i1 %18, i32 1, i32 10
br label %20
20: ; preds = %17, %15, %13, %11, %9, %7, %5, %3, %1
%21 = phi i32 [ 1000000000, %1 ], [ 100000000, %3 ], [ 10000000, %5 ], [ 1000000, %7 ], [ 100000, %9 ], [ 10000, %11 ], [ 1000, %13 ], [ 100, %15 ], [ %19, %17 ]
ret i32 %21
}