; LLVM IR from tangjz/acm-icpc :: spoj (GSS4)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@dsu = external dso_local global [100001 x i32], align 16
@a = external dso_local global [100001 x i64], align 16
@bit = external dso_local global [100001 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [1 x i8], align 1

; 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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i32 -1, ptr @dsu, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %165, %0
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %14 = icmp eq i32 %13, 1
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %168

16:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %49, %16
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %52

22:                                               ; preds = %17
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i64, ptr @a, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25)
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = icmp sgt i64 %30, 1
  br i1 %31, label %32, label %33

32:                                               ; preds = %22
  br label %37

33:                                               ; preds = %22
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sub nsw i32 %34, 1
  %36 = call noundef i32 @_Z8dsu_findi(i32 noundef %35)
  br label %37

37:                                               ; preds = %33, %32
  %38 = phi i32 [ -1, %32 ], [ %36, %33 ]
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %40
  store i32 %38, ptr %41, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %47
  store i64 %45, ptr %48, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %37
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %4, align 4, !tbaa !5
  br label %17, !llvm.loop !11

52:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  br label %53

53:                                               ; preds = %78, %52
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = icmp sle i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %81

58:                                               ; preds = %53
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sub nsw i32 0, %61
  %63 = and i32 %60, %62
  %64 = add nsw i32 %59, %63
  store i32 %64, ptr %6, align 4, !tbaa !5
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = icmp sle i32 %64, %65
  br i1 %66, label %67, label %77

67:                                               ; preds = %58
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = add nsw i64 %75, %71
  store i64 %76, ptr %74, align 8, !tbaa !9
  br label %77

77:                                               ; preds = %67, %58
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %5, align 4, !tbaa !5
  br label %53, !llvm.loop !13

81:                                               ; preds = %57
  %82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %83)
  br label %85

85:                                               ; preds = %162, %81
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr @m, align 4, !tbaa !5
  %88 = icmp ne i32 %86, 0
  br i1 %88, label %89, label %163

89:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %90 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %7, ptr noundef %8, ptr noundef %9)
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = icmp sgt i32 %91, %92
  br i1 %93, label %94, label %104

94:                                               ; preds = %89
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = add nsw i32 %95, %96
  store i32 %97, ptr %8, align 4, !tbaa !5
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = sub nsw i32 %98, %99
  store i32 %100, ptr %9, align 4, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = sub nsw i32 %101, %102
  store i32 %103, ptr %8, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %94, %89
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %154, label %107

107:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = call noundef i32 @_Z8dsu_findi(i32 noundef %108)
  store i32 %109, ptr %10, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %149, %107
  %111 = load i32, ptr %10, align 4, !tbaa !5
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = icmp sge i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %153

115:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %116 = load i32, ptr %10, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !9
  %120 = sitofp i64 %119 to double
  %121 = call double @sqrt(double noundef %120) #6
  %122 = fptosi double %121 to i64
  store i64 %122, ptr %11, align 8, !tbaa !9
  %123 = load i32, ptr %10, align 4, !tbaa !5
  %124 = load i64, ptr %11, align 8, !tbaa !9
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !9
  %129 = sub nsw i64 %124, %128
  call void @_Z7bit_addix(i32 noundef %123, i64 noundef %129)
  %130 = load i64, ptr %11, align 8, !tbaa !9
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %132
  store i64 %130, ptr %133, align 8, !tbaa !9
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !9
  %138 = icmp sgt i64 %137, 1
  br i1 %138, label %139, label %140

139:                                              ; preds = %115
  br label %144

140:                                              ; preds = %115
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = sub nsw i32 %141, 1
  %143 = call noundef i32 @_Z8dsu_findi(i32 noundef %142)
  br label %144

144:                                              ; preds = %140, %139
  %145 = phi i32 [ -1, %139 ], [ %143, %140 ]
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %147
  store i32 %145, ptr %148, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %149

149:                                              ; preds = %144
  %150 = load i32, ptr %10, align 4, !tbaa !5
  %151 = sub nsw i32 %150, 1
  %152 = call noundef i32 @_Z8dsu_findi(i32 noundef %151)
  store i32 %152, ptr %10, align 4, !tbaa !5
  br label %110, !llvm.loop !14

153:                                              ; preds = %114
  br label %162

154:                                              ; preds = %104
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = call noundef i64 @_Z7bit_sumi(i32 noundef %155)
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = sub nsw i32 %157, 1
  %159 = call noundef i64 @_Z7bit_sumi(i32 noundef %158)
  %160 = sub nsw i64 %156, %159
  %161 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %160)
  br label %162

162:                                              ; preds = %154, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %85, !llvm.loop !15

163:                                              ; preds = %85
  %164 = call i32 @puts(ptr noundef @.str.5)
  br label %165

165:                                              ; preds = %163
  %166 = load i32, ptr %2, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !16

168:                                              ; preds = %15
  ret i32 0
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) #3

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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7bit_addix(i32 noundef, i64 noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7bit_sumi(i32 noundef) #5

declare i32 @puts(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nounwind "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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@dsu = external dso_local local_unnamed_addr global [100001 x i32], align 16
@a = external dso_local global [100001 x i64], align 16
@bit = external dso_local local_unnamed_addr global [100001 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [1 x i8], align 1

; 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
  store i32 -1, ptr @dsu, align 16, !tbaa !5
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %.preheader40, label %._crit_edge55

.preheader40:                                     ; preds = %0, %._crit_edge53
  %.054 = phi i32 [ %95, %._crit_edge53 ], [ 1, %0 ]
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not41 = icmp slt i32 %6, 1
  br i1 %.not41, label %._crit_edge, label %.lr.ph

._crit_edge55:                                    ; preds = %._crit_edge53, %0
  ret i32 0

.preheader:                                       ; preds = %17
  %.not3543 = icmp slt i32 %22, 1
  br i1 %.not3543, label %._crit_edge, label %.lr.ph45.preheader

.lr.ph45.preheader:                               ; preds = %.preheader
  %7 = zext nneg i32 %22 to i64
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i32 %22, 1
  br i1 %8, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph45.preheader.new

.lr.ph45.preheader.new:                           ; preds = %.lr.ph45.preheader
  %unroll_iter = and i64 %7, 2147483646
  br label %.lr.ph45

.lr.ph:                                           ; preds = %.preheader40, %17
  %indvars.iv = phi i64 [ %indvars.iv.next, %17 ], [ 1, %.preheader40 ]
  %9 = getelementptr inbounds i64, ptr @a, i64 %indvars.iv
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9)
  %11 = load i64, ptr %9, align 8, !tbaa !9
  %12 = icmp sgt i64 %11, 1
  br i1 %12, label %17, label %13

13:                                               ; preds = %.lr.ph
  %14 = trunc i64 %indvars.iv to i32
  %15 = add i32 %14, -1
  %16 = call noundef i32 @_Z8dsu_findi(i32 noundef %15)
  %.pre = load i64, ptr %9, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %.lr.ph, %13
  %18 = phi i64 [ %.pre, %13 ], [ %11, %.lr.ph ]
  %19 = phi i32 [ %16, %13 ], [ -1, %.lr.ph ]
  %20 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %indvars.iv
  store i32 %19, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %indvars.iv
  store i64 %18, ptr %21, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %.not.not = icmp slt i64 %indvars.iv, %23
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %58, %.lr.ph45.preheader
  %indvars.iv58.unr = phi i64 [ 1, %.lr.ph45.preheader ], [ %indvars.iv.next59.1, %58 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph45.epil

.lr.ph45.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %indvars60.epil = trunc i64 %indvars.iv58.unr to i32
  %24 = sub nsw i32 0, %indvars60.epil
  %25 = and i32 %indvars60.epil, %24
  %26 = add nuw nsw i32 %25, %indvars60.epil
  %.not39.epil = icmp sgt i32 %26, %22
  br i1 %.not39.epil, label %._crit_edge, label %27

27:                                               ; preds = %.lr.ph45.epil
  %28 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %indvars.iv58.unr
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = zext nneg i32 %26 to i64
  %31 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !9
  %33 = add nsw i64 %32, %29
  store i64 %33, ptr %31, align 8, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %27, %.lr.ph45.epil, %.preheader40, %.preheader
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.054)
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr @m, align 4, !tbaa !5
  %.not3650 = icmp eq i32 %36, 0
  br i1 %.not3650, label %._crit_edge53, label %.lr.ph52

.lr.ph45:                                         ; preds = %58, %.lr.ph45.preheader.new
  %indvars.iv58 = phi i64 [ 1, %.lr.ph45.preheader.new ], [ %indvars.iv.next59.1, %58 ]
  %niter = phi i64 [ 0, %.lr.ph45.preheader.new ], [ %niter.next.1, %58 ]
  %indvars60 = trunc i64 %indvars.iv58 to i32
  %38 = sub nsw i32 0, %indvars60
  %39 = and i32 %indvars60, %38
  %40 = add nuw nsw i32 %39, %indvars60
  %.not39 = icmp sgt i32 %40, %22
  br i1 %.not39, label %.lr.ph45.1, label %41

41:                                               ; preds = %.lr.ph45
  %42 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %indvars.iv58
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = zext nneg i32 %40 to i64
  %45 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = add nsw i64 %46, %43
  store i64 %47, ptr %45, align 8, !tbaa !9
  br label %.lr.ph45.1

.lr.ph45.1:                                       ; preds = %.lr.ph45, %41
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %indvars60.1 = trunc i64 %indvars.iv.next59 to i32
  %48 = sub nsw i32 0, %indvars60.1
  %49 = and i32 %indvars60.1, %48
  %50 = add nuw nsw i32 %49, %indvars60.1
  %.not39.1 = icmp sgt i32 %50, %22
  br i1 %.not39.1, label %58, label %51

51:                                               ; preds = %.lr.ph45.1
  %52 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %indvars.iv.next59
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = zext nneg i32 %50 to i64
  %55 = getelementptr inbounds [100001 x i64], ptr @bit, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = add nsw i64 %56, %53
  store i64 %57, ptr %55, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %51, %.lr.ph45.1
  %indvars.iv.next59.1 = add nuw nsw i64 %indvars.iv58, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph45, !llvm.loop !13

.lr.ph52:                                         ; preds = %._crit_edge, %.loopexit
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = icmp sgt i32 %60, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %.lr.ph52
  store i32 %60, ptr %3, align 4, !tbaa !5
  store i32 %61, ptr %2, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %63, %.lr.ph52
  %65 = phi i32 [ %60, %63 ], [ %61, %.lr.ph52 ]
  %66 = load i32, ptr %1, align 4, !tbaa !5
  %.not37 = icmp eq i32 %66, 0
  br i1 %.not37, label %67, label %85

67:                                               ; preds = %64
  %68 = call noundef i32 @_Z8dsu_findi(i32 noundef %65)
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %.not3846 = icmp slt i32 %68, %69
  br i1 %.not3846, label %.loopexit, label %.lr.ph49

.lr.ph49:                                         ; preds = %67, %.lr.ph49._crit_edge
  %.02847 = phi i32 [ %83, %.lr.ph49._crit_edge ], [ %68, %67 ]
  %70 = sext i32 %.02847 to i64
  %71 = getelementptr inbounds [100001 x i64], ptr @a, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = sitofp i64 %72 to double
  %74 = call double @sqrt(double noundef %73) #6
  %75 = fptosi double %74 to i64
  %76 = load i64, ptr %71, align 8, !tbaa !9
  %77 = sub nsw i64 %75, %76
  call void @_Z7bit_addix(i32 noundef %.02847, i64 noundef %77)
  store i64 %75, ptr %71, align 8, !tbaa !9
  %78 = icmp sgt i64 %75, 1
  %.pre61 = add nsw i32 %.02847, -1
  br i1 %78, label %.lr.ph49._crit_edge, label %79

79:                                               ; preds = %.lr.ph49
  %80 = call noundef i32 @_Z8dsu_findi(i32 noundef %.pre61)
  br label %.lr.ph49._crit_edge

.lr.ph49._crit_edge:                              ; preds = %.lr.ph49, %79
  %81 = phi i32 [ %80, %79 ], [ -1, %.lr.ph49 ]
  %82 = getelementptr inbounds [100001 x i32], ptr @dsu, i64 0, i64 %70
  store i32 %81, ptr %82, align 4, !tbaa !5
  %83 = call noundef i32 @_Z8dsu_findi(i32 noundef %.pre61)
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %.not38 = icmp slt i32 %83, %84
  br i1 %.not38, label %.loopexit, label %.lr.ph49, !llvm.loop !14

85:                                               ; preds = %64
  %86 = call noundef i64 @_Z7bit_sumi(i32 noundef %65)
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  %89 = call noundef i64 @_Z7bit_sumi(i32 noundef %88)
  %90 = sub nsw i64 %86, %89
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %90)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph49._crit_edge, %67, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %92 = load i32, ptr @m, align 4, !tbaa !5
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr @m, align 4, !tbaa !5
  %.not36 = icmp eq i32 %92, 0
  br i1 %.not36, label %._crit_edge53, label %.lr.ph52, !llvm.loop !15

._crit_edge53:                                    ; preds = %.loopexit, %._crit_edge
  %94 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
  %95 = add nuw nsw i32 %.054, 1
  %96 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %.preheader40, label %._crit_edge55, !llvm.loop !16
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7bit_addix(i32 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7bit_sumi(i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "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 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(write) "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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !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,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass