; LLVM IR from microsoft/LightAIMD :: src (basis_func)

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

@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 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 i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @print_basis_funcs_buffer(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca double, align 8
  %16 = alloca i64, align 8
  %17 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %18, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %20, ptr %4, align 8, !tbaa !9
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds i64, ptr %21, i32 1
  store ptr %22, ptr %3, align 8, !tbaa !5
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %24 = load i64, ptr %4, align 8, !tbaa !9
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %24)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %26

26:                                               ; preds = %112, %1
  %27 = load i64, ptr %5, align 8, !tbaa !9
  %28 = load i64, ptr %4, align 8, !tbaa !9
  %29 = icmp ult i64 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %115

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i64, ptr %32, align 8, !tbaa !9
  store i64 %33, ptr %7, align 8, !tbaa !9
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds i64, ptr %34, i32 1
  store ptr %35, ptr %3, align 8, !tbaa !5
  %36 = load i64, ptr %7, align 8, !tbaa !9
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %36)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load i64, ptr %38, align 8, !tbaa !9
  store i64 %39, ptr %8, align 8, !tbaa !9
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds i64, ptr %40, i32 1
  store ptr %41, ptr %3, align 8, !tbaa !5
  %42 = load i64, ptr %8, align 8, !tbaa !9
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i64 noundef %42)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %107, %31
  %45 = load i64, ptr %9, align 8, !tbaa !9
  %46 = load i64, ptr %8, align 8, !tbaa !9
  %47 = icmp ult i64 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %110

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load i64, ptr %50, align 8, !tbaa !9
  store i64 %51, ptr %10, align 8, !tbaa !9
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds i64, ptr %52, i32 1
  store ptr %53, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load i64, ptr %54, align 8, !tbaa !9
  store i64 %55, ptr %11, align 8, !tbaa !9
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds i64, ptr %56, i32 1
  store ptr %57, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = load i64, ptr %58, align 8, !tbaa !9
  store i64 %59, ptr %12, align 8, !tbaa !9
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds i64, ptr %60, i32 1
  store ptr %61, ptr %3, align 8, !tbaa !5
  %62 = load i64, ptr %10, align 8, !tbaa !9
  %63 = load i64, ptr %11, align 8, !tbaa !9
  %64 = load i64, ptr %12, align 8, !tbaa !9
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i64 noundef %62, i64 noundef %63, i64 noundef %64)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !9
  store i64 %67, ptr %13, align 8, !tbaa !9
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds i64, ptr %68, i32 1
  store ptr %69, ptr %3, align 8, !tbaa !5
  %70 = load i64, ptr %13, align 8, !tbaa !9
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i64 noundef %70)
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %85, %49
  %74 = load i64, ptr %14, align 8, !tbaa !9
  %75 = load i64, ptr %13, align 8, !tbaa !9
  %76 = icmp ult i64 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %88

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = load double, ptr %79, align 8, !tbaa !11
  store double %80, ptr %15, align 8, !tbaa !11
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds i64, ptr %81, i32 1
  store ptr %82, ptr %3, align 8, !tbaa !5
  %83 = load double, ptr %15, align 8, !tbaa !11
  %84 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, double noundef %83)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %85

85:                                               ; preds = %78
  %86 = load i64, ptr %14, align 8, !tbaa !9
  %87 = add i64 %86, 1
  store i64 %87, ptr %14, align 8, !tbaa !9
  br label %73, !llvm.loop !13

88:                                               ; preds = %77
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %102, %88
  %91 = load i64, ptr %16, align 8, !tbaa !9
  %92 = load i64, ptr %13, align 8, !tbaa !9
  %93 = icmp ult i64 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %105

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = load double, ptr %96, align 8, !tbaa !11
  store double %97, ptr %17, align 8, !tbaa !11
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds i64, ptr %98, i32 1
  store ptr %99, ptr %3, align 8, !tbaa !5
  %100 = load double, ptr %17, align 8, !tbaa !11
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, double noundef %100)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br label %102

102:                                              ; preds = %95
  %103 = load i64, ptr %16, align 8, !tbaa !9
  %104 = add i64 %103, 1
  store i64 %104, ptr %16, align 8, !tbaa !9
  br label %90, !llvm.loop !15

105:                                              ; preds = %94
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %107

107:                                              ; preds = %105
  %108 = load i64, ptr %9, align 8, !tbaa !9
  %109 = add i64 %108, 1
  store i64 %109, ptr %9, align 8, !tbaa !9
  br label %44, !llvm.loop !16

110:                                              ; preds = %48
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %112

112:                                              ; preds = %110
  %113 = load i64, ptr %5, align 8, !tbaa !9
  %114 = add i64 %113, 1
  store i64 %114, ptr %5, align 8, !tbaa !9
  br label %26, !llvm.loop !17

115:                                              ; preds = %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

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 }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


; 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.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_basis_funcs_buffer(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load i64, ptr %0, align 8, !tbaa !5
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %2)
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %._crit_edge62, label %.lr.ph61.preheader

.lr.ph61.preheader:                               ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  br label %.lr.ph61

._crit_edge62:                                    ; preds = %._crit_edge56, %1
  ret void

.lr.ph61:                                         ; preds = %.lr.ph61.preheader, %._crit_edge56
  %.059 = phi ptr [ %.1.lcssa, %._crit_edge56 ], [ %5, %.lr.ph61.preheader ]
  %.04058 = phi i64 [ %13, %._crit_edge56 ], [ 0, %.lr.ph61.preheader ]
  %6 = load i64, ptr %.059, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %.059, i64 8
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %6)
  %9 = load i64, ptr %7, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %.059, i64 16
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %9)
  %.not63 = icmp eq i64 %9, 0
  br i1 %.not63, label %._crit_edge56, label %.lr.ph55

._crit_edge56:                                    ; preds = %._crit_edge50, %.lr.ph61
  %.1.lcssa = phi ptr [ %10, %.lr.ph61 ], [ %.3.lcssa, %._crit_edge50 ]
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %13 = add nuw i64 %.04058, 1
  %exitcond69.not = icmp eq i64 %13, %2
  br i1 %exitcond69.not, label %._crit_edge62, label %.lr.ph61, !llvm.loop !9

.lr.ph55:                                         ; preds = %.lr.ph61, %._crit_edge50
  %.153 = phi ptr [ %.3.lcssa, %._crit_edge50 ], [ %10, %.lr.ph61 ]
  %.04252 = phi i64 [ %32, %._crit_edge50 ], [ 0, %.lr.ph61 ]
  %14 = load i64, ptr %.153, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %.153, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %.153, i64 16
  %18 = load i64, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %.153, i64 24
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i64 noundef %14, i64 noundef %16, i64 noundef %18)
  %21 = load i64, ptr %19, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %.153, i64 32
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i64 noundef %21)
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %.not64 = icmp eq i64 %21, 0
  br i1 %.not64, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %.lr.ph55
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %._crit_edge50

.lr.ph49.preheader:                               ; preds = %.lr.ph
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %.lr.ph49

.lr.ph:                                           ; preds = %.lr.ph55, %.lr.ph
  %.245 = phi ptr [ %28, %.lr.ph ], [ %22, %.lr.ph55 ]
  %.04144 = phi i64 [ %30, %.lr.ph ], [ 0, %.lr.ph55 ]
  %27 = load double, ptr %.245, align 8, !tbaa !11
  %28 = getelementptr inbounds i8, ptr %.245, i64 8
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, double noundef %27)
  %30 = add nuw i64 %.04144, 1
  %exitcond.not = icmp eq i64 %30, %21
  br i1 %exitcond.not, label %.lr.ph49.preheader, label %.lr.ph, !llvm.loop !13

._crit_edge50:                                    ; preds = %.lr.ph49, %._crit_edge.thread
  %.3.lcssa = phi ptr [ %22, %._crit_edge.thread ], [ %34, %.lr.ph49 ]
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %32 = add nuw i64 %.04252, 1
  %exitcond68.not = icmp eq i64 %32, %9
  br i1 %exitcond68.not, label %._crit_edge56, label %.lr.ph55, !llvm.loop !14

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %.lr.ph49
  %.347 = phi ptr [ %34, %.lr.ph49 ], [ %28, %.lr.ph49.preheader ]
  %.03946 = phi i64 [ %36, %.lr.ph49 ], [ 0, %.lr.ph49.preheader ]
  %33 = load double, ptr %.347, align 8, !tbaa !11
  %34 = getelementptr inbounds i8, ptr %.347, i64 8
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, double noundef %33)
  %36 = add nuw i64 %.03946, 1
  %exitcond67.not = icmp eq i64 %36, %21
  br i1 %exitcond67.not, label %._crit_edge50, label %.lr.ph49, !llvm.loop !15
}

attributes #0 = { 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 #1 = { nofree 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" }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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