#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*/ dirs;

/* Variables and functions */
int /*<<< orphan*/ opendir(char const *);
int /*<<< orphan*/ u_bomb(char *, char const *);
void u_check_art_directory(void) {
  const char *dirs[] = {
      "art/",
      "art/"
      "gui",
      "art/"
      "items",
      "art/"
      "screenshots",
      "art/"
      "sprites",
      "art/"
      "tiles",
  };
  for (int i = 0; i < ((int)(sizeof(dirs) / sizeof(*dirs))); i++)
    if (!opendir(dirs[i]))
      u_bomb("error: missing directory %s\n", dirs[i]);
}


x86 assembly (clang, -O0):
<u_check_art_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1050 <memset@plt>
lea    0xeb1(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xeab(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeac(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x6,-0x34(%rbp)
jge    11da <u_check_art_directory+0xaa>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <opendir@plt>
cmp    $0x0,%eax
jne    11c7 <u_check_art_directory+0x97>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xe7b(%rip),%rdi
call   1040 <u_bomb@plt>
jmp    11cc <u_check_art_directory+0x9c>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1191 <u_check_art_directory+0x61>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_check_art_directory>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <opendir@plt>
test   %eax,%eax
jne    1144 <u_check_art_directory+0x24>
lea    0xf05(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1040 <u_bomb@plt>
lea    0xeba(%rip),%rdi
call   1030 <opendir@plt>
test   %eax,%eax
jne    1167 <u_check_art_directory+0x47>
lea    0xee2(%rip),%rdi
lea    0xea3(%rip),%rsi
call   1040 <u_bomb@plt>
lea    0xe9f(%rip),%rdi
call   1030 <opendir@plt>
test   %eax,%eax
jne    118a <u_check_art_directory+0x6a>
lea    0xebf(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1040 <u_bomb@plt>
lea    0xe86(%rip),%rdi
call   1030 <opendir@plt>
test   %eax,%eax
jne    11ad <u_check_art_directory+0x8d>
lea    0xe9c(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <u_bomb@plt>
lea    0xe73(%rip),%rdi
call   1030 <opendir@plt>
test   %eax,%eax
jne    11d0 <u_check_art_directory+0xb0>
lea    0xe79(%rip),%rdi
lea    0xe5c(%rip),%rsi
call   1040 <u_bomb@plt>
lea    0xe5c(%rip),%rdi
call   1030 <opendir@plt>
test   %eax,%eax
je     11e2 <u_check_art_directory+0xc2>
pop    %rax
ret
lea    0xe54(%rip),%rdi
lea    0xe43(%rip),%rsi
pop    %rax
jmp    1040 <u_bomb@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"art/\00"
@.str.1 = [8 x i8] c"art/gui\00"
@.str.2 = [10 x i8] c"art/items\00"
@.str.3 = [16 x i8] c"art/screenshots\00"
@.str.4 = [12 x i8] c"art/sprites\00"
@.str.5 = [10 x i8] c"art/tiles\00"
@.str.6 = [29 x i8] c"error: missing directory %s\0A\00"
define void @u_check_art_directory() {
%1 = alloca [6 x i8*]
%2 = alloca i32
%3 = bitcast [6 x i8*]* %1 to i8*
%4 = bitcast i8* %3 to [6 x i8*]*
%5 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %5
%6 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i32 0, i32 1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8** %6
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i32 0, i32 2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i32 0, i32 3
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i32 0, i32 4
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %4, i32 0, i32 5
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i32 0, i32 0), i8** %10
store i32 0, i32* %2
br label %11
11: ; preds = %28, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 6
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @opendir(i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %14
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %21, %14
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %11
31: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"art/\00"
@.str.1 = [8 x i8] c"art/gui\00"
@.str.2 = [10 x i8] c"art/items\00"
@.str.3 = [16 x i8] c"art/screenshots\00"
@.str.4 = [12 x i8] c"art/sprites\00"
@.str.5 = [10 x i8] c"art/tiles\00"
@.str.6 = [29 x i8] c"error: missing directory %s\0A\00"
define void @u_check_art_directory() {
%1 = tail call i32 @opendir(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = tail call i32 @opendir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = tail call i32 @opendir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = tail call i32 @opendir(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = tail call i32 @opendir(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = tail call i32 @opendir(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @u_bomb(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
ret void
}