#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 void *__m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_pd(int /*<<< orphan*/, int /*<<< orphan*/);
void *_mm_add_ps(void *, void *);
void *_mm_andnot_ps(void *const, void *);
void *_mm_cmpnlt_ps(void *, void *);
int /*<<< orphan*/ _mm_load_pd(double *);
void *_mm_load_ps(float *);
int _mm_movemask_ps(void *);
void *_mm_mul_ps(void *, void *);
void *_mm_set1_ps(float);
int /*<<< orphan*/ _mm_set_pd(double, double);
int /*<<< orphan*/ _mm_store_pd(double *, int /*<<< orphan*/);
void *_mm_sub_ps(void *, void *);
void check_pc_3(double z, float *xp, float *xp1, float *yp, float xpc, 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);
  ;
  __m128 frac = _mm_set1_ps(xpc);
  for (int i = 0; i < nv; i += 4) {
    __m128 tx = _mm_load_ps(xp + i);
    __m128 tx1 = _mm_load_ps(xp1 + i);
    tx1 = _mm_sub_ps(tx1, tx);
    tx1 = _mm_mul_ps(tx1, frac);
    tx = _mm_add_ps(tx, tx1);
    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_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movss  %xmm1,-0x24(%rbp)
mov    %ecx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movss  0xe0c(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %rax,-0x40(%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)
movss  -0x24(%rbp),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13dc <check_pc_3+0x21c>
mov    -0x10(%rbp),%rdi
movslq -0x5c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x5c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1090 <_mm_sub_ps@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1080 <_mm_mul_ps@plt>
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
call   10c0 <_mm_add_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x5c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,%rsi
call   1090 <_mm_sub_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   10d0 <_mm_andnot_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x30(%rbp),%rdi
movslq -0x5c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <_mm_load_ps@plt>
mov    -0x80(%rbp),%rdi
mov    %rax,%rsi
call   10e0 <_mm_cmpnlt_ps@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1070 <_mm_movemask_ps@plt>
mov    %eax,-0x74(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x5c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   10a0 <_mm_load_pd@plt>
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x74(%rbp),%eax
and    $0x3,%eax
cltq
mov    -0x50(%rbp,%rax,4),%esi
call   1060 <_mm_add_pd@plt>
mov    %eax,-0x78(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x5c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x78(%rbp),%esi
call   1040 <_mm_store_pd@plt>
mov    -0x38(%rbp),%rdi
add    $0x10,%rdi
movslq -0x5c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   10a0 <_mm_load_pd@plt>
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x74(%rbp),%eax
sar    $0x2,%eax
cltq
mov    -0x50(%rbp,%rax,4),%esi
call   1060 <_mm_add_pd@plt>
mov    %eax,-0x78(%rbp)
mov    -0x38(%rbp),%rdi
add    $0x10,%rdi
movslq -0x5c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x78(%rbp),%esi
call   1040 <_mm_store_pd@plt>
mov    -0x5c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x5c(%rbp)
jmp    1252 <check_pc_3+0x92>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_pc_3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,%r12
mov    %r8,%r14
mov    %ecx,%r15d
movss  %xmm1,0x10(%rsp)
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r13
movsd  %xmm0,0x8(%rsp)
movss  0xe0c(%rip),%xmm0
call   10b0 <_mm_set1_ps@plt>
mov    %rax,0x40(%rsp)
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,0x20(%rsp)
xorps  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,0x24(%rsp)
xorps  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
call   1050 <_mm_set_pd@plt>
mov    %eax,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
movaps %xmm0,%xmm1
call   1050 <_mm_set_pd@plt>
mov    %eax,0x2c(%rsp)
movss  0x10(%rsp),%xmm0
call   10b0 <_mm_set1_ps@plt>
test   %r15d,%r15d
jle    1387 <check_pc_3+0x1c7>
mov    %r13,%rcx
mov    %rax,%r13
mov    %r15d,%eax
xor    %edx,%edx
mov    %r15d,0x18(%rsp)
mov    %r13,0x38(%rsp)
nopl   0x0(%rax)
mov    %edx,0x1c(%rsp)
mov    %rcx,0x30(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rbp,0x8(%rsp)
mov    0x30(%rsp),%rdi
call   1030 <_mm_load_ps@plt>
mov    %rax,%r15
mov    0x10(%rsp),%rdi
call   1030 <_mm_load_ps@plt>
mov    %rax,%rdi
mov    %r15,%rsi
call   1090 <_mm_sub_ps@plt>
mov    %rax,%rdi
mov    %r13,%rsi
call   1080 <_mm_mul_ps@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   10c0 <_mm_add_ps@plt>
mov    %rax,%rbp
mov    0x8(%rsp),%rdi
call   1030 <_mm_load_ps@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   1090 <_mm_sub_ps@plt>
mov    0x40(%rsp),%rdi
mov    %rax,%rsi
call   10d0 <_mm_andnot_ps@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <_mm_load_ps@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
call   10e0 <_mm_cmpnlt_ps@plt>
mov    %rax,%rdi
call   1070 <_mm_movemask_ps@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   10a0 <_mm_load_pd@plt>
mov    %ebp,%ecx
and    $0x3,%ecx
mov    0x20(%rsp,%rcx,4),%esi
mov    %eax,%edi
call   1060 <_mm_add_pd@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <_mm_store_pd@plt>
lea    0x10(%r12),%rbx
mov    %rbx,%rdi
call   10a0 <_mm_load_pd@plt>
sar    $0x2,%ebp
movslq %ebp,%rcx
mov    0x18(%rsp),%r13d
mov    0x20(%rsp,%rcx,4),%esi
mov    %eax,%edi
call   1060 <_mm_add_pd@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rbx
mov    0x8(%rsp),%rbp
mov    %eax,%esi
call   1040 <_mm_store_pd@plt>
mov    0x1c(%rsp),%edx
mov    0x30(%rsp),%rcx
add    $0x20,%r12
add    $0x10,%r14
add    $0x10,%rbp
add    $0x10,%rbx
add    $0x10,%rcx
add    $0x4,%edx
cmp    %r13d,%edx
mov    0x38(%rsp),%r13
jl     1270 <check_pc_3+0xb0>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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