// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r12
movl %edi, %r13d
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
leaq 0xc7b8(%rip), %rax      # 0x122c0
movq %rax, 0x10(%rsp)
movl $0xbb8, 0x18(%rsp)      # imm = 0xBB8
leaq 0xc7ae(%rip), %rax      # 0x122ca
movq %rax, 0x20(%rsp)
leaq 0xc7a7(%rip), %rax      # 0x122cf
movq %rax, 0x48(%rsp)
movq %rax, 0x28(%rsp)
movw $0x100, 0x30(%rsp)      # imm = 0x100
leaq 0xc838(%rip), %rdi      # 0x12378
callq 0x53f0
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x18(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
movb $0x1, %al
movl %eax, 0x4(%rsp)
movl $0x0, 0x8(%rsp)
movl 0x34(%rsp), %eax
movl %eax, (%rsp)
leaq 0xc75e(%rip), %rbp      # 0x122db
leaq 0xc480(%rip), %r15      # 0x12004
movq 0x13445(%rip), %rbx     # 0x18fd0
xorl %eax, %eax
movl %eax, %r14d
movl %r13d, %edi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x5080
leal -0x66(%rax), %ecx
cmpl $0x10, %ecx
ja 0x5c2a
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
movb $0x1, %al
jmpq *%rcx
movl $0x0, 0x4(%rsp)
movl %r14d, %eax
jmp 0x5b8d
movq (%rbx), %rdi
callq 0x5400
movl %eax, (%rsp)
movl %r14d, %eax
jmp 0x5b8d
movq (%rbx), %rdi
callq 0x5490
movq %rax, 0x40(%rsp)
movl %r14d, %eax
jmp 0x5b8d
movq (%rbx), %rdi
callq 0x5490
movq %rax, 0x48(%rsp)
movl %r14d, %eax
jmp 0x5b8d
movq (%rbx), %rdi
callq 0x5490
movq %rax, 0x50(%rsp)
movl %r14d, %eax
jmp 0x5b8d
movq (%rbx), %rdi
callq 0x5400
movl %eax, 0xc(%rsp)
movl %r14d, %eax
jmp 0x5b8d
movb $0x1, %al
movl %eax, 0x8(%rsp)
movl %r14d, %eax
jmp 0x5b8d
cmpl $-0x1, %eax
jne 0x5cc6
movl (%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x4(%rsp), %eax
movb %al, 0x31(%rsp)
movl 0x8(%rsp), %eax
movb %al, 0x30(%rsp)
movq 0x48(%rsp), %r9
movq %r9, 0x28(%rsp)
movq 0x40(%rsp), %r8
movq %r8, 0x20(%rsp)
movl 0xc(%rsp), %ebp
movl %ebp, 0x18(%rsp)
movq 0x50(%rsp), %r12
movq %r12, 0x10(%rsp)
movq 0x13369(%rip), %r15     # 0x18fe0
movq (%r15), %rdi
leaq 0xc669(%rip), %rsi      # 0x122ea
movq %r12, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x5350
testb $0x1, %r14b
je 0x5ca2
movl $0xa, %edi
movl $0x2f02f529, %esi       # imm = 0x2F02F529
callq 0xc8cc
callq 0x812a
testl %eax, %eax
je 0x5cb0
callq 0x56a1
callq 0x82a8
movq %rax, 0x38(%rsp)
testq %rax, %rax
jne 0x5d1c
callq 0x56ee
jmp 0x5d08
movl (%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x4(%rsp), %eax
movb %al, 0x31(%rsp)
movl 0x8(%rsp), %eax
movb %al, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x18(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x5510
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
cmpb $0x0, 0x31(%rsp)
jne 0x5d30
movq %rbx, %rdi
xorl %esi, %esi
callq 0x92af
movswl %bp, %edx
movq %rbx, %rdi
movq %r12, %rsi
movl $0xc8, %ecx
callq 0x8589
leaq 0x10(%rsp), %rdi
callq 0x58cc
movq (%r15), %rdi
testl %eax, %eax
jne 0x5d5d
callq 0x56d2
xorl %eax, %eax
jmp 0x5d0d
callq 0x56bd
jmp 0x5d08