// File: /workspace/github_c_makefile_star2_O1/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 0x11425
movl $0x0, (%r14)
movl %edi, (%rbx)
xorl %eax, %eax
jmp 0x11796
cmpl $0xdf, %edi
jg 0x11475
cmpb $0x1, 0x43fd8(%rip)     # 0x5540c
jne 0x11574
movl 0x43fc8(%rip), %eax     # 0x55408
cmpl $0x2, %eax
jne 0x114e2
cmpl $0xc3, %edi
je 0x11533
cmpl $0xc2, %edi
jne 0x11574
movl $0x1, %eax
movabsq $-0xfacfe7000000000, %rcx # imm = 0xF053019000000000
jmp 0x11528
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0xef, %edx
jg 0x117f5
cmpb $0x1, 0x43f7f(%rip)     # 0x5540c
jne 0x11740
movl 0x43f6f(%rip), %eax     # 0x55408
cmpl $0x1, %eax
je 0x115ed
cmpl $0x3, %eax
je 0x115b3
cmpl $0x2, %eax
jne 0x1164a
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
jne 0x11740
jmp 0x117f5
cmpl $0x0, 0x3bdd7(%rip)     # 0x4d2c0
je 0x11509
cmpl $0x1, %eax
jne 0x11547
cmpl $0xc2, %edi
jne 0x11574
movl $0x1, %eax
movabsq $-0x7aac386e00000000, %rcx # imm = 0x8553C79200000000
jmp 0x11528
cmpl $0xc3, %edi
je 0x11533
cmpl $0xc2, %edi
jne 0x11574
movl $0x1, %eax
movabsq $0x5301ec00000000, %rcx # imm = 0x5301EC00000000
btq %rsi, %rcx
jb 0x11574
jmp 0x117f5
movl %esi, %ecx
andl $0x1f, %ecx
movl $0x1, %eax
cmpl $0x17, %ecx
je 0x11574
jmp 0x117f5
xorl $0x3, %eax
movl %edi, %ecx
xorl $0xc2, %ecx
orl %eax, %ecx
jne 0x11574
leal -0xa2(%rsi), %ecx
cmpl $0x16, %ecx
ja 0x11574
movl $0x1, %eax
movl $0x40241b, %edx         # imm = 0x40241B
btl %ecx, %edx
jb 0x117f5
movl 0x43e8e(%rip), %eax     # 0x55408
decl %eax
cmpl $0x3, %eax
jae 0x11590
movl %eax, %eax
leaq 0x35d46(%rip), %rcx     # 0x472d0
movq (%rcx,%rax,8), %rdx
jmp 0x115a9
cmpb $0x0, 0x3be25(%rip)     # 0x4d3bc
je 0x115a2
leaq 0x37d00(%rip), %rdx     # 0x492a0
jmp 0x115a9
leaq 0x36ef7(%rip), %rdx     # 0x484a0
movl $0x70, %ecx
jmp 0x1178b
cmpl $0xe3, %edi
jne 0x11740
cmpl $0x83, %esi
je 0x116da
cmpl $0x82, %esi
jne 0x11740
movl $0x1, %eax
cmpl $0x94, %edx
jne 0x11740
jmp 0x117f5
cmpl $0xe3, %edi
je 0x1168c
cmpl $0xe2, %edi
jne 0x11740
cmpl $0x88, %esi
je 0x116ec
cmpl $0x80, %esi
jne 0x11740
leal -0x94(%rdx), %ecx
cmpl $0x2a, %ecx
ja 0x11740
movl $0x1, %eax
movabsq $0x40000000005, %r8     # imm = 0x40000000005
btq %rcx, %r8
jb 0x117f5
jmp 0x11740
cmpl $0xef, %edi
je 0x116b0
cmpl $0xe2, %edi
jne 0x11740
cmpl $0x88, %esi
je 0x116fe
cmpl $0x80, %esi
jne 0x11740
movl $0x1, %eax
cmpl $0x95, %edx
jne 0x11740
jmp 0x117f5
cmpl $0x80, %esi
sete %al
cmpl $0x9c, %edx
sete %cl
orb %al, %cl
movl $0x1, %eax
je 0x11740
jmp 0x117f5
cmpl $0xbf, %esi
je 0x1172c
cmpl $0xbd, %esi
je 0x11710
cmpl $0xbc, %esi
jne 0x11740
movl $0x1, %eax
cmpl $0x8d, %edx
jne 0x11740
jmp 0x117f5
movl $0x1, %eax
cmpl $0xbb, %edx
jne 0x11740
jmp 0x117f5
movl $0x1, %eax
cmpl $0x92, %edx
jne 0x11740
jmp 0x117f5
movl $0x1, %eax
cmpl $0xa5, %edx
jne 0x11740
jmp 0x117f5
cmpl $0x9e, %edx
jne 0x11740
movl $0x1, %eax
cmpl $0x0, 0x3bb9c(%rip)     # 0x4d2c0
je 0x117f5
jmp 0x11740
leal -0xa0(%rdx), %ecx
movl $0x1, %eax
cmpl $0x6, %ecx
jb 0x117f5
movl 0x43cc2(%rip), %eax     # 0x55408
decl %eax
cmpl $0x3, %eax
jae 0x1175c
movl %eax, %eax
leaq 0x35b92(%rip), %rcx     # 0x472e8
movq (%rcx,%rax,8), %rax
jmp 0x11775
cmpb $0x0, 0x3bc59(%rip)     # 0x4d3bc
je 0x1176e
leaq 0x3a2b4(%rip), %rax     # 0x4ba20
jmp 0x11775
leaq 0x38cab(%rip), %rax     # 0x4a420
addl $0xffffff20, %edi       # imm = 0xFFFFFF20
movq (%rax,%rdi,8), %rax
movl %esi, %edi
movl %edx, %esi
movq %rax, %rdx
movl $0x40, %ecx
movq %r14, %r8
movq %rbx, %r9
callq 0x117fd
testl %eax, %eax
jne 0x117f5
movl (%r14), %edi
movl %edi, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
xorl %eax, %eax
cmpl $0x8f00, %ecx           # imm = 0x8F00
jne 0x117f5
cmpl $0x0, 0x3bb0a(%rip)     # 0x4d2c0
je 0x117c7
xorl %eax, %eax
cmpq $0x0, 0x43c4e(%rip)     # 0x55410
setne %al
jmp 0x117f5
movl (%rbx), %esi
leaq 0x4(%rsp), %rdx
movq %rsp, %rcx
callq 0x10f40
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x117f5
movl 0x4(%rsp), %edi
movl (%rsp), %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x110a3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq