#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 corner(int x[3][3]) {
  if (x[0][0] == 0) {
    printf("0 0");
    return 1;
  } else if (x[0][2] == 0) {
    printf("0 2");
    return 1;
  } else if (x[2][0] == 0) {
    printf("2 0");
    return 1;
  } else if (x[2][2] == 0) {
    printf("2 2");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<corner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1141 <corner+0x31>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <corner+0xb9>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jne    1167 <corner+0x57>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <corner+0xb9>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x18(%rax)
jne    118d <corner+0x7d>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <corner+0xb9>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x20(%rax)
jne    11b3 <corner+0xa3>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <corner+0xb9>
jmp    11b8 <corner+0xa8>
jmp    11bd <corner+0xad>
jmp    11c2 <corner+0xb2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<corner>:
push   %rax
cmpl   $0x0,(%rdi)
je     112c <corner+0x1c>
cmpl   $0x0,0x8(%rdi)
je     1135 <corner+0x25>
cmpl   $0x0,0x18(%rdi)
je     113e <corner+0x2e>
xor    %eax,%eax
cmpl   $0x0,0x20(%rdi)
je     1147 <corner+0x37>
pop    %rcx
ret
lea    0xecd(%rip),%rdi
jmp    114e <corner+0x3e>
lea    0xec8(%rip),%rdi
jmp    114e <corner+0x3e>
lea    0xec3(%rip),%rdi
jmp    114e <corner+0x3e>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"0 0\00"
@.str.1 = [4 x i8] c"0 2\00"
@.str.2 = [4 x i8] c"2 0\00"
@.str.3 = [4 x i8] c"2 2\00"
define i32 @corner([3 x i32]* %0) {
%2 = alloca i32
%3 = alloca [3 x i32]*
store [3 x i32]* %0, [3 x i32]** %3
%4 = load [3 x i32]*, [3 x i32]** %3
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %39
11: ; preds = %1
%12 = load [3 x i32]*, [3 x i32]** %3
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %39
19: ; preds = %11
%20 = load [3 x i32]*, [3 x i32]** %3
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %20, i64 2
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %39
27: ; preds = %19
%28 = load [3 x i32]*, [3 x i32]** %3
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %28, i64 2
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %29, i64 0, i64 2
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %39
35: ; preds = %27
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
store i32 0, i32* %2
br label %39
39: ; preds = %38, %33, %25, %17, %9
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
@.str = [4 x i8] c"0 0\00"
@.str.1 = [4 x i8] c"0 2\00"
@.str.2 = [4 x i8] c"2 0\00"
@.str.3 = [4 x i8] c"2 2\00"
define i32 @corner([3 x i32]* nocapture %0) {
%2 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 0
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %1
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 0, i64 2
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %5
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 2, i64 2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13, %9, %5, %1
%18 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %13 ]
%19 = tail call i32 @printf(i8* dereferenceable(1) %18)
br label %20
20: ; preds = %17, %13
%21 = phi i32 [ 0, %13 ], [ 1, %17 ]
ret i32 %21
}