#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 *, unsigned char, unsigned char, unsigned char);
int /*<<< orphan*/ scanf(char *, unsigned char *, unsigned char *);
int main() {
  unsigned char a = 0;
  unsigned char b = 0;
  scanf("%c%c", &a, &b);
  printf("%x & %x = %x\n", a, b, a & b);
  printf("%x | %x = %x\n", a, b, a | b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movb   $0x0,-0x6(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x5(%rbp),%rsi
lea    -0x6(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x5(%rbp),%dl
mov    -0x6(%rbp),%cl
movzbl -0x5(%rbp),%eax
movzbl -0x6(%rbp),%esi
and    %esi,%eax
lea    0xea3(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
call   1030 <printf@plt>
mov    -0x5(%rbp),%dl
mov    -0x6(%rbp),%cl
movzbl -0x5(%rbp),%eax
movzbl -0x6(%rbp),%esi
or     %esi,%eax
lea    0xe8c(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x7(%rsp)
movb   $0x0,0x6(%rsp)
lea    0xece(%rip),%rdi
lea    0x7(%rsp),%rsi
lea    0x6(%rsp),%rdx
call   1040 <scanf@plt>
movzbl 0x7(%rsp),%esi
movzbl 0x6(%rsp),%edx
mov    %edx,%ecx
and    %esi,%ecx
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
movzbl 0x7(%rsp),%esi
movzbl 0x6(%rsp),%edx
mov    %edx,%ecx
or     %esi,%ecx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%c\00"
@.str.1 = [14 x i8] c"%x & %x = %x\0A\00"
@.str.2 = [14 x i8] c"%x | %x = %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
store i8 0, i8* %3
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3)
%5 = load i8, i8* %2
%6 = load i8, i8* %3
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = and i32 %8, %10
%12 = trunc i32 %11 to i8
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %5, i8 zeroext %6, i8 zeroext %12)
%14 = load i8, i8* %2
%15 = load i8, i8* %3
%16 = load i8, i8* %2
%17 = zext i8 %16 to i32
%18 = load i8, i8* %3
%19 = zext i8 %18 to i32
%20 = or i32 %17, %19
%21 = trunc i32 %20 to i8
%22 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %14, i8 zeroext %15, i8 zeroext %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%c\00"
@.str.1 = [14 x i8] c"%x & %x = %x\0A\00"
@.str.2 = [14 x i8] c"%x | %x = %x\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
store i8 0, i8* %1
store i8 0, i8* %2
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%4 = load i8, i8* %1
%5 = load i8, i8* %2
%6 = and i8 %5, %4
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %4, i8 zeroext %5, i8 zeroext %6)
%8 = load i8, i8* %1
%9 = load i8, i8* %2
%10 = or i8 %9, %8
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %8, i8 zeroext %9, i8 zeroext %10)
ret i32 0
}