#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 */
typedef scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ free(char **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ split(char ***, char *, char);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  if (argc > 1) {
    int k;
    clock_t over, init;
    char **string_split;
    init = clock();
    split(&string_split, argv[1], *argv[2]);
    over = clock();
    printf("string split :[");
    for (k = 0; string_split[k]; k++) {
      printf("\"%s\"(%lu)%c", string_split[k], strlen(string_split[k]),
             string_split[k + 1] ? ',' : ']');
    }
    printf("\ndemorou %f seconds\n", ((double)(over - init) / CLOCKS_PER_SEC));
    free(string_split);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    125e <main+0x10e>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
lea    -0x30(%rbp),%rdi
movsbl (%rax),%edx
call   1070 <split@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x20(%rbp)
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     122f <main+0xdf>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x5d,%ecx
mov    $0x2c,%eax
cmp    $0x0,%rdi
cmovne %eax,%ecx
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b7 <main+0x67>
mov    -0x20(%rbp),%rax
sub    -0x28(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2da5(%rip),%rax
divsd  (%rax),%xmm0
lea    0xdce(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     1231 <main+0xe1>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rsi
mov    0x10(%rbx),%rax
movsbl (%rax),%edx
mov    %rsp,%rdi
call   1070 <split@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r15
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%r13
test   %r13,%r13
je     11f9 <main+0xa9>
mov    $0x8,%ebx
mov    $0x5d,%ebp
lea    0xe57(%rip),%r12
nopl   0x0(%rax)
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    (%rsp),%rcx
cmpq   $0x0,(%rcx,%rbx,1)
mov    $0x2c,%ecx
cmove  %ebp,%ecx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%rax
mov    (%rax,%rbx,1),%r13
add    $0x8,%rbx
test   %r13,%r13
jne    11c0 <main+0x70>
sub    %r14,%r15
cvtsi2sd %r15,%xmm0
mov    0x2de0(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe09(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"string split :[\00"
@.str.1 = [12 x i8] c"\22%s\22(%lu)%c\00"
@.str.2 = [21 x i8] c"\0Ademorou %f seconds\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %66
12: ; preds = %2
%13 = call i64 (...) @clock()
store i64 %13, i64* %8
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = call i32 @split(i8*** %9, i8* %16, i8 signext %20)
%22 = call i64 (...) @clock()
store i64 %22, i64* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %24
24: ; preds = %53, %12
%25 = load i8**, i8*** %9
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %56
31: ; preds = %24
%32 = load i8**, i8*** %9
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %9
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 @strlen(i8* %41)
%43 = load i8**, i8*** %9
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %43, i64 %46
%48 = load i8*, i8** %47
%49 = icmp ne i8* %48, null
%50 = zext i1 %49 to i64
%51 = select i1 %49, i32 44, i32 93
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %36, i32 %42, i32 %51)
br label %53
53: ; preds = %31
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %24
56: ; preds = %24
%57 = load i64, i64* %7
%58 = load i64, i64* %8
%59 = sub nsw i64 %57, %58
%60 = sitofp i64 %59 to double
%61 = load double, double* @CLOCKS_PER_SEC
%62 = fdiv double %60, %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %62)
%64 = load i8**, i8*** %9
%65 = call i32 @free(i8** %64)
br label %66
66: ; preds = %56, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"string split :[\00"
@.str.1 = [12 x i8] c"\22%s\22(%lu)%c\00"
@.str.2 = [21 x i8] c"\0Ademorou %f seconds\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8**
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %42
5: ; preds = %2
%6 = bitcast i8*** %3 to i8*
%7 = tail call i64 (...) @clock()
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = call i32 @split(i8*** %3, i8* %9, i8 signext %12)
%14 = call i64 (...) @clock()
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %34, label %19
19: ; preds = %5, %19
%20 = phi i64 [ %24, %19 ], [ 0, %5 ]
%21 = phi i8* [ %32, %19 ], [ %17, %5 ]
%22 = call i32 @strlen(i8* %21)
%23 = load i8**, i8*** %3
%24 = add nuw i64 %20, 1
%25 = getelementptr inbounds i8*, i8** %23, i64 %24
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
%28 = select i1 %27, i32 93, i32 44
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32 %22, i32 %28)
%30 = load i8**, i8*** %3
%31 = getelementptr inbounds i8*, i8** %30, i64 %24
%32 = load i8*, i8** %31
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %19
34: ; preds = %19, %5
%35 = sub nsw i64 %14, %7
%36 = sitofp i64 %35 to double
%37 = load double, double* @CLOCKS_PER_SEC
%38 = fdiv double %36, %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %38)
%40 = load i8**, i8*** %3
%41 = call i32 @free(i8** %40)
br label %42
42: ; preds = %34, %2
ret i32 0
}