#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*/ GenerateRooms(char *, char **);
int /*<<< orphan*/ Introduction();
int getpid();
char *malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
int main() {
  srand(1000);
  const char *dirRoomBase = "reitanc.rooms.";
  char dirPid[16];
  int procPid = getpid();
  sprintf(dirPid, "%u", procPid);
  char *dirRoom;
  dirRoom = malloc(strlen(dirRoomBase) + strlen(dirPid) + 1);
  strcpy(dirRoom, dirRoomBase);
  strcat(dirRoom, dirPid);
  char *roomNames[] = {"Diablo",    "Crypt",       "Rivendell",  "Skyrim",
                       "Morrowind", "Destiny-SGU", "Transporter"};
  GenerateRooms(dirRoom, roomNames);
  Introduction();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3e8,%edi
call   1070 <srand@plt>
lea    0xe3d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe30(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x78(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x78(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10b0 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0x2bad(%rip),%rsi
mov    $0x38,%edx
call   1080 <memcpy@plt>
mov    -0x30(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <GenerateRooms@plt>
mov    $0x0,%al
call   10a0 <Introduction@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    $0x3e8,%edi
call   1070 <srand@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xe60(%rip),%rsi
lea    0x40(%rsp),%r14
mov    %r14,%rdi
mov    %eax,%edx
call   10b0 <sprintf@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    0xf(%rax),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
lea    0xe27(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <strcat@plt>
mov    0x2c1d(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0x2c01(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2be5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2bc9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <GenerateRooms@plt>
xor    %eax,%eax
call   1090 <Introduction@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"reitanc.rooms.\00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [7 x i8] c"Diablo\00"
@.str.3 = [6 x i8] c"Crypt\00"
@.str.4 = [10 x i8] c"Rivendell\00"
@.str.5 = [7 x i8] c"Skyrim\00"
@.str.6 = [10 x i8] c"Morrowind\00"
@.str.7 = [12 x i8] c"Destiny-SGU\00"
@.str.8 = [12 x i8] c"Transporter\00"
@__const.main.roomNames = [7 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [16 x i8]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [7 x i8*]
store i32 0, i32* %1
%7 = call i32 @srand(i32 1000)
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
%8 = call i32 (...) @getpid()
store i32 %8, i32* %4
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i8*, i8** %2
%13 = call i64 @strlen(i8* %12)
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%15 = call i64 @strlen(i8* %14)
%16 = add nsw i64 %13, %15
%17 = add nsw i64 %16, 1
%18 = call i8* @malloc(i64 %17)
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = load i8*, i8** %2
%21 = call i32 @strcpy(i8* %19, i8* %20)
%22 = load i8*, i8** %5
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%24 = call i32 @strcat(i8* %22, i8* %23)
%25 = bitcast [7 x i8*]* %6 to i8*
%26 = load i8*, i8** %5
%27 = getelementptr inbounds [7 x i8*], [7 x i8*]* %6, i64 0, i64 0
%28 = call i32 @GenerateRooms(i8* %26, i8** %27)
%29 = call i32 (...) @Introduction()
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"reitanc.rooms.\00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [7 x i8] c"Diablo\00"
@.str.3 = [6 x i8] c"Crypt\00"
@.str.4 = [10 x i8] c"Rivendell\00"
@.str.5 = [7 x i8] c"Skyrim\00"
@.str.6 = [10 x i8] c"Morrowind\00"
@.str.7 = [12 x i8] c"Destiny-SGU\00"
@.str.8 = [12 x i8] c"Transporter\00"
@__const.main.roomNames = [7 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i32 0, i32 0)]
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [7 x i8*]
%3 = tail call i32 @srand(i32 1000)
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%5 = tail call i32 (...) @getpid()
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i64 @strlen(i8* %4)
%8 = add nsw i64 %7, 15
%9 = tail call i8* @malloc(i64 %8)
%10 = tail call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @strcat(i8* %9, i8* %4)
%12 = bitcast [7 x i8*]* %2 to i8*
%13 = getelementptr inbounds [7 x i8*], [7 x i8*]* %2, i64 0, i64 0
%14 = call i32 @GenerateRooms(i8* %9, i8** %13)
%15 = call i32 (...) @Introduction()
ret i32 0
}