#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 get_len();
int validate_data(int data_type, int data_length) {
  int len;
  switch (data_type) {
  case 8:
    if (!data_length)
      return 0;
    len = get_len();
    return (len <= 253 && data_length == len);
  case 13:
    if (!data_length)
      return 0;
    return (data_length == 43);
  default:
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validate_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x8,%eax
je     1143 <validate_data+0x33>
jmp    1132 <validate_data+0x22>
mov    -0x14(%rbp),%eax
sub    $0xd,%eax
je     1191 <validate_data+0x81>
jmp    11bb <validate_data+0xab>
cmpl   $0x0,-0xc(%rbp)
jne    1159 <validate_data+0x49>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <validate_data+0xb2>
mov    $0x0,%al
call   1030 <get_len@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0xfd,-0x10(%rbp)
mov    %al,-0x15(%rbp)
jg     1181 <validate_data+0x71>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11c2 <validate_data+0xb2>
cmpl   $0x0,-0xc(%rbp)
jne    11a7 <validate_data+0x97>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <validate_data+0xb2>
cmpl   $0x2b,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11c2 <validate_data+0xb2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_data>:
push   %rbx
mov    %esi,%ebx
cmp    $0xd,%edi
je     113d <validate_data+0x2d>
cmp    $0x8,%edi
jne    1139 <validate_data+0x29>
test   %ebx,%ebx
je     1139 <validate_data+0x29>
xor    %eax,%eax
call   1030 <get_len@plt>
cmp    $0xfe,%eax
setl   %cl
cmp    %ebx,%eax
sete   %al
and    %cl,%al
jmp    1143 <validate_data+0x33>
xor    %eax,%eax
jmp    1143 <validate_data+0x33>
cmp    $0x2b,%ebx
sete   %al
movzbl %al,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @validate_data(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
switch i32 %7, label %31 [
i32 8, label %8
i32 13, label %23
]
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %8
store i32 0, i32* %3
br label %32
12: ; preds = %8
%13 = call i32 (...) @get_len()
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp sle i32 %14, 253
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp eq i32 %17, %18
br label %20
20: ; preds = %16, %12
%21 = phi i1 [ false, %12 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
store i32 %22, i32* %3
br label %32
23: ; preds = %2
%24 = load i32, i32* %5
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %23
store i32 0, i32* %3
br label %32
27: ; preds = %23
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 43
%30 = zext i1 %29 to i32
store i32 %30, i32* %3
br label %32
31: ; preds = %2
store i32 0, i32* %3
br label %32
32: ; preds = %31, %27, %26, %20, %11
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @validate_data(i32 %0, i32 %1) {
switch i32 %0, label %12 [
i32 8, label %3
i32 13, label %10
]
3: ; preds = %2
%4 = icmp eq i32 %1, 0
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = tail call i32 (...) @get_len()
%7 = icmp slt i32 %6, 254
%8 = icmp eq i32 %6, %1
%9 = and i1 %7, %8
br label %12
10: ; preds = %2
%11 = icmp eq i32 %1, 43
br label %12
12: ; preds = %10, %2, %3, %5
%13 = phi i1 [ %9, %5 ], [ false, %3 ], [ false, %2 ], [ %11, %10 ]
%14 = zext i1 %13 to i32
ret i32 %14
}