; LLVM IR from Aryansh-S/USACO :: USACO/2008/Open/Old Silver (Now Gold)/ClearAndPresentDanger (main)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Floyd = type { [200 x [200 x i32]] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@must = external dso_local global [10005 x i32], align 16
@ans = external dso_local global i32, align 4
@first = external dso_local global %struct.Floyd, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = call noalias ptr @fopen(ptr noundef @.str.2, ptr noundef @.str.3)
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %22

17:                                               ; preds = %0
  %18 = load ptr, ptr @stdin, align 8, !tbaa !8
  %19 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %18)
  %20 = load ptr, ptr @stdout, align 8, !tbaa !8
  %21 = call ptr @freopen(ptr noundef @.str.4, ptr noundef @.str.5, ptr noundef %20)
  br label %22

22:                                               ; preds = %17, %0
  call void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %23 = load i32, ptr @m, align 4, !tbaa !11
  %24 = icmp sgt i32 0, %23
  %25 = zext i1 %24 to i32
  %26 = sub nsw i32 0, %25
  store i32 %26, ptr %2, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %42, %22
  %28 = load i32, ptr %2, align 4, !tbaa !11
  %29 = load i32, ptr @m, align 4, !tbaa !11
  %30 = load i32, ptr @m, align 4, !tbaa !11
  %31 = icmp sgt i32 0, %30
  %32 = zext i1 %31 to i32
  %33 = sub nsw i32 %29, %32
  %34 = icmp ne i32 %28, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %49

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %3)
  %37 = load i32, ptr %3, align 4, !tbaa !11
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %3, align 4, !tbaa !11
  %39 = load i32, ptr %2, align 4, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [10005 x i32], ptr @must, i64 0, i64 %40
  store i32 %38, ptr %41, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %42

42:                                               ; preds = %36
  %43 = load i32, ptr @m, align 4, !tbaa !11
  %44 = icmp sgt i32 0, %43
  %45 = zext i1 %44 to i64
  %46 = select i1 %44, i32 -1, i32 1
  %47 = load i32, ptr %2, align 4, !tbaa !11
  %48 = add nsw i32 %47, %46
  store i32 %48, ptr %2, align 4, !tbaa !11
  br label %27, !llvm.loop !13

49:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %50 = load i32, ptr @n, align 4, !tbaa !11
  %51 = icmp sgt i32 0, %50
  %52 = zext i1 %51 to i32
  %53 = sub nsw i32 0, %52
  store i32 %53, ptr %4, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %89, %49
  %55 = load i32, ptr %4, align 4, !tbaa !11
  %56 = load i32, ptr @n, align 4, !tbaa !11
  %57 = load i32, ptr @n, align 4, !tbaa !11
  %58 = icmp sgt i32 0, %57
  %59 = zext i1 %58 to i32
  %60 = sub nsw i32 %56, %59
  %61 = icmp ne i32 %55, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %54
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %96

63:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %64 = load i32, ptr @n, align 4, !tbaa !11
  %65 = icmp sgt i32 0, %64
  %66 = zext i1 %65 to i32
  %67 = sub nsw i32 0, %66
  store i32 %67, ptr %6, align 4, !tbaa !11
  br label %68

68:                                               ; preds = %81, %63
  %69 = load i32, ptr %6, align 4, !tbaa !11
  %70 = load i32, ptr @n, align 4, !tbaa !11
  %71 = load i32, ptr @n, align 4, !tbaa !11
  %72 = icmp sgt i32 0, %71
  %73 = zext i1 %72 to i32
  %74 = sub nsw i32 %70, %73
  %75 = icmp ne i32 %69, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %68
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %88

77:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %7)
  %78 = load i32, ptr %4, align 4, !tbaa !11
  %79 = load i32, ptr %6, align 4, !tbaa !11
  %80 = load i32, ptr %7, align 4, !tbaa !11
  call void @_ZN5FloydIiLi200EE4add_Eiii(ptr noundef nonnull align 4 dereferenceable(160000) @first, i32 noundef %78, i32 noundef %79, i32 noundef %80)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %81

81:                                               ; preds = %77
  %82 = load i32, ptr @n, align 4, !tbaa !11
  %83 = icmp sgt i32 0, %82
  %84 = zext i1 %83 to i64
  %85 = select i1 %83, i32 -1, i32 1
  %86 = load i32, ptr %6, align 4, !tbaa !11
  %87 = add nsw i32 %86, %85
  store i32 %87, ptr %6, align 4, !tbaa !11
  br label %68, !llvm.loop !15

88:                                               ; preds = %76
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr @n, align 4, !tbaa !11
  %91 = icmp sgt i32 0, %90
  %92 = zext i1 %91 to i64
  %93 = select i1 %91, i32 -1, i32 1
  %94 = load i32, ptr %4, align 4, !tbaa !11
  %95 = add nsw i32 %94, %93
  store i32 %95, ptr %4, align 4, !tbaa !11
  br label %54, !llvm.loop !16

96:                                               ; preds = %62
  call void @_ZN5FloydIiLi200EE3updEv(ptr noundef nonnull align 4 dereferenceable(160000) @first)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %97 = load i32, ptr @m, align 4, !tbaa !11
  %98 = sub nsw i32 %97, 1
  %99 = icmp sgt i32 0, %98
  %100 = zext i1 %99 to i32
  %101 = sub nsw i32 0, %100
  store i32 %101, ptr %8, align 4, !tbaa !11
  br label %102

102:                                              ; preds = %126, %96
  %103 = load i32, ptr %8, align 4, !tbaa !11
  %104 = load i32, ptr @m, align 4, !tbaa !11
  %105 = sub nsw i32 %104, 1
  %106 = load i32, ptr @m, align 4, !tbaa !11
  %107 = sub nsw i32 %106, 1
  %108 = icmp sgt i32 0, %107
  %109 = zext i1 %108 to i32
  %110 = sub nsw i32 %105, %109
  %111 = icmp ne i32 %103, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %102
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %134

113:                                              ; preds = %102
  %114 = load i32, ptr %8, align 4, !tbaa !11
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [10005 x i32], ptr @must, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !11
  %118 = load i32, ptr %8, align 4, !tbaa !11
  %119 = add nsw i32 %118, 1
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [10005 x i32], ptr @must, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !11
  %123 = call noundef i32 @_ZN5FloydIiLi200EE5queryEii(ptr noundef nonnull align 4 dereferenceable(160000) @first, i32 noundef %117, i32 noundef %122)
  %124 = load i32, ptr @ans, align 4, !tbaa !11
  %125 = add nsw i32 %124, %123
  store i32 %125, ptr @ans, align 4, !tbaa !11
  br label %126

126:                                              ; preds = %113
  %127 = load i32, ptr @m, align 4, !tbaa !11
  %128 = sub nsw i32 %127, 1
  %129 = icmp sgt i32 0, %128
  %130 = zext i1 %129 to i64
  %131 = select i1 %129, i32 -1, i32 1
  %132 = load i32, ptr %8, align 4, !tbaa !11
  %133 = add nsw i32 %132, %131
  store i32 %133, ptr %8, align 4, !tbaa !11
  br label %102, !llvm.loop !17

134:                                              ; preds = %112
  %135 = load i32, ptr @ans, align 4, !tbaa !11
  call void @_Z3outIiEvT_(i32 noundef %135)
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5FloydIiLi200EE4add_Eiii(ptr noundef nonnull align 4 dereferenceable(160000), i32 noundef, i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5FloydIiLi200EE3updEv(ptr noundef nonnull align 4 dereferenceable(160000)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5FloydIiLi200EE5queryEii(ptr noundef nonnull align 4 dereferenceable(160000), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3outIiEvT_(i32 noundef) #3

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Floyd = type { [200 x [200 x i32]] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@must = external dso_local local_unnamed_addr global [10005 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@first = external dso_local global %struct.Floyd, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3)
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %15, label %10

10:                                               ; preds = %0
  %11 = load ptr, ptr @stdin, align 8, !tbaa !8
  %12 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %11)
  %13 = load ptr, ptr @stdout, align 8, !tbaa !8
  %14 = tail call ptr @freopen(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, ptr noundef %13)
  br label %15

15:                                               ; preds = %10, %0
  tail call void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %16 = load i32, ptr @m, align 4, !tbaa !11
  %.not1729 = icmp eq i32 %16, 0
  br i1 %.not1729, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %15
  %.lobit.neg = ashr i32 %16, 31
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %15
  %17 = load i32, ptr @n, align 4, !tbaa !11
  %.not1937 = icmp eq i32 %17, 0
  br i1 %.not1937, label %._crit_edge40, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge
  %.lobit.neg18 = ashr i32 %17, 31
  br label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.01530 = phi i32 [ %24, %.lr.ph ], [ %.lobit.neg, %.lr.ph.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %1)
  %18 = load i32, ptr %1, align 4, !tbaa !11
  %19 = add nsw i32 %18, -1
  %20 = sext i32 %.01530 to i64
  %21 = getelementptr inbounds [10005 x i32], ptr @must, i64 0, i64 %20
  store i32 %19, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %22 = load i32, ptr @m, align 4, !tbaa !11
  %.inv27 = icmp sgt i32 %22, -1
  %23 = select i1 %.inv27, i32 1, i32 -1
  %24 = add nsw i32 %23, %.01530
  %.lobit.neg16 = ashr i32 %22, 31
  %25 = add i32 %.lobit.neg16, %22
  %.not17 = icmp eq i32 %24, %25
  br i1 %.not17, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge35
  %26 = phi i32 [ %30, %._crit_edge35 ], [ %17, %.preheader.preheader ]
  %.lobit.neg2339 = phi i32 [ %.lobit.neg23.pre-phi, %._crit_edge35 ], [ %.lobit.neg18, %.preheader.preheader ]
  %.01438 = phi i32 [ %32, %._crit_edge35 ], [ %.lobit.neg18, %.preheader.preheader ]
  %.lobit.neg2431 = ashr i32 %26, 31
  %27 = add i32 %.lobit.neg2431, %26
  %.not2532 = icmp eq i32 %.lobit.neg2339, %27
  br i1 %.not2532, label %._crit_edge35, label %.lr.ph34

._crit_edge40:                                    ; preds = %._crit_edge35, %._crit_edge
  call void @_ZN5FloydIiLi200EE3updEv(ptr noundef nonnull align 4 dereferenceable(160000) @first)
  %28 = load i32, ptr @m, align 4, !tbaa !11
  %.not2142 = icmp eq i32 %28, 1
  br i1 %.not2142, label %._crit_edge40.._crit_edge46_crit_edge, label %.lr.ph45.preheader

._crit_edge40.._crit_edge46_crit_edge:            ; preds = %._crit_edge40
  %.pre = load i32, ptr @ans, align 4, !tbaa !11
  br label %._crit_edge46

.lr.ph45.preheader:                               ; preds = %._crit_edge40
  %29 = icmp slt i32 %28, 1
  %.neg = sext i1 %29 to i32
  br label %.lr.ph45

._crit_edge35:                                    ; preds = %.lr.ph34, %.preheader
  %.pre-phi = phi i32 [ %27, %.preheader ], [ %37, %.lr.ph34 ]
  %.lobit.neg23.pre-phi = phi i32 [ %.lobit.neg2431, %.preheader ], [ %.lobit.neg24, %.lr.ph34 ]
  %30 = phi i32 [ %26, %.preheader ], [ %34, %.lr.ph34 ]
  %.inv = icmp sgt i32 %30, -1
  %31 = select i1 %.inv, i32 1, i32 -1
  %32 = add nsw i32 %31, %.01438
  %.not19 = icmp eq i32 %32, %.pre-phi
  br i1 %.not19, label %._crit_edge40, label %.preheader, !llvm.loop !15

.lr.ph34:                                         ; preds = %.preheader, %.lr.ph34
  %.01333 = phi i32 [ %36, %.lr.ph34 ], [ %.lobit.neg2339, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %2)
  %33 = load i32, ptr %2, align 4, !tbaa !11
  call void @_ZN5FloydIiLi200EE4add_Eiii(ptr noundef nonnull align 4 dereferenceable(160000) @first, i32 noundef %.01438, i32 noundef %.01333, i32 noundef %33)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %34 = load i32, ptr @n, align 4, !tbaa !11
  %.inv26 = icmp sgt i32 %34, -1
  %35 = select i1 %.inv26, i32 1, i32 -1
  %36 = add nsw i32 %35, %.01333
  %.lobit.neg24 = ashr i32 %34, 31
  %37 = add i32 %.lobit.neg24, %34
  %.not25 = icmp eq i32 %36, %37
  br i1 %.not25, label %._crit_edge35, label %.lr.ph34, !llvm.loop !16

._crit_edge46:                                    ; preds = %.lr.ph45, %._crit_edge40.._crit_edge46_crit_edge
  %38 = phi i32 [ %.pre, %._crit_edge40.._crit_edge46_crit_edge ], [ %48, %.lr.ph45 ]
  call void @_Z3outIiEvT_(i32 noundef %38)
  ret i32 0

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %.lr.ph45
  %.043 = phi i32 [ %52, %.lr.ph45 ], [ %.neg, %.lr.ph45.preheader ]
  %39 = sext i32 %.043 to i64
  %40 = getelementptr inbounds [10005 x i32], ptr @must, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = add nsw i32 %.043, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10005 x i32], ptr @must, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = call noundef i32 @_ZN5FloydIiLi200EE5queryEii(ptr noundef nonnull align 4 dereferenceable(160000) @first, i32 noundef %41, i32 noundef %45)
  %47 = load i32, ptr @ans, align 4, !tbaa !11
  %48 = add nsw i32 %47, %46
  store i32 %48, ptr @ans, align 4, !tbaa !11
  %49 = load i32, ptr @m, align 4, !tbaa !11
  %50 = icmp slt i32 %49, 1
  %51 = select i1 %50, i32 -1, i32 1
  %52 = add nsw i32 %51, %.043
  %53 = add nsw i32 %49, -1
  %.neg20 = sext i1 %50 to i32
  %54 = add i32 %53, %.neg20
  %.not21 = icmp eq i32 %52, %54
  br i1 %.not21, label %._crit_edge46, label %.lr.ph45, !llvm.loop !17
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2inIiJEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5FloydIiLi200EE4add_Eiii(ptr noundef nonnull align 4 dereferenceable(160000), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5FloydIiLi200EE3updEv(ptr noundef nonnull align 4 dereferenceable(160000)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN5FloydIiLi200EE5queryEii(ptr noundef nonnull align 4 dereferenceable(160000), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3outIiEvT_(i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass