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

/* Variables and functions */
int /*<<< orphan*/ REG_ICASE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ regerror(int, int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int main(void) {
  regex_t re;
  int n;
  n = regcomp(&re, "[a-bA-B]", REG_ICASE);
  if (n != 0) {
    char buf[500];
    regerror(n, &re, buf, sizeof(buf));
    printf("regcomp failed: %s\n", buf);
    exit(1);
  }
  regfree(&re);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1050 <regcomp@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11bd <main+0x6d>
mov    -0xc(%rbp),%edi
lea    -0x200(%rbp),%rdx
lea    -0x8(%rbp),%rsi
mov    $0x1f4,%ecx
call   1060 <regerror@plt>
lea    -0x200(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x8(%rbp),%rdi
call   1030 <regfree@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x210,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%edx
lea    0xe98(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1050 <regcomp@plt>
test   %eax,%eax
jne    118b <main+0x3b>
lea    0xc(%rsp),%rdi
call   1030 <regfree@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbx
ret
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rdx
mov    $0x1f4,%ecx
call   1060 <regerror@plt>
lea    0xe5e(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"[a-bA-B]\00"
@REG_ICASE = global i32 0
@.str.1 = [20 x i8] c"regcomp failed: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [500 x i8]
store i32 0, i32* %1
%5 = load i32, i32* @REG_ICASE
%6 = call i32 @regcomp(i32* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %0
%10 = load i32, i32* %3
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%12 = call i32 @regerror(i32 %10, i32* %2, i8* %11, i32 500)
%13 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = call i32 @regfree(i32* %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"[a-bA-B]\00"
@REG_ICASE = global i32 0
@.str.1 = [20 x i8] c"regcomp failed: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [500 x i8]
%3 = bitcast i32* %1 to i8*
%4 = load i32, i32* @REG_ICASE
%5 = call i32 @regcomp(i32* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %0
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%9 = call i32 @regerror(i32 %5, i32* %1, i8* %8, i32 500)
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
%13 = call i32 @regfree(i32* %1)
ret i32 0
}