#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 puissance;
  if (nb < 0) {
    my_putchar('-');
    nb = nb * -1;
  }
  puissance = 1;
  while ((nb / puissance) > 9)
    puissance = puissance * 10;
  while (puissance > 1) {
    my_putchar(nb / puissance + '0');
    nb = nb % puissance;
    puissance = puissance / 10;
  }
  my_putchar(nb % 10 + '0');
}


x86 assembly (clang, -O0):
<my_put_nbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1136 <my_put_nbr+0x26>
mov    $0x2d,%edi
call   1030 <my_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x9,%eax
jle    1159 <my_put_nbr+0x49>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    113d <my_put_nbr+0x2d>
jmp    115e <my_put_nbr+0x4e>
cmpl   $0x1,-0x8(%rbp)
jle    1196 <my_put_nbr+0x86>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%edi
add    $0x30,%edi
call   1030 <my_putchar@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    115e <my_put_nbr+0x4e>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <my_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_nbr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
test   %edi,%edi
js     1121 <my_put_nbr+0x11>
cmp    $0xa,%ebp
jae    1132 <my_put_nbr+0x22>
jmp    1180 <my_put_nbr+0x70>
mov    $0x2d,%edi
call   1030 <my_putchar@plt>
neg    %ebp
cmp    $0xa,%ebp
jb     1180 <my_put_nbr+0x70>
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %ebp,%eax
cltd
idiv   %ebx
cmp    $0x9,%eax
jg     1140 <my_put_nbr+0x30>
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%eax
cltd
idiv   %ebx
lea    0x30(%rax),%edi
mov    %edx,%ebp
call   1030 <my_putchar@plt>
mov    %ebx,%eax
imul   %r14,%rax
shr    $0x23,%rax
cmp    $0x13,%ebx
mov    %eax,%ebx
ja     1160 <my_put_nbr+0x50>
movslq %ebp,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x30,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <my_putchar@plt>

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

LLVM IR (-O2):
define void @my_put_nbr(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @my_putchar(i32 45)
%5 = sub nsw i32 0, %0
br label %6
6: ; preds = %3, %1
%7 = phi i32 [ %5, %3 ], [ %0, %1 ]
%8 = icmp ugt i32 %7, 9
br i1 %8, label %9, label %23
9: ; preds = %6, %9
%10 = phi i32 [ %11, %9 ], [ 1, %6 ]
%11 = mul nuw nsw i32 %10, 10
%12 = sdiv i32 %7, %11
%13 = icmp sgt i32 %12, 9
br i1 %13, label %9, label %14
14: ; preds = %9, %14
%15 = phi i32 [ %21, %14 ], [ %11, %9 ]
%16 = phi i32 [ %20, %14 ], [ %7, %9 ]
%17 = sdiv i32 %16, %15
%18 = add nsw i32 %17, 48
%19 = tail call i32 @my_putchar(i32 %18)
%20 = srem i32 %16, %15
%21 = udiv i32 %15, 10
%22 = icmp ugt i32 %15, 19
br i1 %22, label %14, label %23
23: ; preds = %14, %6
%24 = phi i32 [ %7, %6 ], [ %20, %14 ]
%25 = srem i32 %24, 10
%26 = add nsw i32 %25, 48
%27 = tail call i32 @my_putchar(i32 %26)
ret void
}