char *num_out(number)
register long number;
{
  static char num_buf[12];
  register int i;
  for (i = 11; i--;) {
    num_buf[i] = (number & 07) + '0';
    number >>= 3;
  }
  return num_buf;
}


x86 assembly (clang, -O0):
<num_out>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xb,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1150 <num_out+0x50>
mov    -0x8(%rbp),%rax
and    $0x7,%rax
add    $0x30,%rax
mov    %al,%dl
movslq -0xc(%rbp),%rcx
lea    0x2ee5(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
sar    $0x3,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <num_out+0xf>
lea    0x2eca(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_out>:
mov    %edi,%eax
and    $0x7,%al
or     $0x30,%al
mov    %al,0x2f1f(%rip)
lea    0x2f0e(%rip),%rax
mov    %edi,%ecx
shr    $0x3,%cl
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2f06(%rip)
mov    %rdi,%rcx
shr    $0x6,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2ef2(%rip)
mov    %rdi,%rcx
shr    $0x9,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2ede(%rip)
mov    %rdi,%rcx
shr    $0xc,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2eca(%rip)
mov    %rdi,%rcx
shr    $0xf,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2eb6(%rip)
mov    %rdi,%rcx
shr    $0x12,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2ea2(%rip)
mov    %rdi,%rcx
shr    $0x15,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2e8e(%rip)
mov    %rdi,%rcx
shr    $0x18,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2e7a(%rip)
mov    %rdi,%rcx
shr    $0x1b,%rcx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x2e66(%rip)
shr    $0x1e,%rdi
and    $0x7,%dil
or     $0x30,%dil
mov    %dil,0x2e52(%rip)
ret

LLVM IR (-O0):
@num_out.num_buf = internal global [12 x i8] zeroinitializer
define i8* @num_out(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 11, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %3
%6 = add nsw i32 %5, -1
store i32 %6, i32* %3
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i64, i64* %2
%10 = and i64 %9, 7
%11 = add nsw i64 %10, 48
%12 = trunc i64 %11 to i8
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 %14
store i8 %12, i8* %15
%16 = load i64, i64* %2
%17 = ashr i64 %16, 3
store i64 %17, i64* %2
br label %4
18: ; preds = %4
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 0)
}

LLVM IR (-O2):
@num_out.num_buf = internal global [12 x i8] zeroinitializer
define i8* @num_out(i64 %0) {
%2 = trunc i64 %0 to i8
%3 = and i8 %2, 7
%4 = or i8 %3, 48
store i8 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 10)
%5 = trunc i64 %0 to i8
%6 = lshr i8 %5, 3
%7 = and i8 %6, 7
%8 = or i8 %7, 48
store i8 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 9)
%9 = lshr i64 %0, 6
%10 = trunc i64 %9 to i8
%11 = and i8 %10, 7
%12 = or i8 %11, 48
store i8 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 8)
%13 = lshr i64 %0, 9
%14 = trunc i64 %13 to i8
%15 = and i8 %14, 7
%16 = or i8 %15, 48
store i8 %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 7)
%17 = lshr i64 %0, 12
%18 = trunc i64 %17 to i8
%19 = and i8 %18, 7
%20 = or i8 %19, 48
store i8 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 6)
%21 = lshr i64 %0, 15
%22 = trunc i64 %21 to i8
%23 = and i8 %22, 7
%24 = or i8 %23, 48
store i8 %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 5)
%25 = lshr i64 %0, 18
%26 = trunc i64 %25 to i8
%27 = and i8 %26, 7
%28 = or i8 %27, 48
store i8 %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 4)
%29 = lshr i64 %0, 21
%30 = trunc i64 %29 to i8
%31 = and i8 %30, 7
%32 = or i8 %31, 48
store i8 %32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 3)
%33 = lshr i64 %0, 24
%34 = trunc i64 %33 to i8
%35 = and i8 %34, 7
%36 = or i8 %35, 48
store i8 %36, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 2)
%37 = lshr i64 %0, 27
%38 = trunc i64 %37 to i8
%39 = and i8 %38, 7
%40 = or i8 %39, 48
store i8 %40, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 1)
%41 = lshr i64 %0, 30
%42 = trunc i64 %41 to i8
%43 = and i8 %42, 7
%44 = or i8 %43, 48
store i8 %44, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 0)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @num_out.num_buf, i64 0, i64 0)
}