#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*/ deflate_put_bits(int, int);
int /*<<< orphan*/ deflate_put_literal(int);
void deflate_put_length(int len) {
  if (len > 2 && len < 11) {
    deflate_put_literal(254 + len);
    return;
  }
  if (len < 19) {
    deflate_put_literal(265 + (len - 11) / 2);
    deflate_put_bits(1, (len - 3) % 2);
    return;
  }
  if (len < 35) {
    deflate_put_literal(269 + (len - 19) / 4);
    deflate_put_bits(2, (len - 3) % 4);
    return;
  }
  if (len < 67) {
    deflate_put_literal(273 + (len - 35) / 8);
    deflate_put_bits(3, (len - 3) % 8);
    return;
  }
  if (len < 131) {
    deflate_put_literal(277 + (len - 67) / 16);
    deflate_put_bits(4, (len - 3) % 16);
    return;
  }
  if (len < 258) {
    deflate_put_literal(281 + (len - 131) / 32);
    deflate_put_bits(5, (len - 3) % 32);
    return;
  }
  if (len == 258) {
    deflate_put_literal(285);
    return;
  }
  return;
}


x86 assembly (clang, -O0):
<deflate_put_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jle    1152 <deflate_put_length+0x32>
cmpl   $0xb,-0x4(%rbp)
jge    1152 <deflate_put_length+0x32>
mov    -0x4(%rbp),%edi
add    $0xfe,%edi
call   1030 <deflate_put_literal@plt>
jmp    12cf <deflate_put_length+0x1af>
cmpl   $0x13,-0x4(%rbp)
jge    1196 <deflate_put_length+0x76>
mov    -0x4(%rbp),%eax
sub    $0xb,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x109,%edi
call   1030 <deflate_put_literal@plt>
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x1,%edi
call   1040 <deflate_put_bits@plt>
jmp    12cf <deflate_put_length+0x1af>
cmpl   $0x23,-0x4(%rbp)
jge    11da <deflate_put_length+0xba>
mov    -0x4(%rbp),%eax
sub    $0x13,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x10d,%edi
call   1030 <deflate_put_literal@plt>
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x2,%edi
call   1040 <deflate_put_bits@plt>
jmp    12cf <deflate_put_length+0x1af>
cmpl   $0x43,-0x4(%rbp)
jge    121e <deflate_put_length+0xfe>
mov    -0x4(%rbp),%eax
sub    $0x23,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x111,%edi
call   1030 <deflate_put_literal@plt>
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x3,%edi
call   1040 <deflate_put_bits@plt>
jmp    12cf <deflate_put_length+0x1af>
cmpl   $0x83,-0x4(%rbp)
jge    1265 <deflate_put_length+0x145>
mov    -0x4(%rbp),%eax
sub    $0x43,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x115,%edi
call   1030 <deflate_put_literal@plt>
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x4,%edi
call   1040 <deflate_put_bits@plt>
jmp    12cf <deflate_put_length+0x1af>
cmpl   $0x102,-0x4(%rbp)
jge    12ae <deflate_put_length+0x18e>
mov    -0x4(%rbp),%eax
sub    $0x83,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x119,%edi
call   1030 <deflate_put_literal@plt>
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x5,%edi
call   1040 <deflate_put_bits@plt>
jmp    12cf <deflate_put_length+0x1af>
cmpl   $0x102,-0x4(%rbp)
jne    12ca <deflate_put_length+0x1aa>
mov    $0x11d,%edi
call   1030 <deflate_put_literal@plt>
jmp    12cf <deflate_put_length+0x1af>
jmp    12cf <deflate_put_length+0x1af>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deflate_put_length>:
push   %rbx
lea    -0x3(%rdi),%ebx
cmp    $0x7,%ebx
ja     1135 <deflate_put_length+0x15>
add    $0xfe,%edi
pop    %rbx
jmp    1030 <deflate_put_literal@plt>
cmp    $0x12,%edi
jg     116a <deflate_put_length+0x4a>
mov    %edi,%eax
add    $0xfffffff5,%eax
shr    $0x1f,%eax
add    %eax,%edi
add    $0xfffffff5,%edi
sar    %edi
add    $0x109,%edi
call   1030 <deflate_put_literal@plt>
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
and    $0xfffffffe,%eax
sub    %eax,%ebx
mov    $0x1,%edi
jmp    1203 <deflate_put_length+0xe3>
cmp    $0x22,%edi
ja     1190 <deflate_put_length+0x70>
add    $0xed,%edi
shr    $0x2,%edi
and    $0x3f,%edi
add    $0x10d,%edi
call   1030 <deflate_put_literal@plt>
and    $0x3,%ebx
mov    $0x2,%edi
jmp    1203 <deflate_put_length+0xe3>
cmp    $0x42,%edi
ja     11b6 <deflate_put_length+0x96>
add    $0xdd,%edi
shr    $0x3,%edi
and    $0x1f,%edi
add    $0x111,%edi
call   1030 <deflate_put_literal@plt>
and    $0x7,%ebx
mov    $0x3,%edi
jmp    1203 <deflate_put_length+0xe3>
cmp    $0x82,%edi
ja     11df <deflate_put_length+0xbf>
add    $0xbd,%edi
shr    $0x4,%edi
and    $0xf,%edi
add    $0x115,%edi
call   1030 <deflate_put_literal@plt>
and    $0xf,%ebx
mov    $0x4,%edi
jmp    1203 <deflate_put_length+0xe3>
cmp    $0x101,%edi
ja     120b <deflate_put_length+0xeb>
add    $0x7d,%edi
shr    $0x5,%edi
and    $0x7,%edi
add    $0x119,%edi
call   1030 <deflate_put_literal@plt>
and    $0x1f,%ebx
mov    $0x5,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <deflate_put_bits@plt>
cmp    $0x102,%edi
jne    121e <deflate_put_length+0xfe>
mov    $0x11d,%edi
pop    %rbx
jmp    1030 <deflate_put_literal@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @deflate_put_length(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 2
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 11
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 254, %9
%11 = call i32 @deflate_put_literal(i32 %10)
br label %83
12: ; preds = %5, %1
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 19
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 11
%18 = sdiv i32 %17, 2
%19 = add nsw i32 265, %18
%20 = call i32 @deflate_put_literal(i32 %19)
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 3
%23 = srem i32 %22, 2
%24 = call i32 @deflate_put_bits(i32 1, i32 %23)
br label %83
25: ; preds = %12
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 35
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i32, i32* %2
%30 = sub nsw i32 %29, 19
%31 = sdiv i32 %30, 4
%32 = add nsw i32 269, %31
%33 = call i32 @deflate_put_literal(i32 %32)
%34 = load i32, i32* %2
%35 = sub nsw i32 %34, 3
%36 = srem i32 %35, 4
%37 = call i32 @deflate_put_bits(i32 2, i32 %36)
br label %83
38: ; preds = %25
%39 = load i32, i32* %2
%40 = icmp slt i32 %39, 67
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = load i32, i32* %2
%43 = sub nsw i32 %42, 35
%44 = sdiv i32 %43, 8
%45 = add nsw i32 273, %44
%46 = call i32 @deflate_put_literal(i32 %45)
%47 = load i32, i32* %2
%48 = sub nsw i32 %47, 3
%49 = srem i32 %48, 8
%50 = call i32 @deflate_put_bits(i32 3, i32 %49)
br label %83
51: ; preds = %38
%52 = load i32, i32* %2
%53 = icmp slt i32 %52, 131
br i1 %53, label %54, label %64
54: ; preds = %51
%55 = load i32, i32* %2
%56 = sub nsw i32 %55, 67
%57 = sdiv i32 %56, 16
%58 = add nsw i32 277, %57
%59 = call i32 @deflate_put_literal(i32 %58)
%60 = load i32, i32* %2
%61 = sub nsw i32 %60, 3
%62 = srem i32 %61, 16
%63 = call i32 @deflate_put_bits(i32 4, i32 %62)
br label %83
64: ; preds = %51
%65 = load i32, i32* %2
%66 = icmp slt i32 %65, 258
br i1 %66, label %67, label %77
67: ; preds = %64
%68 = load i32, i32* %2
%69 = sub nsw i32 %68, 131
%70 = sdiv i32 %69, 32
%71 = add nsw i32 281, %70
%72 = call i32 @deflate_put_literal(i32 %71)
%73 = load i32, i32* %2
%74 = sub nsw i32 %73, 3
%75 = srem i32 %74, 32
%76 = call i32 @deflate_put_bits(i32 5, i32 %75)
br label %83
77: ; preds = %64
%78 = load i32, i32* %2
%79 = icmp eq i32 %78, 258
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = call i32 @deflate_put_literal(i32 285)
br label %83
82: ; preds = %77
br label %83
83: ; preds = %82, %80, %67, %54, %41, %28, %15, %8
ret void
}

LLVM IR (-O2):
define void @deflate_put_length(i32 %0) {
%2 = add i32 %0, -3
%3 = icmp ult i32 %2, 8
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = add nuw nsw i32 %0, 254
%6 = tail call i32 @deflate_put_literal(i32 %5)
br label %60
7: ; preds = %1
%8 = icmp slt i32 %0, 19
br i1 %8, label %9, label %16
9: ; preds = %7
%10 = add nsw i32 %0, -11
%11 = sdiv i32 %10, 2
%12 = add nsw i32 %11, 265
%13 = tail call i32 @deflate_put_literal(i32 %12)
%14 = srem i32 %2, 2
%15 = tail call i32 @deflate_put_bits(i32 1, i32 %14)
br label %60
16: ; preds = %7
%17 = icmp ult i32 %0, 35
br i1 %17, label %18, label %26
18: ; preds = %16
%19 = add nuw nsw i32 %0, 237
%20 = lshr i32 %19, 2
%21 = and i32 %20, 63
%22 = add nuw nsw i32 %21, 269
%23 = tail call i32 @deflate_put_literal(i32 %22)
%24 = and i32 %2, 3
%25 = tail call i32 @deflate_put_bits(i32 2, i32 %24)
br label %60
26: ; preds = %16
%27 = icmp ult i32 %0, 67
br i1 %27, label %28, label %36
28: ; preds = %26
%29 = add nuw nsw i32 %0, 221
%30 = lshr i32 %29, 3
%31 = and i32 %30, 31
%32 = add nuw nsw i32 %31, 273
%33 = tail call i32 @deflate_put_literal(i32 %32)
%34 = and i32 %2, 7
%35 = tail call i32 @deflate_put_bits(i32 3, i32 %34)
br label %60
36: ; preds = %26
%37 = icmp ult i32 %0, 131
br i1 %37, label %38, label %46
38: ; preds = %36
%39 = add nuw nsw i32 %0, 189
%40 = lshr i32 %39, 4
%41 = and i32 %40, 15
%42 = add nuw nsw i32 %41, 277
%43 = tail call i32 @deflate_put_literal(i32 %42)
%44 = and i32 %2, 15
%45 = tail call i32 @deflate_put_bits(i32 4, i32 %44)
br label %60
46: ; preds = %36
%47 = icmp ult i32 %0, 258
br i1 %47, label %48, label %56
48: ; preds = %46
%49 = add nuw nsw i32 %0, 125
%50 = lshr i32 %49, 5
%51 = and i32 %50, 7
%52 = add nuw nsw i32 %51, 281
%53 = tail call i32 @deflate_put_literal(i32 %52)
%54 = and i32 %2, 31
%55 = tail call i32 @deflate_put_bits(i32 5, i32 %54)
br label %60
56: ; preds = %46
%57 = icmp eq i32 %0, 258
br i1 %57, label %58, label %60
58: ; preds = %56
%59 = tail call i32 @deflate_put_literal(i32 285)
br label %60
60: ; preds = %56, %58, %48, %38, %28, %18, %9, %4
ret void
}