#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_putnbr(int nb) {
  int nombre;
  if (nb >= 0) {
    nb = -nb;
  } else
    my_putchar('-');
  nombre = 1;
  while (nb / nombre < -9)
    nombre = nombre * 10;
  while (nombre != 0) {
    my_putchar('0' - nb / nombre % 10);
    nb = nb % nombre;
    nombre = nombre / 10;
  }
  return (0);
}


x86 assembly (clang, -O0):
<my_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1132 <my_putnbr+0x22>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113c <my_putnbr+0x2c>
mov    $0x2d,%edi
call   1030 <my_putchar@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0xfffffff7,%eax
jge    115f <my_putnbr+0x4f>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1143 <my_putnbr+0x33>
jmp    1164 <my_putnbr+0x54>
cmpl   $0x0,-0x8(%rbp)
je     11a6 <my_putnbr+0x96>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0x30,%edi
sub    %edx,%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    1164 <my_putnbr+0x54>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putnbr>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
test   %edi,%edi
js     111d <my_putnbr+0xd>
neg    %ebp
jmp    1127 <my_putnbr+0x17>
mov    $0x2d,%edi
call   1030 <my_putchar@plt>
mov    $0x1,%ebx
cmp    $0xfffffff6,%ebp
jg     1150 <my_putnbr+0x40>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %ebp,%eax
cltd
idiv   %ebx
cmp    $0xfffffff7,%eax
jl     1140 <my_putnbr+0x30>
nop
mov    %ebp,%eax
cltd
idiv   %ebx
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%edi
sub    %eax,%edi
add    $0x30,%edi
mov    %edx,%ebp
call   1030 <my_putchar@plt>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rbx
add    %ecx,%ebx
add    $0x9,%eax
cmp    $0x12,%eax
ja     1150 <my_putnbr+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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