; LLVM IR from upupming/algorithm :: acwing/日常刷题/kick-start/578. 去观光.ll (Z5solvev)

; 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.Bus = type { i32, i32, 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
@ts = external dso_local global i32, align 4
@tf = external dso_local global i32, align 4
@f = external dso_local global [2010 x [2010 x i64]], align 16
@bus = external dso_local global [2010 x %struct.Bus], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7get_offii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) @ts)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @tf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %31, %0
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %34

15:                                               ; preds = %10
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [2010 x %struct.Bus], ptr @bus, i64 0, i64 %17
  %19 = getelementptr inbounds %struct.Bus, ptr %18, i32 0, i32 0
  %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) %19)
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [2010 x %struct.Bus], ptr @bus, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.Bus, ptr %23, i32 0, i32 1
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2010 x %struct.Bus], ptr @bus, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.Bus, ptr %28, i32 0, i32 2
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) %29)
  br label %31

31:                                               ; preds = %15
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %1, align 4, !tbaa !5
  br label %10, !llvm.loop !9

34:                                               ; preds = %14
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 63, i64 32320800, i1 false)
  store i64 0, ptr getelementptr inbounds ([2010 x [2010 x i64]], ptr @f, i64 0, i64 1), align 16, !tbaa !11
  %35 = load i32, ptr @ts, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  store i64 %36, ptr getelementptr inbounds ([2010 x i64], ptr getelementptr inbounds ([2010 x [2010 x i64]], ptr @f, i64 0, i64 1), i64 0, i64 1), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %104, %34
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %107

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %100, %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %103

48:                                               ; preds = %43
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sub nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2010 x i64], ptr %52, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = trunc i64 %56 to i32
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = call noundef i64 @_Z7get_offii(i32 noundef %57, i32 noundef %58)
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %61
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [2010 x i64], ptr %62, i64 0, i64 %64
  store i64 %59, ptr %65, align 8, !tbaa !11
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %99

69:                                               ; preds = %48
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %71
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2010 x i64], ptr %72, i64 0, i64 %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %78
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2010 x i64], ptr %79, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = trunc i64 %84 to i32
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = call noundef i64 @_Z7get_offii(i32 noundef %85, i32 noundef %86)
  %88 = load i32, ptr @ts, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = add nsw i64 %87, %89
  store i64 %90, ptr %5, align 8, !tbaa !11
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = load i32, ptr %2, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %94
  %96 = load i32, ptr %4, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [2010 x i64], ptr %95, i64 0, i64 %97
  store i64 %92, ptr %98, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %99

99:                                               ; preds = %69, %48
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %4, align 4, !tbaa !5
  br label %43, !llvm.loop !13

103:                                              ; preds = %47
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %2, align 4, !tbaa !5
  br label %37, !llvm.loop !14

107:                                              ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = sub nsw i32 %108, 1
  store i32 %109, ptr %6, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %126, %107
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = icmp sge i32 %111, 0
  br i1 %112, label %113, label %124

113:                                              ; preds = %110
  %114 = load i32, ptr @n, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %115
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2010 x i64], ptr %116, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !11
  %121 = load i32, ptr @tf, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = icmp sgt i64 %120, %122
  br label %124

124:                                              ; preds = %113, %110
  %125 = phi i1 [ false, %110 ], [ %123, %113 ]
  br i1 %125, label %126, label %129

126:                                              ; preds = %124
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr %6, align 4, !tbaa !5
  br label %110, !llvm.loop !15

129:                                              ; preds = %124
  %130 = load i32, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  ret i32 %130
}

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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nounwind willreturn memory(argmem: write) }
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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; 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.Bus = type { i32, i32, 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
@ts = external dso_local global i32, align 4
@tf = external dso_local global i32, align 4
@f = external dso_local global [2010 x [2010 x i64]], align 16
@bus = external dso_local global [2010 x %struct.Bus], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7get_offii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @ts)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @tf)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 1
  br i1 %6, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32320800) @f, i8 63, i64 32320800, i1 false)
  store i64 0, ptr getelementptr inbounds (i8, ptr @f, i64 16080), align 16, !tbaa !9
  %7 = load i32, ptr @ts, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  store i64 %8, ptr getelementptr inbounds (i8, ptr @f, i64 16088), align 8, !tbaa !9
  br label %._crit_edge..preheader_crit_edge

._crit_edge:                                      ; preds = %.lr.ph
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32320800) @f, i8 63, i64 32320800, i1 false)
  store i64 0, ptr getelementptr inbounds (i8, ptr @f, i64 16080), align 16, !tbaa !9
  %9 = load i32, ptr @ts, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  store i64 %10, ptr getelementptr inbounds (i8, ptr @f, i64 16088), align 8, !tbaa !9
  %.not35 = icmp slt i32 %18, 2
  br i1 %.not35, label %._crit_edge..preheader_crit_edge, label %.preheader32

._crit_edge..preheader_crit_edge:                 ; preds = %._crit_edge.thread, %._crit_edge
  %11 = phi i32 [ %5, %._crit_edge.thread ], [ %18, %._crit_edge ]
  %.pre = sext i32 %11 to i64
  br label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %12 = getelementptr inbounds [2010 x %struct.Bus], ptr @bus, i64 0, i64 %indvars.iv
  %13 = tail 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)
  %14 = getelementptr inbounds i8, ptr %12, i64 4
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %16 = getelementptr inbounds i8, ptr %12, i64 8
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader32:                                     ; preds = %._crit_edge, %27
  %indvars.iv46 = phi i64 [ %indvars.iv.next47, %27 ], [ 2, %._crit_edge ]
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %27 ], [ 3, %._crit_edge ]
  %21 = add nsw i64 %indvars.iv46, -1
  %22 = trunc nuw nsw i64 %indvars.iv46 to i32
  br label %30

.preheader:                                       ; preds = %27, %._crit_edge..preheader_crit_edge
  %.pre-phi = phi i64 [ %.pre, %._crit_edge..preheader_crit_edge ], [ %29, %27 ]
  %.lcssa = phi i32 [ %11, %._crit_edge..preheader_crit_edge ], [ %28, %27 ]
  %23 = load i32, ptr @tf, align 4
  %24 = sext i32 %23 to i64
  %25 = zext i32 %.lcssa to i64
  %smin = call i32 @llvm.smin.i32(i32 %.lcssa, i32 0)
  %26 = add i32 %smin, -1
  br label %51

27:                                               ; preds = %50
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %.not.not = icmp slt i64 %indvars.iv46, %29
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  br i1 %.not.not, label %.preheader32, label %.preheader, !llvm.loop !13

30:                                               ; preds = %.preheader32, %50
  %indvars.iv39 = phi i64 [ 0, %.preheader32 ], [ %indvars.iv.next40, %50 ]
  %31 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %21, i64 %indvars.iv39
  %32 = load i64, ptr %31, align 8, !tbaa !9
  %33 = trunc i64 %32 to i32
  %34 = call noundef i64 @_Z7get_offii(i32 noundef %33, i32 noundef %22)
  %35 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %indvars.iv46, i64 %indvars.iv39
  store i64 %34, ptr %35, align 8, !tbaa !9
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv46, %37
  br i1 %38, label %39, label %50

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %40 = add nsw i64 %indvars.iv39, -1
  %41 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %21, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = trunc i64 %42 to i32
  %44 = call noundef i64 @_Z7get_offii(i32 noundef %43, i32 noundef %22)
  %45 = load i32, ptr @ts, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = add nsw i64 %44, %46
  store i64 %47, ptr %1, align 8, !tbaa !9
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %49 = load i64, ptr %48, align 8, !tbaa !9
  store i64 %49, ptr %35, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  br label %50

50:                                               ; preds = %30, %39
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next40, %indvars.iv44
  br i1 %exitcond.not, label %27, label %30, !llvm.loop !14

51:                                               ; preds = %.preheader, %54
  %indvars.iv51 = phi i64 [ %25, %.preheader ], [ %indvars.iv.next52, %54 ]
  %52 = trunc nuw i64 %indvars.iv51 to i32
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %54, label %.critedge

54:                                               ; preds = %51
  %indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
  %55 = and i64 %indvars.iv.next52, 4294967295
  %56 = getelementptr inbounds [2010 x [2010 x i64]], ptr @f, i64 0, i64 %.pre-phi, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = icmp sgt i64 %57, %24
  br i1 %58, label %51, label %.critedge.split.loop.exit58, !llvm.loop !15

.critedge.split.loop.exit58:                      ; preds = %54
  %indvars.le = trunc i64 %indvars.iv.next52 to i32
  br label %.critedge

.critedge:                                        ; preds = %51, %.critedge.split.loop.exit58
  %.0.lcssa = phi i32 [ %indvars.le, %.critedge.split.loop.exit58 ], [ %26, %51 ]
  ret i32 %.0.lcssa
}

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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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