; 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.4 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__.nk_stricmpn = external hidden unnamed_addr constant [49 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
define dso_local i32 @nk_stricmpn(ptr noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %12 = load i32, ptr %7, align 4, !tbaa !9
  %13 = icmp sge i32 %12, 0
  br i1 %13, label %14, label %15

14:                                               ; preds = %3
  br label %16

15:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 6571, ptr noundef @__PRETTY_FUNCTION__.nk_stricmpn) #4
  unreachable

16:                                               ; preds = %14
  br label %17

17:                                               ; preds = %70, %16
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i32 1
  store ptr %19, ptr %5, align 8, !tbaa !5
  %20 = load i8, ptr %18, align 1, !tbaa !11
  %21 = sext i8 %20 to i32
  store i32 %21, ptr %8, align 4, !tbaa !9
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i32 1
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = load i8, ptr %22, align 1, !tbaa !11
  %25 = sext i8 %24 to i32
  store i32 %25, ptr %9, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr %7, align 4, !tbaa !9
  %28 = icmp ne i32 %26, 0
  br i1 %28, label %30, label %29

29:                                               ; preds = %17
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %74

30:                                               ; preds = %17
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = sub nsw i32 %31, %32
  store i32 %33, ptr %10, align 4, !tbaa !9
  br label %34

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

37:                                               ; preds = %34
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = icmp sle i32 %38, 90
  br i1 %39, label %40, label %50

40:                                               ; preds = %37
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = icmp sge i32 %41, 65
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = add nsw i32 %44, 32
  store i32 %45, ptr %10, align 4, !tbaa !9
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %43
  br label %69

49:                                               ; preds = %43
  br label %50

50:                                               ; preds = %49, %40, %37
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = icmp sle i32 %51, 90
  br i1 %52, label %53, label %63

53:                                               ; preds = %50
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = icmp sge i32 %54, 65
  br i1 %55, label %56, label %63

56:                                               ; preds = %53
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = sub nsw i32 %57, 32
  store i32 %58, ptr %10, align 4, !tbaa !9
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %62, label %61

61:                                               ; preds = %56
  br label %69

62:                                               ; preds = %56
  br label %63

63:                                               ; preds = %62, %53, %50
  %64 = load i32, ptr %10, align 4, !tbaa !9
  %65 = icmp sge i32 %64, 0
  %66 = zext i1 %65 to i32
  %67 = shl i32 %66, 1
  %68 = sub nsw i32 %67, 1
  store i32 %68, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %74

69:                                               ; preds = %61, %48, %34
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %17, label %73, !llvm.loop !12

73:                                               ; preds = %70
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %74

74:                                               ; preds = %73, %63, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %75 = load i32, ptr %4, align 4
  ret i32 %75
}

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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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.4 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__.nk_stricmpn = external hidden unnamed_addr constant [49 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
define dso_local range(i32 -1, 2) i32 @nk_stricmpn(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp sgt i32 %2, -1
  br i1 %4, label %.preheader, label %5

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 6571, ptr noundef nonnull @__PRETTY_FUNCTION__.nk_stricmpn) #2
  unreachable

.preheader:                                       ; preds = %3, %25
  %.023 = phi ptr [ %8, %25 ], [ %1, %3 ]
  %.022 = phi i32 [ %10, %25 ], [ %2, %3 ]
  %.021 = phi ptr [ %6, %25 ], [ %0, %3 ]
  %6 = getelementptr inbounds i8, ptr %.021, i64 1
  %7 = load i8, ptr %.021, align 1, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %.023, i64 1
  %9 = load i8, ptr %.023, align 1, !tbaa !5
  %10 = add nsw i32 %.022, -1
  %.not = icmp eq i32 %.022, 0
  br i1 %.not, label %.loopexit, label %11

11:                                               ; preds = %.preheader
  %12 = sext i8 %7 to i32
  %13 = sext i8 %9 to i32
  %14 = sub nsw i32 %12, %13
  %.not28 = icmp eq i32 %14, 0
  br i1 %.not28, label %25, label %15

15:                                               ; preds = %11
  %16 = add i8 %7, -65
  %or.cond = icmp ult i8 %16, 26
  br i1 %or.cond, label %17, label %19

17:                                               ; preds = %15
  %18 = add nsw i32 %14, 32
  %.not29 = icmp eq i32 %18, 0
  br i1 %.not29, label %25, label %19

19:                                               ; preds = %17, %15
  %.0 = phi i32 [ %18, %17 ], [ %14, %15 ]
  %20 = add i8 %9, -65
  %or.cond3 = icmp ult i8 %20, 26
  br i1 %or.cond3, label %21, label %23

21:                                               ; preds = %19
  %22 = add nsw i32 %.0, -32
  %.not30 = icmp eq i32 %22, 0
  br i1 %.not30, label %25, label %23

23:                                               ; preds = %21, %19
  %.1 = phi i32 [ %22, %21 ], [ %.0, %19 ]
  %.inv.inv = icmp sgt i32 %.1, -1
  %24 = select i1 %.inv.inv, i32 1, i32 -1
  br label %.loopexit

25:                                               ; preds = %11, %17, %21
  %.not31 = icmp eq i8 %7, 0
  br i1 %.not31, label %.loopexit, label %.preheader, !llvm.loop !8

.loopexit:                                        ; preds = %25, %.preheader, %23
  %.020 = phi i32 [ %24, %23 ], [ 0, %.preheader ], [ 0, %25 ]
  ret i32 %.020
}

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


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass