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

; 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.anon.13 = type { %struct.arm_2d_region_t, %struct.arm_2d_region_t, %struct.arm_2d_location_t, %struct.anon.14, ptr, i32, i32, i8, i8, %struct.anon.15, %struct.anon.16, %struct.anon.17, %struct.arm_2d_scratch_mem_t, %struct.arm_2d_region_t, ptr }
%struct.arm_2d_location_t = type { i16, i16 }
%struct.anon.14 = type { i16, i16 }
%struct.anon.15 = type { i8, i8 }
%struct.anon.16 = type { %struct.arm_2d_size_t, %struct.arm_2d_size_t, %struct.arm_2d_region_t }
%struct.arm_2d_size_t = type { i16, i16 }
%struct.anon.17 = type { %union.anon.18, i16, i16, [65 x i8] }
%union.anon.18 = type { i16 }
%struct.arm_2d_scratch_mem_t = type { %union.anon.19, i64 }
%union.anon.19 = type { %union.anon.20 }
%union.anon.20 = type { %struct.anon.21 }
%struct.anon.21 = type { i32 }
%struct.arm_2d_region_t = type { %union.anon.10, %union.anon.11 }
%union.anon.10 = type { %struct.arm_2d_location_t }
%union.anon.11 = type { %struct.arm_2d_size_t }
%struct.__arm_2d_op_control = type { %struct.anon.25 }
%struct.anon.25 = type { ptr, %struct.anon.26, %struct.anon.27, i16, i16, i16, i16, ptr, %union.anon.28 }
%struct.anon.26 = type { ptr, ptr }
%struct.anon.27 = type { ptr, ptr }
%union.anon.28 = type { %struct.arm_2d_op_trans_msk_opa_t }
%struct.arm_2d_op_trans_msk_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon.71, %struct.anon.72, %union.anon.73, %struct.anon.75, %struct.anon.76, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { %struct.anon.29, i64 }
%struct.anon.29 = type { ptr, ptr, %struct.anon.30, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.30 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.31 }
%struct.anon.31 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.71 = type { ptr, ptr }
%struct.anon.72 = type { ptr }
%union.anon.73 = type { %struct.anon.74 }
%struct.anon.74 = type { i32 }
%struct.anon.75 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon, %union.anon.9, %union.anon.12 }
%union.anon = type { %struct.anon }
%struct.anon = type { i8, %union.arm_2d_color_info_t, %union.anon.2 }
%union.arm_2d_color_info_t = type { %struct.anon.0 }
%struct.anon.0 = type { i8 }
%union.anon.2 = type { i16 }
%union.anon.9 = type { %struct.arm_2d_region_t }
%union.anon.12 = type { ptr }
%struct.anon.76 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.63, %struct.anon.64 }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.63 = type { i32 }
%struct.anon.64 = type { %struct.arm_2d_location_t, %struct.anon.65 }
%struct.anon.65 = type { %struct.arm_2d_region_t, %struct.arm_2d_tile_t }
%struct.arm_2d_char_descriptor_t = type { %struct.arm_2d_tile_t, i16, i16, i16, i8, i8 }
%struct.arm_2d_font_t = type { %struct.arm_2d_tile_t, %struct.arm_2d_size_t, i32, ptr, ptr }
%struct.anon.5 = type { i8, %union.arm_2d_color_info_t, %union.anon.6 }
%union.anon.6 = type { i16 }
%struct.arm_2d_op_trans_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon.66, %struct.anon.67, %union.anon.68, %struct.anon.70, %struct.__arm_2d_transform_info_t, i8 }
%struct.anon.66 = type { ptr, ptr }
%struct.anon.67 = type { ptr }
%union.anon.68 = type { %struct.anon.69 }
%struct.anon.69 = type { i32 }
%struct.anon.70 = type { ptr, %struct.arm_2d_tile_t }

@s_tLCDTextControl = external hidden global %struct.anon.13, align 8
@ARM_2D_CTRL = external global %struct.__arm_2d_op_control, align 8

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden signext i8 @arm_2d_helper_get_utf8_byte_valid_length(ptr noundef nonnull) #1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @arm_2d_helper_get_char_descriptor(ptr noundef nonnull, ptr noundef nonnull, ptr noundef nonnull) #2

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

; Function Attrs: nounwind uwtable
declare hidden signext i16 @__arm_lcd_get_char_advance(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local signext i16 @lcd_draw_char(i16 noundef signext %0, i16 noundef signext %1, ptr noundef %2, i8 noundef zeroext %3) #2 {
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  %7 = alloca i16, align 2
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca %struct.arm_2d_char_descriptor_t, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca %struct.arm_2d_size_t, align 2
  %15 = alloca %struct.arm_2d_region_t, align 2
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store i16 %0, ptr %6, align 2, !tbaa !5
  store i16 %1, ptr %7, align 2, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store i8 %3, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %18 = load ptr, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 14), align 8, !tbaa !12
  store ptr %18, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  %19 = load ptr, ptr %8, align 8, !tbaa !9
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = call signext i8 @arm_2d_helper_get_utf8_byte_valid_length(ptr noundef %20)
  store i8 %21, ptr %12, align 1, !tbaa !11
  %22 = load i8, ptr %12, align 1, !tbaa !11
  %23 = sext i8 %22 to i32
  %24 = icmp sle i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %4
  store i8 1, ptr %12, align 1, !tbaa !11
  br label %26

26:                                               ; preds = %25, %4
  %27 = load ptr, ptr %11, align 8, !tbaa !9
  %28 = load ptr, ptr %8, align 8, !tbaa !9
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = call ptr @arm_2d_helper_get_char_descriptor(ptr noundef %27, ptr noundef %10, ptr noundef %29)
  %31 = icmp eq ptr null, %30
  br i1 %31, label %32, label %46

32:                                               ; preds = %26
  %33 = load i8, ptr %12, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  %35 = load ptr, ptr %8, align 8, !tbaa !9
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = sext i32 %34 to i64
  %38 = getelementptr inbounds i8, ptr %36, i64 %37
  store ptr %38, ptr %35, align 8, !tbaa !9
  %39 = load ptr, ptr %11, align 8, !tbaa !9
  %40 = call signext i16 @__arm_lcd_get_char_advance(ptr noundef %39, ptr noundef null, ptr noundef null)
  %41 = sext i16 %40 to i32
  %42 = load i16, ptr getelementptr inbounds (%struct.anon.16, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 10), i32 0, i32 1), align 4, !tbaa !24
  %43 = sext i16 %42 to i32
  %44 = add nsw i32 %41, %43
  %45 = trunc i32 %44 to i16
  store i16 %45, ptr %5, align 2
  store i32 1, ptr %13, align 4
  br label %151

46:                                               ; preds = %26
  %47 = load i8, ptr %12, align 1, !tbaa !11
  %48 = sext i8 %47 to i32
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = sext i32 %48 to i64
  %52 = getelementptr inbounds i8, ptr %50, i64 %51
  store ptr %52, ptr %49, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %53 = load ptr, ptr %11, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.arm_2d_font_t, ptr %53, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %14, ptr align 8 %54, i64 4, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %55 = getelementptr inbounds %struct.arm_2d_region_t, ptr %15, i32 0, i32 0
  %56 = getelementptr inbounds %struct.arm_2d_location_t, ptr %55, i32 0, i32 0
  %57 = load i16, ptr %6, align 2, !tbaa !5
  %58 = sext i16 %57 to i32
  %59 = getelementptr inbounds %struct.arm_2d_char_descriptor_t, ptr %10, i32 0, i32 2
  %60 = load i16, ptr %59, align 2, !tbaa !26
  %61 = sext i16 %60 to i32
  %62 = add nsw i32 %58, %61
  %63 = trunc i32 %62 to i16
  store i16 %63, ptr %56, align 2, !tbaa !29
  %64 = getelementptr inbounds %struct.arm_2d_location_t, ptr %55, i32 0, i32 1
  %65 = load i16, ptr %7, align 2, !tbaa !5
  %66 = sext i16 %65 to i32
  %67 = getelementptr inbounds %struct.arm_2d_size_t, ptr %14, i32 0, i32 1
  %68 = load i16, ptr %67, align 2, !tbaa !30
  %69 = sext i16 %68 to i32
  %70 = getelementptr inbounds %struct.arm_2d_char_descriptor_t, ptr %10, i32 0, i32 3
  %71 = load i16, ptr %70, align 4, !tbaa !31
  %72 = sext i16 %71 to i32
  %73 = sub nsw i32 %69, %72
  %74 = add nsw i32 %66, %73
  %75 = trunc i32 %74 to i16
  store i16 %75, ptr %64, align 2, !tbaa !32
  %76 = getelementptr inbounds %struct.arm_2d_region_t, ptr %15, i32 0, i32 1
  %77 = getelementptr inbounds %struct.arm_2d_char_descriptor_t, ptr %10, i32 0, i32 0
  %78 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %77, i32 0, i32 1
  %79 = getelementptr inbounds %struct.arm_2d_region_t, ptr %78, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %76, ptr align 4 %79, i64 4, i1 false), !tbaa.struct !25
  %80 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 13), ptr noundef %15, ptr noundef getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 13))
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %81 = load ptr, ptr %11, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.arm_2d_font_t, ptr %81, i32 0, i32 0
  %83 = call ptr @arm_2d_tile_get_root(ptr noundef %82, ptr noundef null, ptr noundef null)
  store ptr %83, ptr %16, align 8, !tbaa !9
  %84 = load ptr, ptr %16, align 8, !tbaa !9
  %85 = icmp ne ptr null, %84
  br i1 %85, label %86, label %142

86:                                               ; preds = %46
  %87 = load ptr, ptr %16, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %struct.anon.5, ptr %88, i32 0, i32 1
  %90 = load i8, ptr %89, align 1, !tbaa !11
  %91 = zext i8 %90 to i32
  %92 = icmp eq i32 %91, 96
  br i1 %92, label %93, label %111

93:                                               ; preds = %86
  %94 = load i32, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 5), align 8, !tbaa !33
  %95 = icmp ne i32 0, %94
  br i1 %95, label %96, label %111

96:                                               ; preds = %93
  %97 = load ptr, ptr %16, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.arm_2d_tile_t, ptr %97, i32 0, i32 0
  %99 = load i8, ptr %98, align 8
  %100 = lshr i8 %99, 1
  %101 = and i8 %100, 1
  %102 = zext i8 %101 to i32
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %111

104:                                              ; preds = %96
  %105 = getelementptr inbounds %struct.arm_2d_char_descriptor_t, ptr %10, i32 0, i32 0
  %106 = load ptr, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 4), align 8, !tbaa !34
  %107 = load i32, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 5), align 8, !tbaa !33
  %108 = load i16, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 3), align 4, !tbaa !35
  %109 = load i16, ptr getelementptr inbounds (%struct.anon.14, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 3), i32 0, i32 1), align 2, !tbaa !36
  %110 = call i32 @arm_2dp_rgb16_draw_pattern(ptr noundef null, ptr noundef %105, ptr noundef %106, ptr noundef %15, i32 noundef %107, i16 noundef zeroext %108, i16 noundef zeroext %109)
  br label %141

111:                                              ; preds = %96, %93, %86
  %112 = load ptr, ptr %11, align 8, !tbaa !9
  %113 = getelementptr inbounds %struct.arm_2d_font_t, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !37
  %115 = icmp ne ptr null, %114
  br i1 %115, label %116, label %140

116:                                              ; preds = %111
  %117 = load ptr, ptr %11, align 8, !tbaa !9
  %118 = getelementptr inbounds %struct.arm_2d_font_t, ptr %117, i32 0, i32 4
  %119 = load ptr, ptr %118, align 8, !tbaa !37
  %120 = load ptr, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 4), align 8, !tbaa !34
  %121 = load ptr, ptr %11, align 8, !tbaa !9
  %122 = getelementptr inbounds %struct.arm_2d_char_descriptor_t, ptr %10, i32 0, i32 0
  %123 = load i16, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 3), align 4, !tbaa !35
  %124 = load i8, ptr %9, align 1, !tbaa !11
  %125 = load i32, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 6), align 4, !tbaa !39
  %126 = call i32 %119(ptr noundef %120, ptr noundef %15, ptr noundef %121, ptr noundef %122, i16 noundef zeroext %123, i8 noundef zeroext %124, i32 noundef %125)
  %127 = load i32, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 6), align 4, !tbaa !39
  %128 = icmp sgt i32 %127, 0
  br i1 %128, label %129, label %139

129:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store ptr null, ptr %17, align 8, !tbaa !9
  %130 = load ptr, ptr %17, align 8, !tbaa !9
  %131 = icmp eq ptr null, %130
  br i1 %131, label %132, label %133

132:                                              ; preds = %129
  store ptr getelementptr inbounds (%struct.anon.25, ptr @ARM_2D_CTRL, i32 0, i32 8), ptr %17, align 8, !tbaa !9
  br label %133

133:                                              ; preds = %132, %129
  %134 = load ptr, ptr %17, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.arm_2d_op_trans_opa_t, ptr %134, i32 0, i32 1
  %136 = getelementptr inbounds %struct.anon.66, ptr %135, i32 0, i32 1
  %137 = load ptr, ptr %136, align 8, !tbaa !40
  %138 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 13), ptr noundef %137, ptr noundef getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 13))
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %139

139:                                              ; preds = %133, %116
  br label %140

140:                                              ; preds = %139, %111
  br label %141

141:                                              ; preds = %140, %104
  br label %142

142:                                              ; preds = %141, %46
  %143 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null)
  %144 = load ptr, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 14), align 8, !tbaa !12
  %145 = call signext i16 @__arm_lcd_get_char_advance(ptr noundef %144, ptr noundef %10, ptr noundef null)
  %146 = sext i16 %145 to i32
  %147 = load i16, ptr getelementptr inbounds (%struct.anon.16, ptr getelementptr inbounds (%struct.anon.13, ptr @s_tLCDTextControl, i32 0, i32 10), i32 0, i32 1), align 4, !tbaa !24
  %148 = sext i16 %147 to i32
  %149 = add nsw i32 %146, %148
  %150 = trunc i32 %149 to i16
  store i16 %150, ptr %5, align 2
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %151

151:                                              ; preds = %142, %32
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  %152 = load i16, ptr %5, align 2
  ret i16 %152
}

declare ptr @arm_2d_region_get_minimal_enclosure(ptr noundef, ptr noundef, ptr noundef) #4

declare ptr @arm_2d_tile_get_root(ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @arm_2dp_rgb16_draw_pattern(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i16 noundef zeroext, i16 noundef zeroext) #4

declare zeroext i1 @arm_2d_op_wait_async(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 160}
!13 = !{!"", !14, i64 0, !14, i64 8, !15, i64 16, !16, i64 20, !10, i64 24, !17, i64 32, !17, i64 36, !7, i64 40, !7, i64 41, !18, i64 42, !19, i64 44, !21, i64 60, !22, i64 136, !14, i64 152, !10, i64 160}
!14 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!15 = !{!"arm_2d_location_t", !6, i64 0, !6, i64 2}
!16 = !{!"", !6, i64 0, !6, i64 2}
!17 = !{!"int", !7, i64 0}
!18 = !{!"", !7, i64 0, !7, i64 1}
!19 = !{!"", !20, i64 0, !20, i64 4, !14, i64 8}
!20 = !{!"arm_2d_size_t", !6, i64 0, !6, i64 2}
!21 = !{!"", !7, i64 0, !6, i64 2, !6, i64 4, !7, i64 6}
!22 = !{!"arm_2d_scratch_mem_t", !7, i64 0, !23, i64 8}
!23 = !{!"long", !7, i64 0}
!24 = !{!13, !6, i64 48}
!25 = !{i64 0, i64 2, !5, i64 2, i64 2, !5}
!26 = !{!27, !6, i64 26}
!27 = !{!"", !28, i64 0, !6, i64 24, !6, i64 26, !6, i64 28, !7, i64 30}
!28 = !{!"arm_2d_tile_t", !7, i64 0, !7, i64 4, !7, i64 16}
!29 = !{!15, !6, i64 0}
!30 = !{!20, !6, i64 2}
!31 = !{!27, !6, i64 28}
!32 = !{!15, !6, i64 2}
!33 = !{!13, !17, i64 32}
!34 = !{!13, !10, i64 24}
!35 = !{!13, !6, i64 20}
!36 = !{!13, !6, i64 22}
!37 = !{!38, !10, i64 40}
!38 = !{!"arm_2d_font_t", !28, i64 0, !20, i64 24, !17, i64 28, !10, i64 32, !10, i64 40}
!39 = !{!13, !17, i64 36}
!40 = !{!41, !10, i64 56}
!41 = !{!"arm_2d_op_trans_opa_t", !42, i64 0, !46, i64 48, !47, i64 64, !7, i64 72, !48, i64 80, !49, i64 112, !7, i64 176}
!42 = !{!"arm_2d_op_core_t", !43, i64 0, !23, i64 40}
!43 = !{!"", !10, i64 0, !10, i64 8, !44, i64 16, !7, i64 17, !7, i64 18, !45, i64 24}
!44 = !{!"", !7, i64 0}
!45 = !{!"arm_2d_op_evt_t", !10, i64 0, !10, i64 8}
!46 = !{!"", !10, i64 0, !10, i64 8}
!47 = !{!"", !10, i64 0}
!48 = !{!"", !10, i64 0, !28, i64 8}
!49 = !{!"__arm_2d_transform_info_t", !50, i64 0, !50, i64 4, !50, i64 8, !51, i64 12, !7, i64 20, !52, i64 24}
!50 = !{!"float", !7, i64 0}
!51 = !{!"arm_2d_point_float_t", !50, i64 0, !50, i64 4}
!52 = !{!"", !15, i64 0, !53, i64 8}
!53 = !{!"", !14, i64 0, !28, i64 8}


; 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.anon.13 = type { %struct.arm_2d_region_t, %struct.arm_2d_region_t, %struct.arm_2d_location_t, %struct.anon.14, ptr, i32, i32, i8, i8, %struct.anon.15, %struct.anon.16, %struct.anon.17, %struct.arm_2d_scratch_mem_t, %struct.arm_2d_region_t, ptr }
%struct.arm_2d_location_t = type { i16, i16 }
%struct.anon.14 = type { i16, i16 }
%struct.anon.15 = type { i8, i8 }
%struct.anon.16 = type { %struct.arm_2d_size_t, %struct.arm_2d_size_t, %struct.arm_2d_region_t }
%struct.arm_2d_size_t = type { i16, i16 }
%struct.anon.17 = type { %union.anon.18, i16, i16, [65 x i8] }
%union.anon.18 = type { i16 }
%struct.arm_2d_scratch_mem_t = type { %union.anon.19, i64 }
%union.anon.19 = type { %union.anon.20 }
%union.anon.20 = type { %struct.anon.21 }
%struct.anon.21 = type { i32 }
%struct.arm_2d_region_t = type { %union.anon.10, %union.anon.11 }
%union.anon.10 = type { %struct.arm_2d_location_t }
%union.anon.11 = type { %struct.arm_2d_size_t }
%struct.__arm_2d_op_control = type { %struct.anon.25 }
%struct.anon.25 = type { ptr, %struct.anon.26, %struct.anon.27, i16, i16, i16, i16, ptr, %union.anon.28 }
%struct.anon.26 = type { ptr, ptr }
%struct.anon.27 = type { ptr, ptr }
%union.anon.28 = type { %struct.arm_2d_op_trans_msk_opa_t }
%struct.arm_2d_op_trans_msk_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon.71, %struct.anon.72, %union.anon.73, %struct.anon.75, %struct.anon.76, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { %struct.anon.29, i64 }
%struct.anon.29 = type { ptr, ptr, %struct.anon.30, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.30 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.31 }
%struct.anon.31 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.71 = type { ptr, ptr }
%struct.anon.72 = type { ptr }
%union.anon.73 = type { %struct.anon.74 }
%struct.anon.74 = type { i32 }
%struct.anon.75 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon, %union.anon.9, %union.anon.12 }
%union.anon = type { %struct.anon }
%struct.anon = type { i8, %union.arm_2d_color_info_t, %union.anon.2 }
%union.arm_2d_color_info_t = type { %struct.anon.0 }
%struct.anon.0 = type { i8 }
%union.anon.2 = type { i16 }
%union.anon.9 = type { %struct.arm_2d_region_t }
%union.anon.12 = type { ptr }
%struct.anon.76 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.63, %struct.anon.64 }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.63 = type { i32 }
%struct.anon.64 = type { %struct.arm_2d_location_t, %struct.anon.65 }
%struct.anon.65 = type { %struct.arm_2d_region_t, %struct.arm_2d_tile_t }
%struct.arm_2d_char_descriptor_t = type { %struct.arm_2d_tile_t, i16, i16, i16, i8, i8 }

@s_tLCDTextControl = external hidden global %struct.anon.13, align 8
@ARM_2D_CTRL = external local_unnamed_addr global %struct.__arm_2d_op_control, align 8

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden signext i8 @arm_2d_helper_get_utf8_byte_valid_length(ptr noundef nonnull) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @arm_2d_helper_get_char_descriptor(ptr noundef nonnull, ptr noundef nonnull, ptr noundef nonnull) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden signext i16 @__arm_lcd_get_char_advance(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local signext i16 @lcd_draw_char(i16 noundef signext %0, i16 noundef signext %1, ptr nocapture noundef %2, i8 noundef zeroext %3) local_unnamed_addr #2 {
  %5 = alloca %struct.arm_2d_char_descriptor_t, align 8
  %6 = alloca %struct.arm_2d_region_t, align 2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 160), align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8, !tbaa !21
  %9 = tail call signext i8 @arm_2d_helper_get_utf8_byte_valid_length(ptr noundef %8)
  %spec.store.select = tail call i8 @llvm.smax.i8(i8 %9, i8 1)
  %10 = load ptr, ptr %2, align 8, !tbaa !21
  %11 = call ptr @arm_2d_helper_get_char_descriptor(ptr noundef %7, ptr noundef %5, ptr noundef %10)
  %12 = icmp eq ptr %11, null
  %13 = load ptr, ptr %2, align 8, !tbaa !21
  %14 = zext nneg i8 %spec.store.select to i64
  %15 = getelementptr inbounds i8, ptr %13, i64 %14
  store ptr %15, ptr %2, align 8, !tbaa !21
  br i1 %12, label %16, label %20

16:                                               ; preds = %4
  %17 = call signext i16 @__arm_lcd_get_char_advance(ptr noundef nonnull %7, ptr noundef null, ptr noundef null)
  %18 = load i16, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 48), align 8, !tbaa !22
  %19 = add i16 %18, %17
  br label %67

20:                                               ; preds = %4
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 26
  %.sroa.3.0.copyload = load i16, ptr %.sroa.3.0..sroa_idx, align 2, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %21 = getelementptr inbounds i8, ptr %5, i64 26
  %22 = load i16, ptr %21, align 2, !tbaa !24
  %23 = add i16 %22, %0
  store i16 %23, ptr %6, align 2, !tbaa !27
  %24 = getelementptr inbounds i8, ptr %6, i64 2
  %25 = getelementptr inbounds i8, ptr %5, i64 28
  %26 = load i16, ptr %25, align 4, !tbaa !28
  %27 = add i16 %.sroa.3.0.copyload, %1
  %28 = sub i16 %27, %26
  store i16 %28, ptr %24, align 2, !tbaa !29
  %29 = getelementptr inbounds i8, ptr %6, i64 4
  %30 = getelementptr inbounds i8, ptr %5, i64 8
  %31 = load i32, ptr %30, align 8
  store i32 %31, ptr %29, align 2
  %32 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef nonnull getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 152), ptr noundef nonnull %6, ptr noundef nonnull getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 152)) #5
  %33 = call ptr @arm_2d_tile_get_root(ptr noundef nonnull %7, ptr noundef null, ptr noundef null) #5
  %.not = icmp eq ptr %33, null
  br i1 %.not, label %61, label %34

34:                                               ; preds = %20
  %35 = getelementptr inbounds i8, ptr %33, i64 1
  %36 = load i8, ptr %35, align 1, !tbaa !30
  %37 = icmp eq i8 %36, 96
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 32), align 8
  %39 = icmp ne i32 %38, 0
  %or.cond = select i1 %37, i1 %39, i1 false
  br i1 %or.cond, label %40, label %48

40:                                               ; preds = %34
  %41 = load i8, ptr %33, align 8
  %42 = and i8 %41, 2
  %.not27 = icmp eq i8 %42, 0
  br i1 %.not27, label %48, label %43

43:                                               ; preds = %40
  %44 = load ptr, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 24), align 8, !tbaa !31
  %45 = load i16, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 20), align 4, !tbaa !32
  %46 = load i16, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 22), align 2, !tbaa !33
  %47 = call i32 @arm_2dp_rgb16_draw_pattern(ptr noundef null, ptr noundef nonnull %5, ptr noundef %44, ptr noundef nonnull %6, i32 noundef %38, i16 noundef zeroext %45, i16 noundef zeroext %46) #5
  br label %61

48:                                               ; preds = %40, %34
  %49 = getelementptr inbounds i8, ptr %7, i64 40
  %50 = load ptr, ptr %49, align 8, !tbaa !34
  %.not28 = icmp eq ptr %50, null
  br i1 %.not28, label %61, label %51

51:                                               ; preds = %48
  %52 = load ptr, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 24), align 8, !tbaa !31
  %53 = load i16, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 20), align 4, !tbaa !32
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 36), align 4, !tbaa !36
  %55 = call i32 %50(ptr noundef %52, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %5, i16 noundef zeroext %53, i8 noundef zeroext %3, i32 noundef %54) #5
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 36), align 4, !tbaa !36
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %58, label %61

58:                                               ; preds = %51
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @ARM_2D_CTRL, i64 112), align 8, !tbaa !37
  %60 = call ptr @arm_2d_region_get_minimal_enclosure(ptr noundef nonnull getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 152), ptr noundef %59, ptr noundef nonnull getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 152)) #5
  br label %61

61:                                               ; preds = %43, %51, %58, %48, %20
  %62 = call zeroext i1 @arm_2d_op_wait_async(ptr noundef null) #5
  %63 = load ptr, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 160), align 8, !tbaa !5
  %64 = call signext i16 @__arm_lcd_get_char_advance(ptr noundef %63, ptr noundef nonnull %5, ptr noundef null)
  %65 = load i16, ptr getelementptr inbounds (i8, ptr @s_tLCDTextControl, i64 48), align 8, !tbaa !22
  %66 = add i16 %65, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %67

67:                                               ; preds = %61, %16
  %.0 = phi i16 [ %19, %16 ], [ %66, %61 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  ret i16 %.0
}

declare ptr @arm_2d_region_get_minimal_enclosure(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @arm_2d_tile_get_root(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @arm_2dp_rgb16_draw_pattern(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #3

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #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 nosync nounwind speculatable willreturn memory(none) }
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, !13, i64 160}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !12, i64 20, !13, i64 24, !14, i64 32, !14, i64 36, !8, i64 40, !8, i64 41, !15, i64 42, !16, i64 44, !18, i64 60, !19, i64 136, !7, i64 152, !13, i64 160}
!7 = !{!"arm_2d_region_t", !8, i64 0, !8, i64 4}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"arm_2d_location_t", !11, i64 0, !11, i64 2}
!11 = !{!"short", !8, i64 0}
!12 = !{!"", !11, i64 0, !11, i64 2}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = !{!"", !8, i64 0, !8, i64 1}
!16 = !{!"", !17, i64 0, !17, i64 4, !7, i64 8}
!17 = !{!"arm_2d_size_t", !11, i64 0, !11, i64 2}
!18 = !{!"", !8, i64 0, !11, i64 2, !11, i64 4, !8, i64 6}
!19 = !{!"arm_2d_scratch_mem_t", !8, i64 0, !20, i64 8}
!20 = !{!"long", !8, i64 0}
!21 = !{!13, !13, i64 0}
!22 = !{!6, !11, i64 48}
!23 = !{!11, !11, i64 0}
!24 = !{!25, !11, i64 26}
!25 = !{!"", !26, i64 0, !11, i64 24, !11, i64 26, !11, i64 28, !8, i64 30}
!26 = !{!"arm_2d_tile_t", !8, i64 0, !8, i64 4, !8, i64 16}
!27 = !{!10, !11, i64 0}
!28 = !{!25, !11, i64 28}
!29 = !{!10, !11, i64 2}
!30 = !{!8, !8, i64 0}
!31 = !{!6, !13, i64 24}
!32 = !{!6, !11, i64 20}
!33 = !{!6, !11, i64 22}
!34 = !{!35, !13, i64 40}
!35 = !{!"arm_2d_font_t", !26, i64 0, !17, i64 24, !14, i64 28, !13, i64 32, !13, i64 40}
!36 = !{!6, !14, i64 36}
!37 = !{!38, !13, i64 56}
!38 = !{!"arm_2d_op_trans_opa_t", !39, i64 0, !43, i64 48, !44, i64 64, !8, i64 72, !45, i64 80, !46, i64 112, !8, i64 176}
!39 = !{!"arm_2d_op_core_t", !40, i64 0, !20, i64 40}
!40 = !{!"", !13, i64 0, !13, i64 8, !41, i64 16, !8, i64 17, !8, i64 18, !42, i64 24}
!41 = !{!"", !8, i64 0}
!42 = !{!"arm_2d_op_evt_t", !13, i64 0, !13, i64 8}
!43 = !{!"", !13, i64 0, !13, i64 8}
!44 = !{!"", !13, i64 0}
!45 = !{!"", !13, i64 0, !26, i64 8}
!46 = !{!"__arm_2d_transform_info_t", !47, i64 0, !47, i64 4, !47, i64 8, !48, i64 12, !8, i64 20, !49, i64 24}
!47 = !{!"float", !8, i64 0}
!48 = !{!"arm_2d_point_float_t", !47, i64 0, !47, i64 4}
!49 = !{!"", !10, i64 0, !50, i64 8}
!50 = !{!"", !7, i64 0, !26, i64 8}


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