; LLVM IR from sbu-fsl/kernel-ml :: examples (nfs_net_classification)

; 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.nfs_model_config = type { float, float, i32, i32, i32 }
%struct.nfs_class_net = type { i32, ptr, ptr, ptr, ptr, %struct.model_data, %struct.model_multithreading, %struct.model_state, ptr, ptr, %struct.nfs_net_data_stat, %struct.nfs_norm_data_stat, float, i32 }
%struct.model_data = type { ptr, ptr, ptr, ptr }
%struct.model_multithreading = type { [32 x %struct.mt_buffer], [32 x i32], i32, i32, i32, i64, ptr }
%struct.mt_buffer = type { ptr, ptr }
%struct.model_state = type { i8, i32 }
%struct.nfs_net_data_stat = type { i64 }
%struct.nfs_norm_data_stat = type { i64, ptr, ptr, ptr, ptr }
%struct.layers = type { ptr, ptr }
%struct.layer = type { ptr, i32, ptr, ptr }

@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [66 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @data_processing(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @kml_file_open(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @kml_file_close(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.nfs_model_config, align 4
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr %5) #3
  %7 = getelementptr inbounds %struct.nfs_model_config, ptr %5, i32 0, i32 2
  store i32 1, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds %struct.nfs_model_config, ptr %5, i32 0, i32 0
  store float 0x3F847AE140000000, ptr %8, align 4, !tbaa !11
  %9 = getelementptr inbounds %struct.nfs_model_config, ptr %5, i32 0, i32 1
  store float 0x3FEFAE1480000000, ptr %9, align 4, !tbaa !12
  %10 = getelementptr inbounds %struct.nfs_model_config, ptr %5, i32 0, i32 3
  store i32 8, ptr %10, align 4, !tbaa !13
  %11 = getelementptr inbounds %struct.nfs_model_config, ptr %5, i32 0, i32 4
  store i32 2, ptr %11, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = call ptr @build_nfs_class_net(ptr noundef %5)
  store ptr %12, ptr %6, align 8, !tbaa !15
  %13 = load ptr, ptr %6, align 8, !tbaa !15
  %14 = getelementptr inbounds %struct.nfs_class_net, ptr %13, i32 0, i32 7
  %15 = getelementptr inbounds %struct.model_state, ptr %14, i32 0, i32 0
  store atomic i8 0, ptr %15 seq_cst, align 1, !tbaa !17
  %16 = load ptr, ptr %6, align 8, !tbaa !15
  %17 = getelementptr inbounds %struct.nfs_class_net, ptr %16, i32 0, i32 3
  %18 = load ptr, ptr %17, align 8, !tbaa !25
  %19 = getelementptr inbounds %struct.layers, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !26
  call void @set_weights_biases_from_file(ptr noundef %20, ptr noundef @.str.11, ptr noundef @.str.12)
  %21 = load ptr, ptr %6, align 8, !tbaa !15
  %22 = getelementptr inbounds %struct.nfs_class_net, ptr %21, i32 0, i32 3
  %23 = load ptr, ptr %22, align 8, !tbaa !25
  %24 = getelementptr inbounds %struct.layers, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !26
  %26 = getelementptr inbounds %struct.layer, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !28
  %28 = getelementptr inbounds %struct.layer, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !28
  call void @set_weights_biases_from_file(ptr noundef %29, ptr noundef @.str.13, ptr noundef @.str.14)
  %30 = load ptr, ptr %6, align 8, !tbaa !15
  %31 = getelementptr inbounds %struct.nfs_class_net, ptr %30, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !25
  %33 = getelementptr inbounds %struct.layers, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !26
  %35 = getelementptr inbounds %struct.layer, ptr %34, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !28
  %37 = getelementptr inbounds %struct.layer, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !28
  %39 = getelementptr inbounds %struct.layer, ptr %38, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !28
  %41 = getelementptr inbounds %struct.layer, ptr %40, i32 0, i32 2
  %42 = load ptr, ptr %41, align 8, !tbaa !28
  call void @set_weights_biases_from_file(ptr noundef %42, ptr noundef @.str.15, ptr noundef @.str.16)
  %43 = load ptr, ptr %6, align 8, !tbaa !15
  %44 = getelementptr inbounds %struct.nfs_class_net, ptr %43, i32 0, i32 3
  %45 = load ptr, ptr %44, align 8, !tbaa !25
  %46 = getelementptr inbounds %struct.layers, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !30
  call void @set_weights_biases_from_file(ptr noundef %47, ptr noundef @.str.17, ptr noundef @.str.18)
  %48 = call ptr @allocate_matrix(i32 noundef 1, i32 noundef 8, i32 noundef 1)
  store ptr %48, ptr %3, align 8, !tbaa !15
  %49 = call ptr @allocate_matrix(i32 noundef 1, i32 noundef 8, i32 noundef 1)
  store ptr %49, ptr %4, align 8, !tbaa !15
  %50 = call ptr @kml_file_open(ptr noundef @.str.19, ptr noundef @.str.3, i32 noundef 0)
  store ptr %50, ptr %1, align 8, !tbaa !15
  %51 = call ptr @kml_file_open(ptr noundef @.str.20, ptr noundef @.str.3, i32 noundef 0)
  store ptr %51, ptr %2, align 8, !tbaa !15
  %52 = load ptr, ptr %1, align 8, !tbaa !15
  %53 = load ptr, ptr %3, align 8, !tbaa !15
  call void @load_matrix_from_file(ptr noundef %52, ptr noundef %53)
  %54 = load ptr, ptr %2, align 8, !tbaa !15
  %55 = load ptr, ptr %4, align 8, !tbaa !15
  call void @load_matrix_from_file(ptr noundef %54, ptr noundef %55)
  %56 = load ptr, ptr %1, align 8, !tbaa !15
  %57 = call i32 @kml_file_close(ptr noundef %56)
  %58 = load ptr, ptr %2, align 8, !tbaa !15
  %59 = call i32 @kml_file_close(ptr noundef %58)
  %60 = load ptr, ptr %6, align 8, !tbaa !15
  %61 = getelementptr inbounds %struct.nfs_class_net, ptr %60, i32 0, i32 11
  %62 = load ptr, ptr %3, align 8, !tbaa !15
  %63 = load ptr, ptr %4, align 8, !tbaa !15
  call void @set_nfs_data(ptr noundef %61, ptr noundef %62, ptr noundef %63, i32 noundef 1202)
  %64 = load ptr, ptr %6, align 8, !tbaa !15
  call void @data_processing(ptr noundef %64)
  %65 = load ptr, ptr %6, align 8, !tbaa !15
  call void @clean_nfs_class_net(ptr noundef %65)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 20, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret i32 0
}

declare ptr @build_nfs_class_net(ptr noundef) #2

declare void @set_weights_biases_from_file(ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @allocate_matrix(i32 noundef, i32 noundef, i32 noundef) #2

declare void @load_matrix_from_file(ptr noundef, ptr noundef) #2

declare void @set_nfs_data(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

declare void @clean_nfs_class_net(ptr noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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 8}
!6 = !{!"nfs_model_config", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !10, i64 12}
!14 = !{!6, !10, i64 16}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!18, !8, i64 744}
!18 = !{!"nfs_class_net", !10, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !19, i64 40, !20, i64 72, !22, i64 744, !16, i64 752, !16, i64 760, !23, i64 768, !24, i64 776, !7, i64 816, !10, i64 820}
!19 = !{!"model_data", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24}
!20 = !{!"model_multithreading", !8, i64 0, !8, i64 512, !8, i64 640, !8, i64 644, !8, i64 648, !21, i64 656, !16, i64 664}
!21 = !{!"long", !8, i64 0}
!22 = !{!"model_state", !8, i64 0, !8, i64 4}
!23 = !{!"nfs_net_data_stat", !21, i64 0}
!24 = !{!"nfs_norm_data_stat", !21, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32}
!25 = !{!18, !16, i64 24}
!26 = !{!27, !16, i64 0}
!27 = !{!"layers", !16, i64 0, !16, i64 8}
!28 = !{!29, !16, i64 16}
!29 = !{!"layer", !16, i64 0, !10, i64 8, !16, i64 16, !16, i64 24}
!30 = !{!27, !16, i64 8}


; 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.nfs_model_config = type { float, float, i32, i32, i32 }

@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [66 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @data_processing(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @kml_file_open(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @kml_file_close(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.nfs_model_config, align 8
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %1) #3
  %2 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 1, ptr %2, align 8, !tbaa !5
  store <2 x float> <float 0x3F847AE140000000, float 0x3FEFAE1480000000>, ptr %1, align 8, !tbaa !11
  %3 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 8, ptr %3, align 4, !tbaa !12
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 2, ptr %4, align 8, !tbaa !13
  %5 = call ptr @build_nfs_class_net(ptr noundef nonnull %1) #3
  %6 = getelementptr inbounds i8, ptr %5, i64 744
  store atomic i8 0, ptr %6 seq_cst, align 1, !tbaa !14
  %7 = getelementptr inbounds i8, ptr %5, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !23
  %9 = load ptr, ptr %8, align 8, !tbaa !24
  call void @set_weights_biases_from_file(ptr noundef %9, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12) #3
  %10 = load ptr, ptr %7, align 8, !tbaa !23
  %11 = load ptr, ptr %10, align 8, !tbaa !24
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !26
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !26
  call void @set_weights_biases_from_file(ptr noundef %15, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.14) #3
  %16 = load ptr, ptr %7, align 8, !tbaa !23
  %17 = load ptr, ptr %16, align 8, !tbaa !24
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !26
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !26
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !26
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !26
  call void @set_weights_biases_from_file(ptr noundef %25, ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.16) #3
  %26 = load ptr, ptr %7, align 8, !tbaa !23
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !28
  call void @set_weights_biases_from_file(ptr noundef %28, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.18) #3
  %29 = call ptr @allocate_matrix(i32 noundef 1, i32 noundef 8, i32 noundef 1) #3
  %30 = call ptr @allocate_matrix(i32 noundef 1, i32 noundef 8, i32 noundef 1) #3
  %31 = call ptr @kml_file_open(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.3, i32 noundef 0) #3
  %32 = call ptr @kml_file_open(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.3, i32 noundef 0) #3
  call void @load_matrix_from_file(ptr noundef %31, ptr noundef %29) #3
  call void @load_matrix_from_file(ptr noundef %32, ptr noundef %30) #3
  %33 = call i32 @kml_file_close(ptr noundef %31) #3
  %34 = call i32 @kml_file_close(ptr noundef %32) #3
  %35 = getelementptr inbounds i8, ptr %5, i64 776
  call void @set_nfs_data(ptr noundef nonnull %35, ptr noundef %29, ptr noundef %30, i32 noundef 1202) #3
  call void @data_processing(ptr noundef %5)
  call void @clean_nfs_class_net(ptr noundef %5) #3
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %1) #3
  ret i32 0
}

declare ptr @build_nfs_class_net(ptr noundef) local_unnamed_addr #2

declare void @set_weights_biases_from_file(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @allocate_matrix(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @load_matrix_from_file(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @set_nfs_data(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @clean_nfs_class_net(ptr noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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 8}
!6 = !{!"nfs_model_config", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !10, i64 12}
!13 = !{!6, !10, i64 16}
!14 = !{!15, !8, i64 744}
!15 = !{!"nfs_class_net", !10, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !17, i64 40, !18, i64 72, !20, i64 744, !16, i64 752, !16, i64 760, !21, i64 768, !22, i64 776, !7, i64 816, !10, i64 820}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"model_data", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24}
!18 = !{!"model_multithreading", !8, i64 0, !8, i64 512, !8, i64 640, !8, i64 644, !8, i64 648, !19, i64 656, !16, i64 664}
!19 = !{!"long", !8, i64 0}
!20 = !{!"model_state", !8, i64 0, !8, i64 4}
!21 = !{!"nfs_net_data_stat", !19, i64 0}
!22 = !{!"nfs_norm_data_stat", !19, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32}
!23 = !{!15, !16, i64 24}
!24 = !{!25, !16, i64 0}
!25 = !{!"layers", !16, i64 0, !16, i64 8}
!26 = !{!27, !16, i64 16}
!27 = !{!"layer", !16, i64 0, !10, i64 8, !16, i64 16, !16, i64 24}
!28 = !{!25, !16, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass