#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_CUR;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ mfile(int, char *, int /*<<< orphan*/ *, int *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int to_integer(char *);
int to_synch_safe(char *);
int getMP3_MBID(const char *path, char mbid[37]) {
  FILE *fp;
  static int s = 1;
  char head[3];
  char version[2];
  char flag[1];
  char size[4];
  char size_extended[4];
  int tag_size = 0;
  int extended_size = 0;
  char frame[4];
  char frame_header[4];
  int frame_size;
  int version_major;
  if (path == NULL) {
    return -1;
  }
  fp = fopen(path, "rb");
  if (fp == NULL) {
    return -1;
  }
  while (s) {
    mfile(3, head, fp, &s);
    if (!strncmp(head, "ID3", 3) == 0) {
      break;
    }
    mfile(2, version, fp, &s);
    version_major = (int)version[0];
    if (version_major == 2) {
      break;
    }
    if (version_major != 3 && version_major != 4) {
      break;
    }
    mfile(1, flag, fp, &s);
    if ((unsigned int)flag[0] & 0x00000040) {
      if (version[0] == 4) {
        mfile(4, size_extended, fp, &s);
        extended_size = to_synch_safe(size_extended);
      } else {
        mfile(4, size_extended, fp, &s);
        extended_size = to_integer(size_extended);
      }
      fseek(fp, extended_size, SEEK_CUR);
    }
    mfile(4, size, fp, &s);
    tag_size = to_synch_safe(size);
    while (s) {
      if (ftell(fp) > tag_size || ftell(fp) > 1048576) {
        break;
      }
      mfile(4, frame, fp, &s);
      if (frame[0] == 0x00) {
        break;
      }
      if (version_major == 4) {
        mfile(4, frame_header, fp, &s);
        frame_size = to_synch_safe(frame_header);
      } else {
        mfile(4, frame_header, fp, &s);
        frame_size = to_integer(frame_header);
      }
      fseek(fp, 2, SEEK_CUR);
      if (strncmp(frame, "UFID", 4) == 0) {
        char frame_data[59];
        mfile(59, frame_data, fp, &s);
        if (frame_size >= 59 &&
            strncmp(frame_data, "http://musicbrainz.org", 22) == 0) {
          char *tmbid = frame_data;
          tmbid = frame_data + 23;
          strncpy(mbid, tmbid, 37 - 1);
          mbid[37 - 1] = 0x00;
          fclose(fp);
          return 0;
        }
      } else {
        fseek(fp, frame_size, SEEK_CUR);
      }
    }
    break;
  }
  if (fp) {
    fclose(fp);
  }
  return -1;
}


x86 assembly (clang, -O0):
<getMP3_MBID>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11c8 <getMP3_MBID+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1521 <getMP3_MBID+0x391>
mov    -0x10(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f3 <getMP3_MBID+0x63>
movl   $0xffffffff,-0x4(%rbp)
jmp    1521 <getMP3_MBID+0x391>
jmp    11f8 <getMP3_MBID+0x68>
cmpl   $0x0,0x2e69(%rip)
je     1506 <getMP3_MBID+0x376>
lea    -0x23(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x3,%edi
lea    0x2e4f(%rip),%rcx
call   1050 <mfile@plt>
lea    -0x23(%rbp),%rdi
lea    0xdda(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jne    124f <getMP3_MBID+0xbf>
jmp    1506 <getMP3_MBID+0x376>
lea    -0x25(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x2,%edi
lea    0x2e05(%rip),%rcx
call   1050 <mfile@plt>
movsbl -0x25(%rbp),%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x2,-0x48(%rbp)
jne    127e <getMP3_MBID+0xee>
jmp    1506 <getMP3_MBID+0x376>
cmpl   $0x3,-0x48(%rbp)
je     1297 <getMP3_MBID+0x107>
cmpl   $0x4,-0x48(%rbp)
je     1297 <getMP3_MBID+0x107>
jmp    1506 <getMP3_MBID+0x376>
lea    -0x26(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
lea    0x2dbd(%rip),%rcx
call   1050 <mfile@plt>
movsbl -0x26(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1331 <getMP3_MBID+0x1a1>
movsbl -0x25(%rbp),%eax
cmp    $0x4,%eax
jne    12f7 <getMP3_MBID+0x167>
lea    -0x2e(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x4,%edi
lea    0x2d87(%rip),%rcx
call   1050 <mfile@plt>
lea    -0x2e(%rbp),%rdi
call   10b0 <to_synch_safe@plt>
mov    %eax,-0x38(%rbp)
jmp    131c <getMP3_MBID+0x18c>
lea    -0x2e(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x4,%edi
lea    0x2d5d(%rip),%rcx
call   1050 <mfile@plt>
lea    -0x2e(%rbp),%rdi
call   1070 <to_integer@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    0x2cbe(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
lea    -0x2a(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x4,%edi
lea    0x2d23(%rip),%rcx
call   1050 <mfile@plt>
lea    -0x2a(%rbp),%rdi
call   10b0 <to_synch_safe@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,0x2d0b(%rip)
je     1501 <getMP3_MBID+0x371>
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
cmp    -0x34(%rbp),%eax
jg     1389 <getMP3_MBID+0x1f9>
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
cmp    $0x100000,%eax
jle    138e <getMP3_MBID+0x1fe>
jmp    1501 <getMP3_MBID+0x371>
lea    -0x3c(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x4,%edi
lea    0x2cc6(%rip),%rcx
call   1050 <mfile@plt>
movsbl -0x3c(%rbp),%eax
cmp    $0x0,%eax
jne    13b9 <getMP3_MBID+0x229>
jmp    1501 <getMP3_MBID+0x371>
cmpl   $0x4,-0x48(%rbp)
jne    13ed <getMP3_MBID+0x25d>
lea    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x4,%edi
lea    0x2c91(%rip),%rcx
call   1050 <mfile@plt>
lea    -0x40(%rbp),%rdi
call   10b0 <to_synch_safe@plt>
mov    %eax,-0x44(%rbp)
jmp    1412 <getMP3_MBID+0x282>
lea    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x4,%edi
lea    0x2c67(%rip),%rcx
call   1050 <mfile@plt>
lea    -0x40(%rbp),%rdi
call   1070 <to_integer@plt>
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2bcb(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%esi
call   1090 <fseek@plt>
lea    -0x3c(%rbp),%rdi
lea    0xbd3(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14e7 <getMP3_MBID+0x357>
lea    -0x90(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x3b,%edi
lea    0x2c09(%rip),%rcx
call   1050 <mfile@plt>
cmpl   $0x3b,-0x44(%rbp)
jl     14e2 <getMP3_MBID+0x352>
lea    -0x90(%rbp),%rdi
lea    0xb90(%rip),%rsi
mov    $0x16,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14e2 <getMP3_MBID+0x352>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rax
add    $0x17,%rax
mov    %rax,-0x98(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    $0x24,%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,0x24(%rax)
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1521 <getMP3_MBID+0x391>
jmp    14fc <getMP3_MBID+0x36c>
mov    -0x20(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    0x2af3(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
jmp    1356 <getMP3_MBID+0x1c6>
jmp    1506 <getMP3_MBID+0x376>
cmpq   $0x0,-0x20(%rbp)
je     151a <getMP3_MBID+0x38a>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMP3_MBID>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    $0xffffffff,%r12d
test   %rdi,%rdi
je     141e <getMP3_MBID+0x28e>
mov    %rsi,%r14
lea    0xe49(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     141e <getMP3_MBID+0x28e>
mov    %rax,%rbx
cmpl   $0x0,0x2e99(%rip)
je     1416 <getMP3_MBID+0x286>
lea    0x2e8c(%rip),%rcx
lea    0x1d(%rsp),%rbp
mov    $0x3,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1050 <mfile@plt>
lea    0xe0b(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1416 <getMP3_MBID+0x286>
lea    0x2e53(%rip),%rcx
lea    0xf(%rsp),%rsi
mov    $0x2,%edi
mov    %rbx,%rdx
call   1050 <mfile@plt>
mov    0xf(%rsp),%al
mov    %rax,0x20(%rsp)
add    $0xfffffffb,%eax
cmp    $0xfe,%al
jb     1416 <getMP3_MBID+0x286>
lea    0x2e26(%rip),%rcx
lea    0xe(%rsp),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1050 <mfile@plt>
testb  $0x40,0xe(%rsp)
je     12a3 <getMP3_MBID+0x113>
mov    0xf(%rsp),%bpl
lea    0x2e01(%rip),%rcx
lea    0x15(%rsp),%rsi
mov    $0x4,%edi
mov    %rbx,%rdx
call   1050 <mfile@plt>
lea    0x15(%rsp),%rdi
cmp    $0x4,%bpl
jne    128b <getMP3_MBID+0xfb>
call   10b0 <to_synch_safe@plt>
jmp    1290 <getMP3_MBID+0x100>
call   1070 <to_integer@plt>
mov    %eax,%esi
mov    0x2d4f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1090 <fseek@plt>
lea    0x2dbe(%rip),%rcx
lea    0x2c(%rsp),%rbp
mov    $0x4,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1050 <mfile@plt>
mov    %rbp,%rdi
call   10b0 <to_synch_safe@plt>
cmpl   $0x0,0x2d9a(%rip)
je     1416 <getMP3_MBID+0x286>
mov    %eax,%r15d
lea    0x19(%rsp),%rbp
jmp    12fe <getMP3_MBID+0x16e>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    %r13d,%esi
call   1090 <fseek@plt>
cmpl   $0x0,0x2d75(%rip)
lea    0x19(%rsp),%rbp
je     1416 <getMP3_MBID+0x286>
mov    %rbx,%rdi
call   1080 <ftell@plt>
cmp    %r15d,%eax
jg     1416 <getMP3_MBID+0x286>
mov    %rbx,%rdi
call   1080 <ftell@plt>
cmp    $0x100000,%eax
jg     1416 <getMP3_MBID+0x286>
mov    $0x4,%edi
lea    0x11(%rsp),%rsi
mov    %rbx,%rdx
lea    0x2d32(%rip),%rcx
call   1050 <mfile@plt>
cmpb   $0x0,0x11(%rsp)
je     1416 <getMP3_MBID+0x286>
mov    $0x4,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
lea    0x2d10(%rip),%rcx
call   1050 <mfile@plt>
cmpb   $0x4,0x20(%rsp)
jne    136e <getMP3_MBID+0x1de>
mov    %rbp,%rdi
call   10b0 <to_synch_safe@plt>
jmp    1376 <getMP3_MBID+0x1e6>
mov    %rbp,%rdi
call   1070 <to_integer@plt>
mov    %eax,%r13d
mov    0x2c68(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1090 <fseek@plt>
lea    0x11(%rsp),%rdi
lea    0xc6b(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    12de <getMP3_MBID+0x14e>
mov    $0x3b,%edi
lea    0x30(%rsp),%rbp
mov    %rbp,%rsi
mov    %rbx,%rdx
lea    0x2ca2(%rip),%rcx
call   1050 <mfile@plt>
cmp    $0x3b,%r13d
jl     12ec <getMP3_MBID+0x15c>
mov    %rbp,%rdi
lea    0xc2d(%rip),%rsi
mov    $0x16,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    12ec <getMP3_MBID+0x15c>
lea    0x47(%rsp),%rsi
mov    %r14,%rdi
mov    $0x24,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x24(%r14)
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %r12d,%r12d
jmp    141e <getMP3_MBID+0x28e>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %r12d,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@getMP3_MBID.s = internal global i32 1
@.str = [3 x i8] c"rb\00"
@.str.1 = [4 x i8] c"ID3\00"
@SEEK_CUR = global i32 0
@.str.2 = [5 x i8] c"UFID\00"
@.str.3 = [23 x i8] c"http://musicbrainz.org\00"
define i32 @getMP3_MBID(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [3 x i8]
%8 = alloca [2 x i8]
%9 = alloca [1 x i8]
%10 = alloca [4 x i8]
%11 = alloca [4 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca [4 x i8]
%15 = alloca [4 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca [59 x i8]
%19 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %12
store i32 0, i32* %13
%20 = load i8*, i8** %4
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %2
store i32 -1, i32* %3
br label %178
23: ; preds = %2
%24 = load i8*, i8** %4
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %6
%26 = load i32*, i32** %6
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 -1, i32* %3
br label %178
29: ; preds = %23
br label %30
30: ; preds = %29
%31 = load i32, i32* @getMP3_MBID.s
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %171
33: ; preds = %30
%34 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%35 = load i32*, i32** %6
%36 = call i32 @mfile(i32 3, i8* %34, i32* %35, i32* @getMP3_MBID.s)
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%38 = call i64 @strncmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%39 = icmp ne i64 %38, 0
%40 = xor i1 %39, true
%41 = zext i1 %40 to i32
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %33
br label %171
44: ; preds = %33
%45 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%46 = load i32*, i32** %6
%47 = call i32 @mfile(i32 2, i8* %45, i32* %46, i32* @getMP3_MBID.s)
%48 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
store i32 %50, i32* %17
%51 = load i32, i32* %17
%52 = icmp eq i32 %51, 2
br i1 %52, label %53, label %54
53: ; preds = %44
br label %171
54: ; preds = %44
%55 = load i32, i32* %17
%56 = icmp ne i32 %55, 3
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = load i32, i32* %17
%59 = icmp ne i32 %58, 4
br i1 %59, label %60, label %61
60: ; preds = %57
br label %171
61: ; preds = %57, %54
%62 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
%63 = load i32*, i32** %6
%64 = call i32 @mfile(i32 1, i8* %62, i32* %63, i32* @getMP3_MBID.s)
%65 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = and i32 %67, 64
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %92
70: ; preds = %61
%71 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp eq i32 %73, 4
br i1 %74, label %75, label %81
75: ; preds = %70
%76 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%77 = load i32*, i32** %6
%78 = call i32 @mfile(i32 4, i8* %76, i32* %77, i32* @getMP3_MBID.s)
%79 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%80 = call i32 @to_synch_safe(i8* %79)
store i32 %80, i32* %13
br label %87
81: ; preds = %70
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%83 = load i32*, i32** %6
%84 = call i32 @mfile(i32 4, i8* %82, i32* %83, i32* @getMP3_MBID.s)
%85 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 0
%86 = call i32 @to_integer(i8* %85)
store i32 %86, i32* %13
br label %87
87: ; preds = %81, %75
%88 = load i32*, i32** %6
%89 = load i32, i32* %13
%90 = load i32, i32* @SEEK_CUR
%91 = call i32 @fseek(i32* %88, i32 %89, i32 %90)
br label %92
92: ; preds = %87, %61
%93 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%94 = load i32*, i32** %6
%95 = call i32 @mfile(i32 4, i8* %93, i32* %94, i32* @getMP3_MBID.s)
%96 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%97 = call i32 @to_synch_safe(i8* %96)
store i32 %97, i32* %12
br label %98
98: ; preds = %169, %92
%99 = load i32, i32* @getMP3_MBID.s
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %170
101: ; preds = %98
%102 = load i32*, i32** %6
%103 = call i32 @ftell(i32* %102)
%104 = load i32, i32* %12
%105 = icmp sgt i32 %103, %104
br i1 %105, label %110, label %106
106: ; preds = %101
%107 = load i32*, i32** %6
%108 = call i32 @ftell(i32* %107)
%109 = icmp sgt i32 %108, 1048576
br i1 %109, label %110, label %111
110: ; preds = %106, %101
br label %170
111: ; preds = %106
%112 = getelementptr inbounds [4 x i8], [4 x i8]* %14, i64 0, i64 0
%113 = load i32*, i32** %6
%114 = call i32 @mfile(i32 4, i8* %112, i32* %113, i32* @getMP3_MBID.s)
%115 = getelementptr inbounds [4 x i8], [4 x i8]* %14, i64 0, i64 0
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %120
119: ; preds = %111
br label %170
120: ; preds = %111
%121 = load i32, i32* %17
%122 = icmp eq i32 %121, 4
br i1 %122, label %123, label %129
123: ; preds = %120
%124 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%125 = load i32*, i32** %6
%126 = call i32 @mfile(i32 4, i8* %124, i32* %125, i32* @getMP3_MBID.s)
%127 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%128 = call i32 @to_synch_safe(i8* %127)
store i32 %128, i32* %16
br label %135
129: ; preds = %120
%130 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%131 = load i32*, i32** %6
%132 = call i32 @mfile(i32 4, i8* %130, i32* %131, i32* @getMP3_MBID.s)
%133 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%134 = call i32 @to_integer(i8* %133)
store i32 %134, i32* %16
br label %135
135: ; preds = %129, %123
%136 = load i32*, i32** %6
%137 = load i32, i32* @SEEK_CUR
%138 = call i32 @fseek(i32* %136, i32 2, i32 %137)
%139 = getelementptr inbounds [4 x i8], [4 x i8]* %14, i64 0, i64 0
%140 = call i64 @strncmp(i8* %139, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%141 = icmp eq i64 %140, 0
br i1 %141, label %142, label %164
142: ; preds = %135
%143 = getelementptr inbounds [59 x i8], [59 x i8]* %18, i64 0, i64 0
%144 = load i32*, i32** %6
%145 = call i32 @mfile(i32 59, i8* %143, i32* %144, i32* @getMP3_MBID.s)
%146 = load i32, i32* %16
%147 = icmp sge i32 %146, 59
br i1 %147, label %148, label %163
148: ; preds = %142
%149 = getelementptr inbounds [59 x i8], [59 x i8]* %18, i64 0, i64 0
%150 = call i64 @strncmp(i8* %149, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 22)
%151 = icmp eq i64 %150, 0
br i1 %151, label %152, label %163
152: ; preds = %148
%153 = getelementptr inbounds [59 x i8], [59 x i8]* %18, i64 0, i64 0
store i8* %153, i8** %19
%154 = getelementptr inbounds [59 x i8], [59 x i8]* %18, i64 0, i64 0
%155 = getelementptr inbounds i8, i8* %154, i64 23
store i8* %155, i8** %19
%156 = load i8*, i8** %5
%157 = load i8*, i8** %19
%158 = call i32 @strncpy(i8* %156, i8* %157, i32 36)
%159 = load i8*, i8** %5
%160 = getelementptr inbounds i8, i8* %159, i64 36
store i8 0, i8* %160
%161 = load i32*, i32** %6
%162 = call i32 @fclose(i32* %161)
store i32 0, i32* %3
br label %178
163: ; preds = %148, %142
br label %169
164: ; preds = %135
%165 = load i32*, i32** %6
%166 = load i32, i32* %16
%167 = load i32, i32* @SEEK_CUR
%168 = call i32 @fseek(i32* %165, i32 %166, i32 %167)
br label %169
169: ; preds = %164, %163
br label %98
170: ; preds = %119, %110, %98
br label %171
171: ; preds = %170, %60, %53, %43, %30
%172 = load i32*, i32** %6
%173 = icmp ne i32* %172, null
br i1 %173, label %174, label %177
174: ; preds = %171
%175 = load i32*, i32** %6
%176 = call i32 @fclose(i32* %175)
br label %177
177: ; preds = %174, %171
store i32 -1, i32* %3
br label %178
178: ; preds = %177, %152, %28, %22
%179 = load i32, i32* %3
ret i32 %179
}

LLVM IR (-O2):
@getMP3_MBID.s = internal global i32 1
@.str = [3 x i8] c"rb\00"
@.str.1 = [4 x i8] c"ID3\00"
@SEEK_CUR = global i32 0
@.str.2 = [5 x i8] c"UFID\00"
@.str.3 = [23 x i8] c"http://musicbrainz.org\00"
define i32 @getMP3_MBID(i8* %0, i8* %1) {
%3 = alloca [3 x i8]
%4 = alloca [2 x i8]
%5 = alloca [1 x i8]
%6 = alloca [4 x i8]
%7 = alloca [4 x i8]
%8 = alloca [4 x i8]
%9 = alloca [4 x i8]
%10 = alloca [59 x i8]
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%18 = icmp eq i8* %0, null
br i1 %18, label %101, label %19
19: ; preds = %2
%20 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %101, label %22
22: ; preds = %19
%23 = load i32, i32* @getMP3_MBID.s
%24 = icmp eq i32 %23, 0
br i1 %24, label %99, label %25
25: ; preds = %22
%26 = call i32 @mfile(i32 3, i8* %11, i32* %20, i32* @getMP3_MBID.s)
%27 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %99
29: ; preds = %25
%30 = call i32 @mfile(i32 2, i8* %12, i32* %20, i32* @getMP3_MBID.s)
%31 = load i8, i8* %12
%32 = add i8 %31, -5
%33 = icmp ult i8 %32, -2
br i1 %33, label %99, label %34
34: ; preds = %29
%35 = call i32 @mfile(i32 1, i8* %13, i32* %20, i32* @getMP3_MBID.s)
%36 = load i8, i8* %13
%37 = and i8 %36, 64
%38 = icmp eq i8 %37, 0
br i1 %38, label %51, label %39
39: ; preds = %34
%40 = load i8, i8* %12
%41 = icmp eq i8 %40, 4
%42 = call i32 @mfile(i32 4, i8* %15, i32* %20, i32* @getMP3_MBID.s)
br i1 %41, label %43, label %45
43: ; preds = %39
%44 = call i32 @to_synch_safe(i8* %15)
br label %47
45: ; preds = %39
%46 = call i32 @to_integer(i8* %15)
br label %47
47: ; preds = %45, %43
%48 = phi i32 [ %44, %43 ], [ %46, %45 ]
%49 = load i32, i32* @SEEK_CUR
%50 = call i32 @fseek(i32* %20, i32 %48, i32 %49)
br label %51
51: ; preds = %47, %34
%52 = call i32 @mfile(i32 4, i8* %14, i32* %20, i32* @getMP3_MBID.s)
%53 = call i32 @to_synch_safe(i8* %14)
%54 = load i32, i32* @getMP3_MBID.s
%55 = icmp eq i32 %54, 0
br i1 %55, label %99, label %56
56: ; preds = %51
%57 = icmp eq i8 %31, 4
%58 = getelementptr inbounds [59 x i8], [59 x i8]* %10, i64 0, i64 0
br label %59
59: ; preds = %56, %96
%60 = call i32 @ftell(i32* %20)
%61 = icmp sgt i32 %60, %53
br i1 %61, label %99, label %62
62: ; preds = %59
%63 = call i32 @ftell(i32* %20)
%64 = icmp sgt i32 %63, 1048576
br i1 %64, label %99, label %65
65: ; preds = %62
%66 = call i32 @mfile(i32 4, i8* %16, i32* %20, i32* @getMP3_MBID.s)
%67 = load i8, i8* %16
%68 = icmp eq i8 %67, 0
br i1 %68, label %99, label %69
69: ; preds = %65
%70 = call i32 @mfile(i32 4, i8* %17, i32* %20, i32* @getMP3_MBID.s)
br i1 %57, label %71, label %73
71: ; preds = %69
%72 = call i32 @to_synch_safe(i8* %17)
br label %75
73: ; preds = %69
%74 = call i32 @to_integer(i8* %17)
br label %75
75: ; preds = %73, %71
%76 = phi i32 [ %72, %71 ], [ %74, %73 ]
%77 = load i32, i32* @SEEK_CUR
%78 = call i32 @fseek(i32* %20, i32 2, i32 %77)
%79 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %93
81: ; preds = %75
%82 = call i32 @mfile(i32 59, i8* %58, i32* %20, i32* @getMP3_MBID.s)
%83 = icmp sgt i32 %76, 58
br i1 %83, label %84, label %92
84: ; preds = %81
%85 = call i64 @strncmp(i8* %58, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 22)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %92
87: ; preds = %84
%88 = getelementptr inbounds [59 x i8], [59 x i8]* %10, i64 0, i64 23
%89 = call i32 @strncpy(i8* %1, i8* %88, i32 36)
%90 = getelementptr inbounds i8, i8* %1, i64 36
store i8 0, i8* %90
%91 = call i32 @fclose(i32* %20)
br label %101
92: ; preds = %81, %84
br label %96
93: ; preds = %75
%94 = load i32, i32* @SEEK_CUR
%95 = call i32 @fseek(i32* %20, i32 %76, i32 %94)
br label %96
96: ; preds = %92, %93
%97 = load i32, i32* @getMP3_MBID.s
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %59
99: ; preds = %96, %62, %59, %65, %51, %22, %25, %29
%100 = call i32 @fclose(i32* %20)
br label %101
101: ; preds = %87, %19, %2, %99
%102 = phi i32 [ -1, %99 ], [ -1, %2 ], [ -1, %19 ], [ 0, %87 ]
ret i32 %102
}