; LLVM IR from tangjz/acm-icpc :: lydsy (3520)

; 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
@tot = external dso_local global i32, align 4
@ord = external dso_local global [1000000 x i32], align 16
@deg = external dso_local global [1000 x i16], align 16
@L = external dso_local global [1000000 x i16], align 16
@R = external dso_local global [1000000 x i16], align 16
@ans = external dso_local global i16, align 2
@a = external dso_local global [1000 x x86_fp80], align 16
@b = external dso_local global [1000000 x x86_fp80], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRss(ptr noundef nonnull align 2 dereferenceable(2), i16 noundef signext) #0

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

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

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

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sitofp i32 %18 to x86_fp80
  %20 = fptrunc x86_fp80 %19 to double
  %21 = call double @log(double noundef %20) #6
  %22 = fpext double %21 to x86_fp80
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000 x x86_fp80], ptr @a, i64 0, i64 %24
  store x86_fp80 %22, ptr %25, align 16, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %26

26:                                               ; preds = %16
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !11

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

30:                                               ; preds = %78, %29
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  store x86_fp80 0xK00000000000000000000, ptr %6, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %7, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %74, %35
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %77

43:                                               ; preds = %38
  %44 = load i32, ptr %7, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000 x x86_fp80], ptr @a, i64 0, i64 %45
  %47 = load x86_fp80, ptr %46, align 16, !tbaa !9
  %48 = load x86_fp80, ptr %6, align 16, !tbaa !9
  %49 = fadd x86_fp80 %48, %47
  store x86_fp80 %49, ptr %6, align 16, !tbaa !9
  %50 = load i32, ptr @tot, align 4, !tbaa !5
  %51 = load i32, ptr @tot, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %52
  store i32 %50, ptr %53, align 4, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = trunc i32 %54 to i16
  %56 = load i32, ptr @tot, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %57
  store i16 %55, ptr %58, align 2, !tbaa !13
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = trunc i32 %59 to i16
  %61 = load i32, ptr @tot, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %62
  store i16 %60, ptr %63, align 2, !tbaa !13
  %64 = load x86_fp80, ptr %6, align 16, !tbaa !9
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sub nsw i32 %65, %66
  %68 = sitofp i32 %67 to x86_fp80
  %69 = fdiv x86_fp80 %64, %68
  %70 = load i32, ptr @tot, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr @tot, align 4, !tbaa !5
  %72 = sext i32 %70 to i64
  %73 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %72
  store x86_fp80 %69, ptr %73, align 16, !tbaa !9
  br label %74

74:                                               ; preds = %43
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %7, align 4, !tbaa !5
  br label %38, !llvm.loop !15

77:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  br label %78

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

81:                                               ; preds = %34
  %82 = load i32, ptr @tot, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i32, ptr @ord, i64 %83
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef @ord, ptr noundef %84, ptr noundef @_Z3cmpRKiS0_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %171, %81
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = load i32, ptr @tot, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %172

90:                                               ; preds = %85
  br label %91

91:                                               ; preds = %137, %90
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = load i32, ptr @tot, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %95, label %112

95:                                               ; preds = %91
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %100
  %102 = load x86_fp80, ptr %101, align 16, !tbaa !9
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %107
  %109 = load x86_fp80, ptr %108, align 16, !tbaa !9
  %110 = fcmp olt x86_fp80 %102, %109
  %111 = xor i1 %110, true
  br label %112

112:                                              ; preds = %95, %91
  %113 = phi i1 [ false, %91 ], [ %111, %95 ]
  br i1 %113, label %114, label %140

114:                                              ; preds = %112
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %119
  %121 = load i16, ptr %120, align 2, !tbaa !13
  %122 = sext i16 %121 to i64
  %123 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %122
  %124 = load i16, ptr %123, align 2, !tbaa !13
  %125 = add i16 %124, 1
  store i16 %125, ptr %123, align 2, !tbaa !13
  call void @_Z3updRss(ptr noundef nonnull align 2 dereferenceable(2) @ans, i16 noundef signext %125)
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %130
  %132 = load i16, ptr %131, align 2, !tbaa !13
  %133 = sext i16 %132 to i64
  %134 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %133
  %135 = load i16, ptr %134, align 2, !tbaa !13
  %136 = add i16 %135, 1
  store i16 %136, ptr %134, align 2, !tbaa !13
  call void @_Z3updRss(ptr noundef nonnull align 2 dereferenceable(2) @ans, i16 noundef signext %136)
  br label %137

137:                                              ; preds = %114
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %9, align 4, !tbaa !5
  br label %91, !llvm.loop !17

140:                                              ; preds = %112
  br label %141

141:                                              ; preds = %168, %140
  %142 = load i32, ptr %8, align 4, !tbaa !5
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = icmp slt i32 %142, %143
  br i1 %144, label %145, label %171

145:                                              ; preds = %141
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %150
  %152 = load i16, ptr %151, align 2, !tbaa !13
  %153 = sext i16 %152 to i64
  %154 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %153
  %155 = load i16, ptr %154, align 2, !tbaa !13
  %156 = add i16 %155, -1
  store i16 %156, ptr %154, align 2, !tbaa !13
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %161
  %163 = load i16, ptr %162, align 2, !tbaa !13
  %164 = sext i16 %163 to i64
  %165 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %164
  %166 = load i16, ptr %165, align 2, !tbaa !13
  %167 = add i16 %166, -1
  store i16 %167, ptr %165, align 2, !tbaa !13
  br label %168

168:                                              ; preds = %145
  %169 = load i32, ptr %8, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %8, align 4, !tbaa !5
  br label %141, !llvm.loop !18

171:                                              ; preds = %141
  br label %85, !llvm.loop !19

172:                                              ; preds = %89
  %173 = load i16, ptr @ans, align 2, !tbaa !13
  %174 = sext i16 %173 to i32
  %175 = add nsw i32 %174, 1
  %176 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %175)
  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: nounwind
declare double @log(double noundef) #4

; 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) #5

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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local global [1000000 x i32], align 16
@deg = external dso_local local_unnamed_addr global [1000 x i16], align 16
@L = external dso_local local_unnamed_addr global [1000000 x i16], align 16
@R = external dso_local local_unnamed_addr global [1000000 x i16], align 16
@ans = external dso_local global i16, align 2
@a = external dso_local local_unnamed_addr global [1000 x x86_fp80], align 16
@b = external dso_local local_unnamed_addr global [1000000 x x86_fp80], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRss(ptr noundef nonnull align 2 dereferenceable(2), i16 noundef signext) local_unnamed_addr #0

; 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 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 1
  br i1 %4, label %.lr.ph, label %.preheader33

.preheader33:                                     ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %3, %0 ], [ %13, %.lr.ph ]
  %tot.promoted39 = load i32, ptr @tot, align 4, !tbaa !5
  %5 = icmp sgt i32 %.lcssa, 0
  br i1 %5, label %.lr.ph44.preheader, label %._crit_edge

.lr.ph44.preheader:                               ; preds = %.preheader33
  %6 = zext nneg i32 %.lcssa to i64
  %wide.trip.count72 = zext nneg i32 %.lcssa to i64
  br label %.lr.ph44

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = sitofp i32 %8 to double
  %10 = call double @log(double noundef %9) #6
  %11 = fpext double %10 to x86_fp80
  %12 = getelementptr inbounds [1000 x x86_fp80], ptr @a, i64 0, i64 %indvars.iv
  store x86_fp80 %11, ptr %12, align 16, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %.preheader33, !llvm.loop !11

..loopexit32_crit_edge:                           ; preds = %25
  %16 = trunc nsw i64 %indvars.iv.next65 to i32
  store i32 %16, ptr @tot, align 4, !tbaa !5
  br label %.loopexit32

.loopexit32:                                      ; preds = %..loopexit32_crit_edge, %.lr.ph44
  %.lcssa3840 = phi i32 [ %16, %..loopexit32_crit_edge ], [ %.lcssa384142, %.lr.ph44 ]
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count72
  br i1 %exitcond73.not, label %._crit_edge, label %.lr.ph44, !llvm.loop !13

._crit_edge:                                      ; preds = %.loopexit32, %.preheader33
  %17 = phi i32 [ %tot.promoted39, %.preheader33 ], [ %.lcssa3840, %.loopexit32 ]
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i32, ptr @ord, i64 %18
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %19, ptr noundef nonnull @_Z3cmpRKiS0_)
  %20 = load i32, ptr @tot, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.preheader, label %._crit_edge55

.lr.ph44:                                         ; preds = %.lr.ph44.preheader, %.loopexit32
  %indvars.iv69 = phi i64 [ 0, %.lr.ph44.preheader ], [ %indvars.iv.next70, %.loopexit32 ]
  %indvars.iv60 = phi i64 [ 1, %.lr.ph44.preheader ], [ %indvars.iv.next61, %.loopexit32 ]
  %.lcssa384142 = phi i32 [ %tot.promoted39, %.lr.ph44.preheader ], [ %.lcssa3840, %.loopexit32 ]
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %22 = icmp ult i64 %indvars.iv.next70, %6
  br i1 %22, label %.lr.ph37, label %.loopexit32

.lr.ph37:                                         ; preds = %.lr.ph44
  %23 = trunc i64 %indvars.iv69 to i16
  %24 = sext i32 %.lcssa384142 to i64
  br label %25

25:                                               ; preds = %.lr.ph37, %25
  %indvars.iv64 = phi i64 [ %24, %.lr.ph37 ], [ %indvars.iv.next65, %25 ]
  %indvars.iv62 = phi i64 [ %indvars.iv60, %.lr.ph37 ], [ %indvars.iv.next63, %25 ]
  %.02935 = phi x86_fp80 [ 0xK00000000000000000000, %.lr.ph37 ], [ %28, %25 ]
  %26 = getelementptr inbounds [1000 x x86_fp80], ptr @a, i64 0, i64 %indvars.iv62
  %27 = load x86_fp80, ptr %26, align 16, !tbaa !9
  %28 = fadd x86_fp80 %.02935, %27
  %29 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %indvars.iv64
  %30 = trunc nsw i64 %indvars.iv64 to i32
  store i32 %30, ptr %29, align 4, !tbaa !5
  %31 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %indvars.iv64
  store i16 %23, ptr %31, align 2, !tbaa !14
  %32 = trunc i64 %indvars.iv62 to i16
  %33 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %indvars.iv64
  store i16 %32, ptr %33, align 2, !tbaa !14
  %34 = sub nuw nsw i64 %indvars.iv62, %indvars.iv69
  %35 = trunc nsw i64 %34 to i32
  %36 = sitofp i32 %35 to x86_fp80
  %37 = fdiv x86_fp80 %28, %36
  %indvars.iv.next65 = add nsw i64 %indvars.iv64, 1
  %38 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %indvars.iv64
  store x86_fp80 %37, ptr %38, align 16, !tbaa !9
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count72
  br i1 %exitcond.not, label %..loopexit32_crit_edge, label %25, !llvm.loop !16

.loopexit:                                        ; preds = %.lr.ph51.prol.loopexit, %.lr.ph51, %.critedge
  %.127.lcssa = phi i32 [ %.02653, %.critedge ], [ %.1.lcssa, %.lr.ph51 ], [ %.1.lcssa, %.lr.ph51.prol.loopexit ]
  %39 = icmp slt i32 %.127.lcssa, %89
  br i1 %39, label %.preheader, label %._crit_edge55, !llvm.loop !17

.preheader:                                       ; preds = %._crit_edge, %.loopexit
  %40 = phi i32 [ %89, %.loopexit ], [ %20, %._crit_edge ]
  %.054 = phi i32 [ %.1.lcssa, %.loopexit ], [ 0, %._crit_edge ]
  %.02653 = phi i32 [ %.127.lcssa, %.loopexit ], [ 0, %._crit_edge ]
  %41 = sext i32 %.02653 to i64
  %42 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %41
  %43 = icmp slt i32 %.054, %40
  br i1 %43, label %.lr.ph46.preheader, label %.critedge

.lr.ph46.preheader:                               ; preds = %.preheader
  %44 = sext i32 %.054 to i64
  %45 = load i32, ptr %42, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %46
  %48 = load x86_fp80, ptr %47, align 16, !tbaa !9
  %49 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %44
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %51
  %53 = load x86_fp80, ptr %52, align 16, !tbaa !9
  %54 = fcmp uge x86_fp80 %48, %53
  br i1 %54, label %.lr.ph86, label %.critedge.loopexit

._crit_edge55:                                    ; preds = %.loopexit, %._crit_edge
  %55 = load i16, ptr @ans, align 2, !tbaa !14
  %56 = sext i16 %55 to i32
  %57 = add nsw i32 %56, 1
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %57)
  ret i32 0

.lr.ph46:                                         ; preds = %.lr.ph86
  %59 = load i32, ptr %42, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %60
  %62 = load x86_fp80, ptr %61, align 16, !tbaa !9
  %63 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %indvars.iv.next75
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1000000 x x86_fp80], ptr @b, i64 0, i64 %65
  %67 = load x86_fp80, ptr %66, align 16, !tbaa !9
  %68 = fcmp uge x86_fp80 %62, %67
  br i1 %68, label %.lr.ph86, label %.critedge.loopexit, !llvm.loop !18

.lr.ph86:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %69 = phi i64 [ %65, %.lr.ph46 ], [ %51, %.lr.ph46.preheader ]
  %70 = phi ptr [ %63, %.lr.ph46 ], [ %49, %.lr.ph46.preheader ]
  %indvars.iv7485 = phi i64 [ %indvars.iv.next75, %.lr.ph46 ], [ %44, %.lr.ph46.preheader ]
  %71 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %69
  %72 = load i16, ptr %71, align 2, !tbaa !14
  %73 = sext i16 %72 to i64
  %74 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %73
  %75 = load i16, ptr %74, align 2, !tbaa !14
  %76 = add i16 %75, 1
  store i16 %76, ptr %74, align 2, !tbaa !14
  call void @_Z3updRss(ptr noundef nonnull align 2 dereferenceable(2) @ans, i16 noundef signext %76)
  %77 = load i32, ptr %70, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %78
  %80 = load i16, ptr %79, align 2, !tbaa !14
  %81 = sext i16 %80 to i64
  %82 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %81
  %83 = load i16, ptr %82, align 2, !tbaa !14
  %84 = add i16 %83, 1
  store i16 %84, ptr %82, align 2, !tbaa !14
  call void @_Z3updRss(ptr noundef nonnull align 2 dereferenceable(2) @ans, i16 noundef signext %84)
  %indvars.iv.next75 = add nsw i64 %indvars.iv7485, 1
  %85 = load i32, ptr @tot, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = icmp slt i64 %indvars.iv.next75, %86
  br i1 %87, label %.lr.ph46, label %.critedge.loopexit, !llvm.loop !18

.critedge.loopexit:                               ; preds = %.lr.ph46, %.lr.ph86, %.lr.ph46.preheader
  %88 = phi i32 [ %40, %.lr.ph46.preheader ], [ %85, %.lr.ph86 ], [ %85, %.lr.ph46 ]
  %.1.lcssa.ph.in = phi i64 [ %44, %.lr.ph46.preheader ], [ %indvars.iv.next75, %.lr.ph86 ], [ %indvars.iv.next75, %.lr.ph46 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader
  %89 = phi i32 [ %40, %.preheader ], [ %88, %.critedge.loopexit ]
  %.1.lcssa = phi i32 [ %.054, %.preheader ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  %90 = icmp slt i32 %.02653, %.1.lcssa
  br i1 %90, label %.lr.ph51.preheader, label %.loopexit

.lr.ph51.preheader:                               ; preds = %.critedge
  %wide.trip.count81 = sext i32 %.1.lcssa to i64
  %91 = sub nsw i64 %wide.trip.count81, %41
  %xtraiter = and i64 %91, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph51.prol.loopexit, label %.lr.ph51.prol

.lr.ph51.prol:                                    ; preds = %.lr.ph51.preheader
  %92 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %41
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %94
  %96 = load i16, ptr %95, align 2, !tbaa !14
  %97 = sext i16 %96 to i64
  %98 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %97
  %99 = load i16, ptr %98, align 2, !tbaa !14
  %100 = add i16 %99, -1
  store i16 %100, ptr %98, align 2, !tbaa !14
  %101 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %94
  %102 = load i16, ptr %101, align 2, !tbaa !14
  %103 = sext i16 %102 to i64
  %104 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %103
  %105 = load i16, ptr %104, align 2, !tbaa !14
  %106 = add i16 %105, -1
  store i16 %106, ptr %104, align 2, !tbaa !14
  %indvars.iv.next78.prol = add nsw i64 %41, 1
  br label %.lr.ph51.prol.loopexit

.lr.ph51.prol.loopexit:                           ; preds = %.lr.ph51.prol, %.lr.ph51.preheader
  %indvars.iv77.unr = phi i64 [ %41, %.lr.ph51.preheader ], [ %indvars.iv.next78.prol, %.lr.ph51.prol ]
  %107 = add nsw i64 %wide.trip.count81, -1
  %108 = icmp eq i64 %107, %41
  br i1 %108, label %.loopexit, label %.lr.ph51

.lr.ph51:                                         ; preds = %.lr.ph51.prol.loopexit, %.lr.ph51
  %indvars.iv77 = phi i64 [ %indvars.iv.next78.1, %.lr.ph51 ], [ %indvars.iv77.unr, %.lr.ph51.prol.loopexit ]
  %109 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %indvars.iv77
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %111
  %113 = load i16, ptr %112, align 2, !tbaa !14
  %114 = sext i16 %113 to i64
  %115 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %114
  %116 = load i16, ptr %115, align 2, !tbaa !14
  %117 = add i16 %116, -1
  store i16 %117, ptr %115, align 2, !tbaa !14
  %118 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %111
  %119 = load i16, ptr %118, align 2, !tbaa !14
  %120 = sext i16 %119 to i64
  %121 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %120
  %122 = load i16, ptr %121, align 2, !tbaa !14
  %123 = add i16 %122, -1
  store i16 %123, ptr %121, align 2, !tbaa !14
  %indvars.iv.next78 = add nsw i64 %indvars.iv77, 1
  %124 = getelementptr inbounds [1000000 x i32], ptr @ord, i64 0, i64 %indvars.iv.next78
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000000 x i16], ptr @L, i64 0, i64 %126
  %128 = load i16, ptr %127, align 2, !tbaa !14
  %129 = sext i16 %128 to i64
  %130 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %129
  %131 = load i16, ptr %130, align 2, !tbaa !14
  %132 = add i16 %131, -1
  store i16 %132, ptr %130, align 2, !tbaa !14
  %133 = getelementptr inbounds [1000000 x i16], ptr @R, i64 0, i64 %126
  %134 = load i16, ptr %133, align 2, !tbaa !14
  %135 = sext i16 %134 to i64
  %136 = getelementptr inbounds [1000 x i16], ptr @deg, i64 0, i64 %135
  %137 = load i16, ptr %136, align 2, !tbaa !14
  %138 = add i16 %137, -1
  store i16 %138, ptr %136, align 2, !tbaa !14
  %indvars.iv.next78.1 = add nsw i64 %indvars.iv77, 2
  %exitcond82.not.1 = icmp eq i64 %indvars.iv.next78.1, %wide.trip.count81
  br i1 %exitcond82.not.1, label %.loopexit, label %.lr.ph51, !llvm.loop !19
}

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

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

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

; Function Attrs: mustprogress 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) local_unnamed_addr #5

; 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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