; LLVM IR from ggml-org/ggml :: tests/test-pad-reflect-1d.ll (Z19test_pad_reflect_1db)

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

@stderr = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@__func__._Z19test_pad_reflect_1db = external hidden unnamed_addr constant [20 x i8], align 1
@__const._Z19test_pad_reflect_1db.input_data = external hidden unnamed_addr constant [4 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_1 = external hidden unnamed_addr constant [6 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_2 = external hidden unnamed_addr constant [7 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_3 = external hidden unnamed_addr constant [7 x float], align 16
@__const._Z19test_pad_reflect_1db.input_data.9 = external hidden unnamed_addr constant [20 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_4 = external hidden unnamed_addr constant [40 x float], align 16

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: 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 @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19test_pad_reflect_1db(i1 noundef zeroext %0) #3 {
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  %4 = alloca %struct.ggml_init_params, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.ggml_tallocr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.ggml_init_params, align 8
  %10 = alloca %struct.ggml_init_params, align 8
  %11 = alloca %struct.ggml_tallocr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca [4 x float], align 16
  %14 = alloca [6 x float], align 16
  %15 = alloca ptr, align 8
  %16 = alloca [7 x float], align 16
  %17 = alloca ptr, align 8
  %18 = alloca [7 x float], align 16
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct.ggml_init_params, align 8
  %22 = alloca %struct.ggml_init_params, align 8
  %23 = alloca %struct.ggml_tallocr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca [20 x float], align 16
  %26 = alloca [40 x float], align 16
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = zext i1 %0 to i8
  store i8 %29, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store ptr null, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %30 = load ptr, ptr %3, align 8, !tbaa !9
  %31 = icmp ne ptr %30, null
  br i1 %31, label %36, label %32

32:                                               ; preds = %1
  %33 = load ptr, ptr @stderr, align 8, !tbaa !9
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.8, ptr noundef @__func__._Z19test_pad_reflect_1db) #5
  %35 = call ptr @ggml_backend_cpu_init()
  store ptr %35, ptr %3, align 8, !tbaa !9
  br label %36

36:                                               ; preds = %32, %1
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  %37 = getelementptr inbounds %struct.ggml_init_params, ptr %9, i32 0, i32 0
  store i64 16777216, ptr %37, align 8, !tbaa !11
  %38 = getelementptr inbounds %struct.ggml_init_params, ptr %9, i32 0, i32 1
  store ptr null, ptr %38, align 8, !tbaa !14
  %39 = getelementptr inbounds %struct.ggml_init_params, ptr %9, i32 0, i32 2
  store i8 1, ptr %39, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %9, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @ggml_log_set(ptr noundef @_ZL25ggml_log_callback_default14ggml_log_levelPKcPv, ptr noundef null)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %4, i64 24, i1 false), !tbaa.struct !16
  %40 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %10)
  store ptr %40, ptr %6, align 8, !tbaa !9
  %41 = load ptr, ptr %3, align 8, !tbaa !9
  %42 = call ptr @ggml_backend_alloc_buffer(ptr noundef %41, i64 noundef 16777216)
  store ptr %42, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #5
  %43 = load ptr, ptr %5, align 8, !tbaa !9
  call void @ggml_tallocr_new(ptr dead_on_unwind writable sret(%struct.ggml_tallocr) align 8 %11, ptr noundef %43)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %11, i64 32, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  %44 = load ptr, ptr %3, align 8, !tbaa !9
  %45 = call ptr @ggml_backend_get_default_buffer_type(ptr noundef %44)
  %46 = call ptr @ggml_gallocr_new(ptr noundef %45)
  store ptr %46, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %47 = load ptr, ptr %6, align 8, !tbaa !9
  %48 = call ptr @ggml_new_tensor_1d(ptr noundef %47, i32 noundef 0, i64 noundef 4)
  store ptr %48, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 @__const._Z19test_pad_reflect_1db.input_data, i64 16, i1 false)
  %49 = load ptr, ptr %12, align 8, !tbaa !9
  %50 = call i32 @ggml_tallocr_alloc(ptr noundef %7, ptr noundef %49)
  %51 = load ptr, ptr %3, align 8, !tbaa !9
  %52 = call zeroext i1 @ggml_backend_is_cpu(ptr noundef %51)
  br i1 %52, label %53, label %60

53:                                               ; preds = %36
  %54 = load ptr, ptr %12, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.ggml_tensor, ptr %54, i32 0, i32 10
  %56 = load ptr, ptr %55, align 8, !tbaa !19
  %57 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 0
  %58 = load ptr, ptr %12, align 8, !tbaa !9
  %59 = call i64 @ggml_nbytes(ptr noundef %58)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %56, ptr align 16 %57, i64 %59, i1 false)
  br label %65

60:                                               ; preds = %36
  %61 = load ptr, ptr %12, align 8, !tbaa !9
  %62 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 0
  %63 = load ptr, ptr %12, align 8, !tbaa !9
  %64 = call i64 @ggml_nbytes(ptr noundef %63)
  call void @ggml_backend_tensor_set(ptr noundef %61, ptr noundef %62, i64 noundef 0, i64 noundef %64)
  br label %65

65:                                               ; preds = %60, %53
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 @__const._Z19test_pad_reflect_1db.expected_1, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %66 = load ptr, ptr %6, align 8, !tbaa !9
  %67 = load ptr, ptr %12, align 8, !tbaa !9
  %68 = call ptr @ggml_pad_reflect_1d(ptr noundef %66, ptr noundef %67, i32 noundef 1, i32 noundef 1)
  store ptr %68, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 28, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 @__const._Z19test_pad_reflect_1db.expected_2, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %69 = load ptr, ptr %6, align 8, !tbaa !9
  %70 = load ptr, ptr %12, align 8, !tbaa !9
  %71 = call ptr @ggml_pad_reflect_1d(ptr noundef %69, ptr noundef %70, i32 noundef 2, i32 noundef 1)
  store ptr %71, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 28, ptr %18) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 @__const._Z19test_pad_reflect_1db.expected_3, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %72 = load ptr, ptr %6, align 8, !tbaa !9
  %73 = load ptr, ptr %12, align 8, !tbaa !9
  %74 = call ptr @ggml_pad_reflect_1d(ptr noundef %72, ptr noundef %73, i32 noundef 1, i32 noundef 2)
  store ptr %74, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %75 = load ptr, ptr %6, align 8, !tbaa !9
  %76 = call ptr @ggml_new_graph(ptr noundef %75)
  store ptr %76, ptr %20, align 8, !tbaa !9
  %77 = load ptr, ptr %20, align 8, !tbaa !9
  %78 = load ptr, ptr %15, align 8, !tbaa !9
  call void @ggml_build_forward_expand(ptr noundef %77, ptr noundef %78)
  %79 = load ptr, ptr %20, align 8, !tbaa !9
  %80 = load ptr, ptr %17, align 8, !tbaa !9
  call void @ggml_build_forward_expand(ptr noundef %79, ptr noundef %80)
  %81 = load ptr, ptr %20, align 8, !tbaa !9
  %82 = load ptr, ptr %19, align 8, !tbaa !9
  call void @ggml_build_forward_expand(ptr noundef %81, ptr noundef %82)
  %83 = load ptr, ptr %8, align 8, !tbaa !9
  %84 = load ptr, ptr %20, align 8, !tbaa !9
  %85 = call zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef %83, ptr noundef %84)
  %86 = load ptr, ptr %3, align 8, !tbaa !9
  %87 = load ptr, ptr %20, align 8, !tbaa !9
  %88 = call i32 @ggml_backend_graph_compute(ptr noundef %86, ptr noundef %87)
  %89 = load ptr, ptr %15, align 8, !tbaa !9
  %90 = getelementptr inbounds [6 x float], ptr %14, i64 0, i64 0
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %89, ptr noundef %90, i32 noundef 6, i32 noundef 1, i32 noundef 1)
  %91 = load ptr, ptr %17, align 8, !tbaa !9
  %92 = getelementptr inbounds [7 x float], ptr %16, i64 0, i64 0
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %91, ptr noundef %92, i32 noundef 7, i32 noundef 1, i32 noundef 1)
  %93 = load ptr, ptr %19, align 8, !tbaa !9
  %94 = getelementptr inbounds [7 x float], ptr %18, i64 0, i64 0
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %93, ptr noundef %94, i32 noundef 7, i32 noundef 1, i32 noundef 1)
  %95 = load ptr, ptr %6, align 8, !tbaa !9
  call void @ggml_free(ptr noundef %95)
  %96 = load ptr, ptr %5, align 8, !tbaa !9
  call void @ggml_backend_buffer_free(ptr noundef %96)
  %97 = load ptr, ptr %8, align 8, !tbaa !9
  call void @ggml_gallocr_free(ptr noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 28, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 28, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #5
  %98 = getelementptr inbounds %struct.ggml_init_params, ptr %21, i32 0, i32 0
  store i64 16777216, ptr %98, align 8, !tbaa !11
  %99 = getelementptr inbounds %struct.ggml_init_params, ptr %21, i32 0, i32 1
  store ptr null, ptr %99, align 8, !tbaa !14
  %100 = getelementptr inbounds %struct.ggml_init_params, ptr %21, i32 0, i32 2
  store i8 1, ptr %100, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %21, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #5
  call void @ggml_log_set(ptr noundef @_ZL25ggml_log_callback_default14ggml_log_levelPKcPv, ptr noundef null)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %4, i64 24, i1 false), !tbaa.struct !16
  %101 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %22)
  store ptr %101, ptr %6, align 8, !tbaa !9
  %102 = load ptr, ptr %3, align 8, !tbaa !9
  %103 = call ptr @ggml_backend_alloc_buffer(ptr noundef %102, i64 noundef 16777216)
  store ptr %103, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #5
  %104 = load ptr, ptr %5, align 8, !tbaa !9
  call void @ggml_tallocr_new(ptr dead_on_unwind writable sret(%struct.ggml_tallocr) align 8 %23, ptr noundef %104)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %23, i64 32, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #5
  %105 = load ptr, ptr %3, align 8, !tbaa !9
  %106 = call ptr @ggml_backend_get_default_buffer_type(ptr noundef %105)
  %107 = call ptr @ggml_gallocr_new(ptr noundef %106)
  store ptr %107, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %108 = load ptr, ptr %6, align 8, !tbaa !9
  %109 = call ptr @ggml_new_tensor_2d(ptr noundef %108, i32 noundef 0, i64 noundef 5, i64 noundef 4)
  store ptr %109, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 80, ptr %25) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 @__const._Z19test_pad_reflect_1db.input_data.9, i64 80, i1 false)
  %110 = load ptr, ptr %24, align 8, !tbaa !9
  %111 = call i32 @ggml_tallocr_alloc(ptr noundef %7, ptr noundef %110)
  %112 = load ptr, ptr %3, align 8, !tbaa !9
  %113 = call zeroext i1 @ggml_backend_is_cpu(ptr noundef %112)
  br i1 %113, label %114, label %121

114:                                              ; preds = %65
  %115 = load ptr, ptr %24, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct.ggml_tensor, ptr %115, i32 0, i32 10
  %117 = load ptr, ptr %116, align 8, !tbaa !19
  %118 = getelementptr inbounds [20 x float], ptr %25, i64 0, i64 0
  %119 = load ptr, ptr %24, align 8, !tbaa !9
  %120 = call i64 @ggml_nbytes(ptr noundef %119)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %117, ptr align 16 %118, i64 %120, i1 false)
  br label %126

121:                                              ; preds = %65
  %122 = load ptr, ptr %24, align 8, !tbaa !9
  %123 = getelementptr inbounds [20 x float], ptr %25, i64 0, i64 0
  %124 = load ptr, ptr %24, align 8, !tbaa !9
  %125 = call i64 @ggml_nbytes(ptr noundef %124)
  call void @ggml_backend_tensor_set(ptr noundef %122, ptr noundef %123, i64 noundef 0, i64 noundef %125)
  br label %126

126:                                              ; preds = %121, %114
  call void @llvm.lifetime.start.p0(i64 160, ptr %26) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %26, ptr align 16 @__const._Z19test_pad_reflect_1db.expected_4, i64 160, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %127 = load ptr, ptr %6, align 8, !tbaa !9
  %128 = load ptr, ptr %24, align 8, !tbaa !9
  %129 = call ptr @ggml_pad_reflect_1d(ptr noundef %127, ptr noundef %128, i32 noundef 3, i32 noundef 2)
  store ptr %129, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %130 = load ptr, ptr %6, align 8, !tbaa !9
  %131 = call ptr @ggml_new_graph(ptr noundef %130)
  store ptr %131, ptr %28, align 8, !tbaa !9
  %132 = load ptr, ptr %28, align 8, !tbaa !9
  %133 = load ptr, ptr %27, align 8, !tbaa !9
  call void @ggml_build_forward_expand(ptr noundef %132, ptr noundef %133)
  %134 = load ptr, ptr %8, align 8, !tbaa !9
  %135 = load ptr, ptr %28, align 8, !tbaa !9
  %136 = call zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef %134, ptr noundef %135)
  %137 = load ptr, ptr %3, align 8, !tbaa !9
  %138 = load ptr, ptr %28, align 8, !tbaa !9
  %139 = call i32 @ggml_backend_graph_compute(ptr noundef %137, ptr noundef %138)
  %140 = load ptr, ptr %27, align 8, !tbaa !9
  %141 = getelementptr inbounds [40 x float], ptr %26, i64 0, i64 0
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %140, ptr noundef %141, i32 noundef 10, i32 noundef 4, i32 noundef 1)
  %142 = load ptr, ptr %6, align 8, !tbaa !9
  call void @ggml_free(ptr noundef %142)
  %143 = load ptr, ptr %8, align 8, !tbaa !9
  call void @ggml_gallocr_free(ptr noundef %143)
  %144 = load ptr, ptr %5, align 8, !tbaa !9
  call void @ggml_backend_buffer_free(ptr noundef %144)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  %145 = load ptr, ptr %3, align 8, !tbaa !9
  call void @ggml_backend_free(ptr noundef %145)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

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

declare ptr @ggml_backend_cpu_init() #2

declare void @ggml_log_set(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL25ggml_log_callback_default14ggml_log_levelPKcPv(i32 noundef, ptr noundef, ptr noundef) #3

declare ptr @ggml_backend_alloc_buffer(ptr noundef, i64 noundef) #2

declare void @ggml_tallocr_new(ptr dead_on_unwind writable sret(%struct.ggml_tallocr) align 8, ptr noundef) #2

declare ptr @ggml_gallocr_new(ptr noundef) #2

declare ptr @ggml_backend_get_default_buffer_type(ptr noundef) #2

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

declare i32 @ggml_tallocr_alloc(ptr noundef, ptr noundef) #2

declare zeroext i1 @ggml_backend_is_cpu(ptr noundef) #2

declare i64 @ggml_nbytes(ptr noundef) #2

declare void @ggml_backend_tensor_set(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #2

declare ptr @ggml_pad_reflect_1d(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

declare ptr @ggml_new_graph(ptr noundef) #2

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

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

declare i32 @ggml_backend_graph_compute(ptr noundef, ptr noundef) #2

declare void @ggml_free(ptr noundef) #2

declare void @ggml_backend_buffer_free(ptr noundef) #2

declare void @ggml_gallocr_free(ptr noundef) #2

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

declare void @ggml_backend_free(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { 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 = { 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 = !{!"bool", !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, !13, i64 0}
!12 = !{!"_ZTS16ggml_init_params", !13, i64 0, !10, i64 8, !6, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !6, i64 16}
!16 = !{i64 0, i64 8, !17, i64 8, i64 8, !9, i64 16, i64 1, !5}
!17 = !{!13, !13, i64 0}
!18 = !{i64 0, i64 8, !9, i64 8, i64 8, !9, i64 16, i64 8, !17, i64 24, i64 8, !17}
!19 = !{!20, !10, i64 248}
!20 = !{!"_ZTS11ggml_tensor", !21, i64 0, !10, i64 8, !7, i64 16, !7, i64 48, !22, i64 80, !7, i64 84, !23, i64 148, !7, i64 152, !10, i64 232, !13, i64 240, !10, i64 248, !7, i64 256, !10, i64 320, !7, i64 328}
!21 = !{!"_ZTS9ggml_type", !7, i64 0}
!22 = !{!"_ZTS7ggml_op", !7, i64 0}
!23 = !{!"int", !7, i64 0}


; 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.ggml_tallocr = type { ptr, ptr, i64, i64 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@__func__._Z19test_pad_reflect_1db = external hidden unnamed_addr constant [20 x i8], align 1
@__const._Z19test_pad_reflect_1db.input_data = external hidden unnamed_addr constant [4 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_1 = external hidden unnamed_addr constant [6 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_2 = external hidden unnamed_addr constant [7 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_3 = external hidden unnamed_addr constant [7 x float], align 16
@__const._Z19test_pad_reflect_1db.input_data.9 = external hidden unnamed_addr constant [20 x float], align 16
@__const._Z19test_pad_reflect_1db.expected_4 = external hidden unnamed_addr constant [40 x float], align 16

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; 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 @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19test_pad_reflect_1db(i1 noundef zeroext %0) local_unnamed_addr #3 {
  %2 = alloca %struct.ggml_tallocr, align 8
  %3 = alloca %struct.ggml_init_params, align 8
  %4 = alloca [4 x float], align 16
  %5 = alloca [6 x float], align 16
  %6 = alloca [7 x float], align 16
  %7 = alloca [7 x float], align 16
  %8 = alloca %struct.ggml_init_params, align 8
  %9 = alloca %struct.ggml_tallocr, align 8
  %10 = alloca [20 x float], align 16
  %11 = alloca [40 x float], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #5
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.8, ptr noundef nonnull @__func__._Z19test_pad_reflect_1db) #6
  %14 = tail call ptr @ggml_backend_cpu_init()
  tail call void @ggml_log_set(ptr noundef nonnull @_ZL25ggml_log_callback_default14ggml_log_levelPKcPv, ptr noundef null)
  store i64 16777216, ptr %3, align 8, !tbaa !9
  %.sroa.654.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store ptr null, ptr %.sroa.654.0..sroa_idx, align 8, !tbaa !5
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 16
  store i8 1, ptr %.sroa.8.0..sroa_idx, align 8, !tbaa !11
  %15 = tail call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %3)
  %16 = tail call ptr @ggml_backend_alloc_buffer(ptr noundef %14, i64 noundef 16777216)
  call void @ggml_tallocr_new(ptr dead_on_unwind nonnull writable sret(%struct.ggml_tallocr) align 8 %2, ptr noundef %16)
  %17 = call ptr @ggml_backend_get_default_buffer_type(ptr noundef %14)
  %18 = call ptr @ggml_gallocr_new(ptr noundef %17)
  %19 = call ptr @ggml_new_tensor_1d(ptr noundef %15, i32 noundef 0, i64 noundef 4)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) @__const._Z19test_pad_reflect_1db.input_data, i64 16, i1 false)
  %20 = call i32 @ggml_tallocr_alloc(ptr noundef nonnull %2, ptr noundef %19)
  %21 = call zeroext i1 @ggml_backend_is_cpu(ptr noundef %14)
  br i1 %21, label %22, label %26

22:                                               ; preds = %1
  %23 = getelementptr inbounds i8, ptr %19, i64 248
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = call i64 @ggml_nbytes(ptr noundef %19)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %24, ptr nonnull align 16 %4, i64 %25, i1 false)
  br label %28

26:                                               ; preds = %1
  %27 = call i64 @ggml_nbytes(ptr noundef %19)
  call void @ggml_backend_tensor_set(ptr noundef %19, ptr noundef nonnull %4, i64 noundef 0, i64 noundef %27)
  br label %28

28:                                               ; preds = %26, %22
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %5, ptr noundef nonnull align 16 dereferenceable(24) @__const._Z19test_pad_reflect_1db.expected_1, i64 24, i1 false)
  %29 = call ptr @ggml_pad_reflect_1d(ptr noundef %15, ptr noundef %19, i32 noundef 1, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(28) %6, ptr noundef nonnull align 16 dereferenceable(28) @__const._Z19test_pad_reflect_1db.expected_2, i64 28, i1 false)
  %30 = call ptr @ggml_pad_reflect_1d(ptr noundef %15, ptr noundef %19, i32 noundef 2, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(28) %7, ptr noundef nonnull align 16 dereferenceable(28) @__const._Z19test_pad_reflect_1db.expected_3, i64 28, i1 false)
  %31 = call ptr @ggml_pad_reflect_1d(ptr noundef %15, ptr noundef %19, i32 noundef 1, i32 noundef 2)
  %32 = call ptr @ggml_new_graph(ptr noundef %15)
  call void @ggml_build_forward_expand(ptr noundef %32, ptr noundef %29)
  call void @ggml_build_forward_expand(ptr noundef %32, ptr noundef %30)
  call void @ggml_build_forward_expand(ptr noundef %32, ptr noundef %31)
  %33 = call zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef %18, ptr noundef %32)
  %34 = call i32 @ggml_backend_graph_compute(ptr noundef %14, ptr noundef %32)
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %29, ptr noundef nonnull %5, i32 noundef 6, i32 noundef 1, i32 noundef 1)
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %30, ptr noundef nonnull %6, i32 noundef 7, i32 noundef 1, i32 noundef 1)
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %31, ptr noundef nonnull %7, i32 noundef 7, i32 noundef 1, i32 noundef 1)
  call void @ggml_free(ptr noundef %15)
  call void @ggml_backend_buffer_free(ptr noundef %16)
  call void @ggml_gallocr_free(ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @ggml_log_set(ptr noundef nonnull @_ZL25ggml_log_callback_default14ggml_log_levelPKcPv, ptr noundef null)
  store i64 16777216, ptr %8, align 8, !tbaa !9
  %.sroa.654.0..sroa_idx55 = getelementptr inbounds i8, ptr %8, i64 8
  store ptr null, ptr %.sroa.654.0..sroa_idx55, align 8, !tbaa !5
  %.sroa.8.0..sroa_idx57 = getelementptr inbounds i8, ptr %8, i64 16
  store i8 1, ptr %.sroa.8.0..sroa_idx57, align 8, !tbaa !11
  %35 = call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %8)
  %36 = call ptr @ggml_backend_alloc_buffer(ptr noundef %14, i64 noundef 16777216)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  call void @ggml_tallocr_new(ptr dead_on_unwind nonnull writable sret(%struct.ggml_tallocr) align 8 %9, ptr noundef %36)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %9, i64 32, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  %37 = call ptr @ggml_backend_get_default_buffer_type(ptr noundef %14)
  %38 = call ptr @ggml_gallocr_new(ptr noundef %37)
  %39 = call ptr @ggml_new_tensor_2d(ptr noundef %35, i32 noundef 0, i64 noundef 5, i64 noundef 4)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %10) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %10, ptr noundef nonnull align 16 dereferenceable(80) @__const._Z19test_pad_reflect_1db.input_data.9, i64 80, i1 false)
  %40 = call i32 @ggml_tallocr_alloc(ptr noundef nonnull %2, ptr noundef %39)
  %41 = call zeroext i1 @ggml_backend_is_cpu(ptr noundef %14)
  br i1 %41, label %42, label %46

42:                                               ; preds = %28
  %43 = getelementptr inbounds i8, ptr %39, i64 248
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = call i64 @ggml_nbytes(ptr noundef %39)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %44, ptr nonnull align 16 %10, i64 %45, i1 false)
  br label %48

46:                                               ; preds = %28
  %47 = call i64 @ggml_nbytes(ptr noundef %39)
  call void @ggml_backend_tensor_set(ptr noundef %39, ptr noundef nonnull %10, i64 noundef 0, i64 noundef %47)
  br label %48

48:                                               ; preds = %46, %42
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %11) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(160) %11, ptr noundef nonnull align 16 dereferenceable(160) @__const._Z19test_pad_reflect_1db.expected_4, i64 160, i1 false)
  %49 = call ptr @ggml_pad_reflect_1d(ptr noundef %35, ptr noundef %39, i32 noundef 3, i32 noundef 2)
  %50 = call ptr @ggml_new_graph(ptr noundef %35)
  call void @ggml_build_forward_expand(ptr noundef %50, ptr noundef %49)
  %51 = call zeroext i1 @ggml_gallocr_alloc_graph(ptr noundef %38, ptr noundef %50)
  %52 = call i32 @ggml_backend_graph_compute(ptr noundef %14, ptr noundef %50)
  call void @_Z12check_tensorP11ggml_tensorPfiii(ptr noundef %49, ptr noundef nonnull %11, i32 noundef 10, i32 noundef 4, i32 noundef 1)
  call void @ggml_free(ptr noundef %35)
  call void @ggml_gallocr_free(ptr noundef %38)
  call void @ggml_backend_buffer_free(ptr noundef %36)
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %10) #5
  call void @ggml_backend_free(ptr noundef %14)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  ret void
}

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

declare ptr @ggml_backend_cpu_init() local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL25ggml_log_callback_default14ggml_log_levelPKcPv(i32 noundef, ptr noundef, ptr noundef) #3

declare ptr @ggml_backend_alloc_buffer(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @ggml_tallocr_new(ptr dead_on_unwind writable sret(%struct.ggml_tallocr) align 8, ptr noundef) local_unnamed_addr #2

declare ptr @ggml_gallocr_new(ptr noundef) local_unnamed_addr #2

declare ptr @ggml_backend_get_default_buffer_type(ptr noundef) local_unnamed_addr #2

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

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

declare zeroext i1 @ggml_backend_is_cpu(ptr noundef) local_unnamed_addr #2

declare i64 @ggml_nbytes(ptr noundef) local_unnamed_addr #2

declare void @ggml_backend_tensor_set(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

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

declare ptr @ggml_new_graph(ptr noundef) local_unnamed_addr #2

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

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

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

declare void @ggml_free(ptr noundef) local_unnamed_addr #2

declare void @ggml_backend_buffer_free(ptr noundef) local_unnamed_addr #2

declare void @ggml_gallocr_free(ptr noundef) local_unnamed_addr #2

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

declare void @ggml_backend_free(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree 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 = { 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 #5 = { nounwind }
attributes #6 = { cold nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 248}
!14 = !{!"_ZTS11ggml_tensor", !15, i64 0, !6, i64 8, !7, i64 16, !7, i64 48, !16, i64 80, !7, i64 84, !17, i64 148, !7, i64 152, !6, i64 232, !10, i64 240, !6, i64 248, !7, i64 256, !6, i64 320, !7, i64 328}
!15 = !{!"_ZTS9ggml_type", !7, i64 0}
!16 = !{!"_ZTS7ggml_op", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !9, i64 24, i64 8, !9}


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