// File: /workspace/github_c_makefile_star2_O2/mloar[P]charset/cstable.c
// Function: main
int main(int argc, char **argv)
{
    long int c;
    int internal_names = FALSE;
    int verbose = FALSE;

    while (--argc) {
        char *p = *++argv;
        if (!strcmp(p, "-i"))
            internal_names = TRUE;
        else if (!strcmp(p, "-v"))
            verbose = TRUE;
    }

    for (c = 0; c < 0x30000; c++) {
	int i, plane, row, col, chr;
	char const *sep = "";

	printf("U+%04x:", (unsigned)c);

	/*
	 * Look up in SBCSes.
	 */
	for (i = 0; i < lenof(cs_table); i++)
	    if (cs_table[i]->read == read_sbcs &&
		(chr = sbcs_from_unicode(cs_table[i]->data, c)) != ERROR) {
		printf("%s %s", sep,
		       (internal_names ? cs_names[i] :
			charset_to_localenc(cs_table[i]->charset)));
		if (verbose)
		    printf("[%d]", chr);
		sep = ";";
	    }

	/*
	 * Look up individually in MBCS base charsets. The
	 * `internal_names' flag does not affect these, because
	 * MBCS base charsets aren't directly encoded by CS_*
	 * constants.
	 */
	if (unicode_to_big5(c, &row, &col)) {
	    printf("%s Big5", sep);
	    if (verbose)
		printf("[%d,%d]", row, col);
	    sep = ";";
	}

	if (unicode_to_gb2312(c, &row, &col)) {
	    printf("%s GB2312", sep);
	    if (verbose)
		printf("[%d,%d]", row, col);
	    sep = ";";
	}

	if (unicode_to_jisx0208(c, &row, &col)) {
	    printf("%s JIS X 0208", sep);
	    if (verbose)
		printf("[%d,%d]", row, col);
	    sep = ";";
	}

	if (unicode_to_ksx1001(c, &row, &col)) {
	    printf("%s KS X 1001", sep);
	    if (verbose)
		printf("[%d,%d]", row, col);
	    sep = ";";
	}

	if (unicode_to_cp949(c, &row, &col)) {
	    printf("%s CP949", sep);
	    if (verbose)
		printf("[%d,%d]", row, col);
	    sep = ";";
	}

	if (unicode_to_cns11643(c, &plane, &row, &col)) {
	    printf("%s CNS11643", sep);
	    if (verbose)
		printf("[%d,%d,%d]", plane, row, col);
	    sep = ";";
	}

	if (!*sep)
	    printf(" unicode-only");

	printf("\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x0, 0x4(%rsp)
movb $0x1, %al
movl %eax, 0x10(%rsp)
pushq $0x1
popq %rax
addq $0x8, %rsi
decl %edi
movl %edi, %ecx
subl $0x1, %ecx
jb 0x61f5
movq (%rsi), %rdx
cmpb $0x2d, (%rdx)
jne 0x61d2
cmpb $0x69, 0x1(%rdx)
jne 0x61cc
cmpb $0x0, 0x2(%rdx)
je 0x61eb
cmpb $0x76, 0x1(%rdx)
je 0x61da
addq $0x8, %rsi
movl %ecx, %edi
jmp 0x61b3
cmpb $0x0, 0x2(%rdx)
movl 0x4(%rsp), %ecx
cmovel %eax, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x61ab
movl $0x0, 0x10(%rsp)
jmp 0x61ab
xorl %ebp, %ebp
cmpq $0x30000, %rbp          # imm = 0x30000
je 0x64cc
leaq 0x3df9(%rip), %rdi      # 0xa004
movl %ebp, %esi
xorl %eax, %eax
callq 0x6050
leaq 0x9fc95(%rip), %rbx     # 0xa5eb0
xorl %r14d, %r14d
leaq 0x55bb1(%rip), %r13     # 0x5bdd6
cmpq $0x13c, %r14            # imm = 0x13C
je 0x62c0
movq (%rbx), %r15
leaq 0x2fed(%rip), %rax      # 0x9229
cmpq %rax, 0x8(%r15)
jne 0x62b3
movq 0x18(%r15), %rdi
movq %rbp, %rsi
callq 0x9236
movq %rax, %r12
cmpl $0xffff, %r12d          # imm = 0xFFFF
je 0x62b3
testb $0x1, 0x10(%rsp)
je 0x626e
movl (%r15), %edi
callq 0x906c
movq %rax, %rdx
jmp 0x627c
leaq 0x41df(%rip), %rax      # 0xa454
movslq (%r14,%rax), %rdx
addq %rax, %rdx
leaq 0x3d89(%rip), %rdi      # 0xa00c
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3d83(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x62b3
leaq 0x3d70(%rip), %rdi      # 0xa012
movl %r12d, %esi
xorl %eax, %eax
callq 0x6050
leaq 0x3d64(%rip), %r13      # 0xa017
addq $0x4, %r14
addq $0x8, %rbx
jmp 0x6225
movq %rbp, %rdi
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x662f
testl %eax, %eax
je 0x6318
leaq 0x3d36(%rip), %rdi      # 0xa019
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3d23(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x6318
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
leaq 0x3d17(%rip), %rdi      # 0xa021
xorl %eax, %eax
callq 0x6050
leaq 0x3cff(%rip), %r13      # 0xa017
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x6dd0
testl %eax, %eax
je 0x6366
leaq 0x3cf8(%rip), %rdi      # 0xa029
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3cd5(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x6366
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
leaq 0x3cc9(%rip), %rdi      # 0xa021
xorl %eax, %eax
callq 0x6050
leaq 0x3cb1(%rip), %r13      # 0xa017
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8d60
testl %eax, %eax
je 0x63b4
leaq 0x3cb4(%rip), %rdi      # 0xa033
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3c87(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x63b4
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
leaq 0x3c7b(%rip), %rdi      # 0xa021
xorl %eax, %eax
callq 0x6050
leaq 0x3c63(%rip), %r13      # 0xa017
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x9014
testl %eax, %eax
je 0x6402
leaq 0x3c74(%rip), %rdi      # 0xa041
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3c39(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x6402
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
leaq 0x3c2d(%rip), %rdi      # 0xa021
xorl %eax, %eax
callq 0x6050
leaq 0x3c15(%rip), %r13      # 0xa017
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8f2e
testl %eax, %eax
je 0x6450
leaq 0x3c33(%rip), %rdi      # 0xa04e
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3beb(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x6450
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
leaq 0x3bdf(%rip), %rdi      # 0xa021
xorl %eax, %eax
callq 0x6050
leaq 0x3bc7(%rip), %r13      # 0xa017
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x674b
testl %eax, %eax
je 0x64a7
leaq 0x3be9(%rip), %rdi      # 0xa057
movq %r13, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x3b98(%rip), %r13      # 0xa017
cmpl $0x0, 0x4(%rsp)
je 0x64a7
movl 0x14(%rsp), %esi
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
leaq 0x3bca(%rip), %rdi      # 0xa063
xorl %eax, %eax
callq 0x6050
leaq 0x3b70(%rip), %r13      # 0xa017
cmpb $0x0, (%r13)
jne 0x64bc
leaq 0x3bb9(%rip), %rdi      # 0xa06e
xorl %eax, %eax
callq 0x6050
pushq $0xa
popq %rdi
callq 0x6030
incq %rbp
jmp 0x61f7
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)