; LLVM IR from eProsima/Fast-DDS :: src/cpp/rtps/attributes (EndpointSecurityAttributes)

; 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.eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes" = type { i8, i8, i8 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK8eprosima7fastdds4rtps8security32PluginEndpointSecurityAttributes4maskEv(ptr noundef nonnull align 1 dereferenceable(3) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 -2147483648, ptr %3, align 4, !tbaa !9
  %5 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes", ptr %4, i32 0, i32 0
  %6 = load i8, ptr %5, align 1, !tbaa !11, !range !14, !noundef !15
  %7 = trunc i8 %6 to i1
  br i1 %7, label %8, label %13

8:                                                ; preds = %1
  %9 = load i32, ptr %3, align 4, !tbaa !9
  %10 = zext i32 %9 to i64
  %11 = or i64 %10, 1
  %12 = trunc i64 %11 to i32
  store i32 %12, ptr %3, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %8, %1
  %14 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes", ptr %4, i32 0, i32 1
  %15 = load i8, ptr %14, align 1, !tbaa !16, !range !14, !noundef !15
  %16 = trunc i8 %15 to i1
  br i1 %16, label %17, label %22

17:                                               ; preds = %13
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = or i64 %19, 4
  %21 = trunc i64 %20 to i32
  store i32 %21, ptr %3, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %17, %13
  %23 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::PluginEndpointSecurityAttributes", ptr %4, i32 0, i32 2
  %24 = load i8, ptr %23, align 1, !tbaa !17, !range !14, !noundef !15
  %25 = trunc i8 %24 to i1
  br i1 %25, label %26, label %31

26:                                               ; preds = %22
  %27 = load i32, ptr %3, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = or i64 %28, 2
  %30 = trunc i64 %29 to i32
  store i32 %30, ptr %3, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %26, %22
  %32 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret i32 %32
}

; 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 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN8eprosima7fastdds4rtps8security32PluginEndpointSecurityAttributesE", !13, i64 0, !13, i64 1, !13, i64 2}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!12, !13, i64 1}
!17 = !{!12, !13, i64 2}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef i32 @_ZNK8eprosima7fastdds4rtps8security32PluginEndpointSecurityAttributes4maskEv(ptr nocapture noundef nonnull readonly align 1 dereferenceable(3) %0) local_unnamed_addr #0 align 2 {
  %2 = load i8, ptr %0, align 1, !tbaa !5, !range !10, !noundef !11
  %3 = trunc nuw i8 %2 to i1
  %spec.select = select i1 %3, i32 -2147483647, i32 -2147483648
  %4 = getelementptr inbounds i8, ptr %0, i64 1
  %5 = load i8, ptr %4, align 1, !tbaa !12, !range !10, !noundef !11
  %6 = trunc nuw i8 %5 to i1
  %7 = or disjoint i32 %spec.select, 4
  %.1 = select i1 %6, i32 %7, i32 %spec.select
  %8 = getelementptr inbounds i8, ptr %0, i64 2
  %9 = load i8, ptr %8, align 1, !tbaa !13, !range !10, !noundef !11
  %10 = trunc nuw i8 %9 to i1
  %11 = or disjoint i32 %.1, 2
  %.2 = select i1 %10, i32 %11, i32 %.1
  ret i32 %.2
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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, !7, i64 0}
!6 = !{!"_ZTSN8eprosima7fastdds4rtps8security32PluginEndpointSecurityAttributesE", !7, i64 0, !7, i64 1, !7, i64 2}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{i8 0, i8 2}
!11 = !{}
!12 = !{!6, !7, i64 1}
!13 = !{!6, !7, i64 2}


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