; LLVM IR from ARM-software/Arm-2D :: examples/common/controls (battery_gasgauge)

; 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_margin_t = type { i8, i8, i8, i8 }
%struct.arm_2d_tile_t = type { %union.anon, %union.anon.10, %union.anon.13 }
%union.anon = type { %struct.anon.0 }
%struct.anon.0 = type { i8, %union.arm_2d_color_info_t, %union.anon.3 }
%union.arm_2d_color_info_t = type { %struct.anon.1 }
%struct.anon.1 = type { i8 }
%union.anon.3 = type { i16 }
%union.anon.10 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.11, %union.anon.12 }
%union.anon.11 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.12 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.13 = type { ptr }
%union.arm_2d_color_rgb565_t = type { i16 }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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

declare ptr @arm_2d_get_default_frame_buffer() #3

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

declare i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16, i8 noundef zeroext) #3

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @draw_liquid_wave(ptr noundef nonnull %0, ptr noundef %1, i16 noundef zeroext %2, i16 noundef signext %3, i32 %4, i16 noundef zeroext %5, ptr noundef %6) #4 {
  %8 = alloca %struct.arm_2d_margin_t, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i16, align 2
  %12 = alloca i16, align 2
  %13 = alloca i16, align 2
  %14 = alloca ptr, align 8
  %15 = alloca %struct.arm_2d_margin_t, align 1
  %16 = alloca ptr, align 8
  %17 = alloca %struct.arm_2d_margin_t, align 1
  %18 = alloca i32, align 4
  %19 = alloca %struct.arm_2d_tile_t, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct.arm_2d_region_t, align 2
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca %struct.arm_2d_region_t, align 2
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca %struct.arm_2d_region_t, align 2
  %29 = alloca i16, align 2
  %30 = alloca i16, align 2
  %31 = alloca %struct.arm_2d_region_t, align 2
  %32 = alloca %union.arm_2d_color_rgb565_t, align 2
  %33 = alloca %struct.arm_2d_region_t, align 2
  %34 = alloca %union.arm_2d_color_rgb565_t, align 2
  %35 = alloca %union.arm_2d_color_rgb565_t, align 2
  %36 = alloca i8, align 1
  store i32 %4, ptr %8, align 1
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i16 %2, ptr %11, align 2, !tbaa !9
  store i16 %3, ptr %12, align 2, !tbaa !9
  store i16 %5, ptr %13, align 2, !tbaa !9
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store ptr null, ptr %16, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %373, %7
  %38 = load ptr, ptr %16, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %38, i32 1
  store ptr %39, ptr %16, align 8, !tbaa !5
  %40 = icmp eq ptr %38, null
  br i1 %40, label %41, label %54

41:                                               ; preds = %37
  %42 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %17, i32 0, i32 0
  %43 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %8, i32 0, i32 0
  %44 = load i8, ptr %43, align 1, !tbaa !11
  store i8 %44, ptr %42, align 1, !tbaa !11
  %45 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %17, i32 0, i32 1
  %46 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %8, i32 0, i32 1
  %47 = load i8, ptr %46, align 1, !tbaa !13
  store i8 %47, ptr %45, align 1, !tbaa !13
  %48 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %17, i32 0, i32 2
  %49 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %8, i32 0, i32 2
  %50 = load i8, ptr %49, align 1, !tbaa !14
  store i8 %50, ptr %48, align 1, !tbaa !14
  %51 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %17, i32 0, i32 3
  %52 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %8, i32 0, i32 3
  %53 = load i8, ptr %52, align 1, !tbaa !15
  store i8 %53, ptr %51, align 1, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %15, ptr align 1 %17, i64 4, i1 false), !tbaa.struct !16
  br label %55

54:                                               ; preds = %37
  br label %55

55:                                               ; preds = %54, %41
  %56 = phi i32 [ 1, %41 ], [ 0, %54 ]
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  store i32 2, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %374

59:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #5
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  store ptr null, ptr %20, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %371, %59
  %61 = load ptr, ptr %20, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %61, i32 1
  store ptr %62, ptr %20, align 8, !tbaa !5
  %63 = icmp eq ptr %61, null
  br i1 %63, label %64, label %135

64:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  call void @llvm.memset.p0.i64(ptr align 2 %21, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %65, ptr %22, align 8, !tbaa !5
  %66 = load ptr, ptr %22, align 8, !tbaa !5
  %67 = icmp eq ptr null, %66
  br i1 %67, label %68, label %74

68:                                               ; preds = %64
  %69 = call ptr @arm_2d_get_default_frame_buffer()
  store ptr %69, ptr %22, align 8, !tbaa !5
  %70 = load ptr, ptr %22, align 8, !tbaa !5
  %71 = icmp eq ptr null, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %68
  store i32 4, ptr %18, align 4
  br label %131

73:                                               ; preds = %68
  br label %74

74:                                               ; preds = %73, %64
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = icmp eq ptr null, %75
  br i1 %76, label %77, label %82

77:                                               ; preds = %74
  %78 = getelementptr inbounds %struct.arm_2d_region_t, ptr %21, i32 0, i32 1
  %79 = load ptr, ptr %22, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %79, i32 0, i32 1
  %81 = getelementptr inbounds %struct.arm_2d_region_t, ptr %80, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %78, ptr align 4 %81, i64 4, i1 false), !tbaa.struct !18
  br label %84

82:                                               ; preds = %74
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %21, ptr align 2 %83, i64 8, i1 false), !tbaa.struct !19
  br label %84

84:                                               ; preds = %82, %77
  %85 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %15, i32 0, i32 0
  %86 = load i8, ptr %85, align 1, !tbaa !11
  %87 = zext i8 %86 to i32
  %88 = getelementptr inbounds %struct.arm_2d_region_t, ptr %21, i32 0, i32 0
  %89 = getelementptr inbounds %struct.arm_2d_location_t, ptr %88, i32 0, i32 0
  %90 = load i16, ptr %89, align 2, !tbaa !17
  %91 = sext i16 %90 to i32
  %92 = add nsw i32 %91, %87
  %93 = trunc i32 %92 to i16
  store i16 %93, ptr %89, align 2, !tbaa !17
  %94 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %15, i32 0, i32 2
  %95 = load i8, ptr %94, align 1, !tbaa !14
  %96 = zext i8 %95 to i32
  %97 = getelementptr inbounds %struct.arm_2d_region_t, ptr %21, i32 0, i32 0
  %98 = getelementptr inbounds %struct.arm_2d_location_t, ptr %97, i32 0, i32 1
  %99 = load i16, ptr %98, align 2, !tbaa !17
  %100 = sext i16 %99 to i32
  %101 = add nsw i32 %100, %96
  %102 = trunc i32 %101 to i16
  store i16 %102, ptr %98, align 2, !tbaa !17
  %103 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %15, i32 0, i32 0
  %104 = load i8, ptr %103, align 1, !tbaa !11
  %105 = zext i8 %104 to i32
  %106 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %15, i32 0, i32 1
  %107 = load i8, ptr %106, align 1, !tbaa !13
  %108 = zext i8 %107 to i32
  %109 = add nsw i32 %105, %108
  %110 = getelementptr inbounds %struct.arm_2d_region_t, ptr %21, i32 0, i32 1
  %111 = getelementptr inbounds %struct.arm_2d_size_t, ptr %110, i32 0, i32 0
  %112 = load i16, ptr %111, align 2, !tbaa !17
  %113 = sext i16 %112 to i32
  %114 = sub nsw i32 %113, %109
  %115 = trunc i32 %114 to i16
  store i16 %115, ptr %111, align 2, !tbaa !17
  %116 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %15, i32 0, i32 2
  %117 = load i8, ptr %116, align 1, !tbaa !14
  %118 = zext i8 %117 to i32
  %119 = getelementptr inbounds %struct.arm_2d_margin_t, ptr %15, i32 0, i32 3
  %120 = load i8, ptr %119, align 1, !tbaa !15
  %121 = zext i8 %120 to i32
  %122 = add nsw i32 %118, %121
  %123 = getelementptr inbounds %struct.arm_2d_region_t, ptr %21, i32 0, i32 1
  %124 = getelementptr inbounds %struct.arm_2d_size_t, ptr %123, i32 0, i32 1
  %125 = load i16, ptr %124, align 2, !tbaa !17
  %126 = sext i16 %125 to i32
  %127 = sub nsw i32 %126, %122
  %128 = trunc i32 %127 to i16
  store i16 %128, ptr %124, align 2, !tbaa !17
  %129 = load ptr, ptr %22, align 8, !tbaa !5
  %130 = call ptr @arm_2d_tile_generate_child(ptr noundef %129, ptr noundef %21, ptr noundef %19, i1 noundef zeroext false)
  store ptr %130, ptr %23, align 8, !tbaa !5
  store i32 0, ptr %18, align 4
  br label %131

131:                                              ; preds = %84, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  %132 = load i32, ptr %18, align 4
  switch i32 %132, label %372 [
    i32 0, label %133
  ]

133:                                              ; preds = %131
  %134 = load ptr, ptr %23, align 8, !tbaa !5
  br label %136

135:                                              ; preds = %60
  br label %136

136:                                              ; preds = %135, %133
  %137 = phi i32 [ 1, %133 ], [ 0, %135 ]
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %140, label %139

139:                                              ; preds = %136
  store i32 4, ptr %18, align 4
  br label %372

140:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  call void @llvm.memset.p0.i64(ptr align 2 %24, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  store ptr null, ptr %25, align 8, !tbaa !5
  br label %141

141:                                              ; preds = %365, %140
  %142 = load ptr, ptr %25, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.arm_2d_region_t, ptr %142, i32 1
  store ptr %143, ptr %25, align 8, !tbaa !5
  %144 = icmp eq ptr %142, null
  br i1 %144, label %145, label %149

145:                                              ; preds = %141
  %146 = getelementptr inbounds %struct.arm_2d_region_t, ptr %24, i32 0, i32 1
  %147 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %19, i32 0, i32 1
  %148 = getelementptr inbounds %struct.arm_2d_region_t, ptr %147, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %146, ptr align 4 %148, i64 4, i1 false), !tbaa.struct !18
  br label %150

149:                                              ; preds = %141
  br label %150

150:                                              ; preds = %149, %145
  %151 = phi i32 [ 1, %145 ], [ 0, %149 ]
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %154, label %153

153:                                              ; preds = %150
  store i32 7, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %370

154:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  store ptr %19, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  store ptr null, ptr %27, align 8, !tbaa !5
  br label %155

155:                                              ; preds = %362, %154
  %156 = load ptr, ptr %27, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %156, i32 1
  store ptr %157, ptr %27, align 8, !tbaa !5
  %158 = icmp eq ptr %156, null
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 10, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br label %364

160:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %28, ptr align 2 %24, i64 8, i1 false), !tbaa.struct !19
  %161 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 1
  %162 = getelementptr inbounds %struct.arm_2d_size_t, ptr %161, i32 0, i32 1
  %163 = load i16, ptr %162, align 2, !tbaa !17
  %164 = sext i16 %163 to i32
  %165 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 1
  %166 = getelementptr inbounds %struct.arm_2d_size_t, ptr %165, i32 0, i32 1
  %167 = load i16, ptr %166, align 2, !tbaa !17
  %168 = sext i16 %167 to i32
  %169 = load i16, ptr %11, align 2, !tbaa !9
  %170 = zext i16 %169 to i32
  %171 = mul nsw i32 %168, %170
  %172 = sdiv i32 %171, 1000
  %173 = sub nsw i32 %164, %172
  %174 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 0
  %175 = getelementptr inbounds %struct.arm_2d_location_t, ptr %174, i32 0, i32 1
  %176 = load i16, ptr %175, align 2, !tbaa !17
  %177 = sext i16 %176 to i32
  %178 = add nsw i32 %177, %173
  %179 = trunc i32 %178 to i16
  store i16 %179, ptr %175, align 2, !tbaa !17
  %180 = load ptr, ptr %14, align 8, !tbaa !5
  %181 = icmp ne ptr null, %180
  br i1 %181, label %182, label %356

182:                                              ; preds = %160
  %183 = load ptr, ptr %14, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %183, i32 0, i32 1
  %185 = getelementptr inbounds %struct.arm_2d_region_t, ptr %184, i32 0, i32 1
  %186 = getelementptr inbounds %struct.arm_2d_size_t, ptr %185, i32 0, i32 0
  %187 = load i16, ptr %186, align 4, !tbaa !17
  %188 = sext i16 %187 to i32
  %189 = load i16, ptr %12, align 2, !tbaa !9
  %190 = sext i16 %189 to i32
  %191 = srem i32 %190, %188
  %192 = trunc i32 %191 to i16
  store i16 %192, ptr %12, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %29) #5
  %193 = load i16, ptr %12, align 2, !tbaa !9
  %194 = sext i16 %193 to i32
  %195 = load ptr, ptr %14, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %195, i32 0, i32 1
  %197 = getelementptr inbounds %struct.arm_2d_region_t, ptr %196, i32 0, i32 1
  %198 = getelementptr inbounds %struct.arm_2d_size_t, ptr %197, i32 0, i32 0
  %199 = load i16, ptr %198, align 4, !tbaa !17
  %200 = sext i16 %199 to i32
  %201 = sub nsw i32 %194, %200
  %202 = trunc i32 %201 to i16
  store i16 %202, ptr %29, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %30) #5
  %203 = load ptr, ptr %14, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %203, i32 0, i32 1
  %205 = getelementptr inbounds %struct.arm_2d_region_t, ptr %204, i32 0, i32 1
  %206 = getelementptr inbounds %struct.arm_2d_size_t, ptr %205, i32 0, i32 0
  %207 = load i16, ptr %206, align 4, !tbaa !17
  %208 = sext i16 %207 to i32
  %209 = ashr i32 %208, 1
  %210 = sub nsw i32 0, %209
  %211 = load i16, ptr %12, align 2, !tbaa !9
  %212 = sext i16 %211 to i32
  %213 = sub nsw i32 %210, %212
  %214 = trunc i32 %213 to i16
  store i16 %214, ptr %30, align 2, !tbaa !9
  %215 = load i16, ptr %30, align 2, !tbaa !9
  %216 = sext i16 %215 to i32
  %217 = load ptr, ptr %14, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %217, i32 0, i32 1
  %219 = getelementptr inbounds %struct.arm_2d_region_t, ptr %218, i32 0, i32 1
  %220 = getelementptr inbounds %struct.arm_2d_size_t, ptr %219, i32 0, i32 0
  %221 = load i16, ptr %220, align 4, !tbaa !17
  %222 = sext i16 %221 to i32
  %223 = sub nsw i32 0, %222
  %224 = icmp sle i32 %216, %223
  br i1 %224, label %225, label %237

225:                                              ; preds = %182
  %226 = load ptr, ptr %14, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %226, i32 0, i32 1
  %228 = getelementptr inbounds %struct.arm_2d_region_t, ptr %227, i32 0, i32 1
  %229 = getelementptr inbounds %struct.arm_2d_size_t, ptr %228, i32 0, i32 0
  %230 = load i16, ptr %229, align 4, !tbaa !17
  %231 = sext i16 %230 to i32
  %232 = sub nsw i32 %231, 1
  %233 = load i16, ptr %30, align 2, !tbaa !9
  %234 = sext i16 %233 to i32
  %235 = add nsw i32 %234, %232
  %236 = trunc i32 %235 to i16
  store i16 %236, ptr %30, align 2, !tbaa !9
  br label %237

237:                                              ; preds = %225, %182
  br label %238

238:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %31, ptr align 2 %28, i64 8, i1 false), !tbaa.struct !19
  %239 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 0
  %240 = getelementptr inbounds %struct.arm_2d_location_t, ptr %239, i32 0, i32 1
  %241 = load i16, ptr %240, align 2, !tbaa !17
  %242 = sext i16 %241 to i32
  %243 = load ptr, ptr %14, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.arm_2d_tile_t, 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 1
  %247 = load i16, ptr %246, align 2, !tbaa !17
  %248 = sext i16 %247 to i32
  %249 = sub nsw i32 %242, %248
  %250 = trunc i32 %249 to i16
  %251 = getelementptr inbounds %struct.arm_2d_region_t, ptr %31, i32 0, i32 0
  %252 = getelementptr inbounds %struct.arm_2d_location_t, ptr %251, i32 0, i32 1
  store i16 %250, ptr %252, align 2, !tbaa !17
  %253 = load i16, ptr %29, align 2, !tbaa !9
  %254 = getelementptr inbounds %struct.arm_2d_region_t, ptr %31, i32 0, i32 0
  %255 = getelementptr inbounds %struct.arm_2d_location_t, ptr %254, i32 0, i32 0
  store i16 %253, ptr %255, align 2, !tbaa !17
  %256 = getelementptr inbounds %struct.arm_2d_region_t, ptr %31, i32 0, i32 1
  %257 = load ptr, ptr %14, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %257, i32 0, i32 1
  %259 = getelementptr inbounds %struct.arm_2d_region_t, ptr %258, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %256, ptr align 4 %259, i64 4, i1 false), !tbaa.struct !18
  br label %260

260:                                              ; preds = %275, %238
  %261 = getelementptr inbounds %struct.arm_2d_region_t, ptr %31, i32 0, i32 0
  %262 = getelementptr inbounds %struct.arm_2d_location_t, ptr %261, i32 0, i32 0
  %263 = load i16, ptr %262, align 2, !tbaa !17
  %264 = sext i16 %263 to i32
  %265 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 0
  %266 = getelementptr inbounds %struct.arm_2d_location_t, ptr %265, i32 0, i32 0
  %267 = load i16, ptr %266, align 2, !tbaa !17
  %268 = sext i16 %267 to i32
  %269 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 1
  %270 = getelementptr inbounds %struct.arm_2d_size_t, ptr %269, i32 0, i32 0
  %271 = load i16, ptr %270, align 2, !tbaa !17
  %272 = sext i16 %271 to i32
  %273 = add nsw i32 %268, %272
  %274 = icmp slt i32 %264, %273
  br i1 %274, label %275, label %294

275:                                              ; preds = %260
  %276 = load ptr, ptr %14, align 8, !tbaa !5
  %277 = load i16, ptr %13, align 2, !tbaa !9
  store i16 %277, ptr %32, align 2, !tbaa !17
  %278 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %32, i32 0, i32 0
  %279 = load i16, ptr %278, align 2
  %280 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef %19, ptr noundef %31, ptr noundef %276, i16 %279, i8 noundef zeroext 96)
  %281 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %282 = load ptr, ptr %14, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %282, i32 0, i32 1
  %284 = getelementptr inbounds %struct.arm_2d_region_t, ptr %283, i32 0, i32 1
  %285 = getelementptr inbounds %struct.arm_2d_size_t, ptr %284, i32 0, i32 0
  %286 = load i16, ptr %285, align 4, !tbaa !17
  %287 = sext i16 %286 to i32
  %288 = getelementptr inbounds %struct.arm_2d_region_t, ptr %31, i32 0, i32 0
  %289 = getelementptr inbounds %struct.arm_2d_location_t, ptr %288, i32 0, i32 0
  %290 = load i16, ptr %289, align 2, !tbaa !17
  %291 = sext i16 %290 to i32
  %292 = add nsw i32 %291, %287
  %293 = trunc i32 %292 to i16
  store i16 %293, ptr %289, align 2, !tbaa !17
  br label %260, !llvm.loop !20

294:                                              ; preds = %260
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  br label %295

295:                                              ; preds = %294
  br label %296

296:                                              ; preds = %295
  br label %297

297:                                              ; preds = %296
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %33, ptr align 2 %28, i64 8, i1 false), !tbaa.struct !19
  %298 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 0
  %299 = getelementptr inbounds %struct.arm_2d_location_t, ptr %298, i32 0, i32 1
  %300 = load i16, ptr %299, align 2, !tbaa !17
  %301 = sext i16 %300 to i32
  %302 = load ptr, ptr %14, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %302, i32 0, i32 1
  %304 = getelementptr inbounds %struct.arm_2d_region_t, ptr %303, i32 0, i32 1
  %305 = getelementptr inbounds %struct.arm_2d_size_t, ptr %304, i32 0, i32 1
  %306 = load i16, ptr %305, align 2, !tbaa !17
  %307 = sext i16 %306 to i32
  %308 = sub nsw i32 %301, %307
  %309 = trunc i32 %308 to i16
  %310 = getelementptr inbounds %struct.arm_2d_region_t, ptr %33, i32 0, i32 0
  %311 = getelementptr inbounds %struct.arm_2d_location_t, ptr %310, i32 0, i32 1
  store i16 %309, ptr %311, align 2, !tbaa !17
  %312 = load i16, ptr %30, align 2, !tbaa !9
  %313 = getelementptr inbounds %struct.arm_2d_region_t, ptr %33, i32 0, i32 0
  %314 = getelementptr inbounds %struct.arm_2d_location_t, ptr %313, i32 0, i32 0
  store i16 %312, ptr %314, align 2, !tbaa !17
  %315 = getelementptr inbounds %struct.arm_2d_region_t, ptr %33, i32 0, i32 1
  %316 = load ptr, ptr %14, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %316, i32 0, i32 1
  %318 = getelementptr inbounds %struct.arm_2d_region_t, ptr %317, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %315, ptr align 4 %318, i64 4, i1 false), !tbaa.struct !18
  br label %319

319:                                              ; preds = %334, %297
  %320 = getelementptr inbounds %struct.arm_2d_region_t, ptr %33, i32 0, i32 0
  %321 = getelementptr inbounds %struct.arm_2d_location_t, ptr %320, i32 0, i32 0
  %322 = load i16, ptr %321, align 2, !tbaa !17
  %323 = sext i16 %322 to i32
  %324 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 0
  %325 = getelementptr inbounds %struct.arm_2d_location_t, ptr %324, i32 0, i32 0
  %326 = load i16, ptr %325, align 2, !tbaa !17
  %327 = sext i16 %326 to i32
  %328 = getelementptr inbounds %struct.arm_2d_region_t, ptr %28, i32 0, i32 1
  %329 = getelementptr inbounds %struct.arm_2d_size_t, ptr %328, i32 0, i32 0
  %330 = load i16, ptr %329, align 2, !tbaa !17
  %331 = sext i16 %330 to i32
  %332 = add nsw i32 %327, %331
  %333 = icmp slt i32 %323, %332
  br i1 %333, label %334, label %353

334:                                              ; preds = %319
  %335 = load ptr, ptr %14, align 8, !tbaa !5
  %336 = load i16, ptr %13, align 2, !tbaa !9
  store i16 %336, ptr %34, align 2, !tbaa !17
  %337 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %34, i32 0, i32 0
  %338 = load i16, ptr %337, align 2
  %339 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef %19, ptr noundef %33, ptr noundef %335, i16 %338, i8 noundef zeroext -1)
  %340 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %341 = load ptr, ptr %14, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %341, i32 0, i32 1
  %343 = getelementptr inbounds %struct.arm_2d_region_t, ptr %342, i32 0, i32 1
  %344 = getelementptr inbounds %struct.arm_2d_size_t, ptr %343, i32 0, i32 0
  %345 = load i16, ptr %344, align 4, !tbaa !17
  %346 = sext i16 %345 to i32
  %347 = getelementptr inbounds %struct.arm_2d_region_t, ptr %33, i32 0, i32 0
  %348 = getelementptr inbounds %struct.arm_2d_location_t, ptr %347, i32 0, i32 0
  %349 = load i16, ptr %348, align 2, !tbaa !17
  %350 = sext i16 %349 to i32
  %351 = add nsw i32 %350, %346
  %352 = trunc i32 %351 to i16
  store i16 %352, ptr %348, align 2, !tbaa !17
  br label %319, !llvm.loop !22

353:                                              ; preds = %319
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #5
  br label %354

354:                                              ; preds = %353
  br label %355

355:                                              ; preds = %354
  call void @llvm.lifetime.end.p0(i64 2, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr %29) #5
  br label %356

356:                                              ; preds = %355, %160
  %357 = load i16, ptr %13, align 2, !tbaa !9
  store i16 %357, ptr %35, align 2, !tbaa !17
  %358 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %35, i32 0, i32 0
  %359 = load i16, ptr %358, align 2
  %360 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef %19, ptr noundef %28, i16 %359, i8 noundef zeroext -1)
  %361 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  br label %362

362:                                              ; preds = %356
  %363 = load ptr, ptr %26, align 8, !tbaa !5
  br label %155, !llvm.loop !23

364:                                              ; preds = %159
  br label %365

365:                                              ; preds = %364
  %366 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %367 = zext i1 %366 to i8
  store i8 %367, ptr %36, align 1, !tbaa !24
  %368 = load i8, ptr %36, align 1, !tbaa !24, !range !26, !noundef !27
  %369 = trunc i8 %368 to i1
  br label %141, !llvm.loop !28

370:                                              ; preds = %153
  br label %371

371:                                              ; preds = %370
  br label %60, !llvm.loop !29

372:                                              ; preds = %139, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #5
  br label %373

373:                                              ; preds = %372
  br label %37, !llvm.loop !30

374:                                              ; preds = %58
  ret void
}

declare i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef, ptr noundef, ptr noundef, i16, i8 noundef zeroext) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { 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 = !{!"short", !7, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"arm_2d_margin_t", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!13 = !{!12, !7, i64 1}
!14 = !{!12, !7, i64 2}
!15 = !{!12, !7, i64 3}
!16 = !{i64 0, i64 1, !17, i64 1, i64 1, !17, i64 2, i64 1, !17, i64 3, i64 1, !17}
!17 = !{!7, !7, i64 0}
!18 = !{i64 0, i64 2, !9, i64 2, i64 2, !9}
!19 = !{i64 0, i64 4, !17, i64 4, i64 4, !17}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}
!24 = !{!25, !25, i64 0}
!25 = !{!"_Bool", !7, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = distinct !{!28, !21}
!29 = distinct !{!29, !21}
!30 = distinct !{!30, !21}


; 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_tile_t = type { %union.anon, %union.anon.10, %union.anon.13 }
%union.anon = type { %struct.anon.0 }
%struct.anon.0 = type { i8, %union.arm_2d_color_info_t, %union.anon.3 }
%union.arm_2d_color_info_t = type { %struct.anon.1 }
%struct.anon.1 = type { i8 }
%union.anon.3 = type { i16 }
%union.anon.10 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.11, %union.anon.12 }
%union.anon.11 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.12 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.13 = type { ptr }

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

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

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

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

declare i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16, i8 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local void @draw_liquid_wave(ptr noundef nonnull %0, ptr noundef readonly %1, i16 noundef zeroext %2, i16 noundef signext %3, i32 %4, i16 noundef zeroext %5, ptr noundef %6) local_unnamed_addr #3 {
  %8 = alloca %struct.arm_2d_tile_t, align 8
  %9 = alloca %struct.arm_2d_region_t, align 2
  %10 = alloca %struct.arm_2d_region_t, align 8
  %11 = alloca %struct.arm_2d_region_t, align 2
  %12 = alloca %struct.arm_2d_region_t, align 2
  %.sroa.045.0.extract.trunc = trunc i32 %4 to i16
  %13 = lshr i16 %.sroa.045.0.extract.trunc, 8
  %.sroa.347.0.extract.shift = lshr i32 %4, 16
  %.sroa.347.0.extract.trunc = trunc nuw i32 %.sroa.347.0.extract.shift to i16
  %.sroa.448.0.extract.shift = lshr i32 %4, 24
  %.sroa.448.0.extract.trunc = trunc nuw nsw i32 %.sroa.448.0.extract.shift to i16
  %14 = icmp eq ptr %1, null
  %15 = and i16 %.sroa.045.0.extract.trunc, 255
  %16 = and i16 %.sroa.347.0.extract.trunc, 255
  %17 = getelementptr inbounds i8, ptr %9, i64 2
  %18 = getelementptr inbounds i8, ptr %9, i64 4
  %19 = add nuw nsw i16 %15, %13
  %20 = getelementptr inbounds i8, ptr %9, i64 6
  %21 = add nuw nsw i16 %16, %.sroa.448.0.extract.trunc
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = getelementptr inbounds i8, ptr %8, i64 8
  %24 = getelementptr inbounds i8, ptr %10, i64 4
  %25 = zext i16 %2 to i32
  %26 = getelementptr inbounds i8, ptr %10, i64 2
  %.not69 = icmp eq ptr %6, null
  %27 = getelementptr inbounds i8, ptr %6, i64 8
  %28 = getelementptr inbounds i8, ptr %6, i64 10
  %29 = getelementptr inbounds i8, ptr %11, i64 2
  %30 = getelementptr inbounds i8, ptr %11, i64 4
  %31 = getelementptr inbounds i8, ptr %12, i64 2
  %32 = getelementptr inbounds i8, ptr %12, i64 4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  br i1 %.not69, label %.split101.us, label %.split97

.split101.us:                                     ; preds = %7
  br i1 %14, label %.split97.us.us.us, label %.split97.us.us

.split97.us.us.us:                                ; preds = %.split101.us
  %33 = load i32, ptr %22, align 4
  store i16 %15, ptr %9, align 2, !tbaa !5
  store i16 %16, ptr %17, align 2, !tbaa !5
  %34 = trunc i32 %33 to i16
  %35 = sub i16 %34, %19
  store i16 %35, ptr %18, align 2, !tbaa !5
  %36 = lshr i32 %33, 16
  %37 = trunc nuw i32 %36 to i16
  %38 = sub i16 %37, %21
  store i16 %38, ptr %20, align 2, !tbaa !5
  %39 = call ptr @arm_2d_tile_generate_child(ptr noundef nonnull %0, ptr noundef nonnull %9, ptr noundef nonnull %8, i1 noundef zeroext false) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  %40 = load i32, ptr %23, align 8
  %.sroa.4.0.insert.ext.us.us.us.us.us = zext i32 %40 to i64
  %.sroa.4.0.insert.shift.us.us.us.us.us = shl nuw i64 %.sroa.4.0.insert.ext.us.us.us.us.us, 32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  store i64 %.sroa.4.0.insert.shift.us.us.us.us.us, ptr %10, align 8
  %41 = lshr i32 %40, 16
  %42 = trunc nuw i32 %41 to i16
  %43 = ashr i32 %40, 16
  %44 = mul nsw i32 %43, %25
  %.neg.us.us.us.us.us.us = sdiv i32 %44, -1000
  %45 = trunc i32 %.neg.us.us.us.us.us.us to i16
  %46 = add i16 %42, %45
  store i16 %46, ptr %26, align 2, !tbaa !5
  %47 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %10, i16 %5, i8 noundef zeroext -1) #4
  %48 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  %49 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #4
  br label %.split103.us

.split97.us.us:                                   ; preds = %.split101.us
  %50 = load i64, ptr %1, align 2
  %51 = trunc i64 %50 to i16
  %52 = add i16 %15, %51
  store i16 %52, ptr %9, align 2, !tbaa !5
  %53 = lshr i64 %50, 16
  %54 = trunc i64 %53 to i16
  %55 = add i16 %16, %54
  store i16 %55, ptr %17, align 2, !tbaa !5
  %56 = lshr i64 %50, 32
  %57 = trunc i64 %56 to i16
  %58 = sub i16 %57, %19
  store i16 %58, ptr %18, align 2, !tbaa !5
  %59 = lshr i64 %50, 48
  %60 = trunc nuw i64 %59 to i16
  %61 = sub i16 %60, %21
  store i16 %61, ptr %20, align 2, !tbaa !5
  %62 = call ptr @arm_2d_tile_generate_child(ptr noundef nonnull %0, ptr noundef nonnull %9, ptr noundef nonnull %8, i1 noundef zeroext false) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  %63 = load i32, ptr %23, align 8
  %.sroa.4.0.insert.ext.us.us.us = zext i32 %63 to i64
  %.sroa.4.0.insert.shift.us.us.us = shl nuw i64 %.sroa.4.0.insert.ext.us.us.us, 32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  store i64 %.sroa.4.0.insert.shift.us.us.us, ptr %10, align 8
  %64 = lshr i32 %63, 16
  %65 = trunc nuw i32 %64 to i16
  %66 = ashr i32 %63, 16
  %67 = mul nsw i32 %66, %25
  %.neg.us.us.us.us = sdiv i32 %67, -1000
  %68 = trunc i32 %.neg.us.us.us.us to i16
  %69 = add i16 %65, %68
  store i16 %69, ptr %26, align 2, !tbaa !5
  %70 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %10, i16 %5, i8 noundef zeroext -1) #4
  %71 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  %72 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #4
  br label %.split103.us

.split103.us:                                     ; preds = %.split97.us.us, %.split97.us.us.us, %.split92
  ret void

.split97:                                         ; preds = %7
  br i1 %14, label %73, label %78

73:                                               ; preds = %.split97
  %74 = load i32, ptr %22, align 4
  %75 = trunc i32 %74 to i16
  %76 = lshr i32 %74, 16
  %77 = trunc nuw i32 %76 to i16
  br label %.split94

78:                                               ; preds = %.split97
  %79 = load i64, ptr %1, align 2
  %80 = trunc i64 %79 to i16
  %81 = lshr i64 %79, 16
  %82 = trunc i64 %81 to i16
  %83 = lshr i64 %79, 32
  %84 = trunc i64 %83 to i16
  %85 = lshr i64 %79, 48
  %86 = trunc nuw i64 %85 to i16
  br label %.split94

.split94:                                         ; preds = %73, %78
  %87 = phi i16 [ %77, %73 ], [ %86, %78 ]
  %88 = phi i16 [ %75, %73 ], [ %84, %78 ]
  %89 = phi i16 [ 0, %73 ], [ %82, %78 ]
  %90 = phi i16 [ 0, %73 ], [ %80, %78 ]
  %91 = add i16 %90, %15
  store i16 %91, ptr %9, align 2, !tbaa !5
  %92 = add i16 %89, %16
  store i16 %92, ptr %17, align 2, !tbaa !5
  %93 = sub i16 %88, %19
  store i16 %93, ptr %18, align 2, !tbaa !5
  %94 = sub i16 %87, %21
  store i16 %94, ptr %20, align 2, !tbaa !5
  %95 = call ptr @arm_2d_tile_generate_child(ptr noundef nonnull %0, ptr noundef nonnull %9, ptr noundef nonnull %8, i1 noundef zeroext false) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  %96 = load i32, ptr %23, align 8
  %.sroa.4.0.insert.ext = zext i32 %96 to i64
  %.sroa.4.0.insert.shift = shl nuw i64 %.sroa.4.0.insert.ext, 32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  store i64 %.sroa.4.0.insert.shift, ptr %10, align 8
  %97 = lshr i32 %96, 16
  %98 = trunc nuw i32 %97 to i16
  %99 = ashr i32 %96, 16
  %100 = mul nsw i32 %99, %25
  %.neg = sdiv i32 %100, -1000
  %101 = trunc i32 %.neg to i16
  %102 = add i16 %98, %101
  store i16 %102, ptr %26, align 2, !tbaa !5
  %103 = load i16, ptr %27, align 4, !tbaa !5
  %104 = sext i16 %103 to i32
  %105 = sext i16 %3 to i32
  %106 = srem i32 %105, %104
  %107 = trunc nsw i32 %106 to i16
  %108 = sub i16 %107, %103
  %109 = lshr i32 %104, 1
  %110 = add i32 %109, %106
  %111 = trunc i32 %110 to i16
  %112 = sub i16 0, %111
  %113 = sext i16 %112 to i32
  %114 = sub nsw i32 0, %104
  %.not70 = icmp sgt i32 %113, %114
  %115 = xor i16 %111, -1
  %116 = add i16 %103, %115
  %.049 = select i1 %.not70, i16 %112, i16 %116
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  %117 = load i64, ptr %10, align 8
  %118 = load i16, ptr %28, align 2, !tbaa !5
  %119 = sub i16 %102, %118
  store i16 %119, ptr %29, align 2, !tbaa !5
  store i16 %108, ptr %11, align 2, !tbaa !5
  %120 = load i32, ptr %27, align 4
  store i32 %120, ptr %30, align 2
  %121 = sext i16 %108 to i32
  %122 = trunc i64 %117 to i32
  %sext = shl i32 %122, 16
  %123 = ashr exact i32 %sext, 16
  %sh.diff = lshr i64 %117, 16
  %tr.sh.diff = trunc i64 %sh.diff to i32
  %124 = ashr i32 %tr.sh.diff, 16
  %125 = add nsw i32 %124, %123
  %126 = icmp sgt i32 %125, %121
  %127 = lshr i32 %120, 16
  %128 = trunc nuw i32 %127 to i16
  br i1 %126, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.split94, %.lr.ph
  %129 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %11, ptr noundef nonnull %6, i16 %5, i8 noundef zeroext 96) #4
  %130 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  %131 = load i16, ptr %27, align 4, !tbaa !5
  %132 = load i16, ptr %11, align 2, !tbaa !5
  %133 = add i16 %132, %131
  store i16 %133, ptr %11, align 2, !tbaa !5
  %134 = sext i16 %133 to i32
  %135 = load i16, ptr %10, align 8, !tbaa !5
  %136 = sext i16 %135 to i32
  %137 = load i16, ptr %24, align 4, !tbaa !5
  %138 = sext i16 %137 to i32
  %139 = add nsw i32 %138, %136
  %140 = icmp sgt i32 %139, %134
  br i1 %140, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !8

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr %10, align 8
  %.pre104 = load i16, ptr %28, align 2, !tbaa !5
  %.pre105 = load i32, ptr %27, align 4
  %141 = trunc i64 %.pre to i32
  %sext112 = shl i32 %141, 16
  %.pre106 = ashr exact i32 %sext112, 16
  %sh.diff114 = lshr i64 %.pre, 16
  %tr.sh.diff115 = trunc i64 %sh.diff114 to i32
  %.pre107 = ashr i32 %tr.sh.diff115, 16
  %.pre109 = add nsw i32 %.pre107, %.pre106
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.split94
  %.pre-phi110 = phi i32 [ %.pre109, %._crit_edge.loopexit ], [ %125, %.split94 ]
  %142 = phi i32 [ %.pre105, %._crit_edge.loopexit ], [ %120, %.split94 ]
  %143 = phi i16 [ %.pre104, %._crit_edge.loopexit ], [ %128, %.split94 ]
  %144 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %117, %.split94 ]
  %.in = lshr i64 %144, 16
  %145 = trunc i64 %.in to i16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #4
  %146 = sub i16 %145, %143
  store i16 %146, ptr %31, align 2, !tbaa !5
  store i16 %.049, ptr %12, align 2, !tbaa !5
  store i32 %142, ptr %32, align 2
  %147 = sext i16 %.049 to i32
  %148 = icmp sgt i32 %.pre-phi110, %147
  br i1 %148, label %.lr.ph88, label %.split92

.lr.ph88:                                         ; preds = %._crit_edge, %.lr.ph88
  %149 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %12, ptr noundef nonnull %6, i16 %5, i8 noundef zeroext -1) #4
  %150 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  %151 = load i16, ptr %27, align 4, !tbaa !5
  %152 = load i16, ptr %12, align 2, !tbaa !5
  %153 = add i16 %152, %151
  store i16 %153, ptr %12, align 2, !tbaa !5
  %154 = sext i16 %153 to i32
  %155 = load i16, ptr %10, align 8, !tbaa !5
  %156 = sext i16 %155 to i32
  %157 = load i16, ptr %24, align 4, !tbaa !5
  %158 = sext i16 %157 to i32
  %159 = add nsw i32 %158, %156
  %160 = icmp sgt i32 %159, %154
  br i1 %160, label %.lr.ph88, label %.split92, !llvm.loop !10

.split92:                                         ; preds = %.lr.ph88, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  %161 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %10, i16 %5, i8 noundef zeroext -1) #4
  %162 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  %163 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #4
  br label %.split103.us
}

declare i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef, ptr noundef, ptr noundef, i16, i8 noundef zeroext) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass