; LLVM IR from clunietp/libgmsd :: src (convolve)

; 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.Matrix = type { i64, i64, ptr, ptr, i64 }

@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @apply_kernel_scanline(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @apply_kernel_scanline_2x2(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @apply_kernel_scanline_3x3(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @conv2(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [8 x ptr], align 16
  %10 = alloca [8 x ptr], align 16
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %struct.Matrix, align 8
  %18 = alloca %struct.Matrix, align 8
  %19 = alloca i8, align 1
  %20 = alloca %struct.Matrix, align 8
  %21 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #6
  call void @llvm.memset.p0.i64(ptr align 16 %9, i8 0, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #6
  call void @llvm.memset.p0.i64(ptr align 16 %10, i8 0, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = call i64 @kernel_size(ptr noundef %22)
  store i64 %23, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %24 = load i64, ptr %14, align 8, !tbaa !9
  %25 = sub i64 %24, 1
  store i64 %25, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %26 = load i64, ptr %14, align 8, !tbaa !9
  %27 = urem i64 %26, 2
  %28 = icmp eq i64 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %4
  br label %33

30:                                               ; preds = %4
  %31 = load i64, ptr %14, align 8, !tbaa !9
  %32 = udiv i64 %31, 2
  br label %33

33:                                               ; preds = %30, %29
  %34 = phi i64 [ 0, %29 ], [ %32, %30 ]
  store i64 %34, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 40, ptr %17) #6
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr %18) #6
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #6
  store i8 0, ptr %19, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 40, ptr %20) #6
  call void @llvm.memset.p0.i64(ptr align 8 %20, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %35 = load i64, ptr %14, align 8, !tbaa !9
  %36 = icmp ugt i64 %35, 8
  br i1 %36, label %47, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = call i32 @strcmp(ptr noundef %38, ptr noundef @.str) #7
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %47, label %41

41:                                               ; preds = %37
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %47

44:                                               ; preds = %41
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %48, label %47

47:                                               ; preds = %44, %41, %37, %33
  br label %131

48:                                               ; preds = %44
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = call ptr @kernel_matrix(ptr noundef %49)
  %51 = call zeroext i1 @matrix_rotate(ptr noundef %20, ptr noundef %50, i32 noundef 180)
  br i1 %51, label %52, label %61

52:                                               ; preds = %48
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load i64, ptr %15, align 8, !tbaa !9
  %55 = load i64, ptr %15, align 8, !tbaa !9
  %56 = call zeroext i1 @matrix_pad(ptr noundef %18, ptr noundef %53, i64 noundef %54, i64 noundef %55)
  br i1 %56, label %57, label %61

57:                                               ; preds = %52
  %58 = call i64 @matrix_rows(ptr noundef %18)
  %59 = call i64 @matrix_cols(ptr noundef %18)
  %60 = call zeroext i1 @matrix_init(ptr noundef %17, i64 noundef %58, i64 noundef %59)
  br i1 %60, label %62, label %61

61:                                               ; preds = %57, %52, %48
  br label %131

62:                                               ; preds = %57
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %73, %62
  %64 = load i64, ptr %12, align 8, !tbaa !9
  %65 = load i64, ptr %14, align 8, !tbaa !9
  %66 = icmp ult i64 %64, %65
  br i1 %66, label %67, label %76

67:                                               ; preds = %63
  %68 = call ptr @kernel_matrix(ptr noundef %20)
  %69 = load i64, ptr %12, align 8, !tbaa !9
  %70 = call ptr @matrix_row(ptr noundef %68, i64 noundef %69)
  %71 = load i64, ptr %12, align 8, !tbaa !9
  %72 = getelementptr inbounds [8 x ptr], ptr %10, i64 0, i64 %71
  store ptr %70, ptr %72, align 8, !tbaa !5
  br label %73

73:                                               ; preds = %67
  %74 = load i64, ptr %12, align 8, !tbaa !9
  %75 = add i64 %74, 1
  store i64 %75, ptr %12, align 8, !tbaa !9
  br label %63, !llvm.loop !13

76:                                               ; preds = %63
  %77 = load i64, ptr %14, align 8, !tbaa !9
  switch i64 %77, label %80 [
    i64 2, label %78
    i64 3, label %79
  ]

78:                                               ; preds = %76
  store ptr @apply_kernel_scanline_2x2, ptr %21, align 8, !tbaa !5
  br label %81

79:                                               ; preds = %76
  store ptr @apply_kernel_scanline_3x3, ptr %21, align 8, !tbaa !5
  br label %81

80:                                               ; preds = %76
  store ptr @apply_kernel_scanline, ptr %21, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %80, %79, %78
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %82

82:                                               ; preds = %118, %81
  %83 = load i64, ptr %11, align 8, !tbaa !9
  %84 = call i64 @matrix_rows(ptr noundef %18)
  %85 = load i64, ptr %15, align 8, !tbaa !9
  %86 = sub i64 %84, %85
  %87 = icmp ult i64 %83, %86
  br i1 %87, label %88, label %121

88:                                               ; preds = %82
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %89

89:                                               ; preds = %100, %88
  %90 = load i64, ptr %12, align 8, !tbaa !9
  %91 = load i64, ptr %14, align 8, !tbaa !9
  %92 = icmp ult i64 %90, %91
  br i1 %92, label %93, label %103

93:                                               ; preds = %89
  %94 = load i64, ptr %11, align 8, !tbaa !9
  %95 = load i64, ptr %12, align 8, !tbaa !9
  %96 = add i64 %94, %95
  %97 = call ptr @matrix_row(ptr noundef %18, i64 noundef %96)
  %98 = load i64, ptr %12, align 8, !tbaa !9
  %99 = getelementptr inbounds [8 x ptr], ptr %9, i64 0, i64 %98
  store ptr %97, ptr %99, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %93
  %101 = load i64, ptr %12, align 8, !tbaa !9
  %102 = add i64 %101, 1
  store i64 %102, ptr %12, align 8, !tbaa !9
  br label %89, !llvm.loop !15

103:                                              ; preds = %89
  %104 = load i64, ptr %11, align 8, !tbaa !9
  %105 = load i64, ptr %16, align 8, !tbaa !9
  %106 = add i64 %104, %105
  %107 = call ptr @matrix_row(ptr noundef %17, i64 noundef %106)
  %108 = load i64, ptr %16, align 8, !tbaa !9
  %109 = getelementptr inbounds float, ptr %107, i64 %108
  store ptr %109, ptr %13, align 8, !tbaa !5
  %110 = load ptr, ptr %21, align 8, !tbaa !5
  %111 = getelementptr inbounds [8 x ptr], ptr %10, i64 0, i64 0
  %112 = getelementptr inbounds [8 x ptr], ptr %9, i64 0, i64 0
  %113 = load i64, ptr %14, align 8, !tbaa !9
  %114 = call i64 @matrix_cols(ptr noundef %18)
  %115 = load i64, ptr %15, align 8, !tbaa !9
  %116 = sub i64 %114, %115
  %117 = load ptr, ptr %13, align 8, !tbaa !5
  call void %110(ptr noundef %111, ptr noundef %112, i64 noundef %113, i64 noundef %116, ptr noundef %117)
  br label %118

118:                                              ; preds = %103
  %119 = load i64, ptr %11, align 8, !tbaa !9
  %120 = add i64 %119, 1
  store i64 %120, ptr %11, align 8, !tbaa !9
  br label %82, !llvm.loop !16

121:                                              ; preds = %82
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = call i64 @matrix_rows(ptr noundef %123)
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = call i64 @matrix_cols(ptr noundef %125)
  %127 = load i64, ptr %15, align 8, !tbaa !9
  %128 = load i64, ptr %15, align 8, !tbaa !9
  %129 = call zeroext i1 @matrix_crop(ptr noundef %122, ptr noundef %17, i64 noundef %124, i64 noundef %126, i64 noundef %127, i64 noundef %128)
  %130 = zext i1 %129 to i8
  store i8 %130, ptr %19, align 1, !tbaa !11
  br label %131

131:                                              ; preds = %121, %61, %47
  call void @kernel_destroy(ptr noundef %20)
  call void @matrix_destroy(ptr noundef %17)
  call void @matrix_destroy(ptr noundef %18)
  %132 = load i8, ptr %19, align 1, !tbaa !11, !range !17, !noundef !18
  %133 = trunc i8 %132 to i1
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #6
  ret i1 %133
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @kernel_size(ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #4

declare zeroext i1 @matrix_rotate(ptr noundef, ptr noundef, i32 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kernel_matrix(ptr noundef) #3

declare zeroext i1 @matrix_pad(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #5

declare zeroext i1 @matrix_init(ptr noundef, i64 noundef, i64 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @matrix_rows(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @matrix_cols(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @matrix_row(ptr noundef, i64 noundef) #3

declare zeroext i1 @matrix_crop(ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @kernel_destroy(ptr noundef) #3

declare void @matrix_destroy(ptr noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { inlinehint 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 #4 = { nounwind willreturn memory(read) "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 #5 = { "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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{i8 0, i8 2}
!18 = !{}


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

%struct.Matrix = type { i64, i64, ptr, ptr, i64 }

@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @apply_kernel_scanline(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @apply_kernel_scanline_2x2(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @apply_kernel_scanline_3x3(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @conv2(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  %5 = alloca [8 x ptr], align 16
  %6 = alloca [8 x ptr], align 16
  %7 = alloca %struct.Matrix, align 8
  %8 = alloca %struct.Matrix, align 8
  %9 = alloca %struct.Matrix, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %5, i8 0, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %6) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %6, i8 0, i64 64, i1 false)
  %10 = tail call i64 @kernel_size(ptr noundef %2)
  %11 = add i64 %10, -1
  %12 = and i64 %10, 1
  %13 = icmp eq i64 %12, 0
  %14 = lshr i64 %10, 1
  %15 = select i1 %13, i64 0, i64 %14
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %7) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %7, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %8) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %8, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %9) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %9, i8 0, i64 40, i1 false)
  %16 = icmp ugt i64 %10, 8
  br i1 %16, label %61, label %17

17:                                               ; preds = %4
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str) #7
  %19 = icmp eq i32 %18, 0
  %20 = icmp ne ptr %1, null
  %or.cond = and i1 %20, %19
  %21 = icmp ne ptr %0, null
  %or.cond3 = and i1 %21, %or.cond
  br i1 %or.cond3, label %22, label %61

22:                                               ; preds = %17
  %23 = tail call ptr @kernel_matrix(ptr noundef %2)
  %24 = call zeroext i1 @matrix_rotate(ptr noundef nonnull %9, ptr noundef %23, i32 noundef 180) #6
  br i1 %24, label %25, label %61

25:                                               ; preds = %22
  %26 = call zeroext i1 @matrix_pad(ptr noundef nonnull %8, ptr noundef nonnull %1, i64 noundef %11, i64 noundef %11) #6
  br i1 %26, label %27, label %61

27:                                               ; preds = %25
  %28 = call i64 @matrix_rows(ptr noundef nonnull %8)
  %29 = call i64 @matrix_cols(ptr noundef nonnull %8)
  %30 = call zeroext i1 @matrix_init(ptr noundef nonnull %7, i64 noundef %28, i64 noundef %29) #6
  br i1 %30, label %.preheader50, label %61

.preheader50:                                     ; preds = %27
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader50, %.lr.ph
  %.04451 = phi i64 [ %34, %.lr.ph ], [ 0, %.preheader50 ]
  %31 = call ptr @kernel_matrix(ptr noundef nonnull %9)
  %32 = call ptr @matrix_row(ptr noundef %31, i64 noundef %.04451)
  %33 = getelementptr inbounds [8 x ptr], ptr %6, i64 0, i64 %.04451
  store ptr %32, ptr %33, align 8, !tbaa !5
  %34 = add nuw i64 %.04451, 1
  %exitcond.not = icmp eq i64 %34, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.preheader50
  %switch.selectcmp = icmp eq i64 %10, 3
  %switch.select = select i1 %switch.selectcmp, ptr @apply_kernel_scanline_3x3, ptr @apply_kernel_scanline
  %switch.selectcmp48 = icmp eq i64 %10, 2
  %switch.select49 = select i1 %switch.selectcmp48, ptr @apply_kernel_scanline_2x2, ptr %switch.select
  %35 = call i64 @matrix_rows(ptr noundef nonnull %8)
  %.not57 = icmp eq i64 %35, %11
  br i1 %.not57, label %._crit_edge56, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %._crit_edge
  br i1 %.not, label %.preheader, label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge54.us
  %.04355.us = phi i64 [ %46, %._crit_edge54.us ], [ 0, %.preheader.lr.ph ]
  br label %36

36:                                               ; preds = %.preheader.us, %36
  %.152.us = phi i64 [ 0, %.preheader.us ], [ %40, %36 ]
  %37 = add i64 %.152.us, %.04355.us
  %38 = call ptr @matrix_row(ptr noundef nonnull %8, i64 noundef %37)
  %39 = getelementptr inbounds [8 x ptr], ptr %5, i64 0, i64 %.152.us
  store ptr %38, ptr %39, align 8, !tbaa !5
  %40 = add nuw i64 %.152.us, 1
  %exitcond60.not = icmp eq i64 %40, %10
  br i1 %exitcond60.not, label %._crit_edge54.us, label %36, !llvm.loop !11

._crit_edge54.us:                                 ; preds = %36
  %41 = add i64 %.04355.us, %15
  %42 = call ptr @matrix_row(ptr noundef nonnull %7, i64 noundef %41)
  %43 = getelementptr inbounds float, ptr %42, i64 %15
  %44 = call i64 @matrix_cols(ptr noundef nonnull %8)
  %45 = sub i64 %44, %11
  call void %switch.select49(ptr noundef nonnull %6, ptr noundef nonnull %5, i64 noundef %10, i64 noundef %45, ptr noundef %43) #6, !callees !12
  %46 = add nuw i64 %.04355.us, 1
  %47 = call i64 @matrix_rows(ptr noundef nonnull %8)
  %48 = sub i64 %47, %11
  %49 = icmp ult i64 %46, %48
  br i1 %49, label %.preheader.us, label %._crit_edge56, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.lr.ph, %.preheader
  %.04355 = phi i64 [ %54, %.preheader ], [ 0, %.preheader.lr.ph ]
  %50 = call ptr @matrix_row(ptr noundef nonnull %7, i64 noundef %.04355)
  %51 = getelementptr inbounds float, ptr %50, i64 %15
  %52 = call i64 @matrix_cols(ptr noundef nonnull %8)
  %53 = sub i64 %52, %11
  call void %switch.select49(ptr noundef nonnull %6, ptr noundef nonnull %5, i64 noundef 0, i64 noundef %53, ptr noundef %51) #6, !callees !12
  %54 = add nuw i64 %.04355, 1
  %55 = call i64 @matrix_rows(ptr noundef nonnull %8)
  %56 = sub i64 %55, %11
  %57 = icmp ult i64 %54, %56
  br i1 %57, label %.preheader, label %._crit_edge56, !llvm.loop !13

._crit_edge56:                                    ; preds = %._crit_edge54.us, %.preheader, %._crit_edge
  %58 = call i64 @matrix_rows(ptr noundef nonnull %1)
  %59 = call i64 @matrix_cols(ptr noundef nonnull %1)
  %60 = call zeroext i1 @matrix_crop(ptr noundef nonnull %0, ptr noundef nonnull %7, i64 noundef %58, i64 noundef %59, i64 noundef %11, i64 noundef %11) #6
  br label %61

61:                                               ; preds = %22, %25, %27, %4, %17, %._crit_edge56
  %.042 = phi i1 [ false, %4 ], [ %60, %._crit_edge56 ], [ false, %27 ], [ false, %25 ], [ false, %22 ], [ false, %17 ]
  call void @kernel_destroy(ptr noundef nonnull %9)
  call void @matrix_destroy(ptr noundef nonnull %7) #6
  call void @matrix_destroy(ptr noundef nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #6
  ret i1 %.042
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @kernel_size(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

declare zeroext i1 @matrix_rotate(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kernel_matrix(ptr noundef) local_unnamed_addr #3

declare zeroext i1 @matrix_pad(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #5

declare zeroext i1 @matrix_init(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @matrix_rows(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @matrix_cols(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @matrix_row(ptr noundef, i64 noundef) local_unnamed_addr #3

declare zeroext i1 @matrix_crop(ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @kernel_destroy(ptr noundef) local_unnamed_addr #3

declare void @matrix_destroy(ptr noundef) local_unnamed_addr #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { inlinehint 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #5 = { "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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{ptr @apply_kernel_scanline, ptr @apply_kernel_scanline_2x2, ptr @apply_kernel_scanline_3x3}
!13 = distinct !{!13, !10}


; Effective O3 passes: CalledValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass