#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);
scalar_t__ malloc(int);
int searchMatrix(int **, int, int, int);
int main(int argc, char **argv) {
  int **matrix = (int **)malloc(sizeof(int *) * 5);
  int m0[] = {1, 4, 7, 11, 15};
  int m1[] = {2, 5, 8, 12, 19};
  int m2[] = {3, 6, 9, 16, 22};
  int m3[] = {10, 13, 14, 17, 24};
  int m4[] = {18, 21, 23, 26, 30};
  matrix[0] = m0;
  matrix[1] = m1;
  matrix[2] = m2;
  matrix[3] = m3;
  matrix[4] = m4;
  assert(searchMatrix(matrix, 5, 5, 5));
  assert(!searchMatrix(matrix, 5, 5, 20));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x28,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe9d(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe9e(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe9f(%rip),%eax
mov    %eax,-0x60(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x88(%rbp)
mov    0xe9a(%rip),%eax
mov    %eax,-0x80(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    0xe95(%rip),%eax
mov    %eax,-0xa0(%rbp)
lea    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x50(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
lea    -0x70(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
lea    -0x90(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x18(%rax)
lea    -0xb0(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x18(%rbp),%rdi
mov    $0x5,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <searchMatrix@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    $0x5,%edx
mov    $0x14,%ecx
mov    %edx,%esi
call   1030 <searchMatrix@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xa0,%rsp
mov    $0x28,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    0xec5(%rip),%eax
mov    %eax,0x90(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
mov    0xec9(%rip),%eax
mov    %eax,0x70(%rsp)
movaps 0xeae(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
mov    0xed3(%rip),%eax
mov    %eax,0x50(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    0xedd(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xee7(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x80(%rsp),%rax
mov    %rax,(%rbx)
lea    0x60(%rsp),%rax
mov    %rax,0x8(%rbx)
lea    0x40(%rsp),%rax
mov    %rax,0x10(%rbx)
lea    0x20(%rsp),%rax
mov    %rax,0x18(%rbx)
mov    %rsp,%rax
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x5,%ecx
call   1030 <searchMatrix@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x14,%ecx
call   1030 <searchMatrix@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.m0 = [5 x i32] [i32 1, i32 4, i32 7, i32 11, i32 15]
@__const.main.m1 = [5 x i32] [i32 2, i32 5, i32 8, i32 12, i32 19]
@__const.main.m2 = [5 x i32] [i32 3, i32 6, i32 9, i32 16, i32 22]
@__const.main.m3 = [5 x i32] [i32 10, i32 13, i32 14, i32 17, i32 24]
@__const.main.m4 = [5 x i32] [i32 18, i32 21, i32 23, i32 26, i32 30]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32**
%7 = alloca [5 x i32]
%8 = alloca [5 x i32]
%9 = alloca [5 x i32]
%10 = alloca [5 x i32]
%11 = alloca [5 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i64 @malloc(i32 40)
%13 = inttoptr i64 %12 to i32**
store i32** %13, i32*** %6
%14 = bitcast [5 x i32]* %7 to i8*
%15 = bitcast [5 x i32]* %8 to i8*
%16 = bitcast [5 x i32]* %9 to i8*
%17 = bitcast [5 x i32]* %10 to i8*
%18 = bitcast [5 x i32]* %11 to i8*
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%20 = load i32**, i32*** %6
%21 = getelementptr inbounds i32*, i32** %20, i64 0
store i32* %19, i32** %21
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 0
%23 = load i32**, i32*** %6
%24 = getelementptr inbounds i32*, i32** %23, i64 1
store i32* %22, i32** %24
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
%26 = load i32**, i32*** %6
%27 = getelementptr inbounds i32*, i32** %26, i64 2
store i32* %25, i32** %27
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%29 = load i32**, i32*** %6
%30 = getelementptr inbounds i32*, i32** %29, i64 3
store i32* %28, i32** %30
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 0
%32 = load i32**, i32*** %6
%33 = getelementptr inbounds i32*, i32** %32, i64 4
store i32* %31, i32** %33
%34 = load i32**, i32*** %6
%35 = call i32 @searchMatrix(i32** %34, i32 5, i32 5, i32 5)
%36 = call i32 @assert(i32 %35)
%37 = load i32**, i32*** %6
%38 = call i32 @searchMatrix(i32** %37, i32 5, i32 5, i32 20)
%39 = icmp ne i32 %38, 0
%40 = xor i1 %39, true
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
ret i32 0
}

LLVM IR (-O2):
@__const.main.m0 = [5 x i32] [i32 1, i32 4, i32 7, i32 11, i32 15]
@__const.main.m1 = [5 x i32] [i32 2, i32 5, i32 8, i32 12, i32 19]
@__const.main.m2 = [5 x i32] [i32 3, i32 6, i32 9, i32 16, i32 22]
@__const.main.m3 = [5 x i32] [i32 10, i32 13, i32 14, i32 17, i32 24]
@__const.main.m4 = [5 x i32] [i32 18, i32 21, i32 23, i32 26, i32 30]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = alloca [5 x i32]
%5 = alloca [5 x i32]
%6 = alloca [5 x i32]
%7 = alloca [5 x i32]
%8 = tail call i64 @malloc(i32 40)
%9 = inttoptr i64 %8 to i32**
%10 = bitcast [5 x i32]* %3 to i8*
%11 = bitcast [5 x i32]* %4 to i8*
%12 = bitcast [5 x i32]* %5 to i8*
%13 = bitcast [5 x i32]* %6 to i8*
%14 = bitcast [5 x i32]* %7 to i8*
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
store i32* %15, i32** %9
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%17 = getelementptr inbounds i32*, i32** %9, i64 1
store i32* %16, i32** %17
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%19 = getelementptr inbounds i32*, i32** %9, i64 2
store i32* %18, i32** %19
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%21 = getelementptr inbounds i32*, i32** %9, i64 3
store i32* %20, i32** %21
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%23 = getelementptr inbounds i32*, i32** %9, i64 4
store i32* %22, i32** %23
%24 = call i32 @searchMatrix(i32** %9, i32 5, i32 5, i32 5)
%25 = call i32 @assert(i32 %24)
%26 = call i32 @searchMatrix(i32** %9, i32 5, i32 5, i32 20)
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
ret i32 0
}