// File: /workspace/github_c_makefile_star2_O0/nurse[P]nkf/nkf.c
// Function: e2s_conv
static nkf_char
e2s_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
{
    nkf_char ndx;
    if (is_eucg3(c2)){
	ndx = c2 & 0x7f;
	if (x0213_f && is_x0213_2_in_x0212(ndx)){
	    if((0x21 <= ndx && ndx <= 0x2F)){
		if (p2) *p2 = ((ndx - 1) >> 1) + 0xec - ndx / 8 * 3;
		if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
		return 0;
	    }else if(0x6E <= ndx && ndx <= 0x7E){
		if (p2) *p2 = ((ndx - 1) >> 1) + 0xbe;
		if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
		return 0;
	    }
	    return 1;
	}
#ifdef X0212_ENABLE
	else if(nkf_isgraph(ndx)){
	    nkf_char val = 0;
	    const unsigned short *ptr;
	    ptr = x0212_shiftjis[ndx - 0x21];
	    if (ptr){
		val = ptr[(c1 & 0x7f) - 0x21];
	    }
	    if (val){
		c2 = val >> 8;
		c1 = val & 0xff;
		if (p2) *p2 = c2;
		if (p1) *p1 = c1;
		return 0;
	    }
	    c2 = x0212_shift(c2);
	}
#endif /* X0212_ENABLE */
    }
    if(0x7F < c2) return 1;
    if (p2) *p2 = ((c2 - 1) >> 1) + ((c2 <= 0x5e) ? 0x71 : 0xb1);
    if (p1) *p1 = c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl -0x8(%rbp), %eax
movzwl %ax, %eax
sarl $0x8, %eax
cmpl $0x8f, %eax
jne 0x1214b
movl -0x8(%rbp), %eax
andl $0x7f, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, 0x404b2(%rip)     # 0x5241c
je 0x120a1
movl -0x24(%rbp), %edi
callq 0x124f0
cmpl $0x0, %eax
je 0x120a1
movl $0x21, %eax
cmpl -0x24(%rbp), %eax
jg 0x12014
cmpl $0x2f, -0x24(%rbp)
jg 0x12014
cmpq $0x0, -0x18(%rbp)
je 0x11fc0
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
sarl %ecx
addl $0xec, %ecx
movl -0x24(%rbp), %eax
movl $0x8, %esi
cltd
idivl %esi
imull $0x3, %eax, %eax
subl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x12008
movl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x11ff0
movl -0xc(%rbp), %edx
movl $0x20, %eax
movl $0x1f, %ecx
cmpl $0x60, %edx
cmovll %ecx, %eax
movl %eax, -0x38(%rbp)
jmp 0x11ffa
movl $0x7e, %eax
movl %eax, -0x38(%rbp)
jmp 0x11ffa
movl -0x34(%rbp), %ecx
movl -0x38(%rbp), %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x121d7
movl $0x6e, %eax
cmpl -0x24(%rbp), %eax
jg 0x12093
cmpl $0x7e, -0x24(%rbp)
jg 0x12093
cmpq $0x0, -0x18(%rbp)
je 0x1203f
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
sarl %ecx
addl $0xbe, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x12087
movl -0xc(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1206f
movl -0xc(%rbp), %edx
movl $0x20, %eax
movl $0x1f, %ecx
cmpl $0x60, %edx
cmovll %ecx, %eax
movl %eax, -0x40(%rbp)
jmp 0x12079
movl $0x7e, %eax
movl %eax, -0x40(%rbp)
jmp 0x12079
movl -0x3c(%rbp), %ecx
movl -0x40(%rbp), %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x121d7
jmp 0x12095
movl $0x1, -0x4(%rbp)
jmp 0x121d7
movl $0x21, %eax
cmpl -0x24(%rbp), %eax
jg 0x12147
cmpl $0x7e, -0x24(%rbp)
jg 0x12147
movl $0x0, -0x28(%rbp)
movl -0x24(%rbp), %eax
subl $0x21, %eax
movslq %eax, %rcx
leaq 0x3ea20(%rip), %rax     # 0x50af0
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x120f6
movq -0x30(%rbp), %rax
movl -0xc(%rbp), %ecx
andl $0x7f, %ecx
subl $0x21, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x1213c
movl -0x28(%rbp), %eax
sarl $0x8, %eax
movl %eax, -0x8(%rbp)
movl -0x28(%rbp), %eax
andl $0xff, %eax
movl %eax, -0xc(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x12120
movl -0x8(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x12130
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x121d7
movl -0x8(%rbp), %edi
callq 0x12540
movl %eax, -0x8(%rbp)
jmp 0x12149
jmp 0x1214b
movl $0x7f, %eax
cmpl -0x8(%rbp), %eax
jge 0x1215e
movl $0x1, -0x4(%rbp)
jmp 0x121d7
cmpq $0x0, -0x18(%rbp)
je 0x12188
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
sarl %ecx
movl -0x8(%rbp), %esi
movl $0xb1, %eax
movl $0x71, %edx
cmpl $0x5e, %esi
cmovlel %edx, %eax
addl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x121d0
movl -0xc(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x8(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x121b8
movl -0xc(%rbp), %edx
movl $0x20, %eax
movl $0x1f, %ecx
cmpl $0x60, %edx
cmovll %ecx, %eax
movl %eax, -0x48(%rbp)
jmp 0x121c2
movl $0x7e, %eax
movl %eax, -0x48(%rbp)
jmp 0x121c2
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
addl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq