#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 hp;
  int helper;
  int i = 0;
  int base[200];
  int box;
  do {
    scanf("%d", &helper);
  } while (helper < 0 || helper > 7);
  do {
    scanf("%d", &box);
  } while (helper < 0 || helper > 200);
  while (box != 0) {
    base[i] = box % 2;
    box = box / 2;
    i++;
  }
  hp = i;
  while (hp <= 8) {
    base[hp] = 0;
    hp++;
  }
  i = 0;
  while (i != helper) {
    i++;
  }
  printf("\n%d", base[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x335(%rbp)
jl     1168 <main+0x48>
cmpl   $0x7,-0xc(%rbp)
setg   %al
mov    %al,-0x335(%rbp)
mov    -0x335(%rbp),%al
test   $0x1,%al
jne    1139 <main+0x19>
jmp    117b <main+0x5b>
lea    0xe7f(%rip),%rdi
lea    -0x334(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x336(%rbp)
jl     11b0 <main+0x90>
cmpl   $0xc8,-0xc(%rbp)
setg   %al
mov    %al,-0x336(%rbp)
mov    -0x336(%rbp),%al
test   $0x1,%al
jne    117b <main+0x5b>
jmp    11c3 <main+0xa3>
cmpl   $0x0,-0x334(%rbp)
je     120b <main+0xeb>
mov    -0x334(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x10(%rbp),%rax
mov    %edx,-0x330(%rbp,%rax,4)
mov    -0x334(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x334(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c3 <main+0xa3>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jg     1238 <main+0x118>
movslq -0x8(%rbp),%rax
movl   $0x0,-0x330(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1211 <main+0xf1>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1259 <main+0x139>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    123f <main+0x11f>
movslq -0x10(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%esi
lea    0xd95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x330,%rsp
lea    0xebe(%rip),%r14
lea    0xc(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x7,0xc(%rsp)
ja     1150 <main+0x20>
lea    0xe98(%rip),%r14
lea    0x8(%rsp),%r15
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
cmp    $0xc8,%rbx
ja     1170 <main+0x40>
mov    0x8(%rsp),%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     11cb <main+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%edx
shr    $0x1f,%ecx
add    %edx,%ecx
mov    %ecx,%esi
and    $0xfffffffe,%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %edi,0x10(%rsp,%rax,4)
sar    %ecx
add    $0x1,%rax
add    $0x1,%edx
cmp    $0x3,%edx
jae    11a0 <main+0x70>
mov    %ecx,0x8(%rsp)
cmp    $0x8,%eax
ja     11eb <main+0xbb>
mov    %eax,%ecx
lea    (%rsp,%rcx,4),%rdi
add    $0x10,%rdi
mov    $0x8,%ecx
sub    %eax,%ecx
lea    0x4(,%rcx,4),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x10(%rsp,%rbx,4),%esi
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [200 x i32]
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %7
7: ; preds = %15, %0
%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 = %7
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 7
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ true, %9 ], [ %14, %12 ]
br i1 %16, label %7, label %17
17: ; preds = %15
br label %18
18: ; preds = %26, %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %20
20: ; preds = %18
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 200
br label %26
26: ; preds = %23, %20
%27 = phi i1 [ true, %20 ], [ %25, %23 ]
br i1 %27, label %18, label %28
28: ; preds = %26
br label %29
29: ; preds = %32, %28
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32, i32* %6
%34 = srem i32 %33, 2
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [200 x i32], [200 x i32]* %5, i64 0, i64 %36
store i32 %34, i32* %37
%38 = load i32, i32* %6
%39 = sdiv i32 %38, 2
store i32 %39, i32* %6
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %29
42: ; preds = %29
%43 = load i32, i32* %4
store i32 %43, i32* %2
br label %44
44: ; preds = %47, %42
%45 = load i32, i32* %2
%46 = icmp sle i32 %45, 8
br i1 %46, label %47, label %53
47: ; preds = %44
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [200 x i32], [200 x i32]* %5, i64 0, i64 %49
store i32 0, i32* %50
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %44
53: ; preds = %44
store i32 0, i32* %4
br label %54
54: ; preds = %58, %53
%55 = load i32, i32* %4
%56 = load i32, i32* %3
%57 = icmp ne i32 %55, %56
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %54
61: ; preds = %54
%62 = load i32, i32* %4
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [200 x i32], [200 x i32]* %5, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
ret i32 0
}

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