#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__ list_match(char *, char *);
int strlen(char *);
int guess_star(char *str, char *mask) {
  int i = 0;
  if (mask[0] == 0)
    return 1;
  for (; i < strlen(str); i++)
    if (list_match(str + i, mask))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<guess_star>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1153 <guess_star+0x33>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <guess_star+0x98>
jmp    1158 <guess_star+0x38>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11b1 <guess_star+0x91>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <list_match@plt>
cmp    $0x0,%rax
je     119e <guess_star+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <guess_star+0x98>
jmp    11a3 <guess_star+0x83>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1158 <guess_star+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<guess_star>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmpb   $0x0,(%rsi)
je     1177 <guess_star+0x57>
mov    %rsi,%r15
mov    %rdi,%rbp
call   1030 <strlen@plt>
test   %eax,%eax
jle    1174 <guess_star+0x54>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%rbx,%rbp,1),%rdi
mov    %r15,%rsi
call   1040 <list_match@plt>
test   %rax,%rax
jne    1177 <guess_star+0x57>
add    $0x1,%rbx
mov    %rbp,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1150 <guess_star+0x30>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @guess_star(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %33
13: ; preds = %2
br label %14
14: ; preds = %29, %13
%15 = load i32, i32* %6
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %32
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8*, i8** %5
%25 = call i64 @list_match(i8* %23, i8* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %19
store i32 1, i32* %3
br label %33
28: ; preds = %19
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %14
32: ; preds = %14
store i32 0, i32* %3
br label %33
33: ; preds = %32, %27, %12
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @guess_star(i8* %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %12, label %18
8: ; preds = %12
%9 = tail call i32 @strlen(i8* %0)
%10 = sext i32 %9 to i64
%11 = icmp slt i64 %17, %10
br i1 %11, label %12, label %18
12: ; preds = %5, %8
%13 = phi i64 [ %17, %8 ], [ 0, %5 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = tail call i64 @list_match(i8* %14, i8* %1)
%16 = icmp eq i64 %15, 0
%17 = add nuw nsw i64 %13, 1
br i1 %16, label %8, label %18
18: ; preds = %12, %8, %5, %2
%19 = phi i32 [ 1, %2 ], [ 0, %5 ], [ 1, %12 ], [ 0, %8 ]
ret i32 %19
}