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

; 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_params = type { i32, i32, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", float, float, float, float, float, float, %struct.sam_point }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.sam_point = type { float, float }
%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.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_image_u8 = type { i32, i32, %"class.std::vector" }
%struct.sam_image_f32 = type { i32, i32, %"class.std::vector.3" }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str.208 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.209 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.210 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.211 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.212 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.213 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.214 = external hidden unnamed_addr constant [36 x i8], align 1
@_ZZ4mainE8buf_size = external hidden global i64, align 8
@.str.215 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.216 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.217 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.218 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.219 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.220 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.221 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.222 = external hidden unnamed_addr constant [30 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: mustprogress uwtable
declare dso_local void @_Z11print_t_f32PKcP11ggml_tensori(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z24sam_image_load_from_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12sam_image_u8(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z20sam_image_preprocessRK12sam_image_u8R13sam_image_f32(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z14sam_model_loadRK10sam_paramsR9sam_model(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(496)) #2

declare i32 @__gxx_personality_v0(...)

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

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

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

declare ptr @ggml_new_tensor_1d(ptr noundef, i32 noundef, i64 noundef) #5

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

declare void @ggml_free(ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15sam_write_masksRK11sam_hparamsiiRK9sam_stateRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 4 dereferenceable(52), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(112), ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN12sam_image_u8C2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN12sam_image_u8D2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef nonnull align 8 dereferenceable(112), i32 noundef, i32 noundef, <2 x float>) #7

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z16sam_params_parseiPPcR10sam_params(i32 noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(136)) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #2 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #8 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %struct.sam_params, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.sam_model, align 8
  %11 = alloca %struct.sam_state, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.sam_image_u8, align 8
  %15 = alloca %struct.sam_image_f32, align 8
  %16 = alloca i64, align 8
  %17 = alloca %struct.ggml_init_params, align 8
  %18 = alloca %struct.ggml_init_params, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct.sam_point, align 4
  %22 = alloca i64, 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 8, ptr %6) #10
  %23 = call i64 @ggml_time_us()
  store i64 %23, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 136, ptr %7) #10
  call void @_ZN10sam_paramsC2Ev(ptr noundef nonnull align 8 dereferenceable(136) %7)
  %24 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 2
  %25 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef @.str.208)
          to label %26 unwind label %34

26:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 496, ptr %10) #10
  call void @_ZN9sam_modelC2Ev(ptr noundef nonnull align 8 dereferenceable(496) %10) #10
  call void @llvm.lifetime.start.p0(i64 112, ptr %11) #10
  call void @_ZN9sam_stateC2Ev(ptr noundef nonnull align 8 dereferenceable(112) %11) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #10
  store i64 0, ptr %12, align 8, !tbaa !11
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = invoke noundef zeroext i1 @_Z16sam_params_parseiPPcR10sam_params(i32 noundef %27, ptr noundef %28, ptr noundef nonnull align 8 dereferenceable(136) %7)
          to label %30 unwind label %38

30:                                               ; preds = %26
  %31 = zext i1 %29 to i32
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %42

33:                                               ; preds = %30
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %294

34:                                               ; preds = %2
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  br label %297

38:                                               ; preds = %26
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %8, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %9, align 4
  br label %296

42:                                               ; preds = %30
  %43 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 0
  %44 = load i32, ptr %43, align 8, !tbaa !13
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %42
  %47 = call i64 @time(ptr noundef null) #10
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 0
  store i32 %48, ptr %49, align 8, !tbaa !13
  br label %50

50:                                               ; preds = %46, %42
  %51 = load ptr, ptr @stderr, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !13
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str.209, ptr noundef @__func__.main, i32 noundef %53) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #10
  call void @_ZN12sam_image_u8C2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #10
  %55 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 3
  %56 = invoke noundef zeroext i1 @_Z24sam_image_load_from_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12sam_image_u8(ptr noundef nonnull align 8 dereferenceable(32) %55, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %57 unwind label %63

57:                                               ; preds = %50
  br i1 %56, label %67, label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr @stderr, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 3
  %61 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %60) #10
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.210, ptr noundef @__func__.main, ptr noundef %61) #10
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %292

63:                                               ; preds = %50
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %8, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %9, align 4
  br label %293

67:                                               ; preds = %57
  %68 = load ptr, ptr @stderr, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 3
  %70 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %69) #10
  %71 = getelementptr inbounds %struct.sam_image_u8, ptr %14, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !19
  %73 = getelementptr inbounds %struct.sam_image_u8, ptr %14, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !25
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.211, ptr noundef @__func__.main, ptr noundef %70, i32 noundef %72, i32 noundef %74) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #10
  call void @_ZN13sam_image_f32C2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #10
  %76 = invoke noundef zeroext i1 @_Z20sam_image_preprocessRK12sam_image_u8R13sam_image_f32(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %77 unwind label %81

77:                                               ; preds = %67
  br i1 %76, label %85, label %78

78:                                               ; preds = %77
  %79 = load ptr, ptr @stderr, align 8, !tbaa !9
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.212, ptr noundef @__func__.main) #10
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %290

81:                                               ; preds = %266, %252, %209, %207, %205, %202, %199, %164, %162, %160, %157, %153, %67
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %8, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %9, align 4
  br label %291

85:                                               ; preds = %77
  %86 = load ptr, ptr @stderr, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.sam_image_f32, ptr %15, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !26
  %89 = getelementptr inbounds %struct.sam_image_f32, ptr %15, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !32
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.213, ptr noundef @__func__.main, i32 noundef %88, i32 noundef %90) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #10
  %92 = invoke i64 @ggml_time_us()
          to label %93 unwind label %101

93:                                               ; preds = %85
  store i64 %92, ptr %16, align 8, !tbaa !11
  %94 = invoke noundef zeroext i1 @_Z14sam_model_loadRK10sam_paramsR9sam_model(ptr noundef nonnull align 8 dereferenceable(136) %7, ptr noundef nonnull align 8 dereferenceable(496) %10)
          to label %95 unwind label %101

95:                                               ; preds = %93
  br i1 %94, label %105, label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr @stderr, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 2
  %99 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %98) #10
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %97, ptr noundef @.str.214, ptr noundef @__func__.main, ptr noundef %99) #10
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %110

101:                                              ; preds = %105, %93, %85
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %8, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #10
  br label %291

105:                                              ; preds = %95
  %106 = invoke i64 @ggml_time_us()
          to label %107 unwind label %101

107:                                              ; preds = %105
  %108 = load i64, ptr %16, align 8, !tbaa !11
  %109 = sub nsw i64 %106, %108
  store i64 %109, ptr %12, align 8, !tbaa !11
  store i32 0, ptr %13, align 4
  br label %110

110:                                              ; preds = %107, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #10
  %111 = load i32, ptr %13, align 4
  switch i32 %111, label %290 [
    i32 0, label %112
  ]

112:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #10
  %113 = getelementptr inbounds %struct.ggml_init_params, ptr %17, i32 0, i32 0
  %114 = load i64, ptr @_ZZ4mainE8buf_size, align 8, !tbaa !11
  store i64 %114, ptr %113, align 8, !tbaa !33
  %115 = getelementptr inbounds %struct.ggml_init_params, ptr %17, i32 0, i32 1
  store ptr null, ptr %115, align 8, !tbaa !36
  %116 = getelementptr inbounds %struct.ggml_init_params, ptr %17, i32 0, i32 2
  store i8 0, ptr %116, align 8, !tbaa !37
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %17, i64 24, i1 false), !tbaa.struct !38
  %117 = invoke ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %18)
          to label %118 unwind label %175

118:                                              ; preds = %112
  %119 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 3
  store ptr %117, ptr %119, align 8, !tbaa !40
  %120 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 3
  %121 = load ptr, ptr %120, align 8, !tbaa !40
  %122 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 0
  %123 = invoke noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52) %122)
          to label %124 unwind label %175

124:                                              ; preds = %118
  %125 = sext i32 %123 to i64
  %126 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 0
  %127 = invoke noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52) %126)
          to label %128 unwind label %175

128:                                              ; preds = %124
  %129 = sext i32 %127 to i64
  %130 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 0
  %131 = getelementptr inbounds %struct.sam_hparams, ptr %130, i32 0, i32 3
  %132 = load i32, ptr %131, align 4, !tbaa !42
  %133 = sext i32 %132 to i64
  %134 = invoke ptr @ggml_new_tensor_3d(ptr noundef %121, i32 noundef 0, i64 noundef %125, i64 noundef %129, i64 noundef %133)
          to label %135 unwind label %175

135:                                              ; preds = %128
  %136 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 0
  store ptr %134, ptr %136, align 8, !tbaa !73
  %137 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 3
  %138 = load ptr, ptr %137, align 8, !tbaa !40
  %139 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 0
  %140 = getelementptr inbounds %struct.sam_hparams, ptr %139, i32 0, i32 3
  %141 = load i32, ptr %140, align 4, !tbaa !42
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 0
  %144 = getelementptr inbounds %struct.sam_hparams, ptr %143, i32 0, i32 3
  %145 = load i32, ptr %144, align 4, !tbaa !42
  %146 = sext i32 %145 to i64
  %147 = invoke ptr @ggml_new_tensor_3d(ptr noundef %138, i32 noundef 0, i64 noundef %142, i64 noundef %146, i64 noundef 3)
          to label %148 unwind label %175

148:                                              ; preds = %135
  %149 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 1
  store ptr %147, ptr %149, align 8, !tbaa !74
  %150 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 3
  %151 = load ptr, ptr %150, align 8, !tbaa !40
  %152 = invoke ptr @ggml_new_tensor_1d(ptr noundef %151, i32 noundef 0, i64 noundef 3)
          to label %153 unwind label %175

153:                                              ; preds = %148
  %154 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 2
  store ptr %152, ptr %154, align 8, !tbaa !75
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #10
  %155 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 5
  %156 = invoke i64 @ggml_tensor_overhead()
          to label %157 unwind label %81

157:                                              ; preds = %153
  %158 = mul i64 %156, 2048
  %159 = invoke i64 @ggml_graph_overhead()
          to label %160 unwind label %81

160:                                              ; preds = %157
  %161 = add i64 %158, %159
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %155, i64 noundef %161)
          to label %162 unwind label %81

162:                                              ; preds = %160
  %163 = invoke ptr @ggml_backend_cpu_buffer_type()
          to label %164 unwind label %81

164:                                              ; preds = %162
  %165 = invoke ptr @ggml_gallocr_new(ptr noundef %163)
          to label %166 unwind label %81

166:                                              ; preds = %164
  %167 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 7
  store ptr %165, ptr %167, align 8, !tbaa !76
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #10
  %168 = invoke noundef ptr @_Z16sam_encode_imageRK9sam_modelR9sam_stateRK13sam_image_f32(ptr noundef nonnull align 8 dereferenceable(496) %10, ptr noundef nonnull align 8 dereferenceable(112) %11, ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %169 unwind label %179

169:                                              ; preds = %166
  store ptr %168, ptr %19, align 8, !tbaa !9
  %170 = load ptr, ptr %19, align 8, !tbaa !9
  %171 = icmp ne ptr %170, null
  br i1 %171, label %183, label %172

172:                                              ; preds = %169
  %173 = load ptr, ptr @stderr, align 8, !tbaa !9
  %174 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %173, ptr noundef @.str.215, ptr noundef @__func__.main) #10
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %197

175:                                              ; preds = %148, %135, %128, %124, %118, %112
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %8, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #10
  br label %291

179:                                              ; preds = %191, %188, %183, %166
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %8, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #10
  br label %291

183:                                              ; preds = %169
  %184 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 4
  %185 = load ptr, ptr %19, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 1
  %187 = load i32, ptr %186, align 4, !tbaa !77
  invoke void @_ZL25ggml_graph_compute_helperRSt6vectorIhSaIhEEP11ggml_cgraphi(ptr noundef nonnull align 8 dereferenceable(24) %184, ptr noundef %185, i32 noundef %187)
          to label %188 unwind label %179

188:                                              ; preds = %183
  %189 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8, !tbaa !73
  invoke void @_Z11print_t_f32PKcP11ggml_tensori(ptr noundef @.str.216, ptr noundef %190, i32 noundef 10)
          to label %191 unwind label %179

191:                                              ; preds = %188
  %192 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 7
  %193 = load ptr, ptr %192, align 8, !tbaa !76
  invoke void @ggml_gallocr_free(ptr noundef %193)
          to label %194 unwind label %179

194:                                              ; preds = %191
  %195 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 7
  store ptr null, ptr %195, align 8, !tbaa !76
  %196 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 4
  call void @_ZNSt6vectorIhSaIhEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %196) #10
  store i32 0, ptr %13, align 4
  br label %197

197:                                              ; preds = %194, %172
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #10
  %198 = load i32, ptr %13, align 4
  switch i32 %198, label %290 [
    i32 0, label %199
  ]

199:                                              ; preds = %197
  %200 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 6
  %201 = invoke i64 @ggml_tensor_overhead()
          to label %202 unwind label %81

202:                                              ; preds = %199
  %203 = mul i64 %201, 2048
  %204 = invoke i64 @ggml_graph_overhead()
          to label %205 unwind label %81

205:                                              ; preds = %202
  %206 = add i64 %203, %204
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %200, i64 noundef %206)
          to label %207 unwind label %81

207:                                              ; preds = %205
  %208 = invoke ptr @ggml_backend_cpu_buffer_type()
          to label %209 unwind label %81

209:                                              ; preds = %207
  %210 = invoke ptr @ggml_gallocr_new(ptr noundef %208)
          to label %211 unwind label %81

211:                                              ; preds = %209
  %212 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 7
  store ptr %210, ptr %212, align 8, !tbaa !76
  %213 = load ptr, ptr @stderr, align 8, !tbaa !9
  %214 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 11
  %215 = getelementptr inbounds %struct.sam_point, ptr %214, i32 0, i32 0
  %216 = load float, ptr %215, align 8, !tbaa !78
  %217 = fpext float %216 to double
  %218 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 11
  %219 = getelementptr inbounds %struct.sam_point, ptr %218, i32 0, i32 1
  %220 = load float, ptr %219, align 4, !tbaa !79
  %221 = fpext float %220 to double
  %222 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %213, ptr noundef @.str.217, double noundef %217, double noundef %221) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #10
  %223 = getelementptr inbounds %struct.sam_image_u8, ptr %14, i32 0, i32 0
  %224 = load i32, ptr %223, align 8, !tbaa !19
  %225 = getelementptr inbounds %struct.sam_image_u8, ptr %14, i32 0, i32 1
  %226 = load i32, ptr %225, align 4, !tbaa !25
  %227 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 8 %227, i64 8, i1 false), !tbaa.struct !80
  %228 = load <2 x float>, ptr %21, align 4
  %229 = invoke noundef ptr @_Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point(ptr noundef nonnull align 8 dereferenceable(496) %10, ptr noundef nonnull align 8 dereferenceable(112) %11, i32 noundef %224, i32 noundef %226, <2 x float> %228)
          to label %230 unwind label %236

230:                                              ; preds = %211
  store ptr %229, ptr %20, align 8, !tbaa !9
  %231 = load ptr, ptr %20, align 8, !tbaa !9
  %232 = icmp ne ptr %231, null
  br i1 %232, label %240, label %233

233:                                              ; preds = %230
  %234 = load ptr, ptr @stderr, align 8, !tbaa !9
  %235 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %234, ptr noundef @.str.218, ptr noundef @__func__.main) #10
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %250

236:                                              ; preds = %245, %240, %211
  %237 = landingpad { ptr, i32 }
          cleanup
  %238 = extractvalue { ptr, i32 } %237, 0
  store ptr %238, ptr %8, align 8
  %239 = extractvalue { ptr, i32 } %237, 1
  store i32 %239, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #10
  br label %291

240:                                              ; preds = %230
  %241 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 4
  %242 = load ptr, ptr %20, align 8, !tbaa !9
  %243 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 1
  %244 = load i32, ptr %243, align 4, !tbaa !77
  invoke void @_ZL25ggml_graph_compute_helperRSt6vectorIhSaIhEEP11ggml_cgraphi(ptr noundef nonnull align 8 dereferenceable(24) %241, ptr noundef %242, i32 noundef %244)
          to label %245 unwind label %236

245:                                              ; preds = %240
  %246 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 7
  %247 = load ptr, ptr %246, align 8, !tbaa !76
  invoke void @ggml_gallocr_free(ptr noundef %247)
          to label %248 unwind label %236

248:                                              ; preds = %245
  %249 = getelementptr inbounds %struct.sam_state, ptr %11, i32 0, i32 7
  store ptr null, ptr %249, align 8, !tbaa !76
  store i32 0, ptr %13, align 4
  br label %250

250:                                              ; preds = %248, %233
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #10
  %251 = load i32, ptr %13, align 4
  switch i32 %251, label %290 [
    i32 0, label %252
  ]

252:                                              ; preds = %250
  %253 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 0
  %254 = getelementptr inbounds %struct.sam_image_u8, ptr %14, i32 0, i32 0
  %255 = load i32, ptr %254, align 8, !tbaa !19
  %256 = getelementptr inbounds %struct.sam_image_u8, ptr %14, i32 0, i32 1
  %257 = load i32, ptr %256, align 4, !tbaa !25
  %258 = getelementptr inbounds %struct.sam_params, ptr %7, i32 0, i32 4
  %259 = invoke noundef zeroext i1 @_Z15sam_write_masksRK11sam_hparamsiiRK9sam_stateRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 4 dereferenceable(52) %253, i32 noundef %255, i32 noundef %257, ptr noundef nonnull align 8 dereferenceable(112) %11, ptr noundef nonnull align 8 dereferenceable(32) %258)
          to label %260 unwind label %81

260:                                              ; preds = %252
  br i1 %259, label %264, label %261

261:                                              ; preds = %260
  %262 = load ptr, ptr @stderr, align 8, !tbaa !9
  %263 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %262, ptr noundef @.str.219, ptr noundef @__func__.main) #10
  store i32 1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %290

264:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #10
  %265 = invoke i64 @ggml_time_us()
          to label %266 unwind label %286

266:                                              ; preds = %264
  store i64 %265, ptr %22, align 8, !tbaa !11
  %267 = load ptr, ptr @stderr, align 8, !tbaa !9
  %268 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %267, ptr noundef @.str.220) #10
  %269 = load ptr, ptr @stderr, align 8, !tbaa !9
  %270 = load i64, ptr %12, align 8, !tbaa !11
  %271 = sitofp i64 %270 to float
  %272 = fdiv float %271, 1.000000e+03
  %273 = fpext float %272 to double
  %274 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %269, ptr noundef @.str.221, ptr noundef @__func__.main, double noundef %273) #10
  %275 = load ptr, ptr @stderr, align 8, !tbaa !9
  %276 = load i64, ptr %22, align 8, !tbaa !11
  %277 = load i64, ptr %6, align 8, !tbaa !11
  %278 = sub nsw i64 %276, %277
  %279 = sitofp i64 %278 to float
  %280 = fdiv float %279, 1.000000e+03
  %281 = fpext float %280 to double
  %282 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %275, ptr noundef @.str.222, ptr noundef @__func__.main, double noundef %281) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #10
  %283 = getelementptr inbounds %struct.sam_model, ptr %10, i32 0, i32 4
  %284 = load ptr, ptr %283, align 8, !tbaa !82
  invoke void @ggml_free(ptr noundef %284)
          to label %285 unwind label %81

285:                                              ; preds = %266
  store i32 0, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %290

286:                                              ; preds = %264
  %287 = landingpad { ptr, i32 }
          cleanup
  %288 = extractvalue { ptr, i32 } %287, 0
  store ptr %288, ptr %8, align 8
  %289 = extractvalue { ptr, i32 } %287, 1
  store i32 %289, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #10
  br label %291

290:                                              ; preds = %285, %261, %250, %197, %110, %78
  call void @_ZN13sam_image_f32D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #10
  br label %292

291:                                              ; preds = %286, %236, %179, %175, %101, %81
  call void @_ZN13sam_image_f32D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #10
  br label %293

292:                                              ; preds = %290, %58
  call void @_ZN12sam_image_u8D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #10
  br label %294

293:                                              ; preds = %291, %63
  call void @_ZN12sam_image_u8D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #10
  br label %296

294:                                              ; preds = %292, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  call void @_ZN9sam_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(112) %11) #10
  call void @llvm.lifetime.end.p0(i64 112, ptr %11) #10
  call void @_ZN9sam_modelD2Ev(ptr noundef nonnull align 8 dereferenceable(496) %10) #10
  call void @llvm.lifetime.end.p0(i64 496, ptr %10) #10
  call void @_ZN10sam_paramsD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %7) #10
  call void @llvm.lifetime.end.p0(i64 136, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  %295 = load i32, ptr %3, align 4
  ret i32 %295

296:                                              ; preds = %293, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  call void @_ZN9sam_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(112) %11) #10
  call void @llvm.lifetime.end.p0(i64 112, ptr %11) #10
  call void @_ZN9sam_modelD2Ev(ptr noundef nonnull align 8 dereferenceable(496) %10) #10
  call void @llvm.lifetime.end.p0(i64 496, ptr %10) #10
  br label %297

297:                                              ; preds = %296, %34
  call void @_ZN10sam_paramsD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %7) #10
  call void @llvm.lifetime.end.p0(i64 136, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  br label %298

298:                                              ; preds = %297
  %299 = load ptr, ptr %8, align 8
  %300 = load i32, ptr %9, align 4
  %301 = insertvalue { ptr, i32 } poison, ptr %299, 0
  %302 = insertvalue { ptr, i32 } %301, i32 %300, 1
  resume { ptr, i32 } %302
}

declare i64 @ggml_time_us() #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10sam_paramsC2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #9 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_modelC2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_stateC2Ev(ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #6 align 2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13sam_image_f32C2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6 align 2

declare i64 @ggml_tensor_overhead() #5

declare i64 @ggml_graph_overhead() #5

declare ptr @ggml_gallocr_new(ptr noundef) #5

declare ptr @ggml_backend_cpu_buffer_type() #5

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL25ggml_graph_compute_helperRSt6vectorIhSaIhEEP11ggml_cgraphi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef) #2

declare void @ggml_gallocr_free(ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13sam_image_f32D2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_modelD2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10sam_paramsD2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #6 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #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 = { 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 #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 = { mustprogress norecurse 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 = { inlinehint 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 #10 = { 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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS10sam_params", !6, i64 0, !6, i64 4, !15, i64 8, !15, i64 40, !15, i64 72, !17, i64 104, !17, i64 108, !17, i64 112, !17, i64 116, !17, i64 120, !17, i64 124, !18, i64 128}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !12, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTS9sam_point", !17, i64 0, !17, i64 4}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTS12sam_image_u8", !6, i64 0, !6, i64 4, !21, i64 8}
!21 = !{!"_ZTSSt6vectorIhSaIhEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!25 = !{!20, !6, i64 4}
!26 = !{!27, !6, i64 0}
!27 = !{!"_ZTS13sam_image_f32", !6, i64 0, !6, i64 4, !28, i64 8}
!28 = !{!"_ZTSSt6vectorIfSaIfEE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!32 = !{!27, !6, i64 4}
!33 = !{!34, !12, i64 0}
!34 = !{!"_ZTS16ggml_init_params", !12, i64 0, !10, i64 8, !35, i64 16}
!35 = !{!"bool", !7, i64 0}
!36 = !{!34, !10, i64 8}
!37 = !{!34, !35, i64 16}
!38 = !{i64 0, i64 8, !11, i64 8, i64 8, !9, i64 16, i64 1, !39}
!39 = !{!35, !35, i64 0}
!40 = !{!41, !10, i64 24}
!41 = !{!"_ZTS9sam_state", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !21, i64 32, !21, i64 56, !21, i64 80, !10, i64 104}
!42 = !{!43, !6, i64 12}
!43 = !{!"_ZTS9sam_model", !44, i64 0, !45, i64 56, !50, i64 152, !55, i64 200, !10, i64 440, !65, i64 448}
!44 = !{!"_ZTS11sam_hparams", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !17, i64 40, !17, i64 44, !17, i64 48}
!45 = !{!"_ZTS17sam_encoder_image", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !46, i64 72}
!46 = !{!"_ZTSSt6vectorI13sam_layer_encSaIS0_EE", !47, i64 0}
!47 = !{!"_ZTSSt12_Vector_baseI13sam_layer_encSaIS0_EE", !48, i64 0}
!48 = !{!"_ZTSNSt12_Vector_baseI13sam_layer_encSaIS0_EE12_Vector_implE", !49, i64 0}
!49 = !{!"_ZTSNSt12_Vector_baseI13sam_layer_encSaIS0_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!50 = !{!"_ZTS18sam_encoder_prompt", !10, i64 0, !10, i64 8, !51, i64 16, !10, i64 40}
!51 = !{!"_ZTSSt6vectorIP11ggml_tensorSaIS1_EE", !52, i64 0}
!52 = !{!"_ZTSSt12_Vector_baseIP11ggml_tensorSaIS1_EE", !53, i64 0}
!53 = !{!"_ZTSNSt12_Vector_baseIP11ggml_tensorSaIS1_EE12_Vector_implE", !54, i64 0}
!54 = !{!"_ZTSNSt12_Vector_baseIP11ggml_tensorSaIS1_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!55 = !{!"_ZTS16sam_decoder_mask", !56, i64 0, !60, i64 24, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !61, i64 152, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232}
!56 = !{!"_ZTSSt6vectorI25sam_layer_dec_transformerSaIS0_EE", !57, i64 0}
!57 = !{!"_ZTSSt12_Vector_baseI25sam_layer_dec_transformerSaIS0_EE", !58, i64 0}
!58 = !{!"_ZTSNSt12_Vector_baseI25sam_layer_dec_transformerSaIS0_EE12_Vector_implE", !59, i64 0}
!59 = !{!"_ZTSNSt12_Vector_baseI25sam_layer_dec_transformerSaIS0_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!60 = !{!"_ZTS30sam_layer_dec_transformer_attn", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!61 = !{!"_ZTSSt6vectorI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE", !62, i64 0}
!62 = !{!"_ZTSSt12_Vector_baseI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE", !63, i64 0}
!63 = !{!"_ZTSNSt12_Vector_baseI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE12_Vector_implE", !64, i64 0}
!64 = !{!"_ZTSNSt12_Vector_baseI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!65 = !{!"_ZTSSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP11ggml_tensorSt4lessIS5_ESaISt4pairIKS5_S7_EEE", !66, i64 0}
!66 = !{!"_ZTSSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P11ggml_tensorESt10_Select1stISA_ESt4lessIS5_ESaISA_EE", !67, i64 0}
!67 = !{!"_ZTSNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P11ggml_tensorESt10_Select1stISA_ESt4lessIS5_ESaISA_EE13_Rb_tree_implISE_Lb1EEE", !68, i64 0, !70, i64 8}
!68 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE", !69, i64 0}
!69 = !{!"_ZTSSt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE"}
!70 = !{!"_ZTSSt15_Rb_tree_header", !71, i64 0, !12, i64 32}
!71 = !{!"_ZTSSt18_Rb_tree_node_base", !72, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!72 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!73 = !{!41, !10, i64 0}
!74 = !{!41, !10, i64 8}
!75 = !{!41, !10, i64 16}
!76 = !{!41, !10, i64 104}
!77 = !{!14, !6, i64 4}
!78 = !{!14, !17, i64 128}
!79 = !{!14, !17, i64 132}
!80 = !{i64 0, i64 4, !81, i64 4, i64 4, !81}
!81 = !{!17, !17, i64 0}
!82 = !{!43, !10, i64 440}


; 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.sam_params = type { i32, i32, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", float, float, float, float, float, float, %struct.sam_point }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.sam_point = type { float, float }
%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.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_image_u8 = type { i32, i32, %"class.std::vector" }
%struct.sam_image_f32 = type { i32, i32, %"class.std::vector.3" }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.208 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.209 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.210 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.211 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.212 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.213 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.214 = external hidden unnamed_addr constant [36 x i8], align 1
@_ZZ4mainE8buf_size = external hidden local_unnamed_addr global i64, align 8
@.str.215 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.216 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.217 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.218 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.219 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.220 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.221 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.222 = external hidden unnamed_addr constant [30 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: mustprogress uwtable
declare dso_local void @_Z11print_t_f32PKcP11ggml_tensori(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z24sam_image_load_from_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12sam_image_u8(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z20sam_image_preprocessRK12sam_image_u8R13sam_image_f32(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z14sam_model_loadRK10sam_paramsR9sam_model(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

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

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

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

declare ptr @ggml_new_tensor_1d(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #4

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

declare void @ggml_free(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15sam_write_masksRK11sam_hparamsiiRK9sam_stateRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 4 dereferenceable(52), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(112), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN12sam_image_u8C2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN12sam_image_u8D2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef nonnull align 8 dereferenceable(112), i32 noundef, i32 noundef, <2 x float>) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z16sam_params_parseiPPcR10sam_params(i32 noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #7 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.sam_params, align 8
  %4 = alloca %struct.sam_model, align 8
  %5 = alloca %struct.sam_state, align 8
  %6 = alloca %struct.sam_image_u8, align 8
  %7 = alloca %struct.sam_image_f32, align 8
  %8 = alloca %struct.ggml_init_params, align 8
  %9 = tail call i64 @ggml_time_us()
  call void @llvm.lifetime.start.p0(i64 136, ptr nonnull %3) #10
  call void @_ZN10sam_paramsC2Ev(ptr noundef nonnull align 8 dereferenceable(136) %3)
  %10 = getelementptr inbounds i8, ptr %3, i64 8
  %11 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull @.str.208)
          to label %12 unwind label %15

12:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 496, ptr nonnull %4) #10
  call void @_ZN9sam_modelC2Ev(ptr noundef nonnull align 8 dereferenceable(496) %4) #10
  call void @llvm.lifetime.start.p0(i64 112, ptr nonnull %5) #10
  call void @_ZN9sam_stateC2Ev(ptr noundef nonnull align 8 dereferenceable(112) %5) #10
  %13 = invoke noundef zeroext i1 @_Z16sam_params_parseiPPcR10sam_params(i32 noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(136) %3)
          to label %14 unwind label %17

14:                                               ; preds = %12
  br i1 %13, label %19, label %189

15:                                               ; preds = %2
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %191

17:                                               ; preds = %12
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %190

19:                                               ; preds = %14
  %20 = load i32, ptr %3, align 8, !tbaa !5
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = call i64 @time(ptr noundef null) #10
  %24 = trunc i64 %23 to i32
  store i32 %24, ptr %3, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %22, %19
  %26 = phi i32 [ %24, %22 ], [ %20, %19 ]
  %27 = load ptr, ptr @stderr, align 8, !tbaa !16
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.209, ptr noundef nonnull @__func__.main, i32 noundef %26) #11
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #10
  call void @_ZN12sam_image_u8C2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #10
  %29 = getelementptr inbounds i8, ptr %3, i64 40
  %30 = invoke noundef zeroext i1 @_Z24sam_image_load_from_fileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12sam_image_u8(ptr noundef nonnull align 8 dereferenceable(32) %29, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %31 unwind label %36

31:                                               ; preds = %25
  %32 = load ptr, ptr @stderr, align 8, !tbaa !16
  %33 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %29) #10
  br i1 %30, label %38, label %34

34:                                               ; preds = %31
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.210, ptr noundef nonnull @__func__.main, ptr noundef %33) #11
  br label %187

36:                                               ; preds = %25
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %188

38:                                               ; preds = %31
  %39 = load i32, ptr %6, align 8, !tbaa !17
  %40 = getelementptr inbounds i8, ptr %6, i64 4
  %41 = load i32, ptr %40, align 4, !tbaa !23
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.211, ptr noundef nonnull @__func__.main, ptr noundef %33, i32 noundef %39, i32 noundef %41) #11
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #10
  call void @_ZN13sam_image_f32C2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #10
  %43 = invoke noundef zeroext i1 @_Z20sam_image_preprocessRK12sam_image_u8R13sam_image_f32(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %44 unwind label %48

44:                                               ; preds = %38
  %45 = load ptr, ptr @stderr, align 8, !tbaa !16
  br i1 %43, label %50, label %46

46:                                               ; preds = %44
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.212, ptr noundef nonnull @__func__.main) #11
  br label %185

48:                                               ; preds = %167, %156, %133, %131, %128, %126, %123, %103, %101, %98, %96, %92, %38
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %186

50:                                               ; preds = %44
  %51 = load i32, ptr %7, align 8, !tbaa !24
  %52 = getelementptr inbounds i8, ptr %7, i64 4
  %53 = load i32, ptr %52, align 4, !tbaa !30
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.213, ptr noundef nonnull @__func__.main, i32 noundef %51, i32 noundef %53) #11
  %55 = invoke i64 @ggml_time_us()
          to label %56 unwind label %59

56:                                               ; preds = %50
  %57 = invoke noundef zeroext i1 @_Z14sam_model_loadRK10sam_paramsR9sam_model(ptr noundef nonnull align 8 dereferenceable(136) %3, ptr noundef nonnull align 8 dereferenceable(496) %4)
          to label %58 unwind label %59

58:                                               ; preds = %56
  br i1 %57, label %61, label %63

59:                                               ; preds = %61, %56, %50
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %186

61:                                               ; preds = %58
  %62 = invoke i64 @ggml_time_us()
          to label %67 unwind label %59

63:                                               ; preds = %58
  %64 = load ptr, ptr @stderr, align 8, !tbaa !16
  %65 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %10) #10
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef nonnull @.str.214, ptr noundef nonnull @__func__.main, ptr noundef %65) #11
  br label %185

67:                                               ; preds = %61
  %68 = sub nsw i64 %62, %55
  %69 = load i64, ptr @_ZZ4mainE8buf_size, align 8, !tbaa !31
  store i64 %69, ptr %8, align 8, !tbaa !31
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  store ptr null, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !16
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 16
  store i8 0, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !32
  %70 = invoke ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %8)
          to label %71 unwind label %111

71:                                               ; preds = %67
  %72 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %70, ptr %72, align 8, !tbaa !34
  %73 = invoke noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52) %4)
          to label %74 unwind label %111

74:                                               ; preds = %71
  %75 = invoke noundef i32 @_ZNK11sam_hparams10n_img_embdEv(ptr noundef nonnull align 4 dereferenceable(52) %4)
          to label %76 unwind label %111

76:                                               ; preds = %74
  %77 = sext i32 %73 to i64
  %78 = sext i32 %75 to i64
  %79 = getelementptr inbounds i8, ptr %4, i64 12
  %80 = load i32, ptr %79, align 4, !tbaa !36
  %81 = sext i32 %80 to i64
  %82 = invoke ptr @ggml_new_tensor_3d(ptr noundef %70, i32 noundef 0, i64 noundef %77, i64 noundef %78, i64 noundef %81)
          to label %83 unwind label %111

83:                                               ; preds = %76
  store ptr %82, ptr %5, align 8, !tbaa !67
  %84 = load ptr, ptr %72, align 8, !tbaa !34
  %85 = load i32, ptr %79, align 4, !tbaa !36
  %86 = sext i32 %85 to i64
  %87 = invoke ptr @ggml_new_tensor_3d(ptr noundef %84, i32 noundef 0, i64 noundef %86, i64 noundef %86, i64 noundef 3)
          to label %88 unwind label %111

88:                                               ; preds = %83
  %89 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %87, ptr %89, align 8, !tbaa !68
  %90 = load ptr, ptr %72, align 8, !tbaa !34
  %91 = invoke ptr @ggml_new_tensor_1d(ptr noundef %90, i32 noundef 0, i64 noundef 3)
          to label %92 unwind label %111

92:                                               ; preds = %88
  %93 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %91, ptr %93, align 8, !tbaa !69
  %94 = getelementptr inbounds i8, ptr %5, i64 56
  %95 = invoke i64 @ggml_tensor_overhead()
          to label %96 unwind label %48

96:                                               ; preds = %92
  %97 = invoke i64 @ggml_graph_overhead()
          to label %98 unwind label %48

98:                                               ; preds = %96
  %99 = shl i64 %95, 11
  %100 = add i64 %97, %99
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %94, i64 noundef %100)
          to label %101 unwind label %48

101:                                              ; preds = %98
  %102 = invoke ptr @ggml_backend_cpu_buffer_type()
          to label %103 unwind label %48

103:                                              ; preds = %101
  %104 = invoke ptr @ggml_gallocr_new(ptr noundef %102)
          to label %105 unwind label %48

105:                                              ; preds = %103
  %106 = getelementptr inbounds i8, ptr %5, i64 104
  store ptr %104, ptr %106, align 8, !tbaa !70
  %107 = invoke noundef ptr @_Z16sam_encode_imageRK9sam_modelR9sam_stateRK13sam_image_f32(ptr noundef nonnull align 8 dereferenceable(496) %4, ptr noundef nonnull align 8 dereferenceable(112) %5, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %108 unwind label %113

108:                                              ; preds = %105
  %.not.not = icmp eq ptr %107, null
  br i1 %.not.not, label %.thread41, label %115

.thread41:                                        ; preds = %108
  %109 = load ptr, ptr @stderr, align 8, !tbaa !16
  %110 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef nonnull @.str.215, ptr noundef nonnull @__func__.main) #11
  br label %185

111:                                              ; preds = %88, %83, %76, %74, %71, %67
  %112 = landingpad { ptr, i32 }
          cleanup
  br label %186

113:                                              ; preds = %121, %119, %115, %105
  %114 = landingpad { ptr, i32 }
          cleanup
  br label %186

115:                                              ; preds = %108
  %116 = getelementptr inbounds i8, ptr %5, i64 32
  %117 = getelementptr inbounds i8, ptr %3, i64 4
  %118 = load i32, ptr %117, align 4, !tbaa !71
  invoke void @_ZL25ggml_graph_compute_helperRSt6vectorIhSaIhEEP11ggml_cgraphi(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull %107, i32 noundef %118)
          to label %119 unwind label %113

119:                                              ; preds = %115
  %120 = load ptr, ptr %5, align 8, !tbaa !67
  invoke void @_Z11print_t_f32PKcP11ggml_tensori(ptr noundef nonnull @.str.216, ptr noundef %120, i32 noundef 10)
          to label %121 unwind label %113

121:                                              ; preds = %119
  %122 = load ptr, ptr %106, align 8, !tbaa !70
  invoke void @ggml_gallocr_free(ptr noundef %122)
          to label %123 unwind label %113

123:                                              ; preds = %121
  store ptr null, ptr %106, align 8, !tbaa !70
  call void @_ZNSt6vectorIhSaIhEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %116) #10
  %124 = getelementptr inbounds i8, ptr %5, i64 80
  %125 = invoke i64 @ggml_tensor_overhead()
          to label %126 unwind label %48

126:                                              ; preds = %123
  %127 = invoke i64 @ggml_graph_overhead()
          to label %128 unwind label %48

128:                                              ; preds = %126
  %129 = shl i64 %125, 11
  %130 = add i64 %127, %129
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %124, i64 noundef %130)
          to label %131 unwind label %48

131:                                              ; preds = %128
  %132 = invoke ptr @ggml_backend_cpu_buffer_type()
          to label %133 unwind label %48

133:                                              ; preds = %131
  %134 = invoke ptr @ggml_gallocr_new(ptr noundef %132)
          to label %135 unwind label %48

135:                                              ; preds = %133
  store ptr %134, ptr %106, align 8, !tbaa !70
  %136 = load ptr, ptr @stderr, align 8, !tbaa !16
  %137 = getelementptr inbounds i8, ptr %3, i64 128
  %138 = load float, ptr %137, align 8, !tbaa !72
  %139 = fpext float %138 to double
  %140 = getelementptr inbounds i8, ptr %3, i64 132
  %141 = load float, ptr %140, align 4, !tbaa !73
  %142 = fpext float %141 to double
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef nonnull @.str.217, double noundef %139, double noundef %142) #11
  %144 = load i32, ptr %6, align 8, !tbaa !17
  %145 = load i32, ptr %40, align 4, !tbaa !23
  %.sroa.0.0.copyload = load <2 x float>, ptr %137, align 8
  %146 = invoke noundef ptr @_Z20sam_build_fast_graphRK9sam_modelR9sam_stateii9sam_point(ptr noundef nonnull align 8 dereferenceable(496) %4, ptr noundef nonnull align 8 dereferenceable(112) %5, i32 noundef %144, i32 noundef %145, <2 x float> %.sroa.0.0.copyload)
          to label %147 unwind label %150

147:                                              ; preds = %135
  %.not.not32 = icmp eq ptr %146, null
  br i1 %.not.not32, label %.thread43, label %152

.thread43:                                        ; preds = %147
  %148 = load ptr, ptr @stderr, align 8, !tbaa !16
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef nonnull @.str.218, ptr noundef nonnull @__func__.main) #11
  br label %185

150:                                              ; preds = %154, %152, %135
  %151 = landingpad { ptr, i32 }
          cleanup
  br label %186

152:                                              ; preds = %147
  %153 = load i32, ptr %117, align 4, !tbaa !71
  invoke void @_ZL25ggml_graph_compute_helperRSt6vectorIhSaIhEEP11ggml_cgraphi(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull %146, i32 noundef %153)
          to label %154 unwind label %150

154:                                              ; preds = %152
  %155 = load ptr, ptr %106, align 8, !tbaa !70
  invoke void @ggml_gallocr_free(ptr noundef %155)
          to label %156 unwind label %150

156:                                              ; preds = %154
  store ptr null, ptr %106, align 8, !tbaa !70
  %157 = load i32, ptr %6, align 8, !tbaa !17
  %158 = load i32, ptr %40, align 4, !tbaa !23
  %159 = getelementptr inbounds i8, ptr %3, i64 72
  %160 = invoke noundef zeroext i1 @_Z15sam_write_masksRK11sam_hparamsiiRK9sam_stateRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 4 dereferenceable(52) %4, i32 noundef %157, i32 noundef %158, ptr noundef nonnull align 8 dereferenceable(112) %5, ptr noundef nonnull align 8 dereferenceable(32) %159)
          to label %161 unwind label %48

161:                                              ; preds = %156
  br i1 %160, label %165, label %162

162:                                              ; preds = %161
  %163 = load ptr, ptr @stderr, align 8, !tbaa !16
  %164 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %163, ptr noundef nonnull @.str.219, ptr noundef nonnull @__func__.main) #11
  br label %185

165:                                              ; preds = %161
  %166 = invoke i64 @ggml_time_us()
          to label %167 unwind label %183

167:                                              ; preds = %165
  %168 = load ptr, ptr @stderr, align 8, !tbaa !16
  %169 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef nonnull @.str.220) #11
  %170 = load ptr, ptr @stderr, align 8, !tbaa !16
  %171 = sitofp i64 %68 to float
  %172 = fdiv float %171, 1.000000e+03
  %173 = fpext float %172 to double
  %174 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef nonnull @.str.221, ptr noundef nonnull @__func__.main, double noundef %173) #11
  %175 = load ptr, ptr @stderr, align 8, !tbaa !16
  %176 = sub nsw i64 %166, %9
  %177 = sitofp i64 %176 to float
  %178 = fdiv float %177, 1.000000e+03
  %179 = fpext float %178 to double
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %175, ptr noundef nonnull @.str.222, ptr noundef nonnull @__func__.main, double noundef %179) #11
  %181 = getelementptr inbounds i8, ptr %4, i64 440
  %182 = load ptr, ptr %181, align 8, !tbaa !74
  invoke void @ggml_free(ptr noundef %182)
          to label %185 unwind label %48

183:                                              ; preds = %165
  %184 = landingpad { ptr, i32 }
          cleanup
  br label %186

185:                                              ; preds = %.thread43, %.thread41, %63, %167, %162, %46
  %.3 = phi i32 [ 1, %162 ], [ 1, %63 ], [ 1, %46 ], [ 0, %167 ], [ 1, %.thread41 ], [ 1, %.thread43 ]
  call void @_ZN13sam_image_f32D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #10
  br label %187

186:                                              ; preds = %183, %150, %113, %111, %59, %48
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %184, %183 ], [ %151, %150 ], [ %114, %113 ], [ %112, %111 ], [ %60, %59 ]
  call void @_ZN13sam_image_f32D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #10
  br label %188

187:                                              ; preds = %185, %34
  %.4 = phi i32 [ %.3, %185 ], [ 1, %34 ]
  call void @_ZN12sam_image_u8D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #10
  br label %189

188:                                              ; preds = %186, %36
  %.pn.pn = phi { ptr, i32 } [ %.pn, %186 ], [ %37, %36 ]
  call void @_ZN12sam_image_u8D2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #10
  br label %190

189:                                              ; preds = %14, %187
  %.5 = phi i32 [ %.4, %187 ], [ 1, %14 ]
  call void @_ZN9sam_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(112) %5) #10
  call void @llvm.lifetime.end.p0(i64 112, ptr nonnull %5) #10
  call void @_ZN9sam_modelD2Ev(ptr noundef nonnull align 8 dereferenceable(496) %4) #10
  call void @llvm.lifetime.end.p0(i64 496, ptr nonnull %4) #10
  call void @_ZN10sam_paramsD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %3) #10
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %3) #10
  ret i32 %.5

190:                                              ; preds = %188, %17
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %188 ], [ %18, %17 ]
  call void @_ZN9sam_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(112) %5) #10
  call void @llvm.lifetime.end.p0(i64 112, ptr nonnull %5) #10
  call void @_ZN9sam_modelD2Ev(ptr noundef nonnull align 8 dereferenceable(496) %4) #10
  call void @llvm.lifetime.end.p0(i64 496, ptr nonnull %4) #10
  br label %191

191:                                              ; preds = %190, %15
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %190 ], [ %16, %15 ]
  call void @_ZN10sam_paramsD2Ev(ptr noundef nonnull align 8 dereferenceable(136) %3) #10
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %3) #10
  resume { ptr, i32 } %.pn.pn.pn.pn
}

declare i64 @ggml_time_us() local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10sam_paramsC2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #8 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_modelC2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_stateC2Ev(ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #5 align 2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #9

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13sam_image_f32C2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

declare i64 @ggml_tensor_overhead() local_unnamed_addr #4

declare i64 @ggml_graph_overhead() local_unnamed_addr #4

declare ptr @ggml_gallocr_new(ptr noundef) local_unnamed_addr #4

declare ptr @ggml_backend_cpu_buffer_type() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL25ggml_graph_compute_helperRSt6vectorIhSaIhEEP11ggml_cgraphi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @ggml_gallocr_free(ptr noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN13sam_image_f32D2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_stateD2Ev(ptr noundef nonnull align 8 dereferenceable(112)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9sam_modelD2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10sam_paramsD2Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #5 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #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 = { 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 #6 = { 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 #7 = { mustprogress norecurse 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 = { inlinehint 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 #9 = { 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 #10 = { nounwind }
attributes #11 = { 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, !7, i64 0}
!6 = !{!"_ZTS10sam_params", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 40, !10, i64 72, !14, i64 104, !14, i64 108, !14, i64 112, !14, i64 116, !14, i64 120, !14, i64 124, !15, i64 128}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !11, i64 0, !13, i64 8, !8, i64 16}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!"float", !8, i64 0}
!15 = !{!"_ZTS9sam_point", !14, i64 0, !14, i64 4}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !7, i64 0}
!18 = !{!"_ZTS12sam_image_u8", !7, i64 0, !7, i64 4, !19, i64 8}
!19 = !{!"_ZTSSt6vectorIhSaIhEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!23 = !{!18, !7, i64 4}
!24 = !{!25, !7, i64 0}
!25 = !{!"_ZTS13sam_image_f32", !7, i64 0, !7, i64 4, !26, i64 8}
!26 = !{!"_ZTSSt6vectorIfSaIfEE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!30 = !{!25, !7, i64 4}
!31 = !{!13, !13, i64 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"bool", !8, i64 0}
!34 = !{!35, !12, i64 24}
!35 = !{!"_ZTS9sam_state", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !19, i64 32, !19, i64 56, !19, i64 80, !12, i64 104}
!36 = !{!37, !7, i64 12}
!37 = !{!"_ZTS9sam_model", !38, i64 0, !39, i64 56, !44, i64 152, !49, i64 200, !12, i64 440, !59, i64 448}
!38 = !{!"_ZTS11sam_hparams", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !14, i64 40, !14, i64 44, !14, i64 48}
!39 = !{!"_ZTS17sam_encoder_image", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !40, i64 72}
!40 = !{!"_ZTSSt6vectorI13sam_layer_encSaIS0_EE", !41, i64 0}
!41 = !{!"_ZTSSt12_Vector_baseI13sam_layer_encSaIS0_EE", !42, i64 0}
!42 = !{!"_ZTSNSt12_Vector_baseI13sam_layer_encSaIS0_EE12_Vector_implE", !43, i64 0}
!43 = !{!"_ZTSNSt12_Vector_baseI13sam_layer_encSaIS0_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!44 = !{!"_ZTS18sam_encoder_prompt", !12, i64 0, !12, i64 8, !45, i64 16, !12, i64 40}
!45 = !{!"_ZTSSt6vectorIP11ggml_tensorSaIS1_EE", !46, i64 0}
!46 = !{!"_ZTSSt12_Vector_baseIP11ggml_tensorSaIS1_EE", !47, i64 0}
!47 = !{!"_ZTSNSt12_Vector_baseIP11ggml_tensorSaIS1_EE12_Vector_implE", !48, i64 0}
!48 = !{!"_ZTSNSt12_Vector_baseIP11ggml_tensorSaIS1_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!49 = !{!"_ZTS16sam_decoder_mask", !50, i64 0, !54, i64 24, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !55, i64 152, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232}
!50 = !{!"_ZTSSt6vectorI25sam_layer_dec_transformerSaIS0_EE", !51, i64 0}
!51 = !{!"_ZTSSt12_Vector_baseI25sam_layer_dec_transformerSaIS0_EE", !52, i64 0}
!52 = !{!"_ZTSNSt12_Vector_baseI25sam_layer_dec_transformerSaIS0_EE12_Vector_implE", !53, i64 0}
!53 = !{!"_ZTSNSt12_Vector_baseI25sam_layer_dec_transformerSaIS0_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!54 = !{!"_ZTS30sam_layer_dec_transformer_attn", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56}
!55 = !{!"_ZTSSt6vectorI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE", !56, i64 0}
!56 = !{!"_ZTSSt12_Vector_baseI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE", !57, i64 0}
!57 = !{!"_ZTSNSt12_Vector_baseI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE12_Vector_implE", !58, i64 0}
!58 = !{!"_ZTSNSt12_Vector_baseI34sam_layer_dec_output_hypernet_mlpsSaIS0_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!59 = !{!"_ZTSSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEP11ggml_tensorSt4lessIS5_ESaISt4pairIKS5_S7_EEE", !60, i64 0}
!60 = !{!"_ZTSSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P11ggml_tensorESt10_Select1stISA_ESt4lessIS5_ESaISA_EE", !61, i64 0}
!61 = !{!"_ZTSNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_P11ggml_tensorESt10_Select1stISA_ESt4lessIS5_ESaISA_EE13_Rb_tree_implISE_Lb1EEE", !62, i64 0, !64, i64 8}
!62 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE", !63, i64 0}
!63 = !{!"_ZTSSt4lessINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE"}
!64 = !{!"_ZTSSt15_Rb_tree_header", !65, i64 0, !13, i64 32}
!65 = !{!"_ZTSSt18_Rb_tree_node_base", !66, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!66 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!67 = !{!35, !12, i64 0}
!68 = !{!35, !12, i64 8}
!69 = !{!35, !12, i64 16}
!70 = !{!35, !12, i64 104}
!71 = !{!6, !7, i64 4}
!72 = !{!6, !14, i64 128}
!73 = !{!6, !14, i64 132}
!74 = !{!37, !12, i64 440}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass