#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(long);
void my_put_nbr(int n) {
  char tmp;
  long long_n;
  long_n = n;
  if (long_n < 0) {
    my_putchar('-');
    long_n *= -1;
  }
  if (long_n >= 10) {
    tmp = (long_n % 10);
    long_n = (long_n - tmp) / 10;
    my_put_nbr(long_n);
    my_putchar(tmp + '0');
  } else
    my_putchar(long_n + '0');
}


x86 assembly (clang, -O0):
<my_put_nbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1151 <my_put_nbr+0x31>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
imul   $0xffffffffffffffff,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0xa,-0x10(%rbp)
jl     11a8 <my_put_nbr+0x88>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %dl,%al
mov    %al,-0x5(%rbp)
mov    -0x10(%rbp),%rax
movsbq -0x5(%rbp),%rcx
sub    %rcx,%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1030 <my_put_nbr@plt>
movsbl -0x5(%rbp),%eax
add    $0x30,%eax
movslq %eax,%rdi
call   1040 <my_putchar@plt>
jmp    11b5 <my_put_nbr+0x95>
mov    -0x10(%rbp),%rdi
add    $0x30,%rdi
call   1040 <my_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_nbr>:
push   %rbx
movslq %edi,%rbx
test   %ebx,%ebx
js     114f <my_put_nbr+0x2f>
cmp    $0x9,%rbx
jle    1162 <my_put_nbr+0x42>
mov    %ebx,%eax
mov    $0xcccccccd,%edi
imul   %rax,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
call   1030 <my_put_nbr@plt>
or     $0x30,%ebx
jmp    1166 <my_put_nbr+0x46>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
neg    %rbx
cmp    $0x9,%rbx
jg     112e <my_put_nbr+0xe>
add    $0x30,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <my_putchar@plt>

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

LLVM IR (-O2):
define void @my_put_nbr(i32 %0) {
%2 = sext i32 %0 to i64
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @my_putchar(i64 45)
%6 = sub nsw i64 0, %2
br label %7
7: ; preds = %4, %1
%8 = phi i64 [ %6, %4 ], [ %2, %1 ]
%9 = icmp sgt i64 %8, 9
br i1 %9, label %13, label %19
10: ; preds = %19, %13
%11 = phi i64 [ %20, %19 ], [ %18, %13 ]
%12 = tail call i32 @my_putchar(i64 %11)
ret void
13: ; preds = %7
%14 = trunc i64 %8 to i32
%15 = urem i32 %14, 10
%16 = udiv i32 %14, 10
tail call void @my_put_nbr(i32 %16)
%17 = or i32 %15, 48
%18 = zext i32 %17 to i64
br label %10
19: ; preds = %7
%20 = add nsw i64 %8, 48
br label %10
}