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

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.nk_plot_function = external hidden unnamed_addr constant [105 x i8], align 1
@.str.133 = external hidden unnamed_addr constant [13 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_chart_begin(ptr noundef, i32 noundef, i32 noundef, float noundef, float noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_chart_push(ptr noundef, float noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @nk_chart_end(ptr noundef) #2

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

20:                                               ; preds = %6
  br label %22

21:                                               ; preds = %6
  call void @__assert_fail(ptr noundef @.str.33, ptr noundef @.str.2, i32 noundef 24323, ptr noundef @__PRETTY_FUNCTION__.nk_plot_function) #4
  unreachable

22:                                               ; preds = %20
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  br label %27

26:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.133, ptr noundef @.str.2, i32 noundef 24324, ptr noundef @__PRETTY_FUNCTION__.nk_plot_function) #4
  unreachable

27:                                               ; preds = %25
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %36

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

33:                                               ; preds = %30
  %34 = load i32, ptr %11, align 4, !tbaa !9
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %33, %30, %27
  store i32 1, ptr %16, align 4
  br label %102

37:                                               ; preds = %33
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = load i32, ptr %12, align 4, !tbaa !9
  %41 = call float %38(ptr noundef %39, i32 noundef %40)
  store float %41, ptr %14, align 4, !tbaa !11
  store float %41, ptr %15, align 4, !tbaa !11
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %71, %37
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %74

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load i32, ptr %13, align 4, !tbaa !9
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = add nsw i32 %49, %50
  %52 = call float %47(ptr noundef %48, i32 noundef %51)
  store float %52, ptr %17, align 4, !tbaa !11
  %53 = load float, ptr %17, align 4, !tbaa !11
  %54 = load float, ptr %14, align 4, !tbaa !11
  %55 = fcmp olt float %53, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %46
  %57 = load float, ptr %17, align 4, !tbaa !11
  br label %60

58:                                               ; preds = %46
  %59 = load float, ptr %14, align 4, !tbaa !11
  br label %60

60:                                               ; preds = %58, %56
  %61 = phi float [ %57, %56 ], [ %59, %58 ]
  store float %61, ptr %14, align 4, !tbaa !11
  %62 = load float, ptr %17, align 4, !tbaa !11
  %63 = load float, ptr %15, align 4, !tbaa !11
  %64 = fcmp olt float %62, %63
  br i1 %64, label %65, label %67

65:                                               ; preds = %60
  %66 = load float, ptr %15, align 4, !tbaa !11
  br label %69

67:                                               ; preds = %60
  %68 = load float, ptr %17, align 4, !tbaa !11
  br label %69

69:                                               ; preds = %67, %65
  %70 = phi float [ %66, %65 ], [ %68, %67 ]
  store float %70, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %71

71:                                               ; preds = %69
  %72 = load i32, ptr %13, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %13, align 4, !tbaa !9
  br label %42, !llvm.loop !13

74:                                               ; preds = %42
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load i32, ptr %8, align 4, !tbaa !9
  %77 = load i32, ptr %11, align 4, !tbaa !9
  %78 = load float, ptr %14, align 4, !tbaa !11
  %79 = load float, ptr %15, align 4, !tbaa !11
  %80 = call i32 @nk_chart_begin(ptr noundef %75, i32 noundef %76, i32 noundef %77, float noundef %78, float noundef %79)
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %101

82:                                               ; preds = %74
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %96, %82
  %84 = load i32, ptr %13, align 4, !tbaa !9
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %99

87:                                               ; preds = %83
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = load i32, ptr %13, align 4, !tbaa !9
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = add nsw i32 %91, %92
  %94 = call float %89(ptr noundef %90, i32 noundef %93)
  %95 = call i32 @nk_chart_push(ptr noundef %88, float noundef %94)
  br label %96

96:                                               ; preds = %87
  %97 = load i32, ptr %13, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %13, align 4, !tbaa !9
  br label %83, !llvm.loop !15

99:                                               ; preds = %83
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  call void @nk_chart_end(ptr noundef %100)
  br label %101

101:                                              ; preds = %99, %74
  store i32 0, ptr %16, align 4
  br label %102

102:                                              ; preds = %101, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  %103 = load i32, ptr %16, align 4
  switch i32 %103, label %105 [
    i32 0, label %104
    i32 1, label %104
  ]

104:                                              ; preds = %102, %102
  ret void

105:                                              ; preds = %102
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { nounwind }
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 = !{!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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !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"

@.str.2 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.nk_plot_function = external hidden unnamed_addr constant [105 x i8], align 1
@.str.133 = external hidden unnamed_addr constant [13 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
declare dso_local i32 @nk_chart_begin(ptr noundef, i32 noundef, i32 noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_chart_push(ptr noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_chart_end(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @nk_plot_function(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef readonly %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #1 {
  %.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.33, ptr noundef nonnull @.str.2, i32 noundef 24323, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_plot_function) #2
  unreachable

8:                                                ; preds = %6
  %.not44 = icmp eq ptr %3, null
  br i1 %.not44, label %9, label %10

9:                                                ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.133, ptr noundef nonnull @.str.2, i32 noundef 24324, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_plot_function) #2
  unreachable

10:                                               ; preds = %8
  %.not45 = icmp eq i32 %4, 0
  br i1 %.not45, label %27, label %11

11:                                               ; preds = %10
  %12 = tail call float %3(ptr noundef %2, i32 noundef %5) #3
  %13 = icmp sgt i32 %4, 0
  br i1 %13, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %11, %.lr.ph
  %.049 = phi i32 [ %20, %.lr.ph ], [ 0, %11 ]
  %.03948 = phi float [ %19, %.lr.ph ], [ %12, %11 ]
  %.04047 = phi float [ %17, %.lr.ph ], [ %12, %11 ]
  %14 = add nsw i32 %.049, %5
  %15 = tail call float %3(ptr noundef %2, i32 noundef %14) #3
  %16 = fcmp olt float %15, %.04047
  %17 = select i1 %16, float %15, float %.04047
  %18 = fcmp olt float %15, %.03948
  %19 = select i1 %18, float %.03948, float %15
  %20 = add nuw nsw i32 %.049, 1
  %exitcond.not = icmp eq i32 %20, %4
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph
  %21 = tail call i32 @nk_chart_begin(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %4, float noundef %17, float noundef %19)
  %.not46 = icmp eq i32 %21, 0
  br i1 %.not46, label %27, label %.preheader

._crit_edge.thread:                               ; preds = %11
  %22 = tail call i32 @nk_chart_begin(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %4, float noundef %12, float noundef %12)
  %.not4658 = icmp eq i32 %22, 0
  br i1 %.not4658, label %27, label %._crit_edge53

.preheader:                                       ; preds = %._crit_edge
  br i1 %13, label %.lr.ph52, label %._crit_edge53

.lr.ph52:                                         ; preds = %.preheader, %.lr.ph52
  %.151 = phi i32 [ %26, %.lr.ph52 ], [ 0, %.preheader ]
  %23 = add nsw i32 %.151, %5
  %24 = tail call float %3(ptr noundef %2, i32 noundef %23) #3
  %25 = tail call i32 @nk_chart_push(ptr noundef nonnull %0, float noundef %24)
  %26 = add nuw nsw i32 %.151, 1
  %exitcond55.not = icmp eq i32 %26, %4
  br i1 %exitcond55.not, label %._crit_edge53, label %.lr.ph52, !llvm.loop !7

._crit_edge53:                                    ; preds = %.lr.ph52, %._crit_edge.thread, %.preheader
  tail call void @nk_chart_end(ptr noundef nonnull %0)
  br label %27

27:                                               ; preds = %._crit_edge.thread, %._crit_edge, %._crit_edge53, %10
  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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


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