// File: /workspace/github_cpp_makefile_star2_O3/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
movl %edi, %r15d
movq (%rsi), %rdi
cmpl $0x2, %r15d
jl 0x26e5
movq %rsi, %r14
addl $-0x4, %r15d
addq $0x8, %r14
movl $0x20000, %r12d         # imm = 0x20000
xorl %ebp, %ebp
movq (%r14), %rax
cmpb $0x2d, (%rax)
jne 0x25c3
movzbl 0x1(%rax), %ecx
cmpl $0x63, %ecx
je 0x259a
cmpl $0x6e, %ecx
jne 0x26c7
cmpb $0x0, 0x2(%rax)
jne 0x26e5
orl $0x4000, %r12d          # imm = 0x4000
jmp 0x25a9
movl $0x1, %ebp
cmpb $0x0, 0x2(%rax)
jne 0x26e5
leal -0x1(%r15), %eax
addl $0x4, %r15d
addq $0x8, %r14
cmpl $0x2, %r15d
movl %eax, %r15d
ja 0x256d
jmp 0x26e5
cmpl $-0x3, %r15d
jbe 0x26e5
movq %rdi, 0x10(%rsp)
leaq 0x111(%rip), %rbx       # 0x26ea
movl $0xd, %edi
movq %rbx, %rsi
callq 0x21f0
movl $0x1, %edi
movq %rbx, %rsi
callq 0x21f0
movl $0x2, %edi
movq %rbx, %rsi
callq 0x21f0
movl $0xf, %edi
movq %rbx, %rsi
callq 0x21f0
leaq 0x8(%rsp), %rdi
callq 0xb75e
leaq 0xba31(%rip), %rbx      # 0xe04f
testl %eax, %eax
jne 0x2683
movq 0x8(%rsp), %rdi
movq (%r14), %rsi
movl %r12d, %edx
movl $0x180, %ecx            # imm = 0x180
callq 0xb970
testl %eax, %eax
jne 0x2683
movq 0x8(%rsp), %rdi
cmpl $-0x2, %r15d
jne 0x2654
movl $0x1, %esi
movl %ebp, %edx
callq 0xc4d2
jmp 0x265f
movq 0x8(%r14), %rsi
movl %ebp, %edx
callq 0xc9f3
movl %eax, %r13d
xorl %ebx, %ebx
testl %eax, %eax
jne 0x2688
movq 0x8(%rsp), %rdi
callq 0xc49a
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r13d
jmp 0x268f
leaq 0xb9d4(%rip), %rbx      # 0xe063
movq 0xf962(%rip), %rax      # 0x11ff8
movq (%rax), %r14
movl %r13d, %edi
callq 0x26ec
leaq 0xb9c3(%rip), %rsi      # 0xe06b
movq %r14, %rdi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
movl %r13d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x2210
movl $0x1, %ebx
jmp 0x2668
cmpl $0x56, %ecx
jne 0x26e5
cmpb $0x0, 0x2(%rax)
jne 0x26e5
leaq 0xb92b(%rip), %rdi      # 0xe004
callq 0x20a0
xorl %edi, %edi
callq 0x2360
callq 0x2420