; LLVM IR from ggml-org/ggml :: src (ggml)

; 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.ggml_tensor = type { i32, ptr, [4 x i64], [4 x i64], i32, [16 x i32], i32, [10 x ptr], ptr, i64, ptr, [64 x i8], ptr, [8 x i8] }

; 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 uwtable
declare dso_local ptr @ggml_new_tensor(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @ggml_set_op_params(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @ggml_im2col_back(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %9, i1 noundef zeroext %10) #1 {
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i8, align 1
  %23 = alloca ptr, align 8
  %24 = alloca [7 x i32], align 16
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store ptr %2, ptr %14, align 8, !tbaa !5
  store ptr %3, ptr %15, align 8, !tbaa !5
  store i32 %4, ptr %16, align 4, !tbaa !9
  store i32 %5, ptr %17, align 4, !tbaa !9
  store i32 %6, ptr %18, align 4, !tbaa !9
  store i32 %7, ptr %19, align 4, !tbaa !9
  store i32 %8, ptr %20, align 4, !tbaa !9
  store i32 %9, ptr %21, align 4, !tbaa !9
  %25 = zext i1 %10 to i8
  store i8 %25, ptr %22, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #2
  %26 = load ptr, ptr %12, align 8, !tbaa !5
  %27 = load ptr, ptr %15, align 8, !tbaa !5
  %28 = call ptr @ggml_new_tensor(ptr noundef %26, i32 noundef 0, i32 noundef 4, ptr noundef %27)
  store ptr %28, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 28, ptr %24) #2
  %29 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %29, ptr %24, align 4, !tbaa !9
  %30 = getelementptr inbounds i32, ptr %24, i64 1
  %31 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %31, ptr %30, align 4, !tbaa !9
  %32 = getelementptr inbounds i32, ptr %24, i64 2
  %33 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %33, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds i32, ptr %24, i64 3
  %35 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %35, ptr %34, align 4, !tbaa !9
  %36 = getelementptr inbounds i32, ptr %24, i64 4
  %37 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %37, ptr %36, align 4, !tbaa !9
  %38 = getelementptr inbounds i32, ptr %24, i64 5
  %39 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %39, ptr %38, align 4, !tbaa !9
  %40 = getelementptr inbounds i32, ptr %24, i64 6
  %41 = load i8, ptr %22, align 1, !tbaa !11, !range !13, !noundef !14
  %42 = trunc i8 %41 to i1
  %43 = zext i1 %42 to i64
  %44 = select i1 %42, i32 1, i32 0
  store i32 %44, ptr %40, align 4, !tbaa !9
  %45 = load ptr, ptr %23, align 8, !tbaa !5
  %46 = getelementptr inbounds [7 x i32], ptr %24, i64 0, i64 0
  call void @ggml_set_op_params(ptr noundef %45, ptr noundef %46, i64 noundef 28)
  %47 = load ptr, ptr %23, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ggml_tensor, ptr %47, i32 0, i32 4
  store i32 50, ptr %48, align 8, !tbaa !15
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = load ptr, ptr %23, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ggml_tensor, ptr %50, i32 0, i32 7
  %52 = getelementptr inbounds [10 x ptr], ptr %51, i64 0, i64 0
  store ptr %49, ptr %52, align 8, !tbaa !5
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  %54 = load ptr, ptr %23, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ggml_tensor, ptr %54, i32 0, i32 7
  %56 = getelementptr inbounds [10 x ptr], ptr %55, i64 0, i64 1
  store ptr %53, ptr %56, align 8, !tbaa !5
  %57 = load ptr, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 28, ptr %24) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #2
  ret ptr %57
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 80}
!16 = !{!"ggml_tensor", !10, i64 0, !6, i64 8, !7, i64 16, !7, i64 48, !10, i64 80, !7, i64 84, !10, i64 148, !7, i64 152, !6, i64 232, !17, i64 240, !6, i64 248, !7, i64 256, !6, i64 320, !7, i64 328}
!17 = !{!"long", !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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @ggml_new_tensor(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @ggml_set_op_params(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @ggml_im2col_back(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %9, i1 noundef zeroext %10) local_unnamed_addr #1 {
  %12 = alloca [7 x i32], align 16
  %13 = tail call ptr @ggml_new_tensor(ptr noundef %0, i32 noundef 0, i32 noundef 4, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %12) #2
  store i32 %4, ptr %12, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %12, i64 4
  store i32 %5, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %12, i64 8
  store i32 %6, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %12, i64 12
  store i32 %7, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %12, i64 16
  store i32 %8, ptr %17, align 16, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %12, i64 20
  store i32 %9, ptr %18, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %12, i64 24
  %20 = zext i1 %10 to i32
  store i32 %20, ptr %19, align 8, !tbaa !5
  call void @ggml_set_op_params(ptr noundef %13, ptr noundef nonnull %12, i64 noundef 28)
  %21 = getelementptr inbounds i8, ptr %13, i64 80
  store i32 50, ptr %21, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %13, i64 152
  store ptr %1, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %13, i64 160
  store ptr %2, ptr %23, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %12) #2
  ret ptr %13
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 80}
!10 = !{!"ggml_tensor", !6, i64 0, !11, i64 8, !7, i64 16, !7, i64 48, !6, i64 80, !7, i64 84, !6, i64 148, !7, i64 152, !11, i64 232, !12, i64 240, !11, i64 248, !7, i64 256, !11, i64 320, !7, i64 328}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass