#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;
  do {
    scanf("%d", &n);
  } while (n < 0 || n > 200);
  do {
    scanf("%d", &v);
  } while (v != 0 && v != 1);
  do {
    scanf("%d", &p);
  } while (p < 0 || p > 7);
  n ^= (-v ^ 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
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     115b <main+0x3b>
cmpl   $0xc8,-0x8(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
jmp    116b <main+0x4b>
lea    0xe8e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x12(%rbp)
je     1194 <main+0x74>
cmpl   $0x1,-0xc(%rbp)
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    116b <main+0x4b>
jmp    11a4 <main+0x84>
lea    0xe55(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x13(%rbp)
jl     11cd <main+0xad>
cmpl   $0x7,-0x10(%rbp)
setg   %al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
test   $0x1,%al
jne    11a4 <main+0x84>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe02(%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    0xed2(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0xc8,0xc(%rsp)
ja     1140 <main+0x20>
lea    0xea4(%rip),%r14
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
ja     1170 <main+0x50>
lea    0xe77(%rip),%r14
lea    0x14(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%ecx
cmp    $0x7,%ecx
ja     1190 <main+0x70>
xor    %eax,%eax
sub    0x10(%rsp),%eax
mov    0xc(%rsp),%edx
mov    $0x1,%esi
shl    %cl,%esi
xor    %edx,%eax
and    %eax,%esi
xor    %edx,%esi
mov    %esi,0xc(%rsp)
lea    0xe3a(%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"
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 = %13, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %5
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 200
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %5, label %15
15: ; preds = %13
br label %16
16: ; preds = %24, %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %18
18: ; preds = %16
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 1
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ false, %18 ], [ %23, %21 ]
br i1 %25, label %16, label %26
26: ; preds = %24
br label %27
27: ; preds = %35, %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %29
29: ; preds = %27
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 7
br label %35
35: ; preds = %32, %29
%36 = phi i1 [ true, %29 ], [ %34, %32 ]
br i1 %36, label %27, label %37
37: ; preds = %35
%38 = load i32, i32* %3
%39 = sub nsw i32 0, %38
%40 = load i32, i32* %2
%41 = xor i32 %39, %40
%42 = load i32, i32* %4
%43 = shl i32 1, %42
%44 = and i32 %41, %43
%45 = load i32, i32* %2
%46 = xor i32 %45, %44
store i32 %46, i32* %2
%47 = load i32, i32* %2
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %47)
ret i32 0
}

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