The final private key reconstruction is explained in the README for the simple case
https://github.com/JeanLucPons/VanitySearch#how-it-worksThis is what is done at the line 323 of main.cpp. Then you find the 5 other cases for symmetry and endomorphism.
The information of which case (out of the 6) has matched during the search is not in the partial key file, the reconstruction just test the 6 cases until one match.
For the reconstruction of a BECH32 address, you simply compute a BECH32 address from the final private key, this is what is done the CHECK_ADDR() macro at line 238 of main.cpp.
Note: The secret private key passed through the command line for reconstruction is stored in e.
#define CHECK_ADDR() \
fullPriv.ModAddK1order(&e, &partialPrivKey); \ # Compute the final private key (partialKey + secretKey mod n)
p = secp->ComputePublicKey(&fullPriv); \ # Compute the corresponding public key
cAddr = secp->GetAddress(addrType, compressed, p); \ # Compute the corresponding address (for BECH32, addrType=2 defined in SECP256k1.h)
if (cAddr == addr) { \ # Test if it matches
found = true; \
string pAddr = secp->GetPrivAddress(compressed, fullPriv); \
string pAddrHex = fullPriv.GetBase16(); \
outputAdd(outputFile, addrType, addr, pAddr, pAddrHex); \
}