; LLVM IR from reyadussalahin/problem-solving :: data_structure/segment_tree/codeforces/F1295E (Solution)

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

@a = external dso_local global [200020 x i64], align 16
@c = external dso_local global [200020 x i32], align 16
@id = external dso_local global [200020 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildiii(i32 noundef, i32 noundef, i32 noundef) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5queryiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %12

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

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %24

17:                                               ; preds = %12
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %19
  store i32 -1, ptr %20, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %17
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %4, align 4, !tbaa !5
  br label %12, !llvm.loop !9

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

25:                                               ; preds = %36, %24
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %39

30:                                               ; preds = %25
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %34
  store i32 %32, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %30
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %5, align 4, !tbaa !5
  br label %25, !llvm.loop !11

39:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %50, %39
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %53

45:                                               ; preds = %40
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %47
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %48)
  br label %50

50:                                               ; preds = %45
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %6, align 4, !tbaa !5
  br label %40, !llvm.loop !12

53:                                               ; preds = %44
  %54 = load i32, ptr @c, align 16, !tbaa !5
  %55 = sext i32 %54 to i64
  store i64 %55, ptr @a, align 16, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %76, %53
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %79

61:                                               ; preds = %56
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = sub nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !13
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = add nsw i64 %66, %71
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %74
  store i64 %72, ptr %75, align 8, !tbaa !13
  br label %76

76:                                               ; preds = %61
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  br label %56, !llvm.loop !15

79:                                               ; preds = %60
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  call void @_Z5buildiii(i32 noundef 0, i32 noundef 0, i32 noundef %81)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %82 = load i32, ptr %2, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 1
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = sub nsw i32 %84, 2
  %86 = call noundef i64 @_Z5queryiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %83, i32 noundef 0, i32 noundef %85)
  store i64 %86, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %144, %79
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = icmp sle i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %147

92:                                               ; preds = %87
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp eq i32 %96, -1
  br i1 %97, label %98, label %99

98:                                               ; preds = %92
  br label %144

99:                                               ; preds = %92
  %100 = load i32, ptr %2, align 4, !tbaa !5
  %101 = sub nsw i32 %100, 1
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %2, align 4, !tbaa !5
  %107 = sub nsw i32 %106, 1
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sub nsw i32 0, %114
  call void @_Z6updateiiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %101, i32 noundef %105, i32 noundef %107, i32 noundef %115)
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp sgt i32 %119, 0
  br i1 %120, label %121, label %136

121:                                              ; preds = %99
  %122 = load i32, ptr %2, align 4, !tbaa !5
  %123 = sub nsw i32 %122, 1
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sub nsw i32 %127, 1
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  call void @_Z6updateiiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %123, i32 noundef 0, i32 noundef %128, i32 noundef %135)
  br label %136

136:                                              ; preds = %121, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %137 = load i32, ptr %2, align 4, !tbaa !5
  %138 = sub nsw i32 %137, 1
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = sub nsw i32 %139, 2
  %141 = call noundef i64 @_Z5queryiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %138, i32 noundef 0, i32 noundef %140)
  store i64 %141, ptr %10, align 8, !tbaa !13
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %143 = load i64, ptr %142, align 8, !tbaa !13
  store i64 %143, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %144

144:                                              ; preds = %136, %98
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %9, align 4, !tbaa !5
  br label %87, !llvm.loop !16

147:                                              ; preds = %91
  %148 = load i64, ptr %8, align 8, !tbaa !13
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %148)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { "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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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"

@a = external dso_local local_unnamed_addr global [200020 x i64], align 16
@c = external dso_local global [200020 x i32], align 16
@id = external dso_local local_unnamed_addr global [200020 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5queryiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %.not32 = icmp slt i32 %6, 1
  br i1 %.not32, label %._crit_edge.thread, label %.lr.ph35.preheader

.lr.ph35.preheader:                               ; preds = %0
  %7 = zext nneg i32 %6 to i64
  %8 = shl nuw nsw i64 %7, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @id, i64 4), i8 -1, i64 %8, i1 false), !tbaa !5
  br label %.lr.ph35

.preheader:                                       ; preds = %.lr.ph35
  %9 = icmp sgt i32 %15, 0
  br i1 %9, label %.lr.ph37, label %._crit_edge.thread

.lr.ph35:                                         ; preds = %.lr.ph35.preheader, %.lr.ph35
  %.02434 = phi i32 [ %14, %.lr.ph35 ], [ 0, %.lr.ph35.preheader ]
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %12
  store i32 %.02434, ptr %13, align 4, !tbaa !5
  %14 = add nuw nsw i32 %.02434, 1
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %.lr.ph35, label %.preheader, !llvm.loop !9

._crit_edge.thread:                               ; preds = %.preheader, %0
  %.lcssa.ph = phi i32 [ %15, %.preheader ], [ %6, %0 ]
  %17 = load i32, ptr @c, align 16, !tbaa !5
  %18 = sext i32 %17 to i64
  store i64 %18, ptr @a, align 16, !tbaa !11
  br label %._crit_edge41

._crit_edge:                                      ; preds = %.lr.ph37
  %19 = load i32, ptr @c, align 16, !tbaa !5
  %20 = sext i32 %19 to i64
  store i64 %20, ptr @a, align 16, !tbaa !11
  %21 = icmp sgt i32 %27, 1
  br i1 %21, label %.lr.ph40.preheader, label %._crit_edge41

.lr.ph40.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %27 to i64
  %22 = add nsw i64 %wide.trip.count, -1
  %23 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %22, 3
  %24 = icmp ult i64 %23, 3
  br i1 %24, label %._crit_edge41.loopexit.unr-lcssa, label %.lr.ph40.preheader.new

.lr.ph40.preheader.new:                           ; preds = %.lr.ph40.preheader
  %unroll_iter = and i64 %22, -4
  br label %.lr.ph40

.lr.ph37:                                         ; preds = %.preheader, %.lr.ph37
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph37 ], [ 0, %.preheader ]
  %25 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %indvars.iv
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %25)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %.lr.ph37, label %._crit_edge, !llvm.loop !13

._crit_edge41.loopexit.unr-lcssa:                 ; preds = %.lr.ph40, %.lr.ph40.preheader
  %.unr = phi i64 [ %20, %.lr.ph40.preheader ], [ %61, %.lr.ph40 ]
  %indvars.iv50.unr = phi i64 [ 1, %.lr.ph40.preheader ], [ %indvars.iv.next51.3, %.lr.ph40 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge41, label %.lr.ph40.epil

.lr.ph40.epil:                                    ; preds = %._crit_edge41.loopexit.unr-lcssa, %.lr.ph40.epil
  %30 = phi i64 [ %34, %.lr.ph40.epil ], [ %.unr, %._crit_edge41.loopexit.unr-lcssa ]
  %indvars.iv50.epil = phi i64 [ %indvars.iv.next51.epil, %.lr.ph40.epil ], [ %indvars.iv50.unr, %._crit_edge41.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph40.epil ], [ 0, %._crit_edge41.loopexit.unr-lcssa ]
  %31 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %indvars.iv50.epil
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = add nsw i64 %30, %33
  %35 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %indvars.iv50.epil
  store i64 %34, ptr %35, align 8, !tbaa !11
  %indvars.iv.next51.epil = add nuw nsw i64 %indvars.iv50.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge41, label %.lr.ph40.epil, !llvm.loop !14

._crit_edge41:                                    ; preds = %._crit_edge41.loopexit.unr-lcssa, %.lr.ph40.epil, %._crit_edge.thread, %._crit_edge
  %.lcssa57 = phi i32 [ %.lcssa.ph, %._crit_edge.thread ], [ %27, %._crit_edge ], [ %27, %.lr.ph40.epil ], [ %27, %._crit_edge41.loopexit.unr-lcssa ]
  %36 = add nsw i32 %.lcssa57, -1
  call void @_Z5buildiii(i32 noundef 0, i32 noundef 0, i32 noundef %36)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = add nsw i32 %37, -1
  %39 = add nsw i32 %37, -2
  %40 = call noundef i64 @_Z5queryiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %38, i32 noundef 0, i32 noundef %39)
  store i64 %40, ptr %3, align 8, !tbaa !11
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %.not3042 = icmp slt i32 %41, 1
  br i1 %.not3042, label %._crit_edge46, label %.lr.ph45

.lr.ph40:                                         ; preds = %.lr.ph40, %.lr.ph40.preheader.new
  %42 = phi i64 [ %20, %.lr.ph40.preheader.new ], [ %61, %.lr.ph40 ]
  %indvars.iv50 = phi i64 [ 1, %.lr.ph40.preheader.new ], [ %indvars.iv.next51.3, %.lr.ph40 ]
  %niter = phi i64 [ 0, %.lr.ph40.preheader.new ], [ %niter.next.3, %.lr.ph40 ]
  %43 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %indvars.iv50
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = add nsw i64 %42, %45
  %47 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %indvars.iv50
  store i64 %46, ptr %47, align 8, !tbaa !11
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %48 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %indvars.iv.next51
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = add nsw i64 %46, %50
  %52 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %indvars.iv.next51
  store i64 %51, ptr %52, align 8, !tbaa !11
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %53 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %indvars.iv.next51.1
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = add nsw i64 %51, %55
  %57 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %indvars.iv.next51.1
  store i64 %56, ptr %57, align 8, !tbaa !11
  %indvars.iv.next51.2 = add nuw nsw i64 %indvars.iv50, 3
  %58 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %indvars.iv.next51.2
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = add nsw i64 %56, %60
  %62 = getelementptr inbounds [200020 x i64], ptr @a, i64 0, i64 %indvars.iv.next51.2
  store i64 %61, ptr %62, align 8, !tbaa !11
  %indvars.iv.next51.3 = add nuw nsw i64 %indvars.iv50, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge41.loopexit.unr-lcssa, label %.lr.ph40, !llvm.loop !16

._crit_edge46:                                    ; preds = %92, %._crit_edge41
  %63 = phi i64 [ %40, %._crit_edge41 ], [ %93, %92 ]
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %63)
  call void @llvm.lifetime.end.p0(i64 8, 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
  ret i32 0

.lr.ph45:                                         ; preds = %._crit_edge41, %92
  %65 = phi i64 [ %93, %92 ], [ %40, %._crit_edge41 ]
  %66 = phi i32 [ %94, %92 ], [ %41, %._crit_edge41 ]
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %92 ], [ 1, %._crit_edge41 ]
  %67 = getelementptr inbounds [200020 x i32], ptr @id, i64 0, i64 %indvars.iv53
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp eq i32 %68, -1
  br i1 %69, label %92, label %70

70:                                               ; preds = %.lr.ph45
  %71 = add nsw i32 %66, -1
  %72 = sext i32 %68 to i64
  %73 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sub nsw i32 0, %74
  call void @_Z6updateiiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %71, i32 noundef %68, i32 noundef %71, i32 noundef %75)
  %76 = load i32, ptr %67, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %78, label %85

78:                                               ; preds = %70
  %79 = load i32, ptr %1, align 4, !tbaa !5
  %80 = add nsw i32 %79, -1
  %81 = add nsw i32 %76, -1
  %82 = zext nneg i32 %76 to i64
  %83 = getelementptr inbounds [200020 x i32], ptr @c, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  call void @_Z6updateiiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %80, i32 noundef 0, i32 noundef %81, i32 noundef %84)
  br label %85

85:                                               ; preds = %78, %70
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %86 = load i32, ptr %1, align 4, !tbaa !5
  %87 = add nsw i32 %86, -1
  %88 = add nsw i32 %86, -2
  %89 = call noundef i64 @_Z5queryiiiii(i32 noundef 0, i32 noundef 0, i32 noundef %87, i32 noundef 0, i32 noundef %88)
  store i64 %89, ptr %4, align 8, !tbaa !11
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %91 = load i64, ptr %90, align 8, !tbaa !11
  store i64 %91, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %.lr.ph45, %85
  %93 = phi i64 [ %65, %.lr.ph45 ], [ %91, %85 ]
  %94 = phi i32 [ %66, %.lr.ph45 ], [ %.pre, %85 ]
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %95 = sext i32 %94 to i64
  %.not30.not = icmp slt i64 %indvars.iv53, %95
  br i1 %.not30.not, label %.lr.ph45, label %._crit_edge46, !llvm.loop !17
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = 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, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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