Shaikhul,
Why not return true / false from the magic instruction, and then update the value of the zero flag based on the value in the code on the Pin side directly? If you want to use the value that returns, then you can do the comparison on the value directly.
One issue is that setting the ZF manually will not be honored by the compiler typically, because when you call the asm() function (and you specify that the condition codes have been updated), the compiler will make sure to update them before they are used. Care will need to be taken to get this right, so it could be easier to handle the if condition from the magic instruction call in some new C code directly instead of trying to modify the ZF.
Unfortunately without more detail with respect to what you’d like to do, it will be difficult for me to help further.