#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 /*<<< orphan*/ my_putstr(char *);
void my_put_nbr(int n) {
  if (n == -2147483648) {
    my_putstr("-2147483648");
  } else {
    if (n < 0) {
      n = -n;
      my_putchar('-');
    }
    if (n < 10)
      my_putchar(n + 48);
    else {
      my_put_nbr(n / 10);
      my_put_nbr(n % 10);
    }
  }
}


x86 assembly (clang, -O0):
<my_put_nbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0xffffffff80000000,%rax
jne    115c <my_put_nbr+0x2c>
lea    0xeae(%rip),%rdi
call   1050 <my_putstr@plt>
jmp    11bb <my_put_nbr+0x8b>
cmpl   $0x0,-0x4(%rbp)
jge    1178 <my_put_nbr+0x48>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
cmpl   $0xa,-0x4(%rbp)
jge    1192 <my_put_nbr+0x62>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1040 <my_putchar@plt>
jmp    11b6 <my_put_nbr+0x86>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <my_put_nbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <my_put_nbr@plt>
jmp    11bb <my_put_nbr+0x8b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_nbr>:
cmp    $0x80000000,%edi
jne    1144 <my_put_nbr+0x14>
lea    0xec1(%rip),%rdi
jmp    1050 <my_putstr@plt>
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0xcccccccd,%r14d
test   %ebp,%ebp
jns    116c <my_put_nbr+0x3c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
neg    %ebp
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
cmp    $0x9,%ebp
jbe    118f <my_put_nbr+0x5f>
mov    %ebp,%ebx
imul   %r14,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1030 <my_put_nbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
test   %ebp,%ebp
jns    116c <my_put_nbr+0x3c>
jmp    1160 <my_put_nbr+0x30>
add    $0x30,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <my_putchar@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"-2147483648\00"
define void @my_put_nbr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = icmp eq i64 %4, -2147483648
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @my_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %28
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 0, %12
store i32 %13, i32* %2
%14 = call i32 @my_putchar(i32 45)
br label %15
15: ; preds = %11, %8
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 48
%21 = call i32 @my_putchar(i32 %20)
br label %27
22: ; preds = %15
%23 = load i32, i32* %2
%24 = sdiv i32 %23, 10
%25 = load i32, i32* %2
%26 = srem i32 %25, 10
br label %27
27: ; preds = %22, %18
br label %28
28: ; preds = %27, %6
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"-2147483648\00"
define void @my_put_nbr(i32 %0) {
%2 = icmp eq i32 %0, -2147483648
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @my_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %20
5: ; preds = %1, %17
%6 = phi i32 [ %19, %17 ], [ %0, %1 ]
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = sub nsw i32 0, %6
%10 = tail call i32 @my_putchar(i32 45)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ %9, %8 ], [ %6, %5 ]
%13 = icmp ult i32 %12, 10
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = add nuw nsw i32 %12, 48
%16 = tail call i32 @my_putchar(i32 %15)
br label %20
17: ; preds = %11
%18 = udiv i32 %12, 10
tail call void @my_put_nbr(i32 %18)
%19 = urem i32 %12, 10
br label %5
20: ; preds = %14, %3
ret void
}