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

/* Variables and functions */
int df_to_len(uint8_t df) {
  if (df > 31) {
    return -1;
  }
  switch (df) {
  case 0:
  case 4:
  case 5:
  case 11:
    return 7;
  case 16:
  case 17:
  case 18:
  case 19:
  case 20:
  case 21:
  case 22:
  case 24:
    return 14;
  default:
    if ((df & 0x18) == 0x18)
      return 14;
    return 0;
  }
}


x86 assembly (clang, -O0):
<df_to_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1f,-0x8(%rbp)
jle    111d <df_to_len+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b4 <df_to_len+0xb4>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     117a <df_to_len+0x7a>
jmp    1130 <df_to_len+0x30>
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x2,%eax
jb     117a <df_to_len+0x7a>
jmp    1144 <df_to_len+0x44>
mov    -0xc(%rbp),%eax
sub    $0xb,%eax
je     117a <df_to_len+0x7a>
jmp    1155 <df_to_len+0x55>
mov    -0xc(%rbp),%eax
add    $0xfffffff0,%eax
sub    $0x7,%eax
jb     1186 <df_to_len+0x86>
jmp    1169 <df_to_len+0x69>
mov    -0xc(%rbp),%eax
sub    $0x18,%eax
je     1186 <df_to_len+0x86>
jmp    1192 <df_to_len+0x92>
movl   $0x7,-0x4(%rbp)
jmp    11b4 <df_to_len+0xb4>
movl   $0xe,-0x4(%rbp)
jmp    11b4 <df_to_len+0xb4>
mov    -0x8(%rbp),%eax
and    $0x18,%eax
cmp    $0x18,%eax
jne    11ad <df_to_len+0xad>
movl   $0xe,-0x4(%rbp)
jmp    11b4 <df_to_len+0xb4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<df_to_len>:
mov    $0xffffffff,%eax
cmp    $0x1f,%edi
jg     1137 <df_to_len+0x37>
cmp    $0x19,%edi
jae    1119 <df_to_len+0x19>
mov    $0x17f0831,%eax
bt     %edi,%eax
jb     112a <df_to_len+0x2a>
not    %edi
xor    %ecx,%ecx
test   $0x18,%dil
mov    $0xe,%eax
cmovne %ecx,%eax
ret
movslq %edi,%rax
lea    0xecc(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @df_to_len(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 31
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -1, i32* %2
br label %17
7: ; preds = %1
%8 = load i32, i32* %3
switch i32 %8, label %11 [
i32 0, label %9
i32 4, label %9
i32 5, label %9
i32 11, label %9
i32 16, label %10
i32 17, label %10
i32 18, label %10
i32 19, label %10
i32 20, label %10
i32 21, label %10
i32 22, label %10
i32 24, label %10
]
9: ; preds = %7, %7, %7, %7
store i32 7, i32* %2
br label %17
10: ; preds = %7, %7, %7, %7, %7, %7, %7, %7
store i32 14, i32* %2
br label %17
11: ; preds = %7
%12 = load i32, i32* %3
%13 = and i32 %12, 24
%14 = icmp eq i32 %13, 24
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 14, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15, %10, %9, %6
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@switch.table.df_to_len = [25 x i32] [i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 7, i32 14, i32 14, i32 14, i32 14, i32 14, i32 14, i32 14, i32 7, i32 14]
define i32 @df_to_len(i32 %0) {
%2 = icmp sgt i32 %0, 31
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 25
br i1 %4, label %9, label %5
5: ; preds = %9, %3
%6 = and i32 %0, 24
%7 = icmp eq i32 %6, 24
%8 = select i1 %7, i32 14, i32 0
br label %17
9: ; preds = %3
%10 = lshr i32 25102385, %0
%11 = and i32 %10, 1
%12 = icmp eq i32 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %9
%14 = sext i32 %0 to i64
%15 = getelementptr inbounds [25 x i32], [25 x i32]* @switch.table.df_to_len, i64 0, i64 %14
%16 = load i32, i32* %15
br label %17
17: ; preds = %13, %5, %1
%18 = phi i32 [ -1, %1 ], [ %8, %5 ], [ %16, %13 ]
ret i32 %18
}