#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 *, int *);
int main() {
  int n, v, p;
  scanf("%d %d %d", &n, &v, &p);
  int mask = 1 << p;
  if (v == 1) {
    n = mask | n;
  } else if (v == 0) {
    if (((n >> p) & 1) == 1)
      n = mask ^ 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
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    116c <main+0x4c>
mov    -0x14(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    119d <main+0x7d>
cmpl   $0x0,-0xc(%rbp)
jne    1198 <main+0x78>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1193 <main+0x73>
mov    -0x14(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1198 <main+0x78>
jmp    119d <main+0x7d>
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%cl
mov    $0x1,%eax
shl    %cl,%eax
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
je     1163 <main+0x43>
cmp    $0x1,%ecx
jne    1173 <main+0x53>
or     0xc(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    %eax,%esi
jmp    1177 <main+0x57>
mov    0xc(%rsp),%esi
test   %eax,%esi
je     1177 <main+0x57>
xor    %eax,%esi
mov    %esi,0xc(%rsp)
jmp    1177 <main+0x57>
mov    0xc(%rsp),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [3 x i8] c"%d\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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %4
%8 = shl i32 1, %7
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = load i32, i32* %5
%13 = load i32, i32* %2
%14 = or i32 %12, %13
store i32 %14, i32* %2
br label %30
15: ; preds = %0
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %15
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = ashr i32 %19, %20
%22 = and i32 %21, 1
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = load i32, i32* %5
%26 = load i32, i32* %2
%27 = xor i32 %25, %26
store i32 %27, i32* %2
br label %28
28: ; preds = %24, %18
br label %29
29: ; preds = %28, %15
br label %30
30: ; preds = %29, %11
%31 = load i32, i32* %2
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %3
%9 = shl nuw i32 1, %8
%10 = load i32, i32* %2
switch i32 %10, label %11 [
i32 1, label %13
i32 0, label %16
]
11: ; preds = %0
%12 = load i32, i32* %1
br label %22
13: ; preds = %0
%14 = load i32, i32* %1
%15 = or i32 %14, %9
store i32 %15, i32* %1
br label %22
16: ; preds = %0
%17 = load i32, i32* %1
%18 = and i32 %17, %9
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = xor i32 %17, %9
store i32 %21, i32* %1
br label %22
22: ; preds = %11, %20, %16, %13
%23 = phi i32 [ %12, %11 ], [ %21, %20 ], [ %17, %16 ], [ %15, %13 ]
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %23)
ret i32 0
}