; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/examples (boing)

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

@glad_glCullFace = external dso_local global ptr, align 8
@glad_glEnable = external dso_local global ptr, align 8
@glad_glMatrixMode = external dso_local global ptr, align 8
@glad_glPopMatrix = external dso_local global ptr, align 8
@glad_glPushMatrix = external dso_local global ptr, align 8
@glad_glRotatef = external dso_local global ptr, align 8
@glad_glTranslatef = external dso_local global ptr, align 8
@deg_rot_y = external dso_local global float, align 4
@deg_rot_y_inc = external dso_local global float, align 4
@ball_x = external dso_local global float, align 4
@ball_y = external dso_local global float, align 4
@drawBallHow = external dso_local global i32, align 4
@dt = external dso_local global double, 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

; Function Attrs: nounwind uwtable
declare dso_local float @TruncateDeg(float noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
define dso_local void @DrawBoingBall() #1 {
  %1 = alloca float, align 4
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %4 = load ptr, ptr @glad_glPushMatrix, align 8, !tbaa !5
  call void %4()
  %5 = load ptr, ptr @glad_glMatrixMode, align 8, !tbaa !5
  call void %5(i32 noundef 5888)
  %6 = load ptr, ptr @glad_glTranslatef, align 8, !tbaa !5
  call void %6(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 1.470000e+02)
  %7 = load double, ptr @dt, align 8, !tbaa !9
  store double %7, ptr %2, align 8, !tbaa !9
  br label %8

8:                                                ; preds = %17, %0
  %9 = load double, ptr %2, align 8, !tbaa !9
  %10 = fcmp ogt double %9, 0.000000e+00
  br i1 %10, label %11, label %30

11:                                               ; preds = %8
  %12 = load double, ptr %2, align 8, !tbaa !9
  %13 = fcmp ogt double %12, 0x3F947AE140000000
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  br label %17

15:                                               ; preds = %11
  %16 = load double, ptr %2, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %15, %14
  %18 = phi double [ 0x3F947AE140000000, %14 ], [ %16, %15 ]
  store double %18, ptr %3, align 8, !tbaa !9
  %19 = load double, ptr %3, align 8, !tbaa !9
  %20 = load double, ptr %2, align 8, !tbaa !9
  %21 = fsub double %20, %19
  store double %21, ptr %2, align 8, !tbaa !9
  %22 = load double, ptr %3, align 8, !tbaa !9
  call void @BounceBall(double noundef %22)
  %23 = load float, ptr @deg_rot_y, align 4, !tbaa !11
  %24 = load float, ptr @deg_rot_y_inc, align 4, !tbaa !11
  %25 = load double, ptr %3, align 8, !tbaa !9
  %26 = fptrunc double %25 to float
  %27 = fmul float %26, 5.000000e+01
  %28 = call float @llvm.fmuladd.f32(float %24, float %27, float %23)
  %29 = call float @TruncateDeg(float noundef %28)
  store float %29, ptr @deg_rot_y, align 4, !tbaa !11
  br label %8, !llvm.loop !13

30:                                               ; preds = %8
  %31 = load ptr, ptr @glad_glTranslatef, align 8, !tbaa !5
  %32 = load float, ptr @ball_x, align 4, !tbaa !11
  %33 = load float, ptr @ball_y, align 4, !tbaa !11
  call void %31(float noundef %32, float noundef %33, float noundef 0.000000e+00)
  %34 = load i32, ptr @drawBallHow, align 4, !tbaa !15
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %38

36:                                               ; preds = %30
  %37 = load ptr, ptr @glad_glTranslatef, align 8, !tbaa !5
  call void %37(float noundef -2.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00)
  br label %38

38:                                               ; preds = %36, %30
  %39 = load ptr, ptr @glad_glRotatef, align 8, !tbaa !5
  call void %39(float noundef -2.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 1.000000e+00)
  %40 = load ptr, ptr @glad_glRotatef, align 8, !tbaa !5
  %41 = load float, ptr @deg_rot_y, align 4, !tbaa !11
  call void %40(float noundef %41, float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef 0.000000e+00)
  %42 = load ptr, ptr @glad_glCullFace, align 8, !tbaa !5
  call void %42(i32 noundef 1028)
  %43 = load ptr, ptr @glad_glEnable, align 8, !tbaa !5
  call void %43(i32 noundef 2884)
  %44 = load ptr, ptr @glad_glEnable, align 8, !tbaa !5
  call void %44(i32 noundef 2977)
  store float 0.000000e+00, ptr %1, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %52, %38
  %46 = load float, ptr %1, align 4, !tbaa !11
  %47 = fcmp olt float %46, 1.800000e+02
  br i1 %47, label %48, label %55

48:                                               ; preds = %45
  %49 = load float, ptr %1, align 4, !tbaa !11
  %50 = load float, ptr %1, align 4, !tbaa !11
  %51 = fadd float %50, 2.250000e+01
  call void @DrawBoingBallBand(float noundef %49, float noundef %51)
  br label %52

52:                                               ; preds = %48
  %53 = load float, ptr %1, align 4, !tbaa !11
  %54 = fadd float %53, 2.250000e+01
  store float %54, ptr %1, align 4, !tbaa !11
  br label %45, !llvm.loop !17

55:                                               ; preds = %45
  %56 = load ptr, ptr @glad_glPopMatrix, align 8, !tbaa !5
  call void %56()
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @BounceBall(double noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @DrawBoingBallBand(float noundef, float noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !14}


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

@glad_glCullFace = external dso_local local_unnamed_addr global ptr, align 8
@glad_glEnable = external dso_local local_unnamed_addr global ptr, align 8
@glad_glMatrixMode = external dso_local local_unnamed_addr global ptr, align 8
@glad_glPopMatrix = external dso_local local_unnamed_addr global ptr, align 8
@glad_glPushMatrix = external dso_local local_unnamed_addr global ptr, align 8
@glad_glRotatef = external dso_local local_unnamed_addr global ptr, align 8
@glad_glTranslatef = external dso_local local_unnamed_addr global ptr, align 8
@deg_rot_y = external dso_local local_unnamed_addr global float, align 4
@deg_rot_y_inc = external dso_local local_unnamed_addr global float, align 4
@ball_x = external dso_local local_unnamed_addr global float, align 4
@ball_y = external dso_local local_unnamed_addr global float, align 4
@drawBallHow = external dso_local local_unnamed_addr global i32, align 4
@dt = external dso_local local_unnamed_addr global double, align 8

; Function Attrs: nounwind uwtable
declare dso_local float @TruncateDeg(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
define dso_local void @DrawBoingBall() local_unnamed_addr #0 {
  %1 = load ptr, ptr @glad_glPushMatrix, align 8, !tbaa !5
  tail call void %1() #3
  %2 = load ptr, ptr @glad_glMatrixMode, align 8, !tbaa !5
  tail call void %2(i32 noundef 5888) #3
  %3 = load ptr, ptr @glad_glTranslatef, align 8, !tbaa !5
  tail call void %3(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 1.470000e+02) #3
  %4 = load double, ptr @dt, align 8, !tbaa !9
  %5 = fcmp ogt double %4, 0.000000e+00
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.01112 = phi double [ %8, %.lr.ph ], [ %4, %0 ]
  %6 = fcmp ogt double %.01112, 0x3F947AE140000000
  %7 = select i1 %6, double 0x3F947AE140000000, double %.01112
  %8 = fsub double %.01112, %7
  tail call void @BounceBall(double noundef %7)
  %9 = load float, ptr @deg_rot_y, align 4, !tbaa !11
  %10 = load float, ptr @deg_rot_y_inc, align 4, !tbaa !11
  %11 = fptrunc double %7 to float
  %12 = fmul float %11, 5.000000e+01
  %13 = tail call float @llvm.fmuladd.f32(float %10, float %12, float %9)
  %14 = tail call float @TruncateDeg(float noundef %13)
  store float %14, ptr @deg_rot_y, align 4, !tbaa !11
  %15 = fcmp ogt double %8, 0.000000e+00
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %0
  %16 = load ptr, ptr @glad_glTranslatef, align 8, !tbaa !5
  %17 = load float, ptr @ball_x, align 4, !tbaa !11
  %18 = load float, ptr @ball_y, align 4, !tbaa !11
  tail call void %16(float noundef %17, float noundef %18, float noundef 0.000000e+00) #3
  %19 = load i32, ptr @drawBallHow, align 4, !tbaa !15
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %23

21:                                               ; preds = %._crit_edge
  %22 = load ptr, ptr @glad_glTranslatef, align 8, !tbaa !5
  tail call void %22(float noundef -2.000000e+01, float noundef 1.000000e+01, float noundef 0.000000e+00) #3
  br label %23

23:                                               ; preds = %21, %._crit_edge
  %24 = load ptr, ptr @glad_glRotatef, align 8, !tbaa !5
  tail call void %24(float noundef -2.000000e+01, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 1.000000e+00) #3
  %25 = load ptr, ptr @glad_glRotatef, align 8, !tbaa !5
  %26 = load float, ptr @deg_rot_y, align 4, !tbaa !11
  tail call void %25(float noundef %26, float noundef 0.000000e+00, float noundef 1.000000e+00, float noundef 0.000000e+00) #3
  %27 = load ptr, ptr @glad_glCullFace, align 8, !tbaa !5
  tail call void %27(i32 noundef 1028) #3
  %28 = load ptr, ptr @glad_glEnable, align 8, !tbaa !5
  tail call void %28(i32 noundef 2884) #3
  %29 = load ptr, ptr @glad_glEnable, align 8, !tbaa !5
  tail call void %29(i32 noundef 2977) #3
  tail call void @DrawBoingBallBand(float noundef 0.000000e+00, float noundef 2.250000e+01)
  tail call void @DrawBoingBallBand(float noundef 2.250000e+01, float noundef 4.500000e+01)
  tail call void @DrawBoingBallBand(float noundef 4.500000e+01, float noundef 6.750000e+01)
  tail call void @DrawBoingBallBand(float noundef 6.750000e+01, float noundef 9.000000e+01)
  tail call void @DrawBoingBallBand(float noundef 9.000000e+01, float noundef 1.125000e+02)
  tail call void @DrawBoingBallBand(float noundef 1.125000e+02, float noundef 1.350000e+02)
  tail call void @DrawBoingBallBand(float noundef 1.350000e+02, float noundef 1.575000e+02)
  tail call void @DrawBoingBallBand(float noundef 1.575000e+02, float noundef 1.800000e+02)
  %30 = load ptr, ptr @glad_glPopMatrix, align 8, !tbaa !5
  tail call void %30() #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @BounceBall(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @DrawBoingBallBand(float noundef, float noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="64" "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 }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass