#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*/ vp8_simple_filter(char, unsigned char *, unsigned char *,
                                     unsigned char *, unsigned char *);
char vp8_simple_filter_mask(unsigned char const, unsigned char, unsigned char,
                            unsigned char, unsigned char);
void vp8_loop_filter_simple_horizontal_edge_simd(unsigned char *s, int p,
                                                 const unsigned char *blimit) {
  signed char mask = 0;
  int i = 0;
  do {
    mask = vp8_simple_filter_mask(blimit[0], s[-2 * p], s[-1 * p], s[0 * p],
                                  s[1 * p]);
    vp8_simple_filter(mask, s - 2 * p, s - 1 * p, s, s + 1 * p);
    ++s;
  } while (++i < 16);
}


x86 assembly (clang, -O0):
<vp8_loop_filter_simple_horizontal_edge_simd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%dil
mov    -0x8(%rbp),%rax
imul   $0xfffffffe,-0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%sil
mov    -0x8(%rbp),%rax
imul   $0xffffffff,-0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
imul   $0x0,-0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%r8d
shl    $0x0,%r8d
movslq %r8d,%r8
movzbl %dil,%edi
movzbl %sil,%esi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1030 <vp8_simple_filter_mask@plt>
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
shl    $0x0,%ecx
movslq %ecx,%rdi
xor    %ecx,%ecx
sub    %rdi,%rcx
add    %rcx,%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0xc(%rbp),%edi
shl    $0x0,%edi
movslq %edi,%rdi
add    %rdi,%r8
movsbl %al,%edi
call   1040 <vp8_simple_filter@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmp    $0x10,%eax
jl     113e <vp8_loop_filter_simple_horizontal_edge_simd+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_loop_filter_simple_horizontal_edge_simd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
mov    %rdi,%rbx
movslq %esi,%rbp
mov    %rbp,%rax
add    %rbp,%rax
neg    %rax
mov    %rax,0x8(%rsp)
lea    0x0(%rbp,%rbp,1),%eax
cltq
neg    %rax
mov    %rax,(%rsp)
mov    %rbp,%r13
neg    %r13
mov    $0x10,%r14d
mov    0x10(%rsp),%rax
movzbl (%rax),%edi
mov    0x8(%rsp),%rax
movzbl (%rbx,%rax,1),%esi
lea    (%rbx,%r13,1),%r15
movzbl (%rbx,%r13,1),%edx
movzbl (%rbx),%ecx
lea    (%rbx,%rbp,1),%r12
movzbl (%rbx,%rbp,1),%r8d
call   1030 <vp8_simple_filter_mask@plt>
mov    (%rsp),%rcx
lea    (%rbx,%rcx,1),%rsi
movsbl %al,%edi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %r12,%r8
call   1040 <vp8_simple_filter@plt>
add    $0x1,%rbx
add    $0xffffffff,%r14d
jne    1160 <vp8_loop_filter_simple_horizontal_edge_simd+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vp8_loop_filter_simple_horizontal_edge_simd(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i8 0, i8* %7
store i32 0, i32* %8
br label %9
9: ; preds = %60, %3
%10 = load i8*, i8** %6
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = mul nsw i32 -2, %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = mul nsw i32 -1, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = load i8*, i8** %4
%26 = load i32, i32* %5
%27 = mul nsw i32 0, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %25, i64 %28
%30 = load i8, i8* %29
%31 = load i8*, i8** %4
%32 = load i32, i32* %5
%33 = mul nsw i32 1, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = call signext i8 @vp8_simple_filter_mask(i8 zeroext %12, i8 zeroext %18, i8 zeroext %24, i8 zeroext %30, i8 zeroext %36)
store i8 %37, i8* %7
%38 = load i8, i8* %7
%39 = load i8*, i8** %4
%40 = load i32, i32* %5
%41 = mul nsw i32 2, %40
%42 = sext i32 %41 to i64
%43 = sub i64 0, %42
%44 = getelementptr inbounds i8, i8* %39, i64 %43
%45 = load i8*, i8** %4
%46 = load i32, i32* %5
%47 = mul nsw i32 1, %46
%48 = sext i32 %47 to i64
%49 = sub i64 0, %48
%50 = getelementptr inbounds i8, i8* %45, i64 %49
%51 = load i8*, i8** %4
%52 = load i8*, i8** %4
%53 = load i32, i32* %5
%54 = mul nsw i32 1, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %52, i64 %55
%57 = call i32 @vp8_simple_filter(i8 signext %38, i8* %44, i8* %50, i8* %51, i8* %56)
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %4
br label %60
60: ; preds = %9
%61 = load i32, i32* %8
%62 = add nsw i32 %61, 1
store i32 %62, i32* %8
%63 = icmp slt i32 %62, 16
br i1 %63, label %9, label %64
64: ; preds = %60
ret void
}

LLVM IR (-O2):
define void @vp8_loop_filter_simple_horizontal_edge_simd(i8* %0, i32 %1, i8* nocapture %2) {
%4 = mul nsw i32 %1, -2
%5 = sext i32 %4 to i64
%6 = sub nsw i32 0, %1
%7 = sext i32 %6 to i64
%8 = sext i32 %1 to i64
%9 = shl nsw i32 %1, 1
%10 = sext i32 %9 to i64
%11 = sub nsw i64 0, %10
%12 = sub nsw i64 0, %8
br label %13
13: ; preds = %13, %3
%14 = phi i8* [ %0, %3 ], [ %28, %13 ]
%15 = phi i32 [ 0, %3 ], [ %29, %13 ]
%16 = load i8, i8* %2
%17 = getelementptr inbounds i8, i8* %14, i64 %5
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %14, i64 %7
%20 = load i8, i8* %19
%21 = load i8, i8* %14
%22 = getelementptr inbounds i8, i8* %14, i64 %8
%23 = load i8, i8* %22
%24 = tail call signext i8 @vp8_simple_filter_mask(i8 zeroext %16, i8 zeroext %18, i8 zeroext %20, i8 zeroext %21, i8 zeroext %23)
%25 = getelementptr inbounds i8, i8* %14, i64 %11
%26 = getelementptr inbounds i8, i8* %14, i64 %12
%27 = tail call i32 @vp8_simple_filter(i8 signext %24, i8* %25, i8* %26, i8* %14, i8* %22)
%28 = getelementptr inbounds i8, i8* %14, i64 1
%29 = add nuw nsw i32 %15, 1
%30 = icmp eq i32 %29, 16
br i1 %30, label %31, label %13
31: ; preds = %13
ret void
}