; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x07-贪心/115. 给树染色 (main)

; 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.node = type { i32, i32, i32, double }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@nd = external dso_local global [1010 x %struct.node], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @r)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %48, %0
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.node, ptr %24, i32 0, i32 0
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %28
  %30 = getelementptr inbounds %struct.node, ptr %29, i32 0, i32 1
  store i32 1, ptr %30, align 4, !tbaa !9
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.node, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !12
  %36 = sitofp i32 %35 to double
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %38
  %40 = getelementptr inbounds %struct.node, ptr %39, i32 0, i32 3
  store double %36, ptr %40, align 8, !tbaa !13
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %42
  %44 = getelementptr inbounds %struct.node, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !12
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = add nsw i32 %46, %45
  store i32 %47, ptr %2, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %21
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !5
  br label %16, !llvm.loop !14

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

52:                                               ; preds = %66, %51
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = sub nsw i32 %54, 1
  %56 = icmp slt i32 %53, %55
  br i1 %56, label %58, label %57

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

58:                                               ; preds = %52
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %59, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %63
  %65 = getelementptr inbounds %struct.node, ptr %64, i32 0, i32 2
  store i32 %61, ptr %65, align 8, !tbaa !16
  br label %66

66:                                               ; preds = %58
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %6, align 4, !tbaa !5
  br label %52, !llvm.loop !17

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

70:                                               ; preds = %191, %69
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %76, label %75

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

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store double -1.000000e+00, ptr %9, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %102, %76
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = load i32, ptr @r, align 4, !tbaa !5
  %85 = icmp ne i32 %83, %84
  br i1 %85, label %86, label %101

86:                                               ; preds = %82
  %87 = load i32, ptr %11, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %88
  %90 = getelementptr inbounds %struct.node, ptr %89, i32 0, i32 3
  %91 = load double, ptr %90, align 8, !tbaa !13
  %92 = load double, ptr %9, align 8, !tbaa !18
  %93 = fcmp ogt double %91, %92
  br i1 %93, label %94, label %101

94:                                               ; preds = %86
  %95 = load i32, ptr %11, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %96
  %98 = getelementptr inbounds %struct.node, ptr %97, i32 0, i32 3
  %99 = load double, ptr %98, align 8, !tbaa !13
  store double %99, ptr %9, align 8, !tbaa !18
  %100 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %100, ptr %10, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %94, %86, %82
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %11, align 4, !tbaa !5
  br label %77, !llvm.loop !19

105:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %106 = load i32, ptr %10, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %107
  %109 = getelementptr inbounds %struct.node, ptr %108, i32 0, i32 2
  %110 = load i32, ptr %109, align 8, !tbaa !16
  store i32 %110, ptr %12, align 4, !tbaa !5
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %112
  %114 = getelementptr inbounds %struct.node, ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = load i32, ptr %10, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %117
  %119 = getelementptr inbounds %struct.node, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 8, !tbaa !12
  %121 = mul nsw i32 %115, %120
  %122 = load i32, ptr %2, align 4, !tbaa !5
  %123 = add nsw i32 %122, %121
  store i32 %123, ptr %2, align 4, !tbaa !5
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.node, ptr %126, i32 0, i32 3
  store double -1.000000e+00, ptr %127, align 8, !tbaa !13
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.node, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !9
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.node, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !9
  %138 = add nsw i32 %137, %132
  store i32 %138, ptr %136, align 4, !tbaa !9
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %140
  %142 = getelementptr inbounds %struct.node, ptr %141, i32 0, i32 0
  %143 = load i32, ptr %142, align 8, !tbaa !12
  %144 = load i32, ptr %12, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %145
  %147 = getelementptr inbounds %struct.node, ptr %146, i32 0, i32 0
  %148 = load i32, ptr %147, align 8, !tbaa !12
  %149 = add nsw i32 %148, %143
  store i32 %149, ptr %147, align 8, !tbaa !12
  %150 = load i32, ptr %12, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %151
  %153 = getelementptr inbounds %struct.node, ptr %152, i32 0, i32 0
  %154 = load i32, ptr %153, align 8, !tbaa !12
  %155 = sitofp i32 %154 to double
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %157
  %159 = getelementptr inbounds %struct.node, ptr %158, i32 0, i32 1
  %160 = load i32, ptr %159, align 4, !tbaa !9
  %161 = sitofp i32 %160 to double
  %162 = fdiv double %155, %161
  %163 = load i32, ptr %12, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %164
  %166 = getelementptr inbounds %struct.node, ptr %165, i32 0, i32 3
  store double %162, ptr %166, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %167

167:                                              ; preds = %187, %105
  %168 = load i32, ptr %13, align 4, !tbaa !5
  %169 = load i32, ptr @n, align 4, !tbaa !5
  %170 = icmp sle i32 %168, %169
  br i1 %170, label %172, label %171

171:                                              ; preds = %167
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %190

172:                                              ; preds = %167
  %173 = load i32, ptr %13, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %174
  %176 = getelementptr inbounds %struct.node, ptr %175, i32 0, i32 2
  %177 = load i32, ptr %176, align 8, !tbaa !16
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = icmp eq i32 %177, %178
  br i1 %179, label %180, label %186

180:                                              ; preds = %172
  %181 = load i32, ptr %12, align 4, !tbaa !5
  %182 = load i32, ptr %13, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %183
  %185 = getelementptr inbounds %struct.node, ptr %184, i32 0, i32 2
  store i32 %181, ptr %185, align 8, !tbaa !16
  br label %186

186:                                              ; preds = %180, %172
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %13, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %13, align 4, !tbaa !5
  br label %167, !llvm.loop !20

190:                                              ; preds = %171
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %7, align 4, !tbaa !5
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %7, align 4, !tbaa !5
  br label %70, !llvm.loop !21

194:                                              ; preds = %75
  %195 = load i32, ptr %2, align 4, !tbaa !5
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %195)
  %197 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %196, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %198 = load i32, ptr %1, align 4
  ret i32 %198
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!10, !6, i64 4}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !11, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !15}
!18 = !{!11, !11, i64 0}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}


; 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.node = type { i32, i32, i32, double }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@nd = external dso_local global [1010 x %struct.node], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @r)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not53 = icmp slt i32 %5, 1
  br i1 %.not53, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  br label %._crit_edge76

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %6 = icmp sgt i32 %14, 1
  br i1 %6, label %.lr.ph58, label %._crit_edge76

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %.04554 = phi i32 [ %13, %.lr.ph ], [ 0, %0 ]
  %7 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %9 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 1, ptr %9, align 4, !tbaa !9
  %10 = load i32, ptr %7, align 8, !tbaa !12
  %11 = sitofp i32 %10 to double
  %12 = getelementptr inbounds i8, ptr %7, i64 16
  store double %11, ptr %12, align 8, !tbaa !13
  %13 = add nsw i32 %10, %.04554
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %.not.not = icmp slt i64 %indvars.iv, %15
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.preheader51:                                     ; preds = %.lr.ph58
  %16 = icmp sgt i32 %31, 1
  br i1 %16, label %.preheader.preheader, label %._crit_edge76

.preheader.preheader:                             ; preds = %.preheader51
  %17 = load i32, ptr @r, align 4
  %18 = zext i32 %17 to i64
  %19 = zext nneg i32 %31 to i64
  %20 = zext nneg i32 %31 to i64
  %21 = add nsw i64 %20, -1
  %xtraiter = and i64 %19, 1
  %22 = icmp eq i64 %21, 0
  %unroll_iter = and i64 %19, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %xtraiter117 = and i64 %19, 1
  %23 = icmp eq i64 %21, 0
  %unroll_iter119 = and i64 %19, 2147483646
  %lcmp.mod118.not = icmp eq i64 %xtraiter117, 0
  br label %.preheader

.lr.ph58:                                         ; preds = %._crit_edge, %.lr.ph58
  %.04356 = phi i32 [ %30, %.lr.ph58 ], [ 0, %._crit_edge ]
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %28, i32 2
  store i32 %26, ptr %29, align 8, !tbaa !16
  %30 = add nuw nsw i32 %.04356, 1
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  %33 = icmp slt i32 %30, %32
  br i1 %33, label %.lr.ph58, label %.preheader51, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge72
  %.03975 = phi i32 [ %.2.lcssa, %._crit_edge72 ], [ undef, %.preheader.preheader ]
  %.04274 = phi i32 [ %81, %._crit_edge72 ], [ 0, %.preheader.preheader ]
  %.14673 = phi i32 [ %52, %._crit_edge72 ], [ %13, %.preheader.preheader ]
  br i1 %22, label %.lr.ph71.preheader.unr-lcssa, label %.preheader.new

._crit_edge76:                                    ; preds = %._crit_edge72, %._crit_edge.thread, %._crit_edge, %.preheader51
  %.146.lcssa = phi i32 [ %13, %.preheader51 ], [ 0, %._crit_edge.thread ], [ %13, %._crit_edge ], [ %52, %._crit_edge72 ]
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.146.lcssa)
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph71.preheader.unr-lcssa:                     ; preds = %76, %.preheader
  %.2.lcssa.ph = phi i32 [ poison, %.preheader ], [ %.2.1, %76 ]
  %indvars.iv86.unr = phi i64 [ 1, %.preheader ], [ %indvars.iv.next87.1, %76 ]
  %.163.unr = phi i32 [ %.03975, %.preheader ], [ %.2.1, %76 ]
  %.04062.unr = phi double [ -1.000000e+00, %.preheader ], [ %.141.1, %76 ]
  br i1 %lcmp.mod.not, label %.lr.ph71.preheader, label %.epil.preheader

.epil.preheader:                                  ; preds = %.lr.ph71.preheader.unr-lcssa
  %.not50.epil = icmp eq i64 %indvars.iv86.unr, %18
  br i1 %.not50.epil, label %.lr.ph71.preheader, label %36

36:                                               ; preds = %.epil.preheader
  %37 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv86.unr, i32 3
  %38 = load double, ptr %37, align 8, !tbaa !13
  %39 = fcmp ogt double %38, %.04062.unr
  br i1 %39, label %40, label %.lr.ph71.preheader

40:                                               ; preds = %36
  %41 = trunc nuw nsw i64 %indvars.iv86.unr to i32
  br label %.lr.ph71.preheader

.lr.ph71.preheader:                               ; preds = %.epil.preheader, %36, %40, %.lr.ph71.preheader.unr-lcssa
  %.2.lcssa = phi i32 [ %.2.lcssa.ph, %.lr.ph71.preheader.unr-lcssa ], [ %41, %40 ], [ %.163.unr, %36 ], [ %.163.unr, %.epil.preheader ]
  %42 = sext i32 %.2.lcssa to i64
  %43 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %42
  %44 = getelementptr inbounds i8, ptr %43, i64 8
  %45 = load i32, ptr %44, align 8, !tbaa !16
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %46
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = load i32, ptr %43, align 8, !tbaa !12
  %51 = mul nsw i32 %50, %49
  %52 = add nsw i32 %51, %.14673
  %53 = getelementptr inbounds i8, ptr %43, i64 16
  store double -1.000000e+00, ptr %53, align 8, !tbaa !13
  %54 = getelementptr inbounds i8, ptr %43, i64 4
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = add nsw i32 %55, %49
  store i32 %56, ptr %48, align 4, !tbaa !9
  %57 = load i32, ptr %47, align 8, !tbaa !12
  %58 = add nsw i32 %57, %50
  store i32 %58, ptr %47, align 8, !tbaa !12
  %59 = sitofp i32 %58 to double
  %60 = sitofp i32 %56 to double
  %61 = fdiv double %59, %60
  %62 = getelementptr inbounds i8, ptr %47, i64 16
  store double %61, ptr %62, align 8, !tbaa !13
  br i1 %23, label %._crit_edge72.unr-lcssa, label %.lr.ph71

.preheader.new:                                   ; preds = %.preheader, %76
  %indvars.iv86 = phi i64 [ %indvars.iv.next87.1, %76 ], [ 1, %.preheader ]
  %.163 = phi i32 [ %.2.1, %76 ], [ %.03975, %.preheader ]
  %.04062 = phi double [ %.141.1, %76 ], [ -1.000000e+00, %.preheader ]
  %niter = phi i64 [ %niter.next.1, %76 ], [ 0, %.preheader ]
  %.not50 = icmp eq i64 %indvars.iv86, %18
  br i1 %.not50, label %69, label %63

63:                                               ; preds = %.preheader.new
  %64 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv86, i32 3
  %65 = load double, ptr %64, align 8, !tbaa !13
  %66 = fcmp ogt double %65, %.04062
  br i1 %66, label %67, label %69

67:                                               ; preds = %63
  %68 = trunc nuw nsw i64 %indvars.iv86 to i32
  br label %69

69:                                               ; preds = %.preheader.new, %63, %67
  %.141 = phi double [ %65, %67 ], [ %.04062, %63 ], [ %.04062, %.preheader.new ]
  %.2 = phi i32 [ %68, %67 ], [ %.163, %63 ], [ %.163, %.preheader.new ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %.not50.1 = icmp eq i64 %indvars.iv.next87, %18
  br i1 %.not50.1, label %76, label %70

70:                                               ; preds = %69
  %71 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv.next87, i32 3
  %72 = load double, ptr %71, align 8, !tbaa !13
  %73 = fcmp ogt double %72, %.141
  br i1 %73, label %74, label %76

74:                                               ; preds = %70
  %75 = trunc nuw nsw i64 %indvars.iv.next87 to i32
  br label %76

76:                                               ; preds = %74, %70, %69
  %.141.1 = phi double [ %72, %74 ], [ %.141, %70 ], [ %.141, %69 ]
  %.2.1 = phi i32 [ %75, %74 ], [ %.2, %70 ], [ %.2, %69 ]
  %indvars.iv.next87.1 = add nuw nsw i64 %indvars.iv86, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.lr.ph71.preheader.unr-lcssa, label %.preheader.new, !llvm.loop !18

._crit_edge72.unr-lcssa:                          ; preds = %90, %.lr.ph71.preheader
  %indvars.iv89.unr = phi i64 [ 1, %.lr.ph71.preheader ], [ %indvars.iv.next90.1, %90 ]
  br i1 %lcmp.mod118.not, label %._crit_edge72, label %.lr.ph71.epil

.lr.ph71.epil:                                    ; preds = %._crit_edge72.unr-lcssa
  %77 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv89.unr, i32 2
  %78 = load i32, ptr %77, align 8, !tbaa !16
  %79 = icmp eq i32 %78, %.2.lcssa
  br i1 %79, label %80, label %._crit_edge72

80:                                               ; preds = %.lr.ph71.epil
  store i32 %45, ptr %77, align 8, !tbaa !16
  br label %._crit_edge72

._crit_edge72:                                    ; preds = %.lr.ph71.epil, %80, %._crit_edge72.unr-lcssa
  %81 = add nuw nsw i32 %.04274, 1
  %exitcond94.not = icmp eq i32 %81, %32
  br i1 %exitcond94.not, label %._crit_edge76, label %.preheader, !llvm.loop !19

.lr.ph71:                                         ; preds = %.lr.ph71.preheader, %90
  %indvars.iv89 = phi i64 [ %indvars.iv.next90.1, %90 ], [ 1, %.lr.ph71.preheader ]
  %niter120 = phi i64 [ %niter120.next.1, %90 ], [ 0, %.lr.ph71.preheader ]
  %82 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv89, i32 2
  %83 = load i32, ptr %82, align 8, !tbaa !16
  %84 = icmp eq i32 %83, %.2.lcssa
  br i1 %84, label %85, label %.lr.ph71.1

85:                                               ; preds = %.lr.ph71
  store i32 %45, ptr %82, align 8, !tbaa !16
  br label %.lr.ph71.1

.lr.ph71.1:                                       ; preds = %.lr.ph71, %85
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %86 = getelementptr inbounds [1010 x %struct.node], ptr @nd, i64 0, i64 %indvars.iv.next90, i32 2
  %87 = load i32, ptr %86, align 8, !tbaa !16
  %88 = icmp eq i32 %87, %.2.lcssa
  br i1 %88, label %89, label %90

89:                                               ; preds = %.lr.ph71.1
  store i32 %45, ptr %86, align 8, !tbaa !16
  br label %90

90:                                               ; preds = %89, %.lr.ph71.1
  %indvars.iv.next90.1 = add nuw nsw i64 %indvars.iv89, 2
  %niter120.next.1 = add i64 %niter120, 2
  %niter120.ncmp.1 = icmp eq i64 %niter120.next.1, %unroll_iter119
  br i1 %niter120.ncmp.1, label %._crit_edge72.unr-lcssa, label %.lr.ph71, !llvm.loop !20
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!10, !6, i64 4}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !11, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 8}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}


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