; LLVM IR from Sonryle/JoePhys :: testbed/src/Renderer.ll (ZN8Renderer6CreateEv)

; 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.Renderer = type { ptr, ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Renderer6CreateEv(ptr noundef nonnull align 8 dereferenceable(16) %0) #0 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 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 49184) #4
  invoke void @_ZN13GLRenderLinesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184) %6)
          to label %7 unwind label %16

7:                                                ; preds = %1
  %8 = getelementptr inbounds %struct.Renderer, ptr %5, i32 0, i32 0
  store ptr %6, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.Renderer, ptr %5, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  call void @_ZN13GLRenderLines6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184) %10)
  %11 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 49184) #4
  invoke void @_ZN17GLRenderTrianglesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184) %11)
          to label %12 unwind label %20

12:                                               ; preds = %7
  %13 = getelementptr inbounds %struct.Renderer, ptr %5, i32 0, i32 1
  store ptr %11, ptr %13, align 8, !tbaa !11
  %14 = getelementptr inbounds %struct.Renderer, ptr %5, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  call void @_ZN17GLRenderTriangles6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184) %15)
  ret void

16:                                               ; preds = %1
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %3, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %6, i64 noundef 49184) #5
  br label %24

20:                                               ; preds = %7
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %3, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %11, i64 noundef 49184) #5
  br label %24

24:                                               ; preds = %20, %16
  %25 = load ptr, ptr %3, align 8
  %26 = load i32, ptr %4, align 4
  %27 = insertvalue { ptr, i32 } poison, ptr %25, 0
  %28 = insertvalue { ptr, i32 } %27, i32 %26, 1
  resume { ptr, i32 } %28
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN13GLRenderLinesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13GLRenderLines6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN17GLRenderTrianglesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17GLRenderTriangles6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184)) #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" }
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 = { 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 #3 = { 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 #4 = { builtin allocsize(0) }
attributes #5 = { 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 = !{!"_ZTS8Renderer", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}


; 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: mustprogress uwtable
define dso_local void @_ZN8Renderer6CreateEv(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(16) %0) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = tail call noalias noundef nonnull dereferenceable(49184) ptr @_Znwm(i64 noundef 49184) #4
  invoke void @_ZN13GLRenderLinesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184) %2)
          to label %3 unwind label %7

3:                                                ; preds = %1
  store ptr %2, ptr %0, align 8, !tbaa !5
  tail call void @_ZN13GLRenderLines6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184) %2)
  %4 = tail call noalias noundef nonnull dereferenceable(49184) ptr @_Znwm(i64 noundef 49184) #4
  invoke void @_ZN17GLRenderTrianglesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184) %4)
          to label %5 unwind label %9

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %4, ptr %6, align 8, !tbaa !10
  tail call void @_ZN17GLRenderTriangles6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184) %4)
  ret void

7:                                                ; preds = %1
  %8 = landingpad { ptr, i32 }
          cleanup
  br label %11

9:                                                ; preds = %3
  %10 = landingpad { ptr, i32 }
          cleanup
  br label %11

11:                                               ; preds = %9, %7
  %.sink = phi ptr [ %4, %9 ], [ %2, %7 ]
  %.pn = phi { ptr, i32 } [ %10, %9 ], [ %8, %7 ]
  tail call void @_ZdlPvm(ptr noundef nonnull %.sink, i64 noundef 49184) #5
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN13GLRenderLinesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13GLRenderLines6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN17GLRenderTrianglesC2Ev(ptr noundef nonnull align 4 dereferenceable(49184)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17GLRenderTriangles6CreateEv(ptr noundef nonnull align 4 dereferenceable(49184)) 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" }
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 = { 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 #3 = { 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 #4 = { builtin allocsize(0) }
attributes #5 = { 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 = !{!"_ZTS8Renderer", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}


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