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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fread(int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ parse_playlist(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ printf(char *, int, ...);
void parse_playlistpointer(FILE *file, uint32_t start, uint32_t pbegin,
                           uint32_t pend) {
  uint16_t count = 0;
  fseek(file, start, SEEK_SET);
  fread(&count, sizeof(count), 1, file);
  printf("\t\t\tPlaylistpointer (0x%X, %d)\n", start, count);
  int i = 0;
  int playerror = 0;
  for (i = 0; i < count; i++) {
    uint32_t pointer;
    fseek(file, start + 2 + i * 4, SEEK_SET);
    fread(&pointer, sizeof(pointer), 1, file);
    if ((pointer < pbegin) || (pointer > pend)) {
      printf("\t\t\t\tPlaylist (0x%X) = PlayError!\n ", pointer);
      playerror = 1;
    } else {
      parse_playlist(file, pointer);
    }
  }
  if (playerror == 1) {
    parse_playlist(file, start);
  }
}


x86 assembly (clang, -O0):
<parse_playlistpointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e76(%rip),%rax
mov    (%rax),%edx
call   1050 <fseek@plt>
mov    -0x8(%rbp),%rcx
lea    -0x18(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1248 <parse_playlistpointer+0x108>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x2,%esi
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
add    %eax,%esi
mov    0x2e0a(%rip),%rax
mov    (%rax),%edx
call   1050 <fseek@plt>
mov    -0x8(%rbp),%rcx
lea    -0x24(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     120c <parse_playlistpointer+0xcc>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1229 <parse_playlistpointer+0xe9>
mov    -0x24(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x20(%rbp)
jmp    1235 <parse_playlistpointer+0xf5>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1060 <parse_playlist@plt>
jmp    123a <parse_playlistpointer+0xfa>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <parse_playlistpointer+0x71>
cmpl   $0x1,-0x20(%rbp)
jne    125e <parse_playlistpointer+0x11e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <parse_playlist@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_playlistpointer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebx
mov    %rdi,%r13
movl   $0x0,0x8(%rsp)
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
call   1050 <fseek@plt>
lea    0x8(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
mov    0x8(%rsp),%ebp
lea    0xe6f(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    123f <parse_playlistpointer+0xff>
mov    %rbx,0x10(%rsp)
add    $0x2,%ebx
xor    %r14d,%r14d
jmp    11dc <parse_playlistpointer+0x9c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r14d
add    $0x4,%ebx
add    $0xffffffff,%ebp
je     121e <parse_playlistpointer+0xde>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    %ebx,%esi
call   1050 <fseek@plt>
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
mov    0xc(%rsp),%esi
cmp    %r12d,%esi
jl     11c0 <parse_playlistpointer+0x80>
cmp    %r15d,%esi
jg     11c0 <parse_playlistpointer+0x80>
mov    %r13,%rdi
call   1060 <parse_playlist@plt>
jmp    11d4 <parse_playlistpointer+0x94>
cmp    $0x1,%r14d
mov    0x10(%rsp),%rsi
jne    123f <parse_playlistpointer+0xff>
mov    %r13,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <parse_playlist@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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