; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 01. Mathematics (childrenholiday)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl" }
%"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl" = type { %"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl_data" }
%"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%struct.triplet = type { i64, i64, i64 }

@m = external dso_local global i64, align 8
@n = external dso_local global i64, align 8
@arr = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4goodx(i64 noundef) #0

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @m)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %14 = load i64, ptr @n, align 8, !tbaa !5
  call void @_ZNSt6vectorI7tripletSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %33, %0
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = load i64, ptr @n, align 8, !tbaa !5
  %18 = icmp slt i64 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %36

20:                                               ; preds = %15
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %21) #6
  %23 = getelementptr inbounds %struct.triplet, ptr %22, i32 0, i32 0
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = load i64, ptr %2, align 8, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %25) #6
  %27 = getelementptr inbounds %struct.triplet, ptr %26, i32 0, i32 1
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = load i64, ptr %2, align 8, !tbaa !5
  %30 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %29) #6
  %31 = getelementptr inbounds %struct.triplet, ptr %30, i32 0, i32 2
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(8) %31)
  br label %33

33:                                               ; preds = %20
  %34 = load i64, ptr %2, align 8, !tbaa !5
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %2, align 8, !tbaa !5
  br label %15, !llvm.loop !9

36:                                               ; preds = %19
  %37 = load i64, ptr @m, align 8, !tbaa !5
  %38 = icmp eq i64 %37, 0
  br i1 %38, label %39, label %52

39:                                               ; preds = %36
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %48, %39
  %42 = load i64, ptr %3, align 8, !tbaa !5
  %43 = load i64, ptr @n, align 8, !tbaa !5
  %44 = icmp slt i64 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %51

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

48:                                               ; preds = %46
  %49 = load i64, ptr %3, align 8, !tbaa !5
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %3, align 8, !tbaa !5
  br label %41, !llvm.loop !11

51:                                               ; preds = %45
  store i32 0, ptr %1, align 4
  br label %141

52:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 -1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 10000000, ptr %5, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %71, %52
  %54 = load i64, ptr %5, align 8, !tbaa !5
  %55 = load i64, ptr %4, align 8, !tbaa !5
  %56 = add nsw i64 %55, 1
  %57 = icmp sgt i64 %54, %56
  br i1 %57, label %58, label %72

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %59 = load i64, ptr %4, align 8, !tbaa !5
  %60 = load i64, ptr %5, align 8, !tbaa !5
  %61 = load i64, ptr %4, align 8, !tbaa !5
  %62 = sub nsw i64 %60, %61
  %63 = sdiv i64 %62, 2
  %64 = add nsw i64 %59, %63
  store i64 %64, ptr %6, align 8, !tbaa !5
  %65 = load i64, ptr %6, align 8, !tbaa !5
  %66 = call noundef zeroext i1 @_Z4goodx(i64 noundef %65)
  br i1 %66, label %67, label %69

67:                                               ; preds = %58
  %68 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %68, ptr %5, align 8, !tbaa !5
  br label %71

69:                                               ; preds = %58
  %70 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %70, ptr %4, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %69, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %53, !llvm.loop !12

72:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %73 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %73, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !5
  %74 = load i64, ptr %7, align 8, !tbaa !5
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %74)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %133, %72
  %78 = load i64, ptr %10, align 8, !tbaa !5
  %79 = load i64, ptr @n, align 8, !tbaa !5
  %80 = sub nsw i64 %79, 1
  %81 = icmp slt i64 %78, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %136

83:                                               ; preds = %77
  %84 = load i64, ptr %7, align 8, !tbaa !5
  %85 = load i64, ptr %10, align 8, !tbaa !5
  %86 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %85) #6
  %87 = getelementptr inbounds %struct.triplet, ptr %86, i32 0, i32 0
  %88 = load i64, ptr %87, align 8, !tbaa !13
  %89 = load i64, ptr %10, align 8, !tbaa !5
  %90 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %89) #6
  %91 = getelementptr inbounds %struct.triplet, ptr %90, i32 0, i32 1
  %92 = load i64, ptr %91, align 8, !tbaa !15
  %93 = mul nsw i64 %88, %92
  %94 = load i64, ptr %10, align 8, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %94) #6
  %96 = getelementptr inbounds %struct.triplet, ptr %95, i32 0, i32 2
  %97 = load i64, ptr %96, align 8, !tbaa !16
  %98 = add nsw i64 %93, %97
  %99 = sdiv i64 %84, %98
  %100 = load i64, ptr %10, align 8, !tbaa !5
  %101 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %100) #6
  %102 = getelementptr inbounds %struct.triplet, ptr %101, i32 0, i32 1
  %103 = load i64, ptr %102, align 8, !tbaa !15
  %104 = mul nsw i64 %99, %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %105 = load i64, ptr %7, align 8, !tbaa !5
  %106 = load i64, ptr %10, align 8, !tbaa !5
  %107 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %106) #6
  %108 = getelementptr inbounds %struct.triplet, ptr %107, i32 0, i32 0
  %109 = load i64, ptr %108, align 8, !tbaa !13
  %110 = load i64, ptr %10, align 8, !tbaa !5
  %111 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %110) #6
  %112 = getelementptr inbounds %struct.triplet, ptr %111, i32 0, i32 2
  %113 = load i64, ptr %112, align 8, !tbaa !16
  %114 = add nsw i64 %109, %113
  %115 = srem i64 %105, %114
  %116 = load i64, ptr %10, align 8, !tbaa !5
  %117 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %116) #6
  %118 = getelementptr inbounds %struct.triplet, ptr %117, i32 0, i32 0
  %119 = load i64, ptr %118, align 8, !tbaa !13
  %120 = sdiv i64 %115, %119
  store i64 %120, ptr %11, align 8, !tbaa !5
  %121 = load i64, ptr %10, align 8, !tbaa !5
  %122 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %121) #6
  %123 = getelementptr inbounds %struct.triplet, ptr %122, i32 0, i32 1
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %123)
  %125 = load i64, ptr %124, align 8, !tbaa !5
  %126 = add nsw i64 %104, %125
  store i64 %126, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %127 = load i64, ptr %8, align 8, !tbaa !5
  %128 = load i64, ptr %9, align 8, !tbaa !5
  %129 = add nsw i64 %128, %127
  store i64 %129, ptr %9, align 8, !tbaa !5
  %130 = load i64, ptr %8, align 8, !tbaa !5
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %130)
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %131, ptr noundef @.str.4)
  br label %133

133:                                              ; preds = %83
  %134 = load i64, ptr %10, align 8, !tbaa !5
  %135 = add nsw i64 %134, 1
  store i64 %135, ptr %10, align 8, !tbaa !5
  br label %77, !llvm.loop !17

136:                                              ; preds = %82
  %137 = load i64, ptr @m, align 8, !tbaa !5
  %138 = load i64, ptr %9, align 8, !tbaa !5
  %139 = sub nsw i64 %137, %138
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %139)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %141

141:                                              ; preds = %136, %51
  %142 = load i32, ptr %1, align 4
  ret i32 %142
}

; 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)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI7tripletSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; 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) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 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 = { 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 #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 = !{!"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, !6, i64 0}
!14 = !{!"_ZTS7triplet", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !6, i64 16}
!17 = distinct !{!17, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl" }
%"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl" = type { %"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl_data" }
%"struct.std::_Vector_base<triplet, std::allocator<triplet>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }

@m = external dso_local global i64, align 8
@n = external dso_local global i64, align 8
@arr = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4goodx(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), 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.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i64, align 8
  %2 = 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) @m)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %4 = load i64, ptr @n, align 8, !tbaa !5
  tail call void @_ZNSt6vectorI7tripletSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %4)
  %5 = load i64, ptr @n, align 8, !tbaa !5
  %6 = icmp sgt i64 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %7 = load i64, ptr @m, align 8, !tbaa !5
  %8 = icmp eq i64 %7, 0
  br i1 %8, label %20, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03641 = phi i64 [ %17, %.lr.ph ], [ 0, %0 ]
  %9 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.03641) #6
  %10 = 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) %9)
  %11 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.03641) #6
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %14 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.03641) #6
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %17 = add nuw nsw i64 %.03641, 1
  %18 = load i64, ptr @n, align 8, !tbaa !5
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !9

20:                                               ; preds = %._crit_edge
  %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 = load i64, ptr @n, align 8, !tbaa !5
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph51, label %.loopexit

.lr.ph51:                                         ; preds = %20, %.lr.ph51
  %.04049 = phi i64 [ %25, %.lr.ph51 ], [ 0, %20 ]
  %24 = 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.2)
  %25 = add nuw nsw i64 %.04049, 1
  %26 = load i64, ptr @n, align 8, !tbaa !5
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %.lr.ph51, label %.loopexit, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %.preheader
  %.03743 = phi i64 [ %..037, %.preheader ], [ 10000000, %._crit_edge ]
  %.03842 = phi i64 [ %.038., %.preheader ], [ -1, %._crit_edge ]
  %28 = sub nsw i64 %.03743, %.03842
  %29 = sdiv i64 %28, 2
  %30 = add nsw i64 %29, %.03842
  %31 = tail call noundef zeroext i1 @_Z4goodx(i64 noundef %30)
  %.038. = select i1 %31, i64 %.03842, i64 %30
  %..037 = select i1 %31, i64 %30, i64 %.03743
  %32 = add nsw i64 %.038., 1
  %33 = icmp sgt i64 %..037, %32
  br i1 %33, label %.preheader, label %34, !llvm.loop !12

34:                                               ; preds = %.preheader
  %35 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %..037)
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull @.str.3)
  %37 = load i64, ptr @n, align 8, !tbaa !5
  %38 = icmp sgt i64 %37, 1
  br i1 %38, label %.lr.ph47, label %._crit_edge48

._crit_edge48:                                    ; preds = %.lr.ph47, %34
  %.034.lcssa = phi i64 [ 0, %34 ], [ %72, %.lr.ph47 ]
  %39 = load i64, ptr @m, align 8, !tbaa !5
  %40 = sub nsw i64 %39, %.034.lcssa
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %40)
  br label %.loopexit

.lr.ph47:                                         ; preds = %34, %.lr.ph47
  %.045 = phi i64 [ %75, %.lr.ph47 ], [ 0, %34 ]
  %.03444 = phi i64 [ %72, %.lr.ph47 ], [ 0, %34 ]
  %42 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %43 = load i64, ptr %42, align 8, !tbaa !13
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load i64, ptr %45, align 8, !tbaa !15
  %47 = mul nsw i64 %46, %43
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %49 = getelementptr inbounds i8, ptr %48, i64 16
  %50 = load i64, ptr %49, align 8, !tbaa !16
  %51 = add nsw i64 %50, %47
  %52 = sdiv i64 %..037, %51
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %54 = getelementptr inbounds i8, ptr %53, i64 8
  %55 = load i64, ptr %54, align 8, !tbaa !15
  %56 = mul nsw i64 %55, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %57 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %58 = load i64, ptr %57, align 8, !tbaa !13
  %59 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %60 = getelementptr inbounds i8, ptr %59, i64 16
  %61 = load i64, ptr %60, align 8, !tbaa !16
  %62 = add nsw i64 %61, %58
  %63 = srem i64 %..037, %62
  %64 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %65 = load i64, ptr %64, align 8, !tbaa !13
  %66 = sdiv i64 %63, %65
  store i64 %66, ptr %1, align 8, !tbaa !5
  %67 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorI7tripletSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @arr, i64 noundef %.045) #6
  %68 = getelementptr inbounds i8, ptr %67, i64 8
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %68)
  %70 = load i64, ptr %69, align 8, !tbaa !5
  %71 = add nsw i64 %70, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %72 = add nsw i64 %71, %.03444
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %71)
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull @.str.4)
  %75 = add nuw nsw i64 %.045, 1
  %76 = load i64, ptr @n, align 8, !tbaa !5
  %77 = add nsw i64 %76, -1
  %78 = icmp slt i64 %75, %77
  br i1 %78, label %.lr.ph47, label %._crit_edge48, !llvm.loop !17

.loopexit:                                        ; preds = %.lr.ph51, %20, %._crit_edge48
  ret i32 0
}

; 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 #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI7tripletSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; 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 #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #0 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 #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 = !{!"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, !6, i64 0}
!14 = !{!"_ZTS7triplet", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !6, i64 16}
!17 = distinct !{!17, !10}


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