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

; 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: nounwind uwtable
define dso_local i32 @HAL_ETHEx_GetL3FilterConfig(ptr noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  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
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  store i32 1, ptr %4, align 4
  br label %150

11:                                               ; preds = %3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %12, i32 0, i32 0
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds %struct.ETH_TypeDef, ptr %14, i32 0, i32 72
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %15, i64 %17
  %19 = load volatile i32, ptr %18, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = and i64 %20, 1
  %22 = trunc i64 %21 to i32
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %23, i32 0, i32 0
  store i32 %22, ptr %24, align 4, !tbaa !16
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds %struct.ETH_TypeDef, ptr %27, i32 0, i32 72
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %28, i64 %30
  %32 = load volatile i32, ptr %31, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = and i64 %33, 12
  %35 = trunc i64 %34 to i32
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %36, i32 0, i32 1
  store i32 %35, ptr %37, align 4, !tbaa !18
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = getelementptr inbounds %struct.ETH_TypeDef, ptr %40, i32 0, i32 72
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  %45 = load volatile i32, ptr %44, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = and i64 %46, 48
  %48 = trunc i64 %47 to i32
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %49, i32 0, i32 2
  store i32 %48, ptr %50, align 4, !tbaa !19
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.ETH_TypeDef, ptr %53, i32 0, i32 72
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %54, i64 %56
  %58 = load volatile i32, ptr %57, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = and i64 %59, 1984
  %61 = lshr i64 %60, 6
  %62 = trunc i64 %61 to i32
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %63, i32 0, i32 3
  store i32 %62, ptr %64, align 4, !tbaa !20
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct.ETH_TypeDef, ptr %67, i32 0, i32 72
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %68, i64 %70
  %72 = load volatile i32, ptr %71, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = and i64 %73, 63488
  %75 = lshr i64 %74, 11
  %76 = trunc i64 %75 to i32
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %77, i32 0, i32 4
  store i32 %76, ptr %78, align 4, !tbaa !21
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %80, align 4, !tbaa !16
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %128

83:                                               ; preds = %11
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct.ETH_TypeDef, ptr %86, i32 0, i32 75
  %88 = load i32, ptr %6, align 4, !tbaa !9
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr %87, i64 %89
  %91 = load volatile i32, ptr %90, align 4, !tbaa !9
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %92, i32 0, i32 7
  %94 = getelementptr inbounds [4 x i32], ptr %93, i64 0, i64 0
  store i32 %91, ptr %94, align 4, !tbaa !9
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !11
  %98 = getelementptr inbounds %struct.ETH_TypeDef, ptr %97, i32 0, i32 76
  %99 = load i32, ptr %6, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %98, i64 %100
  %102 = load volatile i32, ptr %101, align 4, !tbaa !9
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %103, i32 0, i32 7
  %105 = getelementptr inbounds [4 x i32], ptr %104, i64 0, i64 1
  store i32 %102, ptr %105, align 4, !tbaa !9
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !11
  %109 = getelementptr inbounds %struct.ETH_TypeDef, ptr %108, i32 0, i32 77
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr %109, i64 %111
  %113 = load volatile i32, ptr %112, align 4, !tbaa !9
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %114, i32 0, i32 7
  %116 = getelementptr inbounds [4 x i32], ptr %115, i64 0, i64 2
  store i32 %113, ptr %116, align 4, !tbaa !9
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !11
  %120 = getelementptr inbounds %struct.ETH_TypeDef, ptr %119, i32 0, i32 78
  %121 = load i32, ptr %6, align 4, !tbaa !9
  %122 = zext i32 %121 to i64
  %123 = getelementptr inbounds i32, ptr %120, i64 %122
  %124 = load volatile i32, ptr %123, align 4, !tbaa !9
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %125, i32 0, i32 7
  %127 = getelementptr inbounds [4 x i32], ptr %126, i64 0, i64 3
  store i32 %124, ptr %127, align 4, !tbaa !9
  br label %149

128:                                              ; preds = %11
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !11
  %132 = getelementptr inbounds %struct.ETH_TypeDef, ptr %131, i32 0, i32 75
  %133 = load i32, ptr %6, align 4, !tbaa !9
  %134 = zext i32 %133 to i64
  %135 = getelementptr inbounds i32, ptr %132, i64 %134
  %136 = load volatile i32, ptr %135, align 4, !tbaa !9
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %137, i32 0, i32 5
  store i32 %136, ptr %138, align 4, !tbaa !22
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !11
  %142 = getelementptr inbounds %struct.ETH_TypeDef, ptr %141, i32 0, i32 76
  %143 = load i32, ptr %6, align 4, !tbaa !9
  %144 = zext i32 %143 to i64
  %145 = getelementptr inbounds i32, ptr %142, i64 %144
  %146 = load volatile i32, ptr %145, align 4, !tbaa !9
  %147 = load ptr, ptr %7, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.ETH_L3FilterConfigTypeDef, ptr %147, i32 0, i32 6
  store i32 %146, ptr %148, align 4, !tbaa !23
  br label %149

149:                                              ; preds = %128, %83
  store i32 0, ptr %4, align 4
  br label %150

150:                                              ; preds = %149, %10
  %151 = load i32, ptr %4, align 4
  ret i32 %151
}

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

!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: mustprogress nofree norecurse nounwind willreturn uwtable
define dso_local range(i32 0, 2) i32 @HAL_ETHEx_GetL3FilterConfig(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef writeonly %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %2, null
  br i1 %4, label %45, label %5

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

31:                                               ; preds = %5
  %32 = getelementptr inbounds i8, ptr %2, i64 28
  store i32 %28, ptr %32, align 4, !tbaa !14
  %33 = load volatile i32, ptr %30, align 4, !tbaa !14
  %34 = getelementptr inbounds i8, ptr %2, i64 32
  store i32 %33, ptr %34, align 4, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %6, i64 2328
  %36 = getelementptr inbounds i32, ptr %35, i64 %8
  %37 = load volatile i32, ptr %36, align 4, !tbaa !14
  %38 = getelementptr inbounds i8, ptr %2, i64 36
  store i32 %37, ptr %38, align 4, !tbaa !14
  %39 = getelementptr inbounds i8, ptr %6, i64 2332
  %40 = getelementptr inbounds i32, ptr %39, i64 %8
  br label %.sink.split

41:                                               ; preds = %5
  %42 = getelementptr inbounds i8, ptr %2, i64 20
  store i32 %28, ptr %42, align 4, !tbaa !21
  br label %.sink.split

.sink.split:                                      ; preds = %41, %31
  %.sink38 = phi ptr [ %40, %31 ], [ %30, %41 ]
  %.sink37 = phi i64 [ 40, %31 ], [ 24, %41 ]
  %43 = load volatile i32, ptr %.sink38, align 4, !tbaa !14
  %44 = getelementptr inbounds i8, ptr %2, i64 %.sink37
  store i32 %43, ptr %44, align 4, !tbaa !14
  br label %45

45:                                               ; preds = %.sink.split, %3
  %.0 = phi i32 [ 1, %3 ], [ 0, %.sink.split ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nounwind willreturn 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}


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