First it compares y to the return value of the function which results in a bool value, true or false.
Next, x is initialized using that bool value. x is an integer so the bool has to be converted to an int. true becomes 1, false becomes 0.
It looks like it makes more sense for x to be a bool, but you can use an int the same way. When you use the integer variable x as a condition to if and loops 0 will be treated as false and all other values as true.