; LLVM IR from libxsmm/libxsmm :: src (generator_matequation_scratch_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 }
%struct.libxsmm_meqn_binary_op = type { i32, i32, i32, i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [369 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_generator_matequation_create_binary_descriptor = external hidden unnamed_addr constant [173 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [364 x i8], align 1

declare ptr @libxsmm_meltw_descriptor_init2(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_matequation_create_binary_descriptor(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = load i32, ptr %9, align 4, !tbaa !9
  %13 = load ptr, ptr %7, 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 !11
  %16 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %15, i32 0, i32 8
  %17 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %16, i32 0, i32 4
  %18 = load i32, ptr %17, align 8, !tbaa !11
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %19, i32 0, i32 5
  %21 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %24, i32 0, i32 8
  %26 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !11
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %28, i32 0, i32 8
  %30 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %29, i32 0, i32 2
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %34, i32 0, i32 8
  %36 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %35, i32 0, i32 3
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %38, i32 0, i32 8
  %40 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %39, i32 0, i32 3
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = load ptr, ptr %7, 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 !11
  %45 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %44, i32 0, i32 8
  %46 = getelementptr inbounds %struct.libxsmm_meqn_tmp_info, ptr %45, i32 0, i32 3
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %48, i32 0, i32 5
  %50 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = trunc i32 %51 to i16
  %53 = zext i16 %52 to i32
  %54 = icmp eq i32 0, %53
  br i1 %54, label %63, label %55

55:                                               ; preds = %5
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %56, i32 0, i32 5
  %58 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !11
  %60 = trunc i32 %59 to i16
  %61 = zext i16 %60 to i32
  %62 = icmp slt i32 0, %61
  br i1 %62, label %63, label %90

63:                                               ; preds = %55, %5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %64, i32 0, i32 5
  %66 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !11
  %68 = zext i32 %67 to i64
  %69 = mul i64 1, %68
  %70 = icmp ult i64 %69, 65535
  br i1 %70, label %71, label %78

71:                                               ; preds = %63
  %72 = load ptr, ptr %7, 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 1
  %75 = load i32, ptr %74, align 4, !tbaa !11
  %76 = zext i32 %75 to i64
  %77 = mul i64 1, %76
  br label %79

78:                                               ; preds = %63
  br label %79

79:                                               ; preds = %78, %71
  %80 = phi i64 [ %77, %71 ], [ 65535, %78 ]
  %81 = icmp ule i64 %80, 65535
  br i1 %81, label %82, label %90

82:                                               ; preds = %79
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %83, i32 0, i32 5
  %85 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 4, !tbaa !11
  %87 = uitofp i32 %86 to double
  %88 = fcmp ole double 0.000000e+00, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %82
  br label %91

90:                                               ; preds = %82, %79, %55
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 51, ptr noundef @__PRETTY_FUNCTION__.libxsmm_generator_matequation_create_binary_descriptor) #3
  unreachable

91:                                               ; preds = %89
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %92, i32 0, i32 5
  %94 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %93, i32 0, i32 1
  %95 = load i32, ptr %94, align 4, !tbaa !11
  %96 = trunc i32 %95 to i16
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %97, i32 0, i32 5
  %99 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %98, i32 0, i32 0
  %100 = load i32, ptr %99, align 4, !tbaa !11
  %101 = trunc i32 %100 to i16
  %102 = zext i16 %101 to i32
  %103 = icmp eq i32 0, %102
  br i1 %103, label %112, label %104

104:                                              ; preds = %91
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %105, i32 0, i32 5
  %107 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 4, !tbaa !11
  %109 = trunc i32 %108 to i16
  %110 = zext i16 %109 to i32
  %111 = icmp slt i32 0, %110
  br i1 %111, label %112, label %139

112:                                              ; preds = %104, %91
  %113 = load ptr, ptr %7, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %113, i32 0, i32 5
  %115 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !11
  %117 = zext i32 %116 to i64
  %118 = mul i64 1, %117
  %119 = icmp ult i64 %118, 65535
  br i1 %119, label %120, label %127

120:                                              ; preds = %112
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %121, i32 0, i32 5
  %123 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 4, !tbaa !11
  %125 = zext i32 %124 to i64
  %126 = mul i64 1, %125
  br label %128

127:                                              ; preds = %112
  br label %128

128:                                              ; preds = %127, %120
  %129 = phi i64 [ %126, %120 ], [ 65535, %127 ]
  %130 = icmp ule i64 %129, 65535
  br i1 %130, label %131, label %139

131:                                              ; preds = %128
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %132, i32 0, i32 5
  %134 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %133, i32 0, i32 0
  %135 = load i32, ptr %134, align 4, !tbaa !11
  %136 = uitofp i32 %135 to double
  %137 = fcmp ole double 0.000000e+00, %136
  br i1 %137, label %138, label %139

138:                                              ; preds = %131
  br label %140

139:                                              ; preds = %131, %128, %104
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 51, ptr noundef @__PRETTY_FUNCTION__.libxsmm_generator_matequation_create_binary_descriptor) #3
  unreachable

140:                                              ; preds = %138
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.libxsmm_meqn_elem, ptr %141, i32 0, i32 5
  %143 = getelementptr inbounds %struct.libxsmm_meqn_binary_op, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 4, !tbaa !11
  %145 = trunc i32 %144 to i16
  %146 = call ptr @libxsmm_meltw_descriptor_init2(ptr noundef %11, i32 noundef %12, i32 noundef %18, i32 noundef 15, i32 noundef %22, i32 noundef %23, i32 noundef %27, i32 noundef %31, i32 noundef %37, i32 noundef %41, i32 noundef %47, i32 noundef 0, i16 noundef zeroext %96, i16 noundef zeroext %145, i8 noundef zeroext 2)
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %146, ptr %147, align 8, !tbaa !5
  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 = { noreturn 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 #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 = { noreturn 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 = !{!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"

declare ptr @libxsmm_meltw_descriptor_init2(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @libxsmm_generator_matequation_create_binary_descriptor(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 104
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 36
  %11 = getelementptr inbounds i8, ptr %1, i64 44
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 92
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 96
  %16 = load i32, ptr %15, align 8, !tbaa !5
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 100
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 100
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %7, i64 100
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 40
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr %10, align 4, !tbaa !5
  %27 = trunc i32 %25 to i16
  %28 = trunc i32 %26 to i16
  %29 = tail call ptr @libxsmm_meltw_descriptor_init2(ptr noundef %0, i32 noundef %3, i32 noundef %9, i32 noundef 15, i32 noundef %12, i32 noundef %4, i32 noundef %14, i32 noundef %16, i32 noundef %19, i32 noundef %21, i32 noundef %23, i32 noundef 0, i16 noundef zeroext %27, i16 noundef zeroext %28, i8 noundef zeroext 2) #2
  store ptr %29, ptr %2, align 8, !tbaa !8
  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" }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass