#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*/ regmatch_t;
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ REG_EXTENDED;
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int regexec(int /*<<< orphan*/ *, char *, size_t, int /*<<< orphan*/ *,
            int /*<<< orphan*/);
int main() {
  size_t groups = 2;
  regex_t rex;
  regcomp(&rex, "(i|zu|ll)", REG_EXTENDED);
  regmatch_t ms[groups];
  int r;
  char *s;
  s = "a";
  r = regexec(&rex, s, groups, ms, 0);
  printf("\"%s\" matches? %s\n", s, r ? "no" : "yes");
  s = "i";
  r = regexec(&rex, s, groups, ms, 0);
  printf("\"%s\" matches? %s\n", s, r ? "no" : "yes");
  s = "zu";
  r = regexec(&rex, s, groups, ms, 0);
  printf("\"%s\" matches? %s\n", s, r ? "no" : "yes");
  s = "ll";
  r = regexec(&rex, s, groups, ms, 0);
  printf("\"%s\" matches? %s\n", s, r ? "no" : "yes");
  s = "lln";
  r = regexec(&rex, s, groups, ms, 0);
  printf("\"%s\" matches? %s\n", s, r ? "no" : "yes");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x2,-0x8(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0xeb0(%rip),%rsi
lea    -0xc(%rbp),%rdi
call   1040 <regcomp@plt>
mov    -0x8(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe82(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xe70(%rip),%rdx
lea    0xe66(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rcx
lea    0xe4f(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xe22(%rip),%rdx
lea    0xe18(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xdf8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rcx
lea    0xe03(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xdd4(%rip),%rdx
lea    0xdca(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rcx
lea    0xdb8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xd86(%rip),%rdx
lea    0xd7c(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xd5c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rcx
lea    0xd6d(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
call   1050 <regexec@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xd38(%rip),%rdx
lea    0xd2e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xd0e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
lea    0xeb2(%rip),%rsi
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1040 <regcomp@plt>
mov    %rsp,(%rsp)
lea    0xea4(%rip),%r13
lea    0x10(%rsp),%r14
mov    $0x2,%edx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
test   %eax,%eax
lea    0xe97(%rip),%rbp
lea    0xe8d(%rip),%rbx
mov    %rbx,%rdx
cmove  %rbp,%rdx
lea    0xe6d(%rip),%r12
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
lea    0xe74(%rip),%r13
mov    $0x2,%edx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
test   %eax,%eax
mov    %rbx,%rdx
cmove  %rbp,%rdx
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
lea    0xe45(%rip),%r13
mov    $0x2,%edx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
test   %eax,%eax
mov    %rbx,%rdx
cmove  %rbp,%rdx
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
lea    0xe17(%rip),%r13
mov    $0x2,%edx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
test   %eax,%eax
mov    %rbx,%rdx
cmove  %rbp,%rdx
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
lea    0xde9(%rip),%r13
mov    $0x2,%edx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <regexec@plt>
test   %eax,%eax
cmove  %rbp,%rbx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    (%rsp),%rsp
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"(i|zu|ll)\00"
@REG_EXTENDED = global i32 0
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [18 x i8] c"\22%s\22 matches? %s\0A\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [4 x i8] c"yes\00"
@.str.5 = [2 x i8] c"i\00"
@.str.6 = [3 x i8] c"zu\00"
@.str.7 = [3 x i8] c"ll\00"
@.str.8 = [4 x i8] c"lln\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
store i64 2, i64* %1
%7 = load i32, i32* @REG_EXTENDED
%8 = call i32 @regcomp(i32* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i64, i64* %1
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i32, i64 %9
store i64 %9, i64* %4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %6
%12 = load i8*, i8** %6
%13 = load i64, i64* %1
%14 = call i32 @regexec(i32* %2, i8* %12, i64 %13, i32* %11, i32 0)
store i32 %14, i32* %5
%15 = load i8*, i8** %6
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%20 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* %19)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8** %6
%21 = load i8*, i8** %6
%22 = load i64, i64* %1
%23 = call i32 @regexec(i32* %2, i8* %21, i64 %22, i32* %11, i32 0)
store i32 %23, i32* %5
%24 = load i8*, i8** %6
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %24, i8* %28)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %6
%30 = load i8*, i8** %6
%31 = load i64, i64* %1
%32 = call i32 @regexec(i32* %2, i8* %30, i64 %31, i32* %11, i32 0)
store i32 %32, i32* %5
%33 = load i8*, i8** %6
%34 = load i32, i32* %5
%35 = icmp ne i32 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%38 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %33, i8* %37)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %6
%39 = load i8*, i8** %6
%40 = load i64, i64* %1
%41 = call i32 @regexec(i32* %2, i8* %39, i64 %40, i32* %11, i32 0)
store i32 %41, i32* %5
%42 = load i8*, i8** %6
%43 = load i32, i32* %5
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%47 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %42, i8* %46)
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8** %6
%48 = load i8*, i8** %6
%49 = load i64, i64* %1
%50 = call i32 @regexec(i32* %2, i8* %48, i64 %49, i32* %11, i32 0)
store i32 %50, i32* %5
%51 = load i8*, i8** %6
%52 = load i32, i32* %5
%53 = icmp ne i32 %52, 0
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%56 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %51, i8* %55)
%57 = load i8*, i8** %3
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"(i|zu|ll)\00"
@REG_EXTENDED = global i32 0
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [18 x i8] c"\22%s\22 matches? %s\0A\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [4 x i8] c"yes\00"
@.str.5 = [2 x i8] c"i\00"
@.str.6 = [3 x i8] c"zu\00"
@.str.7 = [3 x i8] c"ll\00"
@.str.8 = [4 x i8] c"lln\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @REG_EXTENDED
%4 = call i32 @regcomp(i32* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i8* @llvm.stacksave()
%6 = alloca [2 x i32]
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%8 = call i32 @regexec(i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 2, i32* %7, i32 0)
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i32 @regexec(i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i64 2, i32* %7, i32 0)
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %14)
%16 = call i32 @regexec(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i32* %7, i32 0)
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%19 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %18)
%20 = call i32 @regexec(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i64 2, i32* %7, i32 0)
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %22)
%24 = call i32 @regexec(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 2, i32* %7, i32 0)
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%27 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %26)
ret i32 0
}