; LLVM IR from alexzheng42/sDMD :: analysis (SystemInformation)

; 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.AtomStr = type { ptr, ptr }

@files = external global ptr, align 8
@atomnum = external global i32, align 4
@connectionMap = external global ptr, align 8
@aminoacid = external global ptr, align 8
@protein = external global ptr, align 8
@atom = external global ptr, align 8
@fileList = external global ptr, align 8
@celllist = external global ptr, align 8
@analysisList = external global ptr, align 8

; 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
declare void @free(ptr noundef) #1

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

5:                                                ; preds = %23, %0
  %6 = load i32, ptr %1, align 4, !tbaa !9
  %7 = load i32, ptr @atomnum, align 4, !tbaa !9
  %8 = icmp sle i32 %6, %7
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  br label %26

10:                                               ; preds = %5
  %11 = load ptr, ptr @atom, align 8, !tbaa !5
  %12 = load i32, ptr %1, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds %struct.AtomStr, ptr %11, i64 %13
  %15 = getelementptr inbounds %struct.AtomStr, ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  call void @free(ptr noundef %16) #3
  %17 = load ptr, ptr @atom, align 8, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds %struct.AtomStr, ptr %17, i64 %19
  %21 = getelementptr inbounds %struct.AtomStr, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  call void @free(ptr noundef %22) #3
  br label %23

23:                                               ; preds = %10
  %24 = load i32, ptr %1, align 4, !tbaa !9
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %1, align 4, !tbaa !9
  br label %5, !llvm.loop !14

26:                                               ; preds = %9
  %27 = load ptr, ptr @atom, align 8, !tbaa !5
  call void @free(ptr noundef %27) #3
  store ptr null, ptr @atom, align 8, !tbaa !5
  %28 = load ptr, ptr @celllist, align 8, !tbaa !5
  call void @free(ptr noundef %28) #3
  store ptr null, ptr @celllist, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %39, %26
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 20
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  br label %42

33:                                               ; preds = %29
  %34 = load ptr, ptr @files, align 8, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds ptr, ptr %34, i64 %36
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  call void @free(ptr noundef %38) #3
  br label %39

39:                                               ; preds = %33
  %40 = load i32, ptr %2, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !9
  br label %29, !llvm.loop !16

42:                                               ; preds = %32
  %43 = load ptr, ptr @files, align 8, !tbaa !5
  call void @free(ptr noundef %43) #3
  store ptr null, ptr @files, align 8, !tbaa !5
  %44 = load ptr, ptr @fileList, align 8, !tbaa !5
  call void @free(ptr noundef %44) #3
  store ptr null, ptr @fileList, align 8, !tbaa !5
  %45 = load ptr, ptr @analysisList, align 8, !tbaa !5
  call void @free(ptr noundef %45) #3
  store ptr null, ptr @analysisList, align 8, !tbaa !5
  %46 = load ptr, ptr @connectionMap, align 8, !tbaa !5
  %47 = getelementptr inbounds ptr, ptr %46, i64 0
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  call void @free(ptr noundef %48) #3
  %49 = load ptr, ptr @connectionMap, align 8, !tbaa !5
  call void @free(ptr noundef %49) #3
  store ptr null, ptr @connectionMap, align 8, !tbaa !5
  ret void
}

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 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 }

!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 8}
!12 = !{!"AtomStr", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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

@files = external local_unnamed_addr global ptr, align 8
@atomnum = external local_unnamed_addr global i32, align 4
@connectionMap = external local_unnamed_addr global ptr, align 8
@aminoacid = external local_unnamed_addr global ptr, align 8
@protein = external local_unnamed_addr global ptr, align 8
@atom = external local_unnamed_addr global ptr, align 8
@fileList = external local_unnamed_addr global ptr, align 8
@celllist = external local_unnamed_addr global ptr, align 8
@analysisList = external local_unnamed_addr global ptr, align 8

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

; Function Attrs: nounwind uwtable
define dso_local void @FreeVariables() local_unnamed_addr #1 {
  %1 = load ptr, ptr @aminoacid, align 8, !tbaa !5
  tail call void @free(ptr noundef %1) #2
  store ptr null, ptr @aminoacid, align 8, !tbaa !5
  %2 = load ptr, ptr @protein, align 8, !tbaa !5
  tail call void @free(ptr noundef %2) #2
  store ptr null, ptr @protein, align 8, !tbaa !5
  %3 = load i32, ptr @atomnum, align 4, !tbaa !9
  %.not8 = icmp slt i32 %3, 0
  br i1 %.not8, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %4 = load ptr, ptr @atom, align 8, !tbaa !5
  tail call void @free(ptr noundef %4) #2
  store ptr null, ptr @atom, align 8, !tbaa !5
  %5 = load ptr, ptr @celllist, align 8, !tbaa !5
  tail call void @free(ptr noundef %5) #2
  store ptr null, ptr @celllist, align 8, !tbaa !5
  %6 = load ptr, ptr @files, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void @free(ptr noundef %7) #2
  %8 = load ptr, ptr @files, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  tail call void @free(ptr noundef %10) #2
  %11 = load ptr, ptr @files, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  tail call void @free(ptr noundef %13) #2
  %14 = load ptr, ptr @files, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 24
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  tail call void @free(ptr noundef %16) #2
  %17 = load ptr, ptr @files, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 32
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  tail call void @free(ptr noundef %19) #2
  %20 = load ptr, ptr @files, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  tail call void @free(ptr noundef %22) #2
  %23 = load ptr, ptr @files, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 48
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  tail call void @free(ptr noundef %25) #2
  %26 = load ptr, ptr @files, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 56
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  tail call void @free(ptr noundef %28) #2
  %29 = load ptr, ptr @files, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 64
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  tail call void @free(ptr noundef %31) #2
  %32 = load ptr, ptr @files, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 72
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  tail call void @free(ptr noundef %34) #2
  %35 = load ptr, ptr @files, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 80
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  tail call void @free(ptr noundef %37) #2
  %38 = load ptr, ptr @files, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 88
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  tail call void @free(ptr noundef %40) #2
  %41 = load ptr, ptr @files, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 96
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  tail call void @free(ptr noundef %43) #2
  %44 = load ptr, ptr @files, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 104
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  tail call void @free(ptr noundef %46) #2
  %47 = load ptr, ptr @files, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 112
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  tail call void @free(ptr noundef %49) #2
  %50 = load ptr, ptr @files, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %50, i64 120
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  tail call void @free(ptr noundef %52) #2
  %53 = load ptr, ptr @files, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 128
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  tail call void @free(ptr noundef %55) #2
  %56 = load ptr, ptr @files, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 136
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  tail call void @free(ptr noundef %58) #2
  %59 = load ptr, ptr @files, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 144
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  tail call void @free(ptr noundef %61) #2
  %62 = load ptr, ptr @files, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 152
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  tail call void @free(ptr noundef %64) #2
  %65 = load ptr, ptr @files, align 8, !tbaa !5
  tail call void @free(ptr noundef %65) #2
  store ptr null, ptr @files, align 8, !tbaa !5
  %66 = load ptr, ptr @fileList, align 8, !tbaa !5
  tail call void @free(ptr noundef %66) #2
  store ptr null, ptr @fileList, align 8, !tbaa !5
  %67 = load ptr, ptr @analysisList, align 8, !tbaa !5
  tail call void @free(ptr noundef %67) #2
  store ptr null, ptr @analysisList, align 8, !tbaa !5
  %68 = load ptr, ptr @connectionMap, align 8, !tbaa !5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  tail call void @free(ptr noundef %69) #2
  %70 = load ptr, ptr @connectionMap, align 8, !tbaa !5
  tail call void @free(ptr noundef %70) #2
  store ptr null, ptr @connectionMap, align 8, !tbaa !5
  ret void

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %71 = load ptr, ptr @atom, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.AtomStr, ptr %71, i64 %indvars.iv, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  tail call void @free(ptr noundef %73) #2
  %74 = load ptr, ptr @atom, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.AtomStr, ptr %74, i64 %indvars.iv
  %76 = load ptr, ptr %75, align 8, !tbaa !13
  tail call void @free(ptr noundef %76) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %77 = load i32, ptr @atomnum, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %.not.not = icmp slt i64 %indvars.iv, %78
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !14
}

attributes #0 = { 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 #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 = { 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 8}
!12 = !{!"AtomStr", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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