#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 pow(double, int);
void recstalta(double *a, double *charfct, int ndat, int nsta, int nlta) {
  int i;
  double csta = 1. / ((double)nsta);
  double clta = 1. / ((double)nlta);
  double sta = 0.0;
  double lta = 0.0;
  for (i = 1; i < ndat; i++) {
    sta = csta * pow(a[i], 2) + (1 - csta) * sta;
    lta = clta * pow(a[i], 2) + (1 - clta) * lta;
    charfct[i] = sta / lta;
  }
  if (nlta < ndat)
    for (i = 0; i < nlta; i++)
      charfct[i] = 0.0;
  return;
}


x86 assembly (clang, -O0):
<recstalta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  0xec9(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xeb3(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    122e <recstalta+0x11e>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  0xe0e(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116d <recstalta+0x5d>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1270 <recstalta+0x160>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    126b <recstalta+0x15b>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1241 <recstalta+0x131>
jmp    1270 <recstalta+0x160>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recstalta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8d,%r14d
mov    %edx,%r15d
mov    %rsi,%r12
cmp    $0x2,%edx
jl     11e1 <recstalta+0xc1>
mov    %rdi,%rbp
movd   %ecx,%xmm0
movd   %r14d,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm0
movapd 0xea4(%rip),%xmm1
movapd %xmm1,%xmm2
divpd  %xmm0,%xmm2
movapd %xmm2,(%rsp)
subpd  %xmm2,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %r15d,%r13d
xorpd  %xmm1,%xmm1
mov    $0x1,%ebx
nop
mulpd  0x10(%rsp),%xmm1
movapd %xmm1,0x30(%rsp)
movsd  0x0(%rbp,%rbx,8),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x0(%rbp,%rbx,8),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd 0x20(%rsp),%xmm0
mulpd  (%rsp),%xmm0
addpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1180 <recstalta+0x60>
cmp    %r15d,%r14d
jge    11fc <recstalta+0xdc>
test   %r14d,%r14d
jle    11fc <recstalta+0xdc>
mov    %r14d,%edx
shl    $0x3,%rdx
mov    %r12,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @recstalta(double* %0, double* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%16 = load i32, i32* %9
%17 = sitofp i32 %16 to double
%18 = fdiv double 1.000000e+00, %17
store double %18, double* %12
%19 = load i32, i32* %10
%20 = sitofp i32 %19 to double
%21 = fdiv double 1.000000e+00, %20
store double %21, double* %13
store double 0.000000e+00, double* %14
store double 0.000000e+00, double* %15
store i32 1, i32* %11
br label %22
22: ; preds = %58, %5
%23 = load i32, i32* %11
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %61
26: ; preds = %22
%27 = load double, double* %12
%28 = load double*, double** %6
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = call double @pow(double %32, i32 2)
%34 = load double, double* %12
%35 = fsub double 1.000000e+00, %34
%36 = load double, double* %14
%37 = fmul double %35, %36
%38 = call double @llvm.fmuladd.f64(double %27, double %33, double %37)
store double %38, double* %14
%39 = load double, double* %13
%40 = load double*, double** %6
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = call double @pow(double %44, i32 2)
%46 = load double, double* %13
%47 = fsub double 1.000000e+00, %46
%48 = load double, double* %15
%49 = fmul double %47, %48
%50 = call double @llvm.fmuladd.f64(double %39, double %45, double %49)
store double %50, double* %15
%51 = load double, double* %14
%52 = load double, double* %15
%53 = fdiv double %51, %52
%54 = load double*, double** %7
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %54, i64 %56
store double %53, double* %57
br label %58
58: ; preds = %26
%59 = load i32, i32* %11
%60 = add nsw i32 %59, 1
store i32 %60, i32* %11
br label %22
61: ; preds = %22
%62 = load i32, i32* %10
%63 = load i32, i32* %8
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %79
65: ; preds = %61
store i32 0, i32* %11
br label %66
66: ; preds = %75, %65
%67 = load i32, i32* %11
%68 = load i32, i32* %10
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %78
70: ; preds = %66
%71 = load double*, double** %7
%72 = load i32, i32* %11
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double 0.000000e+00, double* %74
br label %75
75: ; preds = %70
%76 = load i32, i32* %11
%77 = add nsw i32 %76, 1
store i32 %77, i32* %11
br label %66
78: ; preds = %66
br label %79
79: ; preds = %78, %61
ret void
}

LLVM IR (-O2):
define void @recstalta(double* nocapture %0, double* nocapture writeonly %1, i32 %2, i32 %3, i32 %4) {
%6 = bitcast double* %1 to i8*
%7 = insertelement <2 x i32> poison, i32 %4, i64 0
%8 = insertelement <2 x i32> %7, i32 %3, i64 1
%9 = sitofp <2 x i32> %8 to <2 x double>
%10 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %9
%11 = icmp sgt i32 %2, 1
br i1 %11, label %12, label %33
12: ; preds = %5
%13 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %10
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %12, %15
%16 = phi i64 [ 1, %12 ], [ %31, %15 ]
%17 = phi <2 x double> [ zeroinitializer, %12 ], [ %26, %15 ]
%18 = getelementptr inbounds double, double* %0, i64 %16
%19 = load double, double* %18
%20 = tail call double @pow(double %19, i32 2)
%21 = load double, double* %18
%22 = tail call double @pow(double %21, i32 2)
%23 = fmul <2 x double> %13, %17
%24 = insertelement <2 x double> poison, double %22, i64 0
%25 = insertelement <2 x double> %24, double %20, i64 1
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %10, <2 x double> %25, <2 x double> %23)
%27 = extractelement <2 x double> %26, i64 0
%28 = extractelement <2 x double> %26, i64 1
%29 = fdiv double %28, %27
%30 = getelementptr inbounds double, double* %1, i64 %16
store double %29, double* %30
%31 = add nuw nsw i64 %16, 1
%32 = icmp eq i64 %31, %14
br i1 %32, label %33, label %15
33: ; preds = %15, %5
%34 = icmp slt i32 %4, %2
%35 = icmp sgt i32 %4, 0
%36 = and i1 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %33
%38 = zext i32 %4 to i64
%39 = shl nuw nsw i64 %38, 3
br label %40
40: ; preds = %37, %33
ret void
}