; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Drivers/STM32H7xx_HAL_Driver/Src (SetL3FilterConfig)

; 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.ETH_HandleTypeDef = type { ptr, %struct.ETH_InitTypeDef, %struct.ETH_TxDescListTypeDef, %struct.ETH_RxDescListTypeDef, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.ETH_InitTypeDef = type { ptr, i32, ptr, ptr, i32 }
%struct.ETH_TxDescListTypeDef = type { [4 x i32], i32 }
%struct.ETH_RxDescListTypeDef = type { [4 x i32], i32, i32, i32, i32, i32 }
%struct.ETH_TypeDef = type { i32, i32, i32, i32, i32, i32, [14 x i32], i32, i32, i32, i32, i32, i32, [2 x i32], i32, [7 x i32], i32, [7 x i32], i32, i32, i32, i32, i32, i32, [2 x i32], i32, i32, i32, i32, [12 x i32], i32, i32, i32, i32, i32, i32, [54 x i32], i32, i32, [2 x i32], i32, [59 x i32], i32, i32, i32, i32, i32, i32, i32, i32, [248 x i32], i32, i32, i32, i32, i32, [14 x i32], i32, i32, [5 x i32], i32, [10 x i32], i32, i32, [10 x i32], i32, [9 x i32], i32, i32, i32, i32, [65 x i32], i32, i32, [2 x i32], i32, i32, i32, i32, [4 x i32], i32, i32, [2 x i32], i32, i32, i32, i32, [108 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, i32, [2 x i32], i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], i32, [3 x i32], i32, i32, i32, i32, [12 x i32], i32, i32, i32, i32, i32, [11 x i32], i32, [7 x i32], i32, [55 x i32], i32, i32, i32, [8 x i32], i32, i32, i32, i32, [177 x i32], i32, i32, i32, i32, [60 x i32], i32, i32, i32, [2 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i32], i32 }
%struct.ETH_L3FilterConfigTypeDef = type { i32, i32, i32, i32, i32, i32, i32, [4 x i32] }

; 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
define dso_local i32 @HAL_ETHEx_SetL3FilterConfig(ptr noundef %0, i32 noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds %struct.ETH_TypeDef, ptr %12, i32 0, i32 72
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = zext i32 %14 to i64
  %16 = getelementptr inbounds i32, ptr %13, i64 %15
  store ptr %16, ptr %8, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %121

20:                                               ; preds = %3
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = load volatile i32, ptr %21, align 4, !tbaa !9
  %23 = zext i32 %22 to i64
  %24 = and i64 %23, -65534
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 4, !tbaa !16
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !18
  %31 = or i32 %27, %30
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 4, !tbaa !19
  %35 = or i32 %31, %34
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %36, i32 0, i32 3
  %38 = load i32, ptr %37, align 4, !tbaa !20
  %39 = shl i32 %38, 6
  %40 = or i32 %35, %39
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %41, i32 0, i32 4
  %43 = load i32, ptr %42, align 4, !tbaa !21
  %44 = shl i32 %43, 11
  %45 = or i32 %40, %44
  %46 = zext i32 %45 to i64
  %47 = or i64 %24, %46
  %48 = trunc i64 %47 to i32
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  store volatile i32 %48, ptr %49, align 4, !tbaa !9
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 4, !tbaa !16
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %99

54:                                               ; preds = %20
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %55, i32 0, i32 7
  %57 = getelementptr inbounds [4 x i32], ptr %56, i64 0, i64 0
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.ETH_TypeDef, ptr %61, i32 0, i32 75
  %63 = load i32, ptr %6, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  store volatile i32 %58, ptr %65, align 4, !tbaa !9
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %66, i32 0, i32 7
  %68 = getelementptr inbounds [4 x i32], ptr %67, i64 0, i64 1
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.ETH_TypeDef, ptr %72, i32 0, i32 76
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %73, i64 %75
  store volatile i32 %69, ptr %76, align 4, !tbaa !9
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %77, i32 0, i32 7
  %79 = getelementptr inbounds [4 x i32], ptr %78, i64 0, i64 2
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8, !tbaa !11
  %84 = getelementptr inbounds %struct.ETH_TypeDef, ptr %83, i32 0, i32 77
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %84, i64 %86
  store volatile i32 %80, ptr %87, align 4, !tbaa !9
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %88, i32 0, i32 7
  %90 = getelementptr inbounds [4 x i32], ptr %89, i64 0, i64 3
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct.ETH_TypeDef, ptr %94, i32 0, i32 78
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %95, i64 %97
  store volatile i32 %91, ptr %98, align 4, !tbaa !9
  br label %120

99:                                               ; preds = %20
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %100, i32 0, i32 5
  %102 = load i32, ptr %101, align 4, !tbaa !22
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !11
  %106 = getelementptr inbounds %struct.ETH_TypeDef, ptr %105, i32 0, i32 75
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %106, i64 %108
  store volatile i32 %102, ptr %109, align 4, !tbaa !9
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %110, i32 0, i32 6
  %112 = load i32, ptr %111, align 4, !tbaa !23
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !11
  %116 = getelementptr inbounds %struct.ETH_TypeDef, ptr %115, i32 0, i32 76
  %117 = load i32, ptr %6, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %116, i64 %118
  store volatile i32 %112, ptr %119, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %99, %54
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %121

121:                                              ; preds = %120, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %122 = load i32, ptr %4, align 4
  ret i32 %122
}

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, !6, i64 0}
!12 = !{!"", !6, i64 0, !13, i64 8, !14, i64 48, !15, i64 68, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132}
!13 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !10, i64 32}
!14 = !{!"", !7, i64 0, !10, i64 16}
!15 = !{!"", !7, i64 0, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!16 = !{!17, !10, i64 0}
!17 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 28}
!18 = !{!17, !10, i64 4}
!19 = !{!17, !10, i64 8}
!20 = !{!17, !10, i64 12}
!21 = !{!17, !10, i64 16}
!22 = !{!17, !10, i64 20}
!23 = !{!17, !10, i64 24}


; 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: nofree norecurse nounwind uwtable
define dso_local range(i32 0, 2) i32 @HAL_ETHEx_SetL3FilterConfig(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef readonly %2) local_unnamed_addr #0 {
  %4 = zext i32 %1 to i64
  %5 = icmp eq ptr %2, null
  br i1 %5, label %51, label %6

6:                                                ; preds = %3
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 2304
  %9 = getelementptr inbounds i32, ptr %8, i64 %4
  %10 = load volatile i32, ptr %9, align 4, !tbaa !14
  %11 = and i32 %10, -65534
  %12 = load i32, ptr %2, align 4, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %2, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  %16 = load i32, ptr %15, align 4, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %2, i64 12
  %18 = load i32, ptr %17, align 4, !tbaa !19
  %19 = shl i32 %18, 6
  %20 = getelementptr inbounds i8, ptr %2, i64 16
  %21 = load i32, ptr %20, align 4, !tbaa !20
  %22 = shl i32 %21, 11
  %23 = or i32 %11, %12
  %24 = or i32 %23, %14
  %25 = or i32 %24, %16
  %26 = or i32 %25, %19
  %27 = or i32 %26, %22
  store volatile i32 %27, ptr %9, align 4, !tbaa !14
  %28 = load i32, ptr %2, align 4, !tbaa !15
  %.not = icmp eq i32 %28, 0
  %29 = getelementptr inbounds i8, ptr %7, i64 2320
  %30 = getelementptr inbounds i32, ptr %29, i64 %4
  %31 = getelementptr inbounds i8, ptr %7, i64 2324
  %32 = getelementptr inbounds i32, ptr %31, i64 %4
  br i1 %.not, label %46, label %33

33:                                               ; preds = %6
  %34 = getelementptr inbounds i8, ptr %2, i64 28
  %35 = load i32, ptr %34, align 4, !tbaa !14
  store volatile i32 %35, ptr %30, align 4, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %2, i64 32
  %37 = load i32, ptr %36, align 4, !tbaa !14
  store volatile i32 %37, ptr %32, align 4, !tbaa !14
  %38 = getelementptr inbounds i8, ptr %2, i64 36
  %39 = load i32, ptr %38, align 4, !tbaa !14
  %40 = getelementptr inbounds i8, ptr %7, i64 2328
  %41 = getelementptr inbounds i32, ptr %40, i64 %4
  store volatile i32 %39, ptr %41, align 4, !tbaa !14
  %42 = getelementptr inbounds i8, ptr %2, i64 40
  %43 = load i32, ptr %42, align 4, !tbaa !14
  %44 = getelementptr inbounds i8, ptr %7, i64 2332
  %45 = getelementptr inbounds i32, ptr %44, i64 %4
  store volatile i32 %43, ptr %45, align 4, !tbaa !14
  br label %51

46:                                               ; preds = %6
  %47 = getelementptr inbounds i8, ptr %2, i64 20
  %48 = load i32, ptr %47, align 4, !tbaa !21
  store volatile i32 %48, ptr %30, align 4, !tbaa !14
  %49 = getelementptr inbounds i8, ptr %2, i64 24
  %50 = load i32, ptr %49, align 4, !tbaa !22
  store volatile i32 %50, ptr %32, align 4, !tbaa !14
  br label %51

51:                                               ; preds = %33, %46, %3
  %.0 = phi i32 [ 1, %3 ], [ 0, %46 ], [ 0, %33 ]
  ret i32 %.0
}

attributes #0 = { nofree norecurse 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !12, i64 48, !13, i64 68, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !11, i64 8, !7, i64 16, !7, i64 24, !11, i64 32}
!11 = !{!"int", !8, i64 0}
!12 = !{!"", !8, i64 0, !11, i64 16}
!13 = !{!"", !8, i64 0, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !11, i64 0}
!16 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !8, i64 28}
!17 = !{!16, !11, i64 4}
!18 = !{!16, !11, i64 8}
!19 = !{!16, !11, i64 12}
!20 = !{!16, !11, i64 16}
!21 = !{!16, !11, i64 20}
!22 = !{!16, !11, i64 24}


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