#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();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int mapGenerator(char **array) {
  int a;
  int b;
  int i;
  i = 0;
  srand(time(NULL));
  while (i < 30) {
    a = (rand() % (7)) + 1;
    b = (rand() % (7)) + 1;
    array[a][b] = ' ';
    i++;
  }
  a = (rand() % (6)) + 2;
  b = (rand() % (6)) + 2;
  array[4][4] = 'X';
  array[4][5] = ' ';
  array[5][4] = ' ';
  array[3][4] = ' ';
  array[4][3] = ' ';
  array[a][b] = '*';
}


x86 assembly (clang, -O0):
<mapGenerator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
cmpl   $0x1e,-0x1c(%rbp)
jge    11a9 <mapGenerator+0x79>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1153 <mapGenerator+0x23>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movb   $0x58,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movb   $0x20,0x5(%rax)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
movb   $0x20,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movb   $0x20,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movb   $0x20,0x3(%rax)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movb   $0x2a,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapGenerator>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x1e,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%rbx
shr    $0x20,%rbx
add    %eax,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0x2,%ebx
add    %ecx,%ebx
lea    0x0(,%rbx,8),%ecx
sub    %ecx,%ebx
add    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movslq %ebx,%rcx
mov    0x8(%r14,%rcx,8),%rcx
movb   $0x20,0x1(%rax,%rcx,1)
add    $0xffffffff,%ebp
jne    1150 <mapGenerator+0x20>
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbp
imul   $0x2aaaaaab,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebp
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
cltq
mov    0x20(%r14),%rcx
movb   $0x58,0x4(%rcx)
mov    0x20(%r14),%rcx
movb   $0x20,0x5(%rcx)
mov    0x28(%r14),%rcx
movb   $0x20,0x4(%rcx)
mov    0x18(%r14),%rcx
movb   $0x20,0x4(%rcx)
mov    0x20(%r14),%rcx
movb   $0x20,0x3(%rcx)
movslq %ebp,%rcx
mov    0x10(%r14,%rcx,8),%rcx
movb   $0x2a,0x2(%rax,%rcx,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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