#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 */
scalar_t__ vp8_sad16x8_c(unsigned char const *, int, unsigned char const *, int,
                         int);
void vp8_sad16x8x8_c(const unsigned char *src_ptr, int src_stride,
                     const unsigned char *ref_ptr, int ref_stride,
                     unsigned short *sad_array) {
  sad_array[0] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr,
                                               ref_stride, 0x7fffffff);
  sad_array[1] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 1,
                                               ref_stride, 0x7fffffff);
  sad_array[2] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 2,
                                               ref_stride, 0x7fffffff);
  sad_array[3] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 3,
                                               ref_stride, 0x7fffffff);
  sad_array[4] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 4,
                                               ref_stride, 0x7fffffff);
  sad_array[5] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 5,
                                               ref_stride, 0x7fffffff);
  sad_array[6] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 6,
                                               ref_stride, 0x7fffffff);
  sad_array[7] = (unsigned short)vp8_sad16x8_c(src_ptr, src_stride, ref_ptr + 7,
                                               ref_stride, 0x7fffffff);
}


x86 assembly (clang, -O0):
<vp8_sad16x8x8_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_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,(%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_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0x2(%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_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0x4(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x3,%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0x6(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x4,%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0x8(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x5,%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0xa(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x6,%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0xc(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
add    $0x7,%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,%cx
mov    -0x28(%rbp),%rax
mov    %cx,0xe(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_sad16x8x8_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_sad16x8_c@plt>
mov    %ax,(%r14)
lea    0x1(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0x2(%r14)
lea    0x2(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0x4(%r14)
lea    0x3(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0x6(%r14)
lea    0x4(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0x8(%r14)
lea    0x5(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0xa(%r14)
lea    0x6(%rbx),%rdx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0xc(%r14)
add    $0x7,%rbx
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    $0x7fffffff,%r8d
call   1030 <vp8_sad16x8_c@plt>
mov    %ax,0xe(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vp8_sad16x8x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i16* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i16*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i16* %4, i16** %10
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i8*, i8** %8
%14 = load i32, i32* %9
%15 = call i64 @vp8_sad16x8_c(i8* %11, i32 %12, i8* %13, i32 %14, i32 2147483647)
%16 = trunc i64 %15 to i16
%17 = load i16*, i16** %10
%18 = getelementptr inbounds i16, i16* %17, i64 0
store i16 %16, i16* %18
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = load i8*, i8** %8
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i32, i32* %9
%24 = call i64 @vp8_sad16x8_c(i8* %19, i32 %20, i8* %22, i32 %23, i32 2147483647)
%25 = trunc i64 %24 to i16
%26 = load i16*, i16** %10
%27 = getelementptr inbounds i16, i16* %26, i64 1
store i16 %25, i16* %27
%28 = load i8*, i8** %6
%29 = load i32, i32* %7
%30 = load i8*, i8** %8
%31 = getelementptr inbounds i8, i8* %30, i64 2
%32 = load i32, i32* %9
%33 = call i64 @vp8_sad16x8_c(i8* %28, i32 %29, i8* %31, i32 %32, i32 2147483647)
%34 = trunc i64 %33 to i16
%35 = load i16*, i16** %10
%36 = getelementptr inbounds i16, i16* %35, i64 2
store i16 %34, i16* %36
%37 = load i8*, i8** %6
%38 = load i32, i32* %7
%39 = load i8*, i8** %8
%40 = getelementptr inbounds i8, i8* %39, i64 3
%41 = load i32, i32* %9
%42 = call i64 @vp8_sad16x8_c(i8* %37, i32 %38, i8* %40, i32 %41, i32 2147483647)
%43 = trunc i64 %42 to i16
%44 = load i16*, i16** %10
%45 = getelementptr inbounds i16, i16* %44, i64 3
store i16 %43, i16* %45
%46 = load i8*, i8** %6
%47 = load i32, i32* %7
%48 = load i8*, i8** %8
%49 = getelementptr inbounds i8, i8* %48, i64 4
%50 = load i32, i32* %9
%51 = call i64 @vp8_sad16x8_c(i8* %46, i32 %47, i8* %49, i32 %50, i32 2147483647)
%52 = trunc i64 %51 to i16
%53 = load i16*, i16** %10
%54 = getelementptr inbounds i16, i16* %53, i64 4
store i16 %52, i16* %54
%55 = load i8*, i8** %6
%56 = load i32, i32* %7
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i64 5
%59 = load i32, i32* %9
%60 = call i64 @vp8_sad16x8_c(i8* %55, i32 %56, i8* %58, i32 %59, i32 2147483647)
%61 = trunc i64 %60 to i16
%62 = load i16*, i16** %10
%63 = getelementptr inbounds i16, i16* %62, i64 5
store i16 %61, i16* %63
%64 = load i8*, i8** %6
%65 = load i32, i32* %7
%66 = load i8*, i8** %8
%67 = getelementptr inbounds i8, i8* %66, i64 6
%68 = load i32, i32* %9
%69 = call i64 @vp8_sad16x8_c(i8* %64, i32 %65, i8* %67, i32 %68, i32 2147483647)
%70 = trunc i64 %69 to i16
%71 = load i16*, i16** %10
%72 = getelementptr inbounds i16, i16* %71, i64 6
store i16 %70, i16* %72
%73 = load i8*, i8** %6
%74 = load i32, i32* %7
%75 = load i8*, i8** %8
%76 = getelementptr inbounds i8, i8* %75, i64 7
%77 = load i32, i32* %9
%78 = call i64 @vp8_sad16x8_c(i8* %73, i32 %74, i8* %76, i32 %77, i32 2147483647)
%79 = trunc i64 %78 to i16
%80 = load i16*, i16** %10
%81 = getelementptr inbounds i16, i16* %80, i64 7
store i16 %79, i16* %81
ret void
}

LLVM IR (-O2):
define void @vp8_sad16x8x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i16* nocapture writeonly %4) {
%6 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i32 2147483647)
%7 = trunc i64 %6 to i16
store i16 %7, i16* %4
%8 = getelementptr inbounds i8, i8* %2, i64 1
%9 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %8, i32 %3, i32 2147483647)
%10 = trunc i64 %9 to i16
%11 = getelementptr inbounds i16, i16* %4, i64 1
store i16 %10, i16* %11
%12 = getelementptr inbounds i8, i8* %2, i64 2
%13 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %12, i32 %3, i32 2147483647)
%14 = trunc i64 %13 to i16
%15 = getelementptr inbounds i16, i16* %4, i64 2
store i16 %14, i16* %15
%16 = getelementptr inbounds i8, i8* %2, i64 3
%17 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %16, i32 %3, i32 2147483647)
%18 = trunc i64 %17 to i16
%19 = getelementptr inbounds i16, i16* %4, i64 3
store i16 %18, i16* %19
%20 = getelementptr inbounds i8, i8* %2, i64 4
%21 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %20, i32 %3, i32 2147483647)
%22 = trunc i64 %21 to i16
%23 = getelementptr inbounds i16, i16* %4, i64 4
store i16 %22, i16* %23
%24 = getelementptr inbounds i8, i8* %2, i64 5
%25 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %24, i32 %3, i32 2147483647)
%26 = trunc i64 %25 to i16
%27 = getelementptr inbounds i16, i16* %4, i64 5
store i16 %26, i16* %27
%28 = getelementptr inbounds i8, i8* %2, i64 6
%29 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %28, i32 %3, i32 2147483647)
%30 = trunc i64 %29 to i16
%31 = getelementptr inbounds i16, i16* %4, i64 6
store i16 %30, i16* %31
%32 = getelementptr inbounds i8, i8* %2, i64 7
%33 = tail call i64 @vp8_sad16x8_c(i8* %0, i32 %1, i8* %32, i32 %3, i32 2147483647)
%34 = trunc i64 %33 to i16
%35 = getelementptr inbounds i16, i16* %4, i64 7
store i16 %34, i16* %35
ret void
}