; 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.8 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__.nk_utf_at = external hidden unnamed_addr constant [64 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 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_utf_decode(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @nk_utf_at(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, 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
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #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 = %5
  br label %22

21:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.2, i32 noundef 7970, ptr noundef @__PRETTY_FUNCTION__.nk_utf_at) #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.9, ptr noundef @.str.2, i32 noundef 7971, ptr noundef @__PRETTY_FUNCTION__.nk_utf_at) #4
  unreachable

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

30:                                               ; preds = %27
  br label %32

31:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.2, i32 noundef 7972, ptr noundef @__PRETTY_FUNCTION__.nk_utf_at) #4
  unreachable

32:                                               ; preds = %30
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %41

35:                                               ; preds = %32
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %42, label %41

41:                                               ; preds = %38, %35, %32
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %90

42:                                               ; preds = %38
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 65533, ptr %46, align 4, !tbaa !9
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %47, align 4, !tbaa !9
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %90

48:                                               ; preds = %42
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %49, ptr %15, align 8, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %50, ptr %16, align 4, !tbaa !9
  %51 = load ptr, ptr %15, align 8, !tbaa !5
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = load i32, ptr %16, align 4, !tbaa !9
  %54 = call i32 @nk_utf_decode(ptr noundef %51, ptr noundef %52, i32 noundef %53)
  store i32 %54, ptr %14, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %65, %48
  %56 = load i32, ptr %14, align 4, !tbaa !9
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %80

58:                                               ; preds = %55
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = load i32, ptr %9, align 4, !tbaa !9
  %61 = icmp eq i32 %59, %60
  br i1 %61, label %62, label %65

62:                                               ; preds = %58
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %63, ptr %64, align 4, !tbaa !9
  br label %80

65:                                               ; preds = %58
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %12, align 4, !tbaa !9
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = load i32, ptr %14, align 4, !tbaa !9
  %70 = add nsw i32 %68, %69
  store i32 %70, ptr %13, align 4, !tbaa !9
  %71 = load ptr, ptr %15, align 8, !tbaa !5
  %72 = load i32, ptr %13, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i8, ptr %71, i64 %73
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load i32, ptr %16, align 4, !tbaa !9
  %77 = load i32, ptr %13, align 4, !tbaa !9
  %78 = sub nsw i32 %76, %77
  %79 = call i32 @nk_utf_decode(ptr noundef %74, ptr noundef %75, i32 noundef %78)
  store i32 %79, ptr %14, align 4, !tbaa !9
  br label %55, !llvm.loop !11

80:                                               ; preds = %62, %55
  %81 = load i32, ptr %12, align 4, !tbaa !9
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = icmp ne i32 %81, %82
  br i1 %83, label %84, label %85

84:                                               ; preds = %80
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %90

85:                                               ; preds = %80
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i8, ptr %86, i64 %88
  store ptr %89, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %90

90:                                               ; preds = %85, %84, %45, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  %91 = load ptr, ptr %6, align 8
  ret ptr %91
}

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 = distinct !{!11, !12}
!12 = !{!"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.8 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__.nk_utf_at = external hidden unnamed_addr constant [64 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 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_utf_decode(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @nk_utf_at(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef writeonly %4) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 7970, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_utf_at) #2
  unreachable

7:                                                ; preds = %5
  %.not41 = icmp eq ptr %3, null
  br i1 %.not41, label %8, label %9

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

9:                                                ; preds = %7
  %.not42 = icmp eq ptr %4, null
  br i1 %.not42, label %10, label %11

10:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.2, i32 noundef 7972, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_utf_at) #2
  unreachable

11:                                               ; preds = %9
  %12 = icmp slt i32 %2, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %11
  store i32 65533, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

14:                                               ; preds = %11
  %15 = tail call i32 @nk_utf_decode(ptr noundef nonnull %0, ptr noundef nonnull %3, i32 noundef %1)
  %.not4350 = icmp eq i32 %15, 0
  br i1 %.not4350, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %14, %17
  %.03453 = phi i32 [ %18, %17 ], [ 0, %14 ]
  %.03552 = phi i32 [ %23, %17 ], [ %15, %14 ]
  %.03651 = phi i32 [ %19, %17 ], [ 0, %14 ]
  %16 = icmp eq i32 %.03453, %2
  br i1 %16, label %.loopexit.thread, label %17

.loopexit.thread:                                 ; preds = %.lr.ph
  store i32 %.03552, ptr %4, align 4, !tbaa !5
  br label %24

17:                                               ; preds = %.lr.ph
  %18 = add nuw nsw i32 %.03453, 1
  %19 = add nsw i32 %.03552, %.03651
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %0, i64 %20
  %22 = sub nsw i32 %1, %19
  %23 = tail call i32 @nk_utf_decode(ptr noundef nonnull %21, ptr noundef nonnull %3, i32 noundef %22)
  %.not43 = icmp eq i32 %23, 0
  br i1 %.not43, label %.loopexit, label %.lr.ph, !llvm.loop !9

.loopexit:                                        ; preds = %17, %14
  %.03649 = phi i32 [ 0, %14 ], [ %19, %17 ]
  %.03446 = phi i32 [ 0, %14 ], [ %18, %17 ]
  %.not44 = icmp eq i32 %.03446, %2
  br i1 %.not44, label %24, label %27

24:                                               ; preds = %.loopexit.thread, %.loopexit
  %.0364962 = phi i32 [ %.03651, %.loopexit.thread ], [ %.03649, %.loopexit ]
  %25 = sext i32 %.0364962 to i64
  %26 = getelementptr inbounds i8, ptr %0, i64 %25
  br label %27

27:                                               ; preds = %.loopexit, %24, %13
  %.0 = phi ptr [ null, %13 ], [ %26, %24 ], [ null, %.loopexit ]
  ret ptr %.0
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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