; 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_color = type { i8, i8, i8, i8 }

; 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 hidden i32 @nk_parse_hex(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @nk_rgba_hex(ptr noundef %0) #1 {
  %2 = alloca %struct.nk_color, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %5, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = load i8, ptr %6, align 1, !tbaa !9
  %8 = sext i8 %7 to i32
  %9 = icmp eq i32 %8, 35
  br i1 %9, label %10, label %13

10:                                               ; preds = %1
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i32 1
  store ptr %12, ptr %4, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %10, %1
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i32 @nk_parse_hex(ptr noundef %14, i32 noundef 2)
  %16 = trunc i32 %15 to i8
  %17 = getelementptr inbounds %struct.nk_color, ptr %2, i32 0, i32 0
  store i8 %16, ptr %17, align 1, !tbaa !10
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 2
  %20 = call i32 @nk_parse_hex(ptr noundef %19, i32 noundef 2)
  %21 = trunc i32 %20 to i8
  %22 = getelementptr inbounds %struct.nk_color, ptr %2, i32 0, i32 1
  store i8 %21, ptr %22, align 1, !tbaa !12
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  %25 = call i32 @nk_parse_hex(ptr noundef %24, i32 noundef 2)
  %26 = trunc i32 %25 to i8
  %27 = getelementptr inbounds %struct.nk_color, ptr %2, i32 0, i32 2
  store i8 %26, ptr %27, align 1, !tbaa !13
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 6
  %30 = call i32 @nk_parse_hex(ptr noundef %29, i32 noundef 2)
  %31 = trunc i32 %30 to i8
  %32 = getelementptr inbounds %struct.nk_color, ptr %2, i32 0, i32 3
  store i8 %31, ptr %32, align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  %33 = load i32, ptr %2, align 1
  ret i32 %33
}

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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 0}
!11 = !{!"nk_color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!12 = !{!11, !7, i64 1}
!13 = !{!11, !7, i64 2}
!14 = !{!11, !7, i64 3}


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

; Function Attrs: nounwind uwtable
declare hidden i32 @nk_parse_hex(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @nk_rgba_hex(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load i8, ptr %0, align 1, !tbaa !5
  %3 = icmp eq i8 %2, 35
  %spec.select.idx = zext i1 %3 to i64
  %spec.select = getelementptr inbounds i8, ptr %0, i64 %spec.select.idx
  %4 = tail call i32 @nk_parse_hex(ptr noundef nonnull %spec.select, i32 noundef 2)
  %5 = getelementptr inbounds i8, ptr %spec.select, i64 2
  %6 = tail call i32 @nk_parse_hex(ptr noundef nonnull %5, i32 noundef 2)
  %7 = getelementptr inbounds i8, ptr %spec.select, i64 4
  %8 = tail call i32 @nk_parse_hex(ptr noundef nonnull %7, i32 noundef 2)
  %9 = getelementptr inbounds i8, ptr %spec.select, i64 6
  %10 = tail call i32 @nk_parse_hex(ptr noundef nonnull %9, i32 noundef 2)
  %.sroa.4.0.insert.ext = shl i32 %10, 24
  %.sroa.3.0.insert.ext = shl i32 %8, 16
  %.sroa.3.0.insert.shift = and i32 %.sroa.3.0.insert.ext, 16711680
  %.sroa.3.0.insert.insert = or disjoint i32 %.sroa.4.0.insert.ext, %.sroa.3.0.insert.shift
  %.sroa.2.0.insert.ext = shl i32 %6, 8
  %.sroa.2.0.insert.shift = and i32 %.sroa.2.0.insert.ext, 65280
  %.sroa.2.0.insert.insert = or disjoint i32 %.sroa.3.0.insert.insert, %.sroa.2.0.insert.shift
  %.sroa.0.0.insert.ext = and i32 %4, 255
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.2.0.insert.insert, %.sroa.0.0.insert.ext
  ret i32 %.sroa.0.0.insert.insert
}

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

!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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass