#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 /*<<< orphan*/ uint8_t;

/* Variables and functions */
int get_u32(int /*<<< orphan*/ const *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void mp4tree_table_print(const char *name, const char *header, const uint8_t *p,
                         int esize, int width, int num, int depth) {
  int i;
  int j;
  int offset = 0;
  printf("%s  %s:\n", indent(depth, 0), name);
  printf("%s             %s\n", indent(depth, 0), header);
  for (i = 0; i < num; i++) {
    printf("%s      %3d:", indent(depth, 0), i + 1);
    for (j = 0; j < width; j++) {
      printf("   %6u", get_u32(p + offset));
      offset += esize;
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<mp4tree_table_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x30(%rbp)
mov    0x10(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x10(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rdx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1235 <mp4tree_table_print+0x105>
mov    0x10(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x28(%rbp),%edx
add    $0x1,%edx
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1219 <mp4tree_table_print+0xe9>
mov    -0x18(%rbp),%rdi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <get_u32@plt>
mov    %eax,%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11d2 <mp4tree_table_print+0xa2>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119e <mp4tree_table_print+0x6e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_table_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebp
mov    %r8d,0x4(%rsp)
mov    %ecx,%r14d
mov    %rdx,0x10(%rsp)
mov    %rsi,%r15
mov    %rdi,%rbx
mov    0x50(%rsp),%r12d
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe86(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <indent@plt>
lea    0xe71(%rip),%rdi
mov    %rax,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,0x8(%rsp)
test   %ebp,%ebp
jle    1255 <mp4tree_table_print+0x115>
movslq %r14d,%rbx
shl    $0x2,%rbx
lea    0xe6a(%rip),%r12
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    11e6 <mp4tree_table_print+0xa6>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%r13d
cmp    0x8(%rsp),%r13d
je     1255 <mp4tree_table_print+0x115>
mov    0x50(%rsp),%edi
xor    %esi,%esi
call   1060 <indent@plt>
add    $0x1,%r13d
lea    0xe20(%rip),%rdi
mov    %rax,%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%r15d
test   %r15d,%r15d
mov    %r13d,0xc(%rsp)
jle    11d0 <mp4tree_table_print+0x90>
movslq %ebp,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,4),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
call   1050 <get_u32@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %rbx,%r13
add    %r14d,%ebp
add    $0xffffffff,%r15d
jne    1230 <mp4tree_table_print+0xf0>
jmp    11d0 <mp4tree_table_print+0x90>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%s %s:\0A\00"
@.str.1 = [19 x i8] c"%s %s\0A\00"
@.str.2 = [13 x i8] c"%s %3d:\00"
@.str.3 = [7 x i8] c" %6u\00"
define void @mp4tree_table_print(i8* %0, i8* %1, i32* %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i8* @indent(i32 %6, i32 0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %0)
%10 = tail call i8* @indent(i32 %6, i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %1)
%12 = icmp sgt i32 %5, 0
br i1 %12, label %13, label %39
13: ; preds = %7
%14 = icmp sgt i32 %4, 0
%15 = sext i32 %3 to i64
br label %16
16: ; preds = %13, %35
%17 = phi i32 [ 0, %13 ], [ %36, %35 ]
%18 = phi i32 [ 0, %13 ], [ %20, %35 ]
%19 = tail call i8* @indent(i32 %6, i32 0)
%20 = add nuw nsw i32 %18, 1
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %19, i32 %20)
br i1 %14, label %22, label %35
22: ; preds = %16
%23 = sext i32 %17 to i64
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ %23, %22 ], [ %30, %24 ]
%26 = phi i32 [ 0, %22 ], [ %31, %24 ]
%27 = getelementptr inbounds i32, i32* %2, i64 %25
%28 = tail call i32 @get_u32(i32* %27)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = add i64 %25, %15
%31 = add nuw nsw i32 %26, 1
%32 = icmp eq i32 %31, %4
br i1 %32, label %33, label %24
33: ; preds = %24
%34 = trunc i64 %30 to i32
br label %35
35: ; preds = %33, %16
%36 = phi i32 [ %17, %16 ], [ %34, %33 ]
%37 = tail call i32 @putchar(i32 10)
%38 = icmp eq i32 %20, %5
br i1 %38, label %39, label %16
39: ; preds = %35, %7
ret void
}