#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*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_adds_epi8(int /*<<< orphan*/, int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_packs_epi16(int /*<<< orphan*/ const,
                                   int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_set1_epi8(int);
int /*<<< orphan*/ _mm_srai_epi16(int /*<<< orphan*/ const, int);
int /*<<< orphan*/ _mm_subs_epi8(int /*<<< orphan*/, int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/ const);
void Update2Pixels(__m128i *const pi, __m128i *const qi,
                   const __m128i *const a0_lo, const __m128i *const a0_hi) {
  const __m128i a1_lo = _mm_srai_epi16(*a0_lo, 7);
  const __m128i a1_hi = _mm_srai_epi16(*a0_hi, 7);
  const __m128i delta = _mm_packs_epi16(a1_lo, a1_hi);
  const __m128i sign_bit = _mm_set1_epi8(0x80);
  *pi = _mm_adds_epi8(*pi, delta);
  *qi = _mm_subs_epi8(*qi, delta);
  {
    *pi = _mm_xor_si128(*pi, sign_bit);
    *qi = _mm_xor_si128(*qi, sign_bit);
  };
}


x86 assembly (clang, -O0):
<Update2Pixels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    $0x7,%esi
call   1060 <_mm_srai_epi16@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    $0x7,%esi
call   1060 <_mm_srai_epi16@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1080 <_mm_packs_epi16@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x80,%edi
call   1040 <_mm_set1_epi8@plt>
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%esi
call   1030 <_mm_adds_epi8@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%esi
call   1050 <_mm_subs_epi8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Update2Pixels>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdx),%edi
mov    $0x7,%esi
call   1060 <_mm_srai_epi16@plt>
mov    %eax,%ebp
mov    (%r15),%edi
mov    $0x7,%esi
call   1060 <_mm_srai_epi16@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <_mm_packs_epi16@plt>
mov    %eax,%ebp
mov    $0x80,%edi
call   1040 <_mm_set1_epi8@plt>
mov    %eax,%r15d
mov    (%rbx),%edi
mov    %ebp,%esi
call   1030 <_mm_adds_epi8@plt>
mov    %eax,(%rbx)
mov    (%r14),%edi
mov    %ebp,%esi
call   1050 <_mm_subs_epi8@plt>
mov    %eax,(%r14)
mov    (%rbx),%edi
mov    %r15d,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,(%rbx)
mov    (%r14),%edi
mov    %r15d,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Update2Pixels(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = call i32 @_mm_srai_epi16(i32 %14, i32 7)
store i32 %15, i32* %9
%16 = load i32*, i32** %8
%17 = load i32, i32* %16
%18 = call i32 @_mm_srai_epi16(i32 %17, i32 7)
store i32 %18, i32* %10
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = call i32 @_mm_packs_epi16(i32 %19, i32 %20)
store i32 %21, i32* %11
%22 = call i32 @_mm_set1_epi8(i32 128)
store i32 %22, i32* %12
%23 = load i32*, i32** %5
%24 = load i32, i32* %23
%25 = load i32, i32* %11
%26 = call i32 @_mm_adds_epi8(i32 %24, i32 %25)
%27 = load i32*, i32** %5
store i32 %26, i32* %27
%28 = load i32*, i32** %6
%29 = load i32, i32* %28
%30 = load i32, i32* %11
%31 = call i32 @_mm_subs_epi8(i32 %29, i32 %30)
%32 = load i32*, i32** %6
store i32 %31, i32* %32
%33 = load i32*, i32** %5
%34 = load i32, i32* %33
%35 = load i32, i32* %12
%36 = call i32 @_mm_xor_si128(i32 %34, i32 %35)
%37 = load i32*, i32** %5
store i32 %36, i32* %37
%38 = load i32*, i32** %6
%39 = load i32, i32* %38
%40 = load i32, i32* %12
%41 = call i32 @_mm_xor_si128(i32 %39, i32 %40)
%42 = load i32*, i32** %6
store i32 %41, i32* %42
ret void
}

LLVM IR (-O2):
define void @Update2Pixels(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = load i32, i32* %2
%6 = tail call i32 @_mm_srai_epi16(i32 %5, i32 7)
%7 = load i32, i32* %3
%8 = tail call i32 @_mm_srai_epi16(i32 %7, i32 7)
%9 = tail call i32 @_mm_packs_epi16(i32 %6, i32 %8)
%10 = tail call i32 @_mm_set1_epi8(i32 128)
%11 = load i32, i32* %0
%12 = tail call i32 @_mm_adds_epi8(i32 %11, i32 %9)
store i32 %12, i32* %0
%13 = load i32, i32* %1
%14 = tail call i32 @_mm_subs_epi8(i32 %13, i32 %9)
store i32 %14, i32* %1
%15 = load i32, i32* %0
%16 = tail call i32 @_mm_xor_si128(i32 %15, i32 %10)
store i32 %16, i32* %0
%17 = load i32, i32* %1
%18 = tail call i32 @_mm_xor_si128(i32 %17, i32 %10)
store i32 %18, i32* %1
ret void
}