; LLVM IR from vectozavr/3dzavr :: engine/io/microui (microui)

; 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.mu_Rect = type { i32, i32, i32, i32 }
%struct.mu_Color = type { i8, i8, i8, i8 }
%struct.mu_Vec2 = type { i32, i32 }
%struct.mu_Context = type { ptr, ptr, ptr, %struct.mu_Style, ptr, i32, i32, i32, %struct.mu_Rect, i32, i32, i32, ptr, ptr, ptr, [127 x i8], i32, %struct.anon, %struct.anon.0, %struct.anon.1, %struct.anon.2, %struct.anon.3, %struct.anon.4, [48 x %struct.mu_PoolItem], [48 x %struct.mu_Container], [48 x %struct.mu_PoolItem], %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, i32, i32, i32, i32, [32 x i8] }
%struct.mu_Style = type { ptr, %struct.mu_Vec2, i32, i32, i32, i32, i32, i32, [14 x %struct.mu_Color] }
%struct.anon = type { i32, [262144 x i8] }
%struct.anon.0 = type { i32, [32 x ptr] }
%struct.anon.1 = type { i32, [32 x ptr] }
%struct.anon.2 = type { i32, [32 x %struct.mu_Rect] }
%struct.anon.3 = type { i32, [32 x i32] }
%struct.anon.4 = type { i32, [16 x %struct.mu_Layout] }
%struct.mu_Layout = type { %struct.mu_Rect, %struct.mu_Rect, %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, [16 x i32], i32, i32, i32, i32, i32 }
%struct.mu_Container = type { ptr, ptr, %struct.mu_Rect, %struct.mu_Rect, %struct.mu_Vec2, %struct.mu_Vec2, i32, i32 }
%struct.mu_PoolItem = type { i32, i32 }

; Function Attrs: nounwind uwtable
declare dso_local i64 @mu_vec2(i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local { i64, i64 } @mu_rect(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @mu_set_focus(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_push_clip_rect(ptr noundef, i64, i64) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_pop_clip_rect(ptr noundef) #0

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_rect(ptr noundef, i64, i64, i32) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_text(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i64, i32) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_frame(ptr noundef, i32 noundef, i64, i64, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_text(ptr noundef, ptr noundef, i64, i64, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_update_control(ptr noundef, i32 noundef, i64, i64, i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mu_textbox_raw(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i64 %4, i64 %5, i32 noundef %6) #0 {
  %8 = alloca %struct.mu_Rect, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.mu_Color, align 1
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %struct.mu_Vec2, align 4
  %25 = alloca %struct.mu_Rect, align 4
  %26 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  store i64 %4, ptr %26, align 4
  %27 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  store i64 %5, ptr %27, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store i32 %6, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !9
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = load i32, ptr %13, align 4, !tbaa !9
  %31 = or i32 %30, 256
  %32 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %33 = load i64, ptr %32, align 4
  %34 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %35 = load i64, ptr %34, align 4
  call void @mu_update_control(ptr noundef %28, i32 noundef %29, i64 %33, i64 %35, i32 noundef %31)
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mu_Context, ptr %36, i32 0, i32 6
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = icmp eq i32 %38, %39
  br i1 %40, label %41, label %133

41:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = call i64 @strlen(ptr noundef %42) #5
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = load i32, ptr %15, align 4, !tbaa !9
  %47 = sub nsw i32 %45, %46
  %48 = sub nsw i32 %47, 1
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.mu_Context, ptr %49, i32 0, i32 34
  %51 = getelementptr inbounds [32 x i8], ptr %50, i64 0, i64 0
  %52 = call i64 @strlen(ptr noundef %51) #5
  %53 = trunc i64 %52 to i32
  %54 = icmp slt i32 %48, %53
  br i1 %54, label %55, label %60

55:                                               ; preds = %41
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = load i32, ptr %15, align 4, !tbaa !9
  %58 = sub nsw i32 %56, %57
  %59 = sub nsw i32 %58, 1
  br label %66

60:                                               ; preds = %41
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.mu_Context, ptr %61, i32 0, i32 34
  %63 = getelementptr inbounds [32 x i8], ptr %62, i64 0, i64 0
  %64 = call i64 @strlen(ptr noundef %63) #5
  %65 = trunc i64 %64 to i32
  br label %66

66:                                               ; preds = %60, %55
  %67 = phi i32 [ %59, %55 ], [ %65, %60 ]
  store i32 %67, ptr %16, align 4, !tbaa !9
  %68 = load i32, ptr %16, align 4, !tbaa !9
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %70, label %89

70:                                               ; preds = %66
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = load i32, ptr %15, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i8, ptr %71, i64 %73
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.mu_Context, ptr %75, i32 0, i32 34
  %77 = getelementptr inbounds [32 x i8], ptr %76, i64 0, i64 0
  %78 = load i32, ptr %16, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %74, ptr align 8 %77, i64 %79, i1 false)
  %80 = load i32, ptr %16, align 4, !tbaa !9
  %81 = load i32, ptr %15, align 4, !tbaa !9
  %82 = add nsw i32 %81, %80
  store i32 %82, ptr %15, align 4, !tbaa !9
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load i32, ptr %15, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %83, i64 %85
  store i8 0, ptr %86, align 1, !tbaa !18
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = or i32 %87, 4
  store i32 %88, ptr %14, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %70, %66
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.mu_Context, ptr %90, i32 0, i32 33
  %92 = load i32, ptr %91, align 4, !tbaa !19
  %93 = and i32 %92, 8
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %122

95:                                               ; preds = %89
  %96 = load i32, ptr %15, align 4, !tbaa !9
  %97 = icmp sgt i32 %96, 0
  br i1 %97, label %98, label %122

98:                                               ; preds = %95
  br label %99

99:                                               ; preds = %114, %98
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load i32, ptr %15, align 4, !tbaa !9
  %102 = add nsw i32 %101, -1
  store i32 %102, ptr %15, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i8, ptr %100, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !18
  %106 = sext i8 %105 to i32
  %107 = and i32 %106, 192
  %108 = icmp eq i32 %107, 128
  br i1 %108, label %109, label %112

109:                                              ; preds = %99
  %110 = load i32, ptr %15, align 4, !tbaa !9
  %111 = icmp sgt i32 %110, 0
  br label %112

112:                                              ; preds = %109, %99
  %113 = phi i1 [ false, %99 ], [ %111, %109 ]
  br i1 %113, label %114, label %115

114:                                              ; preds = %112
  br label %99, !llvm.loop !20

115:                                              ; preds = %112
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = load i32, ptr %15, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %116, i64 %118
  store i8 0, ptr %119, align 1, !tbaa !18
  %120 = load i32, ptr %14, align 4, !tbaa !9
  %121 = or i32 %120, 4
  store i32 %121, ptr %14, align 4, !tbaa !9
  br label %122

122:                                              ; preds = %115, %95, %89
  %123 = load ptr, ptr %9, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.mu_Context, ptr %123, i32 0, i32 33
  %125 = load i32, ptr %124, align 4, !tbaa !19
  %126 = and i32 %125, 16
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %132

128:                                              ; preds = %122
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  call void @mu_set_focus(ptr noundef %129, i32 noundef 0)
  %130 = load i32, ptr %14, align 4, !tbaa !9
  %131 = or i32 %130, 2
  store i32 %131, ptr %14, align 4, !tbaa !9
  br label %132

132:                                              ; preds = %128, %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %133

133:                                              ; preds = %132, %7
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = load i32, ptr %12, align 4, !tbaa !9
  %136 = load i32, ptr %13, align 4, !tbaa !9
  %137 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %138 = load i64, ptr %137, align 4
  %139 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %140 = load i64, ptr %139, align 4
  call void @mu_draw_control_frame(ptr noundef %134, i32 noundef %135, i64 %138, i64 %140, i32 noundef 9, i32 noundef %136)
  %141 = load ptr, ptr %9, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.mu_Context, ptr %141, i32 0, i32 6
  %143 = load i32, ptr %142, align 4, !tbaa !11
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = icmp eq i32 %143, %144
  br i1 %145, label %146, label %237

146:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.mu_Context, ptr %147, i32 0, i32 4
  %149 = load ptr, ptr %148, align 8, !tbaa !22
  %150 = getelementptr inbounds %struct.mu_Style, ptr %149, i32 0, i32 8
  %151 = getelementptr inbounds [14 x %struct.mu_Color], ptr %150, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %17, ptr align 8 %151, i64 4, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.mu_Context, ptr %152, i32 0, i32 4
  %154 = load ptr, ptr %153, align 8, !tbaa !22
  %155 = getelementptr inbounds %struct.mu_Style, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !24
  store ptr %156, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.mu_Context, ptr %157, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !25
  %160 = load ptr, ptr %18, align 8, !tbaa !5
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = call i32 %159(ptr noundef %160, ptr noundef %161, i32 noundef -1)
  store i32 %162, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %163 = load ptr, ptr %9, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.mu_Context, ptr %163, i32 0, i32 1
  %165 = load ptr, ptr %164, align 8, !tbaa !26
  %166 = load ptr, ptr %18, align 8, !tbaa !5
  %167 = call i32 %165(ptr noundef %166)
  store i32 %167, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %168 = getelementptr inbounds %struct.mu_Rect, ptr %8, i32 0, i32 2
  %169 = load i32, ptr %168, align 4, !tbaa !27
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.mu_Context, ptr %170, i32 0, i32 4
  %172 = load ptr, ptr %171, align 8, !tbaa !22
  %173 = getelementptr inbounds %struct.mu_Style, ptr %172, i32 0, i32 2
  %174 = load i32, ptr %173, align 8, !tbaa !28
  %175 = sub nsw i32 %169, %174
  %176 = load i32, ptr %19, align 4, !tbaa !9
  %177 = sub nsw i32 %175, %176
  %178 = sub nsw i32 %177, 1
  store i32 %178, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %179 = getelementptr inbounds %struct.mu_Rect, ptr %8, i32 0, i32 0
  %180 = load i32, ptr %179, align 4, !tbaa !29
  %181 = load i32, ptr %21, align 4, !tbaa !9
  %182 = load ptr, ptr %9, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.mu_Context, ptr %182, i32 0, i32 4
  %184 = load ptr, ptr %183, align 8, !tbaa !22
  %185 = getelementptr inbounds %struct.mu_Style, ptr %184, i32 0, i32 2
  %186 = load i32, ptr %185, align 8, !tbaa !28
  %187 = icmp slt i32 %181, %186
  br i1 %187, label %188, label %190

188:                                              ; preds = %146
  %189 = load i32, ptr %21, align 4, !tbaa !9
  br label %196

190:                                              ; preds = %146
  %191 = load ptr, ptr %9, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.mu_Context, ptr %191, i32 0, i32 4
  %193 = load ptr, ptr %192, align 8, !tbaa !22
  %194 = getelementptr inbounds %struct.mu_Style, ptr %193, i32 0, i32 2
  %195 = load i32, ptr %194, align 8, !tbaa !28
  br label %196

196:                                              ; preds = %190, %188
  %197 = phi i32 [ %189, %188 ], [ %195, %190 ]
  %198 = add nsw i32 %180, %197
  store i32 %198, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %199 = getelementptr inbounds %struct.mu_Rect, ptr %8, i32 0, i32 1
  %200 = load i32, ptr %199, align 4, !tbaa !30
  %201 = getelementptr inbounds %struct.mu_Rect, ptr %8, i32 0, i32 3
  %202 = load i32, ptr %201, align 4, !tbaa !31
  %203 = load i32, ptr %20, align 4, !tbaa !9
  %204 = sub nsw i32 %202, %203
  %205 = sdiv i32 %204, 2
  %206 = add nsw i32 %200, %205
  store i32 %206, ptr %23, align 4, !tbaa !9
  %207 = load ptr, ptr %9, align 8, !tbaa !5
  %208 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %209 = load i64, ptr %208, align 4
  %210 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %211 = load i64, ptr %210, align 4
  call void @mu_push_clip_rect(ptr noundef %207, i64 %209, i64 %211)
  %212 = load ptr, ptr %9, align 8, !tbaa !5
  %213 = load ptr, ptr %18, align 8, !tbaa !5
  %214 = load ptr, ptr %10, align 8, !tbaa !5
  %215 = load i32, ptr %22, align 4, !tbaa !9
  %216 = load i32, ptr %23, align 4, !tbaa !9
  %217 = call i64 @mu_vec2(i32 noundef %215, i32 noundef %216)
  store i64 %217, ptr %24, align 4
  %218 = load i64, ptr %24, align 4
  %219 = load i32, ptr %17, align 1
  call void @mu_draw_text(ptr noundef %212, ptr noundef %213, ptr noundef %214, i32 noundef -1, i64 %218, i32 %219)
  %220 = load ptr, ptr %9, align 8, !tbaa !5
  %221 = load i32, ptr %22, align 4, !tbaa !9
  %222 = load i32, ptr %19, align 4, !tbaa !9
  %223 = add nsw i32 %221, %222
  %224 = load i32, ptr %23, align 4, !tbaa !9
  %225 = load i32, ptr %20, align 4, !tbaa !9
  %226 = call { i64, i64 } @mu_rect(i32 noundef %223, i32 noundef %224, i32 noundef 1, i32 noundef %225)
  %227 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 0
  %228 = extractvalue { i64, i64 } %226, 0
  store i64 %228, ptr %227, align 4
  %229 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 1
  %230 = extractvalue { i64, i64 } %226, 1
  store i64 %230, ptr %229, align 4
  %231 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 0
  %232 = load i64, ptr %231, align 4
  %233 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 1
  %234 = load i64, ptr %233, align 4
  %235 = load i32, ptr %17, align 1
  call void @mu_draw_rect(ptr noundef %220, i64 %232, i64 %234, i32 %235)
  %236 = load ptr, ptr %9, align 8, !tbaa !5
  call void @mu_pop_clip_rect(ptr noundef %236)
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %245

237:                                              ; preds = %133
  %238 = load ptr, ptr %9, align 8, !tbaa !5
  %239 = load ptr, ptr %10, align 8, !tbaa !5
  %240 = load i32, ptr %13, align 4, !tbaa !9
  %241 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %242 = load i64, ptr %241, align 4
  %243 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %244 = load i64, ptr %243, align 4
  call void @mu_draw_control_text(ptr noundef %238, ptr noundef %239, i64 %242, i64 %244, i32 noundef 0, i32 noundef %240)
  br label %245

245:                                              ; preds = %237, %196
  %246 = load i32, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  ret i32 %246
}

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

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 132}
!12 = !{!"mu_Context", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 120, !10, i64 128, !10, i64 132, !10, i64 136, !15, i64 140, !10, i64 156, !10, i64 160, !10, i64 164, !6, i64 168, !6, i64 176, !6, i64 184, !7, i64 192, !10, i64 320, !16, i64 324, !17, i64 262472, !17, i64 262736, !16, i64 263000, !16, i64 263516, !16, i64 263648, !7, i64 265892, !7, i64 266280, !7, i64 269736, !14, i64 270120, !14, i64 270128, !14, i64 270136, !14, i64 270144, !10, i64 270152, !10, i64 270156, !10, i64 270160, !10, i64 270164, !7, i64 270168}
!13 = !{!"", !6, i64 0, !14, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40}
!14 = !{!"", !10, i64 0, !10, i64 4}
!15 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!16 = !{!"", !10, i64 0, !7, i64 4}
!17 = !{!"", !10, i64 0, !7, i64 8}
!18 = !{!7, !7, i64 0}
!19 = !{!12, !10, i64 270164}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!12, !6, i64 120}
!23 = !{i64 0, i64 1, !18, i64 1, i64 1, !18, i64 2, i64 1, !18, i64 3, i64 1, !18}
!24 = !{!13, !6, i64 0}
!25 = !{!12, !6, i64 0}
!26 = !{!12, !6, i64 8}
!27 = !{!15, !10, i64 8}
!28 = !{!13, !10, i64 16}
!29 = !{!15, !10, i64 0}
!30 = !{!15, !10, i64 4}
!31 = !{!15, !10, i64 12}


; 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"

; Function Attrs: nounwind uwtable
declare dso_local i64 @mu_vec2(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local { i64, i64 } @mu_rect(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress 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) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mu_set_focus(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_push_clip_rect(ptr noundef, i64, i64) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_pop_clip_rect(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_rect(ptr noundef, i64, i64, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_text(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i64, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_frame(ptr noundef, i32 noundef, i64, i64, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_draw_control_text(ptr noundef, ptr noundef, i64, i64, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @mu_update_control(ptr noundef, i32 noundef, i64, i64, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @mu_textbox_raw(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i64 %4, i64 %5, i32 noundef %6) local_unnamed_addr #0 {
  %.sroa.071.0.extract.trunc = trunc i64 %4 to i32
  %.sroa.6.0.extract.shift = lshr i64 %4, 32
  %.sroa.6.0.extract.trunc = trunc nuw i64 %.sroa.6.0.extract.shift to i32
  %.sroa.7.8.extract.trunc = trunc i64 %5 to i32
  %.sroa.13.8.extract.shift = lshr i64 %5, 32
  %.sroa.13.8.extract.trunc = trunc nuw i64 %.sroa.13.8.extract.shift to i32
  %8 = or i32 %6, 256
  tail call void @mu_update_control(ptr noundef %0, i32 noundef %3, i64 %4, i64 %5, i32 noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 132
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = icmp eq i32 %10, %3
  br i1 %11, label %12, label %49

12:                                               ; preds = %7
  %13 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #4
  %14 = trunc i64 %13 to i32
  %15 = xor i32 %14, -1
  %16 = add i32 %15, %2
  %17 = getelementptr inbounds i8, ptr %0, i64 270168
  %18 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %17) #4
  %19 = trunc i64 %18 to i32
  %. = tail call i32 @llvm.smin.i32(i32 %16, i32 %19)
  %20 = icmp sgt i32 %., 0
  br i1 %20, label %21, label %28

21:                                               ; preds = %12
  %sext = shl i64 %13, 32
  %22 = ashr exact i64 %sext, 32
  %23 = getelementptr inbounds i8, ptr %1, i64 %22
  %24 = zext nneg i32 %. to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %23, ptr nonnull align 8 %17, i64 %24, i1 false)
  %25 = add nsw i32 %., %14
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %1, i64 %26
  store i8 0, ptr %27, align 1, !tbaa !16
  br label %28

28:                                               ; preds = %21, %12
  %.0128 = phi i32 [ %25, %21 ], [ %14, %12 ]
  %.0 = phi i32 [ 4, %21 ], [ 0, %12 ]
  %29 = getelementptr inbounds i8, ptr %0, i64 270164
  %30 = load i32, ptr %29, align 4, !tbaa !17
  %31 = and i32 %30, 8
  %32 = icmp ne i32 %31, 0
  %33 = icmp sgt i32 %.0128, 0
  %or.cond = and i1 %33, %32
  br i1 %or.cond, label %.preheader.preheader, label %44

.preheader.preheader:                             ; preds = %28
  %34 = zext nneg i32 %.0128 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %indvars.iv = phi i64 [ %34, %.preheader.preheader ], [ %indvars.iv.next, %.preheader ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %35 = and i64 %indvars.iv.next, 4294967295
  %36 = getelementptr inbounds i8, ptr %1, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !16
  %38 = and i8 %37, -64
  %39 = icmp eq i8 %38, -128
  %40 = icmp ugt i64 %indvars.iv, 1
  %41 = and i1 %40, %39
  br i1 %41, label %.preheader, label %42, !llvm.loop !18

42:                                               ; preds = %.preheader
  %43 = getelementptr inbounds i8, ptr %1, i64 %35
  store i8 0, ptr %43, align 1, !tbaa !16
  %.pre = load i32, ptr %29, align 4, !tbaa !17
  br label %44

44:                                               ; preds = %42, %28
  %45 = phi i32 [ %.pre, %42 ], [ %30, %28 ]
  %.1 = phi i32 [ 4, %42 ], [ %.0, %28 ]
  %46 = and i32 %45, 16
  %.not = icmp eq i32 %46, 0
  br i1 %.not, label %49, label %47

47:                                               ; preds = %44
  tail call void @mu_set_focus(ptr noundef nonnull %0, i32 noundef 0)
  %48 = or i32 %.1, 2
  br label %49

49:                                               ; preds = %44, %47, %7
  %.3 = phi i32 [ 0, %7 ], [ %48, %47 ], [ %.1, %44 ]
  tail call void @mu_draw_control_frame(ptr noundef nonnull %0, i32 noundef %3, i64 %4, i64 %5, i32 noundef 9, i32 noundef %6)
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = icmp eq i32 %50, %3
  br i1 %51, label %52, label %77

52:                                               ; preds = %49
  %53 = getelementptr inbounds i8, ptr %0, i64 120
  %54 = load ptr, ptr %53, align 8, !tbaa !20
  %55 = getelementptr inbounds i8, ptr %54, i64 40
  %.sroa.014.0.copyload = load i32, ptr %55, align 8
  %56 = load ptr, ptr %54, align 8, !tbaa !21
  %57 = load ptr, ptr %0, align 8, !tbaa !22
  %58 = tail call i32 %57(ptr noundef %56, ptr noundef %1, i32 noundef -1) #5
  %59 = getelementptr inbounds i8, ptr %0, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !23
  %61 = tail call i32 %60(ptr noundef %56) #5
  %62 = load ptr, ptr %53, align 8, !tbaa !20
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %64 = load i32, ptr %63, align 8, !tbaa !24
  %65 = add i32 %64, %58
  %66 = xor i32 %65, -1
  %67 = add i32 %66, %.sroa.7.8.extract.trunc
  %.135 = tail call i32 @llvm.smin.i32(i32 %67, i32 %64)
  %68 = add nsw i32 %.135, %.sroa.071.0.extract.trunc
  %69 = sub nsw i32 %.sroa.13.8.extract.trunc, %61
  %70 = sdiv i32 %69, 2
  %71 = add nsw i32 %70, %.sroa.6.0.extract.trunc
  tail call void @mu_push_clip_rect(ptr noundef nonnull %0, i64 %4, i64 %5)
  %72 = tail call i64 @mu_vec2(i32 noundef %68, i32 noundef %71)
  tail call void @mu_draw_text(ptr noundef nonnull %0, ptr noundef %56, ptr noundef %1, i32 noundef -1, i64 %72, i32 %.sroa.014.0.copyload)
  %73 = add nsw i32 %68, %58
  %74 = tail call { i64, i64 } @mu_rect(i32 noundef %73, i32 noundef %71, i32 noundef 1, i32 noundef %61)
  %75 = extractvalue { i64, i64 } %74, 0
  %76 = extractvalue { i64, i64 } %74, 1
  tail call void @mu_draw_rect(ptr noundef nonnull %0, i64 %75, i64 %76, i32 %.sroa.014.0.copyload)
  tail call void @mu_pop_clip_rect(ptr noundef nonnull %0)
  br label %78

77:                                               ; preds = %49
  tail call void @mu_draw_control_text(ptr noundef nonnull %0, ptr noundef %1, i64 %4, i64 %5, i32 noundef 0, i32 noundef %6)
  br label %78

78:                                               ; preds = %77, %52
  ret i32 %.3
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 speculatable willreturn memory(none) }
attributes #4 = { nounwind willreturn memory(read) }
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, !12, i64 132}
!6 = !{!"mu_Context", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !7, i64 120, !12, i64 128, !12, i64 132, !12, i64 136, !13, i64 140, !12, i64 156, !12, i64 160, !12, i64 164, !7, i64 168, !7, i64 176, !7, i64 184, !8, i64 192, !12, i64 320, !14, i64 324, !15, i64 262472, !15, i64 262736, !14, i64 263000, !14, i64 263516, !14, i64 263648, !8, i64 265892, !8, i64 266280, !8, i64 269736, !11, i64 270120, !11, i64 270128, !11, i64 270136, !11, i64 270144, !12, i64 270152, !12, i64 270156, !12, i64 270160, !12, i64 270164, !8, i64 270168}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !11, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !8, i64 40}
!11 = !{!"", !12, i64 0, !12, i64 4}
!12 = !{!"int", !8, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!14 = !{!"", !12, i64 0, !8, i64 4}
!15 = !{!"", !12, i64 0, !8, i64 8}
!16 = !{!8, !8, i64 0}
!17 = !{!6, !12, i64 270164}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !7, i64 120}
!21 = !{!10, !7, i64 0}
!22 = !{!6, !7, i64 0}
!23 = !{!6, !7, i64 8}
!24 = !{!10, !12, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass