#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int rx_cmatch(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ rx_init();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  int ok;
  rx_init();
  ok = rx_cmatch(*(argv + 1), *(argv + 2), strlen(*(argv + 2)));
  fprintf(stderr, "%s\n", ok ? "ok" : "error");
  return !ok;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rx_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1050 <rx_cmatch@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%ecx
lea    0xe60(%rip),%rdx
lea    0xe56(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe44(%rip),%rsi
call   1060 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
xor    %eax,%eax
call   1030 <rx_init@plt>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <rx_cmatch@plt>
mov    0x2e6e(%rip),%rcx
mov    (%rcx),%edi
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
lea    0xe85(%rip),%rax
lea    0xe7b(%rip),%rdx
cmove  %rax,%rdx
lea    0xe6c(%rip),%rsi
call   1060 <fprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c"ok\00"
@.str.2 = [6 x i8] c"error\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @rx_init()
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%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 @strlen(i8* %16)
%18 = call i32 @rx_cmatch(i8* %10, i8* %13, i32 %17)
store i32 %18, i32* %6
%19 = load i32, i32* @stderr
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%24 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c"ok\00"
@.str.2 = [6 x i8] c"error\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @rx_init()
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @strlen(i8* %7)
%9 = tail call i32 @rx_cmatch(i8* %5, i8* %7, i32 %8)
%10 = load i32, i32* @stderr
%11 = icmp eq i32 %9, 0
%12 = select i1 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%13 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = zext i1 %11 to i32
ret i32 %14
}