// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/src/citrusleaf.c
// Function: do_the_full_monte
static int
do_the_full_monte(cl_cluster *asc, int info1, int info2, int info3, const char *ns, const char *set, const cl_object *key,
	const cf_digest *digest, cl_bin **values, cl_operator operator, cl_operation **operations, int *n_values, 
	uint32_t *cl_gen, const cl_write_parameters *cl_w_p, uint64_t *trid, char **setname_r)
{
	int rv = -1;
#ifdef DEBUG_HISTOGRAM	
    uint64_t start_time = cf_getms();
#endif	
	

	uint8_t		rd_stack_buf[STACK_BUF_SZ];	
	uint8_t		*rd_buf = rd_stack_buf;
	size_t		rd_buf_sz = 0;
    
	uint8_t		wr_stack_buf[STACK_BUF_SZ];
	uint8_t		*wr_buf = wr_stack_buf;
	size_t		wr_buf_sz = sizeof(wr_stack_buf);

	as_msg 		msg;
    
    uint        progress_timeout_ms;
	uint64_t deadline_ms;
	cl_cluster_node *node = 0;

	int fd = -1;

//	if( *values ){
//		dump_values(*values, null, *n_values);
//	}else if( *operations ){
//		dump_values(null, *operations, *n_values);
//	}	
	 
	/* 
	 * Check if the current process is the one which spawned the background threads (tend,batch).
	 * If it is not, it means that this process is a forked child process. The threads would not
	 * be running in this case. So, spawn the background threads and remember that this process
	 * has started the threads.
	 */
	if(g_init_pid != getpid()) {
		cf_atomic32_set(&batch_initialized,0);
		g_clust_initialized = 0;
		citrusleaf_init();
	}

	cf_digest d_ret;	
	if (n_values && ( values || operations) ){
		if (cl_compile(info1, info2, info3, ns, set, key, digest, values?*values:NULL, operator, operations?*operations:NULL,
				*n_values , &wr_buf, &wr_buf_sz, cl_w_p, &d_ret, *trid, NULL)) {
			return(rv);
		}
	}else{
		if (cl_compile(info1, info2, info3, ns, set, key, digest, 0, 0, 0, 0, &wr_buf, &wr_buf_sz, cl_w_p, &d_ret, *trid, NULL)) {
			return(rv);
		}
	}	

#ifdef DEBUG_VERBOSE
	dump_buf("sending request to cluster:", wr_buf, wr_buf_sz);
#endif	

	int try = 0;

#ifdef DEBUG_TIME
	uint64_t before_write_time = 0;
	uint64_t after_write_time = 0;
	uint64_t before_read_header_time = 0;
	uint64_t after_read_header_time = 0;
	uint64_t before_read_body_time = 0;
    uint64_t after_read_body_time = 0;	
#endif

    deadline_ms = 0;
    progress_timeout_ms = 0;
    if (cl_w_p && cl_w_p->timeout_ms) {
    	// policy: if asking for a long timeout, give enough time to try two servers
    	if (cl_w_p->timeout_ms > 700) {
			deadline_ms = cf_getms() + cl_w_p->timeout_ms;
			progress_timeout_ms = cl_w_p->timeout_ms / 2;
		}
		else {
			deadline_ms = cf_getms() + cl_w_p->timeout_ms;
			progress_timeout_ms = cl_w_p->timeout_ms;
		}
#ifdef DEBUG_VERBOSE        
        cf_debug("transaction has deadline: in %d deadlinems %"PRIu64" progress %d",
        	(int)cl_w_p->timeout_ms,deadline_ms,progress_timeout_ms);
#endif        
    }
    else {
        progress_timeout_ms = DEFAULT_PROGRESS_TIMEOUT;
    }
	
	// retry request based on the write_policy
	do {

#ifdef DEBUG_TIME
		before_write_time = 0;
		after_write_time = 0;
		before_read_header_time = 0;
		after_read_header_time = 0;
		before_read_body_time = 0;
		after_read_body_time = 0;
#endif
        
#ifdef DEBUG		
		if (try > 0)
			cf_debug("request retrying try %d tid %zu", try, (uint64_t)pthread_self());
#endif        
		try++;
		
		// Get an FD from a cluster
		node = cl_cluster_node_get(asc, ns, &d_ret, info2 & CL_MSG_INFO2_WRITE ? true : false);
		if (!node) {
#ifdef DEBUG
			cf_debug("warning: no healthy nodes in cluster, retrying");
#endif
			usleep(10000);
			goto Retry;
		}
		fd = cl_cluster_node_fd_get(node, false, asc->nbconnect);
		if (fd == -1) {
#ifdef DEBUG			
			cf_debug("warning: node %s has no file descriptors, retrying transaction (tid %zu)", node->name, (uint64_t)pthread_self());
#endif			
			usleep(1000);
			goto Retry;
		}

#ifdef DEBUG_VERBOSE
		cf_debug("node %s fd %d", node->name, fd);
#endif		
		
		// Hate special cases, but we have to clear the verify bit on delete verify
		if ( (info2 & CL_MSG_INFO2_DELETE) && (info1 & CL_MSG_INFO1_VERIFY))
		{
			as_msg *msgp = (as_msg *)wr_buf;
			msgp->m.info1 &= ~CL_MSG_INFO1_VERIFY;
		}
		
		// send it to the cluster - non blocking socket, but we're blocking

#ifdef DEBUG_TIME
        before_write_time = cf_getms();
#endif
		rv = cf_socket_write_timeout(fd, wr_buf, wr_buf_sz, deadline_ms, progress_timeout_ms);
#ifdef DEBUG_TIME
        after_write_time = cf_getms();
#endif

		if (rv != 0) {
#ifdef DEBUG			
			cf_debug("Citrusleaf: write timeout or error when writing header to server - %d fd %d errno %d (tid %zu)",rv,fd,errno,(uint64_t)pthread_self());
#endif
#ifdef DEBUG_TIME
            debug_printf(before_write_time, after_write_time, before_read_header_time, after_read_header_time, before_read_body_time, after_read_body_time,
                         deadline_ms, progress_timeout_ms);           	
#endif

			cl_cluster_node_dun(node, rv == ETIMEDOUT ? NODE_DUN_TIMEOUT : NODE_DUN_NET_ERR);
			goto Retry;
		}

#ifdef DEBUG		
		memset(&msg, 0, sizeof(as_msg));
#endif
#ifdef DEBUG_TIME
        before_read_header_time = cf_getms();
#endif		
		
		// Now turn around and read into this fine cl_msg, which is the short header
		rv = cf_socket_read_timeout(fd, (uint8_t *) &msg, sizeof(as_msg), deadline_ms, progress_timeout_ms);
#ifdef DEBUG_TIME
        after_read_header_time = cf_getms();
#endif

		if (rv) {

#ifdef DEBUG            
			cf_debug("Citrusleaf: error when reading header from server - rv %d fd %d", rv, fd);
#endif
#ifdef DEBUG_TIME
            debug_printf(before_write_time, after_write_time, before_read_header_time, after_read_header_time, before_read_body_time, after_read_body_time,
                         deadline_ms, progress_timeout_ms);           	
#endif            

			cl_cluster_node_dun(node, rv == ETIMEDOUT ? NODE_DUN_TIMEOUT : NODE_DUN_NET_ERR);
			goto Retry;
	
		}
#ifdef DEBUG_VERBOSE
		dump_buf("read header from cluster", (uint8_t *) &msg, sizeof(cl_msg));
#endif	
		cl_proto_swap(&msg.proto);
		cl_msg_swap_header(&msg.m);

		if (/*(info1 & CL_MSG_INFO1_READ) &&*/ cl_gen) {
			*cl_gen = msg.m.generation;
		}
	
		
		// second read for the remainder of the message - expect this to cover everything requested
		// if there's no error
		rd_buf_sz =  msg.proto.sz  - msg.m.header_sz;
		if (rd_buf_sz > 0) {
			if (rd_buf_sz > sizeof(rd_stack_buf)) {
				rd_buf = malloc(rd_buf_sz);
				if (!rd_buf) {
                    cf_error("malloc fail: trying %zu", rd_buf_sz);
                    rv = -1; 
                    goto Error; 
                }
			}
#ifdef DEBUG_TIME
        before_read_body_time = cf_getms();
#endif            
			rv = cf_socket_read_timeout(fd, rd_buf, rd_buf_sz, deadline_ms, progress_timeout_ms);
#ifdef DEBUG_TIME
        after_read_body_time = cf_getms();
#endif
			if (rv) {
				if (rd_buf != rd_stack_buf) { free(rd_buf); }
                rd_buf = 0;
                
#ifdef DEBUG            
                cf_debug("Citrusleaf: error when reading from server - rv %d fd %d", rv, fd);
#endif
#ifdef DEBUG_TIME
				debug_printf(before_write_time, after_write_time, before_read_header_time, after_read_header_time, before_read_body_time, after_read_body_time, 
                             deadline_ms, progress_timeout_ms);           	
#endif

				cl_cluster_node_dun(node, rv == ETIMEDOUT ? NODE_DUN_TIMEOUT : NODE_DUN_NET_ERR);
				goto Retry;
			}

#ifdef DEBUG_VERBOSE
			dump_buf("read body from cluster", rd_buf, rd_buf_sz);
#endif	
			
			// todo: check error!!?!?!
		}

        goto Ok;
		
Retry:		

		if (fd != -1) {
			close(fd);
			fd = -1;
		}

		if (node) {
            cl_cluster_node_put(node); 
            node = 0; 
        }

        if (deadline_ms && (deadline_ms < cf_getms() ) ) {
#ifdef DEBUG            
            cf_debug("out of luck out of time : deadline %"PRIu64" now %"PRIu64,
                deadline_ms, cf_getms());
#endif            
            rv = CITRUSLEAF_FAIL_TIMEOUT;
            goto Error;
        }
		
	} while ( (cl_w_p == 0) || (cl_w_p->w_pol == CL_WRITE_RETRY) );
	
Error:	
	
#ifdef DEBUG	
	cf_debug("exiting with failure: wpol %d timeleft %d rv %d",
		(int)(cl_w_p ? cl_w_p->w_pol : 0),
		(int)(deadline_ms - cf_getms() ), rv );
#endif	

    if (fd != -1)   close(fd);

	if (wr_buf != wr_stack_buf)		free(wr_buf);
	if (rd_buf && (rd_buf != rd_stack_buf))		free(rd_buf);
	
	return(rv);
    
Ok:    

	cl_cluster_node_ok(node);
    cl_cluster_node_fd_put(node, fd, false);
	cl_cluster_node_put(node);
   
	if (wr_buf != wr_stack_buf)		free(wr_buf);

	if (rd_buf) {
		if (0 != cl_parse(&msg.m, rd_buf, rd_buf_sz, values, operations, n_values, trid, setname_r)) {
			rv = CITRUSLEAF_FAIL_UNKNOWN;
		}
		else {
			rv = msg.m.result_code;
			// special case: if there was a retry, and we're doing a delete, force 'not found'
			// errors to 'ok' because the first delete might have succeeded
			if ((try > 1) && (rv == 2) && (info2 & CL_MSG_INFO2_DELETE)) {
//				dump_key("delete: stomping error code on retransmitted delete", key);
				rv = 0;
			}
		}
    }
    else {
        rv = CITRUSLEAF_FAIL_UNKNOWN;
    }    
	if (rd_buf && (rd_buf != rd_stack_buf))		free(rd_buf);
	
	if (rv == 0 && (values || operations) && n_values) {
		for (int i=0;i<*n_values;i++) {
			cl_bin *bin = values? &(*values)[i] : &((*operations)[i].bin);
//			if ( bin->object.type == CL_NULL ) {
//				// raise(SIGINT);
//			}
		}
	}
#ifdef DEBUG_HISTOGRAM	
    cf_histogram_insert_data_point(cf_hist, start_time);
#endif	
#ifdef DEBUG_VERBOSE
	if (rv != 0) {
		cf_debug("exiting OK clause with failure: wpol %d timeleft %d rv %d",
			(int)(cl_w_p ? cl_w_p->w_pol : 0),
			(int)(deadline_ms - cf_getms() ), rv );
	}
#endif	

	return(rv);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8198, %rsp           # imm = 0x8198
movq 0x8218(%rsp), %rax
movq 0x8210(%rsp), %rax
movq 0x8208(%rsp), %rax
movq 0x8200(%rsp), %rax
movq 0x81f8(%rsp), %rax
movq 0x81f0(%rsp), %rax
movl 0x81e8(%rsp), %eax
movq 0x81e0(%rsp), %rax
movq 0x81d8(%rsp), %rax
movq 0x81d0(%rsp), %rax
movq %rdi, 0x8188(%rsp)
movl %esi, 0x8184(%rsp)
movl %edx, 0x8180(%rsp)
movl %ecx, 0x817c(%rsp)
movq %r8, 0x8170(%rsp)
movq %r9, 0x8168(%rsp)
movl $0xffffffff, 0x8164(%rsp) # imm = 0xFFFFFFFF
leaq 0x4160(%rsp), %rax
movq %rax, 0x4158(%rsp)
movq $0x0, 0x4150(%rsp)
leaq 0x150(%rsp), %rax
movq %rax, 0x148(%rsp)
movq $0x4000, 0x140(%rsp) # imm = 0x4000
movq $0x0, 0x108(%rsp)
movl $0xffffffff, 0x104(%rsp) # imm = 0xFFFFFFFF
leaq 0x18e16(%rip), %rax     # 0x203b4
movl (%rax), %eax
movl %eax, 0xcc(%rsp)
callq 0x23d0
movl %eax, %ecx
movl 0xcc(%rsp), %eax
cmpl %ecx, %eax
je 0x75d8
leaq 0x18e80(%rip), %rax     # 0x20440
movl $0x0, (%rax)
leaq 0x18deb(%rip), %rax     # 0x203b8
movl $0x0, (%rax)
callq 0x9970
cmpq $0x0, 0x81f8(%rsp)
je 0x77b7
cmpq $0x0, 0x81e0(%rsp)
jne 0x7601
cmpq $0x0, 0x81f0(%rsp)
je 0x77b7
movl 0x8184(%rsp), %eax
movl %eax, 0x9c(%rsp)
movl 0x8180(%rsp), %eax
movl %eax, 0xa0(%rsp)
movl 0x817c(%rsp), %eax
movl %eax, 0xa4(%rsp)
movq 0x8170(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x8168(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x81d0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x81d8(%rsp), %rax
movq %rax, 0xc0(%rsp)
cmpq $0x0, 0x81e0(%rsp)
je 0x768b
movq 0x81e0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x90(%rsp)
jmp 0x7697
xorl %eax, %eax
movq %rax, 0x90(%rsp)
jmp 0x7697
movq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movl 0x81e8(%rsp), %eax
movl %eax, 0x8c(%rsp)
cmpq $0x0, 0x81f0(%rsp)
je 0x76d2
movq 0x81f0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x78(%rsp)
jmp 0x76db
xorl %eax, %eax
movq %rax, 0x78(%rsp)
jmp 0x76db
movq 0x80(%rsp), %r13
movq 0xc0(%rsp), %r12
movq 0xb8(%rsp), %r9
movq 0xb0(%rsp), %r8
movl 0xa4(%rsp), %edx
movl 0xa0(%rsp), %esi
movl 0x9c(%rsp), %edi
movq 0x78(%rsp), %r15
movq 0x81f8(%rsp), %rax
movl (%rax), %ebp
movq 0x8208(%rsp), %r11
movq 0x8210(%rsp), %rax
movq (%rax), %rax
leaq 0x148(%rsp), %r14
leaq 0x140(%rsp), %rbx
leaq 0xf0(%rsp), %r10
xorl %ecx, %ecx
movq 0xa8(%rsp), %rcx
movq %r12, (%rsp)
movl 0x8c(%rsp), %r12d
movq %r13, 0x8(%rsp)
movl %r12d, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movl %ebp, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r11, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
callq 0x5fb0
cmpl $0x0, %eax
je 0x77b2
movl 0x8164(%rsp), %eax
movl %eax, 0x8194(%rsp)
jmp 0x7fb5
jmp 0x7884
movl 0x8184(%rsp), %edi
movl 0x8180(%rsp), %esi
movl 0x817c(%rsp), %edx
movq 0x8170(%rsp), %rcx
movq 0x8168(%rsp), %r8
movq 0x81d0(%rsp), %r9
movq 0x81d8(%rsp), %r15
movq 0x8208(%rsp), %r11
movq 0x8210(%rsp), %rax
movq (%rax), %rax
xorl %r10d, %r10d
xorl %r10d, %r10d
leaq 0x148(%rsp), %r14
leaq 0x140(%rsp), %rbx
leaq 0xf0(%rsp), %r10
movq %r15, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r11, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
callq 0x5fb0
cmpl $0x0, %eax
je 0x7882
movl 0x8164(%rsp), %eax
movl %eax, 0x8194(%rsp)
jmp 0x7fb5
jmp 0x7884
movl $0x0, 0xec(%rsp)
movq $0x0, 0x110(%rsp)
movl $0x0, 0x11c(%rsp)
cmpq $0x0, 0x8208(%rsp)
je 0x793c
movq 0x8208(%rsp), %rax
cmpl $0x0, 0xc(%rax)
je 0x793c
movq 0x8208(%rsp), %rax
cmpl $0x2bc, 0xc(%rax)       # imm = 0x2BC
jle 0x790c
callq 0x9c20
movq 0x8208(%rsp), %rcx
movslq 0xc(%rcx), %rcx
addq %rcx, %rax
movq %rax, 0x110(%rsp)
movq 0x8208(%rsp), %rax
movl 0xc(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x11c(%rsp)
jmp 0x793a
callq 0x9c20
movq 0x8208(%rsp), %rcx
movslq 0xc(%rcx), %rcx
addq %rcx, %rax
movq %rax, 0x110(%rsp)
movq 0x8208(%rsp), %rax
movl 0xc(%rax), %eax
movl %eax, 0x11c(%rsp)
jmp 0x7947
movl $0x32, 0x11c(%rsp)
jmp 0x7949
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
movq 0x8188(%rsp), %rdi
movq 0x8170(%rsp), %rsi
movl 0x8180(%rsp), %edx
andl $0x1, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
movzbl %al, %ecx
andl $0x1, %ecx
leaq 0xf0(%rsp), %rdx
callq 0xb760
movq %rax, 0x108(%rsp)
cmpq $0x0, 0x108(%rsp)
jne 0x79bc
movl $0x2710, %edi           # imm = 0x2710
callq 0x2390
jmp 0x7c7c
movq 0x108(%rsp), %rdi
movq 0x8188(%rsp), %rax
movb 0x15(%rax), %al
xorl %esi, %esi
andb $0x1, %al
movzbl %al, %edx
callq 0xc160
movl %eax, 0x104(%rsp)
cmpl $-0x1, 0x104(%rsp)
jne 0x79fb
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x2390
jmp 0x7c7c
movl 0x8180(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7a3b
movl 0x8184(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x7a3b
movq 0x148(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movzbl 0x9(%rax), %ecx
andl $-0x9, %ecx
movb %cl, 0x9(%rax)
movl 0x104(%rsp), %edi
movq 0x148(%rsp), %rsi
movq 0x140(%rsp), %rdx
movq 0x110(%rsp), %rcx
movl 0x11c(%rsp), %r8d
callq 0x15c90
movl %eax, 0x8164(%rsp)
cmpl $0x0, 0x8164(%rsp)
je 0x7aa1
movq 0x108(%rsp), %rdi
movl 0x8164(%rsp), %ecx
movl $0x32, %esi
movl $0x1, %eax
cmpl $0x6e, %ecx
cmovel %eax, %esi
callq 0xbe50
jmp 0x7c7c
movl 0x104(%rsp), %edi
movq 0x110(%rsp), %rcx
movl 0x11c(%rsp), %r8d
leaq 0x122(%rsp), %rsi
movl $0x1e, %edx
callq 0x15350
movl %eax, 0x8164(%rsp)
cmpl $0x0, 0x8164(%rsp)
je 0x7b04
movq 0x108(%rsp), %rdi
movl 0x8164(%rsp), %ecx
movl $0x32, %esi
movl $0x1, %eax
cmpl $0x6e, %ecx
cmovel %eax, %esi
callq 0xbe50
jmp 0x7c7c
leaq 0x122(%rsp), %rdi
callq 0x13a70
leaq 0x122(%rsp), %rdi
addq $0x8, %rdi
callq 0x13af0
cmpq $0x0, 0x8200(%rsp)
je 0x7b3e
movl 0x130(%rsp), %ecx
movq 0x8200(%rsp), %rax
movl %ecx, (%rax)
movl 0x124(%rsp), %eax
movzwl 0x128(%rsp), %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movzbl 0x12a(%rsp), %ecx
subq %rcx, %rax
movq %rax, 0x4150(%rsp)
cmpq $0x0, 0x4150(%rsp)
jbe 0x7c77
cmpq $0x4000, 0x4150(%rsp) # imm = 0x4000
jbe 0x7be4
movq 0x4150(%rsp), %rdi
callq 0x2310
movq %rax, 0x4158(%rsp)
cmpq $0x0, 0x4158(%rsp)
jne 0x7be2
leaq 0x1672d(%rip), %rax     # 0x1e2d8
movl (%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jg 0x7bd2
leaq 0x16726(%rip), %rax     # 0x1e2e0
movq (%rax), %rcx
movq 0x4150(%rsp), %rdx
xorl %edi, %edi
leaq 0x10da4(%rip), %rsi     # 0x18972
movb $0x0, %al
callq *%rcx
movl $0xffffffff, 0x8164(%rsp) # imm = 0xFFFFFFFF
jmp 0x7d2c
jmp 0x7be4
movl 0x104(%rsp), %edi
movq 0x4158(%rsp), %rsi
movq 0x4150(%rsp), %rdx
movq 0x110(%rsp), %rcx
movl 0x11c(%rsp), %r8d
callq 0x15350
movl %eax, 0x8164(%rsp)
cmpl $0x0, 0x8164(%rsp)
je 0x7c75
movq 0x4158(%rsp), %rax
leaq 0x4160(%rsp), %rcx
cmpq %rcx, %rax
je 0x7c43
movq 0x4158(%rsp), %rdi
callq 0x22e0
movq $0x0, 0x4158(%rsp)
movq 0x108(%rsp), %rdi
movl 0x8164(%rsp), %ecx
movl $0x32, %esi
movl $0x1, %eax
cmpl $0x6e, %ecx
cmovel %eax, %esi
callq 0xbe50
jmp 0x7c7c
jmp 0x7c77
jmp 0x7da4
cmpl $-0x1, 0x104(%rsp)
je 0x7c9d
movl 0x104(%rsp), %edi
callq 0x2570
movl $0xffffffff, 0x104(%rsp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x108(%rsp)
je 0x7cc1
movq 0x108(%rsp), %rdi
callq 0xbe40
movq $0x0, 0x108(%rsp)
cmpq $0x0, 0x110(%rsp)
je 0x7cf8
movq 0x110(%rsp), %rax
movq %rax, 0x70(%rsp)
callq 0x9c20
movq %rax, %rcx
movq 0x70(%rsp), %rax
cmpq %rcx, %rax
jae 0x7cf8
movl $0xfffffffe, 0x8164(%rsp) # imm = 0xFFFFFFFE
jmp 0x7d2c
jmp 0x7cfa
movb $0x1, %al
cmpq $0x0, 0x8208(%rsp)
movb %al, 0x6f(%rsp)
je 0x7d1e
movq 0x8208(%rsp), %rax
cmpl $0x2, 0x14(%rax)
sete %al
movb %al, 0x6f(%rsp)
movb 0x6f(%rsp), %al
testb $0x1, %al
jne 0x7949
jmp 0x7d2c
cmpl $-0x1, 0x104(%rsp)
je 0x7d42
movl 0x104(%rsp), %edi
callq 0x2570
movq 0x148(%rsp), %rax
leaq 0x150(%rsp), %rcx
cmpq %rcx, %rax
je 0x7d64
movq 0x148(%rsp), %rdi
callq 0x22e0
cmpq $0x0, 0x4158(%rsp)
je 0x7d91
movq 0x4158(%rsp), %rax
leaq 0x4160(%rsp), %rcx
cmpq %rcx, %rax
je 0x7d91
movq 0x4158(%rsp), %rdi
callq 0x22e0
movl 0x8164(%rsp), %eax
movl %eax, 0x8194(%rsp)
jmp 0x7fb5
movq 0x108(%rsp), %rdi
callq 0xbed0
movq 0x108(%rsp), %rdi
movl 0x104(%rsp), %esi
xorl %edx, %edx
callq 0xc230
movq 0x108(%rsp), %rdi
callq 0xbe40
movq 0x148(%rsp), %rax
leaq 0x150(%rsp), %rcx
cmpq %rcx, %rax
je 0x7df6
movq 0x148(%rsp), %rdi
callq 0x22e0
cmpq $0x0, 0x4158(%rsp)
je 0x7ead
leaq 0x122(%rsp), %rdi
addq $0x8, %rdi
movq 0x4158(%rsp), %rsi
movq 0x4150(%rsp), %rdx
movq 0x81e0(%rsp), %rcx
movq 0x81f0(%rsp), %r8
movq 0x81f8(%rsp), %r9
movq 0x8210(%rsp), %r10
movq 0x8218(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x6dc0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x7e6c
movl $0x1, 0x8164(%rsp)
jmp 0x7eab
movzbl 0x12f(%rsp), %eax
movl %eax, 0x8164(%rsp)
cmpl $0x1, 0xec(%rsp)
jle 0x7ea9
cmpl $0x2, 0x8164(%rsp)
jne 0x7ea9
movl 0x8180(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7ea9
movl $0x0, 0x8164(%rsp)
jmp 0x7eab
jmp 0x7eb8
movl $0x1, 0x8164(%rsp)
cmpq $0x0, 0x4158(%rsp)
je 0x7ee5
movq 0x4158(%rsp), %rax
leaq 0x4160(%rsp), %rcx
cmpq %rcx, %rax
je 0x7ee5
movq 0x4158(%rsp), %rdi
callq 0x22e0
cmpl $0x0, 0x8164(%rsp)
jne 0x7fa7
cmpq $0x0, 0x81e0(%rsp)
jne 0x7f0d
cmpq $0x0, 0x81f0(%rsp)
je 0x7fa7
cmpq $0x0, 0x81f8(%rsp)
je 0x7fa7
movl $0x0, 0xdc(%rsp)
movl 0xdc(%rsp), %eax
movq 0x81f8(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x7fa5
cmpq $0x0, 0x81e0(%rsp)
je 0x7f66
movq 0x81e0(%rsp), %rax
movq (%rax), %rax
movslq 0xdc(%rsp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, 0x60(%rsp)
jmp 0x7f85
movq 0x81f0(%rsp), %rax
movq (%rax), %rax
movslq 0xdc(%rsp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0xd0(%rsp)
movl 0xdc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xdc(%rsp)
jmp 0x7f27
jmp 0x7fa7
movl 0x8164(%rsp), %eax
movl %eax, 0x8194(%rsp)
movl 0x8194(%rsp), %eax
addq $0x8198, %rsp           # imm = 0x8198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop