#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*/ db_get_error(char **, int, ...);
int db_sql_exec_fn(char **, int, char *, char *, ...);
int db_sql_fetch_int(char **, int *, char *, ...);
int /*<<< orphan*/ db_sql_parse_smart(char **, char **, char *);
int /*<<< orphan*/ db_sql_update_playlists(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int db_sql_edit_playlist(char **pe, int id, char *name, char *clause) {
  int result;
  int playlist_type;
  int dup_id = id;
  char *criteria;
  char *estring;
  if ((name == NULL) && (clause == NULL))
    return 0x00;
  if (id == 1) {
    db_get_error(pe, 0x06);
    return 0x06;
  }
  result = db_sql_fetch_int(pe, &playlist_type,
                            "select type from playlists where id=%d", id);
  if (result != 0x00) {
    if (result == 0x05) {
      if (pe) {
        free(*pe);
      };
      db_get_error(pe, 0x06);
      return 0x06;
    }
    return result;
  }
  if ((playlist_type == 1) && (clause)) {
    if (!db_sql_parse_smart(&estring, &criteria, clause)) {
      db_get_error(pe, 0x08, estring);
      free(estring);
      return 0x08;
    }
    free(criteria);
  }
  if (name) {
    result = db_sql_fetch_int(pe, &dup_id,
                              "select id from playlists "
                              "where upper(title)=upper('%q')",
                              name);
    if ((result != 0x00) && (result != 0x05))
      return result;
    if (result == 0x05)
      if (pe)
        free(*pe);
    if (dup_id != id) {
      db_get_error(pe, 0x02, name);
      return 0x02;
    }
    if ((playlist_type == 1) && (clause)) {
      result = db_sql_exec_fn(pe, 1,
                              "update playlists set title='%q', "
                              "query='%q' where id=%d",
                              name, clause, id);
    } else {
      result = db_sql_exec_fn(pe, 1,
                              "update playlists set title='%q' "
                              "where id=%d",
                              name, id);
    }
    db_sql_update_playlists(NULL);
    return result;
  }
  if ((playlist_type == 1) && (clause)) {
    result = db_sql_exec_fn(pe, 1,
                            "update playlists set query='%q' "
                            "where id=%d",
                            clause, id);
    db_sql_update_playlists(NULL);
    return result;
  }
  return 0x00;
}


x86 assembly (clang, -O0):
<db_sql_edit_playlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    119f <db_sql_edit_playlist+0x3f>
cmpq   $0x0,-0x28(%rbp)
jne    119f <db_sql_edit_playlist+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
cmpl   $0x1,-0x14(%rbp)
jne    11c5 <db_sql_edit_playlist+0x65>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1080 <db_get_error@plt>
movl   $0x6,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    -0x30(%rbp),%rsi
lea    0xe29(%rip),%rdx
mov    $0x0,%al
call   1070 <db_sql_fetch_int@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1233 <db_sql_edit_playlist+0xd3>
cmpl   $0x5,-0x2c(%rbp)
jne    1228 <db_sql_edit_playlist+0xc8>
cmpq   $0x0,-0x10(%rbp)
je     120c <db_sql_edit_playlist+0xac>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1080 <db_get_error@plt>
movl   $0x6,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
cmpl   $0x1,-0x30(%rbp)
jne    1294 <db_sql_edit_playlist+0x134>
cmpq   $0x0,-0x28(%rbp)
je     1294 <db_sql_edit_playlist+0x134>
mov    -0x28(%rbp),%rdx
lea    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <db_sql_parse_smart@plt>
cmp    $0x0,%eax
jne    128b <db_sql_edit_playlist+0x12b>
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    $0x8,%esi
mov    $0x0,%al
call   1080 <db_get_error@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0x8,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x20(%rbp)
je     13a3 <db_sql_edit_playlist+0x243>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rcx
lea    -0x34(%rbp),%rsi
lea    0xd75(%rip),%rdx
mov    $0x0,%al
call   1070 <db_sql_fetch_int@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     12db <db_sql_edit_playlist+0x17b>
cmpl   $0x5,-0x2c(%rbp)
je     12db <db_sql_edit_playlist+0x17b>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
cmpl   $0x5,-0x2c(%rbp)
jne    1301 <db_sql_edit_playlist+0x1a1>
cmpq   $0x0,-0x10(%rbp)
je     12fc <db_sql_edit_playlist+0x19c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    1301 <db_sql_edit_playlist+0x1a1>
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     132d <db_sql_edit_playlist+0x1cd>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2,%esi
mov    $0x0,%al
call   1080 <db_get_error@plt>
movl   $0x2,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
cmpl   $0x1,-0x30(%rbp)
jne    136d <db_sql_edit_playlist+0x20d>
cmpq   $0x0,-0x28(%rbp)
je     136d <db_sql_edit_playlist+0x20d>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x14(%rbp),%r9d
mov    $0x1,%esi
lea    0xd01(%rip),%rdx
mov    $0x0,%al
call   1040 <db_sql_exec_fn@plt>
mov    %eax,-0x2c(%rbp)
jmp    138f <db_sql_edit_playlist+0x22f>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x1,%esi
lea    0xd12(%rip),%rdx
mov    $0x0,%al
call   1040 <db_sql_exec_fn@plt>
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <db_sql_update_playlists@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
cmpl   $0x1,-0x30(%rbp)
jne    13ee <db_sql_edit_playlist+0x28e>
cmpq   $0x0,-0x28(%rbp)
je     13ee <db_sql_edit_playlist+0x28e>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x1,%esi
lea    0xcf3(%rip),%rdx
mov    $0x0,%al
call   1040 <db_sql_exec_fn@plt>
mov    %eax,-0x2c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <db_sql_update_playlists@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f5 <db_sql_edit_playlist+0x295>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_sql_edit_playlist>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %esi,0xc(%rsp)
xor    %ebx,%ebx
mov    %rdx,%rax
or     %rcx,%rax
je     130c <db_sql_edit_playlist+0x1ac>
mov    %esi,%ebp
mov    %rdi,%r14
cmp    $0x1,%esi
jne    11a1 <db_sql_edit_playlist+0x41>
mov    $0x6,%ebx
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1080 <db_get_error@plt>
jmp    130c <db_sql_edit_playlist+0x1ac>
mov    %rcx,%r15
mov    %rdx,%r12
lea    0xe52(%rip),%rdx
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    %ebp,%ecx
xor    %eax,%eax
call   1070 <db_sql_fetch_int@plt>
test   %eax,%eax
je     11dd <db_sql_edit_playlist+0x7d>
mov    %eax,%ebx
cmp    $0x5,%eax
jne    130c <db_sql_edit_playlist+0x1ac>
test   %r14,%r14
je     1188 <db_sql_edit_playlist+0x28>
mov    (%r14),%rdi
call   1030 <free@plt>
jmp    1188 <db_sql_edit_playlist+0x28>
test   %r15,%r15
je     120d <db_sql_edit_playlist+0xad>
cmpl   $0x1,0x8(%rsp)
jne    120d <db_sql_edit_playlist+0xad>
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    %r15,%rdx
call   1050 <db_sql_parse_smart@plt>
test   %eax,%eax
je     12a9 <db_sql_edit_playlist+0x149>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
test   %r12,%r12
je     1287 <db_sql_edit_playlist+0x127>
lea    0xe0e(%rip),%rdx
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
mov    %r12,%rcx
xor    %eax,%eax
call   1070 <db_sql_fetch_int@plt>
mov    %eax,%ebx
cmp    $0x5,%eax
je     123a <db_sql_edit_playlist+0xda>
test   %ebx,%ebx
jne    130c <db_sql_edit_playlist+0x1ac>
test   %r14,%r14
je     124c <db_sql_edit_playlist+0xec>
cmp    $0x5,%ebx
jne    124c <db_sql_edit_playlist+0xec>
mov    (%r14),%rdi
call   1030 <free@plt>
cmp    %ebp,0xc(%rsp)
jne    12ce <db_sql_edit_playlist+0x16e>
test   %r15,%r15
je     12e7 <db_sql_edit_playlist+0x187>
cmpl   $0x1,0x8(%rsp)
jne    12e7 <db_sql_edit_playlist+0x187>
lea    0xdf2(%rip),%rdx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r12,%rcx
mov    %r15,%r8
mov    %ebp,%r9d
xor    %eax,%eax
call   1040 <db_sql_exec_fn@plt>
jmp    1303 <db_sql_edit_playlist+0x1a3>
xor    %ebx,%ebx
test   %r15,%r15
je     130c <db_sql_edit_playlist+0x1ac>
cmpl   $0x1,0x8(%rsp)
jne    130c <db_sql_edit_playlist+0x1ac>
lea    0xe27(%rip),%rdx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r15,%rcx
jmp    12f9 <db_sql_edit_playlist+0x199>
mov    0x10(%rsp),%rdx
mov    $0x8,%ebx
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1080 <db_get_error@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
jmp    130c <db_sql_edit_playlist+0x1ac>
mov    $0x2,%ebx
mov    %r14,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1080 <db_get_error@plt>
jmp    130c <db_sql_edit_playlist+0x1ac>
lea    0xda9(%rip),%rdx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r12,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1040 <db_sql_exec_fn@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1060 <db_sql_update_playlists@plt>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"select type from playlists where id=%d\00"
@.str.1 = [56 x i8] c"select id from playlists where upper(title)=upper('%q')\00"
@.str.2 = [56 x i8] c"update playlists set title='%q', query='%q' where id=%d\00"
@.str.3 = [44 x i8] c"update playlists set title='%q' where id=%d\00"
@.str.4 = [44 x i8] c"update playlists set query='%q' where id=%d\00"
define i32 @db_sql_edit_playlist(i8** %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
store i8** %0, i8*** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%15 = load i32, i32* %7
store i32 %15, i32* %12
%16 = load i8*, i8** %8
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %4
%19 = load i8*, i8** %9
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 0, i32* %5
br label %135
22: ; preds = %18, %4
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i8**, i8*** %6
%27 = call i32 (i8**, i32, ...) @db_get_error(i8** %26, i32 6)
store i32 6, i32* %5
br label %135
28: ; preds = %22
%29 = load i8**, i8*** %6
%30 = load i32, i32* %7
%31 = call i32 (i8**, i32*, i8*, ...) @db_sql_fetch_int(i8** %29, i32* %11, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %30)
store i32 %31, i32* %10
%32 = load i32, i32* %10
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %49
34: ; preds = %28
%35 = load i32, i32* %10
%36 = icmp eq i32 %35, 5
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i8**, i8*** %6
%39 = icmp ne i8** %38, null
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load i8**, i8*** %6
%42 = load i8*, i8** %41
%43 = call i32 @free(i8* %42)
br label %44
44: ; preds = %40, %37
%45 = load i8**, i8*** %6
%46 = call i32 (i8**, i32, ...) @db_get_error(i8** %45, i32 6)
store i32 6, i32* %5
br label %135
47: ; preds = %34
%48 = load i32, i32* %10
store i32 %48, i32* %5
br label %135
49: ; preds = %28
%50 = load i32, i32* %11
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %68
52: ; preds = %49
%53 = load i8*, i8** %9
%54 = icmp ne i8* %53, null
br i1 %54, label %55, label %68
55: ; preds = %52
%56 = load i8*, i8** %9
%57 = call i32 @db_sql_parse_smart(i8** %14, i8** %13, i8* %56)
%58 = icmp ne i32 %57, 0
br i1 %58, label %65, label %59
59: ; preds = %55
%60 = load i8**, i8*** %6
%61 = load i8*, i8** %14
%62 = call i32 (i8**, i32, ...) @db_get_error(i8** %60, i32 8, i8* %61)
%63 = load i8*, i8** %14
%64 = call i32 @free(i8* %63)
store i32 8, i32* %5
br label %135
65: ; preds = %55
%66 = load i8*, i8** %13
%67 = call i32 @free(i8* %66)
br label %68
68: ; preds = %65, %52, %49
%69 = load i8*, i8** %8
%70 = icmp ne i8* %69, null
br i1 %70, label %71, label %121
71: ; preds = %68
%72 = load i8**, i8*** %6
%73 = load i8*, i8** %8
%74 = call i32 (i8**, i32*, i8*, ...) @db_sql_fetch_int(i8** %72, i32* %12, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %73)
store i32 %74, i32* %10
%75 = load i32, i32* %10
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %82
77: ; preds = %71
%78 = load i32, i32* %10
%79 = icmp ne i32 %78, 5
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = load i32, i32* %10
store i32 %81, i32* %5
br label %135
82: ; preds = %77, %71
%83 = load i32, i32* %10
%84 = icmp eq i32 %83, 5
br i1 %84, label %85, label %93
85: ; preds = %82
%86 = load i8**, i8*** %6
%87 = icmp ne i8** %86, null
br i1 %87, label %88, label %92
88: ; preds = %85
%89 = load i8**, i8*** %6
%90 = load i8*, i8** %89
%91 = call i32 @free(i8* %90)
br label %92
92: ; preds = %88, %85
br label %93
93: ; preds = %92, %82
%94 = load i32, i32* %12
%95 = load i32, i32* %7
%96 = icmp ne i32 %94, %95
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = load i8**, i8*** %6
%99 = load i8*, i8** %8
%100 = call i32 (i8**, i32, ...) @db_get_error(i8** %98, i32 2, i8* %99)
store i32 2, i32* %5
br label %135
101: ; preds = %93
%102 = load i32, i32* %11
%103 = icmp eq i32 %102, 1
br i1 %103, label %104, label %113
104: ; preds = %101
%105 = load i8*, i8** %9
%106 = icmp ne i8* %105, null
br i1 %106, label %107, label %113
107: ; preds = %104
%108 = load i8**, i8*** %6
%109 = load i8*, i8** %8
%110 = load i8*, i8** %9
%111 = load i32, i32* %7
%112 = call i32 (i8**, i32, i8*, i8*, ...) @db_sql_exec_fn(i8** %108, i32 1, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i8* %109, i8* %110, i32 %111)
store i32 %112, i32* %10
br label %118
113: ; preds = %104, %101
%114 = load i8**, i8*** %6
%115 = load i8*, i8** %8
%116 = load i32, i32* %7
%117 = call i32 (i8**, i32, i8*, i8*, ...) @db_sql_exec_fn(i8** %114, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %115, i32 %116)
store i32 %117, i32* %10
br label %118
118: ; preds = %113, %107
%119 = call i32 @db_sql_update_playlists(i32* null)
%120 = load i32, i32* %10
store i32 %120, i32* %5
br label %135
121: ; preds = %68
%122 = load i32, i32* %11
%123 = icmp eq i32 %122, 1
br i1 %123, label %124, label %134
124: ; preds = %121
%125 = load i8*, i8** %9
%126 = icmp ne i8* %125, null
br i1 %126, label %127, label %134
127: ; preds = %124
%128 = load i8**, i8*** %6
%129 = load i8*, i8** %9
%130 = load i32, i32* %7
%131 = call i32 (i8**, i32, i8*, i8*, ...) @db_sql_exec_fn(i8** %128, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8* %129, i32 %130)
store i32 %131, i32* %10
%132 = call i32 @db_sql_update_playlists(i32* null)
%133 = load i32, i32* %10
store i32 %133, i32* %5
br label %135
134: ; preds = %124, %121
store i32 0, i32* %5
br label %135
135: ; preds = %134, %127, %118, %97, %80, %59, %47, %44, %25, %21
%136 = load i32, i32* %5
ret i32 %136
}

LLVM IR (-O2):
@.str = [39 x i8] c"select type from playlists where id=%d\00"
@.str.1 = [56 x i8] c"select id from playlists where upper(title)=upper('%q')\00"
@.str.2 = [56 x i8] c"update playlists set title='%q', query='%q' where id=%d\00"
@.str.3 = [44 x i8] c"update playlists set title='%q' where id=%d\00"
@.str.4 = [44 x i8] c"update playlists set query='%q' where id=%d\00"
define i32 @db_sql_edit_playlist(i8** %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
store i32 %1, i32* %6
%11 = bitcast i8** %7 to i8*
%12 = bitcast i8** %8 to i8*
%13 = icmp eq i8* %2, null
%14 = icmp eq i8* %3, null
%15 = and i1 %13, %14
br i1 %15, label %78, label %16
16: ; preds = %4
%17 = icmp eq i32 %1, 1
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 (i8**, i32, ...) @db_get_error(i8** %0, i32 6)
br label %78
20: ; preds = %16
%21 = call i32 (i8**, i32*, i8*, ...) @db_sql_fetch_int(i8** %0, i32* %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %1)
switch i32 %21, label %78 [
i32 0, label %29
i32 5, label %22
]
22: ; preds = %20
%23 = icmp eq i8** %0, null
br i1 %23, label %27, label %24
24: ; preds = %22
%25 = load i8*, i8** %0
%26 = call i32 @free(i8* %25)
br label %27
27: ; preds = %24, %22
%28 = call i32 (i8**, i32, ...) @db_get_error(i8** %0, i32 6)
br label %78
29: ; preds = %20
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 1
%32 = icmp ne i8* %3, null
%33 = and i1 %32, %31
br i1 %33, label %34, label %45
34: ; preds = %29
%35 = call i32 @db_sql_parse_smart(i8** %8, i8** %7, i8* %3)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i8*, i8** %8
%39 = call i32 (i8**, i32, ...) @db_get_error(i8** %0, i32 8, i8* %38)
%40 = load i8*, i8** %8
%41 = call i32 @free(i8* %40)
br label %78
42: ; preds = %34
%43 = load i8*, i8** %7
%44 = call i32 @free(i8* %43)
br label %45
45: ; preds = %42, %29
br i1 %13, label %71, label %46
46: ; preds = %45
%47 = call i32 (i8**, i32*, i8*, ...) @db_sql_fetch_int(i8** %0, i32* %6, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8* %2)
switch i32 %47, label %78 [
i32 5, label %48
i32 0, label %48
]
48: ; preds = %46, %46
%49 = icmp eq i32 %47, 5
%50 = icmp ne i8** %0, null
%51 = and i1 %50, %49
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i8*, i8** %0
%54 = call i32 @free(i8* %53)
br label %55
55: ; preds = %52, %48
%56 = load i32, i32* %6
%57 = icmp eq i32 %56, %1
br i1 %57, label %60, label %58
58: ; preds = %55
%59 = call i32 (i8**, i32, ...) @db_get_error(i8** %0, i32 2, i8* %2)
br label %78
60: ; preds = %55
%61 = load i32, i32* %5
%62 = icmp eq i32 %61, 1
%63 = and i1 %32, %62
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = call i32 (i8**, i32, i8*, i8*, ...) @db_sql_exec_fn(i8** %0, i32 1, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* %3, i32 %1)
br label %68
66: ; preds = %60
%67 = call i32 (i8**, i32, i8*, i8*, ...) @db_sql_exec_fn(i8** %0, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 %1)
br label %68
68: ; preds = %66, %64
%69 = phi i32 [ %65, %64 ], [ %67, %66 ]
%70 = call i32 @db_sql_update_playlists(i32* null)
br label %78
71: ; preds = %45
%72 = load i32, i32* %5
%73 = icmp eq i32 %72, 1
%74 = and i1 %32, %73
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = call i32 (i8**, i32, i8*, i8*, ...) @db_sql_exec_fn(i8** %0, i32 1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8* %3, i32 %1)
%77 = call i32 @db_sql_update_playlists(i32* null)
br label %78
78: ; preds = %71, %46, %20, %4, %75, %68, %58, %37, %27, %18
%79 = phi i32 [ 6, %18 ], [ 6, %27 ], [ 2, %58 ], [ %69, %68 ], [ %76, %75 ], [ 8, %37 ], [ 0, %4 ], [ %21, %20 ], [ %47, %46 ], [ 0, %71 ]
ret i32 %79
}