#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 = 0, b = 0, number, rest, brsys, counter;
  char digit, result[8] = "00000000";
  scanf("%d", &a);
  scanf("%d", &b);
  if ((a < 0 || a > 7) || (b < 0 || b > 200)) {
    printf("%s", "Wrong range of a or b. Exit");
    return 0;
  }
  number = b;
  brsys = 2;
  counter = 1;
  while (number > 0) {
    rest = number % brsys;
    if (rest == 0) {
      digit = '0';
    } else {
      digit = '1';
    }
    number = number / brsys;
    result[8 - counter] = digit;
    counter++;
  }
  printf("%c", result[7 - a]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0xebc(%rip),%rax
mov    %rax,-0x25(%rbp)
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     1193 <main+0x73>
cmpl   $0x7,-0x8(%rbp)
jg     1193 <main+0x73>
cmpl   $0x0,-0xc(%rbp)
jl     1193 <main+0x73>
cmpl   $0xc8,-0xc(%rbp)
jle    11b4 <main+0x94>
lea    0xe71(%rip),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1240 <main+0x120>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    121c <main+0xfc>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11ef <main+0xcf>
movb   $0x30,-0x1d(%rbp)
jmp    11f3 <main+0xd3>
movb   $0x31,-0x1d(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x1d(%rbp),%cl
mov    $0x8,%eax
sub    -0x1c(%rbp),%eax
cltq
mov    %cl,-0x25(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c8 <main+0xa8>
mov    $0x7,%eax
sub    -0x8(%rbp),%eax
cltq
movsbl -0x25(%rbp,%rax,1),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
movabs $0x3030303030303030,%rax
30 30 30
mov    %rax,0x8(%rsp)
lea    0xea6(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rax
cmp    $0x7,%rax
ja     11c6 <main+0x96>
mov    (%rsp),%ecx
test   %ecx,%ecx
js     11c6 <main+0x96>
cmp    $0xc8,%ecx
jg     11c6 <main+0x96>
test   %ecx,%ecx
je     11b7 <main+0x87>
lea    0xf(%rsp),%rdx
mov    %ecx,%esi
nopw   0x0(%rax,%rax,1)
mov    %ecx,%ebx
and    $0x1,%bl
or     $0x30,%bl
shr    %esi
mov    %bl,(%rdx)
add    $0xffffffffffffffff,%rdx
cmp    $0x1,%ecx
mov    %esi,%ecx
ja     11a0 <main+0x70>
neg    %rax
movsbl 0xf(%rsp,%rax,1),%edi
call   1030 <putchar@plt>
jmp    11db <main+0xab>
lea    0xe36(%rip),%rdi
lea    0xe32(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.result = [8 x i8] c"00000000"
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"Wrong range of a or b. Exit\00"
@.str.3 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca [8 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%10 = bitcast [8 x i8]* %9 to i8*
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %0
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 7
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 200
br i1 %23, label %24, label %26
24: ; preds = %21, %18, %15, %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %58
26: ; preds = %21
%27 = load i32, i32* %3
store i32 %27, i32* %4
store i32 2, i32* %6
store i32 1, i32* %7
br label %28
28: ; preds = %39, %26
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %50
31: ; preds = %28
%32 = load i32, i32* %4
%33 = load i32, i32* %6
%34 = srem i32 %32, %33
store i32 %34, i32* %5
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31
store i8 48, i8* %8
br label %39
38: ; preds = %31
store i8 49, i8* %8
br label %39
39: ; preds = %38, %37
%40 = load i32, i32* %4
%41 = load i32, i32* %6
%42 = sdiv i32 %40, %41
store i32 %42, i32* %4
%43 = load i8, i8* %8
%44 = load i32, i32* %7
%45 = sub nsw i32 8, %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 %46
store i8 %43, i8* %47
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %28
50: ; preds = %28
%51 = load i32, i32* %2
%52 = sub nsw i32 7, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %56)
store i32 0, i32* %1
br label %58
58: ; preds = %50, %24
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"Wrong range of a or b. Exit\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = bitcast i64* %3 to [8 x i8]*
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i64* %3 to i8*
store i64 3472328296227680304, i64* %3
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = icmp ugt i32 %10, 7
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
%14 = select i1 %11, i1 true, i1 %13
%15 = icmp sgt i32 %12, 200
%16 = select i1 %14, i1 true, i1 %15
br i1 %16, label %19, label %17
17: ; preds = %0
%18 = icmp eq i32 %12, 0
br i1 %18, label %32, label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %39
21: ; preds = %17, %21
%22 = phi i64 [ %30, %21 ], [ 1, %17 ]
%23 = phi i32 [ %27, %21 ], [ %12, %17 ]
%24 = and i32 %23, 1
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8 48, i8 49
%27 = lshr i32 %23, 1
%28 = sub nsw i64 8, %22
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 %28
store i8 %26, i8* %29
%30 = add nuw nsw i64 %22, 1
%31 = icmp ult i32 %23, 2
br i1 %31, label %32, label %21
32: ; preds = %21, %17
%33 = sub nsw i32 7, %10
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = call i32 @putchar(i32 %37)
br label %39
39: ; preds = %32, %19
ret i32 0
}