#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 */
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_add_ss(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_load_ps1(float const *);
int /*<<< orphan*/ _mm_loadu_ps(float const *);
int /*<<< orphan*/ _mm_move_ss(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_mul_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_shuffle_ps(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_store_ss(float *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_storeu_ps(float *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_sub_ss(int /*<<< orphan*/, int /*<<< orphan*/);
void fir_mem2_8(const float *x, const float *_num, float *y, int N, int ord,
                float *_mem) {
  __m128 num[2], mem[2];
  int i;
  for (i = 0; i < 2; i++) {
    mem[i] = _mm_loadu_ps(_mem + 4 * i);
    num[i] = _mm_loadu_ps(_num + 4 * i + 1);
  }
  for (i = 0; i < N; i++) {
    __m128 xx;
    __m128 yy;
    xx = _mm_load_ps1(x + i);
    yy = _mm_add_ss(xx, mem[0]);
    _mm_store_ss(y + i, yy);
    yy = _mm_shuffle_ps(yy, yy, 0);
    mem[0] = _mm_move_ss(mem[0], mem[1]);
    mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
    mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
    mem[1] = _mm_sub_ss(mem[1], mem[1]);
    mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
    mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
  }
  _mm_storeu_ps(_mem, mem[0]);
  _mm_storeu_ps(_mem + 4, mem[1]);
}


x86 assembly (clang, -O0):
<fir_mem2_8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x2,-0x3c(%rbp)
jge    1226 <fir_mem2_8+0x86>
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%eax
shl    $0x2,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1070 <_mm_loadu_ps@plt>
mov    %eax,%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x38(%rbp,%rax,4)
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%eax
shl    $0x2,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
add    $0x4,%rdi
call   1070 <_mm_loadu_ps@plt>
mov    %eax,%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11c6 <fir_mem2_8+0x26>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1311 <fir_mem2_8+0x171>
mov    -0x8(%rbp),%rdi
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps1@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1090 <_mm_add_ss@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x3c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x44(%rbp),%esi
call   1080 <_mm_store_ss@plt>
mov    -0x44(%rbp),%edi
mov    -0x44(%rbp),%esi
xor    %edx,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x44(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x34(%rbp),%esi
call   1040 <_mm_move_ss@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    $0x39,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x30(%rbp),%esi
call   10a0 <_mm_mul_ps@plt>
mov    -0x4c(%rbp),%edi
mov    %eax,%esi
call   10b0 <_mm_add_ps@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
call   10c0 <_mm_sub_ss@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    $0x39,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   10a0 <_mm_mul_ps@plt>
mov    -0x48(%rbp),%edi
mov    %eax,%esi
call   10b0 <_mm_add_ps@plt>
mov    %eax,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    122d <fir_mem2_8+0x8d>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1060 <_mm_storeu_ps@plt>
mov    -0x28(%rbp),%rdi
add    $0x10,%rdi
mov    -0x34(%rbp),%esi
call   1060 <_mm_storeu_ps@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fir_mem2_8>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%rbp
mov    %ecx,%r13d
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r14
mov    %r9,%rdi
call   1070 <_mm_loadu_ps@plt>
mov    %eax,%ebx
lea    0x4(%r12),%rdi
call   1070 <_mm_loadu_ps@plt>
mov    %eax,0x8(%rsp)
mov    %rbp,0x18(%rsp)
lea    0x10(%rbp),%rdi
mov    %rdi,0x10(%rsp)
call   1070 <_mm_loadu_ps@plt>
mov    %eax,%ebp
add    $0x14,%r12
mov    %r12,%rdi
call   1070 <_mm_loadu_ps@plt>
test   %r13d,%r13d
jle    12c5 <fir_mem2_8+0x125>
mov    %eax,%r12d
mov    %r13d,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,0x20(%rsp)
mov    %r14,%rdi
call   1030 <_mm_load_ps1@plt>
mov    %eax,0xc(%rsp)
mov    %eax,%edi
mov    %ebx,%esi
call   1090 <_mm_add_ss@plt>
mov    %r12d,%r13d
mov    %eax,%r12d
mov    %r15,%rdi
mov    %eax,%esi
call   1080 <_mm_store_ss@plt>
mov    %r12d,%edi
mov    %r12d,%esi
mov    %r13d,%r12d
xor    %edx,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <_mm_move_ss@plt>
mov    %eax,%edi
mov    %eax,%esi
mov    $0x39,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%r13d
mov    %r13d,%edi
mov    0x8(%rsp),%esi
call   10a0 <_mm_mul_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   10b0 <_mm_add_ps@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %ebp,%esi
call   10c0 <_mm_sub_ss@plt>
mov    %eax,%edi
mov    %eax,%esi
mov    $0x39,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %r12d,%esi
call   10a0 <_mm_mul_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   10b0 <_mm_add_ps@plt>
mov    %eax,%ebp
mov    0x20(%rsp),%rax
add    $0x4,%r15
add    $0x4,%r14
add    $0xffffffffffffffff,%rax
jne    1210 <fir_mem2_8+0x70>
mov    0x18(%rsp),%rdi
mov    %ebx,%esi
call   1060 <_mm_storeu_ps@plt>
mov    0x10(%rsp),%rdi
mov    %ebp,%esi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <_mm_storeu_ps@plt>

LLVM IR (-O0):
define void @fir_mem2_8(float* %0, float* %1, float* %2, i32 %3, i32 %4, float* %5) {
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca [2 x i32]
%14 = alloca [2 x i32]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store float* %0, float** %7
store float* %1, float** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store float* %5, float** %12
store i32 0, i32* %15
br label %18
18: ; preds = %41, %6
%19 = load i32, i32* %15
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %44
21: ; preds = %18
%22 = load float*, float** %12
%23 = load i32, i32* %15
%24 = mul nsw i32 4, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %22, i64 %25
%27 = call i32 @_mm_loadu_ps(float* %26)
%28 = load i32, i32* %15
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 %29
store i32 %27, i32* %30
%31 = load float*, float** %8
%32 = load i32, i32* %15
%33 = mul nsw i32 4, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %31, i64 %34
%36 = getelementptr inbounds float, float* %35, i64 1
%37 = call i32 @_mm_loadu_ps(float* %36)
%38 = load i32, i32* %15
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 %39
store i32 %37, i32* %40
br label %41
41: ; preds = %21
%42 = load i32, i32* %15
%43 = add nsw i32 %42, 1
store i32 %43, i32* %15
br label %18
44: ; preds = %18
store i32 0, i32* %15
br label %45
45: ; preds = %108, %44
%46 = load i32, i32* %15
%47 = load i32, i32* %10
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %111
49: ; preds = %45
%50 = load float*, float** %7
%51 = load i32, i32* %15
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds float, float* %50, i64 %52
%54 = call i32 @_mm_load_ps1(float* %53)
store i32 %54, i32* %16
%55 = load i32, i32* %16
%56 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%57 = load i32, i32* %56
%58 = call i32 @_mm_add_ss(i32 %55, i32 %57)
store i32 %58, i32* %17
%59 = load float*, float** %9
%60 = load i32, i32* %15
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load i32, i32* %17
%64 = call i32 @_mm_store_ss(float* %62, i32 %63)
%65 = load i32, i32* %17
%66 = load i32, i32* %17
%67 = call i32 @_mm_shuffle_ps(i32 %65, i32 %66, i32 0)
store i32 %67, i32* %17
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%69 = load i32, i32* %68
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%71 = load i32, i32* %70
%72 = call i32 @_mm_move_ss(i32 %69, i32 %71)
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
store i32 %72, i32* %73
%74 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%75 = load i32, i32* %74
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%77 = load i32, i32* %76
%78 = call i32 @_mm_shuffle_ps(i32 %75, i32 %77, i32 57)
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
store i32 %78, i32* %79
%80 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%81 = load i32, i32* %80
%82 = load i32, i32* %16
%83 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%84 = load i32, i32* %83
%85 = call i32 @_mm_mul_ps(i32 %82, i32 %84)
%86 = call i32 @_mm_add_ps(i32 %81, i32 %85)
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
store i32 %86, i32* %87
%88 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%89 = load i32, i32* %88
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%91 = load i32, i32* %90
%92 = call i32 @_mm_sub_ss(i32 %89, i32 %91)
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
store i32 %92, i32* %93
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%95 = load i32, i32* %94
%96 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%97 = load i32, i32* %96
%98 = call i32 @_mm_shuffle_ps(i32 %95, i32 %97, i32 57)
%99 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
store i32 %98, i32* %99
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%101 = load i32, i32* %100
%102 = load i32, i32* %16
%103 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%104 = load i32, i32* %103
%105 = call i32 @_mm_mul_ps(i32 %102, i32 %104)
%106 = call i32 @_mm_add_ps(i32 %101, i32 %105)
%107 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
store i32 %106, i32* %107
br label %108
108: ; preds = %49
%109 = load i32, i32* %15
%110 = add nsw i32 %109, 1
store i32 %110, i32* %15
br label %45
111: ; preds = %45
%112 = load float*, float** %12
%113 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%114 = load i32, i32* %113
%115 = call i32 @_mm_storeu_ps(float* %112, i32 %114)
%116 = load float*, float** %12
%117 = getelementptr inbounds float, float* %116, i64 4
%118 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%119 = load i32, i32* %118
%120 = call i32 @_mm_storeu_ps(float* %117, i32 %119)
ret void
}

LLVM IR (-O2):
define void @fir_mem2_8(float* %0, float* %1, float* %2, i32 %3, i32 %4, float* %5) {
%7 = tail call i32 @_mm_loadu_ps(float* %5)
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = tail call i32 @_mm_loadu_ps(float* %8)
%10 = getelementptr inbounds float, float* %5, i64 4
%11 = tail call i32 @_mm_loadu_ps(float* %10)
%12 = getelementptr inbounds float, float* %1, i64 5
%13 = tail call i32 @_mm_loadu_ps(float* %12)
%14 = icmp sgt i32 %3, 0
br i1 %14, label %15, label %37
15: ; preds = %6
%16 = zext i32 %3 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %35, %17 ]
%19 = phi i32 [ %11, %15 ], [ %34, %17 ]
%20 = phi i32 [ %7, %15 ], [ %30, %17 ]
%21 = getelementptr inbounds float, float* %0, i64 %18
%22 = tail call i32 @_mm_load_ps1(float* %21)
%23 = tail call i32 @_mm_add_ss(i32 %22, i32 %20)
%24 = getelementptr inbounds float, float* %2, i64 %18
%25 = tail call i32 @_mm_store_ss(float* %24, i32 %23)
%26 = tail call i32 @_mm_shuffle_ps(i32 %23, i32 %23, i32 0)
%27 = tail call i32 @_mm_move_ss(i32 %20, i32 %19)
%28 = tail call i32 @_mm_shuffle_ps(i32 %27, i32 %27, i32 57)
%29 = tail call i32 @_mm_mul_ps(i32 %22, i32 %9)
%30 = tail call i32 @_mm_add_ps(i32 %28, i32 %29)
%31 = tail call i32 @_mm_sub_ss(i32 %19, i32 %19)
%32 = tail call i32 @_mm_shuffle_ps(i32 %31, i32 %31, i32 57)
%33 = tail call i32 @_mm_mul_ps(i32 %22, i32 %13)
%34 = tail call i32 @_mm_add_ps(i32 %32, i32 %33)
%35 = add nuw nsw i64 %18, 1
%36 = icmp eq i64 %35, %16
br i1 %36, label %37, label %17
37: ; preds = %17, %6
%38 = phi i32 [ %11, %6 ], [ %34, %17 ]
%39 = phi i32 [ %7, %6 ], [ %30, %17 ]
%40 = tail call i32 @_mm_storeu_ps(float* %5, i32 %39)
%41 = tail call i32 @_mm_storeu_ps(float* %10, i32 %38)
ret void
}