// File: /workspace/github_c_makefile_star2_O0/ryo[P]shmqueue/shmclient.c
// Function: main
int
main(int argc, char *argv[])
{
	struct keyvalue kv;
	int ch, i, rc, nloop;
	int opt_d = 0, opt_t = 0;

	while ((ch = getopt(argc, argv, "dt")) != -1) {
		switch (ch) {
		case 'd':
			opt_d = 1;
			break;
		case 't':
			opt_t = 1;
			break;
		default:
			usage();
			return 1;
		}
	}
	argc -= optind;
	argv += optind;

	shmqueue = shmqueue_new(MEMID, 0, 1, 1);

	for (nloop = i = 0; i >= 0; i++, nloop++) {
#if 1
		char key[1024];
		char data[1024];

		sprintf(key, "%d", i);
		sprintf(data, "data of %d", i);

		rc = shmqueue_keyvalue_store(shmqueue, (uint8_t *)key, (uint8_t *)data, strlen(data));
		if (rc != 0) {
			if ((nloop & 0xffff) == 0)
				printf("���Ԥ���(%d)\n", i);
			i--;
			continue;
		}

		if ((i & 0xff) == 0)
			printf("��������(%d)\n", i);

		fflush(stdout);
#endif
	}

	(void)&rc;
	(void)&kv;
#if 0
	for (i = 0; i < 10000; i++) {
		rc = shmqueue_getoldest(shmqueue, &kv);
		printf("rc = %d\n", rc);
		fflush(stdout);

		if (rc == 0) {
			fprintf(stderr, "EXPIRE: key=<%s>, storage_size=%u, storage=<%s>\n",
			    KEYVALUE_KEY(&kv),
			    kv.kv_storagesize,
			    KEYVALUE_STORAGE(&kv));
		}
	}
#endif


	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1020, %rsp           # imm = 0x1020
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x7fc(%rbp)
movl $0x0, -0x800(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x2dcf(%rip), %rdx      # 0x401a
callq 0x10b0
movl %eax, -0x7ec(%rbp)
cmpl $-0x1, %eax
je 0x12a6
movl -0x7ec(%rbp), %eax
movl %eax, -0x1004(%rbp)
subl $0x64, %eax
je 0x127b
jmp 0x126e
movl -0x1004(%rbp), %eax
subl $0x74, %eax
je 0x1287
jmp 0x1293
movl $0x1, -0x7fc(%rbp)
jmp 0x12a4
movl $0x1, -0x800(%rbp)
jmp 0x12a4
callq 0x11f0
movl $0x1, -0x4(%rbp)
jmp 0x1438
jmp 0x123d
movq 0x4d33(%rip), %rax      # 0x5fe0
movl (%rax), %ecx
movl -0x8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x8(%rbp)
movq 0x4d22(%rip), %rax      # 0x5fe0
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl $0x186a0, %edi          # imm = 0x186A0
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x1db0
movq %rax, 0x4da2(%rip)      # 0x6090
movl $0x0, -0x7f0(%rbp)
movl $0x0, -0x7f8(%rbp)
cmpl $0x0, -0x7f0(%rbp)
jl 0x1431
leaq -0xc00(%rbp), %rdi
movl -0x7f0(%rbp), %edx
leaq 0x2d02(%rip), %rsi      # 0x4025
movb $0x0, %al
callq 0x10e0
leaq -0x1000(%rbp), %rdi
movl -0x7f0(%rbp), %edx
leaq 0x2cdf(%rip), %rsi      # 0x401d
movb $0x0, %al
callq 0x10e0
movq 0x4d44(%rip), %rax      # 0x6090
movq %rax, -0x1020(%rbp)
leaq -0xc00(%rbp), %rax
movq %rax, -0x1018(%rbp)
leaq -0x1000(%rbp), %rax
movq %rax, -0x1010(%rbp)
leaq -0x1000(%rbp), %rdi
callq 0x1040
movq -0x1020(%rbp), %rdi
movq -0x1018(%rbp), %rsi
movq -0x1010(%rbp), %rdx
movl %eax, %ecx
callq 0x2fc0
movl %eax, -0x7f4(%rbp)
cmpl $0x0, -0x7f4(%rbp)
je 0x13db
movl -0x7f8(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x0, %eax
jne 0x13ca
movl -0x7f0(%rbp), %esi
leaq 0x2c65(%rip), %rdi      # 0x4028
movb $0x0, %al
callq 0x1050
movl -0x7f0(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x7f0(%rbp)
jmp 0x140e
movl -0x7f0(%rbp), %eax
andl $0xff, %eax
cmpl $0x0, %eax
jne 0x13ff
movl -0x7f0(%rbp), %esi
leaq 0x2c3e(%rip), %rdi      # 0x4036
movb $0x0, %al
callq 0x1050
movq 0x4bd2(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x1090
movl -0x7f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7f0(%rbp)
movl -0x7f8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7f8(%rbp)
jmp 0x1302
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1020, %rsp           # imm = 0x1020
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop