// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/tests/loop_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.set = "set";
	g_config.bin = "value";
	g_config.verbose = false;
	g_config.follow = true;
	g_config.strict = false;
	
	g_config.n_threads = 32;
	g_config.n_keys = 100000;
	g_config.key_len = 10;
	g_config.value_len = 20;
	g_config.pseudo_seed = 0; // means use a real random value
	g_config.timeout_ms = 200; // 200 ms
	
	g_config.values = 0;
	g_config.in_progress_hash = 0;
	

	int		c;
	
	printf("testing the C citrusleaf library\n");
	
	while ((c = getopt(argc, argv, "h:p:H:n:t:k:b:w:K:V:s:r:m:vfS")) != -1) 
	{
		switch (c)
		{
		case 'h':
			g_config.host = strdup(optarg);
			break;
		
		case 'p':
			g_config.port = atoi(optarg);
			if (g_config.port <= 0) {
				fprintf(stderr, "port must be a number\n");
				usage();
				return(0);
			}
			break;

		case 'H':
			g_config.host = malloc(strlen(optarg));
		    char *tp = optarg;
		    while (*tp++) {
		    	if (*tp == ':') break;
		    }
		    if (*tp == ':') *tp = 0;
		    strcpy(g_config.host, optarg);
		    g_config.port = atoi(tp + 1);
		    fprintf(stderr, " host %s port %d\n",g_config.host,g_config.port);
			break;

		case 'n':
			g_config.ns = strdup(optarg);
			break;

		case 's':
			g_config.set = strdup(optarg);
			break;

		case 'b':
			g_config.bin = strdup(optarg);
			break;

		case 't':
			g_config.n_threads = atoi(optarg);
			break;
			
		case 'k':
			g_config.n_keys = atoi(optarg);
			break;


		case 'K':
			g_config.key_len = atoi(optarg);
			break;
			
		case 'V':
			g_config.value_len = atoi(optarg);
			break;

		case 'r':
			g_config.pseudo_seed = atoi(optarg);
			break;
			
		case 'm':
			g_config.timeout_ms = atoi(optarg);
			break;
			
		case 'v':
			g_config.verbose = true;
			break;

		case 'f':
			g_config.follow = false;
			break;

		case 'S':
			g_config.follow = false;
			break;
			
		default:
			usage();
			return(-1);
			
		}
	}
	fprintf(stderr, "testing: host %s port %d ns %s set %s bin %s\n",g_config.host,g_config.port,g_config.ns,g_config.set,g_config.bin);

	if (g_config.pseudo_seed)
		srandom(g_config.pseudo_seed);
	
	citrusleaf_init();

	fprintf(stderr, "key_test: keys: %d threads: %d \n",g_config.n_keys,g_config.n_threads);

	if (0 != do_loop_test()) {
		fprintf(stderr, "could not init test!\n");
		return(-1);
	}

	return(0);
}

// Assembly:
subq $0x38, %rsp
movl $0x0, 0x34(%rsp)
movl %edi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
leaq 0x1b6a4(%rip), %rdi     # 0x1e300
xorl %esi, %esi
movl $0x80, %edx
callq 0x2170
leaq 0x156b7(%rip), %rax     # 0x18326
movq %rax, 0x1b68a(%rip)     # 0x1e300
movl $0xbb8, 0x1b688(%rip)   # imm = 0xBB8
leaq 0x156a9(%rip), %rax     # 0x18330
movq %rax, 0x1b682(%rip)     # 0x1e310
leaq 0x156a0(%rip), %rax     # 0x18335
movq %rax, 0x1b67c(%rip)     # 0x1e318
leaq 0x15696(%rip), %rax     # 0x18339
movq %rax, 0x1b676(%rip)     # 0x1e320
movb $0x0, 0x1b677(%rip)     # 0x1e328
movb $0x1, 0x1b671(%rip)     # 0x1e329
movb $0x0, 0x1b66b(%rip)     # 0x1e32a
movl $0x20, 0x1b663(%rip)    # 0x1e32c
movl $0x186a0, 0x1b65d(%rip) # imm = 0x186A0
movl $0xa, 0x1b657(%rip)     # 0x1e334
movl $0x14, 0x1b651(%rip)    # 0x1e338
movl $0x0, 0x1b67f(%rip)     # 0x1e370
movl $0xc8, 0x1b679(%rip)    # 0x1e374
movq $0x0, 0x1b63a(%rip) # 0x1e340
movq $0x0, 0x1b637(%rip) # 0x1e348
leaq 0x15627(%rip), %rdi     # 0x1833f
movb $0x0, %al
callq 0x2050
movl 0x30(%rsp), %edi
movq 0x28(%rsp), %rsi
leaq 0x15632(%rip), %rdx     # 0x18361
callq 0x20a0
movl %eax, 0x24(%rsp)
cmpl $-0x1, %eax
je 0x2fa5
movl 0x24(%rsp), %eax
addl $-0x48, %eax
movl %eax, %ecx
movq %rcx, 0x10(%rsp)
subl $0x2e, %eax
ja 0x2f8e
movq 0x10(%rsp), %rax
leaq 0x152a0(%rip), %rcx     # 0x18004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1b25c(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x1b57d(%rip)     # 0x1e300
jmp 0x2fa0
movq 0x1b241(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b56b(%rip)     # 0x1e308
cmpl $0x0, 0x1b564(%rip)     # 0x1e308
jg 0x2dd0
movq 0x1b233(%rip), %rax     # 0x1dfe0
movq (%rax), %rdi
leaq 0x155c8(%rip), %rsi     # 0x1837f
movb $0x0, %al
callq 0x23b0
callq 0x2ab0
movl $0x0, 0x34(%rsp)
jmp 0x3057
jmp 0x2fa0
movq 0x1b1f4(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2100
movq %rax, %rdi
callq 0x2310
movq %rax, 0x1b50d(%rip)     # 0x1e300
movq 0x1b1d6(%rip), %rax     # 0x1dfd0
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
cmpb $0x0, (%rax)
je 0x2e29
movq 0x18(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x2e27
jmp 0x2e29
jmp 0x2e02
movq 0x18(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x2e3e
movq 0x18(%rsp), %rax
movb $0x0, (%rax)
movq 0x1b4bb(%rip), %rdi     # 0x1e300
movq 0x1b184(%rip), %rax     # 0x1dfd0
movq (%rax), %rsi
callq 0x2270
movq 0x18(%rsp), %rdi
addq $0x1, %rdi
callq 0x2460
movl %eax, 0x1b4a0(%rip)     # 0x1e308
movq 0x1b171(%rip), %rax     # 0x1dfe0
movq (%rax), %rdi
movq 0x1b487(%rip), %rdx     # 0x1e300
movl 0x1b489(%rip), %ecx     # 0x1e308
leaq 0x15510(%rip), %rsi     # 0x18396
movb $0x0, %al
callq 0x23b0
jmp 0x2fa0
movq 0x1b137(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x1b468(%rip)     # 0x1e310
jmp 0x2fa0
movq 0x1b11c(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x1b455(%rip)     # 0x1e318
jmp 0x2fa0
movq 0x1b101(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2520
movq %rax, 0x1b442(%rip)     # 0x1e320
jmp 0x2fa0
movq 0x1b0e6(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b434(%rip)     # 0x1e32c
jmp 0x2fa0
movq 0x1b0cc(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b41e(%rip)     # 0x1e330
jmp 0x2fa0
movq 0x1b0b2(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b408(%rip)     # 0x1e334
jmp 0x2fa0
movq 0x1b09b(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b3f5(%rip)     # 0x1e338
jmp 0x2fa0
movq 0x1b084(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b416(%rip)     # 0x1e370
jmp 0x2fa0
movq 0x1b06d(%rip), %rax     # 0x1dfd0
movq (%rax), %rdi
callq 0x2460
movl %eax, 0x1b403(%rip)     # 0x1e374
jmp 0x2fa0
movb $0x1, 0x1b3ae(%rip)     # 0x1e328
jmp 0x2fa0
movb $0x0, 0x1b3a6(%rip)     # 0x1e329
jmp 0x2fa0
movb $0x0, 0x1b39d(%rip)     # 0x1e329
jmp 0x2fa0
callq 0x2ab0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x3057
jmp 0x2d1f
movq 0x1b034(%rip), %rax     # 0x1dfe0
movq (%rax), %rdi
movq 0x1b34a(%rip), %rdx     # 0x1e300
movl 0x1b34c(%rip), %ecx     # 0x1e308
movq 0x1b34d(%rip), %r8      # 0x1e310
movq 0x1b34e(%rip), %r9      # 0x1e318
movq 0x1b34f(%rip), %rax     # 0x1e320
leaq 0x153d0(%rip), %rsi     # 0x183a8
movq %rax, (%rsp)
movb $0x0, %al
callq 0x23b0
cmpl $0x0, 0x1b386(%rip)     # 0x1e370
je 0x2ff7
movl 0x1b37e(%rip), %edi     # 0x1e370
callq 0x20b0
callq 0x9970
movq 0x1afdd(%rip), %rax     # 0x1dfe0
movq (%rax), %rdi
movl 0x1b324(%rip), %edx     # 0x1e330
movl 0x1b31a(%rip), %ecx     # 0x1e32c
leaq 0x153bd(%rip), %rsi     # 0x183d6
movb $0x0, %al
callq 0x23b0
callq 0x3c10
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x304f
movq 0x1afac(%rip), %rax     # 0x1dfe0
movq (%rax), %rdi
leaq 0x153b9(%rip), %rsi     # 0x183f7
movb $0x0, %al
callq 0x23b0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x3057
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq