; LLVM IR from ggml-org/ggml :: tests (test-rel-pos)

; 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.ggml_tensor = type { i32, ptr, [4 x i64], [4 x i64], i32, [16 x i32], i32, [10 x ptr], ptr, i64, ptr, [64 x i8], ptr, [8 x i8] }

@__const.main.expected_out = external hidden unnamed_addr constant [4 x [9 x float]], align 16

; Function Attrs: nounwind uwtable
declare dso_local ptr @make_ctx() #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [1024 x i16], align 16
  %7 = alloca i32, align 4
  %8 = alloca [4 x [9 x float]], align 16
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2048, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %37, %2
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = icmp slt i32 %27, 1024
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %40

30:                                               ; preds = %26
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sitofp i32 %31 to float
  %33 = call zeroext i16 @ggml_fp32_to_fp16(float noundef %32)
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1024 x i16], ptr %6, i64 0, i64 %35
  store i16 %33, ptr %36, align 2, !tbaa !11
  br label %37

37:                                               ; preds = %30
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %7, align 4, !tbaa !5
  br label %26, !llvm.loop !13

40:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 144, ptr %8) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %8, ptr align 16 @__const.main.expected_out, i64 144, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %41 = call ptr @make_ctx()
  store ptr %41, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %42 = load ptr, ptr %9, align 8, !tbaa !9
  %43 = call ptr @ggml_new_tensor_2d(ptr noundef %42, i32 noundef 1, i64 noundef 3, i64 noundef 3)
  store ptr %43, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %44 = load ptr, ptr %10, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.ggml_tensor, ptr %44, i32 0, i32 10
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  store ptr %46, ptr %11, align 8, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !9
  %48 = getelementptr inbounds [1024 x i16], ptr %6, i64 0, i64 0
  %49 = load ptr, ptr %10, align 8, !tbaa !9
  %50 = call i64 @ggml_nbytes(ptr noundef %49)
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %47, ptr align 16 %48, i64 %50, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %51 = load ptr, ptr %9, align 8, !tbaa !9
  %52 = call ptr @ggml_new_tensor_2d(ptr noundef %51, i32 noundef 1, i64 noundef 3, i64 noundef 3)
  store ptr %52, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.ggml_tensor, ptr %53, i32 0, i32 10
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  store ptr %55, ptr %13, align 8, !tbaa !9
  %56 = load ptr, ptr %13, align 8, !tbaa !9
  %57 = getelementptr inbounds [1024 x i16], ptr %6, i64 0, i64 0
  %58 = getelementptr inbounds i16, ptr %57, i64 1
  %59 = load ptr, ptr %12, align 8, !tbaa !9
  %60 = call i64 @ggml_nbytes(ptr noundef %59)
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %56, ptr align 2 %58, i64 %60, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %61 = load ptr, ptr %9, align 8, !tbaa !9
  %62 = load ptr, ptr %10, align 8, !tbaa !9
  %63 = call ptr @ggml_get_rel_pos(ptr noundef %61, ptr noundef %62, i32 noundef 2, i32 noundef 2)
  store ptr %63, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %64 = load ptr, ptr %9, align 8, !tbaa !9
  %65 = load ptr, ptr %12, align 8, !tbaa !9
  %66 = call ptr @ggml_get_rel_pos(ptr noundef %64, ptr noundef %65, i32 noundef 2, i32 noundef 2)
  store ptr %66, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %67 = load ptr, ptr %9, align 8, !tbaa !9
  %68 = load ptr, ptr %14, align 8, !tbaa !9
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = call ptr @ggml_new_tensor_3d(ptr noundef %69, i32 noundef 0, i64 noundef 3, i64 noundef 2, i64 noundef 2)
  %71 = call ptr @ggml_cpy(ptr noundef %67, ptr noundef %68, ptr noundef %70)
  store ptr %71, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %72 = load ptr, ptr %9, align 8, !tbaa !9
  %73 = load ptr, ptr %15, align 8, !tbaa !9
  %74 = load ptr, ptr %9, align 8, !tbaa !9
  %75 = call ptr @ggml_new_tensor_3d(ptr noundef %74, i32 noundef 0, i64 noundef 3, i64 noundef 2, i64 noundef 2)
  %76 = call ptr @ggml_cpy(ptr noundef %72, ptr noundef %73, ptr noundef %75)
  store ptr %76, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %77 = load ptr, ptr %9, align 8, !tbaa !9
  %78 = call ptr @ggml_new_tensor_2d(ptr noundef %77, i32 noundef 0, i64 noundef 9, i64 noundef 4)
  store ptr %78, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %79 = load ptr, ptr %9, align 8, !tbaa !9
  %80 = call ptr @ggml_new_tensor_2d(ptr noundef %79, i32 noundef 0, i64 noundef 9, i64 noundef 4)
  store ptr %80, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %81 = load ptr, ptr %18, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.ggml_tensor, ptr %81, i32 0, i32 10
  %83 = load ptr, ptr %82, align 8, !tbaa !15
  store ptr %83, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %84 = load ptr, ptr %19, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.ggml_tensor, ptr %84, i32 0, i32 10
  %86 = load ptr, ptr %85, align 8, !tbaa !15
  store ptr %86, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %103, %40
  %88 = load i32, ptr %22, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = load ptr, ptr %18, align 8, !tbaa !9
  %91 = call i64 @ggml_nelements(ptr noundef %90)
  %92 = icmp slt i64 %89, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %106

94:                                               ; preds = %87
  %95 = load ptr, ptr %20, align 8, !tbaa !9
  %96 = load i32, ptr %22, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds float, ptr %95, i64 %97
  store float 1.000000e+00, ptr %98, align 4, !tbaa !18
  %99 = load ptr, ptr %21, align 8, !tbaa !9
  %100 = load i32, ptr %22, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds float, ptr %99, i64 %101
  store float 1.000000e+00, ptr %102, align 4, !tbaa !18
  br label %103

103:                                              ; preds = %94
  %104 = load i32, ptr %22, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %22, align 4, !tbaa !5
  br label %87, !llvm.loop !20

106:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %107 = load ptr, ptr %9, align 8, !tbaa !9
  %108 = load ptr, ptr %18, align 8, !tbaa !9
  %109 = load ptr, ptr %16, align 8, !tbaa !9
  %110 = load ptr, ptr %17, align 8, !tbaa !9
  %111 = call ptr @ggml_add_rel_pos(ptr noundef %107, ptr noundef %108, ptr noundef %109, ptr noundef %110)
  store ptr %111, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %112 = load ptr, ptr %9, align 8, !tbaa !9
  %113 = call ptr @ggml_new_graph(ptr noundef %112)
  store ptr %113, ptr %24, align 8, !tbaa !9
  %114 = load ptr, ptr %24, align 8, !tbaa !9
  %115 = load ptr, ptr %23, align 8, !tbaa !9
  call void @ggml_build_forward_expand(ptr noundef %114, ptr noundef %115)
  %116 = load ptr, ptr %9, align 8, !tbaa !9
  %117 = load ptr, ptr %24, align 8, !tbaa !9
  %118 = call i32 @ggml_graph_compute_with_ctx(ptr noundef %116, ptr noundef %117, i32 noundef 1)
  %119 = load ptr, ptr %9, align 8, !tbaa !9
  %120 = load ptr, ptr %19, align 8, !tbaa !9
  %121 = load ptr, ptr %16, align 8, !tbaa !9
  %122 = load ptr, ptr %17, align 8, !tbaa !9
  %123 = call ptr @ggml_add_rel_pos_inplace(ptr noundef %119, ptr noundef %120, ptr noundef %121, ptr noundef %122)
  store ptr %123, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %124 = load ptr, ptr %9, align 8, !tbaa !9
  %125 = call ptr @ggml_new_graph(ptr noundef %124)
  store ptr %125, ptr %25, align 8, !tbaa !9
  %126 = load ptr, ptr %25, align 8, !tbaa !9
  %127 = load ptr, ptr %19, align 8, !tbaa !9
  call void @ggml_build_forward_expand(ptr noundef %126, ptr noundef %127)
  %128 = load ptr, ptr %9, align 8, !tbaa !9
  %129 = load ptr, ptr %25, align 8, !tbaa !9
  %130 = call i32 @ggml_graph_compute_with_ctx(ptr noundef %128, ptr noundef %129, i32 noundef 1)
  %131 = load ptr, ptr %23, align 8, !tbaa !9
  %132 = getelementptr inbounds [4 x [9 x float]], ptr %8, i64 0, i64 0
  call void @check_tensor(ptr noundef %131, ptr noundef %132, i32 noundef 9, i32 noundef 4, i32 noundef 1)
  %133 = load ptr, ptr %19, align 8, !tbaa !9
  %134 = getelementptr inbounds [4 x [9 x float]], ptr %8, i64 0, i64 0
  call void @check_tensor(ptr noundef %133, ptr noundef %134, i32 noundef 9, i32 noundef 4, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 144, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr %6) #4
  ret i32 0
}

declare zeroext i16 @ggml_fp32_to_fp16(float noundef) #3

declare ptr @ggml_new_tensor_2d(ptr noundef, i32 noundef, i64 noundef, i64 noundef) #3

declare i64 @ggml_nbytes(ptr noundef) #3

declare ptr @ggml_get_rel_pos(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

declare ptr @ggml_cpy(ptr noundef, ptr noundef, ptr noundef) #3

declare ptr @ggml_new_tensor_3d(ptr noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef) #3

declare i64 @ggml_nelements(ptr noundef) #3

declare ptr @ggml_add_rel_pos(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare ptr @ggml_new_graph(ptr noundef) #3

declare void @ggml_build_forward_expand(ptr noundef, ptr noundef) #3

declare i32 @ggml_graph_compute_with_ctx(ptr noundef, ptr noundef, i32 noundef) #3

declare ptr @ggml_add_rel_pos_inplace(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 248}
!16 = !{!"ggml_tensor", !6, i64 0, !10, i64 8, !7, i64 16, !7, i64 48, !6, i64 80, !7, i64 84, !6, i64 148, !7, i64 152, !10, i64 232, !17, i64 240, !10, i64 248, !7, i64 256, !10, i64 320, !7, i64 328}
!17 = !{!"long", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = distinct !{!20, !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"

@__const.main.expected_out = external hidden unnamed_addr constant [4 x [9 x float]], align 16

; Function Attrs: nounwind uwtable
declare dso_local ptr @make_ctx() 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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca [1024 x i16], align 16
  %4 = alloca [4 x [9 x float]], align 16
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %3) #4
  br label %30

5:                                                ; preds = %30
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %4) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(144) %4, ptr noundef nonnull align 16 dereferenceable(144) @__const.main.expected_out, i64 144, i1 false)
  %6 = tail call ptr @make_ctx()
  %7 = tail call ptr @ggml_new_tensor_2d(ptr noundef %6, i32 noundef 1, i64 noundef 3, i64 noundef 3) #4
  %8 = getelementptr inbounds i8, ptr %7, i64 248
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call i64 @ggml_nbytes(ptr noundef %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %9, ptr nonnull align 16 %3, i64 %10, i1 false)
  %11 = tail call ptr @ggml_new_tensor_2d(ptr noundef %6, i32 noundef 1, i64 noundef 3, i64 noundef 3) #4
  %12 = getelementptr inbounds i8, ptr %11, i64 248
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %3, i64 2
  %15 = tail call i64 @ggml_nbytes(ptr noundef %11) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %13, ptr nonnull align 2 %14, i64 %15, i1 false)
  %16 = tail call ptr @ggml_get_rel_pos(ptr noundef %6, ptr noundef %7, i32 noundef 2, i32 noundef 2) #4
  %17 = tail call ptr @ggml_get_rel_pos(ptr noundef %6, ptr noundef %11, i32 noundef 2, i32 noundef 2) #4
  %18 = tail call ptr @ggml_new_tensor_3d(ptr noundef %6, i32 noundef 0, i64 noundef 3, i64 noundef 2, i64 noundef 2) #4
  %19 = tail call ptr @ggml_cpy(ptr noundef %6, ptr noundef %16, ptr noundef %18) #4
  %20 = tail call ptr @ggml_new_tensor_3d(ptr noundef %6, i32 noundef 0, i64 noundef 3, i64 noundef 2, i64 noundef 2) #4
  %21 = tail call ptr @ggml_cpy(ptr noundef %6, ptr noundef %17, ptr noundef %20) #4
  %22 = tail call ptr @ggml_new_tensor_2d(ptr noundef %6, i32 noundef 0, i64 noundef 9, i64 noundef 4) #4
  %23 = tail call ptr @ggml_new_tensor_2d(ptr noundef %6, i32 noundef 0, i64 noundef 9, i64 noundef 4) #4
  %24 = getelementptr inbounds i8, ptr %22, i64 248
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %23, i64 248
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = tail call i64 @ggml_nelements(ptr noundef %22) #4
  %29 = icmp sgt i64 %28, 0
  br i1 %29, label %.lr.ph, label %._crit_edge

30:                                               ; preds = %2, %30
  %indvars.iv = phi i64 [ 0, %2 ], [ %indvars.iv.next, %30 ]
  %31 = trunc nuw nsw i64 %indvars.iv to i32
  %32 = uitofp nneg i32 %31 to float
  %33 = tail call zeroext i16 @ggml_fp32_to_fp16(float noundef %32) #4
  %34 = getelementptr inbounds [1024 x i16], ptr %3, i64 0, i64 %indvars.iv
  store i16 %33, ptr %34, align 2, !tbaa !12
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1024
  br i1 %exitcond.not, label %5, label %30, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %5
  %35 = tail call ptr @ggml_add_rel_pos(ptr noundef %6, ptr noundef %22, ptr noundef %19, ptr noundef %21) #4
  %36 = tail call ptr @ggml_new_graph(ptr noundef %6) #4
  tail call void @ggml_build_forward_expand(ptr noundef %36, ptr noundef %35) #4
  %37 = tail call i32 @ggml_graph_compute_with_ctx(ptr noundef %6, ptr noundef %36, i32 noundef 1) #4
  %38 = tail call ptr @ggml_add_rel_pos_inplace(ptr noundef %6, ptr noundef %23, ptr noundef %19, ptr noundef %21) #4
  %39 = tail call ptr @ggml_new_graph(ptr noundef %6) #4
  tail call void @ggml_build_forward_expand(ptr noundef %39, ptr noundef %38) #4
  %40 = tail call i32 @ggml_graph_compute_with_ctx(ptr noundef %6, ptr noundef %39, i32 noundef 1) #4
  call void @check_tensor(ptr noundef %35, ptr noundef nonnull %4, i32 noundef 9, i32 noundef 4, i32 noundef 1)
  call void @check_tensor(ptr noundef %38, ptr noundef nonnull %4, i32 noundef 9, i32 noundef 4, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %3) #4
  ret i32 0

.lr.ph:                                           ; preds = %5, %.lr.ph
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.lr.ph ], [ 0, %5 ]
  %41 = getelementptr inbounds float, ptr %25, i64 %indvars.iv57
  store float 1.000000e+00, ptr %41, align 4, !tbaa !16
  %42 = getelementptr inbounds float, ptr %27, i64 %indvars.iv57
  store float 1.000000e+00, ptr %42, align 4, !tbaa !16
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %43 = tail call i64 @ggml_nelements(ptr noundef %22) #4
  %44 = icmp sgt i64 %43, %indvars.iv.next58
  br i1 %44, label %.lr.ph, label %._crit_edge, !llvm.loop !18
}

declare zeroext i16 @ggml_fp32_to_fp16(float noundef) local_unnamed_addr #3

declare ptr @ggml_new_tensor_2d(ptr noundef, i32 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

declare i64 @ggml_nbytes(ptr noundef) local_unnamed_addr #3

declare ptr @ggml_get_rel_pos(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare ptr @ggml_cpy(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @ggml_new_tensor_3d(ptr noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

declare i64 @ggml_nelements(ptr noundef) local_unnamed_addr #3

declare ptr @ggml_add_rel_pos(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @ggml_new_graph(ptr noundef) local_unnamed_addr #3

declare void @ggml_build_forward_expand(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @ggml_graph_compute_with_ctx(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @ggml_add_rel_pos_inplace(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 248}
!6 = !{!"ggml_tensor", !7, i64 0, !10, i64 8, !8, i64 16, !8, i64 48, !7, i64 80, !8, i64 84, !7, i64 148, !8, i64 152, !10, i64 232, !11, i64 240, !10, i64 248, !8, i64 256, !10, i64 320, !8, i64 328}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = distinct !{!18, !15}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass