#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*/ draw_region(int, int, int, int, char);
int rand();
int /*<<< orphan*/ rand_place(char, int);
int rr(int, int, int);
void init_map(void) {
  int i, x1, x2, y1, y2;
  draw_region(0, 128 - 1, 0, 64, '.');
  for (i = 0; i < 200; i++) {
    int r = rand();
    x1 = rr(1, 128 - 20, r);
    x2 = rr(x1 + 5, x1 + 19, r);
    y1 = rr(1, 64 - 8, r);
    y2 = rr(y1 + 3, y1 + 7, r);
    draw_region(x1, x2, y1, y2, ' ');
  }
  rand_place('@', 5);
  for (i = 0; i < 10; i++) {
    rand_place('m', 2);
  }
}


x86 assembly (clang, -O0):
<init_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edx,%edx
mov    $0x7f,%esi
mov    $0x40,%ecx
mov    $0x2e,%r8d
mov    %edx,%edi
call   1030 <draw_region@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xc8,-0x4(%rbp)
jge    11fc <init_map+0xbc>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
mov    $0x6c,%esi
call   1040 <rr@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
add    $0x5,%edi
mov    -0x8(%rbp),%esi
add    $0x13,%esi
mov    -0x18(%rbp),%edx
call   1040 <rr@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
mov    $0x38,%esi
call   1040 <rr@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
add    $0x3,%edi
mov    -0x10(%rbp),%esi
add    $0x7,%esi
mov    -0x18(%rbp),%edx
call   1040 <rr@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    $0x20,%r8d
call   1030 <draw_region@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <init_map+0x28>
mov    $0x40,%edi
mov    $0x5,%esi
call   1050 <rand_place@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1239 <init_map+0xf9>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <init_map+0xd2>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_map>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %edi,%edi
mov    $0x7f,%esi
xor    %edx,%edx
mov    $0x40,%ecx
mov    $0x2e,%r8d
call   1030 <draw_region@plt>
mov    $0xc8,%r12d
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x6c,%esi
mov    %eax,%edx
call   1040 <rr@plt>
mov    %eax,%r14d
lea    0x5(%r14),%edi
lea    0x13(%r14),%esi
mov    %ebx,%edx
call   1040 <rr@plt>
mov    %eax,%r15d
mov    $0x1,%edi
mov    $0x38,%esi
mov    %ebx,%edx
call   1040 <rr@plt>
mov    %eax,%ebp
lea    0x3(%rbp),%edi
lea    0x7(%rbp),%esi
mov    %ebx,%edx
call   1040 <rr@plt>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
mov    $0x20,%r8d
call   1030 <draw_region@plt>
add    $0xffffffff,%r12d
jne    1170 <init_map+0x30>
mov    $0x40,%edi
mov    $0x5,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
call   1050 <rand_place@plt>
mov    $0x6d,%edi
mov    $0x2,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <rand_place@plt>

LLVM IR (-O0):
define void @init_map() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 @draw_region(i32 0, i32 127, i32 0, i32 64, i8 signext 46)
store i32 0, i32* %1
br label %8
8: ; preds = %34, %0
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 200
br i1 %10, label %11, label %37
11: ; preds = %8
%12 = call i32 (...) @rand()
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = call i32 @rr(i32 1, i32 108, i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 5
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 19
%19 = load i32, i32* %6
%20 = call i32 @rr(i32 %16, i32 %18, i32 %19)
store i32 %20, i32* %3
%21 = load i32, i32* %6
%22 = call i32 @rr(i32 1, i32 56, i32 %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 3
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 7
%27 = load i32, i32* %6
%28 = call i32 @rr(i32 %24, i32 %26, i32 %27)
store i32 %28, i32* %5
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = call i32 @draw_region(i32 %29, i32 %30, i32 %31, i32 %32, i8 signext 32)
br label %34
34: ; preds = %11
%35 = load i32, i32* %1
%36 = add nsw i32 %35, 1
store i32 %36, i32* %1
br label %8
37: ; preds = %8
%38 = call i32 @rand_place(i8 signext 64, i32 5)
store i32 0, i32* %1
br label %39
39: ; preds = %44, %37
%40 = load i32, i32* %1
%41 = icmp slt i32 %40, 10
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = call i32 @rand_place(i8 signext 109, i32 2)
br label %44
44: ; preds = %42
%45 = load i32, i32* %1
%46 = add nsw i32 %45, 1
store i32 %46, i32* %1
br label %39
47: ; preds = %39
ret void
}

LLVM IR (-O2):
define void @init_map() {
%1 = tail call i32 @draw_region(i32 0, i32 127, i32 0, i32 64, i8 signext 46)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %14, %2 ]
%4 = tail call i32 (...) @rand()
%5 = tail call i32 @rr(i32 1, i32 108, i32 %4)
%6 = add nsw i32 %5, 5
%7 = add nsw i32 %5, 19
%8 = tail call i32 @rr(i32 %6, i32 %7, i32 %4)
%9 = tail call i32 @rr(i32 1, i32 56, i32 %4)
%10 = add nsw i32 %9, 3
%11 = add nsw i32 %9, 7
%12 = tail call i32 @rr(i32 %10, i32 %11, i32 %4)
%13 = tail call i32 @draw_region(i32 %5, i32 %8, i32 %9, i32 %12, i8 signext 32)
%14 = add nuw nsw i32 %3, 1
%15 = icmp eq i32 %14, 200
br i1 %15, label %16, label %2
16: ; preds = %2
%17 = tail call i32 @rand_place(i8 signext 64, i32 5)
%18 = tail call i32 @rand_place(i8 signext 109, i32 2)
%19 = tail call i32 @rand_place(i8 signext 109, i32 2)
%20 = tail call i32 @rand_place(i8 signext 109, i32 2)
%21 = tail call i32 @rand_place(i8 signext 109, i32 2)
%22 = tail call i32 @rand_place(i8 signext 109, i32 2)
%23 = tail call i32 @rand_place(i8 signext 109, i32 2)
%24 = tail call i32 @rand_place(i8 signext 109, i32 2)
%25 = tail call i32 @rand_place(i8 signext 109, i32 2)
%26 = tail call i32 @rand_place(i8 signext 109, i32 2)
%27 = tail call i32 @rand_place(i8 signext 109, i32 2)
ret void
}