#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 log1p(float);
float *malloc(int);
float *nxta(float rateparam, float *rfa, int nsteps) {
  int i;
  float *erfa = malloc(nsteps * sizeof(float));
  for (i = 0; i < nsteps; ++i)
    erfa[i] = -log1p(-rfa[i]) / rateparam;
  return erfa;
}


x86 assembly (clang, -O0):
<nxta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a6 <nxta+0x86>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1040 <log1p@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x4(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114e <nxta+0x2e>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nxta>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
movss  %xmm0,0x4(%rsp)
lea    0x0(,%r15,4),%edi
call   1030 <malloc@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    1181 <nxta+0x61>
mov    %r15d,%r15d
xor    %ebx,%ebx
xchg   %ax,%ax
movss  (%r14,%rbx,4),%xmm0
movaps 0xea3(%rip),%xmm1
xorps  %xmm1,%xmm0
call   1040 <log1p@plt>
xorps  0xe94(%rip),%xmm0
divss  0x4(%rsp),%xmm0
movss  %xmm0,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <nxta+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias float* @nxta(float %0, float* nocapture %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call float* @malloc(i32 %4)
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %20
7: ; preds = %3
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %18, %9 ]
%11 = getelementptr inbounds float, float* %1, i64 %10
%12 = load float, float* %11
%13 = fneg float %12
%14 = tail call float @log1p(float %13)
%15 = fneg float %14
%16 = fdiv float %15, %0
%17 = getelementptr inbounds float, float* %5, i64 %10
store float %16, float* %17
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %9
20: ; preds = %9, %3
ret float* %5
}