#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 *young_tableau_find(int **, int, int, int);
int main(int argc, char *argv[]) {
  int matrix[4][4] = {
      {
          1,
          2,
          8,
          9,
      },
      {
          2,
          4,
          9,
          12,
      },
      {
          4,
          7,
          10,
          13,
      },
      {
          6,
          8,
          11,
          15,
      },
  };
  int *value = young_tableau_find(matrix, 4, 4, 5);
  printf("%p %p\n", matrix, value);
  if (value) {
    printf("%d\n", *value);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x4,%edx
mov    $0x5,%ecx
mov    %edx,%esi
call   1030 <young_tableau_find@plt>
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x58(%rbp)
je     11a9 <main+0x79>
mov    -0x58(%rbp),%rax
mov    (%rax),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeae(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x5,%ecx
call   1030 <young_tableau_find@plt>
mov    %rax,%rbx
lea    0xec6(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     119c <main+0x7c>
mov    (%rbx),%esi
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.matrix = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 8, i32 9], [4 x i32] [i32 2, i32 4, i32 9, i32 12], [4 x i32] [i32 4, i32 7, i32 10, i32 13], [4 x i32] [i32 6, i32 8, i32 11, i32 15]]
@.str = [7 x i8] c"%p %p\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x [4 x i32]]
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [4 x [4 x i32]]* %6 to i8*
%9 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %6, i64 0, i64 0
%10 = bitcast [4 x i32]* %9 to i32**
%11 = call i32* @young_tableau_find(i32** %10, i32 4, i32 4, i32 5)
store i32* %11, i32** %7
%12 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %6, i64 0, i64 0
%13 = load i32*, i32** %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), [4 x i32]* %12, i32* %13)
%15 = load i32*, i32** %7
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i32*, i32** %7
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %2
ret i32 0
}

LLVM IR (-O2):
@__const.main.matrix = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 8, i32 9], [4 x i32] [i32 2, i32 4, i32 9, i32 12], [4 x i32] [i32 4, i32 7, i32 10, i32 13], [4 x i32] [i32 6, i32 8, i32 11, i32 15]]
@.str = [7 x i8] c"%p %p\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x [4 x i32]]
%4 = bitcast [4 x [4 x i32]]* %3 to i8*
%5 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %3, i64 0, i64 0
%6 = bitcast [4 x [4 x i32]]* %3 to i32**
%7 = call i32* @young_tableau_find(i32** %6, i32 4, i32 4, i32 5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), [4 x i32]* %5, i32* %7)
%9 = icmp eq i32* %7, null
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %7
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %2
ret i32 0
}