// File: /workspace/github_cpp_makefile_star2_O2/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb_copy.c
// Function: main
int main(int argc,char * argv[])
{
	int rc;
	MDB_env *env;
	const char *progname = argv[0], *act;
	unsigned flags = MDB_RDONLY;
	unsigned cpflags = 0;

	for (; argc > 1 && argv[1][0] == '-'; argc--, argv++) {
		if (argv[1][1] == 'n' && argv[1][2] == '\0')
			flags |= MDB_NOSUBDIR;
		else if (argv[1][1] == 'c' && argv[1][2] == '\0')
			cpflags |= MDB_CP_COMPACT;
		else if (argv[1][1] == 'V' && argv[1][2] == '\0') {
			printf("%s\n", MDB_VERSION_STRING);
			exit(0);
		} else
			argc = 0;
	}

	if (argc<2 || argc>3) {
		fprintf(stderr, "usage: %s [-V] [-c] [-n] srcpath [dstpath]\n", progname);
		exit(EXIT_FAILURE);
	}

#ifdef SIGPIPE
	signal(SIGPIPE, sighandle);
#endif
#ifdef SIGHUP
	signal(SIGHUP, sighandle);
#endif
	signal(SIGINT, sighandle);
	signal(SIGTERM, sighandle);

	act = "opening environment";
	rc = mdb_env_create(&env);
	if (rc == MDB_SUCCESS) {
		rc = mdb_env_open(env, argv[1], flags, 0600);
	}
	if (rc == MDB_SUCCESS) {
		act = "copying";
		if (argc == 2)
			rc = mdb_env_copyfd2(env, MDB_STDOUT, cpflags);
		else
			rc = mdb_env_copy2(env, argv[2], cpflags);
	}
	if (rc)
		fprintf(stderr, "%s: %s failed, error %d (%s)\n",
			progname, act, rc, mdb_strerror(rc));
	mdb_env_close(env);

	return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %r13d
movq (%rsi), %rdx
addq $0x8, %r14
xorl %ebp, %ebp
movl $0x20000, %r15d         # imm = 0x20000
pushq $0x1
popq %rax
cmpl $0x2, %r13d
jl 0x2695
movq (%r14), %rdi
cmpb $0x2d, (%rdi)
jne 0x259d
movzbl 0x1(%rdi), %esi
xorl %ecx, %ecx
cmpl $0x56, %esi
je 0x2588
cmpl $0x63, %esi
je 0x257b
cmpl $0x6e, %esi
jne 0x2592
cmpb $0x0, 0x2(%rdi)
jne 0x2592
orl $0x4000, %r15d          # imm = 0x4000
movl %r13d, %ecx
jmp 0x2592
cmpb $0x0, 0x2(%rdi)
jne 0x2592
movl %r13d, %ecx
movl %eax, %ebp
jmp 0x2592
cmpb $0x0, 0x2(%rdi)
je 0x26b5
decl %ecx
addq $0x8, %r14
movl %ecx, %r13d
jmp 0x2542
leal -0x4(%r13), %eax
cmpl $-0x3, %eax
jbe 0x2695
movq %rdx, 0x10(%rsp)
leaq 0x112(%rip), %rbx       # 0x26c8
pushq $0xd
popq %rdi
movq %rbx, %rsi
callq 0x21f0
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq 0x21f0
pushq $0x2
popq %rdi
movq %rbx, %rsi
callq 0x21f0
pushq $0xf
popq %rdi
movq %rbx, %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
callq 0xb08b
leaq 0xba5c(%rip), %r12      # 0xe04f
testl %eax, %eax
jne 0x2655
movq 0x8(%rsp), %rdi
movq (%r14), %rsi
movl %r15d, %edx
movl $0x180, %ecx            # imm = 0x180
callq 0xb27f
testl %eax, %eax
jne 0x2655
movq 0x8(%rsp), %rdi
cmpl $0x2, %r13d
jne 0x2627
pushq $0x1
popq %rsi
movl %ebp, %edx
callq 0xbd99
jmp 0x2632
movq 0x8(%r14), %rsi
movl %ebp, %edx
callq 0xc26a
movl %eax, %ebx
xorl %ebp, %ebp
testl %eax, %eax
jne 0x2659
movq 0x8(%rsp), %rdi
callq 0xbd61
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
jmp 0x2660
leaq 0xba03(%rip), %r12      # 0xe063
movq 0xf991(%rip), %rax      # 0x11ff8
movq (%rax), %r14
movl %ebx, %edi
callq 0x26cc
leaq 0xb9f3(%rip), %rsi      # 0xe06b
movq %r14, %rdi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
movl %ebx, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x2210
pushq $0x1
popq %rbp
jmp 0x263a
movq 0xf95c(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0xb97d(%rip), %rsi      # 0xe023
xorl %eax, %eax
callq 0x2210
pushq $0x1
popq %rdi
callq 0x2370
leaq 0xb948(%rip), %rdi      # 0xe004
callq 0x20a0
xorl %edi, %edi
callq 0x2370