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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     116a <main+0x4a>
cmpl   $0x1,-0xc(%rbp)
jle    1176 <main+0x56>
movl   $0x0,-0x4(%rbp)
jmp    1205 <main+0xe5>
lea    0xe83(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jl     119a <main+0x7a>
cmpl   $0x7,-0x10(%rbp)
jle    11a6 <main+0x86>
movl   $0x0,-0x4(%rbp)
jmp    1205 <main+0xe5>
cmpl   $0x0,-0xc(%rbp)
jne    11cc <main+0xac>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    11ef <main+0xcf>
cmpl   $0x1,-0xc(%rbp)
jne    11ea <main+0xca>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    11ef <main+0xcf>
mov    -0x14(%rbp),%esi
lea    0xe0a(%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    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
ja     1192 <main+0x72>
lea    0xeac(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x7,%eax
ja     1192 <main+0x72>
mov    0x4(%rsp),%ecx
cmp    $0x1,%ecx
je     117f <main+0x5f>
xor    %esi,%esi
test   %ecx,%ecx
jne    1186 <main+0x66>
mov    0x8(%rsp),%esi
btr    %eax,%esi
jmp    1186 <main+0x66>
mov    0x8(%rsp),%esi
bts    %eax,%esi
lea    0xe76(%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"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%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 %13, label %10
10: ; preds = %0
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10, %0
store i32 0, i32* %1
br label %43
14: ; preds = %10
%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 %21, label %18
18: ; preds = %14
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 7
br i1 %20, label %21, label %22
21: ; preds = %18, %14
store i32 0, i32* %1
br label %43
22: ; preds = %18
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %2
%27 = load i32, i32* %4
%28 = shl i32 1, %27
%29 = xor i32 %28, -1
%30 = and i32 %26, %29
store i32 %30, i32* %5
br label %40
31: ; preds = %22
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i32, i32* %2
%36 = load i32, i32* %4
%37 = shl i32 1, %36
%38 = or i32 %35, %37
store i32 %38, i32* %5
br label %39
39: ; preds = %34, %31
br label %40
40: ; preds = %39, %25
%41 = load i32, i32* %5
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
store i32 0, i32* %1
br label %43
43: ; preds = %40, %21, %13
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [3 x i8] c"%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 ([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 = load i32, i32* %2
%10 = icmp ugt i32 %9, 1
br i1 %10, label %29, label %11
11: ; preds = %0
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp ugt i32 %13, 7
br i1 %14, label %29, label %15
15: ; preds = %11
%16 = load i32, i32* %2
switch i32 %16, label %26 [
i32 0, label %17
i32 1, label %22
]
17: ; preds = %15
%18 = load i32, i32* %1
%19 = shl nuw nsw i32 1, %13
%20 = xor i32 %19, -1
%21 = and i32 %18, %20
br label %26
22: ; preds = %15
%23 = load i32, i32* %1
%24 = shl nuw nsw i32 1, %13
%25 = or i32 %23, %24
br label %26
26: ; preds = %15, %22, %17
%27 = phi i32 [ %21, %17 ], [ %25, %22 ], [ 0, %15 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %11, %0, %26
ret i32 0
}