#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_sad8x8_c(unsigned char const *, int, unsigned char const *,
                          int, int);
void vp8_sad8x8x3_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_sad8x8_c(src_ptr, src_stride, ref_ptr, ref_stride, 0x7fffffff);
  sad_array[1] =
      vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 1, ref_stride, 0x7fffffff);
  sad_array[2] =
      vp8_sad8x8_c(src_ptr, src_stride, ref_ptr + 2, ref_stride, 0x7fffffff);
}


x86 assembly (clang, -O0):
<vp8_sad8x8x3_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    $0x7fffffff,%r8d
call   1030 <vp8_sad8x8_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    $0x7fffffff,%r8d
call   1030 <vp8_sad8x8_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    $0x7fffffff,%r8d
call   1030 <vp8_sad8x8_c@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_sad8x8x3_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    $0x7fffffff,%r8d
call   1030 <vp8_sad8x8_c@plt>
mov    %eax,(%r14)
lea    0x1(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad8x8_c@plt>
mov    %eax,0x4(%r14)
add    $0x2,%rbx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad8x8_c@plt>
mov    %eax,0x8(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vp8_sad8x8x3_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 = load i32, i32* %9
%15 = call i32 @vp8_sad8x8_c(i8* %11, i32 %12, i8* %13, i32 %14, i32 2147483647)
%16 = load i32*, i32** %10
%17 = getelementptr inbounds i32, i32* %16, i64 0
store i32 %15, i32* %17
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = load i8*, i8** %8
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i32, i32* %9
%23 = call i32 @vp8_sad8x8_c(i8* %18, i32 %19, i8* %21, i32 %22, i32 2147483647)
%24 = load i32*, i32** %10
%25 = getelementptr inbounds i32, i32* %24, i64 1
store i32 %23, i32* %25
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = load i8*, i8** %8
%29 = getelementptr inbounds i8, i8* %28, i64 2
%30 = load i32, i32* %9
%31 = call i32 @vp8_sad8x8_c(i8* %26, i32 %27, i8* %29, i32 %30, i32 2147483647)
%32 = load i32*, i32** %10
%33 = getelementptr inbounds i32, i32* %32, i64 2
store i32 %31, i32* %33
ret void
}

LLVM IR (-O2):
define void @vp8_sad8x8x3_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* nocapture writeonly %4) {
%6 = tail call i32 @vp8_sad8x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i32 2147483647)
store i32 %6, i32* %4
%7 = getelementptr inbounds i8, i8* %2, i64 1
%8 = tail call i32 @vp8_sad8x8_c(i8* %0, i32 %1, i8* %7, i32 %3, i32 2147483647)
%9 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %8, i32* %9
%10 = getelementptr inbounds i8, i8* %2, i64 2
%11 = tail call i32 @vp8_sad8x8_c(i8* %0, i32 %1, i8* %10, i32 %3, i32 2147483647)
%12 = getelementptr inbounds i32, i32* %4, i64 2
store i32 %11, i32* %12
ret void
}