#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*/ my_putchar(int);
int my_put_nbr(int nb) {
  int i;
  i = 0;
  if (nb == -2147483648) {
    nb++;
    i = 1;
  }
  if (nb < 0) {
    my_putchar('-');
    nb *= -1;
  }
  if (nb >= 10) {
    my_put_nbr(nb / 10);
  }
  if (i == 1)
    my_putchar(nb % 10 + '1');
  else
    my_putchar(nb % 10 + '0');
  return (0);
}


x86 assembly (clang, -O0):
<my_put_nbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    1152 <my_put_nbr+0x32>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    116d <my_put_nbr+0x4d>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     1189 <my_put_nbr+0x69>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <my_put_nbr@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11ad <my_put_nbr+0x8d>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x31,%edi
call   1040 <my_putchar@plt>
jmp    11c2 <my_put_nbr+0xa2>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_nbr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
cmp    $0x80000000,%edi
mov    $0x80000001,%ebx
cmovne %edi,%ebx
test   %ebx,%ebx
jns    1145 <my_put_nbr+0x25>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
neg    %ebx
mov    %ebx,%ebp
cmp    $0xa,%ebx
jb     115e <my_put_nbr+0x3e>
mov    $0xcccccccd,%edi
imul   %rbp,%rdi
shr    $0x23,%rdi
call   1030 <my_put_nbr@plt>
mov    $0xcccccccd,%eax
imul   %rbp,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %ebx,%ecx
sub    %eax,%ecx
or     $0x30,%ecx
neg    %eax
cmp    $0x80000000,%r14d
lea    0x31(%rbx,%rax,1),%edi
cmovne %ecx,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @my_put_nbr(i32 %0) {
%2 = icmp eq i32 %0, -2147483648
%3 = select i1 %2, i32 -2147483647, i32 %0
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @my_putchar(i32 45)
%7 = sub nsw i32 0, %3
br label %8
8: ; preds = %5, %1
%9 = phi i32 [ %7, %5 ], [ %3, %1 ]
%10 = icmp ugt i32 %9, 9
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = udiv i32 %9, 10
%13 = tail call i32 @my_put_nbr(i32 %12)
br label %14
14: ; preds = %11, %8
%15 = urem i32 %9, 10
%16 = or i32 %15, 48
%17 = add nuw nsw i32 %15, 49
%18 = select i1 %2, i32 %17, i32 %16
%19 = tail call i32 @my_putchar(i32 %18)
ret i32 0
}