Function at 0x4be5a0
Capabilities:
Authenticate hmac
Encode data using xor

Disassembly:
sub esp, 0x224
mov eax, dword [0x59a024]
xor eax, esp
mov dword [esp + 0x220], eax
mov eax, dword [esp + 0x228]
push ebx
mov dword [esp + 0x50], eax
mov eax, dword [esp + 0x238]
mov dword [esp + 0x48], ecx
mov ecx, dword [esp + 0x240]
push ebp
mov dword [esp + 0x40], edx
mov edx, dword [edi + 4]
push esi
mov dword [esp + 0x30], eax
mov dword [esp + 0x28], ecx
call edx
mov esi, dword [edi + 0x1c]
xor ecx, ecx
cmp esi, 0x40
setne cl
xor edx, edx
cmp dword [edi + 0x20], 2
mov ebx, eax
mov eax, dword [edi]
sete dl
mov dword [esp + 0x2c], eax
lea ecx, [ecx*8 + 8]
mov ebp, ecx
xor ecx, ecx
cmp byte [esp + 0x254], cl
mov dword [esp + 0x34], ebp
sete cl
sub ebp, eax
lea edx, [edx*8 + 0x28]
mov dword [esp + 0x4c], edx
mov edx, dword [esp + 0x250]
add ebp, esi
mov dword [esp + 0x38], ebx
lea ecx, [ecx*4 + 2]
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0x244]
add ebp, ecx
lea eax, [edx + ebp - 1]
xor edx, edx
div esi
sub ecx, dword [esp + 0x2c]
xor edx, edx
add ecx, dword [esp + 0x24c]
mov ebp, eax
mov eax, ecx
div esi
mov dword [esp + 0x40], eax
mov eax, dword [esp + 0x34]
mov dword [esp + 0x48], edx
xor edx, edx
add eax, ecx
div esi
xor edx, edx
mov dword [esp + 0x3c], eax
xor eax, eax
cmp byte [esp + 0x254], al
mov dword [esp + 0x24], eax
setne dl
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x20]
add edx, eax
cmp ebp, edx
jbe 0x4be6a8
sub ebp, eax
mov eax, ebp
mov dword [esp + 0x24], eax
imul eax, esi
mov dword [esp + 0x14], eax
mov eax, dword [edi + 0x10]
lea ebp, [ecx*8]
push ebx
mov dword [esp + 0x10], ebp
call eax
add esp, 4
cmp byte [esp + 0x254], 0
jne 0x4be719
push esi
lea edx, [esp + 0x70]
lea ecx, [ebp + esi*8]
push 0
push edx
mov dword [esp + 0x18], ecx
call fcn.00412eb0
mov eax, dword [esp + 0x248]
mov ecx, dword [esp + 0x50]
push eax
push ecx
lea edx, [esp + 0x80]
push edx
call fcn.0040dc50
add esp, 0x18
xor eax, eax
test esi, esi
jbe 0x4be70a
mov edi, edi
xor byte [esp + eax + 0x6c], 0x36
inc eax
cmp eax, esi
jb 0x4be700
mov ecx, dword [edi + 0x14]
push esi
lea eax, [esp + 0x70]
push eax
push ebx
call ecx
add esp, 0xc
xor eax, eax
xor ecx, ecx
cmp dword [esp + 0x34], 0x10
mov dword [esp + 0x5c], eax
mov dword [esp + 0x60], eax
mov dword [esp + 0x64], eax
mov dword [esp + 0x68], eax
jne 0x4be737
lea ecx, [eax + 8]
xor ebp, ebp
cmp dword [edi + 0x20], 2
jne 0x4be759
lea eax, [esp + ecx + 0x5c]
mov edx, dword [esp + 0xc]
mov ecx, ebp
shr edx, cl
add ebp, 8
inc eax
mov byte [eax - 1], dl
cmp ebp, 0x20
jb 0x4be743
jmp 0x4be77d
lea eax, [esp + ecx + 0x60]
lea ecx, [ecx]
mov edx, dword [esp + 0xc]
mov ecx, 3
sub ecx, ebp
add ecx, ecx
add ecx, ecx
add ecx, ecx
shr edx, cl
inc ebp
mov byte [eax + ebp - 1], dl
cmp ebp, 4
jb 0x4be760
cmp dword [esp + 0x14], 0
jbe 0x4be8a4
cmp byte [esp + 0x254], 0
mov eax, dword [esp + 0x30]
je 0x4be82a
mov ebp, dword [esp + 0x244]
mov ecx, dword [edi + 0x14]
push esi
push eax
push ebx
sub ebp, esi
call ecx
mov edx, dword [esp + 0x3c]
push ebp
add edx, esi
push edx
lea eax, [esp + 0x140]
push eax
call fcn.0040dc50
mov edx, dword [esp + 0x40]
mov ecx, esi
sub ecx, ebp
push ecx
push edx
lea eax, [esp + ebp + 0x14c]
push eax
call fcn.0040dc50
mov edx, dword [edi + 0x14]
push esi
lea ecx, [esp + 0x154]
push ecx
push ebx
call edx
mov eax, dword [esp + 0x44]
xor edx, edx
div esi
add esp, 0x30
dec eax
cmp eax, 1
jbe 0x4be8a4
mov ecx, dword [esp + 0x28]
sub ecx, ebp
add ecx, esi
mov dword [esp + 0xc], ecx
lea ebp, [eax - 1]
jmp 0x4be814
mov ecx, dword [esp + 0xc]
mov eax, dword [edi + 0x14]
push esi
push ecx
push ebx
call eax
add dword [esp + 0x18], esi
add esp, 0xc
sub ebp, 1
jne 0x4be810
jmp 0x4be8a4
mov ecx, dword [eax]
mov edx, dword [eax + 4]
mov ebp, dword [esp + 0x28]
mov dword [esp + 0x12c], ecx
mov ecx, dword [eax + 8]
mov dword [esp + 0x130], edx
mov dl, byte [eax + 0xc]
lea eax, [esi - 0xd]
push eax
mov dword [esp + 0x138], ecx
lea ecx, [esp + 0x13d]
push ebp
push ecx
mov byte [esp + 0x144], dl
call fcn.0040dc50
mov eax, dword [edi + 0x14]
push esi
lea edx, [esp + 0x13c]
push edx
push ebx
call eax
mov eax, dword [esp + 0x2c]
xor edx, edx
div esi
add esp, 0x18
cmp eax, 1
jbe 0x4be8a4
dec eax
lea ebp, [esi + ebp - 0xd]
mov dword [esp + 0x1c], eax
nop
mov ecx, dword [edi + 0x14]
push esi
push ebp
push ebx
call ecx
add esp, 0xc
add ebp, esi
sub dword [esp + 0x1c], 1
jne 0x4be890
push 0x40
lea edx, [esp + 0xf0]
push 0
push edx
call fcn.00412eb0
mov ecx, dword [esp + 0x30]
mov eax, dword [esp + 0x2c]
add eax, ecx
add esp, 0xc
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x54], eax
cmp ecx, eax
ja 0x4bea5c
movzx ecx, byte [esp + 0x40]
movzx edx, byte [esp + 0x3c]
mov dword [esp + 0x40], ecx
mov dword [esp + 0x3c], edx
jmp 0x4be8f0
movzx ecx, byte [esp + 0x1c]
mov eax, dword [esp + 0x40]
mov ebx, dword [esp + 0x3c]
xor eax, ecx
xor ebx, ecx
dec eax
dec ebx
sar eax, 0x1f
sar ebx, 0x1f
mov byte [esp + 0x1a], al
mov byte [esp + 0x13], bl
mov dword [esp + 0x20], 0
test esi, esi
jbe 0x4be9f9
mov ebp, dword [esp + 0x48]
mov ecx, esi
sub ecx, dword [esp + 0x34]
not bl
mov dword [esp + 0x24], ecx
mov ecx, dword [esp + 0x34]
mov byte [esp + 0x18], bl
or bl, al
neg ebp
sub ecx, esi
lea edx, [esp + ecx + 0x5c]
mov byte [esp + 0x1b], bl
mov dword [esp + 0xc], edx
jmp 0x4be954
mov al, byte [esp + 0x1a]
mov ebx, dword [esp + 0x14]
mov ecx, ebp
lea edx, [ebp - 1]
not ecx
not edx
sar ecx, 0x1f
sar edx, 0x1f
and cl, al
and dl, al
mov eax, dword [esp + 0x244]
mov byte [esp + 0x19], 0
cmp ebx, eax
jae 0x4be984
mov eax, dword [esp + 0x30]
mov bl, byte [eax + ebx]
jmp 0x4be9ab
mov ebx, dword [esp + 0x250]
add eax, ebx
cmp dword [esp + 0x14], eax
jae 0x4be9a7
mov eax, dword [esp + 0x28]
sub eax, dword [esp + 0x244]
mov ebx, dword [esp + 0x14]
mov bl, byte [eax + ebx]
jmp 0x4be9ab
mov bl, byte [esp + 0x19]
inc dword [esp + 0x14]
mov al, cl
not al
and al, bl
mov bl, byte [esp + 0x13]
and cl, 0x80
or al, cl
mov ecx, dword [esp + 0x20]
not dl
and al, dl
and al, byte [esp + 0x1b]
cmp ecx, dword [esp + 0x24]
jb 0x4be9e0
mov dl, byte [esp + 0x18]
and dl, al
mov eax, dword [esp + 0xc]
mov al, byte [eax]
and al, bl
or al, dl
inc dword [esp + 0xc]
mov byte [esp + ecx + 0x1ac], al
inc ecx
inc ebp
mov dword [esp + 0x20], ecx
cmp ecx, esi
jb 0x4be950
mov edx, dword [esp + 0x38]
mov eax, dword [edi + 0x14]
push esi
lea ecx, [esp + 0x1b0]
push ecx
push edx
call eax
mov ebp, dword [esp + 0x38]
mov edx, dword [esp + 0x44]
mov eax, dword [edi + 0x24]
push ebp
push 0
lea ecx, [esp + 0x1c0]
push ecx
push edx
call eax
add esp, 0x1c
xor eax, eax
test ebp, ebp
jbe 0x4bea45
mov edi, edi
mov cl, byte [esp + eax + 0x1ac]
and cl, bl
or byte [esp + eax + 0xec], cl
inc eax
cmp eax, ebp
jb 0x4bea30
mov eax, dword [esp + 0x1c]
inc eax
mov dword [esp + 0x1c], eax
cmp eax, dword [esp + 0x54]
jbe 0x4be8f0
mov ebx, dword [esp + 0x38]
mov edx, dword [edi + 0x10]
push ebx
call edx
add esp, 4
cmp byte [esp + 0x254], 0
je 0x4beabe
mov esi, dword [esp + 0x4c]
test esi, esi
jbe 0x4bea87
push esi
lea eax, [esp + 0x70]
push 0x5c
push eax
call fcn.00412eb0
add esp, 0xc
mov ecx, dword [esp + 0x23c]
mov edx, dword [esp + 0x44]
mov eax, dword [edi + 0x14]
push ecx
push edx
push ebx
call eax
mov edx, dword [edi + 0x14]
push esi
lea ecx, [esp + 0x7c]
push ecx
push ebx
call edx
mov eax, dword [esp + 0x44]
mov edx, dword [edi + 0x14]
push eax
lea ecx, [esp + 0x108]
push ecx
push ebx
call edx
add esp, 0x24
jmp 0x4beaf0
xor eax, eax
test esi, esi
jbe 0x4beace
xor byte [esp + eax + 0x6c], 0x6a
inc eax
cmp eax, esi
jb 0x4beac4
mov ecx, dword [edi + 0x14]
push esi
lea eax, [esp + 0x70]
push eax
push ebx
call ecx
mov edx, dword [esp + 0x38]
mov ecx, dword [edi + 0x14]
push edx
lea eax, [esp + 0xfc]
push eax
push ebx
call ecx
add esp, 0x18
mov edx, dword [esp + 0x238]
mov eax, dword [esp + 0x50]
mov ecx, dword [esp + 0x58]
push edx
mov edx, dword [edi + 0x18]
push eax
push ecx
push ebx
call edx
mov eax, dword [edi + 0xc]
push 1
push ebx
call eax
mov ecx, dword [esp + 0x244]
add esp, 0x18
pop esi
pop ebp
pop ebx
xor ecx, esp
xor eax, eax
call fcn.00409b58
add esp, 0x224
ret