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


x86 assembly (clang, -O0):
<filterh2d>:
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    -0x28(%rbp),%eax
jge    1188 <filterh2d+0x78>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%eax
imul   -0x2c(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%eax
imul   -0x2c(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rcx
mov    -0x24(%rbp),%r8d
call   1030 <filterh@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1136 <filterh2d+0x26>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filterh2d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,0x4(%rsp)
test   %r9d,%r9d
jle    1162 <filterh2d+0x52>
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %esi,%r15d
mov    %rdi,%r12
movslq 0x4(%rsp),%r13
mov    %r9d,%r14d
shl    $0x2,%r13
nopl   (%rax)
mov    %r12,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    0x4(%rsp),%r8d
call   1030 <filterh@plt>
add    %r13,%rbp
add    %r13,%rbx
add    $0xffffffffffffffff,%r14
jne    1140 <filterh2d+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @filterh2d(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 = %35, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %12
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %38
18: ; preds = %14
%19 = load i32*, i32** %7
%20 = load i32, i32* %8
%21 = load i32*, i32** %9
%22 = load i32, i32* %11
%23 = load i32, i32* %13
%24 = mul nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %21, i64 %25
%27 = load i32*, i32** %10
%28 = load i32, i32* %11
%29 = load i32, i32* %13
%30 = mul nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %27, i64 %31
%33 = load i32, i32* %11
%34 = call i32 @filterh(i32* %19, i32 %20, i32* %26, i32* %32, i32 %33)
br label %35
35: ; preds = %18
%36 = load i32, i32* %13
%37 = add nsw i32 %36, 1
store i32 %37, i32* %13
br label %14
38: ; preds = %14
ret void
}

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