#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*/ stderr;
int max_match(char c) {
  if (c == '*')
    return 1000000000;
  if (c == '+')
    return 1000000000;
  if (c == '?')
    return 1;
  fprintf(stderr, "BUG, Invalid quantifier char '%c'\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<max_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
jne    1137 <max_match+0x27>
movl   $0x3b9aca00,-0x4(%rbp)
jmp    1189 <max_match+0x79>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    1150 <max_match+0x40>
movl   $0x3b9aca00,-0x4(%rbp)
jmp    1189 <max_match+0x79>
movsbl -0x5(%rbp),%eax
cmp    $0x3f,%eax
jne    1169 <max_match+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1189 <max_match+0x79>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
movsbl -0x5(%rbp),%edx
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_match>:
mov    $0x3b9aca00,%eax
lea    -0x2a(%rdi),%ecx
cmp    $0x2,%cl
jb     114b <max_match+0x3b>
cmp    $0x3f,%dil
jne    1129 <max_match+0x19>
mov    $0x1,%eax
ret
push   %rax
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
movsbl %dil,%edx
lea    0xec2(%rip),%rsi
mov    %eax,%edi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"BUG, Invalid quantifier char '%c'\0A\00"
define i32 @max_match(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 42
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1000000000, i32* %2
br label %22
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 43
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1000000000, i32* %2
br label %22
13: ; preds = %8
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 63
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %2
br label %22
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i8, i8* %3
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext %20)
store i32 0, i32* %2
br label %22
22: ; preds = %18, %17, %12, %7
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"BUG, Invalid quantifier char '%c'\0A\00"
define i32 @max_match(i8 signext %0) {
switch i8 %0, label %3 [
i8 42, label %6
i8 43, label %6
i8 63, label %2
]
2: ; preds = %1
br label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext %0)
br label %6
6: ; preds = %1, %1, %3, %2
%7 = phi i32 [ 1, %2 ], [ 0, %3 ], [ 1000000000, %1 ], [ 1000000000, %1 ]
ret i32 %7
}