; LLVM IR from ARM-software/Arm-2D :: examples/[template][bare-metal][STM32F746G-Discovery]/project/mdk/RTE (circle)

; 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.__arm_2d_op_control = type { %struct.anon.0 }
%struct.anon.0 = type { ptr, %struct.anon.1, %struct.anon.2, i16, i16, i16, i16, ptr, %union.anon }
%struct.anon.1 = type { ptr, ptr }
%struct.anon.2 = type { ptr, ptr }
%union.anon = type { %struct.arm_2d_op_trans_msk_opa_t }
%struct.arm_2d_op_trans_msk_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon.60, %struct.anon.61, %union.anon.62, %struct.anon.64, %struct.anon.65, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { %struct.anon.3, i64 }
%struct.anon.3 = type { ptr, ptr, %struct.anon.4, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.4 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.5 }
%struct.anon.5 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.60 = type { ptr, ptr }
%struct.anon.61 = type { ptr }
%union.anon.62 = type { %struct.anon.63 }
%struct.anon.63 = type { i32 }
%struct.anon.64 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.37, %union.anon.48, %union.anon.51 }
%union.anon.37 = type { %struct.anon.38 }
%struct.anon.38 = type { i8, %union.arm_2d_color_info_t, %union.anon.41 }
%union.arm_2d_color_info_t = type { %struct.anon.39 }
%struct.anon.39 = type { i8 }
%union.anon.41 = type { i16 }
%union.anon.48 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.49, %union.anon.50 }
%union.anon.49 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.50 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.51 = type { ptr }
%struct.anon.65 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.52, %struct.anon.53 }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.52 = type { i32 }
%struct.anon.53 = type { %struct.arm_2d_location_t, %struct.anon.54 }
%struct.anon.54 = type { %struct.arm_2d_region_t, %struct.arm_2d_tile_t }
%union.anon.73 = type { %struct.anon.74 }
%struct.anon.74 = type { i8 }
%union.anon.75 = type { %struct.anon.76 }
%struct.anon.76 = type { i8, i8 }
%struct.anon.82 = type { ptr }
%union.arm_2d_color_rgb565_t = type { i16 }
%struct.arm_2d_user_draw_circle_descriptor_t = type { %union.anon.83, %struct.arm_2d_user_draw_circle_api_params_t, %struct.arm_2d_location_t, %struct.arm_2d_region_t, i8, %union.COLOUR_TYPE_T }
%union.anon.83 = type { %struct.arm_2d_op_t }
%struct.arm_2d_op_t = type { %struct.arm_2d_op_core_t, %struct.anon.6 }
%struct.anon.6 = type { ptr, ptr }
%struct.arm_2d_user_draw_circle_api_params_t = type { ptr, i16, i8 }
%union.COLOUR_TYPE_T = type { i32 }

@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [169 x i8], align 1
@__PRETTY_FUNCTION__.arm_2dp_rgb565_user_draw_circle = external hidden unnamed_addr constant [211 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@ARM_2D_CTRL = external global %struct.__arm_2d_op_control, align 8
@ARM_2D_OP_USER_DRAW_CIRCLE = external dso_local constant { { { i8 }, %union.anon.73, i8, i8, %union.anon.75, { %struct.anon.82, [8 x i8] } } }, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @arm_2dp_rgb565_user_draw_circle(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef nonnull %3, i16 %4, i8 noundef zeroext %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca %union.arm_2d_color_rgb565_t, align 2
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.arm_2d_region_t, align 2
  %17 = alloca %struct.arm_2d_location_t, align 2
  %18 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %8, i32 0, i32 0
  store i16 %4, ptr %18, align 2
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store i8 %5, ptr %13, align 1, !tbaa !9
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = icmp ne ptr null, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %6
  br label %23

22:                                               ; preds = %6
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 98, ptr noundef @__PRETTY_FUNCTION__.arm_2dp_rgb565_user_draw_circle) #6
  unreachable

23:                                               ; preds = %21
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = icmp ne ptr null, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  br label %28

27:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 99, ptr noundef @__PRETTY_FUNCTION__.arm_2dp_rgb565_user_draw_circle) #6
  unreachable

28:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %29, ptr %14, align 8, !tbaa !5
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %31 = icmp eq ptr null, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  store ptr getelementptr inbounds (%struct.anon.0, ptr @ARM_2D_CTRL, i32 0, i32 8), ptr %14, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %32, %28
  %34 = load ptr, ptr %14, align 8, !tbaa !5
  %35 = call zeroext i1 @__arm_2d_op_acquire(ptr noundef %34)
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %203

37:                                               ; preds = %33
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.arm_2d_op_t, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.arm_2d_op_core_t, ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds %struct.anon.3, ptr %41, i32 0, i32 1
  store ptr @ARM_2D_OP_USER_DRAW_CIRCLE, ptr %42, align 8, !tbaa !9
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.arm_2d_op_t, ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds %struct.anon.6, ptr %46, i32 0, i32 0
  store ptr %43, ptr %47, align 8, !tbaa !9
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.arm_2d_op_t, ptr %50, i32 0, i32 1
  %52 = getelementptr inbounds %struct.anon.6, ptr %51, i32 0, i32 1
  store ptr %48, ptr %52, align 8, !tbaa !9
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %54, ptr align 8 %55, i64 16, i1 false), !tbaa.struct !10
  %56 = load i8, ptr %13, align 1, !tbaa !9
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %57, i32 0, i32 4
  store i8 %56, ptr %58, align 4, !tbaa !15
  %59 = load i16, ptr %8, align 2, !tbaa !9
  %60 = load ptr, ptr %14, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %60, i32 0, i32 5
  store i16 %59, ptr %61, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  call void @llvm.memset.p0.i64(ptr align 2 %16, i8 0, i64 8, i1 false)
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = icmp eq ptr null, %62
  br i1 %63, label %64, label %69

64:                                               ; preds = %37
  %65 = getelementptr inbounds %struct.arm_2d_region_t, ptr %16, i32 0, i32 1
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %66, i32 0, i32 1
  %68 = getelementptr inbounds %struct.arm_2d_region_t, ptr %67, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %65, ptr align 4 %68, i64 4, i1 false), !tbaa.struct !20
  store ptr %16, ptr %11, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %64, %37
  br label %70

70:                                               ; preds = %69
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %71, i32 0, i32 1
  %73 = getelementptr inbounds %struct.arm_2d_user_draw_circle_api_params_t, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !21
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %83

76:                                               ; preds = %70
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %77, i32 0, i32 2
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %79, i32 0, i32 1
  %81 = getelementptr inbounds %struct.arm_2d_user_draw_circle_api_params_t, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %78, ptr align 2 %82, i64 4, i1 false), !tbaa.struct !20
  br label %116

83:                                               ; preds = %70
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.arm_2d_region_t, ptr %84, i32 0, i32 0
  %86 = getelementptr inbounds %struct.arm_2d_location_t, ptr %85, i32 0, i32 0
  %87 = load i16, ptr %86, align 2, !tbaa !9
  %88 = sext i16 %87 to i32
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.arm_2d_region_t, ptr %89, i32 0, i32 1
  %91 = getelementptr inbounds %struct.arm_2d_size_t, ptr %90, i32 0, i32 0
  %92 = load i16, ptr %91, align 2, !tbaa !9
  %93 = sext i16 %92 to i32
  %94 = ashr i32 %93, 1
  %95 = add nsw i32 %88, %94
  %96 = trunc i32 %95 to i16
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %97, i32 0, i32 2
  %99 = getelementptr inbounds %struct.arm_2d_location_t, ptr %98, i32 0, i32 0
  store i16 %96, ptr %99, align 8, !tbaa !22
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.arm_2d_region_t, ptr %100, i32 0, i32 0
  %102 = getelementptr inbounds %struct.arm_2d_location_t, ptr %101, i32 0, i32 1
  %103 = load i16, ptr %102, align 2, !tbaa !9
  %104 = sext i16 %103 to i32
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.arm_2d_region_t, ptr %105, i32 0, i32 1
  %107 = getelementptr inbounds %struct.arm_2d_size_t, ptr %106, i32 0, i32 1
  %108 = load i16, ptr %107, align 2, !tbaa !9
  %109 = sext i16 %108 to i32
  %110 = ashr i32 %109, 1
  %111 = add nsw i32 %104, %110
  %112 = trunc i32 %111 to i16
  %113 = load ptr, ptr %14, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %113, i32 0, i32 2
  %115 = getelementptr inbounds %struct.arm_2d_location_t, ptr %114, i32 0, i32 1
  store i16 %112, ptr %115, align 2, !tbaa !23
  br label %116

116:                                              ; preds = %83, %76
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %117, i32 0, i32 1
  %119 = getelementptr inbounds %struct.arm_2d_user_draw_circle_api_params_t, ptr %118, i32 0, i32 1
  %120 = load i16, ptr %119, align 8, !tbaa !24
  %121 = sext i16 %120 to i32
  %122 = mul nsw i32 %121, 2
  %123 = add nsw i32 %122, 2
  %124 = trunc i32 %123 to i16
  %125 = load ptr, ptr %14, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %125, i32 0, i32 3
  %127 = getelementptr inbounds %struct.arm_2d_region_t, ptr %126, i32 0, i32 1
  %128 = getelementptr inbounds %struct.arm_2d_size_t, ptr %127, i32 0, i32 1
  store i16 %124, ptr %128, align 2, !tbaa !9
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %129, i32 0, i32 3
  %131 = getelementptr inbounds %struct.arm_2d_region_t, ptr %130, i32 0, i32 1
  %132 = getelementptr inbounds %struct.arm_2d_size_t, ptr %131, i32 0, i32 1
  %133 = load i16, ptr %132, align 2, !tbaa !9
  %134 = sext i16 %133 to i32
  %135 = add nsw i32 %134, 2
  %136 = trunc i32 %135 to i16
  %137 = load ptr, ptr %14, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %137, i32 0, i32 3
  %139 = getelementptr inbounds %struct.arm_2d_region_t, ptr %138, i32 0, i32 1
  %140 = getelementptr inbounds %struct.arm_2d_size_t, ptr %139, i32 0, i32 0
  store i16 %136, ptr %140, align 4, !tbaa !9
  %141 = load ptr, ptr %14, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %141, i32 0, i32 2
  %143 = getelementptr inbounds %struct.arm_2d_location_t, ptr %142, i32 0, i32 0
  %144 = load i16, ptr %143, align 8, !tbaa !22
  %145 = sext i16 %144 to i32
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %146, i32 0, i32 1
  %148 = getelementptr inbounds %struct.arm_2d_user_draw_circle_api_params_t, ptr %147, i32 0, i32 1
  %149 = load i16, ptr %148, align 8, !tbaa !24
  %150 = sext i16 %149 to i32
  %151 = sub nsw i32 %145, %150
  %152 = sub nsw i32 %151, 1
  %153 = trunc i32 %152 to i16
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %154, i32 0, i32 3
  %156 = getelementptr inbounds %struct.arm_2d_region_t, ptr %155, i32 0, i32 0
  %157 = getelementptr inbounds %struct.arm_2d_location_t, ptr %156, i32 0, i32 0
  store i16 %153, ptr %157, align 4, !tbaa !9
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %158, i32 0, i32 2
  %160 = getelementptr inbounds %struct.arm_2d_location_t, ptr %159, i32 0, i32 1
  %161 = load i16, ptr %160, align 2, !tbaa !23
  %162 = sext i16 %161 to i32
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %163, i32 0, i32 1
  %165 = getelementptr inbounds %struct.arm_2d_user_draw_circle_api_params_t, ptr %164, i32 0, i32 1
  %166 = load i16, ptr %165, align 8, !tbaa !24
  %167 = sext i16 %166 to i32
  %168 = sub nsw i32 %162, %167
  %169 = sub nsw i32 %168, 1
  %170 = trunc i32 %169 to i16
  %171 = load ptr, ptr %14, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %171, i32 0, i32 3
  %173 = getelementptr inbounds %struct.arm_2d_region_t, ptr %172, i32 0, i32 0
  %174 = getelementptr inbounds %struct.arm_2d_location_t, ptr %173, i32 0, i32 1
  store i16 %170, ptr %174, align 2, !tbaa !9
  %175 = load ptr, ptr %11, align 8, !tbaa !5
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %176, i32 0, i32 3
  %178 = load ptr, ptr %14, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %178, i32 0, i32 3
  %180 = call zeroext i1 @arm_2d_region_intersect(ptr noundef %175, ptr noundef %177, ptr noundef %179)
  br i1 %180, label %184, label %181

181:                                              ; preds = %116
  %182 = load ptr, ptr %14, align 8, !tbaa !5
  %183 = call i32 @__arm_2d_op_depose(ptr noundef %182, i32 noundef 0)
  store i32 %183, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %202

184:                                              ; preds = %116
  %185 = load ptr, ptr %14, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %185, i32 0, i32 3
  %187 = load ptr, ptr %14, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %187, i32 0, i32 0
  %189 = getelementptr inbounds %struct.arm_2d_op_t, ptr %188, i32 0, i32 1
  %190 = getelementptr inbounds %struct.anon.6, ptr %189, i32 0, i32 1
  store ptr %186, ptr %190, align 8, !tbaa !9
  %191 = load ptr, ptr %14, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %191, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %193 = load ptr, ptr %10, align 8, !tbaa !5
  %194 = load ptr, ptr %14, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.arm_2d_user_draw_circle_descriptor_t, ptr %194, i32 0, i32 2
  %196 = load i32, ptr %195, align 8
  %197 = call i32 @arm_2d_get_absolute_location(ptr noundef %193, i32 %196, i1 noundef zeroext true)
  store i32 %197, ptr %17, align 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %192, ptr align 2 %17, i64 4, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %198

198:                                              ; preds = %184
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr %14, align 8, !tbaa !5
  %201 = call i32 @__arm_2d_op_invoke(ptr noundef %200)
  store i32 %201, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %202

202:                                              ; preds = %199, %181
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %203

203:                                              ; preds = %202, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  %204 = load i32, ptr %7, align 4
  ret i32 %204
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

declare zeroext i1 @__arm_2d_op_acquire(ptr noundef) #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

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

declare i32 @arm_2d_get_absolute_location(ptr noundef, i32, i1 noundef zeroext) #3

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

declare i32 @__arm_2d_op_invoke(ptr noundef) #3

attributes #0 = { 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 #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { noreturn nounwind }
attributes #7 = { 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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{i64 0, i64 8, !5, i64 8, i64 2, !11, i64 10, i64 1, !13}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !7, i64 92}
!16 = !{!"arm_2d_user_draw_circle_descriptor_t", !7, i64 0, !17, i64 64, !18, i64 80, !19, i64 84, !7, i64 92, !7, i64 96}
!17 = !{!"arm_2d_user_draw_circle_api_params_t", !6, i64 0, !12, i64 8, !14, i64 10}
!18 = !{!"arm_2d_location_t", !12, i64 0, !12, i64 2}
!19 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!20 = !{i64 0, i64 2, !11, i64 2, i64 2, !11}
!21 = !{!16, !6, i64 64}
!22 = !{!16, !12, i64 80}
!23 = !{!16, !12, i64 82}
!24 = !{!16, !12, 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"

%struct.__arm_2d_op_control = type { %struct.anon.0 }
%struct.anon.0 = type { ptr, %struct.anon.1, %struct.anon.2, i16, i16, i16, i16, ptr, %union.anon }
%struct.anon.1 = type { ptr, ptr }
%struct.anon.2 = type { ptr, ptr }
%union.anon = type { %struct.arm_2d_op_trans_msk_opa_t }
%struct.arm_2d_op_trans_msk_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon.60, %struct.anon.61, %union.anon.62, %struct.anon.64, %struct.anon.65, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { %struct.anon.3, i64 }
%struct.anon.3 = type { ptr, ptr, %struct.anon.4, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.4 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.5 }
%struct.anon.5 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.60 = type { ptr, ptr }
%struct.anon.61 = type { ptr }
%union.anon.62 = type { %struct.anon.63 }
%struct.anon.63 = type { i32 }
%struct.anon.64 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.37, %union.anon.48, %union.anon.51 }
%union.anon.37 = type { %struct.anon.38 }
%struct.anon.38 = type { i8, %union.arm_2d_color_info_t, %union.anon.41 }
%union.arm_2d_color_info_t = type { %struct.anon.39 }
%struct.anon.39 = type { i8 }
%union.anon.41 = type { i16 }
%union.anon.48 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.49, %union.anon.50 }
%union.anon.49 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.50 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.51 = type { ptr }
%struct.anon.65 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.52, %struct.anon.53 }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.52 = type { i32 }
%struct.anon.53 = type { %struct.arm_2d_location_t, %struct.anon.54 }
%struct.anon.54 = type { %struct.arm_2d_region_t, %struct.arm_2d_tile_t }
%union.anon.73 = type { %struct.anon.74 }
%struct.anon.74 = type { i8 }
%union.anon.75 = type { %struct.anon.76 }
%struct.anon.76 = type { i8, i8 }
%struct.anon.82 = type { ptr }

@ARM_2D_CTRL = external global %struct.__arm_2d_op_control, align 8
@ARM_2D_OP_USER_DRAW_CIRCLE = external dso_local constant { { { i8 }, %union.anon.73, i8, i8, %union.anon.75, { %struct.anon.82, [8 x i8] } } }, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @arm_2dp_rgb565_user_draw_circle(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %2, ptr nocapture noundef nonnull readonly %3, i16 %4, i8 noundef zeroext %5) local_unnamed_addr #0 {
  %7 = alloca %struct.arm_2d_region_t, align 8
  %.047.sroa.gep50 = getelementptr inbounds i8, ptr %7, i64 4
  %8 = icmp eq ptr %0, null
  %spec.store.select = select i1 %8, ptr getelementptr inbounds (i8, ptr @ARM_2D_CTRL, i64 56), ptr %0
  %9 = tail call zeroext i1 @__arm_2d_op_acquire(ptr noundef nonnull %spec.store.select) #4
  br i1 %9, label %10, label %64

10:                                               ; preds = %6
  %.047.sroa.gep51 = getelementptr inbounds i8, ptr %2, i64 4
  %11 = getelementptr inbounds i8, ptr %spec.store.select, i64 8
  store ptr @ARM_2D_OP_USER_DRAW_CIRCLE, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %spec.store.select, i64 48
  store ptr %1, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %spec.store.select, i64 56
  store ptr %2, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !8
  %15 = getelementptr inbounds i8, ptr %spec.store.select, i64 92
  store i8 %5, ptr %15, align 4, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %spec.store.select, i64 96
  store i16 %4, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  store i64 0, ptr %7, align 8
  %17 = icmp eq ptr %2, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %10
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = load i32, ptr %19, align 4
  store i32 %20, ptr %.047.sroa.gep50, align 4
  br label %21

21:                                               ; preds = %10, %18
  %.047.sroa.phi55 = phi ptr [ %.047.sroa.gep50, %18 ], [ %.047.sroa.gep51, %10 ]
  %.047 = phi ptr [ %7, %18 ], [ %2, %10 ]
  %22 = load ptr, ptr %14, align 8, !tbaa !20
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %29, label %23

23:                                               ; preds = %21
  %24 = getelementptr inbounds i8, ptr %spec.store.select, i64 80
  %25 = load i32, ptr %22, align 2
  store i32 %25, ptr %24, align 8
  %26 = trunc i32 %25 to i16
  %27 = lshr i32 %25, 16
  %28 = trunc nuw i32 %27 to i16
  br label %41

29:                                               ; preds = %21
  %.047.sroa.phi = getelementptr inbounds i8, ptr %.047, i64 2
  %30 = load i16, ptr %.047, align 2, !tbaa !5
  %31 = load i16, ptr %.047.sroa.phi55, align 2, !tbaa !5
  %32 = ashr i16 %31, 1
  %33 = add i16 %32, %30
  %34 = getelementptr inbounds i8, ptr %spec.store.select, i64 80
  store i16 %33, ptr %34, align 8, !tbaa !21
  %35 = load i16, ptr %.047.sroa.phi, align 2, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %.047.sroa.phi55, i64 2
  %37 = load i16, ptr %36, align 2, !tbaa !5
  %38 = ashr i16 %37, 1
  %39 = add i16 %38, %35
  %40 = getelementptr inbounds i8, ptr %spec.store.select, i64 82
  store i16 %39, ptr %40, align 2, !tbaa !22
  br label %41

41:                                               ; preds = %29, %23
  %42 = phi i16 [ %39, %29 ], [ %28, %23 ]
  %43 = phi i16 [ %33, %29 ], [ %26, %23 ]
  %44 = getelementptr inbounds i8, ptr %spec.store.select, i64 72
  %45 = load i16, ptr %44, align 8, !tbaa !23
  %46 = shl i16 %45, 1
  %47 = getelementptr inbounds i8, ptr %spec.store.select, i64 84
  %48 = xor i16 %45, -1
  %49 = insertelement <4 x i16> <i16 poison, i16 poison, i16 4, i16 2>, i16 %43, i64 0
  %50 = insertelement <4 x i16> %49, i16 %42, i64 1
  %51 = insertelement <4 x i16> poison, i16 %48, i64 0
  %52 = insertelement <4 x i16> %51, i16 %46, i64 1
  %53 = shufflevector <4 x i16> %52, <4 x i16> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
  %54 = add <4 x i16> %50, %53
  store <4 x i16> %54, ptr %47, align 4, !tbaa !5
  %55 = call zeroext i1 @arm_2d_region_intersect(ptr noundef nonnull %.047, ptr noundef nonnull %47, ptr noundef nonnull %47) #4
  br i1 %55, label %58, label %56

56:                                               ; preds = %41
  %57 = call i32 @__arm_2d_op_depose(ptr noundef nonnull %spec.store.select, i32 noundef 0) #4
  br label %63

58:                                               ; preds = %41
  %59 = getelementptr inbounds i8, ptr %spec.store.select, i64 80
  store ptr %47, ptr %13, align 8, !tbaa !5
  %60 = load i32, ptr %59, align 8
  %61 = call i32 @arm_2d_get_absolute_location(ptr noundef nonnull %1, i32 %60, i1 noundef zeroext true) #4
  store i32 %61, ptr %59, align 8
  %62 = call i32 @__arm_2d_op_invoke(ptr noundef nonnull %spec.store.select) #4
  br label %63

63:                                               ; preds = %58, %56
  %.0 = phi i32 [ %62, %58 ], [ %57, %56 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %64

64:                                               ; preds = %6, %63
  %.1 = phi i32 [ %.0, %63 ], [ 1, %6 ]
  ret i32 %.1
}

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

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

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

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

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

declare i32 @arm_2d_get_absolute_location(ptr noundef, i32, i1 noundef zeroext) 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) #1

declare i32 @__arm_2d_op_invoke(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{i64 0, i64 8, !9, i64 8, i64 2, !11, i64 10, i64 1, !13}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !6, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !6, i64 0}
!15 = !{!16, !6, i64 92}
!16 = !{!"arm_2d_user_draw_circle_descriptor_t", !6, i64 0, !17, i64 64, !18, i64 80, !19, i64 84, !6, i64 92, !6, i64 96}
!17 = !{!"arm_2d_user_draw_circle_api_params_t", !10, i64 0, !12, i64 8, !14, i64 10}
!18 = !{!"arm_2d_location_t", !12, i64 0, !12, i64 2}
!19 = !{!"arm_2d_region_t", !6, i64 0, !6, i64 4}
!20 = !{!16, !10, i64 64}
!21 = !{!16, !12, i64 80}
!22 = !{!16, !12, i64 82}
!23 = !{!16, !12, i64 72}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass