#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 isDiagonal(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int test_isDiagonal() {
  int src, dest, boardSize;
  for (boardSize = 3; boardSize <= 3; boardSize++) {
    for (src = 0; src <= boardSize * boardSize; src++) {
      for (dest = 0; dest < boardSize * boardSize; dest++) {
        printf("isDiagonal(src = %d, dest = %d, boardSize = %d) = %d\n", src,
               dest, boardSize, isDiagonal(src, dest, boardSize));
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_isDiagonal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jg     11d7 <test_isDiagonal+0xb7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     11c4 <test_isDiagonal+0xa4>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    11b1 <test_isDiagonal+0x91>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <isDiagonal@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    %eax,%r8d
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1159 <test_isDiagonal+0x39>
jmp    11b6 <test_isDiagonal+0x96>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <test_isDiagonal+0x20>
jmp    11c9 <test_isDiagonal+0xa9>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112f <test_isDiagonal+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isDiagonal>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x5,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x7,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x8,%esi
mov    $0x3,%edx
call   1040 <isDiagonal@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x8,%edx
mov    $0x3,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0xa,%ebx
jne    1130 <test_isDiagonal+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [54 x i8] c"isDiagonal(src = %d, dest = %d, boardSize = %d) = %d\0A\00"
define i32 @test_isDiagonal() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %21, %1 ]
%3 = tail call i32 @isDiagonal(i32 %2, i32 0, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 0, i32 3, i32 %3)
%5 = tail call i32 @isDiagonal(i32 %2, i32 1, i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 1, i32 3, i32 %5)
%7 = tail call i32 @isDiagonal(i32 %2, i32 2, i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 2, i32 3, i32 %7)
%9 = tail call i32 @isDiagonal(i32 %2, i32 3, i32 3)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 3, i32 3, i32 %9)
%11 = tail call i32 @isDiagonal(i32 %2, i32 4, i32 3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 4, i32 3, i32 %11)
%13 = tail call i32 @isDiagonal(i32 %2, i32 5, i32 3)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 5, i32 3, i32 %13)
%15 = tail call i32 @isDiagonal(i32 %2, i32 6, i32 3)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 6, i32 3, i32 %15)
%17 = tail call i32 @isDiagonal(i32 %2, i32 7, i32 3)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 7, i32 3, i32 %17)
%19 = tail call i32 @isDiagonal(i32 %2, i32 8, i32 3)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %2, i32 8, i32 3, i32 %19)
%21 = add nuw nsw i32 %2, 1
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %1
23: ; preds = %1
ret i32 0
}