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

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

@.str.19 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [5 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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #1

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

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

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

12:                                               ; preds = %5
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = load i64, ptr %3, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %13, i64 %14
  %16 = load i8, ptr %15, align 1, !tbaa !13
  %17 = sext i8 %16 to i32
  %18 = icmp ne i32 %17, 0
  br label %19

19:                                               ; preds = %12, %5
  %20 = phi i1 [ false, %5 ], [ %18, %12 ]
  br i1 %20, label %21, label %68

21:                                               ; preds = %19
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = load i64, ptr %3, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %22, i64 %23
  %25 = call i32 @strncmp(ptr noundef %24, ptr noundef @.str.19, i64 noundef 6) #5
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %33

27:                                               ; preds = %21
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = load i64, ptr %3, align 8, !tbaa !9
  %30 = add i64 %29, 6
  %31 = getelementptr inbounds i8, ptr %28, i64 %30
  %32 = call i32 @atoi(ptr noundef %31) #5
  store i32 %32, ptr %4, align 4, !tbaa !11
  br label %33

33:                                               ; preds = %27, %21
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = load i64, ptr %3, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %34, i64 %35
  %37 = call i32 @strncmp(ptr noundef %36, ptr noundef @.str.20, i64 noundef 4) #5
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %57, label %39

39:                                               ; preds = %33
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = load i64, ptr %3, align 8, !tbaa !9
  %42 = getelementptr inbounds i8, ptr %40, i64 %41
  %43 = call i32 @strncmp(ptr noundef %42, ptr noundef @.str.21, i64 noundef 4) #5
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %57, label %45

45:                                               ; preds = %39
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = load i64, ptr %3, align 8, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %46, i64 %47
  %49 = call i32 @strncmp(ptr noundef %48, ptr noundef @.str.22, i64 noundef 4) #5
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %57, label %51

51:                                               ; preds = %45
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = load i64, ptr %3, align 8, !tbaa !9
  %54 = getelementptr inbounds i8, ptr %52, i64 %53
  %55 = call i32 @strncmp(ptr noundef %54, ptr noundef @.str.23, i64 noundef 4) #5
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %65

57:                                               ; preds = %51, %45, %39, %33
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = load i64, ptr %3, align 8, !tbaa !9
  %60 = add i64 %59, 4
  %61 = getelementptr inbounds i8, ptr %58, i64 %60
  %62 = call i32 @atoi(ptr noundef %61) #5
  %63 = load i32, ptr %4, align 4, !tbaa !11
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr %4, align 4, !tbaa !11
  br label %65

65:                                               ; preds = %57, %51
  %66 = load i64, ptr %3, align 8, !tbaa !9
  %67 = add i64 %66, 1
  store i64 %67, ptr %3, align 8, !tbaa !9
  br label %5, !llvm.loop !14

68:                                               ; preds = %19
  %69 = load i32, ptr %4, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret i32 %69
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(read) "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 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 = { 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 #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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

@.str.19 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(read) uwtable
define dso_local noundef i32 @_Z13parse_supportPc(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  br label %2

2:                                                ; preds = %27, %1
  %.020 = phi i64 [ 0, %1 ], [ %28, %27 ]
  %.0 = phi i32 [ 0, %1 ], [ %.2, %27 ]
  %3 = getelementptr inbounds i8, ptr %0, i64 %.020
  %4 = load i8, ptr %3, align 1, !tbaa !5
  switch i8 %4, label %5 [
    i8 9, label %.critedge
    i8 0, label %.critedge
  ]

5:                                                ; preds = %2
  %6 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.19, i64 noundef 6) #3
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %11

8:                                                ; preds = %5
  %9 = getelementptr i8, ptr %3, i64 6
  %10 = tail call i32 @atoi(ptr nocapture noundef %9) #3
  br label %11

11:                                               ; preds = %8, %5
  %.1 = phi i32 [ %10, %8 ], [ %.0, %5 ]
  %12 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.20, i64 noundef 4) #3
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %23, label %14

14:                                               ; preds = %11
  %15 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.21, i64 noundef 4) #3
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %23, label %17

17:                                               ; preds = %14
  %18 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.22, i64 noundef 4) #3
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %23, label %20

20:                                               ; preds = %17
  %21 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str.23, i64 noundef 4) #3
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %27

23:                                               ; preds = %20, %17, %14, %11
  %24 = getelementptr i8, ptr %3, i64 4
  %25 = tail call i32 @atoi(ptr nocapture noundef %24) #3
  %26 = add nsw i32 %25, %.1
  br label %27

27:                                               ; preds = %23, %20
  %.2 = phi i32 [ %26, %23 ], [ %.1, %20 ]
  %28 = add i64 %.020, 1
  br label %2, !llvm.loop !8

.critedge:                                        ; preds = %2, %2
  ret i32 %.0
}

attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 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 #2 = { 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 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass