// File: /workspace/github_c_makefile_star2_O3/nurse[P]nkf/nkf.c
// Function: nfc_getc
static nkf_char
nfc_getc(FILE *f)
{
    nkf_char (*g)(FILE *f) = i_nfc_getc;
    nkf_char (*u)(nkf_char c ,FILE *f) = i_nfc_ungetc;
    nkf_buf_t *buf = nkf_state->nfc_buf;
    const unsigned char *array;
    int lower=0, upper=NORMALIZATION_TABLE_LENGTH-1;
    nkf_char c = (*g)(f);

    if (c == EOF || c > 0xFF || (c & 0xc0) == 0x80) return c;

    nkf_buf_push(buf, c);
    do {
	while (lower <= upper) {
	    int mid = (lower+upper) / 2;
	    int len;
	    array = normalization_table[mid].nfd;
	    for (len=0; len < NORMALIZATION_TABLE_NFD_LENGTH && array[len]; len++) {
		if (len >= nkf_buf_length(buf)) {
		    c = (*g)(f);
		    if (c == EOF) {
			len = 0;
			lower = 1, upper = 0;
			break;
		    }
		    nkf_buf_push(buf, c);
		}
		if (array[len] != nkf_buf_at(buf, len)) {
		    if (array[len] < nkf_buf_at(buf, len)) lower = mid + 1;
		    else  upper = mid - 1;
		    len = 0;
		    break;
		}
	    }
	    if (len > 0) {
		int i;
		array = normalization_table[mid].nfc;
		nkf_buf_clear(buf);
		for (i=0; i < NORMALIZATION_TABLE_NFC_LENGTH && array[i]; i++)
		    nkf_buf_push(buf, array[i]);
		break;
	    }
	}
    } while (lower <= upper);

    while (nkf_buf_length(buf) > 1) (*u)(nkf_buf_pop(buf), f);
    c = nkf_buf_pop(buf);

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x38e76(%rip), %rcx     # 0x4d390
movq 0x38e77(%rip), %r15     # 0x4d398
movq 0x41010(%rip), %rax     # 0x55538
movq 0x20(%rax), %r14
movq %rcx, 0x20(%rsp)
callq *%rcx
cmpl $-0x1, %eax
sete %cl
cmpl $0x100, %eax            # imm = 0x100
setge %dl
movl %eax, %esi
andl $0xc0, %esi
cmpl $0x80, %esi
sete %sil
orb %cl, %dl
orb %sil, %dl
je 0x14569
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x18(%rsp)
movq 0x8(%r14), %rcx
cmpq %rcx, (%r14)
jle 0x146d9
movq 0x10(%r14), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x8(%r14)
movl %eax, (%rdx,%rcx,4)
movl $0x3ad, %edx            # imm = 0x3AD
xorl %ecx, %ecx
movq %rcx, %rax
movq %rdx, %rbp
cmpl %ebp, %eax
jg 0x14692
movq %rax, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
addl %ebp, %eax
movl %eax, %ebp
shrl $0x1f, %ebp
addl %eax, %ebp
sarl %ebp
movslq %ebp, %rax
leaq (%rax,%rax,2), %r15
shlq $0x2, %r15
addq 0x389da(%rip), %r15     # 0x4cfa0
xorl %r13d, %r13d
movzbl 0x3(%r15,%r13), %r12d
testl %r12d, %r12d
je 0x1462a
movq 0x8(%r14), %rcx
cmpq %r13, %rcx
jg 0x14609
movq %rbx, %rdi
callq *0x20(%rsp)
cmpl $-0x1, %eax
je 0x146a0
movq 0x8(%r14), %rdx
cmpq %rdx, (%r14)
jle 0x146d9
movq 0x10(%r14), %rsi
leaq 0x1(%rdx), %rcx
movq %rcx, 0x8(%r14)
movl %eax, (%rsi,%rdx,4)
cmpq %r13, %rcx
jl 0x146e3
movq 0x10(%r14), %rax
movl (%rax,%r13,4), %eax
cmpl %r12d, %eax
jne 0x1463e
incq %r13
cmpq $0x9, %r13
jne 0x145c9
jmp 0x14658
testq %r13, %r13
jne 0x14658
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rbp
jmp 0x14597
leal 0x1(%rbp), %ecx
decl %ebp
cmpl %r12d, %eax
movq 0x10(%rsp), %rax
cmovgl %ecx, %eax
cmovgl 0x8(%rsp), %ebp
jmp 0x14597
movq $0x0, 0x8(%r14)
xorl %eax, %eax
movzbl (%r15,%rax), %ecx
testl %ecx, %ecx
je 0x14688
cmpq %rax, (%r14)
jle 0x146d9
movq 0x10(%r14), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x8(%r14)
movl %ecx, (%rdx,%rax,4)
movq %rsi, %rax
cmpq $0x3, %rsi
jne 0x14662
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rbp
movq %rax, %rcx
movq %rbp, %rdx
cmpl %ebp, %eax
jle 0x14591
cmpq $0x2, 0x8(%r14)
movq 0x18(%rsp), %r15
jl 0x146c3
movq %r14, %rdi
callq 0x126bd
movl %eax, %edi
movq %rbx, %rsi
callq *%r15
cmpq $0x1, 0x8(%r14)
jg 0x146ac
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x126bd
movl $0x1, %edi
callq 0xc240
leaq 0x406d(%rip), %rdi      # 0x18757
leaq 0x3f9b(%rip), %rsi      # 0x1868c
leaq 0x4071(%rip), %rcx      # 0x18769
movl $0x361, %edx            # imm = 0x361
callq 0xc0f0