// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/example/main.c
// Function: main
int
main(int argc, char **argv)
{
	config g_config;
	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 = "example_set";
	g_config.verbose = false;
	g_config.follow = true;
	
	bool use_shm = false;
	int	c;
	
	printf("example of the C citrusleaf library\n");
	
	while ((c = getopt(argc, argv, "h:p:n:s:b:m:vr")) != -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.set = strdup(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 'r':
			use_shm = true;
			break;

		default:
			usage();
			return(-1);
			
		}
	}

	fprintf(stderr, "example: host %s port %d ns %s set %s\n",
		g_config.host,g_config.port,g_config.ns,g_config.set);

	if (use_shm) {
		citrusleaf_use_shm(10,788722985);
	}

	// init the unit before creating any clusters
	int rv = citrusleaf_init();
	if(rv!=0) {
		fprintf(stderr,"Citrusleaf init failed\n");
	}
	
	// Create a citrusleaf cluster object for subsequent requests
	g_config.asc = citrusleaf_cluster_create();
	if (!g_config.asc) {
		fprintf(stderr, "could not create cluster, internal error\n");
		return(-1);
	}
	if (g_config.follow == false)
		citrusleaf_cluster_follow(g_config.asc, false);
	
	citrusleaf_cluster_add_host(g_config.asc, g_config.host, g_config.port, 200 /*timeout*/);

	// Make some example requests against the cluster
	if (0 != do_example(&g_config)) {
		fprintf(stderr, "example failed!\n");
		return(-1);
	}
	fprintf(stderr, "example succeeded!\n");
	citrusleaf_shutdown();
	return(0);
}

// Assembly:
subq $0x58, %rsp
movl $0x0, 0x54(%rsp)
movl %edi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x5150
leaq 0x14763(%rip), %rax     # 0x1a2c0
movq %rax, 0x18(%rsp)
movl $0xbb8, 0x20(%rsp)      # imm = 0xBB8
leaq 0x14759(%rip), %rax     # 0x1a2ca
movq %rax, 0x28(%rsp)
leaq 0x14752(%rip), %rax     # 0x1a2cf
movq %rax, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movb $0x1, 0x39(%rsp)
movb $0x0, 0x17(%rsp)
leaq 0x14743(%rip), %rdi     # 0x1a2db
movb $0x0, %al
callq 0x5050
movl 0x50(%rsp), %edi
movq 0x48(%rsp), %rsi
leaq 0x14751(%rip), %rdx     # 0x1a300
callq 0x50a0
movl %eax, 0x10(%rsp)
cmpl $-0x1, %eax
je 0x5c83
movl 0x10(%rsp), %eax
addl $-0x66, %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x10, %eax
ja 0x5c6c
movq (%rsp), %rax
leaq 0x14422(%rip), %rcx     # 0x1a004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1a3de(%rip), %rax     # 0x1ffd0
movq (%rax), %rdi
callq 0x54c0
movq %rax, 0x18(%rsp)
jmp 0x5c7e
movq 0x1a3c8(%rip), %rax     # 0x1ffd0
movq (%rax), %rdi
callq 0x5420
movl %eax, 0x20(%rsp)
jmp 0x5c7e
movq 0x1a3b3(%rip), %rax     # 0x1ffd0
movq (%rax), %rdi
callq 0x54c0
movq %rax, 0x28(%rsp)
jmp 0x5c7e
movq 0x1a39d(%rip), %rax     # 0x1ffd0
movq (%rax), %rdi
callq 0x54c0
movq %rax, 0x30(%rsp)
jmp 0x5c7e
movq 0x1a387(%rip), %rax     # 0x1ffd0
movq (%rax), %rdi
callq 0x5420
movl %eax, 0x3c(%rsp)
jmp 0x5c7e
movb $0x1, 0x38(%rsp)
jmp 0x5c7e
movb $0x0, 0x39(%rsp)
jmp 0x5c7e
movb $0x1, 0x17(%rsp)
jmp 0x5c7e
callq 0x5a50
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0x5db1
jmp 0x5b9f
movq 0x1a356(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
movq 0x18(%rsp), %rdx
movl 0x20(%rsp), %ecx
movq 0x28(%rsp), %r8
movq 0x30(%rsp), %r9
leaq 0x14668(%rip), %rsi     # 0x1a30f
movb $0x0, %al
callq 0x5380
testb $0x1, 0x17(%rsp)
je 0x5cc4
movl $0xa, %edi
movl $0x2f02f529, %esi       # imm = 0x2F02F529
callq 0x11ae0
callq 0xa2c0
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0x5cec
movq 0x1a305(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x14651(%rip), %rsi     # 0x1a336
movb $0x0, %al
callq 0x5380
callq 0xa730
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
jne 0x5d23
movq 0x1a2db(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x1463f(%rip), %rsi     # 0x1a34e
movb $0x0, %al
callq 0x5380
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0x5db1
movb 0x39(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5d3d
movq 0x40(%rsp), %rdi
xorl %esi, %esi
callq 0xbb30
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0x20(%rsp), %eax
movl $0xc8, %ecx
movswl %ax, %edx
callq 0xabb0
leaq 0x18(%rsp), %rdi
callq 0x5620
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x5d8c
movq 0x1a26f(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x145fd(%rip), %rsi     # 0x1a378
movb $0x0, %al
callq 0x5380
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0x5db1
movq 0x1a24d(%rip), %rax     # 0x1ffe0
movq (%rax), %rdi
leaq 0x145ec(%rip), %rsi     # 0x1a389
movb $0x0, %al
callq 0x5380
callq 0xa320
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw (%rax,%rax)