// File: /workspace/github_c_makefile_star2_O0/schroeder-lvb[P]sissm/src/piprotect.c
// Function: joinLimit
static int  _joinLimit( char *objName, char *mapName, char objLetter ) {
    int joinLimit = 99;    // returns default high limit if no match
    int i;
    char *w, numStr[16];

    // check if current map/side/objective is the final objective
    // if so return a non-zero value
    //
    for ( i=0; i<PIPROT_MAXLASTOBJTABLE; i++ ) {

        // if entry was not found, do not process
        // 
        if ( 0 == (int) strlen( piprotectConfig.joinLimit[i] ) ) break;

        // if the map name/side matches 
        //
        if ( 0 == strcasecmp( getWord( piprotectConfig.joinLimit[i], 0, " "), mapName )) { 

            // check if this objective is limited 
            //
            if ( NULL != ( w = getWord( piprotectConfig.joinLimit[i], 1, " ") )) {

                if ( objLetter == w[0] ) {  // case sensitive; lower = normal, upper = counterattack
                    //
                    // match found - extract the join limit
                    //
                    if ( NULL != (w = getWord ( piprotectConfig.joinLimit[i], 2, " ") )) {
                        strlcpy( numStr, w, 16 );
                        if ( 1 != sscanf( numStr, "%d", &joinLimit )) joinLimit = 99;
                    }
                }
            }
        }
    }
    return joinLimit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movl $0x63, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x78, -0x1c(%rbp)
jge 0x115dc
movslq -0x1c(%rbp), %rax
leaq 0x9b478(%rip), %rdi     # 0xac920
addq $0x414, %rdi            # imm = 0x414
shlq $0xa, %rax
addq %rax, %rdi
callq 0x8110
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x114c8
jmp 0x115dc
movslq -0x1c(%rbp), %rax
leaq 0x9b44d(%rip), %rdi     # 0xac920
addq $0x414, %rdi            # imm = 0x414
shlq $0xa, %rax
addq %rax, %rdi
xorl %esi, %esi
leaq 0x12c6e(%rip), %rdx     # 0x24158
callq 0x122d0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x8040
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x115cc
movslq -0x1c(%rbp), %rax
leaq 0x9b40e(%rip), %rdi     # 0xac920
addq $0x414, %rdi            # imm = 0x414
shlq $0xa, %rax
addq %rax, %rdi
movl $0x1, %esi
leaq 0x12c2c(%rip), %rdx     # 0x24158
callq 0x122d0
movq %rax, %rcx
movq %rcx, -0x28(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x115ca
movsbl -0x11(%rbp), %eax
movq -0x28(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x115c8
movslq -0x1c(%rbp), %rax
leaq 0x9b3c3(%rip), %rdi     # 0xac920
addq $0x414, %rdi            # imm = 0x414
shlq $0xa, %rax
addq %rax, %rdi
movl $0x2, %esi
leaq 0x12be1(%rip), %rdx     # 0x24158
callq 0x122d0
movq %rax, %rcx
movq %rcx, -0x28(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x115c6
leaq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x10, %edx
callq 0x11bc0
leaq -0x40(%rbp), %rdi
leaq 0x12b28(%rip), %rsi     # 0x240cf
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x82c0
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
je 0x115c4
movl $0x63, -0x18(%rbp)
jmp 0x115c6
jmp 0x115c8
jmp 0x115ca
jmp 0x115cc
jmp 0x115ce
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x11493
movl -0x18(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)