; LLVM IR from KamilSJaron/smudgeplot :: src_ploidyplot (gene_core)

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

@stderr = external global ptr, align 8
@Prog_Name = external dso_local global ptr, align 8
@Catenate.cat = external hidden global ptr, align 8
@Catenate.max = external hidden global i32, align 4
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local ptr @Catenate(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %23, label %14

14:                                               ; preds = %4
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %23, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %23, label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %20, %17, %14, %4
  %24 = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  call void @free(ptr noundef %24) #5
  store i32 -1, ptr @Catenate.max, align 4, !tbaa !9
  store ptr null, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %76

25:                                               ; preds = %20
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = call i64 @strlen(ptr noundef %26) #6
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %10, align 4, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = call i64 @strlen(ptr noundef %29) #6
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = add i64 %32, %30
  %34 = trunc i64 %33 to i32
  store i32 %34, ptr %10, align 4, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = call i64 @strlen(ptr noundef %35) #6
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = add i64 %38, %36
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr %10, align 4, !tbaa !9
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = call i64 @strlen(ptr noundef %41) #6
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = add i64 %44, %42
  %46 = trunc i64 %45 to i32
  store i32 %46, ptr %10, align 4, !tbaa !9
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = load i32, ptr @Catenate.max, align 4, !tbaa !9
  %49 = icmp sgt i32 %47, %48
  br i1 %49, label %50, label %68

50:                                               ; preds = %25
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = sitofp i32 %51 to double
  %53 = fmul double 1.200000e+00, %52
  %54 = fptosi double %53 to i32
  %55 = add nsw i32 %54, 100
  store i32 %55, ptr @Catenate.max, align 4, !tbaa !9
  %56 = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  %57 = load i32, ptr @Catenate.max, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = call ptr @realloc(ptr noundef %56, i64 noundef %59) #7
  store ptr %60, ptr @Catenate.cat, align 8, !tbaa !5
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %67

62:                                               ; preds = %50
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = load ptr, ptr @Prog_Name, align 8, !tbaa !5
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.7, ptr noundef %64, ptr noundef %65) #5
  store ptr null, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %76

67:                                               ; preds = %50
  br label %68

68:                                               ; preds = %67, %25
  %69 = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %69, ptr noundef @.str.8, ptr noundef %70, ptr noundef %71, ptr noundef %72, ptr noundef %73) #5
  %75 = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  store ptr %75, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %76

76:                                               ; preds = %68, %62, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %77 = load ptr, ptr %5, align 8
  ret ptr %77
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #1

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

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

@stderr = external local_unnamed_addr global ptr, align 8
@Prog_Name = external dso_local local_unnamed_addr global ptr, align 8
@Catenate.cat = external hidden local_unnamed_addr global ptr, align 8
@Catenate.max = external hidden local_unnamed_addr global i32, align 4
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @Catenate(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %6 = insertelement <4 x ptr> %5, ptr %2, i64 1
  %7 = insertelement <4 x ptr> %6, ptr %1, i64 2
  %8 = insertelement <4 x ptr> %7, ptr %3, i64 3
  %9 = icmp eq <4 x ptr> %8, zeroinitializer
  %10 = bitcast <4 x i1> %9 to i4
  %.not = icmp eq i4 %10, 0
  br i1 %.not, label %13, label %11

11:                                               ; preds = %4
  %12 = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  tail call void @free(ptr noundef %12) #5
  store i32 -1, ptr @Catenate.max, align 4, !tbaa !9
  br label %41

13:                                               ; preds = %4
  %14 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #6
  %15 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #6
  %16 = add i64 %15, %14
  %17 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #6
  %18 = add i64 %16, %17
  %19 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #6
  %20 = add i64 %18, %19
  %21 = trunc i64 %20 to i32
  %22 = load i32, ptr @Catenate.max, align 4, !tbaa !9
  %23 = icmp slt i32 %22, %21
  %.pre = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  br i1 %23, label %24, label %37

24:                                               ; preds = %13
  %25 = sitofp i32 %21 to double
  %26 = fmul double %25, 1.200000e+00
  %27 = fptosi double %26 to i32
  %28 = add nsw i32 %27, 100
  store i32 %28, ptr @Catenate.max, align 4, !tbaa !9
  %29 = add nsw i32 %27, 101
  %30 = sext i32 %29 to i64
  %31 = tail call ptr @realloc(ptr noundef %.pre, i64 noundef %30) #7
  store ptr %31, ptr @Catenate.cat, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %37

33:                                               ; preds = %24
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = load ptr, ptr @Prog_Name, align 8, !tbaa !5
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.7, ptr noundef %35, ptr noundef nonnull %2) #8
  br label %41

37:                                               ; preds = %24, %13
  %38 = phi ptr [ %31, %24 ], [ %.pre, %13 ]
  %39 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %38, ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3) #5
  %40 = load ptr, ptr @Catenate.cat, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %37, %33, %11
  %.0 = phi ptr [ null, %11 ], [ null, %33 ], [ %40, %37 ]
  ret ptr %.0
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

attributes #0 = { nofree nounwind "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 willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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(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 #3 = { 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind allocsize(1) }
attributes #8 = { cold 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass