; LLVM IR from ARM-software/Arm-2D :: examples/common/controls/progress_bar_drill.ll_ (progress_bar_drill_show)

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

@s_lLastTime = external hidden global i64, section ".bss.noinit", align 8
@s_wUnit = external hidden global i32, section ".bss.noinit", align 4
@__progress_bar_drill_show.s_chOffset = external hidden global i8, align 1
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@__PRETTY_FUNCTION__.__progress_bar_drill_show = external hidden unnamed_addr constant [110 x i8], align 1
@c_tileBlueSlashRGB565 = external constant %struct.arm_2d_tile_t, align 8

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

21:                                               ; preds = %5
  br label %23

22:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 102, ptr noundef @__PRETTY_FUNCTION__.__progress_bar_drill_show) #6
  unreachable

23:                                               ; preds = %21
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = ptrtoint ptr %24 to i64
  %26 = icmp eq i64 -1, %25
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  %28 = call ptr @arm_2d_get_default_frame_buffer()
  store ptr %28, ptr %6, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %27, %23
  %30 = load i64, ptr %8, align 8, !tbaa !9
  %31 = icmp sgt i64 %30, 1000
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %32, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %34 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 0
  call void @llvm.memset.p0.i64(ptr align 2 %34, i8 0, i64 4, i1 false)
  %35 = getelementptr inbounds %struct.arm_2d_region_t, ptr %12, i32 0, i32 1
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds %struct.arm_2d_region_t, ptr %37, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %35, ptr align 4 %38, i64 4, i1 false), !tbaa.struct !15
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = icmp eq ptr null, %39
  br i1 %40, label %41, label %50

41:                                               ; preds = %33
  store ptr %12, ptr %7, align 8, !tbaa !5
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.arm_2d_region_t, ptr %42, i32 0, i32 1
  %44 = getelementptr inbounds %struct.arm_2d_size_t, ptr %43, i32 0, i32 0
  %45 = load i16, ptr %44, align 2, !tbaa !16
  %46 = sext i16 %45 to i32
  %47 = mul nsw i32 %46, 3
  %48 = ashr i32 %47, 3
  %49 = sext i32 %48 to i64
  store i64 %49, ptr %11, align 8, !tbaa !9
  br label %56

50:                                               ; preds = %33
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.arm_2d_region_t, ptr %51, i32 0, i32 1
  %53 = getelementptr inbounds %struct.arm_2d_size_t, ptr %52, i32 0, i32 0
  %54 = load i16, ptr %53, align 2, !tbaa !16
  %55 = sext i16 %54 to i64
  store i64 %55, ptr %11, align 8, !tbaa !9
  br label %56

56:                                               ; preds = %50, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %57 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 0
  %58 = getelementptr inbounds %struct.arm_2d_location_t, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.arm_2d_region_t, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.arm_2d_location_t, ptr %60, i32 0, i32 0
  %62 = load i16, ptr %61, align 2, !tbaa !16
  %63 = sext i16 %62 to i32
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.arm_2d_region_t, ptr %64, i32 0, i32 1
  %66 = getelementptr inbounds %struct.arm_2d_size_t, ptr %65, i32 0, i32 0
  %67 = load i16, ptr %66, align 2, !tbaa !16
  %68 = sext i16 %67 to i32
  %69 = load i64, ptr %11, align 8, !tbaa !9
  %70 = trunc i64 %69 to i16
  %71 = sext i16 %70 to i32
  %72 = sub nsw i32 %68, %71
  %73 = sdiv i32 %72, 2
  %74 = add nsw i32 %63, %73
  %75 = trunc i32 %74 to i16
  store i16 %75, ptr %58, align 2, !tbaa !17
  %76 = getelementptr inbounds %struct.arm_2d_location_t, ptr %57, i32 0, i32 1
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.arm_2d_region_t, ptr %77, i32 0, i32 0
  %79 = getelementptr inbounds %struct.arm_2d_location_t, ptr %78, i32 0, i32 1
  %80 = load i16, ptr %79, align 2, !tbaa !16
  %81 = sext i16 %80 to i32
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.arm_2d_region_t, ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds %struct.arm_2d_size_t, ptr %83, i32 0, i32 1
  %85 = load i16, ptr %84, align 2, !tbaa !16
  %86 = sext i16 %85 to i32
  %87 = 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_tileBlueSlashRGB565, i32 0, i32 1), i32 0, i32 1), i32 0, i32 1), align 2, !tbaa !16
  %88 = sext i16 %87 to i32
  %89 = sub nsw i32 %86, %88
  %90 = sdiv i32 %89, 2
  %91 = add nsw i32 %81, %90
  %92 = trunc i32 %91 to i16
  store i16 %92, ptr %76, align 2, !tbaa !19
  %93 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %94 = getelementptr inbounds %struct.arm_2d_size_t, ptr %93, i32 0, i32 0
  %95 = load i64, ptr %11, align 8, !tbaa !9
  %96 = trunc i64 %95 to i16
  store i16 %96, ptr %94, align 2, !tbaa !20
  %97 = getelementptr inbounds %struct.arm_2d_size_t, ptr %93, i32 0, i32 1
  %98 = 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_tileBlueSlashRGB565, i32 0, i32 1), i32 0, i32 1), i32 0, i32 1), align 2, !tbaa !16
  store i16 %98, ptr %97, align 2, !tbaa !22
  %99 = load i8, ptr %10, align 1, !tbaa !13, !range !23, !noundef !24
  %100 = trunc i8 %99 to i1
  br i1 %100, label %101, label %119

101:                                              ; preds = %56
  %102 = load i32, ptr @s_wUnit, align 4, !tbaa !25
  %103 = call i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef %102)
  %104 = call zeroext i1 @__arm_2d_helper_is_time_out(i64 noundef %103, ptr noundef @s_lLastTime)
  %105 = zext i1 %104 to i8
  store i8 %105, ptr %14, align 1, !tbaa !13
  %106 = load i8, ptr %14, align 1, !tbaa !13, !range !23, !noundef !24
  %107 = trunc i8 %106 to i1
  br i1 %107, label %108, label %118

108:                                              ; preds = %101
  %109 = load i8, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !16
  %110 = add i8 %109, 1
  store i8 %110, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !16
  %111 = load i8, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !16
  %112 = zext i8 %111 to i32
  %113 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileBlueSlashRGB565, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !16
  %114 = sext i16 %113 to i32
  %115 = icmp sge i32 %112, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %108
  store i8 0, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !16
  br label %117

117:                                              ; preds = %116, %108
  br label %118

118:                                              ; preds = %117, %101
  br label %119

119:                                              ; preds = %118, %56
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = call zeroext i1 @arm_2d_helper_pfb_is_region_being_drawing(ptr noundef %120, ptr noundef %13, ptr noundef null)
  br i1 %121, label %123, label %122

122:                                              ; preds = %119
  store i32 1, ptr %15, align 4
  br label %203

123:                                              ; preds = %119
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = call i32 @arm_2dp_rgb16_fill_colour(ptr noundef null, ptr noundef %124, ptr noundef %13, i64 noundef 42557)
  %126 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %127 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %128 = getelementptr inbounds %struct.arm_2d_size_t, ptr %127, i32 0, i32 1
  %129 = load i16, ptr %128, align 2, !tbaa !16
  %130 = sext i16 %129 to i32
  %131 = sub nsw i32 %130, 2
  %132 = trunc i32 %131 to i16
  store i16 %132, ptr %128, align 2, !tbaa !16
  %133 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %134 = getelementptr inbounds %struct.arm_2d_size_t, ptr %133, i32 0, i32 0
  %135 = load i16, ptr %134, align 2, !tbaa !16
  %136 = sext i16 %135 to i32
  %137 = sub nsw i32 %136, 2
  %138 = trunc i32 %137 to i16
  store i16 %138, ptr %134, align 2, !tbaa !16
  %139 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 0
  %140 = getelementptr inbounds %struct.arm_2d_location_t, ptr %139, i32 0, i32 0
  %141 = load i16, ptr %140, align 2, !tbaa !16
  %142 = sext i16 %141 to i32
  %143 = add nsw i32 %142, 1
  %144 = trunc i32 %143 to i16
  store i16 %144, ptr %140, align 2, !tbaa !16
  %145 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 0
  %146 = getelementptr inbounds %struct.arm_2d_location_t, ptr %145, i32 0, i32 1
  %147 = load i16, ptr %146, align 2, !tbaa !16
  %148 = sext i16 %147 to i32
  %149 = add nsw i32 %148, 1
  %150 = trunc i32 %149 to i16
  store i16 %150, ptr %146, align 2, !tbaa !16
  br label %151

151:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %152 = getelementptr inbounds %struct.arm_2d_region_t, ptr %16, i32 0, i32 0
  %153 = getelementptr inbounds %struct.arm_2d_location_t, ptr %152, i32 0, i32 0
  %154 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileBlueSlashRGB565, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !16
  %155 = sext i16 %154 to i32
  %156 = sub nsw i32 0, %155
  %157 = load i8, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !16
  %158 = zext i8 %157 to i32
  %159 = add nsw i32 %156, %158
  %160 = trunc i32 %159 to i16
  store i16 %160, ptr %153, align 2, !tbaa !17
  %161 = getelementptr inbounds %struct.arm_2d_location_t, ptr %152, i32 0, i32 1
  store i16 0, ptr %161, align 2, !tbaa !19
  %162 = getelementptr inbounds %struct.arm_2d_region_t, ptr %16, i32 0, i32 1
  %163 = getelementptr inbounds %struct.arm_2d_size_t, ptr %162, i32 0, i32 0
  %164 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %165 = getelementptr inbounds %struct.arm_2d_size_t, ptr %164, i32 0, i32 0
  %166 = load i16, ptr %165, align 2, !tbaa !16
  %167 = sext i16 %166 to i32
  %168 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileBlueSlashRGB565, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !16
  %169 = sext i16 %168 to i32
  %170 = add nsw i32 %167, %169
  %171 = trunc i32 %170 to i16
  store i16 %171, ptr %163, align 2, !tbaa !20
  %172 = getelementptr inbounds %struct.arm_2d_size_t, ptr %162, i32 0, i32 1
  %173 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %174 = getelementptr inbounds %struct.arm_2d_size_t, ptr %173, i32 0, i32 1
  %175 = load i16, ptr %174, align 2, !tbaa !16
  store i16 %175, ptr %172, align 2, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = call ptr @arm_2d_tile_generate_child(ptr noundef %176, ptr noundef %13, ptr noundef %17, i1 noundef zeroext false)
  %178 = call i32 @arm_2dp_rgb16_tile_fill_only(ptr noundef null, ptr noundef @c_tileBlueSlashRGB565, ptr noundef %17, ptr noundef %16)
  %179 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %180

180:                                              ; preds = %151
  br label %181

181:                                              ; preds = %180
  %182 = load i64, ptr %8, align 8, !tbaa !9
  %183 = icmp sge i64 %182, 0
  br i1 %183, label %184, label %202

184:                                              ; preds = %181
  %185 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %186 = getelementptr inbounds %struct.arm_2d_size_t, ptr %185, i32 0, i32 0
  %187 = load i16, ptr %186, align 2, !tbaa !16
  %188 = sext i16 %187 to i32
  %189 = load i64, ptr %8, align 8, !tbaa !9
  %190 = trunc i64 %189 to i16
  %191 = sext i16 %190 to i32
  %192 = mul nsw i32 %188, %191
  %193 = sdiv i32 %192, 1000
  %194 = trunc i32 %193 to i16
  %195 = getelementptr inbounds %struct.arm_2d_region_t, ptr %13, i32 0, i32 1
  %196 = getelementptr inbounds %struct.arm_2d_size_t, ptr %195, i32 0, i32 0
  store i16 %194, ptr %196, align 2, !tbaa !16
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = load i16, ptr %9, align 2, !tbaa !11
  %199 = zext i16 %198 to i64
  %200 = call i32 @arm_2dp_rgb16_fill_colour(ptr noundef null, ptr noundef %197, ptr noundef %13, i64 noundef %199)
  %201 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  br label %202

202:                                              ; preds = %184, %181
  store i32 0, ptr %15, align 4
  br label %203

203:                                              ; preds = %202, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %204 = load i32, ptr %15, align 4
  switch i32 %204, label %206 [
    i32 0, label %205
    i32 1, label %205
  ]

205:                                              ; preds = %203, %203
  ret void

206:                                              ; preds = %203
  unreachable
}

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

declare ptr @arm_2d_get_default_frame_buffer() #2

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

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

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

declare zeroext i1 @__arm_2d_helper_is_time_out(i64 noundef, ptr noundef) #2

declare i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef) #2

declare zeroext i1 @arm_2d_helper_pfb_is_region_being_drawing(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @arm_2dp_rgb16_fill_colour(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) #2

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

declare i32 @arm_2dp_rgb16_tile_fill_only(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

attributes #0 = { 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 #1 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i64 0, i64 2, !11, i64 2, i64 2, !11}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"arm_2d_location_t", !12, i64 0, !12, i64 2}
!19 = !{!18, !12, i64 2}
!20 = !{!21, !12, i64 0}
!21 = !{!"arm_2d_size_t", !12, i64 0, !12, i64 2}
!22 = !{!21, !12, i64 2}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.arm_2d_tile_t = type { %union.anon.1, %union.anon.11, %union.anon.12 }
%union.anon.1 = type { %struct.anon }
%struct.anon = type { i8, %union.arm_2d_color_info_t, %union.anon.4 }
%union.arm_2d_color_info_t = type { %struct.anon.2 }
%struct.anon.2 = type { i8 }
%union.anon.4 = type { i16 }
%union.anon.11 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon, %union.anon.0 }
%union.anon = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.0 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.12 = type { ptr }

@s_lLastTime = external hidden global i64, section ".bss.noinit", align 8
@s_wUnit = external hidden local_unnamed_addr global i32, section ".bss.noinit", align 4
@__progress_bar_drill_show.s_chOffset = external hidden local_unnamed_addr global i8, align 1
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@__PRETTY_FUNCTION__.__progress_bar_drill_show = external hidden unnamed_addr constant [110 x i8], align 1
@c_tileBlueSlashRGB565 = external constant %struct.arm_2d_tile_t, align 8

; Function Attrs: nounwind uwtable
define dso_local void @__progress_bar_drill_show(ptr noundef %0, ptr noundef readonly %1, i64 noundef %2, i16 noundef zeroext %3, i1 noundef zeroext %4) local_unnamed_addr #0 {
  %.sroa.0 = alloca %struct.arm_2d_location_t, align 4
  %.sroa.5 = alloca i16, align 2
  %6 = alloca %struct.arm_2d_region_t, align 8
  %7 = alloca %struct.arm_2d_region_t, align 2
  %8 = alloca %struct.arm_2d_tile_t, align 8
  %.023.sroa.gep27 = getelementptr inbounds i8, ptr %1, i64 4
  %magicptr = ptrtoint ptr %0 to i64
  %.pn.sroa.gep = getelementptr inbounds i8, ptr %1, i64 6
  switch i64 %magicptr, label %12 [
    i64 0, label %9
    i64 -1, label %10
  ]

9:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 102, ptr noundef nonnull @__PRETTY_FUNCTION__.__progress_bar_drill_show) #4
  unreachable

10:                                               ; preds = %5
  %11 = tail call ptr @arm_2d_get_default_frame_buffer() #5
  br label %12

12:                                               ; preds = %5, %10
  %.0 = phi ptr [ %11, %10 ], [ %0, %5 ]
  %13 = icmp sgt i64 %2, 1000
  %spec.store.select = select i1 %13, i64 0, i64 %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %.sroa.0)
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %.sroa.5)
  store i32 0, ptr %.sroa.0, align 4
  %14 = getelementptr inbounds i8, ptr %.0, i64 8
  %.sroa_idx = getelementptr inbounds i8, ptr %.0, i64 10
  %15 = load i16, ptr %.sroa_idx, align 2
  %16 = load i32, ptr %14, align 4
  store i16 %15, ptr %.sroa.5, align 2
  %17 = icmp eq ptr %1, null
  br i1 %17, label %18, label %23

18:                                               ; preds = %12
  %sext = shl i32 %16, 16
  %19 = ashr exact i32 %sext, 16
  %20 = mul nsw i32 %19, 3
  %21 = lshr i32 %20, 3
  %22 = trunc i32 %21 to i16
  %sext42 = shl i32 %21, 16
  %.pre40 = ashr exact i32 %sext42, 16
  br label %25

23:                                               ; preds = %12
  %24 = load i16, ptr %.023.sroa.gep27, align 2, !tbaa !5
  %.pre = sext i16 %24 to i32
  br label %25

25:                                               ; preds = %23, %18
  %.pre-phi41 = phi i32 [ %.pre, %23 ], [ %.pre40, %18 ]
  %.pre-phi = phi i32 [ %.pre, %23 ], [ %19, %18 ]
  %.pn.sroa.phi = phi ptr [ %.pn.sroa.gep, %23 ], [ %.sroa.5, %18 ]
  %.pn = phi ptr [ %1, %23 ], [ %.sroa.0, %18 ]
  %.022 = phi i16 [ %24, %23 ], [ %22, %18 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %26 = load i16, ptr %.pn.sroa.phi, align 2, !tbaa !5
  %27 = sext i16 %26 to i32
  %28 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileBlueSlashRGB565, i64 10), align 2, !tbaa !5
  %29 = sext i16 %28 to i32
  %30 = load <2 x i16>, ptr %.pn, align 2, !tbaa !5
  %31 = insertelement <2 x i32> poison, i32 %.pre-phi, i64 0
  %32 = insertelement <2 x i32> %31, i32 %27, i64 1
  %33 = insertelement <2 x i32> poison, i32 %.pre-phi41, i64 0
  %34 = insertelement <2 x i32> %33, i32 %29, i64 1
  %35 = sub nsw <2 x i32> %32, %34
  %36 = sdiv <2 x i32> %35, <i32 2, i32 2>
  %37 = trunc <2 x i32> %36 to <2 x i16>
  %38 = add <2 x i16> %30, %37
  store <2 x i16> %38, ptr %6, align 8, !tbaa !8
  %39 = getelementptr inbounds i8, ptr %6, i64 4
  store i16 %.022, ptr %39, align 4, !tbaa !10
  %40 = getelementptr inbounds i8, ptr %6, i64 6
  store i16 %28, ptr %40, align 2, !tbaa !12
  br i1 %4, label %41, label %51

41:                                               ; preds = %25
  %42 = load i32, ptr @s_wUnit, align 4, !tbaa !13
  %43 = tail call i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef %42) #5
  %44 = tail call zeroext i1 @__arm_2d_helper_is_time_out(i64 noundef %43, ptr noundef nonnull @s_lLastTime) #5
  br i1 %44, label %45, label %51

45:                                               ; preds = %41
  %46 = load i8, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !5
  %47 = add i8 %46, 1
  %48 = zext i8 %47 to i32
  %49 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileBlueSlashRGB565, i64 8), align 8, !tbaa !5
  %50 = sext i16 %49 to i32
  %.not36 = icmp slt i32 %48, %50
  %spec.store.select1 = select i1 %.not36, i8 %47, i8 0
  store i8 %spec.store.select1, ptr @__progress_bar_drill_show.s_chOffset, align 1
  br label %51

51:                                               ; preds = %41, %45, %25
  %52 = call zeroext i1 @arm_2d_helper_pfb_is_region_being_drawing(ptr noundef nonnull %.0, ptr noundef nonnull %6, ptr noundef null) #5
  br i1 %52, label %53, label %82

53:                                               ; preds = %51
  %54 = call i32 @arm_2dp_rgb16_fill_colour(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %6, i64 noundef 42557) #5
  %55 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  %56 = load <4 x i16>, ptr %6, align 8, !tbaa !5
  %57 = add <4 x i16> %56, <i16 1, i16 1, i16 -2, i16 -2>
  store <4 x i16> %57, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %58 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileBlueSlashRGB565, i64 8), align 8, !tbaa !5
  %59 = load i8, ptr @__progress_bar_drill_show.s_chOffset, align 1, !tbaa !5
  %60 = zext i8 %59 to i16
  %61 = sub i16 %60, %58
  store i16 %61, ptr %7, align 2, !tbaa !15
  %62 = getelementptr inbounds i8, ptr %7, i64 2
  store i16 0, ptr %62, align 2, !tbaa !17
  %63 = getelementptr inbounds i8, ptr %7, i64 4
  %64 = extractelement <4 x i16> %57, i64 2
  %65 = add i16 %58, %64
  store i16 %65, ptr %63, align 2, !tbaa !10
  %66 = getelementptr inbounds i8, ptr %7, i64 6
  %67 = extractelement <4 x i16> %57, i64 3
  store i16 %67, ptr %66, align 2, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  %68 = call ptr @arm_2d_tile_generate_child(ptr noundef nonnull %.0, ptr noundef nonnull %6, ptr noundef nonnull %8, i1 noundef zeroext false) #5
  %69 = call i32 @arm_2dp_rgb16_tile_fill_only(ptr noundef null, ptr noundef nonnull @c_tileBlueSlashRGB565, ptr noundef nonnull %8, ptr noundef nonnull %7) #5
  %70 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  %71 = icmp sgt i64 %spec.store.select, -1
  br i1 %71, label %72, label %82

72:                                               ; preds = %53
  %73 = load i16, ptr %39, align 4, !tbaa !5
  %74 = sext i16 %73 to i32
  %75 = trunc i64 %spec.store.select to i32
  %76 = mul nsw i32 %74, %75
  %77 = sdiv i32 %76, 1000
  %78 = trunc i32 %77 to i16
  store i16 %78, ptr %39, align 4, !tbaa !5
  %79 = zext i16 %3 to i64
  %80 = call i32 @arm_2dp_rgb16_fill_colour(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %6, i64 noundef %79) #5
  %81 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  br label %82

82:                                               ; preds = %53, %72, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %.sroa.0)
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %.sroa.5)
  ret void
}

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

declare ptr @arm_2d_get_default_frame_buffer() local_unnamed_addr #2

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

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

declare i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef) local_unnamed_addr #2

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

declare i32 @arm_2dp_rgb16_fill_colour(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

declare i32 @arm_2dp_rgb16_tile_fill_only(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #1 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { noreturn nounwind }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"short", !6, i64 0}
!10 = !{!11, !9, i64 0}
!11 = !{!"arm_2d_size_t", !9, i64 0, !9, i64 2}
!12 = !{!11, !9, i64 2}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{!16, !9, i64 0}
!16 = !{!"arm_2d_location_t", !9, i64 0, !9, i64 2}
!17 = !{!16, !9, i64 2}


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