#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 supcon_leni(int num) {
  int p;
  int sign;
  if (num < 0) {
    p = -num;
    sign = 1;
  } else {
    p = num;
    sign = 0;
  }
  if (p < 10)
    return sign + 1;
  if (p < 100)
    return sign + 2;
  if (p < 1000)
    return sign + 3;
  if (p < 10000)
    return sign + 4;
  if (p < 100000)
    return sign + 5;
  if (p < 1000000)
    return sign + 6;
  if (p < 10000000)
    return sign + 7;
  if (p < 100000000)
    return sign + 8;
  if (p < 1000000000)
    return sign + 9;
  return 10;
}


x86 assembly (clang, -O0):
<supcon_leni>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1125 <supcon_leni+0x25>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    1132 <supcon_leni+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    114a <supcon_leni+0x4a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x64,-0xc(%rbp)
jge    1162 <supcon_leni+0x62>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x3e8,-0xc(%rbp)
jge    117d <supcon_leni+0x7d>
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x2710,-0xc(%rbp)
jge    1198 <supcon_leni+0x98>
mov    -0x10(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x186a0,-0xc(%rbp)
jge    11b3 <supcon_leni+0xb3>
mov    -0x10(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0xf4240,-0xc(%rbp)
jge    11ce <supcon_leni+0xce>
mov    -0x10(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x989680,-0xc(%rbp)
jge    11e9 <supcon_leni+0xe9>
mov    -0x10(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x5f5e100,-0xc(%rbp)
jge    1204 <supcon_leni+0x104>
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
cmpl   $0x3b9aca00,-0xc(%rbp)
jge    121f <supcon_leni+0x11f>
mov    -0x10(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x4(%rbp)
jmp    1226 <supcon_leni+0x126>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<supcon_leni>:
mov    %edi,%eax
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
shr    $0x1f,%eax
cmp    $0x9,%ecx
ja     1115 <supcon_leni+0x15>
add    $0x1,%eax
ret
cmp    $0x63,%ecx
ja     111e <supcon_leni+0x1e>
or     $0x2,%eax
ret
cmp    $0x3e7,%ecx
ja     112a <supcon_leni+0x2a>
add    $0x3,%eax
ret
cmp    $0x270f,%ecx
ja     1136 <supcon_leni+0x36>
or     $0x4,%eax
ret
cmp    $0x1869f,%ecx
ja     1142 <supcon_leni+0x42>
add    $0x5,%eax
ret
cmp    $0xf423f,%ecx
ja     114e <supcon_leni+0x4e>
or     $0x6,%eax
ret
cmp    $0x98967f,%ecx
ja     115a <supcon_leni+0x5a>
add    $0x7,%eax
ret
cmp    $0x5f5e0ff,%ecx
ja     1166 <supcon_leni+0x66>
or     $0x8,%eax
ret
add    $0x9,%eax
cmp    $0x3b9aca00,%ecx
mov    $0xa,%ecx
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @supcon_leni(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 0, %9
store i32 %10, i32* %4
store i32 1, i32* %5
br label %13
11: ; preds = %1
%12 = load i32, i32* %3
store i32 %12, i32* %4
store i32 0, i32* %5
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %68
19: ; preds = %13
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 100
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 2
store i32 %24, i32* %2
br label %68
25: ; preds = %19
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 1000
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 3
store i32 %30, i32* %2
br label %68
31: ; preds = %25
%32 = load i32, i32* %4
%33 = icmp slt i32 %32, 10000
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 4
store i32 %36, i32* %2
br label %68
37: ; preds = %31
%38 = load i32, i32* %4
%39 = icmp slt i32 %38, 100000
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 5
store i32 %42, i32* %2
br label %68
43: ; preds = %37
%44 = load i32, i32* %4
%45 = icmp slt i32 %44, 1000000
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 6
store i32 %48, i32* %2
br label %68
49: ; preds = %43
%50 = load i32, i32* %4
%51 = icmp slt i32 %50, 10000000
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 7
store i32 %54, i32* %2
br label %68
55: ; preds = %49
%56 = load i32, i32* %4
%57 = icmp slt i32 %56, 100000000
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 8
store i32 %60, i32* %2
br label %68
61: ; preds = %55
%62 = load i32, i32* %4
%63 = icmp slt i32 %62, 1000000000
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 9
store i32 %66, i32* %2
br label %68
67: ; preds = %61
store i32 10, i32* %2
br label %68
68: ; preds = %67, %64, %58, %52, %46, %40, %34, %28, %22, %16
%69 = load i32, i32* %2
ret i32 %69
}

LLVM IR (-O2):
define i32 @supcon_leni(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = lshr i32 %0, 31
%4 = icmp ult i32 %2, 10
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nuw nsw i32 %3, 1
br label %39
7: ; preds = %1
%8 = icmp ult i32 %2, 100
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = or i32 %3, 2
br label %39
11: ; preds = %7
%12 = icmp ult i32 %2, 1000
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = add nuw nsw i32 %3, 3
br label %39
15: ; preds = %11
%16 = icmp ult i32 %2, 10000
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = or i32 %3, 4
br label %39
19: ; preds = %15
%20 = icmp ult i32 %2, 100000
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = add nuw nsw i32 %3, 5
br label %39
23: ; preds = %19
%24 = icmp ult i32 %2, 1000000
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = or i32 %3, 6
br label %39
27: ; preds = %23
%28 = icmp ult i32 %2, 10000000
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = add nuw nsw i32 %3, 7
br label %39
31: ; preds = %27
%32 = icmp ult i32 %2, 100000000
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = or i32 %3, 8
br label %39
35: ; preds = %31
%36 = icmp ult i32 %2, 1000000000
%37 = add nuw nsw i32 %3, 9
%38 = select i1 %36, i32 %37, i32 10
br label %39
39: ; preds = %35, %33, %29, %25, %21, %17, %13, %9, %5
%40 = phi i32 [ %6, %5 ], [ %10, %9 ], [ %14, %13 ], [ %18, %17 ], [ %22, %21 ], [ %26, %25 ], [ %30, %29 ], [ %34, %33 ], [ %38, %35 ]
ret i32 %40
}