#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(void) {
  int i = 10;
  int x = 5;
  x = x & i;
  printf("x & i = %d\n", x);
  x = 5;
  x = x | i;
  printf("x | i = %d\n", x);
  x = 5;
  x = x ^ i;
  printf("x ^ i = %d\n", x);
  x = 5;
  x = x << i;
  printf("x << i = %d\n", x);
  x = 5;
  x = x >> i;
  printf("x >> i = %d\n", x);
  x = 5;
  x = ~i;
  printf("~i = %d\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x1400,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0xfffffff5,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"x & i = %d\0A\00"
@.str.1 = [12 x i8] c"x | i = %d\0A\00"
@.str.2 = [12 x i8] c"x ^ i = %d\0A\00"
@.str.3 = [13 x i8] c"x << i = %d\0A\00"
@.str.4 = [13 x i8] c"x >> i = %d\0A\00"
@.str.5 = [9 x i8] c"~i = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 10, i32* %1
store i32 5, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %1
%5 = and i32 %3, %4
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 5, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = or i32 %8, %9
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %11)
store i32 5, i32* %2
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = xor i32 %13, %14
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %16)
store i32 5, i32* %2
%18 = load i32, i32* %2
%19 = load i32, i32* %1
%20 = shl i32 %18, %19
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %21)
store i32 5, i32* %2
%23 = load i32, i32* %2
%24 = load i32, i32* %1
%25 = ashr i32 %23, %24
store i32 %25, i32* %2
%26 = load i32, i32* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %26)
store i32 5, i32* %2
%28 = load i32, i32* %1
%29 = xor i32 %28, -1
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"x & i = %d\0A\00"
@.str.1 = [12 x i8] c"x | i = %d\0A\00"
@.str.2 = [12 x i8] c"x ^ i = %d\0A\00"
@.str.3 = [13 x i8] c"x << i = %d\0A\00"
@.str.4 = [13 x i8] c"x >> i = %d\0A\00"
@.str.5 = [9 x i8] c"~i = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 15)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 15)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 5120)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 -11)
ret i32 0
}