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

; 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 uwtable
define dso_local void @_ZN3spv7Builder2If13makeBeginElseEv(ptr noundef nonnull align 8 dereferenceable(56) %0) #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 0
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 7
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  call void @_ZN3spv7Builder12createBranchEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096) %7, ptr noundef %9)
  %10 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 120) #5
  %11 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = invoke noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096) %12)
          to label %14 unwind label %27

14:                                               ; preds = %1
  %15 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  invoke void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113) %10, i32 noundef %13, ptr noundef nonnull align 8 dereferenceable(224) %16)
          to label %17 unwind label %27

17:                                               ; preds = %14
  %18 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 6
  store ptr %10, ptr %18, align 8, !tbaa !14
  %19 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 3
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 6
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  call void @_ZN3spv8Function8addBlockEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(224) %20, ptr noundef %22)
  %23 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds %"class.spv::Builder::If", ptr %5, i32 0, i32 6
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  call void @_ZN3spv7Builder13setBuildPointEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096) %24, ptr noundef %26)
  ret void

27:                                               ; preds = %14, %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %3, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %10, i64 noundef 120) #6
  br label %31

31:                                               ; preds = %27
  %32 = load ptr, ptr %3, align 8
  %33 = load i32, ptr %4, align 4
  %34 = insertvalue { ptr, i32 } poison, ptr %32, 0
  %35 = insertvalue { ptr, i32 } %34, i32 %33, 1
  resume { ptr, i32 } %35
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3spv7Builder12createBranchEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096), ptr noundef) #4 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, !6, i64 0}
!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, !6, i64 48}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !6, i64 40}


; 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 uwtable
define dso_local void @_ZN3spv7Builder2If13makeBeginElseEv(ptr nocapture noundef nonnull align 8 dereferenceable(56) %0) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 48
  %4 = load ptr, ptr %3, align 8, !tbaa !11
  tail call void @_ZN3spv7Builder12createBranchEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096) %2, ptr noundef %4)
  %5 = tail call noalias noundef nonnull dereferenceable(120) ptr @_Znwm(i64 noundef 120) #5
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = tail call noundef i32 @_ZN3spv7Builder11getUniqueIdEv(ptr noundef nonnull align 8 dereferenceable(1096) %6)
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  invoke void @_ZN3spv5BlockC2EjRNS_8FunctionE(ptr noundef nonnull align 8 dereferenceable(113) %5, i32 noundef %7, ptr noundef nonnull align 8 dereferenceable(224) %9)
          to label %10 unwind label %15

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %5, ptr %11, align 8, !tbaa !13
  %12 = load ptr, ptr %8, align 8, !tbaa !12
  tail call void @_ZN3spv8Function8addBlockEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(224) %12, ptr noundef nonnull %5)
  %13 = load ptr, ptr %0, align 8, !tbaa !5
  %14 = load ptr, ptr %11, align 8, !tbaa !13
  tail call void @_ZN3spv7Builder13setBuildPointEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096) %13, ptr noundef %14)
  ret void

15:                                               ; preds = %1
  %16 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %5, i64 noundef 120) #6
  resume { ptr, i32 } %16
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3spv7Builder12createBranchEPNS_5BlockE(ptr noundef nonnull align 8 dereferenceable(1096), ptr noundef) local_unnamed_addr #4 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, !7, i64 0}
!6 = !{!"_ZTSN3spv7Builder2IfE", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 48}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 40}


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