; 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::EndpointSecurityAttributes" = type { i8, i8, i8, i8, i8, i8, i8, i32 }

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK8eprosima7fastdds4rtps8security26EndpointSecurityAttributes4maskEv(ptr noundef nonnull align 4 dereferenceable(12) %0) #1 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::EndpointSecurityAttributes", ptr %4, i32 0, i32 0
  %6 = load i8, ptr %5, align 4, !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::EndpointSecurityAttributes", 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, 2
  %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::EndpointSecurityAttributes", ptr %4, i32 0, i32 2
  %24 = load i8, ptr %23, align 2, !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, 4
  %30 = trunc i64 %29 to i32
  store i32 %30, ptr %3, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %26, %22
  %32 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::EndpointSecurityAttributes", ptr %4, i32 0, i32 3
  %33 = load i8, ptr %32, align 1, !tbaa !18, !range !14, !noundef !15
  %34 = trunc i8 %33 to i1
  br i1 %34, label %35, label %40

35:                                               ; preds = %31
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = or i64 %37, 64
  %39 = trunc i64 %38 to i32
  store i32 %39, ptr %3, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %35, %31
  %41 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::EndpointSecurityAttributes", ptr %4, i32 0, i32 4
  %42 = load i8, ptr %41, align 4, !tbaa !19, !range !14, !noundef !15
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %49

44:                                               ; preds = %40
  %45 = load i32, ptr %3, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = or i64 %46, 8
  %48 = trunc i64 %47 to i32
  store i32 %48, ptr %3, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %44, %40
  %50 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::EndpointSecurityAttributes", ptr %4, i32 0, i32 5
  %51 = load i8, ptr %50, align 1, !tbaa !20, !range !14, !noundef !15
  %52 = trunc i8 %51 to i1
  br i1 %52, label %53, label %58

53:                                               ; preds = %49
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = or i64 %55, 16
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %3, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %53, %49
  %59 = getelementptr inbounds %"struct.eprosima::fastdds::rtps::security::EndpointSecurityAttributes", ptr %4, i32 0, i32 6
  %60 = load i8, ptr %59, align 2, !tbaa !21, !range !14, !noundef !15
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %67

62:                                               ; preds = %58
  %63 = load i32, ptr %3, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = or i64 %64, 32
  %66 = trunc i64 %65 to i32
  store i32 %66, ptr %3, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %62, %58
  %68 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret i32 %68
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"_ZTSN8eprosima7fastdds4rtps8security26EndpointSecurityAttributesE", !13, i64 0, !13, i64 1, !13, i64 2, !13, i64 3, !13, i64 4, !13, i64 5, !13, i64 6, !10, i64 8}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!12, !13, i64 1}
!17 = !{!12, !13, i64 2}
!18 = !{!12, !13, i64 3}
!19 = !{!12, !13, i64 4}
!20 = !{!12, !13, i64 5}
!21 = !{!12, !13, i64 6}


; 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 @_ZNK8eprosima7fastdds4rtps8security26EndpointSecurityAttributes4maskEv(ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %0) local_unnamed_addr #0 align 2 {
  %2 = load i8, ptr %0, align 4, !tbaa !5, !range !11, !noundef !12
  %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 !13, !range !11, !noundef !12
  %6 = trunc nuw i8 %5 to i1
  %7 = or disjoint i32 %spec.select, 2
  %.1 = select i1 %6, i32 %7, i32 %spec.select
  %8 = getelementptr inbounds i8, ptr %0, i64 2
  %9 = load i8, ptr %8, align 2, !tbaa !14, !range !11, !noundef !12
  %10 = trunc nuw i8 %9 to i1
  %11 = or disjoint i32 %.1, 4
  %.2 = select i1 %10, i32 %11, i32 %.1
  %12 = getelementptr inbounds i8, ptr %0, i64 3
  %13 = load i8, ptr %12, align 1, !tbaa !15, !range !11, !noundef !12
  %14 = trunc nuw i8 %13 to i1
  %15 = or disjoint i32 %.2, 64
  %.3 = select i1 %14, i32 %15, i32 %.2
  %16 = getelementptr inbounds i8, ptr %0, i64 4
  %17 = load i8, ptr %16, align 4, !tbaa !16, !range !11, !noundef !12
  %18 = trunc nuw i8 %17 to i1
  %19 = or i32 %.3, 8
  %.4 = select i1 %18, i32 %19, i32 %.3
  %20 = getelementptr inbounds i8, ptr %0, i64 5
  %21 = load i8, ptr %20, align 1, !tbaa !17, !range !11, !noundef !12
  %22 = trunc nuw i8 %21 to i1
  %23 = or i32 %.4, 16
  %.5 = select i1 %22, i32 %23, i32 %.4
  %24 = getelementptr inbounds i8, ptr %0, i64 6
  %25 = load i8, ptr %24, align 2, !tbaa !18, !range !11, !noundef !12
  %26 = trunc nuw i8 %25 to i1
  %27 = or i32 %.5, 32
  %.6 = select i1 %26, i32 %27, i32 %.5
  ret i32 %.6
}

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 = !{!"_ZTSN8eprosima7fastdds4rtps8security26EndpointSecurityAttributesE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !10, i64 8}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!6, !7, i64 1}
!14 = !{!6, !7, i64 2}
!15 = !{!6, !7, i64 3}
!16 = !{!6, !7, i64 4}
!17 = !{!6, !7, i64 5}
!18 = !{!6, !7, i64 6}


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