; LLVM IR from ggml-org/ggml :: tests/test-conv-transpose-1d.ll (Z11build_graphRK10test_model)

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

%"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.ggml_init_params = type { i64, ptr, i8 }
%"class.std::allocator" = type { i8 }
%struct.test_model = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@__dso_handle = external hidden global i8
@_ZZ11build_graphRK10test_modelE8buf_size = external hidden global i64, align 8
@_ZGVZ11build_graphRK10test_modelE8buf_size = external hidden global i64, align 8
@_ZZ11build_graphRK10test_modelE3buf = external hidden global %"class.std::vector", align 8
@_ZGVZ11build_graphRK10test_modelE3buf = external hidden global i64, align 8
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) #0

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

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

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

declare i64 @ggml_tensor_overhead() #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z11build_graphRK10test_model(ptr noundef nonnull align 8 dereferenceable(104) %0) #4 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::allocator", align 1
  %6 = alloca %struct.ggml_init_params, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.ggml_init_params, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %21 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE8buf_size acquire, align 8
  %22 = icmp eq i8 %21, 0
  br i1 %22, label %23, label %33, !prof !9

23:                                               ; preds = %1
  %24 = call i32 @__cxa_guard_acquire(ptr @_ZGVZ11build_graphRK10test_modelE8buf_size) #0
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %33

26:                                               ; preds = %23
  %27 = invoke i64 @ggml_tensor_overhead()
          to label %28 unwind label %174

28:                                               ; preds = %26
  %29 = mul i64 %27, 2048
  %30 = invoke i64 @ggml_graph_overhead()
          to label %31 unwind label %174

31:                                               ; preds = %28
  %32 = add i64 %29, %30
  store i64 %32, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !10
  call void @__cxa_guard_release(ptr @_ZGVZ11build_graphRK10test_modelE8buf_size) #0
  br label %33

33:                                               ; preds = %31, %23, %1
  %34 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE3buf acquire, align 8
  %35 = icmp eq i8 %34, 0
  br i1 %35, label %36, label %43, !prof !9

36:                                               ; preds = %33
  %37 = call i32 @__cxa_guard_acquire(ptr @_ZGVZ11build_graphRK10test_modelE3buf) #0
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %43

39:                                               ; preds = %36
  %40 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #0
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #0
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf, i64 noundef %40, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %41 unwind label %178

41:                                               ; preds = %39
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #0
  %42 = call i32 @__cxa_atexit(ptr @_ZNSt6vectorIhSaIhEED2Ev, ptr @_ZZ11build_graphRK10test_modelE3buf, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZ11build_graphRK10test_modelE3buf) #0
  br label %43

43:                                               ; preds = %41, %36, %33
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #0
  %44 = getelementptr inbounds %struct.ggml_init_params, ptr %6, i32 0, i32 0
  %45 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !10
  store i64 %45, ptr %44, align 8, !tbaa !12
  %46 = getelementptr inbounds %struct.ggml_init_params, ptr %6, i32 0, i32 1
  %47 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf) #0
  store ptr %47, ptr %46, align 8, !tbaa !15
  %48 = getelementptr inbounds %struct.ggml_init_params, ptr %6, i32 0, i32 2
  store i8 1, ptr %48, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %6, i64 24, i1 false), !tbaa.struct !17
  %49 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %8)
  store ptr %49, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #0
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call ptr @ggml_new_graph(ptr noundef %50)
  store ptr %51, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #0
  store i32 1, ptr %10, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #0
  store i32 0, ptr %11, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #0
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #0
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.test_model, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.test_model, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !23
  %59 = load i32, ptr %10, align 4, !tbaa !19
  %60 = load i32, ptr %11, align 4, !tbaa !19
  %61 = load i32, ptr %12, align 4, !tbaa !19
  %62 = call ptr @ggml_conv_transpose_1d(ptr noundef %52, ptr noundef %55, ptr noundef %58, i32 noundef %59, i32 noundef %60, i32 noundef %61)
  store ptr %62, ptr %13, align 8, !tbaa !5
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = call ptr @ggml_set_name(ptr noundef %63, ptr noundef @.str.2)
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %65, ptr noundef %66)
  store i32 1, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #0
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.test_model, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !24
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.test_model, ptr %71, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !25
  %74 = load i32, ptr %10, align 4, !tbaa !19
  %75 = load i32, ptr %11, align 4, !tbaa !19
  %76 = load i32, ptr %12, align 4, !tbaa !19
  %77 = call ptr @ggml_conv_transpose_1d(ptr noundef %67, ptr noundef %70, ptr noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76)
  store ptr %77, ptr %14, align 8, !tbaa !5
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = call ptr @ggml_set_name(ptr noundef %78, ptr noundef @.str.3)
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %80, ptr noundef %81)
  store i32 1, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #0
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.test_model, ptr %83, i32 0, i32 4
  %85 = load ptr, ptr %84, align 8, !tbaa !26
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.test_model, ptr %86, i32 0, i32 5
  %88 = load ptr, ptr %87, align 8, !tbaa !27
  %89 = load i32, ptr %10, align 4, !tbaa !19
  %90 = load i32, ptr %11, align 4, !tbaa !19
  %91 = load i32, ptr %12, align 4, !tbaa !19
  %92 = call ptr @ggml_conv_transpose_1d(ptr noundef %82, ptr noundef %85, ptr noundef %88, i32 noundef %89, i32 noundef %90, i32 noundef %91)
  store ptr %92, ptr %15, align 8, !tbaa !5
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = call ptr @ggml_set_name(ptr noundef %93, ptr noundef @.str.4)
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = load ptr, ptr %15, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %95, ptr noundef %96)
  store i32 2, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #0
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.test_model, ptr %98, i32 0, i32 4
  %100 = load ptr, ptr %99, align 8, !tbaa !26
  %101 = load ptr, ptr %2, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.test_model, ptr %101, i32 0, i32 5
  %103 = load ptr, ptr %102, align 8, !tbaa !27
  %104 = load i32, ptr %10, align 4, !tbaa !19
  %105 = load i32, ptr %11, align 4, !tbaa !19
  %106 = load i32, ptr %12, align 4, !tbaa !19
  %107 = call ptr @ggml_conv_transpose_1d(ptr noundef %97, ptr noundef %100, ptr noundef %103, i32 noundef %104, i32 noundef %105, i32 noundef %106)
  store ptr %107, ptr %16, align 8, !tbaa !5
  %108 = load ptr, ptr %16, align 8, !tbaa !5
  %109 = call ptr @ggml_set_name(ptr noundef %108, ptr noundef @.str.5)
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = load ptr, ptr %16, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %110, ptr noundef %111)
  store i32 1, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #0
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.test_model, ptr %113, i32 0, i32 6
  %115 = load ptr, ptr %114, align 8, !tbaa !28
  %116 = load ptr, ptr %2, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.test_model, ptr %116, i32 0, i32 7
  %118 = load ptr, ptr %117, align 8, !tbaa !29
  %119 = load i32, ptr %10, align 4, !tbaa !19
  %120 = load i32, ptr %11, align 4, !tbaa !19
  %121 = load i32, ptr %12, align 4, !tbaa !19
  %122 = call ptr @ggml_conv_transpose_1d(ptr noundef %112, ptr noundef %115, ptr noundef %118, i32 noundef %119, i32 noundef %120, i32 noundef %121)
  store ptr %122, ptr %17, align 8, !tbaa !5
  %123 = load ptr, ptr %17, align 8, !tbaa !5
  %124 = call ptr @ggml_set_name(ptr noundef %123, ptr noundef @.str.6)
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = load ptr, ptr %17, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %125, ptr noundef %126)
  store i32 2, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #0
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = load ptr, ptr %2, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.test_model, ptr %128, i32 0, i32 6
  %130 = load ptr, ptr %129, align 8, !tbaa !28
  %131 = load ptr, ptr %2, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.test_model, ptr %131, i32 0, i32 7
  %133 = load ptr, ptr %132, align 8, !tbaa !29
  %134 = load i32, ptr %10, align 4, !tbaa !19
  %135 = load i32, ptr %11, align 4, !tbaa !19
  %136 = load i32, ptr %12, align 4, !tbaa !19
  %137 = call ptr @ggml_conv_transpose_1d(ptr noundef %127, ptr noundef %130, ptr noundef %133, i32 noundef %134, i32 noundef %135, i32 noundef %136)
  store ptr %137, ptr %18, align 8, !tbaa !5
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  %139 = call ptr @ggml_set_name(ptr noundef %138, ptr noundef @.str.7)
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load ptr, ptr %18, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %140, ptr noundef %141)
  store i32 3, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #0
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = load ptr, ptr %2, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.test_model, ptr %143, i32 0, i32 6
  %145 = load ptr, ptr %144, align 8, !tbaa !28
  %146 = load ptr, ptr %2, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.test_model, ptr %146, i32 0, i32 7
  %148 = load ptr, ptr %147, align 8, !tbaa !29
  %149 = load i32, ptr %10, align 4, !tbaa !19
  %150 = load i32, ptr %11, align 4, !tbaa !19
  %151 = load i32, ptr %12, align 4, !tbaa !19
  %152 = call ptr @ggml_conv_transpose_1d(ptr noundef %142, ptr noundef %145, ptr noundef %148, i32 noundef %149, i32 noundef %150, i32 noundef %151)
  store ptr %152, ptr %19, align 8, !tbaa !5
  %153 = load ptr, ptr %19, align 8, !tbaa !5
  %154 = call ptr @ggml_set_name(ptr noundef %153, ptr noundef @.str.8)
  %155 = load ptr, ptr %9, align 8, !tbaa !5
  %156 = load ptr, ptr %19, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %155, ptr noundef %156)
  store i32 8, ptr %10, align 4, !tbaa !19
  store i32 0, ptr %11, align 4, !tbaa !19
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #0
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  %158 = load ptr, ptr %2, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.test_model, ptr %158, i32 0, i32 8
  %160 = load ptr, ptr %159, align 8, !tbaa !30
  %161 = load ptr, ptr %2, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.test_model, ptr %161, i32 0, i32 9
  %163 = load ptr, ptr %162, align 8, !tbaa !31
  %164 = load i32, ptr %10, align 4, !tbaa !19
  %165 = load i32, ptr %11, align 4, !tbaa !19
  %166 = load i32, ptr %12, align 4, !tbaa !19
  %167 = call ptr @ggml_conv_transpose_1d(ptr noundef %157, ptr noundef %160, ptr noundef %163, i32 noundef %164, i32 noundef %165, i32 noundef %166)
  store ptr %167, ptr %20, align 8, !tbaa !5
  %168 = load ptr, ptr %20, align 8, !tbaa !5
  %169 = call ptr @ggml_set_name(ptr noundef %168, ptr noundef @.str.9)
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = load ptr, ptr %20, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %170, ptr noundef %171)
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  call void @ggml_free(ptr noundef %172)
  %173 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #0
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #0
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #0
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #0
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #0
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #0
  ret ptr %173

174:                                              ; preds = %28, %26
  %175 = landingpad { ptr, i32 }
          cleanup
  %176 = extractvalue { ptr, i32 } %175, 0
  store ptr %176, ptr %3, align 8
  %177 = extractvalue { ptr, i32 } %175, 1
  store i32 %177, ptr %4, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZ11build_graphRK10test_modelE8buf_size) #0
  br label %182

178:                                              ; preds = %39
  %179 = landingpad { ptr, i32 }
          cleanup
  %180 = extractvalue { ptr, i32 } %179, 0
  store ptr %180, ptr %3, align 8
  %181 = extractvalue { ptr, i32 } %179, 1
  store i32 %181, ptr %4, align 4
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #0
  call void @__cxa_guard_abort(ptr @_ZGVZ11build_graphRK10test_modelE3buf) #0
  br label %182

182:                                              ; preds = %178, %174
  %183 = load ptr, ptr %3, align 8
  %184 = load i32, ptr %4, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186
}

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #0

declare i32 @__gxx_personality_v0(...)

declare i64 @ggml_graph_overhead() #3

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #0

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #0

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

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

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

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

declare ptr @ggml_new_graph(ptr noundef) #3

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

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

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

declare void @ggml_free(ptr noundef) #3

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"branch_weights", i32 1, i32 1048575}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_ZTS16ggml_init_params", !11, i64 0, !6, i64 8, !14, i64 16}
!14 = !{!"bool", !7, i64 0}
!15 = !{!13, !6, i64 8}
!16 = !{!13, !14, i64 16}
!17 = !{i64 0, i64 8, !10, i64 8, i64 8, !5, i64 16, i64 1, !18}
!18 = !{!14, !14, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTS10test_model", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!23 = !{!22, !6, i64 8}
!24 = !{!22, !6, i64 16}
!25 = !{!22, !6, i64 24}
!26 = !{!22, !6, i64 32}
!27 = !{!22, !6, i64 40}
!28 = !{!22, !6, i64 48}
!29 = !{!22, !6, i64 56}
!30 = !{!22, !6, i64 64}
!31 = !{!22, !6, i64 72}


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

%"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.ggml_init_params = type { i64, ptr, i8 }
%"class.std::allocator" = type { i8 }

@__dso_handle = external hidden global i8
@_ZZ11build_graphRK10test_modelE8buf_size = external hidden local_unnamed_addr global i64, align 8
@_ZGVZ11build_graphRK10test_modelE8buf_size = external hidden global i64, align 8
@_ZZ11build_graphRK10test_modelE3buf = external hidden global %"class.std::vector", align 8
@_ZGVZ11build_graphRK10test_modelE3buf = external hidden global i64, align 8
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nofree nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i64 @ggml_tensor_overhead() local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z11build_graphRK10test_model(ptr nocapture noundef nonnull readonly align 8 dereferenceable(104) %0) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca %struct.ggml_init_params, align 8
  %4 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE8buf_size acquire, align 8
  %5 = icmp eq i8 %4, 0
  br i1 %5, label %6, label %15, !prof !5

6:                                                ; preds = %1
  %7 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ11build_graphRK10test_modelE8buf_size) #5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %15, label %8

8:                                                ; preds = %6
  %9 = invoke i64 @ggml_tensor_overhead()
          to label %10 unwind label %70

10:                                               ; preds = %8
  %11 = invoke i64 @ggml_graph_overhead()
          to label %12 unwind label %70

12:                                               ; preds = %10
  %13 = shl i64 %9, 11
  %14 = add i64 %11, %13
  store i64 %14, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !6
  tail call void @__cxa_guard_release(ptr nonnull @_ZGVZ11build_graphRK10test_modelE8buf_size) #5
  br label %15

15:                                               ; preds = %12, %6, %1
  %16 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE3buf acquire, align 8
  %17 = icmp eq i8 %16, 0
  br i1 %17, label %18, label %24, !prof !5

18:                                               ; preds = %15
  %19 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ11build_graphRK10test_modelE3buf) #5
  %.not77 = icmp eq i32 %19, 0
  br i1 %.not77, label %24, label %20

20:                                               ; preds = %18
  %21 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf, i64 noundef %21, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %22 unwind label %72

22:                                               ; preds = %20
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  %23 = call i32 @__cxa_atexit(ptr nonnull @_ZNSt6vectorIhSaIhEED2Ev, ptr nonnull @_ZZ11build_graphRK10test_modelE3buf, ptr nonnull @__dso_handle) #5
  call void @__cxa_guard_release(ptr nonnull @_ZGVZ11build_graphRK10test_modelE3buf) #5
  br label %24

24:                                               ; preds = %22, %18, %15
  %25 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !6
  %26 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf) #5
  store i64 %25, ptr %3, align 8, !tbaa !6
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %26, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !10
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 16
  store i8 1, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !12
  %27 = call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %3)
  %28 = call ptr @ggml_new_graph(ptr noundef %27)
  %29 = load ptr, ptr %0, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %29, ptr noundef %31, i32 noundef 1, i32 noundef 0, i32 noundef 1)
  %33 = call ptr @ggml_set_name(ptr noundef %32, ptr noundef nonnull @.str.2)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %32)
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = getelementptr inbounds i8, ptr %0, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  %38 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %35, ptr noundef %37, i32 noundef 1, i32 noundef 0, i32 noundef 1)
  %39 = call ptr @ggml_set_name(ptr noundef %38, ptr noundef nonnull @.str.3)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %38)
  %40 = getelementptr inbounds i8, ptr %0, i64 32
  %41 = load ptr, ptr %40, align 8, !tbaa !19
  %42 = getelementptr inbounds i8, ptr %0, i64 40
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %44 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %41, ptr noundef %43, i32 noundef 1, i32 noundef 0, i32 noundef 1)
  %45 = call ptr @ggml_set_name(ptr noundef %44, ptr noundef nonnull @.str.4)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %44)
  %46 = load ptr, ptr %40, align 8, !tbaa !19
  %47 = load ptr, ptr %42, align 8, !tbaa !20
  %48 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %46, ptr noundef %47, i32 noundef 2, i32 noundef 0, i32 noundef 1)
  %49 = call ptr @ggml_set_name(ptr noundef %48, ptr noundef nonnull @.str.5)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %48)
  %50 = getelementptr inbounds i8, ptr %0, i64 48
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  %52 = getelementptr inbounds i8, ptr %0, i64 56
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %54 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %51, ptr noundef %53, i32 noundef 1, i32 noundef 0, i32 noundef 1)
  %55 = call ptr @ggml_set_name(ptr noundef %54, ptr noundef nonnull @.str.6)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %54)
  %56 = load ptr, ptr %50, align 8, !tbaa !21
  %57 = load ptr, ptr %52, align 8, !tbaa !22
  %58 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %56, ptr noundef %57, i32 noundef 2, i32 noundef 0, i32 noundef 1)
  %59 = call ptr @ggml_set_name(ptr noundef %58, ptr noundef nonnull @.str.7)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %58)
  %60 = load ptr, ptr %50, align 8, !tbaa !21
  %61 = load ptr, ptr %52, align 8, !tbaa !22
  %62 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %60, ptr noundef %61, i32 noundef 3, i32 noundef 0, i32 noundef 1)
  %63 = call ptr @ggml_set_name(ptr noundef %62, ptr noundef nonnull @.str.8)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %62)
  %64 = getelementptr inbounds i8, ptr %0, i64 64
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  %66 = getelementptr inbounds i8, ptr %0, i64 72
  %67 = load ptr, ptr %66, align 8, !tbaa !24
  %68 = call ptr @ggml_conv_transpose_1d(ptr noundef %27, ptr noundef %65, ptr noundef %67, i32 noundef 8, i32 noundef 0, i32 noundef 1)
  %69 = call ptr @ggml_set_name(ptr noundef %68, ptr noundef nonnull @.str.9)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %68)
  call void @ggml_free(ptr noundef %27)
  ret ptr %28

70:                                               ; preds = %10, %8
  %71 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_guard_abort(ptr nonnull @_ZGVZ11build_graphRK10test_modelE8buf_size) #5
  br label %74

72:                                               ; preds = %20
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZ11build_graphRK10test_modelE3buf) #5
  br label %74

74:                                               ; preds = %72, %70
  %.pn = phi { ptr, i32 } [ %73, %72 ], [ %71, %70 ]
  resume { ptr, i32 } %.pn
}

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

declare i64 @ggml_graph_overhead() local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #0

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

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

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

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

declare ptr @ggml_new_graph(ptr noundef) local_unnamed_addr #2

declare ptr @ggml_conv_transpose_1d(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare ptr @ggml_set_name(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare void @ggml_free(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { nofree nounwind }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!6 = !{!7, !7, i64 0}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!15, !11, i64 0}
!15 = !{!"_ZTS10test_model", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96}
!16 = !{!15, !11, i64 8}
!17 = !{!15, !11, i64 16}
!18 = !{!15, !11, i64 24}
!19 = !{!15, !11, i64 32}
!20 = !{!15, !11, i64 40}
!21 = !{!15, !11, i64 48}
!22 = !{!15, !11, i64 56}
!23 = !{!15, !11, i64 64}
!24 = !{!15, !11, i64 72}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass