; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/dear_imgui/imnodes.ll (ZN7imnodes20IsAnyAttributeActiveEPi)

; 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.anon = type <{ ptr, ptr, ptr, %struct.ImGuiStorage, %struct.ImVector.0, %struct.ImVector.0, %struct.ImVec2, %struct.ImRect, i32, [4 x i8], %"struct.imnodes::IO", %"struct.imnodes::Style", %struct.ImVector.1, %struct.ImVector.2, %struct.ImGuiTextBuffer, i32, [4 x i8], %struct.ImVector.0, i32, i32, i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, i32, i8, [3 x i8], %struct.ImVec2, i8, i8, i8, i8, i8, [3 x i8] }>
%struct.ImGuiStorage = type { %struct.ImVector }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%"struct.imnodes::IO" = type { %"struct.imnodes::IO::EmulateThreeButtonMouse", %"struct.imnodes::IO::LinkDetachWithModifierClick" }
%"struct.imnodes::IO::EmulateThreeButtonMouse" = type { i8, ptr }
%"struct.imnodes::IO::LinkDetachWithModifierClick" = type { ptr }
%"struct.imnodes::Style" = type { float, float, float, float, float, float, float, float, float, float, float, float, float, i32, [16 x i32] }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImGuiTextBuffer = type { %struct.ImVector.3 }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.0 = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::OptionalIndex" = type { i32 }
%struct.ImVec2 = type { float, float }

@_ZN7imnodes12_GLOBAL__N_11gE = external hidden global %struct.anon, align 8
@.str.1 = external hidden unnamed_addr constant [111 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [56 x i8], align 1
@__PRETTY_FUNCTION__._ZN7imnodes20IsAnyAttributeActiveEPi = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN7imnodes20IsAnyAttributeActiveEPi(ptr noundef %0) #1 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load i32, ptr getelementptr inbounds (%struct.anon, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i32 0, i32 8), align 8, !tbaa !9
  %5 = and i32 %4, 12
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %8

7:                                                ; preds = %1
  br label %10

8:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 2500, ptr noundef @__PRETTY_FUNCTION__._ZN7imnodes20IsAnyAttributeActiveEPi) #2
  unreachable

9:                                                ; No predecessors!
  br label %10

10:                                               ; preds = %9, %7
  %11 = load i8, ptr getelementptr inbounds (%struct.anon, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i32 0, i32 29), align 4, !tbaa !29, !range !30, !noundef !31
  %12 = trunc i8 %11 to i1
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  store i1 false, ptr %2, align 1
  br label %21

14:                                               ; preds = %10
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %20

17:                                               ; preds = %14
  %18 = load i32, ptr getelementptr inbounds (%struct.anon, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i32 0, i32 28), align 8, !tbaa !32
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  store i32 %18, ptr %19, align 4, !tbaa !33
  br label %20

20:                                               ; preds = %17, %14
  store i1 true, ptr %2, align 1
  br label %21

21:                                               ; preds = %20, %13
  %22 = load i1, ptr %2, align 1
  ret i1 %22
}

attributes #0 = { noreturn nounwind "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 = { 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 = { noreturn 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, !7, i64 96}
!10 = !{!"_ZTSN7imnodes12_GLOBAL__N_13$_0E", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !14, i64 40, !14, i64 56, !15, i64 72, !17, i64 80, !7, i64 96, !18, i64 104, !22, i64 128, !24, i64 248, !25, i64 264, !26, i64 280, !13, i64 296, !14, i64 304, !13, i64 320, !13, i64 324, !13, i64 328, !28, i64 332, !28, i64 336, !28, i64 340, !13, i64 344, !28, i64 348, !28, i64 352, !13, i64 356, !13, i64 360, !20, i64 364, !15, i64 368, !20, i64 376, !20, i64 377, !20, i64 378, !20, i64 379, !20, i64 380}
!11 = !{!"_ZTS12ImGuiStorage", !12, i64 0}
!12 = !{!"_ZTS8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE", !13, i64 0, !13, i64 4, !6, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS8ImVectorIiE", !13, i64 0, !13, i64 4, !6, i64 8}
!15 = !{!"_ZTS6ImVec2", !16, i64 0, !16, i64 4}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTS6ImRect", !15, i64 0, !15, i64 8}
!18 = !{!"_ZTSN7imnodes2IOE", !19, i64 0, !21, i64 16}
!19 = !{!"_ZTSN7imnodes2IO23EmulateThreeButtonMouseE", !20, i64 0, !6, i64 8}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTSN7imnodes2IO27LinkDetachWithModifierClickE", !6, i64 0}
!22 = !{!"_ZTSN7imnodes5StyleE", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !16, i64 44, !16, i64 48, !23, i64 52, !7, i64 56}
!23 = !{!"_ZTSN7imnodes10StyleFlagsE", !7, i64 0}
!24 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_117ColorStyleElementEE", !13, i64 0, !13, i64 4, !6, i64 8}
!25 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_112StyleElementEE", !13, i64 0, !13, i64 4, !6, i64 8}
!26 = !{!"_ZTS15ImGuiTextBuffer", !27, i64 0}
!27 = !{!"_ZTS8ImVectorIcE", !13, i64 0, !13, i64 4, !6, i64 8}
!28 = !{!"_ZTSN7imnodes12_GLOBAL__N_113OptionalIndexE", !13, i64 0}
!29 = !{!10, !20, i64 364}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!10, !13, i64 360}
!33 = !{!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"

%struct.anon = type <{ ptr, ptr, ptr, %struct.ImGuiStorage, %struct.ImVector.0, %struct.ImVector.0, %struct.ImVec2, %struct.ImRect, i32, [4 x i8], %"struct.imnodes::IO", %"struct.imnodes::Style", %struct.ImVector.1, %struct.ImVector.2, %struct.ImGuiTextBuffer, i32, [4 x i8], %struct.ImVector.0, i32, i32, i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32, i32, i8, [3 x i8], %struct.ImVec2, i8, i8, i8, i8, i8, [3 x i8] }>
%struct.ImGuiStorage = type { %struct.ImVector }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%"struct.imnodes::IO" = type { %"struct.imnodes::IO::EmulateThreeButtonMouse", %"struct.imnodes::IO::LinkDetachWithModifierClick" }
%"struct.imnodes::IO::EmulateThreeButtonMouse" = type { i8, ptr }
%"struct.imnodes::IO::LinkDetachWithModifierClick" = type { ptr }
%"struct.imnodes::Style" = type { float, float, float, float, float, float, float, float, float, float, float, float, float, i32, [16 x i32] }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImGuiTextBuffer = type { %struct.ImVector.3 }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.0 = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::OptionalIndex" = type { i32 }
%struct.ImVec2 = type { float, float }

@_ZN7imnodes12_GLOBAL__N_11gE = external hidden local_unnamed_addr global %struct.anon, align 8
@.str.1 = external hidden unnamed_addr constant [111 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [56 x i8], align 1
@__PRETTY_FUNCTION__._ZN7imnodes20IsAnyAttributeActiveEPi = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN7imnodes20IsAnyAttributeActiveEPi(ptr noundef writeonly %0) local_unnamed_addr #1 {
  %2 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i64 96), align 8, !tbaa !5
  %3 = and i32 %2, 12
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.1, i32 noundef 2500, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7imnodes20IsAnyAttributeActiveEPi) #2
  unreachable

6:                                                ; preds = %1
  %7 = load i8, ptr getelementptr inbounds (i8, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i64 364), align 4, !tbaa !28, !range !29, !noundef !30
  %8 = trunc nuw i8 %7 to i1
  %.not = icmp ne ptr %0, null
  %or.cond.not = and i1 %.not, %8
  br i1 %or.cond.not, label %9, label %11

9:                                                ; preds = %6
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN7imnodes12_GLOBAL__N_11gE, i64 360), align 8, !tbaa !31
  store i32 %10, ptr %0, align 4, !tbaa !32
  br label %11

11:                                               ; preds = %9, %6
  ret i1 %8
}

attributes #0 = { noreturn nounwind "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 = { 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 = { noreturn 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, !8, i64 96}
!6 = !{!"_ZTSN7imnodes12_GLOBAL__N_13$_0E", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !13, i64 40, !13, i64 56, !14, i64 72, !16, i64 80, !8, i64 96, !17, i64 104, !21, i64 128, !23, i64 248, !24, i64 264, !25, i64 280, !12, i64 296, !13, i64 304, !12, i64 320, !12, i64 324, !12, i64 328, !27, i64 332, !27, i64 336, !27, i64 340, !12, i64 344, !27, i64 348, !27, i64 352, !12, i64 356, !12, i64 360, !19, i64 364, !14, i64 368, !19, i64 376, !19, i64 377, !19, i64 378, !19, i64 379, !19, i64 380}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS12ImGuiStorage", !11, i64 0}
!11 = !{!"_ZTS8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE", !12, i64 0, !12, i64 4, !7, i64 8}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTS8ImVectorIiE", !12, i64 0, !12, i64 4, !7, i64 8}
!14 = !{!"_ZTS6ImVec2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !8, i64 0}
!16 = !{!"_ZTS6ImRect", !14, i64 0, !14, i64 8}
!17 = !{!"_ZTSN7imnodes2IOE", !18, i64 0, !20, i64 16}
!18 = !{!"_ZTSN7imnodes2IO23EmulateThreeButtonMouseE", !19, i64 0, !7, i64 8}
!19 = !{!"bool", !8, i64 0}
!20 = !{!"_ZTSN7imnodes2IO27LinkDetachWithModifierClickE", !7, i64 0}
!21 = !{!"_ZTSN7imnodes5StyleE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !22, i64 52, !8, i64 56}
!22 = !{!"_ZTSN7imnodes10StyleFlagsE", !8, i64 0}
!23 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_117ColorStyleElementEE", !12, i64 0, !12, i64 4, !7, i64 8}
!24 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_112StyleElementEE", !12, i64 0, !12, i64 4, !7, i64 8}
!25 = !{!"_ZTS15ImGuiTextBuffer", !26, i64 0}
!26 = !{!"_ZTS8ImVectorIcE", !12, i64 0, !12, i64 4, !7, i64 8}
!27 = !{!"_ZTSN7imnodes12_GLOBAL__N_113OptionalIndexE", !12, i64 0}
!28 = !{!6, !19, i64 364}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!6, !12, i64 360}
!32 = !{!12, !12, i64 0}


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