; LLVM IR from niessner/Matterport :: code/gaps/apps/mpview/mpview.ll (Z10GLUTMotionii)

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

%class.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }

@_ZL6center = external hidden global %class.R3Point, align 8
@_ZL6viewer = external hidden global ptr, align 8
@_ZL17GLUTwindow_height = external hidden global i32, align 4
@_ZL9GLUTmouse = external hidden global [2 x i32], align 4
@_ZL14GLUTmouse_drag = external hidden global i32, align 4
@_ZL13GLUTmodifiers = external hidden global i32, align 4
@_ZL10GLUTbutton = external hidden global [3 x i32], align 4
@R3posy_vector = external global %class.R3Vector, align 8

; 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

declare void @glutPostRedisplay() #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10GLUTMotionii(i32 noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %class.R3Vector, align 8
  %9 = alloca %class.R3Vector, align 8
  %10 = alloca %class.R3Vector, align 8
  %11 = alloca %class.R3Vector, align 8
  %12 = alloca %class.R3Vector, align 8
  %13 = alloca %class.R3Vector, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %14 = load i32, ptr @_ZL17GLUTwindow_height, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = sub nsw i32 %14, %15
  store i32 %16, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = load i32, ptr @_ZL9GLUTmouse, align 4, !tbaa !5
  %19 = sub nsw i32 %17, %18
  store i32 %19, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @_ZL9GLUTmouse, i64 0, i64 1), align 4, !tbaa !5
  %22 = sub nsw i32 %20, %21
  store i32 %22, ptr %6, align 4, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = mul nsw i32 %23, %24
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = mul nsw i32 %26, %27
  %29 = add nsw i32 %25, %28
  %30 = load i32, ptr @_ZL14GLUTmouse_drag, align 4, !tbaa !5
  %31 = add nsw i32 %30, %29
  store i32 %31, ptr @_ZL14GLUTmouse_drag, align 4, !tbaa !5
  %32 = load i32, ptr @_ZL13GLUTmodifiers, align 4, !tbaa !5
  %33 = and i32 %32, 1
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %94

35:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %36 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %37 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK8R3Viewer6CameraEv(ptr noundef nonnull align 8 dereferenceable(168) %36)
  store ptr %37, ptr %7, align 8, !tbaa !9
  %38 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %47

40:                                               ; preds = %35
  %41 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  %43 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera5RightEv(ptr noundef nonnull align 8 dereferenceable(144) %42)
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = sitofp i32 %44 to double
  %46 = fmul double -1.000000e-03, %45
  call void @_ZN8R3Viewer12RotateCameraERK8R3Vectord(ptr noundef nonnull align 8 dereferenceable(168) %41, ptr noundef nonnull align 8 dereferenceable(24) %43, double noundef %46)
  br label %47

47:                                               ; preds = %40, %35
  %48 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %55

50:                                               ; preds = %47
  %51 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = sitofp i32 %52 to double
  %54 = fmul double 1.000000e-03, %53
  call void @_ZN8R3Viewer12RotateCameraERK8R3Vectord(ptr noundef nonnull align 8 dereferenceable(168) %51, ptr noundef nonnull align 8 dereferenceable(24) @R3posy_vector, double noundef %54)
  br label %83

55:                                               ; preds = %47
  %56 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 1), align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %67

58:                                               ; preds = %55
  %59 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #6
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sitofp i32 %60 to double
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = sitofp i32 %62 to double
  %64 = fmul double 1.000000e-02, %63
  %65 = call double @llvm.fmuladd.f64(double 1.000000e-02, double %61, double %64)
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  %66 = load ptr, ptr %7, align 8, !tbaa !9
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %9, ptr noundef nonnull align 8 dereferenceable(144) %66)
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %8, double noundef %65, ptr noundef nonnull align 8 dereferenceable(24) %9)
  call void @_ZN8R3Viewer15TranslateCameraERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(168) %59, ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #6
  br label %82

67:                                               ; preds = %55
  %68 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 2), align 4, !tbaa !5
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %81

70:                                               ; preds = %67
  %71 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sitofp i32 %72 to double
  %74 = fmul double 1.000000e-02, %73
  %75 = load ptr, ptr %7, align 8, !tbaa !9
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera5RightEv(ptr noundef nonnull align 8 dereferenceable(144) %75)
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %11, double noundef %74, ptr noundef nonnull align 8 dereferenceable(24) %76)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = sitofp i32 %77 to double
  %79 = fmul double 1.000000e-02, %78
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #6
  %80 = load ptr, ptr %7, align 8, !tbaa !9
  call void @_ZNK8R3Camera4DownEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %13, ptr noundef nonnull align 8 dereferenceable(144) %80)
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %12, double noundef %79, ptr noundef nonnull align 8 dereferenceable(24) %13)
  call void @_ZplRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @_ZN8R3Viewer15TranslateCameraERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(168) %71, ptr noundef nonnull align 8 dereferenceable(24) %10)
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #6
  br label %81

81:                                               ; preds = %70, %67
  br label %82

82:                                               ; preds = %81, %58
  br label %83

83:                                               ; preds = %82, %50
  %84 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %92, label %86

86:                                               ; preds = %83
  %87 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 1), align 4, !tbaa !5
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %92, label %89

89:                                               ; preds = %86
  %90 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 2), align 4, !tbaa !5
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %89, %86, %83
  call void @glutPostRedisplay()
  br label %93

93:                                               ; preds = %92, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %143

94:                                               ; preds = %2
  %95 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %106

97:                                               ; preds = %94
  %98 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = load i32, ptr %5, align 4, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = load ptr, ptr %98, align 8, !tbaa !11
  %104 = getelementptr inbounds ptr, ptr %103, i64 11
  %105 = load ptr, ptr %104, align 8
  call void %105(ptr noundef nonnull align 8 dereferenceable(168) %98, double noundef 1.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) @_ZL6center, i32 noundef %99, i32 noundef %100, i32 noundef %101, i32 noundef %102)
  br label %132

106:                                              ; preds = %94
  %107 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 1), align 4, !tbaa !5
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %118

109:                                              ; preds = %106
  %110 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = load i32, ptr %6, align 4, !tbaa !5
  %115 = load ptr, ptr %110, align 8, !tbaa !11
  %116 = getelementptr inbounds ptr, ptr %115, i64 10
  %117 = load ptr, ptr %116, align 8
  call void %117(ptr noundef nonnull align 8 dereferenceable(168) %110, double noundef 1.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) @_ZL6center, i32 noundef %111, i32 noundef %112, i32 noundef %113, i32 noundef %114)
  br label %131

118:                                              ; preds = %106
  %119 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 2), align 4, !tbaa !5
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %130

121:                                              ; preds = %118
  %122 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %123 = load i32, ptr %3, align 4, !tbaa !5
  %124 = load i32, ptr %4, align 4, !tbaa !5
  %125 = load i32, ptr %5, align 4, !tbaa !5
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = load ptr, ptr %122, align 8, !tbaa !11
  %128 = getelementptr inbounds ptr, ptr %127, i64 9
  %129 = load ptr, ptr %128, align 8
  call void %129(ptr noundef nonnull align 8 dereferenceable(168) %122, double noundef 1.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) @_ZL6center, i32 noundef %123, i32 noundef %124, i32 noundef %125, i32 noundef %126)
  br label %130

130:                                              ; preds = %121, %118
  br label %131

131:                                              ; preds = %130, %109
  br label %132

132:                                              ; preds = %131, %97
  %133 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %141, label %135

135:                                              ; preds = %132
  %136 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 1), align 4, !tbaa !5
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %141, label %138

138:                                              ; preds = %135
  %139 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @_ZL10GLUTbutton, i64 0, i64 2), align 4, !tbaa !5
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %138, %135, %132
  call void @glutPostRedisplay()
  br label %142

142:                                              ; preds = %141, %138
  br label %143

143:                                              ; preds = %142, %93
  %144 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %144, ptr @_ZL9GLUTmouse, align 4, !tbaa !5
  %145 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %145, ptr getelementptr inbounds ([2 x i32], ptr @_ZL9GLUTmouse, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(144) ptr @_ZNK8R3Viewer6CameraEv(ptr noundef nonnull align 8 dereferenceable(168)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Viewer12RotateCameraERK8R3Vectord(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(24), double noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera5RightEv(ptr noundef nonnull align 8 dereferenceable(144)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Viewer15TranslateCameraERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmldRK8R3Vector(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, double noundef, ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(144)) #4 align 2

declare void @_ZplRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8R3Camera4DownEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(144)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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 #3 = { inlinehint 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" }
attributes #4 = { inlinehint 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, 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"

%class.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }

@_ZL6center = external hidden global %class.R3Point, align 8
@_ZL6viewer = external hidden local_unnamed_addr global ptr, align 8
@_ZL17GLUTwindow_height = external hidden local_unnamed_addr global i32, align 4
@_ZL9GLUTmouse = external hidden local_unnamed_addr global [2 x i32], align 4
@_ZL14GLUTmouse_drag = external hidden local_unnamed_addr global i32, align 4
@_ZL13GLUTmodifiers = external hidden local_unnamed_addr global i32, align 4
@_ZL10GLUTbutton = external hidden local_unnamed_addr global [3 x i32], align 4
@R3posy_vector = external global %class.R3Vector, align 8

; 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

declare void @glutPostRedisplay() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10GLUTMotionii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca %class.R3Vector, align 8
  %4 = alloca %class.R3Vector, align 8
  %5 = alloca %class.R3Vector, align 8
  %6 = alloca %class.R3Vector, align 8
  %7 = alloca %class.R3Vector, align 8
  %8 = alloca %class.R3Vector, align 8
  %9 = load i32, ptr @_ZL17GLUTwindow_height, align 4, !tbaa !5
  %10 = sub nsw i32 %9, %1
  %11 = load i32, ptr @_ZL9GLUTmouse, align 4, !tbaa !5
  %12 = sub nsw i32 %0, %11
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL9GLUTmouse, i64 4), align 4, !tbaa !5
  %14 = sub nsw i32 %10, %13
  %15 = mul nsw i32 %12, %12
  %16 = mul nsw i32 %14, %14
  %17 = load i32, ptr @_ZL14GLUTmouse_drag, align 4, !tbaa !5
  %18 = add i32 %17, %15
  %19 = add i32 %18, %16
  store i32 %19, ptr @_ZL14GLUTmouse_drag, align 4, !tbaa !5
  %20 = load i32, ptr @_ZL13GLUTmodifiers, align 4, !tbaa !5
  %21 = and i32 %20, 1
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %59, label %22

22:                                               ; preds = %2
  %23 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %24 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK8R3Viewer6CameraEv(ptr noundef nonnull align 8 dereferenceable(168) %23)
  %25 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %.not40 = icmp eq i32 %25, 0
  br i1 %.not40, label %.thread, label %26

26:                                               ; preds = %22
  %27 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %28 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera5RightEv(ptr noundef nonnull align 8 dereferenceable(144) %24)
  %29 = sitofp i32 %14 to double
  %30 = fmul double %29, -1.000000e-03
  tail call void @_ZN8R3Viewer12RotateCameraERK8R3Vectord(ptr noundef nonnull align 8 dereferenceable(168) %27, ptr noundef nonnull align 8 dereferenceable(24) %28, double noundef %30)
  %.pr = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %.not41 = icmp eq i32 %.pr, 0
  br i1 %.not41, label %.thread, label %31

31:                                               ; preds = %26
  %32 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %33 = sitofp i32 %12 to double
  %34 = fmul double %33, 1.000000e-03
  tail call void @_ZN8R3Viewer12RotateCameraERK8R3Vectord(ptr noundef nonnull align 8 dereferenceable(168) %32, ptr noundef nonnull align 8 dereferenceable(24) @R3posy_vector, double noundef %34)
  br label %51

.thread:                                          ; preds = %22, %26
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 4), align 4, !tbaa !5
  %.not42 = icmp eq i32 %35, 0
  br i1 %.not42, label %42, label %36

36:                                               ; preds = %.thread
  %37 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %38 = sitofp i32 %12 to double
  %39 = sitofp i32 %14 to double
  %40 = fmul double %39, 1.000000e-02
  %41 = tail call double @llvm.fmuladd.f64(double %38, double 1.000000e-02, double %40)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %4, ptr noundef nonnull align 8 dereferenceable(144) %24)
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %3, double noundef %41, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @_ZN8R3Viewer15TranslateCameraERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(168) %37, ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  br label %51

42:                                               ; preds = %.thread
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 8), align 4, !tbaa !5
  %.not43 = icmp eq i32 %43, 0
  br i1 %.not43, label %51, label %44

44:                                               ; preds = %42
  %45 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  %46 = sitofp i32 %12 to double
  %47 = fmul double %46, 1.000000e-02
  %48 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera5RightEv(ptr noundef nonnull align 8 dereferenceable(144) %24)
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %6, double noundef %47, ptr noundef nonnull align 8 dereferenceable(24) %48)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  %49 = sitofp i32 %14 to double
  %50 = fmul double %49, 1.000000e-02
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  call void @_ZNK8R3Camera4DownEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %8, ptr noundef nonnull align 8 dereferenceable(144) %24)
  call void @_ZmldRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %7, double noundef %50, ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @_ZplRK8R3VectorS1_(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @_ZN8R3Viewer15TranslateCameraERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(168) %45, ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  br label %51

51:                                               ; preds = %36, %44, %42, %31
  %52 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 4), align 4
  %55 = icmp ne i32 %54, 0
  %or.cond = select i1 %53, i1 true, i1 %55
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 8), align 4
  %57 = icmp ne i32 %56, 0
  %or.cond3 = select i1 %or.cond, i1 true, i1 %57
  br i1 %or.cond3, label %58, label %77

58:                                               ; preds = %51
  call void @glutPostRedisplay()
  br label %77

59:                                               ; preds = %2
  %60 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %.not37 = icmp eq i32 %60, 0
  br i1 %.not37, label %61, label %.sink.split

61:                                               ; preds = %59
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 4), align 4, !tbaa !5
  %.not38 = icmp eq i32 %62, 0
  br i1 %.not38, label %63, label %.sink.split

63:                                               ; preds = %61
  %64 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 8), align 4, !tbaa !5
  %.not39 = icmp eq i32 %64, 0
  br i1 %.not39, label %69, label %.sink.split

.sink.split:                                      ; preds = %63, %61, %59
  %.sink48 = phi i64 [ 88, %59 ], [ 80, %61 ], [ 72, %63 ]
  %65 = load ptr, ptr @_ZL6viewer, align 8, !tbaa !9
  %66 = load ptr, ptr %65, align 8, !tbaa !11
  %67 = getelementptr inbounds i8, ptr %66, i64 %.sink48
  %68 = load ptr, ptr %67, align 8
  tail call void %68(ptr noundef nonnull align 8 dereferenceable(168) %65, double noundef 1.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) @_ZL6center, i32 noundef %0, i32 noundef %10, i32 noundef %12, i32 noundef %14)
  br label %69

69:                                               ; preds = %.sink.split, %63
  %70 = load i32, ptr @_ZL10GLUTbutton, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 4), align 4
  %73 = icmp ne i32 %72, 0
  %or.cond5 = select i1 %71, i1 true, i1 %73
  %74 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL10GLUTbutton, i64 8), align 4
  %75 = icmp ne i32 %74, 0
  %or.cond7 = select i1 %or.cond5, i1 true, i1 %75
  br i1 %or.cond7, label %76, label %77

76:                                               ; preds = %69
  tail call void @glutPostRedisplay()
  br label %77

77:                                               ; preds = %58, %51, %76, %69
  store i32 %0, ptr @_ZL9GLUTmouse, align 4, !tbaa !5
  store i32 %10, ptr getelementptr inbounds (i8, ptr @_ZL9GLUTmouse, i64 4), align 4, !tbaa !5
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(144) ptr @_ZNK8R3Viewer6CameraEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Viewer12RotateCameraERK8R3Vectord(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera5RightEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Viewer15TranslateCameraERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmldRK8R3Vector(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, double noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #4 align 2

declare void @_ZplRK8R3VectorS1_(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8R3Camera4DownEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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 #3 = { inlinehint 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" }
attributes #4 = { inlinehint 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass