; LLVM IR from openxrlab/xrsfm :: 3rdparty/SiftGPU/GlobalUtil.ll (ZN10GlobalUtil11InitGLParamEi)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZN11GlobalParam8_verboseE = external dso_local global i32, align 4
@_ZN11GlobalParam10_texTargetE = external dso_local global i32, align 4
@_ZN11GlobalParam8_UseCUDAE = external dso_local global i32, align 4
@_ZN11GlobalParam10_texMaxDimE = external dso_local global i32, align 4
@_ZN11GlobalParam12_texMaxDimGLE = external dso_local global i32, align 4
@_ZN11GlobalParam10_MemCapGPUE = external dso_local global i32, align 4
@_ZN11GlobalParam9_IsNvidiaE = external dso_local global i32, align 4
@_ZN11GlobalParam15_KeepShaderLoopE = external dso_local global i32, align 4
@_ZN11GlobalParam15_SupportNVFloatE = external dso_local global i32, align 4
@_ZN11GlobalParam17_SupportTextureRGE = external dso_local global i32, align 4
@_ZN11GlobalParam13_UseSiftGPUEXE = external dso_local global i32, align 4
@_ZN11GlobalParam11_GoodOpenGLE = external dso_local global i32, align 4
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.12 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [18 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: mustprogress uwtable
declare dso_local void @_ZN10GlobalUtil19SetTextureParameterEv() #1 align 2

declare void @glGetIntegerv(i32 noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

declare void @glEnable(i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10GlobalUtil11InitGLParamEi(i32 noundef %0) #1 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca [4 x i32], align 16
  %5 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %6 = load i32, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 2
  br i1 %7, label %8, label %9

8:                                                ; preds = %1
  br label %149

9:                                                ; preds = %1
  %10 = load i32, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  br label %149

13:                                               ; preds = %9
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %20

16:                                               ; preds = %13
  %17 = load i32, ptr @_ZN11GlobalParam13_UseSiftGPUEXE, align 4, !tbaa !5
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  store i32 1, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %149

20:                                               ; preds = %16, %13
  %21 = call i32 @glewInit()
  store i32 2, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %22 = call ptr @glGetString(i32 noundef 7936)
  store ptr %22, ptr %3, align 8, !tbaa !9
  %23 = load ptr, ptr %3, align 8, !tbaa !9
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %94

25:                                               ; preds = %20
  %26 = load ptr, ptr %3, align 8, !tbaa !9
  %27 = call noundef ptr @strstr(ptr noundef %26, ptr noundef @.str.9) #6
  %28 = icmp ne ptr %27, null
  %29 = zext i1 %28 to i64
  %30 = select i1 %28, i32 1, i32 0
  store i32 %30, ptr @_ZN11GlobalParam9_IsNvidiaE, align 4, !tbaa !5
  %31 = load i32, ptr @_ZN11GlobalParam9_IsNvidiaE, align 4, !tbaa !5
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %25
  store i32 1, ptr @_ZN11GlobalParam15_KeepShaderLoopE, align 4, !tbaa !5
  br label %40

34:                                               ; preds = %25
  %35 = load ptr, ptr %3, align 8, !tbaa !9
  %36 = call noundef ptr @strstr(ptr noundef %35, ptr noundef @.str.10) #6
  %37 = icmp ne ptr %36, null
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 1, ptr @_ZN11GlobalParam15_KeepShaderLoopE, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %38, %34
  br label %40

40:                                               ; preds = %39, %33
  %41 = load i32, ptr @_ZN11GlobalParam9_IsNvidiaE, align 4, !tbaa !5
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %60

43:                                               ; preds = %40
  %44 = call zeroext i8 @glewGetExtension(ptr noundef @.str.11)
  %45 = icmp ne i8 %44, 0
  br i1 %45, label %46, label %60

46:                                               ; preds = %43
  call void @glGetIntegerv(i32 noundef 36937, ptr noundef @_ZN11GlobalParam10_MemCapGPUE)
  %47 = load i32, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %48 = sdiv i32 %47, 1024
  store i32 %48, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %49 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %59

51:                                               ; preds = %46
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.12)
  %53 = load ptr, ptr %3, align 8, !tbaa !9
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef %53)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %54, i8 noundef signext 32)
  %56 = load i32, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %55, i32 noundef %56)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef @.str.13)
  br label %59

59:                                               ; preds = %51, %46
  br label %93

60:                                               ; preds = %43, %40
  %61 = load ptr, ptr %3, align 8, !tbaa !9
  %62 = call noundef ptr @strstr(ptr noundef %61, ptr noundef @.str.10) #6
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %83

64:                                               ; preds = %60
  %65 = call zeroext i8 @glewGetExtension(ptr noundef @.str.14)
  %66 = icmp ne i8 %65, 0
  br i1 %66, label %67, label %83

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  %68 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  call void @glGetIntegerv(i32 noundef 34812, ptr noundef %68)
  %69 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  %70 = load i32, ptr %69, align 16, !tbaa !5
  %71 = sdiv i32 %70, 1024
  store i32 %71, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %72 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %82

74:                                               ; preds = %67
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.12)
  %76 = load ptr, ptr %3, align 8, !tbaa !9
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef %76)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %77, i8 noundef signext 32)
  %79 = load i32, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %78, i32 noundef %79)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef @.str.13)
  br label %82

82:                                               ; preds = %74, %67
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  br label %92

83:                                               ; preds = %64, %60
  %84 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %91

86:                                               ; preds = %83
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.12)
  %88 = load ptr, ptr %3, align 8, !tbaa !9
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef @.str.15)
  br label %91

91:                                               ; preds = %86, %83
  br label %92

92:                                               ; preds = %91, %82
  br label %93

93:                                               ; preds = %92, %59
  br label %94

94:                                               ; preds = %93, %20
  %95 = load i32, ptr @_ZN11GlobalParam9_IsNvidiaE, align 4, !tbaa !5
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %94
  store i32 0, ptr @_ZN11GlobalParam8_UseCUDAE, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %97, %94
  %99 = call zeroext i8 @glewGetExtension(ptr noundef @.str.16)
  %100 = zext i8 %99 to i32
  %101 = icmp ne i32 %100, 1
  br i1 %101, label %110, label %102

102:                                              ; preds = %98
  %103 = call zeroext i8 @glewGetExtension(ptr noundef @.str.17)
  %104 = zext i8 %103 to i32
  %105 = icmp ne i32 %104, 1
  br i1 %105, label %110, label %106

106:                                              ; preds = %102
  %107 = call zeroext i8 @glewGetExtension(ptr noundef @.str.18)
  %108 = zext i8 %107 to i32
  %109 = icmp ne i32 %108, 1
  br i1 %109, label %110, label %112

110:                                              ; preds = %106, %102, %98
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.19)
  store i32 0, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %110, %106
  %113 = call zeroext i8 @glewGetExtension(ptr noundef @.str.20)
  %114 = zext i8 %113 to i32
  %115 = icmp ne i32 %114, 1
  br i1 %115, label %116, label %118

116:                                              ; preds = %112
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.21)
  store i32 0, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %116, %112
  %119 = call zeroext i8 @glewGetExtension(ptr noundef @.str.22)
  %120 = zext i8 %119 to i32
  %121 = icmp eq i32 %120, 1
  br i1 %121, label %122, label %142

122:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 34037, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !5
  call void @glGetIntegerv(i32 noundef 34040, ptr noundef %5)
  %123 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %123, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4, !tbaa !5
  %124 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %131

126:                                              ; preds = %122
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.23)
  %128 = load i32, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4, !tbaa !5
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %127, i32 noundef %128)
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef @.str.15)
  br label %131

131:                                              ; preds = %126, %122
  %132 = load i32, ptr @_ZN11GlobalParam10_texMaxDimE, align 4, !tbaa !5
  %133 = icmp eq i32 %132, 0
  br i1 %133, label %138, label %134

134:                                              ; preds = %131
  %135 = load i32, ptr @_ZN11GlobalParam10_texMaxDimE, align 4, !tbaa !5
  %136 = load i32, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4, !tbaa !5
  %137 = icmp sgt i32 %135, %136
  br i1 %137, label %138, label %140

138:                                              ; preds = %134, %131
  %139 = load i32, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4, !tbaa !5
  store i32 %139, ptr @_ZN11GlobalParam10_texMaxDimE, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %138, %134
  %141 = load i32, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !5
  call void @glEnable(i32 noundef %141)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %144

142:                                              ; preds = %118
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str.24)
  store i32 0, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %142, %140
  %145 = call zeroext i8 @glewGetExtension(ptr noundef @.str.25)
  %146 = zext i8 %145 to i32
  store i32 %146, ptr @_ZN11GlobalParam15_SupportNVFloatE, align 4, !tbaa !5
  %147 = call zeroext i8 @glewGetExtension(ptr noundef @.str.26)
  %148 = zext i8 %147 to i32
  store i32 %148, ptr @_ZN11GlobalParam17_SupportTextureRGE, align 4, !tbaa !5
  call void @glShadeModel(i32 noundef 7424)
  call void @glPolygonMode(i32 noundef 1028, i32 noundef 6914)
  call void @_ZN10GlobalUtil19SetTextureParameterEv()
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %149

149:                                              ; preds = %144, %19, %12, %8
  ret void
}

declare i32 @glewInit() #2

declare ptr @glGetString(i32 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strstr(ptr noundef, ptr noundef) #4

declare zeroext i8 @glewGetExtension(ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

declare void @glShadeModel(i32 noundef) #2

declare void @glPolygonMode(i32 noundef, i32 noundef) #2

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 = { "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 = { nounwind willreturn memory(read) "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 }
attributes #6 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZN11GlobalParam8_verboseE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam10_texTargetE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam8_UseCUDAE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam10_texMaxDimE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam12_texMaxDimGLE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam10_MemCapGPUE = external dso_local global i32, align 4
@_ZN11GlobalParam9_IsNvidiaE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam15_KeepShaderLoopE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam15_SupportNVFloatE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam17_SupportTextureRGE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam13_UseSiftGPUEXE = external dso_local local_unnamed_addr global i32, align 4
@_ZN11GlobalParam11_GoodOpenGLE = external dso_local local_unnamed_addr global i32, align 4
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.12 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [18 x i8], align 1

; 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
declare dso_local void @_ZN10GlobalUtil19SetTextureParameterEv() local_unnamed_addr #1 align 2

declare void @glGetIntegerv(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3

declare void @glEnable(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10GlobalUtil11InitGLParamEi(i32 noundef %0) local_unnamed_addr #1 align 2 {
  %2 = alloca [4 x i32], align 16
  %3 = alloca i32, align 4
  %4 = load i32, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4
  %5 = and i32 %4, -3
  %or.cond3 = icmp eq i32 %5, 0
  br i1 %or.cond3, label %96, label %6

6:                                                ; preds = %1
  %7 = icmp eq i32 %0, 0
  %8 = load i32, ptr @_ZN11GlobalParam13_UseSiftGPUEXE, align 4
  %9 = icmp ne i32 %8, 0
  %or.cond = select i1 %7, i1 true, i1 %9
  br i1 %or.cond, label %11, label %10

10:                                               ; preds = %6
  store i32 1, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %96

11:                                               ; preds = %6
  %12 = tail call i32 @glewInit()
  store i32 2, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  %13 = tail call ptr @glGetString(i32 noundef 7936)
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %54, label %14

14:                                               ; preds = %11
  %15 = tail call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.9) #5
  %.not11 = icmp ne ptr %15, null
  %16 = zext i1 %.not11 to i32
  store i32 %16, ptr @_ZN11GlobalParam9_IsNvidiaE, align 4, !tbaa !5
  br i1 %.not11, label %20, label %17

17:                                               ; preds = %14
  %18 = tail call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.10) #5
  %.not12 = icmp eq ptr %18, null
  br i1 %.not12, label %19, label %.thread

19:                                               ; preds = %17
  store i32 1, ptr @_ZN11GlobalParam15_KeepShaderLoopE, align 4, !tbaa !5
  br label %.thread

20:                                               ; preds = %14
  store i32 1, ptr @_ZN11GlobalParam15_KeepShaderLoopE, align 4, !tbaa !5
  %21 = tail call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.11)
  %.not14 = icmp eq i8 %21, 0
  br i1 %.not14, label %.thread, label %22

22:                                               ; preds = %20
  tail call void @glGetIntegerv(i32 noundef 36937, ptr noundef nonnull @_ZN11GlobalParam10_MemCapGPUE)
  %23 = load i32, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %24 = sdiv i32 %23, 1024
  store i32 %24, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %25 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %.not19 = icmp eq i32 %25, 0
  br i1 %.not19, label %54, label %26

26:                                               ; preds = %22
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.12)
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull %13)
  %29 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %28, i8 noundef signext 32)
  %30 = load i32, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %31 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %29, i32 noundef %30)
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull @.str.13)
  br label %54

.thread:                                          ; preds = %19, %17, %20
  %33 = tail call noundef ptr @strstr(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.10) #5
  %.not15 = icmp eq ptr %33, null
  br i1 %.not15, label %48, label %34

34:                                               ; preds = %.thread
  %35 = tail call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.14)
  %.not16 = icmp eq i8 %35, 0
  br i1 %.not16, label %48, label %36

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @glGetIntegerv(i32 noundef 34812, ptr noundef nonnull %2)
  %37 = load i32, ptr %2, align 16, !tbaa !5
  %38 = sdiv i32 %37, 1024
  store i32 %38, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %39 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %.not18 = icmp eq i32 %39, 0
  br i1 %.not18, label %47, label %40

40:                                               ; preds = %36
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.12)
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef nonnull %13)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %42, i8 noundef signext 32)
  %44 = load i32, ptr @_ZN11GlobalParam10_MemCapGPUE, align 4, !tbaa !5
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %43, i32 noundef %44)
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull @.str.13)
  br label %47

47:                                               ; preds = %40, %36
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  br label %54

48:                                               ; preds = %34, %.thread
  %49 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %.not17 = icmp eq i32 %49, 0
  br i1 %.not17, label %54, label %50

50:                                               ; preds = %48
  %51 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.12)
  %52 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull %13)
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str.15)
  br label %54

54:                                               ; preds = %26, %22, %48, %50, %47, %11
  %55 = load i32, ptr @_ZN11GlobalParam9_IsNvidiaE, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  store i32 0, ptr @_ZN11GlobalParam8_UseCUDAE, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %57, %54
  %59 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.16)
  %.not20 = icmp eq i8 %59, 1
  br i1 %.not20, label %60, label %64

60:                                               ; preds = %58
  %61 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.17)
  %.not21 = icmp eq i8 %61, 1
  br i1 %.not21, label %62, label %64

62:                                               ; preds = %60
  %63 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.18)
  %.not22 = icmp eq i8 %63, 1
  br i1 %.not22, label %66, label %64

64:                                               ; preds = %62, %60, %58
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.19)
  store i32 0, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %64, %62
  %67 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.20)
  %.not23 = icmp eq i8 %67, 1
  br i1 %.not23, label %70, label %68

68:                                               ; preds = %66
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.21)
  store i32 0, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %68, %66
  %71 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.22)
  %72 = icmp eq i8 %71, 1
  br i1 %72, label %73, label %89

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 34037, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !5
  call void @glGetIntegerv(i32 noundef 34040, ptr noundef nonnull %3)
  %74 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %74, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4, !tbaa !5
  %75 = load i32, ptr @_ZN11GlobalParam8_verboseE, align 4, !tbaa !5
  %.not24 = icmp eq i32 %75, 0
  br i1 %.not24, label %81, label %76

76:                                               ; preds = %73
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.23)
  %78 = load i32, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4, !tbaa !5
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %77, i32 noundef %78)
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @.str.15)
  %.pre = load i32, ptr @_ZN11GlobalParam12_texMaxDimGLE, align 4
  br label %81

81:                                               ; preds = %76, %73
  %82 = phi i32 [ %.pre, %76 ], [ %74, %73 ]
  %83 = load i32, ptr @_ZN11GlobalParam10_texMaxDimE, align 4, !tbaa !5
  %84 = icmp eq i32 %83, 0
  %85 = icmp sgt i32 %83, %82
  %or.cond26 = select i1 %84, i1 true, i1 %85
  br i1 %or.cond26, label %86, label %87

86:                                               ; preds = %81
  store i32 %82, ptr @_ZN11GlobalParam10_texMaxDimE, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %81, %86
  %88 = load i32, ptr @_ZN11GlobalParam10_texTargetE, align 4, !tbaa !5
  call void @glEnable(i32 noundef %88)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %91

89:                                               ; preds = %70
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str.24)
  store i32 0, ptr @_ZN11GlobalParam11_GoodOpenGLE, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %89, %87
  %92 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.25)
  %93 = zext i8 %92 to i32
  store i32 %93, ptr @_ZN11GlobalParam15_SupportNVFloatE, align 4, !tbaa !5
  %94 = call zeroext i8 @glewGetExtension(ptr noundef nonnull @.str.26)
  %95 = zext i8 %94 to i32
  store i32 %95, ptr @_ZN11GlobalParam17_SupportTextureRGE, align 4, !tbaa !5
  call void @glShadeModel(i32 noundef 7424)
  call void @glPolygonMode(i32 noundef 1028, i32 noundef 6914)
  call void @_ZN10GlobalUtil19SetTextureParameterEv()
  br label %96

96:                                               ; preds = %1, %91, %10
  ret void
}

declare i32 @glewInit() local_unnamed_addr #2

declare ptr @glGetString(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4

declare zeroext i8 @glewGetExtension(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

declare void @glShadeModel(i32 noundef) local_unnamed_addr #2

declare void @glPolygonMode(i32 noundef, i32 noundef) local_unnamed_addr #2

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 = { "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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }
attributes #6 = { 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++ TBAA"}


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