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

/* Variables and functions */
int /*<<< orphan*/ _mm_add_pd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_andnot_ps(int /*<<< orphan*/ const, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_cmpnlt_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_load_pd(double *);
int /*<<< orphan*/ _mm_load_ps(float *);
int _mm_movemask_ps(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_set1_ps(float);
int /*<<< orphan*/ _mm_set_pd(double, double);
int /*<<< orphan*/ _mm_store_pd(double *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_sub_ps(int /*<<< orphan*/, int /*<<< orphan*/);
void check_pc_2(double z, float *xp, float *yp, int nv, float *diff,
                double *pval) {
  const __m128 sign_mask = _mm_set1_ps(-0.f);
  __m128d pmask[4];
  pmask[0] = _mm_set_pd(0.0, 0.0);
  pmask[1] = _mm_set_pd(0.0, z);
  pmask[2] = _mm_set_pd(z, 0.0);
  pmask[3] = _mm_set_pd(z, z);
  ;
  for (int i = 0; i < nv; i += 4) {
    __m128 tx = _mm_load_ps(xp + i);
    tx = _mm_sub_ps(tx, _mm_load_ps(yp + i));
    tx = _mm_andnot_ps(sign_mask, tx);
    tx = _mm_cmpnlt_ps(tx, _mm_load_ps(diff + i));
    int msk = _mm_movemask_ps(tx);
    __m128d p = _mm_load_pd(pval + i);
    p = _mm_add_pd(p, pmask[msk & 3]);
    _mm_store_pd(pval + i, p);
    p = _mm_load_pd(pval + 2 + i);
    p = _mm_add_pd(p, pmask[msk >> 2]);
    _mm_store_pd(pval + 2 + i, p);
    ;
  }
}


x86 assembly (clang, -O0):
<check_pc_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movss  0xe38(%rip),%xmm0
call   10a0 <_mm_set1_ps@plt>
mov    %eax,-0x34(%rbp)
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1050 <_mm_set_pd@plt>
mov    %eax,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1050 <_mm_set_pd@plt>
mov    %eax,-0x4c(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1341 <check_pc_2+0x1a1>
mov    -0x10(%rbp),%rdi
movslq -0x54(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x54(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    -0x68(%rbp),%edi
mov    %eax,%esi
call   1080 <_mm_sub_ps@plt>
mov    %eax,-0x58(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x58(%rbp),%esi
call   10b0 <_mm_andnot_ps@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rdi
movslq -0x54(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    -0x64(%rbp),%edi
mov    %eax,%esi
call   10c0 <_mm_cmpnlt_ps@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%edi
call   1070 <_mm_movemask_ps@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x30(%rbp),%rdi
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1090 <_mm_load_pd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x5c(%rbp),%eax
and    $0x3,%eax
cltq
mov    -0x50(%rbp,%rax,4),%esi
call   1060 <_mm_add_pd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x60(%rbp),%esi
call   1040 <_mm_store_pd@plt>
mov    -0x30(%rbp),%rdi
add    $0x10,%rdi
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1090 <_mm_load_pd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x5c(%rbp),%eax
sar    $0x2,%eax
cltq
mov    -0x50(%rbp,%rax,4),%esi
call   1060 <_mm_add_pd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x10,%rdi
movslq -0x54(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x60(%rbp),%esi
call   1040 <_mm_store_pd@plt>
mov    -0x54(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x54(%rbp)
jmp    1217 <check_pc_2+0x77>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_pc_2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %rdi,%r12
movsd  %xmm0,(%rsp)
movss  0xe36(%rip),%xmm0
call   10a0 <_mm_set1_ps@plt>
mov    %eax,%r13d
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,0x10(%rsp)
xorps  %xmm0,%xmm0
movsd  (%rsp),%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,0x14(%rsp)
xorps  %xmm1,%xmm1
movsd  (%rsp),%xmm0
call   1050 <_mm_set_pd@plt>
mov    %eax,0x18(%rsp)
movsd  (%rsp),%xmm0
movaps %xmm0,%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,0x1c(%rsp)
test   %r15d,%r15d
jle    12fe <check_pc_2+0x15e>
mov    %r12,%rcx
mov    %r15d,%eax
xor    %r12d,%r12d
mov    %r15d,0xc(%rsp)
mov    %r13d,0x8(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rbp,(%rsp)
mov    0x20(%rsp),%rdi
call   1030 <_mm_load_ps@plt>
mov    %eax,%r15d
mov    (%rsp),%rdi
call   1030 <_mm_load_ps@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1080 <_mm_sub_ps@plt>
mov    %r13d,%edi
mov    %eax,%esi
call   10b0 <_mm_andnot_ps@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <_mm_load_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   10c0 <_mm_cmpnlt_ps@plt>
mov    %eax,%edi
call   1070 <_mm_movemask_ps@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1090 <_mm_load_pd@plt>
mov    %ebp,%ecx
and    $0x3,%ecx
mov    0x10(%rsp,%rcx,4),%esi
mov    %eax,%edi
call   1060 <_mm_add_pd@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <_mm_store_pd@plt>
mov    %rbx,%r15
lea    0x10(%r14),%rbx
mov    %rbx,%rdi
call   1090 <_mm_load_pd@plt>
sar    $0x2,%ebp
movslq %ebp,%rcx
mov    0xc(%rsp),%r13d
mov    0x10(%rsp,%rcx,4),%esi
mov    %eax,%edi
call   1060 <_mm_add_pd@plt>
mov    %rbx,%rdi
mov    %r15,%rbx
mov    (%rsp),%rbp
mov    %eax,%esi
call   1040 <_mm_store_pd@plt>
mov    0x20(%rsp),%rcx
add    $0x20,%r14
add    $0x10,%rbx
add    $0x10,%rbp
add    $0x10,%rcx
add    $0x4,%r12d
cmp    %r13d,%r12d
mov    0x8(%rsp),%r13d
jl     1230 <check_pc_2+0x90>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @check_pc_2(double %0, float* %1, float* %2, i32 %3, float* %4, double* %5) {
%7 = alloca double
%8 = alloca float*
%9 = alloca float*
%10 = alloca i32
%11 = alloca float*
%12 = alloca double*
%13 = alloca i32
%14 = alloca [4 x i32]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store double %0, double* %7
store float* %1, float** %8
store float* %2, float** %9
store i32 %3, i32* %10
store float* %4, float** %11
store double* %5, double** %12
%19 = call i32 @_mm_set1_ps(float -0.000000e+00)
store i32 %19, i32* %13
%20 = call i32 @_mm_set_pd(double 0.000000e+00, double 0.000000e+00)
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 0
store i32 %20, i32* %21
%22 = load double, double* %7
%23 = call i32 @_mm_set_pd(double 0.000000e+00, double %22)
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 1
store i32 %23, i32* %24
%25 = load double, double* %7
%26 = call i32 @_mm_set_pd(double %25, double 0.000000e+00)
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 2
store i32 %26, i32* %27
%28 = load double, double* %7
%29 = load double, double* %7
%30 = call i32 @_mm_set_pd(double %28, double %29)
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 3
store i32 %30, i32* %31
store i32 0, i32* %15
br label %32
32: ; preds = %99, %6
%33 = load i32, i32* %15
%34 = load i32, i32* %10
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %102
36: ; preds = %32
%37 = load float*, float** %8
%38 = load i32, i32* %15
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %37, i64 %39
%41 = call i32 @_mm_load_ps(float* %40)
store i32 %41, i32* %16
%42 = load i32, i32* %16
%43 = load float*, float** %9
%44 = load i32, i32* %15
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
%47 = call i32 @_mm_load_ps(float* %46)
%48 = call i32 @_mm_sub_ps(i32 %42, i32 %47)
store i32 %48, i32* %16
%49 = load i32, i32* %13
%50 = load i32, i32* %16
%51 = call i32 @_mm_andnot_ps(i32 %49, i32 %50)
store i32 %51, i32* %16
%52 = load i32, i32* %16
%53 = load float*, float** %11
%54 = load i32, i32* %15
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds float, float* %53, i64 %55
%57 = call i32 @_mm_load_ps(float* %56)
%58 = call i32 @_mm_cmpnlt_ps(i32 %52, i32 %57)
store i32 %58, i32* %16
%59 = load i32, i32* %16
%60 = call i32 @_mm_movemask_ps(i32 %59)
store i32 %60, i32* %17
%61 = load double*, double** %12
%62 = load i32, i32* %15
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = call i32 @_mm_load_pd(double* %64)
store i32 %65, i32* %18
%66 = load i32, i32* %18
%67 = load i32, i32* %17
%68 = and i32 %67, 3
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = call i32 @_mm_add_pd(i32 %66, i32 %71)
store i32 %72, i32* %18
%73 = load double*, double** %12
%74 = load i32, i32* %15
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load i32, i32* %18
%78 = call i32 @_mm_store_pd(double* %76, i32 %77)
%79 = load double*, double** %12
%80 = getelementptr inbounds double, double* %79, i64 2
%81 = load i32, i32* %15
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = call i32 @_mm_load_pd(double* %83)
store i32 %84, i32* %18
%85 = load i32, i32* %18
%86 = load i32, i32* %17
%87 = ashr i32 %86, 2
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [4 x i32], [4 x i32]* %14, i64 0, i64 %88
%90 = load i32, i32* %89
%91 = call i32 @_mm_add_pd(i32 %85, i32 %90)
store i32 %91, i32* %18
%92 = load double*, double** %12
%93 = getelementptr inbounds double, double* %92, i64 2
%94 = load i32, i32* %15
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load i32, i32* %18
%98 = call i32 @_mm_store_pd(double* %96, i32 %97)
br label %99
99: ; preds = %36
%100 = load i32, i32* %15
%101 = add nsw i32 %100, 4
store i32 %101, i32* %15
br label %32
102: ; preds = %32
ret void
}

LLVM IR (-O2):
define void @check_pc_2(double %0, float* %1, float* %2, i32 %3, float* %4, double* %5) {
%7 = alloca [4 x i32]
%8 = tail call i32 @_mm_set1_ps(float -0.000000e+00)
%9 = bitcast [4 x i32]* %7 to i8*
%10 = tail call i32 @_mm_set_pd(double 0.000000e+00, double 0.000000e+00)
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
store i32 %10, i32* %11
%12 = tail call i32 @_mm_set_pd(double 0.000000e+00, double %0)
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
store i32 %12, i32* %13
%14 = tail call i32 @_mm_set_pd(double %0, double 0.000000e+00)
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
store i32 %14, i32* %15
%16 = tail call i32 @_mm_set_pd(double %0, double %0)
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
store i32 %16, i32* %17
%18 = icmp sgt i32 %3, 0
br i1 %18, label %19, label %21
19: ; preds = %6
%20 = getelementptr inbounds double, double* %5, i64 2
br label %22
21: ; preds = %22, %6
ret void
22: ; preds = %19, %22
%23 = phi i64 [ 0, %19 ], [ %50, %22 ]
%24 = getelementptr inbounds float, float* %1, i64 %23
%25 = tail call i32 @_mm_load_ps(float* %24)
%26 = getelementptr inbounds float, float* %2, i64 %23
%27 = tail call i32 @_mm_load_ps(float* %26)
%28 = tail call i32 @_mm_sub_ps(i32 %25, i32 %27)
%29 = tail call i32 @_mm_andnot_ps(i32 %8, i32 %28)
%30 = getelementptr inbounds float, float* %4, i64 %23
%31 = tail call i32 @_mm_load_ps(float* %30)
%32 = tail call i32 @_mm_cmpnlt_ps(i32 %29, i32 %31)
%33 = tail call i32 @_mm_movemask_ps(i32 %32)
%34 = getelementptr inbounds double, double* %5, i64 %23
%35 = tail call i32 @_mm_load_pd(double* %34)
%36 = and i32 %33, 3
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = tail call i32 @_mm_add_pd(i32 %35, i32 %39)
%41 = tail call i32 @_mm_store_pd(double* %34, i32 %40)
%42 = getelementptr inbounds double, double* %20, i64 %23
%43 = tail call i32 @_mm_load_pd(double* %42)
%44 = ashr i32 %33, 2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = tail call i32 @_mm_add_pd(i32 %43, i32 %47)
%49 = tail call i32 @_mm_store_pd(double* %42, i32 %48)
%50 = add nuw i64 %23, 4
%51 = trunc i64 %50 to i32
%52 = icmp slt i32 %51, %3
br i1 %52, label %22, label %21
}