; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/src/input.ll (glfwInputMouseClick)

; 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._GLFWwindow = type { ptr, i32, i32, i32, i32, i32, i32, i32, ptr, i32, %struct.GLFWvidmode, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [8 x i8], [349 x i8], double, double, i32, %struct._GLFWcontext, %struct.anon.1, %struct._GLFWwindowNull }
%struct.GLFWvidmode = type { i32, i32, i32, i32, i32, i32 }
%struct._GLFWcontext = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.anon, %struct.anon.0 }
%struct.anon = type { ptr, ptr, ptr, ptr }
%struct.anon.0 = type { ptr, i32, i32, ptr }
%struct.anon.1 = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._GLFWwindowNull = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@__PRETTY_FUNCTION__._glfwInputMouseClick = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

11:                                               ; preds = %4
  br label %13

12:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 349, ptr noundef @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

13:                                               ; preds = %11
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = icmp sge i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  br label %18

17:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 350, ptr noundef @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

18:                                               ; preds = %16
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %24, label %21

21:                                               ; preds = %18
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %21, %18
  br label %26

25:                                               ; preds = %21
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 351, ptr noundef @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

26:                                               ; preds = %24
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = and i32 %28, 63
  %30 = icmp eq i32 %27, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  br label %33

32:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 352, ptr noundef @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

33:                                               ; preds = %31
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %44, label %36

36:                                               ; preds = %33
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._GLFWwindow, ptr %37, i32 0, i32 23
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %45, label %41

41:                                               ; preds = %36
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = icmp sgt i32 %42, 7
  br i1 %43, label %44, label %45

44:                                               ; preds = %41, %33
  br label %94

45:                                               ; preds = %41, %36
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._GLFWwindow, ptr %46, i32 0, i32 22
  %48 = load i32, ptr %47, align 8, !tbaa !21
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %53, label %50

50:                                               ; preds = %45
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = and i32 %51, -49
  store i32 %52, ptr %8, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %50, %45
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = icmp sle i32 %54, 7
  br i1 %55, label %56, label %79

56:                                               ; preds = %53
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %70

59:                                               ; preds = %56
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._GLFWwindow, ptr %60, i32 0, i32 21
  %62 = load i32, ptr %61, align 4, !tbaa !22
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %70

64:                                               ; preds = %59
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._GLFWwindow, ptr %65, i32 0, i32 25
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [8 x i8], ptr %66, i64 0, i64 %68
  store i8 3, ptr %69, align 1, !tbaa !23
  br label %78

70:                                               ; preds = %59, %56
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = trunc i32 %71 to i8
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._GLFWwindow, ptr %73, i32 0, i32 25
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [8 x i8], ptr %74, i64 0, i64 %76
  store i8 %72, ptr %77, align 1, !tbaa !23
  br label %78

78:                                               ; preds = %70, %64
  br label %79

79:                                               ; preds = %78, %53
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._GLFWwindow, ptr %80, i32 0, i32 31
  %82 = getelementptr inbounds %struct.anon.1, ptr %81, i32 0, i32 9
  %83 = load ptr, ptr %82, align 8, !tbaa !24
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %94

85:                                               ; preds = %79
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._GLFWwindow, ptr %86, i32 0, i32 31
  %88 = getelementptr inbounds %struct.anon.1, ptr %87, i32 0, i32 9
  %89 = load ptr, ptr %88, align 8, !tbaa !24
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load i32, ptr %6, align 4, !tbaa !9
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = load i32, ptr %8, align 4, !tbaa !9
  call void %89(ptr noundef %90, i32 noundef %91, i32 noundef %92, i32 noundef %93)
  br label %94

94:                                               ; preds = %85, %79, %44
  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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 140}
!12 = !{!"_GLFWwindow", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !10, i64 48, !13, i64 52, !6, i64 80, !6, i64 88, !6, i64 96, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !7, i64 148, !7, i64 156, !14, i64 512, !14, i64 520, !10, i64 528, !15, i64 536, !18, i64 712, !19, i64 848}
!13 = !{!"GLFWvidmode", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_GLFWcontext", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !16, i64 120, !17, i64 152}
!16 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!17 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!18 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!19 = !{!"_GLFWwindowNull", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !20, i64 44}
!20 = !{!"float", !7, i64 0}
!21 = !{!12, !10, i64 136}
!22 = !{!12, !10, i64 132}
!23 = !{!7, !7, i64 0}
!24 = !{!12, !6, i64 784}


; 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 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@__PRETTY_FUNCTION__._glfwInputMouseClick = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 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 @_glfwInputMouseClick(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 349, ptr noundef nonnull @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

6:                                                ; preds = %4
  %7 = icmp sgt i32 %1, -1
  br i1 %7, label %9, label %8

8:                                                ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 350, ptr noundef nonnull @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

9:                                                ; preds = %6
  %10 = icmp eq i32 %2, 0
  %or.cond = icmp ult i32 %2, 2
  br i1 %or.cond, label %12, label %11

11:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 351, ptr noundef nonnull @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

12:                                               ; preds = %9
  %13 = icmp ult i32 %3, 64
  br i1 %13, label %15, label %14

14:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 352, ptr noundef nonnull @__PRETTY_FUNCTION__._glfwInputMouseClick) #2
  unreachable

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 140
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 0
  %19 = icmp ugt i32 %1, 7
  %or.cond3 = and i1 %19, %18
  br i1 %or.cond3, label %38, label %20

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %0, i64 136
  %22 = load i32, ptr %21, align 8, !tbaa !19
  %.not31 = icmp eq i32 %22, 0
  %23 = and i32 %3, 15
  %spec.select = select i1 %.not31, i32 %23, i32 %3
  %24 = icmp ult i32 %1, 8
  br i1 %24, label %25, label %34

25:                                               ; preds = %20
  br i1 %10, label %26, label %29

26:                                               ; preds = %25
  %27 = getelementptr inbounds i8, ptr %0, i64 132
  %28 = load i32, ptr %27, align 4, !tbaa !20
  %.not32 = icmp eq i32 %28, 0
  br i1 %.not32, label %29, label %.sink.split

29:                                               ; preds = %26, %25
  %30 = trunc nuw i32 %2 to i8
  br label %.sink.split

.sink.split:                                      ; preds = %26, %29
  %.sink = phi i8 [ %30, %29 ], [ 3, %26 ]
  %31 = getelementptr inbounds i8, ptr %0, i64 148
  %32 = zext nneg i32 %1 to i64
  %33 = getelementptr inbounds [8 x i8], ptr %31, i64 0, i64 %32
  store i8 %.sink, ptr %33, align 1, !tbaa !21
  br label %34

34:                                               ; preds = %.sink.split, %20
  %35 = getelementptr inbounds i8, ptr %0, i64 784
  %36 = load ptr, ptr %35, align 8, !tbaa !22
  %.not33 = icmp eq ptr %36, null
  br i1 %.not33, label %38, label %37

37:                                               ; preds = %34
  tail call void %36(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2, i32 noundef %spec.select) #3
  br label %38

38:                                               ; preds = %15, %37, %34
  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 }
attributes #3 = { 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 140}
!6 = !{!"_GLFWwindow", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !7, i64 40, !10, i64 48, !11, i64 52, !7, i64 80, !7, i64 88, !7, i64 96, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !8, i64 148, !8, i64 156, !12, i64 512, !12, i64 520, !10, i64 528, !13, i64 536, !16, i64 712, !17, i64 848}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"GLFWvidmode", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_GLFWcontext", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !14, i64 120, !15, i64 152}
!14 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!15 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16}
!16 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128}
!17 = !{!"_GLFWwindowNull", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !18, i64 44}
!18 = !{!"float", !8, i64 0}
!19 = !{!6, !10, i64 136}
!20 = !{!6, !10, i64 132}
!21 = !{!8, !8, i64 0}
!22 = !{!6, !7, i64 784}


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