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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%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
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1196 <main+0x76>
cmpl   $0x0,-0xc(%rbp)
jne    1191 <main+0x71>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    11cd <main+0xad>
cmpl   $0x1,-0xc(%rbp)
jne    11c8 <main+0xa8>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    11cd <main+0xad>
mov    -0x8(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    0x4(%rsp),%esi
bt     %ecx,%esi
mov    0xc(%rsp),%edx
jae    1178 <main+0x58>
test   %edx,%edx
jne    1178 <main+0x58>
mov    $0xffffffff,%eax
shl    %cl,%eax
jmp    1181 <main+0x61>
test   %esi,%eax
jne    1187 <main+0x67>
cmp    $0x1,%edx
jne    1187 <main+0x67>
add    %eax,%esi
mov    %esi,0x4(%rsp)
lea    0xe72(%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
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)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %2
%9 = load i32, i32* %4
%10 = ashr i32 %8, %9
%11 = and i32 %10, 1
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %0
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = shl i32 1, %18
%20 = sub nsw i32 %17, %19
store i32 %20, i32* %2
br label %21
21: ; preds = %16, %13
br label %22
22: ; preds = %21, %0
%23 = load i32, i32* %2
%24 = load i32, i32* %4
%25 = ashr i32 %23, %24
%26 = and i32 %25, 1
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %22
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 1
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 = add nsw i32 %32, %34
store i32 %35, i32* %2
br label %36
36: ; preds = %31, %28
br label %37
37: ; preds = %36, %22
%38 = load i32, i32* %2
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %38)
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 ne 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 %18, label %21
18: ; preds = %0
%19 = shl nsw i32 -1, %11
%20 = add i32 %19, %10
store i32 %20, i32* %1
br label %27
21: ; preds = %0
%22 = icmp eq i32 %13, 0
%23 = icmp eq i32 %15, 1
%24 = select i1 %22, i1 %23, i1 false
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = add nsw i32 %10, %12
store i32 %26, i32* %1
br label %27
27: ; preds = %18, %25, %21
%28 = phi i32 [ %20, %18 ], [ %26, %25 ], [ %10, %21 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}