#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 */
typedef int /*<<< orphan*/ pid_t;
typedef int off_t;

/* Variables and functions */
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void ft_putnbr_off_t(off_t n, pid_t pid) {
  off_t decim;
  char c;
  decim = 1;
  while ((n / decim) > 9)
    decim *= 10;
  while (decim > 0) {
    c = (n / decim) % 10 + '0';
    write(pid, &c, 1);
    decim /= 10;
  }
}


x86 assembly (clang, -O0):
<ft_putnbr_off_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x9,%eax
jle    1141 <ft_putnbr_off_t+0x31>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <ft_putnbr_off_t+0x15>
jmp    1146 <ft_putnbr_off_t+0x36>
cmpl   $0x0,-0xc(%rbp)
jle    118b <ft_putnbr_off_t+0x7b>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xd(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1146 <ft_putnbr_off_t+0x36>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_off_t>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r15d
mov    %edi,%ebp
mov    $0x1,%ebx
cmp    $0xa,%edi
jl     113f <ft_putnbr_off_t+0x2f>
mov    $0x1,%ebx
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %ebp,%eax
cltd
idiv   %ebx
cmp    $0x9,%eax
jg     1130 <ft_putnbr_off_t+0x20>
lea    0xf(%rsp),%r14
mov    $0xcccccccd,%r12d
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
cltd
idiv   %ebx
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0xf(%rsp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebx,%eax
imul   %r12,%rax
shr    $0x23,%rax
cmp    $0x9,%ebx
mov    %eax,%ebx
ja     1150 <ft_putnbr_off_t+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ft_putnbr_off_t(i32 %0, i32 %1) {
%3 = alloca i8
%4 = icmp sgt i32 %0, 9
br i1 %4, label %5, label %10
5: ; preds = %2, %5
%6 = phi i32 [ %7, %5 ], [ 1, %2 ]
%7 = mul nuw nsw i32 %6, 10
%8 = sdiv i32 %0, %7
%9 = icmp sgt i32 %8, 9
br i1 %9, label %5, label %10
10: ; preds = %5, %2
%11 = phi i32 [ 1, %2 ], [ %7, %5 ]
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ %19, %12 ], [ %11, %10 ]
%14 = sdiv i32 %0, %13
%15 = srem i32 %14, 10
%16 = trunc i32 %15 to i8
%17 = add nsw i8 %16, 48
store i8 %17, i8* %3
%18 = call i32 @write(i32 %1, i8* %3, i32 1)
%19 = udiv i32 %13, 10
%20 = icmp ult i32 %13, 10
br i1 %20, label %21, label %12
21: ; preds = %12
ret void
}