#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int get_u24(int const *);
int get_u32(int const *);
scalar_t__ get_u64(int const *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
void mp4tree_box_saio_print(const uint8_t *p, size_t len, int depth) {
  uint8_t version = p[0];
  uint32_t flags = get_u24(p + 1);
  uint8_t entry_count = 0;
  printf("%s  Version:                  %u\n", indent(depth, 0), version);
  printf("%s  Flags:                    0x%.6x\n", indent(depth, 0), flags);
  p += 4;
  if (flags & 1) {
    printf("%s  Aux Info Type:            %c%c%c%c\n", indent(depth, 0), p[0],
           p[1], p[2], p[3]);
    printf("%s  Aux Info Type Parameter:  %u\n", indent(depth, 0),
           get_u32(p + 4));
    p += 8;
  }
  entry_count = get_u32(p);
  p += 4;
  if (version == 0) {
    int i = 0;
    printf("%s  Entry     Offset\n", indent(depth, 0));
    for (i = 0; i < entry_count; i++) {
      printf("%s  %3d:       %u\n", indent(depth, 0), i, get_u32(p));
      p += 4;
    }
  } else {
    int i = 0;
    printf("%s  Entry     Offset\n", indent(depth, 0));
    for (i = 0; i < entry_count; i++) {
      printf("%s  %3d:       %llu\n", indent(depth, 0), i,
             (long long unsigned)get_u64(p));
      p += 8;
    }
  }
}


x86 assembly (clang, -O0):
<mp4tree_box_saio_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1070 <get_u24@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x1c(%rbp),%edx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     124d <mp4tree_box_saio_print+0xfd>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r9d
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1050 <get_u32@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_u32@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    12f7 <mp4tree_box_saio_print+0x1a7>
movl   $0x0,-0x24(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12f2 <mp4tree_box_saio_print+0x1a2>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <get_u32@plt>
mov    -0x40(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    %eax,%ecx
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1298 <mp4tree_box_saio_print+0x148>
jmp    1380 <mp4tree_box_saio_print+0x230>
movl   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    137b <mp4tree_box_saio_print+0x22b>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_u64@plt>
mov    -0x50(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    %rax,%rcx
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1320 <mp4tree_box_saio_print+0x1d0>
jmp    1380 <mp4tree_box_saio_print+0x230>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_saio_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rdi,%r14
mov    (%rdi),%ebx
add    $0x4,%rdi
call   1070 <get_u24@plt>
mov    %eax,%ebp
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe81(%rip),%rdi
mov    %rax,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe86(%rip),%rdi
mov    %rax,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x1,%bpl
jne    11b4 <mp4tree_box_saio_print+0x64>
add    $0x10,%r14
jmp    120c <mp4tree_box_saio_print+0xbc>
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    0x10(%r14),%edx
mov    0x14(%r14),%ecx
mov    0x18(%r14),%r8d
mov    0x1c(%r14),%r9d
lea    0xe73(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rbp
lea    0x20(%r14),%rdi
call   1050 <get_u32@plt>
lea    0xe74(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x30,%r14
mov    %r14,%rdi
call   1050 <get_u32@plt>
mov    %eax,%r12d
add    $0x10,%r14
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe66(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
je     1285 <mp4tree_box_saio_print+0x135>
test   %r12d,%r12d
jle    12d2 <mp4tree_box_saio_print+0x182>
lea    0xe71(%rip),%r13
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <get_u64@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%r14
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1250 <mp4tree_box_saio_print+0x100>
jmp    12d2 <mp4tree_box_saio_print+0x182>
test   %r12d,%r12d
jle    12d2 <mp4tree_box_saio_print+0x182>
lea    0xe17(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%r13
mov    %r14,%rdi
call   1050 <get_u32@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%r14
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    12a0 <mp4tree_box_saio_print+0x150>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"%s Version: %u\0A\00"
@.str.1 = [38 x i8] c"%s Flags: 0x%.6x\0A\00"
@.str.2 = [40 x i8] c"%s Aux Info Type: %c%c%c%c\0A\00"
@.str.3 = [34 x i8] c"%s Aux Info Type Parameter: %u\0A\00"
@.str.4 = [22 x i8] c"%s Entry Offset\0A\00"
@.str.5 = [19 x i8] c"%s %3d: %u\0A\00"
@.str.6 = [21 x i8] c"%s %3d: %llu\0A\00"
define void @mp4tree_box_saio_print(i32* %0, i64 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
store i32 %14, i32* %7
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = call i32 @get_u24(i32* %16)
store i32 %17, i32* %8
store i32 0, i32* %9
%18 = load i32, i32* %6
%19 = call i8* @indent(i32 %18, i32 0)
%20 = load i32, i32* %7
%21 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20)
%22 = load i32, i32* %6
%23 = call i8* @indent(i32 %22, i32 0)
%24 = load i32, i32* %8
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %23, i32 %24)
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 4
store i32* %27, i32** %4
%28 = load i32, i32* %8
%29 = and i32 %28, 1
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %55
31: ; preds = %3
%32 = load i32, i32* %6
%33 = call i8* @indent(i32 %32, i32 0)
%34 = load i32*, i32** %4
%35 = getelementptr inbounds i32, i32* %34, i64 0
%36 = load i32, i32* %35
%37 = load i32*, i32** %4
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %38
%40 = load i32*, i32** %4
%41 = getelementptr inbounds i32, i32* %40, i64 2
%42 = load i32, i32* %41
%43 = load i32*, i32** %4
%44 = getelementptr inbounds i32, i32* %43, i64 3
%45 = load i32, i32* %44
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %33, i32 %36, i32 %39, i32 %42, i32 %45)
%47 = load i32, i32* %6
%48 = call i8* @indent(i32 %47, i32 0)
%49 = load i32*, i32** %4
%50 = getelementptr inbounds i32, i32* %49, i64 4
%51 = call i32 @get_u32(i32* %50)
%52 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %48, i32 %51)
%53 = load i32*, i32** %4
%54 = getelementptr inbounds i32, i32* %53, i64 8
store i32* %54, i32** %4
br label %55
55: ; preds = %31, %3
%56 = load i32*, i32** %4
%57 = call i32 @get_u32(i32* %56)
store i32 %57, i32* %9
%58 = load i32*, i32** %4
%59 = getelementptr inbounds i32, i32* %58, i64 4
store i32* %59, i32** %4
%60 = load i32, i32* %7
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %83
62: ; preds = %55
store i32 0, i32* %10
%63 = load i32, i32* %6
%64 = call i8* @indent(i32 %63, i32 0)
%65 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %64)
store i32 0, i32* %10
br label %66
66: ; preds = %79, %62
%67 = load i32, i32* %10
%68 = load i32, i32* %9
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %82
70: ; preds = %66
%71 = load i32, i32* %6
%72 = call i8* @indent(i32 %71, i32 0)
%73 = load i32, i32* %10
%74 = load i32*, i32** %4
%75 = call i32 @get_u32(i32* %74)
%76 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %72, i32 %73, i32 %75)
%77 = load i32*, i32** %4
%78 = getelementptr inbounds i32, i32* %77, i64 4
store i32* %78, i32** %4
br label %79
79: ; preds = %70
%80 = load i32, i32* %10
%81 = add nsw i32 %80, 1
store i32 %81, i32* %10
br label %66
82: ; preds = %66
br label %104
83: ; preds = %55
store i32 0, i32* %11
%84 = load i32, i32* %6
%85 = call i8* @indent(i32 %84, i32 0)
%86 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %85)
store i32 0, i32* %11
br label %87
87: ; preds = %100, %83
%88 = load i32, i32* %11
%89 = load i32, i32* %9
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %103
91: ; preds = %87
%92 = load i32, i32* %6
%93 = call i8* @indent(i32 %92, i32 0)
%94 = load i32, i32* %11
%95 = load i32*, i32** %4
%96 = call i64 @get_u64(i32* %95)
%97 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %93, i32 %94, i64 %96)
%98 = load i32*, i32** %4
%99 = getelementptr inbounds i32, i32* %98, i64 8
store i32* %99, i32** %4
br label %100
100: ; preds = %91
%101 = load i32, i32* %11
%102 = add nsw i32 %101, 1
store i32 %102, i32* %11
br label %87
103: ; preds = %87
br label %104
104: ; preds = %103, %82
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"%s Version: %u\0A\00"
@.str.1 = [38 x i8] c"%s Flags: 0x%.6x\0A\00"
@.str.2 = [40 x i8] c"%s Aux Info Type: %c%c%c%c\0A\00"
@.str.3 = [34 x i8] c"%s Aux Info Type Parameter: %u\0A\00"
@.str.4 = [22 x i8] c"%s Entry Offset\0A\00"
@.str.5 = [19 x i8] c"%s %3d: %u\0A\00"
@.str.6 = [21 x i8] c"%s %3d: %llu\0A\00"
define void @mp4tree_box_saio_print(i32* %0, i64 %1, i32 %2) {
%4 = load i32, i32* %0
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = tail call i32 @get_u24(i32* %5)
%7 = tail call i8* @indent(i32 %2, i32 0)
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %4)
%9 = tail call i8* @indent(i32 %2, i32 0)
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %6)
%11 = getelementptr inbounds i32, i32* %0, i64 4
%12 = and i32 %6, 1
%13 = icmp eq i32 %12, 0
br i1 %13, label %29, label %14
14: ; preds = %3
%15 = tail call i8* @indent(i32 %2, i32 0)
%16 = load i32, i32* %11
%17 = getelementptr inbounds i32, i32* %0, i64 5
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %0, i64 6
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %0, i64 7
%22 = load i32, i32* %21
%23 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %15, i32 %16, i32 %18, i32 %20, i32 %22)
%24 = tail call i8* @indent(i32 %2, i32 0)
%25 = getelementptr inbounds i32, i32* %0, i64 8
%26 = tail call i32 @get_u32(i32* %25)
%27 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %24, i32 %26)
%28 = getelementptr inbounds i32, i32* %0, i64 12
br label %29
29: ; preds = %14, %3
%30 = phi i32* [ %28, %14 ], [ %11, %3 ]
%31 = tail call i32 @get_u32(i32* %30)
%32 = getelementptr inbounds i32, i32* %30, i64 4
%33 = icmp eq i32 %4, 0
%34 = tail call i8* @indent(i32 %2, i32 0)
%35 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = icmp sgt i32 %31, 0
br i1 %33, label %37, label %47
37: ; preds = %29
br i1 %36, label %38, label %57
38: ; preds = %37, %38
%39 = phi i32 [ %45, %38 ], [ 0, %37 ]
%40 = phi i32* [ %44, %38 ], [ %32, %37 ]
%41 = tail call i8* @indent(i32 %2, i32 0)
%42 = tail call i32 @get_u32(i32* %40)
%43 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %41, i32 %39, i32 %42)
%44 = getelementptr inbounds i32, i32* %40, i64 4
%45 = add nuw nsw i32 %39, 1
%46 = icmp eq i32 %45, %31
br i1 %46, label %57, label %38
47: ; preds = %29
br i1 %36, label %48, label %57
48: ; preds = %47, %48
%49 = phi i32 [ %55, %48 ], [ 0, %47 ]
%50 = phi i32* [ %54, %48 ], [ %32, %47 ]
%51 = tail call i8* @indent(i32 %2, i32 0)
%52 = tail call i64 @get_u64(i32* %50)
%53 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %51, i32 %49, i64 %52)
%54 = getelementptr inbounds i32, i32* %50, i64 8
%55 = add nuw nsw i32 %49, 1
%56 = icmp eq i32 %55, %31
br i1 %56, label %57, label %48
57: ; preds = %48, %38, %47, %37
ret void
}