#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, ...);
int main() {
  int a = 7;
  int b = 12;
  printf("%d & %d = %d \n", a, b, a & b);
  printf("%d | %d = %d \n", a, b, a | b);
  printf("%d ^ %d = %d \n", a, b, a ^ b);
  printf("~%d = %d \n", a, ~a);
  printf("%d<<3 = %d \n", a, a << 3);
  printf("%d>>3 = %d \n", a, a >> 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0xc,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
or     -0xc(%rbp),%ecx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    -0xc(%rbp),%ecx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
xor    $0xffffffff,%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
shl    $0x3,%edx
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
sar    $0x3,%edx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x7,%esi
mov    $0xc,%edx
mov    $0x4,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x7,%esi
mov    $0xc,%edx
mov    $0xf,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x7,%esi
mov    $0xc,%edx
mov    $0xb,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x7,%esi
mov    $0xfffffff8,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x7,%esi
mov    $0x38,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0x7,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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