// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0xff, -0x10(%rbp)
jle 0xd05c
movl -0x10(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %eax
sarl $0x8, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0xd06c
movl $0xff, %eax
cmpl -0x8(%rbp), %eax
jge 0xd071
jmp 0xd2d0
cmpl $0x0, -0x8(%rbp)
jne 0xd083
movl $0x0, -0x10(%rbp)
jmp 0xd2ce
movl -0x8(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0xd09e
movl $0x0, -0x4(%rbp)
jmp 0xd374
movl -0x8(%rbp), %eax
addl $0xffffff40, %eax       # imm = 0xFFFFFF40
cltq
leaq 0xf521(%rip), %rcx      # 0x1c5d0
movsbl (%rax,%rcx), %eax
addl $-0x15, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x15, %eax
ja 0xd2be
movq -0x20(%rbp), %rax
leaq 0xef40(%rip), %rcx      # 0x1c010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x80, -0xc(%rbp)
jl 0xd0ec
movl $0xbf, %eax
cmpl -0xc(%rbp), %eax
jge 0xd0f8
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
cmpl $0x0, -0x10(%rbp)
jne 0xd10f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd374
cmpl $0xa0, -0xc(%rbp)
jl 0xd131
movl $0xbf, %eax
cmpl -0xc(%rbp), %eax
jl 0xd131
movl -0x10(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
je 0xd13d
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
cmpl $0x0, -0x10(%rbp)
jne 0xd154
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd374
movl -0xc(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0xd172
movl -0x10(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
je 0xd17e
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
cmpl $0x0, -0x10(%rbp)
jne 0xd195
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd374
cmpl $0x80, -0xc(%rbp)
jl 0xd1b7
movl $0x9f, %eax
cmpl -0xc(%rbp), %eax
jl 0xd1b7
movl -0x10(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
je 0xd1c3
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
cmpl $0x0, -0x10(%rbp)
jne 0xd1da
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd374
cmpl $0x90, -0xc(%rbp)
jl 0xd20b
movl $0xbf, %eax
cmpl -0xc(%rbp), %eax
jl 0xd20b
movl -0x10(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0xd20b
movl -0x18(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
je 0xd217
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
cmpl $0x0, -0x10(%rbp)
jne 0xd22e
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd374
cmpl $0x80, -0xc(%rbp)
jl 0xd25f
movl $0xbf, %eax
cmpl -0xc(%rbp), %eax
jl 0xd25f
movl -0x10(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0xd25f
movl -0x18(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
je 0xd26b
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
cmpl $0x0, -0x10(%rbp)
jne 0xd27f
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd374
cmpl $0x80, -0xc(%rbp)
jl 0xd2b0
movl $0x8f, %eax
cmpl -0xc(%rbp), %eax
jl 0xd2b0
movl -0x10(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0xd2b0
movl -0x18(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
je 0xd2bc
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2ca
movl $0x0, -0x4(%rbp)
jmp 0xd374
jmp 0xd2cc
jmp 0xd2ce
jmp 0xd2d0
cmpl $0x0, -0x8(%rbp)
je 0xd2dc
cmpl $-0x1, -0x8(%rbp)
jne 0xd2de
jmp 0xd359
movl -0x8(%rbp), %eax
andl $0xf8, %eax
cmpl $0xf0, %eax
jne 0xd30f
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x12680
orl $0x1000000, %eax        # imm = 0x1000000
movl %eax, -0xc(%rbp)
movl $0x0, -0x8(%rbp)
jmp 0xd357
cmpl $0x0, 0x45106(%rip)     # 0x5241c
je 0xd33e
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x12680
movl %eax, %edi
callq 0x12770
cmpl $0x0, %eax
je 0xd33e
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0xd374
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x8(%rbp), %rcx
leaq -0xc(%rbp), %r8
callq 0x127d0
movl %eax, -0x14(%rbp)
jmp 0xd359
cmpl $0x0, -0x14(%rbp)
jne 0xd36e
movq 0x44f32(%rip), %rax     # 0x52298
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
callq *%rax
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)