; LLVM IR from ARM-software/Arm-2D :: examples/common/controls/progress_bar_simple.ll_ (progress_bar_simple_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.4, %union.anon.11, %union.anon.12 }
%union.anon.4 = type { %struct.anon }
%struct.anon = type { i8, %union.arm_2d_color_info_t, %union.anon }
%union.arm_2d_color_info_t = type { %struct.anon.0 }
%struct.anon.0 = type { i8 }
%union.anon = type { i16 }
%union.anon.11 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.9, %union.anon.10 }
%union.anon.9 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.10 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.12 = type { ptr }
%union.arm_2d_color_rgb565_t = type { i16 }

@c_tileSmallDotMask = external constant %struct.arm_2d_tile_t, align 8
@c_tileSemisphereLeft = external dso_local constant { { { i8, { i8 }, %union.anon } }, %union.anon.11, %union.anon.12 }, align 8
@c_tileSemisphereRight = external dso_local constant { { { i8, { i8 }, %union.anon } }, %union.anon.11, %union.anon.12 }, align 8
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [100 x i8], align 1
@__PRETTY_FUNCTION__.__progress_bar_simple_show = external hidden unnamed_addr constant [94 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__progress_bar_simple_show(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %struct.arm_2d_region_t, align 2
  %9 = alloca %struct.arm_2d_region_t, align 2
  %10 = alloca %struct.arm_2d_region_t, align 2
  %11 = alloca %union.arm_2d_color_rgb565_t, align 2
  %12 = alloca %union.arm_2d_color_rgb565_t, align 2
  %13 = alloca %union.arm_2d_color_rgb565_t, align 2
  %14 = alloca %union.arm_2d_color_rgb565_t, align 2
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = ptrtoint ptr %15 to i64
  %17 = icmp eq i64 -1, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %3
  %19 = call ptr @arm_2d_get_default_frame_buffer()
  store ptr %19, ptr %4, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %18, %3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp ne ptr null, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  br label %25

24:                                               ; preds = %20
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 116, ptr noundef @__PRETTY_FUNCTION__.__progress_bar_simple_show) #7
  unreachable

25:                                               ; preds = %23
  %26 = load i64, ptr %6, align 8, !tbaa !9
  %27 = icmp sgt i64 %26, 1000
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  store i64 1000, ptr %6, align 8, !tbaa !9
  br label %34

29:                                               ; preds = %25
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %32, label %33

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

33:                                               ; preds = %32, %29
  br label %34

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

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

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

57:                                               ; preds = %51, %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %58 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 0
  %59 = getelementptr inbounds %struct.arm_2d_location_t, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.arm_2d_region_t, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds %struct.arm_2d_location_t, ptr %61, i32 0, i32 0
  %63 = load i16, ptr %62, align 2, !tbaa !14
  %64 = sext i16 %63 to i32
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.arm_2d_region_t, ptr %65, i32 0, i32 1
  %67 = getelementptr inbounds %struct.arm_2d_size_t, ptr %66, i32 0, i32 0
  %68 = load i16, ptr %67, align 2, !tbaa !14
  %69 = sext i16 %68 to i32
  %70 = load i64, ptr %7, align 8, !tbaa !9
  %71 = trunc i64 %70 to i16
  %72 = sext i16 %71 to i32
  %73 = sub nsw i32 %69, %72
  %74 = sdiv i32 %73, 2
  %75 = add nsw i32 %64, %74
  %76 = trunc i32 %75 to i16
  store i16 %76, ptr %59, align 2, !tbaa !15
  %77 = getelementptr inbounds %struct.arm_2d_location_t, ptr %58, i32 0, i32 1
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.arm_2d_region_t, ptr %78, i32 0, i32 0
  %80 = getelementptr inbounds %struct.arm_2d_location_t, ptr %79, i32 0, i32 1
  %81 = load i16, ptr %80, align 2, !tbaa !14
  %82 = sext i16 %81 to i32
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.arm_2d_region_t, ptr %83, i32 0, i32 1
  %85 = getelementptr inbounds %struct.arm_2d_size_t, ptr %84, i32 0, i32 1
  %86 = load i16, ptr %85, align 2, !tbaa !14
  %87 = sext i16 %86 to i32
  %88 = 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_tileSmallDotMask, i32 0, i32 1), i32 0, i32 1), i32 0, i32 1), align 2, !tbaa !14
  %89 = sext i16 %88 to i32
  %90 = sub nsw i32 %87, %89
  %91 = sdiv i32 %90, 2
  %92 = add nsw i32 %82, %91
  %93 = trunc i32 %92 to i16
  store i16 %93, ptr %77, align 2, !tbaa !17
  %94 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 1
  %95 = getelementptr inbounds %struct.arm_2d_size_t, ptr %94, i32 0, i32 0
  %96 = load i64, ptr %7, align 8, !tbaa !9
  %97 = trunc i64 %96 to i16
  store i16 %97, ptr %95, align 2, !tbaa !18
  %98 = getelementptr inbounds %struct.arm_2d_size_t, ptr %94, i32 0, i32 1
  %99 = 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_tileSmallDotMask, i32 0, i32 1), i32 0, i32 1), i32 0, i32 1), align 2, !tbaa !14
  store i16 %99, ptr %98, align 2, !tbaa !20
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  call void @arm_2d_helper_draw_box(ptr noundef %100, ptr noundef %9, i16 noundef signext 1, i16 noundef zeroext -1, i8 noundef zeroext -65)
  %101 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  br label %102

102:                                              ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %103 = getelementptr inbounds %struct.arm_2d_region_t, ptr %10, i32 0, i32 0
  %104 = getelementptr inbounds %struct.arm_2d_location_t, ptr %103, i32 0, i32 0
  %105 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 0
  %106 = getelementptr inbounds %struct.arm_2d_location_t, ptr %105, i32 0, i32 0
  %107 = load i16, ptr %106, align 2, !tbaa !14
  %108 = sext i16 %107 to i32
  %109 = sub nsw i32 %108, 4
  %110 = trunc i32 %109 to i16
  store i16 %110, ptr %104, align 2, !tbaa !15
  %111 = getelementptr inbounds %struct.arm_2d_location_t, ptr %103, i32 0, i32 1
  %112 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 0
  %113 = getelementptr inbounds %struct.arm_2d_location_t, ptr %112, i32 0, i32 1
  %114 = load i16, ptr %113, align 2, !tbaa !14
  store i16 %114, ptr %111, align 2, !tbaa !17
  %115 = getelementptr inbounds %struct.arm_2d_region_t, ptr %10, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %115, ptr align 4 getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileSemisphereLeft, i32 0, i32 1), i32 0, i32 1), i64 4, i1 false), !tbaa.struct !11
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  store i16 -1, ptr %11, align 2, !tbaa !14
  %117 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %11, i32 0, i32 0
  %118 = load i16, ptr %117, align 2
  %119 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef %116, ptr noundef %10, ptr noundef @c_tileSemisphereLeft, i16 %118, i8 noundef zeroext -65)
  %120 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %121 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 0
  %122 = getelementptr inbounds %struct.arm_2d_location_t, ptr %121, i32 0, i32 0
  %123 = load i16, ptr %122, align 2, !tbaa !14
  %124 = sext i16 %123 to i32
  %125 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 1
  %126 = getelementptr inbounds %struct.arm_2d_size_t, ptr %125, i32 0, i32 0
  %127 = load i16, ptr %126, align 2, !tbaa !14
  %128 = sext i16 %127 to i32
  %129 = add nsw i32 %124, %128
  %130 = trunc i32 %129 to i16
  %131 = getelementptr inbounds %struct.arm_2d_region_t, ptr %10, i32 0, i32 0
  %132 = getelementptr inbounds %struct.arm_2d_location_t, ptr %131, i32 0, i32 0
  store i16 %130, ptr %132, align 2, !tbaa !14
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  store i16 -1, ptr %12, align 2, !tbaa !14
  %134 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %12, i32 0, i32 0
  %135 = load i16, ptr %134, align 2
  %136 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef %133, ptr noundef %10, ptr noundef @c_tileSemisphereRight, i16 %135, i8 noundef zeroext -65)
  %137 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %138

138:                                              ; preds = %102
  br label %139

139:                                              ; preds = %138
  %140 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 1
  %141 = getelementptr inbounds %struct.arm_2d_size_t, ptr %140, i32 0, i32 1
  %142 = load i16, ptr %141, align 2, !tbaa !14
  %143 = sext i16 %142 to i32
  %144 = sub nsw i32 %143, 2
  %145 = trunc i32 %144 to i16
  store i16 %145, ptr %141, align 2, !tbaa !14
  %146 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 1
  %147 = getelementptr inbounds %struct.arm_2d_size_t, ptr %146, i32 0, i32 0
  %148 = load i16, ptr %147, align 2, !tbaa !14
  %149 = sext i16 %148 to i32
  %150 = sub nsw i32 %149, 2
  %151 = trunc i32 %150 to i16
  store i16 %151, ptr %147, align 2, !tbaa !14
  %152 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 0
  %153 = getelementptr inbounds %struct.arm_2d_location_t, ptr %152, i32 0, i32 0
  %154 = load i16, ptr %153, align 2, !tbaa !14
  %155 = sext i16 %154 to i32
  %156 = add nsw i32 %155, 1
  %157 = trunc i32 %156 to i16
  store i16 %157, ptr %153, align 2, !tbaa !14
  %158 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 0
  %159 = getelementptr inbounds %struct.arm_2d_location_t, ptr %158, i32 0, i32 1
  %160 = load i16, ptr %159, align 2, !tbaa !14
  %161 = sext i16 %160 to i32
  %162 = add nsw i32 %161, 1
  %163 = trunc i32 %162 to i16
  store i16 %163, ptr %159, align 2, !tbaa !14
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  store i16 0, ptr %13, align 2, !tbaa !14
  %165 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %13, i32 0, i32 0
  %166 = load i16, ptr %165, align 2
  %167 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef %164, ptr noundef %9, i16 %166, i8 noundef zeroext 64)
  %168 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %169 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 1
  %170 = getelementptr inbounds %struct.arm_2d_size_t, ptr %169, i32 0, i32 0
  %171 = load i16, ptr %170, align 2, !tbaa !14
  %172 = sext i16 %171 to i32
  %173 = load i64, ptr %6, align 8, !tbaa !9
  %174 = trunc i64 %173 to i16
  %175 = sext i16 %174 to i32
  %176 = mul nsw i32 %172, %175
  %177 = sdiv i32 %176, 1000
  %178 = trunc i32 %177 to i16
  %179 = getelementptr inbounds %struct.arm_2d_region_t, ptr %9, i32 0, i32 1
  %180 = getelementptr inbounds %struct.arm_2d_size_t, ptr %179, i32 0, i32 0
  store i16 %178, ptr %180, align 2, !tbaa !14
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  store i16 -1, ptr %14, align 2, !tbaa !14
  %182 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %14, i32 0, i32 0
  %183 = load i16, ptr %182, align 2
  %184 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef %181, ptr noundef %9, i16 %183, i8 noundef zeroext -65)
  %185 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  ret void
}

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

declare ptr @arm_2d_get_default_frame_buffer() #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 void @arm_2d_helper_draw_box(ptr noundef, ptr noundef, i16 noundef signext, i16 noundef zeroext, i8 noundef zeroext) #2

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) #2

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

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

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

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

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

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


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

@c_tileSmallDotMask = external local_unnamed_addr constant %struct.arm_2d_tile_t, align 8
@c_tileSemisphereLeft = external dso_local constant { { { i8, { i8 }, %union.anon } }, %union.anon.11, %union.anon.12 }, align 8
@c_tileSemisphereRight = external dso_local constant { { { i8, { i8 }, %union.anon } }, %union.anon.11, %union.anon.12 }, align 8
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [100 x i8], align 1
@__PRETTY_FUNCTION__.__progress_bar_simple_show = external hidden unnamed_addr constant [94 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__progress_bar_simple_show(ptr noundef %0, ptr noundef readonly %1, i64 noundef %2) local_unnamed_addr #0 {
  %.sroa.0 = alloca %struct.arm_2d_location_t, align 4
  %.sroa.5 = alloca i16, align 2
  %4 = alloca %struct.arm_2d_region_t, align 8
  %5 = alloca %struct.arm_2d_region_t, align 2
  %6 = icmp eq ptr %0, inttoptr (i64 -1 to ptr)
  %.022.sroa.gep28 = getelementptr inbounds i8, ptr %1, i64 4
  %.pn.sroa.gep = getelementptr inbounds i8, ptr %1, i64 6
  br i1 %6, label %7, label %9

7:                                                ; preds = %3
  %8 = tail call ptr @arm_2d_get_default_frame_buffer() #5
  br label %9

9:                                                ; preds = %7, %3
  %.0 = phi ptr [ %8, %7 ], [ %0, %3 ]
  %.not = icmp eq ptr %.0, null
  br i1 %.not, label %10, label %11

10:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 116, ptr noundef nonnull @__PRETTY_FUNCTION__.__progress_bar_simple_show) #6
  unreachable

11:                                               ; preds = %9
  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
  %12 = getelementptr inbounds i8, ptr %.0, i64 8
  %.sroa_idx = getelementptr inbounds i8, ptr %.0, i64 10
  %13 = load i16, ptr %.sroa_idx, align 2
  %14 = load i32, ptr %12, align 4
  store i16 %13, ptr %.sroa.5, align 2
  %15 = icmp eq ptr %1, null
  br i1 %15, label %16, label %21

16:                                               ; preds = %11
  %sext = shl i32 %14, 16
  %17 = ashr exact i32 %sext, 16
  %18 = mul nsw i32 %17, 3
  %19 = lshr i32 %18, 3
  %20 = trunc i32 %19 to i16
  %sext43 = shl i32 %19, 16
  %.pre41 = ashr exact i32 %sext43, 16
  br label %23

21:                                               ; preds = %11
  %22 = load i16, ptr %.022.sroa.gep28, align 2, !tbaa !5
  %.pre = sext i16 %22 to i32
  br label %23

23:                                               ; preds = %21, %16
  %.pre-phi42 = phi i32 [ %.pre, %21 ], [ %.pre41, %16 ]
  %.pre-phi = phi i32 [ %.pre, %21 ], [ %17, %16 ]
  %.024 = phi i16 [ %22, %21 ], [ %20, %16 ]
  %.pn.sroa.phi = phi ptr [ %.pn.sroa.gep, %21 ], [ %.sroa.5, %16 ]
  %.pn = phi ptr [ %1, %21 ], [ %.sroa.0, %16 ]
  %spec.store.select = tail call i64 @llvm.smax.i64(i64 %2, i64 0)
  %.02338 = tail call i64 @llvm.umin.i64(i64 %spec.store.select, i64 1000)
  %.023 = trunc nuw nsw i64 %.02338 to i32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %24 = getelementptr inbounds i8, ptr %4, i64 2
  %25 = load i16, ptr %.pn.sroa.phi, align 2, !tbaa !5
  %26 = sext i16 %25 to i32
  %27 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileSmallDotMask, i64 10), align 2, !tbaa !5
  %28 = sext i16 %27 to i32
  %29 = load <2 x i16>, ptr %.pn, align 2, !tbaa !5
  %30 = insertelement <2 x i32> poison, i32 %.pre-phi, i64 0
  %31 = insertelement <2 x i32> %30, i32 %26, i64 1
  %32 = insertelement <2 x i32> poison, i32 %.pre-phi42, i64 0
  %33 = insertelement <2 x i32> %32, i32 %28, i64 1
  %34 = sub nsw <2 x i32> %31, %33
  %35 = sdiv <2 x i32> %34, <i32 2, i32 2>
  %36 = trunc <2 x i32> %35 to <2 x i16>
  %37 = add <2 x i16> %29, %36
  store <2 x i16> %37, ptr %4, align 8, !tbaa !8
  %38 = getelementptr inbounds i8, ptr %4, i64 4
  store i16 %.024, ptr %38, align 4, !tbaa !10
  %39 = getelementptr inbounds i8, ptr %4, i64 6
  store i16 %27, ptr %39, align 2, !tbaa !12
  call void @arm_2d_helper_draw_box(ptr noundef nonnull %.0, ptr noundef nonnull %4, i16 noundef signext 1, i16 noundef zeroext -1, i8 noundef zeroext -65) #5
  %40 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %41 = load i16, ptr %4, align 8, !tbaa !5
  %42 = add i16 %41, -4
  store i16 %42, ptr %5, align 2, !tbaa !13
  %43 = getelementptr inbounds i8, ptr %5, i64 2
  %44 = load i16, ptr %24, align 2, !tbaa !5
  store i16 %44, ptr %43, align 2, !tbaa !15
  %45 = getelementptr inbounds i8, ptr %5, i64 4
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @c_tileSemisphereLeft, i64 8), align 8
  store i32 %46, ptr %45, align 2
  %47 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %5, ptr noundef nonnull @c_tileSemisphereLeft, i16 -1, i8 noundef zeroext -65) #5
  %48 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  %49 = load i16, ptr %4, align 8, !tbaa !5
  %50 = load i16, ptr %38, align 4, !tbaa !5
  %51 = add i16 %50, %49
  store i16 %51, ptr %5, align 2, !tbaa !5
  %52 = call i32 @arm_2dp_rgb565_fill_colour_with_mask_and_opacity(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %5, ptr noundef nonnull @c_tileSemisphereRight, i16 -1, i8 noundef zeroext -65) #5
  %53 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %54 = load <4 x i16>, ptr %4, align 8, !tbaa !5
  %55 = add <4 x i16> %54, <i16 1, i16 1, i16 -2, i16 -2>
  store <4 x i16> %55, ptr %4, align 8, !tbaa !5
  %56 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %4, i16 0, i8 noundef zeroext 64) #5
  %57 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  %58 = load i16, ptr %38, align 4, !tbaa !5
  %59 = sext i16 %58 to i32
  %60 = mul nsw i32 %59, %.023
  %61 = sdiv i32 %60, 1000
  %62 = trunc nsw i32 %61 to i16
  store i16 %62, ptr %38, align 4, !tbaa !5
  %63 = call i32 @arm_2dp_rgb565_fill_colour_with_opacity(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %4, i16 -1, i8 noundef zeroext -65) #5
  %64 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @arm_2d_get_default_frame_buffer() local_unnamed_addr #2

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

declare void @arm_2d_helper_draw_box(ptr noundef, ptr noundef, i16 noundef signext, i16 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) 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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4

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 = { 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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, !9, i64 0}
!14 = !{!"arm_2d_location_t", !9, i64 0, !9, i64 2}
!15 = !{!14, !9, i64 2}


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