// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
cmpl $0x7f, %edi
jg 0x11437
movl $0x0, (%r14)
movl %edi, (%rbx)
movl (%r14), %edi
movl %edi, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
xorl %eax, %eax
cmpl $0x8f00, %ecx           # imm = 0x8F00
jne 0x1185d
cmpl $0x0, 0x3bea1(%rip)     # 0x4d2c0
je 0x11503
xorl %eax, %eax
cmpq $0x0, 0x43fe1(%rip)     # 0x55410
setne %al
jmp 0x1185d
cmpl $0xdf, %edi
ja 0x1148f
movl 0x43fc3(%rip), %ecx     # 0x55408
cmpb $0x1, 0x43fc0(%rip)     # 0x5540c
jne 0x11711
cmpl $0x2, %ecx
jne 0x1153a
leaq 0x3773e(%rip), %rdx     # 0x48ba0
cmpb $-0x3d, %dil
je 0x115b4
movzbl %dil, %eax
cmpl $0xc2, %eax
jne 0x11740
movl $0x1, %eax
movabsq $-0xfacfe7000000000, %rcx # imm = 0xF053019000000000
jmp 0x1156e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0xef, %edx
jg 0x1185d
movl 0x43f62(%rip), %ecx     # 0x55408
cmpb $0x1, 0x43f5f(%rip)     # 0x5540c
jne 0x117fe
cmpl $0x1, %ecx
je 0x11652
cmpl $0x3, %ecx
je 0x11611
cmpl $0x2, %ecx
jne 0x116b8
movl %edi, %eax
xorl $0xe3, %eax
movl %esi, %ecx
xorl $0x82, %ecx
orl %eax, %ecx
movl %edx, %r8d
xorl $0x94, %r8d
movl $0x1, %eax
orl %ecx, %r8d
je 0x1185d
leaq 0x39222(%rip), %rcx     # 0x4a720
jmp 0x1182d
movl (%rbx), %esi
leaq 0x4(%rsp), %rdx
movq %rsp, %rcx
callq 0x10f30
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x1185d
movl 0x4(%rsp), %edi
movl (%rsp), %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1108d
xorl %eax, %eax
jmp 0x1185d
cmpl $0x0, 0x3bd7f(%rip)     # 0x4d2c0
je 0x1157d
cmpl $0x1, %ecx
jne 0x115cc
leaq 0x372cd(%rip), %rdx     # 0x48820
cmpl $0xc2, %edi
jne 0x11740
movl $0x1, %eax
movabsq $-0x7aac386e00000000, %rcx # imm = 0x8553C79200000000
btq %rsi, %rcx
jb 0x11740
jmp 0x1185d
cmpb $-0x3d, %dil
je 0x116fe
movzbl %dil, %eax
cmpl $0xc2, %eax
jne 0x11711
movl $0x1, %eax
movabsq $0x5301ec00000000, %rdx # imm = 0x5301EC00000000
btq %rsi, %rdx
jb 0x11711
jmp 0x1185d
movl %esi, %ecx
andl $0x1f, %ecx
movl $0x1, %eax
cmpl $0x17, %ecx
je 0x11740
jmp 0x1185d
movl %ecx, %eax
xorl $0x3, %eax
movl %edi, %edx
xorl $0xc2, %edx
orl %eax, %edx
jne 0x11711
leaq 0x37938(%rip), %rdx     # 0x48f20
leal -0xa2(%rsi), %ecx
cmpl $0x16, %ecx
ja 0x11740
movl $0x1, %eax
movl $0x40241b, %r8d         # imm = 0x40241B
btl %ecx, %r8d
jb 0x1185d
jmp 0x11740
leaq 0x39188(%rip), %rcx     # 0x4a7a0
cmpl $0xe3, %edi
jne 0x1182d
cmpl $0x83, %esi
je 0x1179a
cmpl $0x82, %esi
jne 0x1182d
movl $0x1, %eax
cmpl $0x94, %edx
jne 0x1182d
jmp 0x1185d
leaq 0x39047(%rip), %rcx     # 0x4a6a0
cmpl $0xe3, %edi
je 0x1174a
cmpl $0xe2, %edi
jne 0x1182d
cmpl $0x88, %esi
je 0x117b0
cmpl $0x80, %esi
jne 0x1182d
leal -0x94(%rdx), %r8d
cmpl $0x2a, %r8d
ja 0x1182d
movl $0x1, %eax
movabsq $0x40000000005, %r9     # imm = 0x40000000005
btq %r8, %r9
jb 0x1185d
jmp 0x1182d
cmpl $0xef, %edi
je 0x11770
cmpl $0xe2, %edi
jne 0x117fe
cmpl $0x88, %esi
je 0x117c2
cmpl $0x80, %esi
jne 0x117fe
movl $0x1, %eax
cmpl $0x95, %edx
jne 0x117fe
jmp 0x1185d
movl %esi, %edx
andl $0x1f, %edx
movl $0x1, %eax
cmpl $0x17, %edx
jne 0x1185d
decl %ecx
cmpl $0x3, %ecx
jae 0x11727
movl %ecx, %eax
leaq 0x35baf(%rip), %rcx     # 0x472d0
movq (%rcx,%rax,8), %rdx
jmp 0x11740
cmpb $0x0, 0x3bc8e(%rip)     # 0x4d3bc
je 0x11739
leaq 0x37b69(%rip), %rdx     # 0x492a0
jmp 0x11740
leaq 0x36d60(%rip), %rdx     # 0x484a0
movl $0x70, %ecx
jmp 0x11843
cmpl $0x80, %esi
sete %al
cmpl $0x9c, %edx
sete %r8b
orb %al, %r8b
movl $0x1, %eax
je 0x1182d
jmp 0x1185d
cmpl $0xbf, %esi
je 0x117ec
cmpl $0xbd, %esi
je 0x117d4
cmpl $0xbc, %esi
jne 0x117fe
movl $0x1, %eax
cmpl $0x8d, %edx
jne 0x117fe
jmp 0x1185d
movl $0x1, %eax
cmpl $0xbb, %edx
jne 0x1182d
jmp 0x1185d
movl $0x1, %eax
cmpl $0x92, %edx
jne 0x1182d
jmp 0x1185d
movl $0x1, %eax
cmpl $0xa5, %edx
jne 0x117fe
jmp 0x1185d
cmpl $0x9e, %edx
jne 0x117fe
movl $0x1, %eax
cmpl $0x0, 0x3bad8(%rip)     # 0x4d2c0
je 0x1185d
jmp 0x117fe
leal -0xa0(%rdx), %r8d
movl $0x1, %eax
cmpl $0x6, %r8d
jb 0x1185d
decl %ecx
cmpl $0x3, %ecx
jae 0x11814
movl %ecx, %eax
leaq 0x35ada(%rip), %rcx     # 0x472e8
movq (%rcx,%rax,8), %rcx
jmp 0x1182d
cmpb $0x0, 0x3bba1(%rip)     # 0x4d3bc
je 0x11826
leaq 0x3a1fc(%rip), %rcx     # 0x4ba20
jmp 0x1182d
leaq 0x38bf3(%rip), %rcx     # 0x4a420
addl $0xffffff20, %edi       # imm = 0xFFFFFF20
movq (%rcx,%rdi,8), %rax
movl %esi, %edi
movl %edx, %esi
movq %rax, %rdx
movl $0x40, %ecx
movq %r14, %r8
movq %rbx, %r9
callq 0x11865
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
je 0x113ff
addq $0x8, %rsp
popq %rbx
popq %r14
retq