#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);
  if (v == 1) {
    n = n | (1 << p);
  }
  if (v == 0) {
    if ((n & (1 << p)) >> p == 1) {
      n = n ^ (1 << p);
    }
  }
  printf("%d\n", 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
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    1165 <main+0x45>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11a7 <main+0x87>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
cmp    $0x1,%eax
jne    11a2 <main+0x82>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    11a7 <main+0x87>
mov    -0x8(%rbp),%esi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%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    0x14(%rsp),%eax
test   %eax,%eax
je     1159 <main+0x39>
cmp    $0x1,%eax
jne    117b <main+0x5b>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%al
bts    %eax,%esi
jmp    1175 <main+0x55>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%cl
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%edx
and    %esi,%edx
sar    %cl,%edx
cmp    $0x1,%edx
jne    117f <main+0x5f>
xor    %eax,%esi
mov    %esi,0xc(%rsp)
jmp    117f <main+0x5f>
mov    0xc(%rsp),%esi
lea    0xe83(%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 = [4 x i8] c"%d\0A\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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = or i32 %9, %11
store i32 %12, i32* %2
br label %13
13: ; preds = %8, %0
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %13
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = shl i32 1, %18
%20 = and i32 %17, %19
%21 = load i32, i32* %4
%22 = ashr i32 %20, %21
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %29
24: ; preds = %16
%25 = load i32, i32* %2
%26 = load i32, i32* %4
%27 = shl i32 1, %26
%28 = xor i32 %25, %27
store i32 %28, i32* %2
br label %29
29: ; preds = %24, %16
br label %30
30: ; preds = %29, %13
%31 = load i32, i32* %2
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 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 = [4 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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %2
switch i32 %8, label %9 [
i32 1, label %11
i32 0, label %16
]
9: ; preds = %0
%10 = load i32, i32* %1
br label %25
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* %3
%14 = shl nuw i32 1, %13
%15 = or i32 %14, %12
store i32 %15, i32* %1
br label %25
16: ; preds = %0
%17 = load i32, i32* %1
%18 = load i32, i32* %3
%19 = shl nuw i32 1, %18
%20 = and i32 %19, %17
%21 = ashr i32 %20, %18
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = xor i32 %19, %17
store i32 %24, i32* %1
br label %25
25: ; preds = %9, %11, %16, %23
%26 = phi i32 [ %10, %9 ], [ %15, %11 ], [ %17, %16 ], [ %24, %23 ]
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
ret i32 0
}