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

; 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.CRYP_HandleTypeDef = type { ptr, %struct.CRYP_ConfigTypeDef, ptr, ptr, i16, i16, i16, i16, i32, ptr, ptr, i32, i32, i32, i32 }
%struct.CRYP_ConfigTypeDef = type { i32, i32, ptr, ptr, i32, ptr, i32, ptr, i32 }

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

8:                                                ; preds = %2
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %8, %2
  store i32 1, ptr %3, align 4
  br label %100

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

17:                                               ; preds = %12
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %18, i32 0, i32 12
  store volatile i32 2, ptr %19, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %21, i32 0, i32 11
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = icmp eq i32 %23, 1
  br i1 %24, label %25, label %26

25:                                               ; preds = %20
  store i32 2, ptr %3, align 4
  br label %100

26:                                               ; preds = %20
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %27, i32 0, i32 11
  store i32 1, ptr %28, align 8, !tbaa !14
  br label %29

29:                                               ; preds = %26
  br label %30

30:                                               ; preds = %29
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %31, i32 0, i32 1
  %33 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !15
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %35, i32 0, i32 0
  store i32 %34, ptr %36, align 8, !tbaa !16
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %37, i32 0, i32 1
  %39 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %38, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %41, i32 0, i32 2
  store ptr %40, ptr %42, align 8, !tbaa !18
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %44, i32 0, i32 4
  %46 = load i32, ptr %45, align 8, !tbaa !19
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %47, i32 0, i32 4
  store i32 %46, ptr %48, align 8, !tbaa !20
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %49, i32 0, i32 1
  %51 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 4, !tbaa !21
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %53, i32 0, i32 1
  store i32 %52, ptr %54, align 4, !tbaa !22
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %55, i32 0, i32 1
  %57 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %56, i32 0, i32 3
  %58 = load ptr, ptr %57, align 8, !tbaa !23
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %59, i32 0, i32 3
  store ptr %58, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %61, i32 0, i32 1
  %63 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %62, i32 0, i32 5
  %64 = load ptr, ptr %63, align 8, !tbaa !25
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %65, i32 0, i32 5
  store ptr %64, ptr %66, align 8, !tbaa !26
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %67, i32 0, i32 1
  %69 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %68, i32 0, i32 6
  %70 = load i32, ptr %69, align 8, !tbaa !27
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %71, i32 0, i32 6
  store i32 %70, ptr %72, align 8, !tbaa !28
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %73, i32 0, i32 1
  %75 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %74, i32 0, i32 7
  %76 = load ptr, ptr %75, align 8, !tbaa !29
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %77, i32 0, i32 7
  store ptr %76, ptr %78, align 8, !tbaa !30
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %79, i32 0, i32 1
  %81 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %80, i32 0, i32 8
  %82 = load i32, ptr %81, align 8, !tbaa !31
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.CRYP_ConfigTypeDef, ptr %83, i32 0, i32 8
  store i32 %82, ptr %84, align 8, !tbaa !32
  br label %85

85:                                               ; preds = %30
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %86, i32 0, i32 11
  store i32 0, ptr %87, align 8, !tbaa !14
  br label %88

88:                                               ; preds = %85
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %89, i32 0, i32 12
  store volatile i32 1, ptr %90, align 4, !tbaa !9
  store i32 0, ptr %3, align 4
  br label %100

91:                                               ; preds = %12
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %93, i32 0, i32 11
  store i32 0, ptr %94, align 8, !tbaa !14
  br label %95

95:                                               ; preds = %92
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.CRYP_HandleTypeDef, ptr %96, i32 0, i32 13
  %98 = load volatile i32, ptr %97, align 8, !tbaa !33
  %99 = or i32 %98, 8
  store volatile i32 %99, ptr %97, align 8, !tbaa !33
  store i32 1, ptr %3, align 4
  br label %100

100:                                              ; preds = %95, %88, %25, %11
  %101 = load i32, ptr %3, align 4
  ret i32 %101
}

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, !12, i64 124}
!10 = !{!"", !6, i64 0, !11, i64 8, !6, i64 72, !6, i64 80, !13, i64 88, !13, i64 90, !13, i64 92, !13, i64 94, !12, i64 96, !6, i64 104, !6, i64 112, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132}
!11 = !{!"", !12, i64 0, !12, i64 4, !6, i64 8, !6, i64 16, !12, i64 24, !6, i64 32, !12, i64 40, !6, i64 48, !12, i64 56}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !12, i64 120}
!15 = !{!10, !12, i64 8}
!16 = !{!11, !12, i64 0}
!17 = !{!10, !6, i64 16}
!18 = !{!11, !6, i64 8}
!19 = !{!10, !12, i64 32}
!20 = !{!11, !12, i64 24}
!21 = !{!10, !12, i64 12}
!22 = !{!11, !12, i64 4}
!23 = !{!10, !6, i64 24}
!24 = !{!11, !6, i64 16}
!25 = !{!10, !6, i64 40}
!26 = !{!11, !6, i64 32}
!27 = !{!10, !12, i64 48}
!28 = !{!11, !12, i64 40}
!29 = !{!10, !6, i64 56}
!30 = !{!11, !6, i64 48}
!31 = !{!10, !12, i64 64}
!32 = !{!11, !12, i64 56}
!33 = !{!10, !12, i64 128}


; 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 memory(argmem: readwrite, inaccessiblemem: readwrite) uwtable
define dso_local range(i32 0, 3) i32 @HAL_CRYP_GetConfig(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  %4 = icmp eq ptr %1, null
  %or.cond = or i1 %3, %4
  br i1 %or.cond, label %39, label %5

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

9:                                                ; preds = %5
  store volatile i32 2, ptr %6, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 120
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %39, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = getelementptr inbounds i8, ptr %0, i64 32
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %1, i64 24
  store i32 %18, ptr %19, align 8, !tbaa !15
  %20 = load <2 x i32>, ptr %14, align 8, !tbaa !16
  store <2 x i32> %20, ptr %1, align 8, !tbaa !16
  %21 = load <2 x ptr>, ptr %15, align 8, !tbaa !17
  store <2 x ptr> %21, ptr %16, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %23, ptr %24, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  %26 = load i32, ptr %25, align 8, !tbaa !20
  %27 = getelementptr inbounds i8, ptr %1, i64 40
  store i32 %26, ptr %27, align 8, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %0, i64 56
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  %30 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr %29, ptr %30, align 8, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  %32 = load i32, ptr %31, align 8, !tbaa !24
  %33 = getelementptr inbounds i8, ptr %1, i64 56
  store i32 %32, ptr %33, align 8, !tbaa !25
  store i32 0, ptr %10, align 8, !tbaa !13
  store volatile i32 1, ptr %6, align 4, !tbaa !5
  br label %39

34:                                               ; preds = %5
  %35 = getelementptr inbounds i8, ptr %0, i64 120
  store i32 0, ptr %35, align 8, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %0, i64 128
  %37 = load volatile i32, ptr %36, align 8, !tbaa !26
  %38 = or i32 %37, 8
  store volatile i32 %38, ptr %36, align 8, !tbaa !26
  br label %39

39:                                               ; preds = %9, %2, %34, %13
  %.0 = phi i32 [ 0, %13 ], [ 1, %34 ], [ 1, %2 ], [ 2, %9 ]
  ret i32 %.0
}

attributes #0 = { nofree norecurse nounwind memory(argmem: readwrite, inaccessiblemem: readwrite) 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, !11, i64 124}
!6 = !{!"", !7, i64 0, !10, i64 8, !7, i64 72, !7, i64 80, !12, i64 88, !12, i64 90, !12, i64 92, !12, i64 94, !11, i64 96, !7, i64 104, !7, i64 112, !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 = !{!"", !11, i64 0, !11, i64 4, !7, i64 8, !7, i64 16, !11, i64 24, !7, i64 32, !11, i64 40, !7, i64 48, !11, i64 56}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !11, i64 120}
!14 = !{!6, !11, i64 32}
!15 = !{!10, !11, i64 24}
!16 = !{!11, !11, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !7, i64 40}
!19 = !{!10, !7, i64 32}
!20 = !{!6, !11, i64 48}
!21 = !{!10, !11, i64 40}
!22 = !{!6, !7, i64 56}
!23 = !{!10, !7, i64 48}
!24 = !{!6, !11, i64 64}
!25 = !{!10, !11, i64 56}
!26 = !{!6, !11, i64 128}


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