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

; 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.strcoordinate = type { i32, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9parse_posPc(ptr dead_on_unwind noalias writable sret(%struct.strcoordinate) align 8 %0, ptr noundef %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store i1 false, ptr %5, align 1
  call void @_ZN13strcoordinateC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #4
  %10 = getelementptr inbounds %struct.strcoordinate, ptr %0, i32 0, i32 1
  %11 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.1)
          to label %12 unwind label %53

12:                                               ; preds = %2
  %13 = getelementptr inbounds %struct.strcoordinate, ptr %0, i32 0, i32 0
  store i32 -1, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !16
  br label %14

14:                                               ; preds = %102, %12
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr %8, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %15, i64 %16
  %18 = load i8, ptr %17, align 1, !tbaa !17
  %19 = sext i8 %18 to i32
  %20 = icmp ne i32 %19, 9
  br i1 %20, label %21, label %105

21:                                               ; preds = %14
  %22 = load i32, ptr %9, align 4, !tbaa !16
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %61

24:                                               ; preds = %21
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i64, ptr %8, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %25, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !17
  %29 = sext i8 %28 to i32
  %30 = icmp ne i32 %29, 91
  br i1 %30, label %38, label %31

31:                                               ; preds = %24
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i64, ptr %8, align 8, !tbaa !15
  %34 = getelementptr inbounds i8, ptr %32, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !17
  %36 = sext i8 %35 to i32
  %37 = icmp ne i32 %36, 93
  br i1 %37, label %38, label %61

38:                                               ; preds = %31, %24
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load i64, ptr %8, align 8, !tbaa !15
  %41 = getelementptr inbounds i8, ptr %39, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !17
  %43 = sext i8 %42 to i32
  %44 = icmp ne i32 %43, 58
  br i1 %44, label %45, label %61

45:                                               ; preds = %38
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i64, ptr %8, align 8, !tbaa !15
  %48 = getelementptr inbounds i8, ptr %46, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !17
  %50 = getelementptr inbounds %struct.strcoordinate, ptr %0, i32 0, i32 1
  %51 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %50, i8 noundef signext %49)
          to label %52 unwind label %57

52:                                               ; preds = %45
  br label %61

53:                                               ; preds = %2
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %6, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %7, align 4
  br label %109

57:                                               ; preds = %45
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %6, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %109

61:                                               ; preds = %52, %38, %31, %21
  %62 = load i32, ptr %9, align 4, !tbaa !16
  %63 = icmp eq i32 %62, 2
  br i1 %63, label %64, label %78

64:                                               ; preds = %61
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i64, ptr %8, align 8, !tbaa !15
  %67 = sub i64 %66, 1
  %68 = getelementptr inbounds i8, ptr %65, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !17
  %70 = sext i8 %69 to i32
  %71 = icmp eq i32 %70, 58
  br i1 %71, label %72, label %78

72:                                               ; preds = %64
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = load i64, ptr %8, align 8, !tbaa !15
  %75 = getelementptr inbounds i8, ptr %73, i64 %74
  %76 = call i32 @atoi(ptr noundef %75) #5
  %77 = getelementptr inbounds %struct.strcoordinate, ptr %0, i32 0, i32 0
  store i32 %76, ptr %77, align 8, !tbaa !9
  br label %78

78:                                               ; preds = %72, %64, %61
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load i64, ptr %8, align 8, !tbaa !15
  %81 = getelementptr inbounds i8, ptr %79, i64 %80
  %82 = load i8, ptr %81, align 1, !tbaa !17
  %83 = sext i8 %82 to i32
  %84 = icmp eq i32 %83, 93
  br i1 %84, label %99, label %85

85:                                               ; preds = %78
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = load i64, ptr %8, align 8, !tbaa !15
  %88 = getelementptr inbounds i8, ptr %86, i64 %87
  %89 = load i8, ptr %88, align 1, !tbaa !17
  %90 = sext i8 %89 to i32
  %91 = icmp eq i32 %90, 91
  br i1 %91, label %99, label %92

92:                                               ; preds = %85
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = load i64, ptr %8, align 8, !tbaa !15
  %95 = getelementptr inbounds i8, ptr %93, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !17
  %97 = sext i8 %96 to i32
  %98 = icmp eq i32 %97, 58
  br i1 %98, label %99, label %102

99:                                               ; preds = %92, %85, %78
  %100 = load i32, ptr %9, align 4, !tbaa !16
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %9, align 4, !tbaa !16
  br label %102

102:                                              ; preds = %99, %92
  %103 = load i64, ptr %8, align 8, !tbaa !15
  %104 = add i64 %103, 1
  store i64 %104, ptr %8, align 8, !tbaa !15
  br label %14, !llvm.loop !18

105:                                              ; preds = %14
  store i1 true, ptr %5, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %106 = load i1, ptr %5, align 1
  br i1 %106, label %108, label %107

107:                                              ; preds = %105
  call void @_ZN13strcoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #4
  br label %108

108:                                              ; preds = %107, %105
  ret void

109:                                              ; preds = %57, %53
  call void @_ZN13strcoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #4
  br label %110

110:                                              ; preds = %109
  %111 = load ptr, ptr %6, align 8
  %112 = load i32, ptr %7, align 4
  %113 = insertvalue { ptr, i32 } poison, ptr %111, 0
  %114 = insertvalue { ptr, i32 } %113, i32 %112, 1
  resume { ptr, i32 } %114
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #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 = !{!"_ZTS13strcoordinate", !11, i64 0, !12, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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.strcoordinate = type { i32, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13strcoordinateC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13strcoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9parse_posPc(ptr dead_on_unwind noalias nonnull writable sret(%struct.strcoordinate) align 8 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN13strcoordinateC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull @.str.1)
          to label %5 unwind label %12

5:                                                ; preds = %2
  store i32 -1, ptr %0, align 8, !tbaa !5
  %6 = load i8, ptr %1, align 1, !tbaa !14
  %.not34 = icmp eq i8 %6, 9
  br i1 %.not34, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5, %24
  %7 = phi i8 [ %27, %24 ], [ %6, %5 ]
  %.036 = phi i32 [ %.1, %24 ], [ 0, %5 ]
  %.02635 = phi i64 [ %25, %24 ], [ 0, %5 ]
  %8 = getelementptr inbounds i8, ptr %1, i64 %.02635
  switch i32 %.036, label %thread-pre-split [
    i32 1, label %9
    i32 2, label %16
  ]

9:                                                ; preds = %.lr.ph
  %.not32 = icmp eq i8 %7, 58
  br i1 %.not32, label %.thread, label %10

10:                                               ; preds = %9
  %11 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %3, i8 noundef signext %7)
          to label %.thread-pre-split_crit_edge unwind label %14

.thread-pre-split_crit_edge:                      ; preds = %10
  %.pr.pre = load i8, ptr %8, align 1, !tbaa !14
  br label %thread-pre-split

12:                                               ; preds = %2
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %28

14:                                               ; preds = %10
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %28

16:                                               ; preds = %.lr.ph
  %17 = getelementptr i8, ptr %8, i64 -1
  %18 = load i8, ptr %17, align 1, !tbaa !14
  %19 = icmp eq i8 %18, 58
  br i1 %19, label %20, label %thread-pre-split

20:                                               ; preds = %16
  %21 = tail call i32 @atoi(ptr nocapture noundef %8) #4
  store i32 %21, ptr %0, align 8, !tbaa !5
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %20, %16, %.thread-pre-split_crit_edge, %.lr.ph
  %22 = phi i8 [ %7, %.lr.ph ], [ %.pr.pre, %.thread-pre-split_crit_edge ], [ %7, %16 ], [ %7, %20 ]
  switch i8 %22, label %24 [
    i8 93, label %.thread
    i8 91, label %.thread
    i8 58, label %.thread
  ]

.thread:                                          ; preds = %9, %thread-pre-split, %thread-pre-split, %thread-pre-split
  %23 = add nsw i32 %.036, 1
  br label %24

24:                                               ; preds = %thread-pre-split, %.thread
  %.1 = phi i32 [ %23, %.thread ], [ %.036, %thread-pre-split ]
  %25 = add i64 %.02635, 1
  %26 = getelementptr inbounds i8, ptr %1, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !14
  %.not = icmp eq i8 %27, 9
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %24, %5
  ret void

28:                                               ; preds = %14, %12
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %13, %12 ]
  tail call void @_ZN13strcoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #3
  resume { ptr, i32 } %.pn
}

attributes #0 = { 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 #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 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 #3 = { nounwind }
attributes #4 = { 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 = !{!"_ZTS13strcoordinate", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !11, i64 0, !13, i64 8, !8, i64 16}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!8, !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass