int main() {
  signed short int a, b;
  signed int c;
  a = 0x0002;
  b = 0x0004;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0xFFFF;
  b = 0xFFFF;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0xFFFF;
  b = 0x0001;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0xFFFF;
  b = 0x000A;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0xFFFE;
  b = 0xFFFC;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0x000A;
  b = 0x000B;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0xFFF6;
  b = 0x000B;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0xF000;
  b = 0xF001;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0x5555;
  b = 0x3333;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  a = 0x5353;
  b = 0x8000;
  c = (signed int)(a) * (signed int)(b);
  c = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movw   $0x2,-0x6(%rbp)
movw   $0x4,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xffff,-0x6(%rbp)
movw   $0xffff,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xffff,-0x6(%rbp)
movw   $0x1,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xffff,-0x6(%rbp)
movw   $0xa,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xfffe,-0x6(%rbp)
movw   $0xfffc,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xa,-0x6(%rbp)
movw   $0xb,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xfff6,-0x6(%rbp)
movw   $0xb,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0xf000,-0x6(%rbp)
movw   $0xf001,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0x5555,-0x6(%rbp)
movw   $0x3333,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
movw   $0x5353,-0x6(%rbp)
movw   $0x8000,-0x8(%rbp)
movswl -0x6(%rbp),%eax
movswl -0x8(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i32
store i32 0, i32* %1
store i16 2, i16* %2
store i16 4, i16* %3
%5 = load i16, i16* %2
%6 = sext i16 %5 to i32
%7 = load i16, i16* %3
%8 = sext i16 %7 to i32
%9 = mul nsw i32 %6, %8
store i32 %9, i32* %4
store i32 0, i32* %4
store i16 -1, i16* %2
store i16 -1, i16* %3
%10 = load i16, i16* %2
%11 = sext i16 %10 to i32
%12 = load i16, i16* %3
%13 = sext i16 %12 to i32
%14 = mul nsw i32 %11, %13
store i32 %14, i32* %4
store i32 0, i32* %4
store i16 -1, i16* %2
store i16 1, i16* %3
%15 = load i16, i16* %2
%16 = sext i16 %15 to i32
%17 = load i16, i16* %3
%18 = sext i16 %17 to i32
%19 = mul nsw i32 %16, %18
store i32 %19, i32* %4
store i32 0, i32* %4
store i16 -1, i16* %2
store i16 10, i16* %3
%20 = load i16, i16* %2
%21 = sext i16 %20 to i32
%22 = load i16, i16* %3
%23 = sext i16 %22 to i32
%24 = mul nsw i32 %21, %23
store i32 %24, i32* %4
store i32 0, i32* %4
store i16 -2, i16* %2
store i16 -4, i16* %3
%25 = load i16, i16* %2
%26 = sext i16 %25 to i32
%27 = load i16, i16* %3
%28 = sext i16 %27 to i32
%29 = mul nsw i32 %26, %28
store i32 %29, i32* %4
store i32 0, i32* %4
store i16 10, i16* %2
store i16 11, i16* %3
%30 = load i16, i16* %2
%31 = sext i16 %30 to i32
%32 = load i16, i16* %3
%33 = sext i16 %32 to i32
%34 = mul nsw i32 %31, %33
store i32 %34, i32* %4
store i32 0, i32* %4
store i16 -10, i16* %2
store i16 11, i16* %3
%35 = load i16, i16* %2
%36 = sext i16 %35 to i32
%37 = load i16, i16* %3
%38 = sext i16 %37 to i32
%39 = mul nsw i32 %36, %38
store i32 %39, i32* %4
store i32 0, i32* %4
store i16 -4096, i16* %2
store i16 -4095, i16* %3
%40 = load i16, i16* %2
%41 = sext i16 %40 to i32
%42 = load i16, i16* %3
%43 = sext i16 %42 to i32
%44 = mul nsw i32 %41, %43
store i32 %44, i32* %4
store i32 0, i32* %4
store i16 21845, i16* %2
store i16 13107, i16* %3
%45 = load i16, i16* %2
%46 = sext i16 %45 to i32
%47 = load i16, i16* %3
%48 = sext i16 %47 to i32
%49 = mul nsw i32 %46, %48
store i32 %49, i32* %4
store i32 0, i32* %4
store i16 21331, i16* %2
store i16 -32768, i16* %3
%50 = load i16, i16* %2
%51 = sext i16 %50 to i32
%52 = load i16, i16* %3
%53 = sext i16 %52 to i32
%54 = mul nsw i32 %51, %53
store i32 %54, i32* %4
store i32 0, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}