// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq 0x3ae1d(%rip), %rax     # 0x52380
movq %rax, -0x18(%rbp)
movq 0x3ae1a(%rip), %rax     # 0x52388
movq %rax, -0x20(%rbp)
movq 0x4301f(%rip), %rax     # 0x5a598
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x3ad, -0x38(%rbp)     # imm = 0x3AD
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movl %eax, -0x3c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
je 0x175ba
cmpl $0xff, -0x3c(%rbp)
jg 0x175ba
movl -0x3c(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x175c5
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x177c1
movq -0x28(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x149b0
jmp 0x175d3
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jg 0x17775
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x40(%rbp)
movslq -0x40(%rbp), %rcx
leaq 0x10d45(%rip), %rax     # 0x28340
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
addq $0x3, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
xorl %eax, %eax
cmpl $0x9, -0x44(%rbp)
movb %al, -0x49(%rbp)
jge 0x17631
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x1763d
jmp 0x176f9
movslq -0x44(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jl 0x17684
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movl %eax, -0x3c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
jne 0x17678
movl $0x0, -0x44(%rbp)
movl $0x1, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
jmp 0x176f9
movq -0x28(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x149b0
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x18f50
movl %eax, %ecx
movl -0x50(%rbp), %eax
cmpl %ecx, %eax
je 0x176e9
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x18f50
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
jge 0x176d7
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x176e0
movl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
jmp 0x176f9
jmp 0x176eb
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x17611
cmpl $0x0, -0x44(%rbp)
jle 0x17770
movslq -0x40(%rbp), %rcx
leaq 0x10c36(%rip), %rax     # 0x28340
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x13e40
movl $0x0, -0x48(%rbp)
xorl %eax, %eax
cmpl $0x3, -0x48(%rbp)
movb %al, -0x55(%rbp)
jge 0x17745
movq -0x30(%rbp), %rax
movslq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x1774e
jmp 0x1776e
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %esi
callq 0x149b0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x17725
jmp 0x17775
jmp 0x175d3
jmp 0x17777
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jle 0x175d1
jmp 0x17785
movq -0x28(%rbp), %rax
cmpq $0x1, 0x8(%rax)
jle 0x177af
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0x14950
movl %eax, %edi
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rsi
callq *%rax
jmp 0x17785
movq -0x28(%rbp), %rdi
callq 0x14950
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)