#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ clearScreen(int);
int /*<<< orphan*/ drawEndOfGame();
int /*<<< orphan*/ drawHeader();
int /*<<< orphan*/ drawSubHeader();
int getRandomNumber(int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sonarReport(int, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t t;
  srand(time(&t));
  int fishX = 0;
  int fishDepth = 0;
  int fishZ = 0;
  int boatX = 0;
  int netDepth = 0;
  int boatZ = 0;
  int turnsTaken = 0;
  int win = 0;
  fishX = getRandomNumber(8);
  fishDepth = getRandomNumber(8);
  fishZ = getRandomNumber(8);
  drawHeader();
  drawSubHeader();
  do {
    printf("\nEnter your NORTH/SOUTH position : ");
    scanf("%d", &boatZ);
    printf("Enter your WEST/EAST postion : ");
    scanf("%d", &boatX);
    printf("Enter your net depth : ");
    scanf("%d", &netDepth);
    turnsTaken++;
    if (boatX == fishX && netDepth == fishDepth && boatZ == fishZ) {
      win = 1;
      clearScreen(10);
      printf("\nWell done! You took %d turns to find the fish.\n", turnsTaken);
      drawEndOfGame();
    } else {
      clearScreen(18);
      drawHeader();
      printf("Turns taken = :     %d\n", turnsTaken);
      printf("======================================\n");
      printf("Sorry, no fish found, please try again.\n");
      printf("Soner : More *** = closer\n\n");
      if (boatZ < fishZ) {
        printf("Sonar Report : Fish located more NORTH : ");
        sonarReport(boatZ, fishZ);
      } else if (boatZ > fishZ) {
        printf("Sonar Report : Fish located more SOUTH : ");
        sonarReport(boatZ, fishZ);
      } else if (boatZ == fishZ) {
        printf("NORTH/SOUTH postion found at           : %d\n", boatZ);
      }
      if (boatX < fishX) {
        printf("Sonar Report : Fish located more EAST  : ");
        sonarReport(boatX, fishX);
      } else if (boatX > fishX) {
        printf("Sonar Report : Fish located more WEST  : ");
        sonarReport(boatX, fishX);
      } else if (boatX == fishX) {
        printf("WEST/EAST postion found at             : %d\n", boatX);
      }
      if (netDepth < fishDepth) {
        printf("Sonar Report : Fish located DEEPER     : ");
        sonarReport(netDepth, fishDepth);
      } else if (netDepth > fishDepth) {
        printf("Sonar Report : Fish located SHALLOWER  : ");
        sonarReport(netDepth, fishDepth);
      } else if (netDepth == fishDepth) {
        printf("DEPTH postion found at                 : %d\n", netDepth);
      }
    }
  } while (win == 0);
  getchar();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    $0x8,%edi
call   10d0 <getRandomNumber@plt>
mov    %eax,-0xc(%rbp)
mov    $0x8,%edi
call   10d0 <getRandomNumber@plt>
mov    %eax,-0x10(%rbp)
mov    $0x8,%edi
call   10d0 <getRandomNumber@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <drawHeader@plt>
mov    $0x0,%al
call   10a0 <drawSubHeader@plt>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd3(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   10b0 <scanf@plt>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdb5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   10b0 <scanf@plt>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd97(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   10b0 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    12f1 <main+0x141>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    12f1 <main+0x141>
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    12f1 <main+0x141>
movl   $0x1,-0x28(%rbp)
mov    $0xa,%edi
call   1090 <clearScreen@plt>
mov    -0x24(%rbp),%esi
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <drawEndOfGame@plt>
jmp    14b3 <main+0x303>
mov    $0x12,%edi
call   1090 <clearScreen@plt>
mov    $0x0,%al
call   1040 <drawHeader@plt>
mov    -0x24(%rbp),%esi
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1367 <main+0x1b7>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10c0 <sonarReport@plt>
jmp    13b8 <main+0x208>
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1391 <main+0x1e1>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10c0 <sonarReport@plt>
jmp    13b3 <main+0x203>
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    13ae <main+0x1fe>
mov    -0x20(%rbp),%esi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13b3 <main+0x203>
jmp    13b8 <main+0x208>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13e2 <main+0x232>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
mov    -0xc(%rbp),%esi
call   10c0 <sonarReport@plt>
jmp    1433 <main+0x283>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    140c <main+0x25c>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
mov    -0xc(%rbp),%esi
call   10c0 <sonarReport@plt>
jmp    142e <main+0x27e>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1429 <main+0x279>
mov    -0x18(%rbp),%esi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    142e <main+0x27e>
jmp    1433 <main+0x283>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    145d <main+0x2ad>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10c0 <sonarReport@plt>
jmp    14ae <main+0x2fe>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1487 <main+0x2d7>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10c0 <sonarReport@plt>
jmp    14a9 <main+0x2f9>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    14a4 <main+0x2f4>
mov    -0x1c(%rbp),%esi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14a9 <main+0x2f9>
jmp    14ae <main+0x2fe>
jmp    14b3 <main+0x303>
jmp    14b8 <main+0x308>
cmpl   $0x0,-0x28(%rbp)
je     123c <main+0x8c>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    0x2b10(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x14(%rsp),%rdi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    $0x8,%edi
call   10e0 <getRandomNumber@plt>
mov    %eax,%ebx
mov    $0x8,%edi
call   10e0 <getRandomNumber@plt>
mov    %eax,%r15d
mov    $0x8,%edi
call   10e0 <getRandomNumber@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <drawHeader@plt>
xor    %eax,%eax
call   10b0 <drawSubHeader@plt>
mov    $0x1,%ebp
lea    0xded(%rip),%r13
lea    0xc(%rsp),%r12
jmp    125d <main+0x9d>
xchg   %ax,%ax
lea    0xf63(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
mov    %r15d,%esi
call   10d0 <sonarReport@plt>
add    $0x1,%ebp
lea    0xd9c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   10c0 <scanf@plt>
lea    0xda8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
call   10c0 <scanf@plt>
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   10c0 <scanf@plt>
cmp    %ebx,0x10(%rsp)
jne    12c4 <main+0x104>
cmp    %r15d,0xc(%rsp)
jne    12c4 <main+0x104>
cmp    %r14d,0x8(%rsp)
je     13ef <main+0x22f>
mov    $0x12,%edi
call   10a0 <clearScreen@plt>
xor    %eax,%eax
call   1040 <drawHeader@plt>
lea    0xdb4(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf3f(%rip),%rdi
call   1050 <puts@plt>
lea    0xf5a(%rip),%rdi
call   1050 <puts@plt>
lea    0xf76(%rip),%rdi
call   1050 <puts@plt>
mov    0x8(%rsp),%eax
cmp    %r14d,%eax
jge    1320 <main+0x160>
lea    0xd8f(%rip),%rdi
jmp    1329 <main+0x169>
nopl   0x0(%rax,%rax,1)
jle    1390 <main+0x1d0>
lea    0xda9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%edi
mov    %r14d,%esi
call   10d0 <sonarReport@plt>
mov    0x10(%rsp),%eax
cmp    %ebx,%eax
jge    1350 <main+0x190>
lea    0xdde(%rip),%rdi
jmp    1359 <main+0x199>
nopl   (%rax)
jle    13b0 <main+0x1f0>
lea    0xdfa(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%edi
mov    %ebx,%esi
call   10d0 <sonarReport@plt>
mov    0xc(%rsp),%eax
cmp    %r15d,%eax
jl     1240 <main+0x80>
jle    13d0 <main+0x210>
lea    0xe53(%rip),%rdi
jmp    1247 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
jne    133c <main+0x17c>
lea    0xd63(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    133c <main+0x17c>
cs nopw 0x0(%rax,%rax,1)
nop
jne    136b <main+0x1ab>
lea    0xdc4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    136b <main+0x1ab>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jne    125a <main+0x9a>
lea    0xe21(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebp
jmp    125d <main+0x9d>
mov    $0xa,%edi
call   10a0 <clearScreen@plt>
lea    0xc5f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1030 <drawEndOfGame@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    0x2bc2(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0AEnter your NORTH/SOUTH position : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"Enter your WEST/EAST postion : \00"
@.str.3 = [24 x i8] c"Enter your net depth : \00"
@.str.4 = [49 x i8] c"\0AWell done! You took %d turns to find the fish.\0A\00"
@.str.5 = [24 x i8] c"Turns taken = : %d\0A\00"
@.str.6 = [40 x i8] c"======================================\0A\00"
@.str.7 = [41 x i8] c"Sorry, no fish found, please try again.\0A\00"
@.str.8 = [28 x i8] c"Soner : More *** = closer\0A\0A\00"
@.str.9 = [42 x i8] c"Sonar Report : Fish located more NORTH : \00"
@.str.10 = [42 x i8] c"Sonar Report : Fish located more SOUTH : \00"
@.str.11 = [45 x i8] c"NORTH/SOUTH postion found at : %d\0A\00"
@.str.12 = [42 x i8] c"Sonar Report : Fish located more EAST : \00"
@.str.13 = [42 x i8] c"Sonar Report : Fish located more WEST : \00"
@.str.14 = [45 x i8] c"WEST/EAST postion found at : %d\0A\00"
@.str.15 = [42 x i8] c"Sonar Report : Fish located DEEPER : \00"
@.str.16 = [42 x i8] c"Sonar Report : Fish located SHALLOWER : \00"
@.str.17 = [45 x i8] c"DEPTH postion found at : %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 @time(i32* %2)
%12 = call i32 @srand(i32 %11)
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%13 = call i32 @getRandomNumber(i32 8)
store i32 %13, i32* %3
%14 = call i32 @getRandomNumber(i32 8)
store i32 %14, i32* %4
%15 = call i32 @getRandomNumber(i32 8)
store i32 %15, i32* %5
%16 = call i32 (...) @drawHeader()
%17 = call i32 (...) @drawSubHeader()
br label %18
18: ; preds = %133, %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
%27 = load i32, i32* %6
%28 = load i32, i32* %3
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %43
30: ; preds = %18
%31 = load i32, i32* %7
%32 = load i32, i32* %4
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %43
34: ; preds = %30
%35 = load i32, i32* %8
%36 = load i32, i32* %5
%37 = icmp eq i32 %35, %36
br i1 %37, label %38, label %43
38: ; preds = %34
store i32 1, i32* %10
%39 = call i32 @clearScreen(i32 10)
%40 = load i32, i32* %9
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = call i32 (...) @drawEndOfGame()
br label %132
43: ; preds = %34, %30, %18
%44 = call i32 @clearScreen(i32 18)
%45 = call i32 (...) @drawHeader()
%46 = load i32, i32* %9
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%51 = load i32, i32* %8
%52 = load i32, i32* %5
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %59
54: ; preds = %43
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
%56 = load i32, i32* %8
%57 = load i32, i32* %5
%58 = call i32 @sonarReport(i32 %56, i32 %57)
br label %77
59: ; preds = %43
%60 = load i32, i32* %8
%61 = load i32, i32* %5
%62 = icmp sgt i32 %60, %61
br i1 %62, label %63, label %68
63: ; preds = %59
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%65 = load i32, i32* %8
%66 = load i32, i32* %5
%67 = call i32 @sonarReport(i32 %65, i32 %66)
br label %76
68: ; preds = %59
%69 = load i32, i32* %8
%70 = load i32, i32* %5
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = load i32, i32* %8
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %72, %68
br label %76
76: ; preds = %75, %63
br label %77
77: ; preds = %76, %54
%78 = load i32, i32* %6
%79 = load i32, i32* %3
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %86
81: ; preds = %77
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
%83 = load i32, i32* %6
%84 = load i32, i32* %3
%85 = call i32 @sonarReport(i32 %83, i32 %84)
br label %104
86: ; preds = %77
%87 = load i32, i32* %6
%88 = load i32, i32* %3
%89 = icmp sgt i32 %87, %88
br i1 %89, label %90, label %95
90: ; preds = %86
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
%92 = load i32, i32* %6
%93 = load i32, i32* %3
%94 = call i32 @sonarReport(i32 %92, i32 %93)
br label %103
95: ; preds = %86
%96 = load i32, i32* %6
%97 = load i32, i32* %3
%98 = icmp eq i32 %96, %97
br i1 %98, label %99, label %102
99: ; preds = %95
%100 = load i32, i32* %6
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i64 0, i64 0), i32 %100)
br label %102
102: ; preds = %99, %95
br label %103
103: ; preds = %102, %90
br label %104
104: ; preds = %103, %81
%105 = load i32, i32* %7
%106 = load i32, i32* %4
%107 = icmp slt i32 %105, %106
br i1 %107, label %108, label %113
108: ; preds = %104
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.15, i64 0, i64 0))
%110 = load i32, i32* %7
%111 = load i32, i32* %4
%112 = call i32 @sonarReport(i32 %110, i32 %111)
br label %131
113: ; preds = %104
%114 = load i32, i32* %7
%115 = load i32, i32* %4
%116 = icmp sgt i32 %114, %115
br i1 %116, label %117, label %122
117: ; preds = %113
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.16, i64 0, i64 0))
%119 = load i32, i32* %7
%120 = load i32, i32* %4
%121 = call i32 @sonarReport(i32 %119, i32 %120)
br label %130
122: ; preds = %113
%123 = load i32, i32* %7
%124 = load i32, i32* %4
%125 = icmp eq i32 %123, %124
br i1 %125, label %126, label %129
126: ; preds = %122
%127 = load i32, i32* %7
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.17, i64 0, i64 0), i32 %127)
br label %129
129: ; preds = %126, %122
br label %130
130: ; preds = %129, %117
br label %131
131: ; preds = %130, %108
br label %132
132: ; preds = %131, %38
br label %133
133: ; preds = %132
%134 = load i32, i32* %10
%135 = icmp eq i32 %134, 0
br i1 %135, label %18, label %136
136: ; preds = %133
%137 = call i32 (...) @getchar()
%138 = load i32, i32* @EXIT_SUCCESS
ret i32 %138
}

LLVM IR (-O2):
@.str = [36 x i8] c"\0AEnter your NORTH/SOUTH position : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"Enter your WEST/EAST postion : \00"
@.str.3 = [24 x i8] c"Enter your net depth : \00"
@.str.4 = [49 x i8] c"\0AWell done! You took %d turns to find the fish.\0A\00"
@.str.5 = [24 x i8] c"Turns taken = : %d\0A\00"
@.str.9 = [42 x i8] c"Sonar Report : Fish located more NORTH : \00"
@.str.10 = [42 x i8] c"Sonar Report : Fish located more SOUTH : \00"
@.str.11 = [45 x i8] c"NORTH/SOUTH postion found at : %d\0A\00"
@.str.12 = [42 x i8] c"Sonar Report : Fish located more EAST : \00"
@.str.13 = [42 x i8] c"Sonar Report : Fish located more WEST : \00"
@.str.14 = [45 x i8] c"WEST/EAST postion found at : %d\0A\00"
@.str.15 = [42 x i8] c"Sonar Report : Fish located DEEPER : \00"
@.str.16 = [42 x i8] c"Sonar Report : Fish located SHALLOWER : \00"
@.str.17 = [45 x i8] c"DEPTH postion found at : %d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [39 x i8] c"======================================\00"
@str.18 = [40 x i8] c"Sorry, no fish found, please try again.\00"
@str.19 = [27 x i8] c"Soner : More *** = closer\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = call i32 @time(i32* %1)
%7 = call i32 @srand(i32 %6)
%8 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%9 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%10 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%11 = call i32 @getRandomNumber(i32 8)
%12 = call i32 @getRandomNumber(i32 8)
%13 = call i32 @getRandomNumber(i32 8)
%14 = call i32 (...) @drawHeader()
%15 = call i32 (...) @drawSubHeader()
br label %16
16: ; preds = %92, %0
%17 = phi i32 [ 0, %0 ], [ %24, %92 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%24 = add nuw nsw i32 %17, 1
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, %11
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, %12
%29 = select i1 %26, i1 %28, i1 false
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, %13
%32 = select i1 %29, i1 %31, i1 false
br i1 %32, label %33, label %39
33: ; preds = %16
%34 = call i32 @clearScreen(i32 10)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%36 = call i32 (...) @drawEndOfGame()
%37 = call i32 (...) @getchar()
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
39: ; preds = %16
%40 = call i32 @clearScreen(i32 18)
%41 = call i32 (...) @drawHeader()
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %24)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.18, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.19, i64 0, i64 0))
%46 = load i32, i32* %4
%47 = icmp slt i32 %46, %13
br i1 %47, label %48, label %52
48: ; preds = %39
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
%50 = load i32, i32* %4
%51 = call i32 @sonarReport(i32 %50, i32 %13)
br label %62
52: ; preds = %39
%53 = icmp sgt i32 %46, %13
br i1 %53, label %54, label %58
54: ; preds = %52
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%56 = load i32, i32* %4
%57 = call i32 @sonarReport(i32 %56, i32 %13)
br label %62
58: ; preds = %52
%59 = icmp eq i32 %46, %13
br i1 %59, label %60, label %62
60: ; preds = %58
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i32 %13)
br label %62
62: ; preds = %54, %60, %58, %48
%63 = load i32, i32* %2
%64 = icmp slt i32 %63, %11
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i64 0, i64 0))
%67 = load i32, i32* %2
%68 = call i32 @sonarReport(i32 %67, i32 %11)
br label %79
69: ; preds = %62
%70 = icmp sgt i32 %63, %11
br i1 %70, label %71, label %75
71: ; preds = %69
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0))
%73 = load i32, i32* %2
%74 = call i32 @sonarReport(i32 %73, i32 %11)
br label %79
75: ; preds = %69
%76 = icmp eq i32 %63, %11
br i1 %76, label %77, label %79
77: ; preds = %75
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i64 0, i64 0), i32 %11)
br label %79
79: ; preds = %71, %77, %75, %65
%80 = load i32, i32* %3
%81 = icmp slt i32 %80, %12
br i1 %81, label %82, label %86
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.15, i64 0, i64 0))
%84 = load i32, i32* %3
%85 = call i32 @sonarReport(i32 %84, i32 %12)
br label %92
86: ; preds = %79
%87 = icmp sgt i32 %80, %12
br i1 %87, label %88, label %93
88: ; preds = %86
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.16, i64 0, i64 0))
%90 = load i32, i32* %3
%91 = call i32 @sonarReport(i32 %90, i32 %12)
br label %92
92: ; preds = %88, %95, %93, %82
br label %16
93: ; preds = %86
%94 = icmp eq i32 %80, %12
br i1 %94, label %95, label %92
95: ; preds = %93
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.17, i64 0, i64 0), i32 %12)
br label %92
}