#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*/ freeMem(char *, int);
char *mallocMem(int);
int /*<<< orphan*/ splitStr(char *, char *, char **, int *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void format_sql_values_str(char **content, int total_line, char *sqlstr) {
  int trade_index = 0;
  int total_item = 0;
  int line_num = 0;
  int i = 0;
  int j = 0;
  char *values = sqlstr;
  char *str[(10)];
  char stock_code[(7)];
  char trade_index_str[(64)];
  for (i = 0; i < (10); i++)
    str[i] = mallocMem((1024));
  if (0 == line_num)
    strcpy(stock_code, content[0]);
  for (i = 1; i < total_line; i++) {
    splitStr(content[i], ",", str, &total_item);
    if (total_item != (7))
      continue;
    strcat(values, "(");
    sprintf(trade_index_str, "%d", trade_index);
    strcat(values + strlen(values), trade_index_str);
    strcat(values + strlen(values), ",'");
    strcat(values + strlen(values), stock_code);
    strcat(values + strlen(values), "',");
    strcat(values + strlen(values), "'");
    strcat(values + strlen(values), str[0]);
    strcat(values + strlen(values), "'");
    for (j = 1; j < total_item; j++) {
      strcat(values + strlen(values), ",");
      strcat(values + strlen(values), str[j]);
    }
    strcat(values + strlen(values), "),");
    trade_index++;
  }
  values[strlen(values) - 1] = ' ';
  for (i = 0; i < (10); i++)
    freeMem(str[i], (1024));
  return;
}


x86 assembly (clang, -O0):
<format_sql_values_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
jge    11e9 <format_sql_values_str+0x79>
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
mov    %rcx,-0x90(%rbp,%rax,8)
ff
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b8 <format_sql_values_str+0x48>
xor    %eax,%eax
cmp    -0x24(%rbp),%eax
jne    1207 <format_sql_values_str+0x97>
lea    -0x97(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1467 <format_sql_values_str+0x2f7>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x90(%rbp),%rdx
lea    0xdd5(%rip),%rsi
lea    -0x20(%rbp),%rcx
call   1030 <splitStr@plt>
cmpl   $0x7,-0x20(%rbp)
je     124c <format_sql_values_str+0xdc>
jmp    1459 <format_sql_values_str+0x2e9>
mov    -0x38(%rbp),%rdi
lea    0xda9(%rip),%rsi
call   1080 <strcat@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xd95(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x118(%rbp),%rdi
cltq
add    %rax,%rdi
lea    -0xe0(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x110(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xd40(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x108(%rbp),%rdi
cltq
add    %rax,%rdi
lea    -0x97(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x100(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xceb(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xf8(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xcbd(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xf0(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x90(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xe8(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xc65(%rip),%rsi
call   1080 <strcat@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1424 <format_sql_values_str+0x2b4>
mov    -0x38(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x128(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xc29(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x120(%rbp),%rdi
cltq
add    %rax,%rdi
movslq -0x2c(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%rsi
ff
call   1080 <strcat@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13ad <format_sql_values_str+0x23d>
mov    -0x38(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x130(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xbc0(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    120e <format_sql_values_str+0x9e>
mov    -0x38(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x138(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
movl   $0x0,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
jge    14c3 <format_sql_values_str+0x353>
movslq -0x28(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%rdi
ff
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1495 <format_sql_values_str+0x325>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_sql_values_str>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
movl   $0x0,0xc(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x10(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x18(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x20(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x28(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x30(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x38(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x40(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x48(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x50(%rsp)
mov    $0x400,%edi
call   1070 <mallocMem@plt>
mov    %rax,0x58(%rsp)
mov    (%r14),%rsi
lea    0x69(%rsp),%rdi
call   1040 <strcpy@plt>
cmp    $0x2,%ebp
jl     13e1 <format_sql_values_str+0x271>
mov    %ebp,%ebp
xor    %r15d,%r15d
mov    $0x1,%r13d
lea    0xdba(%rip),%r12
mov    %rbp,0x78(%rsp)
mov    %r14,0x70(%rsp)
jmp    1295 <format_sql_values_str+0x125>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xd96(%rip),%rsi
call   1080 <strcat@plt>
add    $0x1,%r15d
mov    0x70(%rsp),%r14
mov    0x78(%rsp),%rbp
add    $0x1,%r13
cmp    %rbp,%r13
je     13e1 <format_sql_values_str+0x271>
mov    (%r14,%r13,8),%rdi
mov    %r12,%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <splitStr@plt>
cmpl   $0x7,0xc(%rsp)
jne    1288 <format_sql_values_str+0x118>
mov    %rbx,%rdi
lea    0xd44(%rip),%rsi
call   1080 <strcat@plt>
lea    0x80(%rsp),%rbp
mov    %rbp,%rdi
lea    0xd2f(%rip),%rsi
mov    %r15d,%edx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xcff(%rip),%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0x69(%rsp),%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xcd0(%rip),%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xcb4(%rip),%rbp
mov    %rbp,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcat@plt>
cmpl   $0x2,0xc(%rsp)
jl     1260 <format_sql_values_str+0xf0>
mov    $0x1,%r14d
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    0x10(%rsp,%r14,8),%rsi
call   1080 <strcat@plt>
add    $0x1,%r14
movslq 0xc(%rsp),%rax
cmp    %rax,%r14
jl     13a0 <format_sql_values_str+0x230>
jmp    1260 <format_sql_values_str+0xf0>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x20,-0x1(%rax,%rbx,1)
mov    0x10(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x18(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x20(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x28(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x30(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x38(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x40(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x48(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x50(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
mov    0x58(%rsp),%rdi
mov    $0x400,%esi
call   1060 <freeMem@plt>
add    $0xc8,%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 = [2 x i8] c"(\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c",'\00"
@.str.4 = [3 x i8] c"',\00"
@.str.5 = [2 x i8] c"'\00"
@.str.6 = [3 x i8] c"),\00"
define void @format_sql_values_str(i8** %0, i32 %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [10 x i8*]
%14 = alloca [7 x i8]
%15 = alloca [64 x i8]
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%16 = load i8*, i8** %6
store i8* %16, i8** %12
store i32 0, i32* %10
br label %17
17: ; preds = %25, %3
%18 = load i32, i32* %10
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = call i8* @mallocMem(i32 1024)
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i8*], [10 x i8*]* %13, i64 0, i64 %23
store i8* %21, i8** %24
br label %25
25: ; preds = %20
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
br label %17
28: ; preds = %17
%29 = load i32, i32* %9
%30 = icmp eq i32 0, %29
br i1 %30, label %31, label %37
31: ; preds = %28
%32 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 0
%33 = load i8**, i8*** %4
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @strcpy(i8* %32, i8* %35)
br label %37
37: ; preds = %31, %28
store i32 1, i32* %10
br label %38
38: ; preds = %138, %37
%39 = load i32, i32* %10
%40 = load i32, i32* %5
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %141
42: ; preds = %38
%43 = load i8**, i8*** %4
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = getelementptr inbounds [10 x i8*], [10 x i8*]* %13, i64 0, i64 0
%49 = call i32 @splitStr(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %48, i32* %8)
%50 = load i32, i32* %8
%51 = icmp ne i32 %50, 7
br i1 %51, label %52, label %53
52: ; preds = %42
br label %138
53: ; preds = %42
%54 = load i8*, i8** %12
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%56 = getelementptr inbounds [64 x i8], [64 x i8]* %15, i64 0, i64 0
%57 = load i32, i32* %7
%58 = call i32 @sprintf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %57)
%59 = load i8*, i8** %12
%60 = load i8*, i8** %12
%61 = call i32 @strlen(i8* %60)
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %59, i64 %62
%64 = getelementptr inbounds [64 x i8], [64 x i8]* %15, i64 0, i64 0
%65 = call i32 @strcat(i8* %63, i8* %64)
%66 = load i8*, i8** %12
%67 = load i8*, i8** %12
%68 = call i32 @strlen(i8* %67)
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %66, i64 %69
%71 = call i32 @strcat(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%72 = load i8*, i8** %12
%73 = load i8*, i8** %12
%74 = call i32 @strlen(i8* %73)
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %72, i64 %75
%77 = getelementptr inbounds [7 x i8], [7 x i8]* %14, i64 0, i64 0
%78 = call i32 @strcat(i8* %76, i8* %77)
%79 = load i8*, i8** %12
%80 = load i8*, i8** %12
%81 = call i32 @strlen(i8* %80)
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %79, i64 %82
%84 = call i32 @strcat(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%85 = load i8*, i8** %12
%86 = load i8*, i8** %12
%87 = call i32 @strlen(i8* %86)
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %85, i64 %88
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%91 = load i8*, i8** %12
%92 = load i8*, i8** %12
%93 = call i32 @strlen(i8* %92)
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %91, i64 %94
%96 = getelementptr inbounds [10 x i8*], [10 x i8*]* %13, i64 0, i64 0
%97 = load i8*, i8** %96
%98 = call i32 @strcat(i8* %95, i8* %97)
%99 = load i8*, i8** %12
%100 = load i8*, i8** %12
%101 = call i32 @strlen(i8* %100)
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %99, i64 %102
%104 = call i32 @strcat(i8* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %11
br label %105
105: ; preds = %126, %53
%106 = load i32, i32* %11
%107 = load i32, i32* %8
%108 = icmp slt i32 %106, %107
br i1 %108, label %109, label %129
109: ; preds = %105
%110 = load i8*, i8** %12
%111 = load i8*, i8** %12
%112 = call i32 @strlen(i8* %111)
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %110, i64 %113
%115 = call i32 @strcat(i8* %114, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%116 = load i8*, i8** %12
%117 = load i8*, i8** %12
%118 = call i32 @strlen(i8* %117)
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %116, i64 %119
%121 = load i32, i32* %11
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [10 x i8*], [10 x i8*]* %13, i64 0, i64 %122
%124 = load i8*, i8** %123
%125 = call i32 @strcat(i8* %120, i8* %124)
br label %126
126: ; preds = %109
%127 = load i32, i32* %11
%128 = add nsw i32 %127, 1
store i32 %128, i32* %11
br label %105
129: ; preds = %105
%130 = load i8*, i8** %12
%131 = load i8*, i8** %12
%132 = call i32 @strlen(i8* %131)
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds i8, i8* %130, i64 %133
%135 = call i32 @strcat(i8* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%136 = load i32, i32* %7
%137 = add nsw i32 %136, 1
store i32 %137, i32* %7
br label %138
138: ; preds = %129, %52
%139 = load i32, i32* %10
%140 = add nsw i32 %139, 1
store i32 %140, i32* %10
br label %38
141: ; preds = %38
%142 = load i8*, i8** %12
%143 = load i8*, i8** %12
%144 = call i32 @strlen(i8* %143)
%145 = sub nsw i32 %144, 1
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i8, i8* %142, i64 %146
store i8 32, i8* %147
store i32 0, i32* %10
br label %148
148: ; preds = %157, %141
%149 = load i32, i32* %10
%150 = icmp slt i32 %149, 10
br i1 %150, label %151, label %160
151: ; preds = %148
%152 = load i32, i32* %10
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [10 x i8*], [10 x i8*]* %13, i64 0, i64 %153
%155 = load i8*, i8** %154
%156 = call i32 @freeMem(i8* %155, i32 1024)
br label %157
157: ; preds = %151
%158 = load i32, i32* %10
%159 = add nsw i32 %158, 1
store i32 %159, i32* %10
br label %148
160: ; preds = %148
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
@.str.1 = [2 x i8] c"(\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c",'\00"
@.str.4 = [3 x i8] c"',\00"
@.str.5 = [2 x i8] c"'\00"
@.str.6 = [3 x i8] c"),\00"
define void @format_sql_values_str(i8** nocapture %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca [10 x i8*]
%6 = alloca [7 x i8]
%7 = alloca [64 x i8]
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast [10 x i8*]* %5 to i8*
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%12 = tail call i8* @mallocMem(i32 1024)
%13 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 0
store i8* %12, i8** %13
%14 = tail call i8* @mallocMem(i32 1024)
%15 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 1
store i8* %14, i8** %15
%16 = tail call i8* @mallocMem(i32 1024)
%17 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 2
store i8* %16, i8** %17
%18 = tail call i8* @mallocMem(i32 1024)
%19 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 3
store i8* %18, i8** %19
%20 = tail call i8* @mallocMem(i32 1024)
%21 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 4
store i8* %20, i8** %21
%22 = tail call i8* @mallocMem(i32 1024)
%23 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 5
store i8* %22, i8** %23
%24 = tail call i8* @mallocMem(i32 1024)
%25 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 6
store i8* %24, i8** %25
%26 = tail call i8* @mallocMem(i32 1024)
%27 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 7
store i8* %26, i8** %27
%28 = tail call i8* @mallocMem(i32 1024)
%29 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 8
store i8* %28, i8** %29
%30 = tail call i8* @mallocMem(i32 1024)
%31 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 9
store i8* %30, i8** %31
%32 = load i8*, i8** %0
%33 = call i32 @strcpy(i8* %10, i8* %32)
%34 = icmp sgt i32 %1, 1
br i1 %34, label %35, label %105
35: ; preds = %3
%36 = zext i32 %1 to i64
br label %37
37: ; preds = %35, %101
%38 = phi i64 [ 1, %35 ], [ %103, %101 ]
%39 = phi i32 [ 0, %35 ], [ %102, %101 ]
%40 = getelementptr inbounds i8*, i8** %0, i64 %38
%41 = load i8*, i8** %40
%42 = call i32 @splitStr(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13, i32* %4)
%43 = load i32, i32* %4
%44 = icmp eq i32 %43, 7
br i1 %44, label %45, label %101
45: ; preds = %37
%46 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%47 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%48 = call i32 @strlen(i8* %2)
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %2, i64 %49
%51 = call i32 @strcat(i8* %50, i8* %11)
%52 = call i32 @strlen(i8* %2)
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %2, i64 %53
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%56 = call i32 @strlen(i8* %2)
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %2, i64 %57
%59 = call i32 @strcat(i8* %58, i8* %10)
%60 = call i32 @strlen(i8* %2)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %2, i64 %61
%63 = call i32 @strcat(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 @strlen(i8* %2)
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %2, i64 %65
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%68 = call i32 @strlen(i8* %2)
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %2, i64 %69
%71 = load i8*, i8** %13
%72 = call i32 @strcat(i8* %70, i8* %71)
%73 = call i32 @strlen(i8* %2)
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %2, i64 %74
%76 = call i32 @strcat(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%77 = load i32, i32* %4
%78 = icmp sgt i32 %77, 1
br i1 %78, label %79, label %95
79: ; preds = %45, %79
%80 = phi i64 [ %91, %79 ], [ 1, %45 ]
%81 = call i32 @strlen(i8* %2)
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %2, i64 %82
%84 = call i32 @strcat(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%85 = call i32 @strlen(i8* %2)
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %2, i64 %86
%88 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 %80
%89 = load i8*, i8** %88
%90 = call i32 @strcat(i8* %87, i8* %89)
%91 = add nuw nsw i64 %80, 1
%92 = load i32, i32* %4
%93 = sext i32 %92 to i64
%94 = icmp slt i64 %91, %93
br i1 %94, label %79, label %95
95: ; preds = %79, %45
%96 = call i32 @strlen(i8* %2)
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %2, i64 %97
%99 = call i32 @strcat(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%100 = add nsw i32 %39, 1
br label %101
101: ; preds = %37, %95
%102 = phi i32 [ %39, %37 ], [ %100, %95 ]
%103 = add nuw nsw i64 %38, 1
%104 = icmp eq i64 %103, %36
br i1 %104, label %105, label %37
105: ; preds = %101, %3
%106 = call i32 @strlen(i8* %2)
%107 = add nsw i32 %106, -1
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %2, i64 %108
store i8 32, i8* %109
%110 = load i8*, i8** %13
%111 = call i32 @freeMem(i8* %110, i32 1024)
%112 = load i8*, i8** %15
%113 = call i32 @freeMem(i8* %112, i32 1024)
%114 = load i8*, i8** %17
%115 = call i32 @freeMem(i8* %114, i32 1024)
%116 = load i8*, i8** %19
%117 = call i32 @freeMem(i8* %116, i32 1024)
%118 = load i8*, i8** %21
%119 = call i32 @freeMem(i8* %118, i32 1024)
%120 = load i8*, i8** %23
%121 = call i32 @freeMem(i8* %120, i32 1024)
%122 = load i8*, i8** %25
%123 = call i32 @freeMem(i8* %122, i32 1024)
%124 = load i8*, i8** %27
%125 = call i32 @freeMem(i8* %124, i32 1024)
%126 = load i8*, i8** %29
%127 = call i32 @freeMem(i8* %126, i32 1024)
%128 = load i8*, i8** %31
%129 = call i32 @freeMem(i8* %128, i32 1024)
ret void
}