; LLVM IR from ggml-org/ggml :: examples/simple (simple-backend)

; 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.simple_model = type { ptr, ptr, ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }
%"class.std::allocator.2" = type { i8 }
%struct.ggml_tensor = type { i32, ptr, [4 x i64], [4 x i64], i32, [16 x i32], i32, [10 x ptr], ptr, i64, ptr, [64 x i8], ptr, [8 x i8] }

@__const.main.matrix_A = external hidden unnamed_addr constant [8 x float], align 16
@__const.main.matrix_B = external hidden unnamed_addr constant [6 x float], align 16
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10load_modelR12simple_modelPfS1_iiii(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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

declare i64 @ggml_nbytes(ptr noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z11build_graphRK12simple_model(ptr noundef nonnull align 8 dereferenceable(40)) #0

declare i32 @__gxx_personality_v0(...)

declare void @ggml_free(ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z7computeRK12simple_modelP12ggml_gallocr(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [8 x float], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [6 x float], align 16
  %8 = alloca %struct.simple_model, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.std::vector.0", align 8
  %14 = alloca %"class.std::allocator.2", align 1
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @ggml_time_init()
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 4, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 2, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.main.matrix_A, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 3, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 2, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 @__const.main.matrix_B, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #8
  call void @_ZN12simple_modelC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #8
  %20 = getelementptr inbounds [8 x float], ptr %4, i64 0, i64 0
  %21 = getelementptr inbounds [6 x float], ptr %7, i64 0, i64 0
  call void @_Z10load_modelR12simple_modelPfS1_iiii(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef %20, ptr noundef %21, i32 noundef 4, i32 noundef 2, i32 noundef 3, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store ptr null, ptr %9, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.simple_model, ptr %8, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = call ptr @ggml_backend_get_default_buffer_type(ptr noundef %23)
  %25 = call ptr @ggml_gallocr_new(ptr noundef %24)
  store ptr %25, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %26 = call noundef ptr @_Z11build_graphRK12simple_model(ptr noundef nonnull align 8 dereferenceable(40) %8)
  store ptr %26, ptr %10, align 8, !tbaa !9
  %27 = load ptr, ptr %9, align 8, !tbaa !9
  %28 = load ptr, ptr %10, align 8, !tbaa !9
  %29 = call zeroext i1 @ggml_gallocr_reserve(ptr noundef %27, ptr noundef %28)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %30 = load ptr, ptr %9, align 8, !tbaa !9
  %31 = call i64 @ggml_gallocr_get_buffer_size(ptr noundef %30, i32 noundef 0)
  store i64 %31, ptr %11, align 8, !tbaa !13
  %32 = load ptr, ptr @stderr, align 8, !tbaa !9
  %33 = load i64, ptr %11, align 8, !tbaa !13
  %34 = uitofp i64 %33 to double
  %35 = fdiv double %34, 1.024000e+03
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef @.str, ptr noundef @__func__.main, double noundef %35) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %37 = load ptr, ptr %9, align 8, !tbaa !9
  %38 = call noundef ptr @_Z7computeRK12simple_modelP12ggml_gallocr(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef %37)
  store ptr %38, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #8
  %39 = load ptr, ptr %12, align 8, !tbaa !9
  %40 = call i64 @ggml_nelements(ptr noundef %39)
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #8
  call void @_ZNSaIfEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #8
  invoke void @_ZNSt6vectorIfSaIfEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %40, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %41 unwind label %69

41:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIfED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  %42 = load ptr, ptr %12, align 8, !tbaa !9
  %43 = call noundef ptr @_ZNSt6vectorIfSaIfEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #8
  %44 = load ptr, ptr %12, align 8, !tbaa !9
  %45 = invoke i64 @ggml_nbytes(ptr noundef %44)
          to label %46 unwind label %73

46:                                               ; preds = %41
  invoke void @ggml_backend_tensor_get(ptr noundef %42, ptr noundef %43, i64 noundef 0, i64 noundef %45)
          to label %47 unwind label %73

47:                                               ; preds = %46
  %48 = load ptr, ptr %12, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.ggml_tensor, ptr %48, i32 0, i32 2
  %50 = getelementptr inbounds [4 x i64], ptr %49, i64 0, i64 0
  %51 = load i64, ptr %50, align 8, !tbaa !13
  %52 = trunc i64 %51 to i32
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.ggml_tensor, ptr %53, i32 0, i32 2
  %55 = getelementptr inbounds [4 x i64], ptr %54, i64 0, i64 1
  %56 = load i64, ptr %55, align 8, !tbaa !13
  %57 = trunc i64 %56 to i32
  %58 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %52, i32 noundef %57)
          to label %59 unwind label %73

59:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %121, %59
  %61 = load i32, ptr %17, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = load ptr, ptr %12, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.ggml_tensor, ptr %63, i32 0, i32 2
  %65 = getelementptr inbounds [4 x i64], ptr %64, i64 0, i64 1
  %66 = load i64, ptr %65, align 8, !tbaa !13
  %67 = icmp slt i64 %62, %66
  br i1 %67, label %77, label %68

68:                                               ; preds = %60
  store i32 2, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %125

69:                                               ; preds = %0
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %15, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %16, align 4
  call void @_ZNSt15__new_allocatorIfED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  br label %141

73:                                               ; preds = %135, %132, %129, %127, %125, %47, %46, %41
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %15, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %16, align 4
  br label %140

77:                                               ; preds = %60
  %78 = load i32, ptr %17, align 4, !tbaa !5
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %80, label %87

80:                                               ; preds = %77
  %81 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2)
          to label %82 unwind label %83

82:                                               ; preds = %80
  br label %87

83:                                               ; preds = %80
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %15, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %16, align 4
  br label %124

87:                                               ; preds = %82, %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %113, %87
  %89 = load i32, ptr %19, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = load ptr, ptr %12, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.ggml_tensor, ptr %91, i32 0, i32 2
  %93 = getelementptr inbounds [4 x i64], ptr %92, i64 0, i64 0
  %94 = load i64, ptr %93, align 8, !tbaa !13
  %95 = icmp slt i64 %90, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %88
  store i32 5, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %120

97:                                               ; preds = %88
  %98 = load i32, ptr %17, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = load ptr, ptr %12, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct.ggml_tensor, ptr %100, i32 0, i32 2
  %102 = getelementptr inbounds [4 x i64], ptr %101, i64 0, i64 0
  %103 = load i64, ptr %102, align 8, !tbaa !13
  %104 = mul nsw i64 %99, %103
  %105 = load i32, ptr %19, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = add nsw i64 %104, %106
  %108 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %107) #8
  %109 = load float, ptr %108, align 4, !tbaa !15
  %110 = fpext float %109 to double
  %111 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %110)
          to label %112 unwind label %116

112:                                              ; preds = %97
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %19, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %19, align 4, !tbaa !5
  br label %88, !llvm.loop !17

116:                                              ; preds = %97
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %15, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %124

120:                                              ; preds = %96
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %17, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %17, align 4, !tbaa !5
  br label %60, !llvm.loop !19

124:                                              ; preds = %116, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %140

125:                                              ; preds = %68
  %126 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4)
          to label %127 unwind label %73

127:                                              ; preds = %125
  %128 = load ptr, ptr %9, align 8, !tbaa !9
  invoke void @ggml_gallocr_free(ptr noundef %128)
          to label %129 unwind label %73

129:                                              ; preds = %127
  %130 = getelementptr inbounds %struct.simple_model, ptr %8, i32 0, i32 4
  %131 = load ptr, ptr %130, align 8, !tbaa !20
  invoke void @ggml_free(ptr noundef %131)
          to label %132 unwind label %73

132:                                              ; preds = %129
  %133 = getelementptr inbounds %struct.simple_model, ptr %8, i32 0, i32 3
  %134 = load ptr, ptr %133, align 8, !tbaa !21
  invoke void @ggml_backend_buffer_free(ptr noundef %134)
          to label %135 unwind label %73

135:                                              ; preds = %132
  %136 = getelementptr inbounds %struct.simple_model, ptr %8, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !11
  invoke void @ggml_backend_free(ptr noundef %137)
          to label %138 unwind label %73

138:                                              ; preds = %135
  store i32 0, ptr %1, align 4
  store i32 1, ptr %18, align 4
  call void @_ZNSt6vectorIfSaIfEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %139 = load i32, ptr %1, align 4
  ret i32 %139

140:                                              ; preds = %124, %73
  call void @_ZNSt6vectorIfSaIfEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #8
  br label %141

141:                                              ; preds = %140, %69
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %15, align 8
  %144 = load i32, ptr %16, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146
}

declare void @ggml_time_init() #3

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

declare ptr @ggml_gallocr_new(ptr noundef) #3

declare ptr @ggml_backend_get_default_buffer_type(ptr noundef) #3

declare zeroext i1 @ggml_gallocr_reserve(ptr noundef, ptr noundef) #3

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

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

declare i64 @ggml_nelements(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIfEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #7 align 2

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

declare void @ggml_backend_tensor_get(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #7 align 2

declare void @ggml_gallocr_free(ptr noundef) #3

declare void @ggml_backend_buffer_free(ptr noundef) #3

declare void @ggml_backend_free(ptr noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIfED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #7 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse 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 = { 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 = { 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 #7 = { 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 #8 = { 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, !10, i64 16}
!12 = !{!"_ZTS12simple_model", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!12, !10, i64 32}
!21 = !{!12, !10, i64 24}


; 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.simple_model = type { ptr, ptr, ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }
%"class.std::allocator.2" = type { i8 }

@__const.main.matrix_A = external hidden unnamed_addr constant [8 x float], align 16
@__const.main.matrix_B = external hidden unnamed_addr constant [6 x float], align 16
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10load_modelR12simple_modelPfS1_iiii(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

declare i64 @ggml_nbytes(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z11build_graphRK12simple_model(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

declare void @ggml_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z7computeRK12simple_modelP12ggml_gallocr(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca [8 x float], align 16
  %2 = alloca [6 x float], align 16
  %3 = alloca %struct.simple_model, align 8
  %4 = alloca %"class.std::vector.0", align 8
  %5 = alloca %"class.std::allocator.2", align 1
  tail call void @ggml_time_init()
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %1, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.matrix_A, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %2, ptr noundef nonnull align 16 dereferenceable(24) @__const.main.matrix_B, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #8
  call void @_ZN12simple_modelC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #8
  call void @_Z10load_modelR12simple_modelPfS1_iiii(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef 4, i32 noundef 2, i32 noundef 3, i32 noundef 2)
  %6 = getelementptr inbounds i8, ptr %3, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = call ptr @ggml_backend_get_default_buffer_type(ptr noundef %7)
  %9 = call ptr @ggml_gallocr_new(ptr noundef %8)
  %10 = call noundef ptr @_Z11build_graphRK12simple_model(ptr noundef nonnull align 8 dereferenceable(40) %3)
  %11 = call zeroext i1 @ggml_gallocr_reserve(ptr noundef %9, ptr noundef %10)
  %12 = call i64 @ggml_gallocr_get_buffer_size(ptr noundef %9, i32 noundef 0)
  %13 = load ptr, ptr @stderr, align 8, !tbaa !10
  %14 = uitofp i64 %12 to double
  %15 = fmul double %14, 0x3F50000000000000
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.main, double noundef %15) #9
  %17 = call noundef ptr @_Z7computeRK12simple_modelP12ggml_gallocr(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #8
  %18 = call i64 @ggml_nelements(ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #8
  call void @_ZNSaIfEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  invoke void @_ZNSt6vectorIfSaIfEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %18, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %19 unwind label %34

19:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIfED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  %20 = call noundef ptr @_ZNSt6vectorIfSaIfEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  %21 = invoke i64 @ggml_nbytes(ptr noundef %17)
          to label %22 unwind label %36

22:                                               ; preds = %19
  invoke void @ggml_backend_tensor_get(ptr noundef %17, ptr noundef %20, i64 noundef 0, i64 noundef %21)
          to label %23 unwind label %36

23:                                               ; preds = %22
  %24 = getelementptr inbounds i8, ptr %17, i64 16
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = trunc i64 %25 to i32
  %27 = getelementptr inbounds i8, ptr %17, i64 24
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = trunc i64 %28 to i32
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %26, i32 noundef %29)
  %31 = load i64, ptr %27, align 8, !tbaa !11
  %32 = icmp sgt i64 %31, 0
  br i1 %32, label %.lr.ph33, label %._crit_edge34

._crit_edge34:                                    ; preds = %._crit_edge, %23
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  invoke void @ggml_gallocr_free(ptr noundef %9)
          to label %54 unwind label %36

34:                                               ; preds = %0
  %35 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIfED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  br label %63

36:                                               ; preds = %60, %57, %54, %._crit_edge34, %22, %19
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIfSaIfEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  br label %63

.lr.ph33:                                         ; preds = %23, %._crit_edge
  %indvars.iv36 = phi i64 [ %indvars.iv.next37, %._crit_edge ], [ 0, %23 ]
  %.not = icmp eq i64 %indvars.iv36, 0
  br i1 %.not, label %40, label %38

38:                                               ; preds = %.lr.ph33
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %40

40:                                               ; preds = %38, %.lr.ph33
  %41 = load i64, ptr %24, align 8, !tbaa !11
  %42 = icmp sgt i64 %41, 0
  br i1 %42, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %40
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %43 = load i64, ptr %27, align 8, !tbaa !11
  %44 = icmp sgt i64 %43, %indvars.iv.next37
  br i1 %44, label %.lr.ph33, label %._crit_edge34, !llvm.loop !13

.lr.ph:                                           ; preds = %40, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %40 ]
  %45 = phi i64 [ %52, %.lr.ph ], [ %41, %40 ]
  %46 = mul nsw i64 %45, %indvars.iv36
  %47 = add nsw i64 %46, %indvars.iv
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %47) #8
  %49 = load float, ptr %48, align 4, !tbaa !15
  %50 = fpext float %49 to double
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %50)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %52 = load i64, ptr %24, align 8, !tbaa !11
  %53 = icmp sgt i64 %52, %indvars.iv.next
  br i1 %53, label %.lr.ph, label %._crit_edge, !llvm.loop !17

54:                                               ; preds = %._crit_edge34
  %55 = getelementptr inbounds i8, ptr %3, i64 32
  %56 = load ptr, ptr %55, align 8, !tbaa !18
  invoke void @ggml_free(ptr noundef %56)
          to label %57 unwind label %36

57:                                               ; preds = %54
  %58 = getelementptr inbounds i8, ptr %3, i64 24
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  invoke void @ggml_backend_buffer_free(ptr noundef %59)
          to label %60 unwind label %36

60:                                               ; preds = %57
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @ggml_backend_free(ptr noundef %61)
          to label %62 unwind label %36

62:                                               ; preds = %60
  call void @_ZNSt6vectorIfSaIfEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  ret i32 0

63:                                               ; preds = %36, %34
  %.pn = phi { ptr, i32 } [ %37, %36 ], [ %35, %34 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn
}

declare void @ggml_time_init() local_unnamed_addr #3

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

declare ptr @ggml_gallocr_new(ptr noundef) local_unnamed_addr #3

declare ptr @ggml_backend_get_default_buffer_type(ptr noundef) local_unnamed_addr #3

declare zeroext i1 @ggml_gallocr_reserve(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

declare i64 @ggml_nelements(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIfEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #7 align 2

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

declare void @ggml_backend_tensor_get(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

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

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

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

declare void @ggml_gallocr_free(ptr noundef) local_unnamed_addr #3

declare void @ggml_backend_buffer_free(ptr noundef) local_unnamed_addr #3

declare void @ggml_backend_free(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIfED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #7 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse 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 = { 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 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { 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 16}
!6 = !{!"_ZTS12simple_model", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !8, i64 0}
!17 = distinct !{!17, !14}
!18 = !{!6, !7, i64 32}
!19 = !{!6, !7, i64 24}


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