; LLVM IR from eyangch/competitive-programming :: Codeforces/1706 (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
@C = external dso_local global [100000 x i64], align 16
@nxt = external dso_local global [100000 x i64], align 16
@pv = external dso_local global [100000 x i64], align 16
@ans = external dso_local global [100000 x i64], align 16
@vis = external dso_local global [100000 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 i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %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
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @T)
  br label %18

18:                                               ; preds = %132, %0
  %19 = load i64, ptr @T, align 8, !tbaa !8
  %20 = add nsw i64 %19, -1
  store i64 %20, ptr @T, align 8, !tbaa !8
  %21 = icmp ne i64 %19, 0
  br i1 %21, label %22, label %134

22:                                               ; preds = %18
  %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) @N)
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %25 = getelementptr inbounds i64, ptr @nxt, i64 %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @nxt, ptr noundef %25, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = getelementptr inbounds i64, ptr @pv, i64 %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 -1, ptr %3, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @pv, ptr noundef %27, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %28 = load i64, ptr @N, align 8, !tbaa !8
  %29 = getelementptr inbounds i8, ptr @vis, i64 %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef @vis, ptr noundef %29, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = getelementptr inbounds i64, ptr @ans, i64 %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @ans, ptr noundef %31, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %32

32:                                               ; preds = %66, %22
  %33 = load i64, ptr %6, align 8, !tbaa !8
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i64, ptr %6, align 8, !tbaa !8
  %39 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %38
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %39)
  %41 = load i64, ptr %6, align 8, !tbaa !8
  %42 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = add nsw i64 %43, -1
  store i64 %44, ptr %42, align 8, !tbaa !8
  %45 = load i64, ptr %6, align 8, !tbaa !8
  %46 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = getelementptr inbounds [100000 x i64], ptr @pv, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = xor i64 %49, -1
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %52, label %60

52:                                               ; preds = %37
  %53 = load i64, ptr %6, align 8, !tbaa !8
  %54 = load i64, ptr %6, align 8, !tbaa !8
  %55 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = getelementptr inbounds [100000 x i64], ptr @pv, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = getelementptr inbounds [100000 x i64], ptr @nxt, i64 0, i64 %58
  store i64 %53, ptr %59, align 8, !tbaa !8
  br label %60

60:                                               ; preds = %52, %37
  %61 = load i64, ptr %6, align 8, !tbaa !8
  %62 = load i64, ptr %6, align 8, !tbaa !8
  %63 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !8
  %65 = getelementptr inbounds [100000 x i64], ptr @pv, i64 0, i64 %64
  store i64 %61, ptr %65, align 8, !tbaa !8
  br label %66

66:                                               ; preds = %60
  %67 = load i64, ptr %6, align 8, !tbaa !8
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %6, align 8, !tbaa !8
  br label %32, !llvm.loop !13

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

70:                                               ; preds = %114, %69
  %71 = load i64, ptr %7, align 8, !tbaa !8
  %72 = load i64, ptr @N, align 8, !tbaa !8
  %73 = icmp slt i64 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %117

75:                                               ; preds = %70
  %76 = load i64, ptr %7, align 8, !tbaa !8
  %77 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !15, !range !17, !noundef !18
  %79 = trunc i8 %78 to i1
  br i1 %79, label %80, label %81

80:                                               ; preds = %75
  br label %114

81:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %82 = load i64, ptr %7, align 8, !tbaa !8
  store i64 %82, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %83 = load i64, ptr %7, align 8, !tbaa !8
  %84 = add nsw i64 %83, 1
  store i64 %84, ptr %9, align 8, !tbaa !8
  br label %85

85:                                               ; preds = %108, %81
  br label %86

86:                                               ; preds = %85
  %87 = load i64, ptr %8, align 8, !tbaa !8
  %88 = srem i64 %87, 2
  %89 = load i64, ptr %9, align 8, !tbaa !8
  %90 = srem i64 %89, 2
  %91 = icmp ne i64 %88, %90
  br i1 %91, label %92, label %99

92:                                               ; preds = %86
  %93 = load i64, ptr %8, align 8, !tbaa !8
  %94 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !8
  %96 = getelementptr inbounds [100000 x i64], ptr @ans, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !8
  %98 = add nsw i64 %97, 1
  store i64 %98, ptr %96, align 8, !tbaa !8
  br label %99

99:                                               ; preds = %92, %86
  %100 = load i64, ptr %8, align 8, !tbaa !8
  %101 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %100
  store i8 1, ptr %101, align 1, !tbaa !15
  %102 = load i64, ptr %8, align 8, !tbaa !8
  %103 = getelementptr inbounds [100000 x i64], ptr @nxt, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !8
  %105 = xor i64 %104, -1
  %106 = icmp ne i64 %105, 0
  br i1 %106, label %108, label %107

107:                                              ; preds = %99
  br label %113

108:                                              ; preds = %99
  %109 = load i64, ptr %8, align 8, !tbaa !8
  store i64 %109, ptr %9, align 8, !tbaa !8
  %110 = load i64, ptr %8, align 8, !tbaa !8
  %111 = getelementptr inbounds [100000 x i64], ptr @nxt, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  store i64 %112, ptr %8, align 8, !tbaa !8
  br label %85, !llvm.loop !19

113:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %114

114:                                              ; preds = %113, %80
  %115 = load i64, ptr %7, align 8, !tbaa !8
  %116 = add nsw i64 %115, 1
  store i64 %116, ptr %7, align 8, !tbaa !8
  br label %70, !llvm.loop !20

117:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %118

118:                                              ; preds = %129, %117
  %119 = load i64, ptr %10, align 8, !tbaa !8
  %120 = load i64, ptr @N, align 8, !tbaa !8
  %121 = icmp slt i64 %119, %120
  br i1 %121, label %123, label %122

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

123:                                              ; preds = %118
  %124 = load i64, ptr %10, align 8, !tbaa !8
  %125 = getelementptr inbounds [100000 x i64], ptr @ans, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !8
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %126)
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %127, i8 noundef signext 32)
  br label %129

129:                                              ; preds = %123
  %130 = load i64, ptr %10, align 8, !tbaa !8
  %131 = add nsw i64 %130, 1
  store i64 %131, ptr %10, align 8, !tbaa !8
  br label %118, !llvm.loop !21

132:                                              ; preds = %122
  %133 = 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 %18, !llvm.loop !22

134:                                              ; preds = %18
  %135 = load i32, ptr %1, align 4
  ret i32 %135
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #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) #4

; 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 = { 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 willreturn memory(argmem: readwrite) }
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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@C = external dso_local global [100000 x i64], align 16
@nxt = external dso_local global [100000 x i64], align 16
@pv = external dso_local global [100000 x i64], align 16
@ans = external dso_local global [100000 x i64], align 16
@vis = external dso_local global [100000 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 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = 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)
  %12 = load i64, ptr @T, align 8, !tbaa !8
  %13 = add nsw i64 %12, -1
  store i64 %13, ptr @T, align 8, !tbaa !8
  %.not38 = icmp eq i64 %12, 0
  br i1 %.not38, label %._crit_edge41, label %.lr.ph40

.lr.ph40:                                         ; preds = %0, %._crit_edge
  %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) @N)
  %15 = load i64, ptr @N, align 8, !tbaa !8
  %16 = getelementptr inbounds i64, ptr @nxt, i64 %15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 -1, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @nxt, ptr noundef nonnull %16, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %17 = load i64, ptr @N, align 8, !tbaa !8
  %18 = getelementptr inbounds i64, ptr @pv, i64 %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @pv, ptr noundef nonnull %18, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %19 = load i64, ptr @N, align 8, !tbaa !8
  %20 = getelementptr inbounds i8, ptr @vis, i64 %19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull @vis, ptr noundef nonnull %20, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = getelementptr inbounds i64, ptr @ans, i64 %21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 0, ptr %4, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @ans, ptr noundef nonnull %22, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %.lr.ph, label %._crit_edge

.preheader32:                                     ; preds = %34
  %25 = icmp sgt i64 %36, 0
  br i1 %25, label %.lr.ph35, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph40, %34
  %.02833 = phi i64 [ %35, %34 ], [ 0, %.lr.ph40 ]
  %26 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %.02833
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %26)
  %28 = load i64, ptr %26, align 8, !tbaa !8
  %29 = add nsw i64 %28, -1
  store i64 %29, ptr %26, align 8, !tbaa !8
  %30 = getelementptr inbounds [100000 x i64], ptr @pv, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !8
  %.not31 = icmp eq i64 %31, -1
  br i1 %.not31, label %34, label %32

32:                                               ; preds = %.lr.ph
  %33 = getelementptr inbounds [100000 x i64], ptr @nxt, i64 0, i64 %31
  store i64 %.02833, ptr %33, align 8, !tbaa !8
  br label %34

34:                                               ; preds = %32, %.lr.ph
  store i64 %.02833, ptr %30, align 8, !tbaa !8
  %35 = add nuw nsw i64 %.02833, 1
  %36 = load i64, ptr @N, align 8, !tbaa !8
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph, label %.preheader32, !llvm.loop !13

.preheader:                                       ; preds = %.loopexit
  br i1 %25, label %.lr.ph37, label %._crit_edge

.lr.ph35:                                         ; preds = %.preheader32, %.loopexit
  %.02734 = phi i64 [ %.pre, %.loopexit ], [ 0, %.preheader32 ]
  %38 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %.02734
  %39 = load i8, ptr %38, align 1, !tbaa !15, !range !17, !noundef !18
  %40 = trunc nuw i8 %39 to i1
  %.pre = add nuw nsw i64 %.02734, 1
  br i1 %40, label %.loopexit, label %.preheader43

.preheader43:                                     ; preds = %.lr.ph35, %49
  %.026 = phi i64 [ %52, %49 ], [ %.02734, %.lr.ph35 ]
  %.025 = phi i64 [ %.026, %49 ], [ %.pre, %.lr.ph35 ]
  %41 = srem i64 %.026, 2
  %42 = srem i64 %.025, 2
  %.not29 = icmp eq i64 %41, %42
  br i1 %.not29, label %49, label %43

43:                                               ; preds = %.preheader43
  %44 = getelementptr inbounds [100000 x i64], ptr @C, i64 0, i64 %.026
  %45 = load i64, ptr %44, align 8, !tbaa !8
  %46 = getelementptr inbounds [100000 x i64], ptr @ans, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = add nsw i64 %47, 1
  store i64 %48, ptr %46, align 8, !tbaa !8
  br label %49

49:                                               ; preds = %43, %.preheader43
  %50 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %.026
  store i8 1, ptr %50, align 1, !tbaa !15
  %51 = getelementptr inbounds [100000 x i64], ptr @nxt, i64 0, i64 %.026
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %.not30 = icmp eq i64 %52, -1
  br i1 %.not30, label %.loopexit, label %.preheader43, !llvm.loop !19

.loopexit:                                        ; preds = %49, %.lr.ph35
  %exitcond.not = icmp eq i64 %.pre, %36
  br i1 %exitcond.not, label %.preheader, label %.lr.ph35, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph37, %.lr.ph40, %.preheader32, %.preheader
  %53 = 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)
  %54 = load i64, ptr @T, align 8, !tbaa !8
  %55 = add nsw i64 %54, -1
  store i64 %55, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %54, 0
  br i1 %.not, label %._crit_edge41, label %.lr.ph40, !llvm.loop !21

.lr.ph37:                                         ; preds = %.preheader, %.lr.ph37
  %.036 = phi i64 [ %60, %.lr.ph37 ], [ 0, %.preheader ]
  %56 = getelementptr inbounds [100000 x i64], ptr @ans, i64 0, i64 %.036
  %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 %.036, 1
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = icmp slt i64 %60, %61
  br i1 %62, label %.lr.ph37, label %._crit_edge, !llvm.loop !22

._crit_edge41:                                    ; preds = %._crit_edge, %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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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

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

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


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