; LLVM IR from NaokiHori/VerySimpleNSSolver :: src/integrate/predict/compute_duy (pres)

; 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.domain_t = type { double, double, i64, i64, double, double }

@uy_jmin = external constant i64, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @uy_pres(ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca double, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.domain_t, ptr %15, i32 0, i32 2
  %17 = load i64, ptr %16, align 8, !tbaa !11
  store i64 %17, ptr %9, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.domain_t, ptr %18, i32 0, i32 3
  %20 = load i64, ptr %19, align 8, !tbaa !15
  store i64 %20, ptr %10, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.domain_t, ptr %21, i32 0, i32 5
  %23 = load double, ptr %22, align 8, !tbaa !16
  store double %23, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %24 = load i64, ptr @uy_jmin, align 8, !tbaa !14
  store i64 %24, ptr %12, align 8, !tbaa !14
  br label %25

25:                                               ; preds = %70, %4
  %26 = load i64, ptr %12, align 8, !tbaa !14
  %27 = load i64, ptr %10, align 8, !tbaa !14
  %28 = icmp ule i64 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %73

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 1, ptr %14, align 8, !tbaa !14
  br label %31

31:                                               ; preds = %66, %30
  %32 = load i64, ptr %14, align 8, !tbaa !14
  %33 = load i64, ptr %9, align 8, !tbaa !14
  %34 = icmp ule i64 %32, %33
  br i1 %34, label %36, label %35

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

36:                                               ; preds = %31
  %37 = load double, ptr %7, align 8, !tbaa !9
  %38 = load double, ptr %11, align 8, !tbaa !9
  %39 = fdiv double %37, %38
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i64, ptr %12, align 8, !tbaa !14
  %42 = sub i64 %41, 1
  %43 = getelementptr inbounds ptr, ptr %40, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = load i64, ptr %14, align 8, !tbaa !14
  %46 = getelementptr inbounds double, ptr %44, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = fneg double %47
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i64, ptr %12, align 8, !tbaa !14
  %51 = getelementptr inbounds ptr, ptr %49, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = load i64, ptr %14, align 8, !tbaa !14
  %54 = getelementptr inbounds double, ptr %52, i64 %53
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = fadd double %48, %55
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = load i64, ptr %12, align 8, !tbaa !14
  %59 = getelementptr inbounds ptr, ptr %57, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = load i64, ptr %14, align 8, !tbaa !14
  %62 = getelementptr inbounds double, ptr %60, i64 %61
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = fneg double %39
  %65 = call double @llvm.fmuladd.f64(double %64, double %56, double %63)
  store double %65, ptr %62, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %36
  %67 = load i64, ptr %14, align 8, !tbaa !14
  %68 = add i64 %67, 1
  store i64 %68, ptr %14, align 8, !tbaa !14
  br label %31, !llvm.loop !17

69:                                               ; preds = %35
  br label %70

70:                                               ; preds = %69
  %71 = load i64, ptr %12, align 8, !tbaa !14
  %72 = add i64 %71, 1
  store i64 %72, ptr %12, align 8, !tbaa !14
  br label %25, !llvm.loop !19

73:                                               ; preds = %29
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret i32 0
}

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !10, i64 32, !10, i64 40}
!13 = !{!"long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !13, i64 24}
!16 = !{!12, !10, i64 40}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

@uy_jmin = external local_unnamed_addr constant i64, align 8

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local noundef i32 @uy_pres(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, double noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load i64, ptr %7, align 8, !tbaa !11
  %9 = load i64, ptr @uy_jmin, align 8, !tbaa !12
  %.not23 = icmp ugt i64 %9, %8
  br i1 %.not23, label %._crit_edge25, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %4
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = load double, ptr %10, align 8, !tbaa !13
  %.not2021 = icmp eq i64 %6, 0
  %12 = fneg double %2
  %13 = fdiv double %12, %11
  br i1 %.not2021, label %._crit_edge25, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %14 = add i64 %6, 1
  %umax = tail call i64 @llvm.umax.i64(i64 %14, i64 2)
  %15 = shl i64 %umax, 3
  %16 = add i64 %umax, -1
  %min.iters.check = icmp ult i64 %14, 5
  %n.vec = and i64 %16, -4
  %ind.end = or disjoint i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <2 x double> poison, double %13, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %16, %n.vec
  %17 = and i64 %umax, 1
  %lcmp.mod.not.not = icmp eq i64 %17, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %.01924 = phi i64 [ %45, %._crit_edge ], [ %9, %.preheader.preheader ]
  %18 = getelementptr ptr, ptr %1, i64 %.01924
  %19 = getelementptr i8, ptr %18, i64 -8
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %18, align 8, !tbaa !14
  %22 = getelementptr inbounds ptr, ptr %3, i64 %.01924
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.preheader
  %.022.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %.preheader ], [ %ind.end, %middle.block ]
  %.neg = add i64 %.022.ph, 1
  br i1 %lcmp.mod.not.not, label %scalar.ph.prol, label %scalar.ph.prol.loopexit

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader
  %24 = getelementptr inbounds double, ptr %20, i64 %.022.ph
  %25 = load double, ptr %24, align 8, !tbaa !16
  %26 = getelementptr inbounds double, ptr %21, i64 %.022.ph
  %27 = load double, ptr %26, align 8, !tbaa !16
  %28 = fsub double %27, %25
  %29 = getelementptr inbounds double, ptr %23, i64 %.022.ph
  %30 = load double, ptr %29, align 8, !tbaa !16
  %31 = tail call double @llvm.fmuladd.f64(double %13, double %28, double %30)
  store double %31, ptr %29, align 8, !tbaa !16
  %32 = add nuw i64 %.022.ph, 1
  br label %scalar.ph.prol.loopexit

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.022.unr = phi i64 [ %.022.ph, %scalar.ph.preheader ], [ %32, %scalar.ph.prol ]
  %33 = icmp eq i64 %umax, %.neg
  br i1 %33, label %._crit_edge, label %scalar.ph

vector.memcheck:                                  ; preds = %.preheader
  %scevgep = getelementptr i8, ptr %23, i64 8
  %scevgep27 = getelementptr i8, ptr %23, i64 %15
  %scevgep28 = getelementptr i8, ptr %20, i64 8
  %scevgep29 = getelementptr i8, ptr %20, i64 %15
  %scevgep30 = getelementptr i8, ptr %21, i64 8
  %scevgep31 = getelementptr i8, ptr %21, i64 %15
  %bound0 = icmp ult ptr %scevgep, %scevgep29
  %bound1 = icmp ult ptr %scevgep28, %scevgep27
  %found.conflict = and i1 %bound0, %bound1
  %bound032 = icmp ult ptr %scevgep, %scevgep31
  %bound133 = icmp ult ptr %scevgep30, %scevgep27
  %found.conflict34 = and i1 %bound032, %bound133
  %conflict.rdx = or i1 %found.conflict, %found.conflict34
  br i1 %conflict.rdx, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %vector.memcheck, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.memcheck ]
  %offset.idx = or disjoint i64 %index, 1
  %34 = getelementptr inbounds double, ptr %20, i64 %offset.idx
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load = load <2 x double>, ptr %34, align 8, !tbaa !16, !alias.scope !17
  %wide.load35 = load <2 x double>, ptr %35, align 8, !tbaa !16, !alias.scope !17
  %36 = getelementptr inbounds double, ptr %21, i64 %offset.idx
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %wide.load36 = load <2 x double>, ptr %36, align 8, !tbaa !16, !alias.scope !20
  %wide.load37 = load <2 x double>, ptr %37, align 8, !tbaa !16, !alias.scope !20
  %38 = fsub <2 x double> %wide.load36, %wide.load
  %39 = fsub <2 x double> %wide.load37, %wide.load35
  %40 = getelementptr inbounds double, ptr %23, i64 %offset.idx
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %wide.load38 = load <2 x double>, ptr %40, align 8, !tbaa !16, !alias.scope !22, !noalias !24
  %wide.load39 = load <2 x double>, ptr %41, align 8, !tbaa !16, !alias.scope !22, !noalias !24
  %42 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %38, <2 x double> %wide.load38)
  %43 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %39, <2 x double> %wide.load39)
  store <2 x double> %42, ptr %40, align 8, !tbaa !16, !alias.scope !22, !noalias !24
  store <2 x double> %43, ptr %41, align 8, !tbaa !16, !alias.scope !22, !noalias !24
  %index.next = add nuw i64 %index, 4
  %44 = icmp eq i64 %index.next, %n.vec
  br i1 %44, label %middle.block, label %vector.body, !llvm.loop !25

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge25:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %4
  ret i32 0

._crit_edge:                                      ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %45 = add i64 %.01924, 1
  %.not = icmp ugt i64 %45, %8
  br i1 %.not, label %._crit_edge25, label %.preheader, !llvm.loop !29

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %.022 = phi i64 [ %63, %scalar.ph ], [ %.022.unr, %scalar.ph.prol.loopexit ]
  %46 = getelementptr inbounds double, ptr %20, i64 %.022
  %47 = load double, ptr %46, align 8, !tbaa !16
  %48 = getelementptr inbounds double, ptr %21, i64 %.022
  %49 = load double, ptr %48, align 8, !tbaa !16
  %50 = fsub double %49, %47
  %51 = getelementptr inbounds double, ptr %23, i64 %.022
  %52 = load double, ptr %51, align 8, !tbaa !16
  %53 = tail call double @llvm.fmuladd.f64(double %13, double %50, double %52)
  store double %53, ptr %51, align 8, !tbaa !16
  %54 = add nuw i64 %.022, 1
  %55 = getelementptr inbounds double, ptr %20, i64 %54
  %56 = load double, ptr %55, align 8, !tbaa !16
  %57 = getelementptr inbounds double, ptr %21, i64 %54
  %58 = load double, ptr %57, align 8, !tbaa !16
  %59 = fsub double %58, %56
  %60 = getelementptr inbounds double, ptr %23, i64 %54
  %61 = load double, ptr %60, align 8, !tbaa !16
  %62 = tail call double @llvm.fmuladd.f64(double %13, double %59, double %61)
  store double %62, ptr %60, align 8, !tbaa !16
  %63 = add nuw i64 %.022, 2
  %exitcond.1 = icmp eq i64 %14, %63
  br i1 %exitcond.1, label %._crit_edge, label %scalar.ph, !llvm.loop !30
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #2

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !10, i64 16}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!10, !10, i64 0}
!13 = !{!6, !7, i64 40}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18}
!18 = distinct !{!18, !19}
!19 = distinct !{!19, !"LVerDomain"}
!20 = !{!21}
!21 = distinct !{!21, !19}
!22 = !{!23}
!23 = distinct !{!23, !19}
!24 = !{!18, !21}
!25 = distinct !{!25, !26, !27, !28}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!"llvm.loop.isvectorized", i32 1}
!28 = !{!"llvm.loop.unroll.runtime.disable"}
!29 = distinct !{!29, !26}
!30 = distinct !{!30, !26, !27}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass