#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*/ printf(char *, char *, int const, ...);
void mp4tree_box_ftyp_print(const uint8_t *p, size_t len, int depth) {
  const uint8_t *pp;
  printf("%s  Major brand:   %c%c%c%c\n", indent(depth, 0), p[0], p[1], p[2],
         p[3]);
  printf("%s  Minor version: %u\n", indent(depth, 0), get_u32(p + 4));
  for (pp = p + 8; pp < p + len; pp += 4) {
    printf("%s  Compability brand: %c%c%c%c\n", indent(depth, 0), pp[0], pp[1],
           pp[2], pp[3]);
  }
}


x86 assembly (clang, -O0):
<mp4tree_box_ftyp_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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
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    0xe8c(%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    $0x10,%rdi
call   1040 <get_u32@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    121b <mp4tree_box_ftyp_print+0xeb>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%r9d
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x20(%rbp)
jmp    11b6 <mp4tree_box_ftyp_print+0x86>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_ftyp_print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %edx,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    (%rbx),%edx
mov    0x4(%rbx),%ecx
mov    0x8(%rbx),%r8d
mov    0xc(%rbx),%r9d
lea    0xea2(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%r15
lea    0x10(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe98(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x9,%r14
jl     11dd <mp4tree_box_ftyp_print+0xad>
lea    (%rbx,%r14,4),%rbp
add    $0x20,%rbx
lea    0xe8e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    (%rbx),%edx
mov    0x4(%rbx),%ecx
mov    0x8(%rbx),%r8d
mov    0xc(%rbx),%r9d
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rbx
cmp    %rbp,%rbx
jb     11b0 <mp4tree_box_ftyp_print+0x80>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"%s Major brand: %c%c%c%c\0A\00"
@.str.1 = [23 x i8] c"%s Minor version: %u\0A\00"
@.str.2 = [33 x i8] c"%s Compability brand: %c%c%c%c\0A\00"
define void @mp4tree_box_ftyp_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* %6
%9 = call i8* @indent(i32 %8, i32 0)
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 2
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 3
%21 = load i32, i32* %20
%22 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %12, i32 %15, i32 %18, i32 %21)
%23 = load i32, i32* %6
%24 = call i8* @indent(i32 %23, i32 0)
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 4
%27 = call i32 @get_u32(i32* %26)
%28 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %27)
%29 = load i32*, i32** %4
%30 = getelementptr inbounds i32, i32* %29, i64 8
store i32* %30, i32** %7
br label %31
31: ; preds = %53, %3
%32 = load i32*, i32** %7
%33 = load i32*, i32** %4
%34 = load i64, i64* %5
%35 = getelementptr inbounds i32, i32* %33, i64 %34
%36 = icmp ult i32* %32, %35
br i1 %36, label %37, label %56
37: ; preds = %31
%38 = load i32, i32* %6
%39 = call i8* @indent(i32 %38, i32 0)
%40 = load i32*, i32** %7
%41 = getelementptr inbounds i32, i32* %40, i64 0
%42 = load i32, i32* %41
%43 = load i32*, i32** %7
%44 = getelementptr inbounds i32, i32* %43, i64 1
%45 = load i32, i32* %44
%46 = load i32*, i32** %7
%47 = getelementptr inbounds i32, i32* %46, i64 2
%48 = load i32, i32* %47
%49 = load i32*, i32** %7
%50 = getelementptr inbounds i32, i32* %49, i64 3
%51 = load i32, i32* %50
%52 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %39, i32 %42, i32 %45, i32 %48, i32 %51)
br label %53
53: ; preds = %37
%54 = load i32*, i32** %7
%55 = getelementptr inbounds i32, i32* %54, i64 4
store i32* %55, i32** %7
br label %31
56: ; preds = %31
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%s Major brand: %c%c%c%c\0A\00"
@.str.1 = [23 x i8] c"%s Minor version: %u\0A\00"
@.str.2 = [33 x i8] c"%s Compability brand: %c%c%c%c\0A\00"
define void @mp4tree_box_ftyp_print(i32* %0, i64 %1, i32 %2) {
%4 = tail call i8* @indent(i32 %2, i32 0)
%5 = load i32, i32* %0
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5, i32 %7, i32 %9, i32 %11)
%13 = tail call i8* @indent(i32 %2, i32 0)
%14 = getelementptr inbounds i32, i32* %0, i64 4
%15 = tail call i32 @get_u32(i32* %14)
%16 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 %15)
%17 = getelementptr inbounds i32, i32* %0, i64 %1
%18 = icmp sgt i64 %1, 8
br i1 %18, label %19, label %34
19: ; preds = %3
%20 = getelementptr inbounds i32, i32* %0, i64 8
br label %21
21: ; preds = %19, %21
%22 = phi i32* [ %32, %21 ], [ %20, %19 ]
%23 = tail call i8* @indent(i32 %2, i32 0)
%24 = load i32, i32* %22
%25 = getelementptr inbounds i32, i32* %22, i64 1
%26 = load i32, i32* %25
%27 = getelementptr inbounds i32, i32* %22, i64 2
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %22, i64 3
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %23, i32 %24, i32 %26, i32 %28, i32 %30)
%32 = getelementptr inbounds i32, i32* %22, i64 4
%33 = icmp ult i32* %32, %17
br i1 %33, label %21, label %34
34: ; preds = %21, %3
ret void
}