#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 REG_EXTENDED;
int REG_NOSUB;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ regcomp(int /*<<< orphan*/ *, char *, int);
scalar_t__ regexec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void er_match(char *argv[]) {
  regex_t reg;
  if (regcomp(&reg, argv[1], REG_EXTENDED | REG_NOSUB) != 0) {
    fprintf(stderr, "erro regcomp\n");
    exit(1);
  }
  if ((regexec(&reg, argv[2], 0, (regmatch_t *)NULL, 0)) == 0)
    printf("Casou\n");
  else
    printf("Não Casou\n");
}


x86 assembly (clang, -O0):
<er_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rsi
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
mov    0x2e6c(%rip),%rax
or     (%rax),%edx
lea    -0xc(%rbp),%rdi
call   1040 <regcomp@plt>
cmp    $0x0,%rax
je     11a8 <er_match+0x58>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0xc(%rbp),%rdi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1060 <regexec@plt>
cmp    $0x0,%rax
jne    11de <er_match+0x8e>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <er_match+0x9a>
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<er_match>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x8(%rdi),%rsi
mov    0x2e6d(%rip),%rax
mov    0x2e76(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0xc(%rsp),%rdi
call   1040 <regcomp@plt>
test   %rax,%rax
jne    11b2 <er_match+0x62>
mov    0x10(%rbx),%rsi
lea    0xc(%rsp),%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <regexec@plt>
test   %rax,%rax
lea    0xe77(%rip),%rax
lea    0xe6b(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"erro regcomp\0A\00"
@.str.1 = [7 x i8] c"Casou\0A\00"
@.str.2 = [12 x i8] c"N\C3\A3o Casou\0A\00"
define void @er_match(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 1
%6 = load i8*, i8** %5
%7 = load i32, i32* @REG_EXTENDED
%8 = load i32, i32* @REG_NOSUB
%9 = or i32 %7, %8
%10 = call i64 @regcomp(i32* %3, i8* %6, i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %1
%17 = load i8**, i8*** %2
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i64 @regexec(i32* %3, i8* %19, i32 0, i32* null, i32 0)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %26
24: ; preds = %16
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
ret void
}

LLVM IR (-O2):
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
@stderr = global i32 0
@.str = [14 x i8] c"erro regcomp\0A\00"
@str = [11 x i8] c"N\C3\A3o Casou\00"
@str.3 = [6 x i8] c"Casou\00"
define void @er_match(i8** nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = load i32, i32* @REG_EXTENDED
%7 = load i32, i32* @REG_NOSUB
%8 = or i32 %7, %6
%9 = call i64 @regcomp(i32* %2, i8* %5, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %1
%16 = getelementptr inbounds i8*, i8** %0, i64 2
%17 = load i8*, i8** %16
%18 = call i64 @regexec(i32* %2, i8* %17, i32 0, i32* null, i32 0)
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
ret void
}