; LLVM IR from BoysTownOrg/chapro :: icmp_prepare (cha_icmp_prepare)

; 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.CHA_CLS = type { i32, i32, [32 x double], [32 x double], [32 x double], [32 x double], [32 x double], [32 x double], [32 x double], [32 x double], [32 x double], [32 x double] }

; Function Attrs: nounwind uwtable
define dso_local i32 @cha_icmp_prepare(ptr noundef %0, ptr noundef %1, double noundef %2, double noundef %3, i32 noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !11
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  call void @cha_prepare(ptr noundef %11)
  %12 = load i32, ptr %10, align 4, !tbaa !11
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds ptr, ptr %13, i64 1
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i32, ptr %15, i64 5
  store i32 %12, ptr %16, align 4, !tbaa !11
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.CHA_CLS, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds ptr, ptr %20, i64 1
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds i32, ptr %22, i64 1
  store i32 %19, ptr %23, align 4, !tbaa !11
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load double, ptr %8, align 8, !tbaa !9
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.CHA_CLS, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = load i32, ptr %10, align 4, !tbaa !11
  call void @compr_ds_expand(ptr noundef %24, ptr noundef %25, double noundef %26, i32 noundef %29, i32 noundef %30)
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load double, ptr %9, align 8, !tbaa !9
  call void @compr_levl_config(ptr noundef %31, ptr noundef %32, double noundef %33)
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  call void @compr_gain_config(ptr noundef %34, ptr noundef %35)
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.CHA_CLS, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !13
  call void @compressor_prep(ptr noundef %36, i32 noundef %39)
  ret i32 0
}

declare void @cha_prepare(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @compr_ds_expand(ptr noundef, ptr noundef, double noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @compr_levl_config(ptr noundef, ptr noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @compr_gain_config(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @compressor_prep(ptr noundef, i32 noundef) #0

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

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 4}
!14 = !{!"", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 264, !7, i64 520, !7, i64 776, !7, i64 1032, !7, i64 1288, !7, i64 1544, !7, i64 1800, !7, i64 2056, !7, i64 2312}


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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @cha_icmp_prepare(ptr noundef %0, ptr noundef %1, double noundef %2, double noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  tail call void @cha_prepare(ptr noundef %0) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 20
  store i32 %4, ptr %8, align 4, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 %10, ptr %11, align 4, !tbaa !9
  tail call void @compr_ds_expand(ptr noundef %0, ptr noundef %1, double noundef %2, i32 noundef %10, i32 noundef %4)
  tail call void @compr_levl_config(ptr noundef %0, ptr noundef %1, double noundef %3)
  tail call void @compr_gain_config(ptr noundef %0, ptr noundef %1)
  %12 = load i32, ptr %9, align 4, !tbaa !11
  tail call void @compressor_prep(ptr noundef %0, i32 noundef %12)
  ret i32 0
}

declare void @cha_prepare(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @compr_ds_expand(ptr noundef, ptr noundef, double noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @compr_levl_config(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @compr_gain_config(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @compressor_prep(ptr noundef, i32 noundef) local_unnamed_addr #0

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, !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, !10, i64 4}
!12 = !{!"", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 264, !7, i64 520, !7, i64 776, !7, i64 1032, !7, i64 1288, !7, i64 1544, !7, i64 1800, !7, i64 2056, !7, i64 2312}


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