// File: brunokeymolen[P]ssdp/src/tools.cpp
// Function: caseinstringcmp(unsigned char*, unsigned int, unsigned char*, unsigned int)
int caseinstringcmp(u8* string1, u32 len1, u8* string2, u32 len2){
    u8 ret = 0;

    if(len1 == len2){
        for(int tel=0;tel<(int)len1;tel++){
            if( (string1[tel] >= 'A' && string1[tel]<='Z') || (string1[tel] >= 'a' && string1[tel]<='z') ){
                if( (string1[tel] == string2[tel]) || (string1[tel]+32 == string2[tel]) || (string1[tel]-32 == string2[tel]) ){
                    //equal
                }else{
                    if(string1[tel] > string2[tel]){
                        ret = 1;
                    }else if(string1[tel] < string2[tel]){
                        ret = -1;
                    }
                }
            }else{
                if(string1[tel] > string2[tel]){
                    ret = 1;
                }else if(string1[tel] < string2[tel]){
                    ret = -1;
                }
            }
            if(ret != 0){
                break;
            }
        }
    }else{
        ret = -1;
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x3b38
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x3b36
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x41, %eax
jl 0x3a07
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x5a, %eax
jle 0x3a31
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x61, %eax
jl 0x3ad5
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x7a, %eax
jg 0x3ad5
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x3a8b
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl $0x20, %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x3a8b
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
subl $0x20, %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x3a8d
jmp 0x3ad3
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jle 0x3aaf
movb $0x1, -0x1d(%rbp)
jmp 0x3ad1
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x3acf
movb $-0x1, -0x1d(%rbp)
jmp 0x3ad1
jmp 0x3ad3
jmp 0x3b1b
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jle 0x3af7
movb $0x1, -0x1d(%rbp)
jmp 0x3b19
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x3b17
movb $-0x1, -0x1d(%rbp)
jmp 0x3b19
jmp 0x3b1b
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
je 0x3b26
jmp 0x3b36
jmp 0x3b28
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x39d9
jmp 0x3b3c
movb $-0x1, -0x1d(%rbp)
movzbl -0x1d(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)