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

/* Variables and functions */
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ ban_setconfig(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ mode_setconfig(char *);
int /*<<< orphan*/ note_setconfig(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ userdb_setconfig(char *);
int /*<<< orphan*/ var_setconfig(char *);
int text_setup_database(const char *dir, const char *a, const char *b,
                        const char *c, const char *d) {
  FILE *cfg;
  char filename[1024];
  snprintf(filename, 1024, "%s/bans.conf", dir);
  ban_setconfig(filename);
  if (access(filename, R_OK) == 0) {
    printf("Ban file `%s' already exists.\n", filename);
  } else {
    if ((cfg = fopen(filename, "w")) == NULL) {
      printf("Could not open `%s' for writing.\n", filename);
      perror("   ");
      return -1;
    }
    fprintf(cfg, "[bans]\n");
    fclose(cfg);
    printf("Created ban file `%s'.\n", filename);
  }
  snprintf(filename, 1024, "%s/modes.conf", dir);
  mode_setconfig(filename);
  if (access(filename, R_OK) == 0) {
    printf("Mode file `%s' already exists.\n", filename);
  } else {
    if ((cfg = fopen(filename, "w")) == NULL) {
      printf("Could not open `%s' for writing.\n", filename);
      perror("   ");
      return -1;
    }
    fprintf(cfg, "[modes]\n");
    fclose(cfg);
    printf("Created mode file `%s'.\n", filename);
  }
  snprintf(filename, 1024, "%s/notes.conf", dir);
  note_setconfig(filename);
  if (access(filename, R_OK) == 0) {
    printf("Note file `%s' already exists.\n", filename);
  } else {
    if ((cfg = fopen(filename, "w")) == NULL) {
      printf("Could not open `%s' for writing.\n", filename);
      perror("   ");
      return -1;
    }
    fprintf(cfg, "[notes]\n");
    fclose(cfg);
    printf("Created note file `%s'.\n", filename);
  }
  snprintf(filename, 1024, "%s/users.conf", dir);
  userdb_setconfig(filename);
  if (access(filename, R_OK) == 0) {
    printf("User file `%s' already exists.\n", filename);
  } else {
    if ((cfg = fopen(filename, "w")) == NULL) {
      printf("Could not open `%s' for writing.\n", filename);
      perror("   ");
      return -1;
    }
    fprintf(cfg, "[users]\n\n\n");
    fprintf(cfg, "[masks]\n");
    fclose(cfg);
    printf("Created user file `%s'.\n", filename);
  }
  snprintf(filename, 1024, "%s/vars.conf", dir);
  var_setconfig(filename);
  if (access(filename, R_OK) == 0) {
    printf("Variable file `%s' already exists.\n", filename);
  } else {
    if ((cfg = fopen(filename, "w")) == NULL) {
      printf("Could not open `%s' for writing.\n", filename);
      perror("   ");
      return -1;
    }
    fprintf(cfg, "[vars]\n");
    fclose(cfg);
    printf("Created variable file `%s'.\n\n", filename);
  }
  return 0;
}


x86 assembly (clang, -O0):
<text_setup_database>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xe0a(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x440(%rbp),%rdi
call   1030 <ban_setconfig@plt>
lea    -0x440(%rbp),%rdi
mov    0x2dcb(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
jne    123e <text_setup_database+0x7e>
lea    -0x440(%rbp),%rsi
lea    0xdd9(%rip),%rdi
call   1070 <printf@plt>
jmp    12b6 <text_setup_database+0xf6>
lea    -0x440(%rbp),%rdi
lea    0xde0(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    128a <text_setup_database+0xca>
lea    -0x440(%rbp),%rsi
lea    0xdc1(%rip),%rdi
call   1070 <printf@plt>
lea    0xdd7(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1629 <text_setup_database+0x469>
mov    -0x38(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x440(%rbp),%rsi
lea    0xdab(%rip),%rdi
call   1070 <printf@plt>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xda7(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x440(%rbp),%rdi
call   1060 <mode_setconfig@plt>
lea    -0x440(%rbp),%rdi
mov    0x2cf4(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
jne    1315 <text_setup_database+0x155>
lea    -0x440(%rbp),%rsi
lea    0xd77(%rip),%rdi
call   1070 <printf@plt>
jmp    138d <text_setup_database+0x1cd>
lea    -0x440(%rbp),%rdi
lea    0xd09(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1361 <text_setup_database+0x1a1>
lea    -0x440(%rbp),%rsi
lea    0xcea(%rip),%rdi
call   1070 <printf@plt>
lea    0xd00(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1629 <text_setup_database+0x469>
mov    -0x38(%rbp),%rdi
lea    0xd36(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x440(%rbp),%rsi
lea    0xd23(%rip),%rdi
call   1070 <printf@plt>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xd20(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x440(%rbp),%rdi
call   1040 <note_setconfig@plt>
lea    -0x440(%rbp),%rdi
mov    0x2c1d(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
jne    13ec <text_setup_database+0x22c>
lea    -0x440(%rbp),%rsi
lea    0xcf0(%rip),%rdi
call   1070 <printf@plt>
jmp    1464 <text_setup_database+0x2a4>
lea    -0x440(%rbp),%rdi
lea    0xc32(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1438 <text_setup_database+0x278>
lea    -0x440(%rbp),%rsi
lea    0xc13(%rip),%rdi
call   1070 <printf@plt>
lea    0xc29(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1629 <text_setup_database+0x469>
mov    -0x38(%rbp),%rdi
lea    0xcaf(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x440(%rbp),%rsi
lea    0xc9c(%rip),%rdi
call   1070 <printf@plt>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xc99(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x440(%rbp),%rdi
call   1080 <userdb_setconfig@plt>
lea    -0x440(%rbp),%rdi
mov    0x2b46(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
jne    14c3 <text_setup_database+0x303>
lea    -0x440(%rbp),%rsi
lea    0xc69(%rip),%rdi
call   1070 <printf@plt>
jmp    154b <text_setup_database+0x38b>
lea    -0x440(%rbp),%rdi
lea    0xb5b(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    150f <text_setup_database+0x34f>
lea    -0x440(%rbp),%rsi
lea    0xb3c(%rip),%rdi
call   1070 <printf@plt>
lea    0xb52(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1629 <text_setup_database+0x469>
mov    -0x38(%rbp),%rdi
lea    0xc28(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xc23(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x440(%rbp),%rsi
lea    0xc10(%rip),%rdi
call   1070 <printf@plt>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xc0d(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x440(%rbp),%rdi
call   10a0 <var_setconfig@plt>
lea    -0x440(%rbp),%rdi
mov    0x2a5f(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
jne    15aa <text_setup_database+0x3ea>
lea    -0x440(%rbp),%rsi
lea    0xbdc(%rip),%rdi
call   1070 <printf@plt>
jmp    1622 <text_setup_database+0x462>
lea    -0x440(%rbp),%rdi
lea    0xa74(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    15f6 <text_setup_database+0x436>
lea    -0x440(%rbp),%rsi
lea    0xa55(%rip),%rdi
call   1070 <printf@plt>
lea    0xa6b(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1629 <text_setup_database+0x469>
mov    -0x38(%rbp),%rdi
lea    0xb9f(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x440(%rbp),%rsi
lea    0xb8b(%rip),%rdi
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<text_setup_database>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%r14
lea    0xe2a(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <ban_setconfig@plt>
mov    0x2de8(%rip),%r15
mov    (%r15),%esi
mov    %rbx,%rdi
call   10b0 <access@plt>
test   %rax,%rax
je     124d <text_setup_database+0x8d>
lea    0xe1d(%rip),%rsi
mov    %rsp,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1498 <text_setup_database+0x2d8>
mov    %rax,%rbx
lea    0xe2a(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xe11(%rip),%rdi
jmp    1254 <text_setup_database+0x94>
lea    0xdb9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <printf@plt>
lea    0xe0e(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <mode_setconfig@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   10b0 <access@plt>
test   %rax,%rax
je     12d3 <text_setup_database+0x113>
lea    0xd97(%rip),%rsi
mov    %rsp,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1498 <text_setup_database+0x2d8>
mov    %rax,%rbx
lea    0xdf2(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xdda(%rip),%rdi
jmp    12da <text_setup_database+0x11a>
lea    0xda8(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <printf@plt>
lea    0xdd8(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <note_setconfig@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   10b0 <access@plt>
test   %rax,%rax
je     1359 <text_setup_database+0x199>
lea    0xd11(%rip),%rsi
mov    %rsp,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1498 <text_setup_database+0x2d8>
mov    %rax,%rbx
lea    0xdbc(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xda4(%rip),%rdi
jmp    1360 <text_setup_database+0x1a0>
lea    0xd72(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <printf@plt>
lea    0xda2(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1080 <userdb_setconfig@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   10b0 <access@plt>
test   %rax,%rax
je     13f8 <text_setup_database+0x238>
lea    0xc8b(%rip),%rsi
mov    %rsp,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1498 <text_setup_database+0x2d8>
mov    %rax,%rbx
lea    0xd86(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10e0 <fwrite@plt>
lea    0xd78(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xd60(%rip),%rdi
jmp    13ff <text_setup_database+0x23f>
lea    0xd23(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <printf@plt>
lea    0xd5e(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   10a0 <var_setconfig@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   10b0 <access@plt>
test   %rax,%rax
je     147a <text_setup_database+0x2ba>
lea    0xbec(%rip),%rsi
mov    %rsp,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1498 <text_setup_database+0x2d8>
mov    %rax,%rbx
lea    0xd49(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xd30(%rip),%rdi
jmp    1481 <text_setup_database+0x2c1>
lea    0xcfb(%rip),%rdi
mov    %rsp,%rsi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xb8f(%rip),%rdi
mov    %rsp,%rsi
call   1070 <printf@plt>
lea    0xba2(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%eax
jmp    148b <text_setup_database+0x2cb>

LLVM IR (-O0):
@.str = [13 x i8] c"%s/bans.conf\00"
@R_OK = global i32 0
@.str.1 = [31 x i8] c"Ban file `%s' already exists.\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [34 x i8] c"Could not open `%s' for writing.\0A\00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [8 x i8] c"[bans]\0A\00"
@.str.6 = [24 x i8] c"Created ban file `%s'.\0A\00"
@.str.7 = [14 x i8] c"%s/modes.conf\00"
@.str.8 = [32 x i8] c"Mode file `%s' already exists.\0A\00"
@.str.9 = [9 x i8] c"[modes]\0A\00"
@.str.10 = [25 x i8] c"Created mode file `%s'.\0A\00"
@.str.11 = [14 x i8] c"%s/notes.conf\00"
@.str.12 = [32 x i8] c"Note file `%s' already exists.\0A\00"
@.str.13 = [9 x i8] c"[notes]\0A\00"
@.str.14 = [25 x i8] c"Created note file `%s'.\0A\00"
@.str.15 = [14 x i8] c"%s/users.conf\00"
@.str.16 = [32 x i8] c"User file `%s' already exists.\0A\00"
@.str.17 = [11 x i8] c"[users]\0A\0A\0A\00"
@.str.18 = [9 x i8] c"[masks]\0A\00"
@.str.19 = [25 x i8] c"Created user file `%s'.\0A\00"
@.str.20 = [13 x i8] c"%s/vars.conf\00"
@.str.21 = [36 x i8] c"Variable file `%s' already exists.\0A\00"
@.str.22 = [8 x i8] c"[vars]\0A\00"
@.str.23 = [30 x i8] c"Created variable file `%s'.\0A\0A\00"
define i32 @text_setup_database(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca [1024 x i8]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = call i32 @snprintf(i8* %14, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%18 = call i32 @ban_setconfig(i8* %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%20 = load i32, i32* @R_OK
%21 = call i64 @access(i8* %19, i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %5
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %41
26: ; preds = %5
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %12
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%32 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%33 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %6
br label %156
34: ; preds = %26
%35 = load i32*, i32** %12
%36 = call i32 @fprintf(i32* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32*, i32** %12
%38 = call i32 @fclose(i32* %37)
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%40 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %34, %23
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%43 = load i8*, i8** %7
%44 = call i32 @snprintf(i8* %42, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %43)
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%46 = call i32 @mode_setconfig(i8* %45)
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%48 = load i32, i32* @R_OK
%49 = call i64 @access(i8* %47, i32 %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %41
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%53 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i8* %52)
br label %69
54: ; preds = %41
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %56, i32** %12
%57 = icmp eq i32* %56, null
br i1 %57, label %58, label %62
58: ; preds = %54
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%60 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %59)
%61 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %6
br label %156
62: ; preds = %54
%63 = load i32*, i32** %12
%64 = call i32 @fprintf(i32* %63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%65 = load i32*, i32** %12
%66 = call i32 @fclose(i32* %65)
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%68 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8* %67)
br label %69
69: ; preds = %62, %51
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%71 = load i8*, i8** %7
%72 = call i32 @snprintf(i8* %70, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %71)
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%74 = call i32 @note_setconfig(i8* %73)
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%76 = load i32, i32* @R_OK
%77 = call i64 @access(i8* %75, i32 %76)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %69
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%81 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8* %80)
br label %97
82: ; preds = %69
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%84 = call i32* @fopen(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %84, i32** %12
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %90
86: ; preds = %82
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%88 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %87)
%89 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %6
br label %156
90: ; preds = %82
%91 = load i32*, i32** %12
%92 = call i32 @fprintf(i32* %91, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%93 = load i32*, i32** %12
%94 = call i32 @fclose(i32* %93)
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%96 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), i8* %95)
br label %97
97: ; preds = %90, %79
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%99 = load i8*, i8** %7
%100 = call i32 @snprintf(i8* %98, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %99)
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%102 = call i32 @userdb_setconfig(i8* %101)
%103 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%104 = load i32, i32* @R_OK
%105 = call i64 @access(i8* %103, i32 %104)
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %97
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%109 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0), i8* %108)
br label %127
110: ; preds = %97
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%112 = call i32* @fopen(i8* %111, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %112, i32** %12
%113 = icmp eq i32* %112, null
br i1 %113, label %114, label %118
114: ; preds = %110
%115 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%116 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %115)
%117 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %6
br label %156
118: ; preds = %110
%119 = load i32*, i32** %12
%120 = call i32 @fprintf(i32* %119, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%121 = load i32*, i32** %12
%122 = call i32 @fprintf(i32* %121, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
%123 = load i32*, i32** %12
%124 = call i32 @fclose(i32* %123)
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%126 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0), i8* %125)
br label %127
127: ; preds = %118, %107
%128 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%129 = load i8*, i8** %7
%130 = call i32 @snprintf(i8* %128, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0), i8* %129)
%131 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%132 = call i32 @var_setconfig(i8* %131)
%133 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%134 = load i32, i32* @R_OK
%135 = call i64 @access(i8* %133, i32 %134)
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %127
%138 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%139 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.21, i64 0, i64 0), i8* %138)
br label %155
140: ; preds = %127
%141 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%142 = call i32* @fopen(i8* %141, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %142, i32** %12
%143 = icmp eq i32* %142, null
br i1 %143, label %144, label %148
144: ; preds = %140
%145 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%146 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %145)
%147 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %6
br label %156
148: ; preds = %140
%149 = load i32*, i32** %12
%150 = call i32 @fprintf(i32* %149, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.22, i64 0, i64 0))
%151 = load i32*, i32** %12
%152 = call i32 @fclose(i32* %151)
%153 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%154 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.23, i64 0, i64 0), i8* %153)
br label %155
155: ; preds = %148, %137
store i32 0, i32* %6
br label %156
156: ; preds = %155, %144, %114, %86, %58, %30
%157 = load i32, i32* %6
ret i32 %157
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s/bans.conf\00"
@R_OK = global i32 0
@.str.1 = [31 x i8] c"Ban file `%s' already exists.\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [34 x i8] c"Could not open `%s' for writing.\0A\00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [8 x i8] c"[bans]\0A\00"
@.str.6 = [24 x i8] c"Created ban file `%s'.\0A\00"
@.str.7 = [14 x i8] c"%s/modes.conf\00"
@.str.8 = [32 x i8] c"Mode file `%s' already exists.\0A\00"
@.str.9 = [9 x i8] c"[modes]\0A\00"
@.str.10 = [25 x i8] c"Created mode file `%s'.\0A\00"
@.str.11 = [14 x i8] c"%s/notes.conf\00"
@.str.12 = [32 x i8] c"Note file `%s' already exists.\0A\00"
@.str.13 = [9 x i8] c"[notes]\0A\00"
@.str.14 = [25 x i8] c"Created note file `%s'.\0A\00"
@.str.15 = [14 x i8] c"%s/users.conf\00"
@.str.16 = [32 x i8] c"User file `%s' already exists.\0A\00"
@.str.17 = [11 x i8] c"[users]\0A\0A\0A\00"
@.str.18 = [9 x i8] c"[masks]\0A\00"
@.str.19 = [25 x i8] c"Created user file `%s'.\0A\00"
@.str.20 = [13 x i8] c"%s/vars.conf\00"
@.str.21 = [36 x i8] c"Variable file `%s' already exists.\0A\00"
@.str.22 = [8 x i8] c"[vars]\0A\00"
@.str.23 = [30 x i8] c"Created variable file `%s'.\0A\0A\00"
define i32 @text_setup_database(i8* %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4) {
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%8 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = call i32 @ban_setconfig(i8* %7)
%10 = load i32, i32* @R_OK
%11 = call i64 @access(i8* %7, i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %5
%14 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%18 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %94
19: ; preds = %13
%20 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 7, i64 1, i32* %14)
%21 = call i32 @fclose(i32* %14)
br label %22
22: ; preds = %5, %19
%23 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), %19 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), %5 ]
%24 = call i32 @printf(i8* %23, i8* %7)
%25 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %0)
%26 = call i32 @mode_setconfig(i8* %7)
%27 = load i32, i32* @R_OK
%28 = call i64 @access(i8* %7, i32 %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %39, label %30
30: ; preds = %22
%31 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%35 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %94
36: ; preds = %30
%37 = call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i64 8, i64 1, i32* %31)
%38 = call i32 @fclose(i32* %31)
br label %39
39: ; preds = %22, %36
%40 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), %36 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), %22 ]
%41 = call i32 @printf(i8* %40, i8* %7)
%42 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %0)
%43 = call i32 @note_setconfig(i8* %7)
%44 = load i32, i32* @R_OK
%45 = call i64 @access(i8* %7, i32 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %39
%48 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%52 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %94
53: ; preds = %47
%54 = call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i64 8, i64 1, i32* %48)
%55 = call i32 @fclose(i32* %48)
br label %56
56: ; preds = %39, %53
%57 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), %53 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), %39 ]
%58 = call i32 @printf(i8* %57, i8* %7)
%59 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %0)
%60 = call i32 @userdb_setconfig(i8* %7)
%61 = load i32, i32* @R_OK
%62 = call i64 @access(i8* %7, i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %74, label %64
64: ; preds = %56
%65 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%66 = icmp eq i32* %65, null
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%69 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %94
70: ; preds = %64
%71 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i64 10, i64 1, i32* %65)
%72 = call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0), i64 8, i64 1, i32* %65)
%73 = call i32 @fclose(i32* %65)
br label %74
74: ; preds = %56, %70
%75 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0), %70 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0), %56 ]
%76 = call i32 @printf(i8* %75, i8* %7)
%77 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0), i8* %0)
%78 = call i32 @var_setconfig(i8* %7)
%79 = load i32, i32* @R_OK
%80 = call i64 @access(i8* %7, i32 %79)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %74
%83 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.21, i64 0, i64 0), i8* %7)
br label %94
84: ; preds = %74
%85 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%89 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %94
90: ; preds = %84
%91 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.22, i64 0, i64 0), i64 7, i64 1, i32* %85)
%92 = call i32 @fclose(i32* %85)
%93 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.23, i64 0, i64 0), i8* %7)
br label %94
94: ; preds = %82, %90, %87, %67, %50, %33, %16
%95 = phi i32 [ -1, %87 ], [ -1, %67 ], [ -1, %50 ], [ -1, %33 ], [ -1, %16 ], [ 0, %90 ], [ 0, %82 ]
ret i32 %95
}