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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void *audio_stream_info(FILE *f, int len) {
  int orig_pos = ftell(f);
  unsigned char data[len - 8];
  int i;
  len -= 8;
  for (i = 0; i < len; i++)
    fread(&data[i], 1, 1, f);
  printf("  [%d bit", data[19]);
  if (data[17] == 1)
    printf(" mono");
  else
    printf(" %d channels", data[17]);
  printf("]\n");
  fseek(f, orig_pos, SEEK_SET);
}


x86 assembly (clang, -O0):
<audio_stream_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ftell@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xfffffff8,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c9 <audio_stream_info+0x89>
mov    -0x38(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1194 <audio_stream_info+0x54>
mov    -0x38(%rbp),%rax
movzbl 0x13(%rax),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rax
movzbl 0x11(%rax),%eax
cmp    $0x1,%eax
jne    1203 <audio_stream_info+0xc3>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <audio_stream_info+0xd9>
mov    -0x38(%rbp),%rax
movzbl 0x11(%rax),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2dab(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<audio_stream_info>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r15
call   1060 <ftell@plt>
mov    %eax,%r14d
lea    -0x8(%rbx),%r13d
mov    %rsp,%r12
lea    0xf(%r13),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
xor    %esi,%esi
cmp    $0x9,%ebx
jl     11b5 <audio_stream_info+0x65>
mov    %r12,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
add    $0x1,%rbx
add    $0xffffffffffffffff,%r13
jne    1190 <audio_stream_info+0x40>
movzbl 0x13(%r12),%esi
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x11(%r12),%esi
cmp    $0x1,%esi
jne    11de <audio_stream_info+0x8e>
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ec <audio_stream_info+0x9c>
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe2a(%rip),%rdi
call   1030 <puts@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %r14d,%esi
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <fseek@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c" [%d bit\00"
@.str.1 = [6 x i8] c" mono\00"
@.str.2 = [13 x i8] c" %d channels\00"
@SEEK_SET = global i32 0
@str = [2 x i8] c"]\00"
define noalias i8* @audio_stream_info(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @ftell(i32* %0)
%4 = add i32 %1, -8
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = icmp sgt i32 %1, 8
br i1 %7, label %8, label %18
8: ; preds = %2, %8
%9 = phi i64 [ %12, %8 ], [ 0, %2 ]
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = call i32 @fread(i8* %10, i32 1, i32 1, i32* %0)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %8
14: ; preds = %8
%15 = getelementptr inbounds i8, i8* %6, i64 19
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
br label %18
18: ; preds = %14, %2
%19 = phi i32 [ %17, %14 ], [ 0, %2 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds i8, i8* %6, i64 17
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %29
26: ; preds = %18
%27 = zext i8 %22 to i32
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %24
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%31 = load i32, i32* @SEEK_SET
%32 = tail call i32 @fseek(i32* %0, i32 %3, i32 %31)
ret i8* undef
}