I don't have msvcc (or any windows box for that matter), but I'd assume any decent compiler will optimize both to the same assembler code. This is what GCC does:
Code:
#include <stdlib.h>
extern volatile_exp;
int test() {
int x= rand();
int y= rand();
if (x == 0)
volatile_exp= 10;
if (!y)
volatile_exp= 10;
}
Code:
test:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl %ebx, -4(%ebp)
# grab x,y, init with random value
call rand
movl %eax, %ebx
call rand
# x now in ebx, y in eax
# test x
testl %ebx, %ebx
jne .L20
movl $10, %ecx
movl %ecx, volatile_exp
.L20:
# test y
testl %eax, %eax
jne .L21
movl $10, %edx
movl %edx, volatile_exp
.L21:
movl -4(%ebp), %ebx
movl %ebp, %esp
popl %ebp
ret
As you can see, it's exactly the same. Now, in completely unoptimized mode (if thats possible) that will probably look different. But I don't think performance matters if you turn off safe optimizations.