// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
cmpl $0x1013, %edi           # imm = 0x1013
jne 0x13831
leal -0x7d(%rbx), %eax
cmpl $0x2, %eax
jb 0x13820
cmpl $0x20, %ebx
jne 0x13831
movq 0x38ab9(%rip), %rax     # 0x4c2e0
movl $0x1013, %edi           # imm = 0x1013
jmp 0x139f1
cmpl $0x0, 0x38a68(%rip)     # 0x4c2a0
je 0x13968
cmpb $0x1, 0x40dab(%rip)     # 0x545f0
jne 0x13927
cmpl $0x1013, %ebp           # imm = 0x1013
jne 0x138f2
cmpl $0x5f, %ebx
je 0x138a1
cmpl $0x5e, %ebx
jne 0x138f2
movb $0x0, 0x40d84(%rip)     # 0x545f0
movq 0x38a6d(%rip), %rax     # 0x4c2e0
movl 0x40d7b(%rip), %ecx     # 0x545f4
leal -0x40(,%rcx,2), %edx
movslq %edx, %rdx
leaq 0x2f06(%rip), %rsi      # 0x16790
movzbl (%rdx,%rsi), %edi
leal -0x3f(,%rcx,2), %ecx
movslq %ecx, %rcx
movzbl (%rcx,%rsi), %esi
jmp 0x139f3
movl 0x40d4d(%rip), %eax     # 0x545f4
leal -0x40(,%rax,2), %ecx
addl %eax, %eax
movslq %ecx, %rcx
leaq 0x2f66(%rip), %rdx      # 0x16820
movzbl (%rcx,%rdx), %edi
testl %edi, %edi
je 0x138da
movb $0x0, 0x40d27(%rip)     # 0x545f0
movq 0x38a10(%rip), %rcx     # 0x4c2e0
addl $-0x3f, %eax
cltq
jmp 0x13b56
cmpb $0x1, 0x38acb(%rip)     # 0x4c3ac
jne 0x138f2
leaq 0x2fc6(%rip), %rdx      # 0x168b0
movzbl (%rcx,%rdx), %edi
testl %edi, %edi
jne 0x138c2
movb $0x0, 0x40cf7(%rip)     # 0x545f0
movl 0x40cf5(%rip), %eax     # 0x545f4
leal -0x40(,%rax,2), %ecx
movslq %ecx, %rcx
leaq 0x2c70(%rip), %rdx      # 0x16580
movzbl (%rcx,%rdx), %edi
leal -0x3f(,%rax,2), %eax
cltq
movzbl (%rax,%rdx), %esi
callq *0x389b9(%rip)          # 0x4c2e0
cmpl $0x1013, %ebp           # imm = 0x1013
jne 0x13968
leal -0x40(,%rbx,2), %eax
cltq
leaq 0x2e51(%rip), %rcx      # 0x16790
cmpb $0x0, (%rax,%rcx)
jne 0x13956
leaq 0x2ed4(%rip), %rcx      # 0x16820
cmpb $0x0, (%rax,%rcx)
je 0x13b22
movl %ebx, 0x40c98(%rip)     # 0x545f4
movb $0x1, 0x40c8d(%rip)     # 0x545f0
jmp 0x13a98
cmpl $-0x1, %ebp
je 0x139a4
movl 0x40bed(%rip), %eax     # 0x54560
cmpl $0x23, %ebp
sete %cl
xorl %edi, %edi
testb %al, %cl
jne 0x139b2
cmpl $0x21, %ebp
jne 0x139b0
cmpl $0x21, %ebx
jne 0x13a33
testb $0x2, %al
jne 0x13b62
testb $0x4, %al
jne 0x13b8c
pushq $0x21
popq %rdi
movl %edi, %ebx
jmp 0x139b2
movq 0x38935(%rip), %rax     # 0x4c2e0
pushq $-0x1
popq %rdi
jmp 0x139f1
movl %ebp, %edi
testb $0x8, %al
je 0x139e6
testl %edi, %edi
jne 0x139e6
cmpl $0x22, %ebx
je 0x13a7d
cmpl $0x26, %ebx
je 0x13a6b
cmpl $0x3e, %ebx
je 0x13a74
cmpl $0x3c, %ebx
jne 0x139e6
leaq 0x3d64(%rip), %rbx      # 0x17745
jmp 0x13a91
testb $0x10, %al
jne 0x139fb
movq 0x388ef(%rip), %rax     # 0x4c2e0
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rax
cmpl $0x25, %edi
je 0x13a9f
cmpl $0x21, %edi
jne 0x13ae0
leal -0x22(%rbx), %eax
cmpl $0xa, %eax
ja 0x13b72
leaq 0x28d4(%rip), %rcx      # 0x162f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xa4, %esi
jmp 0x13bd1
testb $0x1, %al
sete %cl
leal -0x21(%rbx), %edx
cmpl $0x5e, %edx
setae %dl
orb %cl, %dl
jne 0x13b6a
leal -0x20(%rbx), %ecx
leaq 0x2eed(%rip), %rdx      # 0x16940
movzbl (%rcx,%rdx), %ecx
xorl %edx, %edx
testl %ecx, %ecx
pushq $0x21
popq %rdi
cmovnel %edx, %edi
cmovel %ebx, %ecx
movl %ecx, %ebx
jmp 0x139b2
leaq 0x3cdf(%rip), %rbx      # 0x17751
jmp 0x13a91
leaq 0x3cc5(%rip), %rbx      # 0x17740
jmp 0x13a91
leaq 0x3cc6(%rip), %rbx      # 0x1774a
jmp 0x13a91
incq %rbx
xorl %edi, %edi
callq *0x3884f(%rip)          # 0x4c2e0
movsbl (%rbx), %esi
testl %esi, %esi
jne 0x13a86
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movslq %ebx, %rax
leaq 0x2b67(%rip), %rcx      # 0x16610
movl -0x80(%rcx,%rax,4), %ebp
testl %ebp, %ebp
je 0x139ea
movl %ebp, %esi
sarl $0x8, %esi
movl $0x1013, %edi           # imm = 0x1013
callq *0x3881b(%rip)          # 0x4c2e0
andl $0xff, %ebp
je 0x13a98
movq 0x3880c(%rip), %rax     # 0x4c2e0
movl $0x1013, %edi           # imm = 0x1013
movl %ebp, %esi
jmp 0x139f3
movl %ebx, %eax
andl $0xff000000, %eax       # imm = 0xFF000000
xorl $0x1000000, %eax        # imm = 0x1000000
orl %edi, %eax
jne 0x139ea
movl %ebx, %esi
andl $0xffffff, %esi         # imm = 0xFFFFFF
leal -0x3099(%rsi), %eax
cmpl $0x1, %eax
ja 0x139ea
movq 0x387ce(%rip), %rax     # 0x4c2e0
addl $0xffffcfc5, %esi       # imm = 0xFFFFCFC5
movl $0x1013, %edi           # imm = 0x1013
jmp 0x139f3
cmpb $0x1, 0x38883(%rip)     # 0x4c3ac
jne 0x13b3c
leaq 0x2d7e(%rip), %rcx      # 0x168b0
cmpb $0x0, (%rax,%rcx)
jne 0x13956
addl %ebx, %ebx
movq 0x3879b(%rip), %rcx     # 0x4c2e0
leaq 0x2a34(%rip), %rdx      # 0x16580
movzbl (%rax,%rdx), %edi
addl $-0x3f, %ebx
movslq %ebx, %rax
movzbl (%rax,%rdx), %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rcx
pushq $0x20
popq %rbx
jmp 0x139b2
pushq $0x21
popq %rdi
jmp 0x139b2
cmpl $0x3c, %ebx
je 0x13bcc
cmpl $0x57, %ebx
je 0x13bc5
cmpl $0x56, %ebx
jne 0x139ea
movl $0xa2, %esi
jmp 0x13bd1
pushq $0x20
popq %rbx
xorl %edi, %edi
movl %ebx, %esi
callq *0x38747(%rip)          # 0x4c2e0
movq 0x38740(%rip), %rax     # 0x4c2e0
xorl %edi, %edi
movl %ebx, %esi
jmp 0x139f3
movl $0xde, %esi
jmp 0x13bd1
movl $0xa1, %esi
jmp 0x13bd1
movl $0xdf, %esi
jmp 0x13bd1
movl $0xa5, %esi
jmp 0x13bd1
movl $0xa3, %esi
jmp 0x13bd1
movl $0xb0, %esi
movq 0x38708(%rip), %rax     # 0x4c2e0
movl $0x1013, %edi           # imm = 0x1013
jmp 0x139f3