#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*/ dump(int);
int first(int *, int);
int last(int *);
int next(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int c, n;
  scanf("%d %d", &c, &n);
  int possible = 1;
  int current = 0;
  if (!(possible = first(&current, c)))
    dump(n - 1);
  for (int i = 1; i < n - 1; i++) {
    if (!(possible = next(&current, c))) {
      dump(n - i - 1);
      break;
    }
  }
  if (possible)
    possible = last(&current);
  printf(possible ? "possible\n" : "impossible\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1070 <scanf@plt>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   1080 <first@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    11b4 <main+0x54>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1050 <dump@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120a <main+0xaa>
mov    -0x8(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   1060 <next@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jne    11f7 <main+0x97>
mov    -0xc(%rbp),%edi
sub    -0x18(%rbp),%edi
sub    $0x1,%edi
call   1050 <dump@plt>
jmp    120a <main+0xaa>
jmp    11fc <main+0x9c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11bb <main+0x5b>
cmpl   $0x0,-0x10(%rbp)
je     1220 <main+0xc0>
lea    -0x14(%rbp),%rdi
call   1040 <last@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
lea    0xddc(%rip),%rdi
lea    0xdd7(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe92(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1070 <scanf@plt>
movl   $0x0,0x10(%rsp)
mov    0x14(%rsp),%esi
lea    0x10(%rsp),%rdi
call   1080 <first@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11d2 <main+0x72>
cmpl   $0x3,0xc(%rsp)
jl     11e5 <main+0x85>
mov    $0x2,%ebx
lea    0x10(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    0x14(%rsp),%esi
mov    %r14,%rdi
call   1060 <next@plt>
test   %eax,%eax
je     1209 <main+0xa9>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
lea    0x1(%rbx),%ecx
cmp    %eax,%ebx
mov    %ecx,%ebx
jl     11b0 <main+0x50>
jmp    11e9 <main+0x89>
mov    0xc(%rsp),%edi
add    $0xffffffff,%edi
call   1050 <dump@plt>
cmpl   $0x3,0xc(%rsp)
jge    11a0 <main+0x40>
test   %ebx,%ebx
je     1214 <main+0xb4>
lea    0x10(%rsp),%rdi
call   1040 <last@plt>
test   %eax,%eax
lea    0xe0a(%rip),%rax
lea    0xe05(%rip),%rdi
cmove  %rax,%rdi
jmp    121b <main+0xbb>
mov    0xc(%rsp),%edi
sub    %ebx,%edi
call   1050 <dump@plt>
lea    0xdeb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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