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

/* Variables and functions */
int indexer_main(int, char **);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ trio_fprintf(int /*<<< orphan*/, char *);
int do_index_xml() {
  char *ind_argv[] = {"indexer", "--config", "/settings/sphinx.conf",
                      "mainindex"};
  int ind_argc = sizeof(ind_argv) / sizeof(char *);
  if (mkdir("/index", 0777) != 0) {
    trio_fprintf(stderr, "Index directory not created\n");
    return -1;
  }
  int ret_ind = indexer_main(ind_argc, ind_argv);
  return ret_ind;
}


x86 assembly (clang, -O0):
<do_index_xml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2cb1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cae(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cab(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ca8(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x34(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     11a7 <do_index_xml+0x77>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1050 <trio_fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <do_index_xml+0x8c>
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1040 <indexer_main@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_index_xml>:
sub    $0x28,%rsp
movaps 0x2cc5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2ca9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xedf(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     1180 <do_index_xml+0x50>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1050 <trio_fprintf@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
ret
mov    %rsp,%rsi
mov    $0x4,%edi
call   1040 <indexer_main@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"indexer\00"
@.str.1 = [9 x i8] c"--config\00"
@.str.2 = [22 x i8] c"/settings/sphinx.conf\00"
@.str.3 = [10 x i8] c"mainindex\00"
@__const.do_index_xml.ind_argv = [4 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [7 x i8] c"/index\00"
@stderr = global i32 0
@.str.5 = [29 x i8] c"Index directory not created\0A\00"
define i32 @do_index_xml() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [4 x i8*]* %2 to i8*
store i32 4, i32* %3
%6 = call i64 @mkdir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 511)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @trio_fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %16
11: ; preds = %0
%12 = load i32, i32* %3
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%14 = call i32 @indexer_main(i32 %12, i8** %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
store i32 %15, i32* %1
br label %16
16: ; preds = %11, %8
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [8 x i8] c"indexer\00"
@.str.1 = [9 x i8] c"--config\00"
@.str.2 = [22 x i8] c"/settings/sphinx.conf\00"
@.str.3 = [10 x i8] c"mainindex\00"
@__const.do_index_xml.ind_argv = [4 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [7 x i8] c"/index\00"
@stderr = global i32 0
@.str.5 = [29 x i8] c"Index directory not created\0A\00"
define i32 @do_index_xml() {
%1 = alloca [4 x i8*]
%2 = bitcast [4 x i8*]* %1 to i8*
%3 = tail call i64 @mkdir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 511)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @trio_fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %11
8: ; preds = %0
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%10 = call i32 @indexer_main(i32 4, i8** %9)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ -1, %5 ], [ %10, %8 ]
ret i32 %12
}