#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ print_help(char *);
int /*<<< orphan*/ stderr;
void check_pattern(char *s, char *self) {
  while (*s) {
    switch (*s) {
    case '5':
    case '1':
    case '2':
    case '4':
    case '8':
    case 'a':
    case 'b':
    case 'c':
    case 'd':
    case 'e':
    case 'f':
    case 'g':
    case 'h':
    case 'i':
    case 'j':
      break;
    default:
      fprintf(stderr, "Invalid packet size symbol: %c.\n\n", *s);
      print_help(self);
    }
    s++;
  }
}


x86 assembly (clang, -O0):
<check_pattern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11cc <check_pattern+0xac>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffcf,%eax
sub    $0x2,%eax
jb     1191 <check_pattern+0x71>
jmp    1158 <check_pattern+0x38>
mov    -0x14(%rbp),%eax
add    $0xffffffcc,%eax
sub    $0x2,%eax
jb     1191 <check_pattern+0x71>
jmp    116c <check_pattern+0x4c>
mov    -0x14(%rbp),%eax
sub    $0x38,%eax
je     1191 <check_pattern+0x71>
jmp    117d <check_pattern+0x5d>
mov    -0x14(%rbp),%eax
add    $0xffffff9f,%eax
sub    $0x9,%eax
ja     1196 <check_pattern+0x76>
jmp    1191 <check_pattern+0x71>
jmp    11bb <check_pattern+0x9b>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
lea    0xe56(%rip),%rsi
movsbl (%rax),%edx
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <print_help@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <check_pattern+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_pattern>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1194 <check_pattern+0x74>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
mov    0x2ea0(%rip),%r12
lea    0xeb9(%rip),%r15
movabs $0x3ff00000000009b,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edx
lea    -0x31(%rdx),%eax
cmp    $0x39,%eax
ja     117e <check_pattern+0x5e>
bt     %rax,%r13
jae    117e <check_pattern+0x5e>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <check_pattern+0x40>
jmp    1194 <check_pattern+0x74>
mov    (%r12),%edi
mov    %r15,%rsi
call   1030 <fprintf@plt>
mov    %r14,%rdi
call   1040 <print_help@plt>
jmp    1171 <check_pattern+0x51>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Invalid packet size symbol: %c.\0A\0A\00"
define void @check_pattern(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %21, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %14 [
i32 53, label %13
i32 49, label %13
i32 50, label %13
i32 52, label %13
i32 56, label %13
i32 97, label %13
i32 98, label %13
i32 99, label %13
i32 100, label %13
i32 101, label %13
i32 102, label %13
i32 103, label %13
i32 104, label %13
i32 105, label %13
i32 106, label %13
]
13: ; preds = %9, %9, %9, %9, %9, %9, %9, %9, %9, %9, %9, %9, %9, %9, %9
br label %21
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %17)
%19 = load i8*, i8** %4
%20 = call i32 @print_help(i8* %19)
br label %21
21: ; preds = %14, %13
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
br label %5
24: ; preds = %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Invalid packet size symbol: %c.\0A\0A\00"
define void @check_pattern(i8* nocapture %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %13
%6 = phi i8 [ %15, %13 ], [ %3, %2 ]
%7 = phi i8* [ %14, %13 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
switch i32 %8, label %9 [
i32 53, label %13
i32 49, label %13
i32 50, label %13
i32 52, label %13
i32 56, label %13
i32 97, label %13
i32 98, label %13
i32 99, label %13
i32 100, label %13
i32 101, label %13
i32 102, label %13
i32 103, label %13
i32 104, label %13
i32 105, label %13
i32 106, label %13
]
9: ; preds = %5
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %6)
%12 = tail call i32 @print_help(i8* %1)
br label %13
13: ; preds = %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %9
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %13, %2
ret void
}