#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 atoi(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int a, b;
  int a_and_b;
  int a_or_b;
  int a_xor_b;
  int not_a;
  if (argc > 2) {
    a = atoi(argv[1]);
    b = atoi(argv[2]);
  } else {
    a = 017;
    b = 036;
  }
  a_and_b = a & b;
  a_or_b = a | b;
  a_xor_b = a ^ b;
  not_a = ~a & 0x3F;
  printf("a & b:\t%o(oct)\n", a_and_b);
  printf("a | b:\t%o(oct)\n", a_or_b);
  printf("a ^ b:\t%o(oct)\n", a_xor_b);
  printf("~a:\t%o(oct)\n", not_a);
  printf("Press any key to continue . . .");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1175 <main+0x45>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1183 <main+0x53>
movl   $0xf,-0x14(%rbp)
movl   $0x1e,-0x18(%rbp)
mov    -0x14(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
and    $0x3f,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x3,%edi
jl     1152 <main+0x22>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1050 <atoi@plt>
jmp    115c <main+0x2c>
mov    $0xf,%ebx
mov    $0x1e,%eax
mov    %ebx,%esi
and    %eax,%esi
mov    %ebx,%ebp
not    %ebp
mov    %ebx,%r14d
or     %eax,%r14d
xor    %eax,%ebx
and    $0x3f,%ebp
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"a & b:\09%o(oct)\0A\00"
@.str.1 = [16 x i8] c"a | b:\09%o(oct)\0A\00"
@.str.2 = [16 x i8] c"a ^ b:\09%o(oct)\0A\00"
@.str.3 = [13 x i8] c"~a:\09%o(oct)\0A\00"
@.str.4 = [32 x i8] c"Press any key to continue . . .\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 2
br i1 %13, label %14, label %23
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %7
br label %24
23: ; preds = %2
store i32 15, i32* %6
store i32 30, i32* %7
br label %24
24: ; preds = %23, %14
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = and i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = or i32 %28, %29
store i32 %30, i32* %9
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = xor i32 %31, %32
store i32 %33, i32* %10
%34 = load i32, i32* %6
%35 = xor i32 %34, -1
%36 = and i32 %35, 63
store i32 %36, i32* %11
%37 = load i32, i32* %8
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %9
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %10
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %11
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"a & b:\09%o(oct)\0A\00"
@.str.1 = [16 x i8] c"a | b:\09%o(oct)\0A\00"
@.str.2 = [16 x i8] c"a ^ b:\09%o(oct)\0A\00"
@.str.3 = [13 x i8] c"~a:\09%o(oct)\0A\00"
@.str.4 = [32 x i8] c"Press any key to continue . . .\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ %10, %4 ], [ 30, %2 ]
%13 = phi i32 [ %7, %4 ], [ 15, %2 ]
%14 = and i32 %13, %12
%15 = or i32 %13, %12
%16 = xor i32 %13, %12
%17 = and i32 %13, 63
%18 = xor i32 %17, 63
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %14)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%24 = tail call i32 (...) @getchar()
ret i32 0
}