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

; 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.9" = type { i32, i32 }

; 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: inlinehint mustprogress nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #1

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @_Z11parse_dellyPc(ptr noundef %0) #3 {
  %2 = alloca %"struct.std::pair.9", align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %2)
  %6 = getelementptr inbounds %"struct.std::pair.9", ptr %2, i32 0, i32 0
  store i32 0, ptr %6, align 4, !tbaa !9
  %7 = getelementptr inbounds %"struct.std::pair.9", ptr %2, i32 0, i32 1
  store i32 0, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !13
  br label %8

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

15:                                               ; preds = %8
  %16 = load i64, ptr %4, align 8, !tbaa !13
  %17 = add i64 %16, 1
  store i64 %17, ptr %4, align 8, !tbaa !13
  br label %8, !llvm.loop !16

18:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !18
  br label %19

19:                                               ; preds = %89, %18
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = load i64, ptr %4, align 8, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %20, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !15
  %24 = sext i8 %23 to i32
  %25 = icmp ne i32 %24, 10
  br i1 %25, label %26, label %33

26:                                               ; preds = %19
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load i64, ptr %4, align 8, !tbaa !13
  %29 = getelementptr inbounds i8, ptr %27, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !15
  %31 = sext i8 %30 to i32
  %32 = icmp ne i32 %31, 0
  br label %33

33:                                               ; preds = %26, %19
  %34 = phi i1 [ false, %19 ], [ %32, %26 ]
  br i1 %34, label %35, label %92

35:                                               ; preds = %33
  %36 = load i32, ptr %5, align 4, !tbaa !18
  %37 = icmp eq i32 %36, 8
  br i1 %37, label %41, label %38

38:                                               ; preds = %35
  %39 = load i32, ptr %5, align 4, !tbaa !18
  %40 = icmp eq i32 %39, 9
  br i1 %40, label %41, label %57

41:                                               ; preds = %38, %35
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load i64, ptr %4, align 8, !tbaa !13
  %44 = sub i64 %43, 1
  %45 = getelementptr inbounds i8, ptr %42, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !15
  %47 = sext i8 %46 to i32
  %48 = icmp eq i32 %47, 58
  br i1 %48, label %49, label %57

49:                                               ; preds = %41
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load i64, ptr %4, align 8, !tbaa !13
  %52 = getelementptr inbounds i8, ptr %50, i64 %51
  %53 = call i32 @atoi(ptr noundef %52) #5
  %54 = getelementptr inbounds %"struct.std::pair.9", ptr %2, i32 0, i32 0
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = add nsw i32 %55, %53
  store i32 %56, ptr %54, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %49, %41, %38
  %58 = load i32, ptr %5, align 4, !tbaa !18
  %59 = icmp eq i32 %58, 10
  br i1 %59, label %63, label %60

60:                                               ; preds = %57
  %61 = load i32, ptr %5, align 4, !tbaa !18
  %62 = icmp eq i32 %61, 11
  br i1 %62, label %63, label %79

63:                                               ; preds = %60, %57
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = load i64, ptr %4, align 8, !tbaa !13
  %66 = sub i64 %65, 1
  %67 = getelementptr inbounds i8, ptr %64, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !15
  %69 = sext i8 %68 to i32
  %70 = icmp eq i32 %69, 58
  br i1 %70, label %71, label %79

71:                                               ; preds = %63
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = load i64, ptr %4, align 8, !tbaa !13
  %74 = getelementptr inbounds i8, ptr %72, i64 %73
  %75 = call i32 @atoi(ptr noundef %74) #5
  %76 = getelementptr inbounds %"struct.std::pair.9", ptr %2, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !12
  %78 = add nsw i32 %77, %75
  store i32 %78, ptr %76, align 4, !tbaa !12
  br label %79

79:                                               ; preds = %71, %63, %60
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = load i64, ptr %4, align 8, !tbaa !13
  %82 = getelementptr inbounds i8, ptr %80, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !15
  %84 = sext i8 %83 to i32
  %85 = icmp eq i32 %84, 58
  br i1 %85, label %86, label %89

86:                                               ; preds = %79
  %87 = load i32, ptr %5, align 4, !tbaa !18
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %5, align 4, !tbaa !18
  br label %89

89:                                               ; preds = %86, %79
  %90 = load i64, ptr %4, align 8, !tbaa !13
  %91 = add i64 %90, 1
  store i64 %91, ptr %4, align 8, !tbaa !13
  br label %19, !llvm.loop !19

92:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %93 = load i64, ptr %2, align 4
  ret i64 %93
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress nounwind willreturn memory(read) 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 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 = { 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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 0}
!10 = !{!"_ZTSSt4pairIiiE", !11, i64 0, !11, i64 4}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!11, !11, i64 0}
!19 = distinct !{!19, !17}


; 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.9" = type { i32, i32 }

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local i64 @_Z11parse_dellyPc(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = alloca %"struct.std::pair.9", align 8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %2)
  store i32 0, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 4
  store i32 0, ptr %3, align 4, !tbaa !10
  br label %4

4:                                                ; preds = %4, %1
  %.025 = phi i64 [ 0, %1 ], [ %7, %4 ]
  %5 = getelementptr inbounds i8, ptr %0, i64 %.025
  %6 = load i8, ptr %5, align 1, !tbaa !11
  %.not = icmp eq i8 %6, 9
  %7 = add i64 %.025, 1
  br i1 %.not, label %.preheader, label %4, !llvm.loop !12

.preheader:                                       ; preds = %4, %.thread
  %8 = phi i8 [ %.pre, %.thread ], [ 9, %4 ]
  %9 = phi i32 [ %28, %.thread ], [ 0, %4 ]
  %10 = phi i32 [ %29, %.thread ], [ 0, %4 ]
  %.126 = phi i64 [ %32, %.thread ], [ %.025, %4 ]
  %.0 = phi i32 [ %spec.select, %.thread ], [ 0, %4 ]
  %11 = getelementptr inbounds i8, ptr %0, i64 %.126
  switch i8 %8, label %12 [
    i8 10, label %.critedge
    i8 0, label %.critedge
  ]

12:                                               ; preds = %.preheader
  %13 = and i32 %.0, 2147483646
  switch i32 %13, label %.thread [
    i32 8, label %14
    i32 10, label %21
  ]

14:                                               ; preds = %12
  %15 = getelementptr i8, ptr %11, i64 -1
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = icmp eq i8 %16, 58
  br i1 %17, label %18, label %.thread

18:                                               ; preds = %14
  %19 = call i32 @atoi(ptr nocapture noundef %11) #2
  %20 = add nsw i32 %9, %19
  store i32 %20, ptr %2, align 8, !tbaa !5
  br label %.thread

21:                                               ; preds = %12
  %22 = getelementptr i8, ptr %11, i64 -1
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = icmp eq i8 %23, 58
  br i1 %24, label %25, label %.thread

25:                                               ; preds = %21
  %26 = call i32 @atoi(ptr nocapture noundef %11) #2
  %27 = add nsw i32 %10, %26
  store i32 %27, ptr %3, align 4, !tbaa !10
  br label %.thread

.thread:                                          ; preds = %12, %14, %18, %25, %21
  %28 = phi i32 [ %9, %12 ], [ %9, %14 ], [ %20, %18 ], [ %9, %25 ], [ %9, %21 ]
  %29 = phi i32 [ %10, %12 ], [ %10, %14 ], [ %10, %18 ], [ %27, %25 ], [ %10, %21 ]
  %30 = icmp eq i8 %8, 58
  %31 = zext i1 %30 to i32
  %spec.select = add nuw nsw i32 %.0, %31
  %32 = add i64 %.126, 1
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 %32
  %.pre = load i8, ptr %.phi.trans.insert, align 1, !tbaa !11
  br label %.preheader, !llvm.loop !14

.critedge:                                        ; preds = %.preheader, %.preheader
  %33 = load i64, ptr %2, align 8
  ret i64 %33
}

attributes #0 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { 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 = { nounwind willreturn memory(read) }

!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 0}
!6 = !{!"_ZTSSt4pairIiiE", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!8, !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass