#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*/ printSolution(int **);
int /*<<< orphan*/ printf(char *);
int solveKTUtil(int /*<<< orphan*/, int /*<<< orphan*/, int, int **, int *,
                int *);
bool solveKT() {
  int sol[8][8];
  for (int x = 0; x < 8; x++)
    for (int y = 0; y < 8; y++)
      sol[x][y] = -1;
  int xMove[8] = {2, 1, -1, -2, -2, -1, 1, 2};
  int yMove[8] = {1, 2, 2, 1, -1, -2, -2, -1};
  sol[0][0] = 0;
  if (solveKTUtil(0, 0, 1, sol, xMove, yMove) == false) {
    printf("Solution does not exist");
    return false;
  } else
    printSolution(sol);
  return true;
}


x86 assembly (clang, -O0):
<solveKT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x114(%rbp)
cmpl   $0x8,-0x114(%rbp)
jge    11b9 <solveKT+0x89>
movl   $0x0,-0x118(%rbp)
cmpl   $0x8,-0x118(%rbp)
jge    11a0 <solveKT+0x70>
movslq -0x114(%rbp),%rcx
lea    -0x110(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x118(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    115c <solveKT+0x2c>
jmp    11a5 <solveKT+0x75>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1145 <solveKT+0x15>
mov    0xe40(%rip),%rax
mov    %rax,-0x140(%rbp)
mov    0xe3a(%rip),%rax
mov    %rax,-0x138(%rbp)
mov    0xe34(%rip),%rax
mov    %rax,-0x130(%rbp)
mov    0xe2e(%rip),%rax
mov    %rax,-0x128(%rbp)
mov    0xe28(%rip),%rax
mov    %rax,-0x160(%rbp)
mov    0xe22(%rip),%rax
mov    %rax,-0x158(%rbp)
mov    0xe1c(%rip),%rax
mov    %rax,-0x150(%rbp)
mov    0xe16(%rip),%rax
mov    %rax,-0x148(%rbp)
movl   $0x0,-0x110(%rbp)
lea    -0x110(%rbp),%rcx
lea    -0x140(%rbp),%r8
lea    -0x160(%rbp),%r9
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1050 <solveKTUtil@plt>
cmp    $0x0,%eax
jne    1277 <solveKT+0x147>
lea    0xdda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    128a <solveKT+0x15a>
lea    -0x110(%rbp),%rdi
call   1040 <printSolution@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveKT>:
push   %rbx
sub    $0x140,%rsp
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x130(%rsp)
movdqa %xmm0,0x120(%rsp)
movdqa %xmm0,0x110(%rsp)
movdqa %xmm0,0x100(%rsp)
movdqa %xmm0,0xf0(%rsp)
movdqa %xmm0,0xe0(%rsp)
movdqa %xmm0,0xd0(%rsp)
movdqa %xmm0,0xc0(%rsp)
movdqa %xmm0,0xb0(%rsp)
movdqa %xmm0,0xa0(%rsp)
movdqa %xmm0,0x90(%rsp)
movdqa %xmm0,0x80(%rsp)
movdqa %xmm0,0x70(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movaps 0xe49(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe2d(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe51(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe35(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x40(%rsp)
xor    %ebx,%ebx
lea    0x40(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    %rsp,%r9
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <solveKTUtil@plt>
test   %eax,%eax
je     1229 <solveKT+0xf9>
lea    0x40(%rsp),%rdi
call   1040 <printSolution@plt>
mov    $0x1,%ebx
jmp    1235 <solveKT+0x105>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x140,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.solveKT.xMove = [8 x i32] [i32 2, i32 1, i32 -1, i32 -2, i32 -2, i32 -1, i32 1, i32 2]
@__const.solveKT.yMove = [8 x i32] [i32 1, i32 2, i32 2, i32 1, i32 -1, i32 -2, i32 -2, i32 -1]
@.str = [24 x i8] c"Solution does not exist\00"
define i32 @solveKT() {
%1 = alloca i32
%2 = alloca [8 x [8 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x i32]
%6 = alloca [8 x i32]
store i32 0, i32* %3
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %28
10: ; preds = %7
store i32 0, i32* %4
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %2, i64 0, i64 %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %17, i64 0, i64 %19
store i32 -1, i32* %20
br label %21
21: ; preds = %14
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %11
24: ; preds = %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %7
28: ; preds = %7
%29 = bitcast [8 x i32]* %5 to i8*
%30 = bitcast [8 x i32]* %6 to i8*
%31 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %2, i64 0, i64 0
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %31, i64 0, i64 0
store i32 0, i32* %32
%33 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %2, i64 0, i64 0
%34 = bitcast [8 x i32]* %33 to i32**
%35 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%36 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%37 = call i32 @solveKTUtil(i32 0, i32 0, i32 1, i32** %34, i32* %35, i32* %36)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %28
%40 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %46
41: ; preds = %28
%42 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %2, i64 0, i64 0
%43 = bitcast [8 x i32]* %42 to i32**
%44 = call i32 @printSolution(i32** %43)
br label %45
45: ; preds = %41
store i32 1, i32* %1
br label %46
46: ; preds = %45, %39
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@__const.solveKT.xMove = [8 x i32] [i32 2, i32 1, i32 -1, i32 -2, i32 -2, i32 -1, i32 1, i32 2]
@__const.solveKT.yMove = [8 x i32] [i32 1, i32 2, i32 2, i32 1, i32 -1, i32 -2, i32 -2, i32 -1]
@.str = [24 x i8] c"Solution does not exist\00"
define i32 @solveKT() {
%1 = alloca [8 x [8 x i32]]
%2 = bitcast [8 x [8 x i32]]* %1 to i8*
%3 = alloca [8 x i32]
%4 = alloca [8 x i32]
%5 = bitcast [8 x i32]* %3 to i8*
%6 = bitcast [8 x i32]* %4 to i8*
%7 = getelementptr inbounds [8 x [8 x i32]], [8 x [8 x i32]]* %1, i64 0, i64 0, i64 0
store i32 0, i32* %7
%8 = bitcast [8 x [8 x i32]]* %1 to i32**
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%11 = call i32 @solveKTUtil(i32 0, i32 0, i32 1, i32** %8, i32* %9, i32* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %17
15: ; preds = %0
%16 = call i32 @printSolution(i32** %8)
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ 0, %13 ], [ 1, %15 ]
ret i32 %18
}