#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*/ printf(char *, long long);
void convert10tob(long long int n, long long int b) {
  long long int i, j, k;
  if (n == 0)
    return;
  i = n % b;
  n = n / b;
  if (i < 0)
    n = n + 1;
  convert10tob(n, b);
  j = i < 0 ? (i + (b * (-1))) : i;
  printf("%lld", j);
  return;
}


x86 assembly (clang, -O0):
<convert10tob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1140 <convert10tob+0x20>
jmp    11c0 <convert10tob+0xa0>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1173 <convert10tob+0x53>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <convert10tob@plt>
cmpq   $0x0,-0x18(%rbp)
jge    11a0 <convert10tob+0x80>
mov    -0x18(%rbp),%rax
imul   $0xffffffffffffffff,-0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
jmp    11a8 <convert10tob+0x88>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert10tob>:
test   %rdi,%rdi
je     1145 <convert10tob+0x25>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1146 <convert10tob+0x26>
mov    %rdi,%rax
cqto
idiv   %r14
mov    %rdx,%rbx
jmp    114f <convert10tob+0x2f>
ret
mov    %edi,%eax
xor    %edx,%edx
div    %r14d
mov    %edx,%ebx
mov    %rbx,%rdi
shr    $0x3f,%rdi
add    %rax,%rdi
mov    %r14,%rsi
call   1040 <convert10tob@plt>
mov    %rbx,%rax
sar    $0x3f,%rax
and    %r14,%rax
sub    %rax,%rbx
lea    0xe8b(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
define void @convert10tob(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = srem i64 %0, %1
%7 = sdiv i64 %0, %1
%8 = icmp slt i64 %6, 0
%9 = lshr i64 %6, 63
%10 = add nsw i64 %7, %9
tail call void @convert10tob(i64 %10, i64 %1)
%11 = select i1 %8, i64 %1, i64 0
%12 = sub i64 %6, %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %12)
br label %4
}