#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 /*<<< orphan*/ match(char *, scalar_t__, char *, scalar_t__);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "Usage:%s src pat\n", argv[0]);
    return -1;
  }
  match(argv[1], strlen(argv[1]) - 1, argv[2], strlen(argv[2]) - 1);
  return 0;
}


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)
cmpl   $0x3,-0x8(%rbp)
je     1178 <main+0x48>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe99(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d1 <main+0xa1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
sub    $0x1,%rcx
call   1050 <match@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    116f <main+0x3f>
mov    0x8(%rbx),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    -0x1(%rax),%r15
mov    0x10(%rbx),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    -0x1(%rax),%rcx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <match@plt>
xor    %eax,%eax
jmp    118c <main+0x5c>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe7e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Usage:%s src pat\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 -1, i32* %3
br label %32
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strlen(i8* %20)
%22 = sub nsw i64 %21, 1
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i64 @strlen(i8* %28)
%30 = sub nsw i64 %29, 1
%31 = call i32 @match(i8* %17, i64 %22, i8* %25, i64 %30)
store i32 0, i32* %3
br label %32
32: ; preds = %14, %8
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Usage:%s src pat\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %18
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strlen(i8* dereferenceable(1) %10)
%12 = add nsw i64 %11, -1
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i64 @strlen(i8* dereferenceable(1) %14)
%16 = add nsw i64 %15, -1
%17 = tail call i32 @match(i8* %10, i64 %12, i8* %14, i64 %16)
br label %18
18: ; preds = %8, %4
%19 = phi i32 [ -1, %4 ], [ 0, %8 ]
ret i32 %19
}