; 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.HCD_HandleTypeDef = type { ptr, %struct.USB_OTG_CfgTypeDef, [16 x %struct.USB_OTG_HCTypeDef], i32, i32, i32, ptr }
%struct.USB_OTG_CfgTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.USB_OTG_HCTypeDef = type { i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, ptr, i32, i32, i8, i8, 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_HCD_HC_Init(ptr noundef %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i8 noundef zeroext %5, i16 noundef zeroext %6) #1 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i16, align 2
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i8 %1, ptr %10, align 1, !tbaa !9
  store i8 %2, ptr %11, align 1, !tbaa !9
  store i8 %3, ptr %12, align 1, !tbaa !9
  store i8 %4, ptr %13, align 1, !tbaa !9
  store i8 %5, ptr %14, align 1, !tbaa !9
  store i16 %6, ptr %15, align 2, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  br label %18

18:                                               ; preds = %7
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %19, i32 0, i32 3
  %21 = load i32, ptr %20, align 8, !tbaa !12
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %24

23:                                               ; preds = %18
  store i32 2, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %116

24:                                               ; preds = %18
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %25, i32 0, i32 3
  store i32 1, ptr %26, align 8, !tbaa !12
  br label %27

27:                                               ; preds = %24
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %30, i32 0, i32 2
  %32 = load i8, ptr %10, align 1, !tbaa !9
  %33 = zext i8 %32 to i64
  %34 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %31, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %34, i32 0, i32 5
  store i8 0, ptr %35, align 1, !tbaa !16
  %36 = load i8, ptr %12, align 1, !tbaa !9
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %37, i32 0, i32 2
  %39 = load i8, ptr %10, align 1, !tbaa !9
  %40 = zext i8 %39 to i64
  %41 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %38, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %41, i32 0, i32 0
  store i8 %36, ptr %42, align 8, !tbaa !18
  %43 = load i16, ptr %15, align 2, !tbaa !10
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %44, i32 0, i32 2
  %46 = load i8, ptr %10, align 1, !tbaa !9
  %47 = zext i8 %46 to i64
  %48 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %45, i64 0, i64 %47
  %49 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %48, i32 0, i32 8
  store i16 %43, ptr %49, align 8, !tbaa !19
  %50 = load i8, ptr %10, align 1, !tbaa !9
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %51, i32 0, i32 2
  %53 = load i8, ptr %10, align 1, !tbaa !9
  %54 = zext i8 %53 to i64
  %55 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %52, i64 0, i64 %54
  %56 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %55, i32 0, i32 1
  store i8 %50, ptr %56, align 1, !tbaa !20
  %57 = load i8, ptr %14, align 1, !tbaa !9
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %58, i32 0, i32 2
  %60 = load i8, ptr %10, align 1, !tbaa !9
  %61 = zext i8 %60 to i64
  %62 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %59, i64 0, i64 %61
  %63 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %62, i32 0, i32 7
  store i8 %57, ptr %63, align 1, !tbaa !21
  %64 = load i8, ptr %11, align 1, !tbaa !9
  %65 = zext i8 %64 to i32
  %66 = and i32 %65, 127
  %67 = trunc i32 %66 to i8
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %68, i32 0, i32 2
  %70 = load i8, ptr %10, align 1, !tbaa !9
  %71 = zext i8 %70 to i64
  %72 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %69, i64 0, i64 %71
  %73 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %72, i32 0, i32 2
  store i8 %67, ptr %73, align 2, !tbaa !22
  %74 = load i8, ptr %11, align 1, !tbaa !9
  %75 = zext i8 %74 to i32
  %76 = and i32 %75, 128
  %77 = icmp eq i32 %76, 128
  br i1 %77, label %78, label %85

78:                                               ; preds = %29
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %79, i32 0, i32 2
  %81 = load i8, ptr %10, align 1, !tbaa !9
  %82 = zext i8 %81 to i64
  %83 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %80, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %83, i32 0, i32 3
  store i8 1, ptr %84, align 1, !tbaa !23
  br label %92

85:                                               ; preds = %29
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %86, i32 0, i32 2
  %88 = load i8, ptr %10, align 1, !tbaa !9
  %89 = zext i8 %88 to i64
  %90 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %87, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %90, i32 0, i32 3
  store i8 0, ptr %91, align 1, !tbaa !23
  br label %92

92:                                               ; preds = %85, %78
  %93 = load i8, ptr %13, align 1, !tbaa !9
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %94, i32 0, i32 2
  %96 = load i8, ptr %10, align 1, !tbaa !9
  %97 = zext i8 %96 to i64
  %98 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %95, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.USB_OTG_HCTypeDef, ptr %98, i32 0, i32 4
  store i8 %93, ptr %99, align 4, !tbaa !24
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !25
  %103 = load i8, ptr %10, align 1, !tbaa !9
  %104 = load i8, ptr %11, align 1, !tbaa !9
  %105 = load i8, ptr %12, align 1, !tbaa !9
  %106 = load i8, ptr %13, align 1, !tbaa !9
  %107 = load i8, ptr %14, align 1, !tbaa !9
  %108 = load i16, ptr %15, align 2, !tbaa !10
  %109 = call i32 @USB_HC_Init(ptr noundef %102, i8 noundef zeroext %103, i8 noundef zeroext %104, i8 noundef zeroext %105, i8 noundef zeroext %106, i8 noundef zeroext %107, i16 noundef zeroext %108)
  store i32 %109, ptr %16, align 4, !tbaa !26
  br label %110

110:                                              ; preds = %92
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.HCD_HandleTypeDef, ptr %111, i32 0, i32 3
  store i32 0, ptr %112, align 8, !tbaa !12
  br label %113

113:                                              ; preds = %110
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %16, align 4, !tbaa !26
  store i32 %115, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %116

116:                                              ; preds = %114, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  %117 = load i32, ptr %8, align 4
  ret i32 %117
}

declare i32 @USB_HC_Init(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i16 noundef zeroext) #2

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 = { "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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !15, i64 960}
!13 = !{!"", !6, i64 0, !14, i64 8, !7, i64 64, !15, i64 960, !15, i64 964, !15, i64 968, !6, i64 976}
!14 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !7, i64 5}
!17 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !11, i64 8, !7, i64 10, !6, i64 16, !15, i64 24, !15, i64 28, !7, i64 32, !7, i64 33, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48}
!18 = !{!17, !7, i64 0}
!19 = !{!17, !11, i64 8}
!20 = !{!17, !7, i64 1}
!21 = !{!17, !7, i64 7}
!22 = !{!17, !7, i64 2}
!23 = !{!17, !7, i64 3}
!24 = !{!17, !7, i64 4}
!25 = !{!13, !6, i64 0}
!26 = !{!15, !15, 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"

%struct.USB_OTG_HCTypeDef = type { i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, ptr, i32, i32, i8, i8, i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_HCD_HC_Init(ptr nocapture noundef %0, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i8 noundef zeroext %5, i16 noundef zeroext %6) local_unnamed_addr #0 {
  %8 = getelementptr inbounds i8, ptr %0, i64 960
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %25, label %11

11:                                               ; preds = %7
  store i32 1, ptr %8, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = zext i8 %1 to i64
  %14 = getelementptr inbounds [16 x %struct.USB_OTG_HCTypeDef], ptr %12, i64 0, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 5
  store i8 0, ptr %15, align 1, !tbaa !12
  store i8 %3, ptr %14, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  store i16 %6, ptr %16, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %14, i64 1
  store i8 %1, ptr %17, align 1, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %14, i64 7
  store i8 %5, ptr %18, align 1, !tbaa !18
  %19 = and i8 %2, 127
  %20 = getelementptr inbounds i8, ptr %14, i64 2
  store i8 %19, ptr %20, align 2, !tbaa !19
  %.lobit = lshr i8 %2, 7
  %21 = getelementptr inbounds i8, ptr %14, i64 3
  store i8 %.lobit, ptr %21, align 1
  %22 = getelementptr inbounds i8, ptr %14, i64 4
  store i8 %4, ptr %22, align 4, !tbaa !20
  %23 = load ptr, ptr %0, align 8, !tbaa !21
  %24 = tail call i32 @USB_HC_Init(ptr noundef %23, i8 noundef zeroext %1, i8 noundef zeroext %2, i8 noundef zeroext %3, i8 noundef zeroext %4, i8 noundef zeroext %5, i16 noundef zeroext %6) #2
  store i32 0, ptr %8, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %7, %11
  %.0 = phi i32 [ %24, %11 ], [ 2, %7 ]
  ret i32 %.0
}

declare i32 @USB_HC_Init(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i16 noundef zeroext) 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, !11, i64 960}
!6 = !{!"", !7, i64 0, !10, i64 8, !8, i64 64, !11, i64 960, !11, i64 964, !11, i64 968, !7, i64 976}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !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 = !{!"int", !8, i64 0}
!12 = !{!13, !8, i64 5}
!13 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !14, i64 8, !8, i64 10, !7, i64 16, !11, i64 24, !11, i64 28, !8, i64 32, !8, i64 33, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48}
!14 = !{!"short", !8, i64 0}
!15 = !{!13, !8, i64 0}
!16 = !{!13, !14, i64 8}
!17 = !{!13, !8, i64 1}
!18 = !{!13, !8, i64 7}
!19 = !{!13, !8, i64 2}
!20 = !{!13, !8, i64 4}
!21 = !{!6, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass