#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 *);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcat(char *, char *);
char *strdup(char *);
char *strsep(char **, char const *);
char *create_insert_statement(char *input) {
  const char delimiters[] = ",:";
  char *token, *running;
  char *result;
  result = (char *)malloc(sizeof(char *) * 30);
  strcat(result, "insert into data (");
  running = strdup(input);
  token = strsep(&running, delimiters);
  strcat(result, token);
  strcat(result, ",");
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  strcat(result, token);
  strcat(result, ",");
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  strcat(result, token);
  strcat(result, ",");
  token = strsep(&running, delimiters);
  token = strsep(&running, delimiters);
  strcat(result, token);
  strcat(result, ");");
  token = strsep(&running, delimiters);
  free(running);
  free(token);
  return result;
}


x86 assembly (clang, -O0):
<create_insert_statement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xe9d(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xe95(%rip),%al
mov    %al,-0x9(%rbp)
mov    $0xf0,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x8(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x20(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1060 <strcat@plt>
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1060 <strcat@plt>
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1060 <strcat@plt>
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x28(%rbp),%rdi
lea    0xd42(%rip),%rsi
call   1060 <strcat@plt>
lea    -0xb(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <strsep@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_insert_statement>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movb   $0x0,0xe(%rsp)
movw   $0x3a2c,0xc(%rsp)
mov    $0xf0,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xe85(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcat@plt>
mov    %r14,%rdi
call   1070 <strdup@plt>
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
lea    0xe5c(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
lea    0xd9c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
mov    %rax,%r14
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.create_insert_statement.delimiters = [3 x i8] c",:\00"
@.str = [19 x i8] c"insert into data (\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [3 x i8] c");\00"
define i8* @create_insert_statement(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %2
%7 = bitcast [3 x i8]* %3 to i8*
%8 = call i64 @malloc(i32 240)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %2
%13 = call i8* @strdup(i8* %12)
store i8* %13, i8** %5
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%15 = call i8* @strsep(i8** %5, i8* %14)
store i8* %15, i8** %4
%16 = load i8*, i8** %6
%17 = load i8*, i8** %4
%18 = call i32 @strcat(i8* %16, i8* %17)
%19 = load i8*, i8** %6
%20 = call i32 @strcat(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%22 = call i8* @strsep(i8** %5, i8* %21)
store i8* %22, i8** %4
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%24 = call i8* @strsep(i8** %5, i8* %23)
store i8* %24, i8** %4
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%26 = call i8* @strsep(i8** %5, i8* %25)
store i8* %26, i8** %4
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%28 = call i8* @strsep(i8** %5, i8* %27)
store i8* %28, i8** %4
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%30 = call i8* @strsep(i8** %5, i8* %29)
store i8* %30, i8** %4
%31 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%32 = call i8* @strsep(i8** %5, i8* %31)
store i8* %32, i8** %4
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%34 = call i8* @strsep(i8** %5, i8* %33)
store i8* %34, i8** %4
%35 = load i8*, i8** %6
%36 = load i8*, i8** %4
%37 = call i32 @strcat(i8* %35, i8* %36)
%38 = load i8*, i8** %6
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%40 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%41 = call i8* @strsep(i8** %5, i8* %40)
store i8* %41, i8** %4
%42 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%43 = call i8* @strsep(i8** %5, i8* %42)
store i8* %43, i8** %4
%44 = load i8*, i8** %6
%45 = load i8*, i8** %4
%46 = call i32 @strcat(i8* %44, i8* %45)
%47 = load i8*, i8** %6
%48 = call i32 @strcat(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%49 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%50 = call i8* @strsep(i8** %5, i8* %49)
store i8* %50, i8** %4
%51 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%52 = call i8* @strsep(i8** %5, i8* %51)
store i8* %52, i8** %4
%53 = load i8*, i8** %6
%54 = load i8*, i8** %4
%55 = call i32 @strcat(i8* %53, i8* %54)
%56 = load i8*, i8** %6
%57 = call i32 @strcat(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%58 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%59 = call i8* @strsep(i8** %5, i8* %58)
store i8* %59, i8** %4
%60 = load i8*, i8** %5
%61 = call i32 @free(i8* %60)
%62 = load i8*, i8** %4
%63 = call i32 @free(i8* %62)
%64 = load i8*, i8** %6
ret i8* %64
}

LLVM IR (-O2):
@__const.create_insert_statement.delimiters = [3 x i8] c",:\00"
@.str = [19 x i8] c"insert into data (\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [3 x i8] c");\00"
define i8* @create_insert_statement(i8* nocapture %0) {
%2 = alloca [3 x i8]
%3 = alloca i8*
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = bitcast i8** %3 to i8*
%6 = tail call i64 @malloc(i32 240)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = tail call i8* @strdup(i8* %0)
store i8* %9, i8** %3
%10 = call i8* @strsep(i8** %3, i8* %4)
%11 = call i32 @strcat(i8* %7, i8* %10)
%12 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i8* @strsep(i8** %3, i8* %4)
%14 = call i8* @strsep(i8** %3, i8* %4)
%15 = call i8* @strsep(i8** %3, i8* %4)
%16 = call i8* @strsep(i8** %3, i8* %4)
%17 = call i8* @strsep(i8** %3, i8* %4)
%18 = call i8* @strsep(i8** %3, i8* %4)
%19 = call i8* @strsep(i8** %3, i8* %4)
%20 = call i32 @strcat(i8* %7, i8* %19)
%21 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = call i8* @strsep(i8** %3, i8* %4)
%23 = call i8* @strsep(i8** %3, i8* %4)
%24 = call i32 @strcat(i8* %7, i8* %23)
%25 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = call i8* @strsep(i8** %3, i8* %4)
%27 = call i8* @strsep(i8** %3, i8* %4)
%28 = call i32 @strcat(i8* %7, i8* %27)
%29 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%30 = call i8* @strsep(i8** %3, i8* %4)
%31 = load i8*, i8** %3
%32 = call i32 @free(i8* %31)
%33 = call i32 @free(i8* %30)
ret i8* %7
}