; LLVM IR from libxsmm/libxsmm :: src (generator_matequation_regblocks_avx_avx512)

; 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.libxsmm_meqn_elem = type { ptr, ptr, ptr, ptr, i32, %union.libxsmm_meqn_info, i32, i32, %struct.libxsmm_meqn_tmp_info, i32, i32, i32, %union.libxsmm_meqn_fusion_info }
%union.libxsmm_meqn_info = type { %struct.libxsmm_meqn_arg }
%struct.libxsmm_meqn_arg = type { i32, i32, i32, i32, i32, i32, i32, %struct.libxsmm_matrix_arg_attributes }
%struct.libxsmm_matrix_arg_attributes = type { i32, i32, i32, i32 }
%struct.libxsmm_meqn_tmp_info = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%union.libxsmm_meqn_fusion_info = type { %struct.libxsmm_meqn_xgemm_fusion_info }
%struct.libxsmm_meqn_xgemm_fusion_info = type { i32, i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_has_hf8_input(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %5, i32 0, i32 4
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = icmp eq i32 %7, 8
  br i1 %8, label %9, label %18

9:                                                ; preds = %2
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %10, i32 0, i32 5
  %12 = getelementptr inbounds %struct.libxsmm_meqn_arg, ptr %11, i32 0, i32 5
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 5
  br i1 %14, label %15, label %17

15:                                               ; preds = %9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 1, ptr %16, align 4, !tbaa !10
  br label %17

17:                                               ; preds = %15, %9
  br label %64

18:                                               ; preds = %2
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %19, i32 0, i32 4
  %21 = load i32, ptr %20, align 8, !tbaa !9
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %28

23:                                               ; preds = %18
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libxsmm_generator_has_hf8_input(ptr noundef %26, ptr noundef %27)
  br label %63

28:                                               ; preds = %18
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %29, i32 0, i32 4
  %31 = load i32, ptr %30, align 8, !tbaa !9
  %32 = icmp eq i32 %31, 2
  br i1 %32, label %33, label %42

33:                                               ; preds = %28
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libxsmm_generator_has_hf8_input(ptr noundef %36, ptr noundef %37)
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libxsmm_generator_has_hf8_input(ptr noundef %40, ptr noundef %41)
  br label %62

42:                                               ; preds = %28
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %43, i32 0, i32 4
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = icmp eq i32 %45, 4
  br i1 %46, label %47, label %60

47:                                               ; preds = %42
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libxsmm_generator_has_hf8_input(ptr noundef %50, ptr noundef %51)
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libxsmm_generator_has_hf8_input(ptr noundef %54, ptr noundef %55)
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  call void @libxsmm_generator_has_hf8_input(ptr noundef %58, ptr noundef %59)
  br label %61

60:                                               ; preds = %42
  br label %61

61:                                               ; preds = %60, %47
  br label %62

62:                                               ; preds = %61, %33
  br label %63

63:                                               ; preds = %62, %23
  br label %64

64:                                               ; preds = %63, %17
  ret void
}

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

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}


; 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @libxsmm_generator_has_hf8_input(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  br label %tailrecurse

tailrecurse:                                      ; preds = %tailrecurse.backedge, %2
  %.tr = phi ptr [ %0, %2 ], [ %.tr.be, %tailrecurse.backedge ]
  %3 = getelementptr inbounds i8, ptr %.tr, i64 32
  %4 = load i32, ptr %3, align 8, !tbaa !5
  switch i32 %4, label %.loopexit [
    i32 8, label %5
    i32 1, label %tailrecurse.backedge
    i32 2, label %tailrecurse.backedge.sink.split
    i32 4, label %12
  ]

5:                                                ; preds = %tailrecurse
  %6 = getelementptr inbounds i8, ptr %.tr, i64 56
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = icmp eq i32 %7, 5
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %5
  store i32 1, ptr %1, align 4, !tbaa !8
  br label %.loopexit

tailrecurse.backedge.sink.split:                  ; preds = %tailrecurse, %12
  %.tr.sink = phi ptr [ %14, %12 ], [ %.tr, %tailrecurse ]
  %.sink = phi i64 [ 16, %12 ], [ 8, %tailrecurse ]
  %10 = load ptr, ptr %.tr.sink, align 8, !tbaa !5
  tail call void @libxsmm_generator_has_hf8_input(ptr noundef %10, ptr noundef %1)
  %11 = getelementptr inbounds i8, ptr %.tr, i64 %.sink
  br label %tailrecurse.backedge

tailrecurse.backedge:                             ; preds = %tailrecurse.backedge.sink.split, %tailrecurse
  %.tr.be.in = phi ptr [ %.tr, %tailrecurse ], [ %11, %tailrecurse.backedge.sink.split ]
  %.tr.be = load ptr, ptr %.tr.be.in, align 8, !tbaa !5
  br label %tailrecurse

12:                                               ; preds = %tailrecurse
  %13 = load ptr, ptr %.tr, align 8, !tbaa !5
  tail call void @libxsmm_generator_has_hf8_input(ptr noundef %13, ptr noundef %1)
  %14 = getelementptr inbounds i8, ptr %.tr, i64 8
  br label %tailrecurse.backedge.sink.split

.loopexit:                                        ; preds = %tailrecurse, %5, %9
  ret void
}

attributes #0 = { nofree 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" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass