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

; 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 }
%struct.libxsmm_meqn_unary_op = type { i32, i32, i32, i32 }
%struct.libxsmm_meqn_binary_op = type { i32, i32, i32, i32, i32, i32 }
%struct.libxsmm_meqn_ternary_op = type { i32, i32, i32, i32, i32, i32 }

@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [42 x i8], align 1

declare i32 @printf(ptr noundef, ...) #0

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

7:                                                ; preds = %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %25

12:                                               ; preds = %7
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %13, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %25

17:                                               ; preds = %12
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %18, i32 0, i32 5
  %20 = getelementptr inbounds %struct.libxsmm_meqn_arg, ptr %19, i32 0, i32 5
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %22, i32 0, i32 8
  %24 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %23, i32 0, i32 4
  store i32 %21, ptr %24, align 8, !tbaa !9
  br label %27

25:                                               ; preds = %12, %7
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %27

27:                                               ; preds = %25, %17
  br label %134

28:                                               ; preds = %1
  %29 = load ptr, ptr %2, 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, 1
  br i1 %32, label %33, label %58

33:                                               ; preds = %28
  %34 = load ptr, ptr %2, 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 = icmp ne ptr %36, null
  br i1 %37, label %38, label %49

38:                                               ; preds = %33
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %39, i32 0, i32 5
  %41 = getelementptr inbounds %struct.libxsmm_meqn_unary_op, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %43, i32 0, i32 8
  %45 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %44, i32 0, i32 4
  store i32 %42, ptr %45, align 8, !tbaa !9
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %48)
  br label %57

49:                                               ; preds = %33
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %56

54:                                               ; preds = %49
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %56

56:                                               ; preds = %54, %49
  br label %57

57:                                               ; preds = %56, %38
  br label %133

58:                                               ; preds = %28
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %59, i32 0, i32 4
  %61 = load i32, ptr %60, align 8, !tbaa !9
  %62 = icmp eq i32 %61, 2
  br i1 %62, label %63, label %90

63:                                               ; preds = %58
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %87

68:                                               ; preds = %63
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %69, i32 0, i32 1
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %87

73:                                               ; preds = %68
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %74, i32 0, i32 5
  %76 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %75, i32 0, i32 2
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %78, i32 0, i32 8
  %80 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %79, i32 0, i32 4
  store i32 %77, ptr %80, align 8, !tbaa !9
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %83)
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %86)
  br label %89

87:                                               ; preds = %68, %63
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %89

89:                                               ; preds = %87, %73
  br label %132

90:                                               ; preds = %58
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %91, i32 0, i32 4
  %93 = load i32, ptr %92, align 8, !tbaa !9
  %94 = icmp eq i32 %93, 4
  br i1 %94, label %95, label %130

95:                                               ; preds = %90
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !9
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %127

100:                                              ; preds = %95
  %101 = load ptr, ptr %2, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %101, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %127

105:                                              ; preds = %100
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %106, i32 0, i32 2
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %127

110:                                              ; preds = %105
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %111, i32 0, i32 5
  %113 = getelementptr inbounds %struct.libxsmm_meqn_ternary_op, ptr %112, i32 0, i32 2
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %115, i32 0, i32 8
  %117 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %116, i32 0, i32 4
  store i32 %114, ptr %117, align 8, !tbaa !9
  %118 = load ptr, ptr %2, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %118, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8, !tbaa !9
  call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %120)
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %121, i32 0, i32 1
  %123 = load ptr, ptr %122, align 8, !tbaa !9
  call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %123)
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %124, i32 0, i32 2
  %126 = load ptr, ptr %125, align 8, !tbaa !9
  call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %126)
  br label %129

127:                                              ; preds = %105, %100, %95
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %129

129:                                              ; preds = %127, %110
  br label %131

130:                                              ; preds = %90
  br label %131

131:                                              ; preds = %130, %129
  br label %132

132:                                              ; preds = %131, %89
  br label %133

133:                                              ; preds = %132, %57
  br label %134

134:                                              ; preds = %133, %27
  ret void
}

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


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

@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @libxsmm_meqn_propagate_tmp_info(ptr nocapture noundef %0) local_unnamed_addr #1 {
  br label %tailrecurse

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

4:                                                ; preds = %tailrecurse
  %5 = load ptr, ptr %.tr, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %15

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %.tr, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %15

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %.tr, i64 56
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %.tr, i64 104
  store i32 %13, ptr %14, align 8, !tbaa !5
  br label %.loopexit

15:                                               ; preds = %7, %4
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %.loopexit

17:                                               ; preds = %tailrecurse
  %18 = load ptr, ptr %.tr, align 8, !tbaa !5
  %.not31 = icmp eq ptr %18, null
  br i1 %.not31, label %23, label %19

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %.tr, i64 44
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %.tr, i64 104
  store i32 %21, ptr %22, align 8, !tbaa !5
  br label %tailrecurse.backedge

tailrecurse.backedge:                             ; preds = %19, %33, %48
  %.tr.be = phi ptr [ %18, %19 ], [ %37, %33 ], [ %53, %48 ]
  br label %tailrecurse

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %.tr, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %.not32 = icmp eq ptr %25, null
  br i1 %.not32, label %.loopexit, label %26

26:                                               ; preds = %23
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %.loopexit

28:                                               ; preds = %tailrecurse
  %29 = load ptr, ptr %.tr, align 8, !tbaa !5
  %.not29 = icmp eq ptr %29, null
  br i1 %.not29, label %38, label %30

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %.tr, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %.not30 = icmp eq ptr %32, null
  br i1 %.not30, label %38, label %33

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %.tr, i64 44
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %.tr, i64 104
  store i32 %35, ptr %36, align 8, !tbaa !5
  tail call void @libxsmm_meqn_propagate_tmp_info(ptr noundef nonnull %29)
  %37 = load ptr, ptr %31, align 8, !tbaa !5
  br label %tailrecurse.backedge

38:                                               ; preds = %30, %28
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %.loopexit

40:                                               ; preds = %tailrecurse
  %41 = load ptr, ptr %.tr, align 8, !tbaa !5
  %.not = icmp eq ptr %41, null
  br i1 %.not, label %54, label %42

42:                                               ; preds = %40
  %43 = getelementptr inbounds i8, ptr %.tr, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %.not27 = icmp eq ptr %44, null
  br i1 %.not27, label %54, label %45

45:                                               ; preds = %42
  %46 = getelementptr inbounds i8, ptr %.tr, i64 16
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %.not28 = icmp eq ptr %47, null
  br i1 %.not28, label %54, label %48

48:                                               ; preds = %45
  %49 = getelementptr inbounds i8, ptr %.tr, i64 44
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %.tr, i64 104
  store i32 %50, ptr %51, align 8, !tbaa !5
  tail call void @libxsmm_meqn_propagate_tmp_info(ptr noundef nonnull %41)
  %52 = load ptr, ptr %43, align 8, !tbaa !5
  tail call void @libxsmm_meqn_propagate_tmp_info(ptr noundef %52)
  %53 = load ptr, ptr %46, align 8, !tbaa !5
  br label %tailrecurse.backedge

54:                                               ; preds = %45, %42, %40
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  br label %.loopexit

.loopexit:                                        ; preds = %tailrecurse, %23, %26, %54, %38, %11, %15
  ret void
}

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


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