#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b;
  int c[100];
  int counter = 0;
  int temp;
  scanf("%d", &a);
  scanf("%d", &b);
  while (b > 0) {
    temp = b % 2;
    c[counter] = temp;
    b = b / 2;
    counter++;
  }
  if (counter < a) {
    return 0;
  }
  printf("\n");
  while (counter >= 0) {
    if (counter == a) {
      printf("\n%d", c[counter]);
      return 0;
    }
    counter--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    11ad <main+0x8d>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%ecx
movslq -0x1a4(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    115c <main+0x3c>
mov    -0x1a4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c8 <main+0xa8>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0x115>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1a4(%rbp)
jl     122e <main+0x10e>
mov    -0x1a4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    121a <main+0xfa>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0x115>
mov    -0x1a4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11d6 <main+0xb6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1a0,%rsp
lea    0xec2(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
xor    %ebx,%ebx
test   %eax,%eax
jle    118a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
mov    %eax,%edx
and    $0x1,%edx
mov    %edx,0x10(%rsp,%rbx,4)
shr    %eax
add    $0x1,%rbx
cmp    $0x1,%ecx
ja     1170 <main+0x40>
mov    %eax,0x8(%rsp)
cmp    0xc(%rsp),%ebx
jl     1201 <main+0xd1>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
js     1201 <main+0xd1>
mov    0xc(%rsp),%eax
mov    %ebx,%ecx
sub    %eax,%ecx
cmp    %ecx,%ebx
cmovb  %ebx,%ecx
cmp    $0x10,%ecx
jb     11d5 <main+0xa5>
add    $0x1,%ecx
mov    %ecx,%edx
and    $0xf,%edx
mov    $0x10,%esi
cmovne %edx,%esi
sub    %esi,%ecx
sub    %ecx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xfffffff0,%ecx
jne    11d0 <main+0xa0>
add    $0x1,%ebx
mov    %eax,%ecx
neg    %ecx
nopl   0x0(%rax)
lea    (%rcx,%rbx,1),%edx
cmp    $0x1,%edx
je     11ef <main+0xbf>
add    $0xffffffff,%ebx
jg     11e0 <main+0xb0>
jmp    1201 <main+0xd1>
mov    0x10(%rsp,%rax,4),%esi
lea    0xe06(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [100 x i32]* %3 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 sgt i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %0, %11
%12 = phi i64 [ %17, %11 ], [ 0, %0 ]
%13 = phi i32 [ %16, %11 ], [ %9, %0 ]
%14 = and i32 %13, 1
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %12
store i32 %14, i32* %15
%16 = lshr i32 %13, 1
%17 = add nuw nsw i64 %12, 1
%18 = icmp ult i32 %13, 2
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = trunc i64 %17 to i32
store i32 %16, i32* %2
br label %21
21: ; preds = %19, %0
%22 = phi i32 [ %20, %19 ], [ 0, %0 ]
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
br i1 %24, label %57, label %25
25: ; preds = %21
%26 = call i32 @putchar(i32 10)
%27 = icmp sgt i32 %22, -1
br i1 %27, label %28, label %57
28: ; preds = %25
%29 = load i32, i32* %1
%30 = sub i32 %22, %29
%31 = call i32 @llvm.umin.i32(i32 %22, i32 %30)
%32 = add nuw nsw i32 %31, 1
%33 = icmp ult i32 %31, 16
br i1 %33, label %44, label %34
34: ; preds = %28
%35 = and i32 %32, 15
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i32 16, i32 %35
%38 = sub i32 %32, %37
%39 = sub i32 %22, %38
br label %40
40: ; preds = %40, %34
%41 = phi i32 [ 0, %34 ], [ %42, %40 ]
%42 = add nuw i32 %41, 16
%43 = icmp eq i32 %42, %38
br i1 %43, label %44, label %40
44: ; preds = %40, %28
%45 = phi i32 [ %22, %28 ], [ %39, %40 ]
br label %46
46: ; preds = %44, %54
%47 = phi i32 [ %55, %54 ], [ %45, %44 ]
%48 = icmp eq i32 %47, %29
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = zext i32 %29 to i64
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %52)
br label %57
54: ; preds = %46
%55 = add nsw i32 %47, -1
%56 = icmp sgt i32 %47, 0
br i1 %56, label %46, label %57
57: ; preds = %54, %25, %21, %49
ret i32 0
}