// File: /workspace/github_c_makefile_star2_O3/nurse[P]nkf/nkf.c
// Function: s2e_conv
static nkf_char
s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
{
#if defined(SHIFTJIS_CP932) || defined(X0212_ENABLE)
    nkf_char val;
#endif
    static const char shift_jisx0213_s1a3_table[5][2] ={ { 1, 8}, { 3, 4}, { 5,12}, {13,14}, {15, 0} };
    if (0xFC < c1) return 1;
#ifdef SHIFTJIS_CP932
    if (!cp932inv_f && !x0213_f && is_ibmext_in_sjis(c2)){
	val = shiftjis_cp932[c2 - CP932_TABLE_BEGIN][c1 - 0x40];
	if (val){
	    c2 = val >> 8;
	    c1 = val & 0xff;
	}
    }
    if (cp932inv_f
	&& CP932INV_TABLE_BEGIN <= c2 && c2 <= CP932INV_TABLE_END){
	val = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40];
	if (val){
	    c2 = val >> 8;
	    c1 = val & 0xff;
	}
    }
#endif /* SHIFTJIS_CP932 */
#ifdef X0212_ENABLE
    if (!x0213_f && is_ibmext_in_sjis(c2)){
	val = shiftjis_x0212[c2 - 0xfa][c1 - 0x40];
	if (val){
	    if (val > 0x7FFF){
		c2 = PREFIX_EUCG3 | ((val >> 8) & 0x7f);
		c1 = val & 0xff;
	    }else{
		c2 = val >> 8;
		c1 = val & 0xff;
	    }
	    if (p2) *p2 = c2;
	    if (p1) *p1 = c1;
	    return 0;
	}
    }
#endif
    if(c2 >= 0x80){
	if(x0213_f && c2 >= 0xF0){
	    if(c2 <= 0xF3 || (c2 == 0xF4 && c1 < 0x9F)){ /* k=1, 3<=k<=5, k=8, 12<=k<=15 */
		c2 = PREFIX_EUCG3 | 0x20 | shift_jisx0213_s1a3_table[c2 - 0xF0][0x9E < c1];
	    }else{ /* 78<=k<=94 */
		c2 = PREFIX_EUCG3 | (c2 * 2 - 0x17B);
		if (0x9E < c1) c2++;
	    }
	}else{
#define         SJ0162  0x00e1          /* 01 - 62 ku offset */
#define         SJ6394  0x0161          /* 63 - 94 ku offset */
	    c2 = c2 + c2 - ((c2 <= 0x9F) ? SJ0162 : SJ6394);
	    if (0x9E < c1) c2++;
	}
	if (c1 < 0x9F)
	    c1 = c1 - ((c1 > DEL) ? SP : 0x1F);
	else {
	    c1 = c1 - 0x7E;
	}
    }

#ifdef X0212_ENABLE
    c2 = x0212_unshift(c2);
#endif
    if (p2) *p2 = c2;
    if (p1) *p1 = c1;
    return 0;
}

// Assembly:
movl $0x1, %eax
cmpl $0xfc, %esi
jg 0x11271
movl 0x3c21b(%rip), %r8d     # 0x4d2c0
testl %r8d, %r8d
setne %r9b
movb 0x3c30a(%rip), %al      # 0x4d3bc
leal -0xfd(%rdi), %r10d
cmpl $-0x3, %r10d
setb %r10b
orb %al, %r10b
orb %r9b, %r10b
testb $0x1, %r10b
je 0x110fe
testl %r8d, %r8d
sete %r9b
leal -0xed(%rdi), %r8d
cmpl $0x2, %r8d
setae %r10b
orb %r9b, %r10b
jne 0x1112b
movl %r8d, %r8d
movslq %esi, %r9
imulq $0x17a, %r8, %r8        # imm = 0x17A
addq 0x3bec4(%rip), %r8      # 0x4cfc0
jmp 0x11116
leal -0xfa(%rdi), %r8d
movslq %esi, %r9
imulq $0x17a, %r8, %r8        # imm = 0x17A
addq 0x3beca(%rip), %r8      # 0x4cfe0
movzwl -0x80(%r8,%r9,2), %r8d
testl %r8d, %r8d
je 0x1112b
movl %r8d, %edi
shrl $0x8, %edi
movzbl %r8b, %esi
leal -0xfd(%rdi), %r8d
cmpl $-0x3, %r8d
setb %r8b
orb %al, %r8b
testb $0x1, %r8b
je 0x11150
cmpl $0x80, %edi
jge 0x111a4
jmp 0x11240
leal -0xfa(%rdi), %r8d
movslq %esi, %r9
imulq $0x17a, %r8, %r8        # imm = 0x17A
addq 0x3be68(%rip), %r8      # 0x4cfd0
movzwl -0x80(%r8,%r9,2), %r8d
testl %r8d, %r8d
je 0x111a4
testq %rdx, %rdx
je 0x11192
movl %r8d, %eax
shrl $0x8, %eax
movl %eax, %esi
andl $0x7f, %esi
orl $0x8f00, %esi           # imm = 0x8F00
testw %r8w, %r8w
cmovnsl %eax, %esi
movl %esi, (%rdx)
testq %rcx, %rcx
je 0x1126f
movzbl %r8b, %esi
jmp 0x1126d
cmpl $0xf0, %edi
setb %r8b
notb %al
orb %r8b, %al
testb $0x1, %al
jne 0x111ff
cmpl $0xf4, %edi
jb 0x111d7
cmpl $0x9e, %esi
jg 0x11272
cmpl $0xf4, %edi
jne 0x11272
addl $0xffffff10, %edi       # imm = 0xFFFFFF10
xorl %eax, %eax
cmpl $0x9f, %esi
setge %al
leaq 0x6141(%rip), %r8       # 0x17330
leaq (%r8,%rdi,2), %rdi
movsbl (%rax,%rdi), %edi
orl $0x8f20, %edi           # imm = 0x8F20
jmp 0x11226
xorl %eax, %eax
cmpl $0xa0, %edi
setb %al
shll $0x7, %eax
xorl %r8d, %r8d
cmpl $0x9f, %esi
setge %r8b
leal (%r8,%rdi,2), %edi
addl %eax, %edi
addl $0xfffffe9f, %edi       # imm = 0xFFFFFE9F
cmpl $0x9e, %esi
jg 0x1123d
xorl %eax, %eax
cmpl $0x7f, %esi
setg %al
xorl $-0x1f, %eax
addl %eax, %esi
jmp 0x11240
addl $-0x7e, %esi
leal -0x7f(%rdi), %eax
cmpl $0x9, %eax
ja 0x1124d
addl $-0xa, %edi
jmp 0x11261
leal -0x89(%rdi), %eax
cmpl $0x9, %eax
ja 0x11261
addl $-0x14, %edi
orl $0x8f80, %edi           # imm = 0x8F80
testq %rdx, %rdx
je 0x11268
movl %edi, (%rdx)
testq %rcx, %rcx
je 0x1126f
movl %esi, (%rcx)
xorl %eax, %eax
retq
leal -0x17b(,%rdi,2), %eax
orl $0x8f00, %eax           # imm = 0x8F00
xorl %edi, %edi
cmpl $0x9f, %esi
setge %dil
addl %eax, %edi
jmp 0x11226