; LLVM IR from eyangch/competitive-programming :: CSES/Range_Queries (static_range_minimum_queries)

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

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@st = external dso_local global [20 x [200000 x i32]], align 16
@l2 = external dso_local global [200001 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 double, align 8
  %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 i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = 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)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store double 1.000000e+09, ptr %2, align 8, !tbaa !8
  call void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef @st, ptr noundef getelementptr inbounds (i32, ptr getelementptr inbounds ([20 x [200000 x i32]], ptr @st, i64 0, i64 19), i64 200000), ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %30, %0
  %21 = load i32, ptr %3, align 4, !tbaa !11
  %22 = load i32, ptr @N, align 4, !tbaa !11
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %33

25:                                               ; preds = %20
  %26 = load i32, ptr %3, align 4, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [200000 x i32], ptr @st, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %28)
  br label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %3, align 4, !tbaa !11
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %3, align 4, !tbaa !11
  br label %20, !llvm.loop !13

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

34:                                               ; preds = %79, %33
  %35 = load i32, ptr %4, align 4, !tbaa !11
  %36 = icmp slt i32 %35, 20
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %82

38:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %39

39:                                               ; preds = %75, %38
  %40 = load i32, ptr %6, align 4, !tbaa !11
  %41 = load i32, ptr %4, align 4, !tbaa !11
  %42 = shl i32 1, %41
  %43 = add nsw i32 %40, %42
  %44 = sub nsw i32 %43, 1
  %45 = load i32, ptr @N, align 4, !tbaa !11
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %39
  %49 = load i32, ptr %4, align 4, !tbaa !11
  %50 = sub nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %51
  %53 = load i32, ptr %6, align 4, !tbaa !11
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [200000 x i32], ptr %52, i64 0, i64 %54
  %56 = load i32, ptr %4, align 4, !tbaa !11
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %58
  %60 = load i32, ptr %6, align 4, !tbaa !11
  %61 = load i32, ptr %4, align 4, !tbaa !11
  %62 = sub nsw i32 %61, 1
  %63 = shl i32 1, %62
  %64 = add nsw i32 %60, %63
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [200000 x i32], ptr %59, i64 0, i64 %65
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) %66)
  %68 = load i32, ptr %67, align 4, !tbaa !11
  %69 = load i32, ptr %4, align 4, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %70
  %72 = load i32, ptr %6, align 4, !tbaa !11
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [200000 x i32], ptr %71, i64 0, i64 %73
  store i32 %68, ptr %74, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %48
  %76 = load i32, ptr %6, align 4, !tbaa !11
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %6, align 4, !tbaa !11
  br label %39, !llvm.loop !15

78:                                               ; preds = %47
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %4, align 4, !tbaa !11
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %4, align 4, !tbaa !11
  br label %34, !llvm.loop !16

82:                                               ; preds = %37
  store i32 0, ptr getelementptr inbounds ([200001 x i32], ptr @l2, i64 0, i64 1), align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 2, ptr %7, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %98, %82
  %84 = load i32, ptr %7, align 4, !tbaa !11
  %85 = load i32, ptr @N, align 4, !tbaa !11
  %86 = icmp sle i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %101

88:                                               ; preds = %83
  %89 = load i32, ptr %7, align 4, !tbaa !11
  %90 = sdiv i32 %89, 2
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !11
  %94 = add nsw i32 %93, 1
  %95 = load i32, ptr %7, align 4, !tbaa !11
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %96
  store i32 %94, ptr %97, align 4, !tbaa !11
  br label %98

98:                                               ; preds = %88
  %99 = load i32, ptr %7, align 4, !tbaa !11
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %7, align 4, !tbaa !11
  br label %83, !llvm.loop !17

101:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %102

102:                                              ; preds = %141, %101
  %103 = load i32, ptr %8, align 4, !tbaa !11
  %104 = load i32, ptr @Q, align 4, !tbaa !11
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %107, label %106

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

107:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %108 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %109 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %108, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %110 = load i32, ptr %9, align 4, !tbaa !11
  %111 = add nsw i32 %110, -1
  store i32 %111, ptr %9, align 4, !tbaa !11
  %112 = load i32, ptr %10, align 4, !tbaa !11
  %113 = add nsw i32 %112, -1
  store i32 %113, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %114 = load i32, ptr %10, align 4, !tbaa !11
  %115 = load i32, ptr %9, align 4, !tbaa !11
  %116 = sub nsw i32 %114, %115
  %117 = add nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !11
  store i32 %120, ptr %11, align 4, !tbaa !11
  %121 = load i32, ptr %11, align 4, !tbaa !11
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %122
  %124 = load i32, ptr %9, align 4, !tbaa !11
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [200000 x i32], ptr %123, i64 0, i64 %125
  %127 = load i32, ptr %11, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %128
  %130 = load i32, ptr %10, align 4, !tbaa !11
  %131 = load i32, ptr %11, align 4, !tbaa !11
  %132 = shl i32 1, %131
  %133 = sub nsw i32 %130, %132
  %134 = add nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [200000 x i32], ptr %129, i64 0, i64 %135
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %126, ptr noundef nonnull align 4 dereferenceable(4) %136)
  %138 = load i32, ptr %137, align 4, !tbaa !11
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %138)
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %141

141:                                              ; preds = %107
  %142 = load i32, ptr %8, align 4, !tbaa !11
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %8, align 4, !tbaa !11
  br label %102, !llvm.loop !18

144:                                              ; preds = %106
  %145 = load i32, ptr %1, align 4
  ret i32 %145
}

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

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

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@st = external dso_local global [20 x [200000 x i32]], align 16
@l2 = external dso_local local_unnamed_addr global [200001 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 double, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = 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)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store double 1.000000e+09, ptr %1, align 8, !tbaa !8
  call void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef nonnull @st, ptr noundef nonnull getelementptr inbounds (i8, ptr @st, i64 16000000), ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %12 = load i32, ptr @N, align 4, !tbaa !11
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %.preheader31.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %14 = getelementptr inbounds [200000 x i32], ptr @st, i64 0, i64 %indvars.iv
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @N, align 4, !tbaa !11
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %.preheader31.preheader, !llvm.loop !13

.preheader31.preheader:                           ; preds = %.lr.ph, %0
  %.ph = phi i32 [ %12, %0 ], [ %16, %.lr.ph ]
  br label %.preheader31

.preheader31:                                     ; preds = %.preheader31.preheader, %._crit_edge
  %19 = phi i32 [ %31, %._crit_edge ], [ %.ph, %.preheader31.preheader ]
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %._crit_edge ], [ 1, %.preheader31.preheader ]
  %20 = trunc nuw nsw i64 %indvars.iv49 to i32
  %21 = shl nuw nsw i32 1, %20
  %.not2934 = icmp sgt i32 %21, %19
  br i1 %.not2934, label %._crit_edge, label %.lr.ph36

.lr.ph36:                                         ; preds = %.preheader31
  %22 = add nsw i64 %indvars.iv49, -1
  %23 = trunc nuw nsw i64 %22 to i32
  %24 = shl nuw nsw i32 1, %23
  %25 = zext nneg i32 %24 to i64
  br label %32

26:                                               ; preds = %._crit_edge
  store i32 0, ptr getelementptr inbounds (i8, ptr @l2, i64 4), align 4, !tbaa !11
  %.not38 = icmp slt i32 %31, 2
  br i1 %.not38, label %.preheader, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %26
  %27 = add nuw nsw i32 %31, 1
  %wide.trip.count = zext nneg i32 %27 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %28 = icmp eq i32 %27, 3
  br i1 %28, label %.preheader.loopexit.unr-lcssa, label %.lr.ph41.preheader.new

.lr.ph41.preheader.new:                           ; preds = %.lr.ph41.preheader
  %29 = and i64 %wide.trip.count, 2147483646
  %30 = add nsw i64 %29, -4
  br label %.lr.ph41

._crit_edge:                                      ; preds = %32, %.preheader31
  %31 = phi i32 [ %19, %.preheader31 ], [ %39, %32 ]
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, 20
  br i1 %exitcond.not, label %26, label %.preheader31, !llvm.loop !15

32:                                               ; preds = %.lr.ph36, %32
  %indvars.iv46 = phi i64 [ 0, %.lr.ph36 ], [ %indvars.iv.next47, %32 ]
  %33 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %22, i64 %indvars.iv46
  %34 = add nuw nsw i64 %indvars.iv46, %25
  %35 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %22, i64 %34
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %33, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %indvars.iv49, i64 %indvars.iv46
  store i32 %37, ptr %38, align 4, !tbaa !11
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %39 = load i32, ptr @N, align 4, !tbaa !11
  %40 = trunc i64 %indvars.iv.next47 to i32
  %41 = add i32 %21, %40
  %.not29 = icmp sgt i32 %41, %39
  br i1 %.not29, label %._crit_edge, label %32, !llvm.loop !16

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph41, %.lr.ph41.preheader
  %indvars.iv52.unr = phi i64 [ 2, %.lr.ph41.preheader ], [ %indvars.iv.next53.1, %.lr.ph41 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph41.epil

.lr.ph41.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %42 = lshr i64 %indvars.iv52.unr, 1
  %43 = and i64 %42, 2147483647
  %44 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = add nsw i32 %45, 1
  %47 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %indvars.iv52.unr
  store i32 %46, ptr %47, align 4, !tbaa !11
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph41.epil, %.preheader.loopexit.unr-lcssa, %26
  %48 = load i32, ptr @Q, align 4, !tbaa !11
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph43, label %._crit_edge44

.lr.ph41:                                         ; preds = %.lr.ph41, %.lr.ph41.preheader.new
  %indvars.iv52 = phi i64 [ 2, %.lr.ph41.preheader.new ], [ %indvars.iv.next53.1, %.lr.ph41 ]
  %niter = phi i64 [ 0, %.lr.ph41.preheader.new ], [ %niter.next.1, %.lr.ph41 ]
  %50 = lshr exact i64 %indvars.iv52, 1
  %51 = and i64 %50, 2147483647
  %52 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = add nsw i32 %53, 1
  %55 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %indvars.iv52
  store i32 %54, ptr %55, align 8, !tbaa !11
  %indvars.iv.next53 = or disjoint i64 %indvars.iv52, 1
  %56 = lshr exact i64 %indvars.iv52, 1
  %57 = and i64 %56, 2147483647
  %58 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !11
  %60 = add nsw i32 %59, 1
  %61 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %indvars.iv.next53
  store i32 %60, ptr %61, align 4, !tbaa !11
  %indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %30
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph41, !llvm.loop !17

._crit_edge44:                                    ; preds = %.lr.ph43, %.preheader
  ret i32 0

.lr.ph43:                                         ; preds = %.preheader, %.lr.ph43
  %.02542 = phi i32 [ %82, %.lr.ph43 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %62, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %64 = load i32, ptr %2, align 4, !tbaa !11
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr %2, align 4, !tbaa !11
  %66 = load i32, ptr %3, align 4, !tbaa !11
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr %3, align 4, !tbaa !11
  %reass.sub = sub i32 %66, %64
  %68 = add i32 %reass.sub, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200001 x i32], ptr @l2, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = sext i32 %65 to i64
  %74 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %72, i64 %73
  %.neg = shl nsw i32 -1, %71
  %75 = add i32 %.neg, %66
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [20 x [200000 x i32]], ptr @st, i64 0, i64 %72, i64 %76
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %77)
  %79 = load i32, ptr %78, align 4, !tbaa !11
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %79)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %82 = add nuw nsw i32 %.02542, 1
  %83 = load i32, ptr @Q, align 4, !tbaa !11
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %.lr.ph43, label %._crit_edge44, !llvm.loop !18
}

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

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

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 #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


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