#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, b, d;
  scanf("%d %d %d", &n, &v, &p);
  if (p >= 0 && p <= 7) {
    d = 0x01;
    d = d << p;
    b = d ^ 0xff;
    if (v == 0) {
      n = n & b;
      printf("%d", n);
    }
    if (v == 1) {
      n = n | d;
      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>
cmpl   $0x0,-0x10(%rbp)
jl     11c1 <main+0xa1>
cmpl   $0x7,-0x10(%rbp)
jg     11c1 <main+0xa1>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    119a <main+0x7a>
mov    -0x8(%rbp),%eax
and    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    11bc <main+0x9c>
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
jmp    11c1 <main+0xa1>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
cmp    $0x7,%ecx
ja     1173 <main+0x53>
mov    $0x1,%ebx
shl    %cl,%ebx
mov    0x8(%rsp),%eax
test   %eax,%eax
je     117b <main+0x5b>
cmp    $0x1,%eax
jne    1173 <main+0x53>
or     0x4(%rsp),%ebx
mov    %ebx,0x4(%rsp)
lea    0xe9a(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %ebx,%esi
xor    $0xff,%esi
and    0x4(%rsp),%esi
mov    %esi,0x4(%rsp)
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
cmp    $0x1,%eax
je     115d <main+0x3d>
jmp    1173 <main+0x53>

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