// File: /workspace/github_c_makefile_star2_O2/pipde[P]deos-songlib/utils/phrases/scanner.c
// Function: readString
char *
readString(FILE *fp)
    {
    int ch,index;
    char *buffer;
    int size = 512;

    /* advance to the double quote */

    skipWhiteSpace(fp);

    ch = fgetc(fp);
    if (ch == EOF) return 0;

    /* allocate the buffer */

    buffer = allocateMsg(size,"readString");

    if (ch != '\"')
        {
        fprintf(stderr,"SCAN ERROR: attempt to read a string failed\n");
        fprintf(stderr,"first character was <%c>\n",ch);
        exit(4);
        }

    /* toss the double quote, skip to the next character */

    ch = fgetc(fp);

    /* initialize the buffer index */

    index = 0;

    /* collect characters until the closing double quote */

    while (ch != '\"')
        {
        if (ch == EOF)
            {
            fprintf(stderr,"SCAN ERROR: attempt to read a string failed\n");
            fprintf(stderr,"no closing double quote\n");
            exit(6);
            }
        if (index > size - 2) 
            {
            ++size;
            buffer = reallocateMsg(buffer,size,"readString");
            }

        if (ch == '\\')
            {
            ch = fgetc(fp);
            if (ch == EOF)
                {
                fprintf(stderr,"SCAN ERROR: attempt to read a string failed\n");
                fprintf(stderr,"escaped character missing\n");
                exit(6);
                }
            buffer[index] = convertEscapedChar(ch);
            }
        else
            buffer[index] = ch;
        ++index;
        ch = fgetc(fp);
        }

    buffer[index] = '\0';

    return buffer;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x201e
movq %rbx, %rdi
callq 0x10b0
cmpl $-0x1, %eax
je 0x1f6c
movl %eax, %r15d
leaq 0x18e1(%rip), %rsi      # 0x379a
movl $0x200, %edi            # imm = 0x200
callq 0x2059
cmpl $0x22, %r15d
jne 0x1fea
movq %rax, %r14
movl $0x200, %r15d           # imm = 0x200
xorl %r13d, %r13d
movq %rbx, %rdi
callq 0x10b0
cmpl $0x22, %eax
je 0x1f62
movl %eax, %r12d
cmpl $-0x1, %eax
je 0x1f81
leal -0x2(%r15), %eax
cltq
cmpq %rax, %r13
jle 0x1f15
incl %r15d
movslq %r15d, %rsi
movq %r14, %rdi
leaq 0x188d(%rip), %rdx      # 0x379a
callq 0x2096
movq %rax, %r14
cmpl $0x5c, %r12d
jne 0x1f56
movq %rbx, %rdi
callq 0x10b0
cmpl $0x22, %eax
je 0x1f49
movl %eax, %r12d
cmpl $0x5c, %eax
je 0x1f44
cmpl $0x6e, %r12d
je 0x1f4e
cmpl $0x74, %r12d
je 0x1f53
cmpl $-0x1, %r12d
jne 0x1f56
jmp 0x1fbd
movb $0x5c, %r12b
jmp 0x1f56
movb $0x22, %r12b
jmp 0x1f56
movb $0xa, %r12b
jmp 0x1f56
movb $0x9, %r12b
movb %r12b, (%r14,%r13)
incq %r13
jmp 0x1ed9
movl %r13d, %eax
movb $0x0, (%r14,%rax)
jmp 0x1f6f
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4070(%rip), %r14      # 0x5ff8
movq (%r14), %rcx
leaq 0x1813(%rip), %rdi      # 0x37a5
pushq $0x2c
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11a0
movq (%r14), %rcx
leaq 0x1842(%rip), %rdi      # 0x37ec
pushq $0x18
popq %rsi
movq %rbx, %rdx
callq 0x11a0
pushq $0x6
popq %rdi
callq 0x1190
movq 0x4034(%rip), %r14      # 0x5ff8
movq (%r14), %rcx
leaq 0x17d7(%rip), %rdi      # 0x37a5
pushq $0x2c
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11a0
movq (%r14), %rcx
leaq 0x181f(%rip), %rdi      # 0x3805
pushq $0x1a
jmp 0x1fac
movq 0x4007(%rip), %rbx      # 0x5ff8
movq (%rbx), %rcx
leaq 0x17aa(%rip), %rdi      # 0x37a5
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x11a0
movq (%rbx), %rdi
leaq 0x17c2(%rip), %rsi      # 0x37d2
movl %r15d, %edx
xorl %eax, %eax
callq 0x10e0
pushq $0x4
jmp 0x1fb7