#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 test2(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, 4, 4) == 4);
  printf("test2 done\n");
}


x86 assembly (clang, -O0):
<test2>:
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    $0x4,%edx
mov    %edx,%esi
call   1040 <blob_count@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
sub    $0x68,%rsp
mov    0xf26(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xf0b(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeef(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7f(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <blob_count@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.test2.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"test2 done\0A\00"
define void @test2() {
%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 4, i32 4)
%6 = icmp eq i32 %5, 4
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test2.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"test2 done\00"
define void @test2() {
%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 4, i32 4)
%5 = icmp eq i32 %4, 4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}