; 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.HASH_HandleTypeDef = type { %struct.HASH_InitTypeDef, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, i32 }
%struct.HASH_InitTypeDef = type { i32, i32, ptr }
%struct.HASH_TypeDef = type { i32, i32, i32, [5 x i32], i32, i32, [52 x i32], [54 x i32] }

; Function Attrs: nounwind uwtable
define dso_local i32 @HASH_Start_IT(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %14, i32 0, i32 13
  %16 = load volatile i32, ptr %15, align 4, !tbaa !11
  store i32 %16, ptr %12, align 4, !tbaa !9
  %17 = load i32, ptr %12, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %22, label %19

19:                                               ; preds = %5
  %20 = load i32, ptr %12, align 4, !tbaa !9
  %21 = icmp eq i32 %20, 8
  br i1 %21, label %22, label %94

22:                                               ; preds = %19, %5
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %31, label %25

25:                                               ; preds = %22
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %31, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %34

31:                                               ; preds = %28, %25, %22
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %32, i32 0, i32 13
  store volatile i32 1, ptr %33, align 4, !tbaa !11
  store i32 1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %95

34:                                               ; preds = %28
  br label %35

35:                                               ; preds = %34
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %36, i32 0, i32 12
  %38 = load i32, ptr %37, align 8, !tbaa !14
  %39 = icmp eq i32 %38, 1
  br i1 %39, label %40, label %41

40:                                               ; preds = %35
  store i32 2, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %95

41:                                               ; preds = %35
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %42, i32 0, i32 12
  store i32 1, ptr %43, align 8, !tbaa !14
  br label %44

44:                                               ; preds = %41
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %47, i32 0, i32 13
  store volatile i32 2, ptr %48, align 4, !tbaa !11
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %49, i32 0, i32 7
  store volatile i32 1, ptr %50, align 8, !tbaa !15
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %51, i32 0, i32 10
  %53 = load i32, ptr %52, align 4, !tbaa !16
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %82

55:                                               ; preds = %46
  %56 = load volatile i32, ptr inttoptr (i64 1208095744 to ptr), align 4, !tbaa !17
  %57 = zext i32 %56 to i64
  %58 = and i64 %57, -327877
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = or i64 %60, 4
  %62 = or i64 %58, %61
  %63 = trunc i64 %62 to i32
  store volatile i32 %63, ptr inttoptr (i64 1208095744 to ptr), align 4, !tbaa !17
  %64 = load volatile i32, ptr getelementptr inbounds (%struct.HASH_TypeDef, ptr inttoptr (i64 1208095744 to ptr), i32 0, i32 2), align 4, !tbaa !19
  %65 = zext i32 %64 to i64
  %66 = and i64 %65, -32
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = urem i32 %67, 4
  %69 = mul i32 8, %68
  %70 = zext i32 %69 to i64
  %71 = or i64 %66, %70
  %72 = trunc i64 %71 to i32
  store volatile i32 %72, ptr getelementptr inbounds (%struct.HASH_TypeDef, ptr inttoptr (i64 1208095744 to ptr), i32 0, i32 2), align 4, !tbaa !19
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %74, i32 0, i32 6
  store volatile i32 %73, ptr %75, align 4, !tbaa !20
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %77, i32 0, i32 1
  store ptr %76, ptr %78, align 8, !tbaa !21
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %80, i32 0, i32 2
  store ptr %79, ptr %81, align 8, !tbaa !22
  br label %82

82:                                               ; preds = %55, %46
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %83, i32 0, i32 10
  store i32 2, ptr %84, align 4, !tbaa !16
  br label %85

85:                                               ; preds = %82
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.HASH_HandleTypeDef, ptr %86, i32 0, i32 12
  store i32 0, ptr %87, align 8, !tbaa !14
  br label %88

88:                                               ; preds = %85
  br label %89

89:                                               ; preds = %88
  %90 = load volatile i32, ptr getelementptr inbounds (%struct.HASH_TypeDef, ptr inttoptr (i64 1208095744 to ptr), i32 0, i32 4), align 4, !tbaa !23
  %91 = zext i32 %90 to i64
  %92 = or i64 %91, 3
  %93 = trunc i64 %92 to i32
  store volatile i32 %93, ptr getelementptr inbounds (%struct.HASH_TypeDef, ptr inttoptr (i64 1208095744 to ptr), i32 0, i32 4), align 4, !tbaa !23
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %95

94:                                               ; preds = %19
  store i32 2, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %95

95:                                               ; preds = %94, %89, %40, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  %96 = load i32, ptr %6, align 4
  ret i32 %96
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 84}
!12 = !{!"", !13, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !6, i64 72, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100}
!13 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8}
!14 = !{!12, !10, i64 80}
!15 = !{!12, !10, i64 56}
!16 = !{!12, !10, i64 68}
!17 = !{!18, !10, i64 0}
!18 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !10, i64 32, !10, i64 36, !7, i64 40, !7, i64 248}
!19 = !{!18, !10, i64 8}
!20 = !{!12, !10, i64 52}
!21 = !{!12, !6, i64 16}
!22 = !{!12, !6, i64 24}
!23 = !{!18, !10, i64 32}


; 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, 3) i32 @HASH_Start_IT(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %0, i64 84
  %7 = load volatile i32, ptr %6, align 4, !tbaa !5
  switch i32 %7, label %38 [
    i32 8, label %8
    i32 1, label %8
  ]

8:                                                ; preds = %5, %5
  %9 = icmp eq ptr %1, null
  %10 = icmp eq i32 %2, 0
  %or.cond3 = or i1 %9, %10
  %11 = icmp eq ptr %3, null
  %or.cond5 = or i1 %or.cond3, %11
  br i1 %or.cond5, label %12, label %13

12:                                               ; preds = %8
  store volatile i32 1, ptr %6, align 4, !tbaa !5
  br label %38

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %0, i64 80
  %15 = load i32, ptr %14, align 8, !tbaa !12
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %38, label %17

17:                                               ; preds = %13
  store volatile i32 2, ptr %6, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 56
  store volatile i32 1, ptr %18, align 8, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 68
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %35

22:                                               ; preds = %17
  %23 = load volatile i32, ptr inttoptr (i64 1208095744 to ptr), align 1024, !tbaa !15
  %24 = and i32 %23, -327877
  %25 = or i32 %24, %4
  %26 = or i32 %25, 4
  store volatile i32 %26, ptr inttoptr (i64 1208095744 to ptr), align 1024, !tbaa !15
  %27 = load volatile i32, ptr inttoptr (i64 1208095752 to ptr), align 8, !tbaa !17
  %28 = and i32 %27, -32
  %29 = shl i32 %2, 3
  %30 = and i32 %29, 24
  %31 = or disjoint i32 %28, %30
  store volatile i32 %31, ptr inttoptr (i64 1208095752 to ptr), align 8, !tbaa !17
  %32 = getelementptr inbounds i8, ptr %0, i64 52
  store volatile i32 %2, ptr %32, align 4, !tbaa !18
  %33 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %1, ptr %33, align 8, !tbaa !19
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %3, ptr %34, align 8, !tbaa !20
  br label %35

35:                                               ; preds = %22, %17
  store i32 2, ptr %19, align 4, !tbaa !14
  store i32 0, ptr %14, align 8, !tbaa !12
  %36 = load volatile i32, ptr inttoptr (i64 1208095776 to ptr), align 32, !tbaa !21
  %37 = or i32 %36, 3
  store volatile i32 %37, ptr inttoptr (i64 1208095776 to ptr), align 32, !tbaa !21
  br label %38

38:                                               ; preds = %5, %13, %35, %12
  %.0 = phi i32 [ 1, %12 ], [ 0, %35 ], [ 2, %13 ], [ 2, %5 ]
  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, !8, i64 84}
!6 = !{!"", !7, i64 0, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !8, i64 48, !8, i64 52, !8, i64 56, !8, i64 60, !8, i64 64, !8, i64 68, !11, i64 72, !8, i64 80, !8, i64 84, !8, i64 88, !8, i64 92, !8, i64 96, !8, i64 100}
!7 = !{!"", !8, i64 0, !8, i64 4, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!6, !8, i64 80}
!13 = !{!6, !8, i64 56}
!14 = !{!6, !8, i64 68}
!15 = !{!16, !8, i64 0}
!16 = !{!"", !8, i64 0, !8, i64 4, !8, i64 8, !9, i64 12, !8, i64 32, !8, i64 36, !9, i64 40, !9, i64 248}
!17 = !{!16, !8, i64 8}
!18 = !{!6, !8, i64 52}
!19 = !{!6, !11, i64 16}
!20 = !{!6, !11, i64 24}
!21 = !{!16, !8, i64 32}


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