; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Graphics/R3Brdf.ll (ZNK6R3Brdf4DrawEi)

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

@_ZZNK6R3Brdf4DrawEiE14R3current_brdf = external hidden global ptr, align 8

; 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: mustprogress uwtable
define dso_local void @_ZNK6R3Brdf4DrawEi(ptr noundef nonnull align 8 dereferenceable(180) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca [4 x float], align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  %7 = load i32, ptr %4, align 4, !tbaa !9
  %8 = icmp ne i32 %7, 0
  br i1 %8, label %13, label %9

9:                                                ; preds = %2
  %10 = load ptr, ptr @_ZZNK6R3Brdf4DrawEiE14R3current_brdf, align 8, !tbaa !5
  %11 = icmp eq ptr %6, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  br label %85

13:                                               ; preds = %9, %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %15 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %16 = fptrunc double %15 to float
  %17 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  store float %16, ptr %17, align 16, !tbaa !11
  %18 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %19 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = fptrunc double %19 to float
  %21 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 1
  store float %20, ptr %21, align 4, !tbaa !11
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %23 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %24 = fptrunc double %23 to float
  %25 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 2
  store float %24, ptr %25, align 8, !tbaa !11
  %26 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %27 = fptrunc double %26 to float
  %28 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 3
  store float %27, ptr %28, align 4, !tbaa !11
  %29 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 4608, ptr noundef %29)
  %30 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %31 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %30)
  %32 = fptrunc double %31 to float
  %33 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  store float %32, ptr %33, align 16, !tbaa !11
  %34 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %35 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %34)
  %36 = fptrunc double %35 to float
  %37 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 1
  store float %36, ptr %37, align 4, !tbaa !11
  %38 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %39 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %38)
  %40 = fptrunc double %39 to float
  %41 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 2
  store float %40, ptr %41, align 8, !tbaa !11
  %42 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %43 = fptrunc double %42 to float
  %44 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 3
  store float %43, ptr %44, align 4, !tbaa !11
  %45 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 4609, ptr noundef %45)
  %46 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %47 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %46)
  %48 = fptrunc double %47 to float
  %49 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  store float %48, ptr %49, align 16, !tbaa !11
  %50 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %51 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %50)
  %52 = fptrunc double %51 to float
  %53 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 1
  store float %52, ptr %53, align 4, !tbaa !11
  %54 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %55 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %54)
  %56 = fptrunc double %55 to float
  %57 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 2
  store float %56, ptr %57, align 8, !tbaa !11
  %58 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %59 = fptrunc double %58 to float
  %60 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 3
  store float %59, ptr %60, align 4, !tbaa !11
  %61 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 4610, ptr noundef %61)
  %62 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %63 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %62)
  %64 = fptrunc double %63 to float
  %65 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  store float %64, ptr %65, align 16, !tbaa !11
  %66 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %67 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %66)
  %68 = fptrunc double %67 to float
  %69 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 1
  store float %68, ptr %69, align 4, !tbaa !11
  %70 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %71 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %70)
  %72 = fptrunc double %71 to float
  %73 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 2
  store float %72, ptr %73, align 8, !tbaa !11
  %74 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %75 = fptrunc double %74 to float
  %76 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 3
  store float %75, ptr %76, align 4, !tbaa !11
  %77 = getelementptr inbounds [4 x float], ptr %5, i64 0, i64 0
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 5632, ptr noundef %77)
  %78 = call noundef double @_ZNK6R3Brdf9ShininessEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %79 = fptrunc double %78 to float
  call void @glMaterialf(i32 noundef 1028, i32 noundef 5633, float noundef %79)
  %80 = call noundef i32 @_ZNK6R3Brdf13IsTransparentEv(ptr noundef nonnull align 8 dereferenceable(180) %6)
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %13
  call void @glDepthMask(i8 noundef zeroext 0)
  call void @glBlendFunc(i32 noundef 770, i32 noundef 771)
  call void @glEnable(i32 noundef 3042)
  br label %84

83:                                               ; preds = %13
  call void @glDisable(i32 noundef 3042)
  call void @glBlendFunc(i32 noundef 1, i32 noundef 0)
  call void @glDepthMask(i8 noundef zeroext 1)
  br label %84

84:                                               ; preds = %83, %82
  store ptr %6, ptr @_ZZNK6R3Brdf4DrawEiE14R3current_brdf, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  br label %85

85:                                               ; preds = %84, %12
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180)) #3 align 2

declare void @glMaterialfv(i32 noundef, i32 noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180)) #2 align 2

declare void @glMaterialf(i32 noundef, i32 noundef, float noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK6R3Brdf9ShininessEv(ptr noundef nonnull align 8 dereferenceable(180)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Brdf13IsTransparentEv(ptr noundef nonnull align 8 dereferenceable(180)) #3 align 2

declare void @glDepthMask(i8 noundef zeroext) #4

declare void @glBlendFunc(i32 noundef, i32 noundef) #4

declare void @glEnable(i32 noundef) #4

declare void @glDisable(i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 = { inlinehint mustprogress 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 = { "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 }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}


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

@_ZZNK6R3Brdf4DrawEiE14R3current_brdf = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Brdf4DrawEi(ptr noundef nonnull align 8 dereferenceable(180) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca [4 x float], align 16
  %4 = icmp eq i32 %1, 0
  %5 = load ptr, ptr @_ZZNK6R3Brdf4DrawEiE14R3current_brdf, align 8
  %6 = icmp eq ptr %5, %0
  %or.cond = select i1 %4, i1 %6, i1 false
  br i1 %or.cond, label %62, label %7

7:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  %8 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %9 = tail call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %10 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %11 = tail call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %12 = getelementptr inbounds i8, ptr %3, i64 4
  %13 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %14 = tail call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  %16 = tail call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %17 = getelementptr inbounds i8, ptr %3, i64 12
  %18 = insertelement <4 x double> poison, double %9, i64 0
  %19 = insertelement <4 x double> %18, double %11, i64 1
  %20 = insertelement <4 x double> %19, double %14, i64 2
  %21 = insertelement <4 x double> %20, double %16, i64 3
  %22 = fptrunc <4 x double> %21 to <4 x float>
  store <4 x float> %22, ptr %3, align 16, !tbaa !5
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 4608, ptr noundef nonnull %3)
  %23 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %24 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %25 = fptrunc double %24 to float
  store float %25, ptr %3, align 16, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %27 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %26)
  %28 = fptrunc double %27 to float
  store float %28, ptr %12, align 4, !tbaa !5
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %30 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  %31 = fptrunc double %30 to float
  store float %31, ptr %15, align 8, !tbaa !5
  %32 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %33 = fptrunc double %32 to float
  store float %33, ptr %17, align 4, !tbaa !5
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 4609, ptr noundef nonnull %3)
  %34 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %35 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %34)
  %36 = fptrunc double %35 to float
  store float %36, ptr %3, align 16, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %38 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %37)
  %39 = fptrunc double %38 to float
  store float %39, ptr %12, align 4, !tbaa !5
  %40 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %41 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %40)
  %42 = fptrunc double %41 to float
  store float %42, ptr %15, align 8, !tbaa !5
  %43 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %44 = fptrunc double %43 to float
  store float %44, ptr %17, align 4, !tbaa !5
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 4610, ptr noundef nonnull %3)
  %45 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %46 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %45)
  %47 = fptrunc double %46 to float
  store float %47, ptr %3, align 16, !tbaa !5
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %49 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %48)
  %50 = fptrunc double %49 to float
  store float %50, ptr %12, align 4, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %52 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
  %53 = fptrunc double %52 to float
  store float %53, ptr %15, align 8, !tbaa !5
  %54 = call noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %55 = fptrunc double %54 to float
  store float %55, ptr %17, align 4, !tbaa !5
  call void @glMaterialfv(i32 noundef 1028, i32 noundef 5632, ptr noundef nonnull %3)
  %56 = call noundef double @_ZNK6R3Brdf9ShininessEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %57 = fptrunc double %56 to float
  call void @glMaterialf(i32 noundef 1028, i32 noundef 5633, float noundef %57)
  %58 = call noundef i32 @_ZNK6R3Brdf13IsTransparentEv(ptr noundef nonnull align 8 dereferenceable(180) %0)
  %.not = icmp eq i32 %58, 0
  br i1 %.not, label %60, label %59

59:                                               ; preds = %7
  call void @glDepthMask(i8 noundef zeroext 0)
  call void @glBlendFunc(i32 noundef 770, i32 noundef 771)
  call void @glEnable(i32 noundef 3042)
  br label %61

60:                                               ; preds = %7
  call void @glDisable(i32 noundef 3042)
  call void @glBlendFunc(i32 noundef 1, i32 noundef 0)
  call void @glDepthMask(i8 noundef zeroext 1)
  br label %61

61:                                               ; preds = %60, %59
  store ptr %0, ptr @_ZZNK6R3Brdf4DrawEiE14R3current_brdf, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %62

62:                                               ; preds = %2, %61
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7AmbientEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Brdf7OpacityEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #3 align 2

declare void @glMaterialfv(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf7DiffuseEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8SpecularEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Brdf8EmissionEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #2 align 2

declare void @glMaterialf(i32 noundef, i32 noundef, float noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK6R3Brdf9ShininessEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Brdf13IsTransparentEv(ptr noundef nonnull align 8 dereferenceable(180)) local_unnamed_addr #3 align 2

declare void @glDepthMask(i8 noundef zeroext) local_unnamed_addr #4

declare void @glBlendFunc(i32 noundef, i32 noundef) local_unnamed_addr #4

declare void @glEnable(i32 noundef) local_unnamed_addr #4

declare void @glDisable(i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 = { inlinehint mustprogress 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 = { "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 }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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