#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*/ do_index_xml();
int /*<<< orphan*/ docs_to_xml(char *, int);
int get_work_mode(int, char **);
int /*<<< orphan*/ mylistdir(char *);
char *prepare_object(int);
int /*<<< orphan*/ save_index();
scalar_t__ save_settings_to_fs();
int /*<<< orphan*/ test_read_dir(char *);
int main(int argc, char **argv) {
  char *real_obj_name = NULL;
  int mode = 0;
  mode = get_work_mode(argc, argv);
  if (save_settings_to_fs() < 0)
    return -1;
  if ((real_obj_name = prepare_object(mode)) == NULL) {
    return -1;
  }
  test_read_dir("/docs/list.txt");
  docs_to_xml("temp_dir", mode);
  do_index_xml();
  save_index();
  mylistdir("/");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <get_work_mode@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1080 <save_settings_to_fs@plt>
cmp    $0x0,%rax
jge    11d1 <main+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <main+0xaf>
mov    -0x1c(%rbp),%edi
call   1040 <prepare_object@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11f3 <main+0x73>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <main+0xaf>
lea    0xe06(%rip),%rdi
call   1090 <test_read_dir@plt>
mov    -0x1c(%rbp),%esi
lea    0xe06(%rip),%rdi
call   1050 <docs_to_xml@plt>
mov    $0x0,%al
call   1030 <do_index_xml@plt>
mov    $0x0,%al
call   1060 <save_index@plt>
lea    0xdf5(%rip),%rdi
call   10a0 <mylistdir@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
call   1070 <get_work_mode@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1080 <save_settings_to_fs@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
js     11dd <main+0x5d>
mov    %ebp,%edi
call   1040 <prepare_object@plt>
test   %rax,%rax
je     11dd <main+0x5d>
lea    0xe52(%rip),%rdi
call   1090 <test_read_dir@plt>
lea    0xe55(%rip),%rdi
mov    %ebp,%esi
call   1050 <docs_to_xml@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <do_index_xml@plt>
xor    %eax,%eax
call   1060 <save_index@plt>
lea    0xe40(%rip),%rdi
call   10a0 <mylistdir@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/docs/list.txt\00"
@.str.1 = [9 x i8] c"temp_dir\00"
@.str.2 = [2 x i8] c"/\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @get_work_mode(i32 %8, i8** %9)
store i32 %10, i32* %7
%11 = call i64 (...) @save_settings_to_fs()
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %26
14: ; preds = %2
%15 = load i32, i32* %7
%16 = call i8* @prepare_object(i32 %15)
store i8* %16, i8** %6
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 -1, i32* %3
br label %26
19: ; preds = %14
%20 = call i32 @test_read_dir(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* %7
%22 = call i32 @docs_to_xml(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i32 (...) @do_index_xml()
%24 = call i32 (...) @save_index()
%25 = call i32 @mylistdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %26
26: ; preds = %19, %18, %13
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [15 x i8] c"/docs/list.txt\00"
@.str.1 = [9 x i8] c"temp_dir\00"
@.str.2 = [2 x i8] c"/\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @get_work_mode(i32 %0, i8** %1)
%4 = tail call i64 (...) @save_settings_to_fs()
%5 = icmp slt i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = tail call i8* @prepare_object(i32 %3)
%8 = icmp eq i8* %7, null
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = tail call i32 @test_read_dir(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @docs_to_xml(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%12 = tail call i32 (...) @do_index_xml()
%13 = tail call i32 (...) @save_index()
%14 = tail call i32 @mylistdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %6, %2, %9
%16 = phi i32 [ 0, %9 ], [ -1, %2 ], [ -1, %6 ]
ret i32 %16
}