#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 (v == 1) {
    n |= 1 << p;
  } else {
    if (n & (1 << p) ? 1 : 0) {
      n ^= 1 << p;
    } else {
      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>
cmpl   $0x1,-0xc(%rbp)
jne    117e <main+0x5e>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11e0 <main+0xc0>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11a7 <main+0x87>
mov    $0x1,%al
test   $0x1,%al
jne    11b6 <main+0x96>
jmp    11cb <main+0xab>
xor    %eax,%eax
test   $0x1,%al
jne    11b6 <main+0x96>
jmp    11cb <main+0xab>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0xbb>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11e0 <main+0xc0>
mov    -0x8(%rbp),%esi
lea    0xe16(%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>
cmpl   $0x1,0xc(%rsp)
jne    1167 <main+0x47>
mov    0x8(%rsp),%al
mov    0x4(%rsp),%esi
bts    %eax,%esi
jmp    1181 <main+0x61>
mov    0x4(%rsp),%eax
mov    0x8(%rsp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
bt     %ecx,%eax
jae    117f <main+0x5f>
xor    %eax,%esi
jmp    1181 <main+0x61>
or     %eax,%esi
mov    %esi,0x4(%rsp)
lea    0xe74(%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* %3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %0
%11 = load i32, i32* %4
%12 = shl i32 1, %11
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
br label %34
15: ; preds = %0
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = shl i32 1, %17
%19 = and i32 %16, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
br i1 true, label %23, label %28
22: ; preds = %15
br i1 false, label %23, label %28
23: ; preds = %22, %21
%24 = load i32, i32* %4
%25 = shl i32 1, %24
%26 = load i32, i32* %2
%27 = xor i32 %26, %25
store i32 %27, i32* %2
br label %33
28: ; preds = %22, %21
%29 = load i32, i32* %4
%30 = shl i32 1, %29
%31 = load i32, i32* %2
%32 = or i32 %31, %30
store i32 %32, i32* %2
br label %33
33: ; preds = %28, %23
br label %34
34: ; preds = %33, %10
%35 = load i32, i32* %2
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %35)
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* %2
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = load i32, i32* %3
%14 = shl nuw i32 1, %13
%15 = load i32, i32* %1
%16 = or i32 %15, %14
store i32 %16, i32* %1
br label %27
17: ; preds = %0
%18 = load i32, i32* %1
%19 = load i32, i32* %3
%20 = shl nuw i32 1, %19
%21 = and i32 %20, %18
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %17
%24 = xor i32 %20, %18
store i32 %24, i32* %1
br label %27
25: ; preds = %17
%26 = or i32 %20, %18
store i32 %26, i32* %1
br label %27
27: ; preds = %23, %25, %12
%28 = phi i32 [ %24, %23 ], [ %26, %25 ], [ %16, %12 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}