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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebb(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jne    1168 <main+0x48>
cmpl   $0x1,-0xc(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    113f <main+0x1f>
jmp    1178 <main+0x58>
lea    0xe82(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x7,-0x10(%rbp)
mov    %al,-0x12(%rbp)
jg     11a1 <main+0x81>
cmpl   $0x0,-0x10(%rbp)
setl   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1178 <main+0x58>
cmpl   $0x1,-0xc(%rbp)
jne    11d9 <main+0xb9>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1209 <main+0xe9>
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,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed3(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    $0x7,%eax
ja     1150 <main+0x30>
mov    0x14(%rsp),%ecx
cmp    $0x1,%ecx
jne    1188 <main+0x68>
mov    0xc(%rsp),%esi
bts    %eax,%esi
mov    %esi,0xc(%rsp)
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
jne    11a7 <main+0x87>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%al
btr    %eax,%esi
mov    %esi,0xc(%rsp)
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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