; 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_context = type { %struct.nk_input, %struct.nk_style, %struct.nk_buffer, %struct.nk_clipboard, i32, i32, %struct.nk_configuration_stacks, float, %struct.nk_draw_list, %struct.nk_text_edit, %struct.nk_command_buffer, i32, i32, %struct.nk_pool, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct.nk_input = type { %struct.nk_keyboard, %struct.nk_mouse }
%struct.nk_keyboard = type { [30 x %struct.nk_key], [16 x i8], i32 }
%struct.nk_key = type { i32, i32 }
%struct.nk_mouse = type { [4 x %struct.nk_mouse_button], %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, i8, i8, i8 }
%struct.nk_mouse_button = type { i32, i32, %struct.nk_vec2 }
%struct.nk_vec2 = type { float, float }
%struct.nk_style = type { ptr, [7 x ptr], ptr, ptr, i32, %struct.nk_style_text, %struct.nk_style_button, %struct.nk_style_button, %struct.nk_style_button, %struct.nk_style_toggle, %struct.nk_style_toggle, %struct.nk_style_selectable, %struct.nk_style_slider, %struct.nk_style_progress, %struct.nk_style_property, %struct.nk_style_edit, %struct.nk_style_chart, %struct.nk_style_scrollbar, %struct.nk_style_scrollbar, %struct.nk_style_tab, %struct.nk_style_combo, %struct.nk_style_window }
%struct.nk_style_text = type { %struct.nk_color, %struct.nk_vec2 }
%struct.nk_color = type { i8, i8, i8, i8 }
%struct.nk_style_button = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, i32, float, float, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %union.nk_handle, ptr, ptr }
%struct.nk_style_item = type { i32, %union.nk_style_item_data }
%union.nk_style_item_data = type { %struct.nk_image }
%struct.nk_image = type { %union.nk_handle, i16, i16, [4 x i16] }
%union.nk_handle = type { ptr }
%struct.nk_style_toggle = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, i32, %struct.nk_vec2, %struct.nk_vec2, float, float, %union.nk_handle, ptr, ptr }
%struct.nk_style_selectable = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, i32, float, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %union.nk_handle, ptr, ptr }
%struct.nk_style_slider = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, float, float, float, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, i32, %struct.nk_style_button, %struct.nk_style_button, i32, i32, %union.nk_handle, ptr, ptr }
%struct.nk_style_progress = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, float, float, float, float, %struct.nk_vec2, %union.nk_handle, ptr, ptr }
%struct.nk_style_property = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, i32, i32, float, float, %struct.nk_vec2, %struct.nk_style_edit, %struct.nk_style_button, %struct.nk_style_button, %union.nk_handle, ptr, ptr }
%struct.nk_style_edit = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_style_scrollbar, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, float, float, float, %struct.nk_vec2, %struct.nk_vec2, float }
%struct.nk_style_chart = type { %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, float, float, %struct.nk_vec2 }
%struct.nk_style_scrollbar = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, float, float, float, float, %struct.nk_vec2, i32, %struct.nk_style_button, %struct.nk_style_button, i32, i32, %union.nk_handle, ptr, ptr }
%struct.nk_style_tab = type { %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_style_button, %struct.nk_style_button, %struct.nk_style_button, %struct.nk_style_button, i32, i32, float, float, float, %struct.nk_vec2, %struct.nk_vec2 }
%struct.nk_style_combo = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_style_button, i32, i32, i32, float, float, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2 }
%struct.nk_style_window = type { %struct.nk_style_window_header, %struct.nk_style_item, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_color, %struct.nk_style_item, float, float, float, float, float, float, float, float, float, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2 }
%struct.nk_style_window_header = type { %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_item, %struct.nk_style_button, %struct.nk_style_button, i32, i32, i32, %struct.nk_color, %struct.nk_color, %struct.nk_color, i32, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2 }
%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_clipboard = type { %union.nk_handle, ptr, ptr }
%struct.nk_configuration_stacks = type { %struct.nk_config_stack_style_item, %struct.nk_config_stack_float, %struct.nk_config_stack_vec2, %struct.nk_config_stack_flags, %struct.nk_config_stack_color, %struct.nk_config_stack_user_font, %struct.nk_config_stack_button_behavior }
%struct.nk_config_stack_style_item = type { i32, [16 x %struct.nk_config_stack_style_item_element] }
%struct.nk_config_stack_style_item_element = type { ptr, %struct.nk_style_item }
%struct.nk_config_stack_float = type { i32, [32 x %struct.nk_config_stack_float_element] }
%struct.nk_config_stack_float_element = type { ptr, float }
%struct.nk_config_stack_vec2 = type { i32, [16 x %struct.nk_config_stack_vec2_element] }
%struct.nk_config_stack_vec2_element = type { ptr, %struct.nk_vec2 }
%struct.nk_config_stack_flags = type { i32, [32 x %struct.nk_config_stack_flags_element] }
%struct.nk_config_stack_flags_element = type { ptr, i32 }
%struct.nk_config_stack_color = type { i32, [32 x %struct.nk_config_stack_color_element] }
%struct.nk_config_stack_color_element = type { ptr, %struct.nk_color }
%struct.nk_config_stack_user_font = type { i32, [8 x %struct.nk_config_stack_user_font_element] }
%struct.nk_config_stack_user_font_element = type { ptr, ptr }
%struct.nk_config_stack_button_behavior = type { i32, [8 x %struct.nk_config_stack_button_behavior_element] }
%struct.nk_config_stack_button_behavior_element = type { ptr, i32 }
%struct.nk_draw_list = type { %struct.nk_rect, [12 x %struct.nk_vec2], %struct.nk_convert_config, ptr, ptr, ptr, i32, i32, i32, i64, i32, i32, i32, i32 }
%struct.nk_rect = type { float, float, float, float }
%struct.nk_convert_config = type { float, i32, i32, i32, i32, i32, %struct.nk_draw_null_texture, ptr, i64, i64 }
%struct.nk_draw_null_texture = type { %union.nk_handle, %struct.nk_vec2 }
%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_str = type { %struct.nk_buffer, i32 }
%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 }
%struct.nk_command_buffer = type { ptr, %struct.nk_rect, i32, %union.nk_handle, i64, i64, i64 }
%struct.nk_pool = type { %struct.nk_allocator, i32, i32, ptr, ptr, i32, i64, i64 }

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.nk_input_glyph = external hidden unnamed_addr constant [55 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_input_glyph(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %13

12:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.33, ptr noundef @.str.2, i32 noundef 14035, ptr noundef @__PRETTY_FUNCTION__.nk_input_glyph) #4
  unreachable

13:                                               ; preds = %11
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  store i32 1, ptr %8, align 4
  br label %56

17:                                               ; preds = %13
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.nk_context, ptr %18, i32 0, i32 0
  store ptr %19, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = call i32 @nk_utf_decode(ptr noundef %20, ptr noundef %6, i32 noundef 4)
  store i32 %21, ptr %5, align 4, !tbaa !9
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %55

24:                                               ; preds = %17
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.nk_input, ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %struct.nk_keyboard, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = add nsw i32 %28, %29
  %31 = icmp slt i32 %30, 16
  br i1 %31, label %32, label %55

32:                                               ; preds = %24
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.nk_input, ptr %34, i32 0, i32 0
  %36 = getelementptr inbounds %struct.nk_keyboard, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.nk_input, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.nk_keyboard, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [16 x i8], ptr %36, i64 0, i64 %41
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.nk_input, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.nk_keyboard, ptr %44, i32 0, i32 2
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = sub nsw i32 16, %46
  %48 = call i32 @nk_utf_encode(i32 noundef %33, ptr noundef %42, i32 noundef %47)
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nk_input, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds %struct.nk_keyboard, ptr %51, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = add nsw i32 %53, %49
  store i32 %54, ptr %52, align 4, !tbaa !11
  br label %55

55:                                               ; preds = %32, %24, %17
  store i32 0, ptr %8, align 4
  br label %56

56:                                               ; preds = %55, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  %57 = load i32, ptr %8, align 4
  switch i32 %57, label %59 [
    i32 0, label %58
    i32 1, label %58
  ]

58:                                               ; preds = %56, %56
  ret void

59:                                               ; preds = %56
  unreachable
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 256}
!12 = !{!"nk_input", !13, i64 0, !14, i64 260}
!13 = !{!"nk_keyboard", !7, i64 0, !7, i64 240, !10, i64 256}
!14 = !{!"nk_mouse", !7, i64 0, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !7, i64 96, !7, i64 97, !7, i64 98}
!15 = !{!"nk_vec2", !16, i64 0, !16, i64 4}
!16 = !{!"float", !7, i64 0}


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

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.nk_input_glyph = external hidden unnamed_addr constant [55 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_input_glyph(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.33, ptr noundef nonnull @.str.2, i32 noundef 14035, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_input_glyph) #4
  unreachable

5:                                                ; preds = %2
  %6 = call i32 @nk_utf_decode(ptr noundef %1, ptr noundef nonnull %3, i32 noundef 4)
  %.not12 = icmp eq i32 %6, 0
  br i1 %.not12, label %21, label %7

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 256
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = add nsw i32 %9, %6
  %11 = icmp slt i32 %10, 16
  br i1 %11, label %12, label %21

12:                                               ; preds = %7
  %13 = load i32, ptr %3, align 4, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 240
  %15 = sext i32 %9 to i64
  %16 = getelementptr inbounds [16 x i8], ptr %14, i64 0, i64 %15
  %17 = sub nsw i32 16, %9
  %18 = call i32 @nk_utf_encode(i32 noundef %13, ptr noundef nonnull %16, i32 noundef %17)
  %19 = load i32, ptr %8, align 4, !tbaa !5
  %20 = add nsw i32 %19, %6
  store i32 %20, ptr %8, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %5, %7, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  ret void
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 256}
!6 = !{!"nk_input", !7, i64 0, !11, i64 260}
!7 = !{!"nk_keyboard", !8, i64 0, !8, i64 240, !10, i64 256}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"nk_mouse", !8, i64 0, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !8, i64 96, !8, i64 97, !8, i64 98}
!12 = !{!"nk_vec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!10, !10, i64 0}


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