#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*/ assert(int);
int /*<<< orphan*/ bs_lua_init();
int bs_xsb_command(char *);
scalar_t__ bs_xsb_init(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ lua_repl_main(int, char **);
int main(int argc, char **argv) {
  int rc;
  if (bs_xsb_init("/home/jbalint/sw/xsb-src/XSB")) {
    exit(1);
  }
  rc = bs_xsb_command(
      "asserta(library_directory('/home/jbalint/sw/flora-git/flora2')).");
  assert(!rc);
  rc = bs_xsb_command("[flora2].");
  assert(!rc);
  rc = bs_xsb_command("bootstrap_flora.");
  assert(!rc);
  rc = bs_xsb_command(
      "'\\\\add'('/home/jbalint/sw/banshee-sympatico/kernel/bs_prefixes').");
  assert(!rc);
  rc = bs_xsb_command(
      "'\\\\add'('/home/jbalint/sw/banshee-sympatico/kernel/bs_rdfs').");
  assert(!rc);
  rc = bs_xsb_command("asserta(library_directory('/home/jbalint/sw/"
                      "banshee-sympatico/kernel')).");
  assert(!rc);
  rc = bs_xsb_command("[cratehooks].");
  assert(!rc);
  rc = bs_xsb_command("['crate.c'].");
  assert(!rc);
  bs_lua_init();
  lua_repl_main(argc, argv);
  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)
lea    0xe83(%rip),%rdi
call   1040 <bs_xsb_init@plt>
cmp    $0x0,%rax
je     1196 <main+0x36>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0xe80(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe9f(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe87(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe76(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe96(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xeb2(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xed9(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xec5(%rip),%rdi
call   1080 <bs_xsb_command@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1030 <bs_lua_init@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <lua_repl_main@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe91(%rip),%rdi
call   1040 <bs_xsb_init@plt>
test   %rax,%rax
jne    125f <main+0xff>
lea    0xe99(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xec1(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xeb2(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xeaa(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xed3(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xef8(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xf28(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xf1d(%rip),%rdi
call   1080 <bs_xsb_command@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1030 <bs_lua_init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <lua_repl_main@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"/home/jbalint/sw/xsb-src/XSB\00"
@.str.1 = [65 x i8] c"asserta(library_directory('/home/jbalint/sw/flora-git/flora2')).\00"
@.str.2 = [10 x i8] c"[flora2].\00"
@.str.3 = [17 x i8] c"bootstrap_flora.\00"
@.str.4 = [66 x i8] c"'\\\\add'('/home/jbalint/sw/banshee-sympatico/kernel/bs_prefixes').\00"
@.str.5 = [62 x i8] c"'\\\\add'('/home/jbalint/sw/banshee-sympatico/kernel/bs_rdfs').\00"
@.str.6 = [73 x i8] c"asserta(library_directory('/home/jbalint/sw/banshee-sympatico/kernel')).\00"
@.str.7 = [14 x i8] c"[cratehooks].\00"
@.str.8 = [13 x i8] c"['crate.c'].\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @bs_xsb_init(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
store i32 %30, i32* %6
%31 = load i32, i32* %6
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
store i32 %36, i32* %6
%37 = load i32, i32* %6
%38 = icmp ne i32 %37, 0
%39 = xor i1 %38, true
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = icmp ne i32 %43, 0
%45 = xor i1 %44, true
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
store i32 %48, i32* %6
%49 = load i32, i32* %6
%50 = icmp ne i32 %49, 0
%51 = xor i1 %50, true
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = call i32 @bs_xsb_command(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
store i32 %54, i32* %6
%55 = load i32, i32* %6
%56 = icmp ne i32 %55, 0
%57 = xor i1 %56, true
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = call i32 (...) @bs_lua_init()
%61 = load i32, i32* %4
%62 = load i8**, i8*** %5
%63 = call i32 @lua_repl_main(i32 %61, i8** %62)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"/home/jbalint/sw/xsb-src/XSB\00"
@.str.1 = [65 x i8] c"asserta(library_directory('/home/jbalint/sw/flora-git/flora2')).\00"
@.str.2 = [10 x i8] c"[flora2].\00"
@.str.3 = [17 x i8] c"bootstrap_flora.\00"
@.str.4 = [66 x i8] c"'\\\\add'('/home/jbalint/sw/banshee-sympatico/kernel/bs_prefixes').\00"
@.str.5 = [62 x i8] c"'\\\\add'('/home/jbalint/sw/banshee-sympatico/kernel/bs_rdfs').\00"
@.str.6 = [73 x i8] c"asserta(library_directory('/home/jbalint/sw/banshee-sympatico/kernel')).\00"
@.str.7 = [14 x i8] c"[cratehooks].\00"
@.str.8 = [13 x i8] c"['crate.c'].\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @bs_xsb_init(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = tail call i32 @assert(i32 %34)
%36 = tail call i32 @bs_xsb_command(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
%39 = tail call i32 @assert(i32 %38)
%40 = tail call i32 (...) @bs_lua_init()
%41 = tail call i32 @lua_repl_main(i32 %0, i8** %1)
ret i32 0
}