#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 /*<<< orphan*/ u_char;
struct ip {
  int ip_hl;
};
struct icmp {
  int icmp_type;
};

/* Variables and functions */
int isICMPOther(const u_char *p, int source) {
  switch (((struct icmp *)(p + 14 + ((struct ip *)(p + 14))->ip_hl * 4))
              ->icmp_type) {
  case 0:
  case 3:
  case 4:
  case 5:
  case 8:
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
  case 14:
  case 15:
  case 16:
  case 17:
  case 18:
    return !source;
  default:
    return source;
  }
}


x86 assembly (clang, -O0):
<isICMPOther>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    0x38(%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     1154 <isICMPOther+0x54>
jmp    112c <isICMPOther+0x2c>
mov    -0x18(%rbp),%eax
add    $0xfffffffd,%eax
sub    $0x3,%eax
jb     1154 <isICMPOther+0x54>
jmp    1140 <isICMPOther+0x40>
mov    -0x18(%rbp),%eax
add    $0xfffffff8,%eax
sub    $0xa,%eax
ja     116a <isICMPOther+0x6a>
jmp    1154 <isICMPOther+0x54>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <isICMPOther+0x70>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isICMPOther>:
mov    %esi,%eax
movslq 0x38(%rdi),%rcx
shl    $0x4,%rcx
mov    0x38(%rdi,%rcx,1),%ecx
lea    -0x8(%rcx),%edx
cmp    $0xb,%edx
jb     1125 <isICMPOther+0x25>
cmp    $0x5,%ecx
ja     112e <isICMPOther+0x2e>
mov    $0x39,%edx
bt     %ecx,%edx
jae    112e <isICMPOther+0x2e>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
ret

LLVM IR (-O0):
%struct.ip = type { i32 }
%struct.icmp = type { i32 }
define i32 @isICMPOther(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 14
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 14
%10 = bitcast i32* %9 to %struct.ip*
%11 = getelementptr inbounds %struct.ip, %struct.ip* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = mul nsw i32 %12, 4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %7, i64 %14
%16 = bitcast i32* %15 to %struct.icmp*
%17 = getelementptr inbounds %struct.icmp, %struct.icmp* %16, i32 0, i32 0
%18 = load i32, i32* %17
switch i32 %18, label %24 [
i32 0, label %19
i32 3, label %19
i32 4, label %19
i32 5, label %19
i32 8, label %19
i32 9, label %19
i32 10, label %19
i32 11, label %19
i32 12, label %19
i32 13, label %19
i32 14, label %19
i32 15, label %19
i32 16, label %19
i32 17, label %19
i32 18, label %19
]
19: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2
%20 = load i32, i32* %5
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
store i32 %23, i32* %3
br label %26
24: ; preds = %2
%25 = load i32, i32* %5
store i32 %25, i32* %3
br label %26
26: ; preds = %24, %19
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @isICMPOther(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 14
%4 = load i32, i32* %3
%5 = shl nsw i32 %4, 2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %3, i64 %6
%8 = load i32, i32* %7
switch i32 %8, label %12 [
i32 0, label %9
i32 3, label %9
i32 4, label %9
i32 5, label %9
i32 8, label %9
i32 9, label %9
i32 10, label %9
i32 11, label %9
i32 12, label %9
i32 13, label %9
i32 14, label %9
i32 15, label %9
i32 16, label %9
i32 17, label %9
i32 18, label %9
]
9: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2
%10 = icmp eq i32 %1, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %2, %9
%13 = phi i32 [ %11, %9 ], [ %1, %2 ]
ret i32 %13
}