; LLVM IR from interpretml/interpret :: shared/libebm (interpretable_numerics)

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

@g_traceLevel = external global i32, align 4
@_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE = external hidden global i32, align 4
@_ZZ8SafeMeanE13LOG__sMessage = external hidden constant [88 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_0 = external hidden constant [37 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_1 = external hidden constant [49 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_2 = external hidden constant [43 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_3 = external hidden constant [55 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_4 = external hidden constant [31 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_5 = external hidden constant [36 x i8], align 16
@_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE = external hidden global i32, align 4
@_ZZ8SafeMeanE13LOG__sMessage_6 = external hidden constant [16 x i8], align 16

; 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 nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE9quiet_NaNEv() #1 align 2

declare void @InteralLogWithArguments(i32 noundef, ptr noundef, ...) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local i32 @SafeMean(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #4 {
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca i64, align 8
  %31 = alloca i64, align 8
  %32 = alloca i64, align 8
  %33 = alloca double, align 8
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca ptr, align 8
  %39 = alloca i32, align 4
  store i64 %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !9
  br label %40

40:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 3, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 4, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %41 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  store i32 %41, ptr %14, align 4, !tbaa !11
  %42 = load i32, ptr %14, align 4, !tbaa !11
  %43 = icmp sle i32 3, %42
  br i1 %43, label %44, label %72

44:                                               ; preds = %40
  br label %45

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %46 = load i32, ptr %14, align 4, !tbaa !11
  %47 = icmp slt i32 %46, 4
  br i1 %47, label %48, label %59

48:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store ptr @_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %49 = load i32, ptr @_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE, align 4, !tbaa !11
  %50 = sub nsw i32 %49, 1
  store i32 %50, ptr %17, align 4, !tbaa !11
  %51 = load i32, ptr %17, align 4, !tbaa !11
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %48
  store i32 4, ptr %18, align 4
  br label %56

54:                                               ; preds = %48
  %55 = load i32, ptr %17, align 4, !tbaa !11
  store i32 %55, ptr @_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE, align 4, !tbaa !11
  store i32 3, ptr %15, align 4, !tbaa !11
  store i32 0, ptr %18, align 4
  br label %56

56:                                               ; preds = %54, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %57 = load i32, ptr %18, align 4
  switch i32 %57, label %67 [
    i32 0, label %58
  ]

58:                                               ; preds = %56
  br label %60

59:                                               ; preds = %45
  store i32 4, ptr %15, align 4, !tbaa !11
  br label %60

60:                                               ; preds = %59, %58
  %61 = load i32, ptr %15, align 4, !tbaa !11
  %62 = load i64, ptr %7, align 8, !tbaa !5
  %63 = load i64, ptr %8, align 8, !tbaa !5
  %64 = load ptr, ptr %9, align 8, !tbaa !9
  %65 = load ptr, ptr %10, align 8, !tbaa !9
  %66 = load ptr, ptr %11, align 8, !tbaa !9
  call void (i32, ptr, ...) @InteralLogWithArguments(i32 noundef %61, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage, i64 noundef %62, i64 noundef %63, ptr noundef %64, ptr noundef %65, ptr noundef %66)
  store i32 0, ptr %18, align 4
  br label %67

67:                                               ; preds = %60, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %68 = load i32, ptr %18, align 4
  switch i32 %68, label %230 [
    i32 0, label %69
    i32 4, label %71
  ]

69:                                               ; preds = %67
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70, %67
  br label %72

72:                                               ; preds = %71, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %73

73:                                               ; preds = %72
  %74 = load i64, ptr %7, align 8, !tbaa !5
  %75 = icmp sle i64 %74, 0
  br i1 %75, label %76, label %87

76:                                               ; preds = %73
  %77 = load i64, ptr %7, align 8, !tbaa !5
  %78 = icmp slt i64 %77, 0
  br i1 %78, label %79, label %86

79:                                               ; preds = %76
  br label %80

80:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 1, ptr %19, align 4, !tbaa !11
  %81 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %82 = icmp sle i32 1, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %80
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_0)
  br label %84

84:                                               ; preds = %83, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %85

85:                                               ; preds = %84
  store i32 -3, ptr %6, align 4
  br label %228

86:                                               ; preds = %76
  store i32 0, ptr %6, align 4
  br label %228

87:                                               ; preds = %73
  %88 = load i64, ptr %7, align 8, !tbaa !5
  %89 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %88) #5
  br i1 %89, label %90, label %97

90:                                               ; preds = %87
  br label %91

91:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 1, ptr %20, align 4, !tbaa !11
  %92 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %93 = icmp sle i32 1, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %91
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_1)
  br label %95

95:                                               ; preds = %94, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %96

96:                                               ; preds = %95
  store i32 -3, ptr %6, align 4
  br label %228

97:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %98 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %98, ptr %21, align 8, !tbaa !5
  %99 = load i64, ptr %8, align 8, !tbaa !5
  %100 = icmp sle i64 %99, 0
  br i1 %100, label %101, label %113

101:                                              ; preds = %97
  %102 = load i64, ptr %8, align 8, !tbaa !5
  %103 = icmp slt i64 %102, 0
  br i1 %103, label %104, label %112

104:                                              ; preds = %101
  br label %105

105:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 1, ptr %22, align 4, !tbaa !11
  %106 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %107 = icmp sle i32 1, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %105
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_2)
  br label %109

109:                                              ; preds = %108, %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %18, align 4
  br label %227

112:                                              ; preds = %101
  store i32 0, ptr %6, align 4
  store i32 1, ptr %18, align 4
  br label %227

113:                                              ; preds = %97
  %114 = load i64, ptr %8, align 8, !tbaa !5
  %115 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %114) #5
  br i1 %115, label %116, label %124

116:                                              ; preds = %113
  br label %117

117:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 1, ptr %23, align 4, !tbaa !11
  %118 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %119 = icmp sle i32 1, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %117
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_3)
  br label %121

121:                                              ; preds = %120, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %18, align 4
  br label %227

124:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %125 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %125, ptr %24, align 8, !tbaa !5
  %126 = load ptr, ptr %9, align 8, !tbaa !9
  %127 = icmp eq ptr null, %126
  br i1 %127, label %128, label %136

128:                                              ; preds = %124
  br label %129

129:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 1, ptr %25, align 4, !tbaa !11
  %130 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %131 = icmp sle i32 1, %130
  br i1 %131, label %132, label %133

132:                                              ; preds = %129
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_4)
  br label %133

133:                                              ; preds = %132, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %18, align 4
  br label %226

136:                                              ; preds = %124
  %137 = load ptr, ptr %11, align 8, !tbaa !9
  %138 = icmp eq ptr null, %137
  br i1 %138, label %139, label %147

139:                                              ; preds = %136
  br label %140

140:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 1, ptr %26, align 4, !tbaa !11
  %141 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %142 = icmp sle i32 1, %141
  br i1 %142, label %143, label %144

143:                                              ; preds = %140
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_5)
  br label %144

144:                                              ; preds = %143, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %18, align 4
  br label %226

147:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %148 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %148, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %149 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %149, ptr %28, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  %150 = load ptr, ptr %11, align 8, !tbaa !9
  %151 = load i64, ptr %24, align 8, !tbaa !5
  %152 = getelementptr inbounds double, ptr %150, i64 %151
  store ptr %152, ptr %29, align 8, !tbaa !9
  br label %153

153:                                              ; preds = %191, %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #5
  %154 = load i64, ptr %21, align 8, !tbaa !5
  %155 = load i64, ptr %24, align 8, !tbaa !5
  %156 = load ptr, ptr %27, align 8, !tbaa !9
  %157 = load ptr, ptr %10, align 8, !tbaa !9
  %158 = call noundef double @_ZN14NAMESPACE_MAINL4MeanEmmPKdS1_PmS2_S2_(i64 noundef %154, i64 noundef %155, ptr noundef %156, ptr noundef %157, ptr noundef %30, ptr noundef %31, ptr noundef %32)
  store double %158, ptr %33, align 8, !tbaa !13
  %159 = load i64, ptr %30, align 8, !tbaa !5
  %160 = icmp ne i64 0, %159
  br i1 %160, label %161, label %163

161:                                              ; preds = %153
  %162 = call noundef double @_ZNSt14numeric_limitsIdE9quiet_NaNEv() #5
  store double %162, ptr %33, align 8, !tbaa !13
  br label %184

163:                                              ; preds = %153
  %164 = load i64, ptr %31, align 8, !tbaa !5
  %165 = icmp ne i64 0, %164
  br i1 %165, label %166, label %176

166:                                              ; preds = %163
  %167 = load i64, ptr %32, align 8, !tbaa !5
  %168 = load i64, ptr %31, align 8, !tbaa !5
  %169 = icmp ule i64 %167, %168
  br i1 %169, label %170, label %172

170:                                              ; preds = %166
  %171 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  store double %171, ptr %33, align 8, !tbaa !13
  br label %175

172:                                              ; preds = %166
  %173 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  %174 = fneg double %173
  store double %174, ptr %33, align 8, !tbaa !13
  br label %175

175:                                              ; preds = %172, %170
  br label %183

176:                                              ; preds = %163
  %177 = load i64, ptr %32, align 8, !tbaa !5
  %178 = icmp ne i64 0, %177
  br i1 %178, label %179, label %182

179:                                              ; preds = %176
  %180 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  %181 = fneg double %180
  store double %181, ptr %33, align 8, !tbaa !13
  br label %182

182:                                              ; preds = %179, %176
  br label %183

183:                                              ; preds = %182, %175
  br label %184

184:                                              ; preds = %183, %161
  %185 = load double, ptr %33, align 8, !tbaa !13
  %186 = load ptr, ptr %28, align 8, !tbaa !9
  store double %185, ptr %186, align 8, !tbaa !13
  %187 = load ptr, ptr %27, align 8, !tbaa !9
  %188 = getelementptr inbounds double, ptr %187, i32 1
  store ptr %188, ptr %27, align 8, !tbaa !9
  %189 = load ptr, ptr %28, align 8, !tbaa !9
  %190 = getelementptr inbounds double, ptr %189, i32 1
  store ptr %190, ptr %28, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  br label %191

191:                                              ; preds = %184
  %192 = load ptr, ptr %29, align 8, !tbaa !9
  %193 = load ptr, ptr %28, align 8, !tbaa !9
  %194 = icmp ne ptr %192, %193
  br i1 %194, label %153, label %195, !llvm.loop !15

195:                                              ; preds = %191
  br label %196

196:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #5
  store i32 3, ptr %34, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #5
  store i32 4, ptr %35, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #5
  %197 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  store i32 %197, ptr %36, align 4, !tbaa !11
  %198 = load i32, ptr %36, align 4, !tbaa !11
  %199 = icmp sle i32 3, %198
  br i1 %199, label %200, label %223

200:                                              ; preds = %196
  br label %201

201:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #5
  %202 = load i32, ptr %36, align 4, !tbaa !11
  %203 = icmp slt i32 %202, 4
  br i1 %203, label %204, label %215

204:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #5
  store ptr @_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE, ptr %38, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #5
  %205 = load i32, ptr @_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE, align 4, !tbaa !11
  %206 = sub nsw i32 %205, 1
  store i32 %206, ptr %39, align 4, !tbaa !11
  %207 = load i32, ptr %39, align 4, !tbaa !11
  %208 = icmp slt i32 %207, 0
  br i1 %208, label %209, label %210

209:                                              ; preds = %204
  store i32 22, ptr %18, align 4
  br label %212

210:                                              ; preds = %204
  %211 = load i32, ptr %39, align 4, !tbaa !11
  store i32 %211, ptr @_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE, align 4, !tbaa !11
  store i32 3, ptr %37, align 4, !tbaa !11
  store i32 0, ptr %18, align 4
  br label %212

212:                                              ; preds = %210, %209
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #5
  %213 = load i32, ptr %18, align 4
  switch i32 %213, label %218 [
    i32 0, label %214
  ]

214:                                              ; preds = %212
  br label %216

215:                                              ; preds = %201
  store i32 4, ptr %37, align 4, !tbaa !11
  br label %216

216:                                              ; preds = %215, %214
  %217 = load i32, ptr %37, align 4, !tbaa !11
  call void @InteralLogWithoutArguments(i32 noundef %217, ptr noundef @_ZZ8SafeMeanE13LOG__sMessage_6)
  store i32 0, ptr %18, align 4
  br label %218

218:                                              ; preds = %216, %212
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #5
  %219 = load i32, ptr %18, align 4
  switch i32 %219, label %230 [
    i32 0, label %220
    i32 22, label %222
  ]

220:                                              ; preds = %218
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221, %218
  br label %223

223:                                              ; preds = %222, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #5
  br label %224

224:                                              ; preds = %223
  br label %225

225:                                              ; preds = %224
  store i32 0, ptr %6, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  br label %226

226:                                              ; preds = %225, %146, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %227

227:                                              ; preds = %226, %123, %112, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %228

228:                                              ; preds = %227, %96, %86, %85
  %229 = load i32, ptr %6, align 4
  ret i32 %229

230:                                              ; preds = %218, %67
  unreachable
}

; Function Attrs: mustprogress uwtable
declare hidden noundef double @_ZN14NAMESPACE_MAINL4MeanEmmPKdS1_PmS2_S2_(i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #4 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@g_traceLevel = external local_unnamed_addr global i32, align 4
@_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE = external hidden local_unnamed_addr global i32, align 4
@_ZZ8SafeMeanE13LOG__sMessage = external hidden constant [88 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_0 = external hidden constant [37 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_1 = external hidden constant [49 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_2 = external hidden constant [43 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_3 = external hidden constant [55 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_4 = external hidden constant [31 x i8], align 16
@_ZZ8SafeMeanE13LOG__sMessage_5 = external hidden constant [36 x i8], align 16
@_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE = external hidden local_unnamed_addr global i32, align 4
@_ZZ8SafeMeanE13LOG__sMessage_6 = external hidden constant [16 x i8], align 16

; 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 nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE8infinityEv() local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE9quiet_NaNEv() local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local range(i32 -3, 1) i32 @SafeMean(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #4 {
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 2
  br i1 %10, label %11, label %.critedge

11:                                               ; preds = %5
  %12 = icmp eq i32 %9, 3
  br i1 %12, label %13, label %18

13:                                               ; preds = %11
  %14 = load i32, ptr @_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %.critedge

16:                                               ; preds = %13
  %17 = add nsw i32 %14, -1
  store i32 %17, ptr @_ZN14NAMESPACE_MAINL24g_cLogEnterSafeMeanCountE, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %16, %11
  %.143 = phi i32 [ 3, %16 ], [ 4, %11 ]
  tail call void (i32, ptr, ...) @InteralLogWithArguments(i32 noundef %.143, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage, i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  br label %.critedge

.critedge:                                        ; preds = %18, %13, %5
  %19 = icmp slt i64 %0, 1
  br i1 %19, label %20, label %26

20:                                               ; preds = %.critedge
  %21 = icmp slt i64 %0, 0
  br i1 %21, label %22, label %.critedge68

22:                                               ; preds = %20
  %23 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %25, label %.critedge68

25:                                               ; preds = %22
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_0)
  br label %.critedge68

26:                                               ; preds = %.critedge
  %27 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %0) #5
  br i1 %27, label %28, label %32

28:                                               ; preds = %26
  %29 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %31, label %.critedge68

31:                                               ; preds = %28
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_1)
  br label %.critedge68

32:                                               ; preds = %26
  %33 = icmp slt i64 %1, 1
  br i1 %33, label %34, label %40

34:                                               ; preds = %32
  %35 = icmp slt i64 %1, 0
  br i1 %35, label %36, label %.critedge68

36:                                               ; preds = %34
  %37 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %39, label %.critedge68

39:                                               ; preds = %36
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_2)
  br label %.critedge68

40:                                               ; preds = %32
  %41 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %1) #5
  br i1 %41, label %42, label %46

42:                                               ; preds = %40
  %43 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %45, label %.critedge68

45:                                               ; preds = %42
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_3)
  br label %.critedge68

46:                                               ; preds = %40
  %47 = icmp eq ptr %2, null
  br i1 %47, label %48, label %52

48:                                               ; preds = %46
  %49 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %51, label %.critedge68

51:                                               ; preds = %48
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_4)
  br label %.critedge68

52:                                               ; preds = %46
  %53 = icmp eq ptr %4, null
  br i1 %53, label %54, label %58

54:                                               ; preds = %52
  %55 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %57, label %.critedge68

57:                                               ; preds = %54
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_5)
  br label %.critedge68

58:                                               ; preds = %52
  %59 = getelementptr inbounds double, ptr %4, i64 %1
  br label %60

60:                                               ; preds = %76, %58
  %.049 = phi ptr [ %4, %58 ], [ %78, %76 ]
  %.048 = phi ptr [ %2, %58 ], [ %77, %76 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %61 = call noundef double @_ZN14NAMESPACE_MAINL4MeanEmmPKdS1_PmS2_S2_(i64 noundef %0, i64 noundef %1, ptr noundef nonnull %.048, ptr noundef %3, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %.not = icmp eq i64 %62, 0
  br i1 %.not, label %65, label %63

63:                                               ; preds = %60
  %64 = call noundef double @_ZNSt14numeric_limitsIdE9quiet_NaNEv() #5
  br label %76

65:                                               ; preds = %60
  %66 = load i64, ptr %7, align 8, !tbaa !9
  %.not63 = icmp eq i64 %66, 0
  %67 = load i64, ptr %8, align 8, !tbaa !9
  br i1 %.not63, label %72, label %68

68:                                               ; preds = %65
  %.not65 = icmp ugt i64 %67, %66
  %69 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  br i1 %.not65, label %70, label %76

70:                                               ; preds = %68
  %71 = fneg double %69
  br label %76

72:                                               ; preds = %65
  %.not64 = icmp eq i64 %67, 0
  br i1 %.not64, label %76, label %73

73:                                               ; preds = %72
  %74 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  %75 = fneg double %74
  br label %76

76:                                               ; preds = %68, %70, %73, %72, %63
  %.050 = phi double [ %64, %63 ], [ %71, %70 ], [ %75, %73 ], [ %61, %72 ], [ %69, %68 ]
  store double %.050, ptr %.049, align 8, !tbaa !11
  %77 = getelementptr inbounds i8, ptr %.048, i64 8
  %78 = getelementptr inbounds i8, ptr %.049, i64 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %.not66 = icmp eq ptr %59, %78
  br i1 %.not66, label %79, label %60, !llvm.loop !13

79:                                               ; preds = %76
  %80 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %81 = icmp sgt i32 %80, 2
  br i1 %81, label %82, label %.critedge68

82:                                               ; preds = %79
  %83 = icmp eq i32 %80, 3
  br i1 %83, label %84, label %89

84:                                               ; preds = %82
  %85 = load i32, ptr @_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %87, label %.critedge68

87:                                               ; preds = %84
  %88 = add nsw i32 %85, -1
  store i32 %88, ptr @_ZN14NAMESPACE_MAINL23g_cLogExitSafeMeanCountE, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %87, %82
  %.145 = phi i32 [ 3, %87 ], [ 4, %82 ]
  call void @InteralLogWithoutArguments(i32 noundef %.145, ptr noundef nonnull @_ZZ8SafeMeanE13LOG__sMessage_6)
  br label %.critedge68

.critedge68:                                      ; preds = %39, %36, %34, %45, %42, %79, %84, %89, %54, %57, %48, %51, %28, %31, %20, %22, %25
  %.2 = phi i32 [ -3, %25 ], [ -3, %22 ], [ 0, %20 ], [ -3, %31 ], [ -3, %28 ], [ -3, %39 ], [ -3, %36 ], [ 0, %34 ], [ -3, %45 ], [ -3, %42 ], [ -3, %51 ], [ -3, %48 ], [ -3, %57 ], [ -3, %54 ], [ 0, %89 ], [ 0, %84 ], [ 0, %79 ]
  ret i32 %.2
}

; Function Attrs: mustprogress uwtable
declare hidden noundef double @_ZN14NAMESPACE_MAINL4MeanEmmPKdS1_PmS2_S2_(i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #4 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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