#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 *);
float *calloc(int, int);
char *strchr(char *, char);
float *get_regression_values(char **labels, int n) {
  float *v = calloc(n, sizeof(float));
  int i;
  for (i = 0; i < n; ++i) {
    char *p = strchr(labels[i], ' ');
    *p = 0;
    v[i] = atof(p + 1);
  }
  return v;
}


x86 assembly (clang, -O0):
<get_regression_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <get_regression_values+0x7c>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1157 <get_regression_values+0x27>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_regression_values>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r15
test   %ebp,%ebp
jle    1189 <get_regression_values+0x59>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r14,%rbx,8),%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
movb   $0x0,(%rax)
lea    0x1(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <get_regression_values+0x30>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float* @get_regression_values(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
%7 = alloca i8*
store i8** %0, i8*** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = call float* @calloc(i32 %8, i32 4)
store float* %9, float** %5
store i32 0, i32* %6
br label %10
10: ; preds = %29, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %32
14: ; preds = %10
%15 = load i8**, i8*** %3
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i8* @strchr(i8* %19, i8 signext 32)
store i8* %20, i8** %7
%21 = load i8*, i8** %7
store i8 0, i8* %21
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = call float @atof(i8* %23)
%25 = load float*, float** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float, float* %25, i64 %27
store float %24, float* %28
br label %29
29: ; preds = %14
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %10
32: ; preds = %10
%33 = load float*, float** %5
ret float* %33
}

LLVM IR (-O2):
define noalias float* @get_regression_values(i8** nocapture %0, i32 %1) {
%3 = tail call float* @calloc(i32 %1, i32 4)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %15, %7 ]
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i8* @strchr(i8* dereferenceable(1) %10, i8 signext 32)
store i8 0, i8* %11
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = tail call float @atof(i8* %12)
%14 = getelementptr inbounds float, float* %3, i64 %8
store float %13, float* %14
%15 = add nuw nsw i64 %8, 1
%16 = icmp eq i64 %15, %6
br i1 %16, label %17, label %7
17: ; preds = %7, %2
ret float* %3
}