#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 aaip_decode_acl(unsigned char *, size_t, size_t *, char *, size_t, size_t *,
                    int);
char *calloc(size_t, int);
int /*<<< orphan*/ free(char *);
int iso_decode_acl(unsigned char *v_data, size_t v_len, size_t *consumed,
                   char **text, size_t *text_fill, int flag) {
  int ret;
  *text = NULL;
  ret = aaip_decode_acl(v_data, v_len, consumed, NULL, (size_t)0, text_fill, 1);
  if (ret <= 0)
    return 0;
  if (*text_fill == 0)
    return ret;
  *text = calloc(*text_fill + 42, 1);
  if (*text == NULL)
    return 0xF030FFFA;
  ret =
      aaip_decode_acl(v_data, v_len, consumed, *text, *text_fill, text_fill, 0);
  if (ret <= 0) {
    free(*text);
    *text = NULL;
    return 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<iso_decode_acl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%r9
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
movl   $0x1,(%rsp)
call   1050 <aaip_decode_acl@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jg     1198 <iso_decode_acl+0x68>
movl   $0x0,-0x4(%rbp)
jmp    124c <iso_decode_acl+0x11c>
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11b1 <iso_decode_acl+0x81>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    124c <iso_decode_acl+0x11c>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
add    $0x2a,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11ea <iso_decode_acl+0xba>
movl   $0xf030fffa,-0x4(%rbp)
jmp    124c <iso_decode_acl+0x11c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
mov    -0x30(%rbp),%rax
mov    (%rax),%r8
mov    -0x30(%rbp),%r9
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1050 <aaip_decode_acl@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jg     1246 <iso_decode_acl+0x116>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    124c <iso_decode_acl+0x11c>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_decode_acl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
movq   $0x0,(%rcx)
movl   $0x1,(%rsp)
xor    %ebp,%ebp
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
call   1050 <aaip_decode_acl@plt>
test   %eax,%eax
jle    11c9 <iso_decode_acl+0x99>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     11c0 <iso_decode_acl+0x90>
add    $0x2a,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,(%r14)
test   %rax,%rax
je     11c4 <iso_decode_acl+0x94>
mov    (%rbx),%r8
movl   $0x0,(%rsp)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
mov    %rbx,%r9
call   1050 <aaip_decode_acl@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     11c9 <iso_decode_acl+0x99>
mov    (%r14),%rdi
call   1030 <free@plt>
movq   $0x0,(%r14)
xor    %ebp,%ebp
jmp    11c9 <iso_decode_acl+0x99>
mov    %eax,%ebp
jmp    11c9 <iso_decode_acl+0x99>
mov    $0xf030fffa,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iso_decode_acl(i8* %0, i64 %1, i64* %2, i8** %3, i64* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64*
%11 = alloca i8**
%12 = alloca i64*
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %8
store i64 %1, i64* %9
store i64* %2, i64** %10
store i8** %3, i8*** %11
store i64* %4, i64** %12
store i32 %5, i32* %13
%15 = load i8**, i8*** %11
store i8* null, i8** %15
%16 = load i8*, i8** %8
%17 = load i64, i64* %9
%18 = load i64*, i64** %10
%19 = load i64*, i64** %12
%20 = call i32 @aaip_decode_acl(i8* %16, i64 %17, i64* %18, i8* null, i64 0, i64* %19, i32 1)
store i32 %20, i32* %14
%21 = load i32, i32* %14
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %6
store i32 0, i32* %7
br label %59
24: ; preds = %6
%25 = load i64*, i64** %12
%26 = load i64, i64* %25
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* %14
store i32 %29, i32* %7
br label %59
30: ; preds = %24
%31 = load i64*, i64** %12
%32 = load i64, i64* %31
%33 = add i64 %32, 42
%34 = call i8* @calloc(i64 %33, i32 1)
%35 = load i8**, i8*** %11
store i8* %34, i8** %35
%36 = load i8**, i8*** %11
%37 = load i8*, i8** %36
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %40
39: ; preds = %30
store i32 -265224198, i32* %7
br label %59
40: ; preds = %30
%41 = load i8*, i8** %8
%42 = load i64, i64* %9
%43 = load i64*, i64** %10
%44 = load i8**, i8*** %11
%45 = load i8*, i8** %44
%46 = load i64*, i64** %12
%47 = load i64, i64* %46
%48 = load i64*, i64** %12
%49 = call i32 @aaip_decode_acl(i8* %41, i64 %42, i64* %43, i8* %45, i64 %47, i64* %48, i32 0)
store i32 %49, i32* %14
%50 = load i32, i32* %14
%51 = icmp sle i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %40
%53 = load i8**, i8*** %11
%54 = load i8*, i8** %53
%55 = call i32 @free(i8* %54)
%56 = load i8**, i8*** %11
store i8* null, i8** %56
store i32 0, i32* %7
br label %59
57: ; preds = %40
%58 = load i32, i32* %14
store i32 %58, i32* %7
br label %59
59: ; preds = %57, %52, %39, %28, %23
%60 = load i32, i32* %7
ret i32 %60
}

LLVM IR (-O2):
define i32 @iso_decode_acl(i8* %0, i64 %1, i64* %2, i8** nocapture %3, i64* %4, i32 %5) {
store i8* null, i8** %3
%7 = tail call i32 @aaip_decode_acl(i8* %0, i64 %1, i64* %2, i8* null, i64 0, i64* %4, i32 1)
%8 = icmp slt i32 %7, 1
br i1 %8, label %23, label %9
9: ; preds = %6
%10 = load i64, i64* %4
%11 = icmp eq i64 %10, 0
br i1 %11, label %23, label %12
12: ; preds = %9
%13 = add i64 %10, 42
%14 = tail call i8* @calloc(i64 %13, i32 1)
store i8* %14, i8** %3
%15 = icmp eq i8* %14, null
br i1 %15, label %23, label %16
16: ; preds = %12
%17 = load i64, i64* %4
%18 = tail call i32 @aaip_decode_acl(i8* %0, i64 %1, i64* %2, i8* %14, i64 %17, i64* %4, i32 0)
%19 = icmp slt i32 %18, 1
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i8*, i8** %3
%22 = tail call i32 @free(i8* %21)
store i8* null, i8** %3
br label %23
23: ; preds = %16, %12, %9, %6, %20
%24 = phi i32 [ 0, %20 ], [ 0, %6 ], [ %7, %9 ], [ -265224198, %12 ], [ %18, %16 ]
ret i32 %24
}