#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 isICMPReply(const u_char *p, int source) {
  if (source)
    switch (((struct icmp *)(p + 14 + ((struct ip *)(p + 14))->ip_hl * 4))
                ->icmp_type) {
    case 0:
    case 9:
    case 14:
    case 16:
    case 18:
      return 1;
    default:
      return 0;
    }
  else
    switch (((struct icmp *)(p + 14 + ((struct ip *)(p + 14))->ip_hl * 4))
                ->icmp_type) {
    case 8:
    case 10:
    case 13:
    case 15:
    case 17:
      return 1;
    default:
      return 0;
    }
}


x86 assembly (clang, -O0):
<isICMPReply>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1192 <isICMPReply+0x92>
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     117a <isICMPReply+0x7a>
jmp    1136 <isICMPReply+0x36>
mov    -0x18(%rbp),%eax
sub    $0x9,%eax
je     117a <isICMPReply+0x7a>
jmp    1147 <isICMPReply+0x47>
mov    -0x18(%rbp),%eax
sub    $0xe,%eax
je     117a <isICMPReply+0x7a>
jmp    1158 <isICMPReply+0x58>
mov    -0x18(%rbp),%eax
sub    $0x10,%eax
je     117a <isICMPReply+0x7a>
jmp    1169 <isICMPReply+0x69>
mov    -0x18(%rbp),%eax
sub    $0x12,%eax
jne    1186 <isICMPReply+0x86>
jmp    117a <isICMPReply+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    120b <isICMPReply+0x10b>
movl   $0x0,-0x4(%rbp)
jmp    120b <isICMPReply+0x10b>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    0x38(%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x8,%eax
je     11f8 <isICMPReply+0xf8>
jmp    11b4 <isICMPReply+0xb4>
mov    -0x1c(%rbp),%eax
sub    $0xa,%eax
je     11f8 <isICMPReply+0xf8>
jmp    11c5 <isICMPReply+0xc5>
mov    -0x1c(%rbp),%eax
sub    $0xd,%eax
je     11f8 <isICMPReply+0xf8>
jmp    11d6 <isICMPReply+0xd6>
mov    -0x1c(%rbp),%eax
sub    $0xf,%eax
je     11f8 <isICMPReply+0xf8>
jmp    11e7 <isICMPReply+0xe7>
mov    -0x1c(%rbp),%eax
sub    $0x11,%eax
jne    1204 <isICMPReply+0x104>
jmp    11f8 <isICMPReply+0xf8>
movl   $0x1,-0x4(%rbp)
jmp    120b <isICMPReply+0x10b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isICMPReply>:
movslq 0x38(%rdi),%rax
shl    $0x4,%rax
mov    0x38(%rdi,%rax,1),%ecx
test   %esi,%esi
je     1125 <isICMPReply+0x25>
cmp    $0x12,%ecx
ja     113d <isICMPReply+0x3d>
mov    $0x1,%eax
mov    $0x54201,%edx
bt     %ecx,%edx
jae    113d <isICMPReply+0x3d>
ret
add    $0xfffffff8,%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
ja     1124 <isICMPReply+0x24>
movslq %ecx,%rax
lea    0xec7(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.ip = type { i32 }
%struct.icmp = type { i32 }
define i32 @isICMPReply(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* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %2
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 14
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 14
%13 = bitcast i32* %12 to %struct.ip*
%14 = getelementptr inbounds %struct.ip, %struct.ip* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = mul nsw i32 %15, 4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %10, i64 %17
%19 = bitcast i32* %18 to %struct.icmp*
%20 = getelementptr inbounds %struct.icmp, %struct.icmp* %19, i32 0, i32 0
%21 = load i32, i32* %20
switch i32 %21, label %23 [
i32 0, label %22
i32 9, label %22
i32 14, label %22
i32 16, label %22
i32 18, label %22
]
22: ; preds = %8, %8, %8, %8, %8
store i32 1, i32* %3
br label %40
23: ; preds = %8
store i32 0, i32* %3
br label %40
24: ; preds = %2
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 14
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 14
%29 = bitcast i32* %28 to %struct.ip*
%30 = getelementptr inbounds %struct.ip, %struct.ip* %29, i32 0, i32 0
%31 = load i32, i32* %30
%32 = mul nsw i32 %31, 4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %26, i64 %33
%35 = bitcast i32* %34 to %struct.icmp*
%36 = getelementptr inbounds %struct.icmp, %struct.icmp* %35, i32 0, i32 0
%37 = load i32, i32* %36
switch i32 %37, label %39 [
i32 8, label %38
i32 10, label %38
i32 13, label %38
i32 15, label %38
i32 17, label %38
]
38: ; preds = %24, %24, %24, %24, %24
store i32 1, i32* %3
br label %40
39: ; preds = %24
store i32 0, i32* %3
br label %40
40: ; preds = %39, %38, %23, %22
%41 = load i32, i32* %3
ret i32 %41
}

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