// File: /workspace/github_c_makefile_star2_O2/nurse[P]nkf/nkf.c
// Function: w_iconv
static nkf_char
w_iconv(nkf_char c1, nkf_char c2, nkf_char c3)
{
    nkf_char ret = 0, c4 = 0;
    static const char w_iconv_utf8_1st_byte[] =
    { /* 0xC0 - 0xFF */
	20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
	21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
	30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 33,
	40, 41, 41, 41, 42, 43, 43, 43, 50, 50, 50, 50, 60, 60, 70, 70};

    if (c3 > 0xFF) {
	c4 = c3 & 0xFF;
	c3 >>= 8;
    }

    if (c1 < 0 || 0xff < c1) {
    }else if (c1 == 0) { /* 0 : 1 byte*/
	c3 = 0;
    } else if ((c1 & 0xC0) == 0x80) { /* 0x80-0xbf : trail byte */
	return 0;
    } else{
	switch (w_iconv_utf8_1st_byte[c1 - 0xC0]) {
	case 21:
	    if (c2 < 0x80 || 0xBF < c2) return 0;
	    break;
	case 30:
	    if (c3 == 0) return -1;
	    if (c2 < 0xA0 || 0xBF < c2 || (c3 & 0xC0) != 0x80)
		return 0;
	    break;
	case 31:
	case 33:
	    if (c3 == 0) return -1;
	    if ((c2 & 0xC0) != 0x80 || (c3 & 0xC0) != 0x80)
		return 0;
	    break;
	case 32:
	    if (c3 == 0) return -1;
	    if (c2 < 0x80 || 0x9F < c2 || (c3 & 0xC0) != 0x80)
		return 0;
	    break;
	case 40:
	    if (c3 == 0) return -2;
	    if (c2 < 0x90 || 0xBF < c2 || (c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
		return 0;
	    break;
	case 41:
	    if (c3 == 0) return -2;
	    if (c2 < 0x80 || 0xBF < c2 || (c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
		return 0;
	    break;
	case 42:
	    if (c3 == 0) return -2;
	    if (c2 < 0x80 || 0x8F < c2 || (c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
		return 0;
	    break;
	default:
	    return 0;
	    break;
	}
    }
    if (c1 == 0 || c1 == EOF){
    } else if ((c1 & 0xf8) == 0xf0) { /* 4 bytes */
	c2 = nkf_char_unicode_new(nkf_utf8_to_unicode(c1, c2, c3, c4));
	c1 = 0;
    } else {
	if (x0213_f && x0213_wait_combining_p(nkf_utf8_to_unicode(c1, c2, c3, c4)))
	    return -3;
	ret = w2e_conv(c1, c2, c3, &c1, &c2);
    }
    if (ret == 0){
	(*oconv)(c1, c2);
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
movl %edi, 0x4(%rsp)
movl $0xff, %eax
movl %edx, %ecx
andl %eax, %ecx
movl %edx, %ebp
shrl $0x8, %ebp
xorl %r15d, %r15d
cmpl $0x100, %edx            # imm = 0x100
cmovll %edx, %ebp
movl %esi, (%rsp)
cmovll %r15d, %ecx
cmpl %eax, %edi
jbe 0xccca
leal 0x1(%r14), %eax
cmpl $0x2, %eax
jae 0xce31
pushq $-0x1
popq %r15
jmp 0xcea2
testl %r14d, %r14d
je 0xcea2
movl %r14d, %edx
andl $0xc0, %edx
xorl %eax, %eax
cmpl $0x80, %edx
je 0xceaf
movslq %r14d, %rdx
leaq 0x964c(%rip), %rsi      # 0x16340
movzbl -0xc0(%rdx,%rsi), %esi
leal -0x1e(%rsi), %edx
cmpl $0xc, %edx
ja 0xcd3d
leaq 0x9305(%rip), %rsi      # 0x16010
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
testl %ebp, %ebp
je 0xcdc7
movl $0xc0, %edx
movl %ebx, %esi
andl %edx, %esi
movl $0x80, %edi
xorl %edi, %esi
andl %ebp, %edx
xorl %edi, %edx
orl %esi, %edx
je 0xce31
jmp 0xceaf
cmpl $0x15, %esi
jne 0xceaf
leal -0xc0(%rbx), %edx
cmpl $-0x40, %edx
jae 0xce31
jmp 0xceaf
testl %ebp, %ebp
je 0xcdc7
movl %ebx, %edx
andl $-0x20, %edx
xorl $0xa0, %edx
movl %ebp, %esi
andl $0xc0, %esi
xorl $0x80, %esi
orl %edx, %esi
je 0xce31
jmp 0xceaf
testl %ebp, %ebp
je 0xceba
movl %ecx, %edx
andl $-0x40, %edx
cmpl $0x80, %edx
jne 0xceaf
movl %ebx, %edx
andl $-0x10, %edx
jmp 0xce15
testl %ebp, %ebp
je 0xcdc7
movl %ebx, %edx
andl $-0x20, %edx
movl $0x80, %esi
xorl %esi, %edx
movl %ebp, %edi
andl $0xc0, %edi
xorl %esi, %edi
orl %edx, %edi
je 0xce31
jmp 0xceaf
pushq $-0x1
jmp 0xcebc
testl %ebp, %ebp
je 0xceba
movl %ecx, %edx
andl $-0x40, %edx
cmpl $0x80, %edx
jne 0xceaf
leal -0x90(%rbx), %edx
cmpl $0x2f, %edx
jbe 0xce21
jmp 0xceaf
testl %ebp, %ebp
je 0xceba
movl %ecx, %edx
andl $-0x40, %edx
cmpl $0x80, %edx
jne 0xceaf
movl %ebx, %edx
andl $-0x40, %edx
cmpl $0x80, %edx
jne 0xceaf
movl %ebp, %edx
andl $0xc0, %edx
cmpl $0x80, %edx
jne 0xceaf
movl %r14d, %eax
andl $0xf8, %eax
cmpl $0xf0, %eax
jne 0xce5e
movl %r14d, %edi
movl %ebx, %esi
movl %ebp, %edx
callq 0x110cd
movl %eax, %ebx
orl $0x1000000, %ebx        # imm = 0x1000000
movl %ebx, (%rsp)
andl $0x0, 0x4(%rsp)
jmp 0xcea2
cmpb $0x1, 0x3f547(%rip)     # 0x4c3ac
jne 0xce82
movl %r14d, %edi
movl %ebx, %esi
movl %ebp, %edx
callq 0x110cd
movl %eax, %edi
callq 0x1113e
testl %eax, %eax
je 0xce82
pushq $-0x3
jmp 0xcebc
leaq 0x4(%rsp), %rcx
movq %rsp, %r8
movl %r14d, %edi
movl %ebx, %esi
movl %ebp, %edx
callq 0x11169
testl %eax, %eax
jne 0xceaf
movl 0x4(%rsp), %r15d
movl (%rsp), %ebx
movl %r15d, %edi
movl %ebx, %esi
callq *0x3f3fb(%rip)          # 0x4c2a8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x2
popq %rax
jmp 0xceaf