#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 */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ mode_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
char *RoomFilePath(char *, char *);
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ mkdir(char *, int);
int open(char *, int, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ write(int, char *, int);
void GenerateRooms(char *dirRooms, char *arrRooms[]) {
  ssize_t numRead;
  ssize_t numWrite;
  mode_t filePerms;
  int i, fd;
  FILE *fp;
  char buf[512];
  char *room;
  char *newDir;
  strcpy(newDir, "");
  strcat(newDir, dirRooms);
  mkdir(newDir, 0777);
  chmod(newDir, 0777);
  for (i = 0; i < 7; ++i) {
    printf("DEBUG arrRooms[i] set to: %s\n", arrRooms[i]);
    printf("DEBUG Room set to: %s\n", room);
    strcpy(room, "");
    printf("DEBUG Room set to: %s\n", room);
    strcat(room, arrRooms[i]);
    printf("DEBUG Room set to: %s\n", room);
    char *file;
    strcpy(file, "");
    printf("DEBUG file set to: %s\n", file);
    strcat(file, RoomFilePath(dirRooms, room));
    printf("DEBUG char* file set to: %s\n", file);
    fd = open(file, O_RDWR | O_CREAT, 0777);
    if (fd == -1) {
      fprintf(stderr, "Could not open the new file %s\n", file);
    } else {
      strcpy(buf, "");
      strcat(buf, "ROOM NAME: ");
      strcat(buf, arrRooms[i]);
      numWrite = write(fd, buf, 512);
      close(fd);
    }
  }
  for (i = 0; i < 7; ++i) {
  }
  return;
}


x86 assembly (clang, -O0):
<GenerateRooms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x240(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x240(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   10c0 <strcat@plt>
mov    -0x240(%rbp),%rdi
mov    $0x1ff,%esi
call   1040 <mkdir@plt>
mov    -0x240(%rbp),%rdi
mov    $0x1ff,%esi
call   10a0 <chmod@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x7,-0x20(%rbp)
jge    13ac <GenerateRooms+0x20c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xde4(%rip),%rdi
call   1060 <printf@plt>
mov    -0x238(%rbp),%rsi
lea    0xdef(%rip),%rdi
call   1060 <printf@plt>
mov    -0x238(%rbp),%rdi
lea    0xddb(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x238(%rbp),%rsi
lea    0xdc9(%rip),%rdi
call   1060 <printf@plt>
mov    -0x238(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10c0 <strcat@plt>
mov    -0x238(%rbp),%rsi
lea    0xd9e(%rip),%rdi
call   1060 <printf@plt>
mov    -0x248(%rbp),%rdi
lea    0xd8a(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x248(%rbp),%rsi
lea    0xd8f(%rip),%rdi
call   1060 <printf@plt>
mov    -0x248(%rbp),%rax
mov    %rax,-0x250(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x238(%rbp),%rsi
call   1090 <RoomFilePath@plt>
mov    -0x250(%rbp),%rdi
mov    %rax,%rsi
call   10c0 <strcat@plt>
mov    -0x248(%rbp),%rsi
lea    0xd66(%rip),%rdi
call   1060 <printf@plt>
mov    -0x248(%rbp),%rdi
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
mov    0x2cf6(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   10b0 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    133c <GenerateRooms+0x19c>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
mov    -0x248(%rbp),%rdx
lea    0xd37(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1399 <GenerateRooms+0x1f9>
lea    -0x230(%rbp),%rdi
lea    0xcd3(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x230(%rbp),%rdi
lea    0xd2c(%rip),%rsi
call   10c0 <strcat@plt>
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10c0 <strcat@plt>
mov    -0x24(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    $0x200,%edx
call   1050 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
jmp    139e <GenerateRooms+0x1fe>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ff <GenerateRooms+0x5f>
movl   $0x0,-0x20(%rbp)
cmpl   $0x7,-0x20(%rbp)
jge    13d0 <GenerateRooms+0x230>
jmp    13c2 <GenerateRooms+0x222>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13b3 <GenerateRooms+0x213>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenerateRooms>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xe5f(%rip),%r15
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,0x8(%rsp)
mov    %rbp,%rsi
call   10c0 <strcat@plt>
mov    $0x1ff,%esi
call   1040 <mkdir@plt>
mov    $0x1ff,%esi
call   10a0 <chmod@plt>
xor    %r14d,%r14d
lea    0xe2d(%rip),%r13
lea    0x10(%rsp),%rbp
jmp    124f <GenerateRooms+0xaf>
nopl   0x0(%rax,%rax,1)
mov    %eax,%r12d
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0xe71(%rip),%rsi
call   10c0 <strcat@plt>
mov    (%rbx,%r14,8),%rsi
mov    %rbp,%rdi
call   10c0 <strcat@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    $0x200,%edx
call   1050 <write@plt>
mov    %r12d,%edi
call   1070 <close@plt>
add    $0x1,%r14
cmp    $0x7,%r14
je     12f9 <GenerateRooms+0x159>
mov    (%rbx,%r14,8),%rsi
lea    0xda6(%rip),%rdi
call   1060 <printf@plt>
mov    %r13,%rdi
call   1060 <printf@plt>
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r13,%rdi
call   1060 <printf@plt>
mov    (%rbx,%r14,8),%rsi
call   10c0 <strcat@plt>
mov    %r13,%rdi
call   1060 <printf@plt>
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xd9e(%rip),%rdi
call   1060 <printf@plt>
mov    0x8(%rsp),%rdi
call   1090 <RoomFilePath@plt>
mov    %rax,%rsi
call   10c0 <strcat@plt>
lea    0xd97(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d37(%rip),%rax
mov    (%rax),%esi
mov    0x2d16(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
jne    1200 <GenerateRooms+0x60>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
lea    0xd7a(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1241 <GenerateRooms+0xa1>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [30 x i8] c"DEBUG arrRooms[i] set to: %s\0A\00"
@.str.2 = [23 x i8] c"DEBUG Room set to: %s\0A\00"
@.str.3 = [23 x i8] c"DEBUG file set to: %s\0A\00"
@.str.4 = [29 x i8] c"DEBUG char* file set to: %s\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@stderr = global i32 0
@.str.5 = [32 x i8] c"Could not open the new file %s\0A\00"
@.str.6 = [12 x i8] c"ROOM NAME: \00"
define void @GenerateRooms(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca [512 x i8]
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%15 = load i8*, i8** %13
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %13
%18 = load i8*, i8** %3
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %13
%21 = call i32 @mkdir(i8* %20, i32 511)
%22 = load i8*, i8** %13
%23 = call i32 @chmod(i8* %22, i32 511)
store i32 0, i32* %8
br label %24
24: ; preds = %89, %2
%25 = load i32, i32* %8
%26 = icmp slt i32 %25, 7
br i1 %26, label %27, label %92
27: ; preds = %24
%28 = load i8**, i8*** %4
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = load i8*, i8** %12
%35 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %12
%37 = call i32 @strcpy(i8* %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%38 = load i8*, i8** %12
%39 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = load i8*, i8** %12
%41 = load i8**, i8*** %4
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @strcat(i8* %40, i8* %45)
%47 = load i8*, i8** %12
%48 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = load i8*, i8** %14
%50 = call i32 @strcpy(i8* %49, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%51 = load i8*, i8** %14
%52 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = load i8*, i8** %14
%54 = load i8*, i8** %3
%55 = load i8*, i8** %12
%56 = call i8* @RoomFilePath(i8* %54, i8* %55)
%57 = call i32 @strcat(i8* %53, i8* %56)
%58 = load i8*, i8** %14
%59 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = load i8*, i8** %14
%61 = load i32, i32* @O_RDWR
%62 = load i32, i32* @O_CREAT
%63 = or i32 %61, %62
%64 = call i32 @open(i8* %60, i32 %63, i32 511)
store i32 %64, i32* %9
%65 = load i32, i32* %9
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %71
67: ; preds = %27
%68 = load i32, i32* @stderr
%69 = load i8*, i8** %14
%70 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %69)
br label %88
71: ; preds = %27
%72 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%73 = call i32 @strcpy(i8* %72, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%74 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%75 = call i32 @strcat(i8* %74, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%76 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%77 = load i8**, i8*** %4
%78 = load i32, i32* %8
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = call i32 @strcat(i8* %76, i8* %81)
%83 = load i32, i32* %9
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%85 = call i32 @write(i32 %83, i8* %84, i32 512)
store i32 %85, i32* %6
%86 = load i32, i32* %9
%87 = call i32 @close(i32 %86)
br label %88
88: ; preds = %71, %67
br label %89
89: ; preds = %88
%90 = load i32, i32* %8
%91 = add nsw i32 %90, 1
store i32 %91, i32* %8
br label %24
92: ; preds = %24
store i32 0, i32* %8
br label %93
93: ; preds = %97, %92
%94 = load i32, i32* %8
%95 = icmp slt i32 %94, 7
br i1 %95, label %96, label %100
96: ; preds = %93
br label %97
97: ; preds = %96
%98 = load i32, i32* %8
%99 = add nsw i32 %98, 1
store i32 %99, i32* %8
br label %93
100: ; preds = %93
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [30 x i8] c"DEBUG arrRooms[i] set to: %s\0A\00"
@.str.2 = [23 x i8] c"DEBUG Room set to: %s\0A\00"
@.str.3 = [23 x i8] c"DEBUG file set to: %s\0A\00"
@.str.4 = [29 x i8] c"DEBUG char* file set to: %s\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@stderr = global i32 0
@.str.5 = [32 x i8] c"Could not open the new file %s\0A\00"
@.str.6 = [12 x i8] c"ROOM NAME: \00"
define void @GenerateRooms(i8* %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strcpy(i8* undef, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcat(i8* undef, i8* %0)
%7 = tail call i32 @mkdir(i8* undef, i32 511)
%8 = tail call i32 @chmod(i8* undef, i32 511)
br label %9
9: ; preds = %2, %40
%10 = phi i64 [ 0, %2 ], [ %41, %40 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* undef)
%15 = call i32 @strcpy(i8* undef, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* undef)
%17 = load i8*, i8** %11
%18 = call i32 @strcat(i8* undef, i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* undef)
%20 = call i32 @strcpy(i8* undef, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* undef)
%22 = call i8* @RoomFilePath(i8* %0, i8* undef)
%23 = call i32 @strcat(i8* undef, i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* undef)
%25 = load i32, i32* @O_RDWR
%26 = load i32, i32* @O_CREAT
%27 = or i32 %26, %25
%28 = call i32 @open(i8* undef, i32 %27, i32 511)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %9
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* undef)
br label %40
33: ; preds = %9
%34 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%35 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%36 = load i8*, i8** %11
%37 = call i32 @strcat(i8* %4, i8* %36)
%38 = call i32 @write(i32 %28, i8* %4, i32 512)
%39 = call i32 @close(i32 %28)
br label %40
40: ; preds = %33, %30
%41 = add nuw nsw i64 %10, 1
%42 = icmp eq i64 %41, 7
br i1 %42, label %43, label %9
43: ; preds = %40
ret void
}