#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 uint32_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ id;
typedef int /*<<< orphan*/ count;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
void parse_playlist(FILE *file, uint32_t start) {
  uint16_t count = 0;
  fseek(file, start, SEEK_SET);
  fread(&count, sizeof(count), 1, file);
  printf("\t\t\t\tPlaylist (0x%X, %d) = [ ", start, count);
  int i = 0;
  for (i = 0; i < count; i++) {
    fflush(stdout);
    uint16_t id;
    fseek(file, start + 2 + i * 2, SEEK_SET);
    fread(&id, sizeof(id), 1, file);
    printf("%3d, ", id);
  }
  printf(" ]\n");
}


x86 assembly (clang, -O0):
<parse_playlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    -0x8(%rbp),%rcx
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1214 <parse_playlist+0xd4>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x2,%esi
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    %eax,%esi
mov    0x2e09(%rip),%rax
mov    (%rax),%edx
call   1060 <fseek@plt>
mov    -0x8(%rbp),%rcx
lea    -0x18(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x18(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a4 <parse_playlist+0x64>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_playlist>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movl   $0x0,(%rsp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    (%rsp),%ebp
lea    0xe6c(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
jle    1207 <parse_playlist+0xb7>
add    $0x2,%ebx
mov    0x2e2b(%rip),%r13
lea    0x4(%rsp),%r15
lea    0xe64(%rip),%r12
nopl   0x0(%rax)
mov    0x0(%r13),%edi
call   1060 <fflush@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1070 <fseek@plt>
mov    %r15,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    0x4(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x2,%ebx
add    $0xffffffff,%ebp
jne    11c0 <parse_playlist+0x70>
lea    0xe15(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [29 x i8] c"\09\09\09\09Playlist (0x%X, %d) = [ \00"
@stdout = global i32 0
@.str.1 = [6 x i8] c"%3d, \00"
@.str.2 = [4 x i8] c" ]\0A\00"
define void @parse_playlist(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = load i32, i32* @SEEK_SET
%11 = call i32 @fseek(i32* %8, i32 %9, i32 %10)
%12 = load i32*, i32** %3
%13 = call i32 @fread(i32* %5, i32 4, i32 1, i32* %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
store i32 0, i32* %6
store i32 0, i32* %6
br label %17
17: ; preds = %36, %2
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load i32, i32* @stdout
%23 = call i32 @fflush(i32 %22)
%24 = load i32*, i32** %3
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 2
%27 = load i32, i32* %6
%28 = mul nsw i32 %27, 2
%29 = add nsw i32 %26, %28
%30 = load i32, i32* @SEEK_SET
%31 = call i32 @fseek(i32* %24, i32 %29, i32 %30)
%32 = load i32*, i32** %3
%33 = call i32 @fread(i32* %7, i32 4, i32 1, i32* %32)
%34 = load i32, i32* %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %21
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %17
39: ; preds = %17
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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