; LLVM IR from omonimus1/competitive-programming :: spoj (acpc11b)

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

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 ptr, 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
  store i32 0, ptr %1, align 4
  %15 = load ptr, ptr @stdin, align 8, !tbaa !5
  %16 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %15)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  %18 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %17)
  %19 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %20 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %22
  %24 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  %25 = 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)
  br label %26

26:                                               ; preds = %113, %0
  %27 = load i64, ptr %2, align 8, !tbaa !11
  %28 = add nsw i64 %27, -1
  store i64 %28, ptr %2, align 8, !tbaa !11
  %29 = icmp ne i64 %27, 0
  br i1 %29, label %30, label %118

30:                                               ; preds = %26
  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
  store i64 0, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store i64 2147483647, ptr %6, align 8, !tbaa !11
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %32 = load i64, ptr %3, align 8, !tbaa !11
  %33 = call ptr @llvm.stacksave.p0()
  store ptr %33, ptr %7, align 8
  %34 = alloca i64, i64 %32, align 16
  store i64 %32, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %35

35:                                               ; preds = %44, %30
  %36 = load i64, ptr %9, align 8, !tbaa !11
  %37 = load i64, ptr %3, align 8, !tbaa !11
  %38 = icmp slt i64 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %47

40:                                               ; preds = %35
  %41 = load i64, ptr %9, align 8, !tbaa !11
  %42 = getelementptr inbounds i64, ptr %34, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %42)
  br label %44

44:                                               ; preds = %40
  %45 = load i64, ptr %9, align 8, !tbaa !11
  %46 = add nsw i64 %45, 1
  store i64 %46, ptr %9, align 8, !tbaa !11
  br label %35, !llvm.loop !13

47:                                               ; preds = %39
  %48 = 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)
  %49 = load i64, ptr %4, align 8, !tbaa !11
  %50 = alloca i64, i64 %49, align 16
  store i64 %49, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %51

51:                                               ; preds = %60, %47
  %52 = load i64, ptr %11, align 8, !tbaa !11
  %53 = load i64, ptr %4, align 8, !tbaa !11
  %54 = icmp slt i64 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %63

56:                                               ; preds = %51
  %57 = load i64, ptr %11, align 8, !tbaa !11
  %58 = getelementptr inbounds i64, ptr %50, i64 %57
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %58)
  br label %60

60:                                               ; preds = %56
  %61 = load i64, ptr %11, align 8, !tbaa !11
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %11, align 8, !tbaa !11
  br label %51, !llvm.loop !15

63:                                               ; preds = %55
  %64 = load i64, ptr %3, align 8, !tbaa !11
  %65 = getelementptr inbounds i64, ptr %34, i64 %64
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef %34, ptr noundef %65)
  %66 = load i64, ptr %4, align 8, !tbaa !11
  %67 = getelementptr inbounds i64, ptr %50, i64 %66
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef %50, ptr noundef %67)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 0, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store i64 0, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store i64 2147483647, ptr %14, align 8, !tbaa !11
  br label %68

68:                                               ; preds = %112, %63
  %69 = load i64, ptr %12, align 8, !tbaa !11
  %70 = load i64, ptr %3, align 8, !tbaa !11
  %71 = icmp slt i64 %69, %70
  br i1 %71, label %72, label %76

72:                                               ; preds = %68
  %73 = load i64, ptr %13, align 8, !tbaa !11
  %74 = load i64, ptr %4, align 8, !tbaa !11
  %75 = icmp slt i64 %73, %74
  br label %76

76:                                               ; preds = %72, %68
  %77 = phi i1 [ false, %68 ], [ %75, %72 ]
  br i1 %77, label %78, label %113

78:                                               ; preds = %76
  %79 = load i64, ptr %12, align 8, !tbaa !11
  %80 = getelementptr inbounds i64, ptr %34, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !11
  %82 = load i64, ptr %13, align 8, !tbaa !11
  %83 = getelementptr inbounds i64, ptr %50, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = sub nsw i64 %81, %84
  %86 = call noundef i64 @_ZSt3absx(i64 noundef %85)
  %87 = load i64, ptr %14, align 8, !tbaa !11
  %88 = icmp slt i64 %86, %87
  br i1 %88, label %89, label %98

89:                                               ; preds = %78
  %90 = load i64, ptr %12, align 8, !tbaa !11
  %91 = getelementptr inbounds i64, ptr %34, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = load i64, ptr %13, align 8, !tbaa !11
  %94 = getelementptr inbounds i64, ptr %50, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !11
  %96 = sub nsw i64 %92, %95
  %97 = call noundef i64 @_ZSt3absx(i64 noundef %96)
  store i64 %97, ptr %14, align 8, !tbaa !11
  br label %98

98:                                               ; preds = %89, %78
  %99 = load i64, ptr %12, align 8, !tbaa !11
  %100 = getelementptr inbounds i64, ptr %34, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !11
  %102 = load i64, ptr %13, align 8, !tbaa !11
  %103 = getelementptr inbounds i64, ptr %50, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = icmp slt i64 %101, %104
  br i1 %105, label %106, label %109

106:                                              ; preds = %98
  %107 = load i64, ptr %12, align 8, !tbaa !11
  %108 = add nsw i64 %107, 1
  store i64 %108, ptr %12, align 8, !tbaa !11
  br label %112

109:                                              ; preds = %98
  %110 = load i64, ptr %13, align 8, !tbaa !11
  %111 = add nsw i64 %110, 1
  store i64 %111, ptr %13, align 8, !tbaa !11
  br label %112

112:                                              ; preds = %109, %106
  br label %68, !llvm.loop !16

113:                                              ; preds = %76
  %114 = load i64, ptr %14, align 8, !tbaa !11
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %114)
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef @.str.4)
  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
  %117 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %117)
  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
  br label %26, !llvm.loop !17

118:                                              ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #6

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

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

; 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 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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 = load ptr, ptr @stdin, align 8, !tbaa !5
  %5 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %4)
  %6 = load ptr, ptr @stdout, align 8, !tbaa !5
  %7 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %6)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %14 = 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)
  %15 = load i64, ptr %1, align 8, !tbaa !11
  %16 = add nsw i64 %15, -1
  store i64 %16, ptr %1, align 8, !tbaa !11
  %.not35 = icmp eq i64 %15, 0
  br i1 %.not35, label %._crit_edge38, label %.lr.ph37

.lr.ph37:                                         ; preds = %0, %._crit_edge34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %17 = 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)
  %18 = load i64, ptr %2, align 8, !tbaa !11
  %19 = call ptr @llvm.stacksave.p0()
  %20 = alloca i64, i64 %18, align 16
  %21 = load i64, ptr %2, align 8, !tbaa !11
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph37
  %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) %3)
  %24 = load i64, ptr %3, align 8, !tbaa !11
  %25 = alloca i64, i64 %24, align 16
  %26 = icmp sgt i64 %24, 0
  br i1 %26, label %.lr.ph27, label %._crit_edge28

.lr.ph:                                           ; preds = %.lr.ph37, %.lr.ph
  %.02324 = phi i64 [ %29, %.lr.ph ], [ 0, %.lr.ph37 ]
  %27 = getelementptr inbounds i64, ptr %20, i64 %.02324
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = add nuw nsw i64 %.02324, 1
  %30 = load i64, ptr %2, align 8, !tbaa !11
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge28:                                    ; preds = %.lr.ph27, %._crit_edge
  %32 = load i64, ptr %2, align 8, !tbaa !11
  %33 = getelementptr inbounds i64, ptr %20, i64 %32
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull %20, ptr noundef nonnull %33)
  %34 = load i64, ptr %3, align 8, !tbaa !11
  %35 = getelementptr inbounds i64, ptr %25, i64 %34
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull %25, ptr noundef nonnull %35)
  %36 = load i64, ptr %2, align 8, !tbaa !11
  %37 = icmp sgt i64 %36, 0
  %38 = load i64, ptr %3, align 8
  %39 = icmp sgt i64 %38, 0
  %40 = select i1 %37, i1 %39, i1 false
  br i1 %40, label %.lr.ph33, label %._crit_edge34

.lr.ph27:                                         ; preds = %._crit_edge, %.lr.ph27
  %.02225 = phi i64 [ %43, %.lr.ph27 ], [ 0, %._crit_edge ]
  %41 = getelementptr inbounds i64, ptr %25, i64 %.02225
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %41)
  %43 = add nuw nsw i64 %.02225, 1
  %44 = load i64, ptr %3, align 8, !tbaa !11
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %.lr.ph27, label %._crit_edge28, !llvm.loop !15

.lr.ph33:                                         ; preds = %._crit_edge28, %58
  %.031 = phi i64 [ %.1, %58 ], [ 2147483647, %._crit_edge28 ]
  %.01830 = phi i64 [ %.119, %58 ], [ 0, %._crit_edge28 ]
  %.02029 = phi i64 [ %.121, %58 ], [ 0, %._crit_edge28 ]
  %46 = getelementptr inbounds i64, ptr %20, i64 %.02029
  %47 = load i64, ptr %46, align 8, !tbaa !11
  %48 = getelementptr inbounds i64, ptr %25, i64 %.01830
  %49 = load i64, ptr %48, align 8, !tbaa !11
  %50 = sub nsw i64 %47, %49
  %51 = call noundef i64 @_ZSt3absx(i64 noundef %50)
  %52 = icmp slt i64 %51, %.031
  br i1 %52, label %53, label %58

53:                                               ; preds = %.lr.ph33
  %54 = load i64, ptr %46, align 8, !tbaa !11
  %55 = load i64, ptr %48, align 8, !tbaa !11
  %56 = sub nsw i64 %54, %55
  %57 = call noundef i64 @_ZSt3absx(i64 noundef %56)
  br label %58

58:                                               ; preds = %53, %.lr.ph33
  %.1 = phi i64 [ %57, %53 ], [ %.031, %.lr.ph33 ]
  %59 = load i64, ptr %46, align 8, !tbaa !11
  %60 = load i64, ptr %48, align 8, !tbaa !11
  %61 = icmp slt i64 %59, %60
  %62 = zext i1 %61 to i64
  %.121 = add nuw nsw i64 %.02029, %62
  %not. = xor i1 %61, true
  %63 = zext i1 %not. to i64
  %.119 = add nuw nsw i64 %.01830, %63
  %64 = load i64, ptr %2, align 8, !tbaa !11
  %65 = icmp slt i64 %.121, %64
  %66 = load i64, ptr %3, align 8
  %67 = icmp slt i64 %.119, %66
  %68 = select i1 %65, i1 %67, i1 false
  br i1 %68, label %.lr.ph33, label %._crit_edge34, !llvm.loop !16

._crit_edge34:                                    ; preds = %58, %._crit_edge28
  %.0.lcssa = phi i64 [ 2147483647, %._crit_edge28 ], [ %.1, %58 ]
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.0.lcssa)
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef nonnull @.str.4)
  call void @llvm.stackrestore.p0(ptr %19)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  %71 = load i64, ptr %1, align 8, !tbaa !11
  %72 = add nsw i64 %71, -1
  store i64 %72, ptr %1, align 8, !tbaa !11
  %.not = icmp eq i64 %71, 0
  br i1 %.not, label %._crit_edge38, label %.lr.ph37, !llvm.loop !17

._crit_edge38:                                    ; preds = %._crit_edge34, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

; 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 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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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