This is an expected optimization performed by Embedded Coder. For example, the code could be written such that "my_var" can never be outside the range [0, 100], and so Embedded Coder optimized it out. Another possible reason could be related to the 'Optimize using the specified minimum and maximum values' (UseSpecifiedMinMax) setting. To access the release-specific documentation for this setting, execute the following command in the MATLAB R2019b command window:
>> web(fullfile(docroot, 'rtw/ref/optimize-using-the-specified-minimum-and-maximum-values.html'))
The if-statement does a range check on "my_var", which is why it could be that Embedded Coder is performing the min/max optimization. There are a few different places a user could be setting the min/max values:
1) On the root inport:
2) In the Ports and Data Manager of the MATLAB Function Block:
3) In a Simulink.Signal object mapped to that input signal:
Please follow the below link to search for the required information regarding the current release: