#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 *const, int, int /*<<< orphan*/);
void vp8_sad4x4x4d_c(const unsigned char *src_ptr, int src_stride,
                     const unsigned char *const 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);
  sad_array[3] =
      vp8_sad4x4_c(src_ptr, src_stride, ref_ptr[3], ref_stride, UINT_MAX);
}


x86 assembly (clang, -O0):
<vp8_sad4x4x4d_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),%rax
mov    (%rax),%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2ea6(%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),%rax
mov    0x8(%rax),%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2e7d(%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),%rax
mov    0x10(%rax),%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2e53(%rip),%rax
mov    (%rax),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x1c(%rbp),%ecx
mov    0x2e29(%rip),%rax
mov    (%rax),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0xc(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_sad4x4x4d_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    (%rdx),%rdx
mov    0x2eb4(%rip),%r13
mov    0x0(%r13),%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,(%r14)
mov    0x8(%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)
mov    0x10(%rbx),%rdx
mov    0x0(%r13),%r8d
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0x8(%r14)
mov    0x18(%rbx),%rdx
mov    0x0(%r13),%r8d
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0xc(%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_sad4x4x4d_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 i8*, i8** %14
%16 = load i32, i32* %9
%17 = load i32, i32* @UINT_MAX
%18 = call i32 @vp8_sad4x4_c(i8* %11, i32 %12, i8* %15, i32 %16, i32 %17)
%19 = load i32*, i32** %10
%20 = getelementptr inbounds i32, i32* %19, i64 0
store i32 %18, i32* %20
%21 = load i8*, i8** %6
%22 = load i32, i32* %7
%23 = load i8**, i8*** %8
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i32, i32* %9
%27 = load i32, i32* @UINT_MAX
%28 = call i32 @vp8_sad4x4_c(i8* %21, i32 %22, i8* %25, i32 %26, i32 %27)
%29 = load i32*, i32** %10
%30 = getelementptr inbounds i32, i32* %29, i64 1
store i32 %28, i32* %30
%31 = load i8*, i8** %6
%32 = load i32, i32* %7
%33 = load i8**, i8*** %8
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = load i32, i32* %9
%37 = load i32, i32* @UINT_MAX
%38 = call i32 @vp8_sad4x4_c(i8* %31, i32 %32, i8* %35, i32 %36, i32 %37)
%39 = load i32*, i32** %10
%40 = getelementptr inbounds i32, i32* %39, i64 2
store i32 %38, i32* %40
%41 = load i8*, i8** %6
%42 = load i32, i32* %7
%43 = load i8**, i8*** %8
%44 = getelementptr inbounds i8*, i8** %43, i64 3
%45 = load i8*, i8** %44
%46 = load i32, i32* %9
%47 = load i32, i32* @UINT_MAX
%48 = call i32 @vp8_sad4x4_c(i8* %41, i32 %42, i8* %45, i32 %46, i32 %47)
%49 = load i32*, i32** %10
%50 = getelementptr inbounds i32, i32* %49, i64 3
store i32 %48, i32* %50
ret void
}

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