#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 *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
void mp4tree_box_vmhd_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  Graphic mode: %u\n", indent(depth, 0), get_u16(p + 4));
  printf("%s  Opcolor       TODO\n", indent(depth, 0));
}


x86 assembly (clang, -O0):
<mp4tree_box_vmhd_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1040 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1040 <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    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1040 <indent@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1050 <get_u16@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1040 <indent@plt>
mov    %rax,%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_vmhd_print>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %edx,%edi
xor    %esi,%esi
call   1040 <indent@plt>
mov    (%rbx),%edx
lea    0xeb5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <indent@plt>
mov    0x4(%rbx),%edx
mov    0x8(%rbx),%ecx
mov    0xc(%rbx),%r8d
lea    0xea7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <indent@plt>
mov    %rax,%r14
add    $0x10,%rbx
mov    %rbx,%rdi
call   1050 <get_u16@plt>
lea    0xea0(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <indent@plt>
lea    0xe9a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%s Version: %u\0A\00"
@.str.1 = [34 x i8] c"%s Flags: 0x%.2x%.2x%.2x\0A\00"
@.str.2 = [22 x i8] c"%s Graphic mode: %u\0A\00"
@.str.3 = [24 x i8] c"%s Opcolor TODO\0A\00"
define void @mp4tree_box_vmhd_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*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 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*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 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_u16(i32* %28)
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 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 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s Version: %u\0A\00"
@.str.1 = [34 x i8] c"%s Flags: 0x%.2x%.2x%.2x\0A\00"
@.str.2 = [22 x i8] c"%s Graphic mode: %u\0A\00"
@.str.3 = [24 x i8] c"%s Opcolor TODO\0A\00"
define void @mp4tree_box_vmhd_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*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 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*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 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_u16(i32* %16)
%18 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %15, i32 %17)
%19 = tail call i8* @indent(i32 %2, i32 0)
%20 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %19)
ret void
}