In case you ever want to customize these functions (maybe modifying to start from 1 as minimum, not from 0) here is the code for assembly functions.
[Fill struct]
mov esi, [esp + 4]
mov ecx, [esp + 8]
next:
mov dword[esi], 0FFFFFFFFh
add esi, 4
loop next
ret 8
[Find minimum]
mov esi, [esp + 4]
mov ecx, [esp + 8]
xor edx, edx
next:
lodsd
cmp eax, edx
je increase
loop next
jmp exit
increase:
mov esi, [esp + 4]
mov ecx, [esp + 8]
inc edx
jmp next
exit:
mov eax, edx
ret 8
[Write minimum]
mov esi, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 0Ch]
next:
lodsd
cmp eax, 0FFFFFFFFh
je update
loop next
mov eax, 0FFFFFFFFh
jmp exit
update:
mov dword[esi-4], edx
mov eax, 0
exit:
ret 12