#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*/ memset(int *, int /*<<< orphan*/, int);
int ercCollectColumnBlocks(int predBlocks[], int currRow, int currColumn,
                           int *condition, int maxRow, int maxColumn,
                           int step) {
  int srcCounter = 0, threshold = 1;
  memset(predBlocks, 0, 8 * sizeof(int));
  if (condition[(currRow - 1) * maxColumn + currColumn] > threshold) {
    predBlocks[4] = 1;
    srcCounter++;
  }
  if (condition[(currRow + step) * maxColumn + currColumn] > threshold) {
    predBlocks[6] = 1;
    srcCounter++;
  }
  return srcCounter;
}


x86 assembly (clang, -O0):
<ercCollectColumnBlocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
imul   -0x20(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jle    1183 <ercCollectColumnBlocks+0x73>
mov    -0x8(%rbp),%rax
movl   $0x1,0x10(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    0x10(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jle    11b7 <ercCollectColumnBlocks+0xa7>
mov    -0x8(%rbp),%rax
movl   $0x1,0x18(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ercCollectColumnBlocks>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r12d
mov    %rcx,%r15
mov    %edx,%r13d
mov    %esi,%ebp
mov    0x40(%rsp),%r14d
xor    %ebx,%ebx
mov    %rdi,(%rsp)
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
lea    -0x1(%rbp),%eax
imul   %r12d,%eax
add    %r13d,%eax
cltq
cmpl   $0x2,(%r15,%rax,4)
jl     1160 <ercCollectColumnBlocks+0x50>
mov    (%rsp),%rax
movl   $0x1,0x10(%rax)
mov    $0x1,%ebx
add    %ebp,%r14d
imul   %r12d,%r14d
add    %r13d,%r14d
movslq %r14d,%rax
cmpl   $0x2,(%r15,%rax,4)
jl     1182 <ercCollectColumnBlocks+0x72>
mov    (%rsp),%rax
movl   $0x1,0x18(%rax)
add    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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