#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 /*<<< orphan*/ assert(int);
int Vec_StrBase10Log(unsigned Num) {
  int Res;
  assert(Num >= 0);
  if (Num == 0)
    return 0;
  if (Num == 1)
    return 1;
  for (Res = 0, Num--; Num; Num /= 10, Res++)
    ;
  return Res;
}


x86 assembly (clang, -O0):
<Vec_StrBase10Log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1142 <Vec_StrBase10Log+0x32>
movl   $0x0,-0x4(%rbp)
jmp    119a <Vec_StrBase10Log+0x8a>
cmpl   $0x1,-0x8(%rbp)
jne    1158 <Vec_StrBase10Log+0x48>
movl   $0x1,-0x4(%rbp)
jmp    119a <Vec_StrBase10Log+0x8a>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1194 <Vec_StrBase10Log+0x84>
jmp    1177 <Vec_StrBase10Log+0x67>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1168 <Vec_StrBase10Log+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vec_StrBase10Log>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1030 <assert@plt>
test   %ebx,%ebx
je     1154 <Vec_StrBase10Log+0x44>
cmp    $0x1,%ebx
jne    112d <Vec_StrBase10Log+0x1d>
mov    $0x1,%ebx
jmp    1154 <Vec_StrBase10Log+0x44>
mov    %ebx,%eax
add    $0xffffffff,%eax
xor    %ebx,%ebx
mov    $0xcccccccd,%ecx
nopl   0x0(%rax)
mov    %eax,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%ebx
cmp    $0x9,%eax
mov    %edx,%eax
ja     1140 <Vec_StrBase10Log+0x30>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Vec_StrBase10Log(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp uge i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %30
12: ; preds = %1
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 1, i32* %2
br label %30
16: ; preds = %12
store i32 0, i32* %4
%17 = load i32, i32* %3
%18 = add i32 %17, -1
store i32 %18, i32* %3
br label %19
19: ; preds = %23, %16
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = udiv i32 %24, 10
store i32 %25, i32* %3
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %19
28: ; preds = %19
%29 = load i32, i32* %4
store i32 %29, i32* %2
br label %30
30: ; preds = %28, %15, %11
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @Vec_StrBase10Log(i32 %0) {
%2 = tail call i32 @assert(i32 1)
switch i32 %0, label %4 [
i32 0, label %12
i32 1, label %3
]
3: ; preds = %1
br label %12
4: ; preds = %1
%5 = add i32 %0, -1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %10, %6 ], [ 0, %4 ]
%8 = phi i32 [ %9, %6 ], [ %5, %4 ]
%9 = udiv i32 %8, 10
%10 = add nuw nsw i32 %7, 1
%11 = icmp ult i32 %8, 10
br i1 %11, label %12, label %6
12: ; preds = %6, %1, %3
%13 = phi i32 [ 1, %3 ], [ %0, %1 ], [ %10, %6 ]
ret i32 %13
}