#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*/ filterv(int *, int, int *, int *, int, int);
void filterv2d(int *ker, int nker, int *in, int *out, int width, int height) {
  int x;
  for (x = 0; x < width; x++) {
    filterv(ker, nker, in + x, out + x, width, height);
  }
}


x86 assembly (clang, -O0):
<filterv2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1182 <filterv2d+0x72>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
call   1030 <filterv@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1136 <filterv2d+0x26>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filterv2d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,0x4(%rsp)
test   %r8d,%r8d
jle    1167 <filterv2d+0x57>
mov    %r9d,%r12d
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %esi,%r13d
mov    %rdi,%r15
mov    0x4(%rsp),%r14d
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r13d,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0x4(%rsp),%r8d
mov    %r12d,%r9d
call   1030 <filterv@plt>
add    $0x4,%rbx
add    $0x4,%rbp
add    $0xffffffffffffffff,%r14
jne    1140 <filterv2d+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @filterv2d(i32* %0, i32 %1, i32* %2, i32* %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %13
br label %14
14: ; preds = %32, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %11
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %35
18: ; preds = %14
%19 = load i32*, i32** %7
%20 = load i32, i32* %8
%21 = load i32*, i32** %9
%22 = load i32, i32* %13
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32*, i32** %10
%26 = load i32, i32* %13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %11
%30 = load i32, i32* %12
%31 = call i32 @filterv(i32* %19, i32 %20, i32* %24, i32* %28, i32 %29, i32 %30)
br label %32
32: ; preds = %18
%33 = load i32, i32* %13
%34 = add nsw i32 %33, 1
store i32 %34, i32* %13
br label %14
35: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @filterv2d(i32* %0, i32 %1, i32* %2, i32* %3, i32 %4, i32 %5) {
%7 = icmp sgt i32 %4, 0
br i1 %7, label %8, label %17
8: ; preds = %6
%9 = zext i32 %4 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %15, %10 ]
%12 = getelementptr inbounds i32, i32* %2, i64 %11
%13 = getelementptr inbounds i32, i32* %3, i64 %11
%14 = tail call i32 @filterv(i32* %0, i32 %1, i32* %12, i32* %13, i32 %4, i32 %5)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %6
ret void
}