#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_mem16_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);
  }
  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_mem16_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    1222 <fir_mem16_8+0x82>
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
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_mem16_8+0x26>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    130d <fir_mem16_8+0x16d>
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    1229 <fir_mem16_8+0x89>
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_mem16_8>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%rbp
mov    %ecx,%r13d
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r14
mov    %r9,%rdi
call   1070 <_mm_loadu_ps@plt>
mov    %eax,%ebx
mov    %r15,%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    $0x10,%r15
mov    %r15,%rdi
call   1070 <_mm_loadu_ps@plt>
test   %r13d,%r13d
jle    12c5 <fir_mem16_8+0x125>
mov    %eax,%r15d
mov    %r13d,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
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    %r15d,%r13d
mov    %eax,%r15d
mov    %r12,%rdi
mov    %eax,%esi
call   1080 <_mm_store_ss@plt>
mov    %r15d,%edi
mov    %r15d,%esi
mov    %r13d,%r15d
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    %r15d,%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,%r12
add    $0x4,%r14
add    $0xffffffffffffffff,%rax
jne    1210 <fir_mem16_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_mem16_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 = %40, %6
%19 = load i32, i32* %15
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %43
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 = call i32 @_mm_loadu_ps(float* %35)
%37 = load i32, i32* %15
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 %38
store i32 %36, i32* %39
br label %40
40: ; preds = %21
%41 = load i32, i32* %15
%42 = add nsw i32 %41, 1
store i32 %42, i32* %15
br label %18
43: ; preds = %18
store i32 0, i32* %15
br label %44
44: ; preds = %107, %43
%45 = load i32, i32* %15
%46 = load i32, i32* %10
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %110
48: ; preds = %44
%49 = load float*, float** %7
%50 = load i32, i32* %15
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds float, float* %49, i64 %51
%53 = call i32 @_mm_load_ps1(float* %52)
store i32 %53, i32* %16
%54 = load i32, i32* %16
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%56 = load i32, i32* %55
%57 = call i32 @_mm_add_ss(i32 %54, i32 %56)
store i32 %57, i32* %17
%58 = load float*, float** %9
%59 = load i32, i32* %15
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds float, float* %58, i64 %60
%62 = load i32, i32* %17
%63 = call i32 @_mm_store_ss(float* %61, i32 %62)
%64 = load i32, i32* %17
%65 = load i32, i32* %17
%66 = call i32 @_mm_shuffle_ps(i32 %64, i32 %65, i32 0)
store i32 %66, i32* %17
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%68 = load i32, i32* %67
%69 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%70 = load i32, i32* %69
%71 = call i32 @_mm_move_ss(i32 %68, i32 %70)
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
store i32 %71, i32* %72
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%74 = load i32, i32* %73
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%76 = load i32, i32* %75
%77 = call i32 @_mm_shuffle_ps(i32 %74, i32 %76, i32 57)
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
store i32 %77, i32* %78
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%80 = load i32, i32* %79
%81 = load i32, i32* %16
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%83 = load i32, i32* %82
%84 = call i32 @_mm_mul_ps(i32 %81, i32 %83)
%85 = call i32 @_mm_add_ps(i32 %80, i32 %84)
%86 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
store i32 %85, i32* %86
%87 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%88 = load i32, i32* %87
%89 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%90 = load i32, i32* %89
%91 = call i32 @_mm_sub_ss(i32 %88, i32 %90)
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
store i32 %91, i32* %92
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%94 = load i32, i32* %93
%95 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%96 = load i32, i32* %95
%97 = call i32 @_mm_shuffle_ps(i32 %94, i32 %96, i32 57)
%98 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
store i32 %97, i32* %98
%99 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%100 = load i32, i32* %99
%101 = load i32, i32* %16
%102 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%103 = load i32, i32* %102
%104 = call i32 @_mm_mul_ps(i32 %101, i32 %103)
%105 = call i32 @_mm_add_ps(i32 %100, i32 %104)
%106 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
store i32 %105, i32* %106
br label %107
107: ; preds = %48
%108 = load i32, i32* %15
%109 = add nsw i32 %108, 1
store i32 %109, i32* %15
br label %44
110: ; preds = %44
%111 = load float*, float** %12
%112 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%113 = load i32, i32* %112
%114 = call i32 @_mm_storeu_ps(float* %111, i32 %113)
%115 = load float*, float** %12
%116 = getelementptr inbounds float, float* %115, i64 4
%117 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%118 = load i32, i32* %117
%119 = call i32 @_mm_storeu_ps(float* %116, i32 %118)
ret void
}

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