; LLVM IR from CLASS-SZ/class_sz :: class-sz/tools (r8lib)

; 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @r8block_zeros_new(i32 noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = mul nsw i32 %11, %12
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = mul nsw i32 %13, %14
  %16 = sext i32 %15 to i64
  %17 = mul i64 %16, 8
  %18 = call noalias ptr @malloc(i64 noundef %17) #4
  store ptr %18, ptr %7, align 8, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %56, %3
  %20 = load i32, ptr %10, align 4, !tbaa !5
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %23, label %59

23:                                               ; preds = %19
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %52, %23
  %25 = load i32, ptr %9, align 4, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %28, label %55

28:                                               ; preds = %24
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %48, %28
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %33, label %51

33:                                               ; preds = %29
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = mul nsw i32 %36, %37
  %39 = add nsw i32 %35, %38
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = mul nsw i32 %40, %41
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = mul nsw i32 %42, %43
  %45 = add nsw i32 %39, %44
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds double, ptr %34, i64 %46
  store double 0.000000e+00, ptr %47, align 8, !tbaa !11
  br label %48

48:                                               ; preds = %33
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %8, align 4, !tbaa !5
  br label %29, !llvm.loop !13

51:                                               ; preds = %29
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %9, align 4, !tbaa !5
  br label %24, !llvm.loop !15

55:                                               ; preds = %24
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %10, align 4, !tbaa !5
  br label %19, !llvm.loop !16

59:                                               ; preds = %19
  %60 = load ptr, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret ptr %60
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 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 }
attributes #4 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias noundef ptr @r8block_zeros_new(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = mul nsw i32 %1, %0
  %5 = mul nsw i32 %4, %2
  %6 = sext i32 %5 to i64
  %7 = shl nsw i64 %6, 3
  %8 = tail call noalias ptr @malloc(i64 noundef %7) #2
  %9 = icmp sgt i32 %2, 0
  %10 = icmp sgt i32 %1, 0
  %or.cond = and i1 %9, %10
  %11 = icmp sgt i32 %0, 0
  %or.cond37 = and i1 %or.cond, %11
  br i1 %or.cond37, label %.preheader23.us.us.preheader, label %._crit_edge

.preheader23.us.us.preheader:                     ; preds = %3
  %wide.trip.count = zext nneg i32 %0 to i64
  %12 = add nsw i64 %wide.trip.count, -1
  %13 = mul i32 %1, %0
  %min.iters.check = icmp ult i32 %0, 8
  %14 = trunc nsw i64 %12 to i32
  %15 = icmp ugt i64 %12, 4294967295
  %n.vec = and i64 %wide.trip.count, 2147483644
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader23.us.us

.preheader23.us.us:                               ; preds = %.preheader23.us.us.preheader, %._crit_edge26.split.us.us.us
  %.027.us.us = phi i32 [ %55, %._crit_edge26.split.us.us.us ], [ 0, %.preheader23.us.us.preheader ]
  %16 = mul i32 %13, %.027.us.us
  %17 = mul i32 %.027.us.us, %1
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %._crit_edge.us.us.us, %.preheader23.us.us
  %.01925.us.us.us = phi i32 [ 0, %.preheader23.us.us ], [ %54, %._crit_edge.us.us.us ]
  %reass.add.us.us.us = add i32 %.01925.us.us.us, %17
  %reass.mul.us.us.us = mul i32 %reass.add.us.us.us, %0
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.preheader.us.us.us
  %18 = mul i32 %.01925.us.us.us, %0
  %19 = add i32 %16, %18
  %20 = add i32 %19, %14
  %21 = icmp slt i32 %20, %19
  %22 = or i1 %21, %15
  br i1 %22, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %vector.scevcheck, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.scevcheck ]
  %23 = trunc i64 %index to i32
  %24 = add i32 %reass.mul.us.us.us, %23
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds double, ptr %8, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  store <2 x double> zeroinitializer, ptr %26, align 8, !tbaa !5
  store <2 x double> zeroinitializer, ptr %27, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !9

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

scalar.ph.preheader:                              ; preds = %middle.block, %vector.scevcheck, %.preheader.us.us.us
  %indvars.iv.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.preheader.us.us.us ], [ %n.vec, %middle.block ]
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %29 = trunc nuw nsw i64 %indvars.iv.prol to i32
  %30 = add i32 %reass.mul.us.us.us, %29
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds double, ptr %8, i64 %31
  store double 0.000000e+00, ptr %32, align 8, !tbaa !5
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !13

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %33 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %34 = icmp ugt i64 %33, -4
  br i1 %34, label %._crit_edge.us.us.us, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  %36 = add i32 %reass.mul.us.us.us, %35
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds double, ptr %8, i64 %37
  store double 0.000000e+00, ptr %38, align 8, !tbaa !5
  %39 = trunc i64 %indvars.iv to i32
  %40 = add i32 %39, 1
  %41 = add i32 %reass.mul.us.us.us, %40
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds double, ptr %8, i64 %42
  store double 0.000000e+00, ptr %43, align 8, !tbaa !5
  %44 = trunc i64 %indvars.iv to i32
  %45 = add i32 %44, 2
  %46 = add i32 %reass.mul.us.us.us, %45
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds double, ptr %8, i64 %47
  store double 0.000000e+00, ptr %48, align 8, !tbaa !5
  %49 = trunc i64 %indvars.iv to i32
  %50 = add i32 %49, 3
  %51 = add i32 %reass.mul.us.us.us, %50
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds double, ptr %8, i64 %52
  store double 0.000000e+00, ptr %53, align 8, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %._crit_edge.us.us.us, label %scalar.ph, !llvm.loop !15

._crit_edge.us.us.us:                             ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %54 = add nuw nsw i32 %.01925.us.us.us, 1
  %exitcond35.not = icmp eq i32 %54, %1
  br i1 %exitcond35.not, label %._crit_edge26.split.us.us.us, label %.preheader.us.us.us, !llvm.loop !16

._crit_edge26.split.us.us.us:                     ; preds = %._crit_edge.us.us.us
  %55 = add nuw nsw i32 %.027.us.us, 1
  %exitcond36.not = icmp eq i32 %55, %2
  br i1 %exitcond36.not, label %._crit_edge, label %.preheader23.us.us, !llvm.loop !17

._crit_edge:                                      ; preds = %._crit_edge26.split.us.us.us, %3
  ret ptr %8
}

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) 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 allocsize(0) }

!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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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