#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*/ printf(char *, int);
int searchMatrix(int **, int, int, int);
int main(void) {
  int r0[] = {1, 4, 7, 11, 15};
  int r1[] = {2, 5, 8, 12, 19};
  int r2[] = {3, 6, 9, 16, 22};
  int r3[] = {10, 13, 14, 17, 24};
  int r4[] = {18, 21, 23, 26, 30};
  int *m[] = {r0, r1, r2, r3, r4};
  printf("%d\n", searchMatrix(m, 5, 5, 20));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec3(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x50(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x70(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x90(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0xd0(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0xc8(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xc0(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0xb0(%rbp)
lea    -0xd0(%rbp),%rdi
mov    $0x5,%edx
mov    $0x14,%ecx
mov    %edx,%esi
call   1040 <searchMatrix@plt>
mov    %eax,%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xc8,%rsp
mov    0xee3(%rip),%eax
mov    %eax,0xc0(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
mov    0xee7(%rip),%eax
mov    %eax,0xa0(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
mov    0xeeb(%rip),%eax
mov    %eax,0x80(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
mov    0xef2(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
mov    0xefc(%rip),%eax
mov    %eax,0x40(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0xb0(%rsp),%rax
mov    %rax,(%rsp)
lea    0x90(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0x70(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x50(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x30(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x14,%ecx
call   1040 <searchMatrix@plt>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
ret

LLVM IR (-O0):
@__const.main.r0 = [5 x i32] [i32 1, i32 4, i32 7, i32 11, i32 15]
@__const.main.r1 = [5 x i32] [i32 2, i32 5, i32 8, i32 12, i32 19]
@__const.main.r2 = [5 x i32] [i32 3, i32 6, i32 9, i32 16, i32 22]
@__const.main.r3 = [5 x i32] [i32 10, i32 13, i32 14, i32 17, i32 24]
@__const.main.r4 = [5 x i32] [i32 18, i32 21, i32 23, i32 26, i32 30]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%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*]
store i32 0, i32* %1
%8 = bitcast [5 x i32]* %2 to i8*
%9 = bitcast [5 x i32]* %3 to i8*
%10 = bitcast [5 x i32]* %4 to i8*
%11 = bitcast [5 x i32]* %5 to i8*
%12 = bitcast [5 x i32]* %6 to i8*
%13 = getelementptr inbounds [5 x i32*], [5 x i32*]* %7, i64 0, i64 0
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32* %14, i32** %13
%15 = getelementptr inbounds i32*, i32** %13, i64 1
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
store i32* %16, i32** %15
%17 = getelementptr inbounds i32*, i32** %15, i64 1
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
store i32* %18, i32** %17
%19 = getelementptr inbounds i32*, i32** %17, i64 1
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32* %20, i32** %19
%21 = getelementptr inbounds i32*, i32** %19, i64 1
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
store i32* %22, i32** %21
%23 = getelementptr inbounds [5 x i32*], [5 x i32*]* %7, i64 0, i64 0
%24 = call i32 @searchMatrix(i32** %23, i32 5, i32 5, i32 20)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@__const.main.r0 = [5 x i32] [i32 1, i32 4, i32 7, i32 11, i32 15]
@__const.main.r1 = [5 x i32] [i32 2, i32 5, i32 8, i32 12, i32 19]
@__const.main.r2 = [5 x i32] [i32 3, i32 6, i32 9, i32 16, i32 22]
@__const.main.r3 = [5 x i32] [i32 10, i32 13, i32 14, i32 17, i32 24]
@__const.main.r4 = [5 x i32] [i32 18, i32 21, i32 23, i32 26, i32 30]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = alloca [5 x i32]
%5 = alloca [5 x i32]
%6 = alloca [5 x i32*]
%7 = bitcast [5 x i32]* %1 to i8*
%8 = bitcast [5 x i32]* %2 to i8*
%9 = bitcast [5 x i32]* %3 to i8*
%10 = bitcast [5 x i32]* %4 to i8*
%11 = bitcast [5 x i32]* %5 to i8*
%12 = bitcast [5 x i32*]* %6 to i8*
%13 = getelementptr inbounds [5 x i32*], [5 x i32*]* %6, i64 0, i64 0
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
store i32* %14, i32** %13
%15 = getelementptr inbounds [5 x i32*], [5 x i32*]* %6, i64 0, i64 1
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32* %16, i32** %15
%17 = getelementptr inbounds [5 x i32*], [5 x i32*]* %6, i64 0, i64 2
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
store i32* %18, i32** %17
%19 = getelementptr inbounds [5 x i32*], [5 x i32*]* %6, i64 0, i64 3
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
store i32* %20, i32** %19
%21 = getelementptr inbounds [5 x i32*], [5 x i32*]* %6, i64 0, i64 4
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
store i32* %22, i32** %21
%23 = call i32 @searchMatrix(i32** %13, i32 5, i32 5, i32 20)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}