#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 /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ scanf(char *, size_t *, size_t *);
int main() {
  size_t n, f;
  int b = 0;
  scanf("%zu %zu", &n, &f);
  for (size_t i = 0; !(i >> n); ++i) {
    if (!(f & 1 << i))
      continue;
    if (b)
      printf(" | ");
    b = 1;
    printf(i & 1 ? "~(x0" : "~(~x0");
    for (size_t j = 1; j < n; ++j)
      if (i & 1 << j)
        printf(" | ~x%zu", j);
      else
        printf(" | x%zu", j);
    putchar(41);
  }
  putchar(10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    %cl,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1183 <main+0x53>
jmp    127e <main+0x14e>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
jne    11a9 <main+0x79>
jmp    126d <main+0x13d>
cmpl   $0x0,-0x1c(%rbp)
je     11c1 <main+0x91>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x28(%rbp),%rcx
and    $0x1,%rcx
lea    0xe3a(%rip),%rdi
lea    0xe2e(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1263 <main+0x133>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     123b <main+0x10b>
mov    -0x30(%rbp),%rsi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    124d <main+0x11d>
mov    -0x30(%rbp),%rsi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1252 <main+0x122>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11f5 <main+0xc5>
mov    $0x29,%edi
call   1030 <putchar@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1162 <main+0x32>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <scanf@plt>
lea    0xeb6(%rip),%r12
lea    0xeaa(%rip),%r13
lea    0xeb7(%rip),%rbp
lea    0xea7(%rip),%r14
xor    %r15d,%r15d
xor    %eax,%eax
jmp    11a2 <main+0x72>
nopw   0x0(%rax,%rax,1)
mov    $0x29,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
add    $0x1,%r15
mov    0x8(%rsp),%cl
mov    %r15,%rdx
shr    %cl,%rdx
test   %rdx,%rdx
jne    1221 <main+0xf1>
mov    $0x1,%edx
mov    %r15d,%ecx
shl    %cl,%edx
movslq %edx,%rcx
test   %rcx,0x10(%rsp)
je     118f <main+0x5f>
test   %eax,%eax
je     11c8 <main+0x98>
lea    0xe47(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x1,%r15b
mov    %r13,%rdi
cmove  %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x2,0x8(%rsp)
jb     1180 <main+0x50>
mov    $0x1,%ebx
jmp    1209 <main+0xd9>
nopl   0x0(%rax)
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    0x8(%rsp),%rbx
jae    1180 <main+0x50>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
cltq
mov    %rbp,%rdi
test   %rax,%r15
je     11f0 <main+0xc0>
mov    %r14,%rdi
jmp    11f0 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%zu %zu\00"
@.str.1 = [4 x i8] c" | \00"
@.str.2 = [5 x i8] c"~(x0\00"
@.str.3 = [6 x i8] c"~(~x0\00"
@.str.4 = [9 x i8] c" | ~x%zu\00"
@.str.5 = [8 x i8] c" | x%zu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %2, i64* %3)
store i64 0, i64* %5
br label %8
8: ; preds = %59, %0
%9 = load i64, i64* %5
%10 = load i64, i64* %2
%11 = lshr i64 %9, %10
%12 = icmp ne i64 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %62
14: ; preds = %8
%15 = load i64, i64* %3
%16 = load i64, i64* %5
%17 = trunc i64 %16 to i32
%18 = shl i32 1, %17
%19 = sext i32 %18 to i64
%20 = and i64 %15, %19
%21 = icmp ne i64 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %14
br label %59
23: ; preds = %14
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
store i32 1, i32* %4
%29 = load i64, i64* %5
%30 = and i64 %29, 1
%31 = icmp ne i64 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%34 = call i32 (i8*, ...) @printf(i8* %33)
store i64 1, i64* %6
br label %35
35: ; preds = %54, %28
%36 = load i64, i64* %6
%37 = load i64, i64* %2
%38 = icmp ult i64 %36, %37
br i1 %38, label %39, label %57
39: ; preds = %35
%40 = load i64, i64* %5
%41 = load i64, i64* %6
%42 = trunc i64 %41 to i32
%43 = shl i32 1, %42
%44 = sext i32 %43 to i64
%45 = and i64 %40, %44
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %39
%48 = load i64, i64* %6
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i64 %48)
br label %53
50: ; preds = %39
%51 = load i64, i64* %6
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i64 %51)
br label %53
53: ; preds = %50, %47
br label %54
54: ; preds = %53
%55 = load i64, i64* %6
%56 = add i64 %55, 1
store i64 %56, i64* %6
br label %35
57: ; preds = %35
%58 = call i32 @putchar(i32 41)
br label %59
59: ; preds = %57, %22
%60 = load i64, i64* %5
%61 = add i64 %60, 1
store i64 %61, i64* %5
br label %8
62: ; preds = %8
%63 = call i32 @putchar(i32 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%zu %zu\00"
@.str.1 = [4 x i8] c" | \00"
@.str.2 = [5 x i8] c"~(x0\00"
@.str.3 = [6 x i8] c"~(~x0\00"
@.str.4 = [9 x i8] c" | ~x%zu\00"
@.str.5 = [8 x i8] c" | x%zu\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
br label %8
6: ; preds = %42
%7 = call i32 @putchar(i32 10)
ret i32 0
8: ; preds = %0, %42
%9 = phi i64 [ 0, %0 ], [ %44, %42 ]
%10 = phi i32 [ 0, %0 ], [ %43, %42 ]
%11 = load i64, i64* %2
%12 = trunc i64 %9 to i32
%13 = shl nuw i32 1, %12
%14 = sext i32 %13 to i64
%15 = and i64 %11, %14
%16 = icmp eq i64 %15, 0
br i1 %16, label %42, label %17
17: ; preds = %8
%18 = icmp eq i32 %10, 0
br i1 %18, label %21, label %19
19: ; preds = %17
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
%22 = and i64 %9, 1
%23 = icmp eq i64 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %24)
%26 = load i64, i64* %1
%27 = icmp ugt i64 %26, 1
br i1 %27, label %30, label %28
28: ; preds = %30, %21
%29 = call i32 @putchar(i32 41)
br label %42
30: ; preds = %21, %30
%31 = phi i64 [ %39, %30 ], [ 1, %21 ]
%32 = trunc i64 %31 to i32
%33 = shl nuw i32 1, %32
%34 = sext i32 %33 to i64
%35 = and i64 %9, %34
%36 = icmp eq i64 %35, 0
%37 = select i1 %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %37, i64 %31)
%39 = add nuw i64 %31, 1
%40 = load i64, i64* %1
%41 = icmp ult i64 %39, %40
br i1 %41, label %30, label %28
42: ; preds = %8, %28
%43 = phi i32 [ 1, %28 ], [ %10, %8 ]
%44 = add i64 %9, 1
%45 = load i64, i64* %1
%46 = lshr i64 %44, %45
%47 = icmp eq i64 %46, 0
br i1 %47, label %8, label %6
}