#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 bool_and(int, int);
int bool_or(int, int);
int bool_xor(int, int);
int /*<<< orphan*/ printf(char *, char);
int main() {
  int a = 0xaa;
  int b = 0x55;
  printf("aa | 55 = %x\n", bool_or(a, b));
  printf("aa xor 55 = %x\n", bool_xor(a, b));
  printf("aa and 55 = %x\n", bool_and(a, b));
  a = 0b0101;
  b = 0b1011;
  printf("5 | b = %x\n", bool_or(a, b));
  printf("5 xor b = %x\n", bool_xor(a, b));
  printf("5 and b = %x\n", bool_and(a, b));
  char c = 0x80;
  printf("0x80 >> 1 = %x\n", c >> 1);
  printf("0x80 >> 2 = %x\n", c >> 2);
  printf("0x80 >> 3 = %x\n", c >> 3);
  printf("0x80 >> 6 = %x\n", c >> 6);
  printf("0x80 >> 7 = %x\n", c >> 7);
  printf("0x80 >> 1 = %d\n", c >> 1);
  printf("0x80 >> 2 = %d\n", c >> 2);
  printf("0x80 >> 3 = %d\n", c >> 3);
  printf("0x80 >> 6 = %d\n", c >> 6);
  printf("0x80 >> 7 = %d\n", c >> 7);
  c = 0x40;
  printf("0x40 >> 1 = %x\n", c >> 1);
  printf("0x40 >> 2 = %x\n", c >> 2);
  printf("0x40 >> 3 = %x\n", c >> 3);
  printf("0x40 >> 6 = %x\n", c >> 6);
  printf("0x40 >> 7 = %x\n", c >> 7);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xaa,-0x8(%rbp)
movl   $0x55,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <bool_or@plt>
lea    0xe91(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <bool_xor@plt>
lea    0xe85(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <bool_and@plt>
lea    0xe7b(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
movl   $0xb,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <bool_or@plt>
lea    0xe63(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <bool_xor@plt>
lea    0xe55(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <bool_and@plt>
lea    0xe49(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movb   $0x80,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
sar    $0x1,%eax
lea    0xe3d(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x2,%eax
lea    0xe37(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x3,%eax
lea    0xe31(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x6,%eax
lea    0xe2b(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x7,%eax
lea    0xe25(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x1,%eax
lea    0xe1f(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x2,%eax
lea    0xe19(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x3,%eax
lea    0xe13(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x6,%eax
lea    0xe0d(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x7,%eax
lea    0xe07(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movb   $0x40,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
sar    $0x1,%eax
lea    0xdfd(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x2,%eax
lea    0xdf7(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x3,%eax
lea    0xdf1(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x6,%eax
lea    0xdeb(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
movsbl -0xd(%rbp),%eax
sar    $0x7,%eax
lea    0xde5(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xaa,%edi
mov    $0x55,%esi
call   1040 <bool_or@plt>
movsbl %al,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0xaa,%edi
mov    $0x55,%esi
call   1050 <bool_xor@plt>
movsbl %al,%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    $0xaa,%edi
mov    $0x55,%esi
call   1060 <bool_and@plt>
movsbl %al,%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0xb,%esi
call   1040 <bool_or@plt>
movsbl %al,%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0xb,%esi
call   1050 <bool_xor@plt>
movsbl %al,%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0xb,%esi
call   1060 <bool_and@plt>
movsbl %al,%esi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0xffffffc0,%esi
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0xffffffe0,%esi
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0xfffffff0,%esi
call   1030 <printf@plt>
lea    0xe57(%rip),%rdi
mov    $0xfffffffe,%esi
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0xffffffc0,%esi
call   1030 <printf@plt>
lea    0xe54(%rip),%rdi
mov    $0xffffffe0,%esi
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
mov    $0xfffffff0,%esi
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0xfffffffe,%esi
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
mov    $0x20,%esi
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xe4c(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"aa | 55 = %x\0A\00"
@.str.1 = [16 x i8] c"aa xor 55 = %x\0A\00"
@.str.2 = [16 x i8] c"aa and 55 = %x\0A\00"
@.str.3 = [12 x i8] c"5 | b = %x\0A\00"
@.str.4 = [14 x i8] c"5 xor b = %x\0A\00"
@.str.5 = [14 x i8] c"5 and b = %x\0A\00"
@.str.6 = [16 x i8] c"0x80 >> 1 = %x\0A\00"
@.str.7 = [16 x i8] c"0x80 >> 2 = %x\0A\00"
@.str.8 = [16 x i8] c"0x80 >> 3 = %x\0A\00"
@.str.9 = [16 x i8] c"0x80 >> 6 = %x\0A\00"
@.str.10 = [16 x i8] c"0x80 >> 7 = %x\0A\00"
@.str.11 = [16 x i8] c"0x80 >> 1 = %d\0A\00"
@.str.12 = [16 x i8] c"0x80 >> 2 = %d\0A\00"
@.str.13 = [16 x i8] c"0x80 >> 3 = %d\0A\00"
@.str.14 = [16 x i8] c"0x80 >> 6 = %d\0A\00"
@.str.15 = [16 x i8] c"0x80 >> 7 = %d\0A\00"
@.str.16 = [16 x i8] c"0x40 >> 1 = %x\0A\00"
@.str.17 = [16 x i8] c"0x40 >> 2 = %x\0A\00"
@.str.18 = [16 x i8] c"0x40 >> 3 = %x\0A\00"
@.str.19 = [16 x i8] c"0x40 >> 6 = %x\0A\00"
@.str.20 = [16 x i8] c"0x40 >> 7 = %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 170, i32* %2
store i32 85, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @bool_or(i32 %5, i32 %6)
%8 = trunc i32 %7 to i8
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @bool_xor(i32 %10, i32 %11)
%13 = trunc i32 %12 to i8
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8 signext %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @bool_and(i32 %15, i32 %16)
%18 = trunc i32 %17 to i8
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8 signext %18)
store i32 5, i32* %2
store i32 11, i32* %3
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i32 @bool_or(i32 %20, i32 %21)
%23 = trunc i32 %22 to i8
%24 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8 signext %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 @bool_xor(i32 %25, i32 %26)
%28 = trunc i32 %27 to i8
%29 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8 signext %28)
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = call i32 @bool_and(i32 %30, i32 %31)
%33 = trunc i32 %32 to i8
%34 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8 signext %33)
store i8 -128, i8* %4
%35 = load i8, i8* %4
%36 = sext i8 %35 to i32
%37 = ashr i32 %36, 1
%38 = trunc i32 %37 to i8
%39 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8 signext %38)
%40 = load i8, i8* %4
%41 = sext i8 %40 to i32
%42 = ashr i32 %41, 2
%43 = trunc i32 %42 to i8
%44 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8 signext %43)
%45 = load i8, i8* %4
%46 = sext i8 %45 to i32
%47 = ashr i32 %46, 3
%48 = trunc i32 %47 to i8
%49 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8 signext %48)
%50 = load i8, i8* %4
%51 = sext i8 %50 to i32
%52 = ashr i32 %51, 6
%53 = trunc i32 %52 to i8
%54 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8 signext %53)
%55 = load i8, i8* %4
%56 = sext i8 %55 to i32
%57 = ashr i32 %56, 7
%58 = trunc i32 %57 to i8
%59 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8 signext %58)
%60 = load i8, i8* %4
%61 = sext i8 %60 to i32
%62 = ashr i32 %61, 1
%63 = trunc i32 %62 to i8
%64 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8 signext %63)
%65 = load i8, i8* %4
%66 = sext i8 %65 to i32
%67 = ashr i32 %66, 2
%68 = trunc i32 %67 to i8
%69 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8 signext %68)
%70 = load i8, i8* %4
%71 = sext i8 %70 to i32
%72 = ashr i32 %71, 3
%73 = trunc i32 %72 to i8
%74 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8 signext %73)
%75 = load i8, i8* %4
%76 = sext i8 %75 to i32
%77 = ashr i32 %76, 6
%78 = trunc i32 %77 to i8
%79 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8 signext %78)
%80 = load i8, i8* %4
%81 = sext i8 %80 to i32
%82 = ashr i32 %81, 7
%83 = trunc i32 %82 to i8
%84 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i8 signext %83)
store i8 64, i8* %4
%85 = load i8, i8* %4
%86 = sext i8 %85 to i32
%87 = ashr i32 %86, 1
%88 = trunc i32 %87 to i8
%89 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), i8 signext %88)
%90 = load i8, i8* %4
%91 = sext i8 %90 to i32
%92 = ashr i32 %91, 2
%93 = trunc i32 %92 to i8
%94 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i8 signext %93)
%95 = load i8, i8* %4
%96 = sext i8 %95 to i32
%97 = ashr i32 %96, 3
%98 = trunc i32 %97 to i8
%99 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8 signext %98)
%100 = load i8, i8* %4
%101 = sext i8 %100 to i32
%102 = ashr i32 %101, 6
%103 = trunc i32 %102 to i8
%104 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i8 signext %103)
%105 = load i8, i8* %4
%106 = sext i8 %105 to i32
%107 = ashr i32 %106, 7
%108 = trunc i32 %107 to i8
%109 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8 signext %108)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"aa | 55 = %x\0A\00"
@.str.1 = [16 x i8] c"aa xor 55 = %x\0A\00"
@.str.2 = [16 x i8] c"aa and 55 = %x\0A\00"
@.str.3 = [12 x i8] c"5 | b = %x\0A\00"
@.str.4 = [14 x i8] c"5 xor b = %x\0A\00"
@.str.5 = [14 x i8] c"5 and b = %x\0A\00"
@.str.6 = [16 x i8] c"0x80 >> 1 = %x\0A\00"
@.str.7 = [16 x i8] c"0x80 >> 2 = %x\0A\00"
@.str.8 = [16 x i8] c"0x80 >> 3 = %x\0A\00"
@.str.9 = [16 x i8] c"0x80 >> 6 = %x\0A\00"
@.str.10 = [16 x i8] c"0x80 >> 7 = %x\0A\00"
@.str.11 = [16 x i8] c"0x80 >> 1 = %d\0A\00"
@.str.12 = [16 x i8] c"0x80 >> 2 = %d\0A\00"
@.str.13 = [16 x i8] c"0x80 >> 3 = %d\0A\00"
@.str.14 = [16 x i8] c"0x80 >> 6 = %d\0A\00"
@.str.15 = [16 x i8] c"0x80 >> 7 = %d\0A\00"
@.str.16 = [16 x i8] c"0x40 >> 1 = %x\0A\00"
@.str.17 = [16 x i8] c"0x40 >> 2 = %x\0A\00"
@.str.18 = [16 x i8] c"0x40 >> 3 = %x\0A\00"
@.str.19 = [16 x i8] c"0x40 >> 6 = %x\0A\00"
@.str.20 = [16 x i8] c"0x40 >> 7 = %x\0A\00"
define i32 @main() {
%1 = tail call i32 @bool_or(i32 170, i32 85)
%2 = trunc i32 %1 to i8
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%4 = tail call i32 @bool_xor(i32 170, i32 85)
%5 = trunc i32 %4 to i8
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8 signext %5)
%7 = tail call i32 @bool_and(i32 170, i32 85)
%8 = trunc i32 %7 to i8
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8 signext %8)
%10 = tail call i32 @bool_or(i32 5, i32 11)
%11 = trunc i32 %10 to i8
%12 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8 signext %11)
%13 = tail call i32 @bool_xor(i32 5, i32 11)
%14 = trunc i32 %13 to i8
%15 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8 signext %14)
%16 = tail call i32 @bool_and(i32 5, i32 11)
%17 = trunc i32 %16 to i8
%18 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8 signext %17)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8 signext -64)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8 signext -32)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8 signext -16)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8 signext -2)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8 signext -1)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8 signext -64)
%25 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8 signext -32)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8 signext -16)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8 signext -2)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), i8 signext -1)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0), i8 signext 32)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i8 signext 16)
%31 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8 signext 8)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i8 signext 1)
%33 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8 signext 0)
ret i32 0
}