; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/Other/DIBZ2016/DZ16SHOP/A.ll (Z19labelingPropogationRi)

; 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.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@cost = external dso_local global [310 x [310 x i64]], align 16
@lx = external dso_local global [310 x i64], align 16
@ly = external dso_local global [310 x i64], align 16
@mate2 = external dso_local global [310 x i32], align 16
@pre1 = external dso_local global [310 x i32], align 16
@pre2 = external dso_local global [310 x i32], align 16
@p = external dso_local global [310 x i64], align 16
@pi = external dso_local global [310 x i32], align 16
@q = external dso_local global [620 x %"struct.std::pair"], align 16
@front = external dso_local global i32, align 4
@back = external dso_local global i32, align 4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19labelingPropogationRi(ptr noundef nonnull align 4 dereferenceable(4) %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %164, %1
  %15 = load i32, ptr @front, align 4, !tbaa !9
  %16 = load i32, ptr @back, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %18, label %165

18:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %19 = load i32, ptr @front, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %20
  %22 = getelementptr inbounds %"struct.std::pair", ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !11
  store i32 %23, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %24 = load i32, ptr @front, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %25
  %27 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !13
  store i32 %28, ptr %4, align 4, !tbaa !9
  %29 = load i32, ptr @front, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @front, align 4, !tbaa !9
  %31 = load i32, ptr %4, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %80

33:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %76, %33
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = load i32, ptr @n, align 4, !tbaa !9
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %39, label %38

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

39:                                               ; preds = %34
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [310 x i32], ptr @pre2, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = icmp eq i32 %43, -1
  br i1 %44, label %45, label %75

45:                                               ; preds = %39
  %46 = load i32, ptr %3, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [310 x [310 x i64]], ptr @cost, i64 0, i64 %47
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [310 x i64], ptr %48, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !14
  %53 = load i32, ptr %3, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [310 x i64], ptr @lx, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !14
  %57 = sub nsw i64 %52, %56
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [310 x i64], ptr @ly, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !14
  %62 = sub nsw i64 %57, %61
  %63 = icmp eq i64 %62, 0
  br i1 %63, label %64, label %75

64:                                               ; preds = %45
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = load i32, ptr %5, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [310 x i32], ptr @pre2, i64 0, i64 %67
  store i32 %65, ptr %68, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 1, ptr %7, align 4, !tbaa !9
  %69 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %69, ptr %6, align 4
  %70 = load i32, ptr @back, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr @back, align 4, !tbaa !9
  %72 = sext i32 %70 to i64
  %73 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %72
  %74 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %73, ptr noundef nonnull align 4 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %75

75:                                               ; preds = %64, %45, %39
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %5, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %5, align 4, !tbaa !9
  br label %34, !llvm.loop !16

79:                                               ; preds = %38
  br label %161

80:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %81 = load i32, ptr %3, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [310 x i32], ptr @mate2, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !9
  store i32 %84, ptr %8, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = icmp ne i32 %85, -1
  br i1 %86, label %87, label %154

87:                                               ; preds = %80
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [310 x i32], ptr @pre1, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = icmp eq i32 %91, -1
  br i1 %92, label %93, label %153

93:                                               ; preds = %87
  %94 = load i32, ptr %3, align 4, !tbaa !9
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [310 x i32], ptr @pre1, i64 0, i64 %96
  store i32 %94, ptr %97, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  %98 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %98, ptr %9, align 4
  %99 = load i32, ptr @back, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr @back, align 4, !tbaa !9
  %101 = sext i32 %99 to i64
  %102 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %101
  %103 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %102, ptr noundef nonnull align 4 dereferenceable(8) %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %149, %93
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr @n, align 4, !tbaa !9
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %152

109:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %110 = load i32, ptr %8, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [310 x [310 x i64]], ptr @cost, i64 0, i64 %111
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [310 x i64], ptr %112, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !14
  %117 = load i32, ptr %8, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [310 x i64], ptr @lx, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !14
  %121 = sub nsw i64 %116, %120
  %122 = load i32, ptr %11, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [310 x i64], ptr @ly, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !14
  %126 = sub nsw i64 %121, %125
  store i64 %126, ptr %12, align 8, !tbaa !14
  %127 = load i32, ptr %11, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [310 x i32], ptr @pre2, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !9
  %131 = icmp eq i32 %130, -1
  br i1 %131, label %132, label %148

132:                                              ; preds = %109
  %133 = load i64, ptr %12, align 8, !tbaa !14
  %134 = load i32, ptr %11, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [310 x i64], ptr @p, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !14
  %138 = icmp slt i64 %133, %137
  br i1 %138, label %139, label %148

139:                                              ; preds = %132
  %140 = load i64, ptr %12, align 8, !tbaa !14
  %141 = load i32, ptr %11, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [310 x i64], ptr @p, i64 0, i64 %142
  store i64 %140, ptr %143, align 8, !tbaa !14
  %144 = load i32, ptr %8, align 4, !tbaa !9
  %145 = load i32, ptr %11, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [310 x i32], ptr @pi, i64 0, i64 %146
  store i32 %144, ptr %147, align 4, !tbaa !9
  br label %148

148:                                              ; preds = %139, %132, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %11, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %11, align 4, !tbaa !9
  br label %104, !llvm.loop !18

152:                                              ; preds = %108
  br label %153

153:                                              ; preds = %152, %87
  br label %157

154:                                              ; preds = %80
  %155 = load i32, ptr %3, align 4, !tbaa !9
  %156 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 %155, ptr %156, align 4, !tbaa !9
  store i32 3, ptr %13, align 4
  br label %158

157:                                              ; preds = %153
  store i32 0, ptr %13, align 4
  br label %158

158:                                              ; preds = %157, %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %159 = load i32, ptr %13, align 4
  switch i32 %159, label %162 [
    i32 0, label %160
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160, %79
  store i32 0, ptr %13, align 4
  br label %162

162:                                              ; preds = %161, %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %163 = load i32, ptr %13, align 4
  switch i32 %163, label %166 [
    i32 0, label %164
    i32 3, label %165
  ]

164:                                              ; preds = %162
  br label %14, !llvm.loop !19

165:                                              ; preds = %162, %14
  ret void

166:                                              ; preds = %162
  unreachable
}

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


; 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.std::pair" = type { i32, i32 }

@n = external dso_local local_unnamed_addr global i32, align 4
@cost = external dso_local local_unnamed_addr global [310 x [310 x i64]], align 16
@lx = external dso_local local_unnamed_addr global [310 x i64], align 16
@ly = external dso_local local_unnamed_addr global [310 x i64], align 16
@mate2 = external dso_local local_unnamed_addr global [310 x i32], align 16
@pre1 = external dso_local local_unnamed_addr global [310 x i32], align 16
@pre2 = external dso_local local_unnamed_addr global [310 x i32], align 16
@p = external dso_local local_unnamed_addr global [310 x i64], align 16
@pi = external dso_local local_unnamed_addr global [310 x i32], align 16
@q = external dso_local global [620 x %"struct.std::pair"], align 16
@front = external dso_local local_unnamed_addr global i32, align 4
@back = external dso_local local_unnamed_addr global i32, align 4

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19labelingPropogationRi(ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %0) local_unnamed_addr #1 {
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = load i32, ptr @front, align 4, !tbaa !5
  %9 = load i32, ptr @back, align 4, !tbaa !5
  %10 = icmp slt i32 %8, %9
  br i1 %10, label %.lr.ph41, label %.loopexit

.lr.ph41:                                         ; preds = %1, %87
  %11 = phi i32 [ %88, %87 ], [ %8, %1 ]
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %12
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %13, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = add nsw i32 %11, 1
  store i32 %17, ptr @front, align 4, !tbaa !5
  %18 = icmp eq i32 %16, 0
  br i1 %18, label %19, label %48

19:                                               ; preds = %.lr.ph41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %.not35 = icmp slt i32 %20, 1
  br i1 %.not35, label %._crit_edge39, label %.lr.ph38

.lr.ph38:                                         ; preds = %19
  %21 = sext i32 %14 to i64
  %22 = getelementptr inbounds [310 x i64], ptr @lx, i64 0, i64 %21
  br label %23

._crit_edge39:                                    ; preds = %44, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  br label %87

23:                                               ; preds = %.lr.ph38, %44
  %24 = phi i32 [ %20, %.lr.ph38 ], [ %45, %44 ]
  %storemerge36 = phi i32 [ 1, %.lr.ph38 ], [ %47, %44 ]
  %25 = sext i32 %storemerge36 to i64
  %26 = getelementptr inbounds [310 x i32], ptr @pre2, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp eq i32 %27, -1
  br i1 %28, label %29, label %44

29:                                               ; preds = %23
  %30 = getelementptr inbounds [310 x [310 x i64]], ptr @cost, i64 0, i64 %21, i64 %25
  %31 = load i64, ptr %30, align 8, !tbaa !12
  %32 = load i64, ptr %22, align 8, !tbaa !12
  %33 = getelementptr inbounds [310 x i64], ptr @ly, i64 0, i64 %25
  %34 = load i64, ptr %33, align 8, !tbaa !12
  %35 = add i64 %34, %32
  %36 = icmp eq i64 %31, %35
  br i1 %36, label %37, label %44

37:                                               ; preds = %29
  store i32 %14, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  store i32 1, ptr %4, align 4, !tbaa !5
  %38 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %38, ptr %3, align 8
  %39 = load i32, ptr @back, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr @back, align 4, !tbaa !5
  %41 = sext i32 %39 to i64
  %42 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %41
  %43 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %42, ptr noundef nonnull align 4 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  %.pre45 = load i32, ptr @n, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %23, %29, %37
  %45 = phi i32 [ %24, %23 ], [ %24, %29 ], [ %.pre45, %37 ]
  %46 = phi i32 [ %storemerge36, %23 ], [ %storemerge36, %29 ], [ %.pre, %37 ]
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %2, align 4, !tbaa !5
  %.not.not42 = icmp slt i32 %46, %45
  br i1 %.not.not42, label %23, label %._crit_edge39, !llvm.loop !14

48:                                               ; preds = %.lr.ph41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  %49 = sext i32 %14 to i64
  %50 = getelementptr inbounds [310 x i32], ptr @mate2, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %5, align 4, !tbaa !5
  %.not.not = icmp eq i32 %51, -1
  br i1 %.not.not, label %.thread28, label %52

52:                                               ; preds = %48
  %53 = sext i32 %51 to i64
  %54 = getelementptr inbounds [310 x i32], ptr @pre1, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp eq i32 %55, -1
  br i1 %56, label %57, label %.thread26

.thread26:                                        ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  br label %87

57:                                               ; preds = %52
  store i32 %14, ptr %54, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  store i32 0, ptr %7, align 4, !tbaa !5
  %58 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %58, ptr %6, align 8
  %59 = load i32, ptr @back, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr @back, align 4, !tbaa !5
  %61 = sext i32 %59 to i64
  %62 = getelementptr inbounds [620 x %"struct.std::pair"], ptr @q, i64 0, i64 %61
  %63 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %62, ptr noundef nonnull align 4 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %.not2433 = icmp slt i32 %64, 1
  br i1 %.not2433, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %57
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [310 x i64], ptr @lx, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !12
  %69 = add nuw i32 %64, 1
  %wide.trip.count = zext i32 %69 to i64
  br label %70

70:                                               ; preds = %.lr.ph, %86
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %86 ]
  %71 = getelementptr inbounds [310 x [310 x i64]], ptr @cost, i64 0, i64 %66, i64 %indvars.iv
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = getelementptr inbounds [310 x i64], ptr @ly, i64 0, i64 %indvars.iv
  %74 = load i64, ptr %73, align 8, !tbaa !12
  %75 = add i64 %68, %74
  %76 = sub i64 %72, %75
  %77 = getelementptr inbounds [310 x i32], ptr @pre2, i64 0, i64 %indvars.iv
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp eq i32 %78, -1
  br i1 %79, label %80, label %86

80:                                               ; preds = %70
  %81 = getelementptr inbounds [310 x i64], ptr @p, i64 0, i64 %indvars.iv
  %82 = load i64, ptr %81, align 8, !tbaa !12
  %83 = icmp slt i64 %76, %82
  br i1 %83, label %84, label %86

84:                                               ; preds = %80
  store i64 %76, ptr %81, align 8, !tbaa !12
  %85 = getelementptr inbounds [310 x i32], ptr @pi, i64 0, i64 %indvars.iv
  store i32 %65, ptr %85, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %84, %80, %70
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %70, !llvm.loop !16

.thread28:                                        ; preds = %48
  store i32 %14, ptr %0, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  br label %.loopexit

._crit_edge:                                      ; preds = %86, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  br label %87

87:                                               ; preds = %._crit_edge, %._crit_edge39, %.thread26
  %88 = load i32, ptr @front, align 4, !tbaa !5
  %89 = load i32, ptr @back, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %.lr.ph41, label %.loopexit

.loopexit:                                        ; preds = %87, %1, %.thread28
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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