; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Random Problems/C. Longest Simple Cycle.ll (Z5solvev)

; 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" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i64, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = call ptr @llvm.stacksave.p0()
  store ptr %27, ptr %2, align 8
  %28 = alloca i64, i64 %26, align 16
  store i64 %26, ptr %3, align 8
  %29 = load i64, ptr %1, align 8, !tbaa !5
  %30 = alloca i64, i64 %29, align 16
  store i64 %29, ptr %4, align 8
  %31 = load i64, ptr %1, align 8, !tbaa !5
  %32 = alloca i64, i64 %31, align 16
  store i64 %31, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr %28, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %33 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %33, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %34 = load ptr, ptr %6, align 8, !tbaa !9
  %35 = mul nuw i64 8, %26
  %36 = udiv i64 %35, 8
  %37 = getelementptr inbounds i64, ptr %34, i64 %36
  store ptr %37, ptr %8, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %47, %0
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = load ptr, ptr %8, align 8, !tbaa !9
  %41 = icmp ne ptr %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %50

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %44 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %44, ptr %9, align 8, !tbaa !9
  %45 = load ptr, ptr %9, align 8, !tbaa !9
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %45)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %47

47:                                               ; preds = %43
  %48 = load ptr, ptr %7, align 8, !tbaa !9
  %49 = getelementptr inbounds i64, ptr %48, i32 1
  store ptr %49, ptr %7, align 8, !tbaa !9
  br label %38

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store ptr %30, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %51 = load ptr, ptr %10, align 8, !tbaa !9
  store ptr %51, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %52 = load ptr, ptr %10, align 8, !tbaa !9
  %53 = mul nuw i64 8, %29
  %54 = udiv i64 %53, 8
  %55 = getelementptr inbounds i64, ptr %52, i64 %54
  store ptr %55, ptr %12, align 8, !tbaa !9
  br label %56

56:                                               ; preds = %65, %50
  %57 = load ptr, ptr %11, align 8, !tbaa !9
  %58 = load ptr, ptr %12, align 8, !tbaa !9
  %59 = icmp ne ptr %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %68

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %62 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %62, ptr %13, align 8, !tbaa !9
  %63 = load ptr, ptr %13, align 8, !tbaa !9
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %63)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %65

65:                                               ; preds = %61
  %66 = load ptr, ptr %11, align 8, !tbaa !9
  %67 = getelementptr inbounds i64, ptr %66, i32 1
  store ptr %67, ptr %11, align 8, !tbaa !9
  br label %56

68:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr %32, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %69 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %69, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %70 = load ptr, ptr %14, align 8, !tbaa !9
  %71 = mul nuw i64 8, %31
  %72 = udiv i64 %71, 8
  %73 = getelementptr inbounds i64, ptr %70, i64 %72
  store ptr %73, ptr %16, align 8, !tbaa !9
  br label %74

74:                                               ; preds = %83, %68
  %75 = load ptr, ptr %15, align 8, !tbaa !9
  %76 = load ptr, ptr %16, align 8, !tbaa !9
  %77 = icmp ne ptr %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 8, 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
  br label %86

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %80 = load ptr, ptr %15, align 8, !tbaa !9
  store ptr %80, ptr %17, align 8, !tbaa !9
  %81 = load ptr, ptr %17, align 8, !tbaa !9
  %82 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %81)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %83

83:                                               ; preds = %79
  %84 = load ptr, ptr %15, align 8, !tbaa !9
  %85 = getelementptr inbounds i64, ptr %84, i32 1
  store ptr %85, ptr %15, align 8, !tbaa !9
  br label %74

86:                                               ; preds = %78
  %87 = load i64, ptr %1, align 8, !tbaa !5
  %88 = alloca i64, i64 %87, align 16
  store i64 %87, ptr %18, align 8
  %89 = load i64, ptr %1, align 8, !tbaa !5
  %90 = sub nsw i64 %89, 1
  %91 = getelementptr inbounds i64, ptr %28, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = sub nsw i64 %92, 1
  %94 = load i64, ptr %1, align 8, !tbaa !5
  %95 = sub nsw i64 %94, 1
  %96 = getelementptr inbounds i64, ptr %88, i64 %95
  store i64 %93, ptr %96, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  store i64 0, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %97 = load i64, ptr %1, align 8, !tbaa !5
  %98 = sub nsw i64 %97, 1
  store i64 %98, ptr %20, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %191, %86
  %100 = load i64, ptr %20, align 8, !tbaa !5
  %101 = icmp sgt i64 %100, 0
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %194

103:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %104 = load i64, ptr %20, align 8, !tbaa !5
  %105 = getelementptr inbounds i64, ptr %30, i64 %104
  %106 = load i64, ptr %20, align 8, !tbaa !5
  %107 = getelementptr inbounds i64, ptr %32, i64 %106
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %105, ptr noundef nonnull align 8 dereferenceable(8) %107)
  %109 = load i64, ptr %108, align 8, !tbaa !5
  %110 = sub nsw i64 %109, 1
  %111 = load i64, ptr %20, align 8, !tbaa !5
  %112 = sub nsw i64 %111, 1
  %113 = getelementptr inbounds i64, ptr %28, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !5
  %115 = add nsw i64 %110, %114
  %116 = load i64, ptr %20, align 8, !tbaa !5
  %117 = getelementptr inbounds i64, ptr %30, i64 %116
  %118 = load i64, ptr %20, align 8, !tbaa !5
  %119 = getelementptr inbounds i64, ptr %32, i64 %118
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef nonnull align 8 dereferenceable(8) %119)
  %121 = load i64, ptr %120, align 8, !tbaa !5
  %122 = sub nsw i64 %115, %121
  store i64 %122, ptr %21, align 8, !tbaa !5
  %123 = load i64, ptr %20, align 8, !tbaa !5
  %124 = getelementptr inbounds i64, ptr %30, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !5
  %126 = load i64, ptr %20, align 8, !tbaa !5
  %127 = getelementptr inbounds i64, ptr %32, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !5
  %129 = icmp eq i64 %125, %128
  br i1 %129, label %130, label %139

130:                                              ; preds = %103
  %131 = load i64, ptr %20, align 8, !tbaa !5
  %132 = sub nsw i64 %131, 1
  %133 = getelementptr inbounds i64, ptr %28, i64 %132
  %134 = load i64, ptr %133, align 8, !tbaa !5
  %135 = sub nsw i64 %134, 1
  %136 = load i64, ptr %20, align 8, !tbaa !5
  %137 = sub nsw i64 %136, 1
  %138 = getelementptr inbounds i64, ptr %88, i64 %137
  store i64 %135, ptr %138, align 8, !tbaa !5
  br label %156

139:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %140 = load i64, ptr %20, align 8, !tbaa !5
  %141 = sub nsw i64 %140, 1
  %142 = getelementptr inbounds i64, ptr %28, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !5
  %144 = sub nsw i64 %143, 1
  store i64 %144, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %145 = load i64, ptr %20, align 8, !tbaa !5
  %146 = getelementptr inbounds i64, ptr %88, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !5
  %148 = add nsw i64 %147, 2
  %149 = load i64, ptr %21, align 8, !tbaa !5
  %150 = add nsw i64 %148, %149
  store i64 %150, ptr %23, align 8, !tbaa !5
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = load i64, ptr %20, align 8, !tbaa !5
  %154 = sub nsw i64 %153, 1
  %155 = getelementptr inbounds i64, ptr %88, i64 %154
  store i64 %152, ptr %155, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  br label %156

156:                                              ; preds = %139, %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %157 = load i64, ptr %20, align 8, !tbaa !5
  %158 = getelementptr inbounds i64, ptr %88, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !5
  %160 = add nsw i64 %159, 2
  %161 = load i64, ptr %20, align 8, !tbaa !5
  %162 = getelementptr inbounds i64, ptr %30, i64 %161
  %163 = load i64, ptr %162, align 8, !tbaa !5
  %164 = load i64, ptr %20, align 8, !tbaa !5
  %165 = getelementptr inbounds i64, ptr %32, i64 %164
  %166 = load i64, ptr %165, align 8, !tbaa !5
  %167 = sub nsw i64 %163, %166
  %168 = icmp slt i64 %167, 0
  br i1 %168, label %169, label %178

169:                                              ; preds = %156
  %170 = load i64, ptr %20, align 8, !tbaa !5
  %171 = getelementptr inbounds i64, ptr %30, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !5
  %173 = load i64, ptr %20, align 8, !tbaa !5
  %174 = getelementptr inbounds i64, ptr %32, i64 %173
  %175 = load i64, ptr %174, align 8, !tbaa !5
  %176 = sub nsw i64 %172, %175
  %177 = sub nsw i64 0, %176
  br label %186

178:                                              ; preds = %156
  %179 = load i64, ptr %20, align 8, !tbaa !5
  %180 = getelementptr inbounds i64, ptr %30, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !5
  %182 = load i64, ptr %20, align 8, !tbaa !5
  %183 = getelementptr inbounds i64, ptr %32, i64 %182
  %184 = load i64, ptr %183, align 8, !tbaa !5
  %185 = sub nsw i64 %181, %184
  br label %186

186:                                              ; preds = %178, %169
  %187 = phi i64 [ %177, %169 ], [ %185, %178 ]
  %188 = add nsw i64 %160, %187
  store i64 %188, ptr %24, align 8, !tbaa !5
  %189 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %190 = load i64, ptr %189, align 8, !tbaa !5
  store i64 %190, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %191

191:                                              ; preds = %186
  %192 = load i64, ptr %20, align 8, !tbaa !5
  %193 = add nsw i64 %192, -1
  store i64 %193, ptr %20, align 8, !tbaa !5
  br label %99, !llvm.loop !11

194:                                              ; preds = %102
  %195 = load i64, ptr %19, align 8, !tbaa !5
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %195)
  %197 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %196, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %198 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %198)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
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 = { 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 #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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = call ptr @llvm.stacksave.p0()
  %9 = alloca i64, i64 %7, align 16
  %10 = load i64, ptr %1, align 8, !tbaa !5
  %11 = alloca i64, i64 %10, align 16
  %12 = alloca i64, i64 %10, align 16
  %13 = getelementptr inbounds i64, ptr %9, i64 %7
  %.not49 = icmp eq i64 %7, 0
  br i1 %.not49, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %14 = getelementptr inbounds i64, ptr %11, i64 %10
  %.not4751 = icmp eq i64 %10, 0
  br i1 %.not4751, label %._crit_edge60, label %.lr.ph54

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.050 = phi ptr [ %16, %.lr.ph ], [ %9, %0 ]
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.050)
  %16 = getelementptr inbounds i8, ptr %.050, i64 8
  %.not = icmp eq ptr %16, %13
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge55:                                    ; preds = %.lr.ph54
  %17 = getelementptr inbounds i64, ptr %12, i64 %10
  br i1 %.not4751, label %._crit_edge60, label %.lr.ph59

.lr.ph54:                                         ; preds = %._crit_edge, %.lr.ph54
  %.04452 = phi ptr [ %19, %.lr.ph54 ], [ %11, %._crit_edge ]
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.04452)
  %19 = getelementptr inbounds i8, ptr %.04452, i64 8
  %.not47 = icmp eq ptr %19, %14
  br i1 %.not47, label %._crit_edge55, label %.lr.ph54

._crit_edge60:                                    ; preds = %.lr.ph59, %._crit_edge, %._crit_edge55
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = getelementptr i64, ptr %9, i64 %20
  %22 = getelementptr i8, ptr %21, i64 -8
  %23 = load i64, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  store i64 0, ptr %2, align 8, !tbaa !5
  %24 = icmp sgt i64 %20, 1
  br i1 %24, label %.lr.ph65.preheader, label %._crit_edge66

.lr.ph65.preheader:                               ; preds = %._crit_edge60
  %25 = add nsw i64 %23, -1
  %invariant.gep = getelementptr i8, ptr %9, i64 -16
  br label %.lr.ph65

.lr.ph59:                                         ; preds = %._crit_edge55, %.lr.ph59
  %.04557 = phi ptr [ %27, %.lr.ph59 ], [ %12, %._crit_edge55 ]
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.04557)
  %27 = getelementptr inbounds i8, ptr %.04557, i64 8
  %.not48 = icmp eq ptr %27, %17
  br i1 %.not48, label %._crit_edge60, label %.lr.ph59

._crit_edge66:                                    ; preds = %54, %._crit_edge60
  %28 = phi i64 [ 0, %._crit_edge60 ], [ %62, %54 ]
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %28)
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %29, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.stackrestore.p0(ptr %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret void

.lr.ph65:                                         ; preds = %.lr.ph65.preheader, %54
  %31 = phi i64 [ %.sink, %54 ], [ %25, %.lr.ph65.preheader ]
  %.043.in62 = phi i64 [ %.04363, %54 ], [ %20, %.lr.ph65.preheader ]
  %.04363 = add nsw i64 %.043.in62, -1
  %32 = getelementptr inbounds i64, ptr %11, i64 %.04363
  %33 = getelementptr inbounds i64, ptr %12, i64 %.04363
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull align 8 dereferenceable(8) %33)
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %gep = getelementptr i64, ptr %invariant.gep, i64 %.043.in62
  %36 = load i64, ptr %gep, align 8, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull align 8 dereferenceable(8) %33)
  %38 = load i64, ptr %32, align 8, !tbaa !5
  %39 = load i64, ptr %33, align 8, !tbaa !5
  %40 = icmp eq i64 %38, %39
  br i1 %40, label %41, label %44

41:                                               ; preds = %.lr.ph65
  %42 = load i64, ptr %gep, align 8, !tbaa !5
  %43 = add nsw i64 %42, -1
  br label %54

44:                                               ; preds = %.lr.ph65
  %45 = load i64, ptr %37, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %46 = load i64, ptr %gep, align 8, !tbaa !5
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %48 = add i64 %35, 1
  %49 = add i64 %48, %36
  %50 = sub i64 %49, %45
  %51 = add i64 %50, %31
  store i64 %51, ptr %4, align 8, !tbaa !5
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %53 = load i64, ptr %52, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %.pre = load i64, ptr %32, align 8, !tbaa !5
  %.pre67 = load i64, ptr %33, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %44, %41
  %55 = phi i64 [ %38, %41 ], [ %.pre67, %44 ]
  %56 = phi i64 [ %38, %41 ], [ %.pre, %44 ]
  %.sink = phi i64 [ %43, %41 ], [ %53, %44 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %57 = add nsw i64 %31, 2
  %58 = sub nsw i64 %56, %55
  %59 = call i64 @llvm.abs.i64(i64 %58, i1 true)
  %60 = add nsw i64 %57, %59
  store i64 %60, ptr %5, align 8, !tbaa !5
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %62 = load i64, ptr %61, align 8, !tbaa !5
  store i64 %62, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %63 = icmp ugt i64 %.043.in62, 2
  br i1 %63, label %.lr.ph65, label %._crit_edge66, !llvm.loop !9
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #5

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


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