; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2018-19/Feb 2019/Plat (cowdate)

; 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.Seg = type { [2097152 x double], double }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@S = external dso_local global %struct.Seg, align 8
@N = external dso_local global i32, align 4
@p = external dso_local global [1000001 x x86_fp80], align 16
@ans = external dso_local global x86_fp80, align 16
@cum = external dso_local global [1000001 x x86_fp80], align 16
@eps = external dso_local global x86_fp80, align 16
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef x86_fp80 @_Z4evalii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %11 unwind label %18

11:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %12 unwind label %22

12:                                               ; preds = %11
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @_ZN5input2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %65, %12
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %27, label %17

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

18:                                               ; preds = %0
  %19 = landingpad { ptr, i32 }
          cleanup
  %20 = extractvalue { ptr, i32 } %19, 0
  store ptr %20, ptr %4, align 8
  %21 = extractvalue { ptr, i32 } %19, 1
  store i32 %21, ptr %5, align 4
  br label %26

22:                                               ; preds = %11
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %4, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  br label %26

26:                                               ; preds = %22, %18
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  br label %114

27:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @_ZN5input2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %7)
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sitofp i32 %28 to x86_fp80
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1000001 x x86_fp80], ptr @p, i64 0, i64 %31
  store x86_fp80 %29, ptr %32, align 16, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1000001 x x86_fp80], ptr @p, i64 0, i64 %34
  %36 = load x86_fp80, ptr %35, align 16, !tbaa !9
  %37 = fdiv x86_fp80 %36, 0xK4012F424000000000000
  %38 = fsub x86_fp80 0xK3FFF8000000000000000, %37
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1000001 x x86_fp80], ptr @p, i64 0, i64 %40
  store x86_fp80 %38, ptr %41, align 16, !tbaa !9
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %43
  %45 = load x86_fp80, ptr %44, align 16, !tbaa !9
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000001 x x86_fp80], ptr @p, i64 0, i64 %47
  %49 = load x86_fp80, ptr %48, align 16, !tbaa !9
  %50 = fdiv x86_fp80 0xK3FFF8000000000000000, %49
  %51 = fadd x86_fp80 %45, %50
  %52 = fsub x86_fp80 %51, 0xK3FFF8000000000000000
  %53 = load x86_fp80, ptr @eps, align 16, !tbaa !9
  %54 = fadd x86_fp80 %52, %53
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %57
  store x86_fp80 %54, ptr %58, align 16, !tbaa !9
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000001 x x86_fp80], ptr @p, i64 0, i64 %61
  %63 = load x86_fp80, ptr %62, align 16, !tbaa !9
  %64 = fptrunc x86_fp80 %63 to double
  call void @_ZN3SegIdLi1048576EE3updEid(ptr noundef nonnull align 8 dereferenceable(16777224) @S, i32 noundef %59, double noundef %64)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %65

65:                                               ; preds = %27
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !5
  br label %13, !llvm.loop !11

68:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 -1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %105, %68
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = load i32, ptr @N, align 4, !tbaa !5
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

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

74:                                               ; preds = %69
  br label %75

75:                                               ; preds = %94, %74
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = load i32, ptr @N, align 4, !tbaa !5
  %78 = sub nsw i32 %77, 1
  %79 = icmp slt i32 %76, %78
  br i1 %79, label %80, label %92

80:                                               ; preds = %75
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %83
  %85 = load x86_fp80, ptr %84, align 16, !tbaa !9
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %87
  %89 = load x86_fp80, ptr %88, align 16, !tbaa !9
  %90 = fsub x86_fp80 %85, %89
  %91 = fcmp ole x86_fp80 %90, 0xK3FFF8000000000000000
  br label %92

92:                                               ; preds = %80, %75
  %93 = phi i1 [ false, %75 ], [ %91, %80 ]
  br i1 %93, label %94, label %97

94:                                               ; preds = %92
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %8, align 4, !tbaa !5
  br label %75, !llvm.loop !13

97:                                               ; preds = %92
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = call noundef x86_fp80 @_Z4evalii(i32 noundef %98, i32 noundef %100)
  call void @_Z5ckmaxIeEvRT_S0_(ptr noundef nonnull align 16 dereferenceable(16) @ans, x86_fp80 noundef %101)
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = call noundef x86_fp80 @_Z4evalii(i32 noundef %102, i32 noundef %103)
  call void @_Z5ckmaxIeEvRT_S0_(ptr noundef nonnull align 16 dereferenceable(16) @ans, x86_fp80 noundef %104)
  br label %105

105:                                              ; preds = %97
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %9, align 4, !tbaa !5
  br label %69, !llvm.loop !14

108:                                              ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %109 = load x86_fp80, ptr @ans, align 16, !tbaa !9
  %110 = fmul x86_fp80 0xK4012F424000000000000, %109
  %111 = call noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef %110)
  %112 = fptosi x86_fp80 %111 to i64
  store i64 %112, ptr %10, align 8, !tbaa !15
  call void @_ZN6output2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %113 = load i32, ptr %1, align 4
  ret i32 %113

114:                                              ; preds = %26
  %115 = load ptr, ptr %4, align 8
  %116 = load i32, ptr %5, align 4
  %117 = insertvalue { ptr, i32 } poison, ptr %115, 0
  %118 = insertvalue { ptr, i32 } %117, i32 %116, 1
  resume { ptr, i32 } %118
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5input2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3SegIdLi1048576EE3updEid(ptr noundef nonnull align 8 dereferenceable(16777224), i32 noundef, double noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5ckmaxIeEvRT_S0_(ptr noundef nonnull align 16 dereferenceable(16), x86_fp80 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6output2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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


; 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.Seg = type { [2097152 x double], double }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@S = external dso_local global %struct.Seg, align 8
@N = external dso_local global i32, align 4
@p = external dso_local local_unnamed_addr global [1000001 x x86_fp80], align 16
@ans = external dso_local global x86_fp80, align 16
@cum = external dso_local local_unnamed_addr global [1000001 x x86_fp80], align 16
@eps = external dso_local local_unnamed_addr global x86_fp80, align 16
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef x86_fp80 @_Z4evalii(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %5 unwind label %10

5:                                                ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %6 unwind label %12

6:                                                ; preds = %5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  call void @_ZN5input2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @N)
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

.preheader27:                                     ; preds = %.lr.ph
  %9 = icmp sgt i32 %30, 0
  br i1 %9, label %.preheader, label %._crit_edge

10:                                               ; preds = %0
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %14

12:                                               ; preds = %5
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #6
  br label %14

14:                                               ; preds = %12, %10
  %.pn = phi { ptr, i32 } [ %13, %12 ], [ %11, %10 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn

.lr.ph:                                           ; preds = %6, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %6 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @_ZN5input2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %3)
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = sitofp i32 %15 to x86_fp80
  %17 = getelementptr inbounds [1000001 x x86_fp80], ptr @p, i64 0, i64 %indvars.iv
  %18 = fdiv x86_fp80 %16, 0xK4012F424000000000000
  %19 = fsub x86_fp80 0xK3FFF8000000000000000, %18
  store x86_fp80 %19, ptr %17, align 16, !tbaa !9
  %20 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %indvars.iv
  %21 = load x86_fp80, ptr %20, align 16, !tbaa !9
  %22 = fdiv x86_fp80 0xK3FFF8000000000000000, %19
  %23 = fadd x86_fp80 %21, %22
  %24 = fadd x86_fp80 %23, 0xKBFFF8000000000000000
  %25 = load x86_fp80, ptr @eps, align 16, !tbaa !9
  %26 = fadd x86_fp80 %25, %24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %indvars.iv.next
  store x86_fp80 %26, ptr %27, align 16, !tbaa !9
  %28 = fptrunc x86_fp80 %19 to double
  %29 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_ZN3SegIdLi1048576EE3updEid(ptr noundef nonnull align 8 dereferenceable(16777224) @S, i32 noundef %29, double noundef %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %30 = load i32, ptr @N, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = icmp slt i64 %indvars.iv.next, %31
  br i1 %32, label %.lr.ph, label %.preheader27, !llvm.loop !11

.preheader:                                       ; preds = %.preheader27, %.critedge
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %.critedge ], [ 0, %.preheader27 ]
  %33 = phi i32 [ %55, %.critedge ], [ %30, %.preheader27 ]
  %.02229 = phi i32 [ %.1.lcssa, %.critedge ], [ -1, %.preheader27 ]
  %34 = add nsw i32 %33, -1
  %35 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %indvars.iv35
  %36 = sext i32 %.02229 to i64
  %37 = sext i32 %34 to i64
  %smax = call i32 @llvm.smax.i32(i32 %.02229, i32 %34)
  br label %42

._crit_edge:                                      ; preds = %.critedge, %6, %.preheader27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %38 = load x86_fp80, ptr @ans, align 16, !tbaa !9
  %39 = fmul x86_fp80 %38, 0xK4012F424000000000000
  %40 = call noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef %39)
  %41 = fptosi x86_fp80 %40 to i64
  store i64 %41, ptr %4, align 8, !tbaa !13
  call void @_ZN6output2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret i32 0

42:                                               ; preds = %.preheader, %44
  %indvars.iv32 = phi i64 [ %36, %.preheader ], [ %indvars.iv.next33, %44 ]
  %43 = icmp slt i64 %indvars.iv32, %37
  br i1 %43, label %44, label %.critedge

44:                                               ; preds = %42
  %indvars.iv.next33 = add nsw i64 %indvars.iv32, 1
  %45 = getelementptr inbounds [1000001 x x86_fp80], ptr @cum, i64 0, i64 %indvars.iv.next33
  %46 = load x86_fp80, ptr %45, align 16, !tbaa !9
  %47 = load x86_fp80, ptr %35, align 16, !tbaa !9
  %48 = fsub x86_fp80 %46, %47
  %49 = fcmp ugt x86_fp80 %48, 0xK3FFF8000000000000000
  br i1 %49, label %.critedge.split.loop.exit38, label %42, !llvm.loop !15

.critedge.split.loop.exit38:                      ; preds = %44
  %50 = trunc nsw i64 %indvars.iv32 to i32
  br label %.critedge

.critedge:                                        ; preds = %42, %.critedge.split.loop.exit38
  %.1.lcssa = phi i32 [ %50, %.critedge.split.loop.exit38 ], [ %smax, %42 ]
  %51 = add nsw i32 %.1.lcssa, -1
  %52 = trunc nuw nsw i64 %indvars.iv35 to i32
  %53 = call noundef x86_fp80 @_Z4evalii(i32 noundef %52, i32 noundef %51)
  call void @_Z5ckmaxIeEvRT_S0_(ptr noundef nonnull align 16 dereferenceable(16) @ans, x86_fp80 noundef %53)
  %54 = call noundef x86_fp80 @_Z4evalii(i32 noundef %52, i32 noundef %.1.lcssa)
  call void @_Z5ckmaxIeEvRT_S0_(ptr noundef nonnull align 16 dereferenceable(16) @ans, x86_fp80 noundef %54)
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %55 = load i32, ptr @N, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next36, %56
  br i1 %57, label %.preheader, label %._crit_edge, !llvm.loop !16
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5input2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3SegIdLi1048576EE3updEid(ptr noundef nonnull align 8 dereferenceable(16777224), i32 noundef, double noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5ckmaxIeEvRT_S0_(ptr noundef nonnull align 16 dereferenceable(16), x86_fp80 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6output2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt5floore(x86_fp80 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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


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