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

/* Variables and functions */
int /*<<< orphan*/ isprint(char);
int /*<<< orphan*/ memcpy(char *, char *, int);
char *strchr(char *, char);
scalar_t__ strpbrk(char *, char *);
char *strstr(char *, char *);
int cddb_gettitle(char *data, char *title, int n) {
  char *p = data, *q = title;
  int i, nn = -1;
  if (n == (-3)) {
    n = (-2);
    p = strstr(p, "\nEXTD");
    if (p) {
      char *pp = strchr(++p, '\n');
      p = strstr(p, "YEAR: ");
      if (p && (pp > p || !pp)) {
        memcpy(--p, "\nDYEAR=", 7);
      }
    }
    p = data;
  }
  if (n == (-1) || n == (-2)) {
    p = strstr(p, n == (-1) ? "\nDGENR" : "\nDYE");
    if (p++)
      goto dump_title;
    else
      return 1;
  }
  do {
    p = strstr(p, "\nDTIT");
    if (p) {
      nn++;
      p++;
    } else
      break;
  } while (1);
  if (n)
    n += nn;
  p = data;
  for (i = n; i >= 0; i--) {
    p = strstr(p, "TITLE");
    if (p == NULL) {
      title[0] = '\0';
      return 1;
    } else
      p += 2;
  }
dump_title:
  p = strchr(p, '=') + 1;
  while (p && *p != '\n' && *p != 0) {
    *q = *p++;
    q++;
  }
  if (!p || (*p == 0))
    return 1;
  *q = 0;
  while (--q > title && (!isprint(*q) || strpbrk(q, "-_ \t/")))
    *q = 0;
  if (q <= title)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cddb_gettitle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0xffffffff,-0x38(%rbp)
cmpl   $0xfffffffd,-0x1c(%rbp)
jne    1226 <cddb_gettitle+0xd6>
movl   $0xfffffffe,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe6a(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     121e <cddb_gettitle+0xce>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x28(%rbp)
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1219 <cddb_gettitle+0xc9>
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
ja     11fc <cddb_gettitle+0xac>
cmpq   $0x0,-0x40(%rbp)
jne    1219 <cddb_gettitle+0xc9>
mov    -0x28(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
mov    %rdi,-0x28(%rbp)
lea    0xdfe(%rip),%rsi
mov    $0x7,%edx
call   1040 <memcpy@plt>
jmp    121e <cddb_gettitle+0xce>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     123a <cddb_gettitle+0xea>
cmpl   $0xfffffffe,-0x1c(%rbp)
jne    1289 <cddb_gettitle+0x139>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
lea    0xdd4(%rip),%rsi
lea    0xdc6(%rip),%rax
cmp    $0xffffffff,%ecx
cmove  %rax,%rsi
call   1070 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
cmp    $0x0,%rax
je     127d <cddb_gettitle+0x12d>
jmp    1361 <cddb_gettitle+0x211>
movl   $0x1,-0x4(%rbp)
jmp    14a6 <cddb_gettitle+0x356>
jmp    128e <cddb_gettitle+0x13e>
mov    -0x28(%rbp),%rdi
lea    0xd88(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     12c7 <cddb_gettitle+0x177>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12cc <cddb_gettitle+0x17c>
jmp    12e0 <cddb_gettitle+0x190>
jmp    12d1 <cddb_gettitle+0x181>
mov    $0x1,%al
test   $0x1,%al
jne    128e <cddb_gettitle+0x13e>
jmp    12e0 <cddb_gettitle+0x190>
cmpl   $0x0,-0x1c(%rbp)
je     12f3 <cddb_gettitle+0x1a3>
mov    -0x38(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     135c <cddb_gettitle+0x20c>
mov    -0x28(%rbp),%rdi
lea    0xd11(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    133d <cddb_gettitle+0x1ed>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    14a6 <cddb_gettitle+0x356>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
jmp    134e <cddb_gettitle+0x1fe>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    1301 <cddb_gettitle+0x1b1>
jmp    1361 <cddb_gettitle+0x211>
mov    -0x28(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x41(%rbp)
je     13ac <cddb_gettitle+0x25c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x41(%rbp)
je     13ac <cddb_gettitle+0x25c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    13bc <cddb_gettitle+0x26c>
jmp    13e4 <cddb_gettitle+0x294>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1377 <cddb_gettitle+0x227>
cmpq   $0x0,-0x28(%rbp)
je     13ff <cddb_gettitle+0x2af>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    140b <cddb_gettitle+0x2bb>
movl   $0x1,-0x4(%rbp)
jmp    14a6 <cddb_gettitle+0x356>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x30(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rcx
mov    %al,-0x42(%rbp)
jbe    1469 <cddb_gettitle+0x319>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isprint@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x43(%rbp)
je     1463 <cddb_gettitle+0x313>
mov    -0x30(%rbp),%rdi
lea    0xbd9(%rip),%rsi
call   1050 <strpbrk@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x43(%rbp)
mov    -0x43(%rbp),%al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    1479 <cddb_gettitle+0x329>
jmp    1485 <cddb_gettitle+0x335>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
jmp    1412 <cddb_gettitle+0x2c2>
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     149f <cddb_gettitle+0x34f>
movl   $0x1,-0x4(%rbp)
jmp    14a6 <cddb_gettitle+0x356>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cddb_gettitle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    $0xfffffffd,%edx
jne    11cd <cddb_gettitle+0x7d>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
lea    0xea3(%rip),%r15
test   %rax,%rax
je     11ec <cddb_gettitle+0x9c>
mov    %rax,%rbp
add    $0x1,%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,%r12
lea    0xe6a(%rip),%rsi
mov    %rbp,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     11ec <cddb_gettitle+0x9c>
test   %r12,%r12
je     11b3 <cddb_gettitle+0x63>
cmp    %rax,%r12
jbe    11ec <cddb_gettitle+0x9c>
add    $0xffffffffffffffff,%rax
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
mov    $0x7,%edx
call   1040 <memcpy@plt>
jmp    11ec <cddb_gettitle+0x9c>
mov    %edx,%r15d
jbe    1293 <cddb_gettitle+0x143>
cmp    $0xffffffff,%r15d
lea    0xe34(%rip),%rax
lea    0xe34(%rip),%r15
cmove  %rax,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strstr@plt>
test   %rax,%rax
je     1327 <cddb_gettitle+0x1d7>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
lea    -0x1(%r14),%rbx
nopl   0x0(%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1327 <cddb_gettitle+0x1d7>
cmp    $0xa,%cl
je     123d <cddb_gettitle+0xed>
mov    %cl,0x1(%rbx)
add    $0x1,%rbx
add    $0x1,%rax
jmp    1220 <cddb_gettitle+0xd0>
movb   $0x0,0x1(%rbx)
mov    $0x1,%ebp
cmp    %r14,%rbx
jbe    132c <cddb_gettitle+0x1dc>
lea    0xdd7(%rip),%r15
jmp    1270 <cddb_gettitle+0x120>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jbe    132c <cddb_gettitle+0x1dc>
movsbl (%rbx),%edi
call   1060 <isprint@plt>
test   %eax,%eax
je     1260 <cddb_gettitle+0x110>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strpbrk@plt>
test   %rax,%rax
jne    1260 <cddb_gettitle+0x110>
xor    %ebp,%ebp
jmp    132c <cddb_gettitle+0x1dc>
lea    0xd87(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     12d7 <cddb_gettitle+0x187>
lea    0xd6e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
add    $0x1,%rax
mov    %rax,%rdi
mov    %r12,%rsi
call   1070 <strstr@plt>
test   %rax,%rax
jne    12c0 <cddb_gettitle+0x170>
add    %r15d,%ebp
test   %r15d,%r15d
cmove  %r15d,%ebp
test   %ebp,%ebp
js     1207 <cddb_gettitle+0xb7>
add    $0x1,%ebp
lea    0xd34(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strstr@plt>
test   %rax,%rax
je     1323 <cddb_gettitle+0x1d3>
mov    %rax,%rbx
add    $0x2,%rbx
add    $0xffffffff,%ebp
test   %ebp,%ebp
jg     1300 <cddb_gettitle+0x1b0>
jmp    1207 <cddb_gettitle+0xb7>
movb   $0x0,(%r14)
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\0AEXTD\00"
@.str.1 = [7 x i8] c"YEAR: \00"
@.str.2 = [8 x i8] c"\0ADYEAR=\00"
@.str.3 = [7 x i8] c"\0ADGENR\00"
@.str.4 = [5 x i8] c"\0ADYE\00"
@.str.5 = [6 x i8] c"\0ADTIT\00"
@.str.6 = [6 x i8] c"TITLE\00"
@.str.7 = [6 x i8] c"-_ \09/\00"
define i32 @cddb_gettitle(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%13 = load i8*, i8** %5
store i8* %13, i8** %8
%14 = load i8*, i8** %6
store i8* %14, i8** %9
store i32 -1, i32* %11
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, -3
br i1 %16, label %17, label %44
17: ; preds = %3
store i32 -2, i32* %7
%18 = load i8*, i8** %8
%19 = call i8* @strstr(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %19, i8** %8
%20 = load i8*, i8** %8
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %42
22: ; preds = %17
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %8
%25 = call i8* @strchr(i8* %24, i8 signext 10)
store i8* %25, i8** %12
%26 = load i8*, i8** %8
%27 = call i8* @strstr(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i8* %27, i8** %8
%28 = load i8*, i8** %8
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %41
30: ; preds = %22
%31 = load i8*, i8** %12
%32 = load i8*, i8** %8
%33 = icmp ugt i8* %31, %32
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = load i8*, i8** %12
%36 = icmp ne i8* %35, null
br i1 %36, label %41, label %37
37: ; preds = %34, %30
%38 = load i8*, i8** %8
%39 = getelementptr inbounds i8, i8* %38, i32 -1
store i8* %39, i8** %8
%40 = call i32 @memcpy(i8* %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %41
41: ; preds = %37, %34, %22
br label %42
42: ; preds = %41, %17
%43 = load i8*, i8** %5
store i8* %43, i8** %8
br label %44
44: ; preds = %42, %3
%45 = load i32, i32* %7
%46 = icmp eq i32 %45, -1
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* %7
%49 = icmp eq i32 %48, -2
br i1 %49, label %50, label %62
50: ; preds = %47, %44
%51 = load i8*, i8** %8
%52 = load i32, i32* %7
%53 = icmp eq i32 %52, -1
%54 = zext i1 %53 to i64
%55 = select i1 %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%56 = call i8* @strstr(i8* %51, i8* %55)
store i8* %56, i8** %8
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %8
%59 = icmp ne i8* %57, null
br i1 %59, label %60, label %61
60: ; preds = %50
br label %105
61: ; preds = %50
store i32 1, i32* %4
br label %168
62: ; preds = %47
br label %63
63: ; preds = %75, %62
%64 = load i8*, i8** %8
%65 = call i8* @strstr(i8* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i8* %65, i8** %8
%66 = load i8*, i8** %8
%67 = icmp ne i8* %66, null
br i1 %67, label %68, label %73
68: ; preds = %63
%69 = load i32, i32* %11
%70 = add nsw i32 %69, 1
store i32 %70, i32* %11
%71 = load i8*, i8** %8
%72 = getelementptr inbounds i8, i8* %71, i32 1
store i8* %72, i8** %8
br label %74
73: ; preds = %63
br label %76
74: ; preds = %68
br label %75
75: ; preds = %74
br i1 true, label %63, label %76
76: ; preds = %75, %73
%77 = load i32, i32* %7
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = load i32, i32* %11
%81 = load i32, i32* %7
%82 = add nsw i32 %81, %80
store i32 %82, i32* %7
br label %83
83: ; preds = %79, %76
%84 = load i8*, i8** %5
store i8* %84, i8** %8
%85 = load i32, i32* %7
store i32 %85, i32* %10
br label %86
86: ; preds = %101, %83
%87 = load i32, i32* %10
%88 = icmp sge i32 %87, 0
br i1 %88, label %89, label %104
89: ; preds = %86
%90 = load i8*, i8** %8
%91 = call i8* @strstr(i8* %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
store i8* %91, i8** %8
%92 = load i8*, i8** %8
%93 = icmp eq i8* %92, null
br i1 %93, label %94, label %97
94: ; preds = %89
%95 = load i8*, i8** %6
%96 = getelementptr inbounds i8, i8* %95, i64 0
store i8 0, i8* %96
store i32 1, i32* %4
br label %168
97: ; preds = %89
%98 = load i8*, i8** %8
%99 = getelementptr inbounds i8, i8* %98, i64 2
store i8* %99, i8** %8
br label %100
100: ; preds = %97
br label %101
101: ; preds = %100
%102 = load i32, i32* %10
%103 = add nsw i32 %102, -1
store i32 %103, i32* %10
br label %86
104: ; preds = %86
br label %105
105: ; preds = %104, %60
%106 = load i8*, i8** %8
%107 = call i8* @strchr(i8* %106, i8 signext 61)
%108 = getelementptr inbounds i8, i8* %107, i64 1
store i8* %108, i8** %8
br label %109
109: ; preds = %124, %105
%110 = load i8*, i8** %8
%111 = icmp ne i8* %110, null
br i1 %111, label %112, label %122
112: ; preds = %109
%113 = load i8*, i8** %8
%114 = load i8, i8* %113
%115 = sext i8 %114 to i32
%116 = icmp ne i32 %115, 10
br i1 %116, label %117, label %122
117: ; preds = %112
%118 = load i8*, i8** %8
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = icmp ne i32 %120, 0
br label %122
122: ; preds = %117, %112, %109
%123 = phi i1 [ false, %112 ], [ false, %109 ], [ %121, %117 ]
br i1 %123, label %124, label %131
124: ; preds = %122
%125 = load i8*, i8** %8
%126 = getelementptr inbounds i8, i8* %125, i32 1
store i8* %126, i8** %8
%127 = load i8, i8* %125
%128 = load i8*, i8** %9
store i8 %127, i8* %128
%129 = load i8*, i8** %9
%130 = getelementptr inbounds i8, i8* %129, i32 1
store i8* %130, i8** %9
br label %109
131: ; preds = %122
%132 = load i8*, i8** %8
%133 = icmp ne i8* %132, null
br i1 %133, label %134, label %139
134: ; preds = %131
%135 = load i8*, i8** %8
%136 = load i8, i8* %135
%137 = sext i8 %136 to i32
%138 = icmp eq i32 %137, 0
br i1 %138, label %139, label %140
139: ; preds = %134, %131
store i32 1, i32* %4
br label %168
140: ; preds = %134
%141 = load i8*, i8** %9
store i8 0, i8* %141
br label %142
142: ; preds = %160, %140
%143 = load i8*, i8** %9
%144 = getelementptr inbounds i8, i8* %143, i32 -1
store i8* %144, i8** %9
%145 = load i8*, i8** %6
%146 = icmp ugt i8* %144, %145
br i1 %146, label %147, label %158
147: ; preds = %142
%148 = load i8*, i8** %9
%149 = load i8, i8* %148
%150 = call i32 @isprint(i8 signext %149)
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %156
152: ; preds = %147
%153 = load i8*, i8** %9
%154 = call i64 @strpbrk(i8* %153, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%155 = icmp ne i64 %154, 0
br label %156
156: ; preds = %152, %147
%157 = phi i1 [ true, %147 ], [ %155, %152 ]
br label %158
158: ; preds = %156, %142
%159 = phi i1 [ false, %142 ], [ %157, %156 ]
br i1 %159, label %160, label %162
160: ; preds = %158
%161 = load i8*, i8** %9
store i8 0, i8* %161
br label %142
162: ; preds = %158
%163 = load i8*, i8** %9
%164 = load i8*, i8** %6
%165 = icmp ule i8* %163, %164
br i1 %165, label %166, label %167
166: ; preds = %162
store i32 1, i32* %4
br label %168
167: ; preds = %162
store i32 0, i32* %4
br label %168
168: ; preds = %167, %166, %139, %94, %61
%169 = load i32, i32* %4
ret i32 %169
}

LLVM IR (-O2):
@.str = [6 x i8] c"\0AEXTD\00"
@.str.1 = [7 x i8] c"YEAR: \00"
@.str.2 = [8 x i8] c"\0ADYEAR=\00"
@.str.3 = [7 x i8] c"\0ADGENR\00"
@.str.4 = [5 x i8] c"\0ADYE\00"
@.str.5 = [6 x i8] c"\0ADTIT\00"
@.str.6 = [6 x i8] c"TITLE\00"
@.str.7 = [6 x i8] c"-_ \09/\00"
define i32 @cddb_gettitle(i8* %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, -3
br i1 %4, label %5, label %20
5: ; preds = %3
%6 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %28, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @strchr(i8* %9, i8 signext 10)
%11 = tail call i8* @strstr(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %28, label %13
13: ; preds = %8
%14 = icmp ule i8* %10, %11
%15 = icmp ne i8* %10, null
%16 = and i1 %15, %14
br i1 %16, label %28, label %17
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %11, i64 -1
%19 = tail call i32 @memcpy(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
br label %28
20: ; preds = %3
%21 = icmp ugt i32 %2, -3
br i1 %21, label %25, label %22
22: ; preds = %20
%23 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i8* %23, null
br i1 %24, label %40, label %33
25: ; preds = %20
%26 = icmp eq i32 %2, -1
%27 = select i1 %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
br label %28
28: ; preds = %25, %8, %17, %13, %5
%29 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %17 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %8 ], [ %27, %25 ]
%30 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %29)
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = icmp eq i8* %30, null
br i1 %32, label %80, label %56
33: ; preds = %22, %33
%34 = phi i8* [ %38, %33 ], [ %23, %22 ]
%35 = phi i32 [ %36, %33 ], [ -1, %22 ]
%36 = add nsw i32 %35, 1
%37 = getelementptr inbounds i8, i8* %34, i64 1
%38 = tail call i8* @strstr(i8* dereferenceable(1) %37, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %33
40: ; preds = %33, %22
%41 = phi i32 [ -1, %22 ], [ %36, %33 ]
%42 = icmp eq i32 %2, 0
%43 = add nsw i32 %41, %2
%44 = select i1 %42, i32 0, i32 %43
%45 = icmp sgt i32 %44, -1
br i1 %45, label %46, label %56
46: ; preds = %40, %52
%47 = phi i32 [ %54, %52 ], [ %44, %40 ]
%48 = phi i8* [ %53, %52 ], [ %0, %40 ]
%49 = tail call i8* @strstr(i8* dereferenceable(1) %48, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %52
51: ; preds = %46
store i8 0, i8* %1
br label %80
52: ; preds = %46
%53 = getelementptr inbounds i8, i8* %49, i64 2
%54 = add nsw i32 %47, -1
%55 = icmp sgt i32 %47, 0
br i1 %55, label %46, label %56
56: ; preds = %52, %40, %28
%57 = phi i8* [ %31, %28 ], [ %0, %40 ], [ %53, %52 ]
%58 = tail call i8* @strchr(i8* dereferenceable(1) %57, i8 signext 61)
br label %59
59: ; preds = %64, %56
%60 = phi i8* [ %58, %56 ], [ %62, %64 ]
%61 = phi i8* [ %1, %56 ], [ %65, %64 ]
%62 = getelementptr inbounds i8, i8* %60, i64 1
%63 = load i8, i8* %62
switch i8 %63, label %64 [
i8 0, label %80
i8 10, label %66
]
64: ; preds = %59
store i8 %63, i8* %61
%65 = getelementptr inbounds i8, i8* %61, i64 1
br label %59
66: ; preds = %59
store i8 0, i8* %61
%67 = getelementptr inbounds i8, i8* %61, i64 -1
%68 = icmp ugt i8* %67, %1
br i1 %68, label %69, label %80
69: ; preds = %66, %77
%70 = phi i8* [ %78, %77 ], [ %67, %66 ]
%71 = load i8, i8* %70
%72 = tail call i32 @isprint(i8 signext %71)
%73 = icmp eq i32 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %69
%75 = tail call i64 @strpbrk(i8* %70, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %80, label %77
77: ; preds = %69, %74
store i8 0, i8* %70
%78 = getelementptr inbounds i8, i8* %70, i64 -1
%79 = icmp ugt i8* %78, %1
br i1 %79, label %69, label %80
80: ; preds = %59, %77, %74, %66, %28, %51
%81 = phi i32 [ 1, %51 ], [ 1, %28 ], [ 1, %66 ], [ 1, %77 ], [ 0, %74 ], [ 1, %59 ]
ret i32 %81
}