; LLVM IR from ARM-software/Arm-2D :: Helper/Source/arm_2d_helper_pfb.ll_ (arm_2d_helper_dirty_region_item_update)

; 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_region_t = type { %union.anon, %union.anon.0 }
%union.anon = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.0 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%struct.arm_2d_helper_dirty_region_item_t = type { %struct.anon.34, %struct.arm_2d_region_t }
%struct.anon.34 = type { ptr, ptr, %union.anon.35, %struct.arm_2d_region_t, i8, i8, i16 }
%union.anon.35 = type { [2 x %struct.arm_2d_region_t] }
%struct.arm_2d_helper_dirty_region_t = type { %struct.anon.33, %struct.arm_2d_helper_dirty_region_item_t }
%struct.anon.33 = type <{ %struct.arm_2d_region_list_item_t, ptr, ptr, i8, i32, [3 x i8] }>
%struct.arm_2d_region_list_item_t = type { ptr, %struct.anon.6, %struct.arm_2d_region_t, %struct.anon.7 }
%struct.anon.6 = type { ptr }
%struct.anon.7 = type { i8, i8, i16 }
%struct.anon.36 = type { %struct.arm_2d_region_t, %union.anon.37 }
%union.anon.37 = type { %struct.arm_2d_region_t }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [21 x i8], align 1
@__PRETTY_FUNCTION__.__arm_2d_helper_dirty_region_item_update = external hidden unnamed_addr constant [156 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @arm_2d_helper_pfb_get_absolute_location(ptr noundef nonnull, i32) #4

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

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

23:                                               ; preds = %4
  br label %25

24:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 4510, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_helper_dirty_region_item_update) #6
  unreachable

25:                                               ; preds = %23
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = icmp ne ptr null, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  br label %30

29:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 4511, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_helper_dirty_region_item_update) #6
  unreachable

30:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.anon.34, ptr %32, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  store ptr %34, ptr %9, align 8, !tbaa !5
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = icmp ne ptr null, %35
  br i1 %36, label %37, label %58

37:                                               ; preds = %30
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_t, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.anon.33, ptr %39, i32 0, i32 3
  %41 = load i8, ptr %40, align 8, !tbaa !14
  %42 = zext i8 %41 to i32
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.anon.34, ptr %44, i32 0, i32 5
  %46 = load i8, ptr %45, align 1, !tbaa !20
  %47 = zext i8 %46 to i32
  %48 = icmp eq i32 %42, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %37
  store i32 1, ptr %10, align 4
  br label %313

50:                                               ; preds = %37
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_t, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.anon.33, ptr %52, i32 0, i32 3
  %54 = load i8, ptr %53, align 8, !tbaa !14
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.anon.34, ptr %56, i32 0, i32 5
  store i8 %54, ptr %57, align 1, !tbaa !20
  br label %58

58:                                               ; preds = %50, %30
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = icmp eq ptr null, %59
  br i1 %60, label %61, label %68

61:                                               ; preds = %58
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.anon.34, ptr %63, i32 0, i32 4
  %65 = load i8, ptr %64, align 8
  %66 = and i8 %65, -5
  %67 = or i8 %66, 4
  store i8 %67, ptr %64, align 8
  store i32 1, ptr %10, align 4
  br label %313

68:                                               ; preds = %58
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds %struct.anon.34, ptr %70, i32 0, i32 4
  %72 = load i8, ptr %71, align 8
  %73 = and i8 %72, -5
  %74 = or i8 %73, 0
  store i8 %74, ptr %71, align 8
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %75, i32 0, i32 0
  %77 = getelementptr inbounds %struct.anon.34, ptr %76, i32 0, i32 4
  %78 = load i8, ptr %77, align 8
  %79 = and i8 %78, -9
  %80 = or i8 %79, 0
  store i8 %80, ptr %77, align 8
  br label %81

81:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %11, ptr align 2 %82, i64 8, i1 false), !tbaa.struct !21
  br label %83

83:                                               ; preds = %81
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %84, i32 0, i32 1
  %86 = getelementptr inbounds %struct.arm_2d_region_t, ptr %85, i32 0, i32 1
  %87 = getelementptr inbounds %struct.arm_2d_size_t, ptr %86, i32 0, i32 0
  %88 = load i16, ptr %87, align 4, !tbaa !22
  %89 = sext i16 %88 to i32
  %90 = getelementptr inbounds %struct.arm_2d_region_t, ptr %11, 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 !22
  %93 = sext i16 %92 to i32
  %94 = add nsw i32 %93, %89
  %95 = trunc i32 %94 to i16
  store i16 %95, ptr %91, align 2, !tbaa !22
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %96, i32 0, i32 1
  %98 = getelementptr inbounds %struct.arm_2d_region_t, ptr %97, i32 0, i32 1
  %99 = getelementptr inbounds %struct.arm_2d_size_t, ptr %98, i32 0, i32 1
  %100 = load i16, ptr %99, align 2, !tbaa !22
  %101 = sext i16 %100 to i32
  %102 = getelementptr inbounds %struct.arm_2d_region_t, ptr %11, i32 0, i32 1
  %103 = getelementptr inbounds %struct.arm_2d_size_t, ptr %102, i32 0, i32 1
  %104 = load i16, ptr %103, align 2, !tbaa !22
  %105 = sext i16 %104 to i32
  %106 = add nsw i32 %105, %101
  %107 = trunc i32 %106 to i16
  store i16 %107, ptr %103, align 2, !tbaa !22
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %108, i32 0, i32 1
  %110 = getelementptr inbounds %struct.arm_2d_region_t, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds %struct.arm_2d_location_t, ptr %110, i32 0, i32 0
  %112 = load i16, ptr %111, align 8, !tbaa !22
  %113 = sext i16 %112 to i32
  %114 = getelementptr inbounds %struct.arm_2d_region_t, ptr %11, i32 0, i32 0
  %115 = getelementptr inbounds %struct.arm_2d_location_t, ptr %114, i32 0, i32 0
  %116 = load i16, ptr %115, align 2, !tbaa !22
  %117 = sext i16 %116 to i32
  %118 = add nsw i32 %117, %113
  %119 = trunc i32 %118 to i16
  store i16 %119, ptr %115, align 2, !tbaa !22
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %120, i32 0, i32 1
  %122 = getelementptr inbounds %struct.arm_2d_region_t, ptr %121, i32 0, i32 0
  %123 = getelementptr inbounds %struct.arm_2d_location_t, ptr %122, i32 0, i32 1
  %124 = load i16, ptr %123, align 2, !tbaa !22
  %125 = sext i16 %124 to i32
  %126 = getelementptr inbounds %struct.arm_2d_region_t, ptr %11, i32 0, i32 0
  %127 = getelementptr inbounds %struct.arm_2d_location_t, ptr %126, i32 0, i32 1
  %128 = load i16, ptr %127, align 2, !tbaa !22
  %129 = sext i16 %128 to i32
  %130 = add nsw i32 %129, %125
  %131 = trunc i32 %130 to i16
  store i16 %131, ptr %127, align 2, !tbaa !22
  br label %132

132:                                              ; preds = %83
  br label %133

133:                                              ; preds = %132
  %134 = getelementptr inbounds %struct.arm_2d_region_t, ptr %11, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.arm_2d_region_t, ptr %11, i32 0, i32 0
  %137 = load i32, ptr %136, align 2
  %138 = call i32 @arm_2d_helper_pfb_get_absolute_location(ptr noundef %135, i32 %137)
  store i32 %138, ptr %12, align 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %134, ptr align 2 %12, i64 4, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = icmp ne ptr null, %139
  br i1 %140, label %141, label %160

141:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %13, ptr align 2 %142, i64 8, i1 false), !tbaa.struct !21
  %143 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %144 = load ptr, ptr %6, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 0
  %146 = load i32, ptr %145, align 2
  %147 = call i32 @arm_2d_helper_pfb_get_absolute_location(ptr noundef %144, i32 %146)
  store i32 %147, ptr %14, align 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %143, ptr align 2 %14, i64 4, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  %148 = call zeroext i1 @arm_2d_region_intersect(ptr noundef %11, ptr noundef %13, ptr noundef %11)
  br i1 %148, label %156, label %149

149:                                              ; preds = %141
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %150, i32 0, i32 0
  %152 = getelementptr inbounds %struct.anon.34, ptr %151, i32 0, i32 4
  %153 = load i8, ptr %152, align 8
  %154 = and i8 %153, -5
  %155 = or i8 %154, 4
  store i8 %155, ptr %152, align 8
  store i32 2, ptr %10, align 4
  br label %157

156:                                              ; preds = %141
  store i32 0, ptr %10, align 4
  br label %157

157:                                              ; preds = %156, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %158 = load i32, ptr %10, align 4
  switch i32 %158, label %308 [
    i32 0, label %159
  ]

159:                                              ; preds = %157
  br label %160

160:                                              ; preds = %159, %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.memset.p0.i64(ptr align 2 %15, i8 0, i64 8, i1 false)
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = call ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef %161, ptr noundef %15, ptr noundef null, ptr noundef null, i1 noundef zeroext true)
  %163 = icmp eq ptr null, %162
  br i1 %163, label %164, label %171

164:                                              ; preds = %160
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %165, i32 0, i32 0
  %167 = getelementptr inbounds %struct.anon.34, ptr %166, i32 0, i32 4
  %168 = load i8, ptr %167, align 8
  %169 = and i8 %168, -5
  %170 = or i8 %169, 4
  store i8 %170, ptr %167, align 8
  store i32 2, ptr %10, align 4
  br label %181

171:                                              ; preds = %160
  %172 = call zeroext i1 @arm_2d_region_intersect(ptr noundef %11, ptr noundef %15, ptr noundef %11)
  br i1 %172, label %180, label %173

173:                                              ; preds = %171
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %174, i32 0, i32 0
  %176 = getelementptr inbounds %struct.anon.34, ptr %175, i32 0, i32 4
  %177 = load i8, ptr %176, align 8
  %178 = and i8 %177, -5
  %179 = or i8 %178, 4
  store i8 %179, ptr %176, align 8
  store i32 2, ptr %10, align 4
  br label %181

180:                                              ; preds = %171
  store i32 0, ptr %10, align 4
  br label %181

181:                                              ; preds = %180, %173, %164
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  %182 = load i32, ptr %10, align 4
  switch i32 %182, label %308 [
    i32 0, label %183
  ]

183:                                              ; preds = %181
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %184, i32 0, i32 0
  %186 = getelementptr inbounds %struct.anon.34, ptr %185, i32 0, i32 2
  %187 = getelementptr inbounds %struct.anon.36, ptr %186, i32 0, i32 1
  %188 = load ptr, ptr %5, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %188, i32 0, i32 0
  %190 = getelementptr inbounds %struct.anon.34, ptr %189, i32 0, i32 2
  %191 = getelementptr inbounds %struct.anon.36, ptr %190, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %187, ptr align 8 %191, i64 8, i1 false), !tbaa.struct !21
  %192 = load ptr, ptr %5, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %192, i32 0, i32 0
  %194 = getelementptr inbounds %struct.anon.34, ptr %193, i32 0, i32 2
  %195 = getelementptr inbounds %struct.anon.36, ptr %194, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %195, ptr align 2 %11, i64 8, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %196, i32 0, i32 0
  %198 = getelementptr inbounds %struct.anon.34, ptr %197, i32 0, i32 4
  %199 = load i8, ptr %198, align 8
  %200 = and i8 %199, 1
  %201 = icmp ne i8 %200, 0
  br i1 %201, label %202, label %222

202:                                              ; preds = %183
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %203, i32 0, i32 0
  %205 = getelementptr inbounds %struct.anon.34, ptr %204, i32 0, i32 2
  %206 = getelementptr inbounds %struct.anon.36, ptr %205, i32 0, i32 0
  %207 = load ptr, ptr %5, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %207, i32 0, i32 0
  %209 = getelementptr inbounds %struct.anon.34, ptr %208, i32 0, i32 2
  %210 = getelementptr inbounds %struct.anon.36, ptr %209, i32 0, i32 1
  %211 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef %206, ptr noundef %210, ptr noundef %17)
  %212 = load ptr, ptr %5, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %212, i32 0, i32 0
  %214 = getelementptr inbounds %struct.anon.34, ptr %213, i32 0, i32 2
  %215 = getelementptr inbounds %struct.anon.36, ptr %214, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %215, ptr align 2 %17, i64 8, i1 false), !tbaa.struct !21
  %216 = load ptr, ptr %5, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %216, i32 0, i32 0
  %218 = getelementptr inbounds %struct.anon.34, ptr %217, i32 0, i32 4
  %219 = load i8, ptr %218, align 8
  %220 = and i8 %219, -9
  %221 = or i8 %220, 8
  store i8 %221, ptr %218, align 8
  store i32 2, ptr %10, align 4
  br label %307

222:                                              ; preds = %183
  %223 = load ptr, ptr %5, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %223, i32 0, i32 0
  %225 = getelementptr inbounds %struct.anon.34, ptr %224, i32 0, i32 2
  %226 = getelementptr inbounds %struct.anon.36, ptr %225, i32 0, i32 1
  %227 = load ptr, ptr %5, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %227, i32 0, i32 0
  %229 = getelementptr inbounds %struct.anon.34, ptr %228, i32 0, i32 2
  %230 = getelementptr inbounds %struct.anon.36, ptr %229, i32 0, i32 0
  %231 = call zeroext i1 @arm_2d_region_intersect(ptr noundef %226, ptr noundef %230, ptr noundef %16)
  br i1 %231, label %232, label %305

232:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %233 = load ptr, ptr %5, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %233, i32 0, i32 0
  %235 = getelementptr inbounds %struct.anon.34, ptr %234, i32 0, i32 2
  %236 = getelementptr inbounds %struct.anon.36, ptr %235, i32 0, i32 1
  %237 = getelementptr inbounds %struct.arm_2d_region_t, ptr %236, i32 0, i32 1
  %238 = getelementptr inbounds %struct.arm_2d_size_t, ptr %237, i32 0, i32 1
  %239 = load i16, ptr %238, align 2, !tbaa !22
  %240 = sext i16 %239 to i32
  %241 = load ptr, ptr %5, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %241, i32 0, i32 0
  %243 = getelementptr inbounds %struct.anon.34, ptr %242, i32 0, i32 2
  %244 = getelementptr inbounds %struct.anon.36, ptr %243, i32 0, i32 1
  %245 = getelementptr inbounds %struct.arm_2d_region_t, ptr %244, i32 0, i32 1
  %246 = getelementptr inbounds %struct.arm_2d_size_t, ptr %245, i32 0, i32 0
  %247 = load i16, ptr %246, align 4, !tbaa !22
  %248 = sext i16 %247 to i32
  %249 = mul nsw i32 %240, %248
  store i32 %249, ptr %18, align 4, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %250 = load ptr, ptr %5, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %250, i32 0, i32 0
  %252 = getelementptr inbounds %struct.anon.34, ptr %251, i32 0, i32 2
  %253 = getelementptr inbounds %struct.anon.36, ptr %252, i32 0, i32 0
  %254 = getelementptr inbounds %struct.arm_2d_region_t, ptr %253, i32 0, i32 1
  %255 = getelementptr inbounds %struct.arm_2d_size_t, ptr %254, i32 0, i32 1
  %256 = load i16, ptr %255, align 2, !tbaa !22
  %257 = sext i16 %256 to i32
  %258 = load ptr, ptr %5, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %258, i32 0, i32 0
  %260 = getelementptr inbounds %struct.anon.34, ptr %259, i32 0, i32 2
  %261 = getelementptr inbounds %struct.anon.36, ptr %260, i32 0, i32 0
  %262 = getelementptr inbounds %struct.arm_2d_region_t, ptr %261, i32 0, i32 1
  %263 = getelementptr inbounds %struct.arm_2d_size_t, ptr %262, i32 0, i32 0
  %264 = load i16, ptr %263, align 4, !tbaa !22
  %265 = sext i16 %264 to i32
  %266 = mul nsw i32 %257, %265
  store i32 %266, ptr %19, align 4, !tbaa !25
  %267 = load ptr, ptr %5, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %267, i32 0, i32 0
  %269 = getelementptr inbounds %struct.anon.34, ptr %268, i32 0, i32 2
  %270 = getelementptr inbounds %struct.anon.36, ptr %269, i32 0, i32 0
  %271 = load ptr, ptr %5, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %271, i32 0, i32 0
  %273 = getelementptr inbounds %struct.anon.34, ptr %272, i32 0, i32 2
  %274 = getelementptr inbounds %struct.anon.36, ptr %273, i32 0, i32 1
  %275 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef %270, ptr noundef %274, ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %276 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 1
  %277 = getelementptr inbounds %struct.arm_2d_size_t, ptr %276, i32 0, i32 1
  %278 = load i16, ptr %277, align 2, !tbaa !22
  %279 = sext i16 %278 to i32
  %280 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 1
  %281 = getelementptr inbounds %struct.arm_2d_size_t, ptr %280, i32 0, i32 0
  %282 = load i16, ptr %281, align 2, !tbaa !22
  %283 = sext i16 %282 to i32
  %284 = mul nsw i32 %279, %283
  store i32 %284, ptr %20, align 4, !tbaa !25
  %285 = load i32, ptr %20, align 4, !tbaa !25
  %286 = load i32, ptr %18, align 4, !tbaa !25
  %287 = load i32, ptr %19, align 4, !tbaa !25
  %288 = add i32 %286, %287
  %289 = icmp ult i32 %285, %288
  br i1 %289, label %290, label %301

290:                                              ; preds = %232
  %291 = load ptr, ptr %5, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %291, i32 0, i32 0
  %293 = getelementptr inbounds %struct.anon.34, ptr %292, i32 0, i32 2
  %294 = getelementptr inbounds %struct.anon.36, ptr %293, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %294, ptr align 2 %17, i64 8, i1 false), !tbaa.struct !21
  %295 = load ptr, ptr %5, align 8, !tbaa !5
  %296 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_item_t, ptr %295, i32 0, i32 0
  %297 = getelementptr inbounds %struct.anon.34, ptr %296, i32 0, i32 4
  %298 = load i8, ptr %297, align 8
  %299 = and i8 %298, -9
  %300 = or i8 %299, 8
  store i8 %300, ptr %297, align 8
  store i32 2, ptr %10, align 4
  br label %302

301:                                              ; preds = %232
  store i32 0, ptr %10, align 4
  br label %302

302:                                              ; preds = %301, %290
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  %303 = load i32, ptr %10, align 4
  switch i32 %303, label %307 [
    i32 0, label %304
  ]

304:                                              ; preds = %302
  br label %305

305:                                              ; preds = %304, %222
  br label %306

306:                                              ; preds = %305
  store i32 0, ptr %10, align 4
  br label %307

307:                                              ; preds = %306, %302, %202
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %308

308:                                              ; preds = %307, %181, %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %309 = load i32, ptr %10, align 4
  switch i32 %309, label %316 [
    i32 0, label %310
    i32 2, label %312
  ]

310:                                              ; preds = %308
  br label %311

311:                                              ; preds = %310
  br label %312

312:                                              ; preds = %311, %308
  store i32 0, ptr %10, align 4
  br label %313

313:                                              ; preds = %312, %61, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %314 = load i32, ptr %10, align 4
  switch i32 %314, label %316 [
    i32 0, label %315
    i32 1, label %315
  ]

315:                                              ; preds = %313, %313
  ret void

316:                                              ; preds = %313, %308
  unreachable
}

declare ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) #5

declare ptr @arm_2d_region_get_minimal_enclosure(ptr noundef, ptr noundef, ptr noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!10, !6, i64 8}
!10 = !{!"arm_2d_helper_dirty_region_item_t", !11, i64 0, !12, i64 48}
!11 = !{!"", !6, i64 0, !6, i64 8, !7, i64 16, !12, i64 32, !7, i64 40, !7, i64 40, !7, i64 40, !7, i64 40, !7, i64 41, !13, i64 42}
!12 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !7, i64 48}
!15 = !{!"arm_2d_helper_dirty_region_t", !16, i64 0, !10, i64 56}
!16 = !{!"", !17, i64 0, !6, i64 32, !6, i64 40, !7, i64 48}
!17 = !{!"arm_2d_region_list_item_t", !6, i64 0, !18, i64 8, !12, i64 16, !19, i64 24}
!18 = !{!"", !6, i64 0}
!19 = !{!"", !7, i64 0, !7, i64 1, !7, i64 1, !13, i64 2, !13, i64 2, !13, i64 2, !13, i64 2}
!20 = !{!10, !7, i64 41}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22}
!22 = !{!7, !7, i64 0}
!23 = !{i64 0, i64 2, !24, i64 2, i64 2, !24}
!24 = !{!13, !13, i64 0}
!25 = !{!26, !26, i64 0}
!26 = !{!"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.arm_2d_region_t = type { %union.anon, %union.anon.0 }
%union.anon = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.0 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }

; 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
declare dso_local i32 @arm_2d_helper_pfb_get_absolute_location(ptr noundef nonnull, i32) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @__arm_2d_helper_dirty_region_item_update(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef readonly %2, ptr noundef readonly %3) local_unnamed_addr #1 {
  %5 = alloca %struct.arm_2d_region_t, align 8
  %6 = alloca %struct.arm_2d_region_t, align 8
  %7 = alloca %struct.arm_2d_region_t, align 8
  %8 = alloca %struct.arm_2d_region_t, align 2
  %9 = alloca %struct.arm_2d_region_t, align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %19, label %12

12:                                               ; preds = %4
  %13 = getelementptr inbounds i8, ptr %11, i64 48
  %14 = load i8, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 41
  %16 = load i8, ptr %15, align 1, !tbaa !19
  %17 = icmp eq i8 %14, %16
  br i1 %17, label %95, label %18

18:                                               ; preds = %12
  store i8 %14, ptr %15, align 1, !tbaa !19
  br label %19

19:                                               ; preds = %18, %4
  %20 = icmp eq ptr %3, null
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load i8, ptr %21, align 8
  br i1 %20, label %23, label %25

23:                                               ; preds = %19
  %24 = or i8 %22, 4
  store i8 %24, ptr %21, align 8
  br label %95

25:                                               ; preds = %19
  %26 = and i8 %22, -13
  store i8 %26, ptr %21, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %27 = load i64, ptr %3, align 2
  %28 = getelementptr inbounds i8, ptr %0, i64 48
  %29 = lshr i64 %27, 32
  %30 = lshr i64 %27, 48
  %31 = lshr i64 %27, 16
  %32 = load <4 x i16>, ptr %28, align 8, !tbaa !20
  %33 = trunc i64 %27 to i16
  %34 = insertelement <4 x i16> poison, i16 %33, i64 0
  %35 = trunc i64 %31 to i16
  %36 = insertelement <4 x i16> %34, i16 %35, i64 1
  %37 = trunc i64 %29 to i16
  %38 = insertelement <4 x i16> %36, i16 %37, i64 2
  %39 = trunc nuw i64 %30 to i16
  %40 = insertelement <4 x i16> %38, i16 %39, i64 3
  %41 = add <4 x i16> %32, %40
  store <4 x i16> %41, ptr %5, align 8, !tbaa !20
  %42 = load i32, ptr %5, align 8
  %43 = tail call i32 @arm_2d_helper_pfb_get_absolute_location(ptr noundef %1, i32 %42)
  store i32 %43, ptr %5, align 8
  %.not54 = icmp eq ptr %2, null
  br i1 %.not54, label %52, label %44

44:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %45 = load i64, ptr %2, align 2
  store i64 %45, ptr %6, align 8
  %46 = trunc i64 %45 to i32
  %47 = tail call i32 @arm_2d_helper_pfb_get_absolute_location(ptr noundef %1, i32 %46)
  store i32 %47, ptr %6, align 8
  %48 = call zeroext i1 @arm_2d_region_intersect(ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %5) #3
  br i1 %48, label %.critedge, label %49

49:                                               ; preds = %44
  %50 = load i8, ptr %21, align 8
  %51 = or i8 %50, 4
  store i8 %51, ptr %21, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br label %94

.critedge:                                        ; preds = %44
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br label %52

52:                                               ; preds = %.critedge, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  store i64 0, ptr %7, align 8
  %53 = call ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef nonnull %1, ptr noundef nonnull %7, ptr noundef null, ptr noundef null, i1 noundef zeroext true) #3
  %54 = icmp eq ptr %53, null
  br i1 %54, label %.critedge58, label %55

55:                                               ; preds = %52
  %56 = call zeroext i1 @arm_2d_region_intersect(ptr noundef nonnull %5, ptr noundef nonnull %7, ptr noundef nonnull %5) #3
  br i1 %56, label %57, label %.critedge58

57:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  %58 = getelementptr inbounds i8, ptr %0, i64 16
  %59 = getelementptr inbounds i8, ptr %0, i64 24
  %60 = load i64, ptr %58, align 8
  store i64 %60, ptr %59, align 8
  %61 = load i64, ptr %5, align 8
  store i64 %61, ptr %58, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %62 = load i8, ptr %21, align 8
  %63 = and i8 %62, 1
  %.not55 = icmp eq i8 %63, 0
  br i1 %.not55, label %66, label %64

64:                                               ; preds = %57
  %65 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef nonnull %58, ptr noundef nonnull %59, ptr noundef nonnull %9) #3
  br label %.critedge60.sink.split

66:                                               ; preds = %57
  %67 = call zeroext i1 @arm_2d_region_intersect(ptr noundef nonnull %59, ptr noundef nonnull %58, ptr noundef nonnull %8) #3
  br i1 %67, label %68, label %.critedge60

68:                                               ; preds = %66
  %69 = getelementptr inbounds i8, ptr %0, i64 28
  %70 = getelementptr inbounds i8, ptr %0, i64 30
  %71 = load i16, ptr %70, align 2, !tbaa !20
  %72 = sext i16 %71 to i32
  %73 = load i16, ptr %69, align 4, !tbaa !20
  %74 = sext i16 %73 to i32
  %75 = mul nsw i32 %74, %72
  %76 = getelementptr inbounds i8, ptr %0, i64 20
  %77 = getelementptr inbounds i8, ptr %0, i64 22
  %78 = load i16, ptr %77, align 2, !tbaa !20
  %79 = sext i16 %78 to i32
  %80 = load i16, ptr %76, align 4, !tbaa !20
  %81 = sext i16 %80 to i32
  %82 = mul nsw i32 %81, %79
  %83 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef nonnull %58, ptr noundef nonnull %59, ptr noundef nonnull %9) #3
  %84 = getelementptr inbounds i8, ptr %9, i64 4
  %85 = getelementptr inbounds i8, ptr %9, i64 6
  %86 = load i16, ptr %85, align 2, !tbaa !20
  %87 = sext i16 %86 to i32
  %88 = load i16, ptr %84, align 4, !tbaa !20
  %89 = sext i16 %88 to i32
  %90 = mul nsw i32 %89, %87
  %91 = add i32 %82, %75
  %.not56 = icmp ult i32 %90, %91
  br i1 %.not56, label %.critedge60.sink.split, label %.critedge60

.critedge60.sink.split:                           ; preds = %68, %64
  %.sink = load i64, ptr %9, align 8
  store i64 %.sink, ptr %59, align 8
  %92 = load i8, ptr %21, align 8
  %93 = or i8 %92, 8
  store i8 %93, ptr %21, align 8
  br label %.critedge60

.critedge60:                                      ; preds = %.critedge60.sink.split, %68, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br label %94

.critedge58:                                      ; preds = %55, %52
  %storemerge.in = load i8, ptr %21, align 8
  %storemerge = or i8 %storemerge.in, 4
  store i8 %storemerge, ptr %21, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  br label %94

94:                                               ; preds = %49, %.critedge58, %.critedge60
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br label %95

95:                                               ; preds = %12, %94, %23
  ret void
}

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

declare ptr @arm_2d_region_get_minimal_enclosure(ptr noundef, ptr noundef, ptr noundef) 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 = { "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_helper_dirty_region_item_t", !7, i64 0, !11, i64 48}
!7 = !{!"", !8, i64 0, !8, i64 8, !9, i64 16, !11, i64 32, !9, i64 40, !9, i64 40, !9, i64 40, !9, i64 40, !9, i64 41, !12, i64 42}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"arm_2d_region_t", !9, i64 0, !9, i64 4}
!12 = !{!"short", !9, i64 0}
!13 = !{!14, !9, i64 48}
!14 = !{!"arm_2d_helper_dirty_region_t", !15, i64 0, !6, i64 56}
!15 = !{!"", !16, i64 0, !8, i64 32, !8, i64 40, !9, i64 48}
!16 = !{!"arm_2d_region_list_item_t", !8, i64 0, !17, i64 8, !11, i64 16, !18, i64 24}
!17 = !{!"", !8, i64 0}
!18 = !{!"", !9, i64 0, !9, i64 1, !9, i64 1, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2}
!19 = !{!6, !9, i64 41}
!20 = !{!9, !9, i64 0}


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