#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*/ int16_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_load_si128(int /*<<< orphan*/ const *);
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ hadamard_col8_sse2(int /*<<< orphan*/ *, int);
void aom_hadamard_8x8_sse2(int16_t const *src_diff, int src_stride,
                           int16_t *coeff) {
  __m128i src[8];
  src[0] = _mm_load_si128((const __m128i *)src_diff);
  src[1] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  src[2] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  src[3] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  src[4] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  src[5] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  src[6] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  src[7] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
  hadamard_col8_sse2(src, 0);
  hadamard_col8_sse2(src, 1);
  _mm_store_si128((__m128i *)coeff, src[0]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[1]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[2]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[3]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[4]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[5]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[6]);
  coeff += 8;
  _mm_store_si128((__m128i *)coeff, src[7]);
}


x86 assembly (clang, -O0):
<aom_hadamard_8x8_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x3c(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdi
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    %rdi,-0x8(%rbp)
call   1030 <_mm_load_si128@plt>
mov    %eax,-0x24(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
call   1050 <hadamard_col8_sse2@plt>
lea    -0x40(%rbp),%rdi
mov    $0x1,%esi
call   1050 <hadamard_col8_sse2@plt>
mov    -0x18(%rbp),%rdi
mov    -0x40(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1040 <_mm_store_si128@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <_mm_store_si128@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aom_hadamard_8x8_sse2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r15
mov    %esi,%r14d
mov    %rdi,%rbp
call   1030 <_mm_load_si128@plt>
mov    %eax,(%rsp)
movslq %r14d,%rbx
lea    0x0(%rbp,%rbx,4),%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x4(%rsp)
lea    0x0(%rbp,%rbx,4),%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x8(%rsp)
lea    0x0(%rbp,%rbx,4),%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0xc(%rsp)
lea    0x0(%rbp,%rbx,4),%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x10(%rsp)
lea    0x0(%rbp,%rbx,4),%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x14(%rsp)
lea    0x0(%rbp,%rbx,4),%rbp
mov    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x18(%rsp)
lea    0x0(,%rbx,4),%rdi
add    %rbp,%rdi
call   1030 <_mm_load_si128@plt>
mov    %eax,0x1c(%rsp)
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
call   1050 <hadamard_col8_sse2@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
call   1050 <hadamard_col8_sse2@plt>
mov    (%rsp),%esi
mov    %r15,%rdi
call   1040 <_mm_store_si128@plt>
lea    0x20(%r15),%rdi
mov    0x4(%rsp),%esi
call   1040 <_mm_store_si128@plt>
lea    0x40(%r15),%rdi
mov    0x8(%rsp),%esi
call   1040 <_mm_store_si128@plt>
lea    0x60(%r15),%rdi
mov    0xc(%rsp),%esi
call   1040 <_mm_store_si128@plt>
lea    0x80(%r15),%rdi
mov    0x10(%rsp),%esi
call   1040 <_mm_store_si128@plt>
lea    0xa0(%r15),%rdi
mov    0x14(%rsp),%esi
call   1040 <_mm_store_si128@plt>
lea    0xc0(%r15),%rdi
mov    0x18(%rsp),%esi
call   1040 <_mm_store_si128@plt>
add    $0xe0,%r15
mov    0x1c(%rsp),%esi
mov    %r15,%rdi
call   1040 <_mm_store_si128@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @aom_hadamard_8x8_sse2(i32* %0, i32 %1, i32* %2) {
%4 = alloca [8 x i32]
%5 = bitcast [8 x i32]* %4 to i8*
%6 = tail call i32 @_mm_load_si128(i32* %0)
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
store i32 %6, i32* %7
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = tail call i32 @_mm_load_si128(i32* %9)
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 1
store i32 %10, i32* %11
%12 = getelementptr inbounds i32, i32* %9, i64 %8
%13 = tail call i32 @_mm_load_si128(i32* %12)
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 2
store i32 %13, i32* %14
%15 = getelementptr inbounds i32, i32* %12, i64 %8
%16 = tail call i32 @_mm_load_si128(i32* %15)
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 3
store i32 %16, i32* %17
%18 = getelementptr inbounds i32, i32* %15, i64 %8
%19 = tail call i32 @_mm_load_si128(i32* %18)
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 4
store i32 %19, i32* %20
%21 = getelementptr inbounds i32, i32* %18, i64 %8
%22 = tail call i32 @_mm_load_si128(i32* %21)
%23 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 5
store i32 %22, i32* %23
%24 = getelementptr inbounds i32, i32* %21, i64 %8
%25 = tail call i32 @_mm_load_si128(i32* %24)
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 6
store i32 %25, i32* %26
%27 = getelementptr inbounds i32, i32* %24, i64 %8
%28 = tail call i32 @_mm_load_si128(i32* %27)
%29 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 7
store i32 %28, i32* %29
%30 = call i32 @hadamard_col8_sse2(i32* %7, i32 0)
%31 = call i32 @hadamard_col8_sse2(i32* %7, i32 1)
%32 = load i32, i32* %7
%33 = call i32 @_mm_store_si128(i32* %2, i32 %32)
%34 = getelementptr inbounds i32, i32* %2, i64 8
%35 = load i32, i32* %11
%36 = call i32 @_mm_store_si128(i32* %34, i32 %35)
%37 = getelementptr inbounds i32, i32* %2, i64 16
%38 = load i32, i32* %14
%39 = call i32 @_mm_store_si128(i32* %37, i32 %38)
%40 = getelementptr inbounds i32, i32* %2, i64 24
%41 = load i32, i32* %17
%42 = call i32 @_mm_store_si128(i32* %40, i32 %41)
%43 = getelementptr inbounds i32, i32* %2, i64 32
%44 = load i32, i32* %20
%45 = call i32 @_mm_store_si128(i32* %43, i32 %44)
%46 = getelementptr inbounds i32, i32* %2, i64 40
%47 = load i32, i32* %23
%48 = call i32 @_mm_store_si128(i32* %46, i32 %47)
%49 = getelementptr inbounds i32, i32* %2, i64 48
%50 = load i32, i32* %26
%51 = call i32 @_mm_store_si128(i32* %49, i32 %50)
%52 = getelementptr inbounds i32, i32* %2, i64 56
%53 = load i32, i32* %29
%54 = call i32 @_mm_store_si128(i32* %52, i32 %53)
ret void
}