// File: /workspace/github_c_makefile_star2_O3/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
cmpl $0x1, %edi
je 0x61f7
movl %edi, %ecx
xorl %eax, %eax
movl $0x1, %edx
movl $0x1, %edi
xorl %r8d, %r8d
movq (%rsi,%rdx,8), %r9
cmpb $0x2d, (%r9)
jne 0x61df
cmpb $0x69, 0x1(%r9)
jne 0x61c8
cmpb $0x0, 0x2(%r9)
je 0x61d9
cmpb $0x76, 0x1(%r9)
jne 0x61df
cmpb $0x0, 0x2(%r9)
cmovel %edi, %eax
jmp 0x61df
movl $0x1, %r8d
incq %rdx
cmpl %edx, %ecx
jne 0x61b0
testl %r8d, %r8d
sete 0xb(%rsp)
testl %eax, %eax
sete 0xa(%rsp)
jmp 0x6201
movb $0x1, 0xb(%rsp)
movb $0x1, 0xa(%rsp)
xorl %ebp, %ebp
leaq 0x4dfa(%rip), %rdi      # 0xb004
movl %ebp, %esi
xorl %eax, %eax
callq 0x6050
leaq 0xa0c96(%rip), %r14     # 0xa6eb0
xorl %r12d, %r12d
leaq 0x56bb2(%rip), %rbx     # 0x5cdd6
movq (%r14), %r13
leaq 0x324f(%rip), %rax      # 0x947d
cmpq %rax, 0x8(%r13)
jne 0x62a6
movq 0x18(%r13), %rdi
movq %rbp, %rsi
callq 0x948a
movq %rax, %r15
cmpl $0xffff, %r15d          # imm = 0xFFFF
je 0x62a6
cmpb $0x0, 0xb(%rsp)
je 0x6261
movl (%r13), %edi
callq 0x9264
movq %rax, %rdx
jmp 0x626f
leaq 0x51ec(%rip), %rax      # 0xb454
movslq (%r12,%rax), %rdx
addq %rax, %rdx
leaq 0x4d96(%rip), %rdi      # 0xb00c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4d90(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x62a6
leaq 0x4d7d(%rip), %rdi      # 0xb012
movl %r15d, %esi
xorl %eax, %eax
callq 0x6050
leaq 0x4d71(%rip), %rbx      # 0xb017
addq $0x4, %r12
addq $0x8, %r14
cmpq $0x13c, %r12            # imm = 0x13C
jne 0x6224
movq %rbp, %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
leaq 0xc(%rsp), %r15
movq %r15, %rdx
callq 0x6637
testl %eax, %eax
je 0x6313
leaq 0x4d3b(%rip), %rdi      # 0xb019
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4d28(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x6313
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
leaq 0x4d1c(%rip), %rdi      # 0xb021
xorl %eax, %eax
callq 0x6050
leaq 0x4d04(%rip), %rbx      # 0xb017
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6e00
testl %eax, %eax
je 0x6361
leaq 0x4cfd(%rip), %rdi      # 0xb029
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4cda(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x6361
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
leaq 0x4cce(%rip), %rdi      # 0xb021
xorl %eax, %eax
callq 0x6050
leaq 0x4cb6(%rip), %rbx      # 0xb017
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x8f18
testl %eax, %eax
je 0x63af
leaq 0x4cb9(%rip), %rdi      # 0xb033
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4c8c(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x63af
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
leaq 0x4c80(%rip), %rdi      # 0xb021
xorl %eax, %eax
callq 0x6050
leaq 0x4c68(%rip), %rbx      # 0xb017
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x91c3
testl %eax, %eax
je 0x63fd
leaq 0x4c79(%rip), %rdi      # 0xb041
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4c3e(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x63fd
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
leaq 0x4c32(%rip), %rdi      # 0xb021
xorl %eax, %eax
callq 0x6050
leaq 0x4c1a(%rip), %rbx      # 0xb017
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x90df
testl %eax, %eax
je 0x644b
leaq 0x4c38(%rip), %rdi      # 0xb04e
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4bf0(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x644b
movl 0x10(%rsp), %esi
movl 0xc(%rsp), %edx
leaq 0x4be4(%rip), %rdi      # 0xb021
xorl %eax, %eax
callq 0x6050
leaq 0x4bcc(%rip), %rbx      # 0xb017
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x674f
testl %eax, %eax
je 0x64a2
leaq 0x4bee(%rip), %rdi      # 0xb057
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6050
leaq 0x4b9d(%rip), %rbx      # 0xb017
cmpb $0x0, 0xa(%rsp)
jne 0x64a2
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
leaq 0x4bcf(%rip), %rdi      # 0xb063
xorl %eax, %eax
callq 0x6050
leaq 0x4b75(%rip), %rbx      # 0xb017
cmpb $0x0, (%rbx)
jne 0x64b5
leaq 0x4bc0(%rip), %rdi      # 0xb06e
xorl %eax, %eax
callq 0x6050
movl $0xa, %edi
callq 0x6030
incq %rbp
cmpq $0x30000, %rbp          # imm = 0x30000
jne 0x6203
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq