#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;

/* Variables and functions */
int get_u32(int const *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ mp4tree_table_print(char *, char *, int const *, int, int,
                                       int const, int);
int /*<<< orphan*/ printf(char *, char *, int const, ...);
void mp4tree_box_stco_print(const uint8_t *p, size_t len, int depth) {
  const int num = get_u32(p + 4);
  printf("%s  Version:     %u\n", indent(depth, 0), p[0]);
  printf("%s  Flags:       0x%.2x%.2x%.2x\n", indent(depth, 0), p[1], p[2],
         p[3]);
  printf("%s  Num Entries: %u\n", indent(depth, 0), num);
  mp4tree_table_print("Sample size table", "Size", p + 8, 4, 1, num, depth);
}


x86 assembly (clang, -O0):
<mp4tree_box_stco_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1050 <get_u32@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r8d
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%edx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdx
add    $0x20,%rdx
mov    -0x18(%rbp),%r9d
mov    -0x14(%rbp),%eax
lea    0xe62(%rip),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x4,%ecx
mov    $0x1,%r8d
mov    %eax,(%rsp)
call   1030 <mp4tree_table_print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_stco_print>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebp
mov    %rdi,%rbx
add    $0x10,%rdi
call   1050 <get_u32@plt>
mov    %eax,%r14d
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    (%rbx),%edx
lea    0xe95(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%ecx
mov    0xc(%rbx),%r8d
lea    0xe86(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe8d(%rip),%rdi
mov    %rax,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x20,%rbx
mov    %ebp,(%rsp)
lea    0xe87(%rip),%rdi
lea    0xe92(%rip),%rsi
mov    %rbx,%rdx
mov    $0x4,%ecx
mov    $0x1,%r8d
mov    %r14d,%r9d
call   1030 <mp4tree_table_print@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"%s Version: %u\0A\00"
@.str.1 = [33 x i8] c"%s Flags: 0x%.2x%.2x%.2x\0A\00"
@.str.2 = [21 x i8] c"%s Num Entries: %u\0A\00"
@.str.3 = [18 x i8] c"Sample size table\00"
@.str.4 = [5 x i8] c"Size\00"
define void @mp4tree_box_stco_print(i32* %0, i64 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 4
%10 = call i32 @get_u32(i32* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %6
%12 = call i8* @indent(i32 %11, i32 0)
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %15)
%17 = load i32, i32* %6
%18 = call i8* @indent(i32 %17, i32 0)
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* %20
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 2
%24 = load i32, i32* %23
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 3
%27 = load i32, i32* %26
%28 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %18, i32 %21, i32 %24, i32 %27)
%29 = load i32, i32* %6
%30 = call i8* @indent(i32 %29, i32 0)
%31 = load i32, i32* %7
%32 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %30, i32 %31)
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 8
%35 = load i32, i32* %7
%36 = load i32, i32* %6
%37 = call i32 @mp4tree_table_print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %34, i32 4, i32 1, i32 %35, i32 %36)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s Version: %u\0A\00"
@.str.1 = [33 x i8] c"%s Flags: 0x%.2x%.2x%.2x\0A\00"
@.str.2 = [21 x i8] c"%s Num Entries: %u\0A\00"
@.str.3 = [18 x i8] c"Sample size table\00"
@.str.4 = [5 x i8] c"Size\00"
define void @mp4tree_box_stco_print(i32* %0, i64 %1, i32 %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 4
%5 = tail call i32 @get_u32(i32* %4)
%6 = tail call i8* @indent(i32 %2, i32 0)
%7 = load i32, i32* %0
%8 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%9 = tail call i8* @indent(i32 %2, i32 0)
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %0, i64 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %11, i32 %13, i32 %15)
%17 = tail call i8* @indent(i32 %2, i32 0)
%18 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %17, i32 %5)
%19 = getelementptr inbounds i32, i32* %0, i64 8
%20 = tail call i32 @mp4tree_table_print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %19, i32 4, i32 1, i32 %5, i32 %2)
ret void
}