#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int re_match(char *, char *, int *);
int main(int argc, char **argv) {
  int length;
  if (argc == 3) {
    int m = re_match(argv[1], argv[2], &length);
    if (m != -1)
      return 0;
  } else {
    printf("\nUsage: %s <PATTERN> <TEXT> \n", argv[0]);
  }
  return -2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1177 <main+0x57>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <re_match@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     1172 <main+0x52>
movl   $0x0,-0x4(%rbp)
jmp    1191 <main+0x71>
jmp    118a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jne    1143 <main+0x23>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
lea    0x4(%rsp),%rdx
call   1030 <re_match@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1152 <main+0x32>
pop    %rcx
ret
mov    (%rsi),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0xfffffffe,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0AUsage: %s <PATTERN> <TEXT> \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %22
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @re_match(i8* %13, i8* %16, i32* %6)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %10
store i32 0, i32* %3
br label %28
21: ; preds = %10
br label %27
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %22, %21
store i32 -2, i32* %3
br label %28
28: ; preds = %27, %20
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0AUsage: %s <PATTERN> <TEXT> \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = call i32 @re_match(i8* %8, i8* %10, i32* %3)
%12 = icmp eq i32 %11, -1
br i1 %12, label %16, label %17
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %6, %13
br label %17
17: ; preds = %6, %16
%18 = phi i32 [ -2, %16 ], [ 0, %6 ]
ret i32 %18
}