#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, i, k[100], multiplier = 1;
  scanf("%d", &n);
  scanf("%d", &v);
  scanf("%d", &p);
  for (i = 6; n != 0; i--) {
    k[i - 1] = n % 2;
    n = n / 2;
  }
  i = 6;
  k[i - p - 1] = v;
  n = 0;
  for (i = 6; i != 0; i--) {
    n = n + k[i - 1] * multiplier;
    multiplier = 2 * multiplier;
  }
  printf("%d", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1b4(%rbp)
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xead(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x6,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11b3 <main+0x93>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %edx,-0x1b0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1173 <main+0x53>
movl   $0x6,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x1b0(%rbp,%rax,4)
movl   $0x0,-0x8(%rbp)
movl   $0x6,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1223 <main+0x103>
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1b0(%rbp,%rcx,4),%ecx
imul   -0x1b4(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x1b4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11dd <main+0xbd>
mov    -0x8(%rbp),%esi
lea    0xdd3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1a0,%rsp
lea    0xef1(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1190 <main+0x70>
lea    0x24(%rsp),%rcx
mov    %eax,%edx
cs nopw 0x0(%rax,%rax,1)
nop
shr    $0x1f,%edx
add    %eax,%edx
mov    %edx,%esi
and    $0xfffffffe,%esi
mov    %eax,%edi
sub    %esi,%edi
mov    %edi,(%rcx)
sar    %edx
add    $0x1,%eax
add    $0xfffffffffffffffc,%rcx
cmp    $0x2,%eax
mov    %edx,%eax
ja     1170 <main+0x50>
mov    0xc(%rsp),%eax
mov    $0x5,%ecx
sub    0x8(%rsp),%ecx
movslq %ecx,%rcx
mov    %eax,0x10(%rsp,%rcx,4)
mov    0x20(%rsp),%eax
movdqa 0x10(%rsp),%xmm0
movdqa 0xe4a(%rip),%xmm1
pmuludq %xmm0,%xmm1
pshufd $0xf5,%xmm0,%xmm0
pmuludq 0xe49(%rip),%xmm0
pshufd $0xe8,%xmm1,%xmm1
pshufd $0xe8,%xmm0,%xmm0
punpckldq %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%ecx
lea    (%rcx,%rax,2),%esi
add    0x24(%rsp),%esi
mov    %esi,0x4(%rsp)
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
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
%5 = alloca i32
%6 = alloca [100 x i32]
%7 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 6, i32* %5
br label %11
11: ; preds = %23, %0
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i32, i32* %2
%16 = srem i32 %15, 2
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %19
store i32 %16, i32* %20
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 2
store i32 %22, i32* %2
br label %23
23: ; preds = %14
%24 = load i32, i32* %5
%25 = add nsw i32 %24, -1
store i32 %25, i32* %5
br label %11
26: ; preds = %11
store i32 6, i32* %5
%27 = load i32, i32* %3
%28 = load i32, i32* %5
%29 = load i32, i32* %4
%30 = sub nsw i32 %28, %29
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %32
store i32 %27, i32* %33
store i32 0, i32* %2
store i32 6, i32* %5
br label %34
34: ; preds = %49, %26
%35 = load i32, i32* %5
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %52
37: ; preds = %34
%38 = load i32, i32* %2
%39 = load i32, i32* %5
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %7
%45 = mul nsw i32 %43, %44
%46 = add nsw i32 %38, %45
store i32 %46, i32* %2
%47 = load i32, i32* %7
%48 = mul nsw i32 2, %47
store i32 %48, i32* %7
br label %49
49: ; preds = %37
%50 = load i32, i32* %5
%51 = add nsw i32 %50, -1
store i32 %51, i32* %5
br label %34
52: ; preds = %34
%53 = load i32, i32* %2
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %53)
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 = alloca [100 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [100 x i32]* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 6, %0 ]
%16 = phi i32 [ %20, %14 ], [ %12, %0 ]
%17 = srem i32 %16, 2
%18 = add nsw i64 %15, -1
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %18
store i32 %17, i32* %19
%20 = sdiv i32 %16, 2
%21 = add i32 %16, 1
%22 = icmp ult i32 %21, 3
br i1 %22, label %23, label %14
23: ; preds = %14, %0
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = sub i32 5, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %27
store i32 %24, i32* %28
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 5
%30 = load i32, i32* %29
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 4
%32 = load i32, i32* %31
%33 = shl nsw i32 %32, 1
%34 = bitcast [100 x i32]* %4 to <4 x i32>*
%35 = load <4 x i32>, <4 x i32>* %34
%36 = shl nsw <4 x i32> %35, <i32 5, i32 4, i32 3, i32 2>
%37 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %36)
%38 = add nsw i32 %37, %33
%39 = add nsw i32 %38, %30
store i32 %39, i32* %1
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
ret i32 0
}