#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 *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
void mp4tree_box_saiz_print(const uint8_t *p, size_t len, int depth) {
  uint32_t flags = get_u24(p + 1);
  printf("%s  Version:                  %u\n", indent(depth, 0), p[0]);
  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;
  }
  uint8_t default_sample_info_size = p[0];
  uint8_t sample_count = get_u32(p + 1);
  printf("%s  Default Sample Info Size: %u\n", indent(depth, 0),
         default_sample_info_size);
  printf("%s  Sample Count:             %u\n", indent(depth, 0), sample_count);
  p += 5;
  if (default_sample_info_size == 0) {
    int i = 0;
    printf("%s  Sample     Sample Info Size\n", indent(depth, 0));
    for (i = 0; i < sample_count; i++) {
      printf("%s  %3d:           %.2u\n", indent(depth, 0), i, p[i]);
    }
  }
}


x86 assembly (clang, -O0):
<mp4tree_box_saiz_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1060 <get_u24@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%edx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1230 <mp4tree_box_saiz_print+0xf0>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <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    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1040 <get_u32@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1040 <get_u32@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x1c(%rbp),%edx
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x20(%rbp),%edx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    130c <mp4tree_box_saiz_print+0x1cc>
movl   $0x0,-0x24(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1307 <mp4tree_box_saiz_print+0x1c7>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x24(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12c4 <mp4tree_box_saiz_print+0x184>
jmp    130c <mp4tree_box_saiz_print+0x1cc>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_saiz_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r12d
mov    %rdi,%r13
add    $0x4,%rdi
call   1060 <get_u24@plt>
mov    %eax,%r14d
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    0x0(%r13),%edx
lea    0xe8e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
lea    0xe95(%rip),%rdi
mov    %rax,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x1,%r14b
jne    11a6 <mp4tree_box_saiz_print+0x66>
add    $0x10,%r13
jmp    11fe <mp4tree_box_saiz_print+0xbe>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    0x10(%r13),%edx
mov    0x14(%r13),%ecx
mov    0x18(%r13),%r8d
mov    0x1c(%r13),%r9d
lea    0xe81(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x20(%r13),%rdi
call   1040 <get_u32@plt>
lea    0xe82(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x30,%r13
mov    0x0(%r13),%r15d
lea    0x4(%r13),%rdi
call   1040 <get_u32@plt>
mov    %eax,%r14d
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
lea    0xe73(%rip),%rdi
mov    %rax,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
lea    0xe77(%rip),%rdi
mov    %rax,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
test   %r15d,%r15d
jne    12a7 <mp4tree_box_saiz_print+0x167>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
lea    0xe76(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r14d,%r14d
jle    12a7 <mp4tree_box_saiz_print+0x167>
mov    %r14d,%ebx
lea    0xe7e(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    0x14(%r13,%rbp,4),%ecx
mov    %r14,%rdi
mov    %rax,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1280 <mp4tree_box_saiz_print+0x140>
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 = [34 x i8] c"%s Default Sample Info Size: %u\0A\00"
@.str.5 = [34 x i8] c"%s Sample Count: %u\0A\00"
@.str.6 = [33 x i8] c"%s Sample Sample Info Size\0A\00"
@.str.7 = [25 x i8] c"%s %3d: %.2u\0A\00"
define void @mp4tree_box_saiz_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
store i32* %0, i32** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = call i32 @get_u24(i32* %12)
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = call i8* @indent(i32 %14, i32 0)
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %18)
%20 = load i32, i32* %6
%21 = call i8* @indent(i32 %20, i32 0)
%22 = load i32, i32* %7
%23 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %22)
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i64 4
store i32* %25, i32** %4
%26 = load i32, i32* %7
%27 = and i32 %26, 1
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %53
29: ; preds = %3
%30 = load i32, i32* %6
%31 = call i8* @indent(i32 %30, i32 0)
%32 = load i32*, i32** %4
%33 = getelementptr inbounds i32, i32* %32, i64 0
%34 = load i32, i32* %33
%35 = load i32*, i32** %4
%36 = getelementptr inbounds i32, i32* %35, i64 1
%37 = load i32, i32* %36
%38 = load i32*, i32** %4
%39 = getelementptr inbounds i32, i32* %38, i64 2
%40 = load i32, i32* %39
%41 = load i32*, i32** %4
%42 = getelementptr inbounds i32, i32* %41, i64 3
%43 = load i32, i32* %42
%44 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %31, i32 %34, i32 %37, i32 %40, i32 %43)
%45 = load i32, i32* %6
%46 = call i8* @indent(i32 %45, i32 0)
%47 = load i32*, i32** %4
%48 = getelementptr inbounds i32, i32* %47, i64 4
%49 = call i32 @get_u32(i32* %48)
%50 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %46, i32 %49)
%51 = load i32*, i32** %4
%52 = getelementptr inbounds i32, i32* %51, i64 8
store i32* %52, i32** %4
br label %53
53: ; preds = %29, %3
%54 = load i32*, i32** %4
%55 = getelementptr inbounds i32, i32* %54, i64 0
%56 = load i32, i32* %55
store i32 %56, i32* %8
%57 = load i32*, i32** %4
%58 = getelementptr inbounds i32, i32* %57, i64 1
%59 = call i32 @get_u32(i32* %58)
store i32 %59, i32* %9
%60 = load i32, i32* %6
%61 = call i8* @indent(i32 %60, i32 0)
%62 = load i32, i32* %8
%63 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %61, i32 %62)
%64 = load i32, i32* %6
%65 = call i8* @indent(i32 %64, i32 0)
%66 = load i32, i32* %9
%67 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %65, i32 %66)
%68 = load i32*, i32** %4
%69 = getelementptr inbounds i32, i32* %68, i64 5
store i32* %69, i32** %4
%70 = load i32, i32* %8
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %94
72: ; preds = %53
store i32 0, i32* %10
%73 = load i32, i32* %6
%74 = call i8* @indent(i32 %73, i32 0)
%75 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %74)
store i32 0, i32* %10
br label %76
76: ; preds = %90, %72
%77 = load i32, i32* %10
%78 = load i32, i32* %9
%79 = icmp slt i32 %77, %78
br i1 %79, label %80, label %93
80: ; preds = %76
%81 = load i32, i32* %6
%82 = call i8* @indent(i32 %81, i32 0)
%83 = load i32, i32* %10
%84 = load i32*, i32** %4
%85 = load i32, i32* %10
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %84, i64 %86
%88 = load i32, i32* %87
%89 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %82, i32 %83, i32 %88)
br label %90
90: ; preds = %80
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
store i32 %92, i32* %10
br label %76
93: ; preds = %76
br label %94
94: ; preds = %93, %53
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 = [34 x i8] c"%s Default Sample Info Size: %u\0A\00"
@.str.5 = [34 x i8] c"%s Sample Count: %u\0A\00"
@.str.6 = [33 x i8] c"%s Sample Sample Info Size\0A\00"
@.str.7 = [25 x i8] c"%s %3d: %.2u\0A\00"
define void @mp4tree_box_saiz_print(i32* %0, i64 %1, i32 %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = tail call i32 @get_u24(i32* %4)
%6 = tail call i8* @indent(i32 %2, i32 0)
%7 = load i32, i32* %0
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%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 %5)
%11 = getelementptr inbounds i32, i32* %0, i64 4
%12 = and i32 %5, 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 = load i32, i32* %30
%32 = getelementptr inbounds i32, i32* %30, i64 1
%33 = tail call i32 @get_u32(i32* %32)
%34 = tail call i8* @indent(i32 %2, i32 0)
%35 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %34, i32 %31)
%36 = tail call i8* @indent(i32 %2, i32 0)
%37 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %36, i32 %33)
%38 = getelementptr inbounds i32, i32* %30, i64 5
%39 = icmp eq i32 %31, 0
br i1 %39, label %40, label %55
40: ; preds = %29
%41 = tail call i8* @indent(i32 %2, i32 0)
%42 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %41)
%43 = icmp sgt i32 %33, 0
br i1 %43, label %44, label %55
44: ; preds = %40
%45 = zext i32 %33 to i64
br label %46
46: ; preds = %44, %46
%47 = phi i64 [ 0, %44 ], [ %53, %46 ]
%48 = tail call i8* @indent(i32 %2, i32 0)
%49 = getelementptr inbounds i32, i32* %38, i64 %47
%50 = load i32, i32* %49
%51 = trunc i64 %47 to i32
%52 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %48, i32 %51, i32 %50)
%53 = add nuw nsw i64 %47, 1
%54 = icmp eq i64 %53, %45
br i1 %54, label %55, label %46
55: ; preds = %46, %40, %29
ret void
}