#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);
  if (v < 0 || v > 1)
    return 0;
  else
    scanf("%d", &p);
  if (p < 0 || p > 7)
    return 0;
  else {
    if (v == 1) {
      n = (1 << p) | n;
    }
    if (v == 0) {
      n = (~(1 << p)) & n;
    }
  }
  printf("\n %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
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jl     1163 <main+0x43>
cmpl   $0x1,-0xc(%rbp)
jle    116f <main+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <main+0xd1>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jl     1193 <main+0x73>
cmpl   $0x7,-0x10(%rbp)
jle    119f <main+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <main+0xd1>
cmpl   $0x1,-0xc(%rbp)
jne    11b9 <main+0x99>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11d6 <main+0xb6>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0xbb>
mov    -0x8(%rbp),%esi
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cmpl   $0x1,0x8(%rsp)
ja     119a <main+0x7a>
lea    0xeac(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x7,%eax
ja     119a <main+0x7a>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
je     117d <main+0x5d>
cmp    $0x1,%ecx
jne    118a <main+0x6a>
mov    0x4(%rsp),%esi
bts    %eax,%esi
jmp    1184 <main+0x64>
mov    0x4(%rsp),%esi
btr    %eax,%esi
mov    %esi,0x4(%rsp)
jmp    118e <main+0x6e>
mov    0x4(%rsp),%esi
lea    0xe6e(%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 = [7 x i8] c"\0A %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 ([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 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %9, %0
store i32 0, i32* %1
br label %43
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %15
15: ; preds = %13
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 7
br i1 %20, label %21, label %22
21: ; preds = %18, %15
store i32 0, i32* %1
br label %43
22: ; preds = %18
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i32, i32* %4
%27 = shl i32 1, %26
%28 = load i32, i32* %2
%29 = or i32 %27, %28
store i32 %29, i32* %2
br label %30
30: ; preds = %25, %22
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load i32, i32* %4
%35 = shl i32 1, %34
%36 = xor i32 %35, -1
%37 = load i32, i32* %2
%38 = and i32 %36, %37
store i32 %38, i32* %2
br label %39
39: ; preds = %33, %30
br label %40
40: ; preds = %39
%41 = load i32, i32* %2
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %41)
store i32 0, i32* %1
br label %43
43: ; preds = %40, %21, %12
%44 = load i32, i32* %1
ret i32 %44
}

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