; LLVM IR from TheAlgorithms/C-Plus-Plus :: range_queries (mo)

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

%struct.query = type { i32, i32, i32 }

@a = external dso_local global [1000005 x i32], align 16
@bucket = external dso_local global [1000005 x i32], align 16
@bucket_size = external dso_local global i32, align 4
@q = external dso_local global [1000005 x %struct.query], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5mycmp5queryS_(i64, i32, i64, i32) #0

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

16:                                               ; preds = %12
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1000005 x i32], ptr @a, i64 0, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %19)
  br label %21

21:                                               ; preds = %16
  %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 = %12
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = call noundef double @_ZSt4sqrtIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %25)
  %27 = call double @llvm.ceil.f64(double %26)
  %28 = fptosi double %27 to i32
  store i32 %28, ptr @bucket_size, align 4, !tbaa !5
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %61, %24
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %34, label %64

34:                                               ; preds = %30
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %36
  %38 = getelementptr inbounds %struct.query, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.query, ptr %41, i32 0, i32 1
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %38, ptr noundef %42)
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %45
  %47 = getelementptr inbounds %struct.query, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %47, align 4, !tbaa !11
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.query, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 4, !tbaa !13
  %55 = add nsw i32 %54, -1
  store i32 %55, ptr %53, align 4, !tbaa !13
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %58
  %60 = getelementptr inbounds %struct.query, ptr %59, i32 0, i32 2
  store i32 %56, ptr %60, align 4, !tbaa !14
  br label %61

61:                                               ; preds = %34
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %4, align 4, !tbaa !5
  br label %30, !llvm.loop !15

64:                                               ; preds = %30
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds %struct.query, ptr @q, i64 %66
  call void @_ZSt4sortIP5queryPFbS0_S0_EEvT_S4_T0_(ptr noundef @q, ptr noundef %67, ptr noundef @_Z5mycmp5queryS_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %130, %64
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %72, label %133

72:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.query, ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 4, !tbaa !11
  store i32 %77, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.query, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !13
  store i32 %82, ptr %10, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %87, %72
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %91

87:                                               ; preds = %83
  %88 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z6removei(i32 noundef %88)
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %7, align 4, !tbaa !5
  br label %83, !llvm.loop !16

91:                                               ; preds = %83
  br label %92

92:                                               ; preds = %96, %91
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = icmp sgt i32 %93, %94
  br i1 %95, label %96, label %101

96:                                               ; preds = %92
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  call void @_Z3addi(i32 noundef %98)
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr %7, align 4, !tbaa !5
  br label %92, !llvm.loop !17

101:                                              ; preds = %92
  br label %102

102:                                              ; preds = %106, %101
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = icmp sle i32 %103, %104
  br i1 %105, label %106, label %110

106:                                              ; preds = %102
  %107 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %107)
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %8, align 4, !tbaa !5
  br label %102, !llvm.loop !18

110:                                              ; preds = %102
  br label %111

111:                                              ; preds = %116, %110
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  %115 = icmp sgt i32 %112, %114
  br i1 %115, label %116, label %121

116:                                              ; preds = %111
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sub nsw i32 %117, 1
  call void @_Z6removei(i32 noundef %118)
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = add nsw i32 %119, -1
  store i32 %120, ptr %8, align 4, !tbaa !5
  br label %111, !llvm.loop !19

121:                                              ; preds = %111
  %122 = load i32, ptr @ans, align 4, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %124
  %126 = getelementptr inbounds %struct.query, ptr %125, i32 0, i32 2
  %127 = load i32, ptr %126, align 4, !tbaa !14
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1000005 x i32], ptr @bucket, i64 0, i64 %128
  store i32 %122, ptr %129, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %130

130:                                              ; preds = %121
  %131 = load i32, ptr %4, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %4, align 4, !tbaa !5
  br label %68, !llvm.loop !20

133:                                              ; preds = %68
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %144, %133
  %135 = load i32, ptr %4, align 4, !tbaa !5
  %136 = load i32, ptr %3, align 4, !tbaa !5
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %138, label %147

138:                                              ; preds = %134
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1000005 x i32], ptr @bucket, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %142)
  br label %144

144:                                              ; preds = %138
  %145 = load i32, ptr %4, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %4, align 4, !tbaa !5
  br label %134, !llvm.loop !21

147:                                              ; preds = %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

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

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

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5query", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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"

%struct.query = type { i32, i32, i32 }

@a = external dso_local global [1000005 x i32], align 16
@bucket = external dso_local local_unnamed_addr global [1000005 x i32], align 16
@bucket_size = external dso_local local_unnamed_addr global i32, align 4
@q = external dso_local global [1000005 x %struct.query], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5mycmp5queryS_(i64, i32, i64, i32) #0

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

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %6 = getelementptr inbounds [1000005 x i32], ptr @a, i64 0, i64 %indvars.iv
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %6)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = icmp slt i64 %indvars.iv.next, %9
  br i1 %10, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa46 = phi i32 [ %4, %0 ], [ %8, %.lr.ph ]
  %11 = call noundef double @_ZSt4sqrtIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %.lcssa46)
  %12 = call double @llvm.ceil.f64(double %11)
  %13 = fptosi double %12 to i32
  store i32 %13, ptr @bucket_size, align 4, !tbaa !5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph50, label %._crit_edge.._crit_edge51_crit_edge

._crit_edge.._crit_edge51_crit_edge:              ; preds = %._crit_edge
  %.pre = sext i32 %15 to i64
  br label %._crit_edge51

.lr.ph50:                                         ; preds = %._crit_edge, %.lr.ph50
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %.lr.ph50 ], [ 0, %._crit_edge ]
  %17 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %indvars.iv83
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %17, ptr noundef nonnull %18)
  %20 = load <2 x i32>, ptr %17, align 4, !tbaa !5
  %21 = add nsw <2 x i32> %20, <i32 -1, i32 -1>
  store <2 x i32> %21, ptr %17, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %17, i64 8
  %23 = trunc nuw nsw i64 %indvars.iv83 to i32
  store i32 %23, ptr %22, align 4, !tbaa !11
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next84, %25
  br i1 %26, label %.lr.ph50, label %._crit_edge51, !llvm.loop !13

._crit_edge51:                                    ; preds = %.lr.ph50, %._crit_edge.._crit_edge51_crit_edge
  %.pre-phi = phi i64 [ %.pre, %._crit_edge.._crit_edge51_crit_edge ], [ %25, %.lr.ph50 ]
  %27 = getelementptr inbounds %struct.query, ptr @q, i64 %.pre-phi
  call void @_ZSt4sortIP5queryPFbS0_S0_EEvT_S4_T0_(ptr noundef nonnull @q, ptr noundef nonnull %27, ptr noundef nonnull @_Z5mycmp5queryS_)
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph72, label %._crit_edge75

.preheader:                                       ; preds = %._crit_edge66
  %30 = icmp sgt i32 %49, 0
  br i1 %30, label %.lr.ph74, label %._crit_edge75

.lr.ph72:                                         ; preds = %._crit_edge51, %._crit_edge66
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %._crit_edge66 ], [ 0, %._crit_edge51 ]
  %.03569 = phi i32 [ %.237.lcssa, %._crit_edge66 ], [ 0, %._crit_edge51 ]
  %.03868 = phi i32 [ %.240.lcssa, %._crit_edge66 ], [ 0, %._crit_edge51 ]
  %31 = getelementptr inbounds [1000005 x %struct.query], ptr @q, i64 0, i64 %indvars.iv87
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = getelementptr inbounds i8, ptr %31, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !15
  %35 = icmp slt i32 %.03569, %32
  br i1 %35, label %.lr.ph55, label %.preheader45

.preheader45:                                     ; preds = %.lr.ph72
  %36 = icmp sgt i32 %.03569, %32
  br i1 %36, label %.lr.ph58, label %.preheader44

.lr.ph55:                                         ; preds = %.lr.ph72, %.lr.ph55
  %.13653 = phi i32 [ %37, %.lr.ph55 ], [ %.03569, %.lr.ph72 ]
  call void @_Z6removei(i32 noundef %.13653)
  %37 = add i32 %.13653, 1
  %exitcond.not = icmp eq i32 %37, %32
  br i1 %exitcond.not, label %.preheader44, label %.lr.ph55, !llvm.loop !16

.preheader44:                                     ; preds = %.lr.ph58, %.lr.ph55, %.preheader45
  %.237.lcssa = phi i32 [ %.03569, %.preheader45 ], [ %32, %.lr.ph55 ], [ %32, %.lr.ph58 ]
  %.not60 = icmp sgt i32 %.03868, %34
  %.pre93 = add i32 %34, 1
  br i1 %.not60, label %.preheader43, label %.lr.ph62

.lr.ph58:                                         ; preds = %.preheader45, %.lr.ph58
  %.23757 = phi i32 [ %38, %.lr.ph58 ], [ %.03569, %.preheader45 ]
  %38 = add nsw i32 %.23757, -1
  call void @_Z3addi(i32 noundef %38)
  %39 = icmp sgt i32 %38, %32
  br i1 %39, label %.lr.ph58, label %.preheader44, !llvm.loop !17

.preheader43:                                     ; preds = %.preheader44
  %40 = icmp sgt i32 %.03868, %.pre93
  br i1 %40, label %.lr.ph65, label %._crit_edge66

.lr.ph62:                                         ; preds = %.preheader44, %.lr.ph62
  %.13961 = phi i32 [ %41, %.lr.ph62 ], [ %.03868, %.preheader44 ]
  call void @_Z3addi(i32 noundef %.13961)
  %41 = add i32 %.13961, 1
  %exitcond86.not = icmp eq i32 %.13961, %34
  br i1 %exitcond86.not, label %._crit_edge66, label %.lr.ph62, !llvm.loop !18

.lr.ph65:                                         ; preds = %.preheader43, %.lr.ph65
  %.24064 = phi i32 [ %42, %.lr.ph65 ], [ %.03868, %.preheader43 ]
  %42 = add nsw i32 %.24064, -1
  call void @_Z6removei(i32 noundef %42)
  %43 = icmp sgt i32 %42, %.pre93
  br i1 %43, label %.lr.ph65, label %._crit_edge66, !llvm.loop !19

._crit_edge66:                                    ; preds = %.lr.ph62, %.lr.ph65, %.preheader43
  %.240.lcssa = phi i32 [ %.03868, %.preheader43 ], [ %42, %.lr.ph65 ], [ %.pre93, %.lr.ph62 ]
  %44 = load i32, ptr @ans, align 4, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %31, i64 8
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000005 x i32], ptr @bucket, i64 0, i64 %47
  store i32 %44, ptr %48, align 4, !tbaa !5
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next88, %50
  br i1 %51, label %.lr.ph72, label %.preheader, !llvm.loop !20

.lr.ph74:                                         ; preds = %.preheader, %.lr.ph74
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.lr.ph74 ], [ 0, %.preheader ]
  %52 = getelementptr inbounds [1000005 x i32], ptr @bucket, i64 0, i64 %indvars.iv90
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %53)
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next91, %56
  br i1 %57, label %.lr.ph74, label %._crit_edge75, !llvm.loop !21

._crit_edge75:                                    ; preds = %.lr.ph74, %._crit_edge51, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

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

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

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS5query", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !6, i64 4}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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