; LLVM IR from drohmer/cgp :: library/cgp/15_input_devices (input_devices)

; 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::inputs_mouse_cursor_click_parameters" = type { i8, i8, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3cgp36inputs_mouse_cursor_click_parameters22update_from_glfw_clickEii(ptr noundef nonnull align 4 dereferenceable(8) %0, i32 noundef %1, i32 noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %16

10:                                               ; preds = %3
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %16

13:                                               ; preds = %10
  %14 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 0
  store i8 1, ptr %14, align 4, !tbaa !11
  %15 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 2
  store i32 0, ptr %15, align 4, !tbaa !15
  br label %16

16:                                               ; preds = %13, %10, %3
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %25

19:                                               ; preds = %16
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 0
  store i8 0, ptr %23, align 4, !tbaa !11
  %24 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 2
  store i32 2, ptr %24, align 4, !tbaa !15
  br label %25

25:                                               ; preds = %22, %19, %16
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %28, label %34

28:                                               ; preds = %25
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  %32 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 1
  store i8 1, ptr %32, align 1, !tbaa !16
  %33 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 2
  store i32 1, ptr %33, align 4, !tbaa !15
  br label %34

34:                                               ; preds = %31, %28, %25
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %43

37:                                               ; preds = %34
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %43

40:                                               ; preds = %37
  %41 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 1
  store i8 0, ptr %41, align 1, !tbaa !16
  %42 = getelementptr inbounds %"struct.cgp::inputs_mouse_cursor_click_parameters", ptr %7, i32 0, i32 2
  store i32 3, ptr %42, align 4, !tbaa !15
  br label %43

43:                                               ; preds = %40, %37, %34
  ret void
}

attributes #0 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3cgp36inputs_mouse_cursor_click_parametersE", !13, i64 0, !13, i64 1, !14, i64 4}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN3cgp24last_mouse_cursor_actionE", !7, i64 0}
!15 = !{!12, !14, i64 4}
!16 = !{!12, !13, i64 1}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_ZN3cgp36inputs_mouse_cursor_click_parameters22update_from_glfw_clickEii(ptr nocapture noundef nonnull writeonly align 4 dereferenceable(8) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = icmp eq i32 %1, 0
  %5 = icmp eq i32 %2, 1
  %or.cond = and i1 %4, %5
  br i1 %or.cond, label %6, label %8

6:                                                ; preds = %3
  store i8 1, ptr %0, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %8

8:                                                ; preds = %6, %3
  %9 = icmp eq i32 %2, 0
  %10 = or i32 %2, %1
  %or.cond3 = icmp eq i32 %10, 0
  br i1 %or.cond3, label %11, label %13

11:                                               ; preds = %8
  store i8 0, ptr %0, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 2, ptr %12, align 4, !tbaa !11
  br label %13

13:                                               ; preds = %11, %8
  %14 = icmp eq i32 %1, 1
  %or.cond5 = and i1 %14, %5
  br i1 %or.cond5, label %.sink.split, label %15

15:                                               ; preds = %13
  %or.cond7 = and i1 %14, %9
  br i1 %or.cond7, label %.sink.split, label %18

.sink.split:                                      ; preds = %15, %13
  %.sink17 = phi i8 [ 1, %13 ], [ 0, %15 ]
  %.sink = phi i32 [ 1, %13 ], [ 3, %15 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 1
  store i8 %.sink17, ptr %16, align 1, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %.sink, ptr %17, align 4, !tbaa !11
  br label %18

18:                                               ; preds = %.sink.split, %15
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !7, i64 0}
!6 = !{!"_ZTSN3cgp36inputs_mouse_cursor_click_parametersE", !7, i64 0, !7, i64 1, !10, i64 4}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3cgp24last_mouse_cursor_actionE", !8, i64 0}
!11 = !{!6, !10, i64 4}
!12 = !{!6, !7, i64 1}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass