; LLVM IR from xirc/cp-algorithm :: atcoder/abc034/D/main.ll (Z4passe)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%class.anon = type { ptr }

@K = external dso_local global i32, align 4
@wp = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z4passe(x86_fp80 noundef %0) #0 {
  %2 = alloca x86_fp80, align 16
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %class.anon, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca x86_fp80, align 16
  store x86_fp80 %0, ptr %2, align 16, !tbaa !5
  %11 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #4
  %12 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  store ptr %11, ptr %12, align 8
  %13 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #4
  %14 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  store ptr %13, ptr %14, align 8
  %15 = getelementptr inbounds %class.anon, ptr %5, i32 0, i32 0
  store ptr %2, ptr %15, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8
  %18 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8
  %20 = getelementptr inbounds %class.anon, ptr %5, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8
  call void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEZ4passeE3$_0EvT_SA_T0_"(ptr %17, ptr %19, ptr %21)
  %22 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #4
  %23 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %22, ptr %23, align 8
  %24 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #4
  %25 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %24, ptr %25, align 8
  %26 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8
  %28 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %27, ptr %29)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store double 0.000000e+00, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %30

30:                                               ; preds = %57, %1
  %31 = load i32, ptr %9, align 4, !tbaa !13
  %32 = load i32, ptr @K, align 4, !tbaa !13
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %60

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  %36 = load i32, ptr %9, align 4, !tbaa !13
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @wp, i64 noundef %37) #4
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %38, i64 noundef 0) #4
  %40 = load i32, ptr %39, align 4, !tbaa !13
  %41 = sitofp i32 %40 to x86_fp80
  %42 = load i32, ptr %9, align 4, !tbaa !13
  %43 = sext i32 %42 to i64
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @wp, i64 noundef %43) #4
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %44, i64 noundef 1) #4
  %46 = load i32, ptr %45, align 4, !tbaa !13
  %47 = sitofp i32 %46 to x86_fp80
  %48 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %49 = fsub x86_fp80 %47, %48
  %50 = fmul x86_fp80 %41, %49
  %51 = fdiv x86_fp80 %50, 0xK4005C800000000000000
  store x86_fp80 %51, ptr %10, align 16, !tbaa !5
  %52 = load x86_fp80, ptr %10, align 16, !tbaa !5
  %53 = load double, ptr %8, align 8, !tbaa !11
  %54 = fpext double %53 to x86_fp80
  %55 = fadd x86_fp80 %54, %52
  %56 = fptrunc x86_fp80 %55 to double
  store double %56, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  br label %57

57:                                               ; preds = %35
  %58 = load i32, ptr %9, align 4, !tbaa !13
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %9, align 4, !tbaa !13
  br label %30, !llvm.loop !15

60:                                               ; preds = %34
  %61 = load double, ptr %8, align 8, !tbaa !11
  %62 = fsub double %61, 1.000000e-08
  %63 = fcmp ogt double %62, 0.000000e+00
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  ret i1 %63
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEZ4passeE3$_0EvT_SA_T0_"(ptr, ptr, ptr) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8), i64 noundef) #2 align 2

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

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 = { 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 #2 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 2>, std::allocator<std::array<int, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@K = external dso_local local_unnamed_addr global i32, align 4
@wp = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z4passe(x86_fp80 noundef %0) local_unnamed_addr #0 {
  %2 = alloca x86_fp80, align 16
  store x86_fp80 %0, ptr %2, align 16, !tbaa !5
  %3 = tail call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #3
  %4 = tail call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #3
  call void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEZ4passeE3$_0EvT_SA_T0_"(ptr %3, ptr %4, ptr nonnull %2)
  %5 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #3
  %6 = call ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @wp) #3
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %5, ptr %6)
  %7 = load i32, ptr @K, align 4, !tbaa !9
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %9 = fadd double %25, -1.000000e-08
  %10 = fcmp ogt double %9, 0.000000e+00
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %1
  %.0.lcssa = phi i1 [ false, %1 ], [ %10, %._crit_edge.loopexit ]
  ret i1 %.0.lcssa

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %1 ]
  %.012 = phi double [ %25, %.lr.ph ], [ 0.000000e+00, %1 ]
  %11 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @wp, i64 noundef %indvars.iv) #3
  %12 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %11, i64 noundef 0) #3
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = sitofp i32 %13 to x86_fp80
  %15 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @wp, i64 noundef %indvars.iv) #3
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8) %15, i64 noundef 1) #3
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = sitofp i32 %17 to x86_fp80
  %19 = load x86_fp80, ptr %2, align 16, !tbaa !5
  %20 = fsub x86_fp80 %18, %19
  %21 = fmul x86_fp80 %20, %14
  %22 = fdiv x86_fp80 %21, 0xK4005C800000000000000
  %23 = fpext double %.012 to x86_fp80
  %24 = fadd x86_fp80 %22, %23
  %25 = fptrunc x86_fp80 %24 to double
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr @K, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !11
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEZ4passeE3$_0EvT_SA_T0_"(ptr, ptr, ptr) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm2EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt5arrayIiLm2EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm2EEixEm(ptr noundef nonnull align 4 dereferenceable(8), i64 noundef) local_unnamed_addr #2 align 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 = { 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 #2 = { 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 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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