#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*/ displayBits(unsigned int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  unsigned number1;
  unsigned number2;
  unsigned mask;
  unsigned setBits;
  number1 = 65535;
  mask = 1;
  printf("The result of combining the following\n");
  displayBits(number1);
  displayBits(mask);
  printf("using the bitwise AND operator & is\n");
  displayBits(number1 & mask);
  number1 = 15;
  setBits = 241;
  printf("\nThe result of combining the following\n");
  displayBits(number1);
  displayBits(setBits);
  printf("using the bitwise inclusive OR operator | is\n");
  displayBits(number1 | setBits);
  number1 = 139;
  number2 = 199;
  printf("\nThe result of combining the following\n");
  displayBits(number1);
  displayBits(number2);
  printf("using the bitwise exclusive OR operator ^ is\n");
  displayBits(number1 ^ number2);
  number1 = 21845;
  printf("\nThe one's complement of\n");
  displayBits(number1);
  printf("is\n");
  displayBits(~number1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffff,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <displayBits@plt>
mov    -0x10(%rbp),%edi
call   1040 <displayBits@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
and    -0x10(%rbp),%edi
call   1040 <displayBits@plt>
movl   $0xf,-0x8(%rbp)
movl   $0xf1,-0x14(%rbp)
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <displayBits@plt>
mov    -0x14(%rbp),%edi
call   1040 <displayBits@plt>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
or     -0x14(%rbp),%edi
call   1040 <displayBits@plt>
movl   $0x8b,-0x8(%rbp)
movl   $0xc7,-0xc(%rbp)
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <displayBits@plt>
mov    -0xc(%rbp),%edi
call   1040 <displayBits@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
xor    -0xc(%rbp),%edi
call   1040 <displayBits@plt>
movl   $0x5555,-0x8(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <displayBits@plt>
lea    0xe0d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
xor    $0xffffffff,%edi
call   1040 <displayBits@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffff,%edi
call   1040 <displayBits@plt>
mov    $0x1,%edi
call   1040 <displayBits@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <displayBits@plt>
lea    0xef3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0xf,%edi
call   1040 <displayBits@plt>
mov    $0xf1,%edi
call   1040 <displayBits@plt>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
mov    $0xff,%edi
call   1040 <displayBits@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x8b,%edi
call   1040 <displayBits@plt>
mov    $0xc7,%edi
call   1040 <displayBits@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4c,%edi
call   1040 <displayBits@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5555,%edi
call   1040 <displayBits@plt>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffaaaa,%edi
call   1040 <displayBits@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"The result of combining the following\0A\00"
@.str.1 = [37 x i8] c"using the bitwise AND operator & is\0A\00"
@.str.2 = [40 x i8] c"\0AThe result of combining the following\0A\00"
@.str.3 = [46 x i8] c"using the bitwise inclusive OR operator | is\0A\00"
@.str.4 = [46 x i8] c"using the bitwise exclusive OR operator ^ is\0A\00"
@.str.5 = [26 x i8] c"\0AThe one's complement of\0A\00"
@.str.6 = [4 x i8] c"is\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 65535, i32* %2
store i32 1, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @displayBits(i32 %7)
%9 = load i32, i32* %4
%10 = call i32 @displayBits(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = and i32 %12, %13
%15 = call i32 @displayBits(i32 %14)
store i32 15, i32* %2
store i32 241, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = call i32 @displayBits(i32 %17)
%19 = load i32, i32* %5
%20 = call i32 @displayBits(i32 %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = load i32, i32* %5
%24 = or i32 %22, %23
%25 = call i32 @displayBits(i32 %24)
store i32 139, i32* %2
store i32 199, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %2
%28 = call i32 @displayBits(i32 %27)
%29 = load i32, i32* %3
%30 = call i32 @displayBits(i32 %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = xor i32 %32, %33
%35 = call i32 @displayBits(i32 %34)
store i32 21845, i32* %2
%36 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32, i32* %2
%38 = call i32 @displayBits(i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%40 = load i32, i32* %2
%41 = xor i32 %40, -1
%42 = call i32 @displayBits(i32 %41)
ret i32 0
}

LLVM IR (-O2):
@str = [38 x i8] c"The result of combining the following\00"
@str.7 = [36 x i8] c"using the bitwise AND operator & is\00"
@str.9 = [45 x i8] c"using the bitwise inclusive OR operator | is\00"
@str.10 = [39 x i8] c"\0AThe result of combining the following\00"
@str.11 = [45 x i8] c"using the bitwise exclusive OR operator ^ is\00"
@str.12 = [25 x i8] c"\0AThe one's complement of\00"
@str.13 = [3 x i8] c"is\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @displayBits(i32 65535)
%3 = tail call i32 @displayBits(i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @displayBits(i32 1)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @displayBits(i32 15)
%8 = tail call i32 @displayBits(i32 241)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.9, i64 0, i64 0))
%10 = tail call i32 @displayBits(i32 255)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0))
%12 = tail call i32 @displayBits(i32 139)
%13 = tail call i32 @displayBits(i32 199)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.11, i64 0, i64 0))
%15 = tail call i32 @displayBits(i32 76)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.12, i64 0, i64 0))
%17 = tail call i32 @displayBits(i32 21845)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.13, i64 0, i64 0))
%19 = tail call i32 @displayBits(i32 -21846)
ret i32 0
}