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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @nk_textedit_cut(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.nk_text_edit, ptr %4, i32 0, i32 7
  %6 = load i8, ptr %5, align 4, !tbaa !9
  %7 = zext i8 %6 to i32
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i32 0, ptr %2, align 4
  br label %23

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.nk_text_edit, ptr %11, i32 0, i32 5
  %13 = load i32, ptr %12, align 4, !tbaa !22
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.nk_text_edit, ptr %14, i32 0, i32 6
  %16 = load i32, ptr %15, align 8, !tbaa !23
  %17 = icmp ne i32 %13, %16
  br i1 %17, label %18, label %22

18:                                               ; preds = %10
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  call void @nk_textedit_delete_selection(ptr noundef %19)
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.nk_text_edit, ptr %20, i32 0, i32 10
  store i8 0, ptr %21, align 1, !tbaa !24
  store i32 1, ptr %2, align 4
  br label %23

22:                                               ; preds = %10
  store i32 0, ptr %2, align 4
  br label %23

23:                                               ; preds = %22, %18, %9
  %24 = load i32, ptr %2, align 4
  ret i32 %24
}

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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 180}
!10 = !{!"nk_text_edit", !11, i64 0, !12, i64 24, !6, i64 152, !19, 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, !18, i64 188, !20, i64 192}
!11 = !{!"nk_clipboard", !7, i64 0, !6, i64 8, !6, i64 16}
!12 = !{!"nk_str", !13, i64 0, !15, i64 120}
!13 = !{!"nk_buffer", !7, i64 0, !14, i64 32, !15, i64 56, !16, i64 64, !18, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !17, i64 112}
!14 = !{!"nk_allocator", !7, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"int", !7, i64 0}
!16 = !{!"nk_memory", !6, i64 0, !17, i64 8}
!17 = !{!"long", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"nk_vec2", !18, i64 0, !18, i64 4}
!20 = !{!"nk_text_undo_state", !7, i64 0, !7, i64 1188, !21, i64 5184, !21, i64 5186, !21, i64 5188, !21, i64 5190}
!21 = !{!"short", !7, i64 0}
!22 = !{!10, !15, i64 172}
!23 = !{!10, !15, i64 176}
!24 = !{!10, !7, i64 183}


; 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 void @nk_textedit_delete_selection(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nk_textedit_cut(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 180
  %3 = load i8, ptr %2, align 4, !tbaa !5
  %4 = icmp eq i8 %3, 0
  br i1 %4, label %12, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 172
  %7 = load i32, ptr %6, align 4, !tbaa !21
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  %9 = load i32, ptr %8, align 8, !tbaa !22
  %.not = icmp eq i32 %7, %9
  br i1 %.not, label %12, label %10

10:                                               ; preds = %5
  tail call void @nk_textedit_delete_selection(ptr noundef nonnull %0)
  %11 = getelementptr inbounds i8, ptr %0, i64 183
  store i8 0, ptr %11, align 1, !tbaa !23
  br label %12

12:                                               ; preds = %5, %1, %10
  %.0 = phi i32 [ 1, %10 ], [ 0, %1 ], [ 0, %5 ]
  ret i32 %.0
}

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


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass