; LLVM IR from OpenFAST/openfast :: modules/map/src (lineroutines)

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

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

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

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

16:                                               ; preds = %45, %7
  %17 = load i32, ptr %15, align 4, !tbaa !9
  %18 = load i32, ptr %14, align 4, !tbaa !9
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %20, label %48

20:                                               ; preds = %16
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = load i32, ptr %15, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds double, ptr %21, i64 %23
  store double 0.000000e+00, ptr %24, align 8, !tbaa !11
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = load i32, ptr %15, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %25, i64 %27
  store double 0.000000e+00, ptr %28, align 8, !tbaa !11
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = load i32, ptr %15, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds double, ptr %29, i64 %31
  store double 0.000000e+00, ptr %32, align 8, !tbaa !11
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = load i32, ptr %15, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds double, ptr %33, i64 %35
  store double 0.000000e+00, ptr %36, align 8, !tbaa !11
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = load i32, ptr %15, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds double, ptr %37, i64 %39
  store double 0.000000e+00, ptr %40, align 8, !tbaa !11
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds double, ptr %41, i64 %43
  store double 0.000000e+00, ptr %44, align 8, !tbaa !11
  br label %45

45:                                               ; preds = %20
  %46 = load i32, ptr %15, align 4, !tbaa !9
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %15, align 4, !tbaa !9
  br label %16, !llvm.loop !13

48:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #2
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local noundef i32 @reset_force_to_zero(ptr nocapture noundef writeonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = ptrtoint ptr %5 to i64
  %9 = ptrtoint ptr %4 to i64
  %10 = ptrtoint ptr %3 to i64
  %11 = ptrtoint ptr %2 to i64
  %12 = ptrtoint ptr %0 to i64
  %13 = ptrtoint ptr %1 to i64
  %14 = icmp sgt i32 %6, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %7
  %wide.trip.count = zext nneg i32 %6 to i64
  %min.iters.check = icmp ult i32 %6, 32
  br i1 %min.iters.check, label %.lr.ph.preheader43, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %15 = sub i64 %13, %12
  %diff.check = icmp ult i64 %15, 32
  %16 = sub i64 %11, %12
  %diff.check16 = icmp ult i64 %16, 32
  %conflict.rdx = or i1 %diff.check, %diff.check16
  %17 = sub i64 %10, %12
  %diff.check17 = icmp ult i64 %17, 32
  %conflict.rdx18 = or i1 %conflict.rdx, %diff.check17
  %18 = sub i64 %9, %12
  %diff.check19 = icmp ult i64 %18, 32
  %conflict.rdx20 = or i1 %conflict.rdx18, %diff.check19
  %19 = sub i64 %8, %12
  %diff.check21 = icmp ult i64 %19, 32
  %conflict.rdx22 = or i1 %conflict.rdx20, %diff.check21
  %20 = sub i64 %11, %13
  %diff.check23 = icmp ult i64 %20, 32
  %conflict.rdx24 = or i1 %conflict.rdx22, %diff.check23
  %21 = sub i64 %10, %13
  %diff.check25 = icmp ult i64 %21, 32
  %conflict.rdx26 = or i1 %conflict.rdx24, %diff.check25
  %22 = sub i64 %9, %13
  %diff.check27 = icmp ult i64 %22, 32
  %conflict.rdx28 = or i1 %conflict.rdx26, %diff.check27
  %23 = sub i64 %8, %13
  %diff.check29 = icmp ult i64 %23, 32
  %conflict.rdx30 = or i1 %conflict.rdx28, %diff.check29
  %24 = sub i64 %10, %11
  %diff.check31 = icmp ult i64 %24, 32
  %conflict.rdx32 = or i1 %conflict.rdx30, %diff.check31
  %25 = sub i64 %9, %11
  %diff.check33 = icmp ult i64 %25, 32
  %conflict.rdx34 = or i1 %conflict.rdx32, %diff.check33
  %26 = sub i64 %8, %11
  %diff.check35 = icmp ult i64 %26, 32
  %conflict.rdx36 = or i1 %conflict.rdx34, %diff.check35
  %27 = sub i64 %9, %10
  %diff.check37 = icmp ult i64 %27, 32
  %conflict.rdx38 = or i1 %conflict.rdx36, %diff.check37
  %28 = sub i64 %8, %10
  %diff.check39 = icmp ult i64 %28, 32
  %conflict.rdx40 = or i1 %conflict.rdx38, %diff.check39
  %29 = sub i64 %8, %9
  %diff.check41 = icmp ult i64 %29, 32
  %conflict.rdx42 = or i1 %conflict.rdx40, %diff.check41
  br i1 %conflict.rdx42, label %.lr.ph.preheader43, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %30 = getelementptr inbounds double, ptr %0, i64 %index
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  store <2 x double> zeroinitializer, ptr %30, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %31, align 8, !tbaa !5
  %32 = getelementptr inbounds double, ptr %1, i64 %index
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  store <2 x double> zeroinitializer, ptr %32, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %33, align 8, !tbaa !5
  %34 = getelementptr inbounds double, ptr %2, i64 %index
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  store <2 x double> zeroinitializer, ptr %34, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %3, i64 %index
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  store <2 x double> zeroinitializer, ptr %36, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %37, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %4, i64 %index
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  store <2 x double> zeroinitializer, ptr %38, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %39, align 8, !tbaa !5
  %40 = getelementptr inbounds double, ptr %5, i64 %index
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  store <2 x double> zeroinitializer, ptr %40, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %41, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %42 = icmp eq i64 %index.next, %n.vec
  br i1 %42, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader43

.lr.ph.preheader43:                               ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader43
  %43 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.ph
  store double 0.000000e+00, ptr %43, align 8, !tbaa !5
  %44 = getelementptr inbounds double, ptr %1, i64 %indvars.iv.ph
  store double 0.000000e+00, ptr %44, align 8, !tbaa !5
  %45 = getelementptr inbounds double, ptr %2, i64 %indvars.iv.ph
  store double 0.000000e+00, ptr %45, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.ph
  store double 0.000000e+00, ptr %46, align 8, !tbaa !5
  %47 = getelementptr inbounds double, ptr %4, i64 %indvars.iv.ph
  store double 0.000000e+00, ptr %47, align 8, !tbaa !5
  %48 = getelementptr inbounds double, ptr %5, i64 %indvars.iv.ph
  store double 0.000000e+00, ptr %48, align 8, !tbaa !5
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader43
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader43 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %49 = add nsw i64 %wide.trip.count, -1
  %50 = icmp eq i64 %indvars.iv.ph, %49
  br i1 %50, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %51 = getelementptr inbounds double, ptr %0, i64 %indvars.iv
  store double 0.000000e+00, ptr %51, align 8, !tbaa !5
  %52 = getelementptr inbounds double, ptr %1, i64 %indvars.iv
  store double 0.000000e+00, ptr %52, align 8, !tbaa !5
  %53 = getelementptr inbounds double, ptr %2, i64 %indvars.iv
  store double 0.000000e+00, ptr %53, align 8, !tbaa !5
  %54 = getelementptr inbounds double, ptr %3, i64 %indvars.iv
  store double 0.000000e+00, ptr %54, align 8, !tbaa !5
  %55 = getelementptr inbounds double, ptr %4, i64 %indvars.iv
  store double 0.000000e+00, ptr %55, align 8, !tbaa !5
  %56 = getelementptr inbounds double, ptr %5, i64 %indvars.iv
  store double 0.000000e+00, ptr %56, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %57 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %57, align 8, !tbaa !5
  %58 = getelementptr inbounds double, ptr %1, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %58, align 8, !tbaa !5
  %59 = getelementptr inbounds double, ptr %2, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %59, align 8, !tbaa !5
  %60 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %60, align 8, !tbaa !5
  %61 = getelementptr inbounds double, ptr %4, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %61, align 8, !tbaa !5
  %62 = getelementptr inbounds double, ptr %5, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %62, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
  br i1 %exitcond.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %7
  ret i32 0
}

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: write) 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" }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11}


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