module UnionFind_Potential

implicit none
integer,allocatable,dimension(:)::par
!parentより
integer,allocatable,dimension(:)::diff_weight

contains

recursive function root(x) result(res)
  integer :: x,res,r
  r=par(x)
  if(par(r) /= r)then
    r = root(par(x))
    diff_weight(x)=diff_weight(x)+diff_weight(par(x))
    par(x)=r
  endif
  res = r
end function

subroutine unite(x,y,w)
  !x+w=yとなるように繋げます
  integer :: x,y,w,rx,ry,rw
  !rx,ryはそれぞれの根っこ
  !rwはrxとryの差分です
  
  rx = root(x);ry = root(y)
  
  !rx + weight(x) +w=ry+weight(y)から
  rw = w + weight(x)-weight(y)
  
  if(rx /= ry)then
    par(ry) = rx
    diff_weight(ry)=rw
  endif
end subroutine

function weight(x)
  integer::x,weight
  weight=root(x)
  weight=diff_weight(x)
end function

function diff(x,y)
  integer::x,y,diff
  diff=weight(y)-weight(x)
end function
end module UnionFind_Potential

use UnionFind_Potential

integer n,m
integer l,r,d
read*,n,m
allocate(par(n),diff_weight(n))

!初期化
do i=1,n
  par(i)=i
end do
diff_weight=0

do i=1,m
  read*,l,r,d
  
  if(root(l)==root(r))then
    if(diff(l,r)/=d)then
      print"(A)","No"
      STOP
    end if
   else    
    call unite(l,r,d)
  endif
end do

print"(A)","Yes"

end  
; 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"

@_QMunionfind_potentialEdiff_weight = local_unnamed_addr global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 2, i8 0, [1 x [3 x i64]] [[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64)]] }
@_QMunionfind_potentialEpar = local_unnamed_addr global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 2, i8 0, [1 x [3 x i64]] [[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64)]] }
@_QQcl.0afeddd7f7915c467fc038f331dad6d5 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6352/source.f\00"
@_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.284129 = linkonce constant [3 x i8] c"(A)"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none)
define i32 @_QMunionfind_potentialProot(ptr nocapture readonly %0) local_unnamed_addr #1 {
  %.unpack = load ptr, ptr @_QMunionfind_potentialEpar, align 16, !tbaa !3
  %.unpack111.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7), align 8, !tbaa !3
  %2 = load i32, ptr %0, align 4, !tbaa !7
  %3 = sext i32 %2 to i64
  %4 = sub i64 %3, %.unpack111.unpack.unpack
  %5 = getelementptr i32, ptr %.unpack, i64 %4
  %6 = load i32, ptr %5, align 4, !tbaa !7
  %7 = sext i32 %6 to i64
  %8 = sub i64 %7, %.unpack111.unpack.unpack
  %9 = getelementptr i32, ptr %.unpack, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !7
  %.not = icmp eq i32 %10, %6
  br i1 %.not, label %common.ret152, label %11

common.ret152:                                    ; preds = %1, %11
  %common.ret152.op = phi i32 [ %12, %11 ], [ %6, %1 ]
  ret i32 %common.ret152.op

11:                                               ; preds = %1
  %12 = tail call i32 @_QMunionfind_potentialProot(ptr nonnull %5)
  %.unpack116 = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack123.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %13 = load i32, ptr %0, align 4, !tbaa !7
  %14 = sext i32 %13 to i64
  %15 = sub i64 %14, %.unpack123.unpack.unpack
  %16 = getelementptr i32, ptr %.unpack116, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !7
  %.unpack128 = load ptr, ptr @_QMunionfind_potentialEpar, align 16, !tbaa !3
  %.unpack135.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7), align 8, !tbaa !3
  %18 = sub i64 %14, %.unpack135.unpack.unpack
  %19 = getelementptr i32, ptr %.unpack128, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !7
  %21 = sext i32 %20 to i64
  %22 = sub i64 %21, %.unpack123.unpack.unpack
  %23 = getelementptr i32, ptr %.unpack116, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !7
  %25 = add i32 %24, %17
  store i32 %25, ptr %16, align 4, !tbaa !7
  %26 = load i32, ptr %0, align 4, !tbaa !7
  %27 = sext i32 %26 to i64
  %28 = sub i64 %27, %.unpack135.unpack.unpack
  %29 = getelementptr i32, ptr %.unpack128, i64 %28
  store i32 %12, ptr %29, align 4, !tbaa !7
  br label %common.ret152
}

; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none)
define void @_QMunionfind_potentialPunite(ptr nocapture readonly %0, ptr nocapture readonly %1, ptr nocapture readonly %2) local_unnamed_addr #1 {
  %4 = tail call i32 @_QMunionfind_potentialProot(ptr %0)
  %5 = tail call i32 @_QMunionfind_potentialProot(ptr %1)
  %6 = load i32, ptr %2, align 4, !tbaa !7
  %7 = tail call i32 @_QMunionfind_potentialProot(ptr %0)
  %.unpack.i = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %8 = load i32, ptr %0, align 4, !tbaa !7
  %9 = sext i32 %8 to i64
  %10 = sub i64 %9, %.unpack7.unpack.unpack.i
  %11 = getelementptr i32, ptr %.unpack.i, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !7
  %13 = tail call i32 @_QMunionfind_potentialProot(ptr %1)
  %.not = icmp eq i32 %4, %5
  br i1 %.not, label %27, label %14

14:                                               ; preds = %3
  %.unpack.i50 = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %15 = load i32, ptr %1, align 4, !tbaa !7
  %16 = sext i32 %15 to i64
  %.unpack7.unpack.unpack.i51 = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %17 = sub i64 %16, %.unpack7.unpack.unpack.i51
  %18 = getelementptr i32, ptr %.unpack.i50, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !7
  %20 = add i32 %12, %6
  %21 = sub i32 %20, %19
  %.unpack = load ptr, ptr @_QMunionfind_potentialEpar, align 16, !tbaa !3
  %.unpack33.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7), align 8, !tbaa !3
  %22 = sext i32 %5 to i64
  %23 = sub i64 %22, %.unpack33.unpack.unpack
  %24 = getelementptr i32, ptr %.unpack, i64 %23
  store i32 %4, ptr %24, align 4, !tbaa !7
  %25 = sub i64 %22, %.unpack7.unpack.unpack.i51
  %26 = getelementptr i32, ptr %.unpack.i50, i64 %25
  store i32 %21, ptr %26, align 4, !tbaa !7
  br label %27

27:                                               ; preds = %14, %3
  ret void
}

; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none)
define i32 @_QMunionfind_potentialPweight(ptr nocapture readonly %0) local_unnamed_addr #1 {
  %2 = tail call i32 @_QMunionfind_potentialProot(ptr %0)
  %.unpack = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %3 = load i32, ptr %0, align 4, !tbaa !7
  %4 = sext i32 %3 to i64
  %5 = sub i64 %4, %.unpack7.unpack.unpack
  %6 = getelementptr i32, ptr %.unpack, i64 %5
  %7 = load i32, ptr %6, align 4, !tbaa !7
  ret i32 %7
}

; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none)
define i32 @_QMunionfind_potentialPdiff(ptr nocapture readonly %0, ptr nocapture readonly %1) local_unnamed_addr #1 {
  %3 = tail call i32 @_QMunionfind_potentialProot(ptr %1)
  %.unpack.i = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %4 = load i32, ptr %1, align 4, !tbaa !7
  %5 = sext i32 %4 to i64
  %6 = sub i64 %5, %.unpack7.unpack.unpack.i
  %7 = getelementptr i32, ptr %.unpack.i, i64 %6
  %8 = load i32, ptr %7, align 4, !tbaa !7
  %9 = tail call i32 @_QMunionfind_potentialProot(ptr %0)
  %.unpack.i1 = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack.i2 = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %10 = load i32, ptr %0, align 4, !tbaa !7
  %11 = sext i32 %10 to i64
  %12 = sub i64 %11, %.unpack7.unpack.unpack.i2
  %13 = getelementptr i32, ptr %.unpack.i1, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !7
  %15 = sub i32 %8, %14
  ret i32 %15
}

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0afeddd7f7915c467fc038f331dad6d5, i32 54)
  %7 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %4, i32 4)
  %8 = call i1 @_FortranAioInputInteger(ptr %6, ptr nonnull %3, i32 4)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %6)
  %10 = load i32, ptr %4, align 4, !tbaa !7
  %11 = call i32 @llvm.smax.i32(i32 %10, i32 0)
  %12 = zext i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 2
  %14 = call ptr @malloc(i64 %13)
  store ptr %14, ptr @_QMunionfind_potentialEpar, align 16, !tbaa !3
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 1), align 8, !tbaa !3
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 2), align 16, !tbaa !3
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 3), align 4, !tbaa !3
  store i8 9, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 4), align 1, !tbaa !3
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 5), align 2, !tbaa !3
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 6), align 1, !tbaa !3
  store i64 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7), align 8, !tbaa !3
  store i64 %12, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !3
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !3
  %15 = call ptr @malloc(i64 %13)
  store ptr %15, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 1), align 8, !tbaa !3
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 2), align 16, !tbaa !3
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 3), align 4, !tbaa !3
  store i8 9, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 4), align 1, !tbaa !3
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 5), align 2, !tbaa !3
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 6), align 1, !tbaa !3
  store i64 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  store i64 %12, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !3
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !3
  %16 = icmp sgt i32 %10, 0
  br i1 %16, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %17 = zext i32 %10 to i64
  %min.iters.check = icmp ult i32 %10, 8
  br i1 %min.iters.check, label %.lr.ph.preheader228, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %17, 4294967288
  %ind.end = or i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %18 = getelementptr i32, ptr %14, i64 %index
  store <4 x i32> %vec.ind, ptr %18, align 4, !tbaa !7
  %19 = getelementptr i32, ptr %18, i64 4
  store <4 x i32> %step.add, ptr %19, align 4, !tbaa !7
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %20 = icmp eq i64 %index.next, %n.vec
  br i1 %20, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %17
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader228

.lr.ph.preheader228:                              ; preds = %.lr.ph.preheader, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader228, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader228 ]
  %21 = add nsw i64 %indvars.iv, -1
  %22 = getelementptr i32, ptr %14, i64 %21
  %23 = trunc i64 %indvars.iv to i32
  store i32 %23, ptr %22, align 4, !tbaa !7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %17
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %0
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %26, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %.not225 = icmp slt i32 %10, 1
  br i1 %.not225, label %.loopexit, label %.lr.ph220.preheader

.lr.ph220.preheader:                              ; preds = %.preheader
  %24 = call i64 @llvm.smax.i64(i64 %12, i64 1)
  %25 = shl nuw nsw i64 %24, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %15, i8 0, i64 %25, i1 false), !tbaa !7
  br label %.loopexit

26:                                               ; preds = %._crit_edge
  %27 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.0afeddd7f7915c467fc038f331dad6d5, i32 61)
  %.unpack192.unpack.unpack = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %28 = icmp slt i32 %10, 1
  %29 = select i1 %28, i64 1, i64 %.unpack192.unpack.unpack
  store ptr null, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 1), align 8, !tbaa !3
  store i32 20180515, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 2), align 16, !tbaa !3
  store i8 1, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 3), align 4, !tbaa !3
  store i8 9, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 4), align 1, !tbaa !3
  store i8 2, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 5), align 2, !tbaa !3
  store i8 0, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 6), align 1, !tbaa !3
  store i64 %29, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  store i64 %12, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7, i64 0, i64 1), align 16, !tbaa !3
  store i64 4, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7, i64 0, i64 2), align 8, !tbaa !3
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph220.preheader, %.preheader, %26
  %30 = load i32, ptr %3, align 4, !tbaa !7
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph223, label %._crit_edge224

.lr.ph223:                                        ; preds = %.loopexit, %_QMunionfind_potentialPunite.exit
  %.0152221 = phi i32 [ %84, %_QMunionfind_potentialPunite.exit ], [ %30, %.loopexit ]
  %32 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.0afeddd7f7915c467fc038f331dad6d5, i32 64)
  %33 = call i1 @_FortranAioInputInteger(ptr %32, ptr nonnull %2, i32 4)
  %34 = call i1 @_FortranAioInputInteger(ptr %32, ptr nonnull %5, i32 4)
  %35 = call i1 @_FortranAioInputInteger(ptr %32, ptr nonnull %1, i32 4)
  %36 = call i32 @_FortranAioEndIoStatement(ptr %32)
  %37 = call i32 @_QMunionfind_potentialProot(ptr nonnull %2)
  %38 = call i32 @_QMunionfind_potentialProot(ptr nonnull %5)
  %39 = icmp eq i32 %37, %38
  br i1 %39, label %40, label %60

40:                                               ; preds = %.lr.ph223
  %41 = call i32 @_QMunionfind_potentialProot(ptr nonnull %5)
  %.unpack.i.i = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack.i.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %42 = load i32, ptr %5, align 4, !tbaa !7
  %43 = sext i32 %42 to i64
  %44 = sub i64 %43, %.unpack7.unpack.unpack.i.i
  %45 = getelementptr i32, ptr %.unpack.i.i, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !7
  %47 = call i32 @_QMunionfind_potentialProot(ptr nonnull %2)
  %.unpack.i1.i = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack.i2.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %48 = load i32, ptr %2, align 4, !tbaa !7
  %49 = sext i32 %48 to i64
  %50 = sub i64 %49, %.unpack7.unpack.unpack.i2.i
  %51 = getelementptr i32, ptr %.unpack.i1.i, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !7
  %53 = sub i32 %46, %52
  %54 = load i32, ptr %1, align 4, !tbaa !7
  %.not184 = icmp eq i32 %53, %54
  br i1 %.not184, label %_QMunionfind_potentialPunite.exit, label %55

55:                                               ; preds = %40
  %56 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.0afeddd7f7915c467fc038f331dad6d5, i32 68)
  %57 = call i1 @_FortranAioOutputAscii(ptr %56, ptr nonnull @_QQcl.4E6F, i64 2)
  %58 = call i32 @_FortranAioEndIoStatement(ptr %56)
  %59 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

60:                                               ; preds = %.lr.ph223
  %61 = call i32 @_QMunionfind_potentialProot(ptr nonnull %2)
  %62 = call i32 @_QMunionfind_potentialProot(ptr nonnull %5)
  %63 = load i32, ptr %1, align 4, !tbaa !7
  %64 = call i32 @_QMunionfind_potentialProot(ptr nonnull %2)
  %.unpack.i.i218 = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %.unpack7.unpack.unpack.i.i219 = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %65 = load i32, ptr %2, align 4, !tbaa !7
  %66 = sext i32 %65 to i64
  %67 = sub i64 %66, %.unpack7.unpack.unpack.i.i219
  %68 = getelementptr i32, ptr %.unpack.i.i218, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !7
  %70 = call i32 @_QMunionfind_potentialProot(ptr nonnull %5)
  %.not.i = icmp eq i32 %61, %62
  br i1 %.not.i, label %_QMunionfind_potentialPunite.exit, label %71

71:                                               ; preds = %60
  %.unpack.i50.i = load ptr, ptr @_QMunionfind_potentialEdiff_weight, align 16, !tbaa !3
  %72 = load i32, ptr %5, align 4, !tbaa !7
  %73 = sext i32 %72 to i64
  %.unpack7.unpack.unpack.i51.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEdiff_weight, i64 0, i32 7), align 8, !tbaa !3
  %74 = sub i64 %73, %.unpack7.unpack.unpack.i51.i
  %75 = getelementptr i32, ptr %.unpack.i50.i, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !7
  %77 = add i32 %69, %63
  %78 = sub i32 %77, %76
  %.unpack.i = load ptr, ptr @_QMunionfind_potentialEpar, align 16, !tbaa !3
  %.unpack33.unpack.unpack.i = load i64, ptr getelementptr inbounds ({ ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr @_QMunionfind_potentialEpar, i64 0, i32 7), align 8, !tbaa !3
  %79 = sext i32 %62 to i64
  %80 = sub i64 %79, %.unpack33.unpack.unpack.i
  %81 = getelementptr i32, ptr %.unpack.i, i64 %80
  store i32 %61, ptr %81, align 4, !tbaa !7
  %82 = sub i64 %79, %.unpack7.unpack.unpack.i51.i
  %83 = getelementptr i32, ptr %.unpack.i50.i, i64 %82
  store i32 %78, ptr %83, align 4, !tbaa !7
  br label %_QMunionfind_potentialPunite.exit

_QMunionfind_potentialPunite.exit:                ; preds = %71, %60, %40
  %84 = add nsw i32 %.0152221, -1
  %85 = icmp sgt i32 %.0152221, 1
  br i1 %85, label %.lr.ph223, label %._crit_edge224

._crit_edge224:                                   ; preds = %_QMunionfind_potentialPunite.exit, %.loopexit
  %86 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.0afeddd7f7915c467fc038f331dad6d5, i32 76)
  %87 = call i1 @_FortranAioOutputAscii(ptr %86, ptr nonnull @_QQcl.596573, i64 3)
  %88 = call i32 @_FortranAioEndIoStatement(ptr %86)
  ret void
}

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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) 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

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

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

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!"descriptor member", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any data access", !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}
