#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*/ assert(int);
int blob_count(int **, int, int);
int /*<<< orphan*/ printf(char *);
void test1(void) {
  int grid[5][5] = {
      {1, 1, 0, 0, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 0, 1},
      {1, 0, 0, 0, 1}, {0, 1, 0, 1, 1},
  };
  assert(blob_count(grid, 1, 0) == 0);
  assert(blob_count(grid, 3, 3) == 0);
  assert(blob_count(grid, 5, 0) == 0);
  assert(blob_count(grid, -1, 0) == 0);
  assert(blob_count(grid, 0, 5) == 0);
  assert(blob_count(grid, 0, -1) == 0);
  assert(blob_count(grid, 1, 1) == 5);
  assert(blob_count(grid, 1, 1) == 0);
  printf("test1 done\n");
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x64,%edx
call   1060 <memcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
mov    $0x3,%edx
mov    %edx,%esi
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <blob_count@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x70(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <blob_count@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbx
sub    $0x70,%rsp
mov    0xf25(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xf0a(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xdea(%rip),%rdi
call   1030 <puts@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test1.grid = [5 x [5 x i32]] [[5 x i32] [i32 1, i32 1, i32 0, i32 0, i32 0], [5 x i32] [i32 0, i32 1, i32 1, i32 0, i32 0], [5 x i32] [i32 0, i32 0, i32 1, i32 0, i32 1], [5 x i32] [i32 1, i32 0, i32 0, i32 0, i32 1], [5 x i32] [i32 0, i32 1, i32 0, i32 1, i32 1]]
@.str = [12 x i8] c"test1 done\0A\00"
define void @test1() {
%1 = alloca [5 x [5 x i32]]
%2 = bitcast [5 x [5 x i32]]* %1 to i8*
%3 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%4 = bitcast [5 x i32]* %3 to i32**
%5 = call i32 @blob_count(i32** %4, i32 1, i32 0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%10 = bitcast [5 x i32]* %9 to i32**
%11 = call i32 @blob_count(i32** %10, i32 3, i32 3)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%16 = bitcast [5 x i32]* %15 to i32**
%17 = call i32 @blob_count(i32** %16, i32 5, i32 0)
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%22 = bitcast [5 x i32]* %21 to i32**
%23 = call i32 @blob_count(i32** %22, i32 -1, i32 0)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%28 = bitcast [5 x i32]* %27 to i32**
%29 = call i32 @blob_count(i32** %28, i32 0, i32 5)
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%34 = bitcast [5 x i32]* %33 to i32**
%35 = call i32 @blob_count(i32** %34, i32 0, i32 -1)
%36 = icmp eq i32 %35, 0
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%40 = bitcast [5 x i32]* %39 to i32**
%41 = call i32 @blob_count(i32** %40, i32 1, i32 1)
%42 = icmp eq i32 %41, 5
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0
%46 = bitcast [5 x i32]* %45 to i32**
%47 = call i32 @blob_count(i32** %46, i32 1, i32 1)
%48 = icmp eq i32 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test1.grid = [5 x [5 x i32]] [[5 x i32] [i32 1, i32 1, i32 0, i32 0, i32 0], [5 x i32] [i32 0, i32 1, i32 1, i32 0, i32 0], [5 x i32] [i32 0, i32 0, i32 1, i32 0, i32 1], [5 x i32] [i32 1, i32 0, i32 0, i32 0, i32 1], [5 x i32] [i32 0, i32 1, i32 0, i32 1, i32 1]]
@str = [11 x i8] c"test1 done\00"
define void @test1() {
%1 = alloca [5 x [5 x i32]]
%2 = bitcast [5 x [5 x i32]]* %1 to i8*
%3 = bitcast [5 x [5 x i32]]* %1 to i32**
%4 = call i32 @blob_count(i32** %3, i32 1, i32 0)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @blob_count(i32** %3, i32 3, i32 3)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32 @blob_count(i32** %3, i32 5, i32 0)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @blob_count(i32** %3, i32 -1, i32 0)
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = call i32 @blob_count(i32** %3, i32 0, i32 5)
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = call i32 @blob_count(i32** %3, i32 0, i32 -1)
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i32 @blob_count(i32** %3, i32 1, i32 1)
%29 = icmp eq i32 %28, 5
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call i32 @blob_count(i32** %3, i32 1, i32 1)
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}