// File: /workspace/github_c_makefile_star2_O2/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:
cmpl $0xfc, %esi
jle 0x10eb2
pushq $0x1
popq %rax
retq
movl 0x3b3f7(%rip), %r8d     # 0x4c2b0
testl %r8d, %r8d
setne %r9b
movb 0x3b4e6(%rip), %al      # 0x4c3ac
leal -0xfd(%rdi), %r10d
cmpl $-0x3, %r10d
setb %r10b
orb %al, %r10b
orb %r9b, %r10b
testb $0x1, %r10b
je 0x10f12
testl %r8d, %r8d
sete %r9b
leal -0xed(%rdi), %r8d
cmpl $0x2, %r8d
setae %r10b
orb %r9b, %r10b
jne 0x10f3f
movl %r8d, %r8d
movslq %esi, %r9
imulq $0x17a, %r8, %r8        # imm = 0x17A
addq 0x3b0b8(%rip), %r8      # 0x4bfc8
jmp 0x10f2a
leal -0xfa(%rdi), %r8d
movslq %esi, %r9
imulq $0x17a, %r8, %r8        # imm = 0x17A
addq 0x3b0b6(%rip), %r8      # 0x4bfe0
movzwl -0x80(%r8,%r9,2), %r8d
testl %r8d, %r8d
je 0x10f3f
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 0x10f64
cmpl $0x80, %edi
jge 0x10fb8
jmp 0x11054
leal -0xfa(%rdi), %r8d
movslq %esi, %r9
imulq $0x17a, %r8, %r8        # imm = 0x17A
addq 0x3b05c(%rip), %r8      # 0x4bfd8
movzwl -0x80(%r8,%r9,2), %r8d
testl %r8d, %r8d
je 0x10fb8
testq %rdx, %rdx
je 0x10fa6
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 0x11083
movzbl %r8b, %esi
jmp 0x11081
cmpl $0xf0, %edi
setb %r8b
notb %al
orb %r8b, %al
testb $0x1, %al
jne 0x11013
cmpl $0xf4, %edi
jb 0x10feb
cmpl $0x9e, %esi
jg 0x11086
cmpl $0xf4, %edi
jne 0x11086
addl $0xffffff10, %edi       # imm = 0xFFFFFF10
xorl %eax, %eax
cmpl $0x9f, %esi
setge %al
leaq 0x532d(%rip), %r8       # 0x16330
leaq (%r8,%rdi,2), %rdi
movsbl (%rax,%rdi), %edi
orl $0x8f20, %edi           # imm = 0x8F20
jmp 0x1103a
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 0x11051
xorl %eax, %eax
cmpl $0x7f, %esi
setg %al
xorl $-0x1f, %eax
addl %eax, %esi
jmp 0x11054
addl $-0x7e, %esi
leal -0x7f(%rdi), %eax
cmpl $0x9, %eax
ja 0x11061
addl $-0xa, %edi
jmp 0x11075
leal -0x89(%rdi), %eax
cmpl $0x9, %eax
ja 0x11075
addl $-0x14, %edi
orl $0x8f80, %edi           # imm = 0x8F80
testq %rdx, %rdx
je 0x1107c
movl %edi, (%rdx)
testq %rcx, %rcx
je 0x11083
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 0x1103a