#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;
  do {
    scanf("%d %d %d", &n, &v, &p);
  } while ((v < 0) || (v < 0) || (p < 0) || (p > 7));
  if (v == 1) {
    n |= 1 << p;
  } else {
    n &= ~(1 << p);
  }
  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
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jl     117e <main+0x5e>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jl     117e <main+0x5e>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jl     117e <main+0x5e>
cmpl   $0x7,-0x10(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
cmpl   $0x1,-0xc(%rbp)
jne    11a8 <main+0x88>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x9b>
mov    -0x10(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
test   %eax,%eax
js     1150 <main+0x30>
mov    0x10(%rsp),%ecx
test   %ecx,%ecx
js     1150 <main+0x30>
cmp    $0x7,%ecx
jg     1150 <main+0x30>
mov    $0x1,%esi
shl    %cl,%esi
cmp    $0x1,%eax
jne    1188 <main+0x68>
or     0xc(%rsp),%esi
jmp    118e <main+0x6e>
not    %esi
and    0xc(%rsp),%esi
mov    %esi,0xc(%rsp)
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [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
br label %5
5: ; preds = %19, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
br label %7
7: ; preds = %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 7
br label %19
19: ; preds = %16, %13, %10, %7
%20 = phi i1 [ true, %13 ], [ true, %10 ], [ true, %7 ], [ %18, %16 ]
br i1 %20, label %5, label %21
21: ; preds = %19
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* %4
%26 = shl i32 1, %25
%27 = load i32, i32* %2
%28 = or i32 %27, %26
store i32 %28, i32* %2
br label %35
29: ; preds = %21
%30 = load i32, i32* %4
%31 = shl i32 1, %30
%32 = xor i32 %31, -1
%33 = load i32, i32* %2
%34 = and i32 %33, %32
store i32 %34, i32* %2
br label %35
35: ; preds = %29, %24
%36 = load i32, i32* %2
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
ret i32 0
}

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