#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*/ file_bplayer(char const *);
int /*<<< orphan*/ file_wplayer(char const *);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ strstr(char const *, char const *);
int file_has_pname(const char *fname, const char *plogin) {
  if (!strstr(fname, plogin))
    return 0;
  if (!strcmp(file_wplayer(fname), plogin))
    return 2;
  if (!strcmp(file_bplayer(fname), plogin))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<file_has_pname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%eax
jne    1172 <file_has_pname+0x32>
movl   $0x0,-0x4(%rbp)
jmp    11cb <file_has_pname+0x8b>
mov    -0x10(%rbp),%rdi
call   1050 <file_wplayer@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119b <file_has_pname+0x5b>
movl   $0x2,-0x4(%rbp)
jmp    11cb <file_has_pname+0x8b>
mov    -0x10(%rbp),%rdi
call   1030 <file_bplayer@plt>
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c4 <file_has_pname+0x84>
movl   $0x1,-0x4(%rbp)
jmp    11cb <file_has_pname+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_has_pname>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1060 <strstr@plt>
test   %eax,%eax
je     1186 <file_has_pname+0x46>
mov    %rbx,%rdi
call   1050 <file_wplayer@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     118a <file_has_pname+0x4a>
mov    %rbx,%rdi
call   1030 <file_bplayer@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1040 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
jmp    118f <file_has_pname+0x4f>
xor    %eax,%eax
jmp    118f <file_has_pname+0x4f>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @file_has_pname(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** %4
%7 = load i8*, i8** %5
%8 = call i32 @strstr(i8* %6, i8* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 0, i32* %3
br label %26
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @file_wplayer(i8* %12)
%14 = load i8*, i8** %5
%15 = call i32 @strcmp(i32 %13, i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %11
store i32 2, i32* %3
br label %26
18: ; preds = %11
%19 = load i8*, i8** %4
%20 = call i32 @file_bplayer(i8* %19)
%21 = load i8*, i8** %5
%22 = call i32 @strcmp(i32 %20, i8* %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %18
store i32 1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %17, %10
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @file_has_pname(i8* %0, i8* %1) {
%3 = tail call i32 @strstr(i8* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call i32 @file_wplayer(i8* %0)
%7 = tail call i32 @strcmp(i32 %6, i8* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = tail call i32 @file_bplayer(i8* %0)
%11 = tail call i32 @strcmp(i32 %10, i8* %1)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %9, %5, %2
%15 = phi i32 [ 0, %2 ], [ 2, %5 ], [ %13, %9 ]
ret i32 %15
}