#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ tr_print_str(char *);
void tr_print_num(long n) {
  long l, m;
  const char digits[] = "0123456789";
  char buf[32], *p;
  p = &buf[sizeof(buf) - 1];
  *p = '\0';
  m = n;
  do {
    p--;
    *p = digits[m % 10];
    m /= 10;
  } while (0 < m);
  tr_print_str(p);
}


x86 assembly (clang, -O0):
<tr_print_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x23(%rbp)
mov    0xeda(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xed2(%rip),%al
mov    %al,-0x19(%rbp)
lea    -0x50(%rbp),%rax
add    $0x1f,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x58(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    -0x23(%rbp,%rdx,1),%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jl     1156 <tr_print_num+0x46>
mov    -0x58(%rbp),%rdi
call   1030 <tr_print_str@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr_print_num>:
sub    $0x28,%rsp
mov    %rdi,%rsi
lea    0x1f(%rsp),%rdi
movb   $0x0,0x1f(%rsp)
lea    0xed8(%rip),%r8
movabs $0x6666666666666667,%r9
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rsi,%rax
imul   %r9
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rsi,%rcx
sub    %rax,%rcx
movzbl (%r8,%rcx,1),%eax
mov    %al,-0x1(%rdi)
add    $0xffffffffffffffff,%rdi
cmp    $0x9,%rsi
mov    %rdx,%rsi
jg     1140 <tr_print_num+0x30>
call   1030 <tr_print_str@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.tr_print_num.digits = [11 x i8] c"0123456789\00"
define void @tr_print_num(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca [11 x i8]
%6 = alloca [32 x i8]
%7 = alloca i8*
store i64 %0, i64* %2
%8 = bitcast [11 x i8]* %5 to i8*
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 31
store i8* %9, i8** %7
%10 = load i8*, i8** %7
store i8 0, i8* %10
%11 = load i64, i64* %2
store i64 %11, i64* %4
br label %12
12: ; preds = %22, %1
%13 = load i8*, i8** %7
%14 = getelementptr inbounds i8, i8* %13, i32 -1
store i8* %14, i8** %7
%15 = load i64, i64* %4
%16 = srem i64 %15, 10
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %7
store i8 %18, i8* %19
%20 = load i64, i64* %4
%21 = sdiv i64 %20, 10
store i64 %21, i64* %4
br label %22
22: ; preds = %12
%23 = load i64, i64* %4
%24 = icmp slt i64 0, %23
br i1 %24, label %12, label %25
25: ; preds = %22
%26 = load i8*, i8** %7
%27 = call i32 @tr_print_str(i8* %26)
ret void
}

LLVM IR (-O2):
@__const.tr_print_num.digits = [11 x i8] c"0123456789\00"
define void @tr_print_num(i64 %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 31
store i8 0, i8* %4
br label %5
5: ; preds = %5, %1
%6 = phi i64 [ %0, %1 ], [ %12, %5 ]
%7 = phi i8* [ %4, %1 ], [ %8, %5 ]
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = srem i64 %6, 10
%10 = getelementptr inbounds [11 x i8], [11 x i8]* @__const.tr_print_num.digits, i64 0, i64 %9
%11 = load i8, i8* %10
store i8 %11, i8* %8
%12 = sdiv i64 %6, 10
%13 = icmp sgt i64 %6, 9
br i1 %13, label %5, label %14
14: ; preds = %5
%15 = call i32 @tr_print_str(i8* %8)
ret void
}