#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 */
double atof(char *);
int /*<<< orphan*/ str_clear(char *);
void translateCSV(char numbersCSV[], double numbers[], int *count) {
  int i = 0;
  int j = 0;
  int k = 0;
  char tmpc = '\0';
  char tmp[81] = "";
  do {
    tmpc = numbersCSV[i++];
    if (tmpc != ',' && tmpc != '\0') {
      tmp[j++] = tmpc;
    } else {
      numbers[k++] = atof(tmp);
      ++(*count);
      str_clear(tmp);
      j = 0;
    }
  } while (tmpc != '\0');
}


x86 assembly (clang, -O0):
<translateCSV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movb   $0x0,-0x25(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x51,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x25(%rbp)
movsbl -0x25(%rbp),%eax
cmp    $0x2c,%eax
je     11bb <translateCSV+0x8b>
movsbl -0x25(%rbp),%eax
cmp    $0x0,%eax
je     11bb <translateCSV+0x8b>
mov    -0x25(%rbp),%cl
mov    -0x20(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
cltq
mov    %cl,-0x80(%rbp,%rax,1)
jmp    11f6 <translateCSV+0xc6>
lea    -0x80(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
lea    -0x80(%rbp),%rdi
call   1050 <str_clear@plt>
movl   $0x0,-0x20(%rbp)
jmp    11fb <translateCSV+0xcb>
movsbl -0x25(%rbp),%eax
cmp    $0x0,%eax
jne    1170 <translateCSV+0x40>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<translateCSV>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movb   $0x0,0x50(%rsp)
xor    %eax,%eax
mov    %rsp,%r12
xor    %ebp,%ebp
jmp    118b <translateCSV+0x6b>
mov    %r12,%rdi
call   1030 <atof@plt>
movslq %ebp,%rax
add    $0x1,%ebp
movsd  %xmm0,(%r15,%rax,8)
addl   $0x1,(%r14)
mov    %r12,%rdi
call   1040 <str_clear@plt>
xor    %eax,%eax
add    $0x1,%rbx
test   %r13b,%r13b
je     11a6 <translateCSV+0x86>
movzbl (%rbx),%r13d
test   %r13b,%r13b
je     1160 <translateCSV+0x40>
cmp    $0x2c,%r13b
je     1160 <translateCSV+0x40>
movslq %eax,%rcx
add    $0x1,%eax
mov    %r13b,(%rsp,%rcx,1)
jmp    1182 <translateCSV+0x62>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @translateCSV(i8* %0, double* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca [81 x i8]
store i8* %0, i8** %4
store double* %1, double** %5
store i32* %2, i32** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i8 0, i8* %10
%12 = bitcast [81 x i8]* %11 to i8*
br label %13
13: ; preds = %47, %3
%14 = load i8*, i8** %4
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %10
%20 = load i8, i8* %10
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 44
br i1 %22, label %23, label %33
23: ; preds = %13
%24 = load i8, i8* %10
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i8, i8* %10
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [81 x i8], [81 x i8]* %11, i64 0, i64 %31
store i8 %28, i8* %32
br label %46
33: ; preds = %23, %13
%34 = getelementptr inbounds [81 x i8], [81 x i8]* %11, i64 0, i64 0
%35 = call double @atof(i8* %34)
%36 = load double*, double** %5
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds double, double* %36, i64 %39
store double %35, double* %40
%41 = load i32*, i32** %6
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 1
store i32 %43, i32* %41
%44 = getelementptr inbounds [81 x i8], [81 x i8]* %11, i64 0, i64 0
%45 = call i32 @str_clear(i8* %44)
store i32 0, i32* %8
br label %46
46: ; preds = %33, %27
br label %47
47: ; preds = %46
%48 = load i8, i8* %10
%49 = sext i8 %48 to i32
%50 = icmp ne i32 %49, 0
br i1 %50, label %13, label %51
51: ; preds = %47
ret void
}

LLVM IR (-O2):
define void @translateCSV(i8* nocapture %0, double* nocapture writeonly %1, i32* nocapture %2) {
%4 = alloca [81 x i8]
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
br label %6
6: ; preds = %26, %3
%7 = phi i64 [ %10, %26 ], [ 0, %3 ]
%8 = phi i32 [ %27, %26 ], [ 0, %3 ]
%9 = phi i32 [ %28, %26 ], [ 0, %3 ]
%10 = add nuw i64 %7, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %7
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
switch i8 %12, label %14 [
i8 44, label %18
i8 0, label %18
]
14: ; preds = %6
%15 = add nsw i32 %8, 1
%16 = sext i32 %8 to i64
%17 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 %16
store i8 %12, i8* %17
br label %26
18: ; preds = %6, %6
%19 = call double @atof(i8* %5)
%20 = add nsw i32 %9, 1
%21 = sext i32 %9 to i64
%22 = getelementptr inbounds double, double* %1, i64 %21
store double %19, double* %22
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
%25 = call i32 @str_clear(i8* %5)
br label %26
26: ; preds = %14, %18
%27 = phi i32 [ %15, %14 ], [ 0, %18 ]
%28 = phi i32 [ %9, %14 ], [ %20, %18 ]
br i1 %13, label %29, label %6
29: ; preds = %26
ret void
}