#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int v, p, b, bit;
  scanf("%d", &b);
  while (v != 0 && v != 1)
    scanf("%d", &v);
  do {
    scanf("%d", &p);
  } while (p < 0 || p > 7);
  if (!v) {
    bit = ~(1 << p);
    printf("%d \n", (b & bit));
  } else {
    bit = 1 << p;
    printf("%d \n", (b | bit));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     1158 <main+0x38>
cmpl   $0x1,-0x8(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1168 <main+0x48>
jmp    117d <main+0x5d>
lea    0xe91(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    113f <main+0x1f>
jmp    1182 <main+0x62>
lea    0xe77(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x16(%rbp)
jl     11ab <main+0x8b>
cmpl   $0x7,-0xc(%rbp)
setg   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    1182 <main+0x62>
cmpl   $0x0,-0x8(%rbp)
jne    11e7 <main+0xc7>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
and    -0x14(%rbp),%esi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
or     -0x14(%rbp),%esi
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
ja     1140 <main+0x20>
lea    0xea7(%rip),%r14
lea    0x14(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%ecx
cmp    $0x7,%ecx
ja     1160 <main+0x40>
mov    $0x1,%esi
shl    %cl,%esi
cmpl   $0x0,0x10(%rsp)
je     1188 <main+0x68>
or     0xc(%rsp),%esi
jmp    118e <main+0x6e>
not    %esi
and    0xc(%rsp),%esi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 1
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ false, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
17: ; preds = %13
br label %18
18: ; preds = %26, %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %20
20: ; preds = %18
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 7
br label %26
26: ; preds = %23, %20
%27 = phi i1 [ true, %20 ], [ %25, %23 ]
br i1 %27, label %18, label %28
28: ; preds = %26
%29 = load i32, i32* %2
%30 = icmp ne i32 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %28
%32 = load i32, i32* %3
%33 = shl i32 1, %32
%34 = xor i32 %33, -1
store i32 %34, i32* %5
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = and i32 %35, %36
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %46
39: ; preds = %28
%40 = load i32, i32* %3
%41 = shl i32 1, %40
store i32 %41, i32* %5
%42 = load i32, i32* %4
%43 = load i32, i32* %5
%44 = or i32 %42, %43
%45 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %39, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %8
8: ; preds = %0, %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp ult i32 %10, 2
br i1 %11, label %12, label %8
12: ; preds = %8, %12
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = icmp ugt i32 %14, 7
br i1 %15, label %12, label %16
16: ; preds = %12
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 0
%19 = shl nuw nsw i32 1, %14
br i1 %18, label %20, label %24
20: ; preds = %16
%21 = xor i32 %19, -1
%22 = load i32, i32* %3
%23 = and i32 %22, %21
br label %27
24: ; preds = %16
%25 = load i32, i32* %3
%26 = or i32 %25, %19
br label %27
27: ; preds = %24, %20
%28 = phi i32 [ %26, %24 ], [ %23, %20 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %28)
ret i32 0
}