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

; 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_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_pocket = type { ptr, ptr, float, float, float, float, [3 x float], i32, i32, i32, i32 }
%struct.s_atm = type { i32, float, float, float, float, float, float, float, [5 x i8], [7 x i8], [16 x i8], [16 x i8], [3 x i8], [8 x i8], i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, i8, i8, float, float, float, float, i16, ptr, i32 }
%struct.s_desc = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, i32, [20 x i32], i32, i32, i32, float, float, i32, i32, i32, i32, i32, [255 x i8], [255 x i8], [8 x i8] }

@.str.1 = external hidden unnamed_addr constant [6 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare float @dist(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) #1

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

16:                                               ; preds = %76, %2
  %17 = load i32, ptr %7, align 4, !tbaa !13
  %18 = load i32, ptr %6, align 4, !tbaa !13
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %20, label %79

20:                                               ; preds = %16
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = load i32, ptr %7, align 4, !tbaa !13
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds ptr, ptr %21, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %25, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %75

28:                                               ; preds = %20
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.s_pocket, ptr %29, i32 0, i32 6
  %31 = getelementptr inbounds [3 x float], ptr %30, i64 0, i64 0
  %32 = load float, ptr %31, align 8, !tbaa !15
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.s_pocket, ptr %33, i32 0, i32 6
  %35 = getelementptr inbounds [3 x float], ptr %34, i64 0, i64 1
  %36 = load float, ptr %35, align 4, !tbaa !15
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.s_pocket, ptr %37, i32 0, i32 6
  %39 = getelementptr inbounds [3 x float], ptr %38, i64 0, i64 2
  %40 = load float, ptr %39, align 8, !tbaa !15
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.s_atm, ptr %41, i32 0, i32 5
  %43 = load float, ptr %42, align 4, !tbaa !16
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.s_atm, ptr %44, i32 0, i32 6
  %46 = load float, ptr %45, align 8, !tbaa !19
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.s_atm, ptr %47, i32 0, i32 7
  %49 = load float, ptr %48, align 4, !tbaa !20
  %50 = call float @dist(float noundef %32, float noundef %36, float noundef %40, float noundef %43, float noundef %46, float noundef %49)
  %51 = fpext float %50 to double
  %52 = fcmp olt double %51, 4.000000e+00
  br i1 %52, label %53, label %74

53:                                               ; preds = %28
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.s_atm, ptr %54, i32 0, i32 13
  %56 = getelementptr inbounds [8 x i8], ptr %55, i64 0, i64 0
  %57 = call i32 @element_in_kept_res(ptr noundef %56)
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %74, label %59

59:                                               ; preds = %53
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.s_pocket, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !21
  %63 = getelementptr inbounds %struct.s_desc, ptr %62, i32 0, i32 41
  %64 = getelementptr inbounds [8 x i8], ptr %63, i64 0, i64 0
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.s_atm, ptr %65, i32 0, i32 13
  %67 = getelementptr inbounds [8 x i8], ptr %66, i64 0, i64 0
  %68 = call ptr @strncpy(ptr noundef %64, ptr noundef %67, i64 noundef 7) #4
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.s_pocket, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !21
  %72 = getelementptr inbounds %struct.s_desc, ptr %71, i32 0, i32 41
  %73 = getelementptr inbounds [8 x i8], ptr %72, i64 0, i64 7
  store i8 0, ptr %73, align 1, !tbaa !23
  store i32 1, ptr %9, align 4
  br label %86

74:                                               ; preds = %53, %28
  br label %75

75:                                               ; preds = %74, %20
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %7, align 4, !tbaa !13
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !13
  br label %16, !llvm.loop !24

79:                                               ; preds = %16
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.s_pocket, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  %83 = getelementptr inbounds %struct.s_desc, ptr %82, i32 0, i32 41
  %84 = getelementptr inbounds [8 x i8], ptr %83, i64 0, i64 0
  %85 = call ptr @strncpy(ptr noundef %84, ptr noundef @.str.1, i64 noundef 5) #4
  store i32 1, ptr %9, align 4
  br label %86

86:                                               ; preds = %79, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

declare i32 @element_in_kept_res(ptr noundef) #1

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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, !11, i64 80}
!10 = !{!"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, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !7, i64 116, !7, i64 199, !12, i64 700, !12, i64 704, !12, i64 708, !11, i64 712, !11, i64 716}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 32}
!15 = !{!12, !12, i64 0}
!16 = !{!17, !12, i64 20}
!17 = !{!"s_atm", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !7, i64 32, !7, i64 37, !7, i64 44, !7, i64 60, !7, i64 76, !7, i64 79, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !7, i64 144, !7, i64 145, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !18, i64 164, !6, i64 168, !11, i64 176}
!18 = !{!"short", !7, i64 0}
!19 = !{!17, !12, i64 24}
!20 = !{!17, !12, i64 28}
!21 = !{!22, !6, i64 0}
!22 = !{!"s_pocket", !6, i64 0, !6, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !7, i64 32, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"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"

@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

declare float @dist(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @set_pocket_contacted_lig_name(ptr noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %1, i64 80
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 32
  %6 = load ptr, ptr %5, align 8, !tbaa !12
  %7 = icmp sgt i32 %4, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %.not = icmp eq ptr %0, null
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = getelementptr inbounds i8, ptr %0, i64 36
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  br i1 %.not, label %._crit_edge, label %.lr.ph.split.preheader

.lr.ph.split.preheader:                           ; preds = %.lr.ph
  %wide.trip.count = zext nneg i32 %4 to i64
  br label %.lr.ph.split

.lr.ph.split:                                     ; preds = %.lr.ph.split.preheader, %33
  %indvars.iv = phi i64 [ 0, %.lr.ph.split.preheader ], [ %indvars.iv.next, %33 ]
  %11 = getelementptr inbounds ptr, ptr %6, i64 %indvars.iv
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = load float, ptr %8, align 8, !tbaa !14
  %14 = load float, ptr %9, align 4, !tbaa !14
  %15 = load float, ptr %10, align 8, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %12, i64 20
  %17 = load float, ptr %16, align 4, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %12, i64 24
  %19 = load float, ptr %18, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %12, i64 28
  %21 = load float, ptr %20, align 4, !tbaa !19
  %22 = tail call float @dist(float noundef %13, float noundef %14, float noundef %15, float noundef %17, float noundef %19, float noundef %21) #3
  %23 = fcmp olt float %22, 4.000000e+00
  br i1 %23, label %24, label %33

24:                                               ; preds = %.lr.ph.split
  %25 = getelementptr inbounds i8, ptr %12, i64 79
  %26 = tail call i32 @element_in_kept_res(ptr noundef nonnull %25) #3
  %.not19 = icmp eq i32 %26, 0
  br i1 %.not19, label %27, label %33

27:                                               ; preds = %24
  %28 = load ptr, ptr %0, align 8, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %28, i64 742
  %30 = tail call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %29, ptr noundef nonnull dereferenceable(1) %25, i64 noundef 7) #3
  %31 = load ptr, ptr %0, align 8, !tbaa !20
  %32 = getelementptr inbounds i8, ptr %31, i64 749
  store i8 0, ptr %32, align 1, !tbaa !22
  br label %37

33:                                               ; preds = %24, %.lr.ph.split
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph.split, !llvm.loop !23

._crit_edge:                                      ; preds = %33, %.lr.ph, %2
  %34 = load ptr, ptr %0, align 8, !tbaa !20
  %35 = getelementptr inbounds i8, ptr %34, i64 742
  %36 = tail call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %35, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 5) #3
  br label %37

37:                                               ; preds = %._crit_edge, %27
  ret void
}

declare i32 @element_in_kept_res(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #2

attributes #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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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, !10, i64 80}
!6 = !{!"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, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !8, i64 116, !8, i64 199, !11, i64 700, !11, i64 704, !11, i64 708, !10, i64 712, !10, i64 716}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !7, i64 32}
!13 = !{!7, !7, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !11, i64 20}
!16 = !{!"s_atm", !10, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !8, i64 32, !8, i64 37, !8, i64 44, !8, i64 60, !8, i64 76, !8, i64 79, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !8, i64 144, !8, i64 145, !11, i64 148, !11, i64 152, !11, i64 156, !11, i64 160, !17, i64 164, !7, i64 168, !10, i64 176}
!17 = !{!"short", !8, i64 0}
!18 = !{!16, !11, i64 24}
!19 = !{!16, !11, i64 28}
!20 = !{!21, !7, i64 0}
!21 = !{!"s_pocket", !7, i64 0, !7, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !8, i64 32, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56}
!22 = !{!8, !8, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass