; LLVM IR from ahr9n/psolving-paradigms :: 3.binary-search (Kattis firefly - Firefly)

; 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" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::reverse_iterator" = type { %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i64, align 8
@h = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@l = external dso_local global i64, align 8
@r = external dso_local global i64, align 8
@mid = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@_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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %"class.std::vector", 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 %"class.std::reverse_iterator", align 8
  %10 = alloca %"class.std::reverse_iterator", align 8
  %11 = alloca %"class.std::reverse_iterator", align 8
  %12 = alloca %"class.std::reverse_iterator", align 8
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %22 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %23 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %24 = getelementptr i8, ptr %23, i64 -24
  %25 = load i64, ptr %24, align 8
  %26 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %25
  %27 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %26, ptr noundef null)
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(8) @h)
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %30

30:                                               ; preds = %63, %0
  %31 = load i32, ptr %4, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = load i64, ptr @n, align 8, !tbaa !11
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %67

36:                                               ; preds = %30
  %37 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @k)
          to label %38 unwind label %46

38:                                               ; preds = %36
  %39 = load i32, ptr %4, align 4, !tbaa !8
  %40 = and i32 %39, 1
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %54

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %43 = load i64, ptr @k, align 8, !tbaa !11
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %7, align 4, !tbaa !8
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %45 unwind label %50

45:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %62

46:                                               ; preds = %36
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %5, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %6, align 4
  br label %66

50:                                               ; preds = %42
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %5, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %66

54:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %55 = load i64, ptr @k, align 8, !tbaa !11
  %56 = trunc i64 %55 to i32
  store i32 %56, ptr %8, align 4, !tbaa !8
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %57 unwind label %58

57:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %62

58:                                               ; preds = %54
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %5, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %66

62:                                               ; preds = %57, %45
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %4, align 4, !tbaa !8
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %4, align 4, !tbaa !8
  br label %30, !llvm.loop !13

66:                                               ; preds = %58, %50, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %268

67:                                               ; preds = %35
  call void @_ZNSt6vectorIiSaIiEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @_ZNSt6vectorIiSaIiEE4rendEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  invoke void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEEvT_S9_(ptr noundef %9, ptr noundef %10)
          to label %68 unwind label %79

68:                                               ; preds = %67
  call void @_ZNSt6vectorIiSaIiEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @_ZNSt6vectorIiSaIiEE4rendEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  invoke void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEEvT_S9_(ptr noundef %11, ptr noundef %12)
          to label %69 unwind label %79

69:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 200010, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !8
  invoke void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %70 unwind label %83

70:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 1, ptr %16, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %71 = load i64, ptr @h, align 8, !tbaa !11
  %72 = trunc i64 %71 to i32
  store i32 %72, ptr %17, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  br label %73

73:                                               ; preds = %159, %70
  %74 = load i32, ptr %16, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = load i64, ptr @h, align 8, !tbaa !11
  %77 = icmp sle i64 %75, %76
  br i1 %77, label %87, label %78

78:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %164

79:                                               ; preds = %68, %67
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %5, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %6, align 4
  br label %268

83:                                               ; preds = %69
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %5, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %267

87:                                               ; preds = %73
  store i64 0, ptr @l, align 8, !tbaa !11
  %88 = load i64, ptr @n, align 8, !tbaa !11
  %89 = sdiv i64 %88, 2
  %90 = sub nsw i64 %89, 1
  store i64 %90, ptr @r, align 8, !tbaa !11
  %91 = load i64, ptr @n, align 8, !tbaa !11
  %92 = sdiv i64 %91, 2
  store i64 %92, ptr @ans, align 8, !tbaa !11
  br label %93

93:                                               ; preds = %114, %87
  %94 = load i64, ptr @l, align 8, !tbaa !11
  %95 = load i64, ptr @r, align 8, !tbaa !11
  %96 = icmp sle i64 %94, %95
  br i1 %96, label %97, label %115

97:                                               ; preds = %93
  %98 = load i64, ptr @l, align 8, !tbaa !11
  %99 = load i64, ptr @r, align 8, !tbaa !11
  %100 = add nsw i64 %98, %99
  %101 = sdiv i64 %100, 2
  store i64 %101, ptr @mid, align 8, !tbaa !11
  %102 = load i64, ptr @mid, align 8, !tbaa !11
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %102) #6
  %104 = load i32, ptr %103, align 4, !tbaa !8
  %105 = load i32, ptr %16, align 4, !tbaa !8
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %107, label %111

107:                                              ; preds = %97
  %108 = load i64, ptr @mid, align 8, !tbaa !11
  store i64 %108, ptr @ans, align 8, !tbaa !11
  %109 = load i64, ptr @mid, align 8, !tbaa !11
  %110 = sub nsw i64 %109, 1
  store i64 %110, ptr @r, align 8, !tbaa !11
  br label %114

111:                                              ; preds = %97
  %112 = load i64, ptr @mid, align 8, !tbaa !11
  %113 = add nsw i64 %112, 1
  store i64 %113, ptr @l, align 8, !tbaa !11
  br label %114

114:                                              ; preds = %111, %107
  br label %93, !llvm.loop !15

115:                                              ; preds = %93
  %116 = load i64, ptr @ans, align 8, !tbaa !11
  %117 = trunc i64 %116 to i32
  store i32 %117, ptr %18, align 4, !tbaa !8
  store i64 0, ptr @l, align 8, !tbaa !11
  %118 = load i64, ptr @n, align 8, !tbaa !11
  %119 = sdiv i64 %118, 2
  %120 = sub nsw i64 %119, 1
  store i64 %120, ptr @r, align 8, !tbaa !11
  %121 = load i64, ptr @n, align 8, !tbaa !11
  %122 = sdiv i64 %121, 2
  store i64 %122, ptr @ans, align 8, !tbaa !11
  br label %123

123:                                              ; preds = %144, %115
  %124 = load i64, ptr @l, align 8, !tbaa !11
  %125 = load i64, ptr @r, align 8, !tbaa !11
  %126 = icmp sle i64 %124, %125
  br i1 %126, label %127, label %145

127:                                              ; preds = %123
  %128 = load i64, ptr @l, align 8, !tbaa !11
  %129 = load i64, ptr @r, align 8, !tbaa !11
  %130 = add nsw i64 %128, %129
  %131 = sdiv i64 %130, 2
  store i64 %131, ptr @mid, align 8, !tbaa !11
  %132 = load i64, ptr @mid, align 8, !tbaa !11
  %133 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %132) #6
  %134 = load i32, ptr %133, align 4, !tbaa !8
  %135 = load i32, ptr %17, align 4, !tbaa !8
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %137, label %141

137:                                              ; preds = %127
  %138 = load i64, ptr @mid, align 8, !tbaa !11
  store i64 %138, ptr @ans, align 8, !tbaa !11
  %139 = load i64, ptr @mid, align 8, !tbaa !11
  %140 = sub nsw i64 %139, 1
  store i64 %140, ptr @r, align 8, !tbaa !11
  br label %144

141:                                              ; preds = %127
  %142 = load i64, ptr @mid, align 8, !tbaa !11
  %143 = add nsw i64 %142, 1
  store i64 %143, ptr @l, align 8, !tbaa !11
  br label %144

144:                                              ; preds = %141, %137
  br label %123, !llvm.loop !16

145:                                              ; preds = %123
  %146 = load i64, ptr @ans, align 8, !tbaa !11
  %147 = load i32, ptr %18, align 4, !tbaa !8
  %148 = sext i32 %147 to i64
  %149 = add nsw i64 %148, %146
  %150 = trunc i64 %149 to i32
  store i32 %150, ptr %18, align 4, !tbaa !8
  %151 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  %152 = load i32, ptr %151, align 4, !tbaa !17
  %153 = load i32, ptr %18, align 4, !tbaa !8
  %154 = icmp sgt i32 %152, %153
  br i1 %154, label %155, label %158

155:                                              ; preds = %145
  %156 = load i32, ptr %18, align 4, !tbaa !8
  %157 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  store i32 %156, ptr %157, align 4, !tbaa !17
  br label %158

158:                                              ; preds = %155, %145
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %16, align 4, !tbaa !8
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %16, align 4, !tbaa !8
  %162 = load i32, ptr %17, align 4, !tbaa !8
  %163 = add nsw i32 %162, -1
  store i32 %163, ptr %17, align 4, !tbaa !8
  br label %73, !llvm.loop !19

164:                                              ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 1, ptr %19, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %165 = load i64, ptr @h, align 8, !tbaa !11
  %166 = trunc i64 %165 to i32
  store i32 %166, ptr %20, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  br label %167

167:                                              ; preds = %246, %164
  %168 = load i32, ptr %19, align 4, !tbaa !8
  %169 = sext i32 %168 to i64
  %170 = load i64, ptr @h, align 8, !tbaa !11
  %171 = icmp sle i64 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %251

173:                                              ; preds = %167
  store i64 0, ptr @l, align 8, !tbaa !11
  %174 = load i64, ptr @n, align 8, !tbaa !11
  %175 = sdiv i64 %174, 2
  %176 = sub nsw i64 %175, 1
  store i64 %176, ptr @r, align 8, !tbaa !11
  %177 = load i64, ptr @n, align 8, !tbaa !11
  %178 = sdiv i64 %177, 2
  store i64 %178, ptr @ans, align 8, !tbaa !11
  br label %179

179:                                              ; preds = %200, %173
  %180 = load i64, ptr @l, align 8, !tbaa !11
  %181 = load i64, ptr @r, align 8, !tbaa !11
  %182 = icmp sle i64 %180, %181
  br i1 %182, label %183, label %201

183:                                              ; preds = %179
  %184 = load i64, ptr @l, align 8, !tbaa !11
  %185 = load i64, ptr @r, align 8, !tbaa !11
  %186 = add nsw i64 %184, %185
  %187 = sdiv i64 %186, 2
  store i64 %187, ptr @mid, align 8, !tbaa !11
  %188 = load i64, ptr @mid, align 8, !tbaa !11
  %189 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %188) #6
  %190 = load i32, ptr %189, align 4, !tbaa !8
  %191 = load i32, ptr %19, align 4, !tbaa !8
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %193, label %197

193:                                              ; preds = %183
  %194 = load i64, ptr @mid, align 8, !tbaa !11
  store i64 %194, ptr @ans, align 8, !tbaa !11
  %195 = load i64, ptr @mid, align 8, !tbaa !11
  %196 = sub nsw i64 %195, 1
  store i64 %196, ptr @r, align 8, !tbaa !11
  br label %200

197:                                              ; preds = %183
  %198 = load i64, ptr @mid, align 8, !tbaa !11
  %199 = add nsw i64 %198, 1
  store i64 %199, ptr @l, align 8, !tbaa !11
  br label %200

200:                                              ; preds = %197, %193
  br label %179, !llvm.loop !20

201:                                              ; preds = %179
  %202 = load i64, ptr @ans, align 8, !tbaa !11
  %203 = trunc i64 %202 to i32
  store i32 %203, ptr %21, align 4, !tbaa !8
  store i64 0, ptr @l, align 8, !tbaa !11
  %204 = load i64, ptr @n, align 8, !tbaa !11
  %205 = sdiv i64 %204, 2
  %206 = sub nsw i64 %205, 1
  store i64 %206, ptr @r, align 8, !tbaa !11
  %207 = load i64, ptr @n, align 8, !tbaa !11
  %208 = sdiv i64 %207, 2
  store i64 %208, ptr @ans, align 8, !tbaa !11
  br label %209

209:                                              ; preds = %230, %201
  %210 = load i64, ptr @l, align 8, !tbaa !11
  %211 = load i64, ptr @r, align 8, !tbaa !11
  %212 = icmp sle i64 %210, %211
  br i1 %212, label %213, label %231

213:                                              ; preds = %209
  %214 = load i64, ptr @l, align 8, !tbaa !11
  %215 = load i64, ptr @r, align 8, !tbaa !11
  %216 = add nsw i64 %214, %215
  %217 = sdiv i64 %216, 2
  store i64 %217, ptr @mid, align 8, !tbaa !11
  %218 = load i64, ptr @mid, align 8, !tbaa !11
  %219 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %218) #6
  %220 = load i32, ptr %219, align 4, !tbaa !8
  %221 = load i32, ptr %20, align 4, !tbaa !8
  %222 = icmp slt i32 %220, %221
  br i1 %222, label %223, label %227

223:                                              ; preds = %213
  %224 = load i64, ptr @mid, align 8, !tbaa !11
  store i64 %224, ptr @ans, align 8, !tbaa !11
  %225 = load i64, ptr @mid, align 8, !tbaa !11
  %226 = sub nsw i64 %225, 1
  store i64 %226, ptr @r, align 8, !tbaa !11
  br label %230

227:                                              ; preds = %213
  %228 = load i64, ptr @mid, align 8, !tbaa !11
  %229 = add nsw i64 %228, 1
  store i64 %229, ptr @l, align 8, !tbaa !11
  br label %230

230:                                              ; preds = %227, %223
  br label %209, !llvm.loop !21

231:                                              ; preds = %209
  %232 = load i64, ptr @ans, align 8, !tbaa !11
  %233 = load i32, ptr %21, align 4, !tbaa !8
  %234 = sext i32 %233 to i64
  %235 = add nsw i64 %234, %232
  %236 = trunc i64 %235 to i32
  store i32 %236, ptr %21, align 4, !tbaa !8
  %237 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  %238 = load i32, ptr %237, align 4, !tbaa !17
  %239 = load i32, ptr %21, align 4, !tbaa !8
  %240 = icmp eq i32 %238, %239
  br i1 %240, label %241, label %245

241:                                              ; preds = %231
  %242 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 1
  %243 = load i32, ptr %242, align 4, !tbaa !22
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr %242, align 4, !tbaa !22
  br label %245

245:                                              ; preds = %241, %231
  br label %246

246:                                              ; preds = %245
  %247 = load i32, ptr %19, align 4, !tbaa !8
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %19, align 4, !tbaa !8
  %249 = load i32, ptr %20, align 4, !tbaa !8
  %250 = add nsw i32 %249, -1
  store i32 %250, ptr %20, align 4, !tbaa !8
  br label %167, !llvm.loop !23

251:                                              ; preds = %172
  %252 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  %253 = load i32, ptr %252, align 4, !tbaa !17
  %254 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %253)
          to label %255 unwind label %263

255:                                              ; preds = %251
  %256 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %254, i8 noundef signext 32)
          to label %257 unwind label %263

257:                                              ; preds = %255
  %258 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 1
  %259 = load i32, ptr %258, align 4, !tbaa !22
  %260 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %256, i32 noundef %259)
          to label %261 unwind label %263

261:                                              ; preds = %257
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #6
  %262 = load i32, ptr %1, align 4
  ret i32 %262

263:                                              ; preds = %257, %255, %251
  %264 = landingpad { ptr, i32 }
          cleanup
  %265 = extractvalue { ptr, i32 } %264, 0
  store ptr %265, ptr %5, align 8
  %266 = extractvalue { ptr, i32 } %264, 1
  store i32 %266, ptr %6, align 4
  br label %267

267:                                              ; preds = %263, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %268

268:                                              ; preds = %267, %79, %66
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #6
  br label %269

269:                                              ; preds = %268
  %270 = load ptr, ptr %5, align 8
  %271 = load i32, ptr %6, align 4
  %272 = insertvalue { ptr, i32 } poison, ptr %270, 0
  %273 = insertvalue { ptr, i32 } %272, i32 %271, 1
  resume { ptr, i32 } %273
}

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; 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 uwtable
declare dso_local void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEEvT_S9_(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { 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 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!18, !9, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !9, i64 0, !9, i64 4}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = !{!18, !9, i64 4}
!23 = distinct !{!23, !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" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::reverse_iterator" = type { %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i64, align 8
@h = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@l = external dso_local local_unnamed_addr global i64, align 8
@r = external dso_local local_unnamed_addr global i64, align 8
@mid = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@_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 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::reverse_iterator", align 8
  %6 = alloca %"class.std::reverse_iterator", align 8
  %7 = alloca %"class.std::reverse_iterator", align 8
  %8 = alloca %"class.std::reverse_iterator", align 8
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = tail 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 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(8) @h)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %20 = load i64, ptr @n, align 8, !tbaa !8
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %39, %0
  call void @_ZNSt6vectorIiSaIiEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @_ZNSt6vectorIiSaIiEE4rendEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  invoke void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEEvT_S9_(ptr noundef nonnull %5, ptr noundef nonnull %6)
          to label %42 unwind label %48

.lr.ph:                                           ; preds = %0, %39
  %indvars.iv = phi i64 [ %indvars.iv.next, %39 ], [ 0, %0 ]
  %22 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @k)
          to label %23 unwind label %29

23:                                               ; preds = %.lr.ph
  %24 = and i64 %indvars.iv, 1
  %.not42 = icmp eq i64 %24, 0
  br i1 %.not42, label %33, label %25

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %26 = load i64, ptr @k, align 8, !tbaa !8
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr %3, align 4, !tbaa !11
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %28 unwind label %31

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %39

29:                                               ; preds = %.lr.ph
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %152

31:                                               ; preds = %25
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %152

33:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %34 = load i64, ptr @k, align 8, !tbaa !8
  %35 = trunc i64 %34 to i32
  store i32 %35, ptr %4, align 4, !tbaa !11
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %36 unwind label %37

36:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %39

37:                                               ; preds = %33
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %152

39:                                               ; preds = %28, %36
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = load i64, ptr @n, align 8, !tbaa !8
  %41 = icmp sgt i64 %40, %indvars.iv.next
  br i1 %41, label %.lr.ph, label %._crit_edge, !llvm.loop !13

42:                                               ; preds = %._crit_edge
  call void @_ZNSt6vectorIiSaIiEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @_ZNSt6vectorIiSaIiEE4rendEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  invoke void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEEvT_S9_(ptr noundef nonnull %7, ptr noundef nonnull %8)
          to label %43 unwind label %48

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  store i32 200010, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  store i32 0, ptr %11, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  %44 = load i64, ptr @h, align 8, !tbaa !8
  %.not54 = icmp slt i64 %44, 1
  br i1 %.not54, label %._crit_edge59.._crit_edge73_crit_edge, label %.lr.ph58.preheader

.lr.ph58.preheader:                               ; preds = %43
  %45 = trunc i64 %44 to i32
  br label %.lr.ph58

._crit_edge59:                                    ; preds = %91
  %.not3768 = icmp slt i64 %93, 1
  br i1 %.not3768, label %._crit_edge59.._crit_edge73_crit_edge, label %.lr.ph72

._crit_edge59.._crit_edge73_crit_edge:            ; preds = %43, %._crit_edge59
  %.pre95 = load i32, ptr %9, align 4, !tbaa !15
  br label %._crit_edge73

.lr.ph72:                                         ; preds = %._crit_edge59
  %46 = trunc i64 %93 to i32
  %47 = getelementptr inbounds i8, ptr %9, i64 4
  br label %96

48:                                               ; preds = %42, %._crit_edge
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %152

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %91
  %indvars.iv76 = phi i64 [ 1, %.lr.ph58.preheader ], [ %indvars.iv.next77, %91 ]
  %.02156 = phi i32 [ %45, %.lr.ph58.preheader ], [ %92, %91 ]
  store i64 0, ptr @l, align 8, !tbaa !8
  %50 = load i64, ptr @n, align 8, !tbaa !8
  %51 = sdiv i64 %50, 2
  %52 = add nsw i64 %51, -1
  store i64 %52, ptr @r, align 8, !tbaa !8
  store i64 %51, ptr @ans, align 8, !tbaa !8
  %.not4046 = icmp slt i64 %50, 2
  br i1 %.not4046, label %._crit_edge49.thread, label %.lr.ph48

._crit_edge49.thread:                             ; preds = %.lr.ph58
  store i64 0, ptr @l, align 8, !tbaa !8
  store i64 %52, ptr @r, align 8, !tbaa !8
  store i64 %51, ptr @ans, align 8, !tbaa !8
  br label %._crit_edge53

.lr.ph48:                                         ; preds = %.lr.ph58, %66
  %53 = phi i64 [ %67, %66 ], [ %52, %.lr.ph58 ]
  %54 = phi i64 [ %68, %66 ], [ 0, %.lr.ph58 ]
  %55 = add nsw i64 %53, %54
  %56 = sdiv i64 %55, 2
  store i64 %56, ptr @mid, align 8, !tbaa !8
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %56) #6
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = icmp sgt i64 %indvars.iv76, %59
  %61 = load i64, ptr @mid, align 8, !tbaa !8
  br i1 %60, label %62, label %64

62:                                               ; preds = %.lr.ph48
  store i64 %61, ptr @ans, align 8, !tbaa !8
  %63 = add nsw i64 %61, -1
  store i64 %63, ptr @r, align 8, !tbaa !8
  %.pre = load i64, ptr @l, align 8, !tbaa !8
  br label %66

64:                                               ; preds = %.lr.ph48
  %65 = add nsw i64 %61, 1
  store i64 %65, ptr @l, align 8, !tbaa !8
  %.pre82 = load i64, ptr @r, align 8, !tbaa !8
  br label %66

66:                                               ; preds = %64, %62
  %67 = phi i64 [ %.pre82, %64 ], [ %63, %62 ]
  %68 = phi i64 [ %65, %64 ], [ %.pre, %62 ]
  %.not40 = icmp sgt i64 %68, %67
  br i1 %.not40, label %._crit_edge49, label %.lr.ph48, !llvm.loop !17

._crit_edge49:                                    ; preds = %66
  %.pre83 = load i64, ptr @ans, align 8, !tbaa !8
  %.pre84 = load i64, ptr @n, align 8, !tbaa !8
  %.pre99 = sdiv i64 %.pre84, 2
  %.pre101 = add nsw i64 %.pre99, -1
  store i64 0, ptr @l, align 8, !tbaa !8
  store i64 %.pre101, ptr @r, align 8, !tbaa !8
  store i64 %.pre99, ptr @ans, align 8, !tbaa !8
  %.not4150 = icmp slt i64 %.pre84, 2
  br i1 %.not4150, label %._crit_edge53, label %.lr.ph52

.lr.ph52:                                         ; preds = %._crit_edge49, %81
  %69 = phi i64 [ %82, %81 ], [ %.pre101, %._crit_edge49 ]
  %70 = phi i64 [ %83, %81 ], [ 0, %._crit_edge49 ]
  %71 = add nsw i64 %69, %70
  %72 = sdiv i64 %71, 2
  store i64 %72, ptr @mid, align 8, !tbaa !8
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %72) #6
  %74 = load i32, ptr %73, align 4, !tbaa !11
  %75 = icmp slt i32 %74, %.02156
  %76 = load i64, ptr @mid, align 8, !tbaa !8
  br i1 %75, label %77, label %79

77:                                               ; preds = %.lr.ph52
  store i64 %76, ptr @ans, align 8, !tbaa !8
  %78 = add nsw i64 %76, -1
  store i64 %78, ptr @r, align 8, !tbaa !8
  %.pre85 = load i64, ptr @l, align 8, !tbaa !8
  br label %81

79:                                               ; preds = %.lr.ph52
  %80 = add nsw i64 %76, 1
  store i64 %80, ptr @l, align 8, !tbaa !8
  %.pre86 = load i64, ptr @r, align 8, !tbaa !8
  br label %81

81:                                               ; preds = %79, %77
  %82 = phi i64 [ %.pre86, %79 ], [ %78, %77 ]
  %83 = phi i64 [ %80, %79 ], [ %.pre85, %77 ]
  %.not41 = icmp sgt i64 %83, %82
  br i1 %.not41, label %._crit_edge53.loopexit, label %.lr.ph52, !llvm.loop !18

._crit_edge53.loopexit:                           ; preds = %81
  %.pre87 = load i64, ptr @ans, align 8, !tbaa !8
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %._crit_edge49.thread, %._crit_edge53.loopexit, %._crit_edge49
  %84 = phi i64 [ %.pre83, %._crit_edge53.loopexit ], [ %.pre83, %._crit_edge49 ], [ %51, %._crit_edge49.thread ]
  %85 = phi i64 [ %.pre87, %._crit_edge53.loopexit ], [ %.pre99, %._crit_edge49 ], [ %51, %._crit_edge49.thread ]
  %86 = add i64 %85, %84
  %87 = trunc i64 %86 to i32
  %88 = load i32, ptr %9, align 4, !tbaa !15
  %89 = icmp sgt i32 %88, %87
  br i1 %89, label %90, label %91

90:                                               ; preds = %._crit_edge53
  store i32 %87, ptr %9, align 4, !tbaa !15
  br label %91

91:                                               ; preds = %._crit_edge53, %90
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %92 = add nsw i32 %.02156, -1
  %93 = load i64, ptr @h, align 8, !tbaa !8
  %.not.not = icmp sgt i64 %93, %indvars.iv76
  br i1 %.not.not, label %.lr.ph58, label %._crit_edge59, !llvm.loop !19

._crit_edge73:                                    ; preds = %140, %._crit_edge59.._crit_edge73_crit_edge
  %94 = phi i32 [ %.pre95, %._crit_edge59.._crit_edge73_crit_edge ], [ %135, %140 ]
  %95 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %94)
          to label %143 unwind label %150

96:                                               ; preds = %.lr.ph72, %140
  %indvars.iv79 = phi i64 [ 1, %.lr.ph72 ], [ %indvars.iv.next80, %140 ]
  %.070 = phi i32 [ %46, %.lr.ph72 ], [ %141, %140 ]
  store i64 0, ptr @l, align 8, !tbaa !8
  %97 = load i64, ptr @n, align 8, !tbaa !8
  %98 = sdiv i64 %97, 2
  %99 = add nsw i64 %98, -1
  store i64 %99, ptr @r, align 8, !tbaa !8
  store i64 %98, ptr @ans, align 8, !tbaa !8
  %.not3860 = icmp slt i64 %97, 2
  br i1 %.not3860, label %._crit_edge63.thread, label %.lr.ph62

._crit_edge63.thread:                             ; preds = %96
  store i64 0, ptr @l, align 8, !tbaa !8
  store i64 %99, ptr @r, align 8, !tbaa !8
  store i64 %98, ptr @ans, align 8, !tbaa !8
  br label %._crit_edge67

.lr.ph62:                                         ; preds = %96, %113
  %100 = phi i64 [ %114, %113 ], [ %99, %96 ]
  %101 = phi i64 [ %115, %113 ], [ 0, %96 ]
  %102 = add nsw i64 %100, %101
  %103 = sdiv i64 %102, 2
  store i64 %103, ptr @mid, align 8, !tbaa !8
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %103) #6
  %105 = load i32, ptr %104, align 4, !tbaa !11
  %106 = sext i32 %105 to i64
  %107 = icmp sgt i64 %indvars.iv79, %106
  %108 = load i64, ptr @mid, align 8, !tbaa !8
  br i1 %107, label %109, label %111

109:                                              ; preds = %.lr.ph62
  store i64 %108, ptr @ans, align 8, !tbaa !8
  %110 = add nsw i64 %108, -1
  store i64 %110, ptr @r, align 8, !tbaa !8
  %.pre88 = load i64, ptr @l, align 8, !tbaa !8
  br label %113

111:                                              ; preds = %.lr.ph62
  %112 = add nsw i64 %108, 1
  store i64 %112, ptr @l, align 8, !tbaa !8
  %.pre89 = load i64, ptr @r, align 8, !tbaa !8
  br label %113

113:                                              ; preds = %111, %109
  %114 = phi i64 [ %.pre89, %111 ], [ %110, %109 ]
  %115 = phi i64 [ %112, %111 ], [ %.pre88, %109 ]
  %.not38 = icmp sgt i64 %115, %114
  br i1 %.not38, label %._crit_edge63, label %.lr.ph62, !llvm.loop !20

._crit_edge63:                                    ; preds = %113
  %.pre90 = load i64, ptr @ans, align 8, !tbaa !8
  %.pre91 = load i64, ptr @n, align 8, !tbaa !8
  %.pre96 = sdiv i64 %.pre91, 2
  %.pre97 = add nsw i64 %.pre96, -1
  store i64 0, ptr @l, align 8, !tbaa !8
  store i64 %.pre97, ptr @r, align 8, !tbaa !8
  store i64 %.pre96, ptr @ans, align 8, !tbaa !8
  %.not3964 = icmp slt i64 %.pre91, 2
  br i1 %.not3964, label %._crit_edge67, label %.lr.ph66

.lr.ph66:                                         ; preds = %._crit_edge63, %128
  %116 = phi i64 [ %129, %128 ], [ %.pre97, %._crit_edge63 ]
  %117 = phi i64 [ %130, %128 ], [ 0, %._crit_edge63 ]
  %118 = add nsw i64 %116, %117
  %119 = sdiv i64 %118, 2
  store i64 %119, ptr @mid, align 8, !tbaa !8
  %120 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %119) #6
  %121 = load i32, ptr %120, align 4, !tbaa !11
  %122 = icmp slt i32 %121, %.070
  %123 = load i64, ptr @mid, align 8, !tbaa !8
  br i1 %122, label %124, label %126

124:                                              ; preds = %.lr.ph66
  store i64 %123, ptr @ans, align 8, !tbaa !8
  %125 = add nsw i64 %123, -1
  store i64 %125, ptr @r, align 8, !tbaa !8
  %.pre92 = load i64, ptr @l, align 8, !tbaa !8
  br label %128

126:                                              ; preds = %.lr.ph66
  %127 = add nsw i64 %123, 1
  store i64 %127, ptr @l, align 8, !tbaa !8
  %.pre93 = load i64, ptr @r, align 8, !tbaa !8
  br label %128

128:                                              ; preds = %126, %124
  %129 = phi i64 [ %.pre93, %126 ], [ %125, %124 ]
  %130 = phi i64 [ %127, %126 ], [ %.pre92, %124 ]
  %.not39 = icmp sgt i64 %130, %129
  br i1 %.not39, label %._crit_edge67.loopexit, label %.lr.ph66, !llvm.loop !21

._crit_edge67.loopexit:                           ; preds = %128
  %.pre94 = load i64, ptr @ans, align 8, !tbaa !8
  br label %._crit_edge67

._crit_edge67:                                    ; preds = %._crit_edge63.thread, %._crit_edge67.loopexit, %._crit_edge63
  %131 = phi i64 [ %.pre90, %._crit_edge67.loopexit ], [ %.pre90, %._crit_edge63 ], [ %98, %._crit_edge63.thread ]
  %132 = phi i64 [ %.pre94, %._crit_edge67.loopexit ], [ %.pre96, %._crit_edge63 ], [ %98, %._crit_edge63.thread ]
  %133 = add i64 %132, %131
  %134 = trunc i64 %133 to i32
  %135 = load i32, ptr %9, align 4, !tbaa !15
  %136 = icmp eq i32 %135, %134
  br i1 %136, label %137, label %140

137:                                              ; preds = %._crit_edge67
  %138 = load i32, ptr %47, align 4, !tbaa !22
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %47, align 4, !tbaa !22
  br label %140

140:                                              ; preds = %._crit_edge67, %137
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %141 = add nsw i32 %.070, -1
  %142 = load i64, ptr @h, align 8, !tbaa !8
  %.not37.not = icmp sgt i64 %142, %indvars.iv79
  br i1 %.not37.not, label %96, label %._crit_edge73, !llvm.loop !23

143:                                              ; preds = %._crit_edge73
  %144 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %95, i8 noundef signext 32)
          to label %145 unwind label %150

145:                                              ; preds = %143
  %146 = getelementptr inbounds i8, ptr %9, i64 4
  %147 = load i32, ptr %146, align 4, !tbaa !22
  %148 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %144, i32 noundef %147)
          to label %149 unwind label %150

149:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #6
  ret i32 0

150:                                              ; preds = %145, %143, %._crit_edge73
  %151 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %152

152:                                              ; preds = %29, %31, %37, %150, %48
  %.pn.pn = phi { ptr, i32 } [ %151, %150 ], [ %49, %48 ], [ %32, %31 ], [ %38, %37 ], [ %30, %29 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn.pn
}

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; 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 uwtable
declare dso_local void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEEvT_S9_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

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

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 nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { 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 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 = { 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 = !{!"long long", !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 = !{!16, !12, i64 0}
!16 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = !{!16, !12, i64 4}
!23 = distinct !{!23, !14}


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