void Saturate(short *Block_Ptr) {
  int i;
  int sum;
  int val;
  int j;
  {
    sum = 0;
    i = 0;
    while (i < 64) {
      j = 0;
      while (j < 8) {
        val = (int)*(Block_Ptr + i);
        if (val > 2047) {
          val = 2047;
        } else if (val < -2048) {
          val = -2048;
        }
        *(Block_Ptr + i) = (short)val;
        sum += val;
        j++;
        i++;
      }
    }
    if ((sum & 1) == 0) {
      *(Block_Ptr + 63) = (short)((int)*(Block_Ptr + 63) ^ 1);
    }
    return;
  }
}


x86 assembly (clang, -O0):
<Saturate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    11a9 <Saturate+0xa9>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    11a4 <Saturate+0xa4>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x7ff,-0x14(%rbp)
jle    1159 <Saturate+0x59>
movl   $0x7ff,-0x14(%rbp)
jmp    1172 <Saturate+0x72>
cmpl   $0xfffff800,-0x14(%rbp)
jge    116d <Saturate+0x6d>
movl   $0xfffff800,-0x14(%rbp)
jmp    1172 <Saturate+0x72>
mov    -0x14(%rbp),%eax
mov    %ax,%dx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <Saturate+0x27>
jmp    1116 <Saturate+0x16>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    11ce <Saturate+0xce>
mov    -0x8(%rbp),%rax
movswl 0x7e(%rax),%eax
xor    $0x1,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x7e(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Saturate>:
movq   (%rdi),%xmm0
punpcklwd %xmm0,%xmm2
psrad  $0x10,%xmm2
movdqa 0xeeb(%rip),%xmm1
pcmpgtw %xmm1,%xmm0
punpcklwd %xmm0,%xmm3
psrad  $0x10,%xmm3
movdqa 0xee6(%rip),%xmm0
movdqa %xmm2,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm4,%xmm2
pandn  %xmm0,%xmm4
por    %xmm2,%xmm4
movdqa %xmm3,%xmm5
pandn  %xmm4,%xmm5
movdqa 0xed2(%rip),%xmm2
pand   %xmm2,%xmm3
por    %xmm5,%xmm3
movdqa %xmm3,%xmm4
packssdw %xmm4,%xmm4
movq   %xmm4,(%rdi)
movq   0x8(%rdi),%xmm4
punpcklwd %xmm4,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm5
psrad  $0x10,%xmm5
movdqa %xmm6,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm4,%xmm6
pandn  %xmm0,%xmm4
por    %xmm6,%xmm4
movdqa %xmm5,%xmm6
pandn  %xmm4,%xmm6
pand   %xmm2,%xmm5
por    %xmm6,%xmm5
movq   0x10(%rdi),%xmm4
punpcklwd %xmm4,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm4
psrad  $0x10,%xmm4
movdqa %xmm6,%xmm7
pcmpgtd %xmm0,%xmm7
pand   %xmm7,%xmm6
pandn  %xmm0,%xmm7
por    %xmm6,%xmm7
movdqa %xmm4,%xmm6
pandn  %xmm7,%xmm6
pand   %xmm2,%xmm4
por    %xmm6,%xmm4
movdqa %xmm5,%xmm6
packssdw %xmm4,%xmm6
movdqu %xmm6,0x8(%rdi)
paddd  %xmm3,%xmm5
pshufd $0x1b,%xmm5,%xmm3
pshufd $0x11,%xmm5,%xmm5
paddd  %xmm3,%xmm5
pshufd $0x55,%xmm5,%xmm3
paddd  %xmm5,%xmm3
movd   %xmm3,%ecx
movq   0x18(%rdi),%xmm3
punpcklwd %xmm3,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm5
psrad  $0x10,%xmm5
movdqa %xmm6,%xmm3
pcmpgtd %xmm0,%xmm3
pand   %xmm3,%xmm6
pandn  %xmm0,%xmm3
por    %xmm6,%xmm3
movdqa %xmm5,%xmm6
pandn  %xmm3,%xmm6
pand   %xmm2,%xmm5
por    %xmm6,%xmm5
movq   0x20(%rdi),%xmm3
punpcklwd %xmm3,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm3
psrad  $0x10,%xmm3
movdqa %xmm6,%xmm7
pcmpgtd %xmm0,%xmm7
pand   %xmm7,%xmm6
pandn  %xmm0,%xmm7
por    %xmm6,%xmm7
movdqa %xmm3,%xmm6
pandn  %xmm7,%xmm6
pand   %xmm2,%xmm3
por    %xmm6,%xmm3
movdqa %xmm5,%xmm6
packssdw %xmm3,%xmm6
movdqu %xmm6,0x18(%rdi)
paddd  %xmm4,%xmm5
pshufd $0x1b,%xmm5,%xmm4
pshufd $0x11,%xmm5,%xmm5
paddd  %xmm4,%xmm5
pshufd $0x55,%xmm5,%xmm4
paddd  %xmm5,%xmm4
movd   %xmm4,%eax
add    %ecx,%eax
movq   0x28(%rdi),%xmm4
punpcklwd %xmm4,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm5
psrad  $0x10,%xmm5
movdqa %xmm6,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm4,%xmm6
pandn  %xmm0,%xmm4
por    %xmm6,%xmm4
movdqa %xmm5,%xmm6
pandn  %xmm4,%xmm6
pand   %xmm2,%xmm5
por    %xmm6,%xmm5
movq   0x30(%rdi),%xmm4
punpcklwd %xmm4,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm4
psrad  $0x10,%xmm4
movdqa %xmm6,%xmm7
pcmpgtd %xmm0,%xmm7
pand   %xmm7,%xmm6
pandn  %xmm0,%xmm7
por    %xmm6,%xmm7
movdqa %xmm4,%xmm6
pandn  %xmm7,%xmm6
pand   %xmm2,%xmm4
por    %xmm6,%xmm4
movdqa %xmm5,%xmm6
packssdw %xmm4,%xmm6
movdqu %xmm6,0x28(%rdi)
paddd  %xmm3,%xmm5
pshufd $0x1b,%xmm5,%xmm3
pshufd $0x11,%xmm5,%xmm5
paddd  %xmm3,%xmm5
pshufd $0x55,%xmm5,%xmm3
paddd  %xmm5,%xmm3
movd   %xmm3,%ecx
add    %eax,%ecx
movq   0x38(%rdi),%xmm3
punpcklwd %xmm3,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm5
psrad  $0x10,%xmm5
movdqa %xmm6,%xmm3
pcmpgtd %xmm0,%xmm3
pand   %xmm3,%xmm6
pandn  %xmm0,%xmm3
por    %xmm6,%xmm3
movdqa %xmm5,%xmm6
pandn  %xmm3,%xmm6
pand   %xmm2,%xmm5
por    %xmm6,%xmm5
movq   0x40(%rdi),%xmm3
punpcklwd %xmm3,%xmm6
psrad  $0x10,%xmm6
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm3
psrad  $0x10,%xmm3
movdqa %xmm6,%xmm7
pcmpgtd %xmm0,%xmm7
pand   %xmm7,%xmm6
pandn  %xmm0,%xmm7
por    %xmm6,%xmm7
movdqa %xmm3,%xmm6
pandn  %xmm7,%xmm6
pand   %xmm2,%xmm3
por    %xmm6,%xmm3
movdqa %xmm5,%xmm6
packssdw %xmm3,%xmm6
movdqu %xmm6,0x38(%rdi)
paddd  %xmm4,%xmm5
pshufd $0x1b,%xmm5,%xmm4
pshufd $0x11,%xmm5,%xmm5
paddd  %xmm4,%xmm5
pshufd $0x55,%xmm5,%xmm4
paddd  %xmm5,%xmm4
movd   %xmm4,%edx
add    %ecx,%edx
movq   0x48(%rdi),%xmm4
punpcklwd %xmm4,%xmm5
psrad  $0x10,%xmm5
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm4
psrad  $0x10,%xmm4
movdqa %xmm5,%xmm6
pcmpgtd %xmm0,%xmm6
pand   %xmm6,%xmm5
pandn  %xmm0,%xmm6
por    %xmm5,%xmm6
movdqa %xmm4,%xmm5
pandn  %xmm6,%xmm5
pand   %xmm2,%xmm4
por    %xmm5,%xmm4
movdqa %xmm4,%xmm5
packssdw %xmm5,%xmm5
movq   %xmm5,0x48(%rdi)
paddd  %xmm3,%xmm4
pshufd $0x1b,%xmm4,%xmm3
pshufd $0x11,%xmm4,%xmm4
paddd  %xmm3,%xmm4
pshufd $0x55,%xmm4,%xmm3
paddd  %xmm4,%xmm3
movd   %xmm3,%eax
add    %edx,%eax
movq   0x50(%rdi),%xmm3
punpcklwd %xmm3,%xmm4
psrad  $0x10,%xmm4
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm3
psrad  $0x10,%xmm3
movdqa %xmm4,%xmm5
pcmpgtd %xmm0,%xmm5
pand   %xmm5,%xmm4
pandn  %xmm0,%xmm5
por    %xmm4,%xmm5
movdqa %xmm3,%xmm4
pandn  %xmm5,%xmm4
pand   %xmm2,%xmm3
por    %xmm4,%xmm3
movdqa %xmm3,%xmm4
packssdw %xmm4,%xmm4
movq   %xmm4,0x50(%rdi)
movq   0x58(%rdi),%xmm4
punpcklwd %xmm4,%xmm5
psrad  $0x10,%xmm5
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm4
psrad  $0x10,%xmm4
movdqa %xmm5,%xmm6
pcmpgtd %xmm0,%xmm6
pand   %xmm6,%xmm5
pandn  %xmm0,%xmm6
por    %xmm5,%xmm6
movdqa %xmm4,%xmm5
pandn  %xmm6,%xmm5
pand   %xmm2,%xmm4
por    %xmm5,%xmm4
movdqa %xmm4,%xmm5
packssdw %xmm5,%xmm5
movq   %xmm5,0x58(%rdi)
paddd  %xmm3,%xmm4
pshufd $0x1b,%xmm4,%xmm3
pshufd $0x11,%xmm4,%xmm4
paddd  %xmm3,%xmm4
pshufd $0x55,%xmm4,%xmm3
paddd  %xmm4,%xmm3
movd   %xmm3,%ecx
add    %eax,%ecx
movq   0x60(%rdi),%xmm3
punpcklwd %xmm3,%xmm4
psrad  $0x10,%xmm4
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm3
psrad  $0x10,%xmm3
movdqa %xmm4,%xmm5
pcmpgtd %xmm0,%xmm5
pand   %xmm5,%xmm4
pandn  %xmm0,%xmm5
por    %xmm4,%xmm5
movdqa %xmm3,%xmm4
pandn  %xmm5,%xmm4
pand   %xmm2,%xmm3
por    %xmm4,%xmm3
movdqa %xmm3,%xmm4
packssdw %xmm4,%xmm4
movq   %xmm4,0x60(%rdi)
movq   0x68(%rdi),%xmm4
punpcklwd %xmm4,%xmm5
psrad  $0x10,%xmm5
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm4
psrad  $0x10,%xmm4
movdqa %xmm5,%xmm6
pcmpgtd %xmm0,%xmm6
pand   %xmm6,%xmm5
pandn  %xmm0,%xmm6
por    %xmm5,%xmm6
movdqa %xmm4,%xmm5
pandn  %xmm6,%xmm5
pand   %xmm2,%xmm4
por    %xmm5,%xmm4
movdqa %xmm4,%xmm5
packssdw %xmm5,%xmm5
movq   %xmm5,0x68(%rdi)
paddd  %xmm3,%xmm4
pshufd $0x1b,%xmm4,%xmm3
pshufd $0x11,%xmm4,%xmm4
paddd  %xmm3,%xmm4
pshufd $0x55,%xmm4,%xmm3
paddd  %xmm4,%xmm3
movd   %xmm3,%eax
add    %ecx,%eax
movq   0x70(%rdi),%xmm3
punpcklwd %xmm3,%xmm4
psrad  $0x10,%xmm4
pcmpgtw %xmm1,%xmm3
punpcklwd %xmm3,%xmm3
psrad  $0x10,%xmm3
movdqa %xmm4,%xmm5
pcmpgtd %xmm0,%xmm5
pand   %xmm5,%xmm4
pandn  %xmm0,%xmm5
por    %xmm4,%xmm5
movdqa %xmm3,%xmm4
pandn  %xmm5,%xmm4
pand   %xmm2,%xmm3
por    %xmm4,%xmm3
movdqa %xmm3,%xmm4
packssdw %xmm4,%xmm4
movq   %xmm4,0x70(%rdi)
movq   0x78(%rdi),%xmm4
punpcklwd %xmm4,%xmm5
psrad  $0x10,%xmm5
pcmpgtw %xmm1,%xmm4
punpcklwd %xmm4,%xmm1
psrad  $0x10,%xmm1
movdqa %xmm5,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm4,%xmm5
pandn  %xmm0,%xmm4
por    %xmm5,%xmm4
movdqa %xmm1,%xmm0
pandn  %xmm4,%xmm0
pand   %xmm2,%xmm1
por    %xmm0,%xmm1
movdqa %xmm1,%xmm0
packssdw %xmm0,%xmm0
movq   %xmm0,0x78(%rdi)
paddd  %xmm3,%xmm1
pshufd $0x1b,%xmm1,%xmm0
pshufd $0x11,%xmm1,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%ecx
add    %eax,%ecx
test   $0x1,%cl
jne    16b1 <Saturate+0x5b1>
xorb   $0x1,0x7e(%rdi)
ret

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

LLVM IR (-O2):
define void @Saturate(i16* nocapture %0) {
%2 = bitcast i16* %0 to <4 x i16>*
%3 = load <4 x i16>, <4 x i16>* %2
%4 = sext <4 x i16> %3 to <4 x i32>
%5 = icmp sgt <4 x i16> %3, <i16 2047, i16 2047, i16 2047, i16 2047>
%6 = icmp sgt <4 x i32> %4, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%7 = select <4 x i1> %6, <4 x i32> %4, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%8 = select <4 x i1> %5, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %7
%9 = trunc <4 x i32> %8 to <4 x i16>
%10 = bitcast i16* %0 to <4 x i16>*
store <4 x i16> %9, <4 x i16>* %10
%11 = getelementptr inbounds i16, i16* %0, i64 4
%12 = bitcast i16* %11 to <4 x i16>*
%13 = load <4 x i16>, <4 x i16>* %12
%14 = sext <4 x i16> %13 to <4 x i32>
%15 = icmp sgt <4 x i16> %13, <i16 2047, i16 2047, i16 2047, i16 2047>
%16 = icmp sgt <4 x i32> %14, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%17 = select <4 x i1> %16, <4 x i32> %14, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%18 = select <4 x i1> %15, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %17
%19 = trunc <4 x i32> %18 to <4 x i16>
%20 = bitcast i16* %11 to <4 x i16>*
store <4 x i16> %19, <4 x i16>* %20
%21 = shufflevector <4 x i32> %18, <4 x i32> %8, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%22 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %21)
%23 = getelementptr inbounds i16, i16* %0, i64 8
%24 = bitcast i16* %23 to <4 x i16>*
%25 = load <4 x i16>, <4 x i16>* %24
%26 = sext <4 x i16> %25 to <4 x i32>
%27 = icmp sgt <4 x i16> %25, <i16 2047, i16 2047, i16 2047, i16 2047>
%28 = icmp sgt <4 x i32> %26, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%29 = select <4 x i1> %28, <4 x i32> %26, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%30 = select <4 x i1> %27, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %29
%31 = trunc <4 x i32> %30 to <4 x i16>
%32 = bitcast i16* %23 to <4 x i16>*
store <4 x i16> %31, <4 x i16>* %32
%33 = getelementptr inbounds i16, i16* %0, i64 12
%34 = bitcast i16* %33 to <4 x i16>*
%35 = load <4 x i16>, <4 x i16>* %34
%36 = sext <4 x i16> %35 to <4 x i32>
%37 = icmp sgt <4 x i16> %35, <i16 2047, i16 2047, i16 2047, i16 2047>
%38 = icmp sgt <4 x i32> %36, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%39 = select <4 x i1> %38, <4 x i32> %36, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%40 = select <4 x i1> %37, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %39
%41 = trunc <4 x i32> %40 to <4 x i16>
%42 = bitcast i16* %33 to <4 x i16>*
store <4 x i16> %41, <4 x i16>* %42
%43 = shufflevector <4 x i32> %40, <4 x i32> %30, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%44 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %43)
%45 = add nsw i32 %44, %22
%46 = getelementptr inbounds i16, i16* %0, i64 16
%47 = bitcast i16* %46 to <4 x i16>*
%48 = load <4 x i16>, <4 x i16>* %47
%49 = sext <4 x i16> %48 to <4 x i32>
%50 = icmp sgt <4 x i16> %48, <i16 2047, i16 2047, i16 2047, i16 2047>
%51 = icmp sgt <4 x i32> %49, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%52 = select <4 x i1> %51, <4 x i32> %49, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%53 = select <4 x i1> %50, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %52
%54 = trunc <4 x i32> %53 to <4 x i16>
%55 = bitcast i16* %46 to <4 x i16>*
store <4 x i16> %54, <4 x i16>* %55
%56 = getelementptr inbounds i16, i16* %0, i64 20
%57 = bitcast i16* %56 to <4 x i16>*
%58 = load <4 x i16>, <4 x i16>* %57
%59 = sext <4 x i16> %58 to <4 x i32>
%60 = icmp sgt <4 x i16> %58, <i16 2047, i16 2047, i16 2047, i16 2047>
%61 = icmp sgt <4 x i32> %59, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%62 = select <4 x i1> %61, <4 x i32> %59, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%63 = select <4 x i1> %60, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %62
%64 = trunc <4 x i32> %63 to <4 x i16>
%65 = bitcast i16* %56 to <4 x i16>*
store <4 x i16> %64, <4 x i16>* %65
%66 = shufflevector <4 x i32> %63, <4 x i32> %53, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%67 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %66)
%68 = add nsw i32 %67, %45
%69 = getelementptr inbounds i16, i16* %0, i64 24
%70 = bitcast i16* %69 to <4 x i16>*
%71 = load <4 x i16>, <4 x i16>* %70
%72 = sext <4 x i16> %71 to <4 x i32>
%73 = icmp sgt <4 x i16> %71, <i16 2047, i16 2047, i16 2047, i16 2047>
%74 = icmp sgt <4 x i32> %72, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%75 = select <4 x i1> %74, <4 x i32> %72, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%76 = select <4 x i1> %73, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %75
%77 = trunc <4 x i32> %76 to <4 x i16>
%78 = bitcast i16* %69 to <4 x i16>*
store <4 x i16> %77, <4 x i16>* %78
%79 = getelementptr inbounds i16, i16* %0, i64 28
%80 = bitcast i16* %79 to <4 x i16>*
%81 = load <4 x i16>, <4 x i16>* %80
%82 = sext <4 x i16> %81 to <4 x i32>
%83 = icmp sgt <4 x i16> %81, <i16 2047, i16 2047, i16 2047, i16 2047>
%84 = icmp sgt <4 x i32> %82, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%85 = select <4 x i1> %84, <4 x i32> %82, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%86 = select <4 x i1> %83, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %85
%87 = trunc <4 x i32> %86 to <4 x i16>
%88 = bitcast i16* %79 to <4 x i16>*
store <4 x i16> %87, <4 x i16>* %88
%89 = shufflevector <4 x i32> %86, <4 x i32> %76, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%90 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %89)
%91 = add nsw i32 %90, %68
%92 = getelementptr inbounds i16, i16* %0, i64 32
%93 = bitcast i16* %92 to <4 x i16>*
%94 = load <4 x i16>, <4 x i16>* %93
%95 = sext <4 x i16> %94 to <4 x i32>
%96 = icmp sgt <4 x i16> %94, <i16 2047, i16 2047, i16 2047, i16 2047>
%97 = icmp sgt <4 x i32> %95, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%98 = select <4 x i1> %97, <4 x i32> %95, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%99 = select <4 x i1> %96, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %98
%100 = trunc <4 x i32> %99 to <4 x i16>
%101 = bitcast i16* %92 to <4 x i16>*
store <4 x i16> %100, <4 x i16>* %101
%102 = getelementptr inbounds i16, i16* %0, i64 36
%103 = bitcast i16* %102 to <4 x i16>*
%104 = load <4 x i16>, <4 x i16>* %103
%105 = sext <4 x i16> %104 to <4 x i32>
%106 = icmp sgt <4 x i16> %104, <i16 2047, i16 2047, i16 2047, i16 2047>
%107 = icmp sgt <4 x i32> %105, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%108 = select <4 x i1> %107, <4 x i32> %105, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%109 = select <4 x i1> %106, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %108
%110 = trunc <4 x i32> %109 to <4 x i16>
%111 = bitcast i16* %102 to <4 x i16>*
store <4 x i16> %110, <4 x i16>* %111
%112 = shufflevector <4 x i32> %109, <4 x i32> %99, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%113 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %112)
%114 = add nsw i32 %113, %91
%115 = getelementptr inbounds i16, i16* %0, i64 40
%116 = bitcast i16* %115 to <4 x i16>*
%117 = load <4 x i16>, <4 x i16>* %116
%118 = sext <4 x i16> %117 to <4 x i32>
%119 = icmp sgt <4 x i16> %117, <i16 2047, i16 2047, i16 2047, i16 2047>
%120 = icmp sgt <4 x i32> %118, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%121 = select <4 x i1> %120, <4 x i32> %118, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%122 = select <4 x i1> %119, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %121
%123 = trunc <4 x i32> %122 to <4 x i16>
%124 = bitcast i16* %115 to <4 x i16>*
store <4 x i16> %123, <4 x i16>* %124
%125 = getelementptr inbounds i16, i16* %0, i64 44
%126 = bitcast i16* %125 to <4 x i16>*
%127 = load <4 x i16>, <4 x i16>* %126
%128 = sext <4 x i16> %127 to <4 x i32>
%129 = icmp sgt <4 x i16> %127, <i16 2047, i16 2047, i16 2047, i16 2047>
%130 = icmp sgt <4 x i32> %128, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%131 = select <4 x i1> %130, <4 x i32> %128, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%132 = select <4 x i1> %129, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %131
%133 = trunc <4 x i32> %132 to <4 x i16>
%134 = bitcast i16* %125 to <4 x i16>*
store <4 x i16> %133, <4 x i16>* %134
%135 = shufflevector <4 x i32> %132, <4 x i32> %122, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%136 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %135)
%137 = add nsw i32 %136, %114
%138 = getelementptr inbounds i16, i16* %0, i64 48
%139 = bitcast i16* %138 to <4 x i16>*
%140 = load <4 x i16>, <4 x i16>* %139
%141 = sext <4 x i16> %140 to <4 x i32>
%142 = icmp sgt <4 x i16> %140, <i16 2047, i16 2047, i16 2047, i16 2047>
%143 = icmp sgt <4 x i32> %141, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%144 = select <4 x i1> %143, <4 x i32> %141, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%145 = select <4 x i1> %142, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %144
%146 = trunc <4 x i32> %145 to <4 x i16>
%147 = bitcast i16* %138 to <4 x i16>*
store <4 x i16> %146, <4 x i16>* %147
%148 = getelementptr inbounds i16, i16* %0, i64 52
%149 = bitcast i16* %148 to <4 x i16>*
%150 = load <4 x i16>, <4 x i16>* %149
%151 = sext <4 x i16> %150 to <4 x i32>
%152 = icmp sgt <4 x i16> %150, <i16 2047, i16 2047, i16 2047, i16 2047>
%153 = icmp sgt <4 x i32> %151, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%154 = select <4 x i1> %153, <4 x i32> %151, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%155 = select <4 x i1> %152, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %154
%156 = trunc <4 x i32> %155 to <4 x i16>
%157 = bitcast i16* %148 to <4 x i16>*
store <4 x i16> %156, <4 x i16>* %157
%158 = shufflevector <4 x i32> %155, <4 x i32> %145, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%159 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %158)
%160 = add nsw i32 %159, %137
%161 = getelementptr inbounds i16, i16* %0, i64 56
%162 = bitcast i16* %161 to <4 x i16>*
%163 = load <4 x i16>, <4 x i16>* %162
%164 = sext <4 x i16> %163 to <4 x i32>
%165 = icmp sgt <4 x i16> %163, <i16 2047, i16 2047, i16 2047, i16 2047>
%166 = icmp sgt <4 x i32> %164, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%167 = select <4 x i1> %166, <4 x i32> %164, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%168 = select <4 x i1> %165, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %167
%169 = trunc <4 x i32> %168 to <4 x i16>
%170 = bitcast i16* %161 to <4 x i16>*
store <4 x i16> %169, <4 x i16>* %170
%171 = getelementptr inbounds i16, i16* %0, i64 60
%172 = bitcast i16* %171 to <4 x i16>*
%173 = load <4 x i16>, <4 x i16>* %172
%174 = sext <4 x i16> %173 to <4 x i32>
%175 = icmp sgt <4 x i16> %173, <i16 2047, i16 2047, i16 2047, i16 2047>
%176 = icmp sgt <4 x i32> %174, <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%177 = select <4 x i1> %176, <4 x i32> %174, <4 x i32> <i32 -2048, i32 -2048, i32 -2048, i32 -2048>
%178 = select <4 x i1> %175, <4 x i32> <i32 2047, i32 2047, i32 2047, i32 2047>, <4 x i32> %177
%179 = trunc <4 x i32> %178 to <4 x i16>
%180 = bitcast i16* %171 to <4 x i16>*
store <4 x i16> %179, <4 x i16>* %180
%181 = shufflevector <4 x i32> %178, <4 x i32> %168, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
%182 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %181)
%183 = add nsw i32 %182, %160
%184 = and i32 %183, 1
%185 = icmp eq i32 %184, 0
br i1 %185, label %186, label %190
186: ; preds = %1
%187 = getelementptr inbounds i16, i16* %0, i64 63
%188 = load i16, i16* %187
%189 = xor i16 %188, 1
store i16 %189, i16* %187
br label %190
190: ; preds = %186, %1
ret void
}