; LLVM IR from eyangch/competitive-programming :: Codeforces/1689 (b)

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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@p = external dso_local global [1000 x i64], align 16
@a = external dso_local global [1000 x i64], align 16
@used = external dso_local global [1000 x i8], align 16
@_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 i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @T)
  br label %15

15:                                               ; preds = %118, %36, %0
  %16 = load i64, ptr @T, align 8, !tbaa !8
  %17 = add nsw i64 %16, -1
  store i64 %17, ptr @T, align 8, !tbaa !8
  %18 = icmp ne i64 %16, 0
  br i1 %18, label %19, label %120

19:                                               ; preds = %15
  %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) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %21

21:                                               ; preds = %30, %19
  %22 = load i64, ptr %2, align 8, !tbaa !8
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %33

26:                                               ; preds = %21
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = getelementptr inbounds [1000 x i64], ptr @p, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  br label %30

30:                                               ; preds = %26
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = add nsw i64 %31, 1
  store i64 %32, ptr %2, align 8, !tbaa !8
  br label %21, !llvm.loop !11

33:                                               ; preds = %25
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %35 = icmp eq i64 %34, 1
  br i1 %35, label %36, label %39

36:                                               ; preds = %33
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %37, i8 noundef signext 10)
  br label %15, !llvm.loop !13

39:                                               ; preds = %33
  %40 = load i64, ptr @N, align 8, !tbaa !8
  %41 = getelementptr inbounds i8, ptr @used, i64 %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !14
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef @used, ptr noundef %41, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %42

42:                                               ; preds = %83, %39
  %43 = load i64, ptr %4, align 8, !tbaa !8
  %44 = load i64, ptr @N, align 8, !tbaa !8
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  store i32 7, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %86

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %48

48:                                               ; preds = %78, %47
  %49 = load i64, ptr %6, align 8, !tbaa !8
  %50 = load i64, ptr @N, align 8, !tbaa !8
  %51 = icmp slt i64 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  store i32 10, ptr %5, align 4
  br label %81

53:                                               ; preds = %48
  %54 = load i64, ptr %6, align 8, !tbaa !8
  %55 = add nsw i64 %54, 1
  %56 = load i64, ptr %4, align 8, !tbaa !8
  %57 = getelementptr inbounds [1000 x i64], ptr @p, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = icmp eq i64 %55, %58
  br i1 %59, label %60, label %65

60:                                               ; preds = %53
  %61 = load i64, ptr %4, align 8, !tbaa !8
  %62 = load i64, ptr @N, align 8, !tbaa !8
  %63 = sub nsw i64 %62, 1
  %64 = icmp ne i64 %61, %63
  br i1 %64, label %70, label %65

65:                                               ; preds = %60, %53
  %66 = load i64, ptr %6, align 8, !tbaa !8
  %67 = getelementptr inbounds [1000 x i8], ptr @used, i64 0, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !16, !range !18, !noundef !19
  %69 = trunc i8 %68 to i1
  br i1 %69, label %70, label %71

70:                                               ; preds = %65, %60
  br label %78

71:                                               ; preds = %65
  %72 = load i64, ptr %6, align 8, !tbaa !8
  %73 = add nsw i64 %72, 1
  %74 = load i64, ptr %4, align 8, !tbaa !8
  %75 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %74
  store i64 %73, ptr %75, align 8, !tbaa !8
  %76 = load i64, ptr %6, align 8, !tbaa !8
  %77 = getelementptr inbounds [1000 x i8], ptr @used, i64 0, i64 %76
  store i8 1, ptr %77, align 1, !tbaa !16
  store i32 10, ptr %5, align 4
  br label %81

78:                                               ; preds = %70
  %79 = load i64, ptr %6, align 8, !tbaa !8
  %80 = add nsw i64 %79, 1
  store i64 %80, ptr %6, align 8, !tbaa !8
  br label %48, !llvm.loop !20

81:                                               ; preds = %71, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %4, align 8, !tbaa !8
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %4, align 8, !tbaa !8
  br label %42, !llvm.loop !21

86:                                               ; preds = %46
  %87 = load i64, ptr @N, align 8, !tbaa !8
  %88 = sub nsw i64 %87, 1
  %89 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !8
  %91 = load i64, ptr @N, align 8, !tbaa !8
  %92 = sub nsw i64 %91, 1
  %93 = getelementptr inbounds [1000 x i64], ptr @p, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = icmp eq i64 %90, %94
  br i1 %95, label %96, label %103

96:                                               ; preds = %86
  %97 = load i64, ptr @N, align 8, !tbaa !8
  %98 = sub nsw i64 %97, 1
  %99 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %98
  %100 = load i64, ptr @N, align 8, !tbaa !8
  %101 = sub nsw i64 %100, 2
  %102 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %101
  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) %99, ptr noundef nonnull align 8 dereferenceable(8) %102) #7
  br label %103

103:                                              ; preds = %96, %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %104

104:                                              ; preds = %115, %103
  %105 = load i64, ptr %7, align 8, !tbaa !8
  %106 = load i64, ptr @N, align 8, !tbaa !8
  %107 = icmp slt i64 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %118

109:                                              ; preds = %104
  %110 = load i64, ptr %7, align 8, !tbaa !8
  %111 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %112)
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %113, i8 noundef signext 32)
  br label %115

115:                                              ; preds = %109
  %116 = load i64, ptr %7, align 8, !tbaa !8
  %117 = add nsw i64 %116, 1
  store i64 %117, ptr %7, align 8, !tbaa !8
  br label %104, !llvm.loop !22

118:                                              ; preds = %108
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  br label %15, !llvm.loop !13

120:                                              ; preds = %15
  %121 = load i32, ptr %1, align 4
  ret i32 %121
}

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

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

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

; 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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

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 = { 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 #2 = { "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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!15, !15, i64 0}
!15 = !{!"int", !10, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@p = external dso_local global [1000 x i64], align 16
@a = external dso_local global [1000 x i64], align 16
@used = external dso_local global [1000 x i8], align 16
@_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 i32, align 4
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = 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) @T)
  %9 = load i64, ptr @T, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @T, align 8, !tbaa !8
  %.not48 = icmp eq i64 %9, 0
  br i1 %.not48, label %._crit_edge51, label %.lr.ph50

.lr.ph50:                                         ; preds = %0, %.backedge
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge.thread

._crit_edge:                                      ; preds = %.lr.ph
  %14 = icmp eq i64 %18, 1
  br i1 %14, label %20, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.lr.ph50, %.lr.ph
  %.02028 = phi i64 [ %17, %.lr.ph ], [ 0, %.lr.ph50 ]
  %15 = getelementptr inbounds [1000 x i64], ptr @p, i64 0, i64 %.02028
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %17 = add nuw nsw i64 %.02028, 1
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !11

20:                                               ; preds = %._crit_edge
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %.backedge

.backedge:                                        ; preds = %.lr.ph46, %53, %20
  %.sink = phi ptr [ %21, %20 ], [ @_ZSt4cout, %53 ], [ @_ZSt4cout, %.lr.ph46 ]
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %.sink, i8 noundef signext 10)
  %23 = load i64, ptr @T, align 8, !tbaa !8
  %24 = add nsw i64 %23, -1
  store i64 %24, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %23, 0
  br i1 %.not, label %._crit_edge51, label %.lr.ph50, !llvm.loop !13

._crit_edge.thread:                               ; preds = %.lr.ph50, %._crit_edge
  %.lcssa66 = phi i64 [ %18, %._crit_edge ], [ %12, %.lr.ph50 ]
  %25 = getelementptr inbounds i8, ptr @used, i64 %.lcssa66
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !14
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull @used, ptr noundef nonnull %25, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = icmp sgt i64 %26, 0
  %28 = add nsw i64 %26, -1
  br i1 %27, label %.preheader.us, label %._crit_edge35.split.us

.preheader.us:                                    ; preds = %._crit_edge.thread, %..loopexit_crit_edge.us
  %.01932.us = phi i64 [ %36, %..loopexit_crit_edge.us ], [ 0, %._crit_edge.thread ]
  %29 = getelementptr inbounds [1000 x i64], ptr @p, i64 0, i64 %.01932.us
  %30 = load i64, ptr %29, align 8, !tbaa !8
  %.not24.us = icmp eq i64 %.01932.us, %28
  %.not24.fr.us = freeze i1 %.not24.us
  br i1 %.not24.fr.us, label %.lr.ph30.split.us.us, label %.lr.ph30.split.us42

.lr.ph30.split.us42:                              ; preds = %.preheader.us, %37
  %.01829.us37 = phi i64 [ %31, %37 ], [ 0, %.preheader.us ]
  %31 = add nuw nsw i64 %.01829.us37, 1
  %.not52 = icmp eq i64 %31, %30
  br i1 %.not52, label %37, label %32

32:                                               ; preds = %.lr.ph30.split.us42
  %33 = getelementptr inbounds [1000 x i8], ptr @used, i64 0, i64 %.01829.us37
  %34 = load i8, ptr %33, align 1, !tbaa !16, !range !18, !noundef !19
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %37, label %.split.us38

..loopexit_crit_edge.us:                          ; preds = %37, %44, %.split.us38
  %36 = add nuw nsw i64 %.01932.us, 1
  %exitcond63.not = icmp eq i64 %36, %26
  br i1 %exitcond63.not, label %._crit_edge35.split.us, label %.preheader.us, !llvm.loop !20

37:                                               ; preds = %32, %.lr.ph30.split.us42
  %exitcond.not = icmp eq i64 %31, %26
  br i1 %exitcond.not, label %..loopexit_crit_edge.us, label %.lr.ph30.split.us42, !llvm.loop !21

.split.us38:                                      ; preds = %32, %.lr.ph30.split.us.us
  %.us-phi.us = phi i64 [ %.01829.us.us, %.lr.ph30.split.us.us ], [ %.01829.us37, %32 ]
  %.us-phi31.us = phi i64 [ %40, %.lr.ph30.split.us.us ], [ %31, %32 ]
  %38 = getelementptr inbounds [1000 x i8], ptr @used, i64 0, i64 %.us-phi.us
  %39 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %.01932.us
  store i64 %.us-phi31.us, ptr %39, align 8, !tbaa !8
  store i8 1, ptr %38, align 1, !tbaa !16
  br label %..loopexit_crit_edge.us

.lr.ph30.split.us.us:                             ; preds = %.preheader.us, %44
  %.01829.us.us = phi i64 [ %40, %44 ], [ 0, %.preheader.us ]
  %40 = add nuw nsw i64 %.01829.us.us, 1
  %41 = getelementptr inbounds [1000 x i8], ptr @used, i64 0, i64 %.01829.us.us
  %42 = load i8, ptr %41, align 1, !tbaa !16, !range !18, !noundef !19
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %44, label %.split.us38

44:                                               ; preds = %.lr.ph30.split.us.us
  %exitcond62.not = icmp eq i64 %40, %26
  br i1 %exitcond62.not, label %..loopexit_crit_edge.us, label %.lr.ph30.split.us.us, !llvm.loop !21

._crit_edge35.split.us:                           ; preds = %..loopexit_crit_edge.us, %._crit_edge.thread
  %45 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %28
  %46 = load i64, ptr %45, align 8, !tbaa !8
  %47 = getelementptr inbounds [1000 x i64], ptr @p, i64 0, i64 %28
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = icmp eq i64 %46, %48
  br i1 %49, label %50, label %53

50:                                               ; preds = %._crit_edge35.split.us
  %51 = add nsw i64 %26, -2
  %52 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %51
  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) %45, ptr noundef nonnull align 8 dereferenceable(8) %52) #7
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %53

53:                                               ; preds = %50, %._crit_edge35.split.us
  %54 = phi i64 [ %.pre, %50 ], [ %26, %._crit_edge35.split.us ]
  %55 = icmp sgt i64 %54, 0
  br i1 %55, label %.lr.ph46, label %.backedge

.lr.ph46:                                         ; preds = %53, %.lr.ph46
  %.044 = phi i64 [ %60, %.lr.ph46 ], [ 0, %53 ]
  %56 = getelementptr inbounds [1000 x i64], ptr @a, i64 0, i64 %.044
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %57)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %58, i8 noundef signext 32)
  %60 = add nuw nsw i64 %.044, 1
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = icmp slt i64 %60, %61
  br i1 %62, label %.lr.ph46, label %.backedge, !llvm.loop !22

._crit_edge51:                                    ; preds = %.backedge, %0
  ret i32 0
}

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

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

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

; 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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

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 = { 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 #2 = { "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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!15, !15, i64 0}
!15 = !{!"int", !10, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass