#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*/ ibdg(long long);
int /*<<< orphan*/ printf(char *, unsigned long long, int /*<<< orphan*/);
int /*<<< orphan*/ ubdg(unsigned long long);
int main(int argc, char **argv) {
  unsigned int i;
  unsigned long long v = 1;
  v = 1;
  for (i = 1; i <= 20; i++) {
    printf("%lld : %d\n", (long long)v, ibdg((long long)v));
    v *= 10;
  }
  v = 1;
  for (i = 1; i <= 20; i++) {
    printf("%llu : %d\n", v, ubdg(v));
    v *= 10;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0x1,-0x20(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
ja     11a1 <main+0x71>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <ibdg@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
imul   $0xa,-0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x2d>
movq   $0x1,-0x20(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
ja     11f4 <main+0xc4>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <ubdg@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe33(%rip),%rdi
call   1040 <printf@plt>
imul   $0xa,-0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
mov    $0x14,%ebp
lea    0xebb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <ibdg@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
add    %rbx,%rbx
lea    (%rbx,%rbx,4),%rbx
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
mov    $0x1,%ebx
mov    $0x14,%ebp
lea    0xe89(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <ubdg@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
add    %rbx,%rbx
lea    (%rbx,%rbx,4),%rbx
add    $0xffffffff,%ebp
jne    1190 <main+0x60>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%lld : %d\0A\00"
@.str.1 = [11 x i8] c"%llu : %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 1, i64* %7
store i64 1, i64* %7
store i32 1, i32* %6
br label %8
8: ; preds = %18, %2
%9 = load i32, i32* %6
%10 = icmp ule i32 %9, 20
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i64, i64* %7
%13 = load i64, i64* %7
%14 = call i32 @ibdg(i64 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %12, i32 %14)
%16 = load i64, i64* %7
%17 = mul i64 %16, 10
store i64 %17, i64* %7
br label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = add i32 %19, 1
store i32 %20, i32* %6
br label %8
21: ; preds = %8
store i64 1, i64* %7
store i32 1, i32* %6
br label %22
22: ; preds = %32, %21
%23 = load i32, i32* %6
%24 = icmp ule i32 %23, 20
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i64, i64* %7
%27 = load i64, i64* %7
%28 = call i32 @ubdg(i64 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %26, i32 %28)
%30 = load i64, i64* %7
%31 = mul i64 %30, 10
store i64 %31, i64* %7
br label %32
32: ; preds = %25
%33 = load i32, i32* %6
%34 = add i32 %33, 1
store i32 %34, i32* %6
br label %22
35: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%lld : %d\0A\00"
@.str.1 = [11 x i8] c"%llu : %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i64 [ 1, %2 ], [ %8, %3 ]
%5 = phi i32 [ 1, %2 ], [ %9, %3 ]
%6 = tail call i32 @ibdg(i64 %4)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %4, i32 %6)
%8 = mul i64 %4, 10
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, 21
br i1 %10, label %11, label %3
11: ; preds = %3, %11
%12 = phi i64 [ %16, %11 ], [ 1, %3 ]
%13 = phi i32 [ %17, %11 ], [ 1, %3 ]
%14 = tail call i32 @ubdg(i64 %12)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %12, i32 %14)
%16 = mul i64 %12, 10
%17 = add nuw nsw i32 %13, 1
%18 = icmp eq i32 %17, 21
br i1 %18, label %19, label %11
19: ; preds = %11
ret i32 0
}