; LLVM IR from ARM-software/Arm-2D :: examples/common/controls/progress_bar_flowing.ll_ (progress_bar_flowing_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 }
%union.arm_2d_color_rgb565_t = type { i16 }

@s_lLastTime = external hidden global i64, section ".bss.noinit", align 8
@s_wUnit = external hidden global i32, section ".bss.noinit", align 4
@s_lWavingTime = external hidden global i64, section ".bss.noinit", align 8
@__progress_bar_flowing_show.s_iOffset = external hidden global i16, align 2
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__.__progress_bar_flowing_show = external hidden unnamed_addr constant [132 x i8], align 1
@s_bWaving = external hidden global i8, align 1
@c_tileWaveLineMask = external constant %struct.arm_2d_tile_t, align 8

declare i64 @arm_2d_helper_get_system_timestamp() #0

declare i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef) #0

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

30:                                               ; preds = %7
  %31 = call ptr @arm_2d_get_default_frame_buffer()
  store ptr %31, ptr %8, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %30, %7
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = icmp ne ptr null, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  br label %37

36:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 94, ptr noundef @__PRETTY_FUNCTION__.__progress_bar_flowing_show) #6
  unreachable

37:                                               ; preds = %35
  %38 = load i64, ptr %10, align 8, !tbaa !9
  %39 = icmp sgt i64 %38, 1000
  br i1 %39, label %40, label %41

40:                                               ; preds = %37
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %40, %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  store i64 0, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %42 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 0
  call void @llvm.memset.p0.i64(ptr align 2 %42, i8 0, i64 4, i1 false)
  %43 = getelementptr inbounds %struct.arm_2d_region_t, ptr %17, i32 0, i32 1
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds %struct.arm_2d_region_t, ptr %45, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %43, ptr align 4 %46, i64 4, i1 false), !tbaa.struct !15
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = icmp eq ptr null, %47
  br i1 %48, label %49, label %58

49:                                               ; preds = %41
  store ptr %17, ptr %9, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.arm_2d_region_t, ptr %50, i32 0, i32 1
  %52 = getelementptr inbounds %struct.arm_2d_size_t, ptr %51, i32 0, i32 0
  %53 = load i16, ptr %52, align 2, !tbaa !16
  %54 = sext i16 %53 to i32
  %55 = mul nsw i32 %54, 3
  %56 = ashr i32 %55, 3
  %57 = sext i32 %56 to i64
  store i64 %57, ptr %15, align 8, !tbaa !9
  store i64 20, ptr %16, align 8, !tbaa !9
  br label %69

58:                                               ; preds = %41
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.arm_2d_region_t, ptr %59, i32 0, i32 1
  %61 = getelementptr inbounds %struct.arm_2d_size_t, ptr %60, i32 0, i32 0
  %62 = load i16, ptr %61, align 2, !tbaa !16
  %63 = sext i16 %62 to i64
  store i64 %63, ptr %15, align 8, !tbaa !9
  %64 = load ptr, ptr %9, 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 1
  %67 = load i16, ptr %66, align 2, !tbaa !16
  %68 = sext i16 %67 to i64
  store i64 %68, ptr %16, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %58, %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %70 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 0
  %71 = getelementptr inbounds %struct.arm_2d_location_t, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.arm_2d_region_t, ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds %struct.arm_2d_location_t, ptr %73, i32 0, i32 0
  %75 = load i16, ptr %74, align 2, !tbaa !16
  %76 = sext i16 %75 to i32
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.arm_2d_region_t, ptr %77, i32 0, i32 1
  %79 = getelementptr inbounds %struct.arm_2d_size_t, ptr %78, i32 0, i32 0
  %80 = load i16, ptr %79, align 2, !tbaa !16
  %81 = sext i16 %80 to i32
  %82 = load i64, ptr %15, align 8, !tbaa !9
  %83 = trunc i64 %82 to i16
  %84 = sext i16 %83 to i32
  %85 = sub nsw i32 %81, %84
  %86 = sdiv i32 %85, 2
  %87 = add nsw i32 %76, %86
  %88 = trunc i32 %87 to i16
  store i16 %88, ptr %71, align 2, !tbaa !17
  %89 = getelementptr inbounds %struct.arm_2d_location_t, ptr %70, i32 0, i32 1
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.arm_2d_region_t, ptr %90, i32 0, i32 0
  %92 = getelementptr inbounds %struct.arm_2d_location_t, ptr %91, i32 0, i32 1
  %93 = load i16, ptr %92, align 2, !tbaa !16
  %94 = sext i16 %93 to i32
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.arm_2d_region_t, ptr %95, i32 0, i32 1
  %97 = getelementptr inbounds %struct.arm_2d_size_t, ptr %96, i32 0, i32 1
  %98 = load i16, ptr %97, align 2, !tbaa !16
  %99 = sext i16 %98 to i32
  %100 = load i64, ptr %16, align 8, !tbaa !9
  %101 = trunc i64 %100 to i16
  %102 = sext i16 %101 to i32
  %103 = sub nsw i32 %99, %102
  %104 = sdiv i32 %103, 2
  %105 = add nsw i32 %94, %104
  %106 = trunc i32 %105 to i16
  store i16 %106, ptr %89, align 2, !tbaa !19
  %107 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 1
  %108 = getelementptr inbounds %struct.arm_2d_size_t, ptr %107, i32 0, i32 0
  %109 = load i64, ptr %15, align 8, !tbaa !9
  %110 = trunc i64 %109 to i16
  store i16 %110, ptr %108, align 2, !tbaa !20
  %111 = getelementptr inbounds %struct.arm_2d_size_t, ptr %107, i32 0, i32 1
  %112 = load i64, ptr %16, align 8, !tbaa !9
  %113 = trunc i64 %112 to i16
  store i16 %113, ptr %111, align 2, !tbaa !22
  %114 = load i8, ptr %11, align 1, !tbaa !11, !range !23, !noundef !24
  %115 = trunc i8 %114 to i1
  br i1 %115, label %116, label %156

116:                                              ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %117 = call i64 @arm_2d_helper_get_system_timestamp()
  store i64 %117, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %118 = load i64, ptr %19, align 8, !tbaa !9
  %119 = load i64, ptr @s_lLastTime, align 8, !tbaa !9
  %120 = sub nsw i64 %118, %119
  %121 = trunc i64 %120 to i32
  store i32 %121, ptr %20, align 4, !tbaa !25
  %122 = load i64, ptr %19, align 8, !tbaa !9
  %123 = load i64, ptr @s_lWavingTime, align 8, !tbaa !9
  %124 = icmp sge i64 %122, %123
  br i1 %124, label %125, label %129

125:                                              ; preds = %116
  %126 = load i64, ptr %19, align 8, !tbaa !9
  %127 = call i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef 3000)
  %128 = add nsw i64 %126, %127
  store i64 %128, ptr @s_lWavingTime, align 8, !tbaa !9
  store volatile i8 1, ptr @s_bWaving, align 1, !tbaa !11
  br label %129

129:                                              ; preds = %125, %116
  %130 = load i32, ptr %20, align 4, !tbaa !25
  %131 = load i32, ptr @s_wUnit, align 4, !tbaa !25
  %132 = icmp sge i32 %130, %131
  br i1 %132, label %133, label %155

133:                                              ; preds = %129
  %134 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %134, ptr @s_lLastTime, align 8, !tbaa !9
  %135 = load volatile i8, ptr @s_bWaving, align 1, !tbaa !11, !range !23, !noundef !24
  %136 = trunc i8 %135 to i1
  br i1 %136, label %137, label %154

137:                                              ; preds = %133
  %138 = load i16, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !13
  %139 = sext i16 %138 to i32
  %140 = add nsw i32 %139, 2
  %141 = trunc i32 %140 to i16
  store i16 %141, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !13
  %142 = load i16, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !13
  %143 = sext i16 %142 to i32
  %144 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 1
  %145 = getelementptr inbounds %struct.arm_2d_size_t, ptr %144, i32 0, i32 0
  %146 = load i16, ptr %145, align 2, !tbaa !16
  %147 = sext i16 %146 to i32
  %148 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileWaveLineMask, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !16
  %149 = sext i16 %148 to i32
  %150 = add nsw i32 %147, %149
  %151 = icmp sge i32 %143, %150
  br i1 %151, label %152, label %153

152:                                              ; preds = %137
  store i16 0, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !13
  store volatile i8 0, ptr @s_bWaving, align 1, !tbaa !11
  br label %153

153:                                              ; preds = %152, %137
  br label %154

154:                                              ; preds = %153, %133
  br label %155

155:                                              ; preds = %154, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %156

156:                                              ; preds = %155, %69
  %157 = load ptr, ptr %8, align 8, !tbaa !5
  %158 = call zeroext i1 @arm_2d_helper_pfb_is_region_being_drawing(ptr noundef %157, ptr noundef %18, ptr noundef null)
  br i1 %158, label %160, label %159

159:                                              ; preds = %156
  store i32 1, ptr %21, align 4
  br label %236

160:                                              ; preds = %156
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = load i16, ptr %14, align 2, !tbaa !13
  call void @arm_2d_helper_draw_box(ptr noundef %161, ptr noundef %18, i16 noundef signext 1, i16 noundef zeroext %162, i8 noundef zeroext -1)
  %163 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %164 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 1
  %165 = getelementptr inbounds %struct.arm_2d_size_t, ptr %164, i32 0, i32 1
  %166 = load i16, ptr %165, align 2, !tbaa !16
  %167 = sext i16 %166 to i32
  %168 = sub nsw i32 %167, 2
  %169 = trunc i32 %168 to i16
  store i16 %169, ptr %165, align 2, !tbaa !16
  %170 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 1
  %171 = getelementptr inbounds %struct.arm_2d_size_t, ptr %170, i32 0, i32 0
  %172 = load i16, ptr %171, align 2, !tbaa !16
  %173 = sext i16 %172 to i32
  %174 = sub nsw i32 %173, 2
  %175 = trunc i32 %174 to i16
  store i16 %175, ptr %171, align 2, !tbaa !16
  %176 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 0
  %177 = getelementptr inbounds %struct.arm_2d_location_t, ptr %176, i32 0, i32 0
  %178 = load i16, ptr %177, align 2, !tbaa !16
  %179 = sext i16 %178 to i32
  %180 = add nsw i32 %179, 1
  %181 = trunc i32 %180 to i16
  store i16 %181, ptr %177, align 2, !tbaa !16
  %182 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 0
  %183 = getelementptr inbounds %struct.arm_2d_location_t, ptr %182, i32 0, i32 1
  %184 = load i16, ptr %183, align 2, !tbaa !16
  %185 = sext i16 %184 to i32
  %186 = add nsw i32 %185, 1
  %187 = trunc i32 %186 to i16
  store i16 %187, ptr %183, align 2, !tbaa !16
  %188 = load i64, ptr %10, align 8, !tbaa !9
  %189 = icmp sge i64 %188, 0
  br i1 %189, label %190, label %203

190:                                              ; preds = %160
  %191 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 1
  %192 = getelementptr inbounds %struct.arm_2d_size_t, ptr %191, i32 0, i32 0
  %193 = load i16, ptr %192, align 2, !tbaa !16
  %194 = sext i16 %193 to i32
  %195 = load i64, ptr %10, align 8, !tbaa !9
  %196 = trunc i64 %195 to i16
  %197 = sext i16 %196 to i32
  %198 = mul nsw i32 %194, %197
  %199 = sdiv i32 %198, 1000
  %200 = trunc i32 %199 to i16
  %201 = getelementptr inbounds %struct.arm_2d_region_t, ptr %18, i32 0, i32 1
  %202 = getelementptr inbounds %struct.arm_2d_size_t, ptr %201, i32 0, i32 0
  store i16 %200, ptr %202, align 2, !tbaa !16
  br label %203

203:                                              ; preds = %190, %160
  %204 = load ptr, ptr %8, align 8, !tbaa !5
  %205 = load i16, ptr %12, align 2, !tbaa !13
  %206 = zext i16 %205 to i64
  %207 = call i32 @arm_2dp_rgb16_fill_colour(ptr noundef null, ptr noundef %204, ptr noundef %18, i64 noundef %206)
  %208 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  br label %209

209:                                              ; preds = %203
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %210 = getelementptr inbounds %struct.arm_2d_region_t, ptr %22, i32 0, i32 0
  %211 = getelementptr inbounds %struct.arm_2d_location_t, ptr %210, i32 0, i32 0
  %212 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileWaveLineMask, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !16
  %213 = sext i16 %212 to i32
  %214 = sub nsw i32 0, %213
  %215 = load i16, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !13
  %216 = sext i16 %215 to i32
  %217 = add nsw i32 %214, %216
  %218 = trunc i32 %217 to i16
  store i16 %218, ptr %211, align 2, !tbaa !17
  %219 = getelementptr inbounds %struct.arm_2d_location_t, ptr %210, i32 0, i32 1
  store i16 0, ptr %219, align 2, !tbaa !19
  %220 = getelementptr inbounds %struct.arm_2d_region_t, ptr %22, i32 0, i32 1
  %221 = getelementptr inbounds %struct.arm_2d_size_t, ptr %220, i32 0, i32 0
  %222 = load i16, ptr getelementptr inbounds (%struct.arm_2d_region_t, ptr getelementptr inbounds (%struct.arm_2d_tile_t, ptr @c_tileWaveLineMask, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !16
  store i16 %222, ptr %221, align 2, !tbaa !20
  %223 = getelementptr inbounds %struct.arm_2d_size_t, ptr %220, i32 0, i32 1
  %224 = load i64, ptr %16, align 8, !tbaa !9
  %225 = trunc i64 %224 to i16
  store i16 %225, ptr %223, align 2, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #7
  %226 = load ptr, ptr %8, align 8, !tbaa !5
  %227 = call ptr @arm_2d_tile_generate_child(ptr noundef %226, ptr noundef %18, ptr noundef %23, i1 noundef zeroext false)
  %228 = load i16, ptr %13, align 2, !tbaa !13
  store i16 %228, ptr %25, align 2, !tbaa !16
  %229 = load i16, ptr %25, align 2, !tbaa !16
  store i16 %229, ptr %24, align 2, !tbaa !16
  %230 = getelementptr inbounds %union.arm_2d_color_rgb565_t, ptr %24, i32 0, i32 0
  %231 = load i16, ptr %230, align 2
  %232 = call i32 @arm_2dp_rgb565_fill_colour_with_horizontal_line_mask(ptr noundef null, ptr noundef %23, ptr noundef %22, ptr noundef @c_tileWaveLineMask, i16 %231)
  %233 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %234

234:                                              ; preds = %209
  br label %235

235:                                              ; preds = %234
  store i32 0, ptr %21, align 4
  br label %236

236:                                              ; preds = %235, %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  %237 = load i32, ptr %21, align 4
  switch i32 %237, label %239 [
    i32 0, label %238
    i32 1, label %238
  ]

238:                                              ; preds = %236, %236
  ret void

239:                                              ; preds = %236
  unreachable
}

declare ptr @arm_2d_get_default_frame_buffer() #0

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

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

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

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

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) #0

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

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

declare i32 @arm_2dp_rgb565_fill_colour_with_horizontal_line_mask(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16) #0

attributes #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 = { 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 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 = !{!"_Bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{i64 0, i64 2, !13, i64 2, i64 2, !13}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !14, i64 0}
!18 = !{!"arm_2d_location_t", !14, i64 0, !14, i64 2}
!19 = !{!18, !14, i64 2}
!20 = !{!21, !14, i64 0}
!21 = !{!"arm_2d_size_t", !14, i64 0, !14, i64 2}
!22 = !{!21, !14, 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 local_unnamed_addr global i64, section ".bss.noinit", align 8
@s_wUnit = external hidden local_unnamed_addr global i32, section ".bss.noinit", align 4
@s_lWavingTime = external hidden local_unnamed_addr global i64, section ".bss.noinit", align 8
@__progress_bar_flowing_show.s_iOffset = external hidden local_unnamed_addr global i16, align 2
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__.__progress_bar_flowing_show = external hidden unnamed_addr constant [132 x i8], align 1
@s_bWaving = external hidden global i8, align 1
@c_tileWaveLineMask = external constant %struct.arm_2d_tile_t, align 8

declare i64 @arm_2d_helper_get_system_timestamp() local_unnamed_addr #0

declare i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @__progress_bar_flowing_show(ptr noundef %0, ptr noundef readonly %1, i64 noundef %2, i1 noundef zeroext %3, i16 noundef zeroext %4, i16 noundef zeroext %5, i16 noundef zeroext %6) local_unnamed_addr #1 {
  %.sroa.0 = alloca %struct.arm_2d_location_t, align 4
  %.sroa.5 = alloca i16, align 2
  %8 = alloca %struct.arm_2d_region_t, align 8
  %9 = alloca %struct.arm_2d_region_t, align 2
  %10 = alloca %struct.arm_2d_tile_t, align 8
  %11 = icmp eq ptr %0, inttoptr (i64 -1 to ptr)
  %.032.sroa.gep38 = getelementptr inbounds i8, ptr %1, i64 4
  %.pn.sroa.gep = getelementptr inbounds i8, ptr %1, i64 6
  br i1 %11, label %12, label %14

12:                                               ; preds = %7
  %13 = tail call ptr @arm_2d_get_default_frame_buffer() #4
  br label %14

14:                                               ; preds = %12, %7
  %.0 = phi ptr [ %13, %12 ], [ %0, %7 ]
  %.not = icmp eq ptr %.0, null
  br i1 %.not, label %15, label %16

15:                                               ; preds = %14
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 94, ptr noundef nonnull @__PRETTY_FUNCTION__.__progress_bar_flowing_show) #5
  unreachable

16:                                               ; preds = %14
  %17 = icmp sgt i64 %2, 1000
  %spec.store.select = select i1 %17, 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
  %18 = getelementptr inbounds i8, ptr %.0, i64 8
  %.sroa_idx = getelementptr inbounds i8, ptr %.0, i64 10
  %19 = load i16, ptr %.sroa_idx, align 2
  %20 = load i32, ptr %18, align 4
  store i16 %19, ptr %.sroa.5, align 2
  %21 = icmp eq ptr %1, null
  br i1 %21, label %22, label %27

22:                                               ; preds = %16
  %sext = shl i32 %20, 16
  %23 = ashr exact i32 %sext, 16
  %24 = mul nsw i32 %23, 3
  %25 = lshr i32 %24, 3
  %26 = trunc i32 %25 to i16
  %sext55 = shl i32 %25, 16
  %.pre53 = ashr exact i32 %sext55, 16
  br label %31

27:                                               ; preds = %16
  %28 = load i16, ptr %.032.sroa.gep38, align 2, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %1, i64 6
  %30 = load i16, ptr %29, align 2, !tbaa !5
  %.pre = sext i16 %28 to i32
  br label %31

31:                                               ; preds = %27, %22
  %.pre-phi54 = phi i32 [ %.pre, %27 ], [ %.pre53, %22 ]
  %.pre-phi = phi i32 [ %.pre, %27 ], [ %23, %22 ]
  %.034 = phi i16 [ %30, %27 ], [ 20, %22 ]
  %32 = phi i16 [ %28, %27 ], [ %26, %22 ]
  %.pn.sroa.phi = phi ptr [ %.pn.sroa.gep, %27 ], [ %.sroa.5, %22 ]
  %.pn = phi ptr [ %1, %27 ], [ %.sroa.0, %22 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %33 = load i16, ptr %.pn.sroa.phi, align 2, !tbaa !5
  %34 = sext i16 %33 to i32
  %35 = sext i16 %.034 to i32
  %36 = load <2 x i16>, ptr %.pn, align 2, !tbaa !5
  %37 = insertelement <2 x i32> poison, i32 %.pre-phi, i64 0
  %38 = insertelement <2 x i32> %37, i32 %34, i64 1
  %39 = insertelement <2 x i32> poison, i32 %.pre-phi54, i64 0
  %40 = insertelement <2 x i32> %39, i32 %35, i64 1
  %41 = sub nsw <2 x i32> %38, %40
  %42 = sdiv <2 x i32> %41, <i32 2, i32 2>
  %43 = trunc <2 x i32> %42 to <2 x i16>
  %44 = add <2 x i16> %36, %43
  store <2 x i16> %44, ptr %8, align 8, !tbaa !8
  %45 = getelementptr inbounds i8, ptr %8, i64 4
  store i16 %32, ptr %45, align 4, !tbaa !10
  %46 = getelementptr inbounds i8, ptr %8, i64 6
  store i16 %.034, ptr %46, align 2, !tbaa !12
  br i1 %3, label %47, label %69

47:                                               ; preds = %31
  %48 = tail call i64 @arm_2d_helper_get_system_timestamp() #4
  %49 = load i64, ptr @s_lLastTime, align 8, !tbaa !13
  %50 = sub nsw i64 %48, %49
  %51 = trunc i64 %50 to i32
  %52 = load i64, ptr @s_lWavingTime, align 8, !tbaa !13
  %.not47 = icmp slt i64 %48, %52
  br i1 %.not47, label %56, label %53

53:                                               ; preds = %47
  %54 = tail call i64 @arm_2d_helper_convert_ms_to_ticks(i32 noundef 3000) #4
  %55 = add nsw i64 %54, %48
  store i64 %55, ptr @s_lWavingTime, align 8, !tbaa !13
  store volatile i8 1, ptr @s_bWaving, align 1, !tbaa !15
  br label %56

56:                                               ; preds = %53, %47
  %57 = load i32, ptr @s_wUnit, align 4, !tbaa !17
  %.not48 = icmp sgt i32 %57, %51
  br i1 %.not48, label %69, label %58

58:                                               ; preds = %56
  store i64 %48, ptr @s_lLastTime, align 8, !tbaa !13
  %59 = load volatile i8, ptr @s_bWaving, align 1, !tbaa !15, !range !19, !noundef !20
  %60 = trunc nuw i8 %59 to i1
  br i1 %60, label %61, label %69

61:                                               ; preds = %58
  %62 = load i16, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !8
  %63 = add i16 %62, 2
  store i16 %63, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !8
  %64 = sext i16 %63 to i32
  %65 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileWaveLineMask, i64 8), align 8, !tbaa !5
  %66 = sext i16 %65 to i32
  %67 = add nsw i32 %.pre-phi54, %66
  %.not49 = icmp sgt i32 %67, %64
  br i1 %.not49, label %69, label %68

68:                                               ; preds = %61
  store i16 0, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !8
  store volatile i8 0, ptr @s_bWaving, align 1, !tbaa !15
  br label %69

69:                                               ; preds = %56, %61, %68, %58, %31
  %70 = call zeroext i1 @arm_2d_helper_pfb_is_region_being_drawing(ptr noundef nonnull %.0, ptr noundef nonnull %8, ptr noundef null) #4
  br i1 %70, label %71, label %96

71:                                               ; preds = %69
  call void @arm_2d_helper_draw_box(ptr noundef nonnull %.0, ptr noundef nonnull %8, i16 noundef signext 1, i16 noundef zeroext %6, i8 noundef zeroext -1) #4
  %72 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  %73 = load <4 x i16>, ptr %8, align 8, !tbaa !5
  %74 = add <4 x i16> %73, <i16 1, i16 1, i16 -2, i16 -2>
  store <4 x i16> %74, ptr %8, align 8, !tbaa !5
  %75 = icmp sgt i64 %spec.store.select, -1
  br i1 %75, label %76, label %83

76:                                               ; preds = %71
  %77 = extractelement <4 x i16> %74, i64 2
  %78 = sext i16 %77 to i32
  %79 = trunc i64 %spec.store.select to i32
  %80 = mul nsw i32 %78, %79
  %81 = sdiv i32 %80, 1000
  %82 = trunc i32 %81 to i16
  store i16 %82, ptr %45, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %76, %71
  %84 = zext i16 %4 to i64
  %85 = call i32 @arm_2dp_rgb16_fill_colour(ptr noundef null, ptr noundef nonnull %.0, ptr noundef nonnull %8, i64 noundef %84) #4
  %86 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %87 = load i16, ptr getelementptr inbounds (i8, ptr @c_tileWaveLineMask, i64 8), align 8, !tbaa !5
  %88 = load i16, ptr @__progress_bar_flowing_show.s_iOffset, align 2, !tbaa !8
  %89 = sub i16 %88, %87
  store i16 %89, ptr %9, align 2, !tbaa !21
  %90 = getelementptr inbounds i8, ptr %9, i64 2
  store i16 0, ptr %90, align 2, !tbaa !23
  %91 = getelementptr inbounds i8, ptr %9, i64 4
  store i16 %87, ptr %91, align 2, !tbaa !10
  %92 = getelementptr inbounds i8, ptr %9, i64 6
  store i16 %.034, ptr %92, align 2, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #4
  %93 = call ptr @arm_2d_tile_generate_child(ptr noundef nonnull %.0, ptr noundef nonnull %8, ptr noundef nonnull %10, i1 noundef zeroext false) #4
  %94 = call i32 @arm_2dp_rgb565_fill_colour_with_horizontal_line_mask(ptr noundef null, ptr noundef nonnull %10, ptr noundef nonnull %9, ptr noundef nonnull @c_tileWaveLineMask, i16 %5) #4
  %95 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %96

96:                                               ; preds = %69, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  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
}

declare ptr @arm_2d_get_default_frame_buffer() local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) 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

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

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

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

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

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

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

declare i32 @arm_2dp_rgb565_fill_colour_with_horizontal_line_mask(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16) local_unnamed_addr #0

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!"long", !6, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"_Bool", !6, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !6, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!22, !9, i64 0}
!22 = !{!"arm_2d_location_t", !9, i64 0, !9, i64 2}
!23 = !{!22, !9, i64 2}


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