// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x200, -0x24(%rbp)     # imm = 0x200
movq -0x10(%rbp), %rdi
callq 0x2480
movq -0x10(%rbp), %rdi
callq 0x10a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x22eb
movq $0x0, -0x8(%rbp)
jmp 0x2474
movslq -0x24(%rbp), %rdi
leaq 0x150c(%rip), %rsi      # 0x3802
callq 0x24e0
movq %rax, -0x20(%rbp)
cmpl $0x22, -0x14(%rbp)
je 0x2342
movq 0x3cec(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x14f7(%rip), %rsi      # 0x380d
movb $0x0, %al
callq 0x10c0
movq 0x3cd4(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x1509(%rip), %rsi      # 0x383a
movb $0x0, %al
callq 0x10c0
movl $0x4, %edi
callq 0x1170
movq -0x10(%rbp), %rdi
callq 0x10a0
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x22, -0x14(%rbp)
je 0x2460
cmpl $-0x1, -0x14(%rbp)
jne 0x239f
movq 0x3c8c(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1497(%rip), %rsi      # 0x380d
movb $0x0, %al
callq 0x10c0
movq 0x3c74(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x14c6(%rip), %rsi      # 0x3854
movb $0x0, %al
callq 0x10c0
movl $0x6, %edi
callq 0x1170
movl -0x18(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jle 0x23cd
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
leaq 0x143e(%rip), %rdx      # 0x3802
callq 0x2540
movq %rax, -0x20(%rbp)
cmpl $0x5c, -0x14(%rbp)
jne 0x2436
movq -0x10(%rbp), %rdi
callq 0x10a0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x241f
movq 0x3c0c(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1417(%rip), %rsi      # 0x380d
movb $0x0, %al
callq 0x10c0
movq 0x3bf4(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x145f(%rip), %rsi      # 0x386d
movb $0x0, %al
callq 0x10c0
movl $0x6, %edi
callq 0x1170
movl -0x14(%rbp), %edi
callq 0x25a0
movb %al, %dl
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x2446
movl -0x14(%rbp), %eax
movb %al, %dl
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10a0
movl %eax, -0x14(%rbp)
jmp 0x2355
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop