// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0xfc, %eax
cmpl -0xc(%rbp), %eax
jge 0x1220c
movl $0x1, -0x4(%rbp)
jmp 0x124da
cmpl $0x0, 0x4008d(%rip)     # 0x522a0
jne 0x12279
cmpl $0x0, 0x40200(%rip)     # 0x5241c
jne 0x12279
movl $0xfa, %eax
cmpl -0x8(%rbp), %eax
jg 0x12279
cmpl $0xfc, -0x8(%rbp)
jg 0x12279
movl -0x8(%rbp), %eax
subl $0xfa, %eax
movslq %eax, %rcx
leaq 0x18d2d(%rip), %rax     # 0x2af70
imulq $0x17a, %rcx, %rcx      # imm = 0x17A
addq %rcx, %rax
movl -0xc(%rbp), %ecx
subl $0x40, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x12277
movl -0x24(%rbp), %eax
sarl $0x8, %eax
movl %eax, -0x8(%rbp)
movl -0x24(%rbp), %eax
andl $0xff, %eax
movl %eax, -0xc(%rbp)
jmp 0x12279
cmpl $0x0, 0x40020(%rip)     # 0x522a0
je 0x122dd
movl $0xed, %eax
cmpl -0x8(%rbp), %eax
jg 0x122dd
cmpl $0xee, -0x8(%rbp)
jg 0x122dd
movl -0x8(%rbp), %eax
subl $0xed, %eax
movslq %eax, %rcx
leaq 0x19139(%rip), %rax     # 0x2b3e0
imulq $0x17a, %rcx, %rcx      # imm = 0x17A
addq %rcx, %rax
movl -0xc(%rbp), %ecx
subl $0x40, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x122db
movl -0x24(%rbp), %eax
sarl $0x8, %eax
movl %eax, -0x8(%rbp)
movl -0x24(%rbp), %eax
andl $0xff, %eax
movl %eax, -0xc(%rbp)
jmp 0x122dd
cmpl $0x0, 0x40138(%rip)     # 0x5241c
jne 0x123a0
movl $0xfa, %eax
cmpl -0x8(%rbp), %eax
jg 0x123a0
cmpl $0xfc, -0x8(%rbp)
jg 0x123a0
movl -0x8(%rbp), %eax
subl $0xfa, %eax
movslq %eax, %rcx
leaq 0x193c9(%rip), %rax     # 0x2b6e0
imulq $0x17a, %rcx, %rcx      # imm = 0x17A
addq %rcx, %rax
movl -0xc(%rbp), %ecx
subl $0x40, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1239e
cmpl $0x7fff, -0x24(%rbp)    # imm = 0x7FFF
jle 0x1235e
movl -0x24(%rbp), %eax
sarl $0x8, %eax
andl $0x7f, %eax
orl $0x8f00, %eax           # imm = 0x8F00
movl %eax, -0x8(%rbp)
movl -0x24(%rbp), %eax
andl $0xff, %eax
movl %eax, -0xc(%rbp)
jmp 0x12372
movl -0x24(%rbp), %eax
sarl $0x8, %eax
movl %eax, -0x8(%rbp)
movl -0x24(%rbp), %eax
andl $0xff, %eax
movl %eax, -0xc(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x12382
movl -0x8(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x12392
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x124da
jmp 0x123a0
cmpl $0x80, -0x8(%rbp)
jl 0x124a8
cmpl $0x0, 0x40068(%rip)     # 0x5241c
je 0x12441
cmpl $0xf0, -0x8(%rbp)
jl 0x12441
cmpl $0xf3, -0x8(%rbp)
jle 0x123de
cmpl $0xf4, -0x8(%rbp)
jne 0x12418
cmpl $0x9f, -0xc(%rbp)
jge 0x12418
movl -0x8(%rbp), %eax
subl $0xf0, %eax
movslq %eax, %rcx
leaq 0xa1d0(%rip), %rax      # 0x1c5c0
shlq %rcx
addq %rcx, %rax
movl $0x9e, %ecx
cmpl -0xc(%rbp), %ecx
setl %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
orl $0x8f20, %eax           # imm = 0x8F20
movl %eax, -0x8(%rbp)
jmp 0x1243f
movl -0x8(%rbp), %eax
shll %eax
subl $0x17b, %eax            # imm = 0x17B
orl $0x8f00, %eax           # imm = 0x8F00
movl %eax, -0x8(%rbp)
movl $0x9e, %eax
cmpl -0xc(%rbp), %eax
jge 0x1243d
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x1243f
jmp 0x12477
movl -0x8(%rbp), %eax
addl -0x8(%rbp), %eax
movl -0x8(%rbp), %esi
movl $0x161, %ecx            # imm = 0x161
movl $0xe1, %edx
cmpl $0x9f, %esi
cmovlel %edx, %ecx
subl %ecx, %eax
movl %eax, -0x8(%rbp)
movl $0x9e, %eax
cmpl -0xc(%rbp), %eax
jge 0x12475
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x12477
cmpl $0x9f, -0xc(%rbp)
jge 0x1249d
movl -0xc(%rbp), %eax
movl -0xc(%rbp), %esi
movl $0x1f, %ecx
movl $0x20, %edx
cmpl $0x7f, %esi
cmovgl %edx, %ecx
subl %ecx, %eax
movl %eax, -0xc(%rbp)
jmp 0x124a6
movl -0xc(%rbp), %eax
subl $0x7e, %eax
movl %eax, -0xc(%rbp)
jmp 0x124a8
movl -0x8(%rbp), %edi
callq 0x125b0
movl %eax, -0x8(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x124c3
movl -0x8(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x124d3
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)