#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, r, pos;
  scanf("%d", &n);
  scanf("%d", &v);
  scanf("%d", &p);
  pos = n & (1 << p);
  if ((pos == 0 && v == 0) || (pos != 0 && v == 1)) {
    printf("%d", n);
  } else {
    if (v == 0) {
      r = n ^ (1 << p);
    } else {
      r = n | (1 << p);
    }
    printf("%d", r);
  }
  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>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1187 <main+0x67>
cmpl   $0x0,-0xc(%rbp)
je     119b <main+0x7b>
cmpl   $0x0,-0x18(%rbp)
je     11af <main+0x8f>
cmpl   $0x1,-0xc(%rbp)
jne    11af <main+0x8f>
mov    -0x8(%rbp),%esi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
cmpl   $0x0,-0xc(%rbp)
jne    11d2 <main+0xb2>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    11e6 <main+0xc6>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%cl
mov    $0x1,%eax
shl    %cl,%eax
mov    0xc(%rsp),%esi
mov    %eax,%edx
and    %esi,%edx
mov    0x8(%rsp),%ecx
or     %ecx,%edx
je     1184 <main+0x64>
test   %esi,%eax
je     1177 <main+0x57>
cmp    $0x1,%ecx
je     1184 <main+0x64>
mov    %eax,%edx
xor    %esi,%edx
or     %esi,%eax
test   %ecx,%ecx
cmove  %edx,%eax
mov    %eax,%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
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
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %2
%11 = load i32, i32* %4
%12 = shl i32 1, %11
%13 = and i32 %10, %12
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %16, %0
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %22, %16
%26 = load i32, i32* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %44
28: ; preds = %22, %19
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %2
%33 = load i32, i32* %4
%34 = shl i32 1, %33
%35 = xor i32 %32, %34
store i32 %35, i32* %5
br label %41
36: ; preds = %28
%37 = load i32, i32* %2
%38 = load i32, i32* %4
%39 = shl i32 1, %38
%40 = or i32 %37, %39
store i32 %40, i32* %5
br label %41
41: ; preds = %36, %31
%42 = load i32, i32* %5
%43 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41, %25
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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %1
%11 = load i32, i32* %3
%12 = shl nuw i32 1, %11
%13 = and i32 %12, %10
%14 = icmp eq i32 %13, 0
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 0
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %26, label %18
18: ; preds = %0
%19 = icmp ne i32 %13, 0
%20 = icmp eq i32 %15, 1
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = xor i32 %12, %10
%24 = or i32 %12, %10
%25 = select i1 %16, i32 %23, i32 %24
br label %26
26: ; preds = %0, %18, %22
%27 = phi i32 [ %25, %22 ], [ %10, %18 ], [ %10, %0 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %27)
ret i32 0
}