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

/* Variables and functions */
int /*<<< orphan*/ UINT_MAX;
unsigned int vp8_sad4x4_c(unsigned char const *, int, unsigned char const *,
                          int, int /*<<< orphan*/);
void vp8_sad4x4x3_c(const unsigned char *src_ptr, int src_stride,
                    const unsigned char *ref_ptr, int ref_stride,
                    unsigned int *sad_array) {
  sad_array[0] =
      vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 0, ref_stride, UINT_MAX);
  sad_array[1] =
      vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, UINT_MAX);
  sad_array[2] =
      vp8_sad4x4_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, UINT_MAX);
}


x86 assembly (clang, -O0):
<vp8_sad4x4x3_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2ea9(%rip),%rax
mov    (%rax),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2e80(%rip),%rax
mov    (%rax),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x2,%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2e56(%rip),%rax
mov    (%rax),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_sad4x4x3_c>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %rdi,%rbp
mov    0x2eb7(%rip),%r13
mov    0x0(%r13),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,(%r14)
lea    0x1(%rbx),%rdx
mov    0x0(%r13),%r8d
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0x4(%r14)
add    $0x2,%rbx
mov    0x0(%r13),%r8d
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UINT_MAX = global i32 0
define void @vp8_sad4x4x3_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i32, i32* %9
%16 = load i32, i32* @UINT_MAX
%17 = call i32 @vp8_sad4x4_c(i8* %11, i32 %12, i8* %14, i32 %15, i32 %16)
%18 = load i32*, i32** %10
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 %17, i32* %19
%20 = load i8*, i8** %6
%21 = load i32, i32* %7
%22 = load i8*, i8** %8
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i32, i32* %9
%25 = load i32, i32* @UINT_MAX
%26 = call i32 @vp8_sad4x4_c(i8* %20, i32 %21, i8* %23, i32 %24, i32 %25)
%27 = load i32*, i32** %10
%28 = getelementptr inbounds i32, i32* %27, i64 1
store i32 %26, i32* %28
%29 = load i8*, i8** %6
%30 = load i32, i32* %7
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i64 2
%33 = load i32, i32* %9
%34 = load i32, i32* @UINT_MAX
%35 = call i32 @vp8_sad4x4_c(i8* %29, i32 %30, i8* %32, i32 %33, i32 %34)
%36 = load i32*, i32** %10
%37 = getelementptr inbounds i32, i32* %36, i64 2
store i32 %35, i32* %37
ret void
}

LLVM IR (-O2):
@UINT_MAX = global i32 0
define void @vp8_sad4x4x3_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* nocapture writeonly %4) {
%6 = load i32, i32* @UINT_MAX
%7 = tail call i32 @vp8_sad4x4_c(i8* %0, i32 %1, i8* %2, i32 %3, i32 %6)
store i32 %7, i32* %4
%8 = getelementptr inbounds i8, i8* %2, i64 1
%9 = load i32, i32* @UINT_MAX
%10 = tail call i32 @vp8_sad4x4_c(i8* %0, i32 %1, i8* %8, i32 %3, i32 %9)
%11 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %10, i32* %11
%12 = getelementptr inbounds i8, i8* %2, i64 2
%13 = load i32, i32* @UINT_MAX
%14 = tail call i32 @vp8_sad4x4_c(i8* %0, i32 %1, i8* %12, i32 %3, i32 %13)
%15 = getelementptr inbounds i32, i32* %4, i64 2
store i32 %14, i32* %15
ret void
}