; LLVM IR from AngoraFuzzer/Angora :: llvm_mode/dfsan_rt/sanitizer_common/sanitizer_termination.ll/ZN11 (sanitizer3DieEv)

; 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::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 }

@_ZN11__sanitizerL20InternalDieCallbacksE = external hidden global [5 x ptr], align 16
@_ZN11__sanitizerL15UserDieCallbackE = external hidden global ptr, align 8

; 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: mustprogress noreturn uwtable
define dso_local void @_ZN11__sanitizer3DieEv() #1 {
  %1 = alloca i32, align 4
  %2 = load ptr, ptr @_ZN11__sanitizerL15UserDieCallbackE, align 8, !tbaa !5
  %3 = icmp ne ptr %2, null
  br i1 %3, label %4, label %6

4:                                                ; preds = %0
  %5 = load ptr, ptr @_ZN11__sanitizerL15UserDieCallbackE, align 8, !tbaa !5
  call void %5()
  br label %6

6:                                                ; preds = %4, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 4, ptr %1, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %23, %6
  %8 = load i32, ptr %1, align 4, !tbaa !9
  %9 = icmp sge i32 %8, 0
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  br label %26

11:                                               ; preds = %7
  %12 = load i32, ptr %1, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [5 x ptr], ptr @_ZN11__sanitizerL20InternalDieCallbacksE, i64 0, i64 %13
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %22

17:                                               ; preds = %11
  %18 = load i32, ptr %1, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [5 x ptr], ptr @_ZN11__sanitizerL20InternalDieCallbacksE, i64 0, i64 %19
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  call void %21()
  br label %22

22:                                               ; preds = %17, %11
  br label %23

23:                                               ; preds = %22
  %24 = load i32, ptr %1, align 4, !tbaa !9
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %1, align 4, !tbaa !9
  br label %7, !llvm.loop !11

26:                                               ; preds = %10
  %27 = call noundef ptr @_ZN11__sanitizer12common_flagsEv()
  %28 = getelementptr inbounds %"struct.__sanitizer::CommonFlags", ptr %27, i32 0, i32 66
  %29 = load i8, ptr %28, align 4, !tbaa !13, !range !17, !noundef !18
  %30 = trunc i8 %29 to i1
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  call void @_ZN11__sanitizer5AbortEv() #5
  unreachable

32:                                               ; preds = %26
  %33 = call noundef ptr @_ZN11__sanitizer12common_flagsEv()
  %34 = getelementptr inbounds %"struct.__sanitizer::CommonFlags", ptr %33, i32 0, i32 65
  %35 = load i32, ptr %34, align 8, !tbaa !19
  call void @_ZN11__sanitizer14internal__exitEi(i32 noundef %35) #5
  unreachable
}

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

; Function Attrs: noreturn
declare void @_ZN11__sanitizer5AbortEv() #3

; Function Attrs: noreturn
declare void @_ZN11__sanitizer14internal__exitEi(i32 noundef) #3

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


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

@_ZN11__sanitizerL20InternalDieCallbacksE = external hidden local_unnamed_addr global [5 x ptr], align 16
@_ZN11__sanitizerL15UserDieCallbackE = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress noreturn uwtable
define dso_local void @_ZN11__sanitizer3DieEv() local_unnamed_addr #0 {
  %1 = load ptr, ptr @_ZN11__sanitizerL15UserDieCallbackE, align 8, !tbaa !5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %3, label %2

2:                                                ; preds = %0
  tail call void %1()
  br label %3

3:                                                ; preds = %2, %0
  %4 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN11__sanitizerL20InternalDieCallbacksE, i64 32), align 16, !tbaa !5
  %.not6 = icmp eq ptr %4, null
  br i1 %.not6, label %6, label %5

5:                                                ; preds = %3
  tail call void %4()
  br label %6

6:                                                ; preds = %3, %5
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN11__sanitizerL20InternalDieCallbacksE, i64 24), align 8, !tbaa !5
  %.not6.1 = icmp eq ptr %7, null
  br i1 %.not6.1, label %9, label %8

8:                                                ; preds = %6
  tail call void %7()
  br label %9

9:                                                ; preds = %8, %6
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN11__sanitizerL20InternalDieCallbacksE, i64 16), align 16, !tbaa !5
  %.not6.2 = icmp eq ptr %10, null
  br i1 %.not6.2, label %12, label %11

11:                                               ; preds = %9
  tail call void %10()
  br label %12

12:                                               ; preds = %11, %9
  %13 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN11__sanitizerL20InternalDieCallbacksE, i64 8), align 8, !tbaa !5
  %.not6.3 = icmp eq ptr %13, null
  br i1 %.not6.3, label %15, label %14

14:                                               ; preds = %12
  tail call void %13()
  br label %15

15:                                               ; preds = %14, %12
  %16 = load ptr, ptr @_ZN11__sanitizerL20InternalDieCallbacksE, align 16, !tbaa !5
  %.not6.4 = icmp eq ptr %16, null
  br i1 %.not6.4, label %18, label %17

17:                                               ; preds = %15
  tail call void %16()
  br label %18

18:                                               ; preds = %17, %15
  %19 = tail call noundef ptr @_ZN11__sanitizer12common_flagsEv()
  %20 = getelementptr inbounds i8, ptr %19, i64 188
  %21 = load i8, ptr %20, align 4, !tbaa !9, !range !14, !noundef !15
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %23, label %24

23:                                               ; preds = %18
  tail call void @_ZN11__sanitizer5AbortEv() #3
  unreachable

24:                                               ; preds = %18
  %25 = tail call noundef ptr @_ZN11__sanitizer12common_flagsEv()
  %26 = getelementptr inbounds i8, ptr %25, i64 184
  %27 = load i32, ptr %26, align 8, !tbaa !16
  tail call void @_ZN11__sanitizer14internal__exitEi(i32 noundef %27) #3
  unreachable
}

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

; Function Attrs: noreturn
declare void @_ZN11__sanitizer5AbortEv() local_unnamed_addr #2

; Function Attrs: noreturn
declare void @_ZN11__sanitizer14internal__exitEi(i32 noundef) local_unnamed_addr #2

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


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