; LLVM IR from eyangch/competitive-programming :: Codeforces/1059/d.ll (Z5workse)

; 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 i64, align 8
@x = external dso_local global [100000 x x86_fp80], align 16
@y = external dso_local global [100000 x x86_fp80], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5workse(x86_fp80 noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca x86_fp80, align 16
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca x86_fp80, align 16
  %7 = alloca x86_fp80, align 16
  %8 = alloca i64, align 8
  %9 = alloca x86_fp80, align 16
  %10 = alloca x86_fp80, align 16
  %11 = alloca x86_fp80, align 16
  store x86_fp80 %0, ptr %3, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %26, %1
  %13 = load i64, ptr %4, align 8, !tbaa !9
  %14 = load i64, ptr @N, align 8, !tbaa !9
  %15 = icmp slt i64 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  store i32 2, ptr %5, align 4
  br label %29

17:                                               ; preds = %12
  %18 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %19 = fmul x86_fp80 0xK40008000000000000000, %18
  %20 = load i64, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds [100000 x x86_fp80], ptr @y, i64 0, i64 %20
  %22 = load x86_fp80, ptr %21, align 16, !tbaa !5
  %23 = fcmp olt x86_fp80 %19, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %17
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %29

25:                                               ; preds = %17
  br label %26

26:                                               ; preds = %25
  %27 = load i64, ptr %4, align 8, !tbaa !9
  %28 = add nsw i64 %27, 1
  store i64 %28, ptr %4, align 8, !tbaa !9
  br label %12, !llvm.loop !11

29:                                               ; preds = %24, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %30 = load i32, ptr %5, align 4
  switch i32 %30, label %74 [
    i32 2, label %31
    i32 1, label %72
  ]

31:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  store x86_fp80 0xKC037B1A2BC2EC5000000, ptr %6, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  store x86_fp80 0xK4037B1A2BC2EC5000000, ptr %7, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %62, %31
  %33 = load i64, ptr %8, align 8, !tbaa !9
  %34 = load i64, ptr @N, align 8, !tbaa !9
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %65

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %38 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %39 = call noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef %38, i32 noundef 2)
  %40 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %41 = load i64, ptr %8, align 8, !tbaa !9
  %42 = getelementptr inbounds [100000 x x86_fp80], ptr @y, i64 0, i64 %41
  %43 = load x86_fp80, ptr %42, align 16, !tbaa !5
  %44 = fsub x86_fp80 %40, %43
  %45 = call noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef %44, i32 noundef 2)
  %46 = fsub x86_fp80 %39, %45
  %47 = call noundef x86_fp80 @_ZSt4sqrte(x86_fp80 noundef %46)
  store x86_fp80 %47, ptr %9, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  %48 = load i64, ptr %8, align 8, !tbaa !9
  %49 = getelementptr inbounds [100000 x x86_fp80], ptr @x, i64 0, i64 %48
  %50 = load x86_fp80, ptr %49, align 16, !tbaa !5
  %51 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %52 = fsub x86_fp80 %50, %51
  store x86_fp80 %52, ptr %10, align 16, !tbaa !5
  %53 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3maxIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16) %6, ptr noundef nonnull align 16 dereferenceable(16) %10)
  %54 = load x86_fp80, ptr %53, align 16, !tbaa !5
  store x86_fp80 %54, ptr %6, align 16, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  %55 = load i64, ptr %8, align 8, !tbaa !9
  %56 = getelementptr inbounds [100000 x x86_fp80], ptr @x, i64 0, i64 %55
  %57 = load x86_fp80, ptr %56, align 16, !tbaa !5
  %58 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %59 = fadd x86_fp80 %57, %58
  store x86_fp80 %59, ptr %11, align 16, !tbaa !5
  %60 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3minIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16) %7, ptr noundef nonnull align 16 dereferenceable(16) %11)
  %61 = load x86_fp80, ptr %60, align 16, !tbaa !5
  store x86_fp80 %61, ptr %7, align 16, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  br label %62

62:                                               ; preds = %37
  %63 = load i64, ptr %8, align 8, !tbaa !9
  %64 = add nsw i64 %63, 1
  store i64 %64, ptr %8, align 8, !tbaa !9
  br label %32, !llvm.loop !13

65:                                               ; preds = %36
  %66 = load x86_fp80, ptr %6, align 16, !tbaa !5
  %67 = load x86_fp80, ptr %7, align 16, !tbaa !5
  %68 = fcmp ole x86_fp80 %66, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %65
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %71

70:                                               ; preds = %65
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %71

71:                                               ; preds = %70, %69
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  br label %72

72:                                               ; preds = %71, %29
  %73 = load i1, ptr %2, align 1
  ret i1 %73

74:                                               ; preds = %29
  unreachable
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3maxIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3minIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!"long double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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 local_unnamed_addr global i64, align 8
@x = external dso_local local_unnamed_addr global [100000 x x86_fp80], align 16
@y = external dso_local local_unnamed_addr global [100000 x x86_fp80], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5workse(x86_fp80 noundef %0) local_unnamed_addr #0 {
  %2 = alloca x86_fp80, align 16
  %3 = alloca x86_fp80, align 16
  %4 = alloca x86_fp80, align 16
  %5 = alloca x86_fp80, align 16
  %6 = load i64, ptr @N, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge.thread

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

.lr.ph:                                           ; preds = %1
  %8 = fmul x86_fp80 %0, 0xK40008000000000000000
  br label %11

9:                                                ; preds = %11
  %10 = add nuw nsw i64 %.01420, 1
  %exitcond.not = icmp eq i64 %10, %6
  br i1 %exitcond.not, label %._crit_edge, label %11, !llvm.loop !9

11:                                               ; preds = %.lr.ph, %9
  %.01420 = phi i64 [ 0, %.lr.ph ], [ %10, %9 ]
  %12 = getelementptr inbounds [100000 x x86_fp80], ptr @y, i64 0, i64 %.01420
  %13 = load x86_fp80, ptr %12, align 16, !tbaa !11
  %14 = fcmp olt x86_fp80 %8, %13
  br i1 %14, label %.loopexit, label %9

._crit_edge:                                      ; preds = %9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  store x86_fp80 0xKC037B1A2BC2EC5000000, ptr %2, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  store x86_fp80 0xK4037B1A2BC2EC5000000, ptr %3, align 16, !tbaa !11
  br i1 %7, label %.lr.ph23, label %._crit_edge24

._crit_edge24.loopexit:                           ; preds = %.lr.ph23
  %.pre = load x86_fp80, ptr %2, align 16, !tbaa !11
  br label %._crit_edge24

._crit_edge24:                                    ; preds = %._crit_edge.thread, %._crit_edge24.loopexit, %._crit_edge
  %15 = phi x86_fp80 [ %33, %._crit_edge24.loopexit ], [ 0xK4037B1A2BC2EC5000000, %._crit_edge ], [ 0xK4037B1A2BC2EC5000000, %._crit_edge.thread ]
  %16 = phi x86_fp80 [ %.pre, %._crit_edge24.loopexit ], [ 0xKC037B1A2BC2EC5000000, %._crit_edge ], [ 0xKC037B1A2BC2EC5000000, %._crit_edge.thread ]
  %17 = fcmp ole x86_fp80 %16, %15
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  br label %.loopexit

.lr.ph23:                                         ; preds = %._crit_edge, %.lr.ph23
  %.01521 = phi i64 [ %34, %.lr.ph23 ], [ 0, %._crit_edge ]
  %18 = call noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef %0, i32 noundef 2)
  %19 = getelementptr inbounds [100000 x x86_fp80], ptr @y, i64 0, i64 %.01521
  %20 = load x86_fp80, ptr %19, align 16, !tbaa !11
  %21 = fsub x86_fp80 %0, %20
  %22 = call noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef %21, i32 noundef 2)
  %23 = fsub x86_fp80 %18, %22
  %24 = call noundef x86_fp80 @_ZSt4sqrte(x86_fp80 noundef %23)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %25 = getelementptr inbounds [100000 x x86_fp80], ptr @x, i64 0, i64 %.01521
  %26 = load x86_fp80, ptr %25, align 16, !tbaa !11
  %27 = fsub x86_fp80 %26, %24
  store x86_fp80 %27, ptr %4, align 16, !tbaa !11
  %28 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3maxIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16) %2, ptr noundef nonnull align 16 dereferenceable(16) %4)
  %29 = load x86_fp80, ptr %28, align 16, !tbaa !11
  store x86_fp80 %29, ptr %2, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  %30 = load x86_fp80, ptr %25, align 16, !tbaa !11
  %31 = fadd x86_fp80 %24, %30
  store x86_fp80 %31, ptr %5, align 16, !tbaa !11
  %32 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3minIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16) %3, ptr noundef nonnull align 16 dereferenceable(16) %5)
  %33 = load x86_fp80, ptr %32, align 16, !tbaa !11
  store x86_fp80 %33, ptr %3, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  %34 = add nuw nsw i64 %.01521, 1
  %35 = load i64, ptr @N, align 8, !tbaa !5
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %.lr.ph23, label %._crit_edge24.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %11, %._crit_edge24
  %.2 = phi i1 [ %17, %._crit_edge24 ], [ false, %11 ]
  ret i1 %.2
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3maxIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZSt3minIeERKT_S2_S2_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #2

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


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