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

/* Variables and functions */
int /*<<< orphan*/ hadamard_col8(int /*<<< orphan*/ const *, int,
                                 int /*<<< orphan*/ const *);
void aom_hadamard_8x8_c(const int16_t *src_diff, int src_stride,
                        int16_t *coeff) {
  int idx;
  int16_t buffer[64];
  int16_t *tmp_buf = &buffer[0];
  for (idx = 0; idx < 8; ++idx) {
    hadamard_col8(src_diff, src_stride, tmp_buf);
    tmp_buf += 8;
    ++src_diff;
  }
  tmp_buf = &buffer[0];
  for (idx = 0; idx < 8; ++idx) {
    hadamard_col8(tmp_buf, 8, coeff);
    coeff += 8;
    ++tmp_buf;
  }
}


x86 assembly (clang, -O0):
<aom_hadamard_8x8_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x128(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    1184 <aom_hadamard_8x8_c+0x74>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x128(%rbp),%rdx
call   1030 <hadamard_col8@plt>
mov    -0x128(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x128(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <aom_hadamard_8x8_c+0x2b>
lea    -0x120(%rbp),%rax
mov    %rax,-0x128(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    11e4 <aom_hadamard_8x8_c+0xd4>
mov    -0x128(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x128(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x128(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1199 <aom_hadamard_8x8_c+0x89>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aom_hadamard_8x8_c>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdx
call   1030 <hadamard_col8@plt>
lea    0x20(%rsp),%rdx
lea    0x4(%rbx),%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
lea    0x40(%rsp),%rdx
lea    0x8(%rbx),%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
lea    0x60(%rsp),%rdx
lea    0xc(%rbx),%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
lea    0x80(%rsp),%rdx
lea    0x10(%rbx),%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
lea    0xa0(%rsp),%rdx
lea    0x14(%rbx),%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
lea    0xc0(%rsp),%rdx
lea    0x18(%rbx),%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
lea    0xe0(%rsp),%rdx
add    $0x1c,%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <hadamard_col8@plt>
mov    %r14,%rdi
mov    $0x8,%esi
mov    %r15,%rdx
call   1030 <hadamard_col8@plt>
lea    0x20(%r15),%rdx
lea    0x4(%rsp),%rdi
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
lea    0x40(%r15),%rdx
lea    0x8(%rsp),%rdi
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
lea    0x60(%r15),%rdx
lea    0xc(%rsp),%rdi
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
lea    0x80(%r15),%rdx
lea    0x10(%rsp),%rdi
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
lea    0xa0(%r15),%rdx
lea    0x14(%rsp),%rdi
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
lea    0xc0(%r15),%rdx
lea    0x18(%rsp),%rdi
mov    $0x8,%esi
call   1030 <hadamard_col8@plt>
add    $0xe0,%r15
lea    0x1c(%rsp),%rdi
mov    $0x8,%esi
mov    %r15,%rdx
call   1030 <hadamard_col8@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @aom_hadamard_8x8_c(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca [64 x i32]
%9 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%10 = getelementptr inbounds [64 x i32], [64 x i32]* %8, i64 0, i64 0
store i32* %10, i32** %9
store i32 0, i32* %7
br label %11
11: ; preds = %23, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = load i32*, i32** %9
%18 = call i32 @hadamard_col8(i32* %15, i32 %16, i32* %17)
%19 = load i32*, i32** %9
%20 = getelementptr inbounds i32, i32* %19, i64 8
store i32* %20, i32** %9
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %4
br label %23
23: ; preds = %14
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %11
26: ; preds = %11
%27 = getelementptr inbounds [64 x i32], [64 x i32]* %8, i64 0, i64 0
store i32* %27, i32** %9
store i32 0, i32* %7
br label %28
28: ; preds = %39, %26
%29 = load i32, i32* %7
%30 = icmp slt i32 %29, 8
br i1 %30, label %31, label %42
31: ; preds = %28
%32 = load i32*, i32** %9
%33 = load i32*, i32** %6
%34 = call i32 @hadamard_col8(i32* %32, i32 8, i32* %33)
%35 = load i32*, i32** %6
%36 = getelementptr inbounds i32, i32* %35, i64 8
store i32* %36, i32** %6
%37 = load i32*, i32** %9
%38 = getelementptr inbounds i32, i32* %37, i32 1
store i32* %38, i32** %9
br label %39
39: ; preds = %31
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %28
42: ; preds = %28
ret void
}

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