; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/AssetLib/FBX (FBXParser)

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

@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Assimp3FBX5Token8IsBinaryEv(ptr noundef nonnull align 8 dereferenceable(36)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_19SafeParseImEET_PKcS3_(ptr noundef, ptr noundef) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN6Assimp12strtoul10_64I17DeadlyImportErrorEEmPKcPS3_Pj(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN6Assimp3FBX15ParseTokenAsDimERKNS0_5TokenERPKc(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr null, ptr %12, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noundef i32 @_ZNK6Assimp3FBX5Token4TypeEv(ptr noundef nonnull align 8 dereferenceable(36) %13)
  %15 = icmp ne i32 %14, 2
  br i1 %15, label %16, label %18

16:                                               ; preds = %2
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr @.str.11, ptr %17, align 8, !tbaa !5
  store i64 0, ptr %3, align 8
  br label %75

18:                                               ; preds = %2
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call noundef zeroext i1 @_ZNK6Assimp3FBX5Token8IsBinaryEv(ptr noundef nonnull align 8 dereferenceable(36) %19)
  br i1 %20, label %21, label %39

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %22)
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 0
  %26 = load i8, ptr %25, align 1, !tbaa !9
  %27 = sext i8 %26 to i32
  %28 = icmp ne i32 %27, 76
  br i1 %28, label %29, label %31

29:                                               ; preds = %21
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr @.str.12, ptr %30, align 8, !tbaa !5
  store i64 0, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %38

31:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 1
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call noundef ptr @_ZNK6Assimp3FBX5Token3endEv(ptr noundef nonnull align 8 dereferenceable(36) %34)
  %36 = call noundef i64 @_ZN12_GLOBAL__N_19SafeParseImEET_PKcS3_(ptr noundef %33, ptr noundef %35)
  store i64 %36, ptr %8, align 8, !tbaa !10
  %37 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %37, ptr %3, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %38

38:                                               ; preds = %31, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %75

39:                                               ; preds = %18
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %40)
  %42 = load i8, ptr %41, align 1, !tbaa !9
  %43 = sext i8 %42 to i32
  %44 = icmp ne i32 %43, 42
  br i1 %44, label %45, label %47

45:                                               ; preds = %39
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr @.str.15, ptr %46, align 8, !tbaa !5
  store i64 0, ptr %3, align 8
  br label %75

47:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = call noundef ptr @_ZNK6Assimp3FBX5Token3endEv(ptr noundef nonnull align 8 dereferenceable(36) %48)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %50)
  %52 = ptrtoint ptr %49 to i64
  %53 = ptrtoint ptr %51 to i64
  %54 = sub i64 %52, %53
  %55 = trunc i64 %54 to i32
  store i32 %55, ptr %9, align 4, !tbaa !12
  %56 = load i32, ptr %9, align 4, !tbaa !12
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %60

58:                                               ; preds = %47
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr @.str.16, ptr %59, align 8, !tbaa !5
  store i64 0, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %74

60:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %61)
  %63 = getelementptr inbounds i8, ptr %62, i64 1
  %64 = call noundef i64 @_ZN6Assimp12strtoul10_64I17DeadlyImportErrorEEmPKcPS3_Pj(ptr noundef %63, ptr noundef %10, ptr noundef %9)
  store i64 %64, ptr %11, align 8, !tbaa !10
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = call noundef ptr @_ZNK6Assimp3FBX5Token3endEv(ptr noundef nonnull align 8 dereferenceable(36) %66)
  %68 = icmp ugt ptr %65, %67
  br i1 %68, label %69, label %71

69:                                               ; preds = %60
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr @.str.17, ptr %70, align 8, !tbaa !5
  store i64 0, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %73

71:                                               ; preds = %60
  %72 = load i64, ptr %11, align 8, !tbaa !10
  store i64 %72, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %73

73:                                               ; preds = %71, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %74

74:                                               ; preds = %73, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %75

75:                                               ; preds = %74, %45, %38, %16
  %76 = load i64, ptr %3, align 8
  ret i64 %76
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, 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"

@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1

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

; 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK6Assimp3FBX5Token4TypeEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Assimp3FBX5Token8IsBinaryEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN12_GLOBAL__N_19SafeParseImEET_PKcS3_(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN6Assimp12strtoul10_64I17DeadlyImportErrorEEmPKcPS3_Pj(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN6Assimp3FBX15ParseTokenAsDimERKNS0_5TokenERPKc(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  store ptr null, ptr %1, align 8, !tbaa !5
  %5 = tail call noundef i32 @_ZNK6Assimp3FBX5Token4TypeEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %.not = icmp eq i32 %5, 2
  br i1 %.not, label %7, label %6

6:                                                ; preds = %2
  store ptr @.str.11, ptr %1, align 8, !tbaa !5
  br label %38

7:                                                ; preds = %2
  %8 = tail call noundef zeroext i1 @_ZNK6Assimp3FBX5Token8IsBinaryEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %9 = tail call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %10 = load i8, ptr %9, align 1, !tbaa !9
  br i1 %8, label %11, label %17

11:                                               ; preds = %7
  %.not20 = icmp eq i8 %10, 76
  br i1 %.not20, label %13, label %12

12:                                               ; preds = %11
  store ptr @.str.12, ptr %1, align 8, !tbaa !5
  br label %38

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %9, i64 1
  %15 = tail call noundef ptr @_ZNK6Assimp3FBX5Token3endEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %16 = tail call noundef i64 @_ZN12_GLOBAL__N_19SafeParseImEET_PKcS3_(ptr noundef nonnull %14, ptr noundef %15)
  br label %38

17:                                               ; preds = %7
  %.not19 = icmp eq i8 %10, 42
  br i1 %.not19, label %19, label %18

18:                                               ; preds = %17
  store ptr @.str.15, ptr %1, align 8, !tbaa !5
  br label %38

19:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %20 = tail call noundef ptr @_ZNK6Assimp3FBX5Token3endEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %21 = tail call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %22 = ptrtoint ptr %20 to i64
  %23 = ptrtoint ptr %21 to i64
  %24 = sub i64 %22, %23
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr %3, align 4, !tbaa !10
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %19
  store ptr @.str.16, ptr %1, align 8, !tbaa !5
  br label %37

28:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  %29 = tail call noundef ptr @_ZNK6Assimp3FBX5Token5beginEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %30 = getelementptr inbounds i8, ptr %29, i64 1
  %31 = call noundef i64 @_ZN6Assimp12strtoul10_64I17DeadlyImportErrorEEmPKcPS3_Pj(ptr noundef nonnull %30, ptr noundef nonnull %4, ptr noundef nonnull %3)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call noundef ptr @_ZNK6Assimp3FBX5Token3endEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %34 = icmp ugt ptr %32, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %28
  store ptr @.str.17, ptr %1, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %28, %35
  %.1 = phi i64 [ 0, %35 ], [ %31, %28 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %37

37:                                               ; preds = %36, %27
  %.2 = phi i64 [ 0, %27 ], [ %.1, %36 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  br label %38

38:                                               ; preds = %12, %13, %37, %18, %6
  %.3 = phi i64 [ 0, %6 ], [ 0, %18 ], [ %.2, %37 ], [ 0, %12 ], [ %16, %13 ]
  ret i64 %.3
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}


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