; LLVM IR from alexzheng42/sDMD :: src (Initialization)

; 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.PropertyStr = type { [8 x i8], [2 x [16 x i8]], [8 x i8], i32, i32, i32, double, double, [3 x double], %struct.AtomSeqStr, ptr, ptr }
%struct.AtomSeqStr = type { i32, i32, i32 }
%struct.ConstraintStr = type { i32, double, ptr, double, ptr }
%struct.AtomStr = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@atom = external global ptr, align 8
@warningsum = external global i64, align 8
@.str.151 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.170 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.172 = external hidden unnamed_addr constant [95 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 allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @FindNextBondList(i32 noundef %0, ptr noundef %1, double noundef %2, double noundef %3, i32 noundef %4) #4 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store i32 %0, ptr %7, align 4, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !9
  store double %2, ptr %9, align 8, !tbaa !11
  store double %3, ptr %10, align 8, !tbaa !11
  store i32 %4, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %15 = load ptr, ptr %8, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct.PropertyStr, ptr %15, i32 0, i32 10
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  store ptr %17, ptr %12, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %72, %5
  %19 = load ptr, ptr %12, align 8, !tbaa !9
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %76

21:                                               ; preds = %18
  %22 = load ptr, ptr %12, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.ConstraintStr, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !16
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = icmp eq i32 %24, %25
  br i1 %26, label %27, label %72

27:                                               ; preds = %21
  %28 = load ptr, ptr %12, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.ConstraintStr, ptr %28, i32 0, i32 1
  %30 = load double, ptr %29, align 8, !tbaa !18
  %31 = load double, ptr %9, align 8, !tbaa !11
  %32 = fcmp une double %30, %31
  br i1 %32, label %39, label %33

33:                                               ; preds = %27
  %34 = load ptr, ptr %12, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.ConstraintStr, ptr %34, i32 0, i32 3
  %36 = load double, ptr %35, align 8, !tbaa !19
  %37 = load double, ptr %10, align 8, !tbaa !11
  %38 = fcmp une double %36, %37
  br i1 %38, label %39, label %71

39:                                               ; preds = %33, %27
  %40 = load ptr, ptr %8, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.PropertyStr, ptr %40, i32 0, i32 2
  %42 = getelementptr inbounds [8 x i8], ptr %41, i64 0, i64 0
  %43 = call i32 @strcmp(ptr noundef %42, ptr noundef @.str.151) #6
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %64

45:                                               ; preds = %39
  %46 = load ptr, ptr @atom, align 8, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds %struct.AtomStr, ptr %46, i64 %48
  %50 = getelementptr inbounds %struct.AtomStr, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !20
  %52 = getelementptr inbounds %struct.PropertyStr, ptr %51, i32 0, i32 2
  %53 = getelementptr inbounds [8 x i8], ptr %52, i64 0, i64 0
  %54 = call i32 @strcmp(ptr noundef %53, ptr noundef @.str.151) #6
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %64

56:                                               ; preds = %45
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = load ptr, ptr %8, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.PropertyStr, ptr %58, i32 0, i32 3
  %60 = load i32, ptr %59, align 8, !tbaa !22
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.172, i32 noundef %57, i32 noundef %60, ptr noundef @.str.2, i32 noundef 1272)
  %62 = load i64, ptr @warningsum, align 8, !tbaa !23
  %63 = add nsw i64 %62, 1
  store i64 %63, ptr @warningsum, align 8, !tbaa !23
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %109

64:                                               ; preds = %45, %39
  %65 = load double, ptr %9, align 8, !tbaa !11
  %66 = load ptr, ptr %12, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.ConstraintStr, ptr %66, i32 0, i32 1
  store double %65, ptr %67, align 8, !tbaa !18
  %68 = load double, ptr %10, align 8, !tbaa !11
  %69 = load ptr, ptr %12, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.ConstraintStr, ptr %69, i32 0, i32 3
  store double %68, ptr %70, align 8, !tbaa !19
  br label %71

71:                                               ; preds = %64, %33
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %109

72:                                               ; preds = %21
  %73 = load ptr, ptr %12, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.ConstraintStr, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %74, align 8, !tbaa !25
  store ptr %75, ptr %12, align 8, !tbaa !9
  br label %18, !llvm.loop !26

76:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %77 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 40) #7
  store ptr %77, ptr %14, align 8, !tbaa !9
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = load ptr, ptr %14, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.ConstraintStr, ptr %79, i32 0, i32 0
  store i32 %78, ptr %80, align 8, !tbaa !16
  %81 = load double, ptr %9, align 8, !tbaa !11
  %82 = load ptr, ptr %14, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.ConstraintStr, ptr %82, i32 0, i32 1
  store double %81, ptr %83, align 8, !tbaa !18
  %84 = load double, ptr %10, align 8, !tbaa !11
  %85 = load ptr, ptr %14, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.ConstraintStr, ptr %85, i32 0, i32 3
  store double %84, ptr %86, align 8, !tbaa !19
  %87 = load ptr, ptr %8, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.PropertyStr, ptr %87, i32 0, i32 10
  %89 = load ptr, ptr %88, align 8, !tbaa !13
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %92

91:                                               ; preds = %76
  br label %96

92:                                               ; preds = %76
  %93 = load ptr, ptr %8, align 8, !tbaa !9
  %94 = getelementptr inbounds %struct.PropertyStr, ptr %93, i32 0, i32 10
  %95 = load ptr, ptr %94, align 8, !tbaa !13
  br label %96

96:                                               ; preds = %92, %91
  %97 = phi ptr [ null, %91 ], [ %95, %92 ]
  %98 = load ptr, ptr %14, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.ConstraintStr, ptr %98, i32 0, i32 4
  store ptr %97, ptr %99, align 8, !tbaa !25
  %100 = load ptr, ptr %14, align 8, !tbaa !9
  %101 = load ptr, ptr %8, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct.PropertyStr, ptr %101, i32 0, i32 10
  store ptr %100, ptr %102, align 8, !tbaa !13
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = icmp eq i32 %103, 2
  br i1 %104, label %105, label %108

105:                                              ; preds = %96
  %106 = load ptr, ptr %8, align 8, !tbaa !9
  %107 = load i32, ptr %7, align 4, !tbaa !5
  call void @RemoveConstr(ptr noundef %106, i32 noundef %107, ptr noundef @.str.170)
  br label %108

108:                                              ; preds = %105, %96
  store i32 1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %109

109:                                              ; preds = %108, %71, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %110 = load i32, ptr %6, align 4
  ret i32 %110
}

; Function Attrs: nounwind uwtable
declare dso_local void @RemoveConstr(ptr noundef, i32 noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(0,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 #2 = { 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 #3 = { "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(0,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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 120}
!14 = !{!"PropertyStr", !7, i64 0, !7, i64 8, !7, i64 40, !6, i64 48, !6, i64 52, !6, i64 56, !12, i64 64, !12, i64 72, !7, i64 80, !15, i64 104, !10, i64 120, !10, i64 128}
!15 = !{!"AtomSeqStr", !6, i64 0, !6, i64 4, !6, i64 8}
!16 = !{!17, !6, i64 0}
!17 = !{!"ConstraintStr", !6, i64 0, !12, i64 8, !10, i64 16, !12, i64 24, !10, i64 32}
!18 = !{!17, !12, i64 8}
!19 = !{!17, !12, i64 24}
!20 = !{!21, !10, i64 0}
!21 = !{!"AtomStr", !10, i64 0, !10, i64 8}
!22 = !{!14, !6, i64 48}
!23 = !{!24, !24, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!17, !10, i64 32}
!26 = distinct !{!26, !27}
!27 = !{!"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.AtomStr = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@atom = external local_unnamed_addr global ptr, align 8
@warningsum = external local_unnamed_addr global i64, align 8
@.str.151 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.170 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.172 = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @FindNextBondList(i32 noundef %0, ptr noundef %1, double noundef %2, double noundef %3, i32 noundef %4) local_unnamed_addr #3 {
  %6 = getelementptr inbounds i8, ptr %1, i64 120
  %.03137 = load ptr, ptr %6, align 8, !tbaa !5
  %.not38 = icmp eq ptr %.03137, null
  br i1 %.not38, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5, %35
  %.03139 = phi ptr [ %.031, %35 ], [ %.03137, %5 ]
  %7 = load i32, ptr %.03139, align 8, !tbaa !9
  %8 = icmp eq i32 %7, %0
  br i1 %8, label %9, label %35

9:                                                ; preds = %.lr.ph
  %10 = getelementptr inbounds i8, ptr %.03139, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !13
  %12 = fcmp une double %11, %2
  br i1 %12, label %17, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %.03139, i64 24
  %15 = load double, ptr %14, align 8, !tbaa !14
  %16 = fcmp une double %15, %3
  br i1 %16, label %17, label %43

17:                                               ; preds = %13, %9
  %18 = getelementptr inbounds i8, ptr %1, i64 40
  %19 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.151) #4
  %.not34 = icmp eq i32 %19, 0
  br i1 %.not34, label %33, label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr @atom, align 8, !tbaa !5
  %22 = sext i32 %0 to i64
  %23 = getelementptr inbounds %struct.AtomStr, ptr %21, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %24, i64 40
  %26 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %25, ptr noundef nonnull dereferenceable(1) @.str.151) #4
  %.not35 = icmp eq i32 %26, 0
  br i1 %.not35, label %33, label %27

27:                                               ; preds = %20
  %28 = getelementptr inbounds i8, ptr %1, i64 48
  %29 = load i32, ptr %28, align 8, !tbaa !17
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.172, i32 noundef %0, i32 noundef %29, ptr noundef nonnull @.str.2, i32 noundef 1272)
  %31 = load i64, ptr @warningsum, align 8, !tbaa !20
  %32 = add nsw i64 %31, 1
  store i64 %32, ptr @warningsum, align 8, !tbaa !20
  br label %43

33:                                               ; preds = %20, %17
  store double %2, ptr %10, align 8, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %.03139, i64 24
  store double %3, ptr %34, align 8, !tbaa !14
  br label %43

35:                                               ; preds = %.lr.ph
  %36 = getelementptr inbounds i8, ptr %.03139, i64 32
  %.031 = load ptr, ptr %36, align 8, !tbaa !5
  %.not = icmp eq ptr %.031, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %35, %5
  %37 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #5
  store i32 %0, ptr %37, align 8, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %37, i64 8
  store double %2, ptr %38, align 8, !tbaa !13
  %39 = getelementptr inbounds i8, ptr %37, i64 24
  store double %3, ptr %39, align 8, !tbaa !14
  %40 = getelementptr inbounds i8, ptr %37, i64 32
  store ptr %.03137, ptr %40, align 8, !tbaa !24
  store ptr %37, ptr %6, align 8, !tbaa !25
  %41 = icmp eq i32 %4, 2
  br i1 %41, label %42, label %43

42:                                               ; preds = %._crit_edge
  tail call void @RemoveConstr(ptr noundef nonnull %1, i32 noundef %0, ptr noundef nonnull @.str.170)
  br label %43

43:                                               ; preds = %._crit_edge, %42, %13, %33, %27
  %.0 = phi i32 [ 0, %27 ], [ 0, %33 ], [ 0, %13 ], [ 1, %42 ], [ 1, %._crit_edge ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare dso_local void @RemoveConstr(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 #1 = { 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 #2 = { 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 #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 = { nounwind willreturn memory(read) }
attributes #5 = { nounwind allocsize(0,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, !11, i64 0}
!10 = !{!"ConstraintStr", !11, i64 0, !12, i64 8, !6, i64 16, !12, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !12, i64 8}
!14 = !{!10, !12, i64 24}
!15 = !{!16, !6, i64 0}
!16 = !{!"AtomStr", !6, i64 0, !6, i64 8}
!17 = !{!18, !11, i64 48}
!18 = !{!"PropertyStr", !7, i64 0, !7, i64 8, !7, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !12, i64 64, !12, i64 72, !7, i64 80, !19, i64 104, !6, i64 120, !6, i64 128}
!19 = !{!"AtomSeqStr", !11, i64 0, !11, i64 4, !11, i64 8}
!20 = !{!21, !21, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!10, !6, i64 32}
!25 = !{!18, !6, i64 120}


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