; LLVM IR from eclipse-threadx/threadx :: common_modules/module_manager/src (txm_module_manager_properties_get)

; 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.TXM_MODULE_INSTANCE_STRUCT = type { i64, ptr, i64, i64, ptr, i64, ptr, ptr, i64, ptr, i64, ptr, ptr, ptr, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, [8 x %struct.TXM_MODULE_MPU_INFO_STRUCT], i64, i64, %struct.TX_THREAD_STRUCT, %struct.TX_THREAD_STRUCT, %struct.TX_QUEUE_STRUCT, [104 x i64], i64, i64, i64, i64, i64, i32, ptr, i64, ptr, ptr }
%struct.TXM_MODULE_MPU_INFO_STRUCT = type { i64, i64 }
%struct.TX_THREAD_STRUCT = type { i64, i64, ptr, ptr, ptr, i64, i64, i64, ptr, ptr, ptr, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, i64, %struct.TX_TIMER_INTERNAL_STRUCT, ptr, ptr, ptr, ptr, i64, ptr, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr, i64 }
%struct.TX_TIMER_INTERNAL_STRUCT = type { i64, i64, ptr, i64, ptr, ptr, ptr }
%struct.TX_QUEUE_STRUCT = type { i64, ptr, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr }

@_txm_module_manager_ready = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @_txm_module_manager_properties_get(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 i32, ptr @_txm_module_manager_ready, align 4, !tbaa !9
  %7 = icmp ne i32 %6, 1
  br i1 %7, label %8, label %9

8:                                                ; preds = %2
  store i32 29, ptr %3, align 4
  br label %28

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

12:                                               ; preds = %9
  store i32 3, ptr %3, align 4
  br label %28

13:                                               ; preds = %9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.TXM_MODULE_INSTANCE_STRUCT, ptr %14, i32 0, i32 0
  %16 = load i64, ptr %15, align 8, !tbaa !11
  %17 = icmp ne i64 %16, 1297040469
  br i1 %17, label %18, label %19

18:                                               ; preds = %13
  store i32 3, ptr %3, align 4
  br label %28

19:                                               ; preds = %13
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  store i32 3, ptr %3, align 4
  br label %28

23:                                               ; preds = %19
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.TXM_MODULE_INSTANCE_STRUCT, ptr %24, i32 0, i32 3
  %26 = load i64, ptr %25, align 8, !tbaa !17
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %26, ptr %27, align 8, !tbaa !18
  store i32 0, ptr %3, align 4
  br label %28

28:                                               ; preds = %23, %22, %18, %12, %8
  %29 = load i32, ptr %3, align 4
  ret i32 %29
}

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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"TXM_MODULE_INSTANCE_STRUCT", !13, i64 0, !6, i64 8, !13, i64 16, !13, i64 24, !6, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !6, i64 72, !13, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !13, i64 112, !13, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !7, i64 200, !13, i64 328, !13, i64 336, !14, i64 344, !14, i64 688, !16, i64 1032, !7, i64 1136, !13, i64 1968, !13, i64 1976, !13, i64 1984, !13, i64 1992, !13, i64 2000, !10, i64 2008, !6, i64 2016, !13, i64 2024, !6, i64 2032, !6, i64 2040}
!13 = !{!"long", !7, i64 0}
!14 = !{!"TX_THREAD_STRUCT", !13, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !6, i64 96, !6, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !6, i64 144, !13, i64 152, !15, i64 160, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !13, i64 248, !6, i64 256, !10, i64 264, !10, i64 268, !6, i64 272, !6, i64 280, !6, i64 288, !10, i64 296, !10, i64 300, !10, i64 304, !10, i64 308, !6, i64 312, !6, i64 320, !6, i64 328, !13, i64 336}
!15 = !{!"TX_TIMER_INTERNAL_STRUCT", !13, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!16 = !{!"TX_QUEUE_STRUCT", !13, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!17 = !{!12, !13, i64 24}
!18 = !{!13, !13, 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"

@_txm_module_manager_ready = external local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local range(i32 0, 30) i32 @_txm_module_manager_properties_get(ptr noundef readonly %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %3 = load i32, ptr @_txm_module_manager_ready, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 1
  br i1 %.not, label %4, label %12

4:                                                ; preds = %2
  %5 = icmp eq ptr %0, null
  br i1 %5, label %12, label %6

6:                                                ; preds = %4
  %7 = load i64, ptr %0, align 8, !tbaa !9
  %.not7 = icmp ne i64 %7, 1297040469
  %8 = icmp eq ptr %1, null
  %or.cond = or i1 %8, %.not7
  br i1 %or.cond, label %12, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !16
  store i64 %11, ptr %1, align 8, !tbaa !17
  br label %12

12:                                               ; preds = %6, %4, %2, %9
  %.0 = phi i32 [ 0, %9 ], [ 29, %2 ], [ 3, %4 ], [ 3, %6 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"TXM_MODULE_INSTANCE_STRUCT", !11, i64 0, !12, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !11, i64 40, !12, i64 48, !12, i64 56, !11, i64 64, !12, i64 72, !11, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !11, i64 112, !11, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !7, i64 200, !11, i64 328, !11, i64 336, !13, i64 344, !13, i64 688, !15, i64 1032, !7, i64 1136, !11, i64 1968, !11, i64 1976, !11, i64 1984, !11, i64 1992, !11, i64 2000, !6, i64 2008, !12, i64 2016, !11, i64 2024, !12, i64 2032, !12, i64 2040}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"TX_THREAD_STRUCT", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !6, i64 88, !12, i64 96, !12, i64 104, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !12, i64 136, !12, i64 144, !11, i64 152, !14, i64 160, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !11, i64 248, !12, i64 256, !6, i64 264, !6, i64 268, !12, i64 272, !12, i64 280, !12, i64 288, !6, i64 296, !6, i64 300, !6, i64 304, !6, i64 308, !12, i64 312, !12, i64 320, !12, i64 328, !11, i64 336}
!14 = !{!"TX_TIMER_INTERNAL_STRUCT", !11, i64 0, !11, i64 8, !12, i64 16, !11, i64 24, !12, i64 32, !12, i64 40, !12, i64 48}
!15 = !{!"TX_QUEUE_STRUCT", !11, i64 0, !12, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !6, i64 72, !12, i64 80, !12, i64 88, !12, i64 96}
!16 = !{!10, !11, i64 24}
!17 = !{!11, !11, i64 0}


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