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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.arm_2d_op_trans_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon, %struct.anon.0, %union.anon, %struct.anon.2, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { [40 x i8], i64 }
%struct.anon = type { ptr, ptr }
%struct.anon.0 = type { ptr }
%union.anon = type { %struct.anon.1 }
%struct.anon.1 = type { i32 }
%struct.anon.2 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.3, %union.anon.14, %union.anon.17 }
%union.anon.3 = type { %struct.anon.4 }
%struct.anon.4 = type { i8, %union.arm_2d_color_info_t, %union.anon.7 }
%union.arm_2d_color_info_t = type { %struct.anon.5 }
%struct.anon.5 = type { i8 }
%union.anon.7 = type { i16 }
%union.anon.14 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.15, %union.anon.16 }
%union.anon.15 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.16 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.17 = type { ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.18, [40 x i8] }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.18 = type { i32 }

@s_tMaskRotateCB = external hidden global [2 x %struct.arm_2d_op_trans_opa_t], align 16
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__.spinning_wheel_show = external hidden unnamed_addr constant [55 x i8], align 1
@spinning_wheel_show.s_fAngle = external hidden global float, align 4
@c_tileWhiteDotMask = external constant %struct.arm_2d_tile_t, align 8
@c_tileSpinWheelMask = external constant %struct.arm_2d_tile_t, align 8

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

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

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

29:                                               ; preds = %2
  br label %31

30:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 94, ptr noundef @__PRETTY_FUNCTION__.spinning_wheel_show) #7
  unreachable

31:                                               ; preds = %29
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %34 = trunc i8 %33 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.memset.p0.i64(ptr align 2 %5, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %214, %31
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.arm_2d_region_t, ptr %36, i32 1
  store ptr %37, ptr %6, align 8, !tbaa !5
  %38 = icmp eq ptr %36, null
  br i1 %38, label %39, label %44

39:                                               ; preds = %35
  %40 = getelementptr inbounds %struct.arm_2d_region_t, ptr %5, i32 0, i32 1
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %struct.arm_2d_region_t, ptr %42, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %40, ptr align 4 %43, i64 4, i1 false), !tbaa.struct !13
  br label %45

44:                                               ; preds = %35
  br label %45

45:                                               ; preds = %44, %39
  %46 = phi i32 [ 1, %39 ], [ 0, %44 ]
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %219

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %50, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %211, %49
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %52, i32 1
  store ptr %53, ptr %9, align 8, !tbaa !5
  %54 = icmp eq ptr %52, null
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %213

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %10, ptr align 2 %5, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store ptr null, ptr %11, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %112, %56
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.arm_2d_region_t, ptr %58, i32 1
  store ptr %59, ptr %11, align 8, !tbaa !5
  %60 = icmp eq ptr %58, null
  br i1 %60, label %62, label %61

61:                                               ; preds = %57
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %113

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store ptr null, ptr %13, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %107, %62
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.arm_2d_region_t, ptr %64, i32 1
  store ptr %65, ptr %13, align 8, !tbaa !5
  %66 = icmp eq ptr %64, null
  br i1 %66, label %67, label %99

67:                                               ; preds = %63
  %68 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 1
  %69 = getelementptr inbounds %struct.arm_2d_size_t, ptr %68, i32 0, i32 0
  store i16 100, ptr %69, align 2, !tbaa !17
  %70 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 1
  %71 = getelementptr inbounds %struct.arm_2d_size_t, ptr %70, i32 0, i32 1
  store i16 100, ptr %71, align 2, !tbaa !17
  %72 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 0
  %73 = getelementptr inbounds %struct.arm_2d_region_t, ptr %10, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %72, ptr align 2 %73, i64 4, i1 false), !tbaa.struct !13
  %74 = getelementptr inbounds %struct.arm_2d_region_t, ptr %10, i32 0, i32 1
  %75 = getelementptr inbounds %struct.arm_2d_size_t, ptr %74, i32 0, i32 0
  %76 = load i16, ptr %75, align 2, !tbaa !17
  %77 = sext i16 %76 to i32
  %78 = sub nsw i32 %77, 100
  %79 = ashr i32 %78, 1
  %80 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 0
  %81 = getelementptr inbounds %struct.arm_2d_location_t, ptr %80, i32 0, i32 0
  %82 = load i16, ptr %81, align 2, !tbaa !17
  %83 = sext i16 %82 to i32
  %84 = add nsw i32 %83, %79
  %85 = trunc i32 %84 to i16
  store i16 %85, ptr %81, align 2, !tbaa !17
  %86 = getelementptr inbounds %struct.arm_2d_region_t, ptr %10, i32 0, i32 1
  %87 = getelementptr inbounds %struct.arm_2d_size_t, ptr %86, i32 0, i32 1
  %88 = load i16, ptr %87, align 2, !tbaa !17
  %89 = sext i16 %88 to i32
  %90 = sub nsw i32 %89, 100
  %91 = ashr i32 %90, 1
  %92 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 0
  %93 = getelementptr inbounds %struct.arm_2d_location_t, ptr %92, i32 0, i32 1
  %94 = load i16, ptr %93, align 2, !tbaa !17
  %95 = sext i16 %94 to i32
  %96 = add nsw i32 %95, %91
  %97 = trunc i32 %96 to i16
  store i16 %97, ptr %93, align 2, !tbaa !17
  store i16 %97, ptr %14, align 2, !tbaa !14
  %98 = load i16, ptr %14, align 2, !tbaa !14
  br label %100

99:                                               ; preds = %63
  br label %100

100:                                              ; preds = %99, %67
  %101 = phi i32 [ 1, %67 ], [ 0, %99 ]
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %112

104:                                              ; preds = %100
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  call void @__draw_round_corner_box(ptr noundef %105, ptr noundef %12, i16 noundef zeroext 0, i8 noundef zeroext 64, ptr noundef @c_tileWhiteDotMask)
  %106 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  br label %107

107:                                              ; preds = %104
  %108 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %109 = zext i1 %108 to i8
  store i8 %109, ptr %15, align 1, !tbaa !9
  %110 = load i8, ptr %15, align 1, !tbaa !9, !range !11, !noundef !12
  %111 = trunc i8 %110 to i1
  br label %63, !llvm.loop !18

112:                                              ; preds = %103
  br label %57, !llvm.loop !20

113:                                              ; preds = %61
  br label %114

114:                                              ; preds = %113
  %115 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %116 = trunc i8 %115 to i1
  br i1 %116, label %117, label %122

117:                                              ; preds = %114
  %118 = load float, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !21
  %119 = fadd float %118, 0x3FBACEEA00000000
  store float %119, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !21
  %120 = load float, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !21
  %121 = call float @fmodf(float noundef %120, float noundef 0x401921FB40000000) #8
  store float %121, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !21
  br label %122

122:                                              ; preds = %117, %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %123 = getelementptr inbounds %struct.arm_2d_location_t, ptr %16, i32 0, i32 0
  %124 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileSpinWheelMask, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !17
  %125 = sext i16 %124 to i32
  %126 = ashr i32 %125, 1
  %127 = trunc i32 %126 to i16
  store i16 %127, ptr %123, align 2, !tbaa !23
  %128 = getelementptr inbounds %struct.arm_2d_location_t, ptr %16, i32 0, i32 1
  %129 = load i16, ptr getelementptr inbounds (%struct.arm_2d_size_t, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileSpinWheelMask, i32 0, i32 1), i32 0, i32 1), i32 0, i32 1), align 2, !tbaa !17
  %130 = sext i16 %129 to i32
  %131 = ashr i32 %130, 1
  %132 = trunc i32 %131 to i16
  store i16 %132, ptr %128, align 2, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %17, ptr align 2 %5, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store ptr null, ptr %18, align 8, !tbaa !5
  br label %133

133:                                              ; preds = %207, %122
  %134 = load ptr, ptr %18, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.arm_2d_region_t, ptr %134, i32 1
  store ptr %135, ptr %18, align 8, !tbaa !5
  %136 = icmp eq ptr %134, null
  br i1 %136, label %138, label %137

137:                                              ; preds = %133
  store i32 15, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %208

138:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  store ptr null, ptr %20, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %202, %138
  %140 = load ptr, ptr %20, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.arm_2d_region_t, ptr %140, i32 1
  store ptr %141, ptr %20, align 8, !tbaa !5
  %142 = icmp eq ptr %140, null
  br i1 %142, label %143, label %185

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %21, ptr align 4 getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileSpinWheelMask, i32 0, i32 1), i32 0, i32 1), i64 4, i1 false), !tbaa.struct !13
  %144 = getelementptr inbounds %struct.arm_2d_size_t, ptr %21, i32 0, i32 0
  %145 = load i16, ptr %144, align 2, !tbaa !26
  %146 = getelementptr inbounds %struct.arm_2d_region_t, ptr %19, i32 0, i32 1
  %147 = getelementptr inbounds %struct.arm_2d_size_t, ptr %146, i32 0, i32 0
  store i16 %145, ptr %147, align 2, !tbaa !17
  %148 = getelementptr inbounds %struct.arm_2d_size_t, ptr %21, i32 0, i32 1
  %149 = load i16, ptr %148, align 2, !tbaa !28
  %150 = getelementptr inbounds %struct.arm_2d_region_t, ptr %19, i32 0, i32 1
  %151 = getelementptr inbounds %struct.arm_2d_size_t, ptr %150, i32 0, i32 1
  store i16 %149, ptr %151, align 2, !tbaa !17
  %152 = getelementptr inbounds %struct.arm_2d_region_t, ptr %19, i32 0, i32 0
  %153 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %152, ptr align 2 %153, i64 4, i1 false), !tbaa.struct !13
  %154 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 1
  %155 = getelementptr inbounds %struct.arm_2d_size_t, ptr %154, i32 0, i32 0
  %156 = load i16, ptr %155, align 2, !tbaa !17
  %157 = sext i16 %156 to i32
  %158 = getelementptr inbounds %struct.arm_2d_size_t, ptr %21, i32 0, i32 0
  %159 = load i16, ptr %158, align 2, !tbaa !26
  %160 = sext i16 %159 to i32
  %161 = sub nsw i32 %157, %160
  %162 = ashr i32 %161, 1
  %163 = getelementptr inbounds %struct.arm_2d_region_t, ptr %19, i32 0, i32 0
  %164 = getelementptr inbounds %struct.arm_2d_location_t, ptr %163, i32 0, i32 0
  %165 = load i16, ptr %164, align 2, !tbaa !17
  %166 = sext i16 %165 to i32
  %167 = add nsw i32 %166, %162
  %168 = trunc i32 %167 to i16
  store i16 %168, ptr %164, align 2, !tbaa !17
  %169 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 1
  %170 = getelementptr inbounds %struct.arm_2d_size_t, ptr %169, i32 0, i32 1
  %171 = load i16, ptr %170, align 2, !tbaa !17
  %172 = sext i16 %171 to i32
  %173 = getelementptr inbounds %struct.arm_2d_size_t, ptr %21, i32 0, i32 1
  %174 = load i16, ptr %173, align 2, !tbaa !28
  %175 = sext i16 %174 to i32
  %176 = sub nsw i32 %172, %175
  %177 = ashr i32 %176, 1
  %178 = getelementptr inbounds %struct.arm_2d_region_t, ptr %19, i32 0, i32 0
  %179 = getelementptr inbounds %struct.arm_2d_location_t, ptr %178, i32 0, i32 1
  %180 = load i16, ptr %179, align 2, !tbaa !17
  %181 = sext i16 %180 to i32
  %182 = add nsw i32 %181, %177
  %183 = trunc i32 %182 to i16
  store i16 %183, ptr %179, align 2, !tbaa !17
  store i16 %183, ptr %22, align 2, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  %184 = load i16, ptr %22, align 2, !tbaa !14
  br label %186

185:                                              ; preds = %139
  br label %186

186:                                              ; preds = %185, %143
  %187 = phi i32 [ 1, %143 ], [ 0, %185 ]
  %188 = icmp ne i32 %187, 0
  br i1 %188, label %190, label %189

189:                                              ; preds = %186
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %207

190:                                              ; preds = %186
  %191 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %192 = trunc i8 %191 to i1
  br i1 %192, label %193, label %197

193:                                              ; preds = %190
  %194 = load float, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !21
  %195 = load i32, ptr %16, align 2
  %196 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_opacity_and_transform_prepare(ptr noundef @s_tMaskRotateCB, ptr noundef @c_tileSpinWheelMask, i32 %195, float noundef %194, float noundef 1.000000e+00, i64 noundef 65535, i8 noundef zeroext -2)
  br label %197

197:                                              ; preds = %193, %190
  %198 = load ptr, ptr %3, align 8, !tbaa !5
  %199 = call i32 @arm_2dp_tile_transform(ptr noundef @s_tMaskRotateCB, ptr noundef %198, ptr noundef %19, ptr noundef null)
  store i32 %199, ptr %23, align 4, !tbaa !29
  %200 = load i32, ptr %23, align 4, !tbaa !29
  %201 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef @s_tMaskRotateCB)
  br label %202

202:                                              ; preds = %197
  %203 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %204 = zext i1 %203 to i8
  store i8 %204, ptr %24, align 1, !tbaa !9
  %205 = load i8, ptr %24, align 1, !tbaa !9, !range !11, !noundef !12
  %206 = trunc i8 %205 to i1
  br label %139, !llvm.loop !31

207:                                              ; preds = %189
  br label %133, !llvm.loop !32

208:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  %212 = load ptr, ptr %8, align 8, !tbaa !5
  br label %51, !llvm.loop !33

213:                                              ; preds = %55
  br label %214

214:                                              ; preds = %213
  %215 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %216 = zext i1 %215 to i8
  store i8 %216, ptr %25, align 1, !tbaa !9
  %217 = load i8, ptr %25, align 1, !tbaa !9, !range !11, !noundef !12
  %218 = trunc i8 %217 to i1
  br label %35, !llvm.loop !34

219:                                              ; preds = %48
  ret void
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @__draw_round_corner_box(ptr noundef, ptr noundef, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) #5

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) #5

; Function Attrs: nounwind
declare float @fmodf(float noundef, float noundef) #6

declare i32 @arm_2dp_rgb565_fill_colour_with_mask_opacity_and_transform_prepare(ptr noundef, ptr noundef, i32, float noundef, float noundef, i64 noundef, i8 noundef zeroext) #5

declare i32 @arm_2dp_tile_transform(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #7 = { noreturn nounwind }
attributes #8 = { 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 = !{i8 0, i8 2}
!12 = !{}
!13 = !{i64 0, i64 2, !14, i64 2, i64 2, !14}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{i64 0, i64 4, !17, i64 4, i64 4, !17}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = !{!24, !15, i64 0}
!24 = !{!"arm_2d_location_t", !15, i64 0, !15, i64 2}
!25 = !{!24, !15, i64 2}
!26 = !{!27, !15, i64 0}
!27 = !{!"arm_2d_size_t", !15, i64 0, !15, i64 2}
!28 = !{!27, !15, i64 2}
!29 = !{!30, !30, i64 0}
!30 = !{!"int", !7, i64 0}
!31 = distinct !{!31, !19}
!32 = distinct !{!32, !19}
!33 = distinct !{!33, !19}
!34 = distinct !{!34, !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_op_trans_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon, %struct.anon.0, %union.anon, %struct.anon.2, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { [40 x i8], i64 }
%struct.anon = type { ptr, ptr }
%struct.anon.0 = type { ptr }
%union.anon = type { %struct.anon.1 }
%struct.anon.1 = type { i32 }
%struct.anon.2 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.3, %union.anon.14, %union.anon.17 }
%union.anon.3 = type { %struct.anon.4 }
%struct.anon.4 = type { i8, %union.arm_2d_color_info_t, %union.anon.7 }
%union.arm_2d_color_info_t = type { %struct.anon.5 }
%struct.anon.5 = type { i8 }
%union.anon.7 = type { i16 }
%union.anon.14 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.15, %union.anon.16 }
%union.anon.15 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.16 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.17 = type { ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.18, [40 x i8] }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.18 = type { i32 }

@s_tMaskRotateCB = external hidden global [2 x %struct.arm_2d_op_trans_opa_t], align 16
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__.spinning_wheel_show = external hidden unnamed_addr constant [55 x i8], align 1
@spinning_wheel_show.s_fAngle = external hidden local_unnamed_addr global float, align 4
@c_tileWhiteDotMask = external constant %struct.arm_2d_tile_t, align 8
@c_tileSpinWheelMask = external constant %struct.arm_2d_tile_t, align 8

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

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

; Function Attrs: nounwind uwtable
define dso_local void @spinning_wheel_show(ptr noundef %0, i1 noundef zeroext %1) local_unnamed_addr #1 {
  %3 = alloca %struct.arm_2d_region_t, align 2
  %4 = alloca %struct.arm_2d_region_t, align 2
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %41, label %.preheader51

.preheader51:                                     ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.8.4..sroa_idx = getelementptr inbounds i8, ptr %0, i64 10
  %6 = getelementptr inbounds i8, ptr %3, i64 4
  %7 = getelementptr inbounds i8, ptr %3, i64 6
  %8 = getelementptr inbounds i8, ptr %3, i64 2
  %9 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileSpinWheelMask, i64 8), align 8
  %10 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileSpinWheelMask, i64 10), align 2
  %11 = getelementptr inbounds i8, ptr %4, i64 4
  %12 = getelementptr inbounds i8, ptr %4, i64 6
  %13 = sext i16 %9 to i32
  %14 = sext i16 %10 to i32
  %15 = getelementptr inbounds i8, ptr %4, i64 2
  br i1 %1, label %.split54.us.us, label %.split54

.split54.us.us:                                   ; preds = %.preheader51
  %16 = ashr i16 %10, 1
  %.sroa.410.0.insert.ext = zext i16 %16 to i32
  %.sroa.410.0.insert.shift = shl nuw i32 %.sroa.410.0.insert.ext, 16
  %17 = ashr i16 %9, 1
  %.sroa.09.0.insert.ext = zext i16 %17 to i32
  %.sroa.09.0.insert.insert = or disjoint i32 %.sroa.410.0.insert.shift, %.sroa.09.0.insert.ext
  %.sroa.522.4.copyload.us = load i16, ptr %5, align 4, !tbaa !5
  %.sroa.8.4.copyload.us = load i16, ptr %.sroa.8.4..sroa_idx, align 2, !tbaa !5
  %18 = sext i16 %.sroa.522.4.copyload.us to i32
  %19 = add nsw i32 %18, 130972
  %20 = lshr i32 %19, 1
  %21 = trunc i32 %20 to i16
  %22 = sext i16 %.sroa.8.4.copyload.us to i32
  %23 = add nsw i32 %22, 130972
  %24 = lshr i32 %23, 1
  %25 = trunc i32 %24 to i16
  %26 = sub nsw i32 %18, %13
  %27 = lshr i32 %26, 1
  %28 = trunc i32 %27 to i16
  %29 = sub nsw i32 %22, %14
  %30 = lshr i32 %29, 1
  %31 = trunc i32 %30 to i16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store i16 100, ptr %6, align 2, !tbaa !9
  store i16 100, ptr %7, align 2, !tbaa !9
  store i16 %21, ptr %3, align 2, !tbaa !9
  store i16 %25, ptr %8, align 2, !tbaa !9
  call void @__draw_round_corner_box(ptr noundef nonnull %0, ptr noundef nonnull %3, i16 noundef zeroext 0, i8 noundef zeroext 64, ptr noundef nonnull @c_tileWhiteDotMask) #5
  %32 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  %33 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %34 = load float, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !10
  %35 = fadd float %34, 0x3FBACEEA00000000
  %36 = call float @fmodf(float noundef %35, float noundef 0x401921FB40000000) #5
  store float %36, ptr @spinning_wheel_show.s_fAngle, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i16 %9, ptr %11, align 2, !tbaa !9
  store i16 %10, ptr %12, align 2, !tbaa !9
  store i16 %28, ptr %4, align 2, !tbaa !9
  store i16 %31, ptr %15, align 2, !tbaa !9
  %37 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_opacity_and_transform_prepare(ptr noundef nonnull @s_tMaskRotateCB, ptr noundef nonnull @c_tileSpinWheelMask, i32 %.sroa.09.0.insert.insert, float noundef %36, float noundef 1.000000e+00, i64 noundef 65535, i8 noundef zeroext -2) #5
  %38 = call i32 @arm_2dp_tile_transform(ptr noundef nonnull @s_tMaskRotateCB, ptr noundef nonnull %0, ptr noundef nonnull %4, ptr noundef null) #5
  %39 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef nonnull @s_tMaskRotateCB) #5
  %40 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %61

41:                                               ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 94, ptr noundef nonnull @__PRETTY_FUNCTION__.spinning_wheel_show) #6
  unreachable

.split54:                                         ; preds = %.preheader51
  %.sroa.522.4.copyload = load i16, ptr %5, align 4, !tbaa !5
  %.sroa.8.4.copyload = load i16, ptr %.sroa.8.4..sroa_idx, align 2, !tbaa !5
  %42 = sext i16 %.sroa.522.4.copyload to i32
  %43 = add nsw i32 %42, 130972
  %44 = lshr i32 %43, 1
  %45 = trunc i32 %44 to i16
  %46 = sext i16 %.sroa.8.4.copyload to i32
  %47 = add nsw i32 %46, 130972
  %48 = lshr i32 %47, 1
  %49 = trunc i32 %48 to i16
  %50 = sub nsw i32 %42, %13
  %51 = lshr i32 %50, 1
  %52 = trunc i32 %51 to i16
  %53 = sub nsw i32 %46, %14
  %54 = lshr i32 %53, 1
  %55 = trunc i32 %54 to i16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store i16 100, ptr %6, align 2, !tbaa !9
  store i16 100, ptr %7, align 2, !tbaa !9
  store i16 %45, ptr %3, align 2, !tbaa !9
  store i16 %49, ptr %8, align 2, !tbaa !9
  call void @__draw_round_corner_box(ptr noundef nonnull %0, ptr noundef nonnull %3, i16 noundef zeroext 0, i8 noundef zeroext 64, ptr noundef nonnull @c_tileWhiteDotMask) #5
  %56 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  %57 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i16 %9, ptr %11, align 2, !tbaa !9
  store i16 %10, ptr %12, align 2, !tbaa !9
  store i16 %52, ptr %4, align 2, !tbaa !9
  store i16 %55, ptr %15, align 2, !tbaa !9
  %58 = call i32 @arm_2dp_tile_transform(ptr noundef nonnull @s_tMaskRotateCB, ptr noundef nonnull %0, ptr noundef nonnull %4, ptr noundef null) #5
  %59 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef nonnull @s_tMaskRotateCB) #5
  %60 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %61

61:                                               ; preds = %.split54.us.us, %.split54
  %62 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  ret void
}

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

declare void @__draw_round_corner_box(ptr noundef, ptr noundef, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @fmodf(float noundef, float noundef) local_unnamed_addr #4

declare i32 @arm_2dp_rgb565_fill_colour_with_mask_opacity_and_transform_prepare(ptr noundef, ptr noundef, i32, float noundef, float noundef, i64 noundef, i8 noundef zeroext) local_unnamed_addr #3

declare i32 @arm_2dp_tile_transform(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(write) "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 }
attributes #6 = { 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass