#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int);
int main(void) {
  unsigned int num1 = 0x66;
  unsigned int num2 = 0x39;
  unsigned int bit_res1 = num1 & num2;
  unsigned int log_res1 = num1 && num2;
  unsigned int bit_res2 = num1 | num2;
  unsigned int log_res2 = num1 || num2;
  unsigned int bit_res3 = ~num1 | ~num2;
  unsigned int log_res3 = !num1 || !num2;
  unsigned int bit_res4 = num1 & !num2;
  unsigned int log_res4 = num1 && ~num2;
  printf("(bitwise)  0x%x  &  0x%x = 0x%x\n", num1, num2, bit_res1);
  printf("(logical)  0x%x &&  0x%x = 0x%x\n", num1, num2, log_res1);
  printf("(bitwise)  0x%x  |  0x%x = 0x%x\n", num1, num2, bit_res2);
  printf("(logical)  0x%x ||  0x%x = 0x%x\n", num1, num2, log_res2);
  printf("(bitwise) ~0x%x |  ~0x%x = 0x%x\n", num1, num2, bit_res3);
  printf("(logical) !0x%x || !0x%x = 0x%x\n", num1, num2, log_res3);
  printf("(bitwise)  0x%x  & !0x%x = 0x%x\n", num1, num2, bit_res4);
  printf("(logical)  0x%x && ~0x%x = 0x%x\n", num1, num2, log_res4);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x66,-0x8(%rbp)
movl   $0x39,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x2d(%rbp)
je     114f <main+0x3f>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x2e(%rbp)
jne    117c <main+0x6c>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0x2e(%rbp)
mov    -0x2e(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x2f(%rbp)
je     11b3 <main+0xa3>
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x2f(%rbp)
mov    -0x2f(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
cmpl   $0x0,-0xc(%rbp)
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x30(%rbp)
je     11f4 <main+0xe4>
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x30(%rbp)
mov    -0x30(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%ecx
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xe39(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
mov    $0x20,%ecx
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
mov    $0x7f,%ecx
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
mov    $0xffffffdf,%ecx
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
xor    %ecx,%ecx
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    $0x66,%esi
mov    $0x39,%edx
mov    $0x1,%ecx
call   1030 <printf@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"(bitwise) 0x%x & 0x%x = 0x%x\0A\00"
@.str.1 = [33 x i8] c"(logical) 0x%x && 0x%x = 0x%x\0A\00"
@.str.2 = [33 x i8] c"(bitwise) 0x%x | 0x%x = 0x%x\0A\00"
@.str.3 = [33 x i8] c"(logical) 0x%x || 0x%x = 0x%x\0A\00"
@.str.4 = [33 x i8] c"(bitwise) ~0x%x | ~0x%x = 0x%x\0A\00"
@.str.5 = [33 x i8] c"(logical) !0x%x || !0x%x = 0x%x\0A\00"
@.str.6 = [33 x i8] c"(bitwise) 0x%x & !0x%x = 0x%x\0A\00"
@.str.7 = [33 x i8] c"(logical) 0x%x && ~0x%x = 0x%x\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store i32 102, i32* %2
store i32 57, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = and i32 %12, %13
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 0
br label %20
20: ; preds = %17, %0
%21 = phi i1 [ false, %0 ], [ %19, %17 ]
%22 = zext i1 %21 to i32
store i32 %22, i32* %5
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = or i32 %23, %24
store i32 %25, i32* %6
%26 = load i32, i32* %2
%27 = icmp ne i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %20
%29 = load i32, i32* %3
%30 = icmp ne i32 %29, 0
br label %31
31: ; preds = %28, %20
%32 = phi i1 [ true, %20 ], [ %30, %28 ]
%33 = zext i1 %32 to i32
store i32 %33, i32* %7
%34 = load i32, i32* %2
%35 = xor i32 %34, -1
%36 = load i32, i32* %3
%37 = xor i32 %36, -1
%38 = or i32 %35, %37
store i32 %38, i32* %8
%39 = load i32, i32* %2
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %31
%42 = load i32, i32* %3
%43 = icmp ne i32 %42, 0
%44 = xor i1 %43, true
br label %45
45: ; preds = %41, %31
%46 = phi i1 [ true, %31 ], [ %44, %41 ]
%47 = zext i1 %46 to i32
store i32 %47, i32* %9
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = icmp ne i32 %49, 0
%51 = xor i1 %50, true
%52 = zext i1 %51 to i32
%53 = and i32 %48, %52
store i32 %53, i32* %10
%54 = load i32, i32* %2
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %45
%57 = load i32, i32* %3
%58 = xor i32 %57, -1
%59 = icmp ne i32 %58, 0
br label %60
60: ; preds = %56, %45
%61 = phi i1 [ false, %45 ], [ %59, %56 ]
%62 = zext i1 %61 to i32
store i32 %62, i32* %11
%63 = load i32, i32* %2
%64 = load i32, i32* %3
%65 = load i32, i32* %4
%66 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %63, i32 %64, i32 %65)
%67 = load i32, i32* %2
%68 = load i32, i32* %3
%69 = load i32, i32* %5
%70 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %67, i32 %68, i32 %69)
%71 = load i32, i32* %2
%72 = load i32, i32* %3
%73 = load i32, i32* %6
%74 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %71, i32 %72, i32 %73)
%75 = load i32, i32* %2
%76 = load i32, i32* %3
%77 = load i32, i32* %7
%78 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %75, i32 %76, i32 %77)
%79 = load i32, i32* %2
%80 = load i32, i32* %3
%81 = load i32, i32* %8
%82 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %79, i32 %80, i32 %81)
%83 = load i32, i32* %2
%84 = load i32, i32* %3
%85 = load i32, i32* %9
%86 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %83, i32 %84, i32 %85)
%87 = load i32, i32* %2
%88 = load i32, i32* %3
%89 = load i32, i32* %10
%90 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %87, i32 %88, i32 %89)
%91 = load i32, i32* %2
%92 = load i32, i32* %3
%93 = load i32, i32* %11
%94 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 %91, i32 %92, i32 %93)
%95 = load i32, i32* @EXIT_SUCCESS
ret i32 %95
}

LLVM IR (-O2):
@.str = [33 x i8] c"(bitwise) 0x%x & 0x%x = 0x%x\0A\00"
@.str.1 = [33 x i8] c"(logical) 0x%x && 0x%x = 0x%x\0A\00"
@.str.2 = [33 x i8] c"(bitwise) 0x%x | 0x%x = 0x%x\0A\00"
@.str.3 = [33 x i8] c"(logical) 0x%x || 0x%x = 0x%x\0A\00"
@.str.4 = [33 x i8] c"(bitwise) ~0x%x | ~0x%x = 0x%x\0A\00"
@.str.5 = [33 x i8] c"(logical) !0x%x || !0x%x = 0x%x\0A\00"
@.str.6 = [33 x i8] c"(bitwise) 0x%x & !0x%x = 0x%x\0A\00"
@.str.7 = [33 x i8] c"(logical) 0x%x && ~0x%x = 0x%x\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 102, i32 57, i32 32)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 102, i32 57, i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 102, i32 57, i32 127)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 102, i32 57, i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 102, i32 57, i32 -33)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 102, i32 57, i32 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 102, i32 57, i32 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 102, i32 57, i32 1)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}