program knot_puzzle
  implicit none
  integer :: n, i, j
  integer(8) :: l, a(100000)
  a = 0_8
  read(*,*) n, l
  read(*,*) a(1:n)
  j = -1
  do i = 1, n-1
    if (a(i)+a(i+1).ge.l) then
      j = i
    end if
  end do
  if (j.lt.0) then
    write(*,'(a)') "Impossible"
    stop
  end if
  write(*,'(a)') "Possible"
  do i = 1, j-1
    write(*,'(i0)') i
  end do
  do i = n-1, j, -1
    write(*,'(i0)') i
  end do
  stop
end program knot_puzzle
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEa = internal global [100000 x i64] undef
@_QQcl.5116941e7aa80f17cd49bd5fdd4094b0 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7990/source.f\00"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.496D706F737369626C65 = linkonce constant [10 x i8] c"Impossible"
@_QQcl.506F737369626C65 = linkonce constant [8 x i8] c"Possible"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) @_QFEa, i8 0, i64 800000, i1 false), !tbaa !3
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.5116941e7aa80f17cd49bd5fdd4094b0, i32 6)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 8)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.5116941e7aa80f17cd49bd5fdd4094b0, i32 7)
  %9 = load i32, ptr %3, align 4, !tbaa !3
  %10 = call i32 @llvm.smax.i32(i32 %9, i32 0)
  %11 = zext i32 %10 to i64
  store ptr @_QFEa, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %11, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %12 = call i1 @_FortranAioInputDescriptor(ptr %8, ptr nonnull %1)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %14 = load i32, ptr %3, align 4, !tbaa !3
  %15 = add i32 %14, -1
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %0
  %17 = zext i32 %15 to i64
  %18 = load i64, ptr %2, align 8, !tbaa !3
  %xtraiter = and i64 %17, 1
  %19 = icmp eq i32 %15, 1
  br i1 %19, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %17, 4294967294
  br label %20

20:                                               ; preds = %20, %.lr.ph.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.1, %20 ]
  %.014 = phi i32 [ -1, %.lr.ph.new ], [ %spec.select.1, %20 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %20 ]
  %21 = add nsw i64 %indvars.iv, -1
  %22 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext = shl i64 %indvars.iv.next, 32
  %24 = ashr exact i64 %sext, 32
  %25 = add nsw i64 %24, -1
  %26 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !3
  %28 = add i64 %27, %23
  %.not = icmp slt i64 %28, %18
  %29 = trunc i64 %indvars.iv to i32
  %spec.select = select i1 %.not, i32 %.014, i32 %29
  %30 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %indvars.iv
  %31 = load i64, ptr %30, align 8, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %sext.1 = shl i64 %indvars.iv.next.1, 32
  %32 = ashr exact i64 %sext.1, 32
  %33 = add nsw i64 %32, -1
  %34 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !3
  %36 = add i64 %35, %31
  %.not.1 = icmp slt i64 %36, %18
  %37 = trunc i64 %indvars.iv.next to i32
  %spec.select.1 = select i1 %.not.1, i32 %spec.select, i32 %37
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %20

._crit_edge.unr-lcssa:                            ; preds = %20, %.lr.ph
  %spec.select.lcssa.ph = phi i32 [ undef, %.lr.ph ], [ %spec.select.1, %20 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next.1, %20 ]
  %.014.unr = phi i32 [ -1, %.lr.ph ], [ %spec.select.1, %20 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %._crit_edge.unr-lcssa
  %38 = add nsw i64 %indvars.iv.unr, -1
  %39 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !3
  %indvars.iv.next.epil = shl i64 %indvars.iv.unr, 32
  %sext.epil = add i64 %indvars.iv.next.epil, 4294967296
  %41 = ashr exact i64 %sext.epil, 32
  %42 = add nsw i64 %41, -1
  %43 = getelementptr [100000 x i64], ptr @_QFEa, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !3
  %45 = add i64 %44, %40
  %.not.epil = icmp slt i64 %45, %18
  %46 = trunc i64 %indvars.iv.unr to i32
  %spec.select.epil = select i1 %.not.epil, i32 %.014.unr, i32 %46
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %._crit_edge.unr-lcssa ], [ %spec.select.epil, %._crit_edge.epilog-lcssa ]
  %47 = icmp slt i32 %spec.select.lcssa, 0
  br i1 %47, label %._crit_edge.thread, label %52

._crit_edge.thread:                               ; preds = %0, %._crit_edge
  %48 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.5116941e7aa80f17cd49bd5fdd4094b0, i32 15)
  %49 = call i1 @_FortranAioOutputAscii(ptr %48, ptr nonnull @_QQcl.496D706F737369626C65, i64 10)
  %50 = call i32 @_FortranAioEndIoStatement(ptr %48)
  %51 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

52:                                               ; preds = %._crit_edge
  %53 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.5116941e7aa80f17cd49bd5fdd4094b0, i32 18)
  %54 = call i1 @_FortranAioOutputAscii(ptr %53, ptr nonnull @_QQcl.506F737369626C65, i64 8)
  %55 = call i32 @_FortranAioEndIoStatement(ptr %53)
  %56 = icmp ugt i32 %spec.select.lcssa, 1
  br i1 %56, label %.lr.ph16.preheader, label %._crit_edge17

.lr.ph16.preheader:                               ; preds = %52
  %57 = add nsw i32 %spec.select.lcssa, -1
  %58 = zext i32 %57 to i64
  br label %.lr.ph16

.lr.ph16:                                         ; preds = %.lr.ph16.preheader, %.lr.ph16
  %59 = phi i64 [ %65, %.lr.ph16 ], [ %58, %.lr.ph16.preheader ]
  %60 = phi i32 [ %64, %.lr.ph16 ], [ 1, %.lr.ph16.preheader ]
  %61 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.5116941e7aa80f17cd49bd5fdd4094b0, i32 20)
  %62 = call i1 @_FortranAioOutputInteger32(ptr %61, i32 %60)
  %63 = call i32 @_FortranAioEndIoStatement(ptr %61)
  %64 = add nuw i32 %60, 1
  %65 = add nsw i64 %59, -1
  %66 = icmp ugt i64 %59, 1
  br i1 %66, label %.lr.ph16, label %._crit_edge17

._crit_edge17:                                    ; preds = %.lr.ph16, %52
  %67 = load i32, ptr %3, align 4, !tbaa !3
  %68 = zext i32 %spec.select.lcssa to i64
  %69 = sub i32 0, %67
  %70 = sext i32 %69 to i64
  %71 = add nsw i64 %68, %70
  %72 = icmp slt i64 %71, 0
  br i1 %72, label %.lr.ph20.preheader, label %._crit_edge21

.lr.ph20.preheader:                               ; preds = %._crit_edge17
  %73 = sub nsw i64 0, %71
  br label %.lr.ph20

.lr.ph20:                                         ; preds = %.lr.ph20.preheader, %.lr.ph20
  %74 = phi i64 [ %79, %.lr.ph20 ], [ %73, %.lr.ph20.preheader ]
  %.in18 = phi i32 [ %75, %.lr.ph20 ], [ %67, %.lr.ph20.preheader ]
  %75 = add i32 %.in18, -1
  %76 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.5116941e7aa80f17cd49bd5fdd4094b0, i32 23)
  %77 = call i1 @_FortranAioOutputInteger32(ptr %76, i32 %75)
  %78 = call i32 @_FortranAioEndIoStatement(ptr %76)
  %79 = add nsw i64 %74, -1
  %80 = icmp ugt i64 %74, 1
  br i1 %80, label %.lr.ph20, label %._crit_edge21

._crit_edge21:                                    ; preds = %.lr.ph20, %._crit_edge17
  %81 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { noreturn }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
