#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*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok_r(char *, char *, char **);
char *parse_sort_criteria(char *sortCriteria, int *error) {
  char *order = NULL;
  char *item, *saveptr;
  int i, ret, reverse, title_sorted = 0;
  *error = 0;
  if (!sortCriteria)
    return NULL;
  if ((item = strtok_r(sortCriteria, ",", &saveptr))) {
    order = malloc(4096);
    strcpy(order, "order by ");
  }
  for (i = 0; item != NULL; i++) {
    reverse = 0;
    if (i)
      strcat(order, ", ");
    if (*item == '+') {
      item++;
    } else if (*item == '-') {
      reverse = 1;
      item++;
    }
    if (strcasecmp(item, "upnp:class") == 0) {
      strcat(order, "o.CLASS");
    } else if (strcasecmp(item, "dc:title") == 0) {
      strcat(order, "d.TITLE");
      title_sorted = 1;
    } else if (strcasecmp(item, "dc:date") == 0) {
      strcat(order, "d.DATE");
    } else if (strcasecmp(item, "upnp:originalTrackNumber") == 0) {
      strcat(order, "d.DISC, d.TRACK");
    } else {
      printf("Unhandled SortCriteria [%s]\n", item);
      *error = 1;
      if (i) {
        ret = strlen(order);
        order[ret - 2] = '\0';
      }
      i--;
      goto unhandled_order;
    }
    if (reverse)
      strcat(order, " DESC");
  unhandled_order:
    item = strtok_r(NULL, ",", &saveptr);
  }
  if (i <= 0) {
    free(order);
    return NULL;
  }
  if (!title_sorted)
    strcat(order, ", TITLE ASC");
  return order;
}


x86 assembly (clang, -O0):
<parse_sort_criteria>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    11c1 <parse_sort_criteria+0x41>
movq   $0x0,-0x8(%rbp)
jmp    1425 <parse_sort_criteria+0x2a5>
mov    -0x10(%rbp),%rdi
lea    0xe34(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1080 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1201 <parse_sort_criteria+0x81>
mov    $0x1000,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   1050 <strcpy@plt>
movl   $0x0,-0x34(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     13e3 <parse_sort_criteria+0x263>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1234 <parse_sort_criteria+0xb4>
mov    -0x20(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    1255 <parse_sort_criteria+0xd5>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    127d <parse_sort_criteria+0xfd>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1278 <parse_sort_criteria+0xf8>
movl   $0x1,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    127d <parse_sort_criteria+0xfd>
mov    -0x28(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12ac <parse_sort_criteria+0x12c>
mov    -0x20(%rbp),%rdi
lea    0xd78(%rip),%rsi
call   10a0 <strcat@plt>
jmp    139e <parse_sort_criteria+0x21e>
mov    -0x28(%rbp),%rdi
lea    0xd6b(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12e2 <parse_sort_criteria+0x162>
mov    -0x20(%rbp),%rdi
lea    0xd5a(%rip),%rsi
call   10a0 <strcat@plt>
movl   $0x1,-0x40(%rbp)
jmp    1399 <parse_sort_criteria+0x219>
mov    -0x28(%rbp),%rdi
lea    0xd46(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1311 <parse_sort_criteria+0x191>
mov    -0x20(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   10a0 <strcat@plt>
jmp    1394 <parse_sort_criteria+0x214>
mov    -0x28(%rbp),%rdi
lea    0xd26(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1340 <parse_sort_criteria+0x1c0>
mov    -0x20(%rbp),%rdi
lea    0xd25(%rip),%rsi
call   10a0 <strcat@plt>
jmp    138f <parse_sort_criteria+0x20f>
mov    -0x28(%rbp),%rsi
lea    0xd20(%rip),%rdi
call   1070 <printf@plt>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
cmpl   $0x0,-0x34(%rbp)
je     1381 <parse_sort_criteria+0x201>
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    13bd <parse_sort_criteria+0x23d>
jmp    1394 <parse_sort_criteria+0x214>
jmp    1399 <parse_sort_criteria+0x219>
jmp    139e <parse_sort_criteria+0x21e>
cmpl   $0x0,-0x3c(%rbp)
je     13b8 <parse_sort_criteria+0x238>
mov    -0x20(%rbp),%rdi
lea    0xcd5(%rip),%rsi
call   10a0 <strcat@plt>
jmp    13bd <parse_sort_criteria+0x23d>
xor    %eax,%eax
mov    %eax,%edi
lea    0xc38(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1080 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1208 <parse_sort_criteria+0x88>
cmpl   $0x0,-0x34(%rbp)
jg     1403 <parse_sort_criteria+0x283>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    1425 <parse_sort_criteria+0x2a5>
cmpl   $0x0,-0x40(%rbp)
jne    141d <parse_sort_criteria+0x29d>
mov    -0x20(%rbp),%rdi
lea    0xc76(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_sort_criteria>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
movl   $0x0,(%rsi)
test   %rdi,%rdi
je     135a <parse_sort_criteria+0x1da>
lea    0xe57(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1080 <strtok_r@plt>
test   %rax,%rax
je     1350 <parse_sort_criteria+0x1d0>
mov    %rax,%r12
xor    %eax,%eax
mov    %rax,(%rsp)
mov    $0x1000,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
lea    0xe29(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
lea    0x10(%rsp),%r13
xor    %r14d,%r14d
jmp    1214 <parse_sort_criteria+0x94>
add    $0xffffffff,%r14d
nop
mov    %r14d,%ebp
xor    %edi,%edi
lea    0xe04(%rip),%rsi
mov    %r13,%rdx
call   1080 <strtok_r@plt>
mov    %rax,%r12
lea    0x1(%rbp),%r14d
test   %rax,%rax
je     1335 <parse_sort_criteria+0x1b5>
test   %r14d,%r14d
je     1228 <parse_sort_criteria+0xa8>
mov    %rbx,%rdi
lea    0xde9(%rip),%rsi
call   10a0 <strcat@plt>
movzbl (%r12),%eax
cmp    $0x2d,%al
je     1240 <parse_sort_criteria+0xc0>
mov    $0x1,%r15b
cmp    $0x2b,%al
jne    1247 <parse_sort_criteria+0xc7>
add    $0x1,%r12
jmp    1247 <parse_sort_criteria+0xc7>
xchg   %ax,%ax
add    $0x1,%r12
xor    %r15d,%r15d
mov    %r12,%rdi
lea    0xdbe(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     12d0 <parse_sort_criteria+0x150>
mov    %r12,%rdi
lea    0xdbd(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     12e0 <parse_sort_criteria+0x160>
mov    %r12,%rdi
lea    0xdba(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     12f2 <parse_sort_criteria+0x172>
mov    %r12,%rdi
lea    0xdb5(%rip),%rsi
call   1040 <strcasecmp@plt>
test   %rax,%rax
je     12fb <parse_sort_criteria+0x17b>
lea    0xdcd(%rip),%rdi
mov    %r12,%rsi
call   1070 <printf@plt>
mov    0x8(%rsp),%rax
movl   $0x1,(%rax)
test   %r14d,%r14d
je     11eb <parse_sort_criteria+0x6b>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x2(%rax,%rbx,1)
jmp    11eb <parse_sort_criteria+0x6b>
xchg   %ax,%ax
lea    0xd43(%rip),%rsi
jmp    1310 <parse_sort_criteria+0x190>
nopl   0x0(%rax)
mov    $0x1,%eax
mov    %rax,(%rsp)
lea    0xd3b(%rip),%rsi
jmp    1310 <parse_sort_criteria+0x190>
lea    0xd42(%rip),%rsi
jmp    1310 <parse_sort_criteria+0x190>
lea    0xd59(%rip),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10a0 <strcat@plt>
test   %r15b,%r15b
jne    11f0 <parse_sort_criteria+0x70>
mov    %rbx,%rdi
lea    0xd5d(%rip),%rsi
call   10a0 <strcat@plt>
jmp    11f0 <parse_sort_criteria+0x70>
test   %ebp,%ebp
js     1352 <parse_sort_criteria+0x1d2>
cmpl   $0x0,(%rsp)
jne    135c <parse_sort_criteria+0x1dc>
lea    0xd48(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strcat@plt>
jmp    135c <parse_sort_criteria+0x1dc>
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c",\00"
@.str.1 = [10 x i8] c"order by \00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [11 x i8] c"upnp:class\00"
@.str.4 = [8 x i8] c"o.CLASS\00"
@.str.5 = [9 x i8] c"dc:title\00"
@.str.6 = [8 x i8] c"d.TITLE\00"
@.str.7 = [8 x i8] c"dc:date\00"
@.str.8 = [7 x i8] c"d.DATE\00"
@.str.9 = [25 x i8] c"upnp:originalTrackNumber\00"
@.str.10 = [16 x i8] c"d.DISC, d.TRACK\00"
@.str.11 = [29 x i8] c"Unhandled SortCriteria [%s]\0A\00"
@.str.12 = [6 x i8] c" DESC\00"
@.str.13 = [12 x i8] c", TITLE ASC\00"
define i8* @parse_sort_criteria(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* null, i8** %6
store i32 0, i32* %12
%13 = load i32*, i32** %5
store i32 0, i32* %13
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %17, label %16
16: ; preds = %2
store i8* null, i8** %3
br label %126
17: ; preds = %2
%18 = load i8*, i8** %4
%19 = call i8* @strtok_r(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8)
store i8* %19, i8** %7
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = call i8* @malloc(i32 4096)
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %21, %17
store i32 0, i32* %9
br label %26
26: ; preds = %109, %25
%27 = load i8*, i8** %7
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %112
29: ; preds = %26
store i32 0, i32* %11
%30 = load i32, i32* %9
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i8*, i8** %6
%34 = call i32 @strcat(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %32, %29
%36 = load i8*, i8** %7
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 43
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %7
br label %52
43: ; preds = %35
%44 = load i8*, i8** %7
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 45
br i1 %47, label %48, label %51
48: ; preds = %43
store i32 1, i32* %11
%49 = load i8*, i8** %7
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %7
br label %51
51: ; preds = %48, %43
br label %52
52: ; preds = %51, %40
%53 = load i8*, i8** %7
%54 = call i64 @strcasecmp(i8* %53, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i8*, i8** %6
%58 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %100
59: ; preds = %52
%60 = load i8*, i8** %7
%61 = call i64 @strcasecmp(i8* %60, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i8*, i8** %6
%65 = call i32 @strcat(i8* %64, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %12
br label %99
66: ; preds = %59
%67 = load i8*, i8** %7
%68 = call i64 @strcasecmp(i8* %67, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = load i8*, i8** %6
%72 = call i32 @strcat(i8* %71, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %98
73: ; preds = %66
%74 = load i8*, i8** %7
%75 = call i64 @strcasecmp(i8* %74, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = load i8*, i8** %6
%79 = call i32 @strcat(i8* %78, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %97
80: ; preds = %73
%81 = load i8*, i8** %7
%82 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %81)
%83 = load i32*, i32** %5
store i32 1, i32* %83
%84 = load i32, i32* %9
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %94
86: ; preds = %80
%87 = load i8*, i8** %6
%88 = call i32 @strlen(i8* %87)
store i32 %88, i32* %10
%89 = load i8*, i8** %6
%90 = load i32, i32* %10
%91 = sub nsw i32 %90, 2
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %89, i64 %92
store i8 0, i8* %93
br label %94
94: ; preds = %86, %80
%95 = load i32, i32* %9
%96 = add nsw i32 %95, -1
store i32 %96, i32* %9
br label %107
97: ; preds = %77
br label %98
98: ; preds = %97, %70
br label %99
99: ; preds = %98, %63
br label %100
100: ; preds = %99, %56
%101 = load i32, i32* %11
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %100
%104 = load i8*, i8** %6
%105 = call i32 @strcat(i8* %104, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
br label %106
106: ; preds = %103, %100
br label %107
107: ; preds = %106, %94
%108 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8)
store i8* %108, i8** %7
br label %109
109: ; preds = %107
%110 = load i32, i32* %9
%111 = add nsw i32 %110, 1
store i32 %111, i32* %9
br label %26
112: ; preds = %26
%113 = load i32, i32* %9
%114 = icmp sle i32 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %112
%116 = load i8*, i8** %6
%117 = call i32 @free(i8* %116)
store i8* null, i8** %3
br label %126
118: ; preds = %112
%119 = load i32, i32* %12
%120 = icmp ne i32 %119, 0
br i1 %120, label %124, label %121
121: ; preds = %118
%122 = load i8*, i8** %6
%123 = call i32 @strcat(i8* %122, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
br label %124
124: ; preds = %121, %118
%125 = load i8*, i8** %6
store i8* %125, i8** %3
br label %126
126: ; preds = %124, %115, %16
%127 = load i8*, i8** %3
ret i8* %127
}

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
@.str.1 = [10 x i8] c"order by \00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [11 x i8] c"upnp:class\00"
@.str.4 = [8 x i8] c"o.CLASS\00"
@.str.5 = [9 x i8] c"dc:title\00"
@.str.6 = [8 x i8] c"d.TITLE\00"
@.str.7 = [8 x i8] c"dc:date\00"
@.str.8 = [7 x i8] c"d.DATE\00"
@.str.9 = [25 x i8] c"upnp:originalTrackNumber\00"
@.str.10 = [16 x i8] c"d.DISC, d.TRACK\00"
@.str.11 = [29 x i8] c"Unhandled SortCriteria [%s]\0A\00"
@.str.12 = [6 x i8] c" DESC\00"
@.str.13 = [12 x i8] c", TITLE ASC\00"
define i8* @parse_sort_criteria(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i32 0, i32* %1
%5 = icmp eq i8* %0, null
br i1 %5, label %69, label %6
6: ; preds = %2
%7 = call i8* @strtok_r(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %3)
%8 = icmp eq i8* %7, null
br i1 %8, label %62, label %9
9: ; preds = %6
%10 = call dereferenceable_or_null(4096) i8* @malloc(i32 4096)
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %54
%13 = phi i32 [ %56, %54 ], [ 0, %9 ]
%14 = phi i32 [ %58, %54 ], [ 0, %9 ]
%15 = phi i8* [ %57, %54 ], [ %7, %9 ]
%16 = icmp eq i32 %14, 0
br i1 %16, label %19, label %17
17: ; preds = %12
%18 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
%20 = load i8, i8* %15
switch i8 %20, label %25 [
i8 43, label %21
i8 45, label %23
]
21: ; preds = %19
%22 = getelementptr inbounds i8, i8* %15, i64 1
br label %25
23: ; preds = %19
%24 = getelementptr inbounds i8, i8* %15, i64 1
br label %25
25: ; preds = %19, %23, %21
%26 = phi i8* [ %22, %21 ], [ %24, %23 ], [ %15, %19 ]
%27 = phi i1 [ true, %21 ], [ false, %23 ], [ true, %19 ]
%28 = call i64 @strcasecmp(i8* %26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %48, label %30
30: ; preds = %25
%31 = call i64 @strcasecmp(i8* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %48, label %33
33: ; preds = %30
%34 = call i64 @strcasecmp(i8* %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %48, label %36
36: ; preds = %33
%37 = call i64 @strcasecmp(i8* %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %48, label %39
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %26)
store i32 1, i32* %1
br i1 %16, label %46, label %41
41: ; preds = %39
%42 = call i32 @strlen(i8* %10)
%43 = add nsw i32 %42, -2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %10, i64 %44
store i8 0, i8* %45
br label %46
46: ; preds = %41, %39
%47 = add nsw i32 %14, -1
br label %54
48: ; preds = %36, %33, %30, %25
%49 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %25 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %30 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), %33 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %36 ]
%50 = phi i32 [ %13, %25 ], [ 1, %30 ], [ %13, %33 ], [ %13, %36 ]
%51 = call i32 @strcat(i8* %10, i8* %49)
br i1 %27, label %54, label %52
52: ; preds = %48
%53 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
br label %54
54: ; preds = %48, %52, %46
%55 = phi i32 [ %14, %52 ], [ %14, %48 ], [ %47, %46 ]
%56 = phi i32 [ %50, %52 ], [ %50, %48 ], [ %13, %46 ]
%57 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %3)
%58 = add nsw i32 %55, 1
%59 = icmp eq i8* %57, null
br i1 %59, label %60, label %12
60: ; preds = %54
%61 = icmp slt i32 %55, 0
br i1 %61, label %62, label %65
62: ; preds = %6, %60
%63 = phi i8* [ %10, %60 ], [ null, %6 ]
%64 = call i32 @free(i8* %63)
br label %69
65: ; preds = %60
%66 = icmp eq i32 %56, 0
br i1 %66, label %67, label %69
67: ; preds = %65
%68 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
br label %69
69: ; preds = %65, %67, %2, %62
%70 = phi i8* [ null, %62 ], [ null, %2 ], [ %10, %67 ], [ %10, %65 ]
ret i8* %70
}