// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/kvlds-dump/main.c
// Function: main
int
main(int argc, char * argv[])
{
	/* State variables. */
	void * K;
	struct wire_requestqueue * Q;
	struct dumpstate C;
	struct timeval st, en;

	/* Command-line parameters. */
	char * opt_fs = NULL;
	char * opt_t = NULL;
	int opt_v = 0;

	/* Working variables. */
	const char * ch;
	struct kvldskey * nullkey;

	WARNP_INIT;

	/* Parse the command line. */
	while ((ch = GETOPT(argc, argv)) != NULL) {
		GETOPT_SWITCH(ch) {
		GETOPT_OPTARG("--fs"):
			if (opt_fs != NULL)
				usage();
			if ((opt_fs = strdup(optarg)) == NULL)
				OPT_EPARSE(ch, optarg);
			break;
		GETOPT_OPTARG("-t"):
			if (opt_t != NULL)
				usage();
			if ((opt_t = strdup(optarg)) == NULL)
				OPT_EPARSE(ch, optarg);
			break;
		GETOPT_OPTARG("-v"):
			opt_v++;
			break;
		GETOPT_OPT("--version"):
			fprintf(stderr, "kivaloo-kvlds-dump @VERSION@\n");
			exit(0);
		GETOPT_MISSING_ARG:
			warn0("Missing argument to %s", ch);
			usage();
		GETOPT_DEFAULT:
			warn0("illegal option -- %s", ch);
			usage();
		}
	}
	argc -= optind;
	argv += optind;

	/* We should have processed all the arguments. */
	if (argc != 0)
		usage();
	(void)argv; /* argv is not used beyond this point. */

	/* Sanity-check options. */
	if (opt_t == NULL)
		usage();

	/* Open a connection to KVLDS. */
	if ((K = kivaloo_open(opt_t, &Q)) == NULL) {
		warnp("Could not connect to KVLDS daemon");
		exit(1);
	}

	/* If we're writing to the filesystem, move to that directory. */
	if (opt_fs) {
		if (chdir(opt_fs)) {
			warnp("chdir(%s)", opt_fs);
			exit(1);
		}
	}

	/* Prepare for dumping key-value pairs. */
	if ((nullkey = kvldskey_create(NULL, 0)) == NULL) {
		warnp("kvldskey_create");
		exit(1);
	}
	C.tofs = opt_fs ? 1 : 0;
	C.N = 0;

	/* Get timestamp. */
	if (monoclock_get(&st)) {
		warnp("monoclock_get");
		exit(1);
	}

	/* Read the range. */
	if (kvlds_range(Q, nullkey, nullkey, callback_pair, &C)) {
		warnp("Error occurred while reading key-value pairs");
		exit(1);
	}

	/* Get timestamp. */
	if (monoclock_get(&en)) {
		warnp("monoclock_get");
		exit(1);
	}

	/* Print statistics if appropriate. */
	if (opt_v) {
		fprintf(stderr,
		    "Dumped %" PRIu64 " key-value pairs in %f seconds.",
		    C.N, timeval_diff(en, st));
	}

	/* Free memory allocated by kvldskey_create. */
	kvldskey_free(nullkey);

	/* Close the connection to KVLDS. */
	kivaloo_close(K);

	/* Free option strings. */
	free(opt_t);
	free(opt_fs);

	/* Success! */
	exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x24e6
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x4180
jmp 0x24e8
jmp 0x24ea
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3150
movq %rax, -0x70(%rbp)
cmpq $0x0, %rax
je 0x293d
movq $0x8e, -0x80(%rbp)
movq -0x80(%rbp), %rax
decq %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0x8c(%rbp)
leaq 0x7(%rip), %rax         # 0x2532
movq %rax, -0x98(%rbp)
leaq 0x14137(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x2557
movq -0x70(%rbp), %rdi
callq 0x3810
movq -0x80(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
jmp 0x2573
movq -0x88(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
addq $-0x8f, %rax
movq %rax, -0xa8(%rbp)
subq $0x15, %rax
ja 0x28cd
movq -0xa8(%rbp), %rax
leaq 0xda71(%rip), %rcx      # 0x10010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x140c1(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x25e4
leaq 0x140ad(%rip), %rax     # 0x16668
cmpq $0x0, (%rax)
je 0x25c3
jmp 0x25e2
leaq 0xda9e(%rip), %rdi      # 0x10068
leaq 0xdaa6(%rip), %rsi      # 0x10077
movl $0x8f, %edx
leaq 0xdaa1(%rip), %rcx      # 0x1007e
callq 0x21a0
jmp 0x2614
movq -0x80(%rbp), %rax
movl $0x8f, %esi
subq %rax, %rsi
leaq 0xda9e(%rip), %rdi      # 0x10095
movl $0x1, %edx
callq 0x3960
movq -0x98(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2c23
cmpq $0x0, -0x58(%rbp)
je 0x2620
callq 0x2c30
leaq 0x14041(%rip), %rax     # 0x16668
movq (%rax), %rdi
callq 0x2360
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
jne 0x2698
jmp 0x263b
jmp 0x263d
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2670
movq -0x70(%rbp), %rsi
leaq 0x14016(%rip), %rax     # 0x16668
movq (%rax), %rdx
leaq 0xda3e(%rip), %rdi      # 0x1009a
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x268c
movq -0x70(%rbp), %rsi
leaq 0x13fed(%rip), %rax     # 0x16668
movq (%rax), %rdx
leaq 0xda15(%rip), %rdi      # 0x1009a
movb $0x0, %al
callq 0x4490
jmp 0x268e
movl $0x1, %edi
callq 0x2320
jmp 0x2938
leaq 0x13fcc(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x26d9
leaq 0x13fb8(%rip), %rax     # 0x16668
cmpq $0x0, (%rax)
je 0x26b8
jmp 0x26d7
leaq 0xd9a9(%rip), %rdi      # 0x10068
leaq 0xd9b1(%rip), %rsi      # 0x10077
movl $0x95, %edx
leaq 0xd9ac(%rip), %rcx      # 0x1007e
callq 0x21a0
jmp 0x2709
movq -0x80(%rbp), %rax
movl $0x95, %esi
subq %rax, %rsi
leaq 0xd9cc(%rip), %rdi      # 0x100b8
movl $0x1, %edx
callq 0x3960
movq -0x98(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2c23
cmpq $0x0, -0x60(%rbp)
je 0x2715
callq 0x2c30
leaq 0x13f4c(%rip), %rax     # 0x16668
movq (%rax), %rdi
callq 0x2360
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
jne 0x278d
jmp 0x2730
jmp 0x2732
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2765
movq -0x70(%rbp), %rsi
leaq 0x13f21(%rip), %rax     # 0x16668
movq (%rax), %rdx
leaq 0xd949(%rip), %rdi      # 0x1009a
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2781
movq -0x70(%rbp), %rsi
leaq 0x13ef8(%rip), %rax     # 0x16668
movq (%rax), %rdx
leaq 0xd920(%rip), %rdi      # 0x1009a
movb $0x0, %al
callq 0x4490
jmp 0x2783
movl $0x1, %edi
callq 0x2320
jmp 0x2938
leaq 0x13ed7(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x27ce
leaq 0x13ec3(%rip), %rax     # 0x16668
cmpq $0x0, (%rax)
je 0x27ad
jmp 0x27cc
leaq 0xd8b4(%rip), %rdi      # 0x10068
leaq 0xd8bc(%rip), %rsi      # 0x10077
movl $0x9b, %edx
leaq 0xd8b7(%rip), %rcx      # 0x1007e
callq 0x21a0
jmp 0x27fe
movq -0x80(%rbp), %rax
movl $0x9b, %esi
subq %rax, %rsi
leaq 0xd8da(%rip), %rdi      # 0x100bb
movl $0x1, %edx
callq 0x3960
movq -0x98(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2c23
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2938
leaq 0x13e5d(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x281a
jmp 0x2847
movq -0x80(%rbp), %rax
movl $0x9e, %esi
subq %rax, %rsi
leaq 0xd891(%rip), %rdi      # 0x100be
xorl %edx, %edx
callq 0x3960
movq -0x98(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2c23
movq 0x137aa(%rip), %rax     # 0x15ff8
movq (%rax), %rdi
leaq 0xd870(%rip), %rsi      # 0x100c8
movb $0x0, %al
callq 0x2210
xorl %edi, %edi
callq 0x2320
leaq 0x13e03(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x2874
jmp 0x2898
movq -0x80(%rbp), %rax
movl $0xa1, %edi
subq %rax, %rdi
callq 0x3bf0
movq -0x98(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2c23
jmp 0x289a
movq -0x70(%rbp), %rsi
leaq 0xd841(%rip), %rdi      # 0x100e6
movb $0x0, %al
callq 0x4490
callq 0x20a0
movl $0x0, (%rax)
callq 0x2c30
jmp 0x2914
leaq 0x13dab(%rip), %rax     # 0x16670
movl $0x1, (%rax)
jmp 0x2938
leaq 0x13d9c(%rip), %rax     # 0x16670
cmpl $0x0, (%rax)
je 0x28db
jmp 0x2914
movl -0x8c(%rbp), %eax
cmpl $0x0, %eax
jne 0x2901
movq -0x80(%rbp), %rax
movl $0xa4, %edi
subq %rax, %rdi
callq 0x3cb0
movl $0x1, -0x8c(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2c23
jmp 0x2916
movq -0x70(%rbp), %rsi
leaq 0xd7dc(%rip), %rdi      # 0x100fd
movb $0x0, %al
callq 0x4490
callq 0x20a0
movl $0x0, (%rax)
callq 0x2c30
jmp 0x24ea
leaq 0x1389c(%rip), %rax     # 0x161e0
movl (%rax), %ecx
movl -0x8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x8(%rbp)
leaq 0x1388b(%rip), %rax     # 0x161e0
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x2974
callq 0x2c30
cmpq $0x0, -0x60(%rbp)
jne 0x2980
callq 0x2c30
movq -0x60(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4930
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x29d8
jmp 0x2999
callq 0x20a0
cmpl $0x0, (%rax)
je 0x29be
leaq 0xd768(%rip), %rdi      # 0x10112
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x29cc
leaq 0xd74d(%rip), %rdi      # 0x10112
movb $0x0, %al
callq 0x4490
jmp 0x29ce
movl $0x1, %edi
callq 0x2320
cmpq $0x0, -0x58(%rbp)
je 0x2a38
movq -0x58(%rbp), %rdi
callq 0x2140
cmpl $0x0, %eax
je 0x2a36
jmp 0x29ef
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2a18
movq -0x58(%rbp), %rsi
leaq 0xd730(%rip), %rdi      # 0x10134
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2a2a
movq -0x58(%rbp), %rsi
leaq 0xd711(%rip), %rdi      # 0x10134
movb $0x0, %al
callq 0x4490
jmp 0x2a2c
movl $0x1, %edi
callq 0x2320
jmp 0x2a38
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x46d0
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
jne 0x2a8f
jmp 0x2a50
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2a75
leaq 0xd6dd(%rip), %rdi      # 0x1013e
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2a83
leaq 0xd6c2(%rip), %rdi      # 0x1013e
movb $0x0, %al
callq 0x4490
jmp 0x2a85
movl $0x1, %edi
callq 0x2320
movq -0x58(%rbp), %rdx
xorl %eax, %eax
movl $0x1, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3e60
cmpl $0x0, %eax
je 0x2afb
jmp 0x2abc
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2ae1
leaq 0xd681(%rip), %rdi      # 0x1014e
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2aef
leaq 0xd666(%rip), %rdi      # 0x1014e
movb $0x0, %al
callq 0x4490
jmp 0x2af1
movl $0x1, %edi
callq 0x2320
movq -0x20(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x78(%rbp), %rdx
leaq 0x162(%rip), %rcx       # 0x2c70
leaq -0x30(%rbp), %r8
callq 0x4d80
cmpl $0x0, %eax
je 0x2b5d
jmp 0x2b1e
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2b43
leaq 0xd62d(%rip), %rdi      # 0x1015c
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2b51
leaq 0xd612(%rip), %rdi      # 0x1015c
movb $0x0, %al
callq 0x4490
jmp 0x2b53
movl $0x1, %edi
callq 0x2320
leaq -0x50(%rbp), %rdi
callq 0x3e60
cmpl $0x0, %eax
je 0x2bac
jmp 0x2b6d
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2b92
leaq 0xd5d0(%rip), %rdi      # 0x1014e
movb $0x0, %al
callq 0x4240
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2ba0
leaq 0xd5b5(%rip), %rdi      # 0x1014e
movb $0x0, %al
callq 0x4490
jmp 0x2ba2
movl $0x1, %edi
callq 0x2320
cmpl $0x0, -0x64(%rbp)
je 0x2bf8
movq 0x1343f(%rip), %rax     # 0x15ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rax
subq -0x50(%rbp), %rax
cvtsi2sd %rax, %xmm1
movq -0x38(%rbp), %rax
subq -0x48(%rbp), %rax
cvtsi2sd %rax, %xmm0
movsd 0xd426(%rip), %xmm2     # 0x10008
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
leaq 0xd598(%rip), %rsi      # 0x10189
movb $0x1, %al
callq 0x2210
movq -0x78(%rbp), %rdi
callq 0x2040
movq -0x18(%rbp), %rdi
callq 0x4af0
movq -0x60(%rbp), %rdi
callq 0x2040
movq -0x58(%rbp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x2320
movq -0xb0(%rbp), %rax
jmpq *%rax
nopl (%rax)