#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 a;
  int b;
  int i;
  int k[8];
  int reverse;
  for (i = 0; i < 8; i++) {
    k[i] = 0;
  }
  scanf("%d", &a);
  scanf("%d", &b);
  for (reverse = 7; b != 0; reverse--) {
    k[reverse] = b % 2;
    b = b / 2;
  }
  printf("%d", k[7 - a]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    115a <main+0x3a>
movslq -0x10(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <main+0x16>
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe8f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x7,-0x34(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11ba <main+0x9a>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x34(%rbp),%rax
mov    %edx,-0x30(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    1181 <main+0x61>
mov    $0x7,%eax
sub    -0x8(%rbp),%eax
cltq
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xec7(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     1184 <main+0x64>
lea    0x2c(%rsp),%rcx
mov    %eax,%edx
shr    $0x1f,%eax
add    %edx,%eax
mov    %eax,%esi
and    $0xfffffffe,%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %edi,(%rcx)
sar    %eax
add    $0x1,%edx
add    $0xfffffffffffffffc,%rcx
cmp    $0x2,%edx
ja     1160 <main+0x40>
mov    %eax,0x8(%rsp)
movslq 0xc(%rsp),%rax
mov    $0x7,%ecx
sub    %rax,%rcx
mov    0x10(%rsp,%rcx,4),%esi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%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 [8 x i32]
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %7
17: ; preds = %7
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 7, i32* %6
br label %20
20: ; preds = %31, %17
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i32, i32* %3
%25 = srem i32 %24, 2
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %27
store i32 %25, i32* %28
%29 = load i32, i32* %3
%30 = sdiv i32 %29, 2
store i32 %30, i32* %3
br label %31
31: ; preds = %23
%32 = load i32, i32* %6
%33 = add nsw i32 %32, -1
store i32 %33, i32* %6
br label %20
34: ; preds = %20
%35 = load i32, i32* %2
%36 = sub nsw i32 7, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 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)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %0, %11
%12 = phi i64 [ %17, %11 ], [ 7, %0 ]
%13 = phi i32 [ %16, %11 ], [ %9, %0 ]
%14 = srem i32 %13, 2
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %12
store i32 %14, i32* %15
%16 = sdiv i32 %13, 2
%17 = add i64 %12, -1
%18 = add i32 %13, 1
%19 = icmp ult i32 %18, 3
br i1 %19, label %20, label %11
20: ; preds = %11
store i32 %16, i32* %2
br label %21
21: ; preds = %20, %0
%22 = load i32, i32* %1
%23 = sub nsw i32 7, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}