#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, temp;
  scanf("%d", &n);
  scanf("%d", &v);
  if (v < 0 && v > 1)
    return -1;
  scanf("%d", &p);
  if (p < 0 && p > 7)
    return -1;
  temp = 1 << p;
  if (v == 1)
    n = n | temp;
  else
    n = n & ~temp;
  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
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jge    116f <main+0x4f>
cmpl   $0x1,-0xc(%rbp)
jle    116f <main+0x4f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e8 <main+0xc8>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jge    119f <main+0x7f>
cmpl   $0x7,-0x10(%rbp)
jle    119f <main+0x7f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e8 <main+0xc8>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11c4 <main+0xa4>
mov    -0x8(%rbp),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11d2 <main+0xb2>
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%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),%al
mov    0x4(%rsp),%esi
mov    %esi,%ecx
btr    %eax,%ecx
bts    %eax,%esi
cmpl   $0x1,0xc(%rsp)
cmovne %ecx,%esi
mov    %esi,0x4(%rsp)
mov    %rbx,%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
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 -1, i32* %1
br label %39
14: ; preds = %10, %0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 7
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 -1, i32* %1
br label %39
22: ; preds = %18, %14
%23 = load i32, i32* %4
%24 = shl i32 1, %23
store i32 %24, i32* %5
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i32, i32* %2
%29 = load i32, i32* %5
%30 = or i32 %28, %29
store i32 %30, i32* %2
br label %36
31: ; preds = %22
%32 = load i32, i32* %2
%33 = load i32, i32* %5
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
store i32 %35, i32* %2
br label %36
36: ; preds = %31, %27
%37 = load i32, i32* %2
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
store i32 0, i32* %1
br label %39
39: ; preds = %36, %21, %13
%40 = load i32, i32* %1
ret i32 %40
}

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* %3
%11 = shl nuw i32 1, %10
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 1
%14 = load i32, i32* %1
%15 = xor i32 %11, -1
%16 = and i32 %14, %15
%17 = or i32 %14, %11
%18 = select i1 %13, i32 %17, i32 %16
store i32 %18, i32* %1
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}