#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 *);
void *malloc(size_t);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ printf(char *, char *, size_t, size_t);
double *realloc(double *, size_t);
double *contentToDoubles(char *content, size_t *online, size_t *lines) {
  size_t cnt = 0, nCnt = 0, vCnt = 0, lCnt = 0;
  size_t bufSize = 20 * sizeof(char);
  char *nBuffer = malloc(bufSize);
  double *values = malloc(vCnt * sizeof(double));
  while (content[cnt] != -1) {
    if (content[cnt] == '\t') {
      nCnt = 0;
      values = realloc(values, (vCnt + 1) * sizeof(double));
      values[vCnt] = atof(nBuffer);
      vCnt++;
      memset(nBuffer, 0, bufSize);
    } else {
      if (content[cnt] == '\n' || content[cnt] == '\0') {
        nCnt = 0;
        values = realloc(values, (vCnt + 1) * sizeof(double));
        values[vCnt] = atof(nBuffer);
        vCnt++;
        lCnt++;
        memset(nBuffer, 0, bufSize);
      } else {
        nBuffer[nCnt] = content[cnt];
        nCnt = nCnt + 1;
      }
    }
    cnt = cnt + 1;
  }
  (*lines) = lCnt;
  (*online) = vCnt / lCnt;
  printf(" %s parsed %zu values from %zu bytes\n", nBuffer, vCnt, cnt);
  return (values);
}


x86 assembly (clang, -O0):
<contentToDoubles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x14,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rdi
shl    $0x3,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xffffffff,%eax
je     12f0 <contentToDoubles+0x1a0>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
jne    122b <contentToDoubles+0xdb>
movq   $0x0,-0x28(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x30(%rbp),%rsi
add    $0x1,%rsi
shl    $0x3,%rsi
call   1070 <realloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rdx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    12df <contentToDoubles+0x18f>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1255 <contentToDoubles+0x105>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    12b8 <contentToDoubles+0x168>
movq   $0x0,-0x28(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x30(%rbp),%rsi
add    $0x1,%rsi
shl    $0x3,%rsi
call   1070 <realloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x50(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rdx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    12da <contentToDoubles+0x18a>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x48(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12df <contentToDoubles+0x18f>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11aa <contentToDoubles+0x5a>
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x38(%rbp)
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x48(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xcdc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x50(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contentToDoubles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,0x10(%rsp)
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
xor    %ebp,%ebp
xor    %edi,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
xor    %r13d,%r13d
xor    %eax,%eax
xor    %r14d,%r14d
jmp    11d1 <contentToDoubles+0x81>
nop
lea    0x1(%rbp),%rbx
lea    0x8(,%rbp,8),%rsi
mov    %r12,%rdi
call   1070 <realloc@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%r12,%rbp,8)
add    $0x1,%r13
mov    $0x14,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
add    $0x1,%r14
mov    %rbx,%rbp
xor    %eax,%eax
mov    0x10(%rsp),%rcx
movzbl (%rcx,%r14,1),%ecx
lea    0x1(%rcx),%edx
cmp    $0xb,%dl
ja     1240 <contentToDoubles+0xf0>
movzbl %dl,%edx
lea    0xe13(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
mov    %r13,%rbx
lea    0x1(%rbp),%r13
lea    0x8(,%rbp,8),%rsi
mov    %r12,%rdi
call   1070 <realloc@plt>
mov    %rax,%r12
mov    %r15,%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%r12,%rbp,8)
mov    $0x14,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
add    $0x1,%r14
mov    %r13,%rbp
mov    %rbx,%r13
xor    %eax,%eax
jmp    11d1 <contentToDoubles+0x81>
nopl   0x0(%rax,%rax,1)
mov    %cl,(%r15,%rax,1)
add    $0x1,%rax
add    $0x1,%r14
jmp    11d1 <contentToDoubles+0x81>
mov    (%rsp),%rax
mov    %r13,(%rax)
mov    %rbp,%rax
or     %r13,%rax
shr    $0x20,%rax
je     126b <contentToDoubles+0x11b>
mov    %rbp,%rax
xor    %edx,%edx
div    %r13
jmp    1272 <contentToDoubles+0x122>
mov    %ebp,%eax
xor    %edx,%edx
div    %r13d
mov    0x8(%rsp),%rcx
mov    %rax,(%rcx)
lea    0xdaf(%rip),%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1040 <printf@plt>
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c" %s parsed %zu values from %zu bytes\0A\00"
define double* @contentToDoubles(i8* %0, i64* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8*
%13 = alloca double*
store i8* %0, i8** %4
store i64* %1, i64** %5
store i64* %2, i64** %6
store i64 0, i64* %7
store i64 0, i64* %8
store i64 0, i64* %9
store i64 0, i64* %10
store i64 20, i64* %11
%14 = load i64, i64* %11
%15 = call i8* @malloc(i64 %14)
store i8* %15, i8** %12
%16 = load i64, i64* %9
%17 = mul i64 %16, 8
%18 = call i8* @malloc(i64 %17)
%19 = bitcast i8* %18 to double*
store double* %19, double** %13
br label %20
20: ; preds = %93, %3
%21 = load i8*, i8** %4
%22 = load i64, i64* %7
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, -1
br i1 %26, label %27, label %96
27: ; preds = %20
%28 = load i8*, i8** %4
%29 = load i64, i64* %7
%30 = getelementptr inbounds i8, i8* %28, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 9
br i1 %33, label %34, label %50
34: ; preds = %27
store i64 0, i64* %8
%35 = load double*, double** %13
%36 = load i64, i64* %9
%37 = add i64 %36, 1
%38 = mul i64 %37, 8
%39 = call double* @realloc(double* %35, i64 %38)
store double* %39, double** %13
%40 = load i8*, i8** %12
%41 = call double @atof(i8* %40)
%42 = load double*, double** %13
%43 = load i64, i64* %9
%44 = getelementptr inbounds double, double* %42, i64 %43
store double %41, double* %44
%45 = load i64, i64* %9
%46 = add i64 %45, 1
store i64 %46, i64* %9
%47 = load i8*, i8** %12
%48 = load i64, i64* %11
%49 = call i32 @memset(i8* %47, i32 0, i64 %48)
br label %93
50: ; preds = %27
%51 = load i8*, i8** %4
%52 = load i64, i64* %7
%53 = getelementptr inbounds i8, i8* %51, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 10
br i1 %56, label %64, label %57
57: ; preds = %50
%58 = load i8*, i8** %4
%59 = load i64, i64* %7
%60 = getelementptr inbounds i8, i8* %58, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %82
64: ; preds = %57, %50
store i64 0, i64* %8
%65 = load double*, double** %13
%66 = load i64, i64* %9
%67 = add i64 %66, 1
%68 = mul i64 %67, 8
%69 = call double* @realloc(double* %65, i64 %68)
store double* %69, double** %13
%70 = load i8*, i8** %12
%71 = call double @atof(i8* %70)
%72 = load double*, double** %13
%73 = load i64, i64* %9
%74 = getelementptr inbounds double, double* %72, i64 %73
store double %71, double* %74
%75 = load i64, i64* %9
%76 = add i64 %75, 1
store i64 %76, i64* %9
%77 = load i64, i64* %10
%78 = add i64 %77, 1
store i64 %78, i64* %10
%79 = load i8*, i8** %12
%80 = load i64, i64* %11
%81 = call i32 @memset(i8* %79, i32 0, i64 %80)
br label %92
82: ; preds = %57
%83 = load i8*, i8** %4
%84 = load i64, i64* %7
%85 = getelementptr inbounds i8, i8* %83, i64 %84
%86 = load i8, i8* %85
%87 = load i8*, i8** %12
%88 = load i64, i64* %8
%89 = getelementptr inbounds i8, i8* %87, i64 %88
store i8 %86, i8* %89
%90 = load i64, i64* %8
%91 = add i64 %90, 1
store i64 %91, i64* %8
br label %92
92: ; preds = %82, %64
br label %93
93: ; preds = %92, %34
%94 = load i64, i64* %7
%95 = add i64 %94, 1
store i64 %95, i64* %7
br label %20
96: ; preds = %20
%97 = load i64, i64* %10
%98 = load i64*, i64** %6
store i64 %97, i64* %98
%99 = load i64, i64* %9
%100 = load i64, i64* %10
%101 = udiv i64 %99, %100
%102 = load i64*, i64** %5
store i64 %101, i64* %102
%103 = load i8*, i8** %12
%104 = load i64, i64* %9
%105 = load i64, i64* %7
%106 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %103, i64 %104, i64 %105)
%107 = load double*, double** %13
ret double* %107
}

LLVM IR (-O2):
@.str = [38 x i8] c" %s parsed %zu values from %zu bytes\0A\00"
define noalias double* @contentToDoubles(i8* nocapture %0, i64* nocapture writeonly %1, i64* nocapture writeonly %2) {
%4 = tail call dereferenceable_or_null(20) i8* @malloc(i64 20)
%5 = tail call i8* @malloc(i64 0)
%6 = bitcast i8* %5 to double*
br label %7
7: ; preds = %33, %3
%8 = phi i64 [ 0, %3 ], [ %34, %33 ]
%9 = phi i64 [ 0, %3 ], [ %35, %33 ]
%10 = phi i64 [ 0, %3 ], [ %36, %33 ]
%11 = phi i64 [ 0, %3 ], [ %38, %33 ]
%12 = phi double* [ %6, %3 ], [ %37, %33 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %11
%14 = load i8, i8* %13
switch i8 %14, label %30 [
i8 -1, label %39
i8 9, label %15
i8 10, label %22
i8 0, label %22
]
15: ; preds = %7
%16 = add i64 %8, 1
%17 = shl i64 %16, 3
%18 = tail call double* @realloc(double* %12, i64 %17)
%19 = tail call double @atof(i8* %4)
%20 = getelementptr inbounds double, double* %18, i64 %8
store double %19, double* %20
%21 = tail call i32 @memset(i8* %4, i32 0, i64 20)
br label %33
22: ; preds = %7, %7
%23 = add i64 %8, 1
%24 = shl i64 %23, 3
%25 = tail call double* @realloc(double* %12, i64 %24)
%26 = tail call double @atof(i8* %4)
%27 = getelementptr inbounds double, double* %25, i64 %8
store double %26, double* %27
%28 = add i64 %9, 1
%29 = tail call i32 @memset(i8* %4, i32 0, i64 20)
br label %33
30: ; preds = %7
%31 = getelementptr inbounds i8, i8* %4, i64 %10
store i8 %14, i8* %31
%32 = add i64 %10, 1
br label %33
33: ; preds = %22, %30, %15
%34 = phi i64 [ %16, %15 ], [ %23, %22 ], [ %8, %30 ]
%35 = phi i64 [ %9, %15 ], [ %28, %22 ], [ %9, %30 ]
%36 = phi i64 [ 0, %15 ], [ 0, %22 ], [ %32, %30 ]
%37 = phi double* [ %18, %15 ], [ %25, %22 ], [ %12, %30 ]
%38 = add i64 %11, 1
br label %7
39: ; preds = %7
store i64 %9, i64* %2
%40 = udiv i64 %8, %9
store i64 %40, i64* %1
%41 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %4, i64 %8, i64 %11)
ret double* %12
}