// File: /workspace/github_c_makefile_star2_O2/usgs[P]nshmp-haz-catalogs/src/agrid/adaptive/Parse_Text.c
// Function: Parse_Text
void Parse_Text(FILE *fp, const char *querystring, const char type,
              void* result){
    int32_t res = 0, found = 0;

    /* Start from the beginning */
    rewind(fp);

    /* Look for the string until found */
    while (!found) {
        char line[LINESIZE];
        char delimiters[] = " =\n\r";
        char *name, *value;

        /* Read in one line */
        if (fgets(line, LINESIZE, fp) == NULL)
            break;

        name = strtok(line, delimiters);
        if ((name != NULL) && (strcmp(name, querystring) == 0)) {
            found = 1;
            value = strtok(NULL, delimiters);

            switch (type) {
            case 'i':
                res = sscanf(value, "%d", (int *)result);
                break;
            case 'I':
                res = sscanf(value, "%d", (int32_t *)result);
                break;
            case 'f':
                res = sscanf(value, "%f", (float *)result);
                break;
            case 'd':
                res = sscanf(value, "%lf", (double *)result);
                break;
            case 's':
                res = 1;
                strcpy((char *)result, value);
                break;
            default:
                fprintf(stderr, "parsetext: unknown type %c\n", type);
                exit(1);
            }
        }

    }

    if (found == 0){
        fprintf(stderr,"\n !!! CANNOT FIND %s IN INPUT FILE\n", querystring);
        fprintf(stderr,"Using default value for calculation.\n");
    }
    if (res == -1){
        fprintf(stderr, "parsetext: unknown type %c\n", type);
        exit(1);
    }

    return ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rcx, 0x8(%rsp)
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r12
callq 0x1090
leaq 0x10(%rsp), %r13
leaq 0x2591(%rip), %rbp      # 0x7980
movsbl %bl, %ebx
xorl %r15d, %r15d
movl $0x0, 0x4(%rsp)
testl %r15d, %r15d
jne 0x54ef
movq %r13, %rdi
movl $0x200, %esi            # imm = 0x200
movq %r12, %rdx
callq 0x10d0
testq %rax, %rax
je 0x54bf
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1160
xorl %r15d, %r15d
testq %rax, %rax
je 0x53fd
movq %rax, %rdi
movq %r14, %rsi
callq 0x10e0
testl %eax, %eax
jne 0x53fd
xorl %edi, %edi
movq %rbp, %rsi
callq 0x1160
cmpl $0x49, %ebx
je 0x5468
cmpl $0x64, %ebx
je 0x5474
cmpl $0x66, %ebx
je 0x5480
cmpl $0x73, %ebx
je 0x54a3
cmpl $0x69, %ebx
jne 0x5508
movq %rax, %rdi
leaq 0xf17(%rip), %rsi       # 0x6389
jmp 0x548a
movq %rax, %rdi
leaq 0x2507(%rip), %rsi      # 0x7985
jmp 0x548a
movq %rax, %rdi
leaq 0x19b0(%rip), %rsi      # 0x6e3a
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x1110
movl %eax, 0x4(%rsp)
pushq $0x1
popq %r15
jmp 0x53fd
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1030
pushq $0x1
popq %rax
movl %eax, %r15d
movl %eax, 0x4(%rsp)
jmp 0x53fd
movq 0x4b32(%rip), %r15      # 0x9ff8
movq (%r15), %rdi
leaq 0x24d5(%rip), %rsi      # 0x79a5
movq %r14, %rdx
xorl %eax, %eax
callq 0x10f0
movq (%r15), %rcx
leaq 0x24e5(%rip), %rdi      # 0x79c9
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
callq 0x1190
cmpl $-0x1, 0x4(%rsp)
je 0x5508
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4ae9(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x2470(%rip), %rsi      # 0x7989
movl %ebx, %edx
xorl %eax, %eax
callq 0x10f0
pushq $0x1
popq %rdi
callq 0x1180