#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*/ info_putchar(char);
void info_decimal(int d) {
  if (d < 0) {
    info_putchar('-');
    d = -d;
  }
  char stack[12];
  char *s = stack;
  while (d) {
    *s++ = '0' + d % 10;
    d /= 10;
  }
  if (s == stack)
    info_putchar('0');
  else
    while (s > stack)
      info_putchar(*--s);
}


x86 assembly (clang, -O0):
<info_decimal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1137 <info_decimal+0x27>
mov    $0x2d,%edi
call   1030 <info_putchar@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     117d <info_decimal+0x6d>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    113f <info_decimal+0x2f>
mov    -0x18(%rbp),%rax
lea    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jne    119d <info_decimal+0x8d>
mov    $0x30,%edi
call   1030 <info_putchar@plt>
jmp    11d5 <info_decimal+0xc5>
jmp    11a2 <info_decimal+0x92>
mov    -0x18(%rbp),%rax
lea    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jbe    11d0 <info_decimal+0xc0>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
movsbl -0x1(%rax),%edi
call   1030 <info_putchar@plt>
jmp    11a2 <info_decimal+0x92>
jmp    11d5 <info_decimal+0xc5>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<info_decimal>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
test   %edi,%edi
js     1121 <info_decimal+0x11>
jne    112d <info_decimal+0x1d>
jmp    1194 <info_decimal+0x84>
mov    $0x2d,%edi
call   1030 <info_putchar@plt>
neg    %ebx
xor    %eax,%eax
nop
movslq %ebx,%rcx
imul   $0x66666667,%rcx,%rbx
mov    %rbx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rbx
add    %edx,%ebx
lea    (%rbx,%rbx,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    $0x30,%sil
mov    %sil,0xc(%rsp,%rax,1)
add    $0x9,%ecx
add    $0x1,%rax
cmp    $0x12,%ecx
ja     1130 <info_decimal+0x20>
test   %rax,%rax
je     1194 <info_decimal+0x84>
lea    (%rsp,%rax,1),%rbx
add    $0xc,%rbx
lea    0xc(%rsp),%r14
cmp    %r14,%rbx
jbe    119e <info_decimal+0x8e>
nopl   (%rax)
movsbl -0x1(%rbx),%edi
add    $0xffffffffffffffff,%rbx
call   1030 <info_putchar@plt>
cmp    %r14,%rbx
ja     1180 <info_decimal+0x70>
jmp    119e <info_decimal+0x8e>
mov    $0x30,%edi
call   1030 <info_putchar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @info_decimal(i32 %0) {
%2 = alloca i32
%3 = alloca [12 x i8]
%4 = alloca i8*
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 @info_putchar(i8 signext 45)
%9 = load i32, i32* %2
%10 = sub nsw i32 0, %9
store i32 %10, i32* %2
br label %11
11: ; preds = %7, %1
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
store i8* %12, i8** %4
br label %13
13: ; preds = %16, %11
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* %2
%18 = srem i32 %17, 10
%19 = add nsw i32 48, %18
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
store i8 %20, i8* %21
%23 = load i32, i32* %2
%24 = sdiv i32 %23, 10
store i32 %24, i32* %2
br label %13
25: ; preds = %13
%26 = load i8*, i8** %4
%27 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%28 = icmp eq i8* %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @info_putchar(i8 signext 48)
br label %42
31: ; preds = %25
br label %32
32: ; preds = %36, %31
%33 = load i8*, i8** %4
%34 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%35 = icmp ugt i8* %33, %34
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i32 -1
store i8* %38, i8** %4
%39 = load i8, i8* %38
%40 = call i32 @info_putchar(i8 signext %39)
br label %32
41: ; preds = %32
br label %42
42: ; preds = %41, %29
ret void
}

LLVM IR (-O2):
define void @info_decimal(i32 %0) {
%2 = alloca [12 x i8]
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @info_putchar(i8 signext 45)
%6 = sub nsw i32 0, %0
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
br label %11
8: ; preds = %1
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%10 = icmp eq i32 %0, 0
br i1 %10, label %28, label %11
11: ; preds = %4, %8
%12 = phi i32 [ %6, %4 ], [ %0, %8 ]
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
br label %14
14: ; preds = %11, %14
%15 = phi i8* [ %20, %14 ], [ %13, %11 ]
%16 = phi i32 [ %21, %14 ], [ %12, %11 ]
%17 = srem i32 %16, 10
%18 = trunc i32 %17 to i8
%19 = add nsw i8 %18, 48
%20 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %19, i8* %15
%21 = sdiv i32 %16, 10
%22 = add i32 %16, 9
%23 = icmp ult i32 %22, 19
br i1 %23, label %24, label %14
24: ; preds = %14
%25 = icmp eq i8* %20, %13
br i1 %25, label %28, label %26
26: ; preds = %24
%27 = icmp ugt i8* %20, %13
br i1 %27, label %30, label %36
28: ; preds = %8, %24
%29 = call i32 @info_putchar(i8 signext 48)
br label %36
30: ; preds = %26, %30
%31 = phi i8* [ %32, %30 ], [ %20, %26 ]
%32 = getelementptr inbounds i8, i8* %31, i64 -1
%33 = load i8, i8* %32
%34 = call i32 @info_putchar(i8 signext %33)
%35 = icmp ugt i8* %32, %13
br i1 %35, label %30, label %36
36: ; preds = %30, %26, %28
%37 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
ret void
}