   program abc157c
      implicit none
      integer::N,M,i,j
      integer,parameter::k=10
      integer,allocatable,dimension(:)::A
      integer,allocatable,dimension(:)::S,C

      read *,N,M
      if (N==1.and.M==0) then
         print *,'0'
         stop
      end if
      allocate(A(N))
      A=k
      allocate(S(M),C(M))

      do i=1,M
         read *,S(i),C(i)
         if (S(i)==1.and.C(i)==0.and.N/=1) then
            print *,'-1'
            stop
         end if
      end do

      do i=1,M
         do j=i+1,M
            if (S(i)==S(j).and.C(i)/=C(j)) then
               print *,'-1'
               stop
            end if
         end do
      end do

      do i=1,N
         do j=1,M
            A(S(j))=C(j)
         end do
         if (i==1.and.A(i)==k) A(i)=1
         if (i>1.and.A(i)==k) A(i)=0
         write(*,'(I1)',advance='no') A(i)
      end do

      stop

   end program abc157c
; 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.0 = internal unnamed_addr global ptr null
@_QFEa.7 = internal unnamed_addr global i64 1
@_QFEc.0 = internal unnamed_addr global ptr null
@_QFEs.0 = internal unnamed_addr global ptr null
@_QQcl.684cbd94d5ab00887b970784a0c07f36 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2284/source.f\00"
@_QQcl.30 = linkonce constant [1 x i8] c"0"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_QQcl.2D31 = linkonce constant [2 x i8] c"-1"
@_QQcl.28493129 = linkonce constant [4 x i8] c"(I1)"
@_QQcl.6E6F = linkonce constant [2 x i8] c"no"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 8)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i32, ptr %2, align 4, !tbaa !3
  %8 = icmp eq i32 %7, 1
  %9 = load i32, ptr %1, align 4, !tbaa !3
  %10 = icmp eq i32 %9, 0
  %11 = and i1 %8, %10
  br i1 %11, label %12, label %17

12:                                               ; preds = %0
  %13 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 10)
  %14 = call i1 @_FortranAioOutputAscii(ptr %13, ptr nonnull @_QQcl.30, i64 1)
  %15 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %16 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

17:                                               ; preds = %0
  %18 = call i32 @llvm.smax.i32(i32 %7, i32 0)
  %19 = zext i32 %18 to i64
  %20 = shl nuw nsw i64 %19, 2
  %21 = call ptr @malloc(i64 %20)
  store ptr %21, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEa.7, align 8, !tbaa !7
  %.not = icmp eq ptr %21, null
  br i1 %.not, label %31, label %.preheader

.preheader:                                       ; preds = %17
  %.not688 = icmp slt i32 %7, 1
  br i1 %.not688, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %min.iters.check = icmp ult i32 %18, 8
  br i1 %min.iters.check, label %.lr.ph.preheader717, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %19, 2147483640
  %ind.end = and i64 %19, 7
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %22 = getelementptr i32, ptr %21, i64 %index
  store <4 x i32> <i32 10, i32 10, i32 10, i32 10>, ptr %22, align 4, !tbaa !3
  %23 = getelementptr i32, ptr %22, i64 4
  store <4 x i32> <i32 10, i32 10, i32 10, i32 10>, ptr %23, align 4, !tbaa !3
  %index.next = add nuw i64 %index, 8
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %19
  br i1 %cmp.n, label %.loopexit, label %.lr.ph.preheader717

.lr.ph.preheader717:                              ; preds = %.lr.ph.preheader, %middle.block
  %.ph = phi i64 [ %19, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.ph718 = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader717, %.lr.ph
  %25 = phi i64 [ %29, %.lr.ph ], [ %.ph, %.lr.ph.preheader717 ]
  %26 = phi i64 [ %27, %.lr.ph ], [ %.ph718, %.lr.ph.preheader717 ]
  %27 = add nuw nsw i64 %26, 1
  %28 = getelementptr i32, ptr %21, i64 %26
  store i32 10, ptr %28, align 4, !tbaa !3
  %29 = add nsw i64 %25, -1
  %30 = icmp ugt i64 %25, 1
  br i1 %30, label %.lr.ph, label %.loopexit, !llvm.loop !12

31:                                               ; preds = %17
  %32 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 14)
  %.unpack654.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %33 = icmp slt i32 %7, 1
  %34 = select i1 %33, i64 1, i64 %.unpack654.unpack.unpack
  store ptr null, ptr @_QFEa.0, align 8, !tbaa !7
  store i64 %34, ptr @_QFEa.7, align 8, !tbaa !7
  %.pre = load i32, ptr %1, align 4, !tbaa !3
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %middle.block, %.preheader, %31
  %35 = phi i32 [ %9, %.preheader ], [ %.pre, %31 ], [ %9, %middle.block ], [ %9, %.lr.ph ]
  %36 = call i32 @llvm.smax.i32(i32 %35, i32 0)
  %37 = zext i32 %36 to i64
  %38 = shl nuw nsw i64 %37, 2
  %39 = call ptr @malloc(i64 %38)
  store ptr %39, ptr @_QFEs.0, align 8, !tbaa !7
  %40 = call ptr @malloc(i64 %38)
  store ptr %40, ptr @_QFEc.0, align 8, !tbaa !7
  %41 = icmp sgt i32 %35, 0
  br i1 %41, label %.lr.ph671, label %._crit_edge681

.lr.ph671:                                        ; preds = %.loopexit, %68
  %.0470670 = phi i32 [ %69, %68 ], [ 1, %.loopexit ]
  %42 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 18)
  %.unpack599 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %43 = sext i32 %.0470670 to i64
  %44 = add nsw i64 %43, -1
  %45 = getelementptr i32, ptr %.unpack599, i64 %44
  %46 = call i1 @_FortranAioInputInteger(ptr %42, ptr %45, i32 4)
  %.unpack611 = load ptr, ptr @_QFEc.0, align 8, !tbaa !7
  %47 = add nsw i64 %43, -1
  %48 = getelementptr i32, ptr %.unpack611, i64 %47
  %49 = call i1 @_FortranAioInputInteger(ptr %42, ptr %48, i32 4)
  %50 = call i32 @_FortranAioEndIoStatement(ptr %42)
  %.unpack623 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %51 = add nsw i64 %43, -1
  %52 = getelementptr i32, ptr %.unpack623, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !3
  %54 = icmp eq i32 %53, 1
  %.unpack635 = load ptr, ptr @_QFEc.0, align 8, !tbaa !7
  %55 = add nsw i64 %43, -1
  %56 = getelementptr i32, ptr %.unpack635, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !3
  %58 = icmp eq i32 %57, 0
  %59 = and i1 %54, %58
  %60 = load i32, ptr %2, align 4, !tbaa !3
  %61 = icmp ne i32 %60, 1
  %62 = and i1 %59, %61
  br i1 %62, label %63, label %68

63:                                               ; preds = %.lr.ph671
  %64 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 20)
  %65 = call i1 @_FortranAioOutputAscii(ptr %64, ptr nonnull @_QQcl.2D31, i64 2)
  %66 = call i32 @_FortranAioEndIoStatement(ptr %64)
  %67 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

68:                                               ; preds = %.lr.ph671
  %69 = add nuw i32 %.0470670, 1
  %exitcond.not = icmp eq i32 %.0470670, %35
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph671

._crit_edge:                                      ; preds = %68
  %.pre697 = load i32, ptr %1, align 4, !tbaa !3
  %70 = icmp sgt i32 %.pre697, 0
  br i1 %70, label %.lr.ph680, label %._crit_edge681

.lr.ph680:                                        ; preds = %._crit_edge, %._crit_edge676
  %.1678 = phi i32 [ %71, %._crit_edge676 ], [ 1, %._crit_edge ]
  %71 = add nuw i32 %.1678, 1
  %72 = sub i32 %.pre697, %.1678
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph675, label %._crit_edge676

.lr.ph675:                                        ; preds = %.lr.ph680
  %74 = sext i32 %.1678 to i64
  %75 = add nsw i64 %74, -1
  %76 = getelementptr i32, ptr %.unpack623, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !3
  %78 = add nsw i64 %74, -1
  %79 = getelementptr i32, ptr %.unpack635, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !3
  br label %81

81:                                               ; preds = %.lr.ph675, %97
  %.0673 = phi i32 [ %71, %.lr.ph675 ], [ %98, %97 ]
  %82 = sext i32 %.0673 to i64
  %83 = add nsw i64 %82, -1
  %84 = getelementptr i32, ptr %.unpack623, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !3
  %86 = icmp eq i32 %77, %85
  %87 = add nsw i64 %82, -1
  %88 = getelementptr i32, ptr %.unpack635, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !3
  %90 = icmp ne i32 %80, %89
  %91 = and i1 %86, %90
  br i1 %91, label %92, label %97

92:                                               ; preds = %81
  %93 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 28)
  %94 = call i1 @_FortranAioOutputAscii(ptr %93, ptr nonnull @_QQcl.2D31, i64 2)
  %95 = call i32 @_FortranAioEndIoStatement(ptr %93)
  %96 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

97:                                               ; preds = %81
  %98 = add i32 %.0673, 1
  %exitcond689.not = icmp eq i32 %.0673, %.pre697
  br i1 %exitcond689.not, label %._crit_edge676, label %81

._crit_edge676:                                   ; preds = %97, %.lr.ph680
  %exitcond690.not = icmp eq i32 %.pre697, %.1678
  br i1 %exitcond690.not, label %._crit_edge681, label %.lr.ph680

._crit_edge681:                                   ; preds = %._crit_edge676, %.loopexit, %._crit_edge
  %99 = load i32, ptr %2, align 4, !tbaa !3
  %100 = icmp sgt i32 %99, 0
  br i1 %100, label %.lr.ph686.preheader, label %._crit_edge687

.lr.ph686.preheader:                              ; preds = %._crit_edge681
  %101 = zext i32 %99 to i64
  br label %.lr.ph686

.lr.ph686:                                        ; preds = %.lr.ph686.preheader, %141
  %indvars.iv693 = phi i64 [ 1, %.lr.ph686.preheader ], [ %indvars.iv.next694, %141 ]
  %102 = load i32, ptr %1, align 4, !tbaa !3
  %103 = icmp sgt i32 %102, 0
  br i1 %103, label %.lr.ph683, label %.lr.ph686.._crit_edge684_crit_edge

.lr.ph686.._crit_edge684_crit_edge:               ; preds = %.lr.ph686
  %.unpack.pre = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack510.unpack.unpack.pre = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  br label %._crit_edge684

.lr.ph683:                                        ; preds = %.lr.ph686
  %104 = zext i32 %102 to i64
  %.unpack539 = load ptr, ptr @_QFEc.0, align 8, !tbaa !7
  %.unpack551 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack558.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %.unpack563 = load ptr, ptr @_QFEs.0, align 8, !tbaa !7
  %xtraiter = and i64 %104, 1
  %105 = icmp eq i32 %102, 1
  br i1 %105, label %._crit_edge684.loopexit.unr-lcssa, label %.lr.ph683.new

.lr.ph683.new:                                    ; preds = %.lr.ph683
  %unroll_iter = and i64 %104, 4294967294
  br label %106

106:                                              ; preds = %106, %.lr.ph683.new
  %indvars.iv = phi i64 [ 1, %.lr.ph683.new ], [ %indvars.iv.next.1, %106 ]
  %niter = phi i64 [ 0, %.lr.ph683.new ], [ %niter.next.1, %106 ]
  %107 = add nsw i64 %indvars.iv, -1
  %108 = getelementptr i32, ptr %.unpack539, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !3
  %110 = add nsw i64 %indvars.iv, -1
  %111 = getelementptr i32, ptr %.unpack563, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !3
  %113 = sext i32 %112 to i64
  %114 = sub i64 %113, %.unpack558.unpack.unpack
  %115 = getelementptr i32, ptr %.unpack551, i64 %114
  store i32 %109, ptr %115, align 4, !tbaa !3
  %116 = getelementptr i32, ptr %.unpack539, i64 %indvars.iv
  %117 = load i32, ptr %116, align 4, !tbaa !3
  %118 = getelementptr i32, ptr %.unpack563, i64 %indvars.iv
  %119 = load i32, ptr %118, align 4, !tbaa !3
  %120 = sext i32 %119 to i64
  %121 = sub i64 %120, %.unpack558.unpack.unpack
  %122 = getelementptr i32, ptr %.unpack551, i64 %121
  store i32 %117, ptr %122, align 4, !tbaa !3
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %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_edge684.loopexit.unr-lcssa, label %106

._crit_edge684.loopexit.unr-lcssa:                ; preds = %106, %.lr.ph683
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph683 ], [ %indvars.iv.next.1, %106 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge684, label %._crit_edge684.loopexit.epilog-lcssa

._crit_edge684.loopexit.epilog-lcssa:             ; preds = %._crit_edge684.loopexit.unr-lcssa
  %123 = add nsw i64 %indvars.iv.unr, -1
  %124 = getelementptr i32, ptr %.unpack539, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !3
  %126 = add nsw i64 %indvars.iv.unr, -1
  %127 = getelementptr i32, ptr %.unpack563, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !3
  %129 = sext i32 %128 to i64
  %130 = sub i64 %129, %.unpack558.unpack.unpack
  %131 = getelementptr i32, ptr %.unpack551, i64 %130
  store i32 %125, ptr %131, align 4, !tbaa !3
  br label %._crit_edge684

._crit_edge684:                                   ; preds = %._crit_edge684.loopexit.epilog-lcssa, %._crit_edge684.loopexit.unr-lcssa, %.lr.ph686.._crit_edge684_crit_edge
  %.unpack510.unpack.unpack = phi i64 [ %.unpack510.unpack.unpack.pre, %.lr.ph686.._crit_edge684_crit_edge ], [ %.unpack558.unpack.unpack, %._crit_edge684.loopexit.unr-lcssa ], [ %.unpack558.unpack.unpack, %._crit_edge684.loopexit.epilog-lcssa ]
  %.unpack = phi ptr [ %.unpack.pre, %.lr.ph686.._crit_edge684_crit_edge ], [ %.unpack551, %._crit_edge684.loopexit.unr-lcssa ], [ %.unpack551, %._crit_edge684.loopexit.epilog-lcssa ]
  %132 = icmp eq i64 %indvars.iv693, 1
  %133 = sub i64 %indvars.iv693, %.unpack510.unpack.unpack
  %134 = getelementptr i32, ptr %.unpack, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !3
  %136 = icmp eq i32 %135, 10
  %137 = and i1 %132, %136
  br i1 %137, label %.sink.split, label %138

138:                                              ; preds = %._crit_edge684
  %139 = icmp ugt i64 %indvars.iv693, 1
  %140 = and i1 %139, %136
  br i1 %140, label %.sink.split, label %141

.sink.split:                                      ; preds = %138, %._crit_edge684
  %.sink = phi i32 [ 1, %._crit_edge684 ], [ 0, %138 ]
  store i32 %.sink, ptr %134, align 4, !tbaa !3
  br label %141

141:                                              ; preds = %.sink.split, %138
  %142 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28493129, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.684cbd94d5ab00887b970784a0c07f36, i32 40)
  %143 = call i1 @_FortranAioSetAdvance(ptr %142, ptr nonnull @_QQcl.6E6F, i64 2)
  %.unpack527 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack534.unpack.unpack = load i64, ptr @_QFEa.7, align 8, !tbaa !7
  %144 = sub i64 %indvars.iv693, %.unpack534.unpack.unpack
  %145 = getelementptr i32, ptr %.unpack527, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !3
  %147 = call i1 @_FortranAioOutputInteger32(ptr %142, i32 %146)
  %148 = call i32 @_FortranAioEndIoStatement(ptr %142)
  %indvars.iv.next694 = add nuw nsw i64 %indvars.iv693, 1
  %exitcond696.not = icmp eq i64 %indvars.iv693, %101
  br i1 %exitcond696.not, label %._crit_edge687, label %.lr.ph686

._crit_edge687:                                   ; preds = %141, %._crit_edge681
  %149 = 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 ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

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

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

declare {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

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

declare i1 @_FortranAioSetAdvance(ptr, ptr, i64) 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) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
