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

; 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.ConstraintStr = type { i32, double, ptr, double, ptr }
%struct.AtomStr = type { ptr, ptr }
%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.AtomListStr = type { i32, [27 x i32], [27 x i32], [27 x i32], double, ptr, ptr, ptr }
%struct.DynamicStr = type { [4 x i32], [4 x double], [4 x double], %struct.HBStr, %struct.HBNeighborStr, %struct.InteractionEventStr }
%struct.HBStr = type { i32, i32, i8, i32 }
%struct.HBNeighborStr = type { [5 x i32], i32, i32 }
%struct.InteractionEventStr = type { i32, i64, i64, double, double, i32, i32 }

@potentialPairHB = external global [12 x [33 x [33 x %struct.ConstraintStr]]], align 16

; 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 uwtable
define dso_local i32 @CheckPairMatch(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = call i32 @HBModel(ptr noundef %14, ptr noundef %15)
  store i32 %16, ptr %8, align 4, !tbaa !9
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %108

20:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.AtomStr, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = getelementptr inbounds %struct.PropertyStr, ptr %23, i32 0, i32 4
  %25 = load i32, ptr %24, align 4, !tbaa !13
  store i32 %25, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.AtomStr, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr inbounds %struct.PropertyStr, ptr %28, i32 0, i32 4
  %30 = load i32, ptr %29, align 4, !tbaa !13
  store i32 %30, ptr %11, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [12 x [33 x [33 x %struct.ConstraintStr]]], ptr @potentialPairHB, i64 0, i64 %32
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr %33, i64 0, i64 %35
  %37 = load i32, ptr %11, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %36, i64 0, i64 %38
  %40 = getelementptr inbounds %struct.ConstraintStr, ptr %39, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %20
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %107

44:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.AtomListStr, ptr %45, i32 0, i32 7
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.AtomStr, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  %51 = getelementptr inbounds %struct.DynamicStr, ptr %50, i32 0, i32 3
  %52 = getelementptr inbounds %struct.HBStr, ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 4, !tbaa !22
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds ptr, ptr %47, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.AtomStr, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.PropertyStr, ptr %58, i32 0, i32 4
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = call i32 @AtomTypeChange(i32 noundef %60, i32 noundef 0)
  store i32 %61, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.AtomListStr, ptr %62, i32 0, i32 7
  %64 = load ptr, ptr %63, align 8, !tbaa !19
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.AtomStr, ptr %65, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !21
  %68 = getelementptr inbounds %struct.DynamicStr, ptr %67, i32 0, i32 3
  %69 = getelementptr inbounds %struct.HBStr, ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !22
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds ptr, ptr %64, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.AtomStr, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !11
  %76 = getelementptr inbounds %struct.PropertyStr, ptr %75, i32 0, i32 4
  %77 = load i32, ptr %76, align 4, !tbaa !13
  %78 = call i32 @AtomTypeChange(i32 noundef %77, i32 noundef 0)
  store i32 %78, ptr %13, align 4, !tbaa !9
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [12 x [33 x [33 x %struct.ConstraintStr]]], ptr @potentialPairHB, i64 0, i64 %80
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr %81, i64 0, i64 %83
  %85 = load i32, ptr %13, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %84, i64 0, i64 %86
  %88 = getelementptr inbounds %struct.ConstraintStr, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !17
  %90 = icmp eq ptr %89, null
  br i1 %90, label %104, label %91

91:                                               ; preds = %44
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [12 x [33 x [33 x %struct.ConstraintStr]]], ptr @potentialPairHB, i64 0, i64 %93
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [33 x [33 x %struct.ConstraintStr]], ptr %94, i64 0, i64 %96
  %98 = load i32, ptr %12, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [33 x %struct.ConstraintStr], ptr %97, i64 0, i64 %99
  %101 = getelementptr inbounds %struct.ConstraintStr, ptr %100, i32 0, i32 2
  %102 = load ptr, ptr %101, align 8, !tbaa !17
  %103 = icmp eq ptr %102, null
  br i1 %103, label %104, label %105

104:                                              ; preds = %91, %44
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %106

105:                                              ; preds = %91
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %106

106:                                              ; preds = %105, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %107

107:                                              ; preds = %106, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %108

108:                                              ; preds = %107, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %109 = load i32, ptr %4, align 4
  ret i32 %109
}

declare i32 @HBModel(ptr noundef, ptr noundef) #2

declare i32 @AtomTypeChange(i32 noundef, i32 noundef) #2

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

!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}
!11 = !{!12, !6, i64 0}
!12 = !{!"AtomStr", !6, i64 0, !6, i64 8}
!13 = !{!14, !10, i64 52}
!14 = !{!"PropertyStr", !7, i64 0, !7, i64 8, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !15, i64 64, !15, i64 72, !7, i64 80, !16, i64 104, !6, i64 120, !6, i64 128}
!15 = !{!"double", !7, i64 0}
!16 = !{!"AtomSeqStr", !10, i64 0, !10, i64 4, !10, i64 8}
!17 = !{!18, !6, i64 16}
!18 = !{!"ConstraintStr", !10, i64 0, !15, i64 8, !6, i64 16, !15, i64 24, !6, i64 32}
!19 = !{!20, !6, i64 352}
!20 = !{!"AtomListStr", !10, i64 0, !7, i64 4, !7, i64 112, !7, i64 220, !15, i64 328, !6, i64 336, !6, i64 344, !6, i64 352}
!21 = !{!12, !6, i64 8}
!22 = !{!23, !10, i64 84}
!23 = !{!"DynamicStr", !7, i64 0, !7, i64 16, !7, i64 48, !24, i64 80, !25, i64 96, !26, i64 128}
!24 = !{!"HBStr", !10, i64 0, !10, i64 4, !7, i64 8, !10, i64 12}
!25 = !{!"HBNeighborStr", !7, i64 0, !10, i64 20, !10, i64 24}
!26 = !{!"InteractionEventStr", !10, i64 0, !27, i64 8, !27, i64 16, !15, i64 24, !15, i64 32, !10, i64 40, !10, i64 44}
!27 = !{!"long", !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"

%struct.ConstraintStr = type { i32, double, ptr, double, ptr }

@potentialPairHB = external local_unnamed_addr global [12 x [33 x [33 x %struct.ConstraintStr]]], align 16

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @CheckPairMatch(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = tail call i32 @HBModel(ptr noundef %0, ptr noundef %1) #2
  %5 = icmp slt i32 %4, 0
  br i1 %5, label %54, label %6

6:                                                ; preds = %3
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 52
  %9 = load i32, ptr %8, align 4, !tbaa !10
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 52
  %12 = load i32, ptr %11, align 4, !tbaa !10
  %13 = zext nneg i32 %4 to i64
  %14 = sext i32 %9 to i64
  %15 = sext i32 %12 to i64
  %16 = getelementptr inbounds [12 x [33 x [33 x %struct.ConstraintStr]]], ptr @potentialPairHB, i64 0, i64 %13, i64 %14, i64 %15, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = icmp eq ptr %17, null
  br i1 %18, label %54, label %19

19:                                               ; preds = %6
  %20 = getelementptr inbounds i8, ptr %2, i64 352
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !19
  %24 = getelementptr inbounds i8, ptr %23, i64 84
  %25 = load i32, ptr %24, align 4, !tbaa !20
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds ptr, ptr %21, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !26
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 52
  %31 = load i32, ptr %30, align 4, !tbaa !10
  %32 = tail call i32 @AtomTypeChange(i32 noundef %31, i32 noundef 0) #2
  %33 = load ptr, ptr %20, align 8, !tbaa !17
  %34 = getelementptr inbounds i8, ptr %1, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  %36 = getelementptr inbounds i8, ptr %35, i64 84
  %37 = load i32, ptr %36, align 4, !tbaa !20
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %33, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !26
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 52
  %43 = load i32, ptr %42, align 4, !tbaa !10
  %44 = tail call i32 @AtomTypeChange(i32 noundef %43, i32 noundef 0) #2
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [12 x [33 x [33 x %struct.ConstraintStr]]], ptr @potentialPairHB, i64 0, i64 %13, i64 %14, i64 %45, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = icmp eq ptr %47, null
  br i1 %48, label %54, label %49

49:                                               ; preds = %19
  %50 = sext i32 %32 to i64
  %51 = getelementptr inbounds [12 x [33 x [33 x %struct.ConstraintStr]]], ptr @potentialPairHB, i64 0, i64 %13, i64 %15, i64 %50, i32 2
  %52 = load ptr, ptr %51, align 8, !tbaa !15
  %53 = icmp eq ptr %52, null
  %spec.select = sext i1 %53 to i32
  br label %54

54:                                               ; preds = %49, %6, %19, %3
  %.2 = phi i32 [ -1, %3 ], [ -1, %6 ], [ -1, %19 ], [ %spec.select, %49 ]
  ret i32 %.2
}

declare i32 @HBModel(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @AtomTypeChange(i32 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 = { "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 }

!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 = !{!"AtomStr", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !12, i64 52}
!11 = !{!"PropertyStr", !8, i64 0, !8, i64 8, !8, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !13, i64 64, !13, i64 72, !8, i64 80, !14, i64 104, !7, i64 120, !7, i64 128}
!12 = !{!"int", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!"AtomSeqStr", !12, i64 0, !12, i64 4, !12, i64 8}
!15 = !{!16, !7, i64 16}
!16 = !{!"ConstraintStr", !12, i64 0, !13, i64 8, !7, i64 16, !13, i64 24, !7, i64 32}
!17 = !{!18, !7, i64 352}
!18 = !{!"AtomListStr", !12, i64 0, !8, i64 4, !8, i64 112, !8, i64 220, !13, i64 328, !7, i64 336, !7, i64 344, !7, i64 352}
!19 = !{!6, !7, i64 8}
!20 = !{!21, !12, i64 84}
!21 = !{!"DynamicStr", !8, i64 0, !8, i64 16, !8, i64 48, !22, i64 80, !23, i64 96, !24, i64 128}
!22 = !{!"HBStr", !12, i64 0, !12, i64 4, !8, i64 8, !12, i64 12}
!23 = !{!"HBNeighborStr", !8, i64 0, !12, i64 20, !12, i64 24}
!24 = !{!"InteractionEventStr", !12, i64 0, !25, i64 8, !25, i64 16, !13, i64 24, !13, i64 32, !12, i64 40, !12, i64 44}
!25 = !{!"long", !8, i64 0}
!26 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass