#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 */
scalar_t__ REG_EXTENDED;
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *malloc(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ regcomp(int /*<<< orphan*/ *, char const *, int);
void init_lex_item(regex_t **preg, const char *re) {
  *preg = malloc(sizeof(regex_t));
  if (regcomp(*preg, re, REG_EXTENDED != 0)) {
    printf("init_lex_error\n");
    free(*preg);
    *preg = NULL;
  }
}


x86 assembly (clang, -O0):
<init_lex_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e6a(%rip),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%edx
call   1050 <regcomp@plt>
cmp    $0x0,%rax
je     11b4 <init_lex_item+0x74>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_lex_item>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,(%rbx)
mov    0x2e82(%rip),%rcx
xor    %edx,%edx
cmpq   $0x0,(%rcx)
setne  %dl
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <regcomp@plt>
test   %rax,%rax
je     1192 <init_lex_item+0x52>
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@REG_EXTENDED = global i64 0
@.str = [16 x i8] c"init_lex_error\0A\00"
define void @init_lex_item(i32** %0, i8* %1) {
%3 = alloca i32**
%4 = alloca i8*
store i32** %0, i32*** %3
store i8* %1, i8** %4
%5 = call i32* @malloc(i32 4)
%6 = load i32**, i32*** %3
store i32* %5, i32** %6
%7 = load i32**, i32*** %3
%8 = load i32*, i32** %7
%9 = load i8*, i8** %4
%10 = load i64, i64* @REG_EXTENDED
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
%13 = call i64 @regcomp(i32* %8, i8* %9, i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%17 = load i32**, i32*** %3
%18 = load i32*, i32** %17
%19 = call i32 @free(i32* %18)
%20 = load i32**, i32*** %3
store i32* null, i32** %20
br label %21
21: ; preds = %15, %2
ret void
}

LLVM IR (-O2):
@REG_EXTENDED = global i64 0
@str = [15 x i8] c"init_lex_error\00"
define void @init_lex_item(i32** nocapture %0, i8* %1) {
%3 = tail call i32* @malloc(i32 4)
store i32* %3, i32** %0
%4 = load i64, i64* @REG_EXTENDED
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i64 @regcomp(i32* %3, i8* %1, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%11 = load i32*, i32** %0
%12 = tail call i32 @free(i32* %11)
store i32* null, i32** %0
br label %13
13: ; preds = %9, %2
ret void
}