#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*/ filter_block2d_first_pass(unsigned char *, int *,
                                             unsigned int, int, int, int,
                                             short const *);
int /*<<< orphan*/ filter_block2d_second_pass(int *, unsigned char *, int, int,
                                              int, int, int, short const *);
void filter_block2d(unsigned char *src_ptr, unsigned char *output_ptr,
                    unsigned int src_pixels_per_line, int output_pitch,
                    const short *HFilter, const short *VFilter) {
  int FData[9 * 4];
  filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData,
                            src_pixels_per_line, 1, 9, 4, HFilter);
  filter_block2d_second_pass(FData + 8, output_ptr, output_pitch, 4, 4, 4, 4,
                             VFilter);
}


x86 assembly (clang, -O0):
<filter_block2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    %rcx,%rax
add    %rax,%rdi
lea    -0xc0(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    $0x1,%ecx
mov    $0x9,%r8d
mov    $0x4,%r9d
mov    %rax,(%rsp)
call   1040 <filter_block2d_first_pass@plt>
lea    -0xc0(%rbp),%rdi
add    $0x20,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%rax
mov    $0x4,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x4,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <filter_block2d_second_pass@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_block2d>:
push   %rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %r9,%r14
mov    %r8,%rax
mov    %ecx,%ebp
mov    %rsi,%rbx
lea    (%rdx,%rdx,1),%ecx
sub    %rcx,%rdi
sub    $0x8,%rsp
lea    0x8(%rsp),%rsi
mov    $0x1,%ecx
mov    $0x9,%r8d
mov    $0x4,%r9d
push   %rax
call   1040 <filter_block2d_first_pass@plt>
add    $0x10,%rsp
lea    0x20(%rsp),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    $0x4,%ecx
mov    $0x4,%r8d
mov    $0x4,%r9d
push   %r14
push   $0x4
call   1030 <filter_block2d_second_pass@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @filter_block2d(i8* %0, i8* %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i16*
%12 = alloca i16*
%13 = alloca [36 x i32]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i16* %4, i16** %11
store i16* %5, i16** %12
%14 = load i8*, i8** %7
%15 = load i32, i32* %9
%16 = mul i32 2, %15
%17 = zext i32 %16 to i64
%18 = sub i64 0, %17
%19 = getelementptr inbounds i8, i8* %14, i64 %18
%20 = getelementptr inbounds [36 x i32], [36 x i32]* %13, i64 0, i64 0
%21 = load i32, i32* %9
%22 = load i16*, i16** %11
%23 = call i32 @filter_block2d_first_pass(i8* %19, i32* %20, i32 %21, i32 1, i32 9, i32 4, i16* %22)
%24 = getelementptr inbounds [36 x i32], [36 x i32]* %13, i64 0, i64 0
%25 = getelementptr inbounds i32, i32* %24, i64 8
%26 = load i8*, i8** %8
%27 = load i32, i32* %10
%28 = load i16*, i16** %12
%29 = call i32 @filter_block2d_second_pass(i32* %25, i8* %26, i32 %27, i32 4, i32 4, i32 4, i32 4, i16* %28)
ret void
}

LLVM IR (-O2):
define void @filter_block2d(i8* %0, i8* %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca [36 x i32]
%8 = bitcast [36 x i32]* %7 to i8*
%9 = shl i32 %2, 1
%10 = zext i32 %9 to i64
%11 = sub nsw i64 0, %10
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = getelementptr inbounds [36 x i32], [36 x i32]* %7, i64 0, i64 0
%14 = call i32 @filter_block2d_first_pass(i8* %12, i32* %13, i32 %2, i32 1, i32 9, i32 4, i16* %4)
%15 = getelementptr inbounds [36 x i32], [36 x i32]* %7, i64 0, i64 8
%16 = call i32 @filter_block2d_second_pass(i32* %15, i8* %1, i32 %3, i32 4, i32 4, i32 4, i32 4, i16* %5)
ret void
}