#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*/ count_digit(int);
int /*<<< orphan*/ count_digit_base(int, int);
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/);
int main() {
  printf("%d: %ld\n", 0, count_digit(0));
  printf("%d: %ld\n", 1, count_digit(1));
  printf("%d: %ld\n", 10, count_digit(10));
  printf("%d: %ld\n", 100, count_digit(100));
  printf("%d: %ld\n", 1000, count_digit(1000));
  printf("%d: %ld\n", 10000, count_digit(10000));
  printf("%d: %ld\n", 100000, count_digit(100000));
  printf("%x: %ld\n", 0, count_digit_base(0, 16));
  printf("%x: %ld\n", 1, count_digit_base(1, 16));
  printf("%x: %ld\n", 10, count_digit_base(10, 16));
  printf("%x: %ld\n", 100, count_digit_base(100, 16));
  printf("%x: %ld\n", 1000, count_digit_base(1000, 16));
  printf("%x: %ld\n", 10000, count_digit_base(10000, 16));
  printf("%x: %ld\n", 100000, count_digit_base(100000, 16));
  printf("%o: %ld\n", 0, count_digit_base(0, 8));
  printf("%o: %ld\n", 1, count_digit_base(1, 8));
  printf("%o: %ld\n", 10, count_digit_base(10, 8));
  printf("%o: %ld\n", 100, count_digit_base(100, 8));
  printf("%o: %ld\n", 1000, count_digit_base(1000, 8));
  printf("%o: %ld\n", 10000, count_digit_base(10000, 8));
  printf("%o: %ld\n", 100000, count_digit_base(100000, 8));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xeb1(%rip),%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xe97(%rip),%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    $0x64,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xe5d(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
mov    $0x3e8,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xe40(%rip),%rdi
mov    $0x3e8,%esi
call   1050 <printf@plt>
mov    $0x2710,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xe23(%rip),%rdi
mov    $0x2710,%esi
call   1050 <printf@plt>
mov    $0x186a0,%edi
call   1040 <count_digit@plt>
mov    %eax,%edx
lea    0xe06(%rip),%rdi
mov    $0x186a0,%esi
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xdf0(%rip),%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xdd1(%rip),%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xdaf(%rip),%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xd8d(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
mov    $0x3e8,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xd6b(%rip),%rdi
mov    $0x3e8,%esi
call   1050 <printf@plt>
mov    $0x2710,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xd49(%rip),%rdi
mov    $0x2710,%esi
call   1050 <printf@plt>
mov    $0x186a0,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xd27(%rip),%rdi
mov    $0x186a0,%esi
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xd11(%rip),%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xcf2(%rip),%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xcd0(%rip),%rdi
mov    $0xa,%esi
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xcae(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
mov    $0x3e8,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xc8c(%rip),%rdi
mov    $0x3e8,%esi
call   1050 <printf@plt>
mov    $0x2710,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xc6a(%rip),%rdi
mov    $0x2710,%esi
call   1050 <printf@plt>
mov    $0x186a0,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %eax,%edx
lea    0xc48(%rip),%rdi
mov    $0x186a0,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <count_digit@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x1,%edi
call   1040 <count_digit@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <count_digit@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x64,%edi
call   1040 <count_digit@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x3e8,%edi
call   1040 <count_digit@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x2710,%edi
call   1040 <count_digit@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x186a0,%edi
call   1040 <count_digit@plt>
mov    %rbx,%rdi
mov    $0x186a0,%esi
mov    %eax,%edx
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
lea    0xe15(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x3e8,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x2710,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x186a0,%edi
mov    $0x10,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x186a0,%esi
mov    %eax,%edx
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
lea    0xd4b(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x64,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x3e8,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x2710,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %eax,%edx
call   1050 <printf@plt>
mov    $0x186a0,%edi
mov    $0x8,%esi
call   1030 <count_digit_base@plt>
mov    %rbx,%rdi
mov    $0x186a0,%esi
mov    %eax,%edx
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d: %ld\0A\00"
@.str.1 = [9 x i8] c"%x: %ld\0A\00"
@.str.2 = [9 x i8] c"%o: %ld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @count_digit(i32 0)
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0, i32 %2)
%4 = call i32 @count_digit(i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4)
%6 = call i32 @count_digit(i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10, i32 %6)
%8 = call i32 @count_digit(i32 100)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 100, i32 %8)
%10 = call i32 @count_digit(i32 1000)
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1000, i32 %10)
%12 = call i32 @count_digit(i32 10000)
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10000, i32 %12)
%14 = call i32 @count_digit(i32 100000)
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 100000, i32 %14)
%16 = call i32 @count_digit_base(i32 0, i32 16)
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %16)
%18 = call i32 @count_digit_base(i32 1, i32 16)
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %18)
%20 = call i32 @count_digit_base(i32 10, i32 16)
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %20)
%22 = call i32 @count_digit_base(i32 100, i32 16)
%23 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 100, i32 %22)
%24 = call i32 @count_digit_base(i32 1000, i32 16)
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1000, i32 %24)
%26 = call i32 @count_digit_base(i32 10000, i32 16)
%27 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 10000, i32 %26)
%28 = call i32 @count_digit_base(i32 100000, i32 16)
%29 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 100000, i32 %28)
%30 = call i32 @count_digit_base(i32 0, i32 8)
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %30)
%32 = call i32 @count_digit_base(i32 1, i32 8)
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %32)
%34 = call i32 @count_digit_base(i32 10, i32 8)
%35 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 %34)
%36 = call i32 @count_digit_base(i32 100, i32 8)
%37 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 100, i32 %36)
%38 = call i32 @count_digit_base(i32 1000, i32 8)
%39 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1000, i32 %38)
%40 = call i32 @count_digit_base(i32 10000, i32 8)
%41 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 10000, i32 %40)
%42 = call i32 @count_digit_base(i32 100000, i32 8)
%43 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 100000, i32 %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d: %ld\0A\00"
@.str.1 = [9 x i8] c"%x: %ld\0A\00"
@.str.2 = [9 x i8] c"%o: %ld\0A\00"
define i32 @main() {
%1 = tail call i32 @count_digit(i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0, i32 %1)
%3 = tail call i32 @count_digit(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i32 %3)
%5 = tail call i32 @count_digit(i32 10)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10, i32 %5)
%7 = tail call i32 @count_digit(i32 100)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 100, i32 %7)
%9 = tail call i32 @count_digit(i32 1000)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1000, i32 %9)
%11 = tail call i32 @count_digit(i32 10000)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 10000, i32 %11)
%13 = tail call i32 @count_digit(i32 100000)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 100000, i32 %13)
%15 = tail call i32 @count_digit_base(i32 0, i32 16)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %15)
%17 = tail call i32 @count_digit_base(i32 1, i32 16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %17)
%19 = tail call i32 @count_digit_base(i32 10, i32 16)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 %19)
%21 = tail call i32 @count_digit_base(i32 100, i32 16)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 100, i32 %21)
%23 = tail call i32 @count_digit_base(i32 1000, i32 16)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1000, i32 %23)
%25 = tail call i32 @count_digit_base(i32 10000, i32 16)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 10000, i32 %25)
%27 = tail call i32 @count_digit_base(i32 100000, i32 16)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 100000, i32 %27)
%29 = tail call i32 @count_digit_base(i32 0, i32 8)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %29)
%31 = tail call i32 @count_digit_base(i32 1, i32 8)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %31)
%33 = tail call i32 @count_digit_base(i32 10, i32 8)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 %33)
%35 = tail call i32 @count_digit_base(i32 100, i32 8)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 100, i32 %35)
%37 = tail call i32 @count_digit_base(i32 1000, i32 8)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 1000, i32 %37)
%39 = tail call i32 @count_digit_base(i32 10000, i32 8)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 10000, i32 %39)
%41 = tail call i32 @count_digit_base(i32 100000, i32 8)
%42 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 100000, i32 %41)
ret i32 0
}