; LLVM IR from reazon-research/OpenArm :: control/canfd_control/Core/Src (usart)

; 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.__UART_HandleTypeDef = type { ptr, %struct.UART_InitTypeDef, %struct.UART_AdvFeatureInitTypeDef, ptr, i16, i16, ptr, i16, i16, i16, i32, i16, i16, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.UART_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.UART_AdvFeatureInitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.RCC_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [9 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32] }

; Function Attrs: nounwind uwtable
define dso_local void @HAL_UART_MspDeInit(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 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %3, i32 0, i32 0
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = icmp eq ptr %5, inttoptr (i64 1073772544 to ptr)
  br i1 %6, label %7, label %12

7:                                                ; preds = %1
  %8 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 50), align 4, !tbaa !15
  %9 = zext i32 %8 to i64
  %10 = and i64 %9, -1073741825
  %11 = trunc i64 %10 to i32
  store volatile i32 %11, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 50), align 4, !tbaa !15
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476530176 to ptr), i32 noundef 384)
  br label %67

12:                                               ; preds = %1
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = icmp eq ptr %15, inttoptr (i64 1073813504 to ptr)
  br i1 %16, label %17, label %22

17:                                               ; preds = %12
  %18 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 52), align 4, !tbaa !17
  %19 = zext i32 %18 to i64
  %20 = and i64 %19, -65
  %21 = trunc i64 %20 to i32
  store volatile i32 %21, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 52), align 4, !tbaa !17
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476529152 to ptr), i32 noundef 49152)
  br label %66

22:                                               ; preds = %12
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = icmp eq ptr %25, inttoptr (i64 1073811456 to ptr)
  br i1 %26, label %27, label %32

27:                                               ; preds = %22
  %28 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 52), align 4, !tbaa !17
  %29 = zext i32 %28 to i64
  %30 = and i64 %29, -17
  %31 = trunc i64 %30 to i32
  store volatile i32 %31, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 52), align 4, !tbaa !17
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476526080 to ptr), i32 noundef 1536)
  br label %65

32:                                               ; preds = %22
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = icmp eq ptr %35, inttoptr (i64 1073759232 to ptr)
  br i1 %36, label %37, label %42

37:                                               ; preds = %32
  %38 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 50), align 4, !tbaa !15
  %39 = zext i32 %38 to i64
  %40 = and i64 %39, -131073
  %41 = trunc i64 %40 to i32
  store volatile i32 %41, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 50), align 4, !tbaa !15
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476529152 to ptr), i32 noundef 112)
  br label %64

42:                                               ; preds = %32
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = icmp eq ptr %45, inttoptr (i64 1073760256 to ptr)
  br i1 %46, label %47, label %52

47:                                               ; preds = %42
  %48 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 50), align 4, !tbaa !15
  %49 = zext i32 %48 to i64
  %50 = and i64 %49, -262145
  %51 = trunc i64 %50 to i32
  store volatile i32 %51, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 50), align 4, !tbaa !15
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476527104 to ptr), i32 noundef 16384)
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476529152 to ptr), i32 noundef 768)
  br label %63

52:                                               ; preds = %42
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = icmp eq ptr %55, inttoptr (i64 1073814528 to ptr)
  br i1 %56, label %57, label %62

57:                                               ; preds = %52
  %58 = load volatile i32, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 52), align 4, !tbaa !17
  %59 = zext i32 %58 to i64
  %60 = and i64 %59, -129
  %61 = trunc i64 %60 to i32
  store volatile i32 %61, ptr getelementptr inbounds (%struct.RCC_TypeDef, ptr inttoptr (i64 1476543488 to ptr), i32 0, i32 52), align 4, !tbaa !17
  call void @HAL_GPIO_DeInit(ptr noundef inttoptr (i64 1476530176 to ptr), i32 noundef 12)
  br label %62

62:                                               ; preds = %57, %52
  br label %63

63:                                               ; preds = %62, %47
  br label %64

64:                                               ; preds = %63, %37
  br label %65

65:                                               ; preds = %64, %27
  br label %66

66:                                               ; preds = %65, %17
  br label %67

67:                                               ; preds = %66, %7
  ret void
}

declare void @HAL_GPIO_DeInit(ptr noundef, i32 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, !6, i64 0}
!10 = !{!"__UART_HandleTypeDef", !6, i64 0, !11, i64 8, !13, i64 44, !6, i64 88, !14, i64 96, !14, i64 98, !6, i64 104, !14, i64 112, !14, i64 114, !14, i64 116, !12, i64 120, !14, i64 124, !14, i64 126, !12, i64 128, !12, i64 132, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180}
!11 = !{!"", !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 = !{!"int", !7, i64 0}
!13 = !{!"", !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}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !12, i64 232}
!16 = !{!"", !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, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !7, i64 172, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !12, i64 232, !12, i64 236, !12, i64 240, !12, i64 244, !12, i64 248, !12, i64 252, !12, i64 256, !12, i64 260, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !12, i64 280, !12, i64 284, !7, i64 288}
!17 = !{!16, !12, i64 240}


; 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
define dso_local void @HAL_UART_MspDeInit(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %magicptr = ptrtoint ptr %2 to i64
  switch i64 %magicptr, label %21 [
    i64 1073772544, label %3
    i64 1073813504, label %6
    i64 1073811456, label %9
    i64 1073759232, label %12
    i64 1073760256, label %15
    i64 1073814528, label %18
  ]

3:                                                ; preds = %1
  %4 = load volatile i32, ptr inttoptr (i64 1476543720 to ptr), align 8, !tbaa !14
  %5 = and i32 %4, -1073741825
  store volatile i32 %5, ptr inttoptr (i64 1476543720 to ptr), align 8, !tbaa !14
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476530176 to ptr), i32 noundef 384) #2
  br label %21

6:                                                ; preds = %1
  %7 = load volatile i32, ptr inttoptr (i64 1476543728 to ptr), align 16, !tbaa !16
  %8 = and i32 %7, -65
  store volatile i32 %8, ptr inttoptr (i64 1476543728 to ptr), align 16, !tbaa !16
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476529152 to ptr), i32 noundef 49152) #2
  br label %21

9:                                                ; preds = %1
  %10 = load volatile i32, ptr inttoptr (i64 1476543728 to ptr), align 16, !tbaa !16
  %11 = and i32 %10, -17
  store volatile i32 %11, ptr inttoptr (i64 1476543728 to ptr), align 16, !tbaa !16
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476526080 to ptr), i32 noundef 1536) #2
  br label %21

12:                                               ; preds = %1
  %13 = load volatile i32, ptr inttoptr (i64 1476543720 to ptr), align 8, !tbaa !14
  %14 = and i32 %13, -131073
  store volatile i32 %14, ptr inttoptr (i64 1476543720 to ptr), align 8, !tbaa !14
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476529152 to ptr), i32 noundef 112) #2
  br label %21

15:                                               ; preds = %1
  %16 = load volatile i32, ptr inttoptr (i64 1476543720 to ptr), align 8, !tbaa !14
  %17 = and i32 %16, -262145
  store volatile i32 %17, ptr inttoptr (i64 1476543720 to ptr), align 8, !tbaa !14
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476527104 to ptr), i32 noundef 16384) #2
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476529152 to ptr), i32 noundef 768) #2
  br label %21

18:                                               ; preds = %1
  %19 = load volatile i32, ptr inttoptr (i64 1476543728 to ptr), align 16, !tbaa !16
  %20 = and i32 %19, -129
  store volatile i32 %20, ptr inttoptr (i64 1476543728 to ptr), align 16, !tbaa !16
  tail call void @HAL_GPIO_DeInit(ptr noundef nonnull inttoptr (i64 1476530176 to ptr), i32 noundef 12) #2
  br label %21

21:                                               ; preds = %1, %6, %12, %18, %15, %9, %3
  ret void
}

declare void @HAL_GPIO_DeInit(ptr noundef, i32 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, !7, i64 0}
!6 = !{!"__UART_HandleTypeDef", !7, i64 0, !10, i64 8, !12, i64 44, !7, i64 88, !13, i64 96, !13, i64 98, !7, i64 104, !13, i64 112, !13, i64 114, !13, i64 116, !11, i64 120, !13, i64 124, !13, i64 126, !11, i64 128, !11, i64 132, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180}
!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 = !{!"int", !8, i64 0}
!12 = !{!"", !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}
!13 = !{!"short", !8, i64 0}
!14 = !{!15, !11, i64 232}
!15 = !{!"", !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, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !8, i64 172, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !8, i64 288}
!16 = !{!15, !11, i64 240}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass