; LLVM IR from fritzsedlazeck/SURVIVOR :: src/vcfs/Merge_VCF.ll (Z19parse_strands_lumpyPc)

; 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.std::pair" = type { i8, i8 }

; 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 nounwind uwtable
declare dso_local void @_ZNSt4pairIbbEC2IbbTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 1 dereferenceable(2)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local i16 @_Z19parse_strands_lumpyPc(ptr noundef %0) #2 {
  %2 = alloca %"struct.std::pair", align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @_ZNSt4pairIbbEC2IbbTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 1 dereferenceable(2) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 1, ptr %5, align 1, !tbaa !11
  br label %6

6:                                                ; preds = %44, %1
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %7, i64 %8
  %10 = load i8, ptr %9, align 1, !tbaa !13
  %11 = sext i8 %10 to i32
  %12 = icmp ne i32 %11, 9
  br i1 %12, label %13, label %47

13:                                               ; preds = %6
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load i64, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %14, i64 %15
  %17 = load i8, ptr %16, align 1, !tbaa !13
  %18 = sext i8 %17 to i32
  %19 = icmp eq i32 %18, 91
  br i1 %19, label %20, label %28

20:                                               ; preds = %13
  %21 = load i8, ptr %5, align 1, !tbaa !11, !range !14, !noundef !15
  %22 = trunc i8 %21 to i1
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 0
  store i8 0, ptr %24, align 1, !tbaa !16
  store i8 0, ptr %5, align 1, !tbaa !11
  br label %27

25:                                               ; preds = %20
  %26 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 1
  store i8 0, ptr %26, align 1, !tbaa !18
  br label %27

27:                                               ; preds = %25, %23
  br label %44

28:                                               ; preds = %13
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = load i64, ptr %4, align 8, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %29, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !13
  %33 = sext i8 %32 to i32
  %34 = icmp eq i32 %33, 93
  br i1 %34, label %35, label %43

35:                                               ; preds = %28
  %36 = load i8, ptr %5, align 1, !tbaa !11, !range !14, !noundef !15
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %40

38:                                               ; preds = %35
  %39 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 0
  store i8 1, ptr %39, align 1, !tbaa !16
  store i8 0, ptr %5, align 1, !tbaa !11
  br label %42

40:                                               ; preds = %35
  %41 = getelementptr inbounds %"struct.std::pair", ptr %2, i32 0, i32 1
  store i8 1, ptr %41, align 1, !tbaa !18
  br label %42

42:                                               ; preds = %40, %38
  br label %43

43:                                               ; preds = %42, %28
  br label %44

44:                                               ; preds = %43, %27
  %45 = load i64, ptr %4, align 8, !tbaa !9
  %46 = add i64 %45, 1
  store i64 %46, ptr %4, align 8, !tbaa !9
  br label %6, !llvm.loop !19

47:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %48 = load i16, ptr %2, align 1
  ret i16 %48
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !12, i64 0}
!17 = !{!"_ZTSSt4pairIbbE", !12, i64 0, !12, i64 1}
!18 = !{!17, !12, i64 1}
!19 = distinct !{!19, !20}
!20 = !{!"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"

%"struct.std::pair" = type { i8, i8 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIbbEC2IbbTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 1 dereferenceable(2)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local i16 @_Z19parse_strands_lumpyPc(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca %"struct.std::pair", align 2
  call void @_ZNSt4pairIbbEC2IbbTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 1 dereferenceable(2) %2)
  %3 = getelementptr inbounds i8, ptr %2, i64 1
  br label %4

4:                                                ; preds = %15, %1
  %.08 = phi i64 [ 0, %1 ], [ %16, %15 ]
  %.0 = phi i8 [ 1, %1 ], [ %.1, %15 ]
  %5 = getelementptr inbounds i8, ptr %0, i64 %.08
  %6 = load i8, ptr %5, align 1, !tbaa !5
  switch i8 %6, label %15 [
    i8 9, label %17
    i8 91, label %7
    i8 93, label %11
  ]

7:                                                ; preds = %4
  %8 = trunc nuw i8 %.0 to i1
  br i1 %8, label %9, label %10

9:                                                ; preds = %7
  store i8 0, ptr %2, align 2, !tbaa !8
  br label %15

10:                                               ; preds = %7
  store i8 0, ptr %3, align 1, !tbaa !11
  br label %15

11:                                               ; preds = %4
  %12 = trunc nuw i8 %.0 to i1
  br i1 %12, label %13, label %14

13:                                               ; preds = %11
  store i8 1, ptr %2, align 2, !tbaa !8
  br label %15

14:                                               ; preds = %11
  store i8 1, ptr %3, align 1, !tbaa !11
  br label %15

15:                                               ; preds = %4, %14, %13, %9, %10
  %.1 = phi i8 [ 0, %9 ], [ %.0, %10 ], [ 0, %13 ], [ %.0, %14 ], [ %.0, %4 ]
  %16 = add i64 %.08, 1
  br label %4, !llvm.loop !12

17:                                               ; preds = %4
  %18 = load i16, ptr %2, align 2
  ret i16 %18
}

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

!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 = !{!9, !10, i64 0}
!9 = !{!"_ZTSSt4pairIbbE", !10, i64 0, !10, i64 1}
!10 = !{!"bool", !6, i64 0}
!11 = !{!9, !10, i64 1}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass