; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/Common (RemoveComments)

; 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 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [115 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp14CommentRemover18RemoveLineCommentsEPKcPcc(ptr noundef %0, ptr noundef %1, i8 noundef signext %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i8 %2, ptr %6, align 1, !tbaa !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = icmp ne ptr null, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %3
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 56)
  br label %14

14:                                               ; preds = %13, %3
  %15 = phi i1 [ true, %3 ], [ false, %13 ]
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr null, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 57)
  br label %19

19:                                               ; preds = %18, %14
  %20 = phi i1 [ true, %14 ], [ false, %18 ]
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = icmp ne i8 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %19
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 58)
  br label %25

25:                                               ; preds = %24, %19
  %26 = phi i1 [ true, %19 ], [ false, %24 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call i64 @strlen(ptr noundef %27) #6
  store i64 %28, ptr %7, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i64 @strlen(ptr noundef %29) #6
  store i64 %30, ptr %8, align 8, !tbaa !10
  %31 = load i64, ptr %7, align 8, !tbaa !10
  %32 = load i64, ptr %8, align 8, !tbaa !10
  %33 = icmp ugt i64 %31, %32
  br i1 %33, label %34, label %36

34:                                               ; preds = %25
  %35 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %35, ptr %7, align 8, !tbaa !10
  br label %36

36:                                               ; preds = %34, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !10
  br label %37

37:                                               ; preds = %117, %36
  %38 = load i64, ptr %9, align 8, !tbaa !10
  %39 = load i64, ptr %8, align 8, !tbaa !10
  %40 = icmp ult i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 2, ptr %10, align 4
  br label %120

42:                                               ; preds = %37
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = load i64, ptr %9, align 8, !tbaa !10
  %45 = getelementptr inbounds i8, ptr %43, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !9
  %47 = sext i8 %46 to i32
  %48 = icmp eq i32 %47, 34
  br i1 %48, label %56, label %49

49:                                               ; preds = %42
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i64, ptr %9, align 8, !tbaa !10
  %52 = getelementptr inbounds i8, ptr %50, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !9
  %54 = sext i8 %53 to i32
  %55 = icmp eq i32 %54, 39
  br i1 %55, label %56, label %80

56:                                               ; preds = %49, %42
  br label %57

57:                                               ; preds = %78, %56
  %58 = load i64, ptr %9, align 8, !tbaa !10
  %59 = add i64 %58, 1
  store i64 %59, ptr %9, align 8, !tbaa !10
  %60 = load i64, ptr %8, align 8, !tbaa !10
  %61 = icmp ult i64 %59, %60
  br i1 %61, label %62, label %76

62:                                               ; preds = %57
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = load i64, ptr %9, align 8, !tbaa !10
  %65 = getelementptr inbounds i8, ptr %63, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !9
  %67 = sext i8 %66 to i32
  %68 = icmp ne i32 %67, 34
  br i1 %68, label %69, label %76

69:                                               ; preds = %62
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = load i64, ptr %9, align 8, !tbaa !10
  %72 = getelementptr inbounds i8, ptr %70, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !9
  %74 = sext i8 %73 to i32
  %75 = icmp ne i32 %74, 39
  br label %76

76:                                               ; preds = %69, %62, %57
  %77 = phi i1 [ false, %62 ], [ false, %57 ], [ %75, %69 ]
  br i1 %77, label %78, label %79

78:                                               ; preds = %76
  br label %57, !llvm.loop !12

79:                                               ; preds = %76
  br label %80

80:                                               ; preds = %79, %49
  %81 = load i64, ptr %8, align 8, !tbaa !10
  %82 = load i64, ptr %9, align 8, !tbaa !10
  %83 = sub i64 %81, %82
  %84 = load i64, ptr %7, align 8, !tbaa !10
  %85 = icmp ult i64 %83, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %80
  store i32 2, ptr %10, align 4
  br label %120

87:                                               ; preds = %80
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = load i64, ptr %9, align 8, !tbaa !10
  %90 = getelementptr inbounds i8, ptr %88, i64 %89
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = load i64, ptr %7, align 8, !tbaa !10
  %93 = call i32 @strncmp(ptr noundef %90, ptr noundef %91, i64 noundef %92) #6
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %116, label %95

95:                                               ; preds = %87
  br label %96

96:                                               ; preds = %109, %95
  %97 = load i64, ptr %9, align 8, !tbaa !10
  %98 = load i64, ptr %8, align 8, !tbaa !10
  %99 = icmp ult i64 %97, %98
  br i1 %99, label %100, label %107

100:                                              ; preds = %96
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = load i64, ptr %9, align 8, !tbaa !10
  %103 = getelementptr inbounds i8, ptr %101, i64 %102
  %104 = load i8, ptr %103, align 1, !tbaa !9
  %105 = call noundef zeroext i1 @_ZN6Assimp9IsLineEndIcEEbT_(i8 noundef signext %104)
  %106 = xor i1 %105, true
  br label %107

107:                                              ; preds = %100, %96
  %108 = phi i1 [ false, %96 ], [ %106, %100 ]
  br i1 %108, label %109, label %115

109:                                              ; preds = %107
  %110 = load i8, ptr %6, align 1, !tbaa !9
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = load i64, ptr %9, align 8, !tbaa !10
  %113 = add i64 %112, 1
  store i64 %113, ptr %9, align 8, !tbaa !10
  %114 = getelementptr inbounds i8, ptr %111, i64 %112
  store i8 %110, ptr %114, align 1, !tbaa !9
  br label %96, !llvm.loop !14

115:                                              ; preds = %107
  br label %116

116:                                              ; preds = %115, %87
  br label %117

117:                                              ; preds = %116
  %118 = load i64, ptr %9, align 8, !tbaa !10
  %119 = add i64 %118, 1
  store i64 %119, ptr %9, align 8, !tbaa !10
  br label %37, !llvm.loop !15

120:                                              ; preds = %86, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %121

121:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void
}

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) #1

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Assimp9IsLineEndIcEEbT_(i8 noundef signext) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { inlinehint 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


; 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 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [115 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6Assimp14CommentRemover18RemoveLineCommentsEPKcPcc(ptr noundef readonly %0, ptr noundef %1, i8 noundef signext %2) local_unnamed_addr #0 align 2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 56)
  br label %5

5:                                                ; preds = %4, %3
  %.not44 = icmp eq ptr %1, null
  br i1 %.not44, label %6, label %7

6:                                                ; preds = %5
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 57)
  br label %7

7:                                                ; preds = %6, %5
  %8 = load i8, ptr %0, align 1, !tbaa !5
  %.not45 = icmp eq i8 %8, 0
  br i1 %.not45, label %9, label %10

9:                                                ; preds = %7
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 58)
  br label %10

10:                                               ; preds = %9, %7
  %11 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #5
  %12 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #5
  %spec.select = tail call i64 @llvm.umin.i64(i64 %11, i64 %12)
  %.not54 = icmp eq i64 %12, 0
  br i1 %.not54, label %.critedge._crit_edge, label %.lr.ph53

.lr.ph53:                                         ; preds = %10, %.critedge2
  %.052 = phi i64 [ %34, %.critedge2 ], [ 0, %10 ]
  %13 = getelementptr inbounds i8, ptr %1, i64 %.052
  %14 = load i8, ptr %13, align 1, !tbaa !5
  switch i8 %14, label %.critedge [
    i8 34, label %15
    i8 39, label %15
  ]

15:                                               ; preds = %.lr.ph53, %.lr.ph53
  %16 = add i64 %.052, 1
  %umax = tail call i64 @llvm.umax.i64(i64 %12, i64 %16)
  br label %17

17:                                               ; preds = %20, %15
  %.1 = phi i64 [ %.052, %15 ], [ %18, %20 ]
  %18 = add i64 %.1, 1
  %19 = icmp ult i64 %18, %12
  br i1 %19, label %20, label %.critedge

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %1, i64 %18
  %22 = load i8, ptr %21, align 1, !tbaa !5
  switch i8 %22, label %17 [
    i8 34, label %.critedge
    i8 39, label %.critedge
  ]

.critedge:                                        ; preds = %20, %20, %17, %.lr.ph53
  %.2 = phi i64 [ %.052, %.lr.ph53 ], [ %18, %20 ], [ %18, %20 ], [ %umax, %17 ]
  %23 = sub i64 %12, %.2
  %24 = icmp ult i64 %23, %spec.select
  br i1 %24, label %.critedge._crit_edge, label %25

25:                                               ; preds = %.critedge
  %26 = getelementptr inbounds i8, ptr %1, i64 %.2
  %27 = tail call i32 @strncmp(ptr noundef %26, ptr noundef nonnull %0, i64 noundef %spec.select) #5
  %.not48 = icmp eq i32 %27, 0
  %28 = icmp ult i64 %.2, %12
  %or.cond = and i1 %.not48, %28
  br i1 %or.cond, label %.lr.ph, label %.critedge2

.lr.ph:                                           ; preds = %25, %32
  %.349 = phi i64 [ %33, %32 ], [ %.2, %25 ]
  %29 = getelementptr inbounds i8, ptr %1, i64 %.349
  %30 = load i8, ptr %29, align 1, !tbaa !5
  %31 = tail call noundef zeroext i1 @_ZN6Assimp9IsLineEndIcEEbT_(i8 noundef signext %30)
  br i1 %31, label %.critedge2, label %32

32:                                               ; preds = %.lr.ph
  %33 = add i64 %.349, 1
  store i8 %2, ptr %29, align 1, !tbaa !5
  %exitcond.not = icmp eq i64 %33, %12
  br i1 %exitcond.not, label %.critedge2, label %.lr.ph, !llvm.loop !8

.critedge2:                                       ; preds = %.lr.ph, %32, %25
  %.4 = phi i64 [ %.2, %25 ], [ %.349, %.lr.ph ], [ %12, %32 ]
  %34 = add i64 %.4, 1
  %35 = icmp ult i64 %34, %12
  br i1 %35, label %.lr.ph53, label %.critedge._crit_edge, !llvm.loop !10

.critedge._crit_edge:                             ; preds = %.critedge2, %.critedge, %10
  ret void
}

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Assimp9IsLineEndIcEEbT_(i8 noundef signext) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4

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 = { "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 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 #3 = { inlinehint 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass