#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int a, b, c;
  printf("1 << 0 = %x\n", 1 << 0);
  printf("1 << 2 = %x\n", 1 << 2);
  printf("0 << 4 = %x\n", 0 << 4);
  printf("1 << 31 = %x\n", 1 << 31);
  printf("1 << 32 = %x\n", 1 << 32);
  printf("4 << -1 = %x\n", 4 << -1);
  printf("4 >> -1 = %x\n", 4 >> -1);
  printf("-1 << 1 = %x\n", -1 << 1);
  printf("-1 << 0 = %x\n", -1 << 0);
  printf("4 >> 1 = %x\n", 4 >> 1);
  printf("4 >> 5 = %x\n", 4 >> 5);
  printf("0x80000000 >> 31 = %x\n", (int)0x80000000 >> 31);
  printf("-1 >> 2 = %x\n", -1 >> 2);
  b = 0xbef6d568;
  c = 0xbef6d56a;
  printf("%d - %d = %d(%x)\n", b, c, b - c, b - c);
  a = (b << 8) | 12;
  c = (a >> 8) | ((int)b & 0xff000000);
  printf("a = %x, b = %x, c = %x\n", a, b, c);
  a = ((b & 0x007fffff) << 8) | 12;
  c = (a >> 8) | ((int)b & 0xff800000);
  printf("a = %x, b = %x, c = %x\n", a, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf3b(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x80000000,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0xfffffffe,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xbef6d568,-0xc(%rbp)
movl   $0xbef6d56a,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
sub    -0x10(%rbp),%r8d
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
or     $0xc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
mov    -0xc(%rbp),%ecx
and    $0xff000000,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0x7fffff,%eax
shl    $0x8,%eax
or     $0xc,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
mov    -0xc(%rbp),%ecx
and    $0xff800000,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf49(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x80000000,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0xfffffffe,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0xbef6d568,%esi
mov    $0xbef6d56a,%edx
mov    $0xfffffffe,%ecx
mov    $0xfffffffe,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea2(%rip),%rbx
mov    %rbx,%rdi
mov    $0xf6d5680c,%esi
mov    $0xbef6d568,%edx
mov    $0xfff6d568,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x76d5680c,%esi
mov    $0xbef6d568,%edx
mov    $0xbef6d568,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"1 << 0 = %x\0A\00"
@.str.1 = [13 x i8] c"1 << 2 = %x\0A\00"
@.str.2 = [13 x i8] c"0 << 4 = %x\0A\00"
@.str.3 = [14 x i8] c"1 << 31 = %x\0A\00"
@.str.4 = [14 x i8] c"1 << 32 = %x\0A\00"
@.str.5 = [14 x i8] c"4 << -1 = %x\0A\00"
@.str.6 = [14 x i8] c"4 >> -1 = %x\0A\00"
@.str.7 = [14 x i8] c"-1 << 1 = %x\0A\00"
@.str.8 = [14 x i8] c"-1 << 0 = %x\0A\00"
@.str.9 = [13 x i8] c"4 >> 1 = %x\0A\00"
@.str.10 = [13 x i8] c"4 >> 5 = %x\0A\00"
@.str.11 = [23 x i8] c"0x80000000 >> 31 = %x\0A\00"
@.str.12 = [14 x i8] c"-1 >> 2 = %x\0A\00"
@.str.13 = [18 x i8] c"%d - %d = %d(%x)\0A\00"
@.str.14 = [24 x i8] c"a = %x, b = %x, c = %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 4)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 0)
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 -2147483648)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 poison)
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 poison)
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 poison)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 -2)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 -1)
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 2)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 0)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 -1)
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 -1)
store i32 -1091119768, i32* %3
store i32 -1091119766, i32* %4
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = sub nsw i32 %20, %21
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %23, %24
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 %18, i32 %19, i32 %22, i32 %25)
%27 = load i32, i32* %3
%28 = shl i32 %27, 8
%29 = or i32 %28, 12
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = ashr i32 %30, 8
%32 = load i32, i32* %3
%33 = and i32 %32, -16777216
%34 = or i32 %31, %33
store i32 %34, i32* %4
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = load i32, i32* %4
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 %35, i32 %36, i32 %37)
%39 = load i32, i32* %3
%40 = and i32 %39, 8388607
%41 = shl i32 %40, 8
%42 = or i32 %41, 12
store i32 %42, i32* %2
%43 = load i32, i32* %2
%44 = ashr i32 %43, 8
%45 = load i32, i32* %3
%46 = and i32 %45, -8388608
%47 = or i32 %44, %46
store i32 %47, i32* %4
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = load i32, i32* %4
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 %48, i32 %49, i32 %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"1 << 0 = %x\0A\00"
@.str.1 = [13 x i8] c"1 << 2 = %x\0A\00"
@.str.2 = [13 x i8] c"0 << 4 = %x\0A\00"
@.str.3 = [14 x i8] c"1 << 31 = %x\0A\00"
@.str.4 = [14 x i8] c"1 << 32 = %x\0A\00"
@.str.5 = [14 x i8] c"4 << -1 = %x\0A\00"
@.str.6 = [14 x i8] c"4 >> -1 = %x\0A\00"
@.str.7 = [14 x i8] c"-1 << 1 = %x\0A\00"
@.str.8 = [14 x i8] c"-1 << 0 = %x\0A\00"
@.str.9 = [13 x i8] c"4 >> 1 = %x\0A\00"
@.str.10 = [13 x i8] c"4 >> 5 = %x\0A\00"
@.str.11 = [23 x i8] c"0x80000000 >> 31 = %x\0A\00"
@.str.12 = [14 x i8] c"-1 >> 2 = %x\0A\00"
@.str.13 = [18 x i8] c"%d - %d = %d(%x)\0A\00"
@.str.14 = [24 x i8] c"a = %x, b = %x, c = %x\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 4)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 0)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 -2147483648)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 poison)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 poison)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 poison)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 -2)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 -1)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 2)
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 0)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0), i32 -1)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 -1)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 -1091119768, i32 -1091119766, i32 -2, i32 -2)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 -153786356, i32 -1091119768, i32 -600728)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 1993697292, i32 -1091119768, i32 -1091119768)
ret i32 0
}