; LLVM IR from ShahjalalShohag/code-library :: Graph Theory/Stable Marriage Problem.ll (Z2SMi)

; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@m = external dso_local global [1010 x [1010 x i32]], align 16
@w = external dso_local global [1010 x [1010 x i32]], align 16
@id = external dso_local global [1010 x i32], align 16
@marry = external dso_local global [1010 x i32], align 16
@ans = external dso_local global [1010 x i32], align 16
@pref = external dso_local global [1010 x [1010 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2SMi(i32 noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::queue", align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %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 i32, align 4
  %12 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %23, %1
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %30

18:                                               ; preds = %13
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %19 unwind label %26

19:                                               ; preds = %18
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %21
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %19
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %4, align 4, !tbaa !5
  br label %13, !llvm.loop !9

26:                                               ; preds = %18
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %5, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %169

30:                                               ; preds = %17
  call void @llvm.memset.p0.i64(ptr align 16 @marry, i8 -1, i64 4040, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %60, %30
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %63

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

37:                                               ; preds = %56, %36
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %9, align 4, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %45
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1010 x [1010 x i32]], ptr @m, i64 0, i64 %48
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1010 x i32], ptr %49, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1010 x i32], ptr %46, i64 0, i64 %54
  store i32 %43, ptr %55, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %42
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %9, align 4, !tbaa !5
  br label %37, !llvm.loop !11

59:                                               ; preds = %41
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %7, align 4, !tbaa !5
  br label %31, !llvm.loop !12

63:                                               ; preds = %35
  br label %64

64:                                               ; preds = %149, %63
  %65 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %66 unwind label %124

66:                                               ; preds = %64
  %67 = xor i1 %65, true
  br i1 %67, label %68, label %151

68:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %69 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %70 unwind label %128

70:                                               ; preds = %68
  %71 = load i32, ptr %69, align 4, !tbaa !5
  store i32 %71, ptr %10, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %72 unwind label %128

72:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %73 = load i32, ptr %10, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1010 x [1010 x i32]], ptr @w, i64 0, i64 %74
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1010 x i32], ptr %75, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  store i32 %82, ptr %11, align 4, !tbaa !5
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp ne i32 %86, -1
  br i1 %87, label %88, label %144

88:                                               ; preds = %72
  %89 = load i32, ptr %11, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %90
  %92 = load i32, ptr %11, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [1010 x i32], ptr %91, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %11, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %100
  %102 = load i32, ptr %10, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1010 x i32], ptr %101, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp sgt i32 %98, %105
  br i1 %106, label %107, label %136

107:                                              ; preds = %88
  %108 = load i32, ptr %11, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %113, align 4, !tbaa !5
  %116 = load i32, ptr %11, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %117
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %118)
          to label %119 unwind label %132

119:                                              ; preds = %107
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %122
  store i32 %120, ptr %123, align 4, !tbaa !5
  br label %143

124:                                              ; preds = %64
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %5, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %6, align 4
  br label %169

128:                                              ; preds = %70, %68
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %5, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %6, align 4
  br label %150

132:                                              ; preds = %136, %107
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %5, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %150

136:                                              ; preds = %88
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %139, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %142 unwind label %132

142:                                              ; preds = %136
  br label %143

143:                                              ; preds = %142, %119
  br label %149

144:                                              ; preds = %72
  %145 = load i32, ptr %10, align 4, !tbaa !5
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %147
  store i32 %145, ptr %148, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %144, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %64, !llvm.loop !13

150:                                              ; preds = %132, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %169

151:                                              ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %165, %151
  %153 = load i32, ptr %12, align 4, !tbaa !5
  %154 = load i32, ptr %2, align 4, !tbaa !5
  %155 = icmp sle i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %168

157:                                              ; preds = %152
  %158 = load i32, ptr %12, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = load i32, ptr %12, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1010 x i32], ptr @ans, i64 0, i64 %163
  store i32 %161, ptr %164, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %157
  %166 = load i32, ptr %12, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %12, align 4, !tbaa !5
  br label %152, !llvm.loop !14

168:                                              ; preds = %156
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  ret void

169:                                              ; preds = %150, %124, %26
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #5
  br label %170

170:                                              ; preds = %169
  %171 = load ptr, ptr %5, align 8
  %172 = load i32, ptr %6, align 4
  %173 = insertvalue { ptr, i32 } poison, ptr %171, 0
  %174 = insertvalue { ptr, i32 } %173, i32 %172, 1
  resume { ptr, i32 } %174
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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"

%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@m = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16
@w = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16
@id = external dso_local local_unnamed_addr global [1010 x i32], align 16
@marry = external dso_local global [1010 x i32], align 16
@ans = external dso_local local_unnamed_addr global [1010 x i32], align 16
@pref = external dso_local local_unnamed_addr global [1010 x [1010 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2SMi(i32 noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::queue", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  %.not38 = icmp slt i32 %0, 1
  br i1 %.not38, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040) @marry, i8 -1, i64 4040, i1 false)
  br label %.preheader36

._crit_edge:                                      ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4040) @marry, i8 -1, i64 4040, i1 false)
  br i1 %.not38, label %.preheader36, label %.preheader37.preheader

.preheader37.preheader:                           ; preds = %._crit_edge
  %5 = add nuw i32 %0, 1
  %wide.trip.count54 = zext i32 %5 to i64
  %6 = zext nneg i32 %0 to i64
  %7 = add nsw i64 %wide.trip.count54, -2
  %xtraiter = and i64 %6, 3
  %8 = icmp ult i64 %7, 3
  %unroll_iter = and i64 %6, 2147483644
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader37

.lr.ph:                                           ; preds = %1, %9
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %9 unwind label %14

9:                                                ; preds = %.lr.ph
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %11
  store i32 1, ptr %12, align 4, !tbaa !5
  %13 = add nsw i32 %10, 1
  store i32 %13, ptr %3, align 4, !tbaa !5
  %.not.not = icmp slt i32 %10, %0
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

14:                                               ; preds = %.lr.ph
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %75

.preheader37:                                     ; preds = %.preheader37.preheader, %._crit_edge42
  %indvars.iv51 = phi i64 [ 1, %.preheader37.preheader ], [ %indvars.iv.next52, %._crit_edge42 ]
  br i1 %8, label %._crit_edge42.unr-lcssa, label %.preheader37.new

.preheader36:                                     ; preds = %._crit_edge42, %._crit_edge.thread, %._crit_edge
  %16 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  br i1 %16, label %.preheader, label %.lr.ph45

._crit_edge42.unr-lcssa:                          ; preds = %.preheader37.new, %.preheader37
  %indvars.iv.unr = phi i64 [ 1, %.preheader37 ], [ %indvars.iv.next.3, %.preheader37.new ]
  br i1 %lcmp.mod.not, label %._crit_edge42, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge42.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge42.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge42.unr-lcssa ]
  %17 = getelementptr inbounds [1010 x [1010 x i32]], ptr @m, i64 0, i64 %indvars.iv51, i64 %indvars.iv.epil
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %indvars.iv51, i64 %19
  %21 = trunc nuw nsw i64 %indvars.iv.epil to i32
  store i32 %21, ptr %20, align 4, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge42, label %.epil.preheader, !llvm.loop !11

._crit_edge42:                                    ; preds = %.epil.preheader, %._crit_edge42.unr-lcssa
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count54
  br i1 %exitcond55.not, label %.preheader36, label %.preheader37, !llvm.loop !13

.preheader37.new:                                 ; preds = %.preheader37, %.preheader37.new
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.preheader37.new ], [ 1, %.preheader37 ]
  %niter = phi i64 [ %niter.next.3, %.preheader37.new ], [ 0, %.preheader37 ]
  %22 = getelementptr inbounds [1010 x [1010 x i32]], ptr @m, i64 0, i64 %indvars.iv51, i64 %indvars.iv
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %indvars.iv51, i64 %24
  %26 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %26, ptr %25, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds [1010 x [1010 x i32]], ptr @m, i64 0, i64 %indvars.iv51, i64 %indvars.iv.next
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %indvars.iv51, i64 %29
  %31 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %31, ptr %30, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %32 = getelementptr inbounds [1010 x [1010 x i32]], ptr @m, i64 0, i64 %indvars.iv51, i64 %indvars.iv.next.1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %indvars.iv51, i64 %34
  %36 = trunc nuw nsw i64 %indvars.iv.next.1 to i32
  store i32 %36, ptr %35, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %37 = getelementptr inbounds [1010 x [1010 x i32]], ptr @m, i64 0, i64 %indvars.iv51, i64 %indvars.iv.next.2
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %indvars.iv51, i64 %39
  %41 = trunc nuw nsw i64 %indvars.iv.next.2 to i32
  store i32 %41, ptr %40, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge42.unr-lcssa, label %.preheader37.new, !llvm.loop !14

.preheader:                                       ; preds = %73, %.preheader36
  br i1 %.not38, label %._crit_edge49, label %.lr.ph48.preheader

.lr.ph48.preheader:                               ; preds = %.preheader
  %42 = zext nneg i32 %0 to i64
  %43 = shl nuw nsw i64 %42, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @ans, i64 4), ptr nonnull align 4 getelementptr inbounds (i8, ptr @marry, i64 4), i64 %43, i1 false), !tbaa !5
  br label %._crit_edge49

.lr.ph45:                                         ; preds = %.preheader36, %73
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  store i32 %45, ptr %4, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1010 x [1010 x i32]], ptr @w, i64 0, i64 %47, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1010 x i32], ptr @marry, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %.not33 = icmp eq i32 %55, -1
  br i1 %.not33, label %.sink.split, label %56

56:                                               ; preds = %.lr.ph45
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %53, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = getelementptr inbounds [1010 x [1010 x i32]], ptr @pref, i64 0, i64 %53, i64 %47
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp sgt i32 %59, %61
  br i1 %62, label %63, label %71

63:                                               ; preds = %56
  %64 = getelementptr inbounds [1010 x i32], ptr @id, i64 0, i64 %57
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %64, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(4) %54)
          to label %67 unwind label %69

67:                                               ; preds = %63
  %68 = load i32, ptr %4, align 4, !tbaa !5
  br label %.sink.split

69:                                               ; preds = %71, %63
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %75

71:                                               ; preds = %56
  %72 = add nsw i32 %49, 1
  store i32 %72, ptr %48, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %73 unwind label %69

.sink.split:                                      ; preds = %.lr.ph45, %67
  %.sink = phi i32 [ %68, %67 ], [ %46, %.lr.ph45 ]
  store i32 %.sink, ptr %54, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %.sink.split, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %74 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
  br i1 %74, label %.preheader, label %.lr.ph45, !llvm.loop !15

._crit_edge49:                                    ; preds = %.lr.ph48.preheader, %.preheader
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #6
  ret void

75:                                               ; preds = %69, %14
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %70, %69 ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn
}

; 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 uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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