; LLVM IR from Discngine/fpocket :: src (tpocket)

; 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.s_tparams = type { ptr, ptr, ptr, ptr, ptr, [128 x i8], [128 x i8], float, i32, i32, ptr }
%struct.c_lst_pockets = type { ptr, ptr, ptr, i64, ptr }
%struct.s_pdb = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, float, float, float, float, float, float, [83 x i8], [500 x i8], float, float, float, i32, i32 }
%struct.s_lst_vvertice = type { ptr, ptr, ptr, i32, ptr, i32, i32 }

@stderr = external global ptr, align 8
@.str.44 = external hidden unnamed_addr constant [58 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

declare ptr @search_pocket(ptr noundef, ptr noundef, ptr noundef) #2

declare void @c_lst_pocket_free(ptr noundef) #2

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

21:                                               ; preds = %5
  %22 = load ptr, ptr %12, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.c_lst_pockets, ptr %22, i32 0, i32 3
  %24 = load i64, ptr %23, align 8, !tbaa !14
  %25 = icmp ugt i64 %24, 0
  br i1 %25, label %26, label %46

26:                                               ; preds = %21
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s_pdb, ptr %27, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.s_pdb, ptr %30, i32 0, i32 12
  %32 = load i32, ptr %31, align 4, !tbaa !19
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.c_lst_pockets, ptr %33, i32 0, i32 4
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = getelementptr inbounds %struct.s_lst_vvertice, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.c_lst_pockets, ptr %38, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !20
  %41 = getelementptr inbounds %struct.s_lst_vvertice, ptr %40, i32 0, i32 5
  %42 = load i32, ptr %41, align 8, !tbaa !23
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = call ptr @get_mol_ctd_atm_neigh(ptr noundef %29, i32 noundef %32, ptr noundef %37, i32 noundef %42, float noundef 3.000000e+00, i32 noundef 1, ptr noundef %43)
  store ptr %44, ptr %11, align 8, !tbaa !5
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  call void @c_lst_pocket_free(ptr noundef %45)
  br label %75

46:                                               ; preds = %21, %5
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.s_tparams, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !24
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds ptr, ptr %50, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.s_tparams, ptr %55, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !25
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.s_tparams, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !26
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds ptr, ptr %64, i64 %66
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.44, ptr noundef %54, ptr noundef %61, ptr noundef %68) #4
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %74

72:                                               ; preds = %46
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  call void @c_lst_pocket_free(ptr noundef %73)
  br label %74

74:                                               ; preds = %72, %46
  br label %75

75:                                               ; preds = %74, %26
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret ptr %76
}

declare ptr @get_mol_ctd_atm_neigh(ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef, i32 noundef, ptr noundef) #2

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

!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 312}
!12 = !{!"s_tparams", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !7, i64 168, !13, i64 296, !10, i64 300, !10, i64 304, !6, i64 312}
!13 = !{!"float", !7, i64 0}
!14 = !{!15, !16, i64 24}
!15 = !{!"c_lst_pockets", !6, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !6, i64 32}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !6, i64 40}
!18 = !{!"s_pdb", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !13, i64 104, !13, i64 108, !13, i64 112, !7, i64 116, !7, i64 199, !13, i64 700, !13, i64 704, !13, i64 708, !10, i64 712, !10, i64 716}
!19 = !{!18, !10, i64 84}
!20 = !{!15, !6, i64 32}
!21 = !{!22, !6, i64 8}
!22 = !{!"s_lst_vvertice", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !6, i64 32, !10, i64 40, !10, i64 44}
!23 = !{!22, !10, i64 40}
!24 = !{!12, !6, i64 0}
!25 = !{!12, !6, i64 8}
!26 = !{!12, !6, i64 16}


; 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
@.str.44 = external hidden unnamed_addr constant [58 x i8], align 1

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

declare ptr @search_pocket(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @c_lst_pocket_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @get_actual_pocket(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = getelementptr inbounds i8, ptr %3, i64 312
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call ptr @search_pocket(ptr noundef %1, ptr noundef %7, ptr noundef %0) #3
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %24, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %8, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !12
  %.not20 = icmp eq i64 %11, 0
  br i1 %.not20, label %24, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %0, i64 84
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %8, i64 32
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %18, i64 40
  %22 = load i32, ptr %21, align 8, !tbaa !21
  %23 = tail call ptr @get_mol_ctd_atm_neigh(ptr noundef %14, i32 noundef %16, ptr noundef %20, i32 noundef %22, float noundef 3.000000e+00, i32 noundef 1, ptr noundef %4) #3
  br label %.sink.split

24:                                               ; preds = %9, %5
  %25 = load ptr, ptr @stderr, align 8, !tbaa !22
  %26 = load ptr, ptr %3, align 8, !tbaa !23
  %27 = sext i32 %2 to i64
  %28 = getelementptr inbounds ptr, ptr %26, i64 %27
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  %30 = getelementptr inbounds i8, ptr %3, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !24
  %32 = getelementptr inbounds ptr, ptr %31, i64 %27
  %33 = load ptr, ptr %32, align 8, !tbaa !22
  %34 = getelementptr inbounds i8, ptr %3, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !25
  %36 = getelementptr inbounds ptr, ptr %35, i64 %27
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.44, ptr noundef %29, ptr noundef %33, ptr noundef %37) #4
  br i1 %.not, label %39, label %.sink.split

.sink.split:                                      ; preds = %24, %12
  %.0.ph = phi ptr [ %23, %12 ], [ null, %24 ]
  tail call void @c_lst_pocket_free(ptr noundef nonnull %8) #3
  br label %39

39:                                               ; preds = %.sink.split, %24
  %.0 = phi ptr [ null, %24 ], [ %.0.ph, %.sink.split ]
  ret ptr %.0
}

declare ptr @get_mol_ctd_atm_neigh(ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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 = { "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 }
attributes #4 = { 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, !7, i64 312}
!6 = !{!"s_tparams", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !8, i64 40, !8, i64 168, !10, i64 296, !11, i64 300, !11, i64 304, !7, i64 312}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !14, i64 24}
!13 = !{!"c_lst_pockets", !7, i64 0, !7, i64 8, !7, i64 16, !14, i64 24, !7, i64 32}
!14 = !{!"long", !8, i64 0}
!15 = !{!16, !7, i64 40}
!16 = !{!"s_pdb", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !8, i64 116, !8, i64 199, !10, i64 700, !10, i64 704, !10, i64 708, !11, i64 712, !11, i64 716}
!17 = !{!16, !11, i64 84}
!18 = !{!13, !7, i64 32}
!19 = !{!20, !7, i64 8}
!20 = !{!"s_lst_vvertice", !7, i64 0, !7, i64 8, !7, i64 16, !11, i64 24, !7, i64 32, !11, i64 40, !11, i64 44}
!21 = !{!20, !11, i64 40}
!22 = !{!7, !7, i64 0}
!23 = !{!6, !7, i64 0}
!24 = !{!6, !7, i64 8}
!25 = !{!6, !7, i64 16}


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