#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 */
int ceil(double);
int /*<<< orphan*/ psiFn(double, int, int, double, double *, double *, double *,
                         double *, double *, double *, double *, double *);
int psiFnEnd(double *eEq, int eEqSize, int xPsiSize, double xres, double EField,
             double *xVc, double *xEg, double *xF, double *xEp, double *xESO,
             double *xMc, double *xMcE, double *xPsi, double *xPsiEnd) {
  double Eq = 0;
  int startpoint = 1;
  int q = 0;
  for (q = 0; q < eEqSize; q++) {
    Eq = *(eEq + q);
    startpoint =
        xPsiSize - ceil((Eq - *eEq) / (EField * xres) * 1e5 + 200 / xres);
    if (startpoint < 1)
      startpoint = 1;
    psiFn(Eq, startpoint, xPsiSize, xres, xVc, xEg, xF, xEp, xESO, xMc, xMcE,
          xPsi);
    *(xPsiEnd + q) = *(xPsi + xPsiSize - 1);
  }
  return 1;
}


x86 assembly (clang, -O0):
<psiFnEnd>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x78,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    126b <psiFnEnd+0x14b>
mov    -0x10(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x54(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe43(%rip),%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  0xe2e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x1,-0x4c(%rbp)
jge    11fa <psiFnEnd+0xda>
movl   $0x1,-0x4c(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x4c(%rbp),%edi
mov    -0x18(%rbp),%esi
movsd  -0x20(%rbp),%xmm1
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%rbx
mov    0x20(%rbp),%r11
mov    0x28(%rbp),%r10
mov    0x30(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1040 <psiFn@plt>
mov    0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  -0x8(%rax,%rcx,8),%xmm0
mov    0x38(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    117e <psiFnEnd+0x5e>
mov    $0x1,%eax
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<psiFnEnd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x28(%rsp)
mov    %r8,0x20(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
test   %esi,%esi
jle    1229 <psiFnEnd+0x109>
mov    %rcx,%r12
mov    %rdi,%rbx
mov    0x90(%rsp),%r13
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe88(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movslq %edx,%rbp
mov    %esi,%r14d
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%r15,8),%xmm0
movsd  %xmm0,0x30(%rsp)
subsd  (%rbx),%xmm0
divsd  0x8(%rsp),%xmm0
mulsd  0xe5a(%rip),%xmm0
addsd  0x18(%rsp),%xmm0
call   1030 <ceil@plt>
mov    %ebp,%edi
sub    %eax,%edi
test   %edi,%edi
mov    $0x1,%eax
cmovle %eax,%edi
movsd  0x30(%rsp),%xmm0
mov    %ebp,%esi
movsd  0x10(%rsp),%xmm1
mov    %r12,%rdx
mov    0x20(%rsp),%rcx
mov    0x28(%rsp),%r8
mov    0x70(%rsp),%r9
push   %r13
push   0x90(%rsp)
push   0x90(%rsp)
push   0x90(%rsp)
call   1040 <psiFn@plt>
add    $0x20,%rsp
movsd  -0x8(%r13,%rbp,8),%xmm0
mov    0x98(%rsp),%rax
movsd  %xmm0,(%rax,%r15,8)
add    $0x1,%r15
cmp    %r15,%r14
jne    1190 <psiFnEnd+0x70>
mov    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @psiFnEnd(double* nocapture %0, i32 %1, i32 %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12, double* nocapture writeonly %13) {
%15 = icmp sgt i32 %1, 0
br i1 %15, label %16, label %40
16: ; preds = %14
%17 = fmul double %3, %4
%18 = fdiv double 2.000000e+02, %3
%19 = sext i32 %2 to i64
%20 = getelementptr inbounds double, double* %12, i64 %19
%21 = getelementptr inbounds double, double* %20, i64 -1
%22 = zext i32 %1 to i64
br label %23
23: ; preds = %16, %23
%24 = phi i64 [ 0, %16 ], [ %38, %23 ]
%25 = getelementptr inbounds double, double* %0, i64 %24
%26 = load double, double* %25
%27 = load double, double* %0
%28 = fsub double %26, %27
%29 = fdiv double %28, %17
%30 = tail call double @llvm.fmuladd.f64(double %29, double 1.000000e+05, double %18)
%31 = tail call i32 @ceil(double %30)
%32 = sub nsw i32 %2, %31
%33 = icmp sgt i32 %32, 1
%34 = select i1 %33, i32 %32, i32 1
%35 = tail call i32 @psiFn(double %26, i32 %34, i32 %2, double %3, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12)
%36 = load double, double* %21
%37 = getelementptr inbounds double, double* %13, i64 %24
store double %36, double* %37
%38 = add nuw nsw i64 %24, 1
%39 = icmp eq i64 %38, %22
br i1 %39, label %40, label %23
40: ; preds = %23, %14
ret i32 1
}