#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 n, v, p;
  scanf("%d", &n);
  scanf("%d", &v);
  while (v < 0 || v > 1)
    scanf("%d", &v);
  scanf("%d", &p);
  while (p < 0 || p > 7)
    scanf("%d", &p);
  if (v == 1) {
    n = (1 << p) | n;
  }
  if (v == 0) {
    n = (~(1 << p)) & n;
  }
  printf("%d", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jl     1168 <main+0x48>
cmpl   $0x1,-0xc(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1178 <main+0x58>
jmp    118d <main+0x6d>
lea    0xe81(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114f <main+0x2f>
lea    0xe6c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
jl     11b6 <main+0x96>
cmpl   $0x7,-0x10(%rbp)
setg   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11c6 <main+0xa6>
jmp    11db <main+0xbb>
lea    0xe33(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
jmp    119d <main+0x7d>
cmpl   $0x1,-0xc(%rbp)
jne    11f5 <main+0xd5>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1212 <main+0xf2>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xde4(%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),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cmpl   $0x2,0x10(%rsp)
jb     1172 <main+0x52>
lea    0xeaa(%rip),%r14
lea    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
ja     1160 <main+0x40>
lea    0xe87(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x8,%eax
jb     11b4 <main+0x94>
lea    0xe6d(%rip),%r14
lea    0x14(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x7,%eax
ja     11a0 <main+0x80>
mov    0x10(%rsp),%ecx
test   %ecx,%ecx
je     11ca <main+0xaa>
cmp    $0x1,%ecx
jne    11d7 <main+0xb7>
mov    0xc(%rsp),%esi
bts    %eax,%esi
jmp    11d1 <main+0xb1>
mov    0xc(%rsp),%esi
btr    %eax,%esi
mov    %esi,0xc(%rsp)
jmp    11db <main+0xbb>
mov    0xc(%rsp),%esi
lea    0xe1e(%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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 1
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %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* %3)
br label %7
17: ; preds = %13
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %19
19: ; preds = %27, %17
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 7
br label %25
25: ; preds = %22, %19
%26 = phi i1 [ true, %19 ], [ %24, %22 ]
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %19
29: ; preds = %25
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load i32, i32* %4
%34 = shl i32 1, %33
%35 = load i32, i32* %2
%36 = or i32 %34, %35
store i32 %36, i32* %2
br label %37
37: ; preds = %32, %29
%38 = load i32, i32* %3
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load i32, i32* %4
%42 = shl i32 1, %41
%43 = xor i32 %42, -1
%44 = load i32, i32* %2
%45 = and i32 %43, %44
store i32 %45, i32* %2
br label %46
46: ; preds = %40, %37
%47 = load i32, i32* %2
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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* %1)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp ugt i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %0, %11
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = icmp ugt i32 %13, 1
br i1 %14, label %11, label %15
15: ; preds = %11, %0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = icmp ugt i32 %17, 7
br i1 %18, label %19, label %23
19: ; preds = %15, %19
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = icmp ugt i32 %21, 7
br i1 %22, label %19, label %23
23: ; preds = %19, %15
%24 = phi i32 [ %17, %15 ], [ %21, %19 ]
%25 = load i32, i32* %2
switch i32 %25, label %26 [
i32 1, label %28
i32 0, label %32
]
26: ; preds = %23
%27 = load i32, i32* %1
br label %37
28: ; preds = %23
%29 = shl nuw nsw i32 1, %24
%30 = load i32, i32* %1
%31 = or i32 %30, %29
store i32 %31, i32* %1
br label %37
32: ; preds = %23
%33 = shl nuw nsw i32 1, %24
%34 = xor i32 %33, -1
%35 = load i32, i32* %1
%36 = and i32 %35, %34
store i32 %36, i32* %1
br label %37
37: ; preds = %26, %28, %32
%38 = phi i32 [ %27, %26 ], [ %31, %28 ], [ %36, %32 ]
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %38)
ret i32 0
}