#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*/ er_error(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int regcomp(int /*<<< orphan*/ *, char *, int);
scalar_t__ regexec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/);
void er_match(char *argv[]) {
  regex_t reg;
  int i;
  if ((i = regcomp(&reg, argv[1], REG_EXTENDED | REG_NOSUB)) != 0)
    er_error(i, reg);
  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    0x2e7d(%rip),%rax
mov    (%rax),%edx
mov    0x2e7c(%rip),%rax
or     (%rax),%edx
lea    -0xc(%rbp),%rdi
call   1040 <regcomp@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1186 <er_match+0x46>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <er_error@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    11bc <er_match+0x7c>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    11c8 <er_match+0x88>
lea    0xe3d(%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    0x2e85(%rip),%rax
mov    0x2e86(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0xc(%rsp),%rdi
call   1040 <regcomp@plt>
test   %eax,%eax
je     1177 <er_match+0x37>
mov    0xc(%rsp),%esi
mov    %eax,%edi
call   1050 <er_error@plt>
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    0xe6f(%rip),%rax
lea    0xe63(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
@str = [11 x i8] c"N\C3\A3o Casou\00"
@str.2 = [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 i32 @regcomp(i32* %2, i8* %5, i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %1
%12 = load i32, i32* %2
%13 = call i32 @er_error(i32 %9, i32 %12)
br label %14
14: ; preds = %11, %1
%15 = getelementptr inbounds i8*, i8** %0, i64 2
%16 = load i8*, i8** %15
%17 = call i64 @regexec(i32* %2, i8* %16, i32 0, i32* null, i32 0)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0)
%20 = call i32 @puts(i8* dereferenceable(1) %19)
ret void
}