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

; 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_TxVLANConfigTypeDef = type { i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_ETHEx_SetTxVLANConfig(ptr noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load i32, ptr %5, align 4, !tbaa !9
  %8 = icmp eq i32 %7, 1
  br i1 %8, label %9, label %45

9:                                                ; preds = %3
  %10 = load ptr, ptr %4, 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 12
  %14 = load volatile i32, ptr %13, align 4, !tbaa !16
  %15 = zext i32 %14 to i64
  %16 = and i64 %15, -2031617
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ETH_TxVLANConfigTypeDef, ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 4, !tbaa !18
  %20 = shl i32 %19, 20
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ETH_TxVLANConfigTypeDef, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !20
  %24 = shl i32 %23, 19
  %25 = or i32 %20, %24
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ETH_TxVLANConfigTypeDef, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !21
  %29 = or i32 %25, %28
  %30 = zext i32 %29 to i64
  %31 = or i64 %16, %30
  %32 = trunc i64 %31 to i32
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds %struct.ETH_TypeDef, ptr %35, i32 0, i32 12
  store volatile i32 %32, ptr %36, align 4, !tbaa !16
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %struct.ETH_TypeDef, ptr %39, i32 0, i32 7
  %41 = load volatile i32, ptr %40, align 4, !tbaa !22
  %42 = zext i32 %41 to i64
  %43 = or i64 %42, 67108864
  %44 = trunc i64 %43 to i32
  store volatile i32 %44, ptr %40, align 4, !tbaa !22
  br label %73

45:                                               ; preds = %3
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds %struct.ETH_TypeDef, ptr %48, i32 0, i32 11
  %50 = load volatile i32, ptr %49, align 4, !tbaa !23
  %51 = zext i32 %50 to i64
  %52 = and i64 %51, -2031617
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ETH_TxVLANConfigTypeDef, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = shl i32 %55, 20
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ETH_TxVLANConfigTypeDef, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !20
  %60 = shl i32 %59, 19
  %61 = or i32 %56, %60
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ETH_TxVLANConfigTypeDef, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 4, !tbaa !21
  %65 = or i32 %61, %64
  %66 = zext i32 %65 to i64
  %67 = or i64 %52, %66
  %68 = trunc i64 %67 to i32
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !11
  %72 = getelementptr inbounds %struct.ETH_TypeDef, ptr %71, i32 0, i32 11
  store volatile i32 %68, ptr %72, align 4, !tbaa !23
  br label %73

73:                                               ; preds = %45, %9
  ret i32 0
}

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 100}
!17 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !7, i64 24, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !7, i64 104, !10, i64 112, !7, i64 116, !10, i64 144, !7, i64 148, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !7, i64 200, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !7, i64 224, !10, i64 272, !10, i64 276, !10, i64 280, !10, i64 284, !10, i64 288, !10, i64 292, !7, i64 296, !10, i64 512, !10, i64 516, !7, i64 520, !10, i64 528, !7, i64 532, !10, i64 768, !10, i64 772, !10, i64 776, !10, i64 780, !10, i64 784, !10, i64 788, !10, i64 792, !10, i64 796, !7, i64 800, !10, i64 1792, !10, i64 1796, !10, i64 1800, !10, i64 1804, !10, i64 1808, !7, i64 1812, !10, i64 1868, !10, i64 1872, !7, i64 1876, !10, i64 1896, !7, i64 1900, !10, i64 1940, !10, i64 1944, !7, i64 1948, !10, i64 1988, !7, i64 1992, !10, i64 2028, !10, i64 2032, !10, i64 2036, !10, i64 2040, !7, i64 2044, !10, i64 2304, !10, i64 2308, !7, i64 2312, !10, i64 2320, !10, i64 2324, !10, i64 2328, !10, i64 2332, !7, i64 2336, !10, i64 2352, !10, i64 2356, !7, i64 2360, !10, i64 2368, !10, i64 2372, !10, i64 2376, !10, i64 2380, !7, i64 2384, !10, i64 2816, !10, i64 2820, !10, i64 2824, !10, i64 2828, !10, i64 2832, !10, i64 2836, !10, i64 2840, !10, i64 2844, !10, i64 2848, !7, i64 2852, !10, i64 2864, !10, i64 2868, !7, i64 2872, !10, i64 2880, !10, i64 2884, !10, i64 2888, !10, i64 2892, !10, i64 2896, !10, i64 2900, !10, i64 2904, !10, i64 2908, !7, i64 2912, !10, i64 2928, !7, i64 2932, !10, i64 2944, !10, i64 2948, !10, i64 2952, !10, i64 2956, !7, i64 2960, !10, i64 3008, !10, i64 3012, !10, i64 3016, !10, i64 3020, !10, i64 3024, !7, i64 3028, !10, i64 3072, !7, i64 3076, !10, i64 3104, !7, i64 3108, !10, i64 3328, !10, i64 3332, !10, i64 3336, !7, i64 3340, !10, i64 3372, !10, i64 3376, !10, i64 3380, !10, i64 3384, !7, i64 3388, !10, i64 4096, !10, i64 4100, !10, i64 4104, !10, i64 4108, !7, i64 4112, !10, i64 4352, !10, i64 4356, !10, i64 4360, !7, i64 4364, !10, i64 4372, !10, i64 4376, !10, i64 4380, !10, i64 4384, !10, i64 4388, !10, i64 4392, !10, i64 4396, !10, i64 4400, !10, i64 4404, !10, i64 4408, !10, i64 4412, !10, i64 4416, !10, i64 4420, !10, i64 4424, !10, i64 4428, !10, i64 4432, !10, i64 4436, !10, i64 4440, !10, i64 4444, !10, i64 4448, !7, i64 4452, !10, i64 4460}
!18 = !{!19, !10, i64 0}
!19 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}
!20 = !{!19, !10, i64 4}
!21 = !{!19, !10, i64 8}
!22 = !{!17, !10, i64 80}
!23 = !{!17, !10, i64 96}


; 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 noundef i32 @HAL_ETHEx_SetTxVLANConfig(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = icmp eq i32 %1, 1
  %5 = load ptr, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %2, i64 4
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  br i1 %4, label %8, label %23

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %5, i64 100
  %10 = load volatile i32, ptr %9, align 4, !tbaa !14
  %11 = and i32 %10, -2031617
  %12 = load i32, ptr %2, align 4, !tbaa !16
  %13 = shl i32 %12, 20
  %14 = load i32, ptr %6, align 4, !tbaa !18
  %15 = shl i32 %14, 19
  %16 = load i32, ptr %7, align 4, !tbaa !19
  %17 = or i32 %13, %11
  %18 = or i32 %17, %15
  %19 = or i32 %18, %16
  store volatile i32 %19, ptr %9, align 4, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %5, i64 80
  %21 = load volatile i32, ptr %20, align 4, !tbaa !20
  %22 = or i32 %21, 67108864
  store volatile i32 %22, ptr %20, align 4, !tbaa !20
  br label %35

23:                                               ; preds = %3
  %24 = getelementptr inbounds i8, ptr %5, i64 96
  %25 = load volatile i32, ptr %24, align 4, !tbaa !21
  %26 = and i32 %25, -2031617
  %27 = load i32, ptr %2, align 4, !tbaa !16
  %28 = shl i32 %27, 20
  %29 = load i32, ptr %6, align 4, !tbaa !18
  %30 = shl i32 %29, 19
  %31 = load i32, ptr %7, align 4, !tbaa !19
  %32 = or i32 %28, %26
  %33 = or i32 %32, %30
  %34 = or i32 %33, %31
  store volatile i32 %34, ptr %24, align 4, !tbaa !21
  br label %35

35:                                               ; preds = %23, %8
  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 = !{!15, !11, i64 100}
!15 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !8, i64 24, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !8, i64 104, !11, i64 112, !8, i64 116, !11, i64 144, !8, i64 148, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !8, i64 200, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !8, i64 224, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !8, i64 296, !11, i64 512, !11, i64 516, !8, i64 520, !11, i64 528, !8, i64 532, !11, i64 768, !11, i64 772, !11, i64 776, !11, i64 780, !11, i64 784, !11, i64 788, !11, i64 792, !11, i64 796, !8, i64 800, !11, i64 1792, !11, i64 1796, !11, i64 1800, !11, i64 1804, !11, i64 1808, !8, i64 1812, !11, i64 1868, !11, i64 1872, !8, i64 1876, !11, i64 1896, !8, i64 1900, !11, i64 1940, !11, i64 1944, !8, i64 1948, !11, i64 1988, !8, i64 1992, !11, i64 2028, !11, i64 2032, !11, i64 2036, !11, i64 2040, !8, i64 2044, !11, i64 2304, !11, i64 2308, !8, i64 2312, !11, i64 2320, !11, i64 2324, !11, i64 2328, !11, i64 2332, !8, i64 2336, !11, i64 2352, !11, i64 2356, !8, i64 2360, !11, i64 2368, !11, i64 2372, !11, i64 2376, !11, i64 2380, !8, i64 2384, !11, i64 2816, !11, i64 2820, !11, i64 2824, !11, i64 2828, !11, i64 2832, !11, i64 2836, !11, i64 2840, !11, i64 2844, !11, i64 2848, !8, i64 2852, !11, i64 2864, !11, i64 2868, !8, i64 2872, !11, i64 2880, !11, i64 2884, !11, i64 2888, !11, i64 2892, !11, i64 2896, !11, i64 2900, !11, i64 2904, !11, i64 2908, !8, i64 2912, !11, i64 2928, !8, i64 2932, !11, i64 2944, !11, i64 2948, !11, i64 2952, !11, i64 2956, !8, i64 2960, !11, i64 3008, !11, i64 3012, !11, i64 3016, !11, i64 3020, !11, i64 3024, !8, i64 3028, !11, i64 3072, !8, i64 3076, !11, i64 3104, !8, i64 3108, !11, i64 3328, !11, i64 3332, !11, i64 3336, !8, i64 3340, !11, i64 3372, !11, i64 3376, !11, i64 3380, !11, i64 3384, !8, i64 3388, !11, i64 4096, !11, i64 4100, !11, i64 4104, !11, i64 4108, !8, i64 4112, !11, i64 4352, !11, i64 4356, !11, i64 4360, !8, i64 4364, !11, i64 4372, !11, i64 4376, !11, i64 4380, !11, i64 4384, !11, i64 4388, !11, i64 4392, !11, i64 4396, !11, i64 4400, !11, i64 4404, !11, i64 4408, !11, i64 4412, !11, i64 4416, !11, i64 4420, !11, i64 4424, !11, i64 4428, !11, i64 4432, !11, i64 4436, !11, i64 4440, !11, i64 4444, !11, i64 4448, !8, i64 4452, !11, i64 4460}
!16 = !{!17, !11, i64 0}
!17 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!18 = !{!17, !11, i64 4}
!19 = !{!17, !11, i64 8}
!20 = !{!15, !11, i64 80}
!21 = !{!15, !11, i64 96}


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