#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 */
char i64c(int);
char *l64a(long l) {
  static char buf[8];
  int i = 0;
  if (l < 0L)
    return ((char *)0);
  do {
    buf[i++] = i64c((int)(l % 64));
    buf[i] = '\0';
  } while (l /= 64L, l > 0 && i < 6);
  return (buf);
}


x86 assembly (clang, -O0):
<l64a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    113b <l64a+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    11c0 <l64a+0xb0>
jmp    1140 <l64a+0x30>
mov    -0x10(%rbp),%rax
mov    $0x40,%ecx
cqto
idiv   %rcx
mov    %edx,%edi
call   1030 <i64c@plt>
mov    %al,%dl
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %eax,%rcx
lea    0x2ebd(%rip),%rax
mov    %dl,(%rax,%rcx,1)
movslq -0x14(%rbp),%rcx
lea    0x2eaf(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    $0x40,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x15(%rbp)
jle    11aa <l64a+0x9a>
cmpl   $0x6,-0x14(%rbp)
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1140 <l64a+0x30>
lea    0x2e6d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l64a>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
js     1170 <l64a+0x60>
mov    %rdi,%rbx
xor    %r15d,%r15d
lea    0x2eff(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%r12
add    $0x3f,%rbx
test   %r12,%r12
cmovns %r12,%rbx
sar    $0x6,%rbx
mov    %ebx,%eax
shl    $0x6,%eax
mov    %r12d,%edi
sub    %eax,%edi
call   1030 <i64c@plt>
mov    %al,(%r15,%r14,1)
movb   $0x0,0x1(%r15,%r14,1)
cmp    $0x40,%r12
jl     1173 <l64a+0x63>
lea    0x1(%r15),%rax
cmp    $0x5,%r15
mov    %rax,%r15
jb     1130 <l64a+0x20>
jmp    1173 <l64a+0x63>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@l64a.buf = internal global [8 x i8] zeroinitializer
define i8* @l64a(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 0, i32* %4
%5 = load i64, i64* %3
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %32
8: ; preds = %1
br label %9
9: ; preds = %29, %8
%10 = load i64, i64* %3
%11 = srem i64 %10, 64
%12 = trunc i64 %11 to i32
%13 = call signext i8 @i64c(i32 %12)
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds [8 x i8], [8 x i8]* @l64a.buf, i64 0, i64 %16
store i8 %13, i8* %17
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8], [8 x i8]* @l64a.buf, i64 0, i64 %19
store i8 0, i8* %20
br label %21
21: ; preds = %9
%22 = load i64, i64* %3
%23 = sdiv i64 %22, 64
store i64 %23, i64* %3
%24 = load i64, i64* %3
%25 = icmp sgt i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 6
br label %29
29: ; preds = %26, %21
%30 = phi i1 [ false, %21 ], [ %28, %26 ]
br i1 %30, label %9, label %31
31: ; preds = %29
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @l64a.buf, i64 0, i64 0), i8** %2
br label %32
32: ; preds = %31, %7
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
@l64a.buf = internal global [8 x i8] zeroinitializer
define i8* @l64a(i64 %0) {
%2 = icmp slt i64 %0, 0
br i1 %2, label %16, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %9, %3 ], [ 0, %1 ]
%5 = phi i64 [ %12, %3 ], [ %0, %1 ]
%6 = srem i64 %5, 64
%7 = trunc i64 %6 to i32
%8 = tail call signext i8 @i64c(i32 %7)
%9 = add nuw nsw i64 %4, 1
%10 = getelementptr inbounds [8 x i8], [8 x i8]* @l64a.buf, i64 0, i64 %4
store i8 %8, i8* %10
%11 = getelementptr inbounds [8 x i8], [8 x i8]* @l64a.buf, i64 0, i64 %9
store i8 0, i8* %11
%12 = sdiv i64 %5, 64
%13 = icmp sgt i64 %5, 63
%14 = icmp ult i64 %4, 5
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %3, label %16
16: ; preds = %3, %1
%17 = phi i8* [ null, %1 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @l64a.buf, i64 0, i64 0), %3 ]
ret i8* %17
}