#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int regcomp(int /*<<< orphan*/ *, char const *, int);
int /*<<< orphan*/ regerror(int, int /*<<< orphan*/ *, char *, size_t const);
int /*<<< orphan*/ stderr;
void compile_reg_expr(int cflags, const char *expr, regex_t *reg) {
  static const size_t ERROR_BUF_SIZE = 256;
  char error_msg[ERROR_BUF_SIZE];
  int result;
  result = regcomp(reg, expr, cflags);
  if (result != 0) {
    regerror(result, reg, error_msg, ERROR_BUF_SIZE);
    fprintf(stderr, "%s\n", error_msg);
  }
}


x86 assembly (clang, -O0):
<compile_reg_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1030 <regcomp@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     119e <compile_reg_expr+0x6e>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    -0x130(%rbp),%rdx
mov    $0x100,%ecx
call   1050 <regerror@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
lea    -0x130(%rbp),%rdx
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compile_reg_expr>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%rbx
mov    %edi,%edx
mov    %rbx,%rdi
call   1030 <regcomp@plt>
test   %eax,%eax
je     1178 <compile_reg_expr+0x48>
mov    %rsp,%r14
mov    $0x100,%ecx
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <regerror@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@compile_reg_expr.ERROR_BUF_SIZE = internal constant i64 256
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @compile_reg_expr(i32 %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %7
%10 = alloca i8, i64 256
%11 = load i32*, i32** %6
%12 = load i8*, i8** %5
%13 = load i32, i32* %4
%14 = call i32 @regcomp(i32* %11, i8* %12, i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i32, i32* %8
%19 = load i32*, i32** %6
%20 = call i32 @regerror(i32 %18, i32* %19, i8* %10, i64 256)
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %23
23: ; preds = %17, %3
%24 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @compile_reg_expr(i32 %0, i8* %1, i32* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @regcomp(i32* %2, i8* %1, i32 %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = call i32 @regerror(i32 %6, i32* %2, i8* %5, i64 256)
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %12
12: ; preds = %8, %3
ret void
}