#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ realloc(char *, int);
char *strstr(char *, char *);
int parse(char *fileName, char **songs, char **playcounts, int *number) {
  printf("%s\n", "In Parse");
  FILE *xml = fopen(fileName, "r+");
  int xmlLength = 1000;
  int readLength = 0;
  char *buffer = (char *)calloc(1, 501);
  char *xmlContent = (char *)calloc(1, xmlLength);
  if (buffer == NULL || xmlContent == NULL) {
    printf("Insufficient memory to read XML!\n");
    return -1;
  }
  int n = -1;
  while ((n = fread(buffer, 1, 501, xml)) > 0) {
    if (readLength + n > xmlLength) {
      xmlLength *= 2;
      xmlContent = (char *)realloc(xmlContent, xmlLength);
    }
    memcpy(xmlContent + readLength, buffer, n);
    readLength += n;
    memset(buffer, 0, 501);
  }
  xmlContent[readLength] = '\0';
  char *xmlPtr = xmlContent;
  while (*xmlPtr != '\0') {
    if (strstr(xmlPtr, "<key>Name</key>") == NULL) {
      break;
    } else {
      xmlPtr = strstr(xmlPtr, "<key>Name</key>");
    }
    if (strstr(xmlPtr, "string") == NULL) {
      break;
    } else {
      xmlPtr = strstr(xmlPtr, "string");
    }
    char *closedict = strstr(xmlPtr, "</dict>");
    int j = closedict - xmlPtr;
    char *tempstr = malloc(j);
    memcpy(tempstr, xmlPtr, j);
    if (strstr(tempstr, "MPEG audio file") == NULL) {
      free(tempstr);
      continue;
    }
    xmlPtr += 7;
    int i = 0;
    while (xmlPtr[i] != '<')
      i++;
    i += 1;
    *(songs) = (char *)malloc(i);
    memcpy(*songs, xmlPtr, i - 1);
    (*songs)[i - 1] = '\0';
    *number += 1;
    songs++;
    char *zeroPlays = "0\0";
    if (strstr(tempstr, "<key>Play Count</key>") == NULL) {
      *(playcounts) = (char *)malloc(sizeof(char) * 2);
      memcpy(*playcounts, zeroPlays, sizeof(char) * 2);
      playcounts++;
    } else {
      xmlPtr = strstr(xmlPtr, "<key>Play Count</key>");
      xmlPtr = strstr(xmlPtr, "integer");
      xmlPtr += 8;
      int k = 0;
      while (xmlPtr[k] != '<')
        k++;
      k += 1;
      *(playcounts) = (char *)malloc(k);
      memcpy(*playcounts, xmlPtr, k - 1);
      (*playcounts)[k - 1] = '\0';
      playcounts++;
    }
    free(tempstr);
  }
  *songs = '\0';
  *playcounts = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    0xe3e(%rip),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x30(%rbp)
movl   $0x3e8,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    $0x1,%edi
mov    $0x1f5,%esi
call   1070 <calloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%esi
mov    $0x1,%edi
call   1070 <calloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     122c <parse+0x8c>
cmpq   $0x0,-0x48(%rbp)
jne    1246 <parse+0xa6>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15a3 <parse+0x403>
movl   $0xffffffff,-0x4c(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
mov    $0x1f5,%edx
call   1040 <fread@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
jle    12cd <parse+0x12d>
mov    -0x38(%rbp),%eax
add    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jle    1298 <parse+0xf8>
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   10a0 <realloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x40(%rbp),%rsi
mov    -0x4c(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x4c(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x1f5,%edx
call   1060 <memset@plt>
jmp    124d <parse+0xad>
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1586 <parse+0x3e6>
mov    -0x58(%rbp),%rdi
lea    0xd36(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
jne    1310 <parse+0x170>
jmp    1586 <parse+0x3e6>
mov    -0x58(%rbp),%rdi
lea    0xd17(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xd13(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
jne    1343 <parse+0x1a3>
jmp    1586 <parse+0x3e6>
mov    -0x58(%rbp),%rdi
lea    0xcf4(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xce7(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    -0x58(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x64(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x70(%rbp),%rdi
lea    0xcb1(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
jne    13bd <parse+0x21d>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
jmp    12e1 <parse+0x141>
mov    -0x58(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x58(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3c,%eax
je     13f3 <parse+0x253>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    13d0 <parse+0x230>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x74(%rbp),%edx
sub    $0x1,%edx
call   1080 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
lea    0xc29(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    -0x70(%rbp),%rdi
lea    0xbfc(%rip),%rsi
call   10c0 <strstr@plt>
cmp    $0x0,%rax
jne    14ae <parse+0x30e>
mov    $0x2,%edi
call   1090 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x80(%rbp),%rsi
mov    $0x2,%edx
call   1080 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    1578 <parse+0x3d8>
mov    -0x58(%rbp),%rdi
lea    0xba8(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
lea    0xbaa(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x58(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3c,%eax
je     1518 <parse+0x378>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    14ec <parse+0x34c>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x84(%rbp),%edx
sub    $0x1,%edx
call   1080 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
jmp    12e1 <parse+0x141>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,0x20(%rsp)
mov    %rdx,%r14
mov    %rsi,0x10(%rsp)
mov    %rdi,%rbx
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
mov    %rax,0x18(%rsp)
mov    $0x1,%edi
mov    $0x1f5,%esi
call   1070 <calloc@plt>
mov    %rax,%rbp
mov    $0x1,%edi
mov    $0x3e8,%esi
call   1070 <calloc@plt>
test   %rbp,%rbp
je     12ad <parse+0x10d>
mov    %rax,%rbx
test   %rax,%rax
je     12ad <parse+0x10d>
mov    %r14,0x8(%rsp)
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1f5,%edx
mov    0x18(%rsp),%rcx
call   1050 <fread@plt>
xor    %r12d,%r12d
test   %eax,%eax
jle    12c6 <parse+0x126>
mov    %eax,%r14d
mov    $0x3e8,%r15d
jmp    1291 <parse+0xf1>
cs nopw 0x0(%rax,%rax,1)
movslq %r12d,%rdi
add    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1080 <memcpy@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x1f5,%edx
call   1060 <memset@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1f5,%edx
mov    0x18(%rsp),%rcx
call   1050 <fread@plt>
mov    %eax,%r14d
mov    %r13d,%r12d
test   %eax,%eax
jle    12c3 <parse+0x123>
lea    (%r14,%r12,1),%r13d
cmp    %r15d,%r13d
jle    1250 <parse+0xb0>
add    %r15d,%r15d
mov    %rbx,%rdi
mov    %r15d,%esi
call   10a0 <realloc@plt>
mov    %rax,%rbx
jmp    1250 <parse+0xb0>
lea    0xda5(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    14a0 <parse+0x300>
movslq %r13d,%r12
movb   $0x0,(%rbx,%r12,1)
cmpb   $0x0,(%rbx)
je     1485 <parse+0x2e5>
lea    0xd60(%rip),%r13
mov    0x8(%rsp),%r12
jmp    1332 <parse+0x192>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2,%edi
call   1090 <malloc@plt>
mov    0x8(%rsp),%r12
mov    %rax,(%r12)
mov    %rax,%rdi
lea    0xd6d(%rip),%rsi
mov    $0x2,%edx
call   1080 <memcpy@plt>
addq   $0x8,0x10(%rsp)
add    $0x8,%r12
mov    %r14,%rdi
call   1030 <free@plt>
cmpb   $0x0,(%rbx)
je     148a <parse+0x2ea>
mov    %rbx,%rdi
lea    0xcd0(%rip),%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     148a <parse+0x2ea>
mov    %rax,%rdi
lea    0xcc8(%rip),%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     148a <parse+0x2ea>
mov    %rax,%rbx
mov    %rax,%rdi
lea    0xcb4(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,%rbp
sub    %ebx,%ebp
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1080 <memcpy@plt>
mov    %r14,%rdi
lea    0xc91(%rip),%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     1321 <parse+0x181>
mov    %r12,0x8(%rsp)
mov    %r13,%r12
add    $0x7,%rbx
mov    $0xffffffffffffffff,%rbp
nopl   0x0(%rax,%rax,1)
cmpb   $0x3c,0x1(%rbx,%rbp,1)
lea    0x1(%rbp),%rbp
jne    13c0 <parse+0x220>
mov    %ebp,%r15d
lea    0x1(%rbp),%edi
call   1090 <malloc@plt>
mov    0x10(%rsp),%r13
mov    %rax,0x0(%r13)
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1080 <memcpy@plt>
mov    0x0(%r13),%rax
movb   $0x0,(%rax,%r15,1)
mov    0x20(%rsp),%rax
addl   $0x1,(%rax)
mov    %r14,%rdi
mov    %r12,%r13
mov    %r12,%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     12f0 <parse+0x150>
mov    %rbx,%rdi
mov    %r13,%rsi
call   10c0 <strstr@plt>
mov    %rax,%rdi
lea    0xc28(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,%rbx
add    $0x8,%rbx
mov    $0xffffffffffffffff,%rbp
mov    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x3c,0x1(%rbx,%rbp,1)
lea    0x1(%rbp),%rbp
jne    1450 <parse+0x2b0>
mov    %ebp,%r15d
lea    0x1(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,(%r12)
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1080 <memcpy@plt>
mov    (%r12),%rax
movb   $0x0,(%rax,%r15,1)
jmp    1317 <parse+0x177>
mov    0x8(%rsp),%r12
mov    0x10(%rsp),%rax
movq   $0x0,(%rax)
movq   $0x0,(%r12)
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [9 x i8] c"In Parse\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [34 x i8] c"Insufficient memory to read XML!\0A\00"
@.str.4 = [16 x i8] c"<key>Name</key>\00"
@.str.5 = [7 x i8] c"string\00"
@.str.6 = [8 x i8] c"</dict>\00"
@.str.7 = [16 x i8] c"MPEG audio file\00"
@.str.8 = [3 x i8] c"0\00\00"
@.str.9 = [22 x i8] c"<key>Play Count</key>\00"
@.str.10 = [8 x i8] c"integer\00"
define i32 @parse(i8* %0, i8** %1, i8** %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32
store i8* %0, i8** %6
store i8** %1, i8*** %7
store i8** %2, i8*** %8
store i32* %3, i32** %9
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8*, i8** %6
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %10
store i32 1000, i32* %11
store i32 0, i32* %12
%26 = call i64 @calloc(i32 1, i32 501)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %13
%28 = load i32, i32* %11
%29 = call i64 @calloc(i32 1, i32 %28)
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %14
%31 = load i8*, i8** %13
%32 = icmp eq i8* %31, null
br i1 %32, label %36, label %33
33: ; preds = %4
%34 = load i8*, i8** %14
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %38
36: ; preds = %33, %4
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %5
br label %211
38: ; preds = %33
store i32 -1, i32* %15
br label %39
39: ; preds = %57, %38
%40 = load i8*, i8** %13
%41 = load i32*, i32** %10
%42 = call i32 @fread(i8* %40, i32 1, i32 501, i32* %41)
store i32 %42, i32* %15
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %70
44: ; preds = %39
%45 = load i32, i32* %12
%46 = load i32, i32* %15
%47 = add nsw i32 %45, %46
%48 = load i32, i32* %11
%49 = icmp sgt i32 %47, %48
br i1 %49, label %50, label %57
50: ; preds = %44
%51 = load i32, i32* %11
%52 = mul nsw i32 %51, 2
store i32 %52, i32* %11
%53 = load i8*, i8** %14
%54 = load i32, i32* %11
%55 = call i64 @realloc(i8* %53, i32 %54)
%56 = inttoptr i64 %55 to i8*
store i8* %56, i8** %14
br label %57
57: ; preds = %50, %44
%58 = load i8*, i8** %14
%59 = load i32, i32* %12
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8*, i8** %13
%63 = load i32, i32* %15
%64 = call i32 @memcpy(i8* %61, i8* %62, i32 %63)
%65 = load i32, i32* %15
%66 = load i32, i32* %12
%67 = add nsw i32 %66, %65
store i32 %67, i32* %12
%68 = load i8*, i8** %13
%69 = call i32 @memset(i8* %68, i32 0, i32 501)
br label %39
70: ; preds = %39
%71 = load i8*, i8** %14
%72 = load i32, i32* %12
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
store i8 0, i8* %74
%75 = load i8*, i8** %14
store i8* %75, i8** %16
br label %76
76: ; preds = %205, %115, %70
%77 = load i8*, i8** %16
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %208
81: ; preds = %76
%82 = load i8*, i8** %16
%83 = call i8* @strstr(i8* %82, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%84 = icmp eq i8* %83, null
br i1 %84, label %85, label %86
85: ; preds = %81
br label %208
86: ; preds = %81
%87 = load i8*, i8** %16
%88 = call i8* @strstr(i8* %87, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
store i8* %88, i8** %16
br label %89
89: ; preds = %86
%90 = load i8*, i8** %16
%91 = call i8* @strstr(i8* %90, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%92 = icmp eq i8* %91, null
br i1 %92, label %93, label %94
93: ; preds = %89
br label %208
94: ; preds = %89
%95 = load i8*, i8** %16
%96 = call i8* @strstr(i8* %95, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
store i8* %96, i8** %16
br label %97
97: ; preds = %94
%98 = load i8*, i8** %16
%99 = call i8* @strstr(i8* %98, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store i8* %99, i8** %17
%100 = load i8*, i8** %17
%101 = load i8*, i8** %16
%102 = ptrtoint i8* %100 to i64
%103 = ptrtoint i8* %101 to i64
%104 = sub i64 %102, %103
%105 = trunc i64 %104 to i32
store i32 %105, i32* %18
%106 = load i32, i32* %18
%107 = call i8* @malloc(i32 %106)
store i8* %107, i8** %19
%108 = load i8*, i8** %19
%109 = load i8*, i8** %16
%110 = load i32, i32* %18
%111 = call i32 @memcpy(i8* %108, i8* %109, i32 %110)
%112 = load i8*, i8** %19
%113 = call i8* @strstr(i8* %112, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%114 = icmp eq i8* %113, null
br i1 %114, label %115, label %118
115: ; preds = %97
%116 = load i8*, i8** %19
%117 = call i32 @free(i8* %116)
br label %76
118: ; preds = %97
%119 = load i8*, i8** %16
%120 = getelementptr inbounds i8, i8* %119, i64 7
store i8* %120, i8** %16
store i32 0, i32* %20
br label %121
121: ; preds = %129, %118
%122 = load i8*, i8** %16
%123 = load i32, i32* %20
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8, i8* %122, i64 %124
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
%128 = icmp ne i32 %127, 60
br i1 %128, label %129, label %132
129: ; preds = %121
%130 = load i32, i32* %20
%131 = add nsw i32 %130, 1
store i32 %131, i32* %20
br label %121
132: ; preds = %121
%133 = load i32, i32* %20
%134 = add nsw i32 %133, 1
store i32 %134, i32* %20
%135 = load i32, i32* %20
%136 = call i8* @malloc(i32 %135)
%137 = load i8**, i8*** %7
store i8* %136, i8** %137
%138 = load i8**, i8*** %7
%139 = load i8*, i8** %138
%140 = load i8*, i8** %16
%141 = load i32, i32* %20
%142 = sub nsw i32 %141, 1
%143 = call i32 @memcpy(i8* %139, i8* %140, i32 %142)
%144 = load i8**, i8*** %7
%145 = load i8*, i8** %144
%146 = load i32, i32* %20
%147 = sub nsw i32 %146, 1
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i8, i8* %145, i64 %148
store i8 0, i8* %149
%150 = load i32*, i32** %9
%151 = load i32, i32* %150
%152 = add nsw i32 %151, 1
store i32 %152, i32* %150
%153 = load i8**, i8*** %7
%154 = getelementptr inbounds i8*, i8** %153, i32 1
store i8** %154, i8*** %7
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %21
%155 = load i8*, i8** %19
%156 = call i8* @strstr(i8* %155, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%157 = icmp eq i8* %156, null
br i1 %157, label %158, label %167
158: ; preds = %132
%159 = call i8* @malloc(i32 2)
%160 = load i8**, i8*** %8
store i8* %159, i8** %160
%161 = load i8**, i8*** %8
%162 = load i8*, i8** %161
%163 = load i8*, i8** %21
%164 = call i32 @memcpy(i8* %162, i8* %163, i32 2)
%165 = load i8**, i8*** %8
%166 = getelementptr inbounds i8*, i8** %165, i32 1
store i8** %166, i8*** %8
br label %205
167: ; preds = %132
%168 = load i8*, i8** %16
%169 = call i8* @strstr(i8* %168, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
store i8* %169, i8** %16
%170 = load i8*, i8** %16
%171 = call i8* @strstr(i8* %170, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
store i8* %171, i8** %16
%172 = load i8*, i8** %16
%173 = getelementptr inbounds i8, i8* %172, i64 8
store i8* %173, i8** %16
store i32 0, i32* %22
br label %174
174: ; preds = %182, %167
%175 = load i8*, i8** %16
%176 = load i32, i32* %22
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i8, i8* %175, i64 %177
%179 = load i8, i8* %178
%180 = sext i8 %179 to i32
%181 = icmp ne i32 %180, 60
br i1 %181, label %182, label %185
182: ; preds = %174
%183 = load i32, i32* %22
%184 = add nsw i32 %183, 1
store i32 %184, i32* %22
br label %174
185: ; preds = %174
%186 = load i32, i32* %22
%187 = add nsw i32 %186, 1
store i32 %187, i32* %22
%188 = load i32, i32* %22
%189 = call i8* @malloc(i32 %188)
%190 = load i8**, i8*** %8
store i8* %189, i8** %190
%191 = load i8**, i8*** %8
%192 = load i8*, i8** %191
%193 = load i8*, i8** %16
%194 = load i32, i32* %22
%195 = sub nsw i32 %194, 1
%196 = call i32 @memcpy(i8* %192, i8* %193, i32 %195)
%197 = load i8**, i8*** %8
%198 = load i8*, i8** %197
%199 = load i32, i32* %22
%200 = sub nsw i32 %199, 1
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i8, i8* %198, i64 %201
store i8 0, i8* %202
%203 = load i8**, i8*** %8
%204 = getelementptr inbounds i8*, i8** %203, i32 1
store i8** %204, i8*** %8
br label %205
205: ; preds = %185, %158
%206 = load i8*, i8** %19
%207 = call i32 @free(i8* %206)
br label %76
208: ; preds = %93, %85, %76
%209 = load i8**, i8*** %7
store i8* null, i8** %209
%210 = load i8**, i8*** %8
store i8* null, i8** %210
store i32 0, i32* %5
br label %211
211: ; preds = %208, %36
%212 = load i32, i32* %5
ret i32 %212
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"In Parse\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.4 = [16 x i8] c"<key>Name</key>\00"
@.str.5 = [7 x i8] c"string\00"
@.str.6 = [8 x i8] c"</dict>\00"
@.str.7 = [16 x i8] c"MPEG audio file\00"
@.str.8 = [3 x i8] c"0\00\00"
@.str.9 = [22 x i8] c"<key>Play Count</key>\00"
@.str.10 = [8 x i8] c"integer\00"
@str = [33 x i8] c"Insufficient memory to read XML!\00"
define i32 @parse(i8* nocapture %0, i8** nocapture %1, i8** nocapture %2, i32* nocapture %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i64 @calloc(i32 1, i32 501)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @calloc(i32 1, i32 1000)
%10 = icmp eq i64 %7, 0
%11 = icmp eq i64 %9, 0
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %121
15: ; preds = %4
%16 = inttoptr i64 %9 to i8*
%17 = tail call i32 @fread(i8* %8, i32 1, i32 501, i32* %6)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %41
19: ; preds = %15, %30
%20 = phi i32 [ %37, %30 ], [ %17, %15 ]
%21 = phi i32 [ %32, %30 ], [ 1000, %15 ]
%22 = phi i8* [ %31, %30 ], [ %16, %15 ]
%23 = phi i32 [ %24, %30 ], [ 0, %15 ]
%24 = add nsw i32 %20, %23
%25 = icmp sgt i32 %24, %21
br i1 %25, label %26, label %30
26: ; preds = %19
%27 = shl nsw i32 %21, 1
%28 = tail call i64 @realloc(i8* %22, i32 %27)
%29 = inttoptr i64 %28 to i8*
br label %30
30: ; preds = %26, %19
%31 = phi i8* [ %29, %26 ], [ %22, %19 ]
%32 = phi i32 [ %27, %26 ], [ %21, %19 ]
%33 = sext i32 %23 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = tail call i32 @memcpy(i8* %34, i8* %8, i32 %20)
%36 = tail call i32 @memset(i8* %8, i32 0, i32 501)
%37 = tail call i32 @fread(i8* %8, i32 1, i32 501, i32* %6)
%38 = icmp sgt i32 %37, 0
br i1 %38, label %19, label %39
39: ; preds = %30
%40 = sext i32 %24 to i64
br label %41
41: ; preds = %39, %15
%42 = phi i64 [ 0, %15 ], [ %40, %39 ]
%43 = phi i8* [ %16, %15 ], [ %31, %39 ]
%44 = getelementptr inbounds i8, i8* %43, i64 %42
store i8 0, i8* %44
%45 = load i8, i8* %43
%46 = icmp eq i8 %45, 0
br i1 %46, label %118, label %47
47: ; preds = %41, %111
%48 = phi i8** [ %114, %111 ], [ %1, %41 ]
%49 = phi i8** [ %113, %111 ], [ %2, %41 ]
%50 = phi i8* [ %112, %111 ], [ %43, %41 ]
%51 = tail call i8* @strstr(i8* %50, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i8* %51, null
br i1 %52, label %118, label %53
53: ; preds = %47
%54 = tail call i8* @strstr(i8* %51, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp eq i8* %54, null
br i1 %55, label %118, label %56
56: ; preds = %53
%57 = tail call i8* @strstr(i8* %54, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%58 = ptrtoint i8* %57 to i64
%59 = ptrtoint i8* %54 to i64
%60 = sub i64 %58, %59
%61 = trunc i64 %60 to i32
%62 = tail call i8* @malloc(i32 %61)
%63 = tail call i32 @memcpy(i8* %62, i8* %54, i32 %61)
%64 = tail call i8* @strstr(i8* dereferenceable(1) %62, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%65 = icmp eq i8* %64, null
br i1 %65, label %111, label %66
66: ; preds = %56
%67 = getelementptr inbounds i8, i8* %54, i64 7
br label %68
68: ; preds = %68, %66
%69 = phi i64 [ %73, %68 ], [ 0, %66 ]
%70 = getelementptr inbounds i8, i8* %67, i64 %69
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 60
%73 = add nuw i64 %69, 1
br i1 %72, label %74, label %68
74: ; preds = %68
%75 = trunc i64 %69 to i32
%76 = and i64 %69, 4294967295
%77 = add nuw nsw i32 %75, 1
%78 = tail call i8* @malloc(i32 %77)
store i8* %78, i8** %48
%79 = tail call i32 @memcpy(i8* %78, i8* %67, i32 %75)
%80 = load i8*, i8** %48
%81 = getelementptr inbounds i8, i8* %80, i64 %76
store i8 0, i8* %81
%82 = load i32, i32* %3
%83 = add nsw i32 %82, 1
store i32 %83, i32* %3
%84 = getelementptr inbounds i8*, i8** %48, i64 1
%85 = tail call i8* @strstr(i8* dereferenceable(1) %62, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %90
87: ; preds = %74
%88 = tail call dereferenceable_or_null(2) i8* @malloc(i32 2)
store i8* %88, i8** %49
%89 = tail call i32 @memcpy(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2)
br label %108
90: ; preds = %74
%91 = tail call i8* @strstr(i8* %67, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%92 = tail call i8* @strstr(i8* dereferenceable(1) %91, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%93 = getelementptr inbounds i8, i8* %92, i64 8
br label %94
94: ; preds = %94, %90
%95 = phi i64 [ %99, %94 ], [ 0, %90 ]
%96 = getelementptr inbounds i8, i8* %93, i64 %95
%97 = load i8, i8* %96
%98 = icmp eq i8 %97, 60
%99 = add nuw i64 %95, 1
br i1 %98, label %100, label %94
100: ; preds = %94
%101 = trunc i64 %95 to i32
%102 = and i64 %95, 4294967295
%103 = add nuw nsw i32 %101, 1
%104 = tail call i8* @malloc(i32 %103)
store i8* %104, i8** %49
%105 = tail call i32 @memcpy(i8* %104, i8* %93, i32 %101)
%106 = load i8*, i8** %49
%107 = getelementptr inbounds i8, i8* %106, i64 %102
store i8 0, i8* %107
br label %108
108: ; preds = %100, %87
%109 = phi i8* [ %67, %87 ], [ %93, %100 ]
%110 = getelementptr inbounds i8*, i8** %49, i64 1
br label %111
111: ; preds = %56, %108
%112 = phi i8* [ %109, %108 ], [ %54, %56 ]
%113 = phi i8** [ %110, %108 ], [ %49, %56 ]
%114 = phi i8** [ %84, %108 ], [ %48, %56 ]
%115 = tail call i32 @free(i8* %62)
%116 = load i8, i8* %112
%117 = icmp eq i8 %116, 0
br i1 %117, label %118, label %47
118: ; preds = %111, %47, %53, %41
%119 = phi i8** [ %2, %41 ], [ %49, %53 ], [ %49, %47 ], [ %113, %111 ]
%120 = phi i8** [ %1, %41 ], [ %48, %53 ], [ %48, %47 ], [ %114, %111 ]
store i8* null, i8** %120
store i8* null, i8** %119
br label %121
121: ; preds = %118, %13
%122 = phi i32 [ -1, %13 ], [ 0, %118 ]
ret i32 %122
}