#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*/ regex_t;

/* Variables and functions */
int REG_EXTENDED;
int REG_ICASE;
int /*<<< orphan*/ puts(char *);
scalar_t__ regcomp(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int main(void) {
  regex_t re;
  int i;
  int ret = 0;
  for (i = 0; i < 32; ++i) {
    if (regcomp(&re, "X-.+:.+Y=\".*\\.(A|B|C|D|E|F|G|H|I",
                REG_EXTENDED | REG_ICASE) == 0) {
      puts("regcomp unexpectedly succeeded");
      ret = 1;
    } else
      regfree(&re);
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    11b7 <main+0x87>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    0x2e81(%rip),%rax
or     (%rax),%edx
lea    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1050 <regcomp@plt>
cmp    $0x0,%rax
jne    119b <main+0x6b>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x10(%rbp)
jmp    11a4 <main+0x74>
lea    -0x8(%rbp),%rdi
call   1040 <regfree@plt>
jmp    11a9 <main+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x1d>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
mov    $0x20,%ebx
mov    0x2e8e(%rip),%r13
mov    0x2e97(%rip),%r15
lea    0xea8(%rip),%r12
lea    0x4(%rsp),%rbp
jmp    116d <main+0x3d>
nop
mov    %rbp,%rdi
call   1040 <regfree@plt>
add    $0xffffffff,%ebx
je     119b <main+0x6b>
mov    (%r15),%edx
or     0x0(%r13),%edx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <regcomp@plt>
test   %rax,%rax
jne    1160 <main+0x30>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
add    $0xffffffff,%ebx
jne    116d <main+0x3d>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"X-.+:.+Y=\22.*\\.(A|B|C|D|E|F|G|H|I\00"
@REG_EXTENDED = global i32 0
@REG_ICASE = global i32 0
@.str.1 = [31 x i8] c"regcomp unexpectedly succeeded\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 32
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* @REG_EXTENDED
%10 = load i32, i32* @REG_ICASE
%11 = or i32 %9, %10
%12 = call i64 @regcomp(i32* %2, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %4
br label %18
16: ; preds = %8
%17 = call i32 @regfree(i32* %2)
br label %18
18: ; preds = %16, %14
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %5
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
@.str = [33 x i8] c"X-.+:.+Y=\22.*\\.(A|B|C|D|E|F|G|H|I\00"
@REG_EXTENDED = global i32 0
@REG_ICASE = global i32 0
@.str.1 = [31 x i8] c"regcomp unexpectedly succeeded\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %15
%4 = phi i32 [ 0, %0 ], [ %16, %15 ]
%5 = phi i32 [ 0, %0 ], [ %17, %15 ]
%6 = load i32, i32* @REG_EXTENDED
%7 = load i32, i32* @REG_ICASE
%8 = or i32 %7, %6
%9 = call i64 @regcomp(i32* %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %3
%14 = call i32 @regfree(i32* %1)
br label %15
15: ; preds = %11, %13
%16 = phi i32 [ 1, %11 ], [ %4, %13 ]
%17 = add nuw nsw i32 %5, 1
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %3
19: ; preds = %15
ret i32 %16
}