#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 */
unsigned short FindSpace(char *, unsigned short);
unsigned short FindText(char *, unsigned short);
scalar_t__ atof(char *);
int /*<<< orphan*/ free(char *);
char *mid(char *, unsigned short, unsigned short);
void Separate(char *ValueList, float results[], unsigned short numValues) {
  unsigned short i;
  unsigned short StartPos, EndPos;
  char *word;
  StartPos = FindText(ValueList, 0);
  for (i = 0; i < numValues; i++) {
    EndPos = FindSpace(ValueList, StartPos);
    word = mid(ValueList, StartPos, (unsigned short)(EndPos - StartPos));
    results[i] = (float)atof(word);
    free(word);
    StartPos = FindText(ValueList, EndPos);
  }
}


x86 assembly (clang, -O0):
<Separate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <FindText@plt>
mov    %ax,-0x16(%rbp)
movw   $0x0,-0x14(%rbp)
movzwl -0x14(%rbp),%eax
movzwl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1204 <Separate+0xb4>
mov    -0x8(%rbp),%rdi
movzwl -0x16(%rbp),%esi
call   1070 <FindSpace@plt>
mov    %ax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x16(%rbp),%cx
movzwl -0x18(%rbp),%eax
movzwl -0x16(%rbp),%edx
sub    %edx,%eax
movzwl %cx,%esi
movzwl %ax,%edx
call   1060 <mid@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <atof@plt>
cvtsi2ss %rax,%xmm0
mov    -0x10(%rbp),%rax
movzwl -0x14(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
movzwl -0x18(%rbp),%esi
call   1040 <FindText@plt>
mov    %ax,-0x16(%rbp)
mov    -0x14(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x14(%rbp)
jmp    117c <Separate+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Separate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,(%rsp)
mov    %rdi,%r12
xor    %esi,%esi
call   1040 <FindText@plt>
test   %r15d,%r15d
je     11de <Separate+0x8e>
mov    %eax,%ebp
movzwl %r15w,%r13d
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
movzwl %bp,%ebx
mov    %r12,%rdi
mov    %ebx,%esi
call   1070 <FindSpace@plt>
mov    %eax,%r15d
mov    %r15d,%eax
sub    %ebp,%eax
movzwl %ax,%edx
mov    %r12,%rdi
mov    %ebx,%esi
call   1060 <mid@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <atof@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mov    (%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
mov    %rbx,%rdi
call   1030 <free@plt>
movzwl %r15w,%esi
mov    %r12,%rdi
call   1040 <FindText@plt>
mov    %eax,%ebp
add    $0x1,%r14
cmp    %r14,%r13
jne    1180 <Separate+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Separate(i8* %0, float* %1, i16 zeroext %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i8*
store i8* %0, i8** %4
store float* %1, float** %5
store i16 %2, i16* %6
%11 = load i8*, i8** %4
%12 = call zeroext i16 @FindText(i8* %11, i16 zeroext 0)
store i16 %12, i16* %8
store i16 0, i16* %7
br label %13
13: ; preds = %44, %3
%14 = load i16, i16* %7
%15 = zext i16 %14 to i32
%16 = load i16, i16* %6
%17 = zext i16 %16 to i32
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %47
19: ; preds = %13
%20 = load i8*, i8** %4
%21 = load i16, i16* %8
%22 = call zeroext i16 @FindSpace(i8* %20, i16 zeroext %21)
store i16 %22, i16* %9
%23 = load i8*, i8** %4
%24 = load i16, i16* %8
%25 = load i16, i16* %9
%26 = zext i16 %25 to i32
%27 = load i16, i16* %8
%28 = zext i16 %27 to i32
%29 = sub nsw i32 %26, %28
%30 = trunc i32 %29 to i16
%31 = call i8* @mid(i8* %23, i16 zeroext %24, i16 zeroext %30)
store i8* %31, i8** %10
%32 = load i8*, i8** %10
%33 = call i64 @atof(i8* %32)
%34 = sitofp i64 %33 to float
%35 = load float*, float** %5
%36 = load i16, i16* %7
%37 = zext i16 %36 to i64
%38 = getelementptr inbounds float, float* %35, i64 %37
store float %34, float* %38
%39 = load i8*, i8** %10
%40 = call i32 @free(i8* %39)
%41 = load i8*, i8** %4
%42 = load i16, i16* %9
%43 = call zeroext i16 @FindText(i8* %41, i16 zeroext %42)
store i16 %43, i16* %8
br label %44
44: ; preds = %19
%45 = load i16, i16* %7
%46 = add i16 %45, 1
store i16 %46, i16* %7
br label %13
47: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @Separate(i8* %0, float* nocapture writeonly %1, i16 zeroext %2) {
%4 = tail call zeroext i16 @FindText(i8* %0, i16 zeroext 0)
%5 = icmp eq i16 %2, 0
br i1 %5, label %21, label %6
6: ; preds = %3
%7 = zext i16 %2 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %19, %8 ]
%10 = phi i16 [ %4, %6 ], [ %18, %8 ]
%11 = tail call zeroext i16 @FindSpace(i8* %0, i16 zeroext %10)
%12 = sub i16 %11, %10
%13 = tail call i8* @mid(i8* %0, i16 zeroext %10, i16 zeroext %12)
%14 = tail call i64 @atof(i8* %13)
%15 = sitofp i64 %14 to float
%16 = getelementptr inbounds float, float* %1, i64 %9
store float %15, float* %16
%17 = tail call i32 @free(i8* %13)
%18 = tail call zeroext i16 @FindText(i8* %0, i16 zeroext %11)
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, %7
br i1 %20, label %21, label %8
21: ; preds = %8, %3
ret void
}