// File: /workspace/github_c_makefile_star2_O0/nurse[P]nkf/nkf.c
// Function: w16e_conv
static nkf_char
w16e_conv(nkf_char val, nkf_char *p2, nkf_char *p1)
{
    nkf_char c1, c2, c3, c4;
    nkf_char ret = 0;
    val &= VALUE_MASK;
    if (val < 0x80) {
	*p2 = 0;
	*p1 = val;
    }
    else if (nkf_char_unicode_bmp_p(val)){
	nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4);
	ret =  unicode_to_jis_common(c1, c2, c3, p2, p1);
	if (ret > 0){
	    *p2 = 0;
	    *p1 = nkf_char_unicode_new(val);
	    ret = 0;
	}
    }
    else {
	int i;
	if (x0213_f) {
	    c1 = (val >> 10) + NKF_INT32_C(0xD7C0);   /* high surrogate */
	    c2 = (val & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */
	    for (i = 0; i < sizeof_x0213_1_surrogate_table; i++)
		if (x0213_1_surrogate_table[i][1] == c1 && x0213_1_surrogate_table[i][2] == c2) {
		    val = x0213_1_surrogate_table[i][0];
		    *p2 = val >> 8;
		    *p1 = val & 0xFF;
		    return 0;
		}
	    for (i = 0; i < sizeof_x0213_2_surrogate_table; i++)
		if (x0213_2_surrogate_table[i][1] == c1 && x0213_2_surrogate_table[i][2] == c2) {
		    val = x0213_2_surrogate_table[i][0];
		    *p2 = PREFIX_EUCG3 | (val >> 8);
		    *p1 = val & 0xFF;
		    return 0;
		}
	}
	*p2 = 0;
	*p1 = nkf_char_unicode_new(val);
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x8(%rbp), %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
movl %eax, -0x8(%rbp)
cmpl $0x80, -0x8(%rbp)
jge 0x13066
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl -0x8(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1324b
movl -0x8(%rbp), %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
cmpl $0xffff, %eax           # imm = 0xFFFF
jg 0x130d1
movl -0x8(%rbp), %edi
leaq -0x1c(%rbp), %rsi
leaq -0x20(%rbp), %rdx
leaq -0x24(%rbp), %rcx
leaq -0x28(%rbp), %r8
callq 0x133f0
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
callq 0x12890
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x130cc
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl -0x8(%rbp), %ecx
orl $0x1000000, %ecx        # imm = 0x1000000
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x2c(%rbp)
jmp 0x13249
cmpl $0x0, 0x3f344(%rip)     # 0x5241c
je 0x13230
movl -0x8(%rbp), %eax
sarl $0xa, %eax
addl $0xd7c0, %eax           # imm = 0xD7C0
movl %eax, -0x1c(%rbp)
movl -0x8(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
addl $0xdc00, %eax           # imm = 0xDC00
movl %eax, -0x20(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x1a, -0x30(%rbp)
jge 0x13192
movslq -0x30(%rbp), %rcx
leaq 0x14288(%rip), %rax     # 0x273a0
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movzwl 0x2(%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x13182
movslq -0x30(%rbp), %rcx
leaq 0x1426d(%rip), %rax     # 0x273a0
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0x13182
movslq -0x30(%rbp), %rcx
leaq 0x14252(%rip), %rax     # 0x273a0
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movzwl (%rax), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %ecx
sarl $0x8, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x8(%rbp), %ecx
andl $0xff, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x13251
jmp 0x13184
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x13103
movl $0x0, -0x30(%rbp)
cmpl $0x115, -0x30(%rbp)     # imm = 0x115
jge 0x1322e
movslq -0x30(%rbp), %rcx
leaq 0x1428f(%rip), %rax     # 0x27440
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movzwl 0x2(%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1321e
movslq -0x30(%rbp), %rcx
leaq 0x14274(%rip), %rax     # 0x27440
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0x1321e
movslq -0x30(%rbp), %rcx
leaq 0x14259(%rip), %rax     # 0x27440
imulq $0x6, %rcx, %rcx
addq %rcx, %rax
movzwl (%rax), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %ecx
sarl $0x8, %ecx
orl $0x8f00, %ecx           # imm = 0x8F00
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movl -0x8(%rbp), %ecx
andl $0xff, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x13251
jmp 0x13220
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x13199
jmp 0x13230
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movl -0x8(%rbp), %ecx
orl $0x1000000, %ecx        # imm = 0x1000000
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1324b
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)