; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Middlewares/ST/STM32_USB_Host_Library/Core/Src (DeInit)

; 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._USBH_HandleTypeDef = type { i32, i32, i32, %struct.USBH_CtrlTypeDef, %struct.USBH_DeviceTypeDef, [1 x ptr], ptr, i32, [16 x i32], i32, i32, i8, ptr, ptr }
%struct.USBH_CtrlTypeDef = type { i8, i8, i8, ptr, i16, i16, %union._USB_Setup, i32, i8 }
%union._USB_Setup = type { [2 x i32] }
%struct.USBH_DeviceTypeDef = type { [256 x i8], [512 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, %struct._DeviceDescriptor, %struct._ConfigurationDescriptor }
%struct._DeviceDescriptor = type { i8, i8, i16, i8, i8, i8, i8, i16, i16, i16, i8, i8, i8, i8 }
%struct._ConfigurationDescriptor = type { i8, i8, i16, i8, i8, i8, i8, i8, [2 x %struct._InterfaceDescriptor] }
%struct._InterfaceDescriptor = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, [2 x %struct._EndpointDescriptor] }
%struct._EndpointDescriptor = type { i8, i8, i8, i8, i16, i8 }

; Function Attrs: nounwind uwtable
declare hidden i32 @DeInitStateMachine(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @USBH_DeInit(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = call i32 @DeInitStateMachine(ptr noundef %3)
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %5, i32 0, i32 4
  %7 = getelementptr inbounds %struct.USBH_DeviceTypeDef, ptr %6, i32 0, i32 9
  store i8 0, ptr %7, align 1, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %8, i32 0, i32 4
  %10 = getelementptr inbounds %struct.USBH_DeviceTypeDef, ptr %9, i32 0, i32 6
  store volatile i8 0, ptr %10, align 4, !tbaa !17
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %11, i32 0, i32 4
  %13 = getelementptr inbounds %struct.USBH_DeviceTypeDef, ptr %12, i32 0, i32 7
  store volatile i8 0, ptr %13, align 1, !tbaa !18
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %14, i32 0, i32 4
  %16 = getelementptr inbounds %struct.USBH_DeviceTypeDef, ptr %15, i32 0, i32 8
  store volatile i8 0, ptr %16, align 2, !tbaa !19
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %17, i32 0, i32 4
  %19 = getelementptr inbounds %struct.USBH_DeviceTypeDef, ptr %18, i32 0, i32 5
  store i8 0, ptr %19, align 1, !tbaa !20
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %20, i32 0, i32 4
  %22 = getelementptr inbounds %struct.USBH_DeviceTypeDef, ptr %21, i32 0, i32 4
  store i8 0, ptr %22, align 2, !tbaa !21
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._USBH_HandleTypeDef, ptr %23, i32 0, i32 12
  %25 = load ptr, ptr %24, align 8, !tbaa !22
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %30

27:                                               ; preds = %1
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = call i32 @USBH_LL_Stop(ptr noundef %28)
  br label %30

30:                                               ; preds = %27, %1
  ret i32 0
}

declare i32 @USBH_LL_Stop(ptr noundef) #1

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 = { "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, !7, i64 831}
!10 = !{!"_USBH_HandleTypeDef", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !14, i64 56, !7, i64 920, !6, i64 928, !11, i64 936, !7, i64 940, !11, i64 1004, !11, i64 1008, !7, i64 1012, !6, i64 1016, !6, i64 1024}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !6, i64 8, !13, i64 16, !13, i64 18, !7, i64 20, !11, i64 28, !7, i64 32}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !7, i64 0, !7, i64 256, !7, i64 768, !7, i64 769, !7, i64 770, !7, i64 771, !7, i64 772, !7, i64 773, !7, i64 774, !7, i64 775, !7, i64 776, !15, i64 778, !16, i64 796}
!15 = !{!"_DeviceDescriptor", !7, i64 0, !7, i64 1, !13, i64 2, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !13, i64 8, !13, i64 10, !13, i64 12, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17}
!16 = !{!"_ConfigurationDescriptor", !7, i64 0, !7, i64 1, !13, i64 2, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 10}
!17 = !{!10, !7, i64 828}
!18 = !{!10, !7, i64 829}
!19 = !{!10, !7, i64 830}
!20 = !{!10, !7, i64 827}
!21 = !{!10, !7, i64 826}
!22 = !{!10, !6, i64 1016}


; 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
declare hidden i32 @DeInitStateMachine(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @USBH_DeInit(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call i32 @DeInitStateMachine(ptr noundef %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 831
  store i8 0, ptr %3, align 1, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 828
  store volatile i8 0, ptr %4, align 4, !tbaa !16
  %5 = getelementptr inbounds i8, ptr %0, i64 829
  store volatile i8 0, ptr %5, align 1, !tbaa !17
  %6 = getelementptr inbounds i8, ptr %0, i64 830
  store volatile i8 0, ptr %6, align 2, !tbaa !18
  %7 = getelementptr inbounds i8, ptr %0, i64 827
  store i8 0, ptr %7, align 1, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %0, i64 826
  store i8 0, ptr %8, align 2, !tbaa !20
  %9 = getelementptr inbounds i8, ptr %0, i64 1016
  %10 = load ptr, ptr %9, align 8, !tbaa !21
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %13, label %11

11:                                               ; preds = %1
  %12 = tail call i32 @USBH_LL_Stop(ptr noundef nonnull %0) #2
  br label %13

13:                                               ; preds = %11, %1
  ret i32 0
}

declare i32 @USBH_LL_Stop(ptr noundef) local_unnamed_addr #1

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 = { "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, !8, i64 831}
!6 = !{!"_USBH_HandleTypeDef", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !13, i64 56, !8, i64 920, !11, i64 928, !7, i64 936, !8, i64 940, !7, i64 1004, !7, i64 1008, !8, i64 1012, !11, i64 1016, !11, i64 1024}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !11, i64 8, !12, i64 16, !12, i64 18, !8, i64 20, !7, i64 28, !8, i64 32}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"", !8, i64 0, !8, i64 256, !8, i64 768, !8, i64 769, !8, i64 770, !8, i64 771, !8, i64 772, !8, i64 773, !8, i64 774, !8, i64 775, !8, i64 776, !14, i64 778, !15, i64 796}
!14 = !{!"_DeviceDescriptor", !8, i64 0, !8, i64 1, !12, i64 2, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !12, i64 8, !12, i64 10, !12, i64 12, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17}
!15 = !{!"_ConfigurationDescriptor", !8, i64 0, !8, i64 1, !12, i64 2, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !8, i64 10}
!16 = !{!6, !8, i64 828}
!17 = !{!6, !8, i64 829}
!18 = !{!6, !8, i64 830}
!19 = !{!6, !8, i64 827}
!20 = !{!6, !8, i64 826}
!21 = !{!6, !11, i64 1016}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass