; LLVM IR from AngoraFuzzer/Angora :: llvm_mode/dfsan_rt/dfsan/dfsan.ll_ (dfsan_set_label)

; 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

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

10:                                               ; preds = %23, %3
  %11 = load i64, ptr %6, align 8, !tbaa !11
  %12 = icmp ne i64 %11, 0
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %28

14:                                               ; preds = %10
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load ptr, ptr %7, align 8, !tbaa !9
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = icmp eq i32 %15, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %14
  br label %23

20:                                               ; preds = %14
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %21, ptr %22, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %20, %19
  %24 = load i64, ptr %6, align 8, !tbaa !11
  %25 = add i64 %24, -1
  store i64 %25, ptr %6, align 8, !tbaa !11
  %26 = load ptr, ptr %7, align 8, !tbaa !9
  %27 = getelementptr inbounds i32, ptr %26, i32 1
  store ptr %27, ptr %7, align 8, !tbaa !9
  br label %10, !llvm.loop !13

28:                                               ; preds = %13
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7__dfsan10shadow_forEPv(ptr noundef) #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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @__dfsan_set_label(i32 noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = tail call noundef ptr @_ZN7__dfsan10shadow_forEPv(ptr noundef %1)
  %.not9 = icmp eq i64 %2, 0
  br i1 %.not9, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %min.iters.check = icmp ult i64 %2, 8
  br i1 %min.iters.check, label %.lr.ph.preheader36, label %vector.ph

.lr.ph.preheader36:                               ; preds = %middle.block, %.lr.ph.preheader
  %.011.ph = phi ptr [ %4, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  %.0710.ph = phi i64 [ %2, %.lr.ph.preheader ], [ %ind.end12, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %2, -8
  %5 = shl i64 %n.vec, 2
  %ind.end = getelementptr i8, ptr %4, i64 %5
  %ind.end12 = and i64 %2, 7
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %pred.store.continue35, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue35 ]
  %offset.idx = shl i64 %index, 2
  %next.gep = getelementptr i8, ptr %4, i64 %offset.idx
  %6 = getelementptr i8, ptr %next.gep, i64 16
  %wide.load = load <4 x i32>, ptr %next.gep, align 4, !tbaa !5
  %wide.load21 = load <4 x i32>, ptr %6, align 4, !tbaa !5
  %7 = icmp ne <4 x i32> %wide.load, %broadcast.splat
  %8 = icmp ne <4 x i32> %wide.load21, %broadcast.splat
  %9 = extractelement <4 x i1> %7, i64 0
  br i1 %9, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body
  store i32 %0, ptr %next.gep, align 4, !tbaa !5
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body
  %10 = extractelement <4 x i1> %7, i64 1
  br i1 %10, label %pred.store.if22, label %pred.store.continue23

pred.store.if22:                                  ; preds = %pred.store.continue
  %11 = or disjoint i64 %offset.idx, 4
  %next.gep14 = getelementptr i8, ptr %4, i64 %11
  store i32 %0, ptr %next.gep14, align 4, !tbaa !5
  br label %pred.store.continue23

pred.store.continue23:                            ; preds = %pred.store.if22, %pred.store.continue
  %12 = extractelement <4 x i1> %7, i64 2
  br i1 %12, label %pred.store.if24, label %pred.store.continue25

pred.store.if24:                                  ; preds = %pred.store.continue23
  %13 = or disjoint i64 %offset.idx, 8
  %next.gep15 = getelementptr i8, ptr %4, i64 %13
  store i32 %0, ptr %next.gep15, align 4, !tbaa !5
  br label %pred.store.continue25

pred.store.continue25:                            ; preds = %pred.store.if24, %pred.store.continue23
  %14 = extractelement <4 x i1> %7, i64 3
  br i1 %14, label %pred.store.if26, label %pred.store.continue27

pred.store.if26:                                  ; preds = %pred.store.continue25
  %15 = or disjoint i64 %offset.idx, 12
  %next.gep16 = getelementptr i8, ptr %4, i64 %15
  store i32 %0, ptr %next.gep16, align 4, !tbaa !5
  br label %pred.store.continue27

pred.store.continue27:                            ; preds = %pred.store.if26, %pred.store.continue25
  %16 = extractelement <4 x i1> %8, i64 0
  br i1 %16, label %pred.store.if28, label %pred.store.continue29

pred.store.if28:                                  ; preds = %pred.store.continue27
  %17 = or disjoint i64 %offset.idx, 16
  %next.gep17 = getelementptr i8, ptr %4, i64 %17
  store i32 %0, ptr %next.gep17, align 4, !tbaa !5
  br label %pred.store.continue29

pred.store.continue29:                            ; preds = %pred.store.if28, %pred.store.continue27
  %18 = extractelement <4 x i1> %8, i64 1
  br i1 %18, label %pred.store.if30, label %pred.store.continue31

pred.store.if30:                                  ; preds = %pred.store.continue29
  %19 = or disjoint i64 %offset.idx, 20
  %next.gep18 = getelementptr i8, ptr %4, i64 %19
  store i32 %0, ptr %next.gep18, align 4, !tbaa !5
  br label %pred.store.continue31

pred.store.continue31:                            ; preds = %pred.store.if30, %pred.store.continue29
  %20 = extractelement <4 x i1> %8, i64 2
  br i1 %20, label %pred.store.if32, label %pred.store.continue33

pred.store.if32:                                  ; preds = %pred.store.continue31
  %21 = or disjoint i64 %offset.idx, 24
  %next.gep19 = getelementptr i8, ptr %4, i64 %21
  store i32 %0, ptr %next.gep19, align 4, !tbaa !5
  br label %pred.store.continue33

pred.store.continue33:                            ; preds = %pred.store.if32, %pred.store.continue31
  %22 = extractelement <4 x i1> %8, i64 3
  br i1 %22, label %pred.store.if34, label %pred.store.continue35

pred.store.if34:                                  ; preds = %pred.store.continue33
  %23 = or disjoint i64 %offset.idx, 28
  %next.gep20 = getelementptr i8, ptr %4, i64 %23
  store i32 %0, ptr %next.gep20, align 4, !tbaa !5
  br label %pred.store.continue35

pred.store.continue35:                            ; preds = %pred.store.if34, %pred.store.continue33
  %index.next = add nuw i64 %index, 8
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %pred.store.continue35
  %cmp.n = icmp eq i64 %n.vec, %2
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader36

._crit_edge:                                      ; preds = %28, %middle.block, %3
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader36, %28
  %.011 = phi ptr [ %30, %28 ], [ %.011.ph, %.lr.ph.preheader36 ]
  %.0710 = phi i64 [ %29, %28 ], [ %.0710.ph, %.lr.ph.preheader36 ]
  %25 = load i32, ptr %.011, align 4, !tbaa !5
  %26 = icmp eq i32 %25, %0
  br i1 %26, label %28, label %27

27:                                               ; preds = %.lr.ph
  store i32 %0, ptr %.011, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %.lr.ph, %27
  %29 = add i64 %.0710, -1
  %30 = getelementptr inbounds i8, ptr %.011, i64 4
  %.not = icmp eq i64 %29, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13
}

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

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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass