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

; 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_mdparams = type { ptr, [2000 x i8], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, i32, [3 x float], float, i16, [3 x i16] }
%struct.s_min_max_pockets = type { float, float, float, float, float, float }

; 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 ptr @my_malloc(i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @assign_min_max_from_user_input(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %5 = call ptr @my_malloc(i64 noundef 24)
  store ptr %5, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.s_mdparams, ptr %6, i32 0, i32 22
  %8 = load float, ptr %7, align 4, !tbaa !9
  %9 = fpext float %8 to double
  %10 = fcmp ogt double %9, 0.000000e+00
  br i1 %10, label %11, label %15

11:                                               ; preds = %1
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.s_mdparams, ptr %12, i32 0, i32 22
  %14 = load float, ptr %13, align 4, !tbaa !9
  store float %14, ptr %4, align 4, !tbaa !14
  br label %16

15:                                               ; preds = %1
  store float 1.000000e+00, ptr %4, align 4, !tbaa !14
  br label %16

16:                                               ; preds = %15, %11
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.s_mdparams, ptr %17, i32 0, i32 21
  %19 = getelementptr inbounds [3 x float], ptr %18, i64 0, i64 0
  %20 = load float, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.s_min_max_pockets, ptr %21, i32 0, i32 0
  store float %20, ptr %22, align 4, !tbaa !15
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s_mdparams, ptr %23, i32 0, i32 21
  %25 = getelementptr inbounds [3 x float], ptr %24, i64 0, i64 1
  %26 = load float, ptr %25, align 4, !tbaa !14
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s_min_max_pockets, ptr %27, i32 0, i32 1
  store float %26, ptr %28, align 4, !tbaa !17
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.s_mdparams, ptr %29, i32 0, i32 21
  %31 = getelementptr inbounds [3 x float], ptr %30, i64 0, i64 2
  %32 = load float, ptr %31, align 8, !tbaa !14
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.s_min_max_pockets, ptr %33, i32 0, i32 2
  store float %32, ptr %34, align 4, !tbaa !18
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.s_mdparams, ptr %35, i32 0, i32 21
  %37 = getelementptr inbounds [3 x float], ptr %36, i64 0, i64 0
  %38 = load float, ptr %37, align 8, !tbaa !14
  %39 = load float, ptr %4, align 4, !tbaa !14
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.s_mdparams, ptr %40, i32 0, i32 24
  %42 = getelementptr inbounds [3 x i16], ptr %41, i64 0, i64 0
  %43 = load i16, ptr %42, align 2, !tbaa !19
  %44 = zext i16 %43 to i32
  %45 = sitofp i32 %44 to float
  %46 = call float @llvm.fmuladd.f32(float %39, float %45, float %38)
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.s_min_max_pockets, ptr %47, i32 0, i32 3
  store float %46, ptr %48, align 4, !tbaa !20
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.s_mdparams, ptr %49, i32 0, i32 21
  %51 = getelementptr inbounds [3 x float], ptr %50, i64 0, i64 1
  %52 = load float, ptr %51, align 4, !tbaa !14
  %53 = load float, ptr %4, align 4, !tbaa !14
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.s_mdparams, ptr %54, i32 0, i32 24
  %56 = getelementptr inbounds [3 x i16], ptr %55, i64 0, i64 1
  %57 = load i16, ptr %56, align 2, !tbaa !19
  %58 = zext i16 %57 to i32
  %59 = sitofp i32 %58 to float
  %60 = call float @llvm.fmuladd.f32(float %53, float %59, float %52)
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.s_min_max_pockets, ptr %61, i32 0, i32 4
  store float %60, ptr %62, align 4, !tbaa !21
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.s_mdparams, ptr %63, i32 0, i32 21
  %65 = getelementptr inbounds [3 x float], ptr %64, i64 0, i64 2
  %66 = load float, ptr %65, align 8, !tbaa !14
  %67 = load float, ptr %4, align 4, !tbaa !14
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.s_mdparams, ptr %68, i32 0, i32 24
  %70 = getelementptr inbounds [3 x i16], ptr %69, i64 0, i64 2
  %71 = load i16, ptr %70, align 2, !tbaa !19
  %72 = zext i16 %71 to i32
  %73 = sitofp i32 %72 to float
  %74 = call float @llvm.fmuladd.f32(float %67, float %73, float %66)
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.s_min_max_pockets, ptr %75, i32 0, i32 5
  store float %74, ptr %76, align 4, !tbaa !22
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret ptr %77
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !12, i64 2164}
!10 = !{!"s_mdparams", !6, i64 0, !7, i64 8, !6, i64 2008, !6, i64 2016, !6, i64 2024, !6, i64 2032, !6, i64 2040, !6, i64 2048, !6, i64 2056, !6, i64 2064, !6, i64 2072, !6, i64 2080, !6, i64 2088, !6, i64 2096, !6, i64 2104, !6, i64 2112, !6, i64 2120, !11, i64 2128, !6, i64 2136, !11, i64 2144, !11, i64 2148, !7, i64 2152, !12, i64 2164, !13, i64 2168, !7, i64 2170}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!16, !12, i64 0}
!16 = !{!"s_min_max_pockets", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!17 = !{!16, !12, i64 4}
!18 = !{!16, !12, i64 8}
!19 = !{!13, !13, i64 0}
!20 = !{!16, !12, i64 12}
!21 = !{!16, !12, i64 16}
!22 = !{!16, !12, i64 20}


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

declare ptr @my_malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @assign_min_max_from_user_input(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = tail call ptr @my_malloc(i64 noundef 24) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 2164
  %4 = load float, ptr %3, align 4, !tbaa !5
  %5 = fcmp ogt float %4, 0.000000e+00
  %. = select i1 %5, float %4, float 1.000000e+00
  %6 = getelementptr inbounds i8, ptr %0, i64 2152
  %7 = load float, ptr %6, align 8, !tbaa !13
  store float %7, ptr %2, align 4, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %0, i64 2156
  %9 = load float, ptr %8, align 4, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %2, i64 4
  store float %9, ptr %10, align 4, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %0, i64 2160
  %12 = load float, ptr %11, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  store float %12, ptr %13, align 4, !tbaa !17
  %14 = load float, ptr %6, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 2170
  %16 = load i16, ptr %15, align 2, !tbaa !18
  %17 = uitofp i16 %16 to float
  %18 = tail call float @llvm.fmuladd.f32(float %., float %17, float %14)
  %19 = getelementptr inbounds i8, ptr %2, i64 12
  store float %18, ptr %19, align 4, !tbaa !19
  %20 = load float, ptr %8, align 4, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %0, i64 2172
  %22 = load i16, ptr %21, align 2, !tbaa !18
  %23 = uitofp i16 %22 to float
  %24 = tail call float @llvm.fmuladd.f32(float %., float %23, float %20)
  %25 = getelementptr inbounds i8, ptr %2, i64 16
  store float %24, ptr %25, align 4, !tbaa !20
  %26 = load float, ptr %11, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %0, i64 2174
  %28 = load i16, ptr %27, align 2, !tbaa !18
  %29 = uitofp i16 %28 to float
  %30 = tail call float @llvm.fmuladd.f32(float %., float %29, float %26)
  %31 = getelementptr inbounds i8, ptr %2, i64 20
  store float %30, ptr %31, align 4, !tbaa !21
  ret ptr %2
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !11, i64 2164}
!6 = !{!"s_mdparams", !7, i64 0, !8, i64 8, !7, i64 2008, !7, i64 2016, !7, i64 2024, !7, i64 2032, !7, i64 2040, !7, i64 2048, !7, i64 2056, !7, i64 2064, !7, i64 2072, !7, i64 2080, !7, i64 2088, !7, i64 2096, !7, i64 2104, !7, i64 2112, !7, i64 2120, !10, i64 2128, !7, i64 2136, !10, i64 2144, !10, i64 2148, !8, i64 2152, !11, i64 2164, !12, i64 2168, !8, i64 2170}
!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 = !{!"short", !8, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !11, i64 0}
!15 = !{!"s_min_max_pockets", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!16 = !{!15, !11, i64 4}
!17 = !{!15, !11, i64 8}
!18 = !{!12, !12, i64 0}
!19 = !{!15, !11, i64 12}
!20 = !{!15, !11, i64 16}
!21 = !{!15, !11, i64 20}


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