Function at 0x40f518
Capabilities:
Encrypt data using speck

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x34
mov ecx, dword [ebp + 0x14]
push ebx
xor ebx, ebx
mov dword [ebp - 0x34], 0xc
push esi
and ecx, 0x80
mov dword [ebp - 0x24], ebx
push ebx
pop eax
sete al
mov byte [ebp - 2], bl
mov dword [ebp - 0x2c], eax
test ecx, ecx
mov dword [ebp - 0x30], ebx
sete al
dec al
and al, 0x10
mov byte [ebp - 1], al
lea eax, [ebp - 0x24]
push eax
call fcn.00407521
pop ecx
test eax, eax
je 0x40f56c
push ebx
push ebx
push ebx
push ebx
push ebx
call fcn.0040aaa0
add esp, 0x14
mov al, byte [ebp - 1]
mov esi, 0x8000
mov ecx, dword [ebp + 0x14]
mov byte [ebp - 1], al
test esi, ecx
jne 0x40f596
test ecx, 0x74000
jne 0x40f58e
mov byte [ebp - 1], al
cmp dword [ebp - 0x24], esi
je 0x40f596
mov dl, al
or dl, 0x80
mov byte [ebp - 1], dl
mov eax, ecx
and eax, 3
sub eax, ebx
je 0x40f5ff
sub eax, 1
je 0x40f5db
sub eax, 1
je 0x40f5d4
call fcn.0040aa0f
mov dword [eax], ebx
mov eax, dword [ebp + 0xc]
or dword [eax], 0xffffffff
call fcn.0040aa45
push 0x16
pop esi
push ebx
push ebx
push ebx
push ebx
push ebx
mov dword [eax], esi
call fcn.0040aa9b
add esp, 0x14
mov eax, esi
jmp 0x40fc88
mov esi, 0xc0000000
jmp 0x40f604
mov esi, ecx
and esi, 0x70000
neg esi
sbb esi, esi
neg esi
test cl, 8
setne al
movzx eax, al
and esi, eax
shl esi, 0x1f
add esi, 0x40000000
jmp 0x40f604
mov esi, 0x80000000
mov eax, dword [ebp + 0x18]
push edi
push 0x10
pop edi
mov dword [ebp - 0x18], esi
push 2
pop edx
mov dword [ebp - 0x28], edx
sub eax, edi
je 0x40f647
sub eax, edi
je 0x40f642
sub eax, edi
je 0x40f63e
sub eax, edi
je 0x40f639
sub eax, 0x40
jne 0x40f6a1
cmp esi, 0x80000000
sete al
mov dword [ebp - 0x10], eax
mov edi, eax
jmp 0x40f64c
push 3
pop edi
jmp 0x40f649
mov edi, edx
jmp 0x40f649
xor edi, edi
inc edi
jmp 0x40f649
mov edi, ebx
mov dword [ebp - 0x10], edi
mov eax, ecx
and eax, 0x700
cmp eax, 0x400
ja 0x40f68c
je 0x40f683
test eax, eax
je 0x40f683
cmp eax, 0x100
je 0x40f67a
cmp eax, 0x200
je 0x40f6cc
cmp eax, 0x300
jne 0x40f6a1
mov dword [ebp - 0x14], edx
jmp 0x40f6dc
mov dword [ebp - 0x14], 4
jmp 0x40f6dc
mov dword [ebp - 0x14], 3
jmp 0x40f6dc
cmp eax, 0x500
je 0x40f6d5
cmp eax, 0x600
je 0x40f6cc
cmp eax, 0x700
je 0x40f6d5
call fcn.0040aa0f
mov dword [eax], ebx
mov eax, dword [ebp + 0xc]
or dword [eax], 0xffffffff
call fcn.0040aa45
push 0x16
pop esi
push ebx
push ebx
push ebx
push ebx
push ebx
mov dword [eax], esi
call fcn.0040aa9b
add esp, 0x14
mov eax, esi
jmp 0x40fc87
mov dword [ebp - 0x14], 5
jmp 0x40f6dc
mov dword [ebp - 0x14], 1
mov edx, 0x100
mov eax, 0x80
mov dword [ebp - 0xc], eax
test edx, ecx
je 0x40f706
mov eax, dword [0x415f64]
not eax
and eax, dword [ebp + 0x1c]
test al, al
js 0x40f703
xor eax, eax
inc eax
mov dword [ebp - 0xc], eax
jmp 0x40f706
mov eax, dword [ebp - 0xc]
test cl, 0x40
je 0x40f722
or eax, 0x4000000
or esi, 0x10000
or edi, 4
mov dword [ebp - 0xc], eax
mov dword [ebp - 0x18], esi
mov dword [ebp - 0x10], edi
test ecx, 0x1000
je 0x40f72f
or eax, edx
mov dword [ebp - 0xc], eax
test cl, 0x20
je 0x40f73b
or eax, 0x8000000
jmp 0x40f745
test cl, 0x10
je 0x40f748
or eax, 0x10000000
mov dword [ebp - 0xc], eax
call fcn.0040b0d6
mov edi, dword [ebp + 0xc]
mov dword [edi], eax
cmp eax, 0xffffffff
jne 0x40f778
call fcn.0040aa0f
mov dword [eax], ebx
or dword [edi], 0xffffffff
call fcn.0040aa45
mov dword [eax], 0x18
call fcn.0040aa45
mov eax, dword [eax]
jmp 0x40fc87
mov eax, dword [ebp + 8]
push ebx
push dword [ebp - 0xc]
push dword [ebp - 0x14]
mov dword [eax], 1
lea eax, [ebp - 0x34]
push eax
push dword [ebp - 0x10]
push esi
push dword [ebp + 0x10]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x1c], eax
cmp eax, 0xffffffff
jne 0x40f80f
mov ecx, 0xc0000000
mov eax, esi
and eax, ecx
cmp eax, ecx
jne 0x40f7dd
test byte [ebp + 0x14], 1
je 0x40f7dd
push ebx
push dword [ebp - 0xc]
lea eax, [ebp - 0x34]
and esi, 0x7fffffff
push dword [ebp - 0x14]
mov dword [ebp - 0x18], esi
push eax
push dword [ebp - 0x10]
push esi
push dword [ebp + 0x10]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x1c], eax
cmp eax, 0xffffffff
jne 0x40f80f
mov ecx, dword [edi]
mov eax, ecx
and ecx, 0x1f
sar eax, 5
imul ecx, ecx, 0x24
mov eax, dword [eax*4 + 0x417780]
and byte [eax + ecx + 4], 0xfe
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.0040aa22
pop ecx
call fcn.0040aa45
mov ebx, dword [eax]
jmp 0x40fc85
push eax
call dword [sym.imp.KERNEL32.dll_GetFileType]
test eax, eax
jne 0x40f85c
mov ecx, dword [edi]
mov eax, ecx
and ecx, 0x1f
sar eax, 5
imul ecx, ecx, 0x24
mov eax, dword [eax*4 + 0x417780]
and byte [eax + ecx + 4], 0xfe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
push esi
call fcn.0040aa22
pop ecx
push dword [ebp - 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test esi, esi
jne 0x40f803
call fcn.0040aa45
mov dword [eax], 0xd
jmp 0x40f803
cmp eax, 2
jne 0x40f867
or byte [ebp - 1], 0x40
jmp 0x40f870
cmp eax, 3
jne 0x40f870
or byte [ebp - 1], 8
push dword [ebp - 0x1c]
push dword [edi]
call fcn.0040b3a8
pop ecx
pop ecx
cmp eax, 0xffffffff
jne 0x40f892
push dword [ebp - 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or eax, 0xffffffff
jmp 0x40fc87
mov ecx, dword [edi]
mov eax, ecx
mov dl, byte [ebp - 1]
and ecx, 0x1f
sar eax, 5
or dl, 1
imul ecx, ecx, 0x24
mov byte [ebp - 1], dl
mov eax, dword [eax*4 + 0x417780]
mov byte [eax + ecx + 4], dl
mov ecx, dword [edi]
mov eax, ecx
sar eax, 5
and ecx, 0x1f
imul ecx, ecx, 0x24
mov eax, dword [eax*4 + 0x417780]
and dword [eax + ecx + 8], 0xfffffffc
mov al, dl
mov ecx, dword [ebp + 0x14]
and al, 0xc8
cmp al, 0x80
jne 0x40f95c
test cl, 2
je 0x40f95c
push 2
push 0xffffffffffffffff
push dword [edi]
call fcn.00412833
add esp, 0xc
mov dword [ebp - 0x20], eax
cmp eax, 0xffffffff
jne 0x40f90f
call fcn.0040aa0f
cmp dword [eax], 0x83
je 0x40f956
push dword [edi]
call fcn.0040f447
jmp 0x40f802
xor eax, eax
mov word [ebp - 8], ax
lea eax, [ebp - 8]
push 1
push eax
push dword [edi]
call fcn.004128a8
add esp, 0xc
test eax, eax
jne 0x40f945
cmp word [ebp - 8], 0x1a
jne 0x40f945
mov eax, dword [ebp - 0x20]
cdq
push edx
push eax
push dword [edi]
call fcn.0041267d
add esp, 0xc
cmp eax, 0xffffffff
je 0x40f903
push ebx
push ebx
push dword [edi]
call fcn.00412833
add esp, 0xc
cmp eax, 0xffffffff
je 0x40f903
mov dl, byte [ebp - 1]
mov ecx, dword [ebp + 0x14]
test dl, dl
jns 0x40fb88
test ecx, 0x74000
jne 0x40f983
mov eax, dword [ebp - 0x24]
and eax, 0x74000
jne 0x40f97e
or ecx, 0x4000
jmp 0x40f980
or ecx, eax
mov dword [ebp + 0x14], ecx
mov eax, ecx
and eax, 0x74000
cmp eax, 0x4000
je 0x40f9df
cmp eax, 0x10000
je 0x40f9c7
cmp eax, 0x14000
je 0x40f9c7
cmp eax, 0x20000
je 0x40f9c1
cmp eax, 0x24000
je 0x40f9c1
cmp eax, 0x40000
je 0x40f9bb
cmp eax, 0x44000
jne 0x40f9e2
mov byte [ebp - 2], 1
jmp 0x40f9e2
mov byte [ebp - 2], 2
jmp 0x40f9e2
mov eax, ecx
and eax, 0x301
cmp eax, 0x301
setne al
dec al
and al, 2
mov byte [ebp - 2], al
jmp 0x40f9e2
mov byte [ebp - 2], bl
test ecx, 0x70000
je 0x40fb88
mov dword [ebp - 0x20], ebx
test dl, 0x40
jne 0x40fb88
mov eax, 0xc0000000
and esi, eax
cmp esi, 0x40000000
je 0x40fafe
cmp esi, 0x80000000
je 0x40fa6b
cmp esi, eax
jne 0x40fb88
mov eax, dword [ebp - 0x14]
push 2
pop ecx
cmp eax, ecx
jbe 0x40fb3e
cmp eax, 4
jbe 0x40fa3e
cmp eax, 5
je 0x40fb3e
jmp 0x40fb88
push ecx
push ebx
push ebx
push dword [edi]
call fcn.0040ee09
add esp, 0x10
or eax, edx
je 0x40fb3b
push ebx
push ebx
push ebx
push dword [edi]
call fcn.0040ee09
and eax, edx
add esp, 0x10
cmp eax, 0xffffffff
je 0x40f903
push 3
lea eax, [ebp - 0x20]
push eax
push dword [edi]
call fcn.004128a8
mov ecx, eax
add esp, 0xc
cmp ecx, 0xffffffff
je 0x40f903
mov edx, dword [ebp - 0x20]
push 2
pop eax
cmp ecx, eax
je 0x40faa6
cmp ecx, 3
jne 0x40faf0
cmp edx, 0xbfbbef
jne 0x40faa6
mov byte [ebp - 2], 1
jmp 0x40fb88
movzx ecx, dx
cmp ecx, 0xfffe
jne 0x40faca
push dword [edi]
call fcn.0040f447
pop ecx
call fcn.0040aa45
push 0x16
pop esi
mov ebx, esi
mov dword [eax], esi
jmp 0x40fc85
cmp ecx, 0xfeff
jne 0x40faf0
push ebx
push eax
push dword [edi]
call fcn.00412833
add esp, 0xc
cmp eax, 0xffffffff
je 0x40f903
mov byte [ebp - 2], 2
jmp 0x40fb88
push ebx
push ebx
push dword [edi]
call fcn.00412833
add esp, 0xc
jmp 0x40fb31
mov eax, dword [ebp - 0x14]
push 2
pop ecx
cmp eax, ecx
jbe 0x40fb3e
cmp eax, 4
ja 0x40fa30
push ecx
push ebx
push ebx
push dword [edi]
call fcn.0040ee09
add esp, 0x10
or eax, edx
je 0x40fb3b
push ebx
push ebx
push ebx
push dword [edi]
call fcn.0040ee09
add esp, 0x10
and eax, edx
cmp eax, 0xffffffff
jne 0x40fb88
jmp 0x40f903
push 2
pop ecx
movzx eax, byte [ebp - 2]
mov esi, ebx
sub eax, 1
je 0x40fb55
sub eax, 1
jne 0x40fb88
mov eax, 0xfeff
jmp 0x40fb60
push 3
pop ecx
mov dword [ebp - 0x28], ecx
mov eax, 0xbfbbef
mov dword [ebp - 0x20], eax
sub ecx, esi
lea eax, [ebp - 0x20]
push ecx
add eax, esi
push eax
push dword [edi]
call fcn.0040beba
add esp, 0xc
cmp eax, 0xffffffff
je 0x40f903
mov ecx, dword [ebp - 0x28]
add esi, eax
cmp ecx, esi
jg 0x40fb63
mov ecx, dword [edi]
mov eax, ecx
and ecx, 0x1f
sar eax, 5
imul esi, ecx, 0x24
mov edx, dword [eax*4 + 0x417780]
movzx eax, byte [ebp - 2]
mov ecx, dword [edx + esi + 8]
and ecx, 0xfffffffc
or ecx, eax
mov dword [edx + esi + 8], ecx
mov ecx, dword [edi]
mov eax, ecx
sar eax, 5
and ecx, 0x1f
imul edx, ecx, 0x24
mov ecx, dword [eax*4 + 0x417780]
mov eax, dword [ebp + 0x14]
shr eax, 0xd
xor eax, dword [ecx + edx + 8]
and eax, 8
xor dword [ecx + edx + 8], eax
test byte [ebp - 1], 0x48
mov ecx, dword [ebp + 0x14]
jne 0x40fbfc
test cl, 8
je 0x40fbfc
mov ecx, dword [edi]
mov eax, ecx
and ecx, 0x1f
sar eax, 5
imul ecx, ecx, 0x24
mov eax, dword [eax*4 + 0x417780]
or byte [eax + ecx + 4], 0x20
mov ecx, dword [ebp + 0x14]
mov esi, dword [ebp - 0x18]
mov edx, 0xc0000000
mov eax, esi
and eax, edx
cmp eax, edx
jne 0x40fc85
test cl, 1
je 0x40fc85
push dword [ebp - 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
push dword [ebp - 0xc]
lea eax, [ebp - 0x34]
and esi, 0x7fffffff
push 3
push eax
push dword [ebp - 0x10]
push esi
push dword [ebp + 0x10]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
jne 0x40fc6e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.0040aa22
mov ecx, dword [edi]
mov eax, ecx
and ecx, 0x1f
sar eax, 5
imul ecx, ecx, 0x24
mov eax, dword [eax*4 + 0x417780]
and byte [eax + ecx + 4], 0xfe
push dword [edi]
call fcn.0040b2a0
pop ecx
jmp 0x40f802
mov edx, dword [edi]
mov ecx, edx
sar ecx, 5
and edx, 0x1f
imul edx, edx, 0x24
mov ecx, dword [ecx*4 + 0x417780]
mov dword [edx + ecx], eax
mov eax, ebx
pop edi
pop esi
pop ebx
leave
ret