; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/AIM Tech Round 3/Problem A/A.ll (Z5solvexxb)

; 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_ostream" = type { ptr, %"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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@a00 = external dso_local global i64, align 8
@a01 = external dso_local global i64, align 8
@a10 = external dso_local global i64, align 8
@a11 = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 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)) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5solvexxb(i64 noundef %0, i64 noundef %1, i1 noundef zeroext %2) #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !5
  %18 = zext i1 %2 to i8
  store i8 %18, ptr %7, align 1, !tbaa !9
  %19 = load i64, ptr %5, align 8, !tbaa !5
  %20 = load i64, ptr %5, align 8, !tbaa !5
  %21 = sub nsw i64 %20, 1
  %22 = mul nsw i64 %19, %21
  %23 = sdiv i64 %22, 2
  %24 = load i64, ptr @a00, align 8, !tbaa !5
  %25 = icmp ne i64 %23, %24
  br i1 %25, label %42, label %26

26:                                               ; preds = %3
  %27 = load i64, ptr %6, align 8, !tbaa !5
  %28 = load i64, ptr %6, align 8, !tbaa !5
  %29 = sub nsw i64 %28, 1
  %30 = mul nsw i64 %27, %29
  %31 = sdiv i64 %30, 2
  %32 = load i64, ptr @a11, align 8, !tbaa !5
  %33 = icmp ne i64 %31, %32
  br i1 %33, label %42, label %34

34:                                               ; preds = %26
  %35 = load i64, ptr %5, align 8, !tbaa !5
  %36 = load i64, ptr %6, align 8, !tbaa !5
  %37 = mul nsw i64 %35, %36
  %38 = load i64, ptr @a10, align 8, !tbaa !5
  %39 = load i64, ptr @a01, align 8, !tbaa !5
  %40 = add nsw i64 %38, %39
  %41 = icmp ne i64 %37, %40
  br i1 %41, label %42, label %49

42:                                               ; preds = %34, %26, %3
  %43 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %44 = trunc i8 %43 to i1
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %48

48:                                               ; preds = %45, %42
  store i1 false, ptr %4, align 1
  br label %162

49:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %50

50:                                               ; preds = %59, %49
  %51 = load i32, ptr %9, align 4, !tbaa !13
  %52 = sext i32 %51 to i64
  %53 = load i64, ptr %5, align 8, !tbaa !5
  %54 = icmp slt i64 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %66

56:                                               ; preds = %50
  %57 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %8, i8 noundef signext 48)
          to label %58 unwind label %62

58:                                               ; preds = %56
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %9, align 4, !tbaa !13
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %9, align 4, !tbaa !13
  br label %50, !llvm.loop !15

62:                                               ; preds = %56
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %10, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %161

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

67:                                               ; preds = %76, %66
  %68 = load i32, ptr %12, align 4, !tbaa !13
  %69 = sext i32 %68 to i64
  %70 = load i64, ptr %6, align 8, !tbaa !5
  %71 = icmp slt i64 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %83

73:                                               ; preds = %67
  %74 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %8, i8 noundef signext 49)
          to label %75 unwind label %79

75:                                               ; preds = %73
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %12, align 4, !tbaa !13
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %12, align 4, !tbaa !13
  br label %67, !llvm.loop !17

79:                                               ; preds = %73
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %10, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %161

83:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %84 = load i64, ptr %5, align 8, !tbaa !5
  %85 = load i64, ptr %6, align 8, !tbaa !5
  %86 = add nsw i64 %84, %85
  %87 = trunc i64 %86 to i32
  store i32 %87, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %88 = load i64, ptr %5, align 8, !tbaa !5
  %89 = load i64, ptr %6, align 8, !tbaa !5
  %90 = mul nsw i64 %88, %89
  store i64 %90, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %91 = load i64, ptr %5, align 8, !tbaa !5
  %92 = trunc i64 %91 to i32
  store i32 %92, ptr %17, align 4, !tbaa !13
  br label %93

93:                                               ; preds = %140, %83
  %94 = load i32, ptr %17, align 4, !tbaa !13
  %95 = load i32, ptr %13, align 4, !tbaa !13
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %97, label %101

97:                                               ; preds = %93
  %98 = load i64, ptr %14, align 8, !tbaa !5
  %99 = load i64, ptr @a01, align 8, !tbaa !5
  %100 = icmp sgt i64 %98, %99
  br label %101

101:                                              ; preds = %97, %93
  %102 = phi i1 [ false, %93 ], [ %100, %97 ]
  br i1 %102, label %104, label %103

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

104:                                              ; preds = %101
  br label %105

105:                                              ; preds = %114, %104
  %106 = load i64, ptr %14, align 8, !tbaa !5
  %107 = load i32, ptr %17, align 4, !tbaa !13
  %108 = load i32, ptr %16, align 4, !tbaa !13
  %109 = sub nsw i32 %107, %108
  %110 = sext i32 %109 to i64
  %111 = sub nsw i64 %106, %110
  %112 = load i64, ptr @a01, align 8, !tbaa !5
  %113 = icmp slt i64 %111, %112
  br i1 %113, label %114, label %117

114:                                              ; preds = %105
  %115 = load i32, ptr %16, align 4, !tbaa !13
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %16, align 4, !tbaa !13
  br label %105, !llvm.loop !18

117:                                              ; preds = %105
  %118 = load i32, ptr %17, align 4, !tbaa !13
  %119 = load i32, ptr %16, align 4, !tbaa !13
  %120 = sub nsw i32 %118, %119
  %121 = sext i32 %120 to i64
  %122 = load i64, ptr %14, align 8, !tbaa !5
  %123 = sub nsw i64 %122, %121
  store i64 %123, ptr %14, align 8, !tbaa !5
  %124 = load i32, ptr %17, align 4, !tbaa !13
  %125 = load i32, ptr %16, align 4, !tbaa !13
  %126 = sub nsw i32 %124, %125
  %127 = sext i32 %126 to i64
  %128 = load i64, ptr %15, align 8, !tbaa !5
  %129 = add nsw i64 %128, %127
  store i64 %129, ptr %15, align 8, !tbaa !5
  %130 = load i32, ptr %17, align 4, !tbaa !13
  %131 = sext i32 %130 to i64
  %132 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 noundef %131)
          to label %133 unwind label %143

133:                                              ; preds = %117
  %134 = load i32, ptr %16, align 4, !tbaa !13
  %135 = sext i32 %134 to i64
  %136 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 noundef %135)
          to label %137 unwind label %143

137:                                              ; preds = %133
  call void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %132, ptr noundef nonnull align 1 dereferenceable(1) %136) #5
  %138 = load i32, ptr %16, align 4, !tbaa !13
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %16, align 4, !tbaa !13
  br label %140

140:                                              ; preds = %137
  %141 = load i32, ptr %17, align 4, !tbaa !13
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %17, align 4, !tbaa !13
  br label %93, !llvm.loop !19

143:                                              ; preds = %133, %117
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %10, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %160

147:                                              ; preds = %103
  %148 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %149 = trunc i8 %148 to i1
  br i1 %149, label %150, label %159

150:                                              ; preds = %147
  %151 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %152 unwind label %155

152:                                              ; preds = %150
  %153 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %151, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %154 unwind label %155

154:                                              ; preds = %152
  br label %159

155:                                              ; preds = %152, %150
  %156 = landingpad { ptr, i32 }
          cleanup
  %157 = extractvalue { ptr, i32 } %156, 0
  store ptr %157, ptr %10, align 8
  %158 = extractvalue { ptr, i32 } %156, 1
  store i32 %158, ptr %11, align 4
  br label %160

159:                                              ; preds = %154, %147
  store i1 true, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  br label %162

160:                                              ; preds = %155, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %161

161:                                              ; preds = %160, %79, %62
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  br label %164

162:                                              ; preds = %159, %48
  %163 = load i1, ptr %4, align 1
  ret i1 %163

164:                                              ; preds = %161
  %165 = load ptr, ptr %10, align 8
  %166 = load i32, ptr %11, align 4
  %167 = insertvalue { ptr, i32 } poison, ptr %165, 0
  %168 = insertvalue { ptr, i32 } %167, i32 %166, 1
  resume { ptr, i32 } %168
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #1

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; 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_ostream" = type { ptr, %"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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@a00 = external dso_local local_unnamed_addr global i64, align 8
@a01 = external dso_local local_unnamed_addr global i64, align 8
@a10 = external dso_local local_unnamed_addr global i64, align 8
@a11 = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 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 #0 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)) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5solvexxb(i64 noundef %0, i64 noundef %1, i1 noundef zeroext %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = add nsw i64 %0, -1
  %6 = mul nsw i64 %5, %0
  %7 = sdiv i64 %6, 2
  %8 = load i64, ptr @a00, align 8, !tbaa !5
  %.not = icmp eq i64 %7, %8
  br i1 %.not, label %9, label %19

9:                                                ; preds = %3
  %10 = add nsw i64 %1, -1
  %11 = mul nsw i64 %10, %1
  %12 = sdiv i64 %11, 2
  %13 = load i64, ptr @a11, align 8, !tbaa !5
  %.not50 = icmp eq i64 %12, %13
  br i1 %.not50, label %14, label %19

14:                                               ; preds = %9
  %15 = mul nsw i64 %1, %0
  %16 = load i64, ptr @a10, align 8, !tbaa !5
  %17 = load i64, ptr @a01, align 8, !tbaa !5
  %18 = add nsw i64 %17, %16
  %.not51 = icmp eq i64 %15, %18
  br i1 %.not51, label %23, label %19

19:                                               ; preds = %14, %9, %3
  br i1 %2, label %20, label %77

20:                                               ; preds = %19
  %21 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %77

23:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  %24 = icmp sgt i64 %0, 0
  br i1 %24, label %.lr.ph, label %.preheader53

.preheader53:                                     ; preds = %27, %23
  %25 = icmp sgt i64 %1, 0
  br i1 %25, label %.lr.ph56, label %._crit_edge

.lr.ph:                                           ; preds = %23, %27
  %indvars.iv = phi i64 [ %indvars.iv.next, %27 ], [ 0, %23 ]
  %26 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 48)
          to label %27 unwind label %28

27:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %0
  br i1 %exitcond.not, label %.preheader53, label %.lr.ph, !llvm.loop !9

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

._crit_edge:                                      ; preds = %41, %.preheader53
  %30 = add nsw i64 %1, %0
  %31 = trunc i64 %30 to i32
  %32 = trunc i64 %0 to i32
  %33 = icmp slt i32 %32, %31
  %34 = load i64, ptr @a01, align 8
  %35 = icmp sgt i64 %15, %34
  %36 = select i1 %33, i1 %35, i1 false
  br i1 %36, label %.preheader.preheader, label %._crit_edge60

.preheader.preheader:                             ; preds = %._crit_edge
  %sext = shl i64 %0, 32
  %37 = ashr exact i64 %sext, 32
  %sext72 = shl i64 %30, 32
  %38 = ashr exact i64 %sext72, 32
  %39 = add nsw i64 %37, 1
  br label %.preheader

.lr.ph56:                                         ; preds = %.preheader53, %41
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %41 ], [ 0, %.preheader53 ]
  %40 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 49)
          to label %41 unwind label %42

41:                                               ; preds = %.lr.ph56
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next63, %1
  br i1 %exitcond65.not, label %._crit_edge, label %.lr.ph56, !llvm.loop !11

42:                                               ; preds = %.lr.ph56
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %76

.preheader:                                       ; preds = %.preheader.preheader, %.loopexit
  %indvar = phi i64 [ 0, %.preheader.preheader ], [ %indvar.next, %.loopexit ]
  %indvars.iv69 = phi i64 [ %37, %.preheader.preheader ], [ %indvars.iv.next70, %.loopexit ]
  %44 = phi i64 [ %34, %.preheader.preheader ], [ %66, %.loopexit ]
  %.03858 = phi i64 [ 0, %.preheader.preheader ], [ %64, %.loopexit ]
  %.04057 = phi i64 [ %15, %.preheader.preheader ], [ %.lcssa, %.loopexit ]
  %45 = add i64 %37, %indvar
  %46 = add i64 %39, %indvar
  %sext73 = shl i64 %.03858, 32
  %47 = ashr exact i64 %sext73, 32
  %48 = sub i64 %.04057, %45
  %49 = add i64 %48, %47
  %smax = call i64 @llvm.smax.i64(i64 %44, i64 %49)
  %50 = add i64 %smax, %46
  %51 = add i64 %.04057, %47
  %52 = sub i64 %50, %51
  %min.iters.check = icmp ult i64 %52, 16
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader
  %indvars.iv66.ph = phi i64 [ %47, %.preheader ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader
  %n.vec = and i64 %52, -16
  %ind.end = add i64 %47, %n.vec
  %53 = add nsw i64 %47, 15
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %54 = phi i64 [ %53, %vector.ph ], [ %55, %vector.body ]
  %index.next = add nuw i64 %index, 16
  %55 = add i64 %54, 16
  %56 = icmp eq i64 %index.next, %n.vec
  br i1 %56, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %57 = sub i64 %54, %indvars.iv69
  %58 = add i64 %57, %.04057
  %cmp.n = icmp eq i64 %52, %n.vec
  %cmo = add i64 %n.vec, -1
  %ind.escape = add i64 %47, %cmo
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

._crit_edge60:                                    ; preds = %.loopexit, %._crit_edge
  br i1 %2, label %69, label %75

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %scalar.ph ], [ %indvars.iv66.ph, %scalar.ph.preheader ]
  %.neg = sub i64 %indvars.iv66, %indvars.iv69
  %59 = add i64 %.neg, %.04057
  %60 = icmp slt i64 %59, %44
  %indvars.iv.next67 = add nsw i64 %indvars.iv66, 1
  br i1 %60, label %scalar.ph, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %scalar.ph, %middle.block
  %indvars.iv66.lcssa = phi i64 [ %ind.escape, %middle.block ], [ %indvars.iv66, %scalar.ph ]
  %.lcssa = phi i64 [ %58, %middle.block ], [ %59, %scalar.ph ]
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %indvars.iv69)
  %sext74 = shl i64 %indvars.iv66.lcssa, 32
  %62 = ashr exact i64 %sext74, 32
  %63 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %62)
  call void @_ZSt4swapIcENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %61, ptr noundef nonnull align 1 dereferenceable(1) %63) #6
  %64 = add i64 %indvars.iv66.lcssa, 1
  %indvars.iv.next70 = add nsw i64 %indvars.iv69, 1
  %65 = icmp slt i64 %indvars.iv.next70, %38
  %66 = load i64, ptr @a01, align 8
  %67 = icmp sgt i64 %.lcssa, %66
  %68 = select i1 %65, i1 %67, i1 false
  %indvar.next = add i64 %indvar, 1
  br i1 %68, label %.preheader, label %._crit_edge60, !llvm.loop !16

69:                                               ; preds = %._crit_edge60
  %70 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %71 unwind label %73

71:                                               ; preds = %69
  %72 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %75 unwind label %73

73:                                               ; preds = %71, %69
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %76

75:                                               ; preds = %71, %._crit_edge60
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  br label %77

76:                                               ; preds = %73, %42, %28
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %43, %42 ], [ %74, %73 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn

77:                                               ; preds = %19, %20, %75
  %.041 = phi i1 [ true, %75 ], [ false, %20 ], [ false, %19 ]
  ret i1 %.041
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}


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