Function at 0x405040
Capabilities:
Encrypt data using speck

Disassembly:
push ecx
test eax, eax
je 0x43a72e
push 0
lea ecx, [esp + 4]
push ecx
mov ecx, dword [esp + 0x10]
push edx
mov edx, dword [eax]
push ecx
push edx
mov dword [esp + 0x14], 0
call dword [0x49c2c4]
test eax, eax
je 0x405070
mov eax, dword [esp]
pop ecx
ret
xor eax, eax
pop ecx
ret
add byte [eax], al
push edx
lea eax, [edi + 0x54]
push eax
mov dword [eax], 7
push ecx
lea eax, [edi + 0x70]
push eax
push 0
mov eax, 0x13
call fcn.00405a20
mov edx, dword [esp + 0x2c]
add esp, 0x14
mov dword [esp + 0x30], eax
test eax, eax
jne 0x43cc9a
mov dword [edi + 0x68], eax
mov dword [edi], 0x11
mov eax, dword [edi + 0x64]
add eax, dword [edi + 0x60]
cmp dword [edi + 0x68], eax
jae 0x406009
mov ecx, dword [edi + 0x54]
mov eax, 1
shl eax, cl
mov ecx, dword [edi + 0x4c]
dec eax
and eax, ebx
mov eax, dword [ecx + eax*4]
mov ecx, eax
shr ecx, 8
movzx ecx, cl
mov dword [esp + 0x28], eax
cmp ecx, ebp
ja 0x406154
mov ecx, eax
shr ecx, 0x10
cmp ecx, 0x10
jae 0x40619d
mov ecx, eax
shr ecx, 8
movzx ecx, cl
cmp ebp, ecx
jb 0x43ccd0
movzx ecx, ah
mov eax, dword [edi + 0x68]
shr ebx, cl
sub ebp, ecx
mov cx, word [esp + 0x2a]
mov word [edi + eax*2 + 0x70], cx
inc dword [edi + 0x68]
mov eax, dword [edi + 0x64]
add eax, dword [edi + 0x60]
cmp dword [edi + 0x68], eax
jb 0x405fa2
cmp dword [edi], 0x1b
je 0x405f30
lea eax, [edi + 0x530]
lea ecx, [edi + 0x6c]
mov dword [ecx], eax
mov dword [edi + 0x4c], eax
lea edx, [edi + 0x2f0]
push edx
lea eax, [edi + 0x54]
push eax
cmp dword [esp + 0x10], 0
je 0x40657e
movzx eax, byte [esi]
dec dword [esp + 0x10]
mov ecx, ebp
shl eax, cl
mov ecx, dword [edi + 0x54]
inc esi
add ebp, 8
add ebx, eax
mov eax, 1
shl eax, cl
mov ecx, dword [edi + 0x4c]
mov dword [esp + 0x14], esi
dec eax
and eax, ebx
mov eax, dword [ecx + eax*4]
mov ecx, eax
shr ecx, 8
movzx ecx, cl
mov dword [esp + 0x28], eax
cmp ecx, ebp
jbe 0x405fc9
jmp 0x406154
mov cx, word [esp + 0x2a]
cmp cx, 0x10
jne 0x406537
movzx ecx, ah
lea eax, [ecx + 2]
cmp ebp, eax
jb 0x406433
mov eax, dword [edi + 0x68]
shr ebx, cl
sub ebp, ecx
test eax, eax
je 0x43cd1e
movzx ecx, word [edi + eax*2 + 0x6e]
mov eax, ebx
and eax, 3
add eax, 3
shr ebx, 2
mov dword [esp + 0x28], ecx
sub ebp, 2
mov edx, dword [edi + 0x64]
mov ecx, dword [edi + 0x68]
add edx, dword [edi + 0x60]
add ecx, eax
cmp ecx, edx
ja 0x43cd34
test eax, eax
je 0x406210
mov ecx, dword [esp + 0x28]
jmp 0x406200
mov edx, dword [edi + 0x68]
dec eax
mov word [edi + edx*2 + 0x70], cx
inc dword [edi + 0x68]
test eax, eax
jne 0x406200
mov edx, dword [esp + 0x18]
jmp 0x405ffe
mov dword [esp + 0x28], ecx
jmp 0x406440
cmp dword [esp + 0x10], 0
je 0x40657e
movzx eax, byte [esi]
dec dword [esp + 0x10]
mov ecx, ebp
shl eax, cl
mov ecx, dword [esp + 0x28]
inc esi
add ebp, 8
add ebx, eax
lea eax, [ecx + 2]
mov dword [esp + 0x14], esi
cmp ebp, eax
jae 0x4061ba
jmp 0x406440
movzx eax, ah
mov dword [esp + 0x28], eax
cmp cx, 0x11
jne 0x4068ba
add eax, 3
cmp ebp, eax
jb 0x406720
mov ecx, dword [esp + 0x28]
shr ebx, cl
mov edx, 0xfffffffd
sub edx, ecx
mov dword [esp + 0x28], 0
mov eax, ebx
and eax, 7
add eax, 3
shr ebx, 3
add ebp, edx
jmp 0x4061e0
int 0xfd
invalid
cmp dword [esp + 0x10], 0
je 0x40657e
movzx eax, byte [esi]
dec dword [esp + 0x10]
mov ecx, ebp
shl eax, cl
inc esi
add ebp, 8
mov dword [esp + 0x14], esi
add ebx, eax
mov eax, dword [esp + 0x28]
add eax, 3
cmp ebp, eax
jae 0x406553
jmp 0x406720
add eax, 7
cmp ebp, eax
jae 0x4068ec
cmp dword [esp + 0x10], 0
je 0x40657e
movzx eax, byte [esi]
dec dword [esp + 0x10]
mov ecx, ebp
shl eax, cl
inc esi
add ebp, 8
mov dword [esp + 0x14], esi
add ebx, eax
mov eax, dword [esp + 0x28]
add eax, 7
cmp ebp, eax
jb 0x4068c1
mov ecx, dword [esp + 0x28]
shr ebx, cl
mov edx, 0xfffffff9
sub edx, ecx
mov dword [esp + 0x28], 0
mov eax, ebx
and eax, 0x7f
add eax, 0xb
shr ebx, 7
add ebp, edx
jmp 0x4061e0
ror byte [edi], 0x10
inc eax
mov al, 0xf
adc dword [ecx], eax
mov eax, dword [esp + 0x10]
mov dword [ecx], eax
add dword [edx], 4
mov ecx, dword [edx]
mov dword [ecx], eax
add dword [edx], 4
mov dword [esi], 0x33c30001
jmp 0x405f5d
movzx ecx, word [edi + 0x18]
cmp ebx, ecx
je 0x50a9cfbc
mov eax, eax
cmove eax, edi
inc eax
sbb byte [eax], bh
pop ecx
dec edx
add bh, al
pop es
sbb eax, ebx
xor eax, dword [eax]
jmp 0x40609b
or dword [ebx + 0x488901e1], eax
sub al, 0x8b
push edi
and bh, al
inc edx
xor byte [ecx], al
add byte [eax], al
jmp [edx]
cmp dword [edi + ecx + 0x10], 0x33
je 0x4066e9
cld
dec dword [edi]
mov dh, 6
movzx eax, byte [esi]
dec dword [esp + 0x10]
mov ecx, ebp
shl eax, cl
inc esi
add ebp, 8
mov dword [esp + 0x14], esi
add ebx, eax
cmp ebp, 0x20
jb 0x43cd15
fadd dword [ebx - 0x248ddf03]
mov ecx, ebx
and ecx, 0xffc3
mov eax, ebx
shl eax, 0x10
add ecx, eax
mov eax, ebx
shr eax, 8