; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2017-18/Open 2018/Gold (talent)

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

%"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
@W = external dso_local global i32, align 4
@bes = external dso_local global [1100000 x i32], align 16
@ans = external dso_local global double, align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_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 i32, align 4
  %10 = alloca double, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @stdin, align 8, !tbaa !5
  %12 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.2, ptr noundef %11)
  %13 = load ptr, ptr @stdout, align 8, !tbaa !5
  %14 = call ptr @freopen(ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef %13)
  %15 = 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)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) @W)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %25, %0
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %19 = icmp slt i32 %18, 1100000
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %23
  store i32 -1000000007, ptr %24, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %21
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !9
  br label %17, !llvm.loop !11

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

29:                                               ; preds = %74, %28
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = load i32, ptr @N, align 4, !tbaa !9
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %77

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = sub nsw i32 1100000, %37
  %39 = sub nsw i32 %38, 1
  store i32 %39, ptr %7, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %70, %34
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = icmp sge i32 %41, 0
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %40
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = icmp ne i32 %48, -1000000007
  br i1 %49, label %50, label %69

50:                                               ; preds = %44
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = add nsw i32 %51, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %56 = load i32, ptr %7, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !9
  %61 = add nsw i32 %59, %60
  store i32 %61, ptr %8, align 4, !tbaa !9
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = load i32, ptr %7, align 4, !tbaa !9
  %65 = load i32, ptr %5, align 4, !tbaa !9
  %66 = add nsw i32 %64, %65
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %67
  store i32 %63, ptr %68, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %69

69:                                               ; preds = %50, %44
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = add nsw i32 %71, -1
  store i32 %72, ptr %7, align 4, !tbaa !9
  br label %40, !llvm.loop !13

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

74:                                               ; preds = %73
  %75 = load i32, ptr %3, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %3, align 4, !tbaa !9
  br label %29, !llvm.loop !14

77:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %78 = load i32, ptr @W, align 4, !tbaa !9
  store i32 %78, ptr %9, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %94, %77
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = icmp slt i32 %80, 1100000
  br i1 %81, label %83, label %82

82:                                               ; preds = %79
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %97

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = sitofp i32 %87 to double
  %89 = load i32, ptr %9, align 4, !tbaa !9
  %90 = sitofp i32 %89 to double
  %91 = fdiv double %88, %90
  store double %91, ptr %10, align 8, !tbaa !15
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %93 = load double, ptr %92, align 8, !tbaa !15
  store double %93, ptr @ans, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %94

94:                                               ; preds = %83
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %9, align 4, !tbaa !9
  br label %79, !llvm.loop !17

97:                                               ; preds = %82
  %98 = load double, ptr @ans, align 8, !tbaa !15
  %99 = fmul double 1.000000e+03, %98
  %100 = call double @llvm.floor.f64(double %99)
  %101 = fptosi double %100 to i32
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %101)
  %103 = load i32, ptr %1, align 4
  ret i32 %103
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !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"

%"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
@W = external dso_local global i32, align 4
@bes = external dso_local global [1100000 x i32], align 16
@ans = external dso_local global double, align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_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 {
vector.ph:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca double, align 8
  %4 = load ptr, ptr @stdin, align 8, !tbaa !5
  %5 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, ptr noundef %4)
  %6 = load ptr, ptr @stdout, align 8, !tbaa !5
  %7 = tail call ptr @freopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef %6)
  %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) @N)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @W)
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.2, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %10 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %offset.idx
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  store <4 x i32> <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>, ptr %10, align 4, !tbaa !9
  store <4 x i32> <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>, ptr %11, align 4, !tbaa !9
  %offset.idx.1 = add nuw nsw i64 %index, 9
  %12 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %offset.idx.1
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  store <4 x i32> <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>, ptr %12, align 4, !tbaa !9
  store <4 x i32> <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>, ptr %13, align 4, !tbaa !9
  %offset.idx.2 = add nuw nsw i64 %index, 17
  %14 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %offset.idx.2
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store <4 x i32> <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>, ptr %14, align 4, !tbaa !9
  store <4 x i32> <i32 -1000000007, i32 -1000000007, i32 -1000000007, i32 -1000000007>, ptr %15, align 4, !tbaa !9
  %index.next.2 = add nuw nsw i64 %index, 24
  %16 = icmp eq i64 %index.next.2, 1099992
  br i1 %16, label %scalar.ph, label %vector.body, !llvm.loop !11

scalar.ph:                                        ; preds = %vector.body
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399972), align 4, !tbaa !9
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399976), align 8, !tbaa !9
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399980), align 4, !tbaa !9
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399984), align 16, !tbaa !9
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399988), align 4, !tbaa !9
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399992), align 8, !tbaa !9
  store i32 -1000000007, ptr getelementptr inbounds (i8, ptr @bes, i64 4399996), align 4, !tbaa !9
  %17 = load i32, ptr @N, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph22, label %._crit_edge23

._crit_edge23:                                    ; preds = %._crit_edge, %scalar.ph
  %19 = load i32, ptr @W, align 4, !tbaa !9
  %20 = icmp slt i32 %19, 1100000
  br i1 %20, label %.lr.ph26.preheader, label %._crit_edge23.._crit_edge27_crit_edge

._crit_edge23.._crit_edge27_crit_edge:            ; preds = %._crit_edge23
  %.pre = load double, ptr @ans, align 8, !tbaa !15
  br label %._crit_edge27

.lr.ph26.preheader:                               ; preds = %._crit_edge23
  %21 = sext i32 %19 to i64
  br label %.lr.ph26

.lr.ph22:                                         ; preds = %scalar.ph, %._crit_edge
  %.01721 = phi i32 [ %28, %._crit_edge ], [ 0, %scalar.ph ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %0)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %24 = load i32, ptr %0, align 4, !tbaa !9
  %25 = sub i32 1099999, %24
  %26 = icmp sgt i32 %25, -1
  br i1 %26, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph22
  %27 = zext nneg i32 %25 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %47, %.lr.ph22
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #5
  %28 = add nuw nsw i32 %.01721, 1
  %29 = load i32, ptr @N, align 4, !tbaa !9
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %.lr.ph22, label %._crit_edge23, !llvm.loop !17

.lr.ph:                                           ; preds = %.lr.ph.preheader, %47
  %31 = phi i32 [ %24, %.lr.ph.preheader ], [ %48, %47 ]
  %indvars.iv29 = phi i64 [ %27, %.lr.ph.preheader ], [ %indvars.iv.next30, %47 ]
  %32 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %indvars.iv29
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %.not = icmp eq i32 %33, -1000000007
  br i1 %.not, label %47, label %34

34:                                               ; preds = %.lr.ph
  %35 = trunc nuw nsw i64 %indvars.iv29 to i32
  %36 = add nsw i32 %31, %35
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %37
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %39 = load i32, ptr %1, align 4, !tbaa !9
  %40 = add nsw i32 %39, %33
  store i32 %40, ptr %2, align 4, !tbaa !9
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %38, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = load i32, ptr %0, align 4, !tbaa !9
  %44 = add nsw i32 %43, %35
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %45
  store i32 %42, ptr %46, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %47

47:                                               ; preds = %.lr.ph, %34
  %48 = phi i32 [ %31, %.lr.ph ], [ %43, %34 ]
  %indvars.iv.next30 = add nsw i64 %indvars.iv29, -1
  %49 = icmp sgt i64 %indvars.iv29, 0
  br i1 %49, label %.lr.ph, label %._crit_edge, !llvm.loop !18

._crit_edge27:                                    ; preds = %.lr.ph26, %._crit_edge23.._crit_edge27_crit_edge
  %50 = phi double [ %.pre, %._crit_edge23.._crit_edge27_crit_edge ], [ %62, %.lr.ph26 ]
  %51 = fmul double %50, 1.000000e+03
  %52 = call double @llvm.floor.f64(double %51)
  %53 = fptosi double %52 to i32
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %53)
  ret i32 0

.lr.ph26:                                         ; preds = %.lr.ph26.preheader, %.lr.ph26
  %indvars.iv32 = phi i64 [ %21, %.lr.ph26.preheader ], [ %indvars.iv.next33, %.lr.ph26 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %55 = getelementptr inbounds [1100000 x i32], ptr @bes, i64 0, i64 %indvars.iv32
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = sitofp i32 %56 to double
  %58 = trunc nsw i64 %indvars.iv32 to i32
  %59 = sitofp i32 %58 to double
  %60 = fdiv double %57, %59
  store double %60, ptr %3, align 8, !tbaa !15
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %62 = load double, ptr %61, align 8, !tbaa !15
  store double %62, ptr @ans, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %indvars.iv.next33 = add nsw i64 %indvars.iv32, 1
  %63 = and i64 %indvars.iv.next33, 4294967295
  %exitcond35.not = icmp eq i64 %63, 1100000
  br i1 %exitcond35.not, label %._crit_edge27, label %.lr.ph26, !llvm.loop !19
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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