#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 uint16_t;

/* Variables and functions */
int get_u16(int const *);
int get_u32(int const *);
char *indent(int, int /*<<< orphan*/);
int /*<<< orphan*/ mp4tree_print(int const *, size_t, int);
int /*<<< orphan*/ printf(char *, char *, int const, ...);
void mp4tree_box_stsd_sample_audio_print(const uint8_t *p, size_t len,
                                         int depth) {
  printf("%s  Reserved:             %.2x%.2x%.2x%.2x%.2x%.2x\n",
         indent(depth, 0), p[0], p[1], p[2], p[3], p[4], p[5]);
  printf("%s  Data reference index: %u\n", indent(depth, 0), get_u16(p + 6));
  p += 8;
  uint16_t version = get_u16(p);
  printf("%s  Version:              %u\n", indent(depth, 0), version);
  printf("%s  Revision level:       %u\n", indent(depth, 0), get_u16(p + 2));
  printf("%s  Vendor:               %x\n", indent(depth, 0), get_u32(p + 4));
  printf("%s  Number of Channels:   %u\n", indent(depth, 0), get_u16(p + 8));
  printf("%s  Sample Size:          %u\n", indent(depth, 0), get_u16(p + 10));
  printf("%s  Compression ID:       %u\n", indent(depth, 0), get_u16(p + 12));
  printf("%s  Packet Size:          %u\n", indent(depth, 0), get_u16(p + 14));
  printf("%s  Sample Rate:          %u\n", indent(depth, 0), get_u32(p + 16));
  if (version == 0) {
    mp4tree_print(p + 20, len - 28, depth);
  }
}


x86 assembly (clang, -O0):
<mp4tree_box_stsd_sample_audio_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe5d(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x18,%rdi
call   1070 <get_u16@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <get_u16@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%edx
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
call   1070 <get_u16@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0xe31(%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    0xe20(%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   1070 <get_u16@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
lea    0xe0f(%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    $0x28,%rdi
call   1070 <get_u16@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xdfe(%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    $0x30,%rdi
call   1070 <get_u16@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xded(%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    $0x38,%rdi
call   1070 <get_u16@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xddc(%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    $0x40,%rdi
call   1040 <get_u32@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1382 <mp4tree_box_stsd_sample_audio_print+0x232>
mov    -0x8(%rbp),%rdi
add    $0x50,%rdi
mov    -0x10(%rbp),%rsi
sub    $0x1c,%rsi
mov    -0x14(%rbp),%edx
call   1060 <mp4tree_print@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp4tree_box_stsd_sample_audio_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
mov    0x10(%rbx),%r10d
mov    0x14(%rbx),%ebp
lea    0xe7b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
push   %rbp
push   %r10
call   1030 <printf@plt>
add    $0x10,%rsp
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x18(%rbx),%rdi
call   1070 <get_u16@plt>
lea    0xe81(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x20(%rbx),%rdi
call   1070 <get_u16@plt>
mov    %eax,%r15d
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
lea    0xe76(%rip),%rdi
mov    %rax,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x28(%rbx),%rdi
call   1070 <get_u16@plt>
lea    0xe6a(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x30(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe5f(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x40(%rbx),%rdi
call   1070 <get_u16@plt>
lea    0xe54(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x48(%rbx),%rdi
call   1070 <get_u16@plt>
lea    0xe49(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x50(%rbx),%rdi
call   1070 <get_u16@plt>
lea    0xe3e(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x58(%rbx),%rdi
call   1070 <get_u16@plt>
lea    0xe33(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <indent@plt>
mov    %rax,%rbp
lea    0x60(%rbx),%rdi
call   1040 <get_u32@plt>
lea    0xe28(%rip),%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
test   %r15d,%r15d
je     1316 <mp4tree_box_stsd_sample_audio_print+0x1c6>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x70,%rbx
add    $0xffffffffffffffe4,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <mp4tree_print@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"%s Reserved: %.2x%.2x%.2x%.2x%.2x%.2x\0A\00"
@.str.1 = [30 x i8] c"%s Data reference index: %u\0A\00"
@.str.2 = [30 x i8] c"%s Version: %u\0A\00"
@.str.3 = [30 x i8] c"%s Revision level: %u\0A\00"
@.str.4 = [30 x i8] c"%s Vendor: %x\0A\00"
@.str.5 = [30 x i8] c"%s Number of Channels: %u\0A\00"
@.str.6 = [30 x i8] c"%s Sample Size: %u\0A\00"
@.str.7 = [30 x i8] c"%s Compression ID: %u\0A\00"
@.str.8 = [30 x i8] c"%s Packet Size: %u\0A\00"
@.str.9 = [30 x i8] c"%s Sample Rate: %u\0A\00"
define void @mp4tree_box_stsd_sample_audio_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 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 4
%24 = load i32, i32* %23
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 5
%27 = load i32, i32* %26
%28 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %12, i32 %15, i32 %18, i32 %21, i32 %24, i32 %27)
%29 = load i32, i32* %6
%30 = call i8* @indent(i32 %29, i32 0)
%31 = load i32*, i32** %4
%32 = getelementptr inbounds i32, i32* %31, i64 6
%33 = call i32 @get_u16(i32* %32)
%34 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %30, i32 %33)
%35 = load i32*, i32** %4
%36 = getelementptr inbounds i32, i32* %35, i64 8
store i32* %36, i32** %4
%37 = load i32*, i32** %4
%38 = call i32 @get_u16(i32* %37)
store i32 %38, i32* %7
%39 = load i32, i32* %6
%40 = call i8* @indent(i32 %39, i32 0)
%41 = load i32, i32* %7
%42 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %40, 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 2
%47 = call i32 @get_u16(i32* %46)
%48 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, 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 4
%53 = call i32 @get_u32(i32* %52)
%54 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, 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 8
%59 = call i32 @get_u16(i32* %58)
%60 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %56, i32 %59)
%61 = load i32, i32* %6
%62 = call i8* @indent(i32 %61, i32 0)
%63 = load i32*, i32** %4
%64 = getelementptr inbounds i32, i32* %63, i64 10
%65 = call i32 @get_u16(i32* %64)
%66 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* %62, i32 %65)
%67 = load i32, i32* %6
%68 = call i8* @indent(i32 %67, i32 0)
%69 = load i32*, i32** %4
%70 = getelementptr inbounds i32, i32* %69, i64 12
%71 = call i32 @get_u16(i32* %70)
%72 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %68, i32 %71)
%73 = load i32, i32* %6
%74 = call i8* @indent(i32 %73, i32 0)
%75 = load i32*, i32** %4
%76 = getelementptr inbounds i32, i32* %75, i64 14
%77 = call i32 @get_u16(i32* %76)
%78 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %74, i32 %77)
%79 = load i32, i32* %6
%80 = call i8* @indent(i32 %79, i32 0)
%81 = load i32*, i32** %4
%82 = getelementptr inbounds i32, i32* %81, i64 16
%83 = call i32 @get_u32(i32* %82)
%84 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8* %80, i32 %83)
%85 = load i32, i32* %7
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %94
87: ; preds = %3
%88 = load i32*, i32** %4
%89 = getelementptr inbounds i32, i32* %88, i64 20
%90 = load i64, i64* %5
%91 = sub i64 %90, 28
%92 = load i32, i32* %6
%93 = call i32 @mp4tree_print(i32* %89, i64 %91, i32 %92)
br label %94
94: ; preds = %87, %3
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"%s Reserved: %.2x%.2x%.2x%.2x%.2x%.2x\0A\00"
@.str.1 = [30 x i8] c"%s Data reference index: %u\0A\00"
@.str.2 = [30 x i8] c"%s Version: %u\0A\00"
@.str.3 = [30 x i8] c"%s Revision level: %u\0A\00"
@.str.4 = [30 x i8] c"%s Vendor: %x\0A\00"
@.str.5 = [30 x i8] c"%s Number of Channels: %u\0A\00"
@.str.6 = [30 x i8] c"%s Sample Size: %u\0A\00"
@.str.7 = [30 x i8] c"%s Compression ID: %u\0A\00"
@.str.8 = [30 x i8] c"%s Packet Size: %u\0A\00"
@.str.9 = [30 x i8] c"%s Sample Rate: %u\0A\00"
define void @mp4tree_box_stsd_sample_audio_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 = getelementptr inbounds i32, i32* %0, i64 4
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %0, i64 5
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5, i32 %7, i32 %9, i32 %11, i32 %13, i32 %15)
%17 = tail call i8* @indent(i32 %2, i32 0)
%18 = getelementptr inbounds i32, i32* %0, i64 6
%19 = tail call i32 @get_u16(i32* %18)
%20 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %19)
%21 = getelementptr inbounds i32, i32* %0, i64 8
%22 = tail call i32 @get_u16(i32* %21)
%23 = tail call i8* @indent(i32 %2, i32 0)
%24 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %23, i32 %22)
%25 = tail call i8* @indent(i32 %2, i32 0)
%26 = getelementptr inbounds i32, i32* %0, i64 10
%27 = tail call i32 @get_u16(i32* %26)
%28 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %25, i32 %27)
%29 = tail call i8* @indent(i32 %2, i32 0)
%30 = getelementptr inbounds i32, i32* %0, i64 12
%31 = tail call i32 @get_u32(i32* %30)
%32 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %29, i32 %31)
%33 = tail call i8* @indent(i32 %2, i32 0)
%34 = getelementptr inbounds i32, i32* %0, i64 16
%35 = tail call i32 @get_u16(i32* %34)
%36 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %33, i32 %35)
%37 = tail call i8* @indent(i32 %2, i32 0)
%38 = getelementptr inbounds i32, i32* %0, i64 18
%39 = tail call i32 @get_u16(i32* %38)
%40 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* %37, i32 %39)
%41 = tail call i8* @indent(i32 %2, i32 0)
%42 = getelementptr inbounds i32, i32* %0, i64 20
%43 = tail call i32 @get_u16(i32* %42)
%44 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %41, i32 %43)
%45 = tail call i8* @indent(i32 %2, i32 0)
%46 = getelementptr inbounds i32, i32* %0, i64 22
%47 = tail call i32 @get_u16(i32* %46)
%48 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %45, i32 %47)
%49 = tail call i8* @indent(i32 %2, i32 0)
%50 = getelementptr inbounds i32, i32* %0, i64 24
%51 = tail call i32 @get_u32(i32* %50)
%52 = tail call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8* %49, i32 %51)
%53 = icmp eq i32 %22, 0
br i1 %53, label %54, label %58
54: ; preds = %3
%55 = getelementptr inbounds i32, i32* %0, i64 28
%56 = add i64 %1, -28
%57 = tail call i32 @mp4tree_print(i32* %55, i64 %56, i32 %2)
br label %58
58: ; preds = %54, %3
ret void
}