// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/tests/key_c/src/main.c
// Function: main
int
main(int argc, char **argv)
{
	memset(&g_config, 0, sizeof(g_config));
	
	g_config.host = "127.0.0.1";
	g_config.port = 3000;
	g_config.ns = "test";
	g_config.table = "";
	g_config.bin = "value";
	g_config.verbose = false;
	g_config.host_direct = false;
	g_config.continuous = false;
	g_config.parallel = false;
	g_config.server_validate = false;
	g_config.timeout = 600;
	g_config.key_type = CL_STR;
	g_config.value_type = CL_STR;
	g_config.delay = 0;
	g_config.record_ttl = 0;
	g_config.ttl_range = 0;
	g_config.zero = 0;
	g_config.value_factor = 1;
	g_config.read_modify_write = false;
	
	// parameters for key-test
	int		n_reads = 10000;
	int		n_writes = 10000;
	int		n_deletes = 0;
	int		n_keys = 10000;
	int 		n_threads = 32;
	int		key_len = 100;
	int 		value_len = 128;
	int 		writesper100 = 20;
	int		n_ops = 0;
	// or maybe to simply do one-test
	int		one_test = 0;

	int		c;
	
	printf("testing the C citrusleaf library\n");
	
	while ((c = getopt(argc, argv, "h:p:n:S:t:k:r:w:e:K:V:m:D:T:U:f:z:A:N:W:o:1vdiPIbBCcsMR")) != -1)
	{
		switch (c)
		{
		case 'h':
			g_config.host = strdup(optarg);
			break;
		
		case 'p':
			g_config.port = atoi(optarg);
			break;
		
		case 'n':
			g_config.ns = strdup(optarg);
			break;

		case 'S':
			g_config.table = strdup(optarg);
			break;

		case 't':
			n_threads = atoi(optarg);
			break;
			
		case 'k':
			n_keys = atoi(optarg);
			break;
		
		case 'r':
			n_reads = atoi(optarg);
			break;
		
		case 'w':
			n_writes = atoi(optarg);
			break;

		case 'e':
			n_deletes = atoi(optarg);
			break;
			
		case 'K':
			key_len = atoi(optarg);
			break;

        case 'V':
            value_len = atoi(optarg);
            break;

		case '1':
			one_test = 1;
			break;
			
		case 'v':
			g_config.verbose = true;
			break;

		case 's':
			g_config.silent = true;
			break;
			
		case 'd':
			g_config.host_direct = true;
			break;

		case 'm':
			g_config.timeout = atoi(optarg);
			break;

		case 'f':
			g_config.value_factor = atoi(optarg);
			break;
			
		case 'D':
			g_config.delay = atoi(optarg);
			break;

		case 'T':
			g_config.record_ttl = atoi(optarg);
			break;

		case 'U':
			g_config.ttl_range = atoi(optarg);
			break;

		case 'z':
			g_config.zero = atoi(optarg);
			break;

		case 'i':
			g_config.value_type = CL_INT;
			break;

		case 'I':
			g_config.key_type = CL_INT;
			break;

		case 'b':
			g_config.value_type = CL_BLOB;
			break;
		
		case 'B':
			g_config.key_type = CL_BLOB;
			break;
			
		case 'C':
			g_config.continuous = true;
			break;

		case 'P':
			g_config.parallel = true;
			break;
			
		case 'c':
			g_config.server_validate = true;
			break;
			
		case 'M':
			g_config.read_modify_write = true;
			break;
			
		case 'A':
			g_config.n_batch = atoi(optarg);
			break;

		case 'R':
			g_config.use_shm = true;
			break;

		case 'N':
			g_config.bin = strdup(optarg);
			break;
		case 'W':
			writesper100 = atof(optarg);
			break;

		case 'o':
			n_ops = atof(optarg);
			break;
	
		default:
			usage();
			return(-1);
			
		}
	}
	fprintf(stderr, "testing: host %s port %d namespace %s set %s\n",g_config.host,g_config.port,g_config.ns, g_config.table);
	
	if (g_config.use_shm) {
		//first parameter is maximum number of nodes allowed for this cluster 
		//(shared memory size is accordingly allocated)
		//second parameter is shm_key
		citrusleaf_use_shm(32,788722985);
	}

	citrusleaf_init();

	if (one_test) {
		test_one_key();
	}
	else {
		fprintf(stderr, "key_test: keys: %d reads: %d writes: %d threads: %d\n",n_keys,n_reads,n_writes,n_threads);
		do_key_test(n_keys, n_reads, n_writes, n_deletes, n_threads, key_len, value_len, n_ops, writesper100, g_config.parallel);
	}

	citrusleaf_shutdown();
	return(0);
}

// Assembly:
pushq %rbx
subq $0x70, %rsp
movl $0x0, 0x6c(%rsp)
movl %edi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
leaq 0x22303(%rip), %rdi     # 0x25330
xorl %esi, %esi
movl $0x60, %edx
callq 0x2150
leaq 0x197df(%rip), %rax     # 0x1c81f
movq %rax, 0x222e9(%rip)     # 0x25330
movl $0xbb8, 0x222e7(%rip)   # imm = 0xBB8
leaq 0x197d1(%rip), %rax     # 0x1c829
movq %rax, 0x222e1(%rip)     # 0x25340
leaq 0x1a370(%rip), %rax     # 0x1d3d6
movq %rax, 0x222db(%rip)     # 0x25348
leaq 0x1913d(%rip), %rax     # 0x1c1b1
movq %rax, 0x222d5(%rip)     # 0x25350
movb $0x0, 0x222d6(%rip)     # 0x25358
movb $0x0, 0x222d1(%rip)     # 0x2535a
movb $0x0, 0x222cb(%rip)     # 0x2535b
movb $0x0, 0x222c6(%rip)     # 0x2535d
movb $0x0, 0x222be(%rip)     # 0x2535c
movl $0x258, 0x222bc(%rip)   # imm = 0x258
movl $0x3, 0x222ca(%rip)     # 0x2537c
movl $0x3, 0x222bc(%rip)     # 0x25378
movl $0x0, 0x222be(%rip)     # 0x25384
movl $0x0, 0x22298(%rip)     # 0x25368
movl $0x0, 0x22292(%rip)     # 0x2536c
movl $0x0, 0x2228c(%rip)     # 0x25370
movl $0x1, 0x22286(%rip)     # 0x25374
movb $0x0, 0x22293(%rip)     # 0x25388
movl $0x2710, 0x5c(%rsp)     # imm = 0x2710
movl $0x2710, 0x58(%rsp)     # imm = 0x2710
movl $0x0, 0x54(%rsp)
movl $0x2710, 0x50(%rsp)     # imm = 0x2710
movl $0x20, 0x4c(%rsp)
movl $0x64, 0x48(%rsp)
movl $0x80, 0x44(%rsp)
movl $0x14, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x38(%rsp)
leaq 0x196e2(%rip), %rdi     # 0x1c82e
movb $0x0, %al
callq 0x2050
movl 0x68(%rsp), %edi
movq 0x60(%rsp), %rsi
leaq 0x196ed(%rip), %rdx     # 0x1c850
callq 0x20a0
movl %eax, 0x34(%rsp)
cmpl $-0x1, %eax
je 0x346b
movl 0x34(%rsp), %eax
addl $-0x31, %eax
movl %eax, %ecx
movq %rcx, 0x28(%rsp)
subl $0x49, %eax
ja 0x3454
movq 0x28(%rsp), %rax
leaq 0x18e6c(%rip), %rcx     # 0x1c004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1fe28(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x22179(%rip)     # 0x25330
jmp 0x3466
movq 0x1fe0d(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x22167(%rip)     # 0x25338
jmp 0x3466
movq 0x1fdf3(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x22154(%rip)     # 0x25340
jmp 0x3466
movq 0x1fdd8(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x22141(%rip)     # 0x25348
jmp 0x3466
movq 0x1fdbd(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x4c(%rsp)
jmp 0x3466
movq 0x1fda5(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x50(%rsp)
jmp 0x3466
movq 0x1fd8d(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x5c(%rsp)
jmp 0x3466
movq 0x1fd75(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x58(%rsp)
jmp 0x3466
movq 0x1fd5d(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x54(%rsp)
jmp 0x3466
movq 0x1fd45(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x48(%rsp)
jmp 0x3466
movq 0x1fd2d(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x44(%rsp)
jmp 0x3466
movl $0x1, 0x38(%rsp)
jmp 0x3466
movb $0x1, 0x22090(%rip)     # 0x25358
jmp 0x3466
movb $0x1, 0x22085(%rip)     # 0x25359
jmp 0x3466
movb $0x1, 0x2207a(%rip)     # 0x2535a
jmp 0x3466
movq 0x1fce4(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x2206a(%rip)     # 0x25364
jmp 0x3466
movq 0x1fcca(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x22060(%rip)     # 0x25374
jmp 0x3466
movq 0x1fcb0(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x22056(%rip)     # 0x25384
jmp 0x3466
movq 0x1fc96(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x22020(%rip)     # 0x25368
jmp 0x3466
movq 0x1fc7c(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x2200a(%rip)     # 0x2536c
jmp 0x3466
movq 0x1fc62(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x21ff4(%rip)     # 0x25370
jmp 0x3466
movl $0x1, 0x21fed(%rip)     # 0x25378
jmp 0x3466
movl $0x1, 0x21fe2(%rip)     # 0x2537c
jmp 0x3466
movl $0x4, 0x21fcf(%rip)     # 0x25378
jmp 0x3466
movl $0x4, 0x21fc4(%rip)     # 0x2537c
jmp 0x3466
movb $0x1, 0x21f97(%rip)     # 0x2535b
jmp 0x3466
movb $0x1, 0x21f8d(%rip)     # 0x2535d
jmp 0x3466
movb $0x1, 0x21f80(%rip)     # 0x2535c
jmp 0x3466
movb $0x1, 0x21fa0(%rip)     # 0x25388
jmp 0x3466
movq 0x1fbdf(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x21f61(%rip)     # 0x25360
jmp 0x3466
movb $0x1, 0x21f81(%rip)     # 0x25389
jmp 0x3466
movq 0x1fbbf(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x21f30(%rip)     # 0x25350
jmp 0x3466
movq 0x1fba7(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x22f0
cvttsd2si %xmm0, %eax
movl %eax, 0x40(%rsp)
jmp 0x3466
movq 0x1fb8e(%rip), %rax     # 0x22fd0
movq (%rax), %rdi
callq 0x22f0
cvttsd2si %xmm0, %eax
movl %eax, 0x3c(%rsp)
jmp 0x3466
callq 0x2d00
movl $0xffffffff, 0x6c(%rsp) # imm = 0xFFFFFFFF
jmp 0x3549
jmp 0x3153
movq 0x1fb6e(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0x21eb4(%rip), %rdx     # 0x25330
movl 0x21eb6(%rip), %ecx     # 0x25338
movq 0x21eb7(%rip), %r8      # 0x25340
movq 0x21eb8(%rip), %r9      # 0x25348
leaq 0x193f1(%rip), %rsi     # 0x1c888
movb $0x0, %al
callq 0x23b0
testb $0x1, 0x21ee4(%rip)     # 0x25389
je 0x34b6
movl $0x20, %edi
movl $0x2f02f529, %esi       # imm = 0x2F02F529
callq 0x12fa0
callq 0xb780
cmpl $0x0, 0x38(%rsp)
je 0x34c9
callq 0x2ab0
jmp 0x353c
movq 0x1fb10(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movl 0x50(%rsp), %edx
movl 0x5c(%rsp), %ecx
movl 0x58(%rsp), %r8d
movl 0x4c(%rsp), %r9d
leaq 0x193ca(%rip), %rsi     # 0x1c8b6
movb $0x0, %al
callq 0x23b0
movl 0x50(%rsp), %edi
movl 0x5c(%rsp), %esi
movl 0x58(%rsp), %edx
movl 0x54(%rsp), %ecx
movl 0x4c(%rsp), %r8d
movl 0x48(%rsp), %r9d
movl 0x44(%rsp), %ebx
movl 0x3c(%rsp), %r11d
movl 0x40(%rsp), %r10d
movb 0x21e3c(%rip), %al      # 0x2535d
andb $0x1, %al
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x60b0
callq 0xb7e0
movl $0x0, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
addq $0x70, %rsp
popq %rbx
retq
nopw %cs:(%rax,%rax)
nopl (%rax)