; LLVM IR from introlab/odas :: src/init (hit)

; 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.tdoas_obj = type { i32, i32, ptr, ptr, ptr }
%struct.taus_obj = type { i32, i32, ptr, ptr }
%struct.area_obj = type { i32, ptr }
%struct.spatialmasks_obj = type { i32, i32, ptr }
%struct.areas_obj = type { i32, i32, i32, ptr }

; 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 void @hit_area_pair(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
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #2
  %23 = load ptr, ptr %11, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.tdoas_obj, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !11
  store i32 %25, ptr %16, align 4, !tbaa !9
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.taus_obj, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !13
  store i32 %28, ptr %18, align 4, !tbaa !9
  %29 = load i32, ptr %18, align 4, !tbaa !9
  %30 = load i32, ptr %16, align 4, !tbaa !9
  %31 = udiv i32 %29, %30
  store i32 %31, ptr %20, align 4, !tbaa !9
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.taus_obj, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !15
  store i32 %34, ptr %21, align 4, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.area_obj, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %38 = load i32, ptr %14, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds float, ptr %37, i64 %39
  store float 0.000000e+00, ptr %40, align 4, !tbaa !18
  store i32 0, ptr %22, align 4, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %96, %7
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = load i32, ptr %16, align 4, !tbaa !9
  %44 = icmp ult i32 %42, %43
  br i1 %44, label %45, label %99

45:                                               ; preds = %41
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %92, %45
  %47 = load i32, ptr %19, align 4, !tbaa !9
  %48 = load i32, ptr %20, align 4, !tbaa !9
  %49 = icmp ult i32 %47, %48
  br i1 %49, label %50, label %95

50:                                               ; preds = %46
  %51 = load i32, ptr %15, align 4, !tbaa !9
  %52 = load i32, ptr %20, align 4, !tbaa !9
  %53 = mul i32 %51, %52
  %54 = load i32, ptr %19, align 4, !tbaa !9
  %55 = add i32 %53, %54
  store i32 %55, ptr %17, align 4, !tbaa !9
  %56 = load ptr, ptr %13, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.spatialmasks_obj, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = load i32, ptr %15, align 4, !tbaa !9
  %60 = load i32, ptr %21, align 4, !tbaa !9
  %61 = mul i32 %59, %60
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = add i32 %61, %62
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %58, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !22
  %67 = sext i8 %66 to i32
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %91

69:                                               ; preds = %50
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.areas_obj, ptr %70, i32 0, i32 3
  %72 = load ptr, ptr %71, align 8, !tbaa !23
  %73 = load i32, ptr %17, align 4, !tbaa !9
  %74 = load i32, ptr %21, align 4, !tbaa !9
  %75 = mul i32 %73, %74
  %76 = load i32, ptr %14, align 4, !tbaa !9
  %77 = add i32 %75, %76
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds float, ptr %72, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !18
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.area_obj, ptr %81, i32 0, i32 1
  %83 = load ptr, ptr %82, align 8, !tbaa !16
  %84 = load i32, ptr %14, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds float, ptr %83, i64 %85
  %87 = load float, ptr %86, align 4, !tbaa !18
  %88 = fadd float %87, %80
  store float %88, ptr %86, align 4, !tbaa !18
  %89 = load i32, ptr %22, align 4, !tbaa !9
  %90 = add i32 %89, 1
  store i32 %90, ptr %22, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %69, %50
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %19, align 4, !tbaa !9
  %94 = add i32 %93, 1
  store i32 %94, ptr %19, align 4, !tbaa !9
  br label %46, !llvm.loop !25

95:                                               ; preds = %46
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = add i32 %97, 1
  store i32 %98, ptr %15, align 4, !tbaa !9
  br label %41, !llvm.loop !27

99:                                               ; preds = %41
  %100 = load i32, ptr %22, align 4, !tbaa !9
  %101 = icmp ugt i32 %100, 0
  br i1 %101, label %102, label %113

102:                                              ; preds = %99
  %103 = load i32, ptr %22, align 4, !tbaa !9
  %104 = uitofp i32 %103 to float
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.area_obj, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !16
  %108 = load i32, ptr %14, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds float, ptr %107, i64 %109
  %111 = load float, ptr %110, align 4, !tbaa !18
  %112 = fdiv float %111, %104
  store float %112, ptr %110, align 4, !tbaa !18
  br label %120

113:                                              ; preds = %99
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.area_obj, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !16
  %117 = load i32, ptr %14, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds float, ptr %116, i64 %118
  store float 1.000000e+00, ptr %119, align 4, !tbaa !18
  br label %120

120:                                              ; preds = %113, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #2
  ret void
}

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, !10, i64 0}
!12 = !{!"tdoas_obj", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!14, !10, i64 0}
!14 = !{!"taus_obj", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!15 = !{!14, !10, i64 4}
!16 = !{!17, !6, i64 8}
!17 = !{!"area_obj", !10, i64 0, !6, i64 8}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!21, !6, i64 8}
!21 = !{!"spatialmasks_obj", !10, i64 0, !10, i64 4, !6, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !6, i64 16}
!24 = !{!"areas_obj", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


; 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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @hit_area_pair(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readnone %4, ptr nocapture noundef readonly %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = load i32, ptr %3, align 8, !tbaa !5
  %9 = load i32, ptr %2, align 8, !tbaa !11
  %10 = udiv i32 %9, %8
  %11 = getelementptr inbounds i8, ptr %2, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = zext i32 %6 to i64
  %16 = getelementptr inbounds float, ptr %14, i64 %15
  store float 0.000000e+00, ptr %16, align 4, !tbaa !16
  %.not45 = icmp ugt i32 %8, %9
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  br i1 %.not45, label %.split43.us.thread, label %.split.us

.split.us:                                        ; preds = %7
  %18 = getelementptr inbounds i8, ptr %5, i64 8
  %19 = load ptr, ptr %18, align 8, !tbaa !18
  %20 = zext i32 %10 to i64
  %umax = tail call i32 @llvm.umax.i32(i32 %8, i32 1)
  %wide.trip.count = zext i32 %umax to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %._crit_edge.us, %.split.us
  %21 = phi float [ %47, %._crit_edge.us ], [ 0.000000e+00, %.split.us ]
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %._crit_edge.us ], [ 0, %.split.us ]
  %.038.us = phi i32 [ %.us-phi.us, %._crit_edge.us ], [ 0, %.split.us ]
  %22 = trunc nuw i64 %indvars.iv49 to i32
  %23 = mul i32 %12, %22
  %24 = add i32 %23, %6
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %19, i64 %25
  %27 = mul i32 %10, %22
  %28 = load i8, ptr %26, align 1, !tbaa !20
  %29 = icmp eq i8 %28, 1
  br i1 %29, label %.lr.ph.split.us41, label %._crit_edge.us

.lr.ph.split.us41thread-pre-split:                ; preds = %44
  %.pr = load i8, ptr %26, align 1, !tbaa !20
  br label %.lr.ph.split.us41

.lr.ph.split.us41:                                ; preds = %.preheader.us, %.lr.ph.split.us41thread-pre-split
  %30 = phi i8 [ %.pr, %.lr.ph.split.us41thread-pre-split ], [ 1, %.preheader.us ]
  %31 = phi float [ %45, %.lr.ph.split.us41thread-pre-split ], [ %21, %.preheader.us ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.split.us41thread-pre-split ], [ 0, %.preheader.us ]
  %.136.us = phi i32 [ %.2.us, %.lr.ph.split.us41thread-pre-split ], [ %.038.us, %.preheader.us ]
  %32 = icmp eq i8 %30, 1
  br i1 %32, label %33, label %44

33:                                               ; preds = %.lr.ph.split.us41
  %34 = trunc nuw i64 %indvars.iv to i32
  %35 = add i32 %27, %34
  %36 = load ptr, ptr %17, align 8, !tbaa !21
  %37 = mul i32 %35, %12
  %38 = add i32 %37, %6
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds float, ptr %36, i64 %39
  %41 = load float, ptr %40, align 4, !tbaa !16
  %42 = fadd float %41, %31
  store float %42, ptr %16, align 4, !tbaa !16
  %43 = add i32 %.136.us, 1
  br label %44

44:                                               ; preds = %33, %.lr.ph.split.us41
  %45 = phi float [ %42, %33 ], [ %31, %.lr.ph.split.us41 ]
  %.2.us = phi i32 [ %43, %33 ], [ %.136.us, %.lr.ph.split.us41 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = icmp ult i64 %indvars.iv.next, %20
  br i1 %46, label %.lr.ph.split.us41thread-pre-split, label %._crit_edge.us, !llvm.loop !23

._crit_edge.us:                                   ; preds = %44, %.preheader.us
  %47 = phi float [ %21, %.preheader.us ], [ %45, %44 ]
  %.us-phi.us = phi i32 [ %.038.us, %.preheader.us ], [ %.2.us, %44 ]
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
  br i1 %exitcond.not, label %.split43.us, label %.preheader.us, !llvm.loop !26

.split43.us:                                      ; preds = %._crit_edge.us
  %.not = icmp eq i32 %.us-phi.us, 0
  br i1 %.not, label %.split43.us.thread, label %48

48:                                               ; preds = %.split43.us
  %49 = uitofp i32 %.us-phi.us to float
  %50 = fdiv float %47, %49
  br label %.split43.us.thread

.split43.us.thread:                               ; preds = %7, %.split43.us, %48
  %storemerge = phi float [ %50, %48 ], [ 1.000000e+00, %.split43.us ], [ 1.000000e+00, %7 ]
  store float %storemerge, ptr %16, align 4, !tbaa !16
  ret void
}

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

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 = { 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, !7, i64 0}
!6 = !{!"tdoas_obj", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"taus_obj", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16}
!13 = !{!12, !7, i64 4}
!14 = !{!15, !10, i64 8}
!15 = !{!"area_obj", !7, i64 0, !10, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = !{!19, !10, i64 8}
!19 = !{!"spatialmasks_obj", !7, i64 0, !7, i64 4, !10, i64 8}
!20 = !{!8, !8, i64 0}
!21 = !{!22, !10, i64 16}
!22 = !{!"areas_obj", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!23 = distinct !{!23, !24, !25}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!"llvm.loop.unswitch.partial.disable"}
!26 = distinct !{!26, !24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass