#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, int /*<<< orphan*/);
void route(int maze[5][5]) {
  int i = 0, j = 0;
  while (i < 5) {
    if ((maze[i][j] == 0) && (j < 5))
      printf("%d, %d\n", i, j++);
    else {
      --j, i++;
    }
  }
}


x86 assembly (clang, -O0):
<route>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1191 <route+0x81>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    117a <route+0x6a>
cmpl   $0x5,-0x10(%rbp)
jge    117a <route+0x6a>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <route+0x7c>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <route+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<route>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
xor    %edx,%edx
lea    0xedd(%rip),%r14
xor    %ebp,%ebp
jmp    113b <route+0x2b>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%edx
add    $0x1,%ebp
cmp    $0x5,%ebp
jge    1168 <route+0x58>
movslq %ebp,%rax
movslq %edx,%rcx
lea    (%rax,%rax,4),%rax
lea    (%r15,%rax,4),%rax
cmpl   $0x0,(%rax,%rcx,4)
jne    1130 <route+0x20>
cmp    $0x4,%edx
jg     1130 <route+0x20>
lea    0x1(%rdx),%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %ebx,%edx
cmp    $0x5,%ebp
jl     113b <route+0x2b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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