; LLVM IR from ARM-software/Arm-2D :: Library/Source/arm_2d_draw.ll_ (arm_2d_sw_draw_point)

; 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 }
%struct.anon = type { ptr, %struct.anon.0, %struct.anon.1, i16, i16, i16, i16, ptr, %union.anon }
%struct.anon.0 = type { ptr, ptr }
%struct.anon.1 = 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.59, %struct.anon.60, %union.anon.61, %struct.anon.63, %struct.anon.64, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { %struct.anon.2, i64 }
%struct.anon.2 = type { ptr, ptr, %struct.anon.3, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.3 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.4 }
%struct.anon.4 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.59 = type { ptr, ptr }
%struct.anon.60 = type { ptr }
%union.anon.61 = type { %struct.anon.62 }
%struct.anon.62 = type { i32 }
%struct.anon.63 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.36, %union.anon.47, %union.anon.50 }
%union.anon.36 = type { %struct.anon.37 }
%struct.anon.37 = type { i8, %union.arm_2d_color_info_t, %union.anon.40 }
%union.arm_2d_color_info_t = type { %struct.anon.38 }
%struct.anon.38 = type { i8 }
%union.anon.40 = type { i16 }
%union.anon.47 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.48, %union.anon.49 }
%union.anon.48 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.49 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.50 = type { ptr }
%struct.anon.64 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.51, %struct.anon.52 }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.51 = type { i32 }
%struct.anon.52 = type { %struct.arm_2d_location_t, %struct.anon.53 }
%struct.anon.53 = type { %struct.arm_2d_region_t, %struct.arm_2d_tile_t }
%union.__arm_2d_color_fast_rgb_t = type { [4 x i16] }
%struct.__arm_2d_sub_task_t = type { %struct.anon.84 }
%struct.anon.84 = type <{ ptr, ptr, i8, i32, [3 x i8], %union.anon.85 }>
%union.anon.85 = type { %struct.__arm_2d_param_copy_orig_msk_t }
%struct.__arm_2d_param_copy_orig_msk_t = type { %union.anon.88, %struct.__arm_2d_tile_param_t, %struct.__arm_2d_tile_param_t }
%union.anon.88 = type { %struct.__arm_2d_param_copy_orig_t }
%struct.__arm_2d_param_copy_orig_t = type { %union.anon.87, %struct.__arm_2d_tile_param_t }
%union.anon.87 = type { %struct.__arm_2d_param_copy_t }
%struct.__arm_2d_param_copy_t = type { %struct.__arm_2d_tile_param_t, %struct.__arm_2d_tile_param_t, %struct.arm_2d_size_t }
%struct.__arm_2d_tile_param_t = type { ptr, i32, i16, %union.arm_2d_color_info_t, i8, %struct.arm_2d_region_t, %struct.arm_2d_region_t, ptr }
%struct.arm_2d_op_drw_pt_t = type { %struct.arm_2d_op_core_t, %struct.anon.71, %union.anon.72, i8, %struct.arm_2d_region_t }
%struct.anon.71 = type { ptr, ptr }
%union.anon.72 = type { i32 }
%struct.anon.73 = type { %union.arm_2d_color_info_t, %union.anon.74, i8, i8, %union.anon.76, %union.anon.80 }
%union.anon.74 = type { %struct.anon.75 }
%struct.anon.75 = type { i8 }
%union.anon.76 = type { %struct.anon.77 }
%struct.anon.77 = type { i8, i8 }
%union.anon.80 = type { [2 x ptr] }

@ARM_2D_CTRL = external global %struct.__arm_2d_op_control, align 8

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @__arm_2d_sw_draw_point(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i16, align 2
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i16, align 2
  %10 = alloca %union.__arm_2d_color_fast_rgb_t, align 2
  %11 = alloca %union.__arm_2d_color_fast_rgb_t, align 2
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i16, align 2
  %15 = alloca i16, align 2
  %16 = alloca i8, align 1
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.anon.84, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  store ptr %22, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = icmp eq ptr null, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %1
  store ptr getelementptr inbounds (%struct.anon, ptr @ARM_2D_CTRL, i32 0, i32 8), ptr %4, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %25, %1
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %27, i32 0, i32 3
  %29 = load i8, ptr %28, align 4, !tbaa !12
  %30 = zext i8 %29 to i32
  %31 = icmp eq i32 255, %30
  br i1 %31, label %32, label %72

32:                                               ; preds = %26
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds %struct.arm_2d_op_core_t, ptr %34, i32 0, i32 0
  %36 = getelementptr inbounds %struct.anon.2, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = getelementptr inbounds %struct.anon.73, ptr %37, i32 0, i32 0
  %39 = load i8, ptr %38, align 8
  %40 = lshr i8 %39, 1
  %41 = and i8 %40, 7
  %42 = zext i8 %41 to i32
  switch i32 %42, label %70 [
    i32 3, label %43
    i32 4, label %52
    i32 5, label %61
  ]

43:                                               ; preds = %32
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %44, i32 0, i32 2
  %46 = load i8, ptr %45, align 8, !tbaa !22
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %47, i32 0, i32 0
  %49 = getelementptr inbounds %struct.anon.84, ptr %48, i32 0, i32 5
  %50 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !22
  store i8 %46, ptr %51, align 1, !tbaa !22
  br label %71

52:                                               ; preds = %32
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %53, i32 0, i32 2
  %55 = load i16, ptr %54, align 8, !tbaa !22
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.anon.84, ptr %57, i32 0, i32 5
  %59 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  store i16 %55, ptr %60, align 2, !tbaa !23
  br label %71

61:                                               ; preds = %32
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 8, !tbaa !22
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.anon.84, ptr %66, i32 0, i32 5
  %68 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !22
  store i32 %64, ptr %69, align 4, !tbaa !25
  br label %71

70:                                               ; preds = %32
  store i32 -4, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %230

71:                                               ; preds = %61, %52, %43
  br label %229

72:                                               ; preds = %26
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds %struct.arm_2d_op_core_t, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.anon.2, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !21
  %78 = getelementptr inbounds %struct.anon.73, ptr %77, i32 0, i32 0
  %79 = load i8, ptr %78, align 8
  %80 = lshr i8 %79, 1
  %81 = and i8 %80, 7
  %82 = zext i8 %81 to i32
  switch i32 %82, label %227 [
    i32 3, label %83
    i32 4, label %123
    i32 5, label %183
  ]

83:                                               ; preds = %72
  br label %84

84:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #3
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %85, i32 0, i32 3
  %87 = load i8, ptr %86, align 4, !tbaa !12
  %88 = zext i8 %87 to i32
  %89 = sub nsw i32 256, %88
  %90 = trunc i32 %89 to i16
  store i16 %90, ptr %6, align 2, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %91, i32 0, i32 2
  store ptr %92, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %93, i32 0, i32 0
  %95 = getelementptr inbounds %struct.anon.84, ptr %94, i32 0, i32 5
  %96 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !22
  store ptr %97, ptr %8, align 8, !tbaa !5
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i32 1
  store ptr %99, ptr %7, align 8, !tbaa !5
  %100 = load i8, ptr %98, align 1, !tbaa !22
  %101 = zext i8 %100 to i16
  %102 = zext i16 %101 to i32
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %103, i32 0, i32 3
  %105 = load i8, ptr %104, align 4, !tbaa !12
  %106 = zext i8 %105 to i32
  %107 = mul nsw i32 %102, %106
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = load i8, ptr %108, align 1, !tbaa !22
  %110 = zext i8 %109 to i16
  %111 = zext i16 %110 to i32
  %112 = load i16, ptr %6, align 2, !tbaa !23
  %113 = zext i16 %112 to i32
  %114 = mul nsw i32 %111, %113
  %115 = add nsw i32 %107, %114
  %116 = trunc i32 %115 to i16
  %117 = zext i16 %116 to i32
  %118 = ashr i32 %117, 8
  %119 = trunc i32 %118 to i8
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  store i8 %119, ptr %120, align 1, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #3
  br label %121

121:                                              ; preds = %84
  br label %122

122:                                              ; preds = %121
  br label %228

123:                                              ; preds = %72
  br label %124

124:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #3
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %125, i32 0, i32 3
  %127 = load i8, ptr %126, align 4, !tbaa !12
  %128 = zext i8 %127 to i32
  %129 = sub nsw i32 256, %128
  %130 = trunc i32 %129 to i16
  store i16 %130, ptr %9, align 2, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %131, i32 0, i32 0
  %133 = getelementptr inbounds %struct.anon.84, ptr %132, i32 0, i32 5
  %134 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !22
  store ptr %135, ptr %12, align 8, !tbaa !5
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %136, i32 0, i32 2
  %138 = load i16, ptr %137, align 8, !tbaa !22
  call void @__arm_2d_rgb565_unpack(i16 noundef zeroext %138, ptr noundef %10)
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = load i16, ptr %139, align 2, !tbaa !23
  call void @__arm_2d_rgb565_unpack(i16 noundef zeroext %140, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !25
  br label %141

141:                                              ; preds = %175, %124
  %142 = load i32, ptr %13, align 4, !tbaa !25
  %143 = icmp slt i32 %142, 3
  br i1 %143, label %145, label %144

144:                                              ; preds = %141
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %178

145:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 2, ptr %14) #3
  %146 = load i32, ptr %13, align 4, !tbaa !25
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [4 x i16], ptr %10, i64 0, i64 %147
  %149 = load i16, ptr %148, align 2, !tbaa !22
  %150 = zext i16 %149 to i32
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %151, i32 0, i32 3
  %153 = load i8, ptr %152, align 4, !tbaa !12
  %154 = zext i8 %153 to i32
  %155 = mul nsw i32 %150, %154
  %156 = trunc i32 %155 to i16
  %157 = zext i16 %156 to i32
  %158 = load i32, ptr %13, align 4, !tbaa !25
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [4 x i16], ptr %11, i64 0, i64 %159
  %161 = load i16, ptr %160, align 2, !tbaa !22
  %162 = zext i16 %161 to i32
  %163 = load i16, ptr %9, align 2, !tbaa !23
  %164 = zext i16 %163 to i32
  %165 = mul nsw i32 %162, %164
  %166 = add nsw i32 %157, %165
  %167 = trunc i32 %166 to i16
  store i16 %167, ptr %14, align 2, !tbaa !23
  %168 = load i16, ptr %14, align 2, !tbaa !23
  %169 = zext i16 %168 to i32
  %170 = ashr i32 %169, 8
  %171 = trunc i32 %170 to i16
  %172 = load i32, ptr %13, align 4, !tbaa !25
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [4 x i16], ptr %11, i64 0, i64 %173
  store i16 %171, ptr %174, align 2, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 2, ptr %14) #3
  br label %175

175:                                              ; preds = %145
  %176 = load i32, ptr %13, align 4, !tbaa !25
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %13, align 4, !tbaa !25
  br label %141, !llvm.loop !27

178:                                              ; preds = %144
  %179 = call zeroext i16 @__arm_2d_rgb565_pack(ptr noundef %11)
  %180 = load ptr, ptr %12, align 8, !tbaa !5
  store i16 %179, ptr %180, align 2, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #3
  br label %181

181:                                              ; preds = %178
  br label %182

182:                                              ; preds = %181
  br label %228

183:                                              ; preds = %72
  br label %184

184:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 2, ptr %15) #3
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %185, i32 0, i32 3
  %187 = load i8, ptr %186, align 4, !tbaa !12
  %188 = zext i8 %187 to i32
  %189 = sub nsw i32 256, %188
  %190 = trunc i32 %189 to i16
  store i16 %190, ptr %15, align 2, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #3
  store i8 3, ptr %16, align 1, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %191, i32 0, i32 2
  store ptr %192, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %193 = load ptr, ptr %3, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.__arm_2d_sub_task_t, ptr %193, i32 0, i32 0
  %195 = getelementptr inbounds %struct.anon.84, ptr %194, i32 0, i32 5
  %196 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !22
  store ptr %197, ptr %18, align 8, !tbaa !5
  br label %198

198:                                              ; preds = %220, %184
  %199 = load ptr, ptr %17, align 8, !tbaa !5
  %200 = getelementptr inbounds i8, ptr %199, i32 1
  store ptr %200, ptr %17, align 8, !tbaa !5
  %201 = load i8, ptr %199, align 1, !tbaa !22
  %202 = zext i8 %201 to i64
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.arm_2d_op_drw_pt_t, ptr %203, i32 0, i32 3
  %205 = load i8, ptr %204, align 4, !tbaa !12
  %206 = zext i8 %205 to i64
  %207 = mul i64 %202, %206
  %208 = load ptr, ptr %18, align 8, !tbaa !5
  %209 = load i8, ptr %208, align 1, !tbaa !22
  %210 = zext i8 %209 to i64
  %211 = load i16, ptr %15, align 2, !tbaa !23
  %212 = zext i16 %211 to i64
  %213 = mul i64 %210, %212
  %214 = add i64 %207, %213
  %215 = lshr i64 %214, 8
  %216 = trunc i64 %215 to i8
  %217 = load ptr, ptr %18, align 8, !tbaa !5
  store i8 %216, ptr %217, align 1, !tbaa !22
  %218 = load ptr, ptr %18, align 8, !tbaa !5
  %219 = getelementptr inbounds i8, ptr %218, i32 1
  store ptr %219, ptr %18, align 8, !tbaa !5
  br label %220

220:                                              ; preds = %198
  %221 = load i8, ptr %16, align 1, !tbaa !22
  %222 = add i8 %221, -1
  store i8 %222, ptr %16, align 1, !tbaa !22
  %223 = icmp ne i8 %222, 0
  br i1 %223, label %198, label %224, !llvm.loop !29

224:                                              ; preds = %220
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %15) #3
  br label %225

225:                                              ; preds = %224
  br label %226

226:                                              ; preds = %225
  br label %228

227:                                              ; preds = %72
  store i32 -4, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %230

228:                                              ; preds = %226, %182, %122
  br label %229

229:                                              ; preds = %228, %71
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %230

230:                                              ; preds = %229, %227, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %231 = load i32, ptr %2, align 4
  ret i32 %231
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @__arm_2d_rgb565_unpack(i16 noundef zeroext, ptr noundef nonnull) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__arm_2d_rgb565_pack(ptr noundef nonnull) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!10, !6, i64 8}
!10 = !{!"__arm_2d_sub_task_t", !11, i64 0}
!11 = !{!"", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !7, i64 24}
!12 = !{!13, !7, i64 68}
!13 = !{!"arm_2d_op_drw_pt_t", !14, i64 0, !19, i64 48, !7, i64 64, !7, i64 68, !20, i64 70}
!14 = !{!"arm_2d_op_core_t", !15, i64 0, !18, i64 40}
!15 = !{!"", !6, i64 0, !6, i64 8, !16, i64 16, !7, i64 17, !7, i64 18, !17, i64 24}
!16 = !{!"", !7, i64 0}
!17 = !{!"arm_2d_op_evt_t", !6, i64 0, !6, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!"", !6, i64 0, !6, i64 8}
!20 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!21 = !{!13, !6, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"short", !7, i64 0}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


; 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 }
%struct.anon = type { ptr, %struct.anon.0, %struct.anon.1, i16, i16, i16, i16, ptr, %union.anon }
%struct.anon.0 = type { ptr, ptr }
%struct.anon.1 = 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.59, %struct.anon.60, %union.anon.61, %struct.anon.63, %struct.anon.64, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { %struct.anon.2, i64 }
%struct.anon.2 = type { ptr, ptr, %struct.anon.3, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.3 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.4 }
%struct.anon.4 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.59 = type { ptr, ptr }
%struct.anon.60 = type { ptr }
%union.anon.61 = type { %struct.anon.62 }
%struct.anon.62 = type { i32 }
%struct.anon.63 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.36, %union.anon.47, %union.anon.50 }
%union.anon.36 = type { %struct.anon.37 }
%struct.anon.37 = type { i8, %union.arm_2d_color_info_t, %union.anon.40 }
%union.arm_2d_color_info_t = type { %struct.anon.38 }
%struct.anon.38 = type { i8 }
%union.anon.40 = type { i16 }
%union.anon.47 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.48, %union.anon.49 }
%union.anon.48 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.49 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.50 = type { ptr }
%struct.anon.64 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.51, %struct.anon.52 }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.51 = type { i32 }
%struct.anon.52 = type { %struct.arm_2d_location_t, %struct.anon.53 }
%struct.anon.53 = type { %struct.arm_2d_region_t, %struct.arm_2d_tile_t }
%union.__arm_2d_color_fast_rgb_t = type { [4 x i16] }

@ARM_2D_CTRL = external local_unnamed_addr global %struct.__arm_2d_op_control, align 8

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -4, 1) i32 @__arm_2d_sw_draw_point(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = alloca %union.__arm_2d_color_fast_rgb_t, align 4
  %3 = alloca %union.__arm_2d_color_fast_rgb_t, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  %spec.store.select = select i1 %6, ptr getelementptr inbounds (i8, ptr @ARM_2D_CTRL, i64 56), ptr %5
  %7 = getelementptr inbounds i8, ptr %spec.store.select, i64 68
  %8 = load i8, ptr %7, align 4, !tbaa !11
  %9 = zext i8 %8 to i32
  %10 = icmp eq i8 %8, -1
  %11 = getelementptr inbounds i8, ptr %spec.store.select, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !20
  %13 = load i8, ptr %12, align 8
  %14 = lshr i8 %13, 1
  %15 = and i8 %14, 7
  br i1 %10, label %16, label %32

16:                                               ; preds = %1
  switch i8 %15, label %.loopexit [
    i8 3, label %17
    i8 4, label %22
    i8 5, label %27
  ]

17:                                               ; preds = %16
  %18 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  %19 = load i8, ptr %18, align 8, !tbaa !21
  %20 = getelementptr inbounds i8, ptr %0, i64 24
  %21 = load ptr, ptr %20, align 8, !tbaa !21
  store i8 %19, ptr %21, align 1, !tbaa !21
  br label %.loopexit

22:                                               ; preds = %16
  %23 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  %24 = load i16, ptr %23, align 8, !tbaa !21
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  store i16 %24, ptr %26, align 2, !tbaa !22
  br label %.loopexit

27:                                               ; preds = %16
  %28 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  %29 = load i32, ptr %28, align 8, !tbaa !21
  %30 = getelementptr inbounds i8, ptr %0, i64 24
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  store i32 %29, ptr %31, align 4, !tbaa !24
  br label %.loopexit

32:                                               ; preds = %1
  switch i8 %15, label %.loopexit [
    i8 3, label %33
    i8 4, label %47
    i8 5, label %.loopexit.loopexit
  ]

33:                                               ; preds = %32
  %34 = sub nuw nsw i32 256, %9
  %35 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  %36 = getelementptr inbounds i8, ptr %0, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = load i8, ptr %35, align 1, !tbaa !21
  %39 = zext i8 %38 to i32
  %40 = mul nuw nsw i32 %39, %9
  %41 = load i8, ptr %37, align 1, !tbaa !21
  %42 = zext i8 %41 to i32
  %43 = mul nuw nsw i32 %34, %42
  %44 = add nuw nsw i32 %43, %40
  %45 = lshr i32 %44, 8
  %46 = trunc i32 %45 to i8
  store i8 %46, ptr %37, align 1, !tbaa !21
  br label %.loopexit

47:                                               ; preds = %32
  %48 = zext i8 %8 to i16
  %49 = sub nuw nsw i16 256, %48
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %50 = getelementptr inbounds i8, ptr %0, i64 24
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  %52 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  %53 = load i16, ptr %52, align 8, !tbaa !21
  call void @__arm_2d_rgb565_unpack(i16 noundef zeroext %53, ptr noundef %2)
  %54 = load i16, ptr %51, align 2, !tbaa !22
  call void @__arm_2d_rgb565_unpack(i16 noundef zeroext %54, ptr noundef %3)
  %55 = load i8, ptr %7, align 4, !tbaa !11
  %56 = zext i8 %55 to i16
  %57 = load <2 x i16>, ptr %2, align 4, !tbaa !21
  %58 = insertelement <2 x i16> poison, i16 %56, i64 0
  %59 = shufflevector <2 x i16> %58, <2 x i16> poison, <2 x i32> zeroinitializer
  %60 = mul <2 x i16> %57, %59
  %61 = load <2 x i16>, ptr %3, align 4, !tbaa !21
  %62 = insertelement <2 x i16> poison, i16 %49, i64 0
  %63 = shufflevector <2 x i16> %62, <2 x i16> poison, <2 x i32> zeroinitializer
  %64 = mul <2 x i16> %61, %63
  %65 = add <2 x i16> %64, %60
  %66 = lshr <2 x i16> %65, <i16 8, i16 8>
  store <2 x i16> %66, ptr %3, align 4, !tbaa !21
  %67 = getelementptr inbounds i8, ptr %2, i64 4
  %68 = load i16, ptr %67, align 4, !tbaa !21
  %69 = mul i16 %68, %56
  %70 = getelementptr inbounds i8, ptr %3, i64 4
  %71 = load i16, ptr %70, align 4, !tbaa !21
  %72 = mul i16 %71, %49
  %73 = add i16 %72, %69
  %74 = lshr i16 %73, 8
  store i16 %74, ptr %70, align 4, !tbaa !21
  %75 = call zeroext i16 @__arm_2d_rgb565_pack(ptr noundef %3)
  store i16 %75, ptr %51, align 2, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %.loopexit

.loopexit.loopexit:                               ; preds = %32
  %76 = sub nuw nsw i32 256, %9
  %77 = getelementptr inbounds i8, ptr %spec.store.select, i64 64
  %78 = getelementptr inbounds i8, ptr %0, i64 24
  %79 = load ptr, ptr %78, align 8, !tbaa !21
  %80 = getelementptr inbounds i8, ptr %spec.store.select, i64 65
  %81 = load i8, ptr %77, align 1, !tbaa !21
  %82 = zext i8 %81 to i32
  %83 = mul nuw nsw i32 %9, %82
  %84 = load i8, ptr %79, align 1, !tbaa !21
  %85 = zext i8 %84 to i32
  %86 = mul nuw nsw i32 %76, %85
  %87 = add nuw nsw i32 %86, %83
  %88 = lshr i32 %87, 8
  %89 = trunc i32 %88 to i8
  store i8 %89, ptr %79, align 1, !tbaa !21
  %90 = getelementptr inbounds i8, ptr %79, i64 1
  %91 = getelementptr inbounds i8, ptr %spec.store.select, i64 66
  %92 = load i8, ptr %80, align 1, !tbaa !21
  %93 = zext i8 %92 to i32
  %94 = load i8, ptr %7, align 4, !tbaa !11
  %95 = zext i8 %94 to i32
  %96 = mul nuw nsw i32 %95, %93
  %97 = load i8, ptr %90, align 1, !tbaa !21
  %98 = zext i8 %97 to i32
  %99 = mul nuw nsw i32 %76, %98
  %100 = add nuw nsw i32 %99, %96
  %101 = lshr i32 %100, 8
  %102 = trunc i32 %101 to i8
  store i8 %102, ptr %90, align 1, !tbaa !21
  %103 = getelementptr inbounds i8, ptr %79, i64 2
  %104 = load i8, ptr %91, align 1, !tbaa !21
  %105 = zext i8 %104 to i32
  %106 = load i8, ptr %7, align 4, !tbaa !11
  %107 = zext i8 %106 to i32
  %108 = mul nuw nsw i32 %107, %105
  %109 = load i8, ptr %103, align 1, !tbaa !21
  %110 = zext i8 %109 to i32
  %111 = mul nuw nsw i32 %76, %110
  %112 = add nuw nsw i32 %111, %108
  %113 = lshr i32 %112, 8
  %114 = trunc i32 %113 to i8
  store i8 %114, ptr %103, align 1, !tbaa !21
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %27, %22, %17, %47, %33, %32, %16
  %.044 = phi i32 [ -4, %16 ], [ -4, %32 ], [ 0, %33 ], [ 0, %47 ], [ 0, %17 ], [ 0, %22 ], [ 0, %27 ], [ 0, %.loopexit.loopexit ]
  ret i32 %.044
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @__arm_2d_rgb565_unpack(i16 noundef zeroext, ptr noundef nonnull) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__arm_2d_rgb565_pack(ptr noundef nonnull) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !8, i64 8}
!6 = !{!"__arm_2d_sub_task_t", !7, i64 0}
!7 = !{!"", !8, i64 0, !8, i64 8, !9, i64 16, !9, i64 17, !9, i64 24}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !9, i64 68}
!12 = !{!"arm_2d_op_drw_pt_t", !13, i64 0, !18, i64 48, !9, i64 64, !9, i64 68, !19, i64 70}
!13 = !{!"arm_2d_op_core_t", !14, i64 0, !17, i64 40}
!14 = !{!"", !8, i64 0, !8, i64 8, !15, i64 16, !9, i64 17, !9, i64 18, !16, i64 24}
!15 = !{!"", !9, i64 0}
!16 = !{!"arm_2d_op_evt_t", !8, i64 0, !8, i64 8}
!17 = !{!"long", !9, i64 0}
!18 = !{!"", !8, i64 0, !8, i64 8}
!19 = !{!"arm_2d_region_t", !9, i64 0, !9, i64 4}
!20 = !{!12, !8, i64 8}
!21 = !{!9, !9, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"short", !9, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"int", !9, i64 0}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass