#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*/ mp4tree_box_tfhd_optional_print(int const *, int const *,
                                                   int, int);
int /*<<< orphan*/ printf(char *, char *, int const);
void mp4tree_box_tfhd_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);
  printf("%s  Track ID:   0x%d\n", indent(depth, 0), get_u32(p + 4));
  mp4tree_box_tfhd_optional_print(p + 8, p + len, depth, flags);
}


x86 assembly (clang, -O0):
<mp4tree_box_tfhd_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    $0x4,%rdi
call   1070 <get_u24@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    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%edx
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1050 <get_u32@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <mp4tree_box_tfhd_optional_print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_tfhd_print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x4,%rdi
call   1070 <get_u24@plt>
mov    %eax,%r15d
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    (%rbx),%edx
lea    0xe82(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe7f(%rip),%rdi
mov    %rax,%rsi
mov    %r15d,%edx
call   1040 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <indent@plt>
mov    %rax,%r12
lea    0x10(%rbx),%rdi
call   1050 <get_u32@plt>
lea    0xe71(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    (%rbx,%r14,4),%rsi
add    $0x20,%rbx
mov    %rbx,%rdi
mov    %ebp,%edx
mov    %r15d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <mp4tree_box_tfhd_optional_print@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%s Version: %u\0A\00"
@.str.1 = [25 x i8] c"%s Flags: 0x%.6x\0A\00"
@.str.2 = [22 x i8] c"%s Track ID: 0x%d\0A\00"
define void @mp4tree_box_tfhd_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 1
%10 = call i32 @get_u24(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 @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* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %18, i32 %19)
%21 = load i32, i32* %6
%22 = call i8* @indent(i32 %21, i32 0)
%23 = load i32*, i32** %4
%24 = getelementptr inbounds i32, i32* %23, i64 4
%25 = call i32 @get_u32(i32* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %22, i32 %25)
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 8
%29 = load i32*, i32** %4
%30 = load i64, i64* %5
%31 = getelementptr inbounds i32, i32* %29, i64 %30
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = call i32 @mp4tree_box_tfhd_optional_print(i32* %28, i32* %31, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s Version: %u\0A\00"
@.str.1 = [25 x i8] c"%s Flags: 0x%.6x\0A\00"
@.str.2 = [22 x i8] c"%s Track ID: 0x%d\0A\00"
define void @mp4tree_box_tfhd_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 @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 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %5)
%11 = tail call i8* @indent(i32 %2, i32 0)
%12 = getelementptr inbounds i32, i32* %0, i64 4
%13 = tail call i32 @get_u32(i32* %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %11, i32 %13)
%15 = getelementptr inbounds i32, i32* %0, i64 8
%16 = getelementptr inbounds i32, i32* %0, i64 %1
%17 = tail call i32 @mp4tree_box_tfhd_optional_print(i32* %15, i32* %16, i32 %2, i32 %5)
ret void
}