// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1090
cmpl $0x0, -0x28(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x6e35
jmp 0x6fbd
movl 0x2bd9(%rip), %eax      # 0x9a14
movl %eax, -0x235(%rbp)
movb 0x2bd1(%rip), %al       # 0x9a18
movb %al, -0x231(%rbp)
leaq -0x230(%rbp), %rdi
movq -0x8(%rbp), %rdx
movl $0x200, %esi            # imm = 0x200
callq 0x10c0
cmpq $0x0, %rax
jne 0x6e6d
jmp 0x6fbd
leaq -0x230(%rbp), %rdi
leaq -0x235(%rbp), %rsi
callq 0x1140
movq %rax, -0x240(%rbp)
cmpq $0x0, -0x240(%rbp)
je 0x6fb8
movq -0x240(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0x6fb8
movl $0x1, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq -0x235(%rbp), %rsi
callq 0x1140
movq %rax, -0x248(%rbp)
movsbl -0x11(%rbp), %eax
addl $-0x49, %eax
movl %eax, %ecx
movq %rcx, -0x250(%rbp)
subl $0x2a, %eax
ja 0x6f90
movq -0x250(%rbp), %rax
leaq 0x2a75(%rip), %rcx      # 0x9968
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x248(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1467(%rip), %rsi      # 0x8375
movb $0x0, %al
callq 0x1100
movl %eax, -0x24(%rbp)
jmp 0x6fb6
movq -0x248(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1446(%rip), %rsi      # 0x8375
movb $0x0, %al
callq 0x1100
movl %eax, -0x24(%rbp)
jmp 0x6fb6
movq -0x248(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1ed9(%rip), %rsi      # 0x8e26
movb $0x0, %al
callq 0x1100
movl %eax, -0x24(%rbp)
jmp 0x6fb6
movq -0x248(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2aae(%rip), %rsi      # 0x9a19
movb $0x0, %al
callq 0x1100
movl %eax, -0x24(%rbp)
jmp 0x6fb6
movl $0x1, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movq -0x248(%rbp), %rsi
callq 0x1030
jmp 0x6fb6
movq 0x5061(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movsbl -0x11(%rbp), %edx
leaq 0x2a78(%rip), %rsi      # 0x9a1d
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
jmp 0x6fb8
jmp 0x6e23
cmpl $0x0, -0x28(%rbp)
jne 0x6ff7
movq 0x502e(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x2a61(%rip), %rsi      # 0x9a39
movb $0x0, %al
callq 0x10e0
movq 0x5012(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x2a6d(%rip), %rsi      # 0x9a5d
movb $0x0, %al
callq 0x10e0
cmpl $-0x1, -0x24(%rbp)
jne 0x7023
movq 0x4ff4(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movsbl -0x11(%rbp), %edx
leaq 0x2a0b(%rip), %rsi      # 0x9a1d
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq