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


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    $0x7fffffff,%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    $0x7fffffff,%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    $0x7fffffff,%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    $0x7fffffff,%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   %r12
push   %rbx
mov    %r8,%r14
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %rdi,%rbp
mov    (%rdx),%rdx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,(%r14)
mov    0x8(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0x4(%r14)
mov    0x10(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0x8(%r14)
mov    0x18(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad4x4_c@plt>
mov    %eax,0xc(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
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 = call i32 @vp8_sad4x4_c(i8* %11, i32 %12, i8* %15, i32 %16, i32 2147483647)
%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 i8*, i8** %23
%25 = load i32, i32* %9
%26 = call i32 @vp8_sad4x4_c(i8* %20, i32 %21, i8* %24, i32 %25, i32 2147483647)
%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 i8*, i8** %32
%34 = load i32, i32* %9
%35 = call i32 @vp8_sad4x4_c(i8* %29, i32 %30, i8* %33, i32 %34, i32 2147483647)
%36 = load i32*, i32** %10
%37 = getelementptr inbounds i32, i32* %36, i64 2
store i32 %35, i32* %37
%38 = load i8*, i8** %6
%39 = load i32, i32* %7
%40 = load i8**, i8*** %8
%41 = getelementptr inbounds i8*, i8** %40, i64 3
%42 = load i8*, i8** %41
%43 = load i32, i32* %9
%44 = call i32 @vp8_sad4x4_c(i8* %38, i32 %39, i8* %42, i32 %43, i32 2147483647)
%45 = load i32*, i32** %10
%46 = getelementptr inbounds i32, i32* %45, i64 3
store i32 %44, i32* %46
ret void
}

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