; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 29. Codeforces Problems (longest-simple-cycle)

; 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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %30 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %31 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %32 = getelementptr i8, ptr %31, i64 -24
  %33 = load i64, ptr %32, align 8
  %34 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %33
  %35 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %34, ptr noundef null)
  %36 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %37 = getelementptr i8, ptr %36, i64 -24
  %38 = load i64, ptr %37, align 8
  %39 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %38
  %40 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %39, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %20)
  br label %42

42:                                               ; preds = %154, %0
  %43 = load i64, ptr %20, align 8, !tbaa !8
  %44 = add nsw i64 %43, -1
  store i64 %44, ptr %20, align 8, !tbaa !8
  %45 = icmp ne i64 %43, 0
  br i1 %45, label %46, label %159

46:                                               ; preds = %42
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %48 = load i64, ptr %2, align 8, !tbaa !8
  %49 = call ptr @llvm.stacksave.p0()
  store ptr %49, ptr %21, align 8
  %50 = alloca i64, i64 %48, align 16
  store i64 %48, ptr %22, align 8
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = alloca i64, i64 %51, align 16
  store i64 %51, ptr %23, align 8
  %53 = load i64, ptr %2, align 8, !tbaa !8
  %54 = alloca i64, i64 %53, align 16
  store i64 %53, ptr %24, align 8
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %55

55:                                               ; preds = %63, %46
  %56 = load i64, ptr %3, align 8, !tbaa !8
  %57 = load i64, ptr %2, align 8, !tbaa !8
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %59, label %66

59:                                               ; preds = %55
  %60 = load i64, ptr %3, align 8, !tbaa !8
  %61 = getelementptr inbounds i64, ptr %54, i64 %60
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %61)
  br label %63

63:                                               ; preds = %59
  %64 = load i64, ptr %3, align 8, !tbaa !8
  %65 = add nsw i64 %64, 1
  store i64 %65, ptr %3, align 8, !tbaa !8
  br label %55, !llvm.loop !11

66:                                               ; preds = %55
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %67

67:                                               ; preds = %75, %66
  %68 = load i64, ptr %3, align 8, !tbaa !8
  %69 = load i64, ptr %2, align 8, !tbaa !8
  %70 = icmp slt i64 %68, %69
  br i1 %70, label %71, label %78

71:                                               ; preds = %67
  %72 = load i64, ptr %3, align 8, !tbaa !8
  %73 = getelementptr inbounds i64, ptr %50, i64 %72
  %74 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %73)
  br label %75

75:                                               ; preds = %71
  %76 = load i64, ptr %3, align 8, !tbaa !8
  %77 = add nsw i64 %76, 1
  store i64 %77, ptr %3, align 8, !tbaa !8
  br label %67, !llvm.loop !13

78:                                               ; preds = %67
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %79

79:                                               ; preds = %87, %78
  %80 = load i64, ptr %3, align 8, !tbaa !8
  %81 = load i64, ptr %2, align 8, !tbaa !8
  %82 = icmp slt i64 %80, %81
  br i1 %82, label %83, label %90

83:                                               ; preds = %79
  %84 = load i64, ptr %3, align 8, !tbaa !8
  %85 = getelementptr inbounds i64, ptr %52, i64 %84
  %86 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %85)
  br label %87

87:                                               ; preds = %83
  %88 = load i64, ptr %3, align 8, !tbaa !8
  %89 = add nsw i64 %88, 1
  store i64 %89, ptr %3, align 8, !tbaa !8
  br label %79, !llvm.loop !14

90:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %91 = getelementptr inbounds i64, ptr %50, i64 1
  %92 = load i64, ptr %91, align 8, !tbaa !8
  %93 = getelementptr inbounds i64, ptr %52, i64 1
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = sub nsw i64 %92, %94
  %96 = call noundef i64 @_ZSt3absx(i64 noundef %95)
  store i64 %96, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  store i64 0, ptr %26, align 8, !tbaa !8
  store i64 1, ptr %3, align 8, !tbaa !8
  br label %97

97:                                               ; preds = %151, %90
  %98 = load i64, ptr %3, align 8, !tbaa !8
  %99 = load i64, ptr %2, align 8, !tbaa !8
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %101, label %154

101:                                              ; preds = %97
  %102 = load i64, ptr %25, align 8, !tbaa !8
  %103 = add nsw i64 %102, 2
  store i64 %103, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %104 = load i64, ptr %25, align 8, !tbaa !8
  %105 = load i64, ptr %3, align 8, !tbaa !8
  %106 = getelementptr inbounds i64, ptr %54, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !8
  %108 = add nsw i64 %104, %107
  %109 = sub nsw i64 %108, 1
  store i64 %109, ptr %27, align 8, !tbaa !8
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %27)
  %111 = load i64, ptr %110, align 8, !tbaa !8
  store i64 %111, ptr %26, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  %112 = load i64, ptr %3, align 8, !tbaa !8
  %113 = load i64, ptr %2, align 8, !tbaa !8
  %114 = sub nsw i64 %113, 1
  %115 = icmp ne i64 %112, %114
  br i1 %115, label %116, label %150

116:                                              ; preds = %101
  %117 = load i64, ptr %3, align 8, !tbaa !8
  %118 = add nsw i64 %117, 1
  %119 = getelementptr inbounds i64, ptr %50, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !8
  store i64 %120, ptr %12, align 8, !tbaa !8
  %121 = load i64, ptr %3, align 8, !tbaa !8
  %122 = add nsw i64 %121, 1
  %123 = getelementptr inbounds i64, ptr %52, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !8
  store i64 %124, ptr %13, align 8, !tbaa !8
  %125 = load i64, ptr %12, align 8, !tbaa !8
  %126 = load i64, ptr %13, align 8, !tbaa !8
  %127 = icmp sgt i64 %125, %126
  br i1 %127, label %128, label %129

128:                                              ; preds = %116
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br label %129

129:                                              ; preds = %128, %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  %130 = load i64, ptr %25, align 8, !tbaa !8
  %131 = load i64, ptr %12, align 8, !tbaa !8
  %132 = add nsw i64 %130, %131
  %133 = sub nsw i64 %132, 1
  %134 = load i64, ptr %3, align 8, !tbaa !8
  %135 = getelementptr inbounds i64, ptr %54, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = add nsw i64 %133, %136
  %138 = load i64, ptr %13, align 8, !tbaa !8
  %139 = sub nsw i64 %137, %138
  store i64 %139, ptr %28, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  %140 = load i64, ptr %13, align 8, !tbaa !8
  %141 = load i64, ptr %12, align 8, !tbaa !8
  %142 = sub nsw i64 %140, %141
  store i64 %142, ptr %29, align 8, !tbaa !8
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %144 = load i64, ptr %143, align 8, !tbaa !8
  store i64 %144, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  %145 = load i64, ptr %12, align 8, !tbaa !8
  %146 = load i64, ptr %13, align 8, !tbaa !8
  %147 = icmp eq i64 %145, %146
  br i1 %147, label %148, label %149

148:                                              ; preds = %129
  store i64 0, ptr %25, align 8, !tbaa !8
  br label %149

149:                                              ; preds = %148, %129
  br label %150

150:                                              ; preds = %149, %101
  br label %151

151:                                              ; preds = %150
  %152 = load i64, ptr %3, align 8, !tbaa !8
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %3, align 8, !tbaa !8
  br label %97, !llvm.loop !15

154:                                              ; preds = %97
  %155 = load i64, ptr %26, align 8, !tbaa !8
  %156 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %155)
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %156, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  %158 = load ptr, ptr %21, align 8
  call void @llvm.stackrestore.p0(ptr %158)
  br label %42, !llvm.loop !16

159:                                              ; preds = %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %160 = load i32, ptr %1, align 4
  ret i32 %160
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #6

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; 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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() 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
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %17
  %19 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %21 = load i64, ptr %4, align 8, !tbaa !8
  %22 = add nsw i64 %21, -1
  store i64 %22, ptr %4, align 8, !tbaa !8
  %.not34 = icmp eq i64 %21, 0
  br i1 %.not34, label %._crit_edge37, label %.lr.ph36

.lr.ph36:                                         ; preds = %0, %._crit_edge33
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %24 = load i64, ptr %1, align 8, !tbaa !8
  %25 = call ptr @llvm.stacksave.p0()
  %26 = alloca i64, i64 %24, align 16
  %27 = load i64, ptr %1, align 8, !tbaa !8
  %28 = alloca i64, i64 %27, align 16
  %29 = alloca i64, i64 %27, align 16
  %30 = icmp sgt i64 %27, 0
  br i1 %30, label %.lr.ph, label %._crit_edge

.preheader23:                                     ; preds = %.lr.ph
  %31 = icmp sgt i64 %35, 0
  br i1 %31, label %.lr.ph26, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph36, %.lr.ph
  %.02024 = phi i64 [ %34, %.lr.ph ], [ 0, %.lr.ph36 ]
  %32 = getelementptr inbounds i64, ptr %29, i64 %.02024
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %32)
  %34 = add nuw nsw i64 %.02024, 1
  %35 = load i64, ptr %1, align 8, !tbaa !8
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %.lr.ph, label %.preheader23, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph26
  %37 = icmp sgt i64 %41, 0
  br i1 %37, label %.lr.ph28, label %._crit_edge

.lr.ph26:                                         ; preds = %.preheader23, %.lr.ph26
  %.12125 = phi i64 [ %40, %.lr.ph26 ], [ 0, %.preheader23 ]
  %38 = getelementptr inbounds i64, ptr %26, i64 %.12125
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %38)
  %40 = add nuw nsw i64 %.12125, 1
  %41 = load i64, ptr %1, align 8, !tbaa !8
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %.lr.ph26, label %.preheader, !llvm.loop !13

.lr.ph28:                                         ; preds = %.preheader, %.lr.ph28
  %.227 = phi i64 [ %45, %.lr.ph28 ], [ 0, %.preheader ]
  %43 = getelementptr inbounds i64, ptr %28, i64 %.227
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = add nuw nsw i64 %.227, 1
  %46 = load i64, ptr %1, align 8, !tbaa !8
  %47 = icmp slt i64 %45, %46
  br i1 %47, label %.lr.ph28, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph28, %.lr.ph36, %.preheader23, %.preheader
  %48 = getelementptr inbounds i8, ptr %26, i64 8
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = getelementptr inbounds i8, ptr %28, i64 8
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = sub nsw i64 %49, %51
  %53 = call noundef i64 @_ZSt3absx(i64 noundef %52)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store i64 0, ptr %5, align 8, !tbaa !8
  %54 = load i64, ptr %1, align 8, !tbaa !8
  %55 = icmp sgt i64 %54, 1
  br i1 %55, label %.lr.ph32, label %._crit_edge33

.lr.ph32:                                         ; preds = %._crit_edge, %86
  %.030 = phi i64 [ %.1, %86 ], [ %53, %._crit_edge ]
  %.329 = phi i64 [ %.pre-phi, %86 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %56 = getelementptr inbounds i64, ptr %29, i64 %.329
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = add i64 %.030, 1
  %59 = add i64 %58, %57
  store i64 %59, ptr %6, align 8, !tbaa !8
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %61 = load i64, ptr %60, align 8, !tbaa !8
  store i64 %61, ptr %5, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %62 = load i64, ptr %1, align 8, !tbaa !8
  %63 = add nsw i64 %62, -1
  %.not22 = icmp eq i64 %.329, %63
  br i1 %.not22, label %.lr.ph32._crit_edge, label %65

.lr.ph32._crit_edge:                              ; preds = %.lr.ph32
  %64 = add nsw i64 %.030, 2
  %.pre41 = add nuw nsw i64 %.329, 1
  br label %86

65:                                               ; preds = %.lr.ph32
  %66 = add nuw nsw i64 %.329, 1
  %67 = getelementptr inbounds i64, ptr %26, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !8
  store i64 %68, ptr %2, align 8, !tbaa !8
  %69 = getelementptr inbounds i64, ptr %28, i64 %66
  %70 = load i64, ptr %69, align 8, !tbaa !8
  store i64 %70, ptr %3, align 8, !tbaa !8
  %71 = icmp sgt i64 %68, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  %.pre = load i64, ptr %2, align 8, !tbaa !8
  %.pre38 = load i64, ptr %3, align 8, !tbaa !8
  br label %73

73:                                               ; preds = %72, %65
  %74 = phi i64 [ %.pre38, %72 ], [ %70, %65 ]
  %75 = phi i64 [ %.pre, %72 ], [ %68, %65 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %76 = load i64, ptr %56, align 8, !tbaa !8
  %77 = add i64 %58, %75
  %78 = add nsw i64 %77, %76
  %79 = sub i64 %78, %74
  store i64 %79, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %80 = sub nsw i64 %74, %75
  store i64 %80, ptr %8, align 8, !tbaa !8
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %82 = load i64, ptr %81, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %83 = load i64, ptr %2, align 8, !tbaa !8
  %84 = load i64, ptr %3, align 8, !tbaa !8
  %85 = icmp eq i64 %83, %84
  %spec.select = select i1 %85, i64 0, i64 %82
  %.pre39 = load i64, ptr %1, align 8, !tbaa !8
  br label %86

86:                                               ; preds = %.lr.ph32._crit_edge, %73
  %.pre-phi = phi i64 [ %.pre41, %.lr.ph32._crit_edge ], [ %66, %73 ]
  %87 = phi i64 [ %62, %.lr.ph32._crit_edge ], [ %.pre39, %73 ]
  %.1 = phi i64 [ %64, %.lr.ph32._crit_edge ], [ %spec.select, %73 ]
  %88 = icmp slt i64 %.pre-phi, %87
  br i1 %88, label %.lr.ph32, label %._crit_edge33.loopexit, !llvm.loop !15

._crit_edge33.loopexit:                           ; preds = %86
  %.pre40 = load i64, ptr %5, align 8, !tbaa !8
  br label %._crit_edge33

._crit_edge33:                                    ; preds = %._crit_edge33.loopexit, %._crit_edge
  %89 = phi i64 [ %.pre40, %._crit_edge33.loopexit ], [ 0, %._crit_edge ]
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %89)
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %90, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.stackrestore.p0(ptr %25)
  %92 = load i64, ptr %4, align 8, !tbaa !8
  %93 = add nsw i64 %92, -1
  store i64 %93, ptr %4, align 8, !tbaa !8
  %.not = icmp eq i64 %92, 0
  br i1 %.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !16

._crit_edge37:                                    ; preds = %._crit_edge33, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #6

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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