; LLVM IR from the-hyp0cr1t3/CC :: CSES/Graph Algorithms (Shortest Routes II)

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

%"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 }
%class.anon = type { i8 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@d = external dso_local global [505 x [505 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@chmin = external hidden global %class.anon, align 1
@_ZSt4cout = external global %"class.std::basic_ostream", 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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %23

23:                                               ; preds = %49, %0
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = load i32, ptr %5, align 4, !tbaa !8
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %52

27:                                               ; preds = %23
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %28

28:                                               ; preds = %45, %27
  %29 = load i32, ptr %3, align 4, !tbaa !8
  %30 = load i32, ptr %5, align 4, !tbaa !8
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %32, label %48

32:                                               ; preds = %28
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = load i32, ptr %3, align 4, !tbaa !8
  %35 = xor i32 %33, %34
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %32
  %38 = load i32, ptr %2, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %39
  %41 = load i32, ptr %3, align 4, !tbaa !8
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [505 x i64], ptr %40, i64 0, i64 %42
  store i64 1000000000000000000, ptr %43, align 8, !tbaa !11
  br label %44

44:                                               ; preds = %37, %32
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %3, align 4, !tbaa !8
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %3, align 4, !tbaa !8
  br label %28, !llvm.loop !13

48:                                               ; preds = %28
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !8
  br label %23, !llvm.loop !15

52:                                               ; preds = %23
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %53

53:                                               ; preds = %79, %52
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = load i32, ptr %6, align 4, !tbaa !8
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %57, label %82

57:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %59, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %61 = load i32, ptr %8, align 4, !tbaa !8
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr %8, align 4, !tbaa !8
  %63 = load i32, ptr %9, align 4, !tbaa !8
  %64 = add nsw i32 %63, -1
  store i32 %64, ptr %9, align 4, !tbaa !8
  %65 = load i32, ptr %8, align 4, !tbaa !8
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %66
  %68 = load i32, ptr %9, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [505 x i64], ptr %67, i64 0, i64 %69
  %71 = call noundef zeroext i1 @"_ZNK3$_0clIlRiEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1) @chmin, ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %72 = load i32, ptr %9, align 4, !tbaa !8
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %73
  %75 = load i32, ptr %8, align 4, !tbaa !8
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [505 x i64], ptr %74, i64 0, i64 %76
  %78 = call noundef zeroext i1 @"_ZNK3$_0clIlRiEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1) @chmin, ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %79

79:                                               ; preds = %57
  %80 = load i32, ptr %2, align 4, !tbaa !8
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %2, align 4, !tbaa !8
  br label %53, !llvm.loop !16

82:                                               ; preds = %53
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %83

83:                                               ; preds = %128, %82
  %84 = load i32, ptr %4, align 4, !tbaa !8
  %85 = load i32, ptr %5, align 4, !tbaa !8
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %131

87:                                               ; preds = %83
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %88

88:                                               ; preds = %124, %87
  %89 = load i32, ptr %2, align 4, !tbaa !8
  %90 = load i32, ptr %5, align 4, !tbaa !8
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %92, label %127

92:                                               ; preds = %88
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %93

93:                                               ; preds = %120, %92
  %94 = load i32, ptr %3, align 4, !tbaa !8
  %95 = load i32, ptr %5, align 4, !tbaa !8
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %97, label %123

97:                                               ; preds = %93
  %98 = load i32, ptr %2, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %99
  %101 = load i32, ptr %3, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [505 x i64], ptr %100, i64 0, i64 %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %104 = load i32, ptr %2, align 4, !tbaa !8
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %105
  %107 = load i32, ptr %4, align 4, !tbaa !8
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [505 x i64], ptr %106, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !11
  %111 = load i32, ptr %4, align 4, !tbaa !8
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %112
  %114 = load i32, ptr %3, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [505 x i64], ptr %113, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = add nsw i64 %110, %117
  store i64 %118, ptr %11, align 8, !tbaa !11
  %119 = call noundef zeroext i1 @"_ZNK3$_0clIllEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1) @chmin, ptr noundef nonnull align 8 dereferenceable(8) %103, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %120

120:                                              ; preds = %97
  %121 = load i32, ptr %3, align 4, !tbaa !8
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %3, align 4, !tbaa !8
  br label %93, !llvm.loop !17

123:                                              ; preds = %93
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %2, align 4, !tbaa !8
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %2, align 4, !tbaa !8
  br label %88, !llvm.loop !18

127:                                              ; preds = %88
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %4, align 4, !tbaa !8
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %4, align 4, !tbaa !8
  br label %83, !llvm.loop !19

131:                                              ; preds = %83
  br label %132

132:                                              ; preds = %160, %131
  %133 = load i32, ptr %7, align 4, !tbaa !8
  %134 = add nsw i32 %133, -1
  store i32 %134, ptr %7, align 4, !tbaa !8
  %135 = icmp ne i32 %133, 0
  br i1 %135, label %136, label %164

136:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %137 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %138 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %137, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %139 = load i32, ptr %12, align 4, !tbaa !8
  %140 = add nsw i32 %139, -1
  store i32 %140, ptr %12, align 4, !tbaa !8
  %141 = load i32, ptr %13, align 4, !tbaa !8
  %142 = add nsw i32 %141, -1
  store i32 %142, ptr %13, align 4, !tbaa !8
  %143 = load i32, ptr %12, align 4, !tbaa !8
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %144
  %146 = load i32, ptr %13, align 4, !tbaa !8
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [505 x i64], ptr %145, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !11
  %150 = icmp eq i64 %149, 1000000000000000000
  br i1 %150, label %151, label %152

151:                                              ; preds = %136
  br label %160

152:                                              ; preds = %136
  %153 = load i32, ptr %12, align 4, !tbaa !8
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %154
  %156 = load i32, ptr %13, align 4, !tbaa !8
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [505 x i64], ptr %155, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !11
  br label %160

160:                                              ; preds = %152, %151
  %161 = phi i64 [ -1, %151 ], [ %159, %152 ]
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %161)
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %162, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %132, !llvm.loop !20

164:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %165 = load i32, ptr %1, align 4
  ret i32 %165
}

; 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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @"_ZNK3$_0clIlRiEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @"_ZNK3$_0clIllEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #6 align 2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { inlinehint 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 #6 = { 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 #7 = { 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !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"

%"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 }
%class.anon = type { i8 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@d = external dso_local global [505 x [505 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@chmin = external hidden global %class.anon, align 1
@_ZSt4cout = external global %"class.std::basic_ostream", 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 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %19 = load i32, ptr %1, align 4, !tbaa !8
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.preheader32.us.preheader, label %.preheader31

.preheader32.us.preheader:                        ; preds = %0
  %wide.trip.count50 = zext nneg i32 %19 to i64
  %xtraiter = and i64 %wide.trip.count50, 1
  %21 = icmp eq i32 %19, 1
  %unroll_iter = and i64 %wide.trip.count50, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader32.us

.preheader32.us:                                  ; preds = %.preheader32.us.preheader, %._crit_edge.us
  %indvars.iv47 = phi i64 [ 0, %.preheader32.us.preheader ], [ %indvars.iv.next48, %._crit_edge.us ]
  br i1 %21, label %._crit_edge.us.unr-lcssa, label %.preheader32.us.new

.preheader32.us.new:                              ; preds = %.preheader32.us, %27
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %27 ], [ 0, %.preheader32.us ]
  %niter = phi i64 [ %niter.next.1, %27 ], [ 0, %.preheader32.us ]
  %.not27.us = icmp eq i64 %indvars.iv47, %indvars.iv
  br i1 %.not27.us, label %24, label %22

22:                                               ; preds = %.preheader32.us.new
  %23 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %indvars.iv47, i64 %indvars.iv
  store i64 1000000000000000000, ptr %23, align 8, !tbaa !11
  br label %24

24:                                               ; preds = %22, %.preheader32.us.new
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %.not27.us.1 = icmp eq i64 %indvars.iv47, %indvars.iv.next
  br i1 %.not27.us.1, label %27, label %25

25:                                               ; preds = %24
  %26 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %indvars.iv47, i64 %indvars.iv.next
  store i64 1000000000000000000, ptr %26, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %25, %24
  %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_edge.us.unr-lcssa, label %.preheader32.us.new, !llvm.loop !13

._crit_edge.us.unr-lcssa:                         ; preds = %27, %.preheader32.us
  %indvars.iv.unr = phi i64 [ 0, %.preheader32.us ], [ %indvars.iv.next.1, %27 ]
  %.not27.us.epil = icmp eq i64 %indvars.iv47, %indvars.iv.unr
  %or.cond = select i1 %lcmp.mod.not, i1 true, i1 %.not27.us.epil
  br i1 %or.cond, label %._crit_edge.us, label %28

28:                                               ; preds = %._crit_edge.us.unr-lcssa
  %29 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %indvars.iv47, i64 %indvars.iv.unr
  store i64 1000000000000000000, ptr %29, align 8, !tbaa !11
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %28, %._crit_edge.us.unr-lcssa
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %exitcond51.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count50
  br i1 %exitcond51.not, label %.preheader31, label %.preheader32.us, !llvm.loop !15

.preheader31:                                     ; preds = %._crit_edge.us, %0
  %30 = load i32, ptr %2, align 4, !tbaa !8
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph, label %.preheader30

.preheader30.loopexit:                            ; preds = %.lr.ph
  %.pre = load i32, ptr %1, align 4, !tbaa !8
  br label %.preheader30

.preheader30:                                     ; preds = %.preheader30.loopexit, %.preheader31
  %32 = phi i32 [ %.pre, %.preheader30.loopexit ], [ %19, %.preheader31 ]
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.preheader29, label %.preheader

.lr.ph:                                           ; preds = %.preheader31, %.lr.ph
  %.12535 = phi i32 [ %51, %.lr.ph ], [ 0, %.preheader31 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %37 = load i32, ptr %4, align 4, !tbaa !8
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %4, align 4, !tbaa !8
  %39 = load i32, ptr %5, align 4, !tbaa !8
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %5, align 4, !tbaa !8
  %41 = sext i32 %38 to i64
  %42 = sext i32 %40 to i64
  %43 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %41, i64 %42
  %44 = call noundef zeroext i1 @"_ZNK3$_0clIlRiEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1) @chmin, ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %45 = load i32, ptr %5, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = load i32, ptr %4, align 4, !tbaa !8
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %46, i64 %48
  %50 = call noundef zeroext i1 @"_ZNK3$_0clIlRiEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1) @chmin, ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %51 = add nuw nsw i32 %.12535, 1
  %52 = load i32, ptr %2, align 4, !tbaa !8
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %.lr.ph, label %.preheader30.loopexit, !llvm.loop !16

.preheader29:                                     ; preds = %.preheader30, %._crit_edge39
  %54 = phi i32 [ %75, %._crit_edge39 ], [ %32, %.preheader30 ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %._crit_edge39 ], [ 0, %.preheader30 ]
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.preheader28, label %._crit_edge39

.preheader:                                       ; preds = %._crit_edge39, %.preheader30
  %56 = load i32, ptr %3, align 4, !tbaa !8
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %3, align 4, !tbaa !8
  %.not41 = icmp eq i32 %56, 0
  br i1 %.not41, label %._crit_edge43, label %.lr.ph42

.preheader28:                                     ; preds = %.preheader29, %._crit_edge
  %58 = phi i32 [ %72, %._crit_edge ], [ %54, %.preheader29 ]
  %59 = phi i32 [ %73, %._crit_edge ], [ %54, %.preheader29 ]
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %._crit_edge ], [ 0, %.preheader29 ]
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %.lr.ph37, label %.preheader28.._crit_edge_crit_edge

.preheader28.._crit_edge_crit_edge:               ; preds = %.preheader28
  %.pre61 = sext i32 %59 to i64
  br label %._crit_edge

.lr.ph37:                                         ; preds = %.preheader28
  %61 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %indvars.iv55, i64 %indvars.iv58
  br label %62

62:                                               ; preds = %.lr.ph37, %62
  %indvars.iv52 = phi i64 [ 0, %.lr.ph37 ], [ %indvars.iv.next53, %62 ]
  %63 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %indvars.iv55, i64 %indvars.iv52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %64 = load i64, ptr %61, align 8, !tbaa !11
  %65 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %indvars.iv58, i64 %indvars.iv52
  %66 = load i64, ptr %65, align 8, !tbaa !11
  %67 = add nsw i64 %66, %64
  store i64 %67, ptr %7, align 8, !tbaa !11
  %68 = call noundef zeroext i1 @"_ZNK3$_0clIllEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1) @chmin, ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %69 = load i32, ptr %1, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next53, %70
  br i1 %71, label %62, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %62, %.preheader28.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre61, %.preheader28.._crit_edge_crit_edge ], [ %70, %62 ]
  %72 = phi i32 [ %58, %.preheader28.._crit_edge_crit_edge ], [ %69, %62 ]
  %73 = phi i32 [ %59, %.preheader28.._crit_edge_crit_edge ], [ %69, %62 ]
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %74 = icmp slt i64 %indvars.iv.next56, %.pre-phi
  br i1 %74, label %.preheader28, label %._crit_edge39, !llvm.loop !18

._crit_edge39:                                    ; preds = %._crit_edge, %.preheader29
  %75 = phi i32 [ %54, %.preheader29 ], [ %72, %._crit_edge ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %76 = sext i32 %75 to i64
  %77 = icmp slt i64 %indvars.iv.next59, %76
  br i1 %77, label %.preheader29, label %.preheader, !llvm.loop !20

.lr.ph42:                                         ; preds = %.preheader, %.lr.ph42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %80 = load i32, ptr %8, align 4, !tbaa !8
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %8, align 4, !tbaa !8
  %82 = load i32, ptr %9, align 4, !tbaa !8
  %83 = add nsw i32 %82, -1
  store i32 %83, ptr %9, align 4, !tbaa !8
  %84 = sext i32 %81 to i64
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds [505 x [505 x i64]], ptr @d, i64 0, i64 %84, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !11
  %88 = icmp eq i64 %87, 1000000000000000000
  %spec.select = select i1 %88, i64 -1, i64 %87
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %spec.select)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %89, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %91 = load i32, ptr %3, align 4, !tbaa !8
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %3, align 4, !tbaa !8
  %.not = icmp eq i32 %91, 0
  br i1 %.not, label %._crit_edge43, label %.lr.ph42, !llvm.loop !21

._crit_edge43:                                    ; preds = %.lr.ph42, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @"_ZNK3$_0clIlRiEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @"_ZNK3$_0clIllEEDaRT_OT0_"(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #6 align 2

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { inlinehint 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 #6 = { 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 #7 = { 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !14, !19}
!21 = distinct !{!21, !14}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass