; 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_style_load_cursor = external hidden unnamed_addr constant [95 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
define dso_local void @nk_style_load_cursor(ptr noundef %0, i32 noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %3
  br label %13

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

13:                                               ; preds = %11
  %14 = load ptr, ptr %4, 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 %26

17:                                               ; preds = %13
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.nk_context, ptr %18, i32 0, i32 1
  store ptr %19, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.nk_style, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [7 x ptr], ptr %22, i64 0, i64 %24
  store ptr %20, ptr %25, align 8, !tbaa !5
  store i32 0, ptr %8, align 4
  br label %26

26:                                               ; preds = %17, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %27 = load i32, ptr %8, align 4
  switch i32 %27, label %29 [
    i32 0, label %28
    i32 1, label %28
  ]

28:                                               ; preds = %26, %26
  ret void

29:                                               ; preds = %26
  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}


; 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_style_load_cursor = external hidden unnamed_addr constant [95 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @nk_style_load_cursor(ptr noundef writeonly %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

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

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 368
  %7 = zext i32 %1 to i64
  %8 = getelementptr inbounds [7 x ptr], ptr %6, i64 0, i64 %7
  store ptr %2, ptr %8, align 8, !tbaa !5
  ret void
}

attributes #0 = { 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 #1 = { 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 = { 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"}


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