; 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.27 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [12 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_meqn_trv_rpn_print(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 %22

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 %19

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 %19

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.28)
  br label %21

19:                                               ; preds = %12, %7
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %21

21:                                               ; preds = %19, %17
  br label %122

22:                                               ; preds = %1
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %23, i32 0, i32 4
  %25 = load i32, ptr %24, align 8, !tbaa !9
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %50

27:                                               ; preds = %22
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %41

32:                                               ; preds = %27
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  call void @libxsmm_meqn_trv_rpn_print(ptr noundef %35)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %36, i32 0, i32 5
  %38 = getelementptr inbounds %struct.libxsmm_meqn_unary_op, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.29, i32 noundef %39)
  br label %49

41:                                               ; preds = %27
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %48

46:                                               ; preds = %41
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %48

48:                                               ; preds = %46, %41
  br label %49

49:                                               ; preds = %48, %32
  br label %121

50:                                               ; preds = %22
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %51, i32 0, i32 4
  %53 = load i32, ptr %52, align 8, !tbaa !9
  %54 = icmp eq i32 %53, 2
  br i1 %54, label %55, label %80

55:                                               ; preds = %50
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %77

60:                                               ; preds = %55
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %61, i32 0, i32 1
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %77

65:                                               ; preds = %60
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  call void @libxsmm_meqn_trv_rpn_print(ptr noundef %68)
  %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
  call void @libxsmm_meqn_trv_rpn_print(ptr noundef %71)
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %72, i32 0, i32 5
  %74 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.30, i32 noundef %75)
  br label %79

77:                                               ; preds = %60, %55
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %79

79:                                               ; preds = %77, %65
  br label %120

80:                                               ; preds = %50
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %81, i32 0, i32 4
  %83 = load i32, ptr %82, align 8, !tbaa !9
  %84 = icmp eq i32 %83, 4
  br i1 %84, label %85, label %118

85:                                               ; preds = %80
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %115

90:                                               ; preds = %85
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !9
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %115

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

100:                                              ; preds = %95
  %101 = load ptr, ptr %2, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  call void @libxsmm_meqn_trv_rpn_print(ptr noundef %103)
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %104, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !9
  call void @libxsmm_meqn_trv_rpn_print(ptr noundef %106)
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %107, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  call void @libxsmm_meqn_trv_rpn_print(ptr noundef %109)
  %110 = load ptr, ptr %2, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %110, i32 0, i32 5
  %112 = getelementptr inbounds %struct.libxsmm_meqn_ternary_op, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.31, i32 noundef %113)
  br label %117

115:                                              ; preds = %95, %90, %85
  %116 = call i32 (ptr, ...) @printf(ptr noundef @.str.27)
  br label %117

117:                                              ; preds = %115, %100
  br label %119

118:                                              ; preds = %80
  br label %119

119:                                              ; preds = %118, %117
  br label %120

120:                                              ; preds = %119, %79
  br label %121

121:                                              ; preds = %120, %49
  br label %122

122:                                              ; preds = %121, %21
  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.27 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [12 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_trv_rpn_print(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  %3 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %3, label %common.ret31 [
    i32 8, label %4
    i32 1, label %15
    i32 2, label %26
    i32 4, label %38
  ]

4:                                                ; preds = %1
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %13

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

11:                                               ; preds = %7
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28)
  br label %common.ret31

13:                                               ; preds = %7, %4
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %common.ret31

15:                                               ; preds = %1
  %16 = load ptr, ptr %0, align 8, !tbaa !5
  %.not29 = icmp eq ptr %16, null
  br i1 %.not29, label %21, label %17

common.ret31:                                     ; preds = %1, %21, %24, %52, %36, %11, %13, %46, %31, %17
  ret void

17:                                               ; preds = %15
  tail call void @libxsmm_meqn_trv_rpn_print(ptr noundef nonnull %16)
  %18 = getelementptr inbounds i8, ptr %0, i64 36
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.29, i32 noundef %19)
  br label %common.ret31

21:                                               ; preds = %15
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %.not30 = icmp eq ptr %23, null
  br i1 %.not30, label %common.ret31, label %24

24:                                               ; preds = %21
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %common.ret31

26:                                               ; preds = %1
  %27 = load ptr, ptr %0, align 8, !tbaa !5
  %.not27 = icmp eq ptr %27, null
  br i1 %.not27, label %36, label %28

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %.not28 = icmp eq ptr %30, null
  br i1 %.not28, label %36, label %31

31:                                               ; preds = %28
  tail call void @libxsmm_meqn_trv_rpn_print(ptr noundef nonnull %27)
  %32 = load ptr, ptr %29, align 8, !tbaa !5
  tail call void @libxsmm_meqn_trv_rpn_print(ptr noundef %32)
  %33 = getelementptr inbounds i8, ptr %0, i64 36
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.30, i32 noundef %34)
  br label %common.ret31

36:                                               ; preds = %28, %26
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %common.ret31

38:                                               ; preds = %1
  %39 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %39, null
  br i1 %.not, label %52, label %40

40:                                               ; preds = %38
  %41 = getelementptr inbounds i8, ptr %0, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %.not25 = icmp eq ptr %42, null
  br i1 %.not25, label %52, label %43

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %0, i64 16
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %.not26 = icmp eq ptr %45, null
  br i1 %.not26, label %52, label %46

46:                                               ; preds = %43
  tail call void @libxsmm_meqn_trv_rpn_print(ptr noundef nonnull %39)
  %47 = load ptr, ptr %41, align 8, !tbaa !5
  tail call void @libxsmm_meqn_trv_rpn_print(ptr noundef %47)
  %48 = load ptr, ptr %44, align 8, !tbaa !5
  tail call void @libxsmm_meqn_trv_rpn_print(ptr noundef %48)
  %49 = getelementptr inbounds i8, ptr %0, i64 36
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31, i32 noundef %50)
  br label %common.ret31

52:                                               ; preds = %43, %40, %38
  %53 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27)
  br label %common.ret31
}

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: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass