#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 */
scalar_t__ amatch(int /*<<< orphan*/, char *);
int umatch(char *s, char *p) {
  if (*p == 0)
    return 1;
  while (*s)
    if (amatch(s++, p))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<umatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113c <umatch+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    118a <umatch+0x7a>
jmp    1141 <umatch+0x31>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1183 <umatch+0x73>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
call   1030 <amatch@plt>
cmp    $0x0,%rax
je     117e <umatch+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    118a <umatch+0x7a>
jmp    1141 <umatch+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umatch>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmpb   $0x0,(%rsi)
je     1151 <umatch+0x41>
mov    %rsi,%r15
mov    %rdi,%rbp
mov    %ebp,%ebx
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x0(%rbp)
je     114e <umatch+0x3e>
add    $0x1,%rbp
mov    %ebx,%edi
mov    %r15,%rsi
call   1030 <amatch@plt>
add    $0x1,%ebx
test   %rax,%rax
je     1130 <umatch+0x20>
jmp    1151 <umatch+0x41>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @umatch(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %26
11: ; preds = %2
br label %12
12: ; preds = %24, %11
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
%19 = ptrtoint i8* %17 to i32
%20 = load i8*, i8** %5
%21 = call i64 @amatch(i32 %19, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 1, i32* %3
br label %26
24: ; preds = %16
br label %12
25: ; preds = %12
store i32 0, i32* %3
br label %26
26: ; preds = %25, %23, %10
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @umatch(i8* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %9
%6 = phi i8* [ %10, %9 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = ptrtoint i8* %6 to i64
%12 = trunc i64 %11 to i32
%13 = tail call i64 @amatch(i32 %12, i8* %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %5, label %15
15: ; preds = %5, %9, %2
%16 = phi i32 [ 1, %2 ], [ 0, %5 ], [ 1, %9 ]
ret i32 %16
}