; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/tests (gamma)

; 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.nk_vec2 = type { float, float }

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__.nk_draw_list_path_arc_to = external hidden unnamed_addr constant [104 x i8], align 1

; 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 <2 x float> @nk_vec2(float noundef, float noundef) #1

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

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

; Function Attrs: nounwind uwtable
declare hidden float @nk_cos(float noundef) #4

; Function Attrs: nounwind uwtable
declare hidden float @nk_sin(float noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @nk_draw_list_path_line_to(ptr noundef, <2 x float>) #1

; Function Attrs: nounwind uwtable
define dso_local void @nk_draw_list_path_arc_to(ptr noundef %0, <2 x float> %1, float noundef %2, float noundef %3, float noundef %4, i32 noundef %5) #1 {
  %7 = alloca %struct.nk_vec2, align 4
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  %23 = alloca float, align 4
  %24 = alloca %struct.nk_vec2, align 4
  store <2 x float> %1, ptr %7, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !9
  store float %3, ptr %10, align 4, !tbaa !9
  store float %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !11
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %6
  br label %29

28:                                               ; preds = %6
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.2, i32 noundef 10035, ptr noundef @__PRETTY_FUNCTION__.nk_draw_list_path_arc_to) #6
  unreachable

29:                                               ; preds = %27
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 1, ptr %14, align 4
  br label %93

33:                                               ; preds = %29
  %34 = load float, ptr %9, align 4, !tbaa !9
  %35 = fcmp oeq float %34, 0.000000e+00
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  store i32 1, ptr %14, align 4
  br label %93

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %38 = load float, ptr %11, align 4, !tbaa !9
  %39 = load float, ptr %10, align 4, !tbaa !9
  %40 = fsub float %38, %39
  %41 = load i32, ptr %12, align 4, !tbaa !11
  %42 = uitofp i32 %41 to float
  %43 = fdiv float %40, %42
  store float %43, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %44 = load float, ptr %15, align 4, !tbaa !9
  %45 = call float @nk_sin(float noundef %44)
  store float %45, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %46 = load float, ptr %15, align 4, !tbaa !9
  %47 = call float @nk_cos(float noundef %46)
  store float %47, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %48 = load float, ptr %10, align 4, !tbaa !9
  %49 = call float @nk_cos(float noundef %48)
  %50 = load float, ptr %9, align 4, !tbaa !9
  %51 = fmul float %49, %50
  store float %51, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %52 = load float, ptr %10, align 4, !tbaa !9
  %53 = call float @nk_sin(float noundef %52)
  %54 = load float, ptr %9, align 4, !tbaa !9
  %55 = fmul float %53, %54
  store float %55, ptr %19, align 4, !tbaa !9
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %89, %37
  %57 = load i32, ptr %13, align 4, !tbaa !11
  %58 = load i32, ptr %12, align 4, !tbaa !11
  %59 = icmp ule i32 %57, %58
  br i1 %59, label %60, label %92

60:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %61 = getelementptr inbounds %struct.nk_vec2, ptr %7, i32 0, i32 0
  %62 = load float, ptr %61, align 4, !tbaa !13
  %63 = load float, ptr %18, align 4, !tbaa !9
  %64 = fadd float %62, %63
  store float %64, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %65 = getelementptr inbounds %struct.nk_vec2, ptr %7, i32 0, i32 1
  %66 = load float, ptr %65, align 4, !tbaa !15
  %67 = load float, ptr %19, align 4, !tbaa !9
  %68 = fadd float %66, %67
  store float %68, ptr %23, align 4, !tbaa !9
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load float, ptr %22, align 4, !tbaa !9
  %71 = load float, ptr %23, align 4, !tbaa !9
  %72 = call <2 x float> @nk_vec2(float noundef %70, float noundef %71)
  store <2 x float> %72, ptr %24, align 4
  %73 = load <2 x float>, ptr %24, align 4
  call void @nk_draw_list_path_line_to(ptr noundef %69, <2 x float> %73)
  %74 = load float, ptr %18, align 4, !tbaa !9
  %75 = load float, ptr %17, align 4, !tbaa !9
  %76 = load float, ptr %19, align 4, !tbaa !9
  %77 = load float, ptr %16, align 4, !tbaa !9
  %78 = fmul float %76, %77
  %79 = fneg float %78
  %80 = call float @llvm.fmuladd.f32(float %74, float %75, float %79)
  store float %80, ptr %20, align 4, !tbaa !9
  %81 = load float, ptr %19, align 4, !tbaa !9
  %82 = load float, ptr %17, align 4, !tbaa !9
  %83 = load float, ptr %18, align 4, !tbaa !9
  %84 = load float, ptr %16, align 4, !tbaa !9
  %85 = fmul float %83, %84
  %86 = call float @llvm.fmuladd.f32(float %81, float %82, float %85)
  store float %86, ptr %21, align 4, !tbaa !9
  %87 = load float, ptr %20, align 4, !tbaa !9
  store float %87, ptr %18, align 4, !tbaa !9
  %88 = load float, ptr %21, align 4, !tbaa !9
  store float %88, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %89

89:                                               ; preds = %60
  %90 = load i32, ptr %13, align 4, !tbaa !11
  %91 = add i32 %90, 1
  store i32 %91, ptr %13, align 4, !tbaa !11
  br label %56, !llvm.loop !16

92:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  store i32 0, ptr %14, align 4
  br label %93

93:                                               ; preds = %92, %36, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %94 = load i32, ptr %14, align 4
  switch i32 %94, label %96 [
    i32 0, label %95
    i32 1, label %95
  ]

95:                                               ; preds = %93, %93
  ret void

96:                                               ; preds = %93
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"nk_vec2", !10, i64 0, !10, i64 4}
!15 = !{!14, !10, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@__PRETTY_FUNCTION__.nk_draw_list_path_arc_to = external hidden unnamed_addr constant [104 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local <2 x float> @nk_vec2(float noundef, float noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare hidden float @nk_cos(float noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden float @nk_sin(float noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_draw_list_path_line_to(ptr noundef, <2 x float>) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @nk_draw_list_path_arc_to(ptr noundef %0, <2 x float> %1, float noundef %2, float noundef %3, float noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.2, i32 noundef 10035, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_draw_list_path_arc_to) #4
  unreachable

8:                                                ; preds = %6
  %9 = fcmp oeq float %2, 0.000000e+00
  br i1 %9, label %.loopexit, label %10

10:                                               ; preds = %8
  %11 = fsub float %4, %3
  %12 = uitofp i32 %5 to float
  %13 = fdiv float %11, %12
  %14 = tail call float @nk_sin(float noundef %13)
  %15 = tail call float @nk_cos(float noundef %13)
  %16 = tail call float @nk_cos(float noundef %3)
  %17 = fmul float %16, %2
  %18 = tail call float @nk_sin(float noundef %3)
  %19 = fmul float %18, %2
  %.sroa.029.0.vec.extract = extractelement <2 x float> %1, i64 0
  %.sroa.029.4.vec.extract = extractelement <2 x float> %1, i64 1
  br label %20

20:                                               ; preds = %10, %20
  %.037 = phi i32 [ 0, %10 ], [ %29, %20 ]
  %.03036 = phi float [ %17, %10 ], [ %26, %20 ]
  %.03135 = phi float [ %19, %10 ], [ %28, %20 ]
  %21 = fadd float %.sroa.029.0.vec.extract, %.03036
  %22 = fadd float %.sroa.029.4.vec.extract, %.03135
  %23 = tail call <2 x float> @nk_vec2(float noundef %21, float noundef %22)
  tail call void @nk_draw_list_path_line_to(ptr noundef nonnull %0, <2 x float> %23)
  %24 = fneg float %.03135
  %25 = fmul float %14, %24
  %26 = tail call float @llvm.fmuladd.f32(float %.03036, float %15, float %25)
  %27 = fmul float %14, %.03036
  %28 = tail call float @llvm.fmuladd.f32(float %.03135, float %15, float %27)
  %29 = add i32 %.037, 1
  %.not34 = icmp ugt i32 %29, %5
  br i1 %.not34, label %.loopexit, label %20, !llvm.loop !5

.loopexit:                                        ; preds = %20, %8
  ret void
}

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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