; LLVM IR from ARM-software/Arm-2D :: Helper/Source (console_box)

; 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_a1_font_t = type { %union.anon.2, i32 }
%union.anon.2 = type { %struct.arm_2d_font_t }
%struct.arm_2d_font_t = type { %struct.arm_2d_tile_t, %struct.arm_2d_size_t, i32, ptr, ptr }
%struct.arm_2d_tile_t = type { %union.anon.3, %union.anon.14, %union.anon.15 }
%union.anon.3 = type { %struct.anon.4 }
%struct.anon.4 = type { i8, %union.arm_2d_color_info_t, %union.anon.7 }
%union.arm_2d_color_info_t = type { %struct.anon.5 }
%struct.anon.5 = type { i8 }
%union.anon.7 = type { i16 }
%union.anon.14 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon, %union.anon.1 }
%union.anon = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.1 = type { %struct.arm_2d_size_t }
%union.anon.15 = type { ptr }
%struct.arm_2d_size_t = type { i16, i16 }
%struct.console_box_t = type { %struct.anon }
%struct.anon = type { ptr, %struct.arm_2d_size_t, [4 x i8], %struct.arm_2d_byte_fifo_t, %struct.arm_2d_byte_fifo_t, %struct.anon.0, ptr, %struct.arm_2d_region_t, %struct.arm_2d_region_list_item_t, ptr, i16, i8 }
%struct.arm_2d_byte_fifo_t = type { [24 x i8] }
%struct.anon.0 = type { i16, i16, i16, i16, i16, i16, i16, i16, i16 }
%struct.arm_2d_region_list_item_t = type { ptr, [8 x i8], %struct.arm_2d_region_t, [4 x i8] }
%struct.console_box_cfg_t = type { %struct.arm_2d_size_t, ptr, ptr, i16, i16, ptr, i16, i8, ptr }

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [81 x i8], align 1
@__PRETTY_FUNCTION__.console_box_init = external hidden unnamed_addr constant [79 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@ARM_2D_FONT_6x8 = external constant %struct.arm_2d_a1_font_t, align 8

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @console_box_init(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = icmp ne ptr null, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  br label %12

11:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 95, ptr noundef @__PRETTY_FUNCTION__.console_box_init) #5
  unreachable

12:                                               ; preds = %10
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = icmp ne ptr null, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %12
  br label %17

16:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 96, ptr noundef @__PRETTY_FUNCTION__.console_box_init) #5
  unreachable

17:                                               ; preds = %15
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 152, i1 false)
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.console_box_t, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.anon, ptr %20, i32 0, i32 4
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.console_box_cfg_t, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.console_box_cfg_t, ptr %25, i32 0, i32 3
  %27 = load i16, ptr %26, align 8, !tbaa !14
  %28 = call zeroext i1 @arm_2d_byte_fifo_init(ptr noundef %21, ptr noundef %24, i16 noundef zeroext %27)
  br i1 %28, label %30, label %29

29:                                               ; preds = %17
  store i1 false, ptr %4, align 1
  br label %210

30:                                               ; preds = %17
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.console_box_t, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.anon, ptr %32, i32 0, i32 3
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.console_box_cfg_t, ptr %34, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.console_box_cfg_t, ptr %37, i32 0, i32 4
  %39 = load i16, ptr %38, align 2, !tbaa !16
  %40 = call zeroext i1 @arm_2d_byte_fifo_init(ptr noundef %33, ptr noundef %36, i16 noundef zeroext %39)
  br i1 %40, label %48, label %41

41:                                               ; preds = %30
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.console_box_t, ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds %struct.anon, ptr %43, i32 0, i32 11
  %45 = load i8, ptr %44, align 2
  %46 = and i8 %45, -2
  %47 = or i8 %46, 1
  store i8 %47, ptr %44, align 2
  br label %48

48:                                               ; preds = %41, %30
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.console_box_t, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds %struct.anon, ptr %51, i32 0, i32 6
  store ptr %49, ptr %52, align 8, !tbaa !17
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.console_box_cfg_t, ptr %53, i32 0, i32 5
  %55 = load ptr, ptr %54, align 8, !tbaa !24
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.console_box_t, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.anon, ptr %57, i32 0, i32 0
  store ptr %55, ptr %58, align 8, !tbaa !25
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.console_box_t, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.anon, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !25
  %63 = icmp eq ptr null, %62
  br i1 %63, label %64, label %68

64:                                               ; preds = %48
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.console_box_t, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.anon, ptr %66, i32 0, i32 0
  store ptr @ARM_2D_FONT_6x8, ptr %67, align 8, !tbaa !25
  br label %68

68:                                               ; preds = %64, %48
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.console_box_t, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds %struct.anon, ptr %70, i32 0, i32 1
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.console_box_cfg_t, ptr %72, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %71, ptr align 8 %73, i64 4, i1 false), !tbaa.struct !26
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.console_box_t, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.anon, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds %struct.arm_2d_size_t, ptr %76, i32 0, i32 1
  %78 = load i16, ptr %77, align 2, !tbaa !28
  %79 = sext i16 %78 to i32
  %80 = icmp eq i32 0, %79
  br i1 %80, label %89, label %81

81:                                               ; preds = %68
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.console_box_t, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.anon, ptr %83, i32 0, i32 1
  %85 = getelementptr inbounds %struct.arm_2d_size_t, ptr %84, i32 0, i32 0
  %86 = load i16, ptr %85, align 8, !tbaa !29
  %87 = sext i16 %86 to i32
  %88 = icmp eq i32 0, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %81, %68
  store i1 false, ptr %4, align 1
  br label %210

90:                                               ; preds = %81
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.console_box_cfg_t, ptr %91, i32 0, i32 6
  %93 = load i16, ptr %92, align 8, !tbaa !30
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.console_box_t, ptr %94, i32 0, i32 0
  %96 = getelementptr inbounds %struct.anon, ptr %95, i32 0, i32 10
  store i16 %93, ptr %96, align 8, !tbaa !31
  br label %97

97:                                               ; preds = %90
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.console_box_t, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds %struct.anon, ptr %99, i32 0, i32 1
  %101 = getelementptr inbounds %struct.arm_2d_size_t, ptr %100, i32 0, i32 0
  %102 = load i16, ptr %101, align 8, !tbaa !29
  %103 = sext i16 %102 to i32
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.console_box_t, ptr %104, i32 0, i32 0
  %106 = getelementptr inbounds %struct.anon, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !25
  %108 = getelementptr inbounds %struct.arm_2d_font_t, ptr %107, i32 0, i32 1
  %109 = getelementptr inbounds %struct.arm_2d_size_t, ptr %108, i32 0, i32 0
  %110 = load i16, ptr %109, align 8, !tbaa !32
  %111 = sext i16 %110 to i32
  %112 = sdiv i32 %103, %111
  %113 = trunc i32 %112 to i16
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.console_box_t, ptr %114, i32 0, i32 0
  %116 = getelementptr inbounds %struct.anon, ptr %115, i32 0, i32 5
  %117 = getelementptr inbounds %struct.anon.0, ptr %116, i32 0, i32 0
  store i16 %113, ptr %117, align 8, !tbaa !36
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.console_box_t, ptr %118, i32 0, i32 0
  %120 = getelementptr inbounds %struct.anon, ptr %119, i32 0, i32 1
  %121 = getelementptr inbounds %struct.arm_2d_size_t, ptr %120, i32 0, i32 1
  %122 = load i16, ptr %121, align 2, !tbaa !28
  %123 = sext i16 %122 to i32
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.console_box_t, ptr %124, i32 0, i32 0
  %126 = getelementptr inbounds %struct.anon, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !25
  %128 = getelementptr inbounds %struct.arm_2d_font_t, ptr %127, i32 0, i32 1
  %129 = getelementptr inbounds %struct.arm_2d_size_t, ptr %128, i32 0, i32 1
  %130 = load i16, ptr %129, align 2, !tbaa !37
  %131 = sext i16 %130 to i32
  %132 = sdiv i32 %123, %131
  %133 = trunc i32 %132 to i16
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.console_box_t, ptr %134, i32 0, i32 0
  %136 = getelementptr inbounds %struct.anon, ptr %135, i32 0, i32 5
  %137 = getelementptr inbounds %struct.anon.0, ptr %136, i32 0, i32 1
  store i16 %133, ptr %137, align 2, !tbaa !38
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.console_box_t, ptr %138, i32 0, i32 0
  %140 = getelementptr inbounds %struct.anon, ptr %139, i32 0, i32 5
  %141 = getelementptr inbounds %struct.anon.0, ptr %140, i32 0, i32 0
  %142 = load i16, ptr %141, align 8, !tbaa !36
  %143 = zext i16 %142 to i32
  %144 = icmp eq i32 0, %143
  br i1 %144, label %153, label %145

145:                                              ; preds = %97
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.console_box_t, ptr %146, i32 0, i32 0
  %148 = getelementptr inbounds %struct.anon, ptr %147, i32 0, i32 5
  %149 = getelementptr inbounds %struct.anon.0, ptr %148, i32 0, i32 1
  %150 = load i16, ptr %149, align 2, !tbaa !38
  %151 = zext i16 %150 to i32
  %152 = icmp eq i32 0, %151
  br i1 %152, label %153, label %154

153:                                              ; preds = %145, %97
  store i1 false, ptr %4, align 1
  br label %210

154:                                              ; preds = %145
  br label %155

155:                                              ; preds = %154
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.console_box_cfg_t, ptr %156, i32 0, i32 7
  %158 = load i8, ptr %157, align 2, !tbaa !39, !range !40, !noundef !41
  %159 = trunc i8 %158 to i1
  br i1 %159, label %160, label %209

160:                                              ; preds = %155
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.console_box_t, ptr %161, i32 0, i32 0
  %163 = getelementptr inbounds %struct.anon, ptr %162, i32 0, i32 8
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.console_box_t, ptr %164, i32 0, i32 0
  %166 = getelementptr inbounds %struct.anon, ptr %165, i32 0, i32 6
  %167 = load ptr, ptr %166, align 8, !tbaa !17
  %168 = call ptr @arm_2d_scene_player_dynamic_dirty_region_init(ptr noundef %163, ptr noundef %167)
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.console_box_t, ptr %169, i32 0, i32 0
  %171 = getelementptr inbounds %struct.anon, ptr %170, i32 0, i32 6
  %172 = load ptr, ptr %171, align 8, !tbaa !17
  %173 = icmp ne ptr null, %172
  br i1 %173, label %174, label %181

174:                                              ; preds = %160
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.console_box_t, ptr %175, i32 0, i32 0
  %177 = getelementptr inbounds %struct.anon, ptr %176, i32 0, i32 11
  %178 = load i8, ptr %177, align 2
  %179 = and i8 %178, -3
  %180 = or i8 %179, 2
  store i8 %180, ptr %177, align 2
  br label %208

181:                                              ; preds = %160
  %182 = load ptr, ptr %7, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.console_box_cfg_t, ptr %182, i32 0, i32 8
  %184 = load ptr, ptr %183, align 8, !tbaa !42
  %185 = icmp ne ptr null, %184
  br i1 %185, label %186, label %207

186:                                              ; preds = %181
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.console_box_t, ptr %187, i32 0, i32 0
  %189 = getelementptr inbounds %struct.anon, ptr %188, i32 0, i32 11
  %190 = load i8, ptr %189, align 2
  %191 = and i8 %190, -3
  %192 = or i8 %191, 2
  store i8 %192, ptr %189, align 2
  %193 = load ptr, ptr %7, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.console_box_cfg_t, ptr %193, i32 0, i32 8
  %195 = load ptr, ptr %194, align 8, !tbaa !42
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.console_box_t, ptr %196, i32 0, i32 0
  %198 = getelementptr inbounds %struct.anon, ptr %197, i32 0, i32 9
  store ptr %195, ptr %198, align 8, !tbaa !43
  %199 = load ptr, ptr %5, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.console_box_t, ptr %199, i32 0, i32 0
  %201 = getelementptr inbounds %struct.anon, ptr %200, i32 0, i32 9
  %202 = load ptr, ptr %201, align 8, !tbaa !43
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.console_box_t, ptr %203, i32 0, i32 0
  %205 = getelementptr inbounds %struct.anon, ptr %204, i32 0, i32 8
  %206 = call zeroext i1 @arm_2d_helper_pfb_append_dirty_regions_to_list(ptr noundef %202, ptr noundef %205, i64 noundef 1)
  br label %207

207:                                              ; preds = %186, %181
  br label %208

208:                                              ; preds = %207, %174
  br label %209

209:                                              ; preds = %208, %155
  store i1 true, ptr %4, align 1
  br label %210

210:                                              ; preds = %209, %153, %89, %29
  %211 = load i1, ptr %4, align 1
  ret i1 %211
}

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

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

declare zeroext i1 @arm_2d_byte_fifo_init(ptr noundef, ptr noundef, i16 noundef zeroext) #3

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

declare ptr @arm_2d_scene_player_dynamic_dirty_region_init(ptr noundef, ptr noundef) #3

declare zeroext i1 @arm_2d_helper_pfb_append_dirty_regions_to_list(ptr noundef, ptr noundef, i64 noundef) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"console_box_cfg_t", !11, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !12, i64 26, !6, i64 32, !12, i64 40, !13, i64 42, !6, i64 48}
!11 = !{!"arm_2d_size_t", !12, i64 0, !12, i64 2}
!12 = !{!"short", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !12, i64 24}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !12, i64 26}
!17 = !{!18, !6, i64 88}
!18 = !{!"console_box_t", !19, i64 0}
!19 = !{!"", !6, i64 0, !11, i64 8, !20, i64 16, !20, i64 40, !21, i64 64, !6, i64 88, !22, i64 96, !23, i64 104, !6, i64 136, !12, i64 144, !7, i64 146, !7, i64 146, !7, i64 146, !7, i64 146, !7, i64 146}
!20 = !{!"arm_2d_byte_fifo_t", !7, i64 0}
!21 = !{!"", !12, i64 0, !12, i64 2, !12, i64 4, !12, i64 6, !12, i64 8, !12, i64 10, !12, i64 12, !12, i64 14, !12, i64 16}
!22 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!23 = !{!"arm_2d_region_list_item_t", !6, i64 0, !7, i64 8, !22, i64 16, !7, i64 24}
!24 = !{!10, !6, i64 32}
!25 = !{!18, !6, i64 0}
!26 = !{i64 0, i64 2, !27, i64 2, i64 2, !27}
!27 = !{!12, !12, i64 0}
!28 = !{!18, !12, i64 10}
!29 = !{!18, !12, i64 8}
!30 = !{!10, !12, i64 40}
!31 = !{!18, !12, i64 144}
!32 = !{!33, !12, i64 24}
!33 = !{!"arm_2d_font_t", !34, i64 0, !11, i64 24, !35, i64 28, !6, i64 32, !6, i64 40}
!34 = !{!"arm_2d_tile_t", !7, i64 0, !7, i64 4, !7, i64 16}
!35 = !{!"int", !7, i64 0}
!36 = !{!18, !12, i64 64}
!37 = !{!33, !12, i64 26}
!38 = !{!18, !12, i64 66}
!39 = !{!10, !13, i64 42}
!40 = !{i8 0, i8 2}
!41 = !{}
!42 = !{!10, !6, i64 48}
!43 = !{!18, !6, i64 136}


; 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_a1_font_t = type { %union.anon.2, i32 }
%union.anon.2 = type { %struct.arm_2d_font_t }
%struct.arm_2d_font_t = type { %struct.arm_2d_tile_t, %struct.arm_2d_size_t, i32, ptr, ptr }
%struct.arm_2d_tile_t = type { %union.anon.3, %union.anon.14, %union.anon.15 }
%union.anon.3 = type { %struct.anon.4 }
%struct.anon.4 = type { i8, %union.arm_2d_color_info_t, %union.anon.7 }
%union.arm_2d_color_info_t = type { %struct.anon.5 }
%struct.anon.5 = type { i8 }
%union.anon.7 = type { i16 }
%union.anon.14 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon, %union.anon.1 }
%union.anon = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.1 = type { %struct.arm_2d_size_t }
%union.anon.15 = type { ptr }
%struct.arm_2d_size_t = type { i16, i16 }

@ARM_2D_FONT_6x8 = external constant %struct.arm_2d_a1_font_t, align 8

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @console_box_init(ptr noundef nonnull %0, ptr noundef %1, ptr nocapture noundef nonnull readonly %2) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(152) %0, i8 0, i64 152, i1 false)
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = getelementptr inbounds i8, ptr %2, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %2, i64 24
  %8 = load i16, ptr %7, align 8, !tbaa !13
  %9 = tail call zeroext i1 @arm_2d_byte_fifo_init(ptr noundef nonnull %4, ptr noundef %6, i16 noundef zeroext %8) #3
  br i1 %9, label %10, label %74

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = getelementptr inbounds i8, ptr %2, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %2, i64 26
  %15 = load i16, ptr %14, align 2, !tbaa !15
  %16 = tail call zeroext i1 @arm_2d_byte_fifo_init(ptr noundef nonnull %11, ptr noundef %13, i16 noundef zeroext %15) #3
  br i1 %16, label %21, label %17

17:                                               ; preds = %10
  %18 = getelementptr inbounds i8, ptr %0, i64 146
  %19 = load i8, ptr %18, align 2
  %20 = or i8 %19, 1
  store i8 %20, ptr %18, align 2
  br label %21

21:                                               ; preds = %17, %10
  %22 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %1, ptr %22, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %2, i64 32
  %24 = load ptr, ptr %23, align 8, !tbaa !23
  %25 = icmp eq ptr %24, null
  %spec.select = select i1 %25, ptr @ARM_2D_FONT_6x8, ptr %24
  store ptr %spec.select, ptr %0, align 8, !tbaa !24
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load i32, ptr %2, align 8
  store i32 %27, ptr %26, align 8
  %28 = icmp ult i32 %27, 65536
  %29 = and i32 %27, 65535
  %30 = icmp eq i32 %29, 0
  %or.cond46 = or i1 %28, %30
  br i1 %or.cond46, label %74, label %31

31:                                               ; preds = %21
  %32 = getelementptr inbounds i8, ptr %2, i64 40
  %33 = load i16, ptr %32, align 8, !tbaa !25
  %34 = getelementptr inbounds i8, ptr %0, i64 144
  store i16 %33, ptr %34, align 8, !tbaa !26
  %sext = shl i32 %27, 16
  %35 = ashr exact i32 %sext, 16
  %36 = getelementptr inbounds i8, ptr %spec.select, i64 24
  %37 = load i16, ptr %36, align 8, !tbaa !27
  %38 = sext i16 %37 to i32
  %39 = sdiv i32 %35, %38
  %40 = trunc i32 %39 to i16
  %41 = getelementptr inbounds i8, ptr %0, i64 64
  store i16 %40, ptr %41, align 8, !tbaa !31
  %42 = ashr i32 %27, 16
  %43 = getelementptr inbounds i8, ptr %spec.select, i64 26
  %44 = load i16, ptr %43, align 2, !tbaa !32
  %45 = sext i16 %44 to i32
  %46 = sdiv i32 %42, %45
  %47 = trunc i32 %46 to i16
  %48 = getelementptr inbounds i8, ptr %0, i64 66
  store i16 %47, ptr %48, align 2, !tbaa !33
  %49 = icmp eq i16 %40, 0
  %50 = and i32 %46, 65535
  %51 = icmp eq i32 %50, 0
  %or.cond = or i1 %49, %51
  br i1 %or.cond, label %74, label %52

52:                                               ; preds = %31
  %53 = getelementptr inbounds i8, ptr %2, i64 42
  %54 = load i8, ptr %53, align 2, !tbaa !34, !range !35, !noundef !36
  %55 = trunc nuw i8 %54 to i1
  br i1 %55, label %56, label %74

56:                                               ; preds = %52
  %57 = getelementptr inbounds i8, ptr %0, i64 104
  %58 = tail call ptr @arm_2d_scene_player_dynamic_dirty_region_init(ptr noundef nonnull %57, ptr noundef %1) #3
  %59 = load ptr, ptr %22, align 8, !tbaa !16
  %.not = icmp eq ptr %59, null
  br i1 %.not, label %64, label %60

60:                                               ; preds = %56
  %61 = getelementptr inbounds i8, ptr %0, i64 146
  %62 = load i8, ptr %61, align 2
  %63 = or i8 %62, 2
  store i8 %63, ptr %61, align 2
  br label %74

64:                                               ; preds = %56
  %65 = getelementptr inbounds i8, ptr %2, i64 48
  %66 = load ptr, ptr %65, align 8, !tbaa !37
  %.not42 = icmp eq ptr %66, null
  br i1 %.not42, label %74, label %67

67:                                               ; preds = %64
  %68 = getelementptr inbounds i8, ptr %0, i64 146
  %69 = load i8, ptr %68, align 2
  %70 = or i8 %69, 2
  store i8 %70, ptr %68, align 2
  %71 = load ptr, ptr %65, align 8, !tbaa !37
  %72 = getelementptr inbounds i8, ptr %0, i64 136
  store ptr %71, ptr %72, align 8, !tbaa !38
  %73 = tail call zeroext i1 @arm_2d_helper_pfb_append_dirty_regions_to_list(ptr noundef %71, ptr noundef nonnull %57, i64 noundef 1) #3
  br label %74

74:                                               ; preds = %52, %64, %67, %60, %31, %21, %3
  %.0 = phi i1 [ false, %3 ], [ false, %21 ], [ false, %31 ], [ true, %60 ], [ true, %67 ], [ true, %64 ], [ true, %52 ]
  ret i1 %.0
}

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

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

declare ptr @arm_2d_scene_player_dynamic_dirty_region_init(ptr noundef, ptr noundef) local_unnamed_addr #2

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

!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, !11, i64 16}
!6 = !{!"console_box_cfg_t", !7, i64 0, !11, i64 8, !11, i64 16, !8, i64 24, !8, i64 26, !11, i64 32, !8, i64 40, !12, i64 42, !11, i64 48}
!7 = !{!"arm_2d_size_t", !8, i64 0, !8, i64 2}
!8 = !{!"short", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_Bool", !9, i64 0}
!13 = !{!6, !8, i64 24}
!14 = !{!6, !11, i64 8}
!15 = !{!6, !8, i64 26}
!16 = !{!17, !11, i64 88}
!17 = !{!"console_box_t", !18, i64 0}
!18 = !{!"", !11, i64 0, !7, i64 8, !19, i64 16, !19, i64 40, !20, i64 64, !11, i64 88, !21, i64 96, !22, i64 104, !11, i64 136, !8, i64 144, !9, i64 146, !9, i64 146, !9, i64 146, !9, i64 146, !9, i64 146}
!19 = !{!"arm_2d_byte_fifo_t", !9, i64 0}
!20 = !{!"", !8, i64 0, !8, i64 2, !8, i64 4, !8, i64 6, !8, i64 8, !8, i64 10, !8, i64 12, !8, i64 14, !8, i64 16}
!21 = !{!"arm_2d_region_t", !9, i64 0, !9, i64 4}
!22 = !{!"arm_2d_region_list_item_t", !11, i64 0, !9, i64 8, !21, i64 16, !9, i64 24}
!23 = !{!6, !11, i64 32}
!24 = !{!17, !11, i64 0}
!25 = !{!6, !8, i64 40}
!26 = !{!17, !8, i64 144}
!27 = !{!28, !8, i64 24}
!28 = !{!"arm_2d_font_t", !29, i64 0, !7, i64 24, !30, i64 28, !11, i64 32, !11, i64 40}
!29 = !{!"arm_2d_tile_t", !9, i64 0, !9, i64 4, !9, i64 16}
!30 = !{!"int", !9, i64 0}
!31 = !{!17, !8, i64 64}
!32 = !{!28, !8, i64 26}
!33 = !{!17, !8, i64 66}
!34 = !{!6, !12, i64 42}
!35 = !{i8 0, i8 2}
!36 = !{}
!37 = !{!6, !11, i64 48}
!38 = !{!17, !11, i64 136}


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