#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_u16(int const *);
int get_u32(int const *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int const, ...);
void mp4tree_box_mdhd_print(const uint8_t *p, size_t len, int depth) {
  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  Creation time:      %u\n", indent(depth, 0), get_u32(p + 4));
  printf("%s  Modification time:  %u\n", indent(depth, 0), get_u32(p + 8));
  printf("%s  Time scale:         %u\n", indent(depth, 0), get_u32(p + 12));
  printf("%s  Duration:           %u\n", indent(depth, 0), get_u32(p + 16));
  printf("%s  Language:           %u\n", indent(depth, 0), get_u16(p + 20));
  printf("%s  Quality:            %u\n", indent(depth, 0), get_u16(p + 22));
}


x86 assembly (clang, -O0):
<mp4tree_box_mdhd_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <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    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1040 <get_u32@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
call   1040 <get_u32@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x30,%rdi
call   1040 <get_u32@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xe51(%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    $0x40,%rdi
call   1040 <get_u32@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x50,%rdi
call   1060 <get_u16@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x58,%rdi
call   1060 <get_u16@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_mdhd_print>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rdi,%rbx
mov    %edx,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    (%rbx),%edx
lea    0xea4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%ecx
mov    0xc(%rbx),%r8d
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x10(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe9c(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x20(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe8f(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x30(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe82(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x40(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe75(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x50(%rbx),%rdi
call   1060 <get_u16@plt>
lea    0xe68(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
add    $0x58,%rbx
mov    %rbx,%rdi
call   1060 <get_u16@plt>
lea    0xe58(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"%s Version: %u\0A\00"
@.str.1 = [40 x i8] c"%s Flags: 0x%.2x%.2x%.2x\0A\00"
@.str.2 = [28 x i8] c"%s Creation time: %u\0A\00"
@.str.3 = [28 x i8] c"%s Modification time: %u\0A\00"
@.str.4 = [28 x i8] c"%s Time scale: %u\0A\00"
@.str.5 = [28 x i8] c"%s Duration: %u\0A\00"
@.str.6 = [28 x i8] c"%s Language: %u\0A\00"
@.str.7 = [28 x i8] c"%s Quality: %u\0A\00"
define void @mp4tree_box_mdhd_print(i32* %0, i64 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i32
store i32* %0, i32** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = call i8* @indent(i32 %7, i32 0)
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %11)
%13 = load i32, i32* %6
%14 = call i8* @indent(i32 %13, i32 0)
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i64 3
%23 = load i32, i32* %22
%24 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %17, i32 %20, i32 %23)
%25 = load i32, i32* %6
%26 = call i8* @indent(i32 %25, i32 0)
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 4
%29 = call i32 @get_u32(i32* %28)
%30 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %26, i32 %29)
%31 = load i32, i32* %6
%32 = call i8* @indent(i32 %31, i32 0)
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 8
%35 = call i32 @get_u32(i32* %34)
%36 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %32, i32 %35)
%37 = load i32, i32* %6
%38 = call i8* @indent(i32 %37, i32 0)
%39 = load i32*, i32** %4
%40 = getelementptr inbounds i32, i32* %39, i64 12
%41 = call i32 @get_u32(i32* %40)
%42 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %38, i32 %41)
%43 = load i32, i32* %6
%44 = call i8* @indent(i32 %43, i32 0)
%45 = load i32*, i32** %4
%46 = getelementptr inbounds i32, i32* %45, i64 16
%47 = call i32 @get_u32(i32* %46)
%48 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %44, i32 %47)
%49 = load i32, i32* %6
%50 = call i8* @indent(i32 %49, i32 0)
%51 = load i32*, i32** %4
%52 = getelementptr inbounds i32, i32* %51, i64 20
%53 = call i32 @get_u16(i32* %52)
%54 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %50, i32 %53)
%55 = load i32, i32* %6
%56 = call i8* @indent(i32 %55, i32 0)
%57 = load i32*, i32** %4
%58 = getelementptr inbounds i32, i32* %57, i64 22
%59 = call i32 @get_u16(i32* %58)
%60 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %56, i32 %59)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"%s Version: %u\0A\00"
@.str.1 = [40 x i8] c"%s Flags: 0x%.2x%.2x%.2x\0A\00"
@.str.2 = [28 x i8] c"%s Creation time: %u\0A\00"
@.str.3 = [28 x i8] c"%s Modification time: %u\0A\00"
@.str.4 = [28 x i8] c"%s Time scale: %u\0A\00"
@.str.5 = [28 x i8] c"%s Duration: %u\0A\00"
@.str.6 = [28 x i8] c"%s Language: %u\0A\00"
@.str.7 = [28 x i8] c"%s Quality: %u\0A\00"
define void @mp4tree_box_mdhd_print(i32* %0, i64 %1, i32 %2) {
%4 = tail call i8* @indent(i32 %2, i32 0)
%5 = load i32, i32* %0
%6 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
%7 = tail call i8* @indent(i32 %2, i32 0)
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32 %9, i32 %11, i32 %13)
%15 = tail call i8* @indent(i32 %2, i32 0)
%16 = getelementptr inbounds i32, i32* %0, i64 4
%17 = tail call i32 @get_u32(i32* %16)
%18 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %15, i32 %17)
%19 = tail call i8* @indent(i32 %2, i32 0)
%20 = getelementptr inbounds i32, i32* %0, i64 8
%21 = tail call i32 @get_u32(i32* %20)
%22 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %19, i32 %21)
%23 = tail call i8* @indent(i32 %2, i32 0)
%24 = getelementptr inbounds i32, i32* %0, i64 12
%25 = tail call i32 @get_u32(i32* %24)
%26 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %23, i32 %25)
%27 = tail call i8* @indent(i32 %2, i32 0)
%28 = getelementptr inbounds i32, i32* %0, i64 16
%29 = tail call i32 @get_u32(i32* %28)
%30 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %27, i32 %29)
%31 = tail call i8* @indent(i32 %2, i32 0)
%32 = getelementptr inbounds i32, i32* %0, i64 20
%33 = tail call i32 @get_u16(i32* %32)
%34 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %31, i32 %33)
%35 = tail call i8* @indent(i32 %2, i32 0)
%36 = getelementptr inbounds i32, i32* %0, i64 22
%37 = tail call i32 @get_u16(i32* %36)
%38 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %35, i32 %37)
ret void
}