#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*/ print_char_console(unsigned char);
void print_int_console(int my_int) {
  int digits[30];
  int index = 0;
  if (my_int < 0) {
    print_char_console('-');
    my_int *= -1;
  }
  if (my_int < 0) {
    return;
  }
  if (my_int == 0) {
    print_char_console('0');
    return;
  }
  while ((my_int > 0) && (index < 30)) {
    digits[index++] = my_int % 10;
    my_int /= 10;
  }
  while (--index >= 0) {
    print_char_console(((unsigned char)digits[index]) + '0');
  }
}


x86 assembly (clang, -O0):
<print_int_console>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1143 <print_int_console+0x33>
mov    $0x2d,%edi
call   1030 <print_char_console@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1152 <print_int_console+0x42>
jmp    1215 <print_int_console+0x105>
cmpl   $0x0,-0x4(%rbp)
jne    116b <print_int_console+0x5b>
mov    $0x30,%edi
call   1030 <print_char_console@plt>
jmp    1215 <print_int_console+0x105>
jmp    1170 <print_int_console+0x60>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x85(%rbp)
jle    1192 <print_int_console+0x82>
cmpl   $0x1e,-0x84(%rbp)
setl   %al
mov    %al,-0x85(%rbp)
mov    -0x85(%rbp),%al
test   $0x1,%al
jne    11a5 <print_int_console+0x95>
jmp    11da <print_int_console+0xca>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x84(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x84(%rbp)
cltq
mov    %edx,-0x80(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1170 <print_int_console+0x60>
jmp    11df <print_int_console+0xcf>
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
cmp    $0x0,%eax
jl     1215 <print_int_console+0x105>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%eax
movzbl %al,%eax
add    $0x30,%eax
movzbl %al,%edi
call   1030 <print_char_console@plt>
jmp    11df <print_int_console+0xcf>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_console>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %edi,%ebx
test   %edi,%edi
js     1130 <print_int_console+0x20>
jne    113c <print_int_console+0x2c>
mov    $0x30,%edi
add    $0x78,%rsp
pop    %rbx
pop    %r14
jmp    1030 <print_char_console@plt>
mov    $0x2d,%edi
call   1030 <print_char_console@plt>
neg    %ebx
xor    %eax,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edx
lea    0x1(%rax),%r14
mov    %ebx,%ebx
imul   %rcx,%rbx
shr    $0x23,%rbx
lea    (%rbx,%rbx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %edi,(%rsp,%rax,4)
cmp    $0xa,%edx
jb     117b <print_int_console+0x6b>
cmp    $0x1d,%rax
mov    %r14,%rax
jb     1150 <print_int_console+0x40>
add    $0x1,%r14
nop
movzbl -0x8(%rsp,%r14,4),%eax
add    $0x30,%al
movzbl %al,%edi
call   1030 <print_char_console@plt>
add    $0xffffffffffffffff,%r14
cmp    $0x1,%r14
ja     1180 <print_int_console+0x70>
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @print_int_console(i32 %0) {
%2 = alloca i32
%3 = alloca [30 x i32]
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = call i32 @print_char_console(i8 zeroext 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, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %53
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @print_char_console(i8 zeroext 48)
br label %53
20: ; preds = %15
br label %21
21: ; preds = %29, %20
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 30
br label %27
27: ; preds = %24, %21
%28 = phi i1 [ false, %21 ], [ %26, %24 ]
br i1 %28, label %29, label %38
29: ; preds = %27
%30 = load i32, i32* %2
%31 = srem i32 %30, 10
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %34
store i32 %31, i32* %35
%36 = load i32, i32* %2
%37 = sdiv i32 %36, 10
store i32 %37, i32* %2
br label %21
38: ; preds = %27
br label %39
39: ; preds = %43, %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
%42 = icmp sge i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [30 x i32], [30 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = trunc i32 %47 to i8
%49 = zext i8 %48 to i32
%50 = add nsw i32 %49, 48
%51 = trunc i32 %50 to i8
%52 = call i32 @print_char_console(i8 zeroext %51)
br label %39
53: ; preds = %14, %18, %39
ret void
}

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