#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 */
char *XATTR_NAME_POSIX_ACL_ACCESS;
char *XATTR_NAME_POSIX_ACL_DEFAULT;
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int posix_xattr_acl(char *xattr) {
  int xattr_len = strlen(xattr);
  if ((strlen(XATTR_NAME_POSIX_ACL_ACCESS) == xattr_len) &&
      (strncmp(XATTR_NAME_POSIX_ACL_ACCESS, xattr, xattr_len) == 0))
    return 1;
  if ((strlen(XATTR_NAME_POSIX_ACL_DEFAULT) == xattr_len) &&
      (strncmp(XATTR_NAME_POSIX_ACL_DEFAULT, xattr, xattr_len) == 0))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<posix_xattr_acl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
cmp    -0x14(%rbp),%eax
jne    117c <posix_xattr_acl+0x5c>
mov    0x2e81(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    117c <posix_xattr_acl+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    11c7 <posix_xattr_acl+0xa7>
mov    0x2e65(%rip),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
cmp    -0x14(%rbp),%eax
jne    11c0 <posix_xattr_acl+0xa0>
mov    0x2e4d(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c0 <posix_xattr_acl+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11c7 <posix_xattr_acl+0xa7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_xattr_acl>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    0x2ea3(%rip),%r14
mov    (%r14),%rdi
call   1040 <strlen@plt>
cmp    %ebp,%eax
jne    1153 <posix_xattr_acl+0x33>
mov    (%r14),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     117c <posix_xattr_acl+0x5c>
mov    0x2e8e(%rip),%r14
mov    (%r14),%rdi
call   1040 <strlen@plt>
cmp    %ebp,%eax
jne    1178 <posix_xattr_acl+0x58>
mov    (%r14),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     117c <posix_xattr_acl+0x5c>
xor    %eax,%eax
jmp    1181 <posix_xattr_acl+0x61>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@XATTR_NAME_POSIX_ACL_ACCESS = global i8* null
@XATTR_NAME_POSIX_ACL_DEFAULT = global i8* null
define i32 @posix_xattr_acl(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i8*, i8** @XATTR_NAME_POSIX_ACL_ACCESS
%8 = call i32 @strlen(i8* %7)
%9 = load i32, i32* %4
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %1
%12 = load i8*, i8** @XATTR_NAME_POSIX_ACL_ACCESS
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = call i64 @strncmp(i8* %12, i8* %13, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 1, i32* %2
br label %31
18: ; preds = %11, %1
%19 = load i8*, i8** @XATTR_NAME_POSIX_ACL_DEFAULT
%20 = call i32 @strlen(i8* %19)
%21 = load i32, i32* %4
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = load i8*, i8** @XATTR_NAME_POSIX_ACL_DEFAULT
%25 = load i8*, i8** %3
%26 = load i32, i32* %4
%27 = call i64 @strncmp(i8* %24, i8* %25, i32 %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %2
br label %31
30: ; preds = %23, %18
store i32 0, i32* %2
br label %31
31: ; preds = %30, %29, %17
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@XATTR_NAME_POSIX_ACL_ACCESS = global i8* null
@XATTR_NAME_POSIX_ACL_DEFAULT = global i8* null
define i32 @posix_xattr_acl(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i8*, i8** @XATTR_NAME_POSIX_ACL_ACCESS
%4 = tail call i32 @strlen(i8* %3)
%5 = icmp eq i32 %4, %2
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** @XATTR_NAME_POSIX_ACL_ACCESS
%8 = tail call i64 @strncmp(i8* %7, i8* %0, i32 %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %6, %1
%11 = load i8*, i8** @XATTR_NAME_POSIX_ACL_DEFAULT
%12 = tail call i32 @strlen(i8* %11)
%13 = icmp eq i32 %12, %2
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8*, i8** @XATTR_NAME_POSIX_ACL_DEFAULT
%16 = tail call i64 @strncmp(i8* %15, i8* %0, i32 %2)
%17 = icmp eq i64 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %14, %10
br label %19
19: ; preds = %14, %6, %18
%20 = phi i32 [ 0, %18 ], [ 1, %6 ], [ 1, %14 ]
ret i32 %20
}