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

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

%"struct.__sanitizer::DTLS" = type { i64, ptr, i64, i64 }
%"struct.__sanitizer::CommonFlags" = type { i8, ptr, i8, ptr, i8, i8, i8, i8, i32, ptr, i8, i8, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i64, ptr, i8, i8, i8, i64, i64, i64, i8, i8, i8, i8, i8, i8, i8, i8, i8, ptr, i8, i8, i8, i8, i8, i8, i32, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i8, i8, i8, i8, ptr }

@.str = external hidden unnamed_addr constant [37 x i8], align 1
@_ZN11__sanitizerL4dtlsE = external hidden thread_local(initialexec) global %"struct.__sanitizer::DTLS", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer12DTLS_DestroyEv() #0 {
  %1 = alloca i64, align 8
  %2 = call noundef ptr @_ZN11__sanitizer12common_flagsEv()
  %3 = getelementptr inbounds %"struct.__sanitizer::CommonFlags", ptr %2, i32 0, i32 28
  %4 = load i8, ptr %3, align 1, !tbaa !5, !range !13, !noundef !14
  %5 = trunc i8 %4 to i1
  br i1 %5, label %7, label %6

6:                                                ; preds = %0
  br label %28

7:                                                ; preds = %0
  br label %8

8:                                                ; preds = %7
  %9 = call noundef i32 @_ZN11__sanitizer9VerbosityEv()
  %10 = sext i32 %9 to i64
  %11 = icmp uge i64 %10, 2
  br i1 %11, label %12, label %17

12:                                               ; preds = %8
  %13 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZN11__sanitizerL4dtlsE)
  %14 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZN11__sanitizerL4dtlsE)
  %15 = getelementptr inbounds %"struct.__sanitizer::DTLS", ptr %14, i32 0, i32 0
  %16 = load i64, ptr %15, align 8, !tbaa !15
  call void (ptr, ...) @_ZN11__sanitizer6PrintfEPKcz(ptr noundef @.str, ptr noundef %13, i64 noundef %16)
  br label %17

17:                                               ; preds = %12, %8
  br label %18

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  %19 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZN11__sanitizerL4dtlsE)
  %20 = getelementptr inbounds %"struct.__sanitizer::DTLS", ptr %19, i32 0, i32 0
  %21 = load i64, ptr %20, align 8, !tbaa !15
  store i64 %21, ptr %1, align 8, !tbaa !17
  %22 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZN11__sanitizerL4dtlsE)
  %23 = getelementptr inbounds %"struct.__sanitizer::DTLS", ptr %22, i32 0, i32 0
  store i64 -1, ptr %23, align 8, !tbaa !15
  %24 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZN11__sanitizerL4dtlsE)
  %25 = getelementptr inbounds %"struct.__sanitizer::DTLS", ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  %27 = load i64, ptr %1, align 8, !tbaa !17
  call void @_ZN11__sanitizerL15DTLS_DeallocateEPNS_4DTLS3DTVEm(ptr noundef %26, i64 noundef %27)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #6
  br label %28

28:                                               ; preds = %18, %6
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11__sanitizer12common_flagsEv() #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN11__sanitizer9VerbosityEv() #2

declare void @_ZN11__sanitizer6PrintfEPKcz(ptr noundef, ...) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #4

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

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

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

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 = { 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 #2 = { 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 #3 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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, !7, i64 89}
!6 = !{!"_ZTSN11__sanitizer11CommonFlagsE", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !11, i64 36, !10, i64 40, !7, i64 48, !7, i64 49, !11, i64 52, !7, i64 56, !7, i64 57, !7, i64 58, !7, i64 59, !7, i64 60, !7, i64 61, !7, i64 62, !7, i64 63, !7, i64 64, !7, i64 65, !7, i64 66, !7, i64 67, !12, i64 72, !10, i64 80, !7, i64 88, !7, i64 89, !7, i64 90, !12, i64 96, !12, i64 104, !12, i64 112, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123, !7, i64 124, !7, i64 125, !7, i64 126, !7, i64 127, !7, i64 128, !10, i64 136, !7, i64 144, !7, i64 145, !7, i64 146, !7, i64 147, !7, i64 148, !7, i64 149, !11, i64 152, !10, i64 160, !7, i64 168, !7, i64 169, !7, i64 170, !7, i64 171, !7, i64 172, !7, i64 173, !7, i64 174, !7, i64 175, !7, i64 176, !7, i64 177, !7, i64 178, !7, i64 179, !7, i64 180, !7, i64 181, !11, i64 184, !7, i64 188, !7, i64 189, !7, i64 190, !7, i64 191, !10, i64 192}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !12, i64 0}
!16 = !{!"_ZTSN11__sanitizer4DTLSE", !12, i64 0, !10, i64 8, !12, i64 16, !12, i64 24}
!17 = !{!12, !12, i64 0}
!18 = !{!16, !10, i64 8}


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

%"struct.__sanitizer::DTLS" = type { i64, ptr, i64, i64 }

@.str = external hidden unnamed_addr constant [37 x i8], align 1
@_ZN11__sanitizerL4dtlsE = external hidden thread_local(initialexec) global %"struct.__sanitizer::DTLS", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer12DTLS_DestroyEv() local_unnamed_addr #0 {
  %1 = tail call noundef ptr @_ZN11__sanitizer12common_flagsEv()
  %2 = getelementptr inbounds i8, ptr %1, i64 89
  %3 = load i8, ptr %2, align 1, !tbaa !5, !range !13, !noundef !14
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %5, label %14

5:                                                ; preds = %0
  %6 = tail call noundef i32 @_ZN11__sanitizer9VerbosityEv()
  %7 = icmp ugt i32 %6, 1
  %8 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_ZN11__sanitizerL4dtlsE)
  br i1 %7, label %9, label %._crit_edge

9:                                                ; preds = %5
  %10 = load i64, ptr %8, align 8, !tbaa !15
  tail call void (ptr, ...) @_ZN11__sanitizer6PrintfEPKcz(ptr noundef nonnull @.str, ptr noundef nonnull %8, i64 noundef %10)
  br label %._crit_edge

._crit_edge:                                      ; preds = %5, %9
  %11 = load i64, ptr %8, align 8, !tbaa !15
  store i64 -1, ptr %8, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %8, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !17
  tail call void @_ZN11__sanitizerL15DTLS_DeallocateEPNS_4DTLS3DTVEm(ptr noundef %13, i64 noundef %11)
  br label %14

14:                                               ; preds = %0, %._crit_edge
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11__sanitizer12common_flagsEv() local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN11__sanitizer9VerbosityEv() local_unnamed_addr #2

declare void @_ZN11__sanitizer6PrintfEPKcz(ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN11__sanitizerL15DTLS_DeallocateEPNS_4DTLS3DTVEm(ptr noundef, i64 noundef) local_unnamed_addr #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 = { 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 #2 = { 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 #3 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 89}
!6 = !{!"_ZTSN11__sanitizer11CommonFlagsE", !7, i64 0, !10, i64 8, !7, i64 16, !10, i64 24, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !11, i64 36, !10, i64 40, !7, i64 48, !7, i64 49, !11, i64 52, !7, i64 56, !7, i64 57, !7, i64 58, !7, i64 59, !7, i64 60, !7, i64 61, !7, i64 62, !7, i64 63, !7, i64 64, !7, i64 65, !7, i64 66, !7, i64 67, !12, i64 72, !10, i64 80, !7, i64 88, !7, i64 89, !7, i64 90, !12, i64 96, !12, i64 104, !12, i64 112, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123, !7, i64 124, !7, i64 125, !7, i64 126, !7, i64 127, !7, i64 128, !10, i64 136, !7, i64 144, !7, i64 145, !7, i64 146, !7, i64 147, !7, i64 148, !7, i64 149, !11, i64 152, !10, i64 160, !7, i64 168, !7, i64 169, !7, i64 170, !7, i64 171, !7, i64 172, !7, i64 173, !7, i64 174, !7, i64 175, !7, i64 176, !7, i64 177, !7, i64 178, !7, i64 179, !7, i64 180, !7, i64 181, !11, i64 184, !7, i64 188, !7, i64 189, !7, i64 190, !7, i64 191, !10, i64 192}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !12, i64 0}
!16 = !{!"_ZTSN11__sanitizer4DTLSE", !12, i64 0, !10, i64 8, !12, i64 16, !12, i64 24}
!17 = !{!16, !10, i64 8}


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