#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*/ putchar(int);
void printint(int i) {
  if (i < 0) {
    putchar(45);
    i = -1 * i;
    if (i == 0) {
      putchar(0);
    } else {
      int j = 0;
      j = i % 10 + 48;
      printint(i / 10);
      putchar(j);
    }
  } else {
    if (i == 0) {
      putchar(0);
    } else {
      int j = 0;
      j = i % 10 + 48;
      printint(i / 10);
      putchar(j);
    }
  }
}


x86 assembly (clang, -O0):
<printint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1196 <printint+0x76>
mov    $0x2d,%edi
call   1030 <putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115f <printint+0x3f>
xor    %edi,%edi
call   1030 <putchar@plt>
jmp    1191 <printint+0x71>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <printint@plt>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11e3 <printint+0xc3>
cmpl   $0x0,-0x4(%rbp)
jne    11ac <printint+0x8c>
xor    %edi,%edi
call   1030 <putchar@plt>
jmp    11de <printint+0xbe>
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <printint@plt>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
jmp    11e3 <printint+0xc3>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printint>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
js     112d <printint+0xd>
jne    1139 <printint+0x19>
xor    %ebx,%ebx
jmp    1158 <printint+0x38>
mov    $0x2d,%edi
call   1030 <putchar@plt>
neg    %ebx
mov    %ebx,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
call   1040 <printint@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @printint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %24
7: ; preds = %1
%8 = call i32 @putchar(i32 45)
%9 = load i32, i32* %2
%10 = mul nsw i32 -1, %9
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 @putchar(i32 0)
br label %23
15: ; preds = %7
store i32 0, i32* %3
%16 = load i32, i32* %2
%17 = srem i32 %16, 10
%18 = add nsw i32 %17, 48
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 10
%21 = load i32, i32* %3
%22 = call i32 @putchar(i32 %21)
br label %23
23: ; preds = %15, %13
br label %38
24: ; preds = %1
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @putchar(i32 0)
br label %37
29: ; preds = %24
store i32 0, i32* %4
%30 = load i32, i32* %2
%31 = srem i32 %30, 10
%32 = add nsw i32 %31, 48
store i32 %32, i32* %4
%33 = load i32, i32* %2
%34 = sdiv i32 %33, 10
%35 = load i32, i32* %4
%36 = call i32 @putchar(i32 %35)
br label %37
37: ; preds = %29, %27
br label %38
38: ; preds = %37, %23
ret void
}

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