// File: Alcaro[P]bridges/arlib/string.cpp
// Function: string::icompare3(cstring, cstring)
int string::icompare3(cstring a, cstring b)
{
	int ret_i = a.length() - b.length();
	
	size_t cmplen = min(a.length(), b.length());
	const uint8_t* ab = a.bytes().ptr();
	const uint8_t* bb = b.bytes().ptr();
	for (size_t n=0; n<cmplen; n++)
	{
		if (ab[n] != bb[n])
		{
			if (ret_i == 0) ret_i = ab[n] - bb[n];
			
			uint8_t ac = toupper(ab[n]);
			uint8_t bc = toupper(bb[n]);
			if (ac != bc) return ac - bc;
		}
	}
	
	return ret_i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x130(%rbp)
movq %rsi, -0x128(%rbp)
movq %rdx, -0x140(%rbp)
movq %rcx, -0x138(%rbp)
leaq -0x130(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x198(%rbp)
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x3bd83
movq -0x198(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
xorl $0xf, %eax
movzbl %al, %eax
movl %eax, -0xc4(%rbp)
jmp 0x3bd93
movq -0x198(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0x1a4(%rbp)
leaq -0x140(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x3bdfb
movq -0x1a0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
xorl $0xf, %eax
movzbl %al, %eax
movl %eax, -0xdc(%rbp)
jmp 0x3be0b
movq -0x1a0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xdc(%rbp)
movl -0x1a4(%rbp), %eax
subl -0xdc(%rbp), %eax
movl %eax, -0x144(%rbp)
leaq -0x130(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x3be79
movq -0x1b0(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
xorl $0xf, %eax
movzbl %al, %eax
movl %eax, -0xf4(%rbp)
jmp 0x3be89
movq -0x1b0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0x1bc(%rbp)
leaq -0x140(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x3bef1
movq -0x1b8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
xorl $0xf, %eax
movzbl %al, %eax
movl %eax, -0x10c(%rbp)
jmp 0x3bf01
movq -0x1b8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x10c(%rbp)
movl -0x1bc(%rbp), %edi
movl -0x10c(%rbp), %esi
callq 0x3bcc0
movl %eax, %eax
movq %rax, -0x150(%rbp)
leaq -0x130(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
leaq -0x88(%rbp), %rcx
movq %rcx, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x3bf8d
movq -0x1c8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5cc0
movq -0x1c8(%rbp), %rsi
movsbl %al, %eax
xorl $0xf, %eax
movzbl %al, %eax
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x5ed0
jmp 0x3bfa8
movq -0x1c8(%rbp), %rax
movq (%rax), %rsi
movl 0x8(%rax), %eax
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x5ed0
movups -0x88(%rbp), %xmm0
movaps %xmm0, -0x70(%rbp)
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x168(%rbp)
movq %rax, -0x160(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x62c0
movq %rax, -0x158(%rbp)
leaq -0x140(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
leaq -0xb8(%rbp), %rcx
movq %rcx, -0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5cc0
movsbl %al, %eax
cmpl $0x0, %eax
jl 0x3c054
movq -0x1d0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5cc0
movq -0x1d0(%rbp), %rsi
movsbl %al, %eax
xorl $0xf, %eax
movzbl %al, %eax
movl %eax, %edx
leaq -0xb8(%rbp), %rdi
callq 0x5ed0
jmp 0x3c06f
movq -0x1d0(%rbp), %rax
movq (%rax), %rsi
movl 0x8(%rax), %eax
movl %eax, %edx
leaq -0xb8(%rbp), %rdi
callq 0x5ed0
movups -0xb8(%rbp), %xmm0
movaps %xmm0, -0xa0(%rbp)
movq -0xa0(%rbp), %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x180(%rbp)
movq %rax, -0x178(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x62c0
movq %rax, -0x170(%rbp)
movq $0x0, -0x188(%rbp)
movq -0x188(%rbp), %rax
cmpq -0x150(%rbp), %rax
jae 0x3c1ab
movq -0x158(%rbp), %rax
movq -0x188(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x170(%rbp), %rcx
movq -0x188(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x3c192
cmpl $0x0, -0x144(%rbp)
jne 0x3c12c
movq -0x158(%rbp), %rax
movq -0x188(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x170(%rbp), %rcx
movq -0x188(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x144(%rbp)
movq -0x158(%rbp), %rax
movq -0x188(%rbp), %rcx
movzbl (%rax,%rcx), %edi
callq 0x3c1d0
movb %al, -0x189(%rbp)
movq -0x170(%rbp), %rax
movq -0x188(%rbp), %rcx
movzbl (%rax,%rcx), %edi
callq 0x3c1d0
movb %al, -0x18a(%rbp)
movzbl -0x189(%rbp), %eax
movzbl -0x18a(%rbp), %ecx
cmpl %ecx, %eax
je 0x3c190
movzbl -0x189(%rbp), %eax
movzbl -0x18a(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x11c(%rbp)
jmp 0x3c1b7
jmp 0x3c192
jmp 0x3c194
movq -0x188(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x188(%rbp)
jmp 0x3c0b7
movl -0x144(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)