#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 */
typedef int /*<<< orphan*/ binaryNumber;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a, b, remainder, quotient;
  int binaryNumber[8], i = 1, j;
  scanf("%d%d", &a, &b);
  quotient = b;
  while (quotient != 0) {
    binaryNumber[i++] = quotient % 2;
    quotient = quotient / 2;
  }
  if (a > sizeof(binaryNumber)) {
    printf("0");
  } else
    printf("%d\n", binaryNumber[a]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1189 <main+0x69>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x44(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x44(%rbp)
cltq
mov    %edx,-0x40(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    1150 <main+0x30>
movslq -0x8(%rbp),%rax
cmp    $0x20,%rax
jbe    11aa <main+0x8a>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c0 <main+0xa0>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     1180 <main+0x50>
lea    0x14(%rsp),%rcx
mov    %eax,%edx
nopl   0x0(%rax)
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    $0x4,%rcx
cmp    $0x2,%eax
mov    %edx,%eax
ja     1160 <main+0x30>
mov    0xc(%rsp),%eax
cmp    $0x21,%rax
jb     1196 <main+0x66>
mov    $0x30,%edi
call   1030 <putchar@plt>
jmp    11a8 <main+0x78>
mov    0x10(%rsp,%rax,4),%esi
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [8 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %7
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%10 = load i32, i32* %3
store i32 %10, i32* %5
br label %11
11: ; preds = %14, %0
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* %5
%16 = srem i32 %15, 2
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %19
store i32 %16, i32* %20
%21 = load i32, i32* %5
%22 = sdiv i32 %21, 2
store i32 %22, i32* %5
br label %11
23: ; preds = %11
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = icmp ugt i64 %25, 32
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %35
29: ; preds = %23
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %29, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [8 x i32]* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 1, %0 ]
%12 = phi i32 [ %16, %10 ], [ %8, %0 ]
%13 = srem i32 %12, 2
%14 = add nuw i64 %11, 1
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %11
store i32 %13, i32* %15
%16 = sdiv i32 %12, 2
%17 = add i32 %12, 1
%18 = icmp ult i32 %17, 3
br i1 %18, label %19, label %10
19: ; preds = %10, %0
%20 = load i32, i32* %1
%21 = icmp ugt i32 %20, 32
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @putchar(i32 48)
br label %29
24: ; preds = %19
%25 = zext i32 %20 to i64
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %24, %22
ret i32 0
}