#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 pclin_innerproduct(float *, float *, int, float *, float *, int, float);
int /*<<< orphan*/ pclin_zerodc(float *, float *, int);
void pclin_crosscorr(float *out, float step, int n, float *pdx1, float *pf1,
                     int n1, float *pdx2, float *pf2, int n2) {
  int i;
  float x;
  pclin_zerodc(pdx1, pf1, n1);
  pclin_zerodc(pdx2, pf2, n2);
  x = 0.0;
  for (i = 0; i < n; i++) {
    out[i] = pclin_innerproduct(pdx1, pf1, n1, pdx2, pf2, n2, x);
    x += step;
  }
}


x86 assembly (clang, -O0):
<pclin_crosscorr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <pclin_zerodc@plt>
mov    -0x30(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%edx
call   1030 <pclin_zerodc@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d1 <pclin_crosscorr+0xb1>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x18(%rbp),%r9d
movss  -0x38(%rbp),%xmm0
call   1040 <pclin_innerproduct@plt>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0xc(%rbp),%xmm0
addss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117a <pclin_crosscorr+0x5a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pclin_crosscorr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r14
mov    %rdx,%rbp
mov    %esi,%r13d
movss  %xmm0,0xc(%rsp)
mov    %rdi,0x10(%rsp)
mov    %rdx,%rdi
mov    %rcx,%rbx
mov    %rcx,%rsi
mov    %r8d,%r12d
mov    %r8d,%edx
call   1030 <pclin_zerodc@plt>
mov    %r14,%r15
mov    %r14,%rdi
mov    0x50(%rsp),%rsi
mov    0x58(%rsp),%edx
call   1030 <pclin_zerodc@plt>
test   %r13d,%r13d
jle    11c7 <pclin_crosscorr+0xa7>
mov    %r13d,%r13d
xorps  %xmm0,%xmm0
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x8(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x50(%rsp),%r8
mov    0x58(%rsp),%r9d
movss  0x8(%rsp),%xmm0
call   1040 <pclin_innerproduct@plt>
mov    0x10(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
movss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
add    $0x1,%r14
cmp    %r14,%r13
jne    1180 <pclin_crosscorr+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @pclin_crosscorr(float* %0, float %1, i32 %2, float* %3, float* %4, i32 %5, float* %6, float* %7, i32 %8) {
%10 = alloca float*
%11 = alloca float
%12 = alloca i32
%13 = alloca float*
%14 = alloca float*
%15 = alloca i32
%16 = alloca float*
%17 = alloca float*
%18 = alloca i32
%19 = alloca i32
%20 = alloca float
store float* %0, float** %10
store float %1, float* %11
store i32 %2, i32* %12
store float* %3, float** %13
store float* %4, float** %14
store i32 %5, i32* %15
store float* %6, float** %16
store float* %7, float** %17
store i32 %8, i32* %18
%21 = load float*, float** %13
%22 = load float*, float** %14
%23 = load i32, i32* %15
%24 = call i32 @pclin_zerodc(float* %21, float* %22, i32 %23)
%25 = load float*, float** %16
%26 = load float*, float** %17
%27 = load i32, i32* %18
%28 = call i32 @pclin_zerodc(float* %25, float* %26, i32 %27)
store float 0.000000e+00, float* %20
store i32 0, i32* %19
br label %29
29: ; preds = %49, %9
%30 = load i32, i32* %19
%31 = load i32, i32* %12
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %52
33: ; preds = %29
%34 = load float*, float** %13
%35 = load float*, float** %14
%36 = load i32, i32* %15
%37 = load float*, float** %16
%38 = load float*, float** %17
%39 = load i32, i32* %18
%40 = load float, float* %20
%41 = call float @pclin_innerproduct(float* %34, float* %35, i32 %36, float* %37, float* %38, i32 %39, float %40)
%42 = load float*, float** %10
%43 = load i32, i32* %19
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds float, float* %42, i64 %44
store float %41, float* %45
%46 = load float, float* %11
%47 = load float, float* %20
%48 = fadd float %47, %46
store float %48, float* %20
br label %49
49: ; preds = %33
%50 = load i32, i32* %19
%51 = add nsw i32 %50, 1
store i32 %51, i32* %19
br label %29
52: ; preds = %29
ret void
}

LLVM IR (-O2):
define void @pclin_crosscorr(float* nocapture writeonly %0, float %1, i32 %2, float* %3, float* %4, i32 %5, float* %6, float* %7, i32 %8) {
%10 = tail call i32 @pclin_zerodc(float* %3, float* %4, i32 %5)
%11 = tail call i32 @pclin_zerodc(float* %6, float* %7, i32 %8)
%12 = icmp sgt i32 %2, 0
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %21, %15 ]
%17 = phi float [ 0.000000e+00, %13 ], [ %20, %15 ]
%18 = tail call float @pclin_innerproduct(float* %3, float* %4, i32 %5, float* %6, float* %7, i32 %8, float %17)
%19 = getelementptr inbounds float, float* %0, i64 %16
store float %18, float* %19
%20 = fadd float %17, %1
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %14
br i1 %22, label %23, label %15
23: ; preds = %15, %9
ret void
}