#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 rand();
void addRandomEntrances(int (*maze)[25]) {
  int rndStartRow = 0, rndStartCol = 0;
  int rndEndRow = 13 - 1, rndEndCol = 25 - 1;
  if ((rand() % 3) == 1) {
    rndStartRow = (rand() % (13 - 2) + 1);
    if (rndStartRow % 2 == 0)
      rndStartRow++;
    rndEndRow = (rand() % (13 - 2) + 1);
    if (rndEndRow % 2 == 0)
      rndEndRow++;
  } else {
    rndStartCol = (rand() % (25 - 2) + 1);
    if (rndStartCol % 2 == 0)
      rndStartCol++;
    rndEndCol = (rand() % (25 - 2) + 1);
    if (rndEndCol % 2 == 0)
      rndEndCol++;
  }
  maze[rndStartRow][rndStartCol] = 0;
  maze[rndEndRow][rndEndCol] = 0;
}


x86 assembly (clang, -O0):
<addRandomEntrances>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0xc,-0x14(%rbp)
movl   $0x18,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11b9 <addRandomEntrances+0xa9>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xb,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1182 <addRandomEntrances+0x72>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xb,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b4 <addRandomEntrances+0xa4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1222 <addRandomEntrances+0x112>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x17,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11eb <addRandomEntrances+0xdb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x17,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    121d <addRandomEntrances+0x10d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1222 <addRandomEntrances+0x112>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addRandomEntrances>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rbx
imul   $0x55555556,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cmp    $0x1,%ebx
jne    11bf <addRandomEntrances+0xaf>
movslq %eax,%rcx
imul   $0x2e8ba2e9,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
mov    %eax,%edx
sub    %ecx,%edx
add    $0x1,%edx
neg    %ecx
test   $0x1,%dl
lea    0x2(%rax,%rcx,1),%ebx
cmovne %edx,%ebx
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
mov    %eax,%edx
sub    %ecx,%edx
add    $0x1,%edx
neg    %ecx
test   $0x1,%dl
lea    0x2(%rax,%rcx,1),%eax
cmovne %edx,%eax
movslq %ebx,%rbx
movslq %eax,%rcx
mov    $0x18,%eax
jmp    1234 <addRandomEntrances+0x124>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
test   $0x1,%dl
lea    0x2(%rax,%rcx,1),%ebp
cmovne %edx,%ebp
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
lea    (%rax,%rcx,1),%edx
add    $0x1,%edx
test   $0x1,%dl
lea    0x2(%rax,%rcx,1),%eax
cmovne %edx,%eax
movslq %ebp,%r15
cltq
mov    $0xc,%ecx
imul   $0x64,%rbx,%rdx
add    %r14,%rdx
movl   $0x0,(%rdx,%r15,4)
imul   $0x64,%rcx,%rcx
add    %r14,%rcx
movl   $0x0,(%rcx,%rax,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @addRandomEntrances([25 x i32]* %0) {
%2 = alloca [25 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [25 x i32]* %0, [25 x i32]** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 12, i32* %5
store i32 24, i32* %6
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %31
10: ; preds = %1
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = srem i32 %14, 2
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %10
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 11
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
%24 = load i32, i32* %5
%25 = srem i32 %24, 2
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %20
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %30
30: ; preds = %27, %20
br label %52
31: ; preds = %1
%32 = call i32 (...) @rand()
%33 = srem i32 %32, 23
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = srem i32 %35, 2
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %31
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %41
41: ; preds = %38, %31
%42 = call i32 (...) @rand()
%43 = srem i32 %42, 23
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
%45 = load i32, i32* %6
%46 = srem i32 %45, 2
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %51
51: ; preds = %48, %41
br label %52
52: ; preds = %51, %30
%53 = load [25 x i32]*, [25 x i32]** %2
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [25 x i32], [25 x i32]* %53, i64 %55
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [25 x i32], [25 x i32]* %56, i64 0, i64 %58
store i32 0, i32* %59
%60 = load [25 x i32]*, [25 x i32]** %2
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [25 x i32], [25 x i32]* %60, i64 %62
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [25 x i32], [25 x i32]* %63, i64 0, i64 %65
store i32 0, i32* %66
ret void
}

LLVM IR (-O2):
define void @addRandomEntrances([25 x i32]* nocapture writeonly %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 3
%4 = icmp eq i32 %3, 1
%5 = tail call i32 (...) @rand()
br i1 %4, label %6, label %22
6: ; preds = %1
%7 = srem i32 %5, 11
%8 = add nsw i32 %7, 1
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
%11 = add nsw i32 %7, 2
%12 = select i1 %10, i32 %11, i32 %8
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 11
%15 = add nsw i32 %14, 1
%16 = and i32 %15, 1
%17 = icmp eq i32 %16, 0
%18 = add nsw i32 %14, 2
%19 = select i1 %17, i32 %18, i32 %15
%20 = sext i32 %12 to i64
%21 = sext i32 %19 to i64
br label %38
22: ; preds = %1
%23 = srem i32 %5, 23
%24 = add nsw i32 %23, 1
%25 = and i32 %24, 1
%26 = icmp eq i32 %25, 0
%27 = add nsw i32 %23, 2
%28 = select i1 %26, i32 %27, i32 %24
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 23
%31 = add nsw i32 %30, 1
%32 = and i32 %31, 1
%33 = icmp eq i32 %32, 0
%34 = add nsw i32 %30, 2
%35 = select i1 %33, i32 %34, i32 %31
%36 = sext i32 %28 to i64
%37 = sext i32 %35 to i64
br label %38
38: ; preds = %22, %6
%39 = phi i64 [ %20, %6 ], [ 0, %22 ]
%40 = phi i64 [ 0, %6 ], [ %36, %22 ]
%41 = phi i64 [ %21, %6 ], [ 12, %22 ]
%42 = phi i64 [ 24, %6 ], [ %37, %22 ]
%43 = getelementptr inbounds [25 x i32], [25 x i32]* %0, i64 %39, i64 %40
store i32 0, i32* %43
%44 = getelementptr inbounds [25 x i32], [25 x i32]* %0, i64 %41, i64 %42
store i32 0, i32* %44
ret void
}