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

; 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.RCC_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [9 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x 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 }

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_ETH_Init(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i32 1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %190

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %11, i32 0, i32 5
  %13 = load volatile i32, ptr %12, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %10
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  call void @HAL_ETH_MspInit(ptr noundef %16)
  br label %17

17:                                               ; preds = %15, %10
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %18, i32 0, i32 5
  store volatile i32 35, ptr %19, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %21 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 53), align 4, !tbaa !15
  %22 = zext i32 %21 to i64
  %23 = or i64 %22, 2
  %24 = trunc i64 %23 to i32
  store volatile i32 %24, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 53), align 4, !tbaa !15
  %25 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 53), align 4, !tbaa !15
  %26 = zext i32 %25 to i64
  %27 = and i64 %26, 2
  %28 = trunc i64 %27 to i32
  store volatile i32 %28, ptr %6, align 4, !tbaa !17
  %29 = load volatile i32, ptr %6, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %30

30:                                               ; preds = %20
  br label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %32, i32 0, i32 1
  %34 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 8, !tbaa !18
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %31
  call void @HAL_SYSCFG_ETHInterfaceSelect(i32 noundef 0)
  br label %39

38:                                               ; preds = %31
  call void @HAL_SYSCFG_ETHInterfaceSelect(i32 noundef 8388608)
  br label %39

39:                                               ; preds = %38, %37
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !19
  %43 = getelementptr inbounds %struct.ETH_TypeDef, ptr %42, i32 0, i32 136
  %44 = load volatile i32, ptr %43, align 4, !tbaa !20
  %45 = zext i32 %44 to i64
  %46 = or i64 %45, 1
  %47 = trunc i64 %46 to i32
  store volatile i32 %47, ptr %43, align 4, !tbaa !20
  %48 = call i32 @HAL_GetTick()
  store i32 %48, ptr %4, align 4, !tbaa !17
  br label %49

49:                                               ; preds = %68, %39
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !19
  %53 = getelementptr inbounds %struct.ETH_TypeDef, ptr %52, i32 0, i32 136
  %54 = load volatile i32, ptr %53, align 4, !tbaa !20
  %55 = zext i32 %54 to i64
  %56 = and i64 %55, 1
  %57 = icmp ugt i64 %56, 0
  br i1 %57, label %58, label %69

58:                                               ; preds = %49
  %59 = call i32 @HAL_GetTick()
  %60 = load i32, ptr %4, align 4, !tbaa !17
  %61 = sub i32 %59, %60
  %62 = icmp ugt i32 %61, 500
  br i1 %62, label %63, label %68

63:                                               ; preds = %58
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %64, i32 0, i32 7
  store volatile i32 4, ptr %65, align 4, !tbaa !22
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %66, i32 0, i32 5
  store volatile i32 224, ptr %67, align 4, !tbaa !9
  store i32 1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %190

68:                                               ; preds = %58
  br label %49, !llvm.loop !23

69:                                               ; preds = %49
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ETH_MAC_MDIO_ClkConfig(ptr noundef %70)
  %71 = call i32 @HAL_RCC_GetHCLKFreq()
  %72 = udiv i32 %71, 1000000
  %73 = sub i32 %72, 1
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !19
  %77 = getelementptr inbounds %struct.ETH_TypeDef, ptr %76, i32 0, i32 28
  store volatile i32 %73, ptr %77, align 4, !tbaa !25
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ETH_MACDMAConfig(ptr noundef %78)
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !19
  %82 = getelementptr inbounds %struct.ETH_TypeDef, ptr %81, i32 0, i32 141
  %83 = load volatile i32, ptr %82, align 4, !tbaa !26
  %84 = zext i32 %83 to i64
  %85 = and i64 %84, -1835009
  %86 = or i64 %85, 524288
  %87 = trunc i64 %86 to i32
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !19
  %91 = getelementptr inbounds %struct.ETH_TypeDef, ptr %90, i32 0, i32 141
  store volatile i32 %87, ptr %91, align 4, !tbaa !26
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %92, i32 0, i32 1
  %94 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %93, i32 0, i32 4
  %95 = load i32, ptr %94, align 8, !tbaa !27
  %96 = urem i32 %95, 4
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %103

98:                                               ; preds = %69
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %99, i32 0, i32 7
  store volatile i32 1, ptr %100, align 4, !tbaa !22
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %101, i32 0, i32 5
  store volatile i32 224, ptr %102, align 4, !tbaa !9
  store i32 1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %190

103:                                              ; preds = %69
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !19
  %107 = getelementptr inbounds %struct.ETH_TypeDef, ptr %106, i32 0, i32 143
  %108 = load volatile i32, ptr %107, align 4, !tbaa !28
  %109 = zext i32 %108 to i64
  %110 = and i64 %109, -32767
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %111, i32 0, i32 1
  %113 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %112, i32 0, i32 4
  %114 = load i32, ptr %113, align 8, !tbaa !27
  %115 = shl i32 %114, 1
  %116 = zext i32 %115 to i64
  %117 = or i64 %110, %116
  %118 = trunc i64 %117 to i32
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !19
  %122 = getelementptr inbounds %struct.ETH_TypeDef, ptr %121, i32 0, i32 143
  store volatile i32 %118, ptr %122, align 4, !tbaa !28
  br label %123

123:                                              ; preds = %103
  %124 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ETH_DMATxDescListInit(ptr noundef %124)
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ETH_DMARxDescListInit(ptr noundef %125)
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %126, i32 0, i32 1
  %128 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !29
  %130 = getelementptr inbounds i8, ptr %129, i64 5
  %131 = load i8, ptr %130, align 1, !tbaa !30
  %132 = zext i8 %131 to i32
  %133 = shl i32 %132, 8
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %134, i32 0, i32 1
  %136 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !29
  %138 = getelementptr inbounds i8, ptr %137, i64 4
  %139 = load i8, ptr %138, align 1, !tbaa !30
  %140 = zext i8 %139 to i32
  %141 = or i32 %133, %140
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %142, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !19
  %145 = getelementptr inbounds %struct.ETH_TypeDef, ptr %144, i32 0, i32 42
  store volatile i32 %141, ptr %145, align 4, !tbaa !31
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %146, i32 0, i32 1
  %148 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !29
  %150 = getelementptr inbounds i8, ptr %149, i64 3
  %151 = load i8, ptr %150, align 1, !tbaa !30
  %152 = zext i8 %151 to i32
  %153 = shl i32 %152, 24
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %154, i32 0, i32 1
  %156 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !29
  %158 = getelementptr inbounds i8, ptr %157, i64 2
  %159 = load i8, ptr %158, align 1, !tbaa !30
  %160 = zext i8 %159 to i32
  %161 = shl i32 %160, 16
  %162 = or i32 %153, %161
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %163, i32 0, i32 1
  %165 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %164, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !29
  %167 = getelementptr inbounds i8, ptr %166, i64 1
  %168 = load i8, ptr %167, align 1, !tbaa !30
  %169 = zext i8 %168 to i32
  %170 = shl i32 %169, 8
  %171 = or i32 %162, %170
  %172 = load ptr, ptr %3, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %172, i32 0, i32 1
  %174 = getelementptr inbounds %struct.ETH_InitTypeDef, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %174, align 8, !tbaa !29
  %176 = getelementptr inbounds i8, ptr %175, i64 0
  %177 = load i8, ptr %176, align 1, !tbaa !30
  %178 = zext i8 %177 to i32
  %179 = or i32 %171, %178
  %180 = load ptr, ptr %3, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %180, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8, !tbaa !19
  %183 = getelementptr inbounds %struct.ETH_TypeDef, ptr %182, i32 0, i32 43
  store volatile i32 %179, ptr %183, align 4, !tbaa !32
  %184 = load ptr, ptr %3, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %184, i32 0, i32 7
  store volatile i32 0, ptr %185, align 4, !tbaa !22
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %186, i32 0, i32 5
  store volatile i32 16, ptr %187, align 4, !tbaa !9
  %188 = load ptr, ptr %3, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.ETH_HandleTypeDef, ptr %188, i32 0, i32 6
  store volatile i32 16, ptr %189, align 8, !tbaa !33
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %190

190:                                              ; preds = %123, %98, %63, %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %191 = load i32, ptr %2, align 4
  ret i32 %191
}

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

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

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

declare void @HAL_SYSCFG_ETHInterfaceSelect(i32 noundef) #2

declare i32 @HAL_GetTick() #2

; Function Attrs: nounwind uwtable
declare hidden void @ETH_MAC_MDIO_ClkConfig(ptr noundef) #0

declare i32 @HAL_RCC_GetHCLKFreq() #2

; Function Attrs: nounwind uwtable
declare hidden void @ETH_MACDMAConfig(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @ETH_DMATxDescListInit(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @ETH_DMARxDescListInit(ptr noundef) #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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 108}
!10 = !{!"", !6, i64 0, !11, i64 8, !13, i64 48, !14, i64 68, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132}
!11 = !{!"", !6, i64 0, !12, i64 8, !6, i64 16, !6, i64 24, !12, i64 32}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !7, i64 0, !12, i64 16}
!14 = !{!"", !7, i64 0, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32}
!15 = !{!16, !12, i64 244}
!16 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !7, i64 172, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !12, i64 232, !12, i64 236, !12, i64 240, !12, i64 244, !12, i64 248, !12, i64 252, !12, i64 256, !12, i64 260, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !12, i64 280, !12, i64 284, !7, i64 288}
!17 = !{!12, !12, i64 0}
!18 = !{!10, !12, i64 16}
!19 = !{!10, !6, i64 0}
!20 = !{!21, !12, i64 4096}
!21 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !7, i64 24, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !7, i64 104, !12, i64 112, !7, i64 116, !12, i64 144, !7, i64 148, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !7, i64 200, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !7, i64 224, !12, i64 272, !12, i64 276, !12, i64 280, !12, i64 284, !12, i64 288, !12, i64 292, !7, i64 296, !12, i64 512, !12, i64 516, !7, i64 520, !12, i64 528, !7, i64 532, !12, i64 768, !12, i64 772, !12, i64 776, !12, i64 780, !12, i64 784, !12, i64 788, !12, i64 792, !12, i64 796, !7, i64 800, !12, i64 1792, !12, i64 1796, !12, i64 1800, !12, i64 1804, !12, i64 1808, !7, i64 1812, !12, i64 1868, !12, i64 1872, !7, i64 1876, !12, i64 1896, !7, i64 1900, !12, i64 1940, !12, i64 1944, !7, i64 1948, !12, i64 1988, !7, i64 1992, !12, i64 2028, !12, i64 2032, !12, i64 2036, !12, i64 2040, !7, i64 2044, !12, i64 2304, !12, i64 2308, !7, i64 2312, !12, i64 2320, !12, i64 2324, !12, i64 2328, !12, i64 2332, !7, i64 2336, !12, i64 2352, !12, i64 2356, !7, i64 2360, !12, i64 2368, !12, i64 2372, !12, i64 2376, !12, i64 2380, !7, i64 2384, !12, i64 2816, !12, i64 2820, !12, i64 2824, !12, i64 2828, !12, i64 2832, !12, i64 2836, !12, i64 2840, !12, i64 2844, !12, i64 2848, !7, i64 2852, !12, i64 2864, !12, i64 2868, !7, i64 2872, !12, i64 2880, !12, i64 2884, !12, i64 2888, !12, i64 2892, !12, i64 2896, !12, i64 2900, !12, i64 2904, !12, i64 2908, !7, i64 2912, !12, i64 2928, !7, i64 2932, !12, i64 2944, !12, i64 2948, !12, i64 2952, !12, i64 2956, !7, i64 2960, !12, i64 3008, !12, i64 3012, !12, i64 3016, !12, i64 3020, !12, i64 3024, !7, i64 3028, !12, i64 3072, !7, i64 3076, !12, i64 3104, !7, i64 3108, !12, i64 3328, !12, i64 3332, !12, i64 3336, !7, i64 3340, !12, i64 3372, !12, i64 3376, !12, i64 3380, !12, i64 3384, !7, i64 3388, !12, i64 4096, !12, i64 4100, !12, i64 4104, !12, i64 4108, !7, i64 4112, !12, i64 4352, !12, i64 4356, !12, i64 4360, !7, i64 4364, !12, i64 4372, !12, i64 4376, !12, i64 4380, !12, i64 4384, !12, i64 4388, !12, i64 4392, !12, i64 4396, !12, i64 4400, !12, i64 4404, !12, i64 4408, !12, i64 4412, !12, i64 4416, !12, i64 4420, !12, i64 4424, !12, i64 4428, !12, i64 4432, !12, i64 4436, !12, i64 4440, !12, i64 4444, !12, i64 4448, !7, i64 4452, !12, i64 4460}
!22 = !{!10, !12, i64 116}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!21, !12, i64 220}
!26 = !{!21, !12, i64 4352}
!27 = !{!10, !12, i64 40}
!28 = !{!21, !12, i64 4360}
!29 = !{!10, !6, i64 8}
!30 = !{!7, !7, i64 0}
!31 = !{!21, !12, i64 768}
!32 = !{!21, !12, i64 772}
!33 = !{!10, !12, i64 112}


; 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: nounwind uwtable
define dso_local range(i32 0, 2) i32 @HAL_ETH_Init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = icmp eq ptr %0, null
  br i1 %3, label %66, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 108
  %6 = load volatile i32, ptr %5, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %9

8:                                                ; preds = %4
  tail call void @HAL_ETH_MspInit(ptr noundef nonnull %0)
  br label %9

9:                                                ; preds = %8, %4
  store volatile i32 35, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2)
  %10 = load volatile i32, ptr inttoptr (i64 1476543732 to ptr), align 4, !tbaa !14
  %11 = or i32 %10, 2
  store volatile i32 %11, ptr inttoptr (i64 1476543732 to ptr), align 4, !tbaa !14
  %12 = load volatile i32, ptr inttoptr (i64 1476543732 to ptr), align 4, !tbaa !14
  %13 = and i32 %12, 2
  store volatile i32 %13, ptr %2, align 4, !tbaa !16
  %.0..0..0..0. = load volatile i32, ptr %2, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2)
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load i32, ptr %15, align 8, !tbaa !17
  %17 = icmp eq i32 %16, 0
  %. = select i1 %17, i32 0, i32 8388608
  tail call void @HAL_SYSCFG_ETHInterfaceSelect(i32 noundef %.) #3
  %18 = load ptr, ptr %0, align 8, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %18, i64 4096
  %20 = load volatile i32, ptr %19, align 4, !tbaa !19
  %21 = or i32 %20, 1
  store volatile i32 %21, ptr %19, align 4, !tbaa !19
  %22 = tail call i32 @HAL_GetTick() #3
  br label %23

23:                                               ; preds = %28, %9
  %24 = load ptr, ptr %0, align 8, !tbaa !18
  %25 = getelementptr inbounds i8, ptr %24, i64 4096
  %26 = load volatile i32, ptr %25, align 4, !tbaa !19
  %27 = and i32 %26, 1
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %34, label %28

28:                                               ; preds = %23
  %29 = tail call i32 @HAL_GetTick() #3
  %30 = sub i32 %29, %22
  %31 = icmp ugt i32 %30, 500
  br i1 %31, label %32, label %23, !llvm.loop !21

32:                                               ; preds = %28
  %33 = getelementptr inbounds i8, ptr %0, i64 116
  store volatile i32 4, ptr %33, align 4, !tbaa !23
  store volatile i32 224, ptr %5, align 4, !tbaa !5
  br label %66

34:                                               ; preds = %23
  tail call void @ETH_MAC_MDIO_ClkConfig(ptr noundef nonnull %0)
  %35 = tail call i32 @HAL_RCC_GetHCLKFreq() #3
  %36 = udiv i32 %35, 1000000
  %37 = add nsw i32 %36, -1
  %38 = load ptr, ptr %0, align 8, !tbaa !18
  %39 = getelementptr inbounds i8, ptr %38, i64 220
  store volatile i32 %37, ptr %39, align 4, !tbaa !24
  tail call void @ETH_MACDMAConfig(ptr noundef nonnull %0)
  %40 = load ptr, ptr %0, align 8, !tbaa !18
  %41 = getelementptr inbounds i8, ptr %40, i64 4352
  %42 = load volatile i32, ptr %41, align 4, !tbaa !25
  %43 = and i32 %42, -1835009
  %44 = or disjoint i32 %43, 524288
  store volatile i32 %44, ptr %41, align 4, !tbaa !25
  %45 = getelementptr inbounds i8, ptr %0, i64 40
  %46 = load i32, ptr %45, align 8, !tbaa !26
  %47 = and i32 %46, 3
  %.not36 = icmp eq i32 %47, 0
  br i1 %.not36, label %50, label %48

48:                                               ; preds = %34
  %49 = getelementptr inbounds i8, ptr %0, i64 116
  store volatile i32 1, ptr %49, align 4, !tbaa !23
  store volatile i32 224, ptr %5, align 4, !tbaa !5
  br label %66

50:                                               ; preds = %34
  %51 = getelementptr inbounds i8, ptr %40, i64 4360
  %52 = load volatile i32, ptr %51, align 4, !tbaa !27
  %53 = and i32 %52, -32767
  %54 = shl i32 %46, 1
  %55 = or i32 %53, %54
  store volatile i32 %55, ptr %51, align 4, !tbaa !27
  tail call void @ETH_DMATxDescListInit(ptr noundef nonnull %0)
  tail call void @ETH_DMARxDescListInit(ptr noundef nonnull %0)
  %56 = load ptr, ptr %14, align 8, !tbaa !28
  %57 = getelementptr i8, ptr %56, i64 4
  %58 = load i16, ptr %57, align 1
  %59 = zext i16 %58 to i32
  %60 = load ptr, ptr %0, align 8, !tbaa !18
  %61 = getelementptr inbounds i8, ptr %60, i64 768
  store volatile i32 %59, ptr %61, align 4, !tbaa !29
  %62 = load i32, ptr %56, align 1
  %63 = getelementptr inbounds i8, ptr %60, i64 772
  store volatile i32 %62, ptr %63, align 4, !tbaa !30
  %64 = getelementptr inbounds i8, ptr %0, i64 116
  store volatile i32 0, ptr %64, align 4, !tbaa !23
  store volatile i32 16, ptr %5, align 4, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %0, i64 112
  store volatile i32 16, ptr %65, align 8, !tbaa !31
  br label %66

66:                                               ; preds = %1, %50, %48, %32
  %.0 = phi i32 [ 1, %32 ], [ 1, %48 ], [ 0, %50 ], [ 1, %1 ]
  ret i32 %.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: nounwind uwtable
declare dso_local void @HAL_ETH_MspInit(ptr noundef) local_unnamed_addr #0

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

declare void @HAL_SYSCFG_ETHInterfaceSelect(i32 noundef) local_unnamed_addr #2

declare i32 @HAL_GetTick() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @ETH_MAC_MDIO_ClkConfig(ptr noundef) local_unnamed_addr #0

declare i32 @HAL_RCC_GetHCLKFreq() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @ETH_MACDMAConfig(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @ETH_DMATxDescListInit(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @ETH_DMARxDescListInit(ptr noundef) local_unnamed_addr #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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !11, i64 108}
!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 244}
!15 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !8, i64 172, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !8, i64 288}
!16 = !{!11, !11, i64 0}
!17 = !{!6, !11, i64 16}
!18 = !{!6, !7, i64 0}
!19 = !{!20, !11, i64 4096}
!20 = !{!"", !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}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!6, !11, i64 116}
!24 = !{!20, !11, i64 220}
!25 = !{!20, !11, i64 4352}
!26 = !{!6, !11, i64 40}
!27 = !{!20, !11, i64 4360}
!28 = !{!6, !7, i64 8}
!29 = !{!20, !11, i64 768}
!30 = !{!20, !11, i64 772}
!31 = !{!6, !11, i64 112}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass