; LLVM IR from tangjz/acm-icpc :: codeforces/complete (567B)

; 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
@k = external dso_local global i32, align 4
@a = external dso_local global [200010 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [200010 x i32], align 16
@f = external dso_local global [200010 x [3 x i64]], align 16
@g = external dso_local global [200010 x [3 x i64]], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 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
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %29, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %32

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i32, ptr @a, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %19)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @tot, align 4, !tbaa !5
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %27
  store i32 %24, ptr %28, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %16
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

32:                                               ; preds = %15
  %33 = load i32, ptr @tot, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr @que, i64 %34
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %35)
  %36 = load i32, ptr @tot, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr @que, i64 %37
  %39 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @que, ptr noundef %38)
  %40 = ptrtoint ptr %39 to i64
  %41 = sub i64 %40, ptrtoint (ptr @que to i64)
  %42 = sdiv exact i64 %41, 4
  %43 = trunc i64 %42 to i32
  store i32 %43, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %158, %32
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp sle i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %161

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

50:                                               ; preds = %108, %49
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = icmp slt i32 %51, 3
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %50
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = load i32, ptr @k, align 4, !tbaa !5
  %60 = srem i32 %58, %59
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %54
  br label %108

63:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %64 = load i32, ptr @tot, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr @que, i64 %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = load i32, ptr @k, align 4, !tbaa !5
  %72 = sdiv i32 %70, %71
  store i32 %72, ptr %7, align 4, !tbaa !5
  %73 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %66, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %74 = ptrtoint ptr %73 to i64
  %75 = sub i64 %74, ptrtoint (ptr @que to i64)
  %76 = sdiv exact i64 %75, 4
  %77 = trunc i64 %76 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  store i32 %77, ptr %6, align 4, !tbaa !5
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = load i32, ptr @k, align 4, !tbaa !5
  %87 = sdiv i32 %85, %86
  %88 = icmp ne i32 %81, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %63
  store i32 10, ptr %4, align 4
  br label %105

90:                                               ; preds = %63
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [200010 x [3 x i64]], ptr @g, i64 0, i64 %92
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [3 x i64], ptr %93, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !11
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %100
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [3 x i64], ptr %101, i64 0, i64 %103
  store i64 %98, ptr %104, align 8, !tbaa !11
  store i32 0, ptr %4, align 4
  br label %105

105:                                              ; preds = %90, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %106 = load i32, ptr %4, align 4
  switch i32 %106, label %164 [
    i32 0, label %107
    i32 10, label %108
  ]

107:                                              ; preds = %105
  br label %108

108:                                              ; preds = %107, %105, %62
  %109 = load i32, ptr %5, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %5, align 4, !tbaa !5
  br label %50, !llvm.loop !13

111:                                              ; preds = %53
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %113
  %115 = getelementptr inbounds [3 x i64], ptr %114, i64 0, i64 0
  store i64 1, ptr %115, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %116 = load i32, ptr @tot, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i32, ptr @que, i64 %117
  %119 = load i32, ptr %3, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %120
  %122 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %118, ptr noundef nonnull align 4 dereferenceable(4) %121)
  %123 = ptrtoint ptr %122 to i64
  %124 = sub i64 %123, ptrtoint (ptr @que to i64)
  %125 = sdiv exact i64 %124, 4
  %126 = trunc i64 %125 to i32
  store i32 %126, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %147, %111
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = icmp slt i32 %128, 3
  br i1 %129, label %131, label %130

130:                                              ; preds = %127
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %150

131:                                              ; preds = %127
  %132 = load i32, ptr %3, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %133
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [3 x i64], ptr %134, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !11
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [200010 x [3 x i64]], ptr @g, i64 0, i64 %140
  %142 = load i32, ptr %9, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [3 x i64], ptr %141, i64 0, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !11
  %146 = add nsw i64 %145, %138
  store i64 %146, ptr %144, align 8, !tbaa !11
  br label %147

147:                                              ; preds = %131
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %9, align 4, !tbaa !5
  br label %127, !llvm.loop !14

150:                                              ; preds = %130
  %151 = load i32, ptr %3, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %152
  %154 = getelementptr inbounds [3 x i64], ptr %153, i64 0, i64 2
  %155 = load i64, ptr %154, align 8, !tbaa !11
  %156 = load i64, ptr @ans, align 8, !tbaa !11
  %157 = add nsw i64 %156, %155
  store i64 %157, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %158

158:                                              ; preds = %150
  %159 = load i32, ptr %3, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !15

161:                                              ; preds = %48
  %162 = load i64, ptr @ans, align 8, !tbaa !11
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %162)
  ret i32 0

164:                                              ; preds = %105
  unreachable
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) #3

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; 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
@k = external dso_local global i32, align 4
@a = external dso_local global [200010 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [200010 x i32], align 16
@f = external dso_local local_unnamed_addr global [200010 x [3 x i64]], align 16
@g = external dso_local local_unnamed_addr global [200010 x [3 x i64]], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not32 = icmp slt i32 %3, 1
  br i1 %.not32, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = load i32, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %4 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %20, %.lr.ph ]
  %5 = sext i32 %4 to i64
  %6 = getelementptr inbounds i32, ptr @que, i64 %5
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %6)
  %7 = load i32, ptr @tot, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i32, ptr @que, i64 %8
  %10 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @que, ptr noundef nonnull %9)
  %11 = ptrtoint ptr %10 to i64
  %12 = sub i64 %11, ptrtoint (ptr @que to i64)
  %13 = lshr exact i64 %12, 2
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr @tot, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %.not2836 = icmp slt i32 %15, 1
  br i1 %.not2836, label %._crit_edge.._crit_edge38_crit_edge, label %.preheader

._crit_edge.._crit_edge38_crit_edge:              ; preds = %._crit_edge
  %.pre49 = load i64, ptr @ans, align 8, !tbaa !9
  br label %._crit_edge38

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %16 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %16)
  %18 = load i32, ptr %16, align 4, !tbaa !5
  %19 = load i32, ptr @tot, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr @tot, align 4, !tbaa !5
  %21 = sext i32 %19 to i64
  %22 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %21
  store i32 %18, ptr %22, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.not.not = icmp slt i64 %indvars.iv, %24
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %71
  %indvars.iv46 = phi i64 [ %indvars.iv.next47, %71 ], [ 1, %._crit_edge ]
  %25 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %indvars.iv46
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = load i32, ptr @k, align 4, !tbaa !5
  %28 = srem i32 %26, %27
  %29 = sdiv i32 %26, %27
  %.not29 = icmp eq i32 %28, 0
  br i1 %.not29, label %32, label %49

._crit_edge38:                                    ; preds = %71, %._crit_edge.._crit_edge38_crit_edge
  %30 = phi i64 [ %.pre49, %._crit_edge.._crit_edge38_crit_edge ], [ %90, %71 ]
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %30)
  ret i32 0

32:                                               ; preds = %.preheader
  %33 = load i32, ptr @tot, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr @que, i64 %34
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store i32 %29, ptr %1, align 4, !tbaa !5
  %36 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %35, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %37 = ptrtoint ptr %36 to i64
  %38 = sub i64 %37, ptrtoint (ptr @que to i64)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %sext30 = shl i64 %38, 30
  %39 = ashr i64 %sext30, 32
  %40 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = load i32, ptr %25, align 4, !tbaa !5
  %43 = load i32, ptr @k, align 4, !tbaa !5
  %44 = sdiv i32 %42, %43
  %.not31 = icmp eq i32 %41, %44
  br i1 %.not31, label %45, label %49

45:                                               ; preds = %32
  %46 = getelementptr inbounds [200010 x [3 x i64]], ptr @g, i64 0, i64 %39, i64 0
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %indvars.iv46, i64 1
  store i64 %47, ptr %48, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %45, %32, %.preheader
  %50 = phi i32 [ %43, %45 ], [ %43, %32 ], [ %27, %.preheader ]
  %51 = phi i32 [ %42, %45 ], [ %42, %32 ], [ %26, %.preheader ]
  %52 = srem i32 %51, %50
  %53 = sdiv i32 %51, %50
  %.not29.1 = icmp eq i32 %52, 0
  br i1 %.not29.1, label %54, label %71

54:                                               ; preds = %49
  %55 = load i32, ptr @tot, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @que, i64 %56
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store i32 %53, ptr %1, align 4, !tbaa !5
  %58 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %57, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %59 = ptrtoint ptr %58 to i64
  %60 = sub i64 %59, ptrtoint (ptr @que to i64)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %sext30.1 = shl i64 %60, 30
  %61 = ashr i64 %sext30.1, 32
  %62 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %25, align 4, !tbaa !5
  %65 = load i32, ptr @k, align 4, !tbaa !5
  %66 = sdiv i32 %64, %65
  %.not31.1 = icmp eq i32 %63, %66
  br i1 %.not31.1, label %67, label %71

67:                                               ; preds = %54
  %68 = getelementptr inbounds [200010 x [3 x i64]], ptr @g, i64 0, i64 %61, i64 1
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %indvars.iv46, i64 2
  store i64 %69, ptr %70, align 8, !tbaa !9
  br label %71

71:                                               ; preds = %67, %54, %49
  %72 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %indvars.iv46
  store i64 1, ptr %72, align 8, !tbaa !9
  %73 = load i32, ptr @tot, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds i32, ptr @que, i64 %74
  %76 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %75, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %77 = ptrtoint ptr %76 to i64
  %78 = sub i64 %77, ptrtoint (ptr @que to i64)
  %sext = shl i64 %78, 30
  %79 = ashr i64 %sext, 32
  %80 = getelementptr inbounds [200010 x [3 x i64]], ptr @g, i64 0, i64 %79, i64 0
  %81 = load <2 x i64>, ptr %72, align 8, !tbaa !9
  %82 = load <2 x i64>, ptr %80, align 8, !tbaa !9
  %83 = add nsw <2 x i64> %82, %81
  store <2 x i64> %83, ptr %80, align 8, !tbaa !9
  %84 = getelementptr inbounds [200010 x [3 x i64]], ptr @f, i64 0, i64 %indvars.iv46, i64 2
  %85 = load i64, ptr %84, align 8, !tbaa !9
  %86 = getelementptr inbounds [200010 x [3 x i64]], ptr @g, i64 0, i64 %79, i64 2
  %87 = load i64, ptr %86, align 8, !tbaa !9
  %88 = add nsw i64 %87, %85
  store i64 %88, ptr %86, align 8, !tbaa !9
  %89 = load i64, ptr @ans, align 8, !tbaa !9
  %90 = add nsw i64 %89, %85
  store i64 %90, ptr @ans, align 8, !tbaa !9
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %.not28.not = icmp slt i64 %indvars.iv46, %92
  br i1 %.not28.not, label %.preheader, label %._crit_edge38, !llvm.loop !13
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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}


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