#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);
void my_put_nbr(int nb) {
  int div;
  int rest;
  rest = nb % 10;
  div = nb / 10;
  if (div > -10 && div < 0)
    my_putchar('-');
  if (nb >= 10 || nb <= -10)
    my_put_nbr(div);
  if (rest < 0)
    rest = -rest;
  my_putchar(rest + 48);
}


x86 assembly (clang, -O0):
<my_put_nbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0xfffffff6,-0x8(%rbp)
jle    1165 <my_put_nbr+0x45>
cmpl   $0x0,-0x8(%rbp)
jge    1165 <my_put_nbr+0x45>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
cmpl   $0xa,-0x4(%rbp)
jge    1179 <my_put_nbr+0x59>
cmpl   $0xfffffff6,-0x4(%rbp)
jg     1181 <my_put_nbr+0x61>
mov    -0x8(%rbp),%edi
call   1030 <my_put_nbr@plt>
cmpl   $0x0,-0xc(%rbp)
jge    1193 <my_put_nbr+0x73>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x30,%edi
call   1040 <my_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_nbr>:
push   %rbp
push   %rbx
push   %rax
movslq %edi,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rbx
add    %ecx,%ebx
lea    (%rbx,%rbx,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%ebp
sub    %ecx,%ebp
add    $0x63,%eax
cmp    $0x59,%eax
ja     1158 <my_put_nbr+0x38>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
jmp    1160 <my_put_nbr+0x40>
add    $0xfffffff6,%edi
cmp    $0xffffffec,%edi
ja     1167 <my_put_nbr+0x47>
mov    %ebx,%edi
call   1030 <my_put_nbr@plt>
mov    %ebp,%edi
neg    %edi
cmovs  %ebp,%edi
add    $0x30,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <my_putchar@plt>

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

LLVM IR (-O2):
define void @my_put_nbr(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = srem i32 %0, 10
%4 = add i32 %0, 99
%5 = icmp ult i32 %4, 90
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @my_putchar(i32 45)
br label %11
8: ; preds = %1
%9 = add i32 %0, -10
%10 = icmp ult i32 %9, -19
br i1 %10, label %11, label %12
11: ; preds = %6, %8
tail call void @my_put_nbr(i32 %2)
br label %12
12: ; preds = %8, %11
%13 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
%14 = add nuw nsw i32 %13, 48
%15 = tail call i32 @my_putchar(i32 %14)
ret void
}