// File: /workspace/github_c_makefile_star2_O2/nurse[P]nkf/nkf.c
// Function: unicode_to_jis_common
static int
unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
{
    const unsigned short *const *pp;
    const unsigned short *const *const *ppp;
    static const char no_best_fit_chars_table_C2[] =
    {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 2,
	0, 0, 1, 1, 0, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1};
    static const char no_best_fit_chars_table_C2_ms[] =
    {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0,
	0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0};
    static const char no_best_fit_chars_table_932_C2[] =
    {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,
	0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0};
    static const char no_best_fit_chars_table_932_C3[] =
    {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1};
    nkf_char ret = 0;

    if(c2 < 0x80){
	*p2 = 0;
	*p1 = c2;
    }else if(c2 < 0xe0){
	if(no_best_fit_chars_f){
	    if(ms_ucs_map_f == UCS_MAP_CP932){
		switch(c2){
		case 0xC2:
		    if(no_best_fit_chars_table_932_C2[c1&0x3F]) return 1;
		    break;
		case 0xC3:
		    if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
		    break;
		}
	    }else if(!cp932inv_f){
		switch(c2){
		case 0xC2:
		    if(no_best_fit_chars_table_C2[c1&0x3F]) return 1;
		    break;
		case 0xC3:
		    if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
		    break;
		}
	    }else if(ms_ucs_map_f == UCS_MAP_MS){
		if(c2 == 0xC2 && no_best_fit_chars_table_C2_ms[c1&0x3F]) return 1;
	    }else if(ms_ucs_map_f == UCS_MAP_CP10001){
		switch(c2){
		case 0xC2:
		    switch(c1){
		    case 0xA2:
		    case 0xA3:
		    case 0xA5:
		    case 0xA6:
		    case 0xAC:
		    case 0xAF:
		    case 0xB8:
			return 1;
		    }
		    break;
		}
	    }
	}
	pp =
	    ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_2bytes_932 :
	    ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_2bytes_ms :
	    ms_ucs_map_f == UCS_MAP_CP10001 ? utf8_to_euc_2bytes_mac :
	    x0213_f ? utf8_to_euc_2bytes_x0213 :
	    utf8_to_euc_2bytes;
	ret =  unicode_to_jis_common2(c2, c1, pp, sizeof_utf8_to_euc_2bytes, p2, p1);
    }else if(c0 < 0xF0){
	if(no_best_fit_chars_f){
	    if(ms_ucs_map_f == UCS_MAP_CP932){
		if(c2 == 0xE3 && c1 == 0x82 && c0 == 0x94) return 1;
	    }else if(ms_ucs_map_f == UCS_MAP_MS){
		switch(c2){
		case 0xE2:
		    switch(c1){
		    case 0x80:
			if(c0 == 0x94 || c0 == 0x96 || c0 == 0xBE) return 1;
			break;
		    case 0x88:
			if(c0 == 0x92) return 1;
			break;
		    }
		    break;
		case 0xE3:
		    if(c1 == 0x80 || c0 == 0x9C) return 1;
		    break;
		}
	    }else if(ms_ucs_map_f == UCS_MAP_CP10001){
		switch(c2){
		case 0xE3:
		    switch(c1){
		    case 0x82:
			if(c0 == 0x94) return 1;
			break;
		    case 0x83:
			if(c0 == 0xBB) return 1;
			break;
		    }
		    break;
		}
	    }else{
		switch(c2){
		case 0xE2:
		    switch(c1){
		    case 0x80:
			if(c0 == 0x95) return 1;
			break;
		    case 0x88:
			if(c0 == 0xA5) return 1;
			break;
		    }
		    break;
		case 0xEF:
		    switch(c1){
		    case 0xBC:
			if(c0 == 0x8D) return 1;
			break;
		    case 0xBD:
			if(c0 == 0x9E && !cp932inv_f) return 1;
			break;
		    case 0xBF:
			if(0xA0 <= c0 && c0 <= 0xA5) return 1;
			break;
		    }
		    break;
		}
	    }
	}
	ppp =
	    ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_3bytes_932 :
	    ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_3bytes_ms :
	    ms_ucs_map_f == UCS_MAP_CP10001 ? utf8_to_euc_3bytes_mac :
	    x0213_f ? utf8_to_euc_3bytes_x0213 :
	    utf8_to_euc_3bytes;
	ret = unicode_to_jis_common2(c1, c0, ppp[c2 - 0xE0], sizeof_utf8_to_euc_C2, p2, p1);
    }else return -1;
#ifdef SHIFTJIS_CP932
    if (!ret&& is_eucg3(*p2)) {
	if (cp932inv_f) {
	    if (encode_fallback) ret = 1;
	}
	else {
	    nkf_char s2, s1;
	    if (e2s_conv(*p2, *p1, &s2, &s1) == 0) {
		s2e_conv(s2, s1, p2, p1);
	    }else{
		ret = 1;
	    }
	}
    }
#endif
    return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %r8, %r14
movq %rcx, %r15
cmpl $0x7f, %edi
jg 0x11244
andl $0x0, (%r15)
movl %edi, (%r14)
movl (%r15), %edi
movl %edi, %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %ebx, %ebx
cmpl $0x8f00, %eax           # imm = 0x8F00
jne 0x115f6
cmpl $0x0, 0x3b084(%rip)     # 0x4c2b0
je 0x11300
xorl %ebx, %ebx
cmpq $0x0, 0x431c4(%rip)     # 0x54400
setne %bl
jmp 0x115f6
pushq $0x1
popq %rbx
cmpl $0xdf, %edi
ja 0x1129a
movl 0x431a3(%rip), %eax     # 0x543f8
cmpb $0x1, 0x431a0(%rip)     # 0x543fc
jne 0x114e4
cmpl $0x2, %eax
jne 0x1131e
leaq 0x3693e(%rip), %rdx     # 0x47bb0
cmpb $-0x3d, %dil
je 0x113a9
movzbl %dil, %eax
cmpl $0xc2, %eax
jne 0x11513
movabsq $-0xfacfe7000000000, %rax # imm = 0xF053019000000000
jmp 0x1134d
cmpl $0xef, %edx
jg 0x112fc
movl 0x43150(%rip), %eax     # 0x543f8
cmpb $0x1, 0x4314d(%rip)     # 0x543fc
jne 0x115a0
cmpl $0x1, %eax
je 0x11436
cmpl $0x3, %eax
je 0x113fa
cmpl $0x2, %eax
jne 0x11495
movl %edi, %eax
xorl $0xe3, %eax
movl %esi, %ecx
xorl $0x82, %ecx
orl %eax, %ecx
movl %edx, %eax
xorl $0x94, %eax
orl %ecx, %eax
je 0x115f6
leaq 0x38439(%rip), %rax     # 0x49730
jmp 0x115cf
pushq $-0x1
jmp 0x11318
movl (%r14), %esi
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x10d5b
testl %eax, %eax
je 0x1135c
pushq $0x1
popq %rbx
jmp 0x115f6
cmpl $0x0, 0x3af8b(%rip)     # 0x4c2b0
je 0x11376
cmpl $0x1, %eax
jne 0x113bc
leaq 0x364f9(%rip), %rdx     # 0x47830
cmpl $0xc2, %edi
jne 0x11513
movabsq $-0x7aac386e00000000, %rax # imm = 0x8553C79200000000
btq %rsi, %rax
jb 0x11513
jmp 0x115f6
movl 0xc(%rsp), %edi
movl 0x8(%rsp), %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x10ea6
xorl %ebx, %ebx
jmp 0x115f6
cmpb $-0x3d, %dil
je 0x114d6
movzbl %dil, %ecx
cmpl $0xc2, %ecx
jne 0x114e4
movabsq $0x5301ec00000000, %rcx # imm = 0x5301EC00000000
btq %rsi, %rcx
jb 0x114e4
jmp 0x115f6
movl %esi, %eax
andl $0x1f, %eax
cmpl $0x17, %eax
je 0x11513
jmp 0x115f6
movl %eax, %ecx
xorl $0x3, %ecx
movl %edi, %edx
xorl $0xc2, %edx
orl %ecx, %edx
jne 0x114e4
leaq 0x36b58(%rip), %rdx     # 0x47f30
leal -0xa2(%rsi), %eax
cmpl $0x16, %eax
ja 0x11513
movl $0x40241b, %ecx         # imm = 0x40241B
btl %eax, %ecx
jb 0x115f6
jmp 0x11513
leaq 0x383af(%rip), %rax     # 0x497b0
cmpl $0xe3, %edi
jne 0x115cf
cmpl $0x83, %esi
je 0x11561
cmpl $0x82, %esi
jne 0x115cf
cmpl $0x94, %edx
jne 0x115cf
jmp 0x115f6
leaq 0x38273(%rip), %rax     # 0x496b0
cmpl $0xe3, %edi
je 0x1151b
cmpl $0xe2, %edi
jne 0x115cf
cmpl $0x88, %esi
je 0x1156e
cmpl $0x80, %esi
jne 0x115cf
leal -0x94(%rdx), %ecx
cmpl $0x2a, %ecx
ja 0x115cf
movabsq $0x40000000005, %r8     # imm = 0x40000000005
btq %rcx, %r8
jb 0x115f6
jmp 0x115cf
cmpl $0xef, %edi
je 0x1153c
cmpl $0xe2, %edi
jne 0x115a0
cmpl $0x88, %esi
je 0x11578
cmpl $0x80, %esi
jne 0x115a0
cmpl $0x95, %edx
jne 0x115a0
jmp 0x115f6
movl %esi, %ecx
andl $0x1f, %ecx
cmpl $0x17, %ecx
jne 0x115f6
decl %eax
cmpl $0x3, %eax
jae 0x114fa
movl %eax, %eax
leaq 0x34dec(%rip), %rcx     # 0x462e0
movq (%rcx,%rax,8), %rdx
jmp 0x11513
cmpb $0x0, 0x3aeab(%rip)     # 0x4c3ac
je 0x1150c
leaq 0x36da6(%rip), %rdx     # 0x482b0
jmp 0x11513
leaq 0x35f9d(%rip), %rdx     # 0x474b0
pushq $0x70
popq %rcx
jmp 0x115e3
cmpl $0x80, %esi
sete %cl
cmpl $0x9c, %edx
sete %r8b
orb %cl, %r8b
je 0x115cf
jmp 0x115f6
cmpl $0xbf, %esi
je 0x11595
cmpl $0xbd, %esi
je 0x11582
cmpl $0xbc, %esi
jne 0x115a0
cmpl $0x8d, %edx
jne 0x115a0
jmp 0x115f6
cmpl $0xbb, %edx
jne 0x115cf
jmp 0x115f6
cmpl $0x92, %edx
jne 0x115cf
jmp 0x115f6
cmpl $0xa5, %edx
jne 0x115a0
jmp 0x115f6
cmpl $0x9e, %edx
jne 0x115a0
cmpl $0x0, 0x3ad1f(%rip)     # 0x4c2b0
je 0x115f6
jmp 0x115a0
leal -0xa0(%rdx), %ecx
cmpl $0x6, %ecx
jb 0x115f6
decl %eax
cmpl $0x3, %eax
jae 0x115b6
movl %eax, %eax
leaq 0x34d48(%rip), %rcx     # 0x462f8
movq (%rcx,%rax,8), %rax
jmp 0x115cf
cmpb $0x0, 0x3adef(%rip)     # 0x4c3ac
je 0x115c8
leaq 0x3946a(%rip), %rax     # 0x4aa30
jmp 0x115cf
leaq 0x37e61(%rip), %rax     # 0x49430
addl $0xffffff20, %edi       # imm = 0xFFFFFF20
movq (%rax,%rdi,8), %rax
pushq $0x40
popq %rcx
movl %esi, %edi
movl %edx, %esi
movq %rax, %rdx
movq %r15, %r8
movq %r14, %r9
callq 0x11602
testl %eax, %eax
je 0x1120e
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq