#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 n) {
  int cociente;
  int resto;
  if (n < 0) {
    putChar('-');
    n = n * (-1);
  }
  if (n < 10) {
    putChar(n + '0');
    return;
  }
  do {
    cociente = n / 10;
    resto = n % 10;
    n = cociente;
    putChar(resto + '0');
  } while (n != 0);
  return;
}


x86 assembly (clang, -O0):
<printInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1136 <printInt+0x26>
mov    $0x2d,%edi
call   1030 <putChar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1150 <printInt+0x40>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <putChar@plt>
jmp    1191 <printInt+0x81>
jmp    1155 <printInt+0x45>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%edi
add    $0x30,%edi
call   1030 <putChar@plt>
cmpl   $0x0,-0x4(%rbp)
jne    1155 <printInt+0x45>
jmp    1191 <printInt+0x81>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printInt>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
js     1121 <printInt+0x11>
cmp    $0xa,%ebx
jae    1150 <printInt+0x40>
jmp    1132 <printInt+0x22>
mov    $0x2d,%edi
call   1030 <putChar@plt>
neg    %ebx
cmp    $0xa,%ebx
jae    1150 <printInt+0x40>
add    $0x30,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putChar@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ebx,%r14
imul   $0x66666667,%r14,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
neg    %eax
lea    (%r14,%rax,1),%edi
add    $0x30,%edi
call   1030 <putChar@plt>
add    $0x9,%r14d
cmp    $0x12,%r14d
ja     1150 <printInt+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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 %11
7: ; preds = %1
%8 = call i32 @putChar(i32 45)
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, -1
store i32 %10, i32* %2
br label %11
11: ; preds = %7, %1
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 48
%17 = call i32 @putChar(i32 %16)
br label %32
18: ; preds = %11
br label %19
19: ; preds = %28, %18
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10
store i32 %21, i32* %3
%22 = load i32, i32* %2
%23 = srem i32 %22, 10
store i32 %23, i32* %4
%24 = load i32, i32* %3
store i32 %24, i32* %2
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 48
%27 = call i32 @putChar(i32 %26)
br label %28
28: ; preds = %19
%29 = load i32, i32* %2
%30 = icmp ne i32 %29, 0
br i1 %30, label %19, label %31
31: ; preds = %28
br label %32
32: ; preds = %31, %14
ret void
}

LLVM IR (-O2):
define void @printInt(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @putChar(i32 45)
%5 = sub nsw i32 0, %0
br label %6
6: ; preds = %3, %1
%7 = phi i32 [ %5, %3 ], [ %0, %1 ]
%8 = icmp ult i32 %7, 10
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = add nuw nsw i32 %7, 48
%11 = tail call i32 @putChar(i32 %10)
br label %20
12: ; preds = %6, %12
%13 = phi i32 [ %14, %12 ], [ %7, %6 ]
%14 = sdiv i32 %13, 10
%15 = srem i32 %13, 10
%16 = add nsw i32 %15, 48
%17 = tail call i32 @putChar(i32 %16)
%18 = add i32 %13, 9
%19 = icmp ult i32 %18, 19
br i1 %19, label %20, label %12
20: ; preds = %12, %9
ret void
}