#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 /*<<< orphan*/ puts(char *);
int rand();
void main() {
  int g[17][17];
  int ok = 0;
  int i, j, k;
  int loops = 0, changes = 0;
  for (i = 0; i < 17; i++) {
    for (j = 0; j < 17; j++) {
      g[i][j] = 0;
    }
  }
  while (!ok) {
    ok = 1;
    changes = 0;
    loops++;
    for (k = 0; k < 17; k++) {
      for (j = 0; j < k; j++) {
        for (i = 0; i < j; i++) {
          int c = g[i][j];
          if ((c == g[j][k]) && c == g[i][k]) {
            int new_c = rand() % 4;
            changes++;
            ok = 0;
            if (rand() % 2) {
              g[j][k] = new_c;
            } else {
              g[i][k] = new_c;
            }
          }
        }
      }
    }
    if (!(loops % 1024)) {
      printf("Loops: %d, changes: %d \r", loops, changes);
    }
  }
  puts("\n\n-- Final Graph --\n");
  printf("   ");
  for (j = 0; j < 17; j++) {
    printf("%2d ", j);
  }
  for (i = 0; i < 17; i++) {
    printf("\n\n%2d   ", i);
    for (j = 0; j < i; j++) {
      printf("%c  ", (g[j][i] + 'a'));
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
movl   $0x0,-0x494(%rbp)
movl   $0x0,-0x4a4(%rbp)
movl   $0x0,-0x4a8(%rbp)
movl   $0x0,-0x498(%rbp)
cmpl   $0x11,-0x498(%rbp)
jge    11d7 <main+0xa7>
movl   $0x0,-0x49c(%rbp)
cmpl   $0x11,-0x49c(%rbp)
jge    11be <main+0x8e>
movslq -0x498(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x44,%rcx,%rcx
add    %rcx,%rax
movslq -0x49c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    117a <main+0x4a>
jmp    11c3 <main+0x93>
mov    -0x498(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x498(%rbp)
jmp    1163 <main+0x33>
jmp    11dc <main+0xac>
cmpl   $0x0,-0x494(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11f5 <main+0xc5>
jmp    13fd <main+0x2cd>
movl   $0x1,-0x494(%rbp)
movl   $0x0,-0x4a8(%rbp)
mov    -0x4a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a4(%rbp)
movl   $0x0,-0x4a0(%rbp)
cmpl   $0x11,-0x4a0(%rbp)
jge    13c7 <main+0x297>
movl   $0x0,-0x49c(%rbp)
mov    -0x49c(%rbp),%eax
cmp    -0x4a0(%rbp),%eax
jge    13ae <main+0x27e>
movl   $0x0,-0x498(%rbp)
mov    -0x498(%rbp),%eax
cmp    -0x49c(%rbp),%eax
jge    1395 <main+0x265>
movslq -0x498(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x44,%rcx,%rcx
add    %rcx,%rax
movslq -0x49c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4ac(%rbp)
mov    -0x4ac(%rbp),%eax
movslq -0x49c(%rbp),%rdx
lea    -0x490(%rbp),%rcx
imul   $0x44,%rdx,%rdx
add    %rdx,%rcx
movslq -0x4a0(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    137c <main+0x24c>
mov    -0x4ac(%rbp),%eax
movslq -0x498(%rbp),%rdx
lea    -0x490(%rbp),%rcx
imul   $0x44,%rdx,%rdx
add    %rdx,%rcx
movslq -0x4a0(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    137c <main+0x24c>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4b0(%rbp)
mov    -0x4a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a8(%rbp)
movl   $0x0,-0x494(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1352 <main+0x222>
mov    -0x4b0(%rbp),%edx
movslq -0x49c(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x44,%rcx,%rcx
add    %rcx,%rax
movslq -0x4a0(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1377 <main+0x247>
mov    -0x4b0(%rbp),%edx
movslq -0x498(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x44,%rcx,%rcx
add    %rcx,%rax
movslq -0x4a0(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    137c <main+0x24c>
jmp    1381 <main+0x251>
mov    -0x498(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x498(%rbp)
jmp    1255 <main+0x125>
jmp    139a <main+0x26a>
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    1239 <main+0x109>
jmp    13b3 <main+0x283>
mov    -0x4a0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a0(%rbp)
jmp    1222 <main+0xf2>
mov    -0x4a4(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13f8 <main+0x2c8>
mov    -0x4a4(%rbp),%esi
mov    -0x4a8(%rbp),%edx
lea    0xc0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <main+0xac>
lea    0xc15(%rip),%rdi
call   1030 <puts@plt>
lea    0xc28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x49c(%rbp)
cmpl   $0x11,-0x49c(%rbp)
jge    1456 <main+0x326>
mov    -0x49c(%rbp),%esi
lea    0xbf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    1421 <main+0x2f1>
movl   $0x0,-0x498(%rbp)
cmpl   $0x11,-0x498(%rbp)
jge    14fa <main+0x3ca>
mov    -0x498(%rbp),%esi
lea    0xbb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x49c(%rbp)
mov    -0x49c(%rbp),%eax
cmp    -0x498(%rbp),%eax
jge    14e1 <main+0x3b1>
movslq -0x49c(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x44,%rcx,%rcx
add    %rcx,%rax
movslq -0x498(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
add    $0x61,%esi
lea    0xb76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    148b <main+0x35b>
jmp    14e6 <main+0x3b6>
mov    -0x498(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x498(%rbp)
jmp    1460 <main+0x330>
add    $0x4b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4b8,%rsp
lea    0x30(%rsp),%rdi
mov    $0x484,%edx
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x0,0xc(%rsp)
jmp    1191 <main+0x51>
nopl   0x0(%rax)
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
test   $0x3ff,%eax
je     1280 <main+0x140>
cmpl   $0x0,0x14(%rsp)
jne    12a1 <main+0x161>
movl   $0x1,0x14(%rsp)
lea    0x30(%rsp),%rcx
xor    %edx,%edx
movl   $0x0,0x10(%rsp)
jmp    11be <main+0x7e>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdx
add    $0x4,%rcx
cmp    $0x11,%rdx
je     1170 <main+0x30>
test   %rdx,%rdx
je     11b0 <main+0x70>
xor    %esi,%esi
lea    0x30(%rsp),%r14
xor    %ebp,%ebp
mov    %rdx,0x18(%rsp)
mov    %rcx,0x28(%rsp)
jmp    11fb <main+0xbb>
nopl   0x0(%rax,%rax,1)
mov    0x20(%rsp),%rbp
add    $0x1,%rbp
add    $0x4,%r14
add    $0x44,%rsi
mov    0x18(%rsp),%rdx
cmp    %rdx,%rbp
je     11b0 <main+0x70>
test   %rbp,%rbp
mov    %rbp,0x20(%rsp)
je     11e0 <main+0xa0>
mov    %rbp,%rax
shl    $0x6,%rax
lea    (%rax,%rbp,4),%rax
add    %rsp,%rax
add    $0x30,%rax
lea    (%rax,%rdx,4),%rbp
xor    %r13d,%r13d
jmp    1229 <main+0xe9>
add    $0x44,%r13
cmp    %r13,%rsi
je     11e0 <main+0xa0>
mov    (%r14,%r13,1),%eax
cmp    0x0(%rbp),%eax
jne    1220 <main+0xe0>
cmp    (%rcx,%r13,1),%eax
jne    1220 <main+0xe0>
lea    (%rcx,%r13,1),%r12
movl   $0x0,0x14(%rsp)
xor    %eax,%eax
mov    %rsi,%r15
call   1060 <rand@plt>
mov    %eax,%ebx
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffffc,%eax
sub    %eax,%ebx
addl   $0x1,0x10(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
mov    %r15,%rsi
mov    0x28(%rsp),%rcx
test   $0x1,%al
cmovne %rbp,%r12
mov    %ebx,(%r12)
jmp    1220 <main+0xe0>
nopl   (%rax)
lea    0xd79(%rip),%rdi
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x14(%rsp)
je     1191 <main+0x51>
lea    0xd71(%rip),%rdi
call   1030 <puts@plt>
lea    0xd84(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd6c(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%r13
lea    0xc69(%rip),%r14
lea    0xc6b(%rip),%r12
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    13f2 <main+0x2b2>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
add    $0x4,%r13
add    $0x44,%rbp
cmp    $0x11,%r15
je     142d <main+0x2ed>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15,%r15
je     13e0 <main+0x2a0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,1),%esi
add    $0x61,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x44,%rbx
cmp    %rbx,%rbp
jne    1410 <main+0x2d0>
jmp    13e0 <main+0x2a0>
add    $0x4b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Loops: %d, changes: %d \0D\00"
@.str.1 = [21 x i8] c"\0A\0A-- Final Graph --\0A\00"
@.str.2 = [4 x i8] c" \00"
@.str.3 = [5 x i8] c"%2d \00"
@.str.4 = [9 x i8] c"\0A\0A%2d \00"
@.str.5 = [5 x i8] c"%c \00"
define void @main() {
%1 = alloca [17 x [17 x 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
store i32 0, i32* %2
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %3
br label %10
10: ; preds = %28, %0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 17
br i1 %12, label %13, label %31
13: ; preds = %10
store i32 0, i32* %4
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 17
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %19
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [17 x i32], [17 x i32]* %20, i64 0, i64 %22
store i32 0, i32* %23
br label %24
24: ; preds = %17
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %14
27: ; preds = %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %10
31: ; preds = %10
br label %32
32: ; preds = %124, %31
%33 = load i32, i32* %2
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %36, label %125
36: ; preds = %32
store i32 1, i32* %2
store i32 0, i32* %7
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
store i32 0, i32* %5
br label %39
39: ; preds = %113, %36
%40 = load i32, i32* %5
%41 = icmp slt i32 %40, 17
br i1 %41, label %42, label %116
42: ; preds = %39
store i32 0, i32* %4
br label %43
43: ; preds = %109, %42
%44 = load i32, i32* %4
%45 = load i32, i32* %5
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %112
47: ; preds = %43
store i32 0, i32* %3
br label %48
48: ; preds = %105, %47
%49 = load i32, i32* %3
%50 = load i32, i32* %4
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %108
52: ; preds = %48
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %54
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [17 x i32], [17 x i32]* %55, i64 0, i64 %57
%59 = load i32, i32* %58
store i32 %59, i32* %8
%60 = load i32, i32* %8
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %62
%64 = load i32, i32* %5
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [17 x i32], [17 x i32]* %63, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = icmp eq i32 %60, %67
br i1 %68, label %69, label %104
69: ; preds = %52
%70 = load i32, i32* %8
%71 = load i32, i32* %3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %72
%74 = load i32, i32* %5
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [17 x i32], [17 x i32]* %73, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = icmp eq i32 %70, %77
br i1 %78, label %79, label %104
79: ; preds = %69
%80 = call i32 (...) @rand()
%81 = srem i32 %80, 4
store i32 %81, i32* %9
%82 = load i32, i32* %7
%83 = add nsw i32 %82, 1
store i32 %83, i32* %7
store i32 0, i32* %2
%84 = call i32 (...) @rand()
%85 = srem i32 %84, 2
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %95
87: ; preds = %79
%88 = load i32, i32* %9
%89 = load i32, i32* %4
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %90
%92 = load i32, i32* %5
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [17 x i32], [17 x i32]* %91, i64 0, i64 %93
store i32 %88, i32* %94
br label %103
95: ; preds = %79
%96 = load i32, i32* %9
%97 = load i32, i32* %3
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %98
%100 = load i32, i32* %5
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [17 x i32], [17 x i32]* %99, i64 0, i64 %101
store i32 %96, i32* %102
br label %103
103: ; preds = %95, %87
br label %104
104: ; preds = %103, %69, %52
br label %105
105: ; preds = %104
%106 = load i32, i32* %3
%107 = add nsw i32 %106, 1
store i32 %107, i32* %3
br label %48
108: ; preds = %48
br label %109
109: ; preds = %108
%110 = load i32, i32* %4
%111 = add nsw i32 %110, 1
store i32 %111, i32* %4
br label %43
112: ; preds = %43
br label %113
113: ; preds = %112
%114 = load i32, i32* %5
%115 = add nsw i32 %114, 1
store i32 %115, i32* %5
br label %39
116: ; preds = %39
%117 = load i32, i32* %6
%118 = srem i32 %117, 1024
%119 = icmp ne i32 %118, 0
br i1 %119, label %124, label %120
120: ; preds = %116
%121 = load i32, i32* %6
%122 = load i32, i32* %7
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %121, i32 %122)
br label %124
124: ; preds = %120, %116
br label %32
125: ; preds = %32
%126 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %128
128: ; preds = %134, %125
%129 = load i32, i32* %4
%130 = icmp slt i32 %129, 17
br i1 %130, label %131, label %137
131: ; preds = %128
%132 = load i32, i32* %4
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %132)
br label %134
134: ; preds = %131
%135 = load i32, i32* %4
%136 = add nsw i32 %135, 1
store i32 %136, i32* %4
br label %128
137: ; preds = %128
store i32 0, i32* %3
br label %138
138: ; preds = %162, %137
%139 = load i32, i32* %3
%140 = icmp slt i32 %139, 17
br i1 %140, label %141, label %165
141: ; preds = %138
%142 = load i32, i32* %3
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %142)
store i32 0, i32* %4
br label %144
144: ; preds = %158, %141
%145 = load i32, i32* %4
%146 = load i32, i32* %3
%147 = icmp slt i32 %145, %146
br i1 %147, label %148, label %161
148: ; preds = %144
%149 = load i32, i32* %4
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %150
%152 = load i32, i32* %3
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [17 x i32], [17 x i32]* %151, i64 0, i64 %153
%155 = load i32, i32* %154
%156 = add nsw i32 %155, 97
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %156)
br label %158
158: ; preds = %148
%159 = load i32, i32* %4
%160 = add nsw i32 %159, 1
store i32 %160, i32* %4
br label %144
161: ; preds = %144
br label %162
162: ; preds = %161
%163 = load i32, i32* %3
%164 = add nsw i32 %163, 1
store i32 %164, i32* %3
br label %138
165: ; preds = %138
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Loops: %d, changes: %d \0D\00"
@.str.1 = [21 x i8] c"\0A\0A-- Final Graph --\0A\00"
@.str.2 = [4 x i8] c" \00"
@.str.3 = [5 x i8] c"%2d \00"
@.str.4 = [9 x i8] c"\0A\0A%2d \00"
@.str.5 = [5 x i8] c"%c \00"
define void @main() {
%1 = alloca [17 x [17 x i32]]
%2 = bitcast [17 x [17 x i32]]* %1 to i8*
br label %3
3: ; preds = %0, %58
%4 = phi i32 [ %53, %58 ], [ 0, %0 ]
br label %5
5: ; preds = %3, %47
%6 = phi i64 [ 0, %3 ], [ %50, %47 ]
%7 = phi i32 [ 1, %3 ], [ %49, %47 ]
%8 = phi i32 [ 0, %3 ], [ %48, %47 ]
%9 = icmp eq i64 %6, 0
br i1 %9, label %47, label %10
10: ; preds = %5, %42
%11 = phi i64 [ %45, %42 ], [ 0, %5 ]
%12 = phi i32 [ %44, %42 ], [ %7, %5 ]
%13 = phi i32 [ %43, %42 ], [ %8, %5 ]
%14 = icmp eq i64 %11, 0
br i1 %14, label %42, label %15
15: ; preds = %10
%16 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %11, i64 %6
br label %17
17: ; preds = %15, %37
%18 = phi i64 [ 0, %15 ], [ %40, %37 ]
%19 = phi i32 [ %12, %15 ], [ %39, %37 ]
%20 = phi i32 [ %13, %15 ], [ %38, %37 ]
%21 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %18, i64 %11
%22 = load i32, i32* %21
%23 = load i32, i32* %16
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %37
25: ; preds = %17
%26 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %18, i64 %6
%27 = load i32, i32* %26
%28 = icmp eq i32 %22, %27
br i1 %28, label %29, label %37
29: ; preds = %25
%30 = tail call i32 (...) @rand()
%31 = srem i32 %30, 4
%32 = add nsw i32 %20, 1
%33 = tail call i32 (...) @rand()
%34 = and i32 %33, 1
%35 = icmp eq i32 %34, 0
%36 = select i1 %35, i32* %26, i32* %16
store i32 %31, i32* %36
br label %37
37: ; preds = %29, %25, %17
%38 = phi i32 [ %20, %25 ], [ %20, %17 ], [ %32, %29 ]
%39 = phi i32 [ %19, %25 ], [ %19, %17 ], [ 0, %29 ]
%40 = add nuw nsw i64 %18, 1
%41 = icmp eq i64 %40, %11
br i1 %41, label %42, label %17
42: ; preds = %37, %10
%43 = phi i32 [ %13, %10 ], [ %38, %37 ]
%44 = phi i32 [ %12, %10 ], [ %39, %37 ]
%45 = add nuw nsw i64 %11, 1
%46 = icmp eq i64 %45, %6
br i1 %46, label %47, label %10
47: ; preds = %42, %5
%48 = phi i32 [ %8, %5 ], [ %43, %42 ]
%49 = phi i32 [ %7, %5 ], [ %44, %42 ]
%50 = add nuw nsw i64 %6, 1
%51 = icmp eq i64 %50, 17
br i1 %51, label %52, label %5
52: ; preds = %47
%53 = add nuw nsw i32 %4, 1
%54 = and i32 %53, 1023
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %53, i32 %48)
br label %58
58: ; preds = %56, %52
%59 = icmp eq i32 %49, 0
br i1 %59, label %3, label %60
60: ; preds = %58
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 0)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 1)
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 2)
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 3)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 5)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 6)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 7)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 8)
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 9)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 10)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 11)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 12)
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 13)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 14)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 15)
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 16)
br label %80
80: ; preds = %60, %93
%81 = phi i64 [ 0, %60 ], [ %94, %93 ]
%82 = trunc i64 %81 to i32
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %82)
%84 = icmp eq i64 %81, 0
br i1 %84, label %93, label %85
85: ; preds = %80, %85
%86 = phi i64 [ %91, %85 ], [ 0, %80 ]
%87 = getelementptr inbounds [17 x [17 x i32]], [17 x [17 x i32]]* %1, i64 0, i64 %86, i64 %81
%88 = load i32, i32* %87
%89 = add nsw i32 %88, 97
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %89)
%91 = add nuw nsw i64 %86, 1
%92 = icmp eq i64 %91, %81
br i1 %92, label %93, label %85
93: ; preds = %85, %80
%94 = add nuw nsw i64 %81, 1
%95 = icmp eq i64 %94, 17
br i1 %95, label %96, label %80
96: ; preds = %93
ret void
}