#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*/ app_sos(double, double, double, double, int, double *);
void filter_with_sos(double g, double *b1, double *b2, double *a1, double *a2,
                     int nsects, double *sig, int npts) {
  int j;
  for (j = 0; j < nsects; j++)
    app_sos(b1[j], b2[j], a1[j], a2[j], npts, sig);
  for (j = 0; j < npts; j++)
    sig[j] *= g;
}


x86 assembly (clang, -O0):
<filter_with_sos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1199 <filter_with_sos+0x89>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    0x10(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1030 <app_sos@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    113f <filter_with_sos+0x2f>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    11d1 <filter_with_sos+0xc1>
movsd  -0x8(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11a0 <filter_with_sos+0x90>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_with_sos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%rbx
movapd %xmm0,0x10(%rsp)
mov    0x60(%rsp),%r12d
test   %r8d,%r8d
jle    1184 <filter_with_sos+0x74>
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %r8d,%eax
mov    %rax,(%rsp)
xor    %r15d,%r15d
mov    %rdi,0x8(%rsp)
nopl   0x0(%rax)
movsd  (%rdi,%r15,8),%xmm0
movsd  (%r14,%r15,8),%xmm1
movsd  0x0(%rbp,%r15,8),%xmm2
movsd  0x0(%r13,%r15,8),%xmm3
mov    %r12d,%edi
mov    %rbx,%rsi
call   1030 <app_sos@plt>
mov    0x8(%rsp),%rdi
add    $0x1,%r15
cmp    %r15,(%rsp)
jne    1150 <filter_with_sos+0x40>
test   %r12d,%r12d
movapd 0x10(%rsp),%xmm5
jle    1277 <filter_with_sos+0x167>
mov    %r12d,%eax
cmp    $0x4,%r12d
jae    11a3 <filter_with_sos+0x93>
xor    %ecx,%ecx
jmp    1260 <filter_with_sos+0x150>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1286 <filter_with_sos+0x176>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd (%rbx,%rdx,8),%xmm1
movupd 0x10(%rbx,%rdx,8),%xmm2
movupd 0x20(%rbx,%rdx,8),%xmm3
movupd 0x30(%rbx,%rdx,8),%xmm4
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rdx,8)
movupd %xmm2,0x10(%rbx,%rdx,8)
mulpd  %xmm0,%xmm3
mulpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rbx,%rdx,8)
movupd %xmm4,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    11e0 <filter_with_sos+0xd0>
test   $0x1,%sil
je     124c <filter_with_sos+0x13c>
movupd (%rbx,%rdx,8),%xmm1
movupd 0x10(%rbx,%rdx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rdx,8)
movupd %xmm2,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
je     1277 <filter_with_sos+0x167>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rcx,8),%xmm0
mulsd  %xmm5,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1260 <filter_with_sos+0x150>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    122e <filter_with_sos+0x11e>
jmp    124c <filter_with_sos+0x13c>

LLVM IR (-O0):
define void @filter_with_sos(double %0, double* %1, double* %2, double* %3, double* %4, i32 %5, double* %6, i32 %7) {
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca double*
%16 = alloca i32
%17 = alloca i32
store double %0, double* %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store i32 %5, i32* %14
store double* %6, double** %15
store i32 %7, i32* %16
store i32 0, i32* %17
br label %18
18: ; preds = %46, %8
%19 = load i32, i32* %17
%20 = load i32, i32* %14
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %49
22: ; preds = %18
%23 = load double*, double** %10
%24 = load i32, i32* %17
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = load double*, double** %11
%29 = load i32, i32* %17
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = load double*, double** %12
%34 = load i32, i32* %17
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %13
%39 = load i32, i32* %17
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = load i32, i32* %16
%44 = load double*, double** %15
%45 = call i32 @app_sos(double %27, double %32, double %37, double %42, i32 %43, double* %44)
br label %46
46: ; preds = %22
%47 = load i32, i32* %17
%48 = add nsw i32 %47, 1
store i32 %48, i32* %17
br label %18
49: ; preds = %18
store i32 0, i32* %17
br label %50
50: ; preds = %62, %49
%51 = load i32, i32* %17
%52 = load i32, i32* %16
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %65
54: ; preds = %50
%55 = load double, double* %9
%56 = load double*, double** %15
%57 = load i32, i32* %17
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = fmul double %60, %55
store double %61, double* %59
br label %62
62: ; preds = %54
%63 = load i32, i32* %17
%64 = add nsw i32 %63, 1
store i32 %64, i32* %17
br label %50
65: ; preds = %50
ret void
}

LLVM IR (-O2):
define void @filter_with_sos(double %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, i32 %5, double* %6, i32 %7) {
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = zext i32 %5 to i64
br label %75
12: ; preds = %75, %8
%13 = icmp sgt i32 %7, 0
br i1 %13, label %14, label %95
14: ; preds = %12
%15 = zext i32 %7 to i64
%16 = icmp ult i32 %7, 4
br i1 %16, label %73, label %17
17: ; preds = %14
%18 = and i64 %15, 4294967292
%19 = insertelement <2 x double> poison, double %0, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %0, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = add nsw i64 %18, -4
%24 = lshr exact i64 %23, 2
%25 = add nuw nsw i64 %24, 1
%26 = and i64 %25, 1
%27 = icmp eq i64 %23, 0
br i1 %27, label %57, label %28
28: ; preds = %17
%29 = and i64 %25, 9223372036854775806
br label %30
30: ; preds = %30, %28
%31 = phi i64 [ 0, %28 ], [ %54, %30 ]
%32 = phi i64 [ 0, %28 ], [ %55, %30 ]
%33 = getelementptr inbounds double, double* %6, i64 %31
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = getelementptr inbounds double, double* %33, i64 2
%37 = bitcast double* %36 to <2 x double>*
%38 = load <2 x double>, <2 x double>* %37
%39 = fmul <2 x double> %35, %20
%40 = fmul <2 x double> %38, %22
%41 = bitcast double* %33 to <2 x double>*
store <2 x double> %39, <2 x double>* %41
%42 = bitcast double* %36 to <2 x double>*
store <2 x double> %40, <2 x double>* %42
%43 = or i64 %31, 4
%44 = getelementptr inbounds double, double* %6, i64 %43
%45 = bitcast double* %44 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = getelementptr inbounds double, double* %44, i64 2
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = fmul <2 x double> %46, %20
%51 = fmul <2 x double> %49, %22
%52 = bitcast double* %44 to <2 x double>*
store <2 x double> %50, <2 x double>* %52
%53 = bitcast double* %47 to <2 x double>*
store <2 x double> %51, <2 x double>* %53
%54 = add nuw i64 %31, 8
%55 = add i64 %32, 2
%56 = icmp eq i64 %55, %29
br i1 %56, label %57, label %30
57: ; preds = %30, %17
%58 = phi i64 [ 0, %17 ], [ %54, %30 ]
%59 = icmp eq i64 %26, 0
br i1 %59, label %71, label %60
60: ; preds = %57
%61 = getelementptr inbounds double, double* %6, i64 %58
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = getelementptr inbounds double, double* %61, i64 2
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = fmul <2 x double> %63, %20
%68 = fmul <2 x double> %66, %22
%69 = bitcast double* %61 to <2 x double>*
store <2 x double> %67, <2 x double>* %69
%70 = bitcast double* %64 to <2 x double>*
store <2 x double> %68, <2 x double>* %70
br label %71
71: ; preds = %57, %60
%72 = icmp eq i64 %18, %15
br i1 %72, label %95, label %73
73: ; preds = %14, %71
%74 = phi i64 [ 0, %14 ], [ %18, %71 ]
br label %88
75: ; preds = %10, %75
%76 = phi i64 [ 0, %10 ], [ %86, %75 ]
%77 = getelementptr inbounds double, double* %1, i64 %76
%78 = load double, double* %77
%79 = getelementptr inbounds double, double* %2, i64 %76
%80 = load double, double* %79
%81 = getelementptr inbounds double, double* %3, i64 %76
%82 = load double, double* %81
%83 = getelementptr inbounds double, double* %4, i64 %76
%84 = load double, double* %83
%85 = tail call i32 @app_sos(double %78, double %80, double %82, double %84, i32 %7, double* %6)
%86 = add nuw nsw i64 %76, 1
%87 = icmp eq i64 %86, %11
br i1 %87, label %12, label %75
88: ; preds = %73, %88
%89 = phi i64 [ %93, %88 ], [ %74, %73 ]
%90 = getelementptr inbounds double, double* %6, i64 %89
%91 = load double, double* %90
%92 = fmul double %91, %0
store double %92, double* %90
%93 = add nuw nsw i64 %89, 1
%94 = icmp eq i64 %93, %15
br i1 %94, label %95, label %88
95: ; preds = %88, %71, %12
ret void
}