// File: /workspace/github_c_makefile_star2_O0/stanfordnlp[P]GloVe/src/common.c
// Function: get_word
int get_word(char *word, FILE *fin) {
    int i = 0, ch;
    for ( ; ; ) {
        ch = fgetc(fin);
        if (ch == '\r') continue;
        if (i == 0 && ((ch == '\n') || (ch == EOF))) {
            word[i] = 0;
            return 1;
        }
        if (i == 0 && ((ch == ' ') || (ch == '\t'))) continue; // skip leading space
        if ((ch == EOF) || (ch == ' ') || (ch == '\t') || (ch == '\n')) {
            if (ch == '\n') ungetc(ch, fin); // return the newline next time as document ender
            break;
        }
        if (i < MAX_STRING_LENGTH - 1)
          word[i++] = ch; // don't allow words to exceed MAX_STRING_LENGTH
    }
    word[i] = 0; //null terminate
    // avoid truncation destroying a multibyte UTF-8 char except if only thing on line (so the i > x tests won't overwrite word[0])
    // see https://en.wikipedia.org/wiki/UTF-8#Description
    if (i == MAX_STRING_LENGTH - 1 && (word[i-1] & 0x80) == 0x80) {
        if ((word[i-1] & 0xC0) == 0xC0) {
            word[i-1] = '\0';
        } else if (i > 2 && (word[i-2] & 0xE0) == 0xE0) {
            word[i-2] = '\0';
        } else if (i > 3 && (word[i-3] & 0xF8) == 0xF0) {
            word[i-3] = '\0';
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x10f0
movl %eax, -0x20(%rbp)
cmpl $0xd, -0x20(%rbp)
jne 0x3e2b
jmp 0x3e17
cmpl $0x0, -0x1c(%rbp)
jne 0x3e55
cmpl $0xa, -0x20(%rbp)
je 0x3e3d
cmpl $-0x1, -0x20(%rbp)
jne 0x3e55
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl $0x1, -0x4(%rbp)
jmp 0x3f9e
cmpl $0x0, -0x1c(%rbp)
jne 0x3e69
cmpl $0x20, -0x20(%rbp)
je 0x3e67
cmpl $0x9, -0x20(%rbp)
jne 0x3e69
jmp 0x3e17
cmpl $-0x1, -0x20(%rbp)
je 0x3e81
cmpl $0x20, -0x20(%rbp)
je 0x3e81
cmpl $0x9, -0x20(%rbp)
je 0x3e81
cmpl $0xa, -0x20(%rbp)
jne 0x3e95
cmpl $0xa, -0x20(%rbp)
jne 0x3e93
movl -0x20(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x1190
jmp 0x3ebd
cmpl $0x3e7, -0x1c(%rbp)     # imm = 0x3E7
jge 0x3eb8
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x3e17
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x3e7, -0x1c(%rbp)     # imm = 0x3E7
jne 0x3f97
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
andl $0x80, %eax
cmpl $0x80, %eax
jne 0x3f97
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
andl $0xc0, %eax
cmpl $0xc0, %eax
jne 0x3f27
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x3f95
cmpl $0x2, -0x1c(%rbp)
jle 0x3f5d
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
andl $0xe0, %eax
cmpl $0xe0, %eax
jne 0x3f5d
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x3f93
cmpl $0x3, -0x1c(%rbp)
jle 0x3f91
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x3, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
andl $0xf8, %eax
cmpl $0xf0, %eax
jne 0x3f91
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x3, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x3f93
jmp 0x3f95
jmp 0x3f97
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)