#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, unsigned int);
void lzcmp_putnum1(int i) {
  if (i <= 4 - 1)
    putbc(i - 1 + 1, 0x2);
  else if (i <= 19 - 1)
    putbc(i - 4 + 1, 0x20);
  else if (i <= 274 - 1)
    putbc(i - 19 + 1, 0x2000);
  else if (i <= 65535)
    putbc(i, 0x20000000);
  else {
    unsigned int limit = 0xffff, mask = 0x4000, lenlen = 15;
    do {
      limit = limit * 2 + 1;
      mask <<= 1;
      lenlen++;
    } while (i > limit);
    putbc(lenlen, 0x20000000);
    putbc(i, mask);
  }
  return;
}


x86 assembly (clang, -O0):
<lzcmp_putnum1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jg     113d <lzcmp_putnum1+0x2d>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
add    $0x1,%edi
mov    $0x2,%esi
call   1030 <putbc@plt>
jmp    1209 <lzcmp_putnum1+0xf9>
cmpl   $0x12,-0x4(%rbp)
jg     115f <lzcmp_putnum1+0x4f>
mov    -0x4(%rbp),%edi
sub    $0x4,%edi
add    $0x1,%edi
mov    $0x20,%esi
call   1030 <putbc@plt>
jmp    1204 <lzcmp_putnum1+0xf4>
cmpl   $0x111,-0x4(%rbp)
jg     1184 <lzcmp_putnum1+0x74>
mov    -0x4(%rbp),%edi
sub    $0x13,%edi
add    $0x1,%edi
mov    $0x2000,%esi
call   1030 <putbc@plt>
jmp    11ff <lzcmp_putnum1+0xef>
cmpl   $0xffff,-0x4(%rbp)
jg     11a3 <lzcmp_putnum1+0x93>
mov    -0x4(%rbp),%edi
mov    $0x20000000,%esi
call   1030 <putbc@plt>
jmp    11fa <lzcmp_putnum1+0xea>
movl   $0xffff,-0x8(%rbp)
movl   $0x4000,-0xc(%rbp)
movl   $0xf,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     11b8 <lzcmp_putnum1+0xa8>
mov    -0x10(%rbp),%edi
mov    $0x20000000,%esi
call   1030 <putbc@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <putbc@plt>
jmp    11ff <lzcmp_putnum1+0xef>
jmp    1204 <lzcmp_putnum1+0xf4>
jmp    1209 <lzcmp_putnum1+0xf9>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lzcmp_putnum1>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x3,%edi
jg     1123 <lzcmp_putnum1+0x13>
mov    %ebx,%edi
mov    $0x2,%esi
jmp    118c <lzcmp_putnum1+0x7c>
cmp    $0x12,%ebx
ja     1134 <lzcmp_putnum1+0x24>
add    $0xfffffffd,%ebx
mov    %ebx,%edi
mov    $0x20,%esi
jmp    118c <lzcmp_putnum1+0x7c>
cmp    $0x111,%ebx
ja     1148 <lzcmp_putnum1+0x38>
add    $0xffffffee,%ebx
mov    %ebx,%edi
mov    $0x2000,%esi
jmp    118c <lzcmp_putnum1+0x7c>
cmp    $0x10000,%ebx
jae    1159 <lzcmp_putnum1+0x49>
mov    %ebx,%edi
mov    $0x20000000,%esi
jmp    118c <lzcmp_putnum1+0x7c>
mov    $0xf,%edi
mov    $0x4000,%ebp
mov    $0xffff,%eax
nopl   0x0(%rax,%rax,1)
add    %eax,%eax
add    $0x1,%eax
add    %ebp,%ebp
add    $0x1,%edi
cmp    %ebx,%eax
jb     1170 <lzcmp_putnum1+0x60>
mov    $0x20000000,%esi
call   1030 <putbc@plt>
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putbc@plt>

LLVM IR (-O0):
define void @lzcmp_putnum1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 3
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 1
%11 = add nsw i32 %10, 1
%12 = call i32 @putbc(i32 %11, i32 2)
br label %57
13: ; preds = %1
%14 = load i32, i32* %2
%15 = icmp sle i32 %14, 18
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 4
%19 = add nsw i32 %18, 1
%20 = call i32 @putbc(i32 %19, i32 32)
br label %56
21: ; preds = %13
%22 = load i32, i32* %2
%23 = icmp sle i32 %22, 273
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 19
%27 = add nsw i32 %26, 1
%28 = call i32 @putbc(i32 %27, i32 8192)
br label %55
29: ; preds = %21
%30 = load i32, i32* %2
%31 = icmp sle i32 %30, 65535
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %2
%34 = call i32 @putbc(i32 %33, i32 536870912)
br label %54
35: ; preds = %29
store i32 65535, i32* %3
store i32 16384, i32* %4
store i32 15, i32* %5
br label %36
36: ; preds = %44, %35
%37 = load i32, i32* %3
%38 = mul i32 %37, 2
%39 = add i32 %38, 1
store i32 %39, i32* %3
%40 = load i32, i32* %4
%41 = shl i32 %40, 1
store i32 %41, i32* %4
%42 = load i32, i32* %5
%43 = add i32 %42, 1
store i32 %43, i32* %5
br label %44
44: ; preds = %36
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = icmp ugt i32 %45, %46
br i1 %47, label %36, label %48
48: ; preds = %44
%49 = load i32, i32* %5
%50 = call i32 @putbc(i32 %49, i32 536870912)
%51 = load i32, i32* %2
%52 = load i32, i32* %4
%53 = call i32 @putbc(i32 %51, i32 %52)
br label %54
54: ; preds = %48, %32
br label %55
55: ; preds = %54, %24
br label %56
56: ; preds = %55, %16
br label %57
57: ; preds = %56, %8
ret void
}

LLVM IR (-O2):
define void @lzcmp_putnum1(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @putbc(i32 %0, i32 2)
br label %31
5: ; preds = %1
%6 = icmp ult i32 %0, 19
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = add nsw i32 %0, -3
%9 = tail call i32 @putbc(i32 %8, i32 32)
br label %31
10: ; preds = %5
%11 = icmp ult i32 %0, 274
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = add nsw i32 %0, -18
%14 = tail call i32 @putbc(i32 %13, i32 8192)
br label %31
15: ; preds = %10
%16 = icmp ult i32 %0, 65536
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = tail call i32 @putbc(i32 %0, i32 536870912)
br label %31
19: ; preds = %15, %19
%20 = phi i32 [ %24, %19 ], [ 65535, %15 ]
%21 = phi i32 [ %25, %19 ], [ 16384, %15 ]
%22 = phi i32 [ %26, %19 ], [ 15, %15 ]
%23 = shl i32 %20, 1
%24 = or i32 %23, 1
%25 = shl i32 %21, 1
%26 = add i32 %22, 1
%27 = icmp ult i32 %24, %0
br i1 %27, label %19, label %28
28: ; preds = %19
%29 = tail call i32 @putbc(i32 %26, i32 536870912)
%30 = tail call i32 @putbc(i32 %0, i32 %25)
br label %31
31: ; preds = %7, %17, %28, %12, %3
ret void
}