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

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

; 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

declare noundef i64 @_ZN11__sanitizer15internal_strlenEPKc(ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11__sanitizer13LibraryNameIsEPKcS1_(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %9, ptr %6, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %15, %2
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = sext i8 %12 to i32
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %18

15:                                               ; preds = %10
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i32 1
  store ptr %17, ptr %6, align 8, !tbaa !5
  br label %10, !llvm.loop !10

18:                                               ; preds = %10
  br label %19

19:                                               ; preds = %30, %18
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp ugt ptr %20, %21
  br i1 %22, label %23, label %28

23:                                               ; preds = %19
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = sext i8 %25 to i32
  %27 = icmp ne i32 %26, 47
  br label %28

28:                                               ; preds = %23, %19
  %29 = phi i1 [ false, %19 ], [ %27, %23 ]
  br i1 %29, label %30, label %33

30:                                               ; preds = %28
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i32 -1
  store ptr %32, ptr %6, align 8, !tbaa !5
  br label %19, !llvm.loop !12

33:                                               ; preds = %28
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = sext i8 %35 to i32
  %37 = icmp eq i32 %36, 47
  br i1 %37, label %38, label %41

38:                                               ; preds = %33
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i32 1
  store ptr %40, ptr %6, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %38, %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = call noundef i64 @_ZN11__sanitizer15internal_strlenEPKc(ptr noundef %42)
  store i64 %43, ptr %7, align 8, !tbaa !13
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = load i64, ptr %7, align 8, !tbaa !13
  %47 = call noundef i32 @_ZN11__sanitizer16internal_strncmpEPKcS1_m(ptr noundef %44, ptr noundef %45, i64 noundef %46)
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %41
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %66

50:                                               ; preds = %41
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = load i64, ptr %7, align 8, !tbaa !13
  %53 = getelementptr inbounds i8, ptr %51, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !9
  %55 = sext i8 %54 to i32
  %56 = icmp eq i32 %55, 45
  br i1 %56, label %64, label %57

57:                                               ; preds = %50
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load i64, ptr %7, align 8, !tbaa !13
  %60 = getelementptr inbounds i8, ptr %58, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !9
  %62 = sext i8 %61 to i32
  %63 = icmp eq i32 %62, 46
  br label %64

64:                                               ; preds = %57, %50
  %65 = phi i1 [ true, %50 ], [ %63, %57 ]
  store i1 %65, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %66

66:                                               ; preds = %64, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %67 = load i1, ptr %3, align 1
  ret i1 %67
}

declare noundef i32 @_ZN11__sanitizer16internal_strncmpEPKcS1_m(ptr noundef, ptr noundef, i64 noundef) #1

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

declare noundef i64 @_ZN11__sanitizer15internal_strlenEPKc(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11__sanitizer13LibraryNameIsEPKcS1_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  br label %3

3:                                                ; preds = %3, %2
  %.017 = phi ptr [ %0, %2 ], [ %5, %3 ]
  %4 = load i8, ptr %.017, align 1, !tbaa !5
  %.not = icmp eq i8 %4, 0
  %5 = getelementptr inbounds i8, ptr %.017, i64 1
  br i1 %.not, label %.preheader, label %3, !llvm.loop !8

.preheader:                                       ; preds = %3
  %6 = icmp ugt ptr %.017, %0
  br i1 %6, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader, %8
  %.122 = phi ptr [ %9, %8 ], [ %.017, %.preheader ]
  %7 = load i8, ptr %.122, align 1, !tbaa !5
  %.not19 = icmp eq i8 %7, 47
  br i1 %.not19, label %.critedge, label %8

8:                                                ; preds = %.lr.ph
  %9 = getelementptr inbounds i8, ptr %.122, i64 -1
  %10 = icmp ugt ptr %9, %0
  br i1 %10, label %.lr.ph, label %..critedge.loopexit_crit_edge, !llvm.loop !10

..critedge.loopexit_crit_edge:                    ; preds = %8
  %.pre.pre = load i8, ptr %0, align 1, !tbaa !5
  %11 = icmp eq i8 %.pre.pre, 47
  %12 = zext i1 %11 to i64
  br label %.critedge

.critedge:                                        ; preds = %.lr.ph, %..critedge.loopexit_crit_edge, %.preheader
  %spec.select.idx = phi i64 [ 0, %.preheader ], [ %12, %..critedge.loopexit_crit_edge ], [ 1, %.lr.ph ]
  %.1.lcssa = phi ptr [ %.017, %.preheader ], [ %0, %..critedge.loopexit_crit_edge ], [ %.122, %.lr.ph ]
  %spec.select = getelementptr inbounds i8, ptr %.1.lcssa, i64 %spec.select.idx
  %13 = tail call noundef i64 @_ZN11__sanitizer15internal_strlenEPKc(ptr noundef %1)
  %14 = tail call noundef i32 @_ZN11__sanitizer16internal_strncmpEPKcS1_m(ptr noundef nonnull %spec.select, ptr noundef %1, i64 noundef %13)
  %.not20 = icmp eq i32 %14, 0
  br i1 %.not20, label %15, label %19

15:                                               ; preds = %.critedge
  %16 = getelementptr inbounds i8, ptr %spec.select, i64 %13
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = add i8 %17, -45
  %spec.select21 = icmp ult i8 %18, 2
  br label %19

19:                                               ; preds = %.critedge, %15
  %.0 = phi i1 [ %spec.select21, %15 ], [ false, %.critedge ]
  ret i1 %.0
}

declare noundef i32 @_ZN11__sanitizer16internal_strncmpEPKcS1_m(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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

!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: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass