#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*/ putbc(int, int);
int /*<<< orphan*/ putnum_l1b(int);
void putnum_l0a(int i, int z) {
  static int l[4] = {0x7fffffff, 4, 8, 16};
  int j;
  z = l[z];
  if (i <= z) {
    while (--i)
      putbc(0x0, 0x1);
    putbc(0x1, 0x1);
    return;
  }
  j = z;
  do {
    putbc(0x0, 0x1);
  } while (--j);
  putnum_l1b(i - z);
  return;
}


x86 assembly (clang, -O0):
<putnum_l0a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
lea    0x2f07(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1184 <putnum_l0a+0x64>
jmp    1150 <putnum_l0a+0x30>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1173 <putnum_l0a+0x53>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <putbc@plt>
jmp    1150 <putnum_l0a+0x30>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <putbc@plt>
jmp    11b3 <putnum_l0a+0x93>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <putbc@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    118a <putnum_l0a+0x6a>
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1040 <putnum_l1b@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putnum_l0a>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
movslq %esi,%rax
lea    0xed0(%rip),%rcx
mov    (%rcx,%rax,4),%r14d
cmp    %edi,%r14d
jge    1160 <putnum_l0a+0x40>
mov    %r14d,%ebp
nopl   0x0(%rax)
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <putbc@plt>
add    $0xffffffff,%ebp
jne    1140 <putnum_l0a+0x20>
sub    %r14d,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <putnum_l1b@plt>
nop
add    $0xffffffff,%ebx
je     1173 <putnum_l0a+0x53>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <putbc@plt>
jmp    1160 <putnum_l0a+0x40>
mov    $0x1,%edi
mov    $0x1,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putbc@plt>

LLVM IR (-O0):
@putnum_l0a.l = internal global [4 x i32] [i32 2147483647, i32 4, i32 8, i32 16]
define void @putnum_l0a(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [4 x i32], [4 x i32]* @putnum_l0a.l, i64 0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %2
br label %14
14: ; preds = %18, %13
%15 = load i32, i32* %3
%16 = add nsw i32 %15, -1
store i32 %16, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @putbc(i32 0, i32 1)
br label %14
20: ; preds = %14
%21 = call i32 @putbc(i32 1, i32 1)
br label %35
22: ; preds = %2
%23 = load i32, i32* %4
store i32 %23, i32* %5
br label %24
24: ; preds = %26, %22
%25 = call i32 @putbc(i32 0, i32 1)
br label %26
26: ; preds = %24
%27 = load i32, i32* %5
%28 = add nsw i32 %27, -1
store i32 %28, i32* %5
%29 = icmp ne i32 %28, 0
br i1 %29, label %24, label %30
30: ; preds = %26
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = sub nsw i32 %31, %32
%34 = call i32 @putnum_l1b(i32 %33)
br label %35
35: ; preds = %30, %20
ret void
}

LLVM IR (-O2):
@putnum_l0a.l = internal unnamed_addr constant [4 x i32] [i32 2147483647, i32 4, i32 8, i32 16]
define void @putnum_l0a(i32 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds [4 x i32], [4 x i32]* @putnum_l0a.l, i64 0, i64 %3
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, %0
br i1 %6, label %17, label %7
7: ; preds = %2
%8 = add nsw i32 %0, -1
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7, %10
%11 = phi i32 [ %13, %10 ], [ %8, %7 ]
%12 = tail call i32 @putbc(i32 0, i32 1)
%13 = add nsw i32 %11, -1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %10
15: ; preds = %10, %7
%16 = tail call i32 @putbc(i32 1, i32 1)
br label %25
17: ; preds = %2, %17
%18 = phi i32 [ %20, %17 ], [ %5, %2 ]
%19 = tail call i32 @putbc(i32 0, i32 1)
%20 = add nsw i32 %18, -1
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %17
22: ; preds = %17
%23 = sub nsw i32 %0, %5
%24 = tail call i32 @putnum_l1b(i32 %23)
br label %25
25: ; preds = %22, %15
ret void
}