But a person who has used ASM would definitely know that it can be optimized...
int a, c;
a=450;
c= a>>5;
This is not really about knowing assembly, rather about general base-2 calculations.
In fact, any decent C compiler will happily do it for you. Example: I compiled with gcc 4.1.2 (with flags -m32 -march=i386 for simplicity) the following function:
int divide (unsigned int a) {
unsigned int b = 32;
return a / b;
}
(I had to move it into a function, otherwise the compiler optimized the whole division away.)
With -O0 optimizations (everything turned off) it indeed compiles into rather dumb division:
divide:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
movl $32, -4(%ebp)
movl 8(%ebp), %eax
movl $0, %edx
divl -4(%ebp)
leave
ret
However, even with -O1 it does the optimization for us:
divide:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
shrl $5, %eax
leave
ret
(Quick guide to i386 assembly: "shrl" is logical shift right, "divl" is unsigned division).