// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/tests/kvlds/main.c
// Function: createmany
static int
createmany(struct wire_requestqueue * Q, size_t N)
{
	size_t i;
	struct kvldskey * key;
	struct kvldskey * key2;
	struct kvldskey ** values;
	uint8_t keybuf[8];
	char valbuf[20];

	/* Allocate values structures. */
	values = malloc(N * sizeof(struct kvldskey *));
	for (i = 0; i < N; i++) {
		sprintf(valbuf, "%zu", i);
		values[i] = kvldskey_create((uint8_t *)valbuf, strlen(valbuf));
	}

	/* Store N key-value pairs. */
	op_done = 0;
	op_count = N;
	for (i = 0; i < N; i++) {
		be64enc(keybuf, i);
		key = kvldskey_create(keybuf, 8);
		if (proto_kvlds_request_set(Q, key, values[i],
		    callback_done, NULL))
			goto err1;
		kvldskey_free(key);
	}

	/* Wait for SETs to complete. */
	if (events_spin(&op_done) || op_failed) {
		warnp("SET request failed");
		goto err1;
	}

	/* Read the values back and check that they are correct. */
	op_done = 0;
	op_failed = 0;
	op_count = N;
	for (i = 0; i < N; i++) {
		be64enc(keybuf, i);
		key = kvldskey_create(keybuf, 8);
		if (proto_kvlds_request_get(Q, key, callback_get,
		    (void *)(uintptr_t)values[i])) {
			warnp("Error sending GET request");
			goto err1;
		}
		kvldskey_free(key);
	}
	if (events_spin(&op_done) || op_failed) {
		warnp("GET request failed");
		goto err1;
	}
	if (op_badval) {
		warn0("Bad value returned by GET!");
		goto err1;
	}

	/* Free values. */
	for (i = 0; i < N; i++)
		kvldskey_free(values[i]);
	free(values);

	/* Delete all the values. */
	be64enc(keybuf, 0);
	key = kvldskey_create(keybuf, 8);
	be64enc(keybuf, N);
	key2 = kvldskey_create(keybuf, 8);
	op_done = 0;
	op_count = 1;
	if (proto_kvlds_request_range2(Q, key, key2, callback_range,
	    callback_done, Q))
		goto err0;
	kvldskey_free(key2);
	kvldskey_free(key);

	/* Wait for RANGEs and DELETEs to complete. */
	if (events_spin(&op_done) || op_failed) {
		warnp("RANGE or DELETE request failed");
		goto err0;
	}

	/* Success! */
	return (0);

err1:
	for (i = 0; i < N; i++)
		kvldskey_free(values[i]);
	free(values);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2200
movq %rax, -0x38(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x2d13
leaq -0x60(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xd75c(%rip), %rsi      # 0x1042e
movb $0x0, %al
callq 0x22c0
leaq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2110
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x6360
movq %rax, %rdx
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2cb9
movl $0x0, 0x1390b(%rip)     # 0x16628
movq -0x18(%rbp), %rax
movq %rax, 0x13908(%rip)     # 0x16630
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x2d9f
leaq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3af0
leaq -0x40(%rbp), %rdi
movl $0x8, %esi
callq 0x6360
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0xbdc(%rip), %rcx       # 0x3950
xorl %eax, %eax
movl %eax, %r8d
callq 0x67b0
cmpl $0x0, %eax
je 0x2d88
jmp 0x306b
movq -0x28(%rbp), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2d30
leaq 0x13882(%rip), %rdi     # 0x16628
callq 0x3f10
cmpl $0x0, %eax
jne 0x2db9
cmpl $0x0, 0x13875(%rip)     # 0x1662c
je 0x2df5
jmp 0x2dbb
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2de0
leaq 0xd432(%rip), %rdi      # 0x101fe
movb $0x0, %al
callq 0x5ed0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2dee
leaq 0xd417(%rip), %rdi      # 0x101fe
movb $0x0, %al
callq 0x6120
jmp 0x2df0
jmp 0x306b
movl $0x0, 0x13829(%rip)     # 0x16628
movl $0x0, 0x13823(%rip)     # 0x1662c
movq -0x18(%rbp), %rax
movq %rax, 0x1381c(%rip)     # 0x16630
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x2ec4
leaq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3af0
leaq -0x40(%rbp), %rdi
movl $0x8, %esi
callq 0x6360
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0xb3c(%rip), %rdx       # 0x39a0
callq 0x7320
cmpl $0x0, %eax
je 0x2eaa
jmp 0x2e70
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2e95
leaq 0xd390(%rip), %rdi      # 0x10211
movb $0x0, %al
callq 0x5ed0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2ea3
leaq 0xd375(%rip), %rdi      # 0x10211
movb $0x0, %al
callq 0x6120
jmp 0x2ea5
jmp 0x306b
movq -0x28(%rbp), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2e1c
leaq 0x1375d(%rip), %rdi     # 0x16628
callq 0x3f10
cmpl $0x0, %eax
jne 0x2ede
cmpl $0x0, 0x13750(%rip)     # 0x1662c
je 0x2f1a
jmp 0x2ee0
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2f05
leaq 0xd33a(%rip), %rdi      # 0x1022b
movb $0x0, %al
callq 0x5ed0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2f13
leaq 0xd31f(%rip), %rdi      # 0x1022b
movb $0x0, %al
callq 0x6120
jmp 0x2f15
jmp 0x306b
cmpl $0x0, 0x13717(%rip)     # 0x16638
je 0x2f43
jmp 0x2f25
leaq 0xd312(%rip), %rdi      # 0x1023e
movb $0x0, %al
callq 0x6120
callq 0x20a0
movl $0x0, (%rax)
jmp 0x306b
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x2f74
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2f4b
movq -0x38(%rbp), %rdi
callq 0x2040
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3af0
leaq -0x40(%rbp), %rdi
movl $0x8, %esi
callq 0x6360
movq %rax, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3af0
leaq -0x40(%rbp), %rdi
movl $0x8, %esi
callq 0x6360
movq %rax, -0x30(%rbp)
movl $0x0, 0x13663(%rip)     # 0x16628
movq $0x1, 0x13660(%rip) # 0x16630
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %r9
leaq 0xbd9(%rip), %rcx       # 0x3bc0
leaq 0x962(%rip), %r8        # 0x3950
callq 0x7cb0
cmpl $0x0, %eax
je 0x2ffd
jmp 0x30a5
movq -0x30(%rbp), %rdi
callq 0x2040
movq -0x28(%rbp), %rdi
callq 0x2040
leaq 0x13612(%rip), %rdi     # 0x16628
callq 0x3f10
cmpl $0x0, %eax
jne 0x3029
cmpl $0x0, 0x13605(%rip)     # 0x1662c
je 0x3062
jmp 0x302b
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3050
leaq 0xd3f6(%rip), %rdi      # 0x10432
movb $0x0, %al
callq 0x5ed0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x305e
leaq 0xd3db(%rip), %rdi      # 0x10432
movb $0x0, %al
callq 0x6120
jmp 0x3060
jmp 0x30a5
movl $0x0, -0x4(%rbp)
jmp 0x30ac
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x309c
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3073
movq -0x38(%rbp), %rdi
callq 0x2040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)