; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/CApi (AssimpCExport)

; 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.Assimp::Exporter" = type { ptr }
%struct.aiExportFormatDesc = type { ptr, ptr, ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare void @_ZN6Assimp8ExporterC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN6Assimp8ExporterD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local ptr @aiGetExportFormatDescription(i64 noundef %0) #3 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.Assimp::Exporter", align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  call void @_ZN6Assimp8ExporterC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %10 = load i64, ptr %3, align 8, !tbaa !5
  %11 = invoke noundef ptr @_ZNK6Assimp8Exporter26GetExportFormatDescriptionEm(ptr noundef nonnull align 8 dereferenceable(8) %4, i64 noundef %10)
          to label %12 unwind label %16

12:                                               ; preds = %1
  store ptr %11, ptr %5, align 8, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = icmp eq ptr null, %13
  br i1 %14, label %15, label %20

15:                                               ; preds = %12
  store ptr null, ptr %2, align 8
  store i32 1, ptr %8, align 4
  br label %85

16:                                               ; preds = %1
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %6, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %7, align 4
  br label %87

20:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %21 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #9
          to label %22 unwind label %81

22:                                               ; preds = %20
  store ptr %21, ptr %9, align 8, !tbaa !9
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %23, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = call i64 @strlen(ptr noundef %25) #10
  %27 = add i64 %26, 1
  %28 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %27) #9
          to label %29 unwind label %81

29:                                               ; preds = %22
  call void @llvm.memset.p0.i64(ptr align 1 %28, i8 0, i64 %27, i1 false)
  %30 = load ptr, ptr %9, align 8, !tbaa !9
  %31 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %30, i32 0, i32 1
  store ptr %28, ptr %31, align 8, !tbaa !11
  %32 = load ptr, ptr %9, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %32, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = call i64 @strlen(ptr noundef %40) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %34, ptr align 1 %37, i64 %41, i1 false)
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %42, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = call i64 @strlen(ptr noundef %44) #10
  %46 = add i64 %45, 1
  %47 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %46) #9
          to label %48 unwind label %81

48:                                               ; preds = %29
  call void @llvm.memset.p0.i64(ptr align 1 %47, i8 0, i64 %46, i1 false)
  %49 = load ptr, ptr %9, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %49, i32 0, i32 2
  store ptr %47, ptr %50, align 8, !tbaa !13
  %51 = load ptr, ptr %9, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !13
  %54 = load ptr, ptr %5, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %57, i32 0, i32 2
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  %60 = call i64 @strlen(ptr noundef %59) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %53, ptr align 1 %56, i64 %60, i1 false)
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  %64 = call i64 @strlen(ptr noundef %63) #10
  %65 = add i64 %64, 1
  %66 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %65) #9
          to label %67 unwind label %81

67:                                               ; preds = %48
  call void @llvm.memset.p0.i64(ptr align 1 %66, i8 0, i64 %65, i1 false)
  %68 = load ptr, ptr %9, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %68, i32 0, i32 0
  store ptr %66, ptr %69, align 8, !tbaa !14
  %70 = load ptr, ptr %9, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = load ptr, ptr %5, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  %76 = load ptr, ptr %5, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.aiExportFormatDesc, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  %79 = call i64 @strlen(ptr noundef %78) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %72, ptr align 1 %75, i64 %79, i1 false)
  %80 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %80, ptr %2, align 8
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %85

81:                                               ; preds = %48, %29, %22, %20
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %6, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %87

85:                                               ; preds = %67, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @_ZN6Assimp8ExporterD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  %86 = load ptr, ptr %2, align 8
  ret ptr %86

87:                                               ; preds = %81, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @_ZN6Assimp8ExporterD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  br label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr %6, align 8
  %90 = load i32, ptr %7, align 4
  %91 = insertvalue { ptr, i32 } poison, ptr %89, 0
  %92 = insertvalue { ptr, i32 } %91, i32 %90, 1
  resume { ptr, i32 } %92
}

declare noundef ptr @_ZNK6Assimp8Exporter26GetExportFormatDescriptionEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #1

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 = { 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 #5 = { nounwind willreturn memory(read) "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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS18aiExportFormatDesc", !10, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, 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"

%"class.Assimp::Exporter" = type { ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare void @_ZN6Assimp8ExporterC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN6Assimp8ExporterD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noalias noundef ptr @aiGetExportFormatDescription(i64 noundef %0) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.Assimp::Exporter", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @_ZN6Assimp8ExporterC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %3 = invoke noundef ptr @_ZNK6Assimp8Exporter26GetExportFormatDescriptionEm(ptr noundef nonnull align 8 dereferenceable(8) %2, i64 noundef %0)
          to label %4 unwind label %6

4:                                                ; preds = %1
  %5 = icmp eq ptr %3, null
  br i1 %5, label %35, label %8

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

8:                                                ; preds = %4
  %9 = invoke noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #9
          to label %10 unwind label %33

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %12) #10
  %14 = add i64 %13, 1
  %15 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %14) #9
          to label %16 unwind label %33

16:                                               ; preds = %10
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %15, i8 0, i64 %14, i1 false)
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %15, ptr %17, align 8, !tbaa !5
  %18 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %12) #10
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %15, ptr align 1 %12, i64 %18, i1 false)
  %19 = getelementptr inbounds i8, ptr %3, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !10
  %21 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %20) #10
  %22 = add i64 %21, 1
  %23 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %22) #9
          to label %24 unwind label %33

24:                                               ; preds = %16
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %23, i8 0, i64 %22, i1 false)
  %25 = getelementptr inbounds i8, ptr %9, i64 16
  store ptr %23, ptr %25, align 8, !tbaa !10
  %26 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %20) #10
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %23, ptr align 1 %20, i64 %26, i1 false)
  %27 = load ptr, ptr %3, align 8, !tbaa !11
  %28 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #10
  %29 = add i64 %28, 1
  %30 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %29) #9
          to label %31 unwind label %33

31:                                               ; preds = %24
  call void @llvm.memset.p0.i64(ptr nonnull align 1 %30, i8 0, i64 %29, i1 false)
  store ptr %30, ptr %9, align 8, !tbaa !11
  %32 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #10
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %30, ptr align 1 %27, i64 %32, i1 false)
  br label %35

33:                                               ; preds = %24, %16, %10, %8
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %36

35:                                               ; preds = %4, %31
  %.0 = phi ptr [ %9, %31 ], [ null, %4 ]
  call void @_ZN6Assimp8ExporterD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  ret ptr %.0

36:                                               ; preds = %33, %6
  %.pn = phi { ptr, i32 } [ %34, %33 ], [ %7, %6 ]
  call void @_ZN6Assimp8ExporterD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  resume { ptr, i32 } %.pn
}

declare noundef ptr @_ZNK6Assimp8Exporter26GetExportFormatDescriptionEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { nounwind willreturn memory(read) }

!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 8}
!6 = !{!"_ZTS18aiExportFormatDesc", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 16}
!11 = !{!6, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass