// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/semind.c
// Function: main
int main(int argc, char **argv)
{
	static const struct command commands[] = {
		{
			.name          = "add",
			.dbflags       = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
			.parse_cmdline = parse_cmdline_add,
			.handler       = command_add
		},
		{
			.name          = "rm",
			.dbflags       = SQLITE_OPEN_READWRITE,
			.parse_cmdline = parse_cmdline_rm,
			.handler       = command_rm
		},
		{
			.name          = "search",
			.dbflags       = SQLITE_OPEN_READONLY,
			.parse_cmdline = parse_cmdline_search,
			.handler       = command_search
		},
		{ .name = NULL },
	};
	const struct command *cmd;

	if (!(progname = rindex(argv[0], '/')))
		progname = argv[0];
	else
		progname++;

	if (!realpath(".", cwd))
		semind_error(1, errno, "unable to get current directory");
	n_cwd = strlen(cwd);

	parse_cmdline(argc, argv);

	for (cmd = commands; cmd->name && strcmp(argv[optind], cmd->name); cmd++);
	if (!cmd->name)
		semind_error(1, 0, "unknown command: %s", argv[optind]);
	optind++;

	semind_command = cmd->name;

	if (cmd->parse_cmdline)
		cmd->parse_cmdline(argc, argv);

	open_database(semind_dbfile, cmd->dbflags);
	cmd->handler(argc - optind, argv + optind);

	sqlite3_close(semind_db);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x2f, %esi
callq 0x121c0
movq %rax, 0x81472(%rip)     # 0x93b00
cmpq $0x0, %rax
jne 0x126a4
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x8145e(%rip)     # 0x93b00
jmp 0x126b6
movq 0x81455(%rip), %rax     # 0x93b00
addq $0x1, %rax
movq %rax, 0x8144a(%rip)     # 0x93b00
leaq 0x5a16f(%rip), %rdi     # 0x6c82c
leaq 0x8144c(%rip), %rsi     # 0x93b10
callq 0x12240
cmpq $0x0, %rax
jne 0x126e9
callq 0x12350
movl (%rax), %esi
movl $0x1, %edi
leaq 0x54a69(%rip), %rdx     # 0x6714b
movb $0x0, %al
callq 0x131c0
leaq 0x81420(%rip), %rdi     # 0x93b10
callq 0x121f0
movq %rax, 0x82414(%rip)     # 0x94b10
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x132d0
leaq 0x723f1(%rip), %rax     # 0x84b00
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, (%rcx)
movb %al, -0x19(%rbp)
je 0x12749
movq -0x10(%rbp), %rax
movq 0x79893(%rip), %rcx     # 0x8bfc0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x12370
cmpl $0x0, %eax
setne %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x12752
jmp 0x12762
jmp 0x12754
movq -0x18(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x18(%rbp)
jmp 0x12713
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x12793
movq -0x10(%rbp), %rax
movq 0x79849(%rip), %rcx     # 0x8bfc0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rcx
movl $0x1, %edi
xorl %esi, %esi
leaq 0x549df(%rip), %rdx     # 0x6716b
movb $0x0, %al
callq 0x131c0
movq 0x79826(%rip), %rax     # 0x8bfc0
movl (%rax), %ecx
addl $0x1, %ecx
movq 0x7981a(%rip), %rax     # 0x8bfc0
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x82362(%rip)     # 0x94b18
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x127d2
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq *%rax
movq 0x79ad7(%rip), %rdi     # 0x8c2b0
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x13420
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x8(%rbp), %edi
movq 0x797c9(%rip), %rcx     # 0x8bfc0
subl (%rcx), %edi
movq -0x10(%rbp), %rsi
movq 0x797bc(%rip), %rcx     # 0x8bfc0
movslq (%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rsi
callq *%rax
movq 0x82309(%rip), %rdi     # 0x94b20
callq 0x12030
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)