#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 v_inner(float *, float *, int);
void autocorr(float input[], float r[], int order, int npts) {
  int i;
  for (i = 0; i <= order; i++)
    r[i] = v_inner(&input[0], &input[i], (npts - i));
  if (r[0] < 1.0)
    r[0] = 1.0;
}


x86 assembly (clang, -O0):
<autocorr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1172 <autocorr+0x62>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%edx
sub    -0x1c(%rbp),%edx
call   1030 <v_inner@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <autocorr+0x1d>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a0 <autocorr+0x90>
mov    -0x10(%rbp),%rax
movss  0xe6c(%rip),%xmm0
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<autocorr>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
test   %edx,%edx
js     1150 <autocorr+0x40>
mov    %ecx,%ebp
mov    %rdi,%r12
mov    %edx,%eax
lea    0x4(,%rax,4),%r15
xor    %ebx,%ebx
lea    (%r12,%rbx,1),%rsi
mov    %r12,%rdi
mov    %ebp,%edx
call   1030 <v_inner@plt>
movss  %xmm0,(%r14,%rbx,1)
add    $0xffffffff,%ebp
add    $0x4,%rbx
cmp    %rbx,%r15
jne    1130 <autocorr+0x20>
movss  0xea8(%rip),%xmm0
ucomiss (%r14),%xmm0
jbe    1165 <autocorr+0x55>
movl   $0x3f800000,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @autocorr(float* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store float* %0, float** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %29, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %32
14: ; preds = %10
%15 = load float*, float** %5
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float*, float** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds float, float* %17, i64 %19
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = sub nsw i32 %21, %22
%24 = call float @v_inner(float* %16, float* %20, i32 %23)
%25 = load float*, float** %6
%26 = load i32, i32* %9
%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* %9
%31 = add nsw i32 %30, 1
store i32 %31, i32* %9
br label %10
32: ; preds = %10
%33 = load float*, float** %6
%34 = getelementptr inbounds float, float* %33, i64 0
%35 = load float, float* %34
%36 = fpext float %35 to double
%37 = fcmp olt double %36, 1.000000e+00
br i1 %37, label %38, label %41
38: ; preds = %32
%39 = load float*, float** %6
%40 = getelementptr inbounds float, float* %39, i64 0
store float 1.000000e+00, float* %40
br label %41
41: ; preds = %38, %32
ret void
}

LLVM IR (-O2):
define void @autocorr(float* %0, float* nocapture %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, 0
br i1 %5, label %18, label %6
6: ; preds = %4
%7 = add nuw i32 %2, 1
%8 = zext i32 %7 to i64
br label %9
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %16, %9 ]
%11 = getelementptr inbounds float, float* %0, i64 %10
%12 = trunc i64 %10 to i32
%13 = sub nsw i32 %3, %12
%14 = tail call float @v_inner(float* %0, float* %11, i32 %13)
%15 = getelementptr inbounds float, float* %1, i64 %10
store float %14, float* %15
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %9
18: ; preds = %9, %4
%19 = load float, float* %1
%20 = fcmp olt float %19, 1.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %18
store float 1.000000e+00, float* %1
br label %22
22: ; preds = %21, %18
ret void
}