; LLVM IR from Try/Tempest :: Engine/thirdparty/spirv_cross (spirv_cfg)

; 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK11spirv_cross3CFG21find_common_dominatorEjj(ptr noundef nonnull align 8 dereferenceable(356) %0, i32 noundef %1, i32 noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  br label %8

8:                                                ; preds = %24, %3
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = icmp ne i32 %9, %10
  br i1 %11, label %12, label %25

12:                                               ; preds = %8
  %13 = load i32, ptr %5, align 4, !tbaa !9
  %14 = call noundef i32 @_ZNK11spirv_cross3CFG15get_visit_orderEj(ptr noundef nonnull align 8 dereferenceable(356) %7, i32 noundef %13)
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = call noundef i32 @_ZNK11spirv_cross3CFG15get_visit_orderEj(ptr noundef nonnull align 8 dereferenceable(356) %7, i32 noundef %15)
  %17 = icmp ult i32 %14, %16
  br i1 %17, label %18, label %21

18:                                               ; preds = %12
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = call noundef i32 @_ZNK11spirv_cross3CFG23get_immediate_dominatorEj(ptr noundef nonnull align 8 dereferenceable(356) %7, i32 noundef %19)
  store i32 %20, ptr %5, align 4, !tbaa !9
  br label %24

21:                                               ; preds = %12
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = call noundef i32 @_ZNK11spirv_cross3CFG23get_immediate_dominatorEj(ptr noundef nonnull align 8 dereferenceable(356) %7, i32 noundef %22)
  store i32 %23, ptr %6, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %21, %18
  br label %8, !llvm.loop !11

25:                                               ; preds = %8
  %26 = load i32, ptr %5, align 4, !tbaa !9
  ret i32 %26
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross3CFG15get_visit_orderEj(ptr noundef nonnull align 8 dereferenceable(356), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross3CFG23get_immediate_dominatorEj(ptr noundef nonnull align 8 dereferenceable(356), i32 noundef) #0 align 2

attributes #0 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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 uwtable
define dso_local noundef i32 @_ZNK11spirv_cross3CFG21find_common_dominatorEjj(ptr noundef nonnull align 8 dereferenceable(356) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %.not9 = icmp eq i32 %1, %2
  br i1 %.not9, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %11
  %.011 = phi i32 [ %.1, %11 ], [ %2, %3 ]
  %.0710 = phi i32 [ %.18, %11 ], [ %1, %3 ]
  %4 = tail call noundef i32 @_ZNK11spirv_cross3CFG15get_visit_orderEj(ptr noundef nonnull align 8 dereferenceable(356) %0, i32 noundef %.0710)
  %5 = tail call noundef i32 @_ZNK11spirv_cross3CFG15get_visit_orderEj(ptr noundef nonnull align 8 dereferenceable(356) %0, i32 noundef %.011)
  %6 = icmp ult i32 %4, %5
  br i1 %6, label %7, label %9

7:                                                ; preds = %.lr.ph
  %8 = tail call noundef i32 @_ZNK11spirv_cross3CFG23get_immediate_dominatorEj(ptr noundef nonnull align 8 dereferenceable(356) %0, i32 noundef %.0710)
  br label %11

9:                                                ; preds = %.lr.ph
  %10 = tail call noundef i32 @_ZNK11spirv_cross3CFG23get_immediate_dominatorEj(ptr noundef nonnull align 8 dereferenceable(356) %0, i32 noundef %.011)
  br label %11

11:                                               ; preds = %9, %7
  %.18 = phi i32 [ %8, %7 ], [ %.0710, %9 ]
  %.1 = phi i32 [ %.011, %7 ], [ %10, %9 ]
  %.not = icmp eq i32 %.18, %.1
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %11, %3
  %.07.lcssa = phi i32 [ %1, %3 ], [ %.18, %11 ]
  ret i32 %.07.lcssa
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross3CFG15get_visit_orderEj(ptr noundef nonnull align 8 dereferenceable(356), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK11spirv_cross3CFG23get_immediate_dominatorEj(ptr noundef nonnull align 8 dereferenceable(356), i32 noundef) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass