; LLVM IR from sbu-fsl/kernel-ml :: examples (readahead_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.readahead_class_net = type { i32, ptr, ptr, ptr, ptr, %struct.model_data, %struct.model_multithreading, %struct.model_state, ptr, ptr, %struct.readahead_net_data_stat, %struct.readahead_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.readahead_net_data_stat = type { i64, double, double }
%struct.readahead_norm_data_stat = type { i64, ptr, ptr, ptr, ptr }
%struct.matrix = type { i32, i32, i32, %union.anon }
%union.anon = type { ptr }

@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [65 x i8], align 1
@__PRETTY_FUNCTION__.simulation = external hidden unnamed_addr constant [39 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

declare i32 @kml_fscanf(ptr noundef, ptr noundef, ...) #4

declare i32 @printf(ptr noundef, ...) #4

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

; Function Attrs: nounwind uwtable
define dso_local void @simulation(ptr noundef %0) #5 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [255 x i8], align 16
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 255, ptr %4) #6
  call void @llvm.memset.p0.i64(ptr align 16 %4, i8 0, i64 255, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %17 = getelementptr inbounds [255 x i8], ptr %4, i64 0, i64 0
  %18 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %17, i64 noundef 255, ptr noundef @.str.8) #6
  store i32 %18, ptr %13, align 4, !tbaa !9
  %19 = load i32, ptr %13, align 4, !tbaa !9
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %1
  %22 = load i32, ptr %13, align 4, !tbaa !9
  %23 = icmp slt i32 %22, 255
  br i1 %23, label %25, label %24

24:                                               ; preds = %21, %1
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 81, ptr noundef @__PRETTY_FUNCTION__.simulation) #7
  unreachable

25:                                               ; preds = %21
  %26 = getelementptr inbounds [255 x i8], ptr %4, i64 0, i64 0
  %27 = call ptr @kml_file_open(ptr noundef %26, ptr noundef @.str.3, i32 noundef 0)
  store ptr %27, ptr %3, align 8, !tbaa !5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @kml_fscanf(ptr noundef %28, ptr noundef @.str.4, ptr noundef %9)
  %30 = load float, ptr %9, align 4, !tbaa !11
  %31 = fptosi float %30 to i32
  store i32 %31, ptr %6, align 4, !tbaa !9
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.readahead_class_net, ptr %33, i32 0, i32 13
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = call ptr @allocate_matrix(i32 noundef %32, i32 noundef 5, i32 noundef %35)
  store ptr %36, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %91, %25
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.matrix, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !22
  %42 = icmp slt i32 %38, %41
  br i1 %42, label %43, label %94

43:                                               ; preds = %37
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %87, %43
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.matrix, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !24
  %49 = icmp slt i32 %45, %48
  br i1 %49, label %50, label %90

50:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @kml_fscanf(ptr noundef %51, ptr noundef @.str.4, ptr noundef %14)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.readahead_class_net, ptr %53, i32 0, i32 13
  %55 = load i32, ptr %54, align 4, !tbaa !13
  switch i32 %55, label %86 [
    i32 1, label %56
    i32 2, label %70
    i32 0, label %85
  ]

56:                                               ; preds = %50
  %57 = load float, ptr %14, align 4, !tbaa !11
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.matrix, ptr %58, i32 0, i32 3
  %60 = load ptr, ptr %59, align 8, !tbaa !25
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.matrix, ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 4, !tbaa !24
  %65 = mul nsw i32 %61, %64
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = add nsw i32 %65, %66
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds float, ptr %60, i64 %68
  store float %57, ptr %69, align 4, !tbaa !11
  br label %86

70:                                               ; preds = %50
  %71 = load float, ptr %14, align 4, !tbaa !11
  %72 = fpext float %71 to double
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.matrix, ptr %73, i32 0, i32 3
  %75 = load ptr, ptr %74, align 8, !tbaa !25
  %76 = load i32, ptr %7, align 4, !tbaa !9
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.matrix, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 4, !tbaa !24
  %80 = mul nsw i32 %76, %79
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = add nsw i32 %80, %81
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds double, ptr %75, i64 %83
  store double %72, ptr %84, align 8, !tbaa !26
  br label %86

85:                                               ; preds = %50
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 103, ptr noundef @__PRETTY_FUNCTION__.simulation) #7
  unreachable

86:                                               ; preds = %70, %56, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %8, align 4, !tbaa !9
  br label %44, !llvm.loop !27

90:                                               ; preds = %44
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !9
  br label %37, !llvm.loop !29

94:                                               ; preds = %37
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %115, %94
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.matrix, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !22
  %100 = icmp slt i32 %96, %99
  br i1 %100, label %101, label %118

101:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = call ptr @get_row(ptr noundef %102, i32 noundef %103)
  store ptr %104, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = call ptr @readahead_class_net_inference(ptr noundef %105, ptr noundef %106)
  store ptr %107, ptr %16, align 8, !tbaa !5
  %108 = load ptr, ptr %16, align 8, !tbaa !5
  %109 = call i32 @matrix_argmax(ptr noundef %108)
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %109)
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.readahead_class_net, ptr %111, i32 0, i32 3
  %113 = load ptr, ptr %112, align 8, !tbaa !30
  call void @cleanup_autodiff(ptr noundef %113)
  %114 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free_matrix(ptr noundef %114)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %115

115:                                              ; preds = %101
  %116 = load i32, ptr %7, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %7, align 4, !tbaa !9
  br label %95, !llvm.loop !31

118:                                              ; preds = %95
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free_matrix(ptr noundef %119)
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free_matrix(ptr noundef %120)
  %121 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free_matrix(ptr noundef %121)
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free_matrix(ptr noundef %122)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 255, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

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

declare ptr @get_row(ptr noundef, i32 noundef) #4

declare ptr @readahead_class_net_inference(ptr noundef, ptr noundef) #4

declare i32 @matrix_argmax(ptr noundef) #4

declare void @cleanup_autodiff(ptr noundef) #4

declare void @free_matrix(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { noreturn 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 = { "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 836}
!14 = !{!"readahead_class_net", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !15, i64 40, !16, i64 72, !18, i64 744, !6, i64 752, !6, i64 760, !19, i64 768, !21, i64 792, !12, i64 832, !10, i64 836}
!15 = !{!"model_data", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"model_multithreading", !7, i64 0, !7, i64 512, !7, i64 640, !7, i64 644, !7, i64 648, !17, i64 656, !6, i64 664}
!17 = !{!"long", !7, i64 0}
!18 = !{!"model_state", !7, i64 0, !7, i64 4}
!19 = !{!"readahead_net_data_stat", !17, i64 0, !20, i64 8, !20, i64 16}
!20 = !{!"double", !7, i64 0}
!21 = !{!"readahead_norm_data_stat", !17, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!22 = !{!23, !10, i64 0}
!23 = !{!"matrix", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16}
!24 = !{!23, !10, i64 4}
!25 = !{!7, !7, i64 0}
!26 = !{!20, !20, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = !{!14, !6, i64 24}
!31 = distinct !{!31, !28}


; 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 [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [65 x i8], align 1
@__PRETTY_FUNCTION__.simulation = external hidden unnamed_addr constant [39 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @kml_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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) #0

; Function Attrs: nounwind uwtable
define dso_local void @simulation(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca [255 x i8], align 16
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 255, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(255) %2, i8 0, i64 255, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %5 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %2, i64 noundef 255, ptr noundef nonnull @.str.8) #6
  %6 = add i32 %5, -1
  %or.cond = icmp ult i32 %6, 254
  br i1 %or.cond, label %8, label %7

7:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 81, ptr noundef nonnull @__PRETTY_FUNCTION__.simulation) #7
  unreachable

8:                                                ; preds = %1
  %9 = call ptr @kml_file_open(ptr noundef nonnull %2, ptr noundef nonnull @.str.3, i32 noundef 0) #6
  %10 = call i32 (ptr, ptr, ...) @kml_fscanf(ptr noundef %9, ptr noundef nonnull @.str.4, ptr noundef nonnull %3) #6
  %11 = load float, ptr %3, align 4, !tbaa !5
  %12 = fptosi float %11 to i32
  %13 = getelementptr inbounds i8, ptr %0, i64 836
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = call ptr @allocate_matrix(i32 noundef %12, i32 noundef 5, i32 noundef %14) #6
  %16 = load i32, ptr %15, align 8, !tbaa !20
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.preheader36.lr.ph, label %._crit_edge41

.preheader36.lr.ph:                               ; preds = %8
  %18 = getelementptr inbounds i8, ptr %15, i64 4
  %19 = getelementptr inbounds i8, ptr %15, i64 16
  %20 = load i32, ptr %18, align 4, !tbaa !22
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.preheader36, label %.lr.ph40

.preheader36:                                     ; preds = %.preheader36.lr.ph, %._crit_edge
  %22 = phi i32 [ %51, %._crit_edge ], [ %16, %.preheader36.lr.ph ]
  %23 = phi i32 [ %52, %._crit_edge ], [ %20, %.preheader36.lr.ph ]
  %.038 = phi i32 [ %53, %._crit_edge ], [ 0, %.preheader36.lr.ph ]
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %._crit_edge
  %25 = icmp sgt i32 %51, 0
  br i1 %25, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %.preheader36.lr.ph, %.preheader
  %26 = getelementptr inbounds i8, ptr %0, i64 24
  br label %55

.lr.ph:                                           ; preds = %.preheader36, %47
  %.03537 = phi i32 [ %49, %47 ], [ 0, %.preheader36 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %27 = call i32 (ptr, ptr, ...) @kml_fscanf(ptr noundef %9, ptr noundef nonnull @.str.4, ptr noundef nonnull %4) #6
  %28 = load i32, ptr %13, align 4, !tbaa !9
  switch i32 %28, label %.lr.ph._crit_edge [
    i32 1, label %29
    i32 2, label %37
    i32 0, label %46
  ]

.lr.ph._crit_edge:                                ; preds = %.lr.ph
  %.pre = load i32, ptr %18, align 4, !tbaa !22
  br label %47

29:                                               ; preds = %.lr.ph
  %30 = load float, ptr %4, align 4, !tbaa !5
  %31 = load ptr, ptr %19, align 8, !tbaa !23
  %32 = load i32, ptr %18, align 4, !tbaa !22
  %33 = mul nsw i32 %32, %.038
  %34 = add nsw i32 %33, %.03537
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds float, ptr %31, i64 %35
  store float %30, ptr %36, align 4, !tbaa !5
  br label %47

37:                                               ; preds = %.lr.ph
  %38 = load float, ptr %4, align 4, !tbaa !5
  %39 = fpext float %38 to double
  %40 = load ptr, ptr %19, align 8, !tbaa !23
  %41 = load i32, ptr %18, align 4, !tbaa !22
  %42 = mul nsw i32 %41, %.038
  %43 = add nsw i32 %42, %.03537
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds double, ptr %40, i64 %44
  store double %39, ptr %45, align 8, !tbaa !24
  br label %47

46:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 103, ptr noundef nonnull @__PRETTY_FUNCTION__.simulation) #7
  unreachable

47:                                               ; preds = %.lr.ph._crit_edge, %37, %29
  %48 = phi i32 [ %.pre, %.lr.ph._crit_edge ], [ %41, %37 ], [ %32, %29 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %49 = add nuw nsw i32 %.03537, 1
  %50 = icmp slt i32 %49, %48
  br i1 %50, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !25

._crit_edge.loopexit:                             ; preds = %47
  %.pre43 = load i32, ptr %15, align 8, !tbaa !20
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader36
  %51 = phi i32 [ %.pre43, %._crit_edge.loopexit ], [ %22, %.preheader36 ]
  %52 = phi i32 [ %48, %._crit_edge.loopexit ], [ %23, %.preheader36 ]
  %53 = add nuw nsw i32 %.038, 1
  %54 = icmp slt i32 %53, %51
  br i1 %54, label %.preheader36, label %.preheader, !llvm.loop !27

55:                                               ; preds = %.lr.ph40, %55
  %.139 = phi i32 [ 0, %.lr.ph40 ], [ %61, %55 ]
  %56 = call ptr @get_row(ptr noundef nonnull %15, i32 noundef %.139) #6
  %57 = call ptr @readahead_class_net_inference(ptr noundef %56, ptr noundef %0) #6
  %58 = call i32 @matrix_argmax(ptr noundef %57) #6
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %58)
  %60 = load ptr, ptr %26, align 8, !tbaa !29
  call void @cleanup_autodiff(ptr noundef %60) #6
  call void @free_matrix(ptr noundef %56) #6
  %61 = add nuw nsw i32 %.139, 1
  %62 = load i32, ptr %15, align 8, !tbaa !20
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %55, label %._crit_edge41, !llvm.loop !30

._crit_edge41:                                    ; preds = %55, %8, %.preheader
  call void @free_matrix(ptr noundef null) #6
  call void @free_matrix(ptr noundef nonnull %15) #6
  call void @free_matrix(ptr noundef null) #6
  call void @free_matrix(ptr noundef null) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 255, ptr nonnull %2) #6
  ret void
}

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

declare ptr @get_row(ptr noundef, i32 noundef) local_unnamed_addr #4

declare ptr @readahead_class_net_inference(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @matrix_argmax(ptr noundef) local_unnamed_addr #4

declare void @cleanup_autodiff(ptr noundef) local_unnamed_addr #4

declare void @free_matrix(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { noreturn 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 = { "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 836}
!10 = !{!"readahead_class_net", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !14, i64 72, !16, i64 744, !12, i64 752, !12, i64 760, !17, i64 768, !19, i64 792, !6, i64 832, !11, i64 836}
!11 = !{!"int", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"model_data", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!14 = !{!"model_multithreading", !7, i64 0, !7, i64 512, !7, i64 640, !7, i64 644, !7, i64 648, !15, i64 656, !12, i64 664}
!15 = !{!"long", !7, i64 0}
!16 = !{!"model_state", !7, i64 0, !7, i64 4}
!17 = !{!"readahead_net_data_stat", !15, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"double", !7, i64 0}
!19 = !{!"readahead_norm_data_stat", !15, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!20 = !{!21, !11, i64 0}
!21 = !{!"matrix", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 16}
!22 = !{!21, !11, i64 4}
!23 = !{!7, !7, i64 0}
!24 = !{!18, !18, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26, !28}
!28 = !{!"llvm.loop.unswitch.partial.disable"}
!29 = !{!10, !12, i64 24}
!30 = distinct !{!30, !26}


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