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

; 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.DFSDM_Channel_HandleTypeDef = type { ptr, %struct.DFSDM_Channel_InitTypeDef, i32 }
%struct.DFSDM_Channel_InitTypeDef = type { %struct.DFSDM_Channel_OutputClockTypeDef, %struct.DFSDM_Channel_InputTypeDef, %struct.DFSDM_Channel_SerialInterfaceTypeDef, %struct.DFSDM_Channel_AwdTypeDef, i32, i32 }
%struct.DFSDM_Channel_OutputClockTypeDef = type { i32, i32, i32 }
%struct.DFSDM_Channel_InputTypeDef = type { i32, i32, i32 }
%struct.DFSDM_Channel_SerialInterfaceTypeDef = type { i32, i32 }
%struct.DFSDM_Channel_AwdTypeDef = type { i32, i32 }
%struct.DFSDM_Filter_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.DFSDM_Channel_TypeDef = type { i32, i32, i32, i32, 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_DFSDM_ChannelScdStart_IT(ptr noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.DFSDM_Channel_HandleTypeDef, ptr %8, i32 0, i32 2
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = icmp ne i32 %10, 1
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %44

13:                                               ; preds = %3
  %14 = load volatile i32, ptr getelementptr inbounds (%struct.DFSDM_Filter_TypeDef, ptr inttoptr (i64 1073836288 to ptr), i32 0, i32 1), align 4, !tbaa !16
  %15 = zext i32 %14 to i64
  %16 = or i64 %15, 32
  %17 = trunc i64 %16 to i32
  store volatile i32 %17, ptr getelementptr inbounds (%struct.DFSDM_Filter_TypeDef, ptr inttoptr (i64 1073836288 to ptr), i32 0, i32 1), align 4, !tbaa !16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.DFSDM_Channel_HandleTypeDef, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  %21 = getelementptr inbounds %struct.DFSDM_Channel_TypeDef, ptr %20, i32 0, i32 2
  %22 = load volatile i32, ptr %21, align 4, !tbaa !19
  %23 = zext i32 %22 to i64
  %24 = and i64 %23, -61696
  %25 = trunc i64 %24 to i32
  store volatile i32 %25, ptr %21, align 4, !tbaa !19
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = shl i32 %26, 12
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = or i32 %27, %28
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.DFSDM_Channel_HandleTypeDef, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %33 = getelementptr inbounds %struct.DFSDM_Channel_TypeDef, ptr %32, i32 0, i32 2
  %34 = load volatile i32, ptr %33, align 4, !tbaa !19
  %35 = or i32 %34, %29
  store volatile i32 %35, ptr %33, align 4, !tbaa !19
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.DFSDM_Channel_HandleTypeDef, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds %struct.DFSDM_Channel_TypeDef, ptr %38, i32 0, i32 0
  %40 = load volatile i32, ptr %39, align 4, !tbaa !21
  %41 = zext i32 %40 to i64
  %42 = or i64 %41, 32
  %43 = trunc i64 %42 to i32
  store volatile i32 %43, ptr %39, align 4, !tbaa !21
  br label %44

44:                                               ; preds = %13, %12
  %45 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret i32 %45
}

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, !10, i64 56}
!12 = !{!"", !6, i64 0, !13, i64 8, !10, i64 56}
!13 = !{!"", !14, i64 0, !14, i64 12, !15, i64 24, !15, i64 32, !10, i64 40, !10, i64 44}
!14 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8}
!15 = !{!"", !10, i64 0, !10, i64 4}
!16 = !{!17, !10, i64 4}
!17 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56}
!18 = !{!12, !6, i64 0}
!19 = !{!20, !10, i64 8}
!20 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!21 = !{!20, !10, i64 0}


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

6:                                                ; preds = %3
  %7 = load volatile i32, ptr inttoptr (i64 1073836292 to ptr), align 4, !tbaa !14
  %8 = or i32 %7, 32
  store volatile i32 %8, ptr inttoptr (i64 1073836292 to ptr), align 4, !tbaa !14
  %9 = load ptr, ptr %0, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = load volatile i32, ptr %10, align 4, !tbaa !17
  %12 = and i32 %11, -61696
  store volatile i32 %12, ptr %10, align 4, !tbaa !17
  %13 = shl i32 %2, 12
  %14 = or i32 %13, %1
  %15 = load volatile i32, ptr %10, align 4, !tbaa !17
  %16 = or i32 %14, %15
  store volatile i32 %16, ptr %10, align 4, !tbaa !17
  %17 = load volatile i32, ptr %9, align 4, !tbaa !19
  %18 = or i32 %17, 32
  store volatile i32 %18, ptr %9, align 4, !tbaa !19
  br label %19

19:                                               ; preds = %3, %6
  %.0 = phi i32 [ 0, %6 ], [ 1, %3 ]
  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, !12, i64 56}
!6 = !{!"", !7, i64 0, !10, i64 8, !12, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 12, !13, i64 24, !13, i64 32, !12, i64 40, !12, i64 44}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"int", !8, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 4}
!14 = !{!15, !12, i64 4}
!15 = !{!"", !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}
!16 = !{!6, !7, i64 0}
!17 = !{!18, !12, i64 8}
!18 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!19 = !{!18, !12, i64 0}


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