; LLVM IR from ggml-org/ggml :: tests (test-conv2d-dw)

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

; 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: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  store i8 1, ptr %6, align 1, !tbaa !11
  %7 = call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 3, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef 1, i1 noundef zeroext false)
  br i1 %7, label %8, label %11

8:                                                ; preds = %2
  %9 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %10 = trunc i8 %9 to i1
  br label %11

11:                                               ; preds = %8, %2
  %12 = phi i1 [ false, %2 ], [ %10, %8 ]
  %13 = zext i1 %12 to i8
  store i8 %13, ptr %6, align 1, !tbaa !11
  %14 = call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 3, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef 1, i1 noundef zeroext true)
  br i1 %14, label %15, label %18

15:                                               ; preds = %11
  %16 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %17 = trunc i8 %16 to i1
  br label %18

18:                                               ; preds = %15, %11
  %19 = phi i1 [ false, %11 ], [ %17, %15 ]
  %20 = zext i1 %19 to i8
  store i8 %20, ptr %6, align 1, !tbaa !11
  %21 = call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 42, i32 noundef 3, i32 noundef 2, i32 noundef 1, i32 noundef 1, i1 noundef zeroext false)
  br i1 %21, label %22, label %25

22:                                               ; preds = %18
  %23 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %24 = trunc i8 %23 to i1
  br label %25

25:                                               ; preds = %22, %18
  %26 = phi i1 [ false, %18 ], [ %24, %22 ]
  %27 = zext i1 %26 to i8
  store i8 %27, ptr %6, align 1, !tbaa !11
  %28 = call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 42, i32 noundef 3, i32 noundef 2, i32 noundef 1, i32 noundef 1, i1 noundef zeroext true)
  br i1 %28, label %29, label %32

29:                                               ; preds = %25
  %30 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %31 = trunc i8 %30 to i1
  br label %32

32:                                               ; preds = %29, %25
  %33 = phi i1 [ false, %25 ], [ %31, %29 ]
  %34 = zext i1 %33 to i8
  store i8 %34, ptr %6, align 1, !tbaa !11
  %35 = call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 8, i32 noundef 5, i32 noundef 1, i32 noundef 2, i32 noundef 2, i1 noundef zeroext false)
  br i1 %35, label %36, label %39

36:                                               ; preds = %32
  %37 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %38 = trunc i8 %37 to i1
  br label %39

39:                                               ; preds = %36, %32
  %40 = phi i1 [ false, %32 ], [ %38, %36 ]
  %41 = zext i1 %40 to i8
  store i8 %41, ptr %6, align 1, !tbaa !11
  %42 = call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 8, i32 noundef 5, i32 noundef 1, i32 noundef 2, i32 noundef 2, i1 noundef zeroext true)
  br i1 %42, label %43, label %46

43:                                               ; preds = %39
  %44 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %45 = trunc i8 %44 to i1
  br label %46

46:                                               ; preds = %43, %39
  %47 = phi i1 [ false, %39 ], [ %45, %43 ]
  %48 = zext i1 %47 to i8
  store i8 %48, ptr %6, align 1, !tbaa !11
  %49 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %50 = trunc i8 %49 to i1
  %51 = zext i1 %50 to i64
  %52 = select i1 %50, i32 0, i32 1
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  ret i32 %52
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { mustprogress norecurse 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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


; 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 uwtable
declare dso_local noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
  %3 = tail call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 3, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef 1, i1 noundef zeroext false)
  %4 = tail call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 3, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef 1, i1 noundef zeroext true)
  %5 = and i1 %3, %4
  %6 = tail call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 42, i32 noundef 3, i32 noundef 2, i32 noundef 1, i32 noundef 1, i1 noundef zeroext false)
  %7 = and i1 %6, %5
  %8 = tail call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 42, i32 noundef 3, i32 noundef 2, i32 noundef 1, i32 noundef 1, i1 noundef zeroext true)
  %9 = and i1 %8, %7
  %10 = tail call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 8, i32 noundef 5, i32 noundef 1, i32 noundef 2, i32 noundef 2, i1 noundef zeroext false)
  %11 = and i1 %10, %9
  %12 = tail call noundef zeroext i1 @_Z15test_conv_2d_dwiiiiib(i32 noundef 8, i32 noundef 5, i32 noundef 1, i32 noundef 2, i32 noundef 2, i1 noundef zeroext true)
  %13 = and i1 %12, %11
  %not. = xor i1 %13, true
  %14 = zext i1 %not. to i32
  ret i32 %14
}

attributes #0 = { mustprogress 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 #1 = { mustprogress norecurse 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)"}


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