; LLVM IR from cruppstahl/upscaledb :: tools/ups_bench/upscaledb.ll (ZN15UpscaleDatabase11do_open_envEv)

; 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.Mutex = type { %"class.boost::mutex" }
%"class.boost::mutex" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.ups_parameter_t = type { i32, i64 }
%"class.boost::unique_lock" = type <{ ptr, i8, [7 x i8] }>
%class.Database = type { ptr, i32, ptr }
%struct.Configuration = type <{ i8, [3 x i8], i32, i8, i8, i8, [5 x i8], %"class.std::__cxx11::basic_string", i8, [3 x i8], i32, i32, i32, i8, [3 x i8], i32, i64, i64, i64, i64, i32, i8, [3 x i8], i32, i32, i32, i32, i8, i8, [2 x i8], i32, i8, [3 x i8], i32, i8, i8, i8, i8, i8, [3 x i8], i32, i32, i32, i8, i8, i8, i8, i32, i32, %"class.std::__cxx11::basic_string", i32, i32, i32, i8, i8, [2 x i8], i32, i32, i32, i8, i8, i8, i8, i32, i8, i8, [2 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@_ZN15UpscaleDatabase6ms_envE = external dso_local global ptr, align 8
@_ZN15UpscaleDatabase8ms_mutexE = external dso_local global %class.Mutex, align 8
@_ZN15UpscaleDatabase11ms_refcountE = external dso_local global i32, align 4
@_ZN9upscaledb7Globals21ms_extended_thresholdE = external global i32, align 4
@_ZN9upscaledb7Globals22ms_duplicate_thresholdE = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [40 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost11unique_lockINS_5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

declare i32 @printf(ptr noundef, ...) #3

declare ptr @ups_strerror(i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost11unique_lockINS_5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN15UpscaleDatabase11do_open_envEv(ptr noundef nonnull align 8 dereferenceable(712) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [6 x %struct.ups_parameter_t], align 16
  %7 = alloca %"class.boost::unique_lock", align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 96, ptr %6) #5
  call void @llvm.memset.p0.i64(ptr align 16 %6, i8 0, i64 96, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  call void @_ZN5boost11unique_lockINS_5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %7, ptr noundef nonnull align 8 dereferenceable(40) @_ZN15UpscaleDatabase8ms_mutexE)
  %13 = load i32, ptr @_ZN15UpscaleDatabase11ms_refcountE, align 4, !tbaa !9
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr @_ZN15UpscaleDatabase11ms_refcountE, align 4, !tbaa !9
  %15 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct.Configuration, ptr %16, i32 0, i32 51
  %18 = load i32, ptr %17, align 4, !tbaa !13
  store i32 %18, ptr @_ZN9upscaledb7Globals21ms_extended_thresholdE, align 4, !tbaa !9
  %19 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds %struct.Configuration, ptr %20, i32 0, i32 52
  %22 = load i32, ptr %21, align 8, !tbaa !19
  store i32 %22, ptr @_ZN9upscaledb7Globals22ms_duplicate_thresholdE, align 4, !tbaa !9
  %23 = load ptr, ptr @_ZN15UpscaleDatabase6ms_envE, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %172

25:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.ups_parameter_t, ptr %28, i32 0, i32 0
  store i32 256, ptr %29, align 16, !tbaa !20
  %30 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = getelementptr inbounds %struct.Configuration, ptr %31, i32 0, i32 40
  %33 = load i32, ptr %32, align 8, !tbaa !22
  %34 = sext i32 %33 to i64
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 %36
  %38 = getelementptr inbounds %struct.ups_parameter_t, ptr %37, i32 0, i32 1
  store i64 %34, ptr %38, align 8, !tbaa !23
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %8, align 4, !tbaa !9
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 %42
  %44 = getelementptr inbounds %struct.ups_parameter_t, ptr %43, i32 0, i32 0
  store i32 272, ptr %44, align 16, !tbaa !20
  %45 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.Configuration, ptr %46, i32 0, i32 63
  %48 = load i32, ptr %47, align 8, !tbaa !24
  %49 = sext i32 %48 to i64
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.ups_parameter_t, ptr %52, i32 0, i32 1
  store i64 %49, ptr %53, align 8, !tbaa !23
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %8, align 4, !tbaa !9
  %56 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %57 = load ptr, ptr %56, align 8, !tbaa !11
  %58 = getelementptr inbounds %struct.Configuration, ptr %57, i32 0, i32 27
  %59 = load i8, ptr %58, align 8, !tbaa !25, !range !26, !noundef !27
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %72

61:                                               ; preds = %25
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 %63
  %65 = getelementptr inbounds %struct.ups_parameter_t, ptr %64, i32 0, i32 0
  store i32 262, ptr %65, align 16, !tbaa !20
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.ups_parameter_t, ptr %68, i32 0, i32 1
  store i64 ptrtoint (ptr @.str.2 to i64), ptr %69, align 8, !tbaa !23
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %8, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %61, %25
  %73 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = getelementptr inbounds %struct.Configuration, ptr %74, i32 0, i32 37
  %76 = load i8, ptr %75, align 1, !tbaa !28, !range !26, !noundef !27
  %77 = trunc i8 %76 to i1
  %78 = zext i1 %77 to i64
  %79 = select i1 %77, i32 512, i32 0
  %80 = load i32, ptr %5, align 4, !tbaa !9
  %81 = or i32 %80, %79
  store i32 %81, ptr %5, align 4, !tbaa !9
  %82 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %83 = load ptr, ptr %82, align 8, !tbaa !11
  %84 = getelementptr inbounds %struct.Configuration, ptr %83, i32 0, i32 38
  %85 = load i8, ptr %84, align 4, !tbaa !29, !range !26, !noundef !27
  %86 = trunc i8 %85 to i1
  %87 = zext i1 %86 to i64
  %88 = select i1 %86, i32 262144, i32 0
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = or i32 %89, %88
  store i32 %90, ptr %5, align 4, !tbaa !9
  %91 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %92 = load ptr, ptr %91, align 8, !tbaa !11
  %93 = getelementptr inbounds %struct.Configuration, ptr %92, i32 0, i32 36
  %94 = load i8, ptr %93, align 2, !tbaa !30, !range !26, !noundef !27
  %95 = trunc i8 %94 to i1
  %96 = zext i1 %95 to i64
  %97 = select i1 %95, i32 196608, i32 0
  %98 = load i32, ptr %5, align 4, !tbaa !9
  %99 = or i32 %98, %97
  store i32 %99, ptr %5, align 4, !tbaa !9
  %100 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %101 = load ptr, ptr %100, align 8, !tbaa !11
  %102 = getelementptr inbounds %struct.Configuration, ptr %101, i32 0, i32 65
  %103 = load i8, ptr %102, align 1, !tbaa !31, !range !26, !noundef !27
  %104 = trunc i8 %103 to i1
  %105 = zext i1 %104 to i64
  %106 = select i1 %104, i32 134217728, i32 0
  %107 = load i32, ptr %5, align 4, !tbaa !9
  %108 = or i32 %107, %106
  store i32 %108, ptr %5, align 4, !tbaa !9
  %109 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %110 = load ptr, ptr %109, align 8, !tbaa !11
  %111 = getelementptr inbounds %struct.Configuration, ptr %110, i32 0, i32 34
  %112 = load i8, ptr %111, align 8, !tbaa !32, !range !26, !noundef !27
  %113 = trunc i8 %112 to i1
  %114 = zext i1 %113 to i64
  %115 = select i1 %113, i32 1, i32 0
  %116 = load i32, ptr %5, align 4, !tbaa !9
  %117 = or i32 %116, %115
  store i32 %117, ptr %5, align 4, !tbaa !9
  %118 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !11
  %120 = getelementptr inbounds %struct.Configuration, ptr %119, i32 0, i32 54
  %121 = load i8, ptr %120, align 1, !tbaa !33, !range !26, !noundef !27
  %122 = trunc i8 %121 to i1
  %123 = zext i1 %122 to i64
  %124 = select i1 %122, i32 524288, i32 0
  %125 = load i32, ptr %5, align 4, !tbaa !9
  %126 = or i32 %125, %124
  store i32 %126, ptr %5, align 4, !tbaa !9
  %127 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %128 = load ptr, ptr %127, align 8, !tbaa !11
  %129 = getelementptr inbounds %struct.Configuration, ptr %128, i32 0, i32 59
  %130 = load i8, ptr %129, align 4, !tbaa !34, !range !26, !noundef !27
  %131 = trunc i8 %130 to i1
  %132 = zext i1 %131 to i64
  %133 = select i1 %131, i32 4, i32 0
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = or i32 %134, %133
  store i32 %135, ptr %5, align 4, !tbaa !9
  %136 = getelementptr inbounds %class.Database, ptr %12, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !11
  %138 = getelementptr inbounds %struct.Configuration, ptr %137, i32 0, i32 60
  %139 = load i8, ptr %138, align 1, !tbaa !35, !range !26, !noundef !27
  %140 = trunc i8 %139 to i1
  %141 = zext i1 %140 to i64
  %142 = select i1 %140, i32 33554432, i32 0
  %143 = load i32, ptr %5, align 4, !tbaa !9
  %144 = or i32 %143, %142
  store i32 %144, ptr %5, align 4, !tbaa !9
  %145 = load i32, ptr %5, align 4, !tbaa !9
  %146 = getelementptr inbounds [6 x %struct.ups_parameter_t], ptr %6, i64 0, i64 0
  %147 = invoke i32 @ups_env_open(ptr noundef @_ZN15UpscaleDatabase6ms_envE, ptr noundef @.str.3, i32 noundef %145, ptr noundef %146)
          to label %148 unwind label %164

148:                                              ; preds = %72
  store i32 %147, ptr %4, align 4, !tbaa !9
  %149 = load i32, ptr %4, align 4, !tbaa !9
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %168

151:                                              ; preds = %148
  br label %152

152:                                              ; preds = %151
  %153 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4)
          to label %154 unwind label %164

154:                                              ; preds = %152
  %155 = load i32, ptr %4, align 4, !tbaa !9
  %156 = load i32, ptr %4, align 4, !tbaa !9
  %157 = invoke ptr @ups_strerror(i32 noundef %156)
          to label %158 unwind label %164

158:                                              ; preds = %154
  %159 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %155, ptr noundef %157)
          to label %160 unwind label %164

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %163, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %169

164:                                              ; preds = %158, %154, %152, %72
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %9, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZN5boost11unique_lockINS_5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %176

168:                                              ; preds = %148
  store i32 0, ptr %11, align 4
  br label %169

169:                                              ; preds = %168, %162
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %170 = load i32, ptr %11, align 4
  switch i32 %170, label %174 [
    i32 0, label %171
  ]

171:                                              ; preds = %169
  br label %172

172:                                              ; preds = %171, %1
  %173 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %173, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %174

174:                                              ; preds = %172, %169
  call void @_ZN5boost11unique_lockINS_5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %175 = load i32, ptr %2, align 4
  ret i32 %175

176:                                              ; preds = %164
  %177 = load ptr, ptr %9, align 8
  %178 = load i32, ptr %10, align 4
  %179 = insertvalue { ptr, i32 } poison, ptr %177, 0
  %180 = insertvalue { ptr, i32 } %179, i32 %178, 1
  resume { ptr, i32 } %180
}

declare i32 @ups_env_open(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { "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 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 #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, !6, i64 16}
!12 = !{!"_ZTS8Database", !10, i64 8, !6, i64 16}
!13 = !{!14, !10, i64 212}
!14 = !{!"_ZTS13Configuration", !15, i64 0, !10, i64 4, !15, i64 8, !15, i64 9, !15, i64 10, !16, i64 16, !15, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !15, i64 64, !10, i64 68, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !10, i64 104, !15, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !15, i64 128, !15, i64 129, !10, i64 132, !15, i64 136, !10, i64 140, !15, i64 144, !15, i64 145, !15, i64 146, !15, i64 147, !15, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !15, i64 164, !15, i64 165, !15, i64 166, !10, i64 168, !10, i64 172, !16, i64 176, !10, i64 208, !10, i64 212, !10, i64 216, !15, i64 220, !15, i64 221, !10, i64 224, !10, i64 228, !10, i64 232, !15, i64 236, !15, i64 237, !15, i64 238, !15, i64 239, !10, i64 240, !15, i64 244, !15, i64 245}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!14, !10, i64 216}
!20 = !{!21, !10, i64 0}
!21 = !{!"_ZTS15ups_parameter_t", !10, i64 0, !18, i64 8}
!22 = !{!14, !10, i64 152}
!23 = !{!21, !18, i64 8}
!24 = !{!14, !10, i64 240}
!25 = !{!14, !15, i64 128}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!14, !15, i64 147}
!29 = !{!14, !15, i64 148}
!30 = !{!14, !15, i64 146}
!31 = !{!14, !15, i64 245}
!32 = !{!14, !15, i64 144}
!33 = !{!14, !15, i64 221}
!34 = !{!14, !15, i64 236}
!35 = !{!14, !15, i64 237}


; 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.Mutex = type { %"class.boost::mutex" }
%"class.boost::mutex" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.ups_parameter_t = type { i32, i64 }
%"class.boost::unique_lock" = type <{ ptr, i8, [7 x i8] }>

@_ZN15UpscaleDatabase6ms_envE = external dso_local global ptr, align 8
@_ZN15UpscaleDatabase8ms_mutexE = external dso_local global %class.Mutex, align 8
@_ZN15UpscaleDatabase11ms_refcountE = external dso_local local_unnamed_addr global i32, align 4
@_ZN9upscaledb7Globals21ms_extended_thresholdE = external local_unnamed_addr global i32, align 4
@_ZN9upscaledb7Globals22ms_duplicate_thresholdE = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [40 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost11unique_lockINS_5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare ptr @ups_strerror(i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost11unique_lockINS_5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN15UpscaleDatabase11do_open_envEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(712) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca [6 x %struct.ups_parameter_t], align 16
  %3 = alloca %"class.boost::unique_lock", align 8
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(96) %2, i8 0, i64 96, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @_ZN5boost11unique_lockINS_5mutexEEC2ERS1_(ptr noundef nonnull align 8 dereferenceable(9) %3, ptr noundef nonnull align 8 dereferenceable(40) @_ZN15UpscaleDatabase8ms_mutexE)
  %4 = load i32, ptr @_ZN15UpscaleDatabase11ms_refcountE, align 4, !tbaa !5
  %5 = add nsw i32 %4, 1
  store i32 %5, ptr @_ZN15UpscaleDatabase11ms_refcountE, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %7, i64 212
  %9 = load i32, ptr %8, align 4, !tbaa !12
  store i32 %9, ptr @_ZN9upscaledb7Globals21ms_extended_thresholdE, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %7, i64 216
  %11 = load i32, ptr %10, align 8, !tbaa !18
  store i32 %11, ptr @_ZN9upscaledb7Globals22ms_duplicate_thresholdE, align 4, !tbaa !5
  %12 = load ptr, ptr @_ZN15UpscaleDatabase6ms_envE, align 8, !tbaa !19
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %.critedge

14:                                               ; preds = %1
  store i32 256, ptr %2, align 16, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %7, i64 152
  %16 = load i32, ptr %15, align 8, !tbaa !22
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i8, ptr %2, i64 8
  store i64 %17, ptr %18, align 8, !tbaa !23
  %19 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 272, ptr %19, align 16, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %7, i64 240
  %21 = load i32, ptr %20, align 8, !tbaa !24
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i8, ptr %2, i64 24
  store i64 %22, ptr %23, align 8, !tbaa !23
  %24 = getelementptr inbounds i8, ptr %7, i64 128
  %25 = load i8, ptr %24, align 8, !tbaa !25, !range !26, !noundef !27
  %26 = trunc nuw i8 %25 to i1
  br i1 %26, label %27, label %30

27:                                               ; preds = %14
  %28 = getelementptr inbounds i8, ptr %2, i64 32
  store i32 262, ptr %28, align 16, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %2, i64 40
  store i64 ptrtoint (ptr @.str.2 to i64), ptr %29, align 8, !tbaa !23
  br label %30

30:                                               ; preds = %27, %14
  %31 = getelementptr inbounds i8, ptr %7, i64 147
  %32 = load i8, ptr %31, align 1, !tbaa !28, !range !26, !noundef !27
  %33 = trunc nuw i8 %32 to i1
  %34 = select i1 %33, i32 512, i32 0
  %35 = getelementptr inbounds i8, ptr %7, i64 148
  %36 = load i8, ptr %35, align 4, !tbaa !29, !range !26, !noundef !27
  %37 = trunc nuw i8 %36 to i1
  %38 = select i1 %37, i32 262144, i32 0
  %39 = or disjoint i32 %38, %34
  %40 = getelementptr inbounds i8, ptr %7, i64 146
  %41 = load i8, ptr %40, align 2, !tbaa !30, !range !26, !noundef !27
  %42 = trunc nuw i8 %41 to i1
  %43 = select i1 %42, i32 196608, i32 0
  %44 = or disjoint i32 %39, %43
  %45 = getelementptr inbounds i8, ptr %7, i64 245
  %46 = load i8, ptr %45, align 1, !tbaa !31, !range !26, !noundef !27
  %47 = trunc nuw i8 %46 to i1
  %48 = select i1 %47, i32 134217728, i32 0
  %49 = or disjoint i32 %44, %48
  %50 = getelementptr inbounds i8, ptr %7, i64 144
  %51 = load i8, ptr %50, align 8, !tbaa !32, !range !26, !noundef !27
  %52 = zext nneg i8 %51 to i32
  %53 = or disjoint i32 %49, %52
  %54 = getelementptr inbounds i8, ptr %7, i64 221
  %55 = load i8, ptr %54, align 1, !tbaa !33, !range !26, !noundef !27
  %56 = trunc nuw i8 %55 to i1
  %57 = select i1 %56, i32 524288, i32 0
  %58 = or disjoint i32 %53, %57
  %59 = getelementptr inbounds i8, ptr %7, i64 236
  %60 = load i8, ptr %59, align 4, !tbaa !34, !range !26, !noundef !27
  %61 = trunc nuw i8 %60 to i1
  %62 = select i1 %61, i32 4, i32 0
  %63 = or i32 %58, %62
  %64 = getelementptr inbounds i8, ptr %7, i64 237
  %65 = load i8, ptr %64, align 1, !tbaa !35, !range !26, !noundef !27
  %66 = trunc nuw i8 %65 to i1
  %67 = select i1 %66, i32 33554432, i32 0
  %68 = or i32 %63, %67
  %69 = invoke i32 @ups_env_open(ptr noundef nonnull @_ZN15UpscaleDatabase6ms_envE, ptr noundef nonnull @.str.3, i32 noundef %68, ptr noundef nonnull %2)
          to label %70 unwind label %76

70:                                               ; preds = %30
  %.not = icmp eq i32 %69, 0
  br i1 %.not, label %.critedge, label %71

71:                                               ; preds = %70
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %73 = invoke ptr @ups_strerror(i32 noundef %69)
          to label %74 unwind label %76

74:                                               ; preds = %71
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %69, ptr noundef %73)
  br label %.critedge

76:                                               ; preds = %71, %30
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5boost11unique_lockINS_5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %2) #6
  resume { ptr, i32 } %77

.critedge:                                        ; preds = %70, %74, %1
  %.1 = phi i32 [ %69, %74 ], [ 0, %1 ], [ 0, %70 ]
  call void @_ZN5boost11unique_lockINS_5mutexEED2Ev(ptr noundef nonnull align 8 dereferenceable(9) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %2) #6
  ret i32 %.1
}

declare i32 @ups_env_open(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { nofree 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 #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 = { 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 #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"}
!9 = !{!10, !11, i64 16}
!10 = !{!"_ZTS8Database", !6, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 212}
!13 = !{!"_ZTS13Configuration", !14, i64 0, !6, i64 4, !14, i64 8, !14, i64 9, !14, i64 10, !15, i64 16, !14, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !14, i64 64, !6, i64 68, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96, !6, i64 104, !14, i64 108, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !14, i64 128, !14, i64 129, !6, i64 132, !14, i64 136, !6, i64 140, !14, i64 144, !14, i64 145, !14, i64 146, !14, i64 147, !14, i64 148, !6, i64 152, !6, i64 156, !6, i64 160, !14, i64 164, !14, i64 165, !14, i64 166, !6, i64 168, !6, i64 172, !15, i64 176, !6, i64 208, !6, i64 212, !6, i64 216, !14, i64 220, !14, i64 221, !6, i64 224, !6, i64 228, !6, i64 232, !14, i64 236, !14, i64 237, !14, i64 238, !14, i64 239, !6, i64 240, !14, i64 244, !14, i64 245}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!13, !6, i64 216}
!19 = !{!11, !11, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS15ups_parameter_t", !6, i64 0, !17, i64 8}
!22 = !{!13, !6, i64 152}
!23 = !{!21, !17, i64 8}
!24 = !{!13, !6, i64 240}
!25 = !{!13, !14, i64 128}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!13, !14, i64 147}
!29 = !{!13, !14, i64 148}
!30 = !{!13, !14, i64 146}
!31 = !{!13, !14, i64 245}
!32 = !{!13, !14, i64 144}
!33 = !{!13, !14, i64 221}
!34 = !{!13, !14, i64 236}
!35 = !{!13, !14, i64 237}


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