#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 /*<<< orphan*/ free_vector(float *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ savgol(float *, int, int, int, int /*<<< orphan*/, int);
float *vector(int, int);
int main(void) {
  int i, j, m, nl, np, nr;
  float *c, sum;
  static int mtest[6 + 1] = {0, 2, 2, 2, 2, 4, 4};
  static int nltest[6 + 1] = {0, 2, 3, 4, 5, 4, 5};
  static int nrtest[6 + 1] = {0, 2, 1, 0, 5, 4, 5};
  static char *ans[6 + 1] = {
      "",
      "                      -0.086  0.343  0.486  0.343 -0.086",
      "               -0.143  0.171  0.343  0.371  0.257",
      "         0.086 -0.143 -0.086  0.257  0.886",
      " -0.084  0.021  0.103  0.161  0.196  0.207  0.196  0.161  0.103  0.021 "
      "-0.084",
      "         0.035 -0.128  0.070  0.315  0.417  0.315  0.070 -0.128  0.035",
      "  0.042 -0.105 -0.023  0.140  0.280  0.333  0.280  0.140 -0.023 -0.105  "
      "0.042"};
  c = vector(1, 1000);
  printf("M nl nr\n");
  printf("\t\t\tSample Savitzky-Golay Coefficients\n");
  for (i = 1; i <= 6; i++) {
    m = mtest[i];
    nl = nltest[i];
    nr = nrtest[i];
    np = nl + nr + 1;
    savgol(c, np, nl, nr, 0, m);
    for (sum = 0.0, j = 1; j <= np; j++)
      sum += c[j];
    printf("%1d %1d %1d\n", m, nl, nr);
    for (j = nl; j < 5; j++)
      printf("%7s", " ");
    for (j = nl + 1; j >= 1; j--)
      printf("%7.3f", c[j]);
    for (j = 0; j < nr; j++)
      printf("%7.3f", c[np - j]);
    printf("\n");
    printf("Sum = %7.3f\n", sum);
    printf("Compare answer:\n%s\n", ans[i]);
  }
  free_vector(c, 1, 1000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x3e8,%esi
call   1050 <vector@plt>
mov    %rax,-0x28(%rbp)
lea    0x1010(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x100b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     1346 <main+0x206>
movslq -0x8(%rbp),%rcx
lea    0x2eb6(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
movslq -0x8(%rbp),%rcx
lea    0x2ec5(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
movslq -0x8(%rbp),%rcx
lea    0x2ed4(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%r9d
xor    %r8d,%r8d
call   1060 <savgol@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1227 <main+0xe7>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f6 <main+0xb6>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xf72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1271 <main+0x131>
lea    0xf61(%rip),%rdi
lea    0xf5e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1244 <main+0x104>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     12b1 <main+0x171>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf20(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    127a <main+0x13a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12f6 <main+0x1b6>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xedb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12b8 <main+0x178>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeae(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rcx
lea    0x2d8a(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <main+0x45>
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
mov    $0x3e8,%edx
call   1040 <free_vector@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%edi
mov    $0x3e8,%esi
call   1070 <vector@plt>
mov    %rax,%r14
lea    0x10a4(%rip),%rdi
call   1040 <puts@plt>
lea    0x10a0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
jmp    11ef <main+0x8f>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x104f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %r13,%rbx
lea    0xe90(%rip),%rax
movslq (%rax,%r13,4),%rsi
add    %rax,%rsi
lea    0x103d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x7,%rbx
je     13e2 <main+0x282>
lea    0xe0a(%rip),%rax
mov    (%rax,%rbx,4),%r15d
lea    0xe1f(%rip),%rax
mov    (%rax,%rbx,4),%r13d
lea    0xe34(%rip),%rax
mov    (%rax,%rbx,4),%r12d
lea    0x1(%r13,%r12,1),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
xor    %r8d,%r8d
mov    %r15d,%r9d
call   1080 <savgol@plt>
test   %ebp,%ebp
mov    %ebp,0x4(%rsp)
jle    1260 <main+0x100>
lea    (%r12,%r13,1),%ecx
add    $0x2,%ecx
lea    -0x1(%rcx),%rdx
add    $0xfffffffffffffffe,%rcx
mov    %edx,%eax
and    $0x7,%eax
cmp    $0x7,%rcx
jae    1270 <main+0x110>
xorps  %xmm0,%xmm0
mov    $0x1,%ecx
test   %rax,%rax
jne    12ca <main+0x16a>
jmp    12de <main+0x17e>
nop
xorps  %xmm0,%xmm0
jmp    12de <main+0x17e>
cs nopw 0x0(%rax,%rax,1)
nop
and    $0xfffffffffffffff8,%rdx
xorps  %xmm0,%xmm0
xor    %ecx,%ecx
nopl   0x0(%rax)
addss  0x4(%r14,%rcx,4),%xmm0
addss  0x8(%r14,%rcx,4),%xmm0
addss  0xc(%r14,%rcx,4),%xmm0
addss  0x10(%r14,%rcx,4),%xmm0
addss  0x14(%r14,%rcx,4),%xmm0
addss  0x18(%r14,%rcx,4),%xmm0
addss  0x1c(%r14,%rcx,4),%xmm0
addss  0x20(%r14,%rcx,4),%xmm0
add    $0x8,%rcx
cmp    %rcx,%rdx
jne    1280 <main+0x120>
add    $0x1,%rcx
test   %rax,%rax
je     12de <main+0x17e>
lea    (%r14,%rcx,4),%rcx
xor    %edx,%edx
addss  (%rcx,%rdx,4),%xmm0
add    $0x1,%rdx
cmp    %rdx,%rax
jne    12d0 <main+0x170>
movss  %xmm0,0xc(%rsp)
lea    0x1(%r13),%eax
mov    %eax,0x8(%rsp)
lea    0xefe(%rip),%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,0x10(%rsp)
mov    %ebx,%eax
and    $0x7ffffffd,%eax
cmp    $0x4,%eax
lea    0xee5(%rip),%rbx
lea    0xee2(%rip),%r15
je     1352 <main+0x1f2>
cmp    $0x5,%r13d
mov    $0x4,%ebp
cmovge %r13d,%ebp
sub    %r13d,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jne    1340 <main+0x1e0>
mov    0x8(%rsp),%eax
add    $0x2,%r13d
lea    (%r14,%rax,4),%rbp
lea    0xe9f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
movss  0x0(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0xffffffff,%r13d
add    $0xfffffffffffffffc,%rbp
cmp    $0x1,%r13d
jg     1370 <main+0x210>
mov    0x10(%rsp),%rax
mov    %rax,%r13
cmp    $0x3,%rax
je     11a0 <main+0x40>
cmp    $0x2,%r12d
mov    $0x1,%eax
cmovl  %eax,%r12d
movslq 0x4(%rsp),%rax
lea    (%r14,%rax,4),%rbp
neg    %r12
xor    %ebx,%ebx
xchg   %ax,%ax
movss  0x0(%rbp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    %rbx,%r12
jne    13c0 <main+0x260>
jmp    11a0 <main+0x40>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3e8,%edx
call   1060 <free_vector@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.mtest = internal global [7 x i32] [i32 0, i32 2, i32 2, i32 2, i32 2, i32 4, i32 4]
@main.nltest = internal global [7 x i32] [i32 0, i32 2, i32 3, i32 4, i32 5, i32 4, i32 5]
@main.nrtest = internal global [7 x i32] [i32 0, i32 2, i32 1, i32 0, i32 5, i32 4, i32 5]
@main.ans = internal global [7 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i32 0, i32 0)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [57 x i8] c" -0.086 0.343 0.486 0.343 -0.086\00"
@.str.2 = [50 x i8] c" -0.143 0.171 0.343 0.371 0.257\00"
@.str.3 = [43 x i8] c" 0.086 -0.143 -0.086 0.257 0.886\00"
@.str.4 = [78 x i8] c" -0.084 0.021 0.103 0.161 0.196 0.207 0.196 0.161 0.103 0.021 -0.084\00"
@.str.5 = [71 x i8] c" 0.035 -0.128 0.070 0.315 0.417 0.315 0.070 -0.128 0.035\00"
@.str.6 = [78 x i8] c" 0.042 -0.105 -0.023 0.140 0.280 0.333 0.280 0.140 -0.023 -0.105 0.042\00"
@.str.7 = [9 x i8] c"M nl nr\0A\00"
@.str.8 = [39 x i8] c"\09\09\09Sample Savitzky-Golay Coefficients\0A\00"
@.str.9 = [13 x i8] c"%1d %1d %1d\0A\00"
@.str.10 = [4 x i8] c"%7s\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [6 x i8] c"%7.3f\00"
@.str.13 = [2 x i8] c"\0A\00"
@.str.14 = [13 x i8] c"Sum = %7.3f\0A\00"
@.str.15 = [20 x i8] c"Compare answer:\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float*
%9 = alloca float
store i32 0, i32* %1
%10 = call float* @vector(i32 1, i32 1000)
store float* %10, float** %8
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %2
br label %13
13: ; preds = %113, %0
%14 = load i32, i32* %2
%15 = icmp sle i32 %14, 6
br i1 %15, label %16, label %116
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [7 x i32], [7 x i32]* @main.mtest, i64 0, i64 %18
%20 = load i32, i32* %19
store i32 %20, i32* %4
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [7 x i32], [7 x i32]* @main.nltest, i64 0, i64 %22
%24 = load i32, i32* %23
store i32 %24, i32* %5
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [7 x i32], [7 x i32]* @main.nrtest, i64 0, i64 %26
%28 = load i32, i32* %27
store i32 %28, i32* %7
%29 = load i32, i32* %5
%30 = load i32, i32* %7
%31 = add nsw i32 %29, %30
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
%33 = load float*, float** %8
%34 = load i32, i32* %6
%35 = load i32, i32* %5
%36 = load i32, i32* %7
%37 = load i32, i32* %4
%38 = call i32 @savgol(float* %33, i32 %34, i32 %35, i32 %36, i32 0, i32 %37)
store float 0.000000e+00, float* %9
store i32 1, i32* %3
br label %39
39: ; preds = %51, %16
%40 = load i32, i32* %3
%41 = load i32, i32* %6
%42 = icmp sle i32 %40, %41
br i1 %42, label %43, label %54
43: ; preds = %39
%44 = load float*, float** %8
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
%48 = load float, float* %47
%49 = load float, float* %9
%50 = fadd float %49, %48
store float %50, float* %9
br label %51
51: ; preds = %43
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %39
54: ; preds = %39
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = load i32, i32* %7
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %55, i32 %56, i32 %57)
%59 = load i32, i32* %5
store i32 %59, i32* %3
br label %60
60: ; preds = %65, %54
%61 = load i32, i32* %3
%62 = icmp slt i32 %61, 5
br i1 %62, label %63, label %68
63: ; preds = %60
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %65
65: ; preds = %63
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %60
68: ; preds = %60
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
store i32 %70, i32* %3
br label %71
71: ; preds = %82, %68
%72 = load i32, i32* %3
%73 = icmp sge i32 %72, 1
br i1 %73, label %74, label %85
74: ; preds = %71
%75 = load float*, float** %8
%76 = load i32, i32* %3
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds float, float* %75, i64 %77
%79 = load float, float* %78
%80 = fpext float %79 to double
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), double %80)
br label %82
82: ; preds = %74
%83 = load i32, i32* %3
%84 = add nsw i32 %83, -1
store i32 %84, i32* %3
br label %71
85: ; preds = %71
store i32 0, i32* %3
br label %86
86: ; preds = %100, %85
%87 = load i32, i32* %3
%88 = load i32, i32* %7
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %103
90: ; preds = %86
%91 = load float*, float** %8
%92 = load i32, i32* %6
%93 = load i32, i32* %3
%94 = sub nsw i32 %92, %93
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds float, float* %91, i64 %95
%97 = load float, float* %96
%98 = fpext float %97 to double
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), double %98)
br label %100
100: ; preds = %90
%101 = load i32, i32* %3
%102 = add nsw i32 %101, 1
store i32 %102, i32* %3
br label %86
103: ; preds = %86
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%105 = load float, float* %9
%106 = fpext float %105 to double
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), double %106)
%108 = load i32, i32* %2
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [7 x i8*], [7 x i8*]* @main.ans, i64 0, i64 %109
%111 = load i8*, i8** %110
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %111)
br label %113
113: ; preds = %103
%114 = load i32, i32* %2
%115 = add nsw i32 %114, 1
store i32 %115, i32* %2
br label %13
116: ; preds = %13
%117 = load float*, float** %8
%118 = call i32 @free_vector(float* %117, i32 1, i32 1000)
ret i32 0
}

LLVM IR (-O2):
@main.mtest = internal unnamed_addr constant [7 x i32] [i32 0, i32 2, i32 2, i32 2, i32 2, i32 4, i32 4]
@main.nltest = internal unnamed_addr constant [7 x i32] [i32 0, i32 2, i32 3, i32 4, i32 5, i32 4, i32 5]
@main.nrtest = internal unnamed_addr constant [7 x i32] [i32 0, i32 2, i32 1, i32 0, i32 5, i32 4, i32 5]
@reltable.main = internal unnamed_addr constant [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([57 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([50 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([43 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([78 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([71 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([78 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [57 x i8] c" -0.086 0.343 0.486 0.343 -0.086\00"
@.str.2 = [50 x i8] c" -0.143 0.171 0.343 0.371 0.257\00"
@.str.3 = [43 x i8] c" 0.086 -0.143 -0.086 0.257 0.886\00"
@.str.4 = [78 x i8] c" -0.084 0.021 0.103 0.161 0.196 0.207 0.196 0.161 0.103 0.021 -0.084\00"
@.str.5 = [71 x i8] c" 0.035 -0.128 0.070 0.315 0.417 0.315 0.070 -0.128 0.035\00"
@.str.6 = [78 x i8] c" 0.042 -0.105 -0.023 0.140 0.280 0.333 0.280 0.140 -0.023 -0.105 0.042\00"
@.str.9 = [13 x i8] c"%1d %1d %1d\0A\00"
@.str.10 = [4 x i8] c"%7s\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [6 x i8] c"%7.3f\00"
@.str.14 = [13 x i8] c"Sum = %7.3f\0A\00"
@.str.15 = [20 x i8] c"Compare answer:\0A%s\0A\00"
@str = [8 x i8] c"M nl nr\00"
@str.16 = [38 x i8] c"\09\09\09Sample Savitzky-Golay Coefficients\00"
define i32 @main() {
%1 = tail call float* @vector(i32 1, i32 1000)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.16, i64 0, i64 0))
br label %4
4: ; preds = %0, %117
%5 = phi i64 [ 1, %0 ], [ %124, %117 ]
%6 = getelementptr inbounds [7 x i32], [7 x i32]* @main.mtest, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = getelementptr inbounds [7 x i32], [7 x i32]* @main.nltest, i64 0, i64 %5
%9 = load i32, i32* %8
%10 = getelementptr inbounds [7 x i32], [7 x i32]* @main.nrtest, i64 0, i64 %5
%11 = load i32, i32* %10
%12 = add i32 %9, 1
%13 = add i32 %12, %11
%14 = tail call i32 @savgol(float* %1, i32 %13, i32 %9, i32 %11, i32 0, i32 %7)
%15 = icmp slt i32 %13, 1
br i1 %15, label %79, label %16
16: ; preds = %4
%17 = add i32 %9, 2
%18 = add i32 %17, %11
%19 = zext i32 %18 to i64
%20 = add nsw i64 %19, -1
%21 = add nsw i64 %19, -2
%22 = and i64 %20, 7
%23 = icmp ult i64 %21, 7
br i1 %23, label %64, label %24
24: ; preds = %16
%25 = and i64 %20, -8
br label %26
26: ; preds = %26, %24
%27 = phi i64 [ 1, %24 ], [ %61, %26 ]
%28 = phi float [ 0.000000e+00, %24 ], [ %60, %26 ]
%29 = phi i64 [ 0, %24 ], [ %62, %26 ]
%30 = getelementptr inbounds float, float* %1, i64 %27
%31 = load float, float* %30
%32 = fadd float %28, %31
%33 = add nuw nsw i64 %27, 1
%34 = getelementptr inbounds float, float* %1, i64 %33
%35 = load float, float* %34
%36 = fadd float %32, %35
%37 = add nuw nsw i64 %27, 2
%38 = getelementptr inbounds float, float* %1, i64 %37
%39 = load float, float* %38
%40 = fadd float %36, %39
%41 = add nuw nsw i64 %27, 3
%42 = getelementptr inbounds float, float* %1, i64 %41
%43 = load float, float* %42
%44 = fadd float %40, %43
%45 = add nuw nsw i64 %27, 4
%46 = getelementptr inbounds float, float* %1, i64 %45
%47 = load float, float* %46
%48 = fadd float %44, %47
%49 = add nuw nsw i64 %27, 5
%50 = getelementptr inbounds float, float* %1, i64 %49
%51 = load float, float* %50
%52 = fadd float %48, %51
%53 = add nuw nsw i64 %27, 6
%54 = getelementptr inbounds float, float* %1, i64 %53
%55 = load float, float* %54
%56 = fadd float %52, %55
%57 = add nuw nsw i64 %27, 7
%58 = getelementptr inbounds float, float* %1, i64 %57
%59 = load float, float* %58
%60 = fadd float %56, %59
%61 = add nuw nsw i64 %27, 8
%62 = add i64 %29, 8
%63 = icmp eq i64 %62, %25
br i1 %63, label %64, label %26
64: ; preds = %26, %16
%65 = phi float [ undef, %16 ], [ %60, %26 ]
%66 = phi i64 [ 1, %16 ], [ %61, %26 ]
%67 = phi float [ 0.000000e+00, %16 ], [ %60, %26 ]
%68 = icmp eq i64 %22, 0
br i1 %68, label %79, label %69
69: ; preds = %64, %69
%70 = phi i64 [ %76, %69 ], [ %66, %64 ]
%71 = phi float [ %75, %69 ], [ %67, %64 ]
%72 = phi i64 [ %77, %69 ], [ 0, %64 ]
%73 = getelementptr inbounds float, float* %1, i64 %70
%74 = load float, float* %73
%75 = fadd float %71, %74
%76 = add nuw nsw i64 %70, 1
%77 = add i64 %72, 1
%78 = icmp eq i64 %77, %22
br i1 %78, label %79, label %69
79: ; preds = %64, %69, %4
%80 = phi float [ 0.000000e+00, %4 ], [ %65, %64 ], [ %75, %69 ]
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %7, i32 %9, i32 %11)
%82 = and i64 %5, 2147483645
%83 = icmp eq i64 %82, 4
br i1 %83, label %91, label %84
84: ; preds = %79
%85 = call i32 @llvm.smax.i32(i32 %9, i32 4)
br label %86
86: ; preds = %84, %86
%87 = phi i32 [ %89, %86 ], [ %9, %84 ]
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%89 = add i32 %87, 1
%90 = icmp eq i32 %87, %85
br i1 %90, label %91, label %86
91: ; preds = %86, %79
%92 = zext i32 %12 to i64
br label %99
93: ; preds = %99
%94 = icmp eq i64 %5, 3
br i1 %94, label %117, label %95
95: ; preds = %93
%96 = sext i32 %13 to i64
%97 = call i32 @llvm.smax.i32(i32 %11, i32 1)
%98 = zext i32 %97 to i64
br label %108
99: ; preds = %91, %99
%100 = phi i64 [ %92, %91 ], [ %105, %99 ]
%101 = getelementptr inbounds float, float* %1, i64 %100
%102 = load float, float* %101
%103 = fpext float %102 to double
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), double %103)
%105 = add nsw i64 %100, -1
%106 = trunc i64 %100 to i32
%107 = icmp sgt i32 %106, 1
br i1 %107, label %99, label %93
108: ; preds = %95, %108
%109 = phi i64 [ 0, %95 ], [ %115, %108 ]
%110 = sub nsw i64 %96, %109
%111 = getelementptr inbounds float, float* %1, i64 %110
%112 = load float, float* %111
%113 = fpext float %112 to double
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), double %113)
%115 = add nuw nsw i64 %109, 1
%116 = icmp eq i64 %115, %98
br i1 %116, label %117, label %108
117: ; preds = %108, %93
%118 = tail call i32 @putchar(i32 10)
%119 = fpext float %80 to double
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), double %119)
%121 = shl i64 %5, 2
%122 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %121)
%123 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i8* %122)
%124 = add nuw nsw i64 %5, 1
%125 = icmp eq i64 %124, 7
br i1 %125, label %126, label %4
126: ; preds = %117
%127 = tail call i32 @free_vector(float* %1, i32 1, i32 1000)
ret i32 0
}