; LLVM IR from tangjz/acm-icpc :: 51nod (1598)

; 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
@a = external dso_local global [100010 x i32], align 16
@b = external dso_local global [100010 x i32], align 16
@ord = external dso_local global [100010 x i32], align 16
@p = external dso_local global [100010 x i32], align 16
@bitk = external dso_local global [100010 x i32], align 16
@sk = external dso_local global i32, align 4
@bitb = external dso_local global [100010 x i64], align 16
@sb = external dso_local global i64, align 8
@.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 [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 i64, align 8
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %72, %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) #5
  br label %75

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 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr @b, i64 %21
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %19, ptr noundef %22)
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp slt i32 %27, 0
  br i1 %28, label %29, label %46

29:                                               ; preds = %16
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = sub nsw i32 0, %33
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %36
  store i32 %34, ptr %37, align 4, !tbaa !5
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sub nsw i32 0, %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %44
  store i32 %42, ptr %45, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %29, %16
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %67, label %52

52:                                               ; preds = %46
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 0
  br i1 %57, label %58, label %67

58:                                               ; preds = %52
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sub nsw i32 0, %62
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %65
  store i32 %63, ptr %66, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %58, %52, %46
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %70
  store i32 %68, ptr %71, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %67
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

75:                                               ; preds = %15
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i32, ptr @ord, i64 %77
  %79 = getelementptr inbounds i32, ptr %78, i64 1
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef getelementptr inbounds (i32, ptr @ord, i64 1), ptr noundef %79, ptr noundef @_Z3cmpRKiS0_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %93, %75
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = icmp sle i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %96

85:                                               ; preds = %80
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %91
  store i32 %86, ptr %92, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %85
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %3, align 4, !tbaa !5
  br label %80, !llvm.loop !11

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

97:                                               ; preds = %205, %96
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = icmp sle i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %208

102:                                              ; preds = %97
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  call void @_Z3addIiEvPT_ii(ptr noundef @bitk, i32 noundef %106, i32 noundef %110)
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr @sk, align 4, !tbaa !5
  %116 = add nsw i32 %115, %114
  store i32 %116, ptr @sk, align 4, !tbaa !5
  %117 = load i32, ptr %4, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  call void @_Z3addIxEvPT_ii(ptr noundef @bitb, i32 noundef %120, i32 noundef %124)
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = load i64, ptr @sb, align 8, !tbaa !12
  %131 = add nsw i64 %130, %129
  store i64 %131, ptr @sb, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %132 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %132, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  br label %133

133:                                              ; preds = %152, %102
  %134 = load i32, ptr %5, align 4, !tbaa !5
  %135 = load i32, ptr %6, align 4, !tbaa !5
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %137, label %153

137:                                              ; preds = %133
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = add nsw i32 %138, %139
  %141 = ashr i32 %140, 1
  store i32 %141, ptr %7, align 4, !tbaa !5
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = call noundef i32 @_Z3sumIiET_PS0_i(ptr noundef @bitk, i32 noundef %142)
  %144 = shl i32 %143, 1
  %145 = load i32, ptr @sk, align 4, !tbaa !5
  %146 = icmp sge i32 %144, %145
  br i1 %146, label %147, label %149

147:                                              ; preds = %137
  %148 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %148, ptr %6, align 4, !tbaa !5
  br label %152

149:                                              ; preds = %137
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %5, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %149, %147
  br label %133, !llvm.loop !14

153:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %154 = load i32, ptr %5, align 4, !tbaa !5
  %155 = call noundef i32 @_Z3sumIiET_PS0_i(ptr noundef @bitk, i32 noundef %154)
  %156 = shl i32 %155, 1
  %157 = load i32, ptr @sk, align 4, !tbaa !5
  %158 = sub nsw i32 %156, %157
  store i32 %158, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %159 = load i32, ptr %5, align 4, !tbaa !5
  %160 = call noundef i64 @_Z3sumIxET_PS0_i(ptr noundef @bitb, i32 noundef %159)
  %161 = shl i64 %160, 1
  %162 = load i64, ptr @sb, align 8, !tbaa !12
  %163 = sub nsw i64 %161, %162
  store i64 %163, ptr %9, align 8, !tbaa !12
  %164 = load i32, ptr %8, align 4, !tbaa !5
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %199

166:                                              ; preds = %153
  %167 = load i64, ptr %9, align 8, !tbaa !12
  %168 = load i32, ptr %5, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = mul nsw i64 %167, %175
  %177 = load i32, ptr %8, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = load i32, ptr %5, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = mul nsw i64 %178, %186
  %188 = sub nsw i64 %176, %187
  %189 = sitofp i64 %188 to double
  %190 = load i32, ptr %5, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  %197 = sitofp i32 %196 to double
  %198 = fdiv double %189, %197
  br label %202

199:                                              ; preds = %153
  %200 = load i64, ptr %9, align 8, !tbaa !12
  %201 = sitofp i64 %200 to double
  br label %202

202:                                              ; preds = %199, %166
  %203 = phi double [ %198, %166 ], [ %201, %199 ]
  %204 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %203)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %205

205:                                              ; preds = %202
  %206 = load i32, ptr %4, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %4, align 4, !tbaa !5
  br label %97, !llvm.loop !15

208:                                              ; preds = %101
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumIiET_PS0_i(ptr noundef, i32 noundef) #0

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

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

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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!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
@a = external dso_local global [100010 x i32], align 16
@b = external dso_local global [100010 x i32], align 16
@ord = external dso_local global [100010 x i32], align 16
@p = external dso_local local_unnamed_addr global [100010 x i32], align 16
@bitk = external dso_local global [100010 x i32], align 16
@sk = external dso_local local_unnamed_addr global i32, align 4
@bitb = external dso_local global [100010 x i64], align 16
@sb = external dso_local local_unnamed_addr global i64, align 8
@.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 [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not58 = icmp slt i32 %2, 1
  br i1 %.not58, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %2 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %20, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %24, %20 ]
  %3 = getelementptr inbounds i32, ptr @ord, i64 %.pre-phi
  %4 = getelementptr inbounds i8, ptr %3, i64 4
  tail call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 4), ptr noundef nonnull %4, ptr noundef nonnull @_Z3cmpRKiS0_)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not5260 = icmp slt i32 %5, 1
  br i1 %.not5260, label %._crit_edge73, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %._crit_edge
  %6 = zext nneg i32 %5 to i64
  %xtraiter = and i64 %6, 3
  %7 = icmp ult i32 %5, 4
  br i1 %7, label %.preheader.unr-lcssa, label %.lr.ph63.preheader.new

.lr.ph63.preheader.new:                           ; preds = %.lr.ph63.preheader
  %unroll_iter = and i64 %6, 2147483644
  br label %.lr.ph63

.lr.ph:                                           ; preds = %0, %20
  %indvars.iv = phi i64 [ %indvars.iv.next, %20 ], [ 1, %0 ]
  %8 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %9 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %8, ptr noundef nonnull %9)
  %11 = load i32, ptr %8, align 4, !tbaa !5
  %12 = icmp slt i32 %11, 0
  br i1 %12, label %.thread, label %15

.thread:                                          ; preds = %.lr.ph
  %13 = sub nsw i32 0, %11
  store i32 %13, ptr %8, align 4, !tbaa !5
  %14 = load i32, ptr %9, align 4, !tbaa !5
  br label %.sink.split

15:                                               ; preds = %.lr.ph
  %.not56 = icmp eq i32 %11, 0
  br i1 %.not56, label %16, label %20

16:                                               ; preds = %15
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %.sink.split, label %20

.sink.split:                                      ; preds = %16, %.thread
  %.sink82 = phi i32 [ %14, %.thread ], [ %17, %16 ]
  %19 = sub nsw i32 0, %.sink82
  store i32 %19, ptr %9, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %.sink.split, %16, %15
  %21 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %22 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %22, ptr %21, 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 !9

.preheader.unr-lcssa:                             ; preds = %.lr.ph63, %.lr.ph63.preheader
  %indvars.iv76.unr = phi i64 [ 1, %.lr.ph63.preheader ], [ %indvars.iv.next77.3, %.lr.ph63 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph63.epil

.lr.ph63.epil:                                    ; preds = %.preheader.unr-lcssa, %.lr.ph63.epil
  %indvars.iv76.epil = phi i64 [ %indvars.iv.next77.epil, %.lr.ph63.epil ], [ %indvars.iv76.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph63.epil ], [ 0, %.preheader.unr-lcssa ]
  %25 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %indvars.iv76.epil
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %27
  %29 = trunc nuw nsw i64 %indvars.iv76.epil to i32
  store i32 %29, ptr %28, align 4, !tbaa !5
  %indvars.iv.next77.epil = add nuw nsw i64 %indvars.iv76.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 %.preheader, label %.lr.ph63.epil, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph63.epil, %.preheader.unr-lcssa
  br i1 %.not5260, label %._crit_edge73, label %.lr.ph72

.lr.ph63:                                         ; preds = %.lr.ph63, %.lr.ph63.preheader.new
  %indvars.iv76 = phi i64 [ 1, %.lr.ph63.preheader.new ], [ %indvars.iv.next77.3, %.lr.ph63 ]
  %niter = phi i64 [ 0, %.lr.ph63.preheader.new ], [ %niter.next.3, %.lr.ph63 ]
  %30 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %indvars.iv76
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %32
  %34 = trunc nuw nsw i64 %indvars.iv76 to i32
  store i32 %34, ptr %33, align 4, !tbaa !5
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %35 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %indvars.iv.next77
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %37
  %39 = trunc nuw nsw i64 %indvars.iv.next77 to i32
  store i32 %39, ptr %38, align 4, !tbaa !5
  %indvars.iv.next77.1 = add nuw nsw i64 %indvars.iv76, 2
  %40 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %indvars.iv.next77.1
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %42
  %44 = trunc nuw nsw i64 %indvars.iv.next77.1 to i32
  store i32 %44, ptr %43, align 4, !tbaa !5
  %indvars.iv.next77.2 = add nuw nsw i64 %indvars.iv76, 3
  %45 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %indvars.iv.next77.2
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %47
  %49 = trunc nuw nsw i64 %indvars.iv.next77.2 to i32
  store i32 %49, ptr %48, align 4, !tbaa !5
  %indvars.iv.next77.3 = add nuw nsw i64 %indvars.iv76, 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 %.preheader.unr-lcssa, label %.lr.ph63, !llvm.loop !13

._crit_edge73:                                    ; preds = %101, %._crit_edge, %.preheader
  ret i32 0

.lr.ph72:                                         ; preds = %.preheader, %101
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %101 ], [ 1, %.preheader ]
  %50 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %indvars.iv79
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv79
  %53 = load i32, ptr %52, align 4, !tbaa !5
  tail call void @_Z3addIiEvPT_ii(ptr noundef nonnull @bitk, i32 noundef %51, i32 noundef %53)
  %54 = load i32, ptr %52, align 4, !tbaa !5
  %55 = load i32, ptr @sk, align 4, !tbaa !5
  %56 = add nsw i32 %55, %54
  store i32 %56, ptr @sk, align 4, !tbaa !5
  %57 = load i32, ptr %50, align 4, !tbaa !5
  %58 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv79
  %59 = load i32, ptr %58, align 4, !tbaa !5
  tail call void @_Z3addIxEvPT_ii(ptr noundef nonnull @bitb, i32 noundef %57, i32 noundef %59)
  %60 = load i32, ptr %58, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = load i64, ptr @sb, align 8, !tbaa !14
  %63 = add nsw i64 %62, %61
  store i64 %63, ptr @sb, align 8, !tbaa !14
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp sgt i32 %64, 1
  br i1 %65, label %.lr.ph67, label %._crit_edge68

.lr.ph67:                                         ; preds = %.lr.ph72, %.lr.ph67
  %.04565 = phi i32 [ %.1, %.lr.ph67 ], [ %64, %.lr.ph72 ]
  %.04664 = phi i32 [ %.147, %.lr.ph67 ], [ 1, %.lr.ph72 ]
  %66 = add nuw nsw i32 %.04565, %.04664
  %67 = lshr i32 %66, 1
  %68 = tail call noundef i32 @_Z3sumIiET_PS0_i(ptr noundef nonnull @bitk, i32 noundef %67)
  %69 = shl i32 %68, 1
  %70 = load i32, ptr @sk, align 4, !tbaa !5
  %.not55 = icmp slt i32 %69, %70
  %71 = add nuw nsw i32 %67, 1
  %.147 = select i1 %.not55, i32 %71, i32 %.04664
  %.1 = select i1 %.not55, i32 %.04565, i32 %67
  %72 = icmp slt i32 %.147, %.1
  br i1 %72, label %.lr.ph67, label %._crit_edge68, !llvm.loop !16

._crit_edge68:                                    ; preds = %.lr.ph67, %.lr.ph72
  %.046.lcssa = phi i32 [ 1, %.lr.ph72 ], [ %.147, %.lr.ph67 ]
  %73 = tail call noundef i32 @_Z3sumIiET_PS0_i(ptr noundef nonnull @bitk, i32 noundef %.046.lcssa)
  %74 = shl i32 %73, 1
  %75 = load i32, ptr @sk, align 4, !tbaa !5
  %76 = tail call noundef i64 @_Z3sumIxET_PS0_i(ptr noundef nonnull @bitb, i32 noundef %.046.lcssa)
  %77 = shl i64 %76, 1
  %78 = load i64, ptr @sb, align 8, !tbaa !14
  %79 = sub nsw i64 %77, %78
  %.not54 = icmp eq i32 %74, %75
  br i1 %.not54, label %99, label %80

80:                                               ; preds = %._crit_edge68
  %81 = sub nsw i32 %74, %75
  %82 = zext nneg i32 %.046.lcssa to i64
  %83 = getelementptr inbounds [100010 x i32], ptr @ord, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = mul nsw i64 %79, %88
  %90 = sext i32 %81 to i64
  %91 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %85
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = mul nsw i64 %93, %90
  %95 = sub nsw i64 %89, %94
  %96 = sitofp i64 %95 to double
  %97 = sitofp i32 %87 to double
  %98 = fdiv double %96, %97
  br label %101

99:                                               ; preds = %._crit_edge68
  %100 = sitofp i64 %79 to double
  br label %101

101:                                              ; preds = %99, %80
  %102 = phi double [ %98, %80 ], [ %100, %99 ]
  %103 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %102)
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %.not53.not = icmp slt i64 %indvars.iv79, %105
  br i1 %.not53.not, label %.lr.ph72, label %._crit_edge73, !llvm.loop !17
}

; 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 void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumIiET_PS0_i(ptr noundef, i32 noundef) local_unnamed_addr #0

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

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

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 = { 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" }

!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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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