; LLVM IR from ggml-org/ggml :: examples/sam/main.ll (Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point)

; 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_init_params = type { i64, ptr, i8 }
%struct.sam_point = type { float, float }
%struct.prompt_encoder_result = type { ptr, ptr }
%struct.sam_state = type { ptr, ptr, ptr, ptr, %"class.std::vector", %"class.std::vector", %"class.std::vector", ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.sam_model = type { %struct.sam_hparams, %struct.sam_encoder_image, %struct.sam_encoder_prompt, %struct.sam_decoder_mask, ptr, %"class.std::map" }
%struct.sam_hparams = type { i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float }
%struct.sam_encoder_image = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::vector.9" }
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<sam_layer_enc, std::allocator<sam_layer_enc>>::_Vector_impl" }
%"struct.std::_Vector_base<sam_layer_enc, std::allocator<sam_layer_enc>>::_Vector_impl" = type { %"struct.std::_Vector_base<sam_layer_enc, std::allocator<sam_layer_enc>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sam_layer_enc, std::allocator<sam_layer_enc>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.sam_encoder_prompt = type { ptr, ptr, %"class.std::vector.14", ptr }
%"class.std::vector.14" = type { %"struct.std::_Vector_base.15" }
%"struct.std::_Vector_base.15" = type { %"struct.std::_Vector_base<ggml_tensor *, std::allocator<ggml_tensor *>>::_Vector_impl" }
%"struct.std::_Vector_base<ggml_tensor *, std::allocator<ggml_tensor *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ggml_tensor *, std::allocator<ggml_tensor *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ggml_tensor *, std::allocator<ggml_tensor *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.sam_decoder_mask = type { %"class.std::vector.19", %struct.sam_layer_dec_transformer_attn, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::vector.24", ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.std::vector.19" = type { %"struct.std::_Vector_base.20" }
%"struct.std::_Vector_base.20" = type { %"struct.std::_Vector_base<sam_layer_dec_transformer, std::allocator<sam_layer_dec_transformer>>::_Vector_impl" }
%"struct.std::_Vector_base<sam_layer_dec_transformer, std::allocator<sam_layer_dec_transformer>>::_Vector_impl" = type { %"struct.std::_Vector_base<sam_layer_dec_transformer, std::allocator<sam_layer_dec_transformer>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sam_layer_dec_transformer, std::allocator<sam_layer_dec_transformer>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.sam_layer_dec_transformer_attn = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.std::vector.24" = type { %"struct.std::_Vector_base.25" }
%"struct.std::_Vector_base.25" = type { %"struct.std::_Vector_base<sam_layer_dec_output_hypernet_mlps, std::allocator<sam_layer_dec_output_hypernet_mlps>>::_Vector_impl" }
%"struct.std::_Vector_base<sam_layer_dec_output_hypernet_mlps, std::allocator<sam_layer_dec_output_hypernet_mlps>>::_Vector_impl" = type { %"struct.std::_Vector_base<sam_layer_dec_output_hypernet_mlps, std::allocator<sam_layer_dec_output_hypernet_mlps>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sam_layer_dec_output_hypernet_mlps, std::allocator<sam_layer_dec_output_hypernet_mlps>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, ggml_tensor *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, ggml_tensor *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, ggml_tensor *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, ggml_tensor *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%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] }

@stderr = external global ptr, align 8
@.str.138 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [38 x i8], align 1
@__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point = external hidden unnamed_addr constant [21 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [27 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

; 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) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #5

declare ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8) #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52)) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z17sam_fill_dense_peRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(112)) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

declare ptr @ggml_new_graph(ptr noundef) #6

declare void @ggml_free(ptr noundef) #6

declare zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef, ptr noundef) #6

declare ptr @ggml_graph_get_tensor(ptr noundef, ptr noundef) #6

declare ptr @ggml_get_data(ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, ptr } @_Z17sam_encode_promptRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(112)) #7

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15sam_decode_maskRK9sam_modelRK21prompt_encoder_resultP11ggml_tensorP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(112)) #7

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull align 8 dereferenceable(112) %1, i32 noundef %2, i32 noundef %3, <2 x float> %4) #8 {
  %6 = alloca ptr, align 8
  %7 = alloca %struct.sam_point, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.ggml_init_params, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.ggml_init_params, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %struct.prompt_encoder_result, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca float, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca float, align 4
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca float, align 4
  %32 = alloca i32, align 4
  %33 = alloca float, align 4
  store <2 x float> %4, ptr %7, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #9
  %34 = getelementptr inbounds %struct.ggml_init_params, ptr %12, i32 0, i32 0
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.sam_state, ptr %35, i32 0, i32 6
  %37 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #9
  store i64 %37, ptr %34, align 8, !tbaa !11
  %38 = getelementptr inbounds %struct.ggml_init_params, ptr %12, i32 0, i32 1
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.sam_state, ptr %39, i32 0, i32 6
  %41 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #9
  store ptr %41, ptr %38, align 8, !tbaa !15
  %42 = getelementptr inbounds %struct.ggml_init_params, ptr %12, i32 0, i32 2
  store i8 1, ptr %42, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %12, i64 24, i1 false), !tbaa.struct !17
  %43 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %14)
  store ptr %43, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = call ptr @ggml_new_graph(ptr noundef %44)
  store ptr %45, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #9
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  %48 = load ptr, ptr %15, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = call { ptr, ptr } @_Z17sam_encode_promptRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496) %46, ptr noundef %47, ptr noundef %48, ptr noundef nonnull align 8 dereferenceable(112) %49)
  %51 = getelementptr inbounds { ptr, ptr }, ptr %16, i32 0, i32 0
  %52 = extractvalue { ptr, ptr } %50, 0
  store ptr %52, ptr %51, align 8
  %53 = getelementptr inbounds { ptr, ptr }, ptr %16, i32 0, i32 1
  %54 = extractvalue { ptr, ptr } %50, 1
  store ptr %54, ptr %53, align 8
  %55 = getelementptr inbounds %struct.prompt_encoder_result, ptr %16, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !20
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %62

58:                                               ; preds = %5
  %59 = getelementptr inbounds %struct.prompt_encoder_result, ptr %16, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  %61 = icmp ne ptr %60, null
  br i1 %61, label %71, label %62

62:                                               ; preds = %58, %5
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 0
  %65 = load float, ptr %64, align 4, !tbaa !23
  %66 = fpext float %65 to double
  %67 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 1
  %68 = load float, ptr %67, align 4, !tbaa !26
  %69 = fpext float %68 to double
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.149, ptr noundef @__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point, double noundef %66, double noundef %69) #9
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %231

71:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = load ptr, ptr %15, align 8, !tbaa !5
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = call noundef ptr @_Z17sam_fill_dense_peRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496) %72, ptr noundef %73, ptr noundef %74, ptr noundef nonnull align 8 dereferenceable(112) %75)
  store ptr %76, ptr %18, align 8, !tbaa !5
  %77 = load ptr, ptr %18, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %82, label %79

79:                                               ; preds = %71
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.150, ptr noundef @__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point) #9
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %230

82:                                               ; preds = %71
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load ptr, ptr %18, align 8, !tbaa !5
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = call noundef zeroext i1 @_Z15sam_decode_maskRK9sam_modelRK21prompt_encoder_resultP11ggml_tensorP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496) %83, ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef %84, ptr noundef %85, ptr noundef %86, ptr noundef nonnull align 8 dereferenceable(112) %87)
  br i1 %88, label %92, label %89

89:                                               ; preds = %82
  %90 = load ptr, ptr @stderr, align 8, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef @.str.151, ptr noundef @__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point) #9
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %230

92:                                               ; preds = %82
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ggml_free(ptr noundef %93)
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.sam_state, ptr %94, i32 0, i32 7
  %96 = load ptr, ptr %95, align 8, !tbaa !27
  %97 = load ptr, ptr %15, align 8, !tbaa !5
  %98 = call zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef %96, ptr noundef %97)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %100 = load i32, ptr %99, align 4, !tbaa !9
  store i32 %100, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.sam_model, ptr %101, i32 0, i32 0
  %103 = call noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52) %102)
  %104 = sitofp i32 %103 to float
  %105 = load i32, ptr %19, align 4, !tbaa !9
  %106 = sitofp i32 %105 to float
  %107 = fdiv float %104, %106
  store float %107, ptr %20, align 4, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = sitofp i32 %108 to float
  %110 = load float, ptr %20, align 4, !tbaa !33
  %111 = call float @llvm.fmuladd.f32(float %109, float %110, float 5.000000e-01)
  %112 = fptosi float %111 to i32
  store i32 %112, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = sitofp i32 %113 to float
  %115 = load float, ptr %20, align 4, !tbaa !33
  %116 = call float @llvm.fmuladd.f32(float %114, float %115, float 5.000000e-01)
  %117 = fptosi float %116 to i32
  store i32 %117, ptr %22, align 4, !tbaa !9
  %118 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 0
  %119 = load float, ptr %118, align 4, !tbaa !23
  %120 = load i32, ptr %21, align 4, !tbaa !9
  %121 = sitofp i32 %120 to float
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = sitofp i32 %122 to float
  %124 = fdiv float %121, %123
  %125 = call float @llvm.fmuladd.f32(float %119, float %124, float 5.000000e-01)
  %126 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 0
  store float %125, ptr %126, align 4, !tbaa !23
  %127 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 1
  %128 = load float, ptr %127, align 4, !tbaa !26
  %129 = load i32, ptr %22, align 4, !tbaa !9
  %130 = sitofp i32 %129 to float
  %131 = load i32, ptr %11, align 4, !tbaa !9
  %132 = sitofp i32 %131 to float
  %133 = fdiv float %130, %132
  %134 = call float @llvm.fmuladd.f32(float %128, float %133, float 5.000000e-01)
  %135 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 1
  store float %134, ptr %135, align 4, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = call ptr @ggml_graph_get_tensor(ptr noundef %136, ptr noundef @.str.142)
  store ptr %137, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  %138 = load ptr, ptr %23, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.ggml_tensor, ptr %138, i32 0, i32 10
  %140 = load ptr, ptr %139, align 8, !tbaa !34
  store ptr %140, ptr %24, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 0
  %142 = load float, ptr %141, align 4, !tbaa !23
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.sam_model, ptr %143, i32 0, i32 0
  %145 = call noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52) %144)
  %146 = sitofp i32 %145 to float
  %147 = fdiv float %142, %146
  %148 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %147, float -1.000000e+00)
  %149 = load ptr, ptr %24, align 8, !tbaa !5
  %150 = getelementptr inbounds float, ptr %149, i64 0
  store float %148, ptr %150, align 4, !tbaa !33
  %151 = getelementptr inbounds %struct.sam_point, ptr %7, i32 0, i32 1
  %152 = load float, ptr %151, align 4, !tbaa !26
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.sam_model, ptr %153, i32 0, i32 0
  %155 = call noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52) %154)
  %156 = sitofp i32 %155 to float
  %157 = fdiv float %152, %156
  %158 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %157, float -1.000000e+00)
  %159 = load ptr, ptr %24, align 8, !tbaa !5
  %160 = getelementptr inbounds float, ptr %159, i64 1
  store float %158, ptr %160, align 4, !tbaa !33
  %161 = load ptr, ptr %24, align 8, !tbaa !5
  %162 = getelementptr inbounds float, ptr %161, i64 2
  store float -1.000000e+00, ptr %162, align 4, !tbaa !33
  %163 = load ptr, ptr %24, align 8, !tbaa !5
  %164 = getelementptr inbounds float, ptr %163, i64 3
  store float -1.000000e+00, ptr %164, align 4, !tbaa !33
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  %165 = load ptr, ptr %15, align 8, !tbaa !5
  %166 = call ptr @ggml_graph_get_tensor(ptr noundef %165, ptr noundef @.str.138)
  store ptr %166, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #9
  %167 = load ptr, ptr %8, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.sam_model, ptr %167, i32 0, i32 0
  %169 = call noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52) %168)
  store i32 %169, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  %170 = load i32, ptr %26, align 4, !tbaa !9
  %171 = sitofp i32 %170 to float
  %172 = fdiv float 1.000000e+00, %171
  store float %172, ptr %27, align 4, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #9
  %173 = load ptr, ptr %25, align 8, !tbaa !5
  %174 = call ptr @ggml_get_data(ptr noundef %173)
  store ptr %174, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  store i32 0, ptr %29, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %225, %92
  %176 = load i32, ptr %29, align 4, !tbaa !9
  %177 = load i32, ptr %26, align 4, !tbaa !9
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  br label %228

180:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #9
  %181 = load i32, ptr %29, align 4, !tbaa !9
  %182 = mul nsw i32 2, %181
  %183 = load i32, ptr %26, align 4, !tbaa !9
  %184 = mul nsw i32 %182, %183
  store i32 %184, ptr %30, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #9
  %185 = load i32, ptr %29, align 4, !tbaa !9
  %186 = sitofp i32 %185 to float
  %187 = fadd float %186, 5.000000e-01
  %188 = fmul float 2.000000e+00, %187
  %189 = load float, ptr %27, align 4, !tbaa !33
  %190 = call float @llvm.fmuladd.f32(float %188, float %189, float -1.000000e+00)
  store float %190, ptr %31, align 4, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #9
  store i32 0, ptr %32, align 4, !tbaa !9
  br label %191

191:                                              ; preds = %221, %180
  %192 = load i32, ptr %32, align 4, !tbaa !9
  %193 = load i32, ptr %26, align 4, !tbaa !9
  %194 = icmp slt i32 %192, %193
  br i1 %194, label %196, label %195

195:                                              ; preds = %191
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #9
  br label %224

196:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #9
  %197 = load i32, ptr %32, align 4, !tbaa !9
  %198 = sitofp i32 %197 to float
  %199 = fadd float %198, 5.000000e-01
  %200 = fmul float 2.000000e+00, %199
  %201 = load float, ptr %27, align 4, !tbaa !33
  %202 = call float @llvm.fmuladd.f32(float %200, float %201, float -1.000000e+00)
  store float %202, ptr %33, align 4, !tbaa !33
  %203 = load float, ptr %33, align 4, !tbaa !33
  %204 = load ptr, ptr %28, align 8, !tbaa !5
  %205 = load i32, ptr %30, align 4, !tbaa !9
  %206 = load i32, ptr %32, align 4, !tbaa !9
  %207 = mul nsw i32 2, %206
  %208 = add nsw i32 %205, %207
  %209 = add nsw i32 %208, 0
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds float, ptr %204, i64 %210
  store float %203, ptr %211, align 4, !tbaa !33
  %212 = load float, ptr %31, align 4, !tbaa !33
  %213 = load ptr, ptr %28, align 8, !tbaa !5
  %214 = load i32, ptr %30, align 4, !tbaa !9
  %215 = load i32, ptr %32, align 4, !tbaa !9
  %216 = mul nsw i32 2, %215
  %217 = add nsw i32 %214, %216
  %218 = add nsw i32 %217, 1
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds float, ptr %213, i64 %219
  store float %212, ptr %220, align 4, !tbaa !33
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  br label %221

221:                                              ; preds = %196
  %222 = load i32, ptr %32, align 4, !tbaa !9
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %32, align 4, !tbaa !9
  br label %191, !llvm.loop !38

224:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #9
  br label %225

225:                                              ; preds = %224
  %226 = load i32, ptr %29, align 4, !tbaa !9
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %29, align 4, !tbaa !9
  br label %175, !llvm.loop !40

228:                                              ; preds = %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  %229 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %229, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %230

230:                                              ; preds = %228, %89, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %231

231:                                              ; preds = %230, %62
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #9
  %232 = load ptr, ptr %6, align 8
  ret ptr %232
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { "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 #7 = { mustprogress 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 #8 = { mustprogress uwtable "min-legal-vector-width"="64" "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 #9 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS16ggml_init_params", !13, i64 0, !6, i64 8, !14, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !14, i64 16}
!17 = !{i64 0, i64 8, !18, i64 8, i64 8, !5, i64 16, i64 1, !19}
!18 = !{!13, !13, i64 0}
!19 = !{!14, !14, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS21prompt_encoder_result", !6, i64 0, !6, i64 8}
!22 = !{!21, !6, i64 8}
!23 = !{!24, !25, i64 0}
!24 = !{!"_ZTS9sam_point", !25, i64 0, !25, i64 4}
!25 = !{!"float", !7, i64 0}
!26 = !{!24, !25, i64 4}
!27 = !{!28, !6, i64 104}
!28 = !{!"_ZTS9sam_state", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !29, i64 32, !29, i64 56, !29, i64 80, !6, i64 104}
!29 = !{!"_ZTSSt6vectorIhSaIhEE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!33 = !{!25, !25, i64 0}
!34 = !{!35, !6, i64 248}
!35 = !{!"_ZTS11ggml_tensor", !36, i64 0, !6, i64 8, !7, i64 16, !7, i64 48, !37, i64 80, !7, i64 84, !10, i64 148, !7, i64 152, !6, i64 232, !13, i64 240, !6, i64 248, !7, i64 256, !6, i64 320, !7, i64 328}
!36 = !{!"_ZTS9ggml_type", !7, i64 0}
!37 = !{!"_ZTS7ggml_op", !7, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = distinct !{!40, !39}


; 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.ggml_init_params = type { i64, ptr, i8 }
%struct.prompt_encoder_result = type { ptr, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.138 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [38 x i8], align 1
@__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point = external hidden unnamed_addr constant [21 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [27 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

declare ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z17sam_fill_dense_peRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

declare ptr @ggml_new_graph(ptr noundef) local_unnamed_addr #5

declare void @ggml_free(ptr noundef) local_unnamed_addr #5

declare zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef, ptr noundef) local_unnamed_addr #5

declare ptr @ggml_graph_get_tensor(ptr noundef, ptr noundef) local_unnamed_addr #5

declare ptr @ggml_get_data(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, ptr } @_Z17sam_encode_promptRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15sam_decode_maskRK9sam_modelRK21prompt_encoder_resultP11ggml_tensorP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull align 8 dereferenceable(112) %1, i32 noundef %2, i32 noundef %3, <2 x float> %4) local_unnamed_addr #7 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.ggml_init_params, align 8
  %9 = alloca %struct.prompt_encoder_result, align 8
  store i32 %2, ptr %6, align 4, !tbaa !5
  store i32 %3, ptr %7, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 80
  %11 = tail call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #9
  %12 = tail call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #9
  store i64 %11, ptr %8, align 8, !tbaa !9
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  store ptr %12, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !11
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 16
  store i8 1, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !13
  %13 = tail call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %8)
  %14 = tail call ptr @ggml_new_graph(ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  %15 = tail call { ptr, ptr } @_Z17sam_encode_promptRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef %13, ptr noundef %14, ptr noundef nonnull align 8 dereferenceable(112) %1)
  %16 = extractvalue { ptr, ptr } %15, 0
  store ptr %16, ptr %9, align 8
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  %18 = extractvalue { ptr, ptr } %15, 1
  store ptr %18, ptr %17, align 8
  %19 = icmp ne ptr %16, null
  %20 = icmp ne ptr %18, null
  %or.cond = select i1 %19, i1 %20, i1 false
  br i1 %or.cond, label %26, label %21

21:                                               ; preds = %5
  %22 = load ptr, ptr @stderr, align 8, !tbaa !11
  %.sroa.060.0.vec.extract = extractelement <2 x float> %4, i64 0
  %23 = fpext float %.sroa.060.0.vec.extract to double
  %.sroa.060.4.vec.extract = extractelement <2 x float> %4, i64 1
  %24 = fpext float %.sroa.060.4.vec.extract to double
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.149, ptr noundef nonnull @__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point, double noundef %23, double noundef %24) #10
  br label %.loopexit

26:                                               ; preds = %5
  %27 = tail call noundef ptr @_Z17sam_fill_dense_peRK9sam_modelP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef %13, ptr noundef %14, ptr noundef nonnull align 8 dereferenceable(112) %1)
  %.not = icmp eq ptr %27, null
  br i1 %.not, label %28, label %31

28:                                               ; preds = %26
  %29 = load ptr, ptr @stderr, align 8, !tbaa !11
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.150, ptr noundef nonnull @__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point) #10
  br label %.loopexit

31:                                               ; preds = %26
  %32 = call noundef zeroext i1 @_Z15sam_decode_maskRK9sam_modelRK21prompt_encoder_resultP11ggml_tensorP12ggml_contextP11ggml_cgraphR9sam_state(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull %27, ptr noundef %13, ptr noundef %14, ptr noundef nonnull align 8 dereferenceable(112) %1)
  br i1 %32, label %36, label %33

33:                                               ; preds = %31
  %34 = load ptr, ptr @stderr, align 8, !tbaa !11
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.151, ptr noundef nonnull @__func__._Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point) #10
  br label %.loopexit

36:                                               ; preds = %31
  call void @ggml_free(ptr noundef %13)
  %37 = getelementptr inbounds i8, ptr %1, i64 104
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = call zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef %38, ptr noundef %14)
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = call noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52) %0)
  %43 = sitofp i32 %42 to float
  %44 = sitofp i32 %41 to float
  %45 = fdiv float %43, %44
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = sitofp i32 %46 to float
  %48 = call float @llvm.fmuladd.f32(float %47, float %45, float 5.000000e-01)
  %49 = fptosi float %48 to i32
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = sitofp i32 %50 to float
  %52 = call float @llvm.fmuladd.f32(float %51, float %45, float 5.000000e-01)
  %53 = fptosi float %52 to i32
  %.sroa.060.0.vec.extract62 = extractelement <2 x float> %4, i64 0
  %54 = sitofp i32 %49 to float
  %55 = fdiv float %54, %47
  %56 = call float @llvm.fmuladd.f32(float %.sroa.060.0.vec.extract62, float %55, float 5.000000e-01)
  %.sroa.060.4.vec.extract67 = extractelement <2 x float> %4, i64 1
  %57 = sitofp i32 %53 to float
  %58 = fdiv float %57, %51
  %59 = call float @llvm.fmuladd.f32(float %.sroa.060.4.vec.extract67, float %58, float 5.000000e-01)
  %60 = call ptr @ggml_graph_get_tensor(ptr noundef %14, ptr noundef nonnull @.str.142)
  %61 = getelementptr inbounds i8, ptr %60, i64 248
  %62 = load ptr, ptr %61, align 8, !tbaa !21
  %63 = call noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52) %0)
  %64 = sitofp i32 %63 to float
  %65 = fdiv float %56, %64
  %66 = call float @llvm.fmuladd.f32(float %65, float 2.000000e+00, float -1.000000e+00)
  store float %66, ptr %62, align 4, !tbaa !25
  %67 = call noundef i32 @_ZNK11sam_hparams10n_img_sizeEv(ptr noundef nonnull align 4 dereferenceable(52) %0)
  %68 = sitofp i32 %67 to float
  %69 = fdiv float %59, %68
  %70 = call float @llvm.fmuladd.f32(float %69, float 2.000000e+00, float -1.000000e+00)
  %71 = getelementptr inbounds i8, ptr %62, i64 4
  store float %70, ptr %71, align 4, !tbaa !25
  %72 = getelementptr inbounds i8, ptr %62, i64 8
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %72, align 4, !tbaa !25
  %73 = call ptr @ggml_graph_get_tensor(ptr noundef %14, ptr noundef nonnull @.str.138)
  %74 = call noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52) %0)
  %75 = sitofp i32 %74 to float
  %76 = fdiv float 1.000000e+00, %75
  %77 = call ptr @ggml_get_data(ptr noundef %73)
  %78 = icmp sgt i32 %74, 0
  br i1 %78, label %.lr.ph79, label %.loopexit

.lr.ph79:                                         ; preds = %36
  %79 = shl nuw i32 %74, 1
  %wide.trip.count84 = zext nneg i32 %74 to i64
  %min.iters.check = icmp ult i32 %74, 4
  %n.vec = and i64 %wide.trip.count84, 2147483644
  %broadcast.splatinsert = insertelement <4 x float> poison, float %76, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %invariant.gep = getelementptr i8, ptr %77, i64 -4
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count84
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %._crit_edge.us, %.lr.ph79
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %._crit_edge.us ], [ 0, %.lr.ph79 ]
  %80 = trunc nuw nsw i64 %indvars.iv81 to i32
  %81 = mul i32 %79, %80
  %82 = uitofp nneg i32 %80 to float
  %83 = fadd float %82, 5.000000e-01
  %84 = fmul float %83, 2.000000e+00
  %85 = call float @llvm.fmuladd.f32(float %84, float %76, float -1.000000e+00)
  %86 = sext i32 %81 to i64
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.us
  %broadcast.splatinsert86 = insertelement <4 x float> poison, float %85, i64 0
  %broadcast.splat87 = shufflevector <4 x float> %broadcast.splatinsert86, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %87 = uitofp <4 x i32> %vec.ind to <4 x float>
  %88 = fadd <4 x float> %87, <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>
  %89 = fmul <4 x float> %88, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
  %90 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %89, <4 x float> %broadcast.splat, <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>)
  %91 = shl nuw nsw i64 %index, 1
  %92 = add nsw i64 %91, %86
  %93 = or disjoint i64 %92, 1
  %gep = getelementptr float, ptr %invariant.gep, i64 %93
  %interleaved.vec = shufflevector <4 x float> %90, <4 x float> %broadcast.splat87, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
  store <8 x float> %interleaved.vec, ptr %gep, align 4, !tbaa !25
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %94 = icmp eq i64 %index.next, %n.vec
  br i1 %94, label %middle.block, label %vector.body, !llvm.loop !27

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph.us
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.us ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %95 = trunc nuw nsw i64 %indvars.iv to i32
  %96 = uitofp nneg i32 %95 to float
  %97 = fadd float %96, 5.000000e-01
  %98 = fmul float %97, 2.000000e+00
  %99 = call float @llvm.fmuladd.f32(float %98, float %76, float -1.000000e+00)
  %100 = shl nuw nsw i64 %indvars.iv, 1
  %101 = add nsw i64 %100, %86
  %102 = getelementptr inbounds float, ptr %77, i64 %101
  store float %99, ptr %102, align 4, !tbaa !25
  %103 = or disjoint i64 %101, 1
  %104 = getelementptr inbounds float, ptr %77, i64 %103
  store float %85, ptr %104, align 4, !tbaa !25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count84
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph, !llvm.loop !31

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
  br i1 %exitcond85.not, label %.loopexit, label %.lr.ph.us, !llvm.loop !32

.loopexit:                                        ; preds = %._crit_edge.us, %36, %28, %33, %21
  %.1 = phi ptr [ null, %21 ], [ null, %33 ], [ null, %28 ], [ %14, %36 ], [ %14, %._crit_edge.us ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  ret ptr %.1
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>) #8

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 = { inlinehint mustprogress 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { "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 = { mustprogress 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 #7 = { mustprogress uwtable "min-legal-vector-width"="64" "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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { cold 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !12, i64 104}
!16 = !{!"_ZTS9sam_state", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !17, i64 32, !17, i64 56, !17, i64 80, !12, i64 104}
!17 = !{!"_ZTSSt6vectorIhSaIhEE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!21 = !{!22, !12, i64 248}
!22 = !{!"_ZTS11ggml_tensor", !23, i64 0, !12, i64 8, !7, i64 16, !7, i64 48, !24, i64 80, !7, i64 84, !6, i64 148, !7, i64 152, !12, i64 232, !10, i64 240, !12, i64 248, !7, i64 256, !12, i64 320, !7, i64 328}
!23 = !{!"_ZTS9ggml_type", !7, i64 0}
!24 = !{!"_ZTS7ggml_op", !7, i64 0}
!25 = !{!26, !26, i64 0}
!26 = !{!"float", !7, i64 0}
!27 = distinct !{!27, !28, !29, !30}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!"llvm.loop.isvectorized", i32 1}
!30 = !{!"llvm.loop.unroll.runtime.disable"}
!31 = distinct !{!31, !28, !30, !29}
!32 = distinct !{!32, !28}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass