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

; 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.__sanitizer::InternalScopedString" = type { %"class.__sanitizer::InternalScopedBuffer", i64 }
%"class.__sanitizer::InternalScopedBuffer" = type { ptr, i64 }

@.str.10 = external hidden unnamed_addr constant [3 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

declare i32 @__gxx_personality_v0(...)

; 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 void @_ZN11__sanitizer13WriteToSyslogEPKc(ptr noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.__sanitizer::InternalScopedString", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #4
  call void @_ZN11__sanitizer20InternalScopedStringC2Em(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 65536)
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  invoke void (ptr, ptr, ...) @_ZN11__sanitizer20InternalScopedString6appendEPKcz(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef @.str.10, ptr noundef %8)
          to label %9 unwind label %20

9:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %10 = invoke noundef ptr @_ZN11__sanitizer20InternalScopedBufferIcE4dataEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %11 unwind label %24

11:                                               ; preds = %9
  store ptr %10, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  br label %12

12:                                               ; preds = %41, %11
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = invoke noundef ptr @_ZN11__sanitizer15internal_strchrEPKci(ptr noundef %13, i32 noundef 10)
          to label %15 unwind label %28

15:                                               ; preds = %12
  store ptr %14, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %32

18:                                               ; preds = %15
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 0, ptr %19, align 1, !tbaa !9
  br label %32

20:                                               ; preds = %1
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %4, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %5, align 4
  br label %46

24:                                               ; preds = %9
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %4, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %5, align 4
  br label %45

28:                                               ; preds = %32, %12
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %4, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %45

32:                                               ; preds = %18, %15
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN11__sanitizer20WriteOneLineToSyslogEPKc(ptr noundef %33)
          to label %34 unwind label %28

34:                                               ; preds = %32
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  store ptr %39, ptr %6, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %37, %34
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %12, label %44, !llvm.loop !10

44:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @_ZN11__sanitizer20InternalScopedBufferIcED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #4
  ret void

45:                                               ; preds = %28, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %46

46:                                               ; preds = %45, %20
  call void @_ZN11__sanitizer20InternalScopedBufferIcED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #4
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %4, align 8
  %49 = load i32, ptr %5, align 4
  %50 = insertvalue { ptr, i32 } poison, ptr %48, 0
  %51 = insertvalue { ptr, i32 } %50, i32 %49, 1
  resume { ptr, i32 } %51
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer20InternalScopedStringC2Em(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) unnamed_addr #1 align 2

declare void @_ZN11__sanitizer20InternalScopedString6appendEPKcz(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11__sanitizer20InternalScopedBufferIcE4dataEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

declare noundef ptr @_ZN11__sanitizer15internal_strchrEPKci(ptr noundef, i32 noundef) #2

declare void @_ZN11__sanitizer20WriteOneLineToSyslogEPKc(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11__sanitizer20InternalScopedBufferIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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


; 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.__sanitizer::InternalScopedString" = type { %"class.__sanitizer::InternalScopedBuffer", i64 }
%"class.__sanitizer::InternalScopedBuffer" = type { ptr, i64 }

@.str.10 = external hidden unnamed_addr constant [3 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

declare i32 @__gxx_personality_v0(...)

; 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 void @_ZN11__sanitizer13WriteToSyslogEPKc(ptr noundef %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.__sanitizer::InternalScopedString", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #4
  call void @_ZN11__sanitizer20InternalScopedStringC2Em(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 65536)
  invoke void (ptr, ptr, ...) @_ZN11__sanitizer20InternalScopedString6appendEPKcz(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull @.str.10, ptr noundef %0)
          to label %3 unwind label %9

3:                                                ; preds = %1
  %4 = call noundef ptr @_ZN11__sanitizer20InternalScopedBufferIcE4dataEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  br label %5

5:                                                ; preds = %14, %3
  %.09 = phi ptr [ %4, %3 ], [ %15, %14 ]
  %6 = invoke noundef ptr @_ZN11__sanitizer15internal_strchrEPKci(ptr noundef %.09, i32 noundef 10)
          to label %7 unwind label %11

7:                                                ; preds = %5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %13, label %8

8:                                                ; preds = %7
  store i8 0, ptr %6, align 1, !tbaa !5
  br label %13

9:                                                ; preds = %1
  %10 = landingpad { ptr, i32 }
          cleanup
  br label %17

11:                                               ; preds = %13, %5
  %12 = landingpad { ptr, i32 }
          cleanup
  br label %17

13:                                               ; preds = %8, %7
  invoke void @_ZN11__sanitizer20WriteOneLineToSyslogEPKc(ptr noundef %.09)
          to label %14 unwind label %11

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %6, i64 1
  br i1 %.not, label %16, label %5, !llvm.loop !8

16:                                               ; preds = %14
  call void @_ZN11__sanitizer20InternalScopedBufferIcED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #4
  ret void

17:                                               ; preds = %11, %9
  %.pn = phi { ptr, i32 } [ %12, %11 ], [ %10, %9 ]
  call void @_ZN11__sanitizer20InternalScopedBufferIcED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer20InternalScopedStringC2Em(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) unnamed_addr #1 align 2

declare void @_ZN11__sanitizer20InternalScopedString6appendEPKcz(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11__sanitizer20InternalScopedBufferIcE4dataEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

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

declare void @_ZN11__sanitizer20WriteOneLineToSyslogEPKc(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11__sanitizer20InternalScopedBufferIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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