#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, ...);
void main() {
  int a = 49, b = 38, c;
  printf("a = 0x%x = %d, b = 0x%x = %d\n", a, a, b, b);
  c = a & b;
  printf("a & b = 0x%x = %d\n", c, c);
  c = a | b;
  printf("a | b = 0x%x = %d\n", c, c);
  c = a ^ b;
  printf("a ^ b = 0x%x = %d\n", c, c);
  c = ~a;
  printf("~a = 0x%x = %d\n", c, c);
  c = a << 1;
  printf("a << 1 = 0x%x = %d\n", c, c);
  c = a >> 1;
  printf("a >> 1 = 0x%x = %d\n", c, c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x31,-0x4(%rbp)
movl   $0x26,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x31,%esi
mov    $0x31,%edx
mov    $0x26,%ecx
mov    $0x26,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x20,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x37,%esi
mov    $0x37,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x17,%esi
mov    $0x17,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0xffffffce,%esi
mov    $0xffffffce,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x62,%esi
mov    $0x62,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x18,%esi
mov    $0x18,%edx
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [30 x i8] c"a = 0x%x = %d, b = 0x%x = %d\0A\00"
@.str.1 = [19 x i8] c"a & b = 0x%x = %d\0A\00"
@.str.2 = [19 x i8] c"a | b = 0x%x = %d\0A\00"
@.str.3 = [19 x i8] c"a ^ b = 0x%x = %d\0A\00"
@.str.4 = [16 x i8] c"~a = 0x%x = %d\0A\00"
@.str.5 = [20 x i8] c"a << 1 = 0x%x = %d\0A\00"
@.str.6 = [20 x i8] c"a >> 1 = 0x%x = %d\0A\00"
define void @main() {
%1 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 49, i32 49, i32 38, i32 38)
%2 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 32, i32 32)
%3 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 55, i32 55)
%4 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 23, i32 23)
%5 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 -50, i32 -50)
%6 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 98, i32 98)
%7 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 24, i32 24)
ret void
}