; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/tests (gamma)

; 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.nk_text_undo_record = type { i32, i16, i16, i16 }
%struct.nk_text_edit = type { %struct.nk_clipboard, %struct.nk_str, ptr, %struct.nk_vec2, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, float, %struct.nk_text_undo_state }
%struct.nk_clipboard = type { %union.nk_handle, ptr, ptr }
%union.nk_handle = type { ptr }
%struct.nk_str = type { %struct.nk_buffer, i32 }
%struct.nk_buffer = type { [2 x %struct.nk_buffer_marker], %struct.nk_allocator, i32, %struct.nk_memory, float, i64, i64, i64, i64 }
%struct.nk_buffer_marker = type { i32, i64 }
%struct.nk_allocator = type { %union.nk_handle, ptr, ptr }
%struct.nk_memory = type { ptr, i64 }
%struct.nk_vec2 = type { float, float }
%struct.nk_text_undo_state = type { [99 x %struct.nk_text_undo_record], [999 x i32], i16, i16, i16, i16 }

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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: nounwind uwtable
declare dso_local i32 @nk_str_insert_text_runes(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_textedit_redo(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.nk_text_undo_record, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.nk_text_edit, ptr %8, i32 0, i32 15
  store ptr %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.nk_text_undo_state, ptr %10, i32 0, i32 3
  %12 = load i16, ptr %11, align 2, !tbaa !9
  %13 = sext i16 %12 to i32
  %14 = icmp eq i32 %13, 99
  br i1 %14, label %15, label %16

15:                                               ; preds = %1
  store i32 1, ptr %6, align 4
  br label %160

16:                                               ; preds = %1
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nk_text_undo_state, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.nk_text_undo_state, ptr %19, i32 0, i32 2
  %21 = load i16, ptr %20, align 4, !tbaa !12
  %22 = sext i16 %21 to i64
  %23 = getelementptr inbounds [99 x %struct.nk_text_undo_record], ptr %18, i64 0, i64 %22
  store ptr %23, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.nk_text_undo_state, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.nk_text_undo_state, ptr %26, i32 0, i32 3
  %28 = load i16, ptr %27, align 2, !tbaa !9
  %29 = sext i16 %28 to i64
  %30 = getelementptr inbounds [99 x %struct.nk_text_undo_record], ptr %25, i64 0, i64 %29
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %30, i64 12, i1 false), !tbaa.struct !13
  %31 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 1
  %32 = load i16, ptr %31, align 4, !tbaa !17
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.nk_text_undo_record, ptr %33, i32 0, i32 2
  store i16 %32, ptr %34, align 2, !tbaa !19
  %35 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 2
  %36 = load i16, ptr %35, align 2, !tbaa !19
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.nk_text_undo_record, ptr %37, i32 0, i32 1
  store i16 %36, ptr %38, align 4, !tbaa !17
  %39 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 0
  %40 = load i32, ptr %39, align 4, !tbaa !20
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.nk_text_undo_record, ptr %41, i32 0, i32 0
  store i32 %40, ptr %42, align 4, !tbaa !20
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.nk_text_undo_record, ptr %43, i32 0, i32 3
  store i16 -1, ptr %44, align 4, !tbaa !21
  %45 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 2
  %46 = load i16, ptr %45, align 2, !tbaa !19
  %47 = icmp ne i16 %46, 0
  br i1 %47, label %48, label %124

48:                                               ; preds = %16
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.nk_text_undo_state, ptr %49, i32 0, i32 4
  %51 = load i16, ptr %50, align 4, !tbaa !22
  %52 = sext i16 %51 to i32
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.nk_text_undo_record, ptr %53, i32 0, i32 1
  %55 = load i16, ptr %54, align 4, !tbaa !17
  %56 = sext i16 %55 to i32
  %57 = add nsw i32 %52, %56
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.nk_text_undo_state, ptr %58, i32 0, i32 5
  %60 = load i16, ptr %59, align 2, !tbaa !23
  %61 = sext i16 %60 to i32
  %62 = icmp sgt i32 %57, %61
  br i1 %62, label %63, label %68

63:                                               ; preds = %48
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.nk_text_undo_record, ptr %64, i32 0, i32 1
  store i16 0, ptr %65, align 4, !tbaa !17
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.nk_text_undo_record, ptr %66, i32 0, i32 2
  store i16 0, ptr %67, align 2, !tbaa !19
  br label %116

68:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.nk_text_undo_state, ptr %69, i32 0, i32 4
  %71 = load i16, ptr %70, align 4, !tbaa !22
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.nk_text_undo_record, ptr %72, i32 0, i32 3
  store i16 %71, ptr %73, align 4, !tbaa !21
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.nk_text_undo_state, ptr %74, i32 0, i32 4
  %76 = load i16, ptr %75, align 4, !tbaa !22
  %77 = sext i16 %76 to i32
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.nk_text_undo_record, ptr %78, i32 0, i32 1
  %80 = load i16, ptr %79, align 4, !tbaa !17
  %81 = sext i16 %80 to i32
  %82 = add nsw i32 %77, %81
  %83 = trunc i32 %82 to i16
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.nk_text_undo_state, ptr %84, i32 0, i32 4
  store i16 %83, ptr %85, align 4, !tbaa !22
  store i32 0, ptr %7, align 4, !tbaa !14
  br label %86

86:                                               ; preds = %112, %68
  %87 = load i32, ptr %7, align 4, !tbaa !14
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.nk_text_undo_record, ptr %88, i32 0, i32 1
  %90 = load i16, ptr %89, align 4, !tbaa !17
  %91 = sext i16 %90 to i32
  %92 = icmp slt i32 %87, %91
  br i1 %92, label %93, label %115

93:                                               ; preds = %86
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.nk_text_edit, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.nk_text_undo_record, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 4, !tbaa !20
  %99 = load i32, ptr %7, align 4, !tbaa !14
  %100 = add nsw i32 %98, %99
  %101 = call i32 @nk_str_rune_at(ptr noundef %95, i32 noundef %100)
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.nk_text_undo_state, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.nk_text_undo_record, ptr %104, i32 0, i32 3
  %106 = load i16, ptr %105, align 4, !tbaa !21
  %107 = sext i16 %106 to i32
  %108 = load i32, ptr %7, align 4, !tbaa !14
  %109 = add nsw i32 %107, %108
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [999 x i32], ptr %103, i64 0, i64 %110
  store i32 %101, ptr %111, align 4, !tbaa !14
  br label %112

112:                                              ; preds = %93
  %113 = load i32, ptr %7, align 4, !tbaa !14
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %7, align 4, !tbaa !14
  br label %86, !llvm.loop !24

115:                                              ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %116

116:                                              ; preds = %115, %63
  %117 = load ptr, ptr %2, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.nk_text_edit, ptr %117, i32 0, i32 1
  %119 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 0
  %120 = load i32, ptr %119, align 4, !tbaa !20
  %121 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 2
  %122 = load i16, ptr %121, align 2, !tbaa !19
  %123 = sext i16 %122 to i32
  call void @nk_str_delete_runes(ptr noundef %118, i32 noundef %120, i32 noundef %123)
  br label %124

124:                                              ; preds = %116, %16
  %125 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 1
  %126 = load i16, ptr %125, align 4, !tbaa !17
  %127 = icmp ne i16 %126, 0
  br i1 %127, label %128, label %143

128:                                              ; preds = %124
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.nk_text_edit, ptr %129, i32 0, i32 1
  %131 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 0
  %132 = load i32, ptr %131, align 4, !tbaa !20
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.nk_text_undo_state, ptr %133, i32 0, i32 1
  %135 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 3
  %136 = load i16, ptr %135, align 4, !tbaa !21
  %137 = sext i16 %136 to i64
  %138 = getelementptr inbounds [999 x i32], ptr %134, i64 0, i64 %137
  %139 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 1
  %140 = load i16, ptr %139, align 4, !tbaa !17
  %141 = sext i16 %140 to i32
  %142 = call i32 @nk_str_insert_text_runes(ptr noundef %130, i32 noundef %132, ptr noundef %138, i32 noundef %141)
  br label %143

143:                                              ; preds = %128, %124
  %144 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 0
  %145 = load i32, ptr %144, align 4, !tbaa !20
  %146 = getelementptr inbounds %struct.nk_text_undo_record, ptr %5, i32 0, i32 1
  %147 = load i16, ptr %146, align 4, !tbaa !17
  %148 = sext i16 %147 to i32
  %149 = add nsw i32 %145, %148
  %150 = load ptr, ptr %2, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.nk_text_edit, ptr %150, i32 0, i32 4
  store i32 %149, ptr %151, align 8, !tbaa !26
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.nk_text_undo_state, ptr %152, i32 0, i32 2
  %154 = load i16, ptr %153, align 4, !tbaa !12
  %155 = add i16 %154, 1
  store i16 %155, ptr %153, align 4, !tbaa !12
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.nk_text_undo_state, ptr %156, i32 0, i32 3
  %158 = load i16, ptr %157, align 2, !tbaa !9
  %159 = add i16 %158, 1
  store i16 %159, ptr %157, align 2, !tbaa !9
  store i32 0, ptr %6, align 4
  br label %160

160:                                              ; preds = %143, %15
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %161 = load i32, ptr %6, align 4
  switch i32 %161, label %163 [
    i32 0, label %162
    i32 1, label %162
  ]

162:                                              ; preds = %160, %160
  ret void

163:                                              ; preds = %160
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !11, i64 5186}
!10 = !{!"nk_text_undo_state", !7, i64 0, !7, i64 1188, !11, i64 5184, !11, i64 5186, !11, i64 5188, !11, i64 5190}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !11, i64 5184}
!13 = !{i64 0, i64 4, !14, i64 4, i64 2, !16, i64 6, i64 2, !16, i64 8, i64 2, !16}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!18, !11, i64 4}
!18 = !{!"nk_text_undo_record", !15, i64 0, !11, i64 4, !11, i64 6, !11, i64 8}
!19 = !{!18, !11, i64 6}
!20 = !{!18, !15, i64 0}
!21 = !{!18, !11, i64 8}
!22 = !{!10, !11, i64 5188}
!23 = !{!10, !11, i64 5190}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!27, !15, i64 168}
!27 = !{!"nk_text_edit", !28, i64 0, !29, i64 24, !6, i64 152, !35, i64 160, !15, i64 168, !15, i64 172, !15, i64 176, !7, i64 180, !7, i64 181, !7, i64 182, !7, i64 183, !7, i64 184, !7, i64 185, !7, i64 186, !34, i64 188, !10, i64 192}
!28 = !{!"nk_clipboard", !7, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"nk_str", !30, i64 0, !15, i64 120}
!30 = !{!"nk_buffer", !7, i64 0, !31, i64 32, !15, i64 56, !32, i64 64, !34, i64 80, !33, i64 88, !33, i64 96, !33, i64 104, !33, i64 112}
!31 = !{!"nk_allocator", !7, i64 0, !6, i64 8, !6, i64 16}
!32 = !{!"nk_memory", !6, i64 0, !33, i64 8}
!33 = !{!"long", !7, i64 0}
!34 = !{!"float", !7, i64 0}
!35 = !{!"nk_vec2", !34, i64 0, !34, i64 4}


; 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.nk_text_undo_record = type { i32, i16, i16, i16 }

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_textedit_redo(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 5378
  %3 = load i16, ptr %2, align 2, !tbaa !5
  %4 = icmp eq i16 %3, 99
  br i1 %4, label %58, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  %7 = getelementptr inbounds i8, ptr %0, i64 5376
  %8 = load i16, ptr %7, align 4, !tbaa !10
  %9 = sext i16 %8 to i64
  %10 = getelementptr inbounds [99 x %struct.nk_text_undo_record], ptr %6, i64 0, i64 %9
  %11 = sext i16 %3 to i64
  %12 = getelementptr inbounds [99 x %struct.nk_text_undo_record], ptr %6, i64 0, i64 %11
  %.sroa.0.0.copyload = load i32, ptr %12, align 4, !tbaa !11
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 4
  %.sroa.7.0.copyload = load i16, ptr %.sroa.7.0..sroa_idx, align 4, !tbaa !13
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 6
  %.sroa.11.0.copyload = load i16, ptr %.sroa.11.0..sroa_idx, align 2, !tbaa !13
  %.sroa.14.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 8
  %.sroa.14.0.copyload = load i16, ptr %.sroa.14.0..sroa_idx, align 4, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %10, i64 6
  store i16 %.sroa.7.0.copyload, ptr %13, align 2, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %10, i64 4
  store i16 %.sroa.11.0.copyload, ptr %14, align 4, !tbaa !16
  store i32 %.sroa.0.0.copyload, ptr %10, align 4, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %10, i64 8
  store i16 -1, ptr %15, align 4, !tbaa !18
  %.not = icmp eq i16 %.sroa.11.0.copyload, 0
  br i1 %.not, label %46, label %16

16:                                               ; preds = %5
  %17 = getelementptr inbounds i8, ptr %0, i64 5380
  %18 = load i16, ptr %17, align 4, !tbaa !19
  %19 = sext i16 %18 to i32
  %20 = sext i16 %.sroa.11.0.copyload to i32
  %21 = add nsw i32 %19, %20
  %22 = getelementptr inbounds i8, ptr %0, i64 5382
  %23 = load i16, ptr %22, align 2, !tbaa !20
  %24 = sext i16 %23 to i32
  %25 = icmp sgt i32 %21, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %16
  store i16 0, ptr %14, align 4, !tbaa !16
  store i16 0, ptr %13, align 2, !tbaa !14
  br label %.loopexit

27:                                               ; preds = %16
  store i16 %18, ptr %15, align 4, !tbaa !18
  %28 = add i16 %18, %.sroa.11.0.copyload
  store i16 %28, ptr %17, align 4, !tbaa !19
  %29 = icmp sgt i16 %.sroa.11.0.copyload, 0
  br i1 %29, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %27
  %30 = getelementptr inbounds i8, ptr %0, i64 24
  %31 = getelementptr inbounds i8, ptr %0, i64 1380
  br label %32

32:                                               ; preds = %.lr.ph, %32
  %.043 = phi i32 [ 0, %.lr.ph ], [ %41, %32 ]
  %33 = load i32, ptr %10, align 4, !tbaa !17
  %34 = add nsw i32 %33, %.043
  %35 = tail call i32 @nk_str_rune_at(ptr noundef nonnull %30, i32 noundef %34)
  %36 = load i16, ptr %15, align 4, !tbaa !18
  %37 = sext i16 %36 to i32
  %38 = add nsw i32 %.043, %37
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [999 x i32], ptr %31, i64 0, i64 %39
  store i32 %35, ptr %40, align 4, !tbaa !11
  %41 = add nuw nsw i32 %.043, 1
  %42 = load i16, ptr %14, align 4, !tbaa !16
  %43 = sext i16 %42 to i32
  %44 = icmp slt i32 %41, %43
  br i1 %44, label %32, label %.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %32, %27, %26
  %45 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @nk_str_delete_runes(ptr noundef nonnull %45, i32 noundef %.sroa.0.0.copyload, i32 noundef %20)
  br label %46

46:                                               ; preds = %.loopexit, %5
  %.not42 = icmp eq i16 %.sroa.7.0.copyload, 0
  br i1 %.not42, label %._crit_edge, label %47

47:                                               ; preds = %46
  %48 = getelementptr inbounds i8, ptr %0, i64 24
  %49 = getelementptr inbounds i8, ptr %0, i64 1380
  %50 = sext i16 %.sroa.14.0.copyload to i64
  %51 = getelementptr inbounds [999 x i32], ptr %49, i64 0, i64 %50
  %52 = sext i16 %.sroa.7.0.copyload to i32
  %53 = tail call i32 @nk_str_insert_text_runes(ptr noundef nonnull %48, i32 noundef %.sroa.0.0.copyload, ptr noundef nonnull %51, i32 noundef %52)
  br label %._crit_edge

._crit_edge:                                      ; preds = %46, %47
  %.pre-phi = phi i32 [ %52, %47 ], [ 0, %46 ]
  %54 = add nsw i32 %.sroa.0.0.copyload, %.pre-phi
  %55 = getelementptr inbounds i8, ptr %0, i64 168
  store i32 %54, ptr %55, align 8, !tbaa !23
  %56 = load <2 x i16>, ptr %7, align 4, !tbaa !13
  %57 = add <2 x i16> %56, <i16 1, i16 1>
  store <2 x i16> %57, ptr %7, align 4, !tbaa !13
  br label %58

58:                                               ; preds = %1, %._crit_edge
  ret void
}

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

!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, !9, i64 5186}
!6 = !{!"nk_text_undo_state", !7, i64 0, !7, i64 1188, !9, i64 5184, !9, i64 5186, !9, i64 5188, !9, i64 5190}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!6, !9, i64 5184}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!9, !9, i64 0}
!14 = !{!15, !9, i64 6}
!15 = !{!"nk_text_undo_record", !12, i64 0, !9, i64 4, !9, i64 6, !9, i64 8}
!16 = !{!15, !9, i64 4}
!17 = !{!15, !12, i64 0}
!18 = !{!15, !9, i64 8}
!19 = !{!6, !9, i64 5188}
!20 = !{!6, !9, i64 5190}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !12, i64 168}
!24 = !{!"nk_text_edit", !25, i64 0, !27, i64 24, !26, i64 152, !33, i64 160, !12, i64 168, !12, i64 172, !12, i64 176, !7, i64 180, !7, i64 181, !7, i64 182, !7, i64 183, !7, i64 184, !7, i64 185, !7, i64 186, !32, i64 188, !6, i64 192}
!25 = !{!"nk_clipboard", !7, i64 0, !26, i64 8, !26, i64 16}
!26 = !{!"any pointer", !7, i64 0}
!27 = !{!"nk_str", !28, i64 0, !12, i64 120}
!28 = !{!"nk_buffer", !7, i64 0, !29, i64 32, !12, i64 56, !30, i64 64, !32, i64 80, !31, i64 88, !31, i64 96, !31, i64 104, !31, i64 112}
!29 = !{!"nk_allocator", !7, i64 0, !26, i64 8, !26, i64 16}
!30 = !{!"nk_memory", !26, i64 0, !31, i64 8}
!31 = !{!"long", !7, i64 0}
!32 = !{!"float", !7, i64 0}
!33 = !{!"nk_vec2", !32, i64 0, !32, i64 4}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass