#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ printc(int /*<<< orphan*/ *, int);
void printl(FILE *fp, long n) {
  int c;
  if (n < 0) {
    printc(fp, '-');
    if ((n = -n) < 0)
      n = 0;
  }
  c = n % 10 + '0';
  n /= 10;
  if (n != 0)
    printl(fp, n);
  printc(fp, c);
}


x86 assembly (clang, -O0):
<printl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    116a <printl+0x4a>
mov    -0x8(%rbp),%rdi
mov    $0x2d,%esi
call   1040 <printc@plt>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jge    1165 <printl+0x45>
movq   $0x0,-0x10(%rbp)
jmp    116a <printl+0x4a>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
add    $0x30,%rdx
mov    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11ab <printl+0x8b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <printl@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <printc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printl>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
jns    1140 <printl+0x20>
mov    %r14,%rdi
mov    $0x2d,%esi
call   1040 <printc@plt>
neg    %rbx
movabs $0xcccccccccccccccd,%r15
cc cc cc
cmp    $0xa,%rbx
jb     1165 <printl+0x45>
mov    %rbx,%rax
mul    %r15
shr    $0x3,%rdx
mov    %r14,%rdi
mov    %rdx,%rsi
call   1030 <printl@plt>
mov    %rbx,%rax
mul    %r15
shr    $0x3,%rdx
add    %edx,%edx
lea    (%rdx,%rdx,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printc@plt>

LLVM IR (-O0):
define void @printl(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32*, i32** %3
%10 = call i32 @printc(i32* %9, i32 45)
%11 = load i64, i64* %4
%12 = sub nsw i64 0, %11
store i64 %12, i64* %4
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %8
store i64 0, i64* %4
br label %15
15: ; preds = %14, %8
br label %16
16: ; preds = %15, %2
%17 = load i64, i64* %4
%18 = srem i64 %17, 10
%19 = add nsw i64 %18, 48
%20 = trunc i64 %19 to i32
store i32 %20, i32* %5
%21 = load i64, i64* %4
%22 = sdiv i64 %21, 10
store i64 %22, i64* %4
%23 = load i64, i64* %4
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %16
%26 = load i32*, i32** %3
%27 = load i64, i64* %4
br label %28
28: ; preds = %25, %16
%29 = load i32*, i32** %3
%30 = load i32, i32* %5
%31 = call i32 @printc(i32* %29, i32 %30)
ret void
}

LLVM IR (-O2):
define void @printl(i32* %0, i64 %1) {
%3 = icmp slt i64 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @printc(i32* %0, i32 45)
%6 = sub nsw i64 0, %1
br label %7
7: ; preds = %4, %2
%8 = phi i64 [ %6, %4 ], [ %1, %2 ]
%9 = icmp ult i64 %8, 10
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = udiv i64 %8, 10
tail call void @printl(i32* %0, i64 %11)
br label %12
12: ; preds = %10, %7
%13 = urem i64 %8, 10
%14 = trunc i64 %13 to i32
%15 = or i32 %14, 48
%16 = tail call i32 @printc(i32* %0, i32 %15)
ret void
}