; LLVM IR from AngoraFuzzer/Angora :: llvm_mode/dfsan_rt/sanitizer_common (sanitizer_common)

; 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.10 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [15 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: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #1

; Function Attrs: noreturn
declare void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer35RemoveANSIEscapeSequencesFromStringEPc(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %10, label %9

9:                                                ; preds = %1
  br label %75

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %11, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %12, ptr %4, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %68, %57, %10
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load i8, ptr %14, align 1, !tbaa !9
  %16 = sext i8 %15 to i32
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %73

18:                                               ; preds = %13
  br label %19

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = ptrtoint ptr %20 to i64
  store i64 %21, ptr %5, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = ptrtoint ptr %22 to i64
  store i64 %23, ptr %6, align 8, !tbaa !10
  %24 = load i64, ptr %5, align 8, !tbaa !10
  %25 = load i64, ptr %6, align 8, !tbaa !10
  %26 = icmp uge i64 %24, %25
  %27 = xor i1 %26, true
  %28 = xor i1 %27, true
  %29 = xor i1 %28, true
  %30 = zext i1 %29 to i64
  %31 = call i64 @llvm.expect.i64(i64 %30, i64 0)
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %33, label %36

33:                                               ; preds = %19
  %34 = load i64, ptr %5, align 8, !tbaa !10
  %35 = load i64, ptr %6, align 8, !tbaa !10
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str.10, i32 noundef 231, ptr noundef @.str.16, i64 noundef %34, i64 noundef %35) #6
  unreachable

36:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %41, 27
  br i1 %42, label %43, label %60

43:                                               ; preds = %38
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 1
  %46 = load i8, ptr %45, align 1, !tbaa !9
  %47 = sext i8 %46 to i32
  %48 = icmp eq i32 %47, 91
  br i1 %48, label %49, label %60

49:                                               ; preds = %43
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = call noundef ptr @_ZN11__sanitizer18internal_strchrnulEPKci(ptr noundef %50, i32 noundef 109)
  store ptr %51, ptr %3, align 8, !tbaa !5
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = load i8, ptr %52, align 1, !tbaa !9
  %54 = sext i8 %53 to i32
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %49
  br label %73

57:                                               ; preds = %49
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %58, i32 1
  store ptr %59, ptr %3, align 8, !tbaa !5
  br label %13, !llvm.loop !12

60:                                               ; preds = %43, %38
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = icmp ne ptr %61, %62
  br i1 %63, label %64, label %68

64:                                               ; preds = %60
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = load i8, ptr %65, align 1, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  store i8 %66, ptr %67, align 1, !tbaa !9
  br label %68

68:                                               ; preds = %64, %60
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %69, i32 1
  store ptr %70, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i32 1
  store ptr %72, ptr %3, align 8, !tbaa !5
  br label %13, !llvm.loop !12

73:                                               ; preds = %56, %13
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  store i8 0, ptr %74, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %75

75:                                               ; preds = %73, %9
  ret void
}

declare noundef ptr @_ZN11__sanitizer18internal_strchrnulEPKci(ptr noundef, i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { noreturn "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 = { "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 = { noreturn }

!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 long", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; 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.10 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: noreturn
declare void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer35RemoveANSIEscapeSequencesFromStringEPc(ptr noundef %0) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %27, label %.preheader

.preheader:                                       ; preds = %1
  %2 = load i8, ptr %0, align 1, !tbaa !5
  %.not243237 = icmp eq i8 %2, 0
  br i1 %.not243237, label %.outer._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.outer
  %3 = phi i8 [ %26, %.outer ], [ %2, %.preheader ]
  %.0.ph39 = phi ptr [ %25, %.outer ], [ %0, %.preheader ]
  %.021.ph38 = phi ptr [ %24, %.outer ], [ %0, %.preheader ]
  br label %7

4:                                                ; preds = %18
  %5 = getelementptr inbounds i8, ptr %19, i64 1
  %6 = load i8, ptr %5, align 1, !tbaa !5
  %.not24 = icmp eq i8 %6, 0
  br i1 %.not24, label %.outer._crit_edge, label %7, !llvm.loop !8

7:                                                ; preds = %.lr.ph, %4
  %8 = phi i8 [ %3, %.lr.ph ], [ %6, %4 ]
  %.033 = phi ptr [ %.0.ph39, %.lr.ph ], [ %5, %4 ]
  %.not25 = icmp ult ptr %.033, %.021.ph38
  br i1 %.not25, label %9, label %12, !prof !10

9:                                                ; preds = %7
  %10 = ptrtoint ptr %.021.ph38 to i64
  %11 = ptrtoint ptr %.033 to i64
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str.10, i32 noundef 231, ptr noundef nonnull @.str.16, i64 noundef %11, i64 noundef %10) #3
  unreachable

12:                                               ; preds = %7
  %13 = icmp eq i8 %8, 27
  br i1 %13, label %14, label %22

14:                                               ; preds = %12
  %15 = getelementptr inbounds i8, ptr %.033, i64 1
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = icmp eq i8 %16, 91
  br i1 %17, label %18, label %22

18:                                               ; preds = %14
  %19 = tail call noundef ptr @_ZN11__sanitizer18internal_strchrnulEPKci(ptr noundef nonnull %.033, i32 noundef 109)
  %20 = load i8, ptr %19, align 1, !tbaa !5
  %21 = icmp eq i8 %20, 0
  br i1 %21, label %.outer._crit_edge, label %4

22:                                               ; preds = %14, %12
  %.not26 = icmp eq ptr %.033, %.021.ph38
  br i1 %.not26, label %.outer, label %23

23:                                               ; preds = %22
  store i8 %8, ptr %.021.ph38, align 1, !tbaa !5
  br label %.outer

.outer:                                           ; preds = %23, %22
  %24 = getelementptr inbounds i8, ptr %.021.ph38, i64 1
  %25 = getelementptr inbounds i8, ptr %.033, i64 1
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %.not2432 = icmp eq i8 %26, 0
  br i1 %.not2432, label %.outer._crit_edge, label %.lr.ph, !llvm.loop !8

.outer._crit_edge:                                ; preds = %.outer, %4, %18, %.preheader
  %.021.ph.lcssa31 = phi ptr [ %0, %.preheader ], [ %.021.ph38, %18 ], [ %.021.ph38, %4 ], [ %24, %.outer ]
  store i8 0, ptr %.021.ph.lcssa31, align 1, !tbaa !5
  br label %27

27:                                               ; preds = %1, %.outer._crit_edge
  ret void
}

declare noundef ptr @_ZN11__sanitizer18internal_strchrnulEPKci(ptr noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { noreturn "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 = { 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 #2 = { "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 = { noreturn }

!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 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass