Function at 0x407820
Capabilities:
Validate payment card number using luhn algorithm

Disassembly:
push ebp
mov ebp, esp
and esp, 0xffffffc0
sub esp, 0x34
push ebx
mov ebx, dword [ebp + 0x10]
xor ecx, ecx
push esi
push edi
mov edi, eax
mov al, byte [ebx]
inc ebx
mov dword [esp + 0x28], ecx
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x34], ecx
mov dword [esp + 0x24], ecx
mov dword [esp + 0x30], ecx
mov dword [esp + 0x2c], 0xffffffff
mov dword [esp + 0x38], ecx
mov dword [ebp + 0x10], ebx
cmp dword [ebp + 8], ecx
jne 0x407866
cmp dword [ebp + 0xc], ecx
je 0x407866
mov dword [ebp + 0xc], ecx
test al, al
je 0x407e08
mov edx, ecx
mov ecx, dword [esp + 0x38]
mov esi, 0x40
cmp ecx, 6
ja case.default.0x407882
jmp dword [ecx*4 + 0x407e58]
cmp al, 0x25
jne 0x40789d
mov al, byte [ebx]
mov dword [esp + 0x38], 1
inc ebx
jmp 0x407df3
mov esi, dword [esp + 0x28]
inc esi
cmp esi, dword [ebp + 0xc]
jae 0x4078b5
mov edx, dword [esp + 0x28]
mov ecx, dword [ebp + 8]
mov byte [edx + ecx], al
mov edx, dword [esp + 0x34]
mov al, byte [ebx]
mov dword [esp + 0x28], esi
inc ebx
jmp 0x407df3
movsx ecx, al
add ecx, 0xffffffe0
cmp ecx, 0x10
ja case.0x4078d3.33
movzx ecx, byte [ecx + 0x407e90]
jmp dword [ecx*4 + 0x407e74]
or dword [esp + 0x24], 1
mov al, byte [ebx]
inc ebx
jmp 0x407df3
or dword [esp + 0x24], 2
mov al, byte [ebx]
inc ebx
jmp 0x407df3
or dword [esp + 0x24], 4
mov al, byte [ebx]
inc ebx
jmp 0x407df3
or dword [esp + 0x24], 8
mov al, byte [ebx]
inc ebx
jmp 0x407df3
or dword [esp + 0x24], 0x10
mov al, byte [ebx]
inc ebx
jmp 0x407df3
or dword [esp + 0x24], 0x20
mov al, byte [ebx]
inc ebx
jmp 0x407df3
mov dword [esp + 0x38], 2
jmp case.default.0x407882
mov cl, al
sub cl, 0x30
cmp cl, 9
ja 0x40797e
add al, 0xd0
movsx ecx, al
mov edx, closesocket
sub edx, ecx
mov eax, 0x66666667
imul edx
mov eax, dword [esp + 0x30]
sar edx, 2
mov esi, edx
shr esi, 0x1f
add esi, edx
cmp eax, esi
jg 0x407e00
lea edx, [eax + eax*4]
lea eax, [ecx + edx*2]
mov edx, dword [esp + 0x34]
mov dword [esp + 0x30], eax
mov al, byte [ebx]
inc ebx
jmp 0x407df3
cmp al, 0x2a
jne 0x4079aa
mov eax, dword [edi]
add edi, 4
mov dword [esp + 0x30], eax
test eax, eax
jge 0x40799a
or dword [esp + 0x24], 1
neg eax
mov dword [esp + 0x30], eax
mov al, byte [ebx]
inc ebx
mov dword [esp + 0x38], 3
jmp 0x407df3
mov dword [esp + 0x38], 3
jmp case.default.0x407882
cmp al, 0x2e
jne 0x4079cb
mov al, byte [ebx]
mov dword [esp + 0x38], 4
inc ebx
jmp 0x407df3
mov dword [esp + 0x38], 5
jmp case.default.0x407882
cmp dword [esp + 0x2c], 0xffffffff
jne 0x4079e7
mov dword [esp + 0x2c], 0
mov cl, al
sub cl, 0x30
cmp cl, 9
ja 0x407a30
add al, 0xd0
movsx ecx, al
mov edx, closesocket
sub edx, ecx
mov eax, 0x66666667
imul edx
mov eax, dword [esp + 0x2c]
sar edx, 2
mov esi, edx
shr esi, 0x1f
add esi, edx
cmp eax, esi
jg 0x407e00
lea edx, [eax + eax*4]
lea eax, [ecx + edx*2]
mov edx, dword [esp + 0x34]
mov dword [esp + 0x2c], eax
mov al, byte [ebx]
inc ebx
jmp 0x407df3
cmp al, 0x2a
jne 0x4079cb
mov eax, dword [edi]
add edi, 4
mov dword [esp + 0x2c], eax
test eax, eax
jge 0x407a49
mov dword [esp + 0x2c], 0xffffffff
mov al, byte [ebx]
inc ebx
mov dword [esp + 0x38], 5
jmp 0x407df3
movsx ecx, al
add ecx, 0xffffffb4
cmp ecx, 0x2e
ja case.0x407a6f.77
movzx ecx, byte [ecx + 0x407ec0]
jmp dword [ecx*4 + 0x407ea4]
mov al, byte [ebx]
inc ebx
mov dword [ebp + 0x10], ebx
cmp al, 0x68
jne 0x407a87
mov edx, 1
jmp 0x407ade
mov edx, 2
mov dword [esp + 0x34], edx
mov dword [esp + 0x38], 6
jmp case.default.0x407882
mov al, byte [ebx]
inc ebx
mov dword [ebp + 0x10], ebx
cmp al, 0x6c
jne 0x407aae
mov edx, 4
jmp 0x407ade
mov edx, 3
mov dword [esp + 0x34], edx
mov dword [esp + 0x38], 6
jmp case.default.0x407882
mov edx, 5
jmp 0x407ade
mov edx, 8
jmp 0x407ade
mov edx, 7
jmp 0x407ade
mov edx, 6
mov al, byte [ebx]
inc ebx
mov dword [ebp + 0x10], ebx
mov dword [esp + 0x34], edx
mov dword [esp + 0x38], 6
jmp case.default.0x407882
movsx ecx, al
add ecx, 0xffffffdb
cmp ecx, 0x53
ja case.0x407b0b.38
movzx ecx, byte [ecx + 0x407f34]
jmp dword [ecx*4 + 0x407ef0]
lea eax, [edx - 1]
cmp eax, 7
ja case.0x407b1a.3
jmp dword [eax*4 + 0x407f88]
movsx eax, byte [edi]
add edi, 4
jmp 0x407b49
movsx eax, word [edi]
add edi, 4
jmp 0x407b49
mov eax, dword [edi]
mov edx, dword [edi + 4]
add edi, 8
jmp 0x407b4a
mov eax, dword [edi]
add edi, 4
xor edx, edx
jmp 0x407b4a
mov eax, dword [edi]
add edi, 4
cdq
mov ecx, dword [esp + 0x2c]
push ecx
mov ecx, dword [esp + 0x34]
push ecx
mov ecx, dword [esp + 0x2c]
push 0xa
push edx
mov edx, dword [ebp + 0xc]
push eax
mov eax, dword [ebp + 8]
push edx
push eax
lea esi, [esp + 0x44]
call fcn.004080e0
add esp, 0x1c
jmp case.0x407b0b.38
or dword [esp + 0x24], esi
mov ecx, 0x10
jmp 0x407b8c
mov ecx, 8
jmp 0x407b8c
mov ecx, 0xa
or dword [esp + 0x24], 0x80
lea eax, [edx - 1]
cmp eax, 7
ja case.0x407b9c.3
jmp dword [eax*4 + 0x407fa8]
movzx eax, byte [edi]
add edi, 4
cdq
jmp 0x407bce
movzx eax, word [edi]
add edi, 4
cdq
jmp 0x407bce
mov eax, dword [edi]
mov edx, dword [edi + 4]
add edi, 8
jmp 0x407bce
mov eax, dword [edi]
add edi, 4
cdq
jmp 0x407bce
mov eax, dword [edi]
add edi, 4
xor edx, edx
mov esi, dword [esp + 0x2c]
push esi
mov esi, dword [esp + 0x34]
push esi
push ecx
mov ecx, dword [ebp + 0xc]
push edx
mov edx, dword [ebp + 8]
push eax
push ecx
mov ecx, dword [esp + 0x3c]
push edx
lea esi, [esp + 0x44]
call fcn.004080e0
add esp, 0x1c
jmp case.0x407b0b.38
or dword [esp + 0x24], esi
fld qword [edi]
add edi, 8
mov ecx, dword [esp + 0x24]
mov edx, dword [esp + 0x2c]
sub esp, 8
fstp qword [esp]
lea eax, [esp + 0x44]
push eax
mov eax, dword [esp + 0x3c]
push ecx
mov ecx, dword [ebp + 0xc]
push edx
mov edx, dword [ebp + 8]
push eax
push ecx
push edx
lea ecx, [esp + 0x48]
call fcn.004083c0
add esp, 0x20
cmp dword [esp + 0x3c], 0
jne 0x407e08
jmp case.0x407b0b.38
or dword [esp + 0x24], esi
fld qword [edi]
or dword [esp + 0x24], 0x200
mov ecx, dword [esp + 0x24]
mov edx, dword [esp + 0x2c]
sub esp, 8
fstp qword [esp]
add edi, 8
lea eax, [esp + 0x44]
push eax
mov eax, dword [esp + 0x3c]
push ecx
mov ecx, dword [ebp + 0xc]
push edx
mov edx, dword [ebp + 8]
push eax
push ecx
push edx
lea ecx, [esp + 0x48]
call fcn.004083c0
add esp, 0x20
cmp dword [esp + 0x3c], 0
jne 0x407e08
jmp case.0x407b0b.38
or dword [esp + 0x24], esi
or dword [esp + 0x24], 0x100
fld qword [edi]
add edi, 8
cmp dword [esp + 0x2c], 0
jne 0x407c01
mov dword [esp + 0x2c], 1
jmp 0x407c01
mov eax, dword [esp + 0x28]
lea esi, [eax + 1]
add edi, 4
cmp esi, dword [ebp + 0xc]
jae 0x407dd2
mov cl, byte [edi - 4]
mov edx, dword [ebp + 8]
mov byte [eax + edx], cl
jmp 0x407dd2
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x2c]
mov edx, dword [ebp + 0xc]
push eax
mov eax, dword [ebp + 8]
push ecx
mov ecx, dword [edi]
push edx
add edi, 4
push eax
mov eax, dword [esp + 0x40]
lea ebx, [esp + 0x38]
call fcn.00407ff0
mov ebx, dword [ebp + 0x10]
add esp, 0x10
jmp case.0x407b0b.38
mov eax, dword [edi]
mov ecx, dword [esp + 0x24]
add edi, 4
test eax, eax
jne 0x407d3c
mov edx, dword [ebp + 0xc]
mov eax, dword [ebp + 8]
push ecx
push 0xffffffffffffffff
push edx
push eax
mov eax, dword [esp + 0x40]
mov ecx, str._nil_
lea ebx, [esp + 0x38]
call fcn.00407ff0
mov ebx, dword [ebp + 0x10]
add esp, 0x10
jmp case.0x407b0b.38
mov edx, dword [esp + 0x2c]
push edx
mov edx, dword [esp + 0x34]
push edx
mov edx, dword [ebp + 8]
push 0x10
push 0
push eax
mov eax, dword [ebp + 0xc]
push eax
or ecx, 0x88
push edx
lea esi, [esp + 0x44]
call fcn.004080e0
add esp, 0x1c
jmp case.0x407b0b.38
lea eax, [edx - 1]
cmp eax, 7
ja case.0x407d6f.3
jmp dword [eax*4 + 0x407fc8]
mov eax, dword [edi]
mov cl, byte [esp + 0x28]
add edi, 4
mov byte [eax], cl
jmp case.0x407b0b.38
mov edx, dword [edi]
mov ax, word [esp + 0x28]
add edi, 4
mov word [edx], ax
jmp case.0x407b0b.38
mov eax, dword [edi]
mov ecx, dword [esp + 0x28]
add edi, 4
mov dword [eax], ecx
mov dword [eax + 4], 0
jmp case.0x407b0b.38
mov edx, dword [edi]
mov eax, dword [esp + 0x28]
add edi, 4
mov dword [edx], eax
jmp case.0x407b0b.38
mov ecx, dword [edi]
mov edx, dword [esp + 0x28]
add edi, 4
mov dword [ecx], edx
jmp case.0x407b0b.38
mov ecx, dword [esp + 0x28]
lea esi, [ecx + 1]
cmp esi, dword [ebp + 0xc]
jae 0x407dd2
mov edx, dword [ebp + 8]
mov byte [ecx + edx], al
mov dword [esp + 0x28], esi
mov al, byte [ebx]
inc ebx
xor edx, edx
mov dword [esp + 0x38], edx
mov dword [esp + 0x30], edx
mov dword [esp + 0x24], edx
mov dword [esp + 0x34], edx
mov dword [esp + 0x2c], 0xffffffff
mov dword [ebp + 0x10], ebx
test al, al
jne 0x407870
jmp 0x407e08
mov dword [esp + 0x3c], 1
mov eax, dword [ebp + 0xc]
mov ecx, dword [esp + 0x28]
cmp ecx, eax
jae 0x407e1c
mov eax, dword [ebp + 8]
mov byte [ecx + eax], 0
jmp 0x407e28
test eax, eax
jbe 0x407e28
mov edx, dword [ebp + 8]
mov byte [edx + eax - 1], 0
cmp dword [esp + 0x3c], 0
jne 0x407e40
cmp ecx, 0x7fffffff
jae 0x407e40
mov eax, ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
call fcn.0040b8d7
pop edi
pop esi
mov dword [eax], 0x22
or eax, 0xffffffff
pop ebx
mov esp, ebp
pop ebp
ret