; LLVM IR from hbatagelo/abcg :: abcg/external/glslang/SPIRV/SpvBuilder.ll (ZN3spv7Builder2IfC2EjjRS0_)

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

%"class.spv::Builder::If" = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113), i32 noundef, ptr noundef nonnull align 8 dereferenceable(224)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3spv8Function8addBlockEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(224), ptr noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3spv7Builder13setBuildPointEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096), ptr noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(224) ptr @_ZNK3spv5Block9getParentEv(ptr noundef nonnull align 8 dereferenceable(113)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3spv7Builder2IfC2EjjRS0_(ptr noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(1096) %3) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8
  %12 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %13, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 1
  %15 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %15, ptr %14, align 8, !tbaa !11
  %16 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 2
  %17 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %17, ptr %16, align 4, !tbaa !13
  %18 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 6
  store ptr null, ptr %18, align 8, !tbaa !14
  %19 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = call noundef ptr @_ZNK3spv7Builder13getBuildPointEv(ptr noundef nonnull align 8 dereferenceable(1096) %20)
  %22 = call noundef nonnull align 8 dereferenceable(224) ptr @_ZNK3spv5Block9getParentEv(ptr noundef nonnull align 8 dereferenceable(113) %21)
  %23 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 3
  store ptr %22, ptr %23, align 8, !tbaa !16
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 120) #5
  %25 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = invoke noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096) %26)
          to label %28 unwind label %54

28:                                               ; preds = %4
  %29 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  invoke void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113) %24, i32 noundef %27, ptr noundef nonnull align 8 dereferenceable(224) %30)
          to label %31 unwind label %54

31:                                               ; preds = %28
  %32 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 5
  store ptr %24, ptr %32, align 8, !tbaa !17
  %33 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 120) #5
  %34 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = invoke noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096) %35)
          to label %37 unwind label %58

37:                                               ; preds = %31
  %38 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 3
  %39 = load ptr, ptr %38, align 8, !tbaa !16
  invoke void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113) %33, i32 noundef %36, ptr noundef nonnull align 8 dereferenceable(224) %39)
          to label %40 unwind label %58

40:                                               ; preds = %37
  %41 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 7
  store ptr %33, ptr %41, align 8, !tbaa !18
  %42 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = call noundef ptr @_ZNK3spv7Builder13getBuildPointEv(ptr noundef nonnull align 8 dereferenceable(1096) %43)
  %45 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 4
  store ptr %44, ptr %45, align 8, !tbaa !19
  %46 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 3
  %47 = load ptr, ptr %46, align 8, !tbaa !16
  %48 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 5
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  call void @_ZN3spv8Function8addBlockEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(224) %47, ptr noundef %49)
  %50 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = getelementptr inbounds %"class.spv::Builder::If", ptr %11, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  call void @_ZN3spv7Builder13setBuildPointEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096) %51, ptr noundef %53)
  ret void

54:                                               ; preds = %28, %4
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %9, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 120) #6
  br label %62

58:                                               ; preds = %37, %31
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %9, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %33, i64 noundef 120) #6
  br label %62

62:                                               ; preds = %58, %54
  %63 = load ptr, ptr %9, align 8
  %64 = load i32, ptr %10, align 4
  %65 = insertvalue { ptr, i32 } poison, ptr %63, 0
  %66 = insertvalue { ptr, i32 } %65, i32 %64, 1
  resume { ptr, i32 } %66
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3spv7Builder13getBuildPointEv(ptr noundef nonnull align 8 dereferenceable(1096)) #2 align 2

attributes #0 = { nobuiltin 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 = { nobuiltin allocsize(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 = { 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 #3 = { inlinehint 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" }
attributes #4 = { 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" }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { builtin 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, !10, i64 8}
!12 = !{!"_ZTSN3spv7Builder2IfE", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!13 = !{!12, !10, i64 12}
!14 = !{!12, !6, i64 40}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 16}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 48}
!19 = !{!12, !6, i64 24}


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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113), i32 noundef, ptr noundef nonnull align 8 dereferenceable(224)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3spv8Function8addBlockEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(224), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3spv7Builder13setBuildPointEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(224) ptr @_ZNK3spv5Block9getParentEv(ptr noundef nonnull align 8 dereferenceable(113)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3spv7Builder2IfC2EjjRS0_(ptr nocapture noundef nonnull align 8 dereferenceable(56) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(1096) %3) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  store ptr %3, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %1, ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %2, ptr %6, align 4, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr null, ptr %7, align 8, !tbaa !13
  %8 = tail call noundef ptr @_ZNK3spv7Builder13getBuildPointEv(ptr noundef nonnull align 8 dereferenceable(1096) %3)
  %9 = tail call noundef nonnull align 8 dereferenceable(224) ptr @_ZNK3spv5Block9getParentEv(ptr noundef nonnull align 8 dereferenceable(113) %8)
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %9, ptr %10, align 8, !tbaa !14
  %11 = tail call noalias noundef nonnull dereferenceable(120) ptr @_Znwm(i64 noundef 120) #5
  %12 = load ptr, ptr %0, align 8, !tbaa !15
  %13 = tail call noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096) %12)
  %14 = load ptr, ptr %10, align 8, !tbaa !14
  invoke void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113) %11, i32 noundef %13, ptr noundef nonnull align 8 dereferenceable(224) %14)
          to label %15 unwind label %30

15:                                               ; preds = %4
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %11, ptr %16, align 8, !tbaa !16
  %17 = tail call noalias noundef nonnull dereferenceable(120) ptr @_Znwm(i64 noundef 120) #5
  %18 = load ptr, ptr %0, align 8, !tbaa !15
  %19 = tail call noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096) %18)
  %20 = load ptr, ptr %10, align 8, !tbaa !14
  invoke void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113) %17, i32 noundef %19, ptr noundef nonnull align 8 dereferenceable(224) %20)
          to label %21 unwind label %32

21:                                               ; preds = %15
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %17, ptr %22, align 8, !tbaa !17
  %23 = load ptr, ptr %0, align 8, !tbaa !15
  %24 = tail call noundef ptr @_ZNK3spv7Builder13getBuildPointEv(ptr noundef nonnull align 8 dereferenceable(1096) %23)
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %24, ptr %25, align 8, !tbaa !18
  %26 = load ptr, ptr %10, align 8, !tbaa !14
  %27 = load ptr, ptr %16, align 8, !tbaa !16
  tail call void @_ZN3spv8Function8addBlockEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(224) %26, ptr noundef %27)
  %28 = load ptr, ptr %0, align 8, !tbaa !15
  %29 = load ptr, ptr %16, align 8, !tbaa !16
  tail call void @_ZN3spv7Builder13setBuildPointEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096) %28, ptr noundef %29)
  ret void

30:                                               ; preds = %4
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %34

32:                                               ; preds = %15
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %34

34:                                               ; preds = %32, %30
  %.sink = phi ptr [ %17, %32 ], [ %11, %30 ]
  %.pn = phi { ptr, i32 } [ %33, %32 ], [ %31, %30 ]
  tail call void @_ZdlPvm(ptr noundef nonnull %.sink, i64 noundef 120) #6
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3spv7Builder13getBuildPointEv(ptr noundef nonnull align 8 dereferenceable(1096)) local_unnamed_addr #2 align 2

attributes #0 = { nobuiltin 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 = { nobuiltin allocsize(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 = { 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 #3 = { inlinehint 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" }
attributes #4 = { 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" }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { builtin 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, !11, i64 8}
!10 = !{!"_ZTSN3spv7Builder2IfE", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 12}
!13 = !{!10, !6, i64 40}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !6, i64 24}


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