#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("-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    0xf2d(%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    $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    0xf3b(%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
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"-1 << 1 = %x\0A\00"
@.str.7 = [14 x i8] c"-1 << 0 = %x\0A\00"
@.str.8 = [13 x i8] c"4 >> 1 = %x\0A\00"
@.str.9 = [13 x i8] c"4 >> 5 = %x\0A\00"
@.str.10 = [23 x i8] c"0x80000000 >> 31 = %x\0A\00"
@.str.11 = [14 x i8] c"-1 >> 2 = %x\0A\00"
@.str.12 = [18 x i8] c"%d - %d = %d(%x)\0A\00"
@.str.13 = [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 -2)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 2)
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 0)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 -1)
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 -1)
store i32 -1091119768, i32* %3
store i32 -1091119766, i32* %4
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = sub nsw i32 %19, %20
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %22, %23
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %17, i32 %18, i32 %21, i32 %24)
%26 = load i32, i32* %3
%27 = shl i32 %26, 8
%28 = or i32 %27, 12
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = ashr i32 %29, 8
%31 = load i32, i32* %3
%32 = and i32 %31, -16777216
%33 = or i32 %30, %32
store i32 %33, i32* %4
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = load i32, i32* %4
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i32 %34, i32 %35, i32 %36)
%38 = load i32, i32* %3
%39 = and i32 %38, 8388607
%40 = shl i32 %39, 8
%41 = or i32 %40, 12
store i32 %41, i32* %2
%42 = load i32, i32* %2
%43 = ashr i32 %42, 8
%44 = load i32, i32* %3
%45 = and i32 %44, -8388608
%46 = or i32 %43, %45
store i32 %46, i32* %4
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = load i32, i32* %4
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i32 %47, i32 %48, i32 %49)
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"-1 << 1 = %x\0A\00"
@.str.7 = [14 x i8] c"-1 << 0 = %x\0A\00"
@.str.8 = [13 x i8] c"4 >> 1 = %x\0A\00"
@.str.9 = [13 x i8] c"4 >> 5 = %x\0A\00"
@.str.10 = [23 x i8] c"0x80000000 >> 31 = %x\0A\00"
@.str.11 = [14 x i8] c"-1 >> 2 = %x\0A\00"
@.str.12 = [18 x i8] c"%d - %d = %d(%x)\0A\00"
@.str.13 = [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 -2)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 -1)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 2)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 0)
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 -1)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i32 -1)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 -1091119768, i32 -1091119766, i32 -2, i32 -2)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i32 -153786356, i32 -1091119768, i32 -600728)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i32 1993697292, i32 -1091119768, i32 -1091119768)
ret i32 0
}