// File: /workspace/github_c_makefile_star2_O1/nurse[P]nkf/nkf.c
// Function: z_conv
static void
z_conv(nkf_char c2, nkf_char c1)
{

    /* if (c2) c1 &= 0x7f; assertion */

    if (c2 == JIS_X_0201_1976_K && (c1 == 0x20 || c1 == 0x7D || c1 == 0x7E)) {
	(*o_zconv)(c2,c1);
	return;
    }

    if (x0201_f) {
	if (z_prev2 == JIS_X_0201_1976_K) {
	    if (c2 == JIS_X_0201_1976_K) {
		if (c1 == (0xde&0x7f)) { /* $BByE@(B */
		    z_prev2 = 0;
		    (*o_zconv)(dv[(z_prev1-SP)*2], dv[(z_prev1-SP)*2+1]);
		    return;
		} else if (c1 == (0xdf&0x7f) && ev[(z_prev1-SP)*2]) {  /* $BH>ByE@(B */
		    z_prev2 = 0;
		    (*o_zconv)(ev[(z_prev1-SP)*2], ev[(z_prev1-SP)*2+1]);
		    return;
		} else if (x0213_f && c1 == (0xdf&0x7f) && ev_x0213[(z_prev1-SP)*2]) {  /* $BH>ByE@(B */
		    z_prev2 = 0;
		    (*o_zconv)(ev_x0213[(z_prev1-SP)*2], ev_x0213[(z_prev1-SP)*2+1]);
		    return;
		}
	    }
	    z_prev2 = 0;
	    (*o_zconv)(cv[(z_prev1-SP)*2], cv[(z_prev1-SP)*2+1]);
	}
	if (c2 == JIS_X_0201_1976_K) {
	    if (dv[(c1-SP)*2] || ev[(c1-SP)*2] || (x0213_f && ev_x0213[(c1-SP)*2])) {
		/* wait for $BByE@(B or $BH>ByE@(B */
		z_prev1 = c1;
		z_prev2 = c2;
		return;
	    } else {
		(*o_zconv)(cv[(c1-SP)*2], cv[(c1-SP)*2+1]);
		return;
	    }
	}
    }

    if (c2 == EOF) {
	(*o_zconv)(c2, c1);
	return;
    }

    if (alpha_f&1 && c2 == 0x23) {
	/* JISX0208 Alphabet */
	c2 = 0;
    } else if (c2 == 0x21) {
	/* JISX0208 Kigou */
	if (0x21==c1) {
	    if (alpha_f&2) {
		c2 = 0;
		c1 = SP;
	    } else if (alpha_f&4) {
		(*o_zconv)(0, SP);
		(*o_zconv)(0, SP);
		return;
	    }
	} else if (alpha_f&1 && 0x20<c1 && c1<0x7f && fv[c1-0x20]) {
	    c2 =  0;
	    c1 = fv[c1-0x20];
	}
    }

    if (alpha_f&8 && c2 == 0) {
	/* HTML Entity */
	const char *entity = 0;
	switch (c1){
	case '>': entity = "&gt;"; break;
	case '<': entity = "&lt;"; break;
	case '\"': entity = "&quot;"; break;
	case '&': entity = "&amp;"; break;
	}
	if (entity){
	    while (*entity) (*o_zconv)(0, *entity++);
	    return;
	}
    }

    if (alpha_f & 16) {
	/* JIS X 0208 Katakana to JIS X 0201 Katakana */
	if (c2 == 0x21) {
	    nkf_char c = 0;
	    switch (c1) {
	    case 0x23:
		/* U+3002 (0x8142) Ideographic Full Stop -> U+FF61 (0xA1) Halfwidth Ideographic Full Stop */
		c = 0xA1;
		break;
	    case 0x56:
		/* U+300C (0x8175) Left Corner Bracket -> U+FF62 (0xA2) Halfwidth Left Corner Bracket */
		c = 0xA2;
		break;
	    case 0x57:
		/* U+300D (0x8176) Right Corner Bracket -> U+FF63 (0xA3) Halfwidth Right Corner Bracket */
		c = 0xA3;
		break;
	    case 0x22:
		/* U+3001 (0x8141) Ideographic Comma -> U+FF64 (0xA4) Halfwidth Ideographic Comma */
		c = 0xA4;
		break;
	    case 0x26:
		/* U+30FB (0x8145) Katakana Middle Dot -> U+FF65 (0xA5) Halfwidth Katakana Middle Dot */
		c = 0xA5;
		break;
	    case 0x3C:
		/* U+30FC (0x815B) Katakana-Hiragana Prolonged Sound Mark -> U+FF70 (0xB0) Halfwidth Katakana-Hiragana Prolonged Sound Mark */
		c = 0xB0;
		break;
	    case 0x2B:
		/* U+309B (0x814A) Katakana-Hiragana Voiced Sound Mark -> U+FF9E (0xDE) Halfwidth Katakana Voiced Sound Mark */
		c = 0xDE;
		break;
	    case 0x2C:
		/* U+309C (0x814B) Katakana-Hiragana Semi-Voiced Sound Mark -> U+FF9F (0xDF) Halfwidth Katakana Semi-Voiced Sound Mark */
		c = 0xDF;
		break;
	    }
	    if (c) {
		(*o_zconv)(JIS_X_0201_1976_K, c);
		return;
	    }
	} else if (c2 == 0x25) {
	    /* JISX0208 Katakana */
	    static const int fullwidth_to_halfwidth[] =
	    {
		0x0000, 0x2700, 0x3100, 0x2800, 0x3200, 0x2900, 0x3300, 0x2A00,
		0x3400, 0x2B00, 0x3500, 0x3600, 0x365E, 0x3700, 0x375E, 0x3800,
		0x385E, 0x3900, 0x395E, 0x3A00, 0x3A5E, 0x3B00, 0x3B5E, 0x3C00,
		0x3C5E, 0x3D00, 0x3D5E, 0x3E00, 0x3E5E, 0x3F00, 0x3F5E, 0x4000,
		0x405E, 0x4100, 0x415E, 0x2F00, 0x4200, 0x425E, 0x4300, 0x435E,
		0x4400, 0x445E, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900, 0x4A00,
		0x4A5E, 0x4A5F, 0x4B00, 0x4B5E, 0x4B5F, 0x4C00, 0x4C5E, 0x4C5F,
		0x4D00, 0x4D5E, 0x4D5F, 0x4E00, 0x4E5E, 0x4E5F, 0x4F00, 0x5000,
		0x5100, 0x5200, 0x5300, 0x2C00, 0x5400, 0x2D00, 0x5500, 0x2E00,
		0x5600, 0x5700, 0x5800, 0x5900, 0x5A00, 0x5B00, 0x0000, 0x5C00,
		0x0000, 0x0000, 0x2600, 0x5D00, 0x335E, 0x0000, 0x0000, 0x365F,
		0x375F, 0x385F, 0x395F, 0x3A5F, 0x3E5F, 0x425F, 0x445F, 0x0000
	    };
	    if (fullwidth_to_halfwidth[c1-0x20]){
		c2 = fullwidth_to_halfwidth[c1-0x20];
		(*o_zconv)(JIS_X_0201_1976_K, c2>>8);
		if (c2 & 0xFF) {
		    (*o_zconv)(JIS_X_0201_1976_K, c2&0xFF);
		}
		return;
	    }
	} else if (c2 == 0 && nkf_char_unicode_p(c1) &&
	    ((c1&VALUE_MASK) == 0x3099 || (c1&VALUE_MASK) == 0x309A)) { /* $B9g@.MQByE@!&H>ByE@(B */
	    (*o_zconv)(JIS_X_0201_1976_K, 0x5E + (c1&VALUE_MASK) - 0x3099);
	    return;
	}
    }
    (*o_zconv)(c2,c1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
cmpl $0x1013, %edi           # imm = 0x1013
jne 0x13e9b
leal -0x7d(%rbx), %eax
cmpl $0x2, %eax
jb 0x13e8a
cmpl $0x20, %ebx
jne 0x13e9b
movq 0x3945f(%rip), %rax     # 0x4d2f0
movl $0x1013, %edi           # imm = 0x1013
jmp 0x1412f
cmpl $0x0, 0x3940e(%rip)     # 0x4d2b0
je 0x13ff6
cmpb $0x1, 0x41751(%rip)     # 0x55600
jne 0x13fae
cmpl $0x1013, %r14d          # imm = 0x1013
jne 0x13f79
cmpl $0x5e, %ebx
jne 0x13f03
movb $0x0, 0x41732(%rip)     # 0x55600
movq 0x3941b(%rip), %rax     # 0x4d2f0
movl 0x41729(%rip), %ecx     # 0x55604
leal -0x40(,%rcx,2), %edx
movslq %edx, %rdx
leaq 0x3894(%rip), %rsi      # 0x17780
movzbl (%rdx,%rsi), %edi
leal -0x3f(,%rcx,2), %ecx
movslq %ecx, %rcx
movzbl (%rcx,%rsi), %esi
jmp 0x14131
cmpl $0x5f, %ebx
jne 0x13f27
movl 0x416f6(%rip), %eax     # 0x55604
leal -0x40(,%rax,2), %ecx
movslq %ecx, %rdx
leaq 0x38f1(%rip), %rcx      # 0x17810
movzbl (%rdx,%rcx), %edi
testl %edi, %edi
jne 0x13f54
cmpl $0x5f, %ebx
jne 0x13f79
testb $0x1, 0x39489(%rip)     # 0x4d3bc
je 0x13f79
movl 0x416c9(%rip), %eax     # 0x55604
leal -0x40(,%rax,2), %ecx
movslq %ecx, %rdx
leaq 0x3954(%rip), %rcx      # 0x178a0
movzbl (%rdx,%rcx), %edi
testl %edi, %edi
je 0x13f79
addl %eax, %eax
movb $0x0, 0x416a3(%rip)     # 0x55600
movq 0x3938c(%rip), %rdx     # 0x4d2f0
addl $-0x3f, %eax
cltq
movzbl (%rax,%rcx), %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rdx
movb $0x0, 0x41680(%rip)     # 0x55600
movl 0x4167e(%rip), %eax     # 0x55604
leal -0x40(,%rax,2), %ecx
movslq %ecx, %rcx
leaq 0x35d9(%rip), %rdx      # 0x17570
movzbl (%rcx,%rdx), %edi
leal -0x3f(,%rax,2), %eax
cltq
movzbl (%rax,%rdx), %esi
callq *0x39342(%rip)          # 0x4d2f0
cmpl $0x1013, %r14d          # imm = 0x1013
jne 0x13ff6
leal -0x40(,%rbx,2), %eax
cltq
leaq 0x37b9(%rip), %rcx      # 0x17780
cmpb $0x0, (%rax,%rcx)
jne 0x13fde
leaq 0x383c(%rip), %rcx      # 0x17810
cmpb $0x0, (%rax,%rcx)
je 0x14202
movl %ebx, 0x41620(%rip)     # 0x55604
movb $0x1, 0x41615(%rip)     # 0x55600
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %r14d
je 0x14055
movl 0x4156e(%rip), %eax     # 0x55570
cmpl $0x23, %r14d
sete %cl
xorl %ebp, %ebp
testb %al, %cl
jne 0x14069
cmpl $0x21, %r14d
jne 0x14066
cmpl $0x21, %ebx
jne 0x140aa
movl $0x20, %ebx
testb $0x2, %al
jne 0x14069
movl $0x21, %ebp
movl $0x21, %ebx
testb $0x4, %al
je 0x14069
xorl %edi, %edi
movl $0x20, %esi
callq *0x392ae(%rip)          # 0x4d2f0
movq 0x392a7(%rip), %rax     # 0x4d2f0
xorl %edi, %edi
movl $0x20, %esi
jmp 0x14131
movq 0x39294(%rip), %rax     # 0x4d2f0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
jmp 0x1412f
movl %r14d, %ebp
testb $0x8, %al
je 0x1411d
testl %ebp, %ebp
jne 0x1411d
movb $0x1, %r15b
xorl %r14d, %r14d
cmpl $0x3b, %ebx
jg 0x14097
cmpl $0x22, %ebx
je 0x140dd
cmpl $0x26, %ebx
jne 0x140f0
leaq 0x46ac(%rip), %r14      # 0x18741
jmp 0x140ed
cmpl $0x3c, %ebx
je 0x140e6
cmpl $0x3e, %ebx
jne 0x140f0
leaq 0x4688(%rip), %r14      # 0x18730
jmp 0x140ed
testb $0x1, %al
sete %cl
leal -0x21(%rbx), %edx
cmpl $0x5e, %edx
setae %dl
movl $0x21, %ebp
orb %cl, %dl
jne 0x14069
leal -0x20(%rbx), %ecx
leaq 0x3865(%rip), %rdx      # 0x17930
movzbl (%rcx,%rdx), %ecx
xorl %edx, %edx
testl %ecx, %ecx
cmovnel %edx, %ebp
cmovel %ebx, %ecx
movl %ecx, %ebx
jmp 0x14069
leaq 0x4656(%rip), %r14      # 0x1873a
jmp 0x140ed
leaq 0x4648(%rip), %r14      # 0x18735
xorl %r15d, %r15d
testb %r15b, %r15b
jne 0x1411d
movb (%r14), %al
testb %al, %al
je 0x14114
incq %r14
movsbl %al, %esi
xorl %edi, %edi
callq *0x391e6(%rip)          # 0x4d2f0
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x140ff
testb %r15b, %r15b
je 0x13feb
testb $0x10, 0x4144c(%rip)    # 0x55570
jne 0x1413d
movq 0x391c3(%rip), %rax     # 0x4d2f0
movl %ebp, %edi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
cmpl $0x25, %ebp
je 0x1417a
cmpl $0x21, %ebp
jne 0x141c0
xorl %esi, %esi
movb $0x1, %al
cmpl $0x3b, %ebx
jg 0x14246
leal -0x22(%rbx), %ecx
cmpl $0xa, %ecx
ja 0x14286
leaq 0x3175(%rip), %rdx      # 0x172dc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0xa4, %esi
jmp 0x14284
movslq %ebx, %rax
leaq 0x347c(%rip), %rcx      # 0x17600
movl -0x80(%rcx,%rax,4), %r14d
testl %r14d, %r14d
je 0x14126
movl %r14d, %esi
sarl $0x8, %esi
movl $0x1013, %edi           # imm = 0x1013
callq *0x39151(%rip)          # 0x4d2f0
andl $0xff, %r14d
je 0x13feb
movq 0x3913d(%rip), %rax     # 0x4d2f0
movl $0x1013, %edi           # imm = 0x1013
movl %r14d, %esi
jmp 0x14131
movl %ebx, %eax
andl $0xff000000, %eax       # imm = 0xFF000000
xorl $0x1000000, %eax        # imm = 0x1000000
orl %ebp, %eax
jne 0x14126
movl %ebx, %esi
andl $0xffffff, %esi         # imm = 0xFFFFFF
leal -0x3099(%rsi), %eax
cmpl $0x1, %eax
ja 0x14126
movq 0x390fe(%rip), %rax     # 0x4d2f0
addl $0xffffcfc5, %esi       # imm = 0xFFFFCFC5
movl $0x1013, %edi           # imm = 0x1013
jmp 0x14131
cmpb $0x1, 0x391b3(%rip)     # 0x4d3bc
jne 0x1421c
leaq 0x368e(%rip), %rcx      # 0x178a0
cmpb $0x0, (%rax,%rcx)
jne 0x13fde
addl %ebx, %ebx
movq 0x390cb(%rip), %rcx     # 0x4d2f0
leaq 0x3344(%rip), %rdx      # 0x17570
movzbl (%rax,%rdx), %edi
addl $-0x3f, %ebx
movslq %ebx, %rax
movzbl (%rax,%rdx), %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
cmpl $0x3c, %ebx
je 0x14278
cmpl $0x56, %ebx
je 0x1427f
cmpl $0x57, %ebx
jne 0x14286
movl $0xa3, %esi
jmp 0x14284
movl $0xde, %esi
jmp 0x14284
movl $0xa5, %esi
jmp 0x14284
movl $0xa1, %esi
jmp 0x14284
movl $0xdf, %esi
jmp 0x14284
movl $0xb0, %esi
jmp 0x14284
movl $0xa2, %esi
xorl %eax, %eax
testb %al, %al
jne 0x14126
movq 0x3905b(%rip), %rax     # 0x4d2f0
movl $0x1013, %edi           # imm = 0x1013
jmp 0x14131