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

; 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.34, %union.anon.35 }
%union.anon.34 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.35 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%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 }
%union.arm_2d_color_info_t = type { %struct.anon.3 }
%struct.anon.3 = type { i8 }
%struct.arm_2d_tile_t = type { %union.anon.24, %union.anon.33, %union.anon.36 }
%union.anon.24 = type { %struct.anon.25 }
%struct.anon.25 = type { i8, %union.arm_2d_color_info_t, %union.anon.26 }
%union.anon.26 = type { i16 }
%union.anon.33 = type { %struct.arm_2d_region_t }
%union.anon.36 = type { ptr }
%struct.anon.29 = type { i8, %union.arm_2d_color_info_t, %union.anon.30 }
%union.anon.30 = type { i16 }

@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__.__arm_2d_tile_region_caculator = external hidden unnamed_addr constant [140 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

23:                                               ; preds = %6
  br label %25

24:                                               ; preds = %6
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 636, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_tile_region_caculator) #5
  unreachable

25:                                               ; preds = %23
  %26 = load ptr, ptr %8, 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.3, ptr noundef @.str.1, i32 noundef 637, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_tile_region_caculator) #5
  unreachable

30:                                               ; preds = %28
  %31 = load i8, ptr %12, align 1, !tbaa !9, !range !13, !noundef !14
  %32 = trunc i8 %31 to i1
  br i1 %32, label %33, label %38

33:                                               ; preds = %30
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %35, i32 0, i32 6
  %37 = call ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef %34, ptr noundef %36, ptr noundef null, ptr noundef null, i1 noundef zeroext true)
  br label %38

38:                                               ; preds = %33, %30
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %40, i32 0, i32 7
  %42 = call ptr @__arm_2d_tile_get_root(ptr noundef %39, ptr noundef %13, ptr noundef null, ptr noundef %41)
  store ptr %42, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #4
  store i8 0, ptr %16, align 1, !tbaa !9
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %43, i32 0, i32 7
  %45 = load ptr, ptr %44, align 8, !tbaa !15
  %46 = icmp ne ptr null, %45
  br i1 %46, label %47, label %57

47:                                               ; preds = %38
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %48, i32 0, i32 7
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %50, i32 0, i32 0
  %52 = load i8, ptr %51, align 8
  %53 = and i8 %52, 1
  %54 = icmp ne i8 %53, 0
  br i1 %54, label %56, label %55

55:                                               ; preds = %47
  store i8 1, ptr %16, align 1, !tbaa !9
  br label %56

56:                                               ; preds = %55, %47
  br label %57

57:                                               ; preds = %56, %38
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = icmp ne ptr null, %58
  br i1 %59, label %60, label %231

60:                                               ; preds = %57
  %61 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %82

63:                                               ; preds = %60
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %64, i32 0, i32 0
  %66 = load i8, ptr %65, align 8
  %67 = lshr i8 %66, 1
  %68 = and i8 %67, 1
  %69 = icmp ne i8 %68, 0
  br i1 %69, label %70, label %81

70:                                               ; preds = %63
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds %struct.anon.25, ptr %72, i32 0, i32 1
  %74 = load i8, ptr %73, align 1
  %75 = lshr i8 %74, 1
  %76 = and i8 %75, 7
  %77 = zext i8 %76 to i32
  %78 = shl i32 1, %77
  %79 = trunc i32 %78 to i8
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  store i8 %79, ptr %80, align 1, !tbaa !19
  br label %81

81:                                               ; preds = %70, %63
  br label %82

82:                                               ; preds = %81, %60
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #4
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load i8, ptr %83, align 1, !tbaa !19
  store i8 %84, ptr %17, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %85 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %18, ptr align 2 %85, i64 4, i1 false), !tbaa.struct !20
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %86, i32 0, i32 1
  %88 = getelementptr inbounds %struct.arm_2d_region_t, ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %struct.arm_2d_location_t, ptr %88, i32 0, i32 0
  %90 = load i16, ptr %89, align 4, !tbaa !19
  %91 = sext i16 %90 to i32
  %92 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 0
  %93 = load i16, ptr %92, align 2, !tbaa !22
  %94 = sext i16 %93 to i32
  %95 = sub nsw i32 %94, %91
  %96 = trunc i32 %95 to i16
  store i16 %96, ptr %92, align 2, !tbaa !22
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %97, i32 0, i32 1
  %99 = getelementptr inbounds %struct.arm_2d_region_t, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds %struct.arm_2d_location_t, ptr %99, i32 0, i32 1
  %101 = load i16, ptr %100, align 2, !tbaa !19
  %102 = sext i16 %101 to i32
  %103 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 1
  %104 = load i16, ptr %103, align 2, !tbaa !24
  %105 = sext i16 %104 to i32
  %106 = sub nsw i32 %105, %102
  %107 = trunc i32 %106 to i16
  store i16 %107, ptr %103, align 2, !tbaa !24
  %108 = load i32, ptr %11, align 4, !tbaa !11
  %109 = and i32 %108, 8
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %113

111:                                              ; preds = %82
  %112 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 0
  store i16 0, ptr %112, align 2, !tbaa !22
  br label %113

113:                                              ; preds = %111, %82
  %114 = load i32, ptr %11, align 4, !tbaa !11
  %115 = and i32 %114, 4
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %119

117:                                              ; preds = %113
  %118 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 1
  store i16 0, ptr %118, align 2, !tbaa !24
  br label %119

119:                                              ; preds = %117, %113
  %120 = load i8, ptr %17, align 1, !tbaa !19
  %121 = zext i8 %120 to i32
  %122 = icmp sge i32 %121, 8
  br i1 %122, label %123, label %148

123:                                              ; preds = %119
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %124, i32 0, i32 1
  %126 = getelementptr inbounds %struct.arm_2d_region_t, ptr %125, i32 0, i32 1
  %127 = getelementptr inbounds %struct.arm_2d_size_t, ptr %126, i32 0, i32 0
  %128 = load i16, ptr %127, align 4, !tbaa !19
  %129 = sext i16 %128 to i32
  %130 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 1
  %131 = load i16, ptr %130, align 2, !tbaa !24
  %132 = sext i16 %131 to i32
  %133 = mul nsw i32 %129, %132
  %134 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 0
  %135 = load i16, ptr %134, align 2, !tbaa !22
  %136 = sext i16 %135 to i32
  %137 = add nsw i32 %133, %136
  store i32 %137, ptr %14, align 4, !tbaa !11
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !19
  %141 = load i32, ptr %14, align 4, !tbaa !11
  %142 = load i8, ptr %17, align 1, !tbaa !19
  %143 = zext i8 %142 to i32
  %144 = mul nsw i32 %141, %143
  %145 = ashr i32 %144, 3
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds i8, ptr %140, i64 %146
  store ptr %147, ptr %15, align 8, !tbaa !5
  br label %181

148:                                              ; preds = %119
  %149 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 0
  %150 = load i16, ptr %149, align 2, !tbaa !22
  %151 = sext i16 %150 to i32
  store i32 %151, ptr %14, align 4, !tbaa !11
  %152 = load ptr, ptr %7, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %152, i32 0, i32 2
  %154 = load ptr, ptr %153, align 8, !tbaa !19
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %155, i32 0, i32 1
  %157 = getelementptr inbounds %struct.arm_2d_region_t, ptr %156, i32 0, i32 1
  %158 = getelementptr inbounds %struct.arm_2d_size_t, ptr %157, i32 0, i32 0
  %159 = load i16, ptr %158, align 4, !tbaa !19
  %160 = sext i16 %159 to i32
  %161 = load i8, ptr %17, align 1, !tbaa !19
  %162 = zext i8 %161 to i32
  %163 = mul nsw i32 %160, %162
  %164 = add nsw i32 %163, 7
  %165 = ashr i32 %164, 3
  %166 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 1
  %167 = load i16, ptr %166, align 2, !tbaa !24
  %168 = sext i16 %167 to i32
  %169 = mul nsw i32 %165, %168
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds i8, ptr %154, i64 %170
  %172 = getelementptr inbounds %struct.arm_2d_location_t, ptr %18, i32 0, i32 0
  %173 = load i16, ptr %172, align 2, !tbaa !22
  %174 = sext i16 %173 to i32
  %175 = load i8, ptr %17, align 1, !tbaa !19
  %176 = zext i8 %175 to i32
  %177 = mul nsw i32 %174, %176
  %178 = ashr i32 %177, 3
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i8, ptr %171, i64 %179
  store ptr %180, ptr %15, align 8, !tbaa !5
  br label %181

181:                                              ; preds = %148, %123
  %182 = load ptr, ptr %7, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %182, i32 0, i32 1
  %184 = getelementptr inbounds %struct.arm_2d_region_t, ptr %183, i32 0, i32 1
  %185 = getelementptr inbounds %struct.arm_2d_size_t, ptr %184, i32 0, i32 0
  %186 = load i16, ptr %185, align 4, !tbaa !19
  %187 = load ptr, ptr %8, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %187, i32 0, i32 2
  store i16 %186, ptr %188, align 4, !tbaa !25
  %189 = load i32, ptr %14, align 4, !tbaa !11
  %190 = load ptr, ptr %8, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %190, i32 0, i32 1
  store i32 %189, ptr %191, align 8, !tbaa !26
  %192 = load ptr, ptr %15, align 8, !tbaa !5
  %193 = load ptr, ptr %8, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %193, i32 0, i32 0
  store ptr %192, ptr %194, align 8, !tbaa !27
  %195 = load ptr, ptr %8, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %195, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %196, ptr align 2 %13, i64 8, i1 false), !tbaa.struct !28
  %197 = load ptr, ptr %7, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %197, i32 0, i32 0
  %199 = getelementptr inbounds %struct.anon.29, ptr %198, i32 0, i32 1
  %200 = load i8, ptr %199, align 1, !tbaa !19
  %201 = load ptr, ptr %8, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %201, i32 0, i32 3
  store i8 %200, ptr %202, align 2, !tbaa !19
  %203 = load i8, ptr %16, align 1, !tbaa !9, !range !13, !noundef !14
  %204 = trunc i8 %203 to i1
  %205 = zext i1 %204 to i8
  %206 = load ptr, ptr %8, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %206, i32 0, i32 4
  %208 = load i8, ptr %207, align 1
  %209 = and i8 %205, 1
  %210 = shl i8 %209, 1
  %211 = and i8 %208, -3
  %212 = or i8 %211, %210
  store i8 %212, ptr %207, align 1
  %213 = load ptr, ptr %8, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %213, i32 0, i32 4
  %215 = load i8, ptr %214, align 1
  %216 = and i8 %215, -2
  %217 = or i8 %216, 0
  store i8 %217, ptr %214, align 1
  %218 = load i8, ptr %12, align 1, !tbaa !9, !range !13, !noundef !14
  %219 = trunc i8 %218 to i1
  %220 = xor i1 %219, true
  %221 = xor i1 %220, true
  %222 = zext i1 %221 to i32
  %223 = trunc i32 %222 to i8
  %224 = load ptr, ptr %8, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.__arm_2d_tile_param_t, ptr %224, i32 0, i32 4
  %226 = load i8, ptr %225, align 1
  %227 = and i8 %223, 1
  %228 = shl i8 %227, 2
  %229 = and i8 %226, -5
  %230 = or i8 %229, %228
  store i8 %230, ptr %225, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #4
  br label %231

231:                                              ; preds = %181, %57
  %232 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret ptr %232
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef nonnull, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @__arm_2d_tile_get_root(ptr noundef nonnull, ptr noundef, ptr noundef, ptr noundef) #3

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: readwrite) }
attributes #3 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !6, i64 32}
!16 = !{!"__arm_2d_tile_param_t", !6, i64 0, !12, i64 8, !17, i64 12, !7, i64 14, !7, i64 15, !7, i64 15, !7, i64 15, !18, i64 16, !18, i64 24, !6, i64 32}
!17 = !{!"short", !7, i64 0}
!18 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!19 = !{!7, !7, i64 0}
!20 = !{i64 0, i64 2, !21, i64 2, i64 2, !21}
!21 = !{!17, !17, i64 0}
!22 = !{!23, !17, i64 0}
!23 = !{!"arm_2d_location_t", !17, i64 0, !17, i64 2}
!24 = !{!23, !17, i64 2}
!25 = !{!16, !17, i64 12}
!26 = !{!16, !12, i64 8}
!27 = !{!16, !6, i64 0}
!28 = !{i64 0, i64 4, !19, i64 4, i64 4, !19}


; 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.34, %union.anon.35 }
%union.anon.34 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.35 = 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
define dso_local ptr @__arm_2d_tile_region_caculator(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr nocapture noundef %2, i1 noundef zeroext %3, i32 noundef %4, i1 noundef zeroext %5) local_unnamed_addr #1 {
  %7 = alloca %struct.arm_2d_region_t, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #2
  br i1 %5, label %8, label %11

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = tail call ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef %0, ptr noundef nonnull %9, ptr noundef null, ptr noundef null, i1 noundef zeroext true)
  br label %11

11:                                               ; preds = %8, %6
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  %13 = call ptr @__arm_2d_tile_get_root(ptr noundef %0, ptr noundef nonnull %7, ptr noundef null, ptr noundef nonnull %12)
  %14 = load ptr, ptr %12, align 8, !tbaa !5
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %19, label %15

15:                                               ; preds = %11
  %16 = load i8, ptr %14, align 8
  %17 = shl i8 %16, 1
  %18 = and i8 %17, 2
  %spec.select = xor i8 %18, 2
  br label %19

19:                                               ; preds = %15, %11
  %.0 = phi i8 [ 0, %11 ], [ %spec.select, %15 ]
  %.not53 = icmp eq ptr %13, null
  br i1 %.not53, label %85, label %20

20:                                               ; preds = %19
  br i1 %3, label %21, label %thread-pre-split

21:                                               ; preds = %20
  %22 = load i8, ptr %13, align 8
  %23 = and i8 %22, 2
  %.not54 = icmp eq i8 %23, 0
  br i1 %.not54, label %thread-pre-split, label %24

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %13, i64 1
  %26 = load i8, ptr %25, align 1
  %27 = lshr i8 %26, 1
  %28 = and i8 %27, 7
  %29 = shl nuw i8 1, %28
  store i8 %29, ptr %2, align 1, !tbaa !13
  br label %30

thread-pre-split:                                 ; preds = %20, %21
  %.pr = load i8, ptr %2, align 1, !tbaa !13
  br label %30

30:                                               ; preds = %thread-pre-split, %24
  %31 = phi i8 [ %.pr, %thread-pre-split ], [ %29, %24 ]
  %.sroa.0.0.copyload = load i16, ptr %7, align 8, !tbaa !14
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 2
  %.sroa.9.0.copyload = load i16, ptr %.sroa.9.0..sroa_idx, align 2, !tbaa !14
  %32 = getelementptr inbounds i8, ptr %13, i64 4
  %33 = load i16, ptr %32, align 4, !tbaa !13
  %34 = sub i16 %.sroa.0.0.copyload, %33
  %35 = getelementptr inbounds i8, ptr %13, i64 6
  %36 = load i16, ptr %35, align 2, !tbaa !13
  %37 = sub i16 %.sroa.9.0.copyload, %36
  %38 = and i32 %4, 8
  %.not55 = icmp eq i32 %38, 0
  %spec.select57 = select i1 %.not55, i16 %34, i16 0
  %39 = and i32 %4, 4
  %.not56 = icmp eq i32 %39, 0
  %.sroa.9.0 = select i1 %.not56, i16 %37, i16 0
  %40 = zext i8 %31 to i32
  %41 = icmp ugt i8 %31, 7
  br i1 %41, label %42, label %52

42:                                               ; preds = %30
  %43 = getelementptr inbounds i8, ptr %13, i64 8
  %44 = load i16, ptr %43, align 4, !tbaa !13
  %45 = sext i16 %44 to i32
  %46 = sext i16 %.sroa.9.0 to i32
  %47 = mul nsw i32 %45, %46
  %48 = sext i16 %spec.select57 to i32
  %49 = add nsw i32 %47, %48
  %50 = getelementptr inbounds i8, ptr %13, i64 16
  %51 = load ptr, ptr %50, align 8, !tbaa !13
  br label %66

52:                                               ; preds = %30
  %53 = sext i16 %spec.select57 to i32
  %54 = getelementptr inbounds i8, ptr %13, i64 16
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = getelementptr inbounds i8, ptr %13, i64 8
  %57 = load i16, ptr %56, align 4, !tbaa !13
  %58 = sext i16 %57 to i32
  %59 = mul nsw i32 %58, %40
  %60 = add nsw i32 %59, 7
  %61 = ashr i32 %60, 3
  %62 = sext i16 %.sroa.9.0 to i32
  %63 = mul nsw i32 %61, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %55, i64 %64
  br label %66

66:                                               ; preds = %52, %42
  %.sink61 = phi i32 [ %53, %52 ], [ %49, %42 ]
  %.sink = phi ptr [ %65, %52 ], [ %51, %42 ]
  %67 = phi i16 [ %57, %52 ], [ %44, %42 ]
  %68 = mul nsw i32 %.sink61, %40
  %69 = ashr i32 %68, 3
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %.sink, i64 %70
  %72 = getelementptr inbounds i8, ptr %1, i64 12
  store i16 %67, ptr %72, align 4, !tbaa !15
  %73 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %.sink61, ptr %73, align 8, !tbaa !16
  store ptr %71, ptr %1, align 8, !tbaa !17
  %74 = getelementptr inbounds i8, ptr %1, i64 16
  %75 = load i64, ptr %7, align 8
  store i64 %75, ptr %74, align 8
  %76 = getelementptr inbounds i8, ptr %13, i64 1
  %77 = load i8, ptr %76, align 1, !tbaa !13
  %78 = getelementptr inbounds i8, ptr %1, i64 14
  store i8 %77, ptr %78, align 2, !tbaa !13
  %79 = getelementptr inbounds i8, ptr %1, i64 15
  %80 = load i8, ptr %79, align 1
  %81 = and i8 %80, -8
  %82 = select i1 %5, i8 4, i8 0
  %83 = or i8 %.0, %82
  %84 = or i8 %83, %81
  store i8 %84, ptr %79, align 1
  br label %85

85:                                               ; preds = %66, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #2
  ret ptr %13
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @__arm_2d_tile_get_virtual_screen_or_root(ptr noundef nonnull, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @__arm_2d_tile_get_root(ptr noundef nonnull, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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 = { 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, !7, i64 32}
!6 = !{!"__arm_2d_tile_param_t", !7, i64 0, !10, i64 8, !11, i64 12, !8, i64 14, !8, i64 15, !8, i64 15, !8, i64 15, !12, i64 16, !12, i64 24, !7, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"arm_2d_region_t", !8, i64 0, !8, i64 4}
!13 = !{!8, !8, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !11, i64 12}
!16 = !{!6, !10, i64 8}
!17 = !{!6, !7, i64 0}


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