// File: /workspace/github_c_makefile_star2_O0/sharpyfox[P]citrusleaf-client/tests/key_c/src/key.c
// Function: read_fn
void *
read_fn(void *udata)
{
	read_work *work = (read_work *) udata;
	uint32_t delay_factor = 0;

	if (g_config.verbose) fprintf(stderr, " read thread started: key_start %d nkeys %d\n",work->start_key,work->n_keys);
	
	for (uint i=0;i<work->n_reads;i++) {
	
		cl_rv rv;
		uint key_int = (rand_64() % work->n_keys) + work->start_key;
		key_value *kv = make_key_value(key_int, work->key_len, work->value_len);

		// Create the key we want to read
		cl_object o_key;
		if (g_config.key_type == CL_STR) {
			citrusleaf_object_init_str(&o_key,kv->key_str);
		}
		else if (g_config.key_type == CL_INT) {
			citrusleaf_object_init_int(&o_key,kv->key_int);
		}
		else {
			if (!g_config.silent) fprintf(stderr, " read thread: unsupport key type %d\n",g_config.key_type);
		}
	
		// bundle it into a value array
		cl_bin values[1];
		memset(values, 0, sizeof(values));
		strcpy(values[0].bin_name, g_config.bin);
	
#ifdef PRINT_KEY
		cf_digest d;
		citrusleaf_calculate_digest(g_config.table, &o_key, &d);
		fprintf(stderr, "get: key %d digest %"PRIx64"\n",key_int, *(uint64_t *)&d);
#endif
		
		
		if (g_config.server_validate) {
	
			if (g_config.value_type == CL_STR) {
				citrusleaf_object_init_str(&values[0].object, kv->value_str);
			}
			else if (g_config.value_type == CL_BLOB) {
				citrusleaf_object_init_blob(&values[0].object, kv->value_blob, kv->value_blob_len);
			}
			else if (g_config.value_type == CL_INT) {
				citrusleaf_object_init_int(&values[0].object, kv->value_int);
			}
			else {
				if (!g_config.silent) fprintf(stderr, "INTERNAL ERROR: unexpected value type under verify, help!\n");
			}
			if (CITRUSLEAF_OK != (rv = citrusleaf_verify(work->asc, g_config.ns, g_config.table, &o_key,values, 1, g_config.timeout, NULL) ) ) 
			{
				if (!g_config.silent) fprintf(stderr, "read: validate: key %d value %"PRIu64" failed with %d\n",key_int,kv->value_int, rv);
				citrusleaf_object_free(&values[0].object);
				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;
			}
		}

		else {
			// do the actual work of reading
			uint64_t start_time = cf_getms();
			if (CITRUSLEAF_OK != (rv = citrusleaf_get(work->asc, g_config.ns, g_config.table, &o_key, values, 1, g_config.timeout, 0))) {
	            uint64_t stop_time = cf_getms();
	            uint64_t diff = safe_delta_ms(start_time, stop_time);

	        	if (rv == CITRUSLEAF_FAIL_TIMEOUT || rv == CITRUSLEAF_FAIL_SERVERSIDE_TIMEOUT) {
	                histogram_insert_data_point(g_p_read_timeout_histogram, diff);

	                if (!g_config.silent) {
                        fprintf(stderr, "citrusleaf get timeout %d %"PRIu64" %d\n",rv,diff,g_config.timeout);
	                }
	        	}
	        	else {
	                if (!g_config.silent) {
	                	fprintf(stderr, "read: failed with error %d\n",rv);
	                }
	        	}
				citrusleaf_object_free(&values[0].object);
				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;
			}
			uint64_t stop_time = cf_getms();
 			histogram_insert_data_point(g_p_read_histogram,
			safe_delta_ms(start_time, stop_time));
		}
		
		// validate
		
		
		if (values[0].object.type != g_config.value_type) {
			if (!g_config.silent) fprintf(stderr, "read value has wrong type: expect %d got %d\n",(int) g_config.value_type, (int) values[0].object.type);
			if (g_config.continuous == false) {
				citrusleaf_object_free(&values[0].object);
				free(kv);
				return((void *)-1);
			}
			raise(SIGINT);
			goto NextRead;
		}
		
		if (g_config.value_type == CL_STR) {
			if (values[0].object.u.str == 0) {
				if (!g_config.silent) fprintf(stderr, "read value pointer is null. Yuck.\n");
				citrusleaf_object_free(&values[0].object);
				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;
			}
						
			if (values[0].object.sz  != strlen(kv->value_str)) {
				if (!g_config.silent) fprintf(stderr, "read value size doesn't match expected. Is %zd expecting %zd\n",
					values[0].object.sz,strlen(kv->value_str)+1);
				citrusleaf_object_free(&values[0].object);
				if (g_config.continuous == false) {
					free(kv);					
					return((void *)-1);
				}
				goto NextRead;
			}			
			
			if (strcmp(values[0].object.u.str, kv->value_str) != 0) {
				if (!g_config.silent) {
					fprintf(stderr, "read value does not match set value.\n");
					fprintf(stderr, "  expecting: %s\n",kv->value_str);
					fprintf(stderr, "  got:       %s\n",values[0].object.u.str);
				}
				citrusleaf_object_free(&values[0].object);

				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;
			}
		}
		else if (g_config.value_type == CL_BLOB) {
			if (values[0].object.u.blob == 0) {
				if (!g_config.silent) fprintf(stderr, "read value pointer is null. Yuck.\n");
				citrusleaf_object_free(&values[0].object);
				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;
			}
			
			if (values[0].object.sz  != kv->value_blob_len) {
				if (!g_config.silent) fprintf(stderr, "read value size doesn't match expected. Is %zd expecting %d\n",
					values[0].object.sz,kv->value_blob_len);
				citrusleaf_object_free(&values[0].object);

				if (g_config.continuous == false) {
					free(kv);					
					return((void *)-1);
				}
				goto NextRead;
			}			
			
			if (memcmp(values[0].object.u.blob, kv->value_blob, kv->value_blob_len) != 0) {
				if (!g_config.silent) {
					int k;
					uint8_t *b1 = (uint8_t *) values[0].object.u.blob;
					uint8_t *b2 = (uint8_t *) kv->value_blob;
					for (k=0;k<kv->value_blob_len;k++) {
						if (b1[k] != b2[k]) break;
					}
					
					fprintf(stderr, "read value does not match set value, key int %d, differ at byte %d (length correct).\n",key_int,k);
					dump_buf("got buf: ", b1, kv->value_blob_len);
					dump_buf("expecting buf: ", b2, kv->value_blob_len);

				}
				citrusleaf_object_free(&values[0].object);

				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;
			}

			
		}
		else if (g_config.value_type == CL_INT) {
			
			if (values[0].object.u.i64 != kv->value_int) {
				if (!g_config.silent) {
					fprintf(stderr, "read value does not match set value.\n");
					fprintf(stderr, "  expecting: %"PRIu64"\n",kv->value_int);
					fprintf(stderr, "  got:       %"PRIu64"\n",values[0].object.u.i64);
				}
				citrusleaf_object_free(&values[0].object);
				if (g_config.continuous == false) {
					free(kv);
					return((void *)-1);
				}
				goto NextRead;

			}			
			
		}

		// have to hand back any possible malloced memory
		citrusleaf_object_free(&values[0].object);
NextRead:
		free(kv);
		
		atomic_int_add(work->completed, 1);
		
		if (g_config.delay) {
			if (g_config.delay >= 1000) {
				usleep( (g_config.delay - 1000) * 1000 );
			}
			else {
				if ( (delay_factor++ % (1000 - g_config.delay)) == 0) {
					usleep( 1000 );
				}
			}
		}
		
	}
	return((void *)0);
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0xf8(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0xf0(%rsp)
movl $0x0, 0xec(%rsp)
leaq 0x21d9f(%rip), %rax     # 0x25330
testb $0x1, 0x28(%rax)
je 0x35c5
movq 0x1fa42(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0xf0(%rsp), %rax
movl 0x4(%rax), %edx
movq 0xf0(%rsp), %rax
movl 0x8(%rax), %ecx
leaq 0x1932d(%rip), %rsi     # 0x1c8eb
movb $0x0, %al
callq 0x23b0
movl $0x0, 0xe8(%rsp)
movl 0xe8(%rsp), %eax
movq 0xf0(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x411a
movb $0x0, %al
callq 0x2960
movq 0xf0(%rsp), %rcx
movl 0x8(%rcx), %ecx
xorl %edx, %edx
divq %rcx
movq 0xf0(%rsp), %rax
movl 0x4(%rax), %eax
addq %rax, %rdx
movl %edx, %eax
movl %eax, 0xe0(%rsp)
movl 0xe0(%rsp), %edi
movq 0xf0(%rsp), %rax
movl 0xc(%rax), %esi
movq 0xf0(%rsp), %rax
movl 0x10(%rax), %edx
callq 0x4140
movq %rax, 0xd8(%rsp)
leaq 0x21cea(%rip), %rax     # 0x25330
cmpl $0x3, 0x4c(%rax)
jne 0x3667
movq 0xd8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x72b0
jmp 0x36c1
leaq 0x21cc2(%rip), %rax     # 0x25330
cmpl $0x1, 0x4c(%rax)
jne 0x368e
movq 0xd8(%rsp), %rax
movq (%rax), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x7350
jmp 0x36bf
leaq 0x21c9b(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x36bd
movq 0x1f93e(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x21c84(%rip), %rax     # 0x25330
movl 0x4c(%rax), %edx
leaq 0x19262(%rip), %rsi     # 0x1c918
movb $0x0, %al
callq 0x23b0
jmp 0x36bf
jmp 0x36c1
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x2150
leaq 0x70(%rsp), %rdi
leaq 0x21c52(%rip), %rax     # 0x25330
movq 0x20(%rax), %rsi
callq 0x2240
leaq 0x21c42(%rip), %rax     # 0x25330
testb $0x1, 0x2c(%rax)
je 0x38a0
leaq 0x21c31(%rip), %rax     # 0x25330
cmpl $0x3, 0x48(%rax)
jne 0x3724
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x72b0
jmp 0x37ad
leaq 0x21c05(%rip), %rax     # 0x25330
cmpl $0x4, 0x48(%rax)
jne 0x3759
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
movq 0xd8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0xd8(%rsp), %rax
movslq 0x18(%rax), %rdx
callq 0x7390
jmp 0x37ab
leaq 0x21bd0(%rip), %rax     # 0x25330
cmpl $0x1, 0x48(%rax)
jne 0x3782
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
movq 0xd8(%rsp), %rax
movq 0x28(%rax), %rsi
callq 0x7350
jmp 0x37a9
leaq 0x21ba7(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x37a7
movq 0x1f84a(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x1919d(%rip), %rsi     # 0x1c93d
movb $0x0, %al
callq 0x23b0
jmp 0x37a9
jmp 0x37ab
jmp 0x37ad
movq 0xf0(%rsp), %rax
movq 0x20(%rax), %rdi
leaq 0x21b70(%rip), %rax     # 0x25330
movq 0x10(%rax), %rsi
leaq 0x21b65(%rip), %rax     # 0x25330
movq 0x18(%rax), %rdx
leaq 0x70(%rsp), %r8
leaq 0x21b55(%rip), %rax     # 0x25330
movl 0x34(%rax), %eax
leaq 0xb8(%rsp), %rcx
movl $0x1, %r9d
xorl %r10d, %r10d
movl %eax, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0xb150
movl %eax, %ecx
movl %ecx, 0xe4(%rsp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x389b
leaq 0x21b16(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3853
movq 0x1f7b9(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movl 0xe0(%rsp), %edx
movq 0xd8(%rsp), %rax
movq 0x28(%rax), %rcx
movl 0xe4(%rsp), %r8d
leaq 0x1912c(%rip), %rsi     # 0x1c978
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x21ac8(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3896
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
jmp 0x3a39
callq 0x6e30
movq %rax, 0x68(%rsp)
movq 0xf0(%rsp), %rax
movq 0x20(%rax), %rdi
leaq 0x21a73(%rip), %rax     # 0x25330
movq 0x10(%rax), %rsi
leaq 0x21a68(%rip), %rax     # 0x25330
movq 0x18(%rax), %rdx
leaq 0x70(%rsp), %r8
leaq 0x21a58(%rip), %rax     # 0x25330
movl 0x34(%rax), %eax
leaq 0xb8(%rsp), %rcx
movl $0x1, %r9d
xorl %r10d, %r10d
movl %eax, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x9130
movl %eax, %ecx
movl %ecx, 0xe4(%rsp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x3a07
callq 0x6e30
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x43b0
movq %rax, 0x58(%rsp)
cmpl $-0x2, 0xe4(%rsp)
je 0x3942
cmpl $0x9, 0xe4(%rsp)
jne 0x3991
movq 0x21a47(%rip), %rdi     # 0x25390
movq 0x58(%rsp), %rsi
callq 0x70d0
leaq 0x219d6(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x398f
movq 0x1f679(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movl 0xe4(%rsp), %edx
movq 0x58(%rsp), %rcx
leaq 0x219b3(%rip), %rax     # 0x25330
movl 0x34(%rax), %r8d
leaq 0x19021(%rip), %rsi     # 0x1c9a9
movb $0x0, %al
callq 0x23b0
jmp 0x39bf
leaq 0x21998(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x39bd
movq 0x1f63b(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movl 0xe4(%rsp), %edx
leaq 0x19015(%rip), %rsi     # 0x1c9cb
movb $0x0, %al
callq 0x23b0
jmp 0x39bf
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x2195c(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3a02
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
callq 0x6e30
movq %rax, 0x50(%rsp)
movq 0x21980(%rip), %rax     # 0x25398
movq %rax, 0x30(%rsp)
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x43b0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x70d0
movl 0x90(%rsp), %eax
leaq 0x218e9(%rip), %rcx     # 0x25330
cmpl 0x48(%rcx), %eax
je 0x3ad8
leaq 0x218d9(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3a86
movq 0x1f57c(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x218c2(%rip), %rax     # 0x25330
movl 0x48(%rax), %edx
movl 0x90(%rsp), %ecx
leaq 0x18f68(%rip), %rsi     # 0x1c9e7
movb $0x0, %al
callq 0x23b0
leaq 0x218a3(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3ac9
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
movl $0x2, %edi
callq 0x2260
jmp 0x406d
leaq 0x21851(%rip), %rax     # 0x25330
cmpl $0x3, 0x48(%rax)
jne 0x3d09
cmpq $0x0, 0xa0(%rsp)
jne 0x3b61
leaq 0x21835(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3b19
movq 0x1f4d8(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x18f02(%rip), %rsi     # 0x1ca14
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x21802(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3b5c
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
movq 0x98(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x20f0
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
je 0x3c31
leaq 0x21799(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3be9
movq 0x1f43c(%rip), %rax     # 0x22fe0
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x20f0
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq %rax, %rcx
addq $0x1, %rcx
leaq 0x18e55(%rip), %rsi     # 0x1ca37
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x21732(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3c2c
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
movq 0xa0(%rsp), %rdi
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rsi
callq 0x2380
cmpl $0x0, %eax
je 0x3d04
leaq 0x216d6(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3cbc
movq 0x1f379(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x18e04(%rip), %rsi     # 0x1ca75
movb $0x0, %al
callq 0x23b0
movq 0x1f361(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0xd8(%rsp), %rax
movq 0x10(%rax), %rdx
leaq 0x18e06(%rip), %rsi     # 0x1ca9b
movb $0x0, %al
callq 0x23b0
movq 0x1f33d(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0xa0(%rsp), %rdx
leaq 0x18df7(%rip), %rsi     # 0x1caac
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x2165f(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3cff
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
jmp 0x405f
leaq 0x21620(%rip), %rax     # 0x25330
cmpl $0x4, 0x48(%rax)
jne 0x3f80
cmpq $0x0, 0xa0(%rsp)
jne 0x3d92
leaq 0x21604(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3d4a
movq 0x1f2a7(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x18cd1(%rip), %rsi     # 0x1ca14
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x215d1(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3d8d
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
movq 0x98(%rsp), %rax
movq 0xd8(%rsp), %rcx
movslq 0x18(%rcx), %rcx
cmpq %rcx, %rax
je 0x3e2f
leaq 0x2157a(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3de7
movq 0x1f21d(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0x98(%rsp), %rdx
movq 0xd8(%rsp), %rax
movl 0x18(%rax), %ecx
leaq 0x18cdd(%rip), %rsi     # 0x1cabd
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x21534(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3e2a
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
movq 0xa0(%rsp), %rdi
movq 0xd8(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0xd8(%rsp), %rax
movslq 0x18(%rax), %rdx
callq 0x2100
cmpl $0x0, %eax
je 0x3f7b
leaq 0x214cc(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x3f33
movq 0xa0(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xd8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movq 0xd8(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x3ed6
movq 0x40(%rsp), %rax
movslq 0x4c(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movq 0x38(%rsp), %rcx
movslq 0x4c(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x3ec7
jmp 0x3ed6
jmp 0x3ec9
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x3e94
movq 0x1f103(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movl 0xe0(%rsp), %edx
movl 0x4c(%rsp), %ecx
leaq 0x18c08(%rip), %rsi     # 0x1cafa
movb $0x0, %al
callq 0x23b0
movq 0x40(%rsp), %rsi
movq 0xd8(%rsp), %rax
movslq 0x18(%rax), %rdx
leaq 0x18c3f(%rip), %rdi     # 0x1cb50
callq 0x43f0
movq 0x38(%rsp), %rsi
movq 0xd8(%rsp), %rax
movslq 0x18(%rax), %rdx
leaq 0x18c2c(%rip), %rdi     # 0x1cb5a
callq 0x43f0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x213e8(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3f76
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
jmp 0x405d
leaq 0x213a9(%rip), %rax     # 0x25330
cmpl $0x1, 0x48(%rax)
jne 0x405b
movq 0xa0(%rsp), %rax
movq 0xd8(%rsp), %rcx
cmpq 0x28(%rcx), %rax
je 0x4059
leaq 0x2137e(%rip), %rax     # 0x25330
testb $0x1, 0x29(%rax)
jne 0x4014
movq 0x1f021(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
leaq 0x18aac(%rip), %rsi     # 0x1ca75
movb $0x0, %al
callq 0x23b0
movq 0x1f009(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0xd8(%rsp), %rax
movq 0x28(%rax), %rdx
leaq 0x18b7d(%rip), %rsi     # 0x1cb6a
movb $0x0, %al
callq 0x23b0
movq 0x1efe5(%rip), %rax     # 0x22fe0
movq (%rax), %rdi
movq 0xa0(%rsp), %rdx
leaq 0x18b6f(%rip), %rsi     # 0x1cb7c
movb $0x0, %al
callq 0x23b0
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
leaq 0x21307(%rip), %rax     # 0x25330
movb 0x2b(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x4057
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq $-0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0x4126
jmp 0x406d
jmp 0x405b
jmp 0x405d
jmp 0x405f
leaq 0x70(%rsp), %rdi
addq $0x20, %rdi
callq 0x74b0
movq 0xd8(%rsp), %rdi
callq 0x22c0
movq 0xf0(%rsp), %rax
movq 0x18(%rax), %rdi
movl $0x1, %esi
callq 0x26e0
leaq 0x21299(%rip), %rax     # 0x25330
cmpl $0x0, 0x54(%rax)
je 0x4102
leaq 0x2128c(%rip), %rax     # 0x25330
cmpl $0x3e8, 0x54(%rax)      # imm = 0x3E8
jb 0x40c9
leaq 0x2127c(%rip), %rax     # 0x25330
movl 0x54(%rax), %eax
subl $0x3e8, %eax            # imm = 0x3E8
imull $0x3e8, %eax, %edi      # imm = 0x3E8
callq 0x2390
jmp 0x4100
movl 0xec(%rsp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0xec(%rsp)
movl $0x3e8, %ecx            # imm = 0x3E8
leaq 0x21248(%rip), %rdx     # 0x25330
subl 0x54(%rdx), %ecx
xorl %edx, %edx
divl %ecx
cmpl $0x0, %edx
jne 0x40fe
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x2390
jmp 0x4100
jmp 0x4102
jmp 0x4104
movl 0xe8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe8(%rsp)
jmp 0x35d0
movq $0x0, 0x100(%rsp)
movq 0x100(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
retq
nopw %cs:(%rax,%rax)