// File: /workspace/github_c_makefile_star2_O0/schroeder-lvb[P]sissm/src/picladmin.c
// Function: reason
static char *_reason( char *rawLine )
{
    char *p1 = NULL, *p3 = NULL;
    int   i, spaceCount = 0;
    static char outReason[ 256 ];

    // Parse and look for "reason" string from what was typed by 
    // admin at console.  
    //
    p3 = & rawLine[ strlen( rawLine ) ];
    for (i=0; i< (int) strlen( rawLine ); i++) {
        if ( rawLine[i] == ' ' ) spaceCount++;
        if ( spaceCount == 2 ) {
            p3 = & rawLine[ i+1 ];
            break;
        }
    }
    strlcpy( outReason, p3, 256 );

    // if the 'reason' was one of shortcut preset 'canned' reasons
    // e.g., 'rush', 'afk', 'tk', etc.  then replace it with the 
    // longer explanation.
    //
    for ( i=0; i<NUM_REASONS; i++ ) {
        p1 = getWord( picladminConfig.reason[i], 0, "\007" ) ;
        if ( p1 != NULL ) { 
            if ( 0 == strcmp( p1, p3 ) ) {  // replace if exact match to preset reasons
                strlcpy( outReason, getWord( picladminConfig.reason[i], 1, "\007" ), 256);
                break;
            }
        }
    }

    // replace double quotes with a single quote
    //
    for ( i=0; i< (int) strlen(outReason); i++ ) {
        if ( outReason[i] == 0x22 ) outReason[i] = 0x27;
    }

    return( outReason );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8110
movq %rax, %rcx
movq -0x28(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8110
movq %rax, %rcx
movl -0x2c(%rbp), %eax
cmpl %ecx, %eax
jge 0xb8c5
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0xb89c
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jne 0xb8b8
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0xb8c5
jmp 0xb8ba
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb869
movq -0x18(%rbp), %rsi
leaq 0x5a6a0(%rip), %rdi     # 0x65f70
movl $0x100, %edx            # imm = 0x100
callq 0x11bc0
movl $0x0, -0x1c(%rbp)
cmpl $0x9, -0x1c(%rbp)
jge 0xb984
movslq -0x1c(%rbp), %rax
leaq 0x3104a(%rip), %rdi     # 0x3c940
addq $0x25410, %rdi          # imm = 0x25410
shlq $0xa, %rax
addq %rax, %rdi
xorl %esi, %esi
leaq 0x17e03(%rip), %rdx     # 0x23710
callq 0x122d0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xb974
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x8200
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xb972
movslq -0x1c(%rbp), %rax
leaq 0x31003(%rip), %rdi     # 0x3c940
addq $0x25410, %rdi          # imm = 0x25410
shlq $0xa, %rax
addq %rax, %rdi
movl $0x1, %esi
leaq 0x17db9(%rip), %rdx     # 0x23710
callq 0x122d0
movq %rax, %rsi
leaq 0x5a60a(%rip), %rdi     # 0x65f70
movl $0x100, %edx            # imm = 0x100
callq 0x11bc0
jmp 0xb984
jmp 0xb974
jmp 0xb976
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb8e1
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
leaq 0x5a5d8(%rip), %rdi     # 0x65f70
callq 0x8110
movq %rax, %rcx
movl -0x30(%rbp), %eax
cmpl %ecx, %eax
jge 0xb9d7
movslq -0x1c(%rbp), %rcx
leaq 0x5a5be(%rip), %rax     # 0x65f70
movsbl (%rax,%rcx), %eax
cmpl $0x22, %eax
jne 0xb9ca
movslq -0x1c(%rbp), %rcx
leaq 0x5a5aa(%rip), %rax     # 0x65f70
movb $0x27, (%rax,%rcx)
jmp 0xb9cc
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb98b
leaq 0x5a592(%rip), %rax     # 0x65f70
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)