#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 */
float atof(char *);
scalar_t__ calloc(int, int);
int count_tokens_in_string(char *, char *);
int /*<<< orphan*/ free(char *);
char *get_token_from_string(char *, char *, char *);
char *strdup(char const *);
scalar_t__ strlen(char *);
float *llspeech_make_float_array(const char *original, int *array_len) {
  float *float_array;
  char *copy, *copy2, *next, *token, delim[3] = ",:";
  int i = 0, len;
  if (!original) {
    if (array_len) {
      *array_len = 0;
      return NULL;
    } else {
      float_array = (float *)calloc(1, sizeof(float));
      float_array[0] = 0.;
      return float_array;
    }
  }
  copy = strdup(original);
  len = count_tokens_in_string(copy, delim);
  if (array_len) {
    *array_len = len;
    float_array = (float *)calloc(len, sizeof(float));
  } else {
    float_array = (float *)calloc(len + 1, sizeof(float));
    float_array[0] = len;
    i++;
  }
  token = copy;
  copy2 = strdup(original);
  next = get_token_from_string(copy2, delim, token);
  while (strlen(token)) {
    float_array[i++] = atof(token);
    next = get_token_from_string(next, delim, token);
  }
  if (copy)
    free(copy);
  if (copy2)
    free(copy2);
  return float_array;
}


x86 assembly (clang, -O0):
<llspeech_make_float_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0xe79(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xe71(%rip),%al
mov    %al,-0x41(%rbp)
movl   $0x0,-0x48(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f3 <llspeech_make_float_array+0x83>
cmpq   $0x0,-0x18(%rbp)
je     11c8 <llspeech_make_float_array+0x58>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    130b <llspeech_make_float_array+0x19b>
mov    $0x1,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    130b <llspeech_make_float_array+0x19b>
mov    -0x10(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x43(%rbp),%rsi
call   1070 <count_tokens_in_string@plt>
mov    %eax,-0x4c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     123a <llspeech_make_float_array+0xca>
mov    -0x4c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
jmp    1264 <llspeech_make_float_array+0xf4>
mov    -0x4c(%rbp),%edi
add    $0x1,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
cvtsi2ssl -0x4c(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x43(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1080 <get_token_from_string@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
je     12db <llspeech_make_float_array+0x16b>
mov    -0x40(%rbp),%rdi
call   1040 <atof@plt>
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x48(%rbp)
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x38(%rbp),%rdi
lea    -0x43(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1080 <get_token_from_string@plt>
mov    %rax,-0x38(%rbp)
jmp    128e <llspeech_make_float_array+0x11e>
cmpq   $0x0,-0x28(%rbp)
je     12ef <llspeech_make_float_array+0x17f>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     1303 <llspeech_make_float_array+0x193>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llspeech_make_float_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
movb   $0x0,0x6(%rsp)
movw   $0x3a2c,0x4(%rsp)
test   %rdi,%rdi
je     11b5 <llspeech_make_float_array+0x55>
mov    %rdi,%r15
call   1080 <strdup@plt>
mov    %rax,%r12
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
call   1060 <count_tokens_in_string@plt>
mov    %eax,%ebx
test   %r14,%r14
je     11cd <llspeech_make_float_array+0x6d>
mov    %ebx,(%r14)
mov    %ebx,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
xor    %r13d,%r13d
jmp    11eb <llspeech_make_float_array+0x8b>
test   %r14,%r14
je     1260 <llspeech_make_float_array+0x100>
movl   $0x0,(%r14)
xor    %r14d,%r14d
jmp    1278 <llspeech_make_float_array+0x118>
lea    0x1(%rbx),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
cvtsi2ss %ebx,%xmm0
mov    %rax,%r14
movss  %xmm0,(%rax)
mov    $0x1,%r13d
mov    %r15,%rdi
call   1080 <strdup@plt>
mov    %rax,%r15
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
call   1070 <get_token_from_string@plt>
cmpb   $0x0,(%r12)
je     1249 <llspeech_make_float_array+0xe9>
mov    %rax,%rbx
lea    (%r14,%r13,4),%rbp
lea    0x4(%rsp),%r13
nopl   0x0(%rax)
mov    %r12,%rdi
call   1040 <atof@plt>
movss  %xmm0,0x0(%rbp)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1070 <get_token_from_string@plt>
mov    %rax,%rbx
add    $0x4,%rbp
cmpb   $0x0,(%r12)
jne    1220 <llspeech_make_float_array+0xc0>
mov    %r12,%rdi
call   1030 <free@plt>
test   %r15,%r15
je     1278 <llspeech_make_float_array+0x118>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    1278 <llspeech_make_float_array+0x118>
mov    $0x1,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
movl   $0x0,(%rax)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.llspeech_make_float_array.delim = [3 x i8] c",:\00"
define float* @llspeech_make_float_array(i8* %0, i32* %1) {
%3 = alloca float*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca float*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [3 x i8]
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%14 = bitcast [3 x i8]* %11 to i8*
store i32 0, i32* %12
%15 = load i8*, i8** %4
%16 = icmp ne i8* %15, null
br i1 %16, label %28, label %17
17: ; preds = %2
%18 = load i32*, i32** %5
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = load i32*, i32** %5
store i32 0, i32* %21
store float* null, float** %3
br label %91
22: ; preds = %17
%23 = call i64 @calloc(i32 1, i32 4)
%24 = inttoptr i64 %23 to float*
store float* %24, float** %6
%25 = load float*, float** %6
%26 = getelementptr inbounds float, float* %25, i64 0
store float 0.000000e+00, float* %26
%27 = load float*, float** %6
store float* %27, float** %3
br label %91
28: ; preds = %2
%29 = load i8*, i8** %4
%30 = call i8* @strdup(i8* %29)
store i8* %30, i8** %7
%31 = load i8*, i8** %7
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%33 = call i32 @count_tokens_in_string(i8* %31, i8* %32)
store i32 %33, i32* %13
%34 = load i32*, i32** %5
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %42
36: ; preds = %28
%37 = load i32, i32* %13
%38 = load i32*, i32** %5
store i32 %37, i32* %38
%39 = load i32, i32* %13
%40 = call i64 @calloc(i32 %39, i32 4)
%41 = inttoptr i64 %40 to float*
store float* %41, float** %6
br label %53
42: ; preds = %28
%43 = load i32, i32* %13
%44 = add nsw i32 %43, 1
%45 = call i64 @calloc(i32 %44, i32 4)
%46 = inttoptr i64 %45 to float*
store float* %46, float** %6
%47 = load i32, i32* %13
%48 = sitofp i32 %47 to float
%49 = load float*, float** %6
%50 = getelementptr inbounds float, float* %49, i64 0
store float %48, float* %50
%51 = load i32, i32* %12
%52 = add nsw i32 %51, 1
store i32 %52, i32* %12
br label %53
53: ; preds = %42, %36
%54 = load i8*, i8** %7
store i8* %54, i8** %10
%55 = load i8*, i8** %4
%56 = call i8* @strdup(i8* %55)
store i8* %56, i8** %8
%57 = load i8*, i8** %8
%58 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%59 = load i8*, i8** %10
%60 = call i8* @get_token_from_string(i8* %57, i8* %58, i8* %59)
store i8* %60, i8** %9
br label %61
61: ; preds = %65, %53
%62 = load i8*, i8** %10
%63 = call i64 @strlen(i8* %62)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %77
65: ; preds = %61
%66 = load i8*, i8** %10
%67 = call float @atof(i8* %66)
%68 = load float*, float** %6
%69 = load i32, i32* %12
%70 = add nsw i32 %69, 1
store i32 %70, i32* %12
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds float, float* %68, i64 %71
store float %67, float* %72
%73 = load i8*, i8** %9
%74 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%75 = load i8*, i8** %10
%76 = call i8* @get_token_from_string(i8* %73, i8* %74, i8* %75)
store i8* %76, i8** %9
br label %61
77: ; preds = %61
%78 = load i8*, i8** %7
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %83
80: ; preds = %77
%81 = load i8*, i8** %7
%82 = call i32 @free(i8* %81)
br label %83
83: ; preds = %80, %77
%84 = load i8*, i8** %8
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = load i8*, i8** %8
%88 = call i32 @free(i8* %87)
br label %89
89: ; preds = %86, %83
%90 = load float*, float** %6
store float* %90, float** %3
br label %91
91: ; preds = %89, %22, %20
%92 = load float*, float** %3
ret float* %92
}

LLVM IR (-O2):
@__const.llspeech_make_float_array.delim = [3 x i8] c",:\00"
define float* @llspeech_make_float_array(i8* %0, i32* writeonly %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = icmp eq i8* %0, null
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = icmp eq i32* %1, null
br i1 %7, label %9, label %8
8: ; preds = %6
store i32 0, i32* %1
br label %45
9: ; preds = %6
%10 = tail call i64 @calloc(i32 1, i32 4)
%11 = inttoptr i64 %10 to float*
store float 0.000000e+00, float* %11
br label %45
12: ; preds = %2
%13 = tail call i8* @strdup(i8* %0)
%14 = call i32 @count_tokens_in_string(i8* %13, i8* %4)
%15 = icmp eq i32* %1, null
br i1 %15, label %19, label %16
16: ; preds = %12
store i32 %14, i32* %1
%17 = call i64 @calloc(i32 %14, i32 4)
%18 = inttoptr i64 %17 to float*
br label %24
19: ; preds = %12
%20 = add nsw i32 %14, 1
%21 = call i64 @calloc(i32 %20, i32 4)
%22 = inttoptr i64 %21 to float*
%23 = sitofp i32 %14 to float
store float %23, float* %22
br label %24
24: ; preds = %19, %16
%25 = phi float* [ %18, %16 ], [ %22, %19 ]
%26 = phi i64 [ 0, %16 ], [ 1, %19 ]
%27 = call i8* @strdup(i8* %0)
%28 = call i8* @get_token_from_string(i8* %27, i8* %4, i8* %13)
%29 = load i8, i8* %13
%30 = icmp eq i8 %29, 0
br i1 %30, label %40, label %31
31: ; preds = %24, %31
%32 = phi i64 [ %35, %31 ], [ %26, %24 ]
%33 = phi i8* [ %37, %31 ], [ %28, %24 ]
%34 = call float @atof(i8* %13)
%35 = add nuw i64 %32, 1
%36 = getelementptr inbounds float, float* %25, i64 %32
store float %34, float* %36
%37 = call i8* @get_token_from_string(i8* %33, i8* %4, i8* %13)
%38 = load i8, i8* %13
%39 = icmp eq i8 %38, 0
br i1 %39, label %40, label %31
40: ; preds = %31, %24
%41 = call i32 @free(i8* %13)
%42 = icmp eq i8* %27, null
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 @free(i8* %27)
br label %45
45: ; preds = %40, %43, %9, %8
%46 = phi float* [ null, %8 ], [ %11, %9 ], [ %25, %43 ], [ %25, %40 ]
ret float* %46
}