#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 */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int iso_aa_get_attrs(unsigned char *, size_t *, char ***, size_t **, char ***,
                     int);
int iso_attr_get_acl_text(size_t, char **, size_t *, char **,
                          int /*<<< orphan*/, char **, char **, int);
int iso_aa_get_acl_text(unsigned char *aa_string, mode_t st_mode,
                        char **access_text, char **default_text, int flag) {
  int ret;
  size_t num_attrs = 0, *value_lengths = NULL;
  char **names = NULL, **values = NULL;
  if (flag & (1 << 15)) {
    iso_attr_get_acl_text(num_attrs, names, value_lengths, values, st_mode,
                          access_text, default_text, 1 << 15);
    return 1;
  }
  ret = iso_aa_get_attrs(aa_string, &num_attrs, &names, &value_lengths, &values,
                         1);
  if (ret < 0)
    goto ex;
  ret = iso_attr_get_acl_text(num_attrs, names, value_lengths, values, st_mode,
                              access_text, default_text, flag);
ex:;
  iso_aa_get_attrs(aa_string, &num_attrs, &names, &value_lengths, &values,
                   1 << 15);
  return ret;
}


x86 assembly (clang, -O0):
<iso_aa_get_acl_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     11a5 <iso_aa_get_acl_text+0x85>
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%rax
mov    %rax,(%rsp)
movl   $0x8000,0x8(%rsp)
call   1040 <iso_attr_get_acl_text@plt>
movl   $0x1,-0x4(%rbp)
jmp    122a <iso_aa_get_acl_text+0x10a>
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    -0x50(%rbp),%r8
mov    $0x1,%r9d
call   1030 <iso_aa_get_attrs@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    11d6 <iso_aa_get_acl_text+0xb6>
jmp    1205 <iso_aa_get_acl_text+0xe5>
mov    -0x38(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%r10
mov    -0x2c(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <iso_attr_get_acl_text@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    -0x50(%rbp),%r8
mov    $0x8000,%r9d
call   1030 <iso_aa_get_attrs@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_aa_get_acl_text>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%r13d
movq   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
test   $0x8000,%r8d
jne    11d9 <iso_aa_get_acl_text+0xb9>
mov    %r8d,%ebx
mov    %rdi,%r15
lea    0x20(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x1,%r9d
call   1030 <iso_aa_get_attrs@plt>
test   %eax,%eax
js     11b3 <iso_aa_get_acl_text+0x93>
mov    0x20(%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %r13d,%r8d
mov    %r12,%r9
push   %rbx
push   %r14
call   1040 <iso_attr_get_acl_text@plt>
add    $0x10,%rsp
mov    %eax,%ebp
lea    0x20(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %r15,%rdi
mov    $0x8000,%r9d
call   1030 <iso_aa_get_attrs@plt>
jmp    11fc <iso_aa_get_acl_text+0xdc>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
mov    %r12,%r9
push   $0x8000
push   %r14
call   1040 <iso_attr_get_acl_text@plt>
add    $0x10,%rsp
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iso_aa_get_acl_text(i8* %0, i32 %1, i8** %2, i8** %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64*
%15 = alloca i8**
%16 = alloca i8**
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i8** %3, i8*** %10
store i32 %4, i32* %11
store i64 0, i64* %13
store i64* null, i64** %14
store i8** null, i8*** %15
store i8** null, i8*** %16
%17 = load i32, i32* %11
%18 = and i32 %17, 32768
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %5
%21 = load i64, i64* %13
%22 = load i8**, i8*** %15
%23 = load i64*, i64** %14
%24 = load i8**, i8*** %16
%25 = load i32, i32* %8
%26 = load i8**, i8*** %9
%27 = load i8**, i8*** %10
%28 = call i32 @iso_attr_get_acl_text(i64 %21, i8** %22, i64* %23, i8** %24, i32 %25, i8** %26, i8** %27, i32 32768)
store i32 1, i32* %6
br label %49
29: ; preds = %5
%30 = load i8*, i8** %7
%31 = call i32 @iso_aa_get_attrs(i8* %30, i64* %13, i8*** %15, i64** %14, i8*** %16, i32 1)
store i32 %31, i32* %12
%32 = load i32, i32* %12
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %29
br label %45
35: ; preds = %29
%36 = load i64, i64* %13
%37 = load i8**, i8*** %15
%38 = load i64*, i64** %14
%39 = load i8**, i8*** %16
%40 = load i32, i32* %8
%41 = load i8**, i8*** %9
%42 = load i8**, i8*** %10
%43 = load i32, i32* %11
%44 = call i32 @iso_attr_get_acl_text(i64 %36, i8** %37, i64* %38, i8** %39, i32 %40, i8** %41, i8** %42, i32 %43)
store i32 %44, i32* %12
br label %45
45: ; preds = %35, %34
%46 = load i8*, i8** %7
%47 = call i32 @iso_aa_get_attrs(i8* %46, i64* %13, i8*** %15, i64** %14, i8*** %16, i32 32768)
%48 = load i32, i32* %12
store i32 %48, i32* %6
br label %49
49: ; preds = %45, %20
%50 = load i32, i32* %6
ret i32 %50
}

LLVM IR (-O2):
define i32 @iso_aa_get_acl_text(i8* %0, i32 %1, i8** %2, i8** %3, i32 %4) {
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i8**
%9 = alloca i8**
%10 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%11 = bitcast i64** %7 to i8*
store i64* null, i64** %7
%12 = bitcast i8*** %8 to i8*
store i8** null, i8*** %8
%13 = bitcast i8*** %9 to i8*
store i8** null, i8*** %9
%14 = and i32 %4, 32768
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %5
%17 = tail call i32 @iso_attr_get_acl_text(i64 0, i8** null, i64* null, i8** null, i32 %1, i8** %2, i8** %3, i32 32768)
br label %30
18: ; preds = %5
%19 = call i32 @iso_aa_get_attrs(i8* %0, i64* %6, i8*** %8, i64** %7, i8*** %9, i32 1)
%20 = icmp slt i32 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = load i64, i64* %6
%23 = load i8**, i8*** %8
%24 = load i64*, i64** %7
%25 = load i8**, i8*** %9
%26 = call i32 @iso_attr_get_acl_text(i64 %22, i8** %23, i64* %24, i8** %25, i32 %1, i8** %2, i8** %3, i32 %4)
br label %27
27: ; preds = %18, %21
%28 = phi i32 [ %19, %18 ], [ %26, %21 ]
%29 = call i32 @iso_aa_get_attrs(i8* %0, i64* %6, i8*** %8, i64** %7, i8*** %9, i32 32768)
br label %30
30: ; preds = %27, %16
%31 = phi i32 [ 1, %16 ], [ %28, %27 ]
ret i32 %31
}