; LLVM IR from drohmer/cgp :: library/cgp/19_camera_controller/camera_controller_first_person/camera_controller_47a2d51b (stackIfLi4ELi4EEE)

; 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.cgp::camera_controller_generic_base" = type { i8, ptr, ptr }
%"struct.cgp::input_devices" = type <{ %"struct.cgp::inputs_keyboard_parameters", %"struct.cgp::inputs_mouse_parameters", float, [4 x i8] }>
%"struct.cgp::inputs_keyboard_parameters" = type { i8, i8, i8, i8, i8, i8, %"struct.cgp::inputs_keyboard_last_action_parameter", %"class.std::set" }
%"struct.cgp::inputs_keyboard_last_action_parameter" = type { i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.cgp::inputs_mouse_parameters" = type <{ %"struct.cgp::inputs_mouse_cursor_position_parameters", %"struct.cgp::inputs_mouse_cursor_click_parameters", float, i8, [3 x i8] }>
%"struct.cgp::inputs_mouse_cursor_position_parameters" = type { %"struct.cgp::numarray_stack.4", %"struct.cgp::numarray_stack.4" }
%"struct.cgp::numarray_stack.4" = type { float, float }
%"struct.cgp::inputs_mouse_cursor_click_parameters" = type { i8, i8, i32 }
%"struct.cgp::camera_controller_first_person" = type <{ %"struct.cgp::camera_controller_generic_base", %"struct.cgp::camera_first_person", float, float, i8, [7 x i8] }>
%"struct.cgp::camera_first_person" = type <{ %"struct.cgp::camera_generic_base", %"struct.cgp::rotation_transform", %"struct.cgp::numarray_stack.0", [4 x i8] }>
%"struct.cgp::camera_generic_base" = type { ptr }
%"struct.cgp::rotation_transform" = type { %"struct.cgp::quaternion" }
%"struct.cgp::quaternion" = type { %"struct.cgp::numarray_stack" }
%"struct.cgp::numarray_stack" = type { float, float, float, float }
%"struct.cgp::numarray_stack.0" = type { float, float, float }
%"struct.cgp::window_structure" = type <{ ptr, ptr, i32, i32, i32, i32, i32, i32, i8, [7 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3cgp30camera_controller_first_person15action_keyboardERNS_12matrix_stackIfLi4ELi4EEE(ptr noundef nonnull align 8 dereferenceable(73) %0, ptr noundef nonnull align 4 dereferenceable(64) %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"struct.cgp::camera_controller_generic_base", ptr %5, i32 0, i32 1
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %"struct.cgp::input_devices", ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds %"struct.cgp::inputs_keyboard_parameters", ptr %8, i32 0, i32 6
  %10 = call noundef zeroext i1 @_ZNK3cgp37inputs_keyboard_last_action_parameter10is_pressedEi(ptr noundef nonnull align 4 dereferenceable(8) %9, i32 noundef 67)
  br i1 %10, label %11, label %39

11:                                               ; preds = %2
  %12 = getelementptr inbounds %"struct.cgp::camera_controller_generic_base", ptr %5, i32 0, i32 1
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %"struct.cgp::input_devices", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %"struct.cgp::inputs_keyboard_parameters", ptr %14, i32 0, i32 0
  %16 = load i8, ptr %15, align 8, !tbaa !12, !range !32, !noundef !33
  %17 = trunc i8 %16 to i1
  br i1 %17, label %18, label %39

18:                                               ; preds = %11
  %19 = getelementptr inbounds %"struct.cgp::camera_controller_first_person", ptr %5, i32 0, i32 4
  %20 = load i8, ptr %19, align 8, !tbaa !34, !range !32, !noundef !33
  %21 = trunc i8 %20 to i1
  %22 = xor i1 %21, true
  %23 = getelementptr inbounds %"struct.cgp::camera_controller_first_person", ptr %5, i32 0, i32 4
  %24 = zext i1 %22 to i8
  store i8 %24, ptr %23, align 8, !tbaa !34
  %25 = getelementptr inbounds %"struct.cgp::camera_controller_first_person", ptr %5, i32 0, i32 4
  %26 = load i8, ptr %25, align 8, !tbaa !34, !range !32, !noundef !33
  %27 = trunc i8 %26 to i1
  br i1 %27, label %28, label %33

28:                                               ; preds = %18
  %29 = getelementptr inbounds %"struct.cgp::camera_controller_generic_base", ptr %5, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !42
  %31 = getelementptr inbounds %"struct.cgp::window_structure", ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !43
  call void @glfwSetInputMode(ptr noundef %32, i32 noundef 208897, i32 noundef 212995)
  br label %38

33:                                               ; preds = %18
  %34 = getelementptr inbounds %"struct.cgp::camera_controller_generic_base", ptr %5, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !42
  %36 = getelementptr inbounds %"struct.cgp::window_structure", ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !43
  call void @glfwSetInputMode(ptr noundef %37, i32 noundef 208897, i32 noundef 212993)
  br label %38

38:                                               ; preds = %33, %28
  br label %39

39:                                               ; preds = %38, %11, %2
  %40 = getelementptr inbounds %"struct.cgp::camera_controller_generic_base", ptr %5, i32 0, i32 1
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = getelementptr inbounds %"struct.cgp::input_devices", ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %"struct.cgp::inputs_keyboard_parameters", ptr %42, i32 0, i32 6
  %44 = call noundef zeroext i1 @_ZNK3cgp37inputs_keyboard_last_action_parameter10is_pressedEi(ptr noundef nonnull align 4 dereferenceable(8) %43, i32 noundef 256)
  br i1 %44, label %45, label %51

45:                                               ; preds = %39
  %46 = getelementptr inbounds %"struct.cgp::camera_controller_first_person", ptr %5, i32 0, i32 4
  store i8 0, ptr %46, align 8, !tbaa !34
  %47 = getelementptr inbounds %"struct.cgp::camera_controller_generic_base", ptr %5, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !42
  %49 = getelementptr inbounds %"struct.cgp::window_structure", ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !43
  call void @glfwSetInputMode(ptr noundef %50, i32 noundef 208897, i32 noundef 212993)
  br label %51

51:                                               ; preds = %45, %39
  ret void
}

declare noundef zeroext i1 @_ZNK3cgp37inputs_keyboard_last_action_parameter10is_pressedEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #1

declare void @glfwSetInputMode(ptr noundef, i32 noundef, i32 noundef) #1

attributes #0 = { mustprogress 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 = { "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++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3cgp30camera_controller_generic_baseE", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"bool", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_ZTSN3cgp13input_devicesE", !14, i64 0, !26, i64 64, !29, i64 96}
!14 = !{!"_ZTSN3cgp26inputs_keyboard_parametersE", !11, i64 0, !11, i64 1, !11, i64 2, !11, i64 3, !11, i64 4, !11, i64 5, !15, i64 8, !17, i64 16}
!15 = !{!"_ZTSN3cgp37inputs_keyboard_last_action_parameterE", !16, i64 0, !16, i64 4}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSSt3setIiSt4lessIiESaIiEE", !18, i64 0}
!18 = !{!"_ZTSSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE", !19, i64 0}
!19 = !{!"_ZTSNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE13_Rb_tree_implIS3_Lb1EEE", !20, i64 0, !22, i64 8}
!20 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIiEE", !21, i64 0}
!21 = !{!"_ZTSSt4lessIiE"}
!22 = !{!"_ZTSSt15_Rb_tree_header", !23, i64 0, !25, i64 32}
!23 = !{!"_ZTSSt18_Rb_tree_node_base", !24, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!24 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!25 = !{!"long", !7, i64 0}
!26 = !{!"_ZTSN3cgp23inputs_mouse_parametersE", !27, i64 0, !30, i64 16, !29, i64 24, !11, i64 28}
!27 = !{!"_ZTSN3cgp39inputs_mouse_cursor_position_parametersE", !28, i64 0, !28, i64 8}
!28 = !{!"_ZTSN3cgp14numarray_stackIfLi2EEE", !29, i64 0, !29, i64 4}
!29 = !{!"float", !7, i64 0}
!30 = !{!"_ZTSN3cgp36inputs_mouse_cursor_click_parametersE", !11, i64 0, !11, i64 1, !31, i64 4}
!31 = !{!"_ZTSN3cgp24last_mouse_cursor_actionE", !7, i64 0}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!35, !11, i64 72}
!35 = !{!"_ZTSN3cgp30camera_controller_first_personE", !10, i64 0, !36, i64 24, !29, i64 64, !29, i64 68, !11, i64 72}
!36 = !{!"_ZTSN3cgp19camera_first_personE", !37, i64 0, !38, i64 8, !41, i64 24}
!37 = !{!"_ZTSN3cgp19camera_generic_baseE"}
!38 = !{!"_ZTSN3cgp18rotation_transformE", !39, i64 0}
!39 = !{!"_ZTSN3cgp10quaternionE", !40, i64 0}
!40 = !{!"_ZTSN3cgp14numarray_stackIfLi4EEE", !29, i64 0, !29, i64 4, !29, i64 8, !29, i64 12}
!41 = !{!"_ZTSN3cgp14numarray_stackIfLi3EEE", !29, i64 0, !29, i64 4, !29, i64 8}
!42 = !{!10, !6, i64 16}
!43 = !{!44, !6, i64 0}
!44 = !{!"_ZTSN3cgp16window_structureE", !6, i64 0, !6, i64 8, !16, i64 16, !16, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !11, i64 40}


; 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: mustprogress uwtable
define dso_local void @_ZN3cgp30camera_controller_first_person15action_keyboardERNS_12matrix_stackIfLi4ELi4EEE(ptr nocapture noundef nonnull align 8 dereferenceable(73) %0, ptr nocapture noundef nonnull readnone align 4 dereferenceable(64) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  %6 = tail call noundef zeroext i1 @_ZNK3cgp37inputs_keyboard_last_action_parameter10is_pressedEi(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 67)
  br i1 %6, label %7, label %18

7:                                                ; preds = %2
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = load i8, ptr %8, align 8, !tbaa !11, !range !31, !noundef !32
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %.sink.split, label %18

.sink.split:                                      ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  %12 = load i8, ptr %11, align 8, !tbaa !33, !range !31, !noundef !32
  %13 = trunc nuw i8 %12 to i1
  %14 = xor i8 %12, 1
  store i8 %14, ptr %11, align 8, !tbaa !33
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !41
  %17 = load ptr, ptr %16, align 8, !tbaa !42
  %. = select i1 %13, i32 212993, i32 212995
  tail call void @glfwSetInputMode(ptr noundef %17, i32 noundef 208897, i32 noundef %.)
  br label %18

18:                                               ; preds = %.sink.split, %7, %2
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = tail call noundef zeroext i1 @_ZNK3cgp37inputs_keyboard_last_action_parameter10is_pressedEi(ptr noundef nonnull align 4 dereferenceable(8) %20, i32 noundef 256)
  br i1 %21, label %22, label %27

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %0, i64 72
  store i8 0, ptr %23, align 8, !tbaa !33
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !41
  %26 = load ptr, ptr %25, align 8, !tbaa !42
  tail call void @glfwSetInputMode(ptr noundef %26, i32 noundef 208897, i32 noundef 212993)
  br label %27

27:                                               ; preds = %22, %18
  ret void
}

declare noundef zeroext i1 @_ZNK3cgp37inputs_keyboard_last_action_parameter10is_pressedEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #1

declare void @glfwSetInputMode(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { "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, !10, i64 8}
!6 = !{!"_ZTSN3cgp30camera_controller_generic_baseE", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"_ZTSN3cgp13input_devicesE", !13, i64 0, !25, i64 64, !28, i64 96}
!13 = !{!"_ZTSN3cgp26inputs_keyboard_parametersE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !14, i64 8, !16, i64 16}
!14 = !{!"_ZTSN3cgp37inputs_keyboard_last_action_parameterE", !15, i64 0, !15, i64 4}
!15 = !{!"int", !8, i64 0}
!16 = !{!"_ZTSSt3setIiSt4lessIiESaIiEE", !17, i64 0}
!17 = !{!"_ZTSSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE", !18, i64 0}
!18 = !{!"_ZTSNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE13_Rb_tree_implIS3_Lb1EEE", !19, i64 0, !21, i64 8}
!19 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIiEE", !20, i64 0}
!20 = !{!"_ZTSSt4lessIiE"}
!21 = !{!"_ZTSSt15_Rb_tree_header", !22, i64 0, !24, i64 32}
!22 = !{!"_ZTSSt18_Rb_tree_node_base", !23, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!23 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!24 = !{!"long", !8, i64 0}
!25 = !{!"_ZTSN3cgp23inputs_mouse_parametersE", !26, i64 0, !29, i64 16, !28, i64 24, !7, i64 28}
!26 = !{!"_ZTSN3cgp39inputs_mouse_cursor_position_parametersE", !27, i64 0, !27, i64 8}
!27 = !{!"_ZTSN3cgp14numarray_stackIfLi2EEE", !28, i64 0, !28, i64 4}
!28 = !{!"float", !8, i64 0}
!29 = !{!"_ZTSN3cgp36inputs_mouse_cursor_click_parametersE", !7, i64 0, !7, i64 1, !30, i64 4}
!30 = !{!"_ZTSN3cgp24last_mouse_cursor_actionE", !8, i64 0}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!34, !7, i64 72}
!34 = !{!"_ZTSN3cgp30camera_controller_first_personE", !6, i64 0, !35, i64 24, !28, i64 64, !28, i64 68, !7, i64 72}
!35 = !{!"_ZTSN3cgp19camera_first_personE", !36, i64 0, !37, i64 8, !40, i64 24}
!36 = !{!"_ZTSN3cgp19camera_generic_baseE"}
!37 = !{!"_ZTSN3cgp18rotation_transformE", !38, i64 0}
!38 = !{!"_ZTSN3cgp10quaternionE", !39, i64 0}
!39 = !{!"_ZTSN3cgp14numarray_stackIfLi4EEE", !28, i64 0, !28, i64 4, !28, i64 8, !28, i64 12}
!40 = !{!"_ZTSN3cgp14numarray_stackIfLi3EEE", !28, i64 0, !28, i64 4, !28, i64 8}
!41 = !{!6, !10, i64 16}
!42 = !{!43, !10, i64 0}
!43 = !{!"_ZTSN3cgp16window_structureE", !10, i64 0, !10, i64 8, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !7, i64 40}


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