#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint32_t convert_length_to_len_sym(uint32_t length) {
  assert(length > 2 && length < 259);
  if (length < 11)
    return 257 + length - 3;
  else if (length < 19)
    return 261 + (length - 3) / 2;
  else if (length < 35)
    return 265 + (length - 3) / 4;
  else if (length < 67)
    return 269 + (length - 3) / 8;
  else if (length < 131)
    return 273 + (length - 3) / 16;
  else if (length < 258)
    return 277 + (length - 3) / 32;
  else
    return 285;
}


x86 assembly (clang, -O0):
<convert_length_to_len_sym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jle    1137 <convert_length_to_len_sym+0x27>
cmpl   $0x103,-0x8(%rbp)
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0xb,-0x8(%rbp)
jge    1161 <convert_length_to_len_sym+0x51>
mov    -0x8(%rbp),%eax
add    $0x101,%eax
sub    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1227 <convert_length_to_len_sym+0x117>
cmpl   $0x13,-0x8(%rbp)
jge    1186 <convert_length_to_len_sym+0x76>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x105,%eax
mov    %eax,-0x4(%rbp)
jmp    1227 <convert_length_to_len_sym+0x117>
cmpl   $0x23,-0x8(%rbp)
jge    11ab <convert_length_to_len_sym+0x9b>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
add    $0x109,%eax
mov    %eax,-0x4(%rbp)
jmp    1227 <convert_length_to_len_sym+0x117>
cmpl   $0x43,-0x8(%rbp)
jge    11d0 <convert_length_to_len_sym+0xc0>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x10d,%eax
mov    %eax,-0x4(%rbp)
jmp    1227 <convert_length_to_len_sym+0x117>
cmpl   $0x83,-0x8(%rbp)
jge    11f8 <convert_length_to_len_sym+0xe8>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
add    $0x111,%eax
mov    %eax,-0x4(%rbp)
jmp    1227 <convert_length_to_len_sym+0x117>
cmpl   $0x102,-0x8(%rbp)
jge    1220 <convert_length_to_len_sym+0x110>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
add    $0x115,%eax
mov    %eax,-0x4(%rbp)
jmp    1227 <convert_length_to_len_sym+0x117>
movl   $0x11d,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_length_to_len_sym>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x3(%rbx),%ebp
xor    %edi,%edi
cmp    $0x100,%ebp
setb   %dil
call   1030 <assert@plt>
cmp    $0xa,%ebx
jg     1138 <convert_length_to_len_sym+0x28>
add    $0xfe,%ebx
mov    %ebx,%eax
jmp    1192 <convert_length_to_len_sym+0x82>
cmp    $0x12,%ebx
ja     1147 <convert_length_to_len_sym+0x37>
shr    %ebp
add    $0x105,%ebp
jmp    1190 <convert_length_to_len_sym+0x80>
cmp    $0x22,%ebx
ja     1157 <convert_length_to_len_sym+0x47>
shr    $0x2,%ebp
add    $0x109,%ebp
jmp    1190 <convert_length_to_len_sym+0x80>
cmp    $0x42,%ebx
ja     1167 <convert_length_to_len_sym+0x57>
shr    $0x3,%ebp
add    $0x10d,%ebp
jmp    1190 <convert_length_to_len_sym+0x80>
cmp    $0x82,%ebx
ja     117a <convert_length_to_len_sym+0x6a>
shr    $0x4,%ebp
add    $0x111,%ebp
jmp    1190 <convert_length_to_len_sym+0x80>
mov    $0x11d,%eax
cmp    $0x101,%ebx
ja     1192 <convert_length_to_len_sym+0x82>
shr    $0x5,%ebp
add    $0x115,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @convert_length_to_len_sym(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 2
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 259
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 11
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 257, %16
%18 = sub nsw i32 %17, 3
store i32 %18, i32* %2
br label %60
19: ; preds = %9
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 19
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 3
%25 = sdiv i32 %24, 2
%26 = add nsw i32 261, %25
store i32 %26, i32* %2
br label %60
27: ; preds = %19
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 35
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* %3
%32 = sub nsw i32 %31, 3
%33 = sdiv i32 %32, 4
%34 = add nsw i32 265, %33
store i32 %34, i32* %2
br label %60
35: ; preds = %27
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 67
br i1 %37, label %38, label %43
38: ; preds = %35
%39 = load i32, i32* %3
%40 = sub nsw i32 %39, 3
%41 = sdiv i32 %40, 8
%42 = add nsw i32 269, %41
store i32 %42, i32* %2
br label %60
43: ; preds = %35
%44 = load i32, i32* %3
%45 = icmp slt i32 %44, 131
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = load i32, i32* %3
%48 = sub nsw i32 %47, 3
%49 = sdiv i32 %48, 16
%50 = add nsw i32 273, %49
store i32 %50, i32* %2
br label %60
51: ; preds = %43
%52 = load i32, i32* %3
%53 = icmp slt i32 %52, 258
br i1 %53, label %54, label %59
54: ; preds = %51
%55 = load i32, i32* %3
%56 = sub nsw i32 %55, 3
%57 = sdiv i32 %56, 32
%58 = add nsw i32 277, %57
store i32 %58, i32* %2
br label %60
59: ; preds = %51
store i32 285, i32* %2
br label %60
60: ; preds = %59, %54, %46, %38, %30, %22, %15
%61 = load i32, i32* %2
ret i32 %61
}

LLVM IR (-O2):
define i32 @convert_length_to_len_sym(i32 %0) {
%2 = add i32 %0, -3
%3 = icmp ult i32 %2, 256
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp slt i32 %0, 11
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = add nsw i32 %0, 254
br label %34
9: ; preds = %1
%10 = icmp ult i32 %0, 19
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = lshr i32 %2, 1
%13 = add nuw nsw i32 %12, 261
br label %34
14: ; preds = %9
%15 = icmp ult i32 %0, 35
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = lshr i32 %2, 2
%18 = add nuw nsw i32 %17, 265
br label %34
19: ; preds = %14
%20 = icmp ult i32 %0, 67
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = lshr i32 %2, 3
%23 = add nuw nsw i32 %22, 269
br label %34
24: ; preds = %19
%25 = icmp ult i32 %0, 131
br i1 %25, label %26, label %29
26: ; preds = %24
%27 = lshr i32 %2, 4
%28 = add nuw nsw i32 %27, 273
br label %34
29: ; preds = %24
%30 = icmp ult i32 %0, 258
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = lshr i32 %2, 5
%33 = add nuw nsw i32 %32, 277
br label %34
34: ; preds = %29, %31, %26, %21, %16, %11, %7
%35 = phi i32 [ %8, %7 ], [ %13, %11 ], [ %18, %16 ], [ %23, %21 ], [ %28, %26 ], [ %33, %31 ], [ 285, %29 ]
ret i32 %35
}