; LLVM IR from yinqiwen/ardb :: src/common/util (string_helper)

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

@_ZZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE12powers_of_10 = external hidden constant [10 x double], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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
define dso_local void @_ZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(double noundef %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) #1 {
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store double %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !11
  %19 = load double, ptr %4, align 8, !tbaa !5
  %20 = load double, ptr %4, align 8, !tbaa !5
  %21 = fcmp oeq double %19, %20
  br i1 %21, label %25, label %22

22:                                               ; preds = %3
  %23 = load ptr, ptr %6, align 8, !tbaa !11
  %24 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef @.str)
  br label %238

25:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 256, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noalias ptr @malloc(i64 noundef %27) #8
  store ptr %28, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store double 0x41DFFFFFFFC00000, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store double 0.000000e+00, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %29 = load ptr, ptr %8, align 8, !tbaa !11
  store ptr %29, ptr %12, align 8, !tbaa !11
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %25
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %38

33:                                               ; preds = %25
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = icmp sgt i32 %34, 9
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  store i32 9, ptr %5, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %36, %33
  br label %38

38:                                               ; preds = %37, %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !9
  %39 = load double, ptr %4, align 8, !tbaa !5
  %40 = fcmp olt double %39, 0.000000e+00
  br i1 %40, label %41, label %44

41:                                               ; preds = %38
  store i32 1, ptr %13, align 4, !tbaa !9
  %42 = load double, ptr %4, align 8, !tbaa !5
  %43 = fneg double %42
  store double %43, ptr %4, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %41, %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %45 = load double, ptr %4, align 8, !tbaa !5
  %46 = fptosi double %45 to i32
  store i32 %46, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %47 = load double, ptr %4, align 8, !tbaa !5
  %48 = load i32, ptr %14, align 4, !tbaa !9
  %49 = sitofp i32 %48 to double
  %50 = fsub double %47, %49
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [10 x double], ptr @_ZZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE12powers_of_10, i64 0, i64 %52
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = fmul double %50, %54
  store double %55, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %56 = load double, ptr %15, align 8, !tbaa !5
  %57 = fptoui double %56 to i32
  store i32 %57, ptr %16, align 4, !tbaa !9
  %58 = load double, ptr %15, align 8, !tbaa !5
  %59 = load i32, ptr %16, align 4, !tbaa !9
  %60 = uitofp i32 %59 to double
  %61 = fsub double %58, %60
  store double %61, ptr %11, align 8, !tbaa !5
  %62 = load double, ptr %11, align 8, !tbaa !5
  %63 = fcmp ogt double %62, 5.000000e-01
  br i1 %63, label %64, label %78

64:                                               ; preds = %44
  %65 = load i32, ptr %16, align 4, !tbaa !9
  %66 = add i32 %65, 1
  store i32 %66, ptr %16, align 4, !tbaa !9
  %67 = load i32, ptr %16, align 4, !tbaa !9
  %68 = uitofp i32 %67 to double
  %69 = load i32, ptr %5, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [10 x double], ptr @_ZZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE12powers_of_10, i64 0, i64 %70
  %72 = load double, ptr %71, align 8, !tbaa !5
  %73 = fcmp oge double %68, %72
  br i1 %73, label %74, label %77

74:                                               ; preds = %64
  store i32 0, ptr %16, align 4, !tbaa !9
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %14, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %74, %64
  br label %92

78:                                               ; preds = %44
  %79 = load double, ptr %11, align 8, !tbaa !5
  %80 = fcmp oeq double %79, 5.000000e-01
  br i1 %80, label %81, label %91

81:                                               ; preds = %78
  %82 = load i32, ptr %16, align 4, !tbaa !9
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %88, label %84

84:                                               ; preds = %81
  %85 = load i32, ptr %16, align 4, !tbaa !9
  %86 = and i32 %85, 1
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %91

88:                                               ; preds = %84, %81
  %89 = load i32, ptr %16, align 4, !tbaa !9
  %90 = add i32 %89, 1
  store i32 %90, ptr %16, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %88, %84, %78
  br label %92

92:                                               ; preds = %91, %77
  %93 = load double, ptr %4, align 8, !tbaa !5
  %94 = fcmp ogt double %93, 0x41DFFFFFFFC00000
  br i1 %94, label %95, label %139

95:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %96 = load ptr, ptr %8, align 8, !tbaa !11
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = load i32, ptr %13, align 4, !tbaa !9
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %95
  %102 = load double, ptr %4, align 8, !tbaa !5
  %103 = fneg double %102
  br label %106

104:                                              ; preds = %95
  %105 = load double, ptr %4, align 8, !tbaa !5
  br label %106

106:                                              ; preds = %104, %101
  %107 = phi double [ %103, %101 ], [ %105, %104 ]
  %108 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %96, i64 noundef %98, ptr noundef @.str.1, double noundef %107) #7
  store i32 %108, ptr %17, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %129, %106
  %110 = load i32, ptr %17, align 4, !tbaa !9
  %111 = icmp slt i32 %110, 0
  br i1 %111, label %112, label %132

112:                                              ; preds = %109
  %113 = load i32, ptr %7, align 4, !tbaa !9
  %114 = mul nsw i32 %113, 2
  store i32 %114, ptr %7, align 4, !tbaa !9
  %115 = load ptr, ptr %8, align 8, !tbaa !11
  %116 = load i32, ptr %7, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = call ptr @realloc(ptr noundef %115, i64 noundef %117) #9
  store ptr %118, ptr %8, align 8, !tbaa !11
  %119 = load ptr, ptr %8, align 8, !tbaa !11
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = load i32, ptr %13, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %127

124:                                              ; preds = %112
  %125 = load double, ptr %4, align 8, !tbaa !5
  %126 = fneg double %125
  br label %129

127:                                              ; preds = %112
  %128 = load double, ptr %4, align 8, !tbaa !5
  br label %129

129:                                              ; preds = %127, %124
  %130 = phi double [ %126, %124 ], [ %128, %127 ]
  %131 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %119, i64 noundef %121, ptr noundef @.str.1, double noundef %130) #7
  store i32 %131, ptr %17, align 4, !tbaa !9
  br label %109, !llvm.loop !13

132:                                              ; preds = %109
  %133 = load ptr, ptr %6, align 8, !tbaa !11
  %134 = load ptr, ptr %8, align 8, !tbaa !11
  %135 = load i32, ptr %17, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %133, ptr noundef %134, i64 noundef %136)
  %138 = load ptr, ptr %8, align 8, !tbaa !11
  call void @free(ptr noundef %138) #7
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %237

139:                                              ; preds = %92
  %140 = load i32, ptr %5, align 4, !tbaa !9
  %141 = icmp eq i32 %140, 0
  br i1 %141, label %142, label %164

142:                                              ; preds = %139
  %143 = load double, ptr %4, align 8, !tbaa !5
  %144 = load i32, ptr %14, align 4, !tbaa !9
  %145 = sitofp i32 %144 to double
  %146 = fsub double %143, %145
  store double %146, ptr %11, align 8, !tbaa !5
  %147 = load double, ptr %11, align 8, !tbaa !5
  %148 = fcmp ogt double %147, 5.000000e-01
  br i1 %148, label %149, label %152

149:                                              ; preds = %142
  %150 = load i32, ptr %14, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %14, align 4, !tbaa !9
  br label %163

152:                                              ; preds = %142
  %153 = load double, ptr %11, align 8, !tbaa !5
  %154 = fcmp oeq double %153, 5.000000e-01
  br i1 %154, label %155, label %162

155:                                              ; preds = %152
  %156 = load i32, ptr %14, align 4, !tbaa !9
  %157 = and i32 %156, 1
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %162

159:                                              ; preds = %155
  %160 = load i32, ptr %14, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %14, align 4, !tbaa !9
  br label %162

162:                                              ; preds = %159, %155, %152
  br label %163

163:                                              ; preds = %162, %149
  br label %205

164:                                              ; preds = %139
  %165 = load i32, ptr %16, align 4, !tbaa !9
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %167, label %204

167:                                              ; preds = %164
  %168 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %168, ptr %10, align 4, !tbaa !9
  br label %169

169:                                              ; preds = %174, %167
  %170 = load i32, ptr %16, align 4, !tbaa !9
  %171 = urem i32 %170, 10
  %172 = icmp ne i32 %171, 0
  %173 = xor i1 %172, true
  br i1 %173, label %174, label %179

174:                                              ; preds = %169
  %175 = load i32, ptr %10, align 4, !tbaa !9
  %176 = add nsw i32 %175, -1
  store i32 %176, ptr %10, align 4, !tbaa !9
  %177 = load i32, ptr %16, align 4, !tbaa !9
  %178 = udiv i32 %177, 10
  store i32 %178, ptr %16, align 4, !tbaa !9
  br label %169, !llvm.loop !15

179:                                              ; preds = %169
  br label %180

180:                                              ; preds = %189, %179
  %181 = load i32, ptr %10, align 4, !tbaa !9
  %182 = add nsw i32 %181, -1
  store i32 %182, ptr %10, align 4, !tbaa !9
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %183 = load i32, ptr %16, align 4, !tbaa !9
  %184 = urem i32 %183, 10
  %185 = add i32 48, %184
  %186 = trunc i32 %185 to i8
  %187 = load ptr, ptr %12, align 8, !tbaa !11
  %188 = getelementptr inbounds i8, ptr %187, i32 1
  store ptr %188, ptr %12, align 8, !tbaa !11
  store i8 %186, ptr %187, align 1, !tbaa !16
  br label %189

189:                                              ; preds = %180
  %190 = load i32, ptr %16, align 4, !tbaa !9
  %191 = udiv i32 %190, 10
  store i32 %191, ptr %16, align 4, !tbaa !9
  %192 = icmp ne i32 %191, 0
  br i1 %192, label %180, label %193, !llvm.loop !17

193:                                              ; preds = %189
  br label %194

194:                                              ; preds = %198, %193
  %195 = load i32, ptr %10, align 4, !tbaa !9
  %196 = add nsw i32 %195, -1
  store i32 %196, ptr %10, align 4, !tbaa !9
  %197 = icmp sgt i32 %195, 0
  br i1 %197, label %198, label %201

198:                                              ; preds = %194
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %199 = load ptr, ptr %12, align 8, !tbaa !11
  %200 = getelementptr inbounds i8, ptr %199, i32 1
  store ptr %200, ptr %12, align 8, !tbaa !11
  store i8 48, ptr %199, align 1, !tbaa !16
  br label %194, !llvm.loop !18

201:                                              ; preds = %194
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %202 = load ptr, ptr %12, align 8, !tbaa !11
  %203 = getelementptr inbounds i8, ptr %202, i32 1
  store ptr %203, ptr %12, align 8, !tbaa !11
  store i8 46, ptr %202, align 1, !tbaa !16
  br label %204

204:                                              ; preds = %201, %164
  br label %205

205:                                              ; preds = %204, %163
  br label %206

206:                                              ; preds = %213, %205
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %207 = load i32, ptr %14, align 4, !tbaa !9
  %208 = srem i32 %207, 10
  %209 = add nsw i32 48, %208
  %210 = trunc i32 %209 to i8
  %211 = load ptr, ptr %12, align 8, !tbaa !11
  %212 = getelementptr inbounds i8, ptr %211, i32 1
  store ptr %212, ptr %12, align 8, !tbaa !11
  store i8 %210, ptr %211, align 1, !tbaa !16
  br label %213

213:                                              ; preds = %206
  %214 = load i32, ptr %14, align 4, !tbaa !9
  %215 = sdiv i32 %214, 10
  store i32 %215, ptr %14, align 4, !tbaa !9
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %206, label %217, !llvm.loop !19

217:                                              ; preds = %213
  %218 = load i32, ptr %13, align 4, !tbaa !9
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %223

220:                                              ; preds = %217
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %221 = load ptr, ptr %12, align 8, !tbaa !11
  %222 = getelementptr inbounds i8, ptr %221, i32 1
  store ptr %222, ptr %12, align 8, !tbaa !11
  store i8 45, ptr %221, align 1, !tbaa !16
  br label %223

223:                                              ; preds = %220, %217
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %224 = load ptr, ptr %12, align 8, !tbaa !11
  store i8 0, ptr %224, align 1, !tbaa !16
  %225 = load ptr, ptr %8, align 8, !tbaa !11
  %226 = load ptr, ptr %12, align 8, !tbaa !11
  %227 = getelementptr inbounds i8, ptr %226, i64 -1
  call void @_ZN4ardbL10strreverseEPcS0_(ptr noundef %225, ptr noundef %227)
  %228 = load ptr, ptr %6, align 8, !tbaa !11
  %229 = load ptr, ptr %8, align 8, !tbaa !11
  %230 = load ptr, ptr %12, align 8, !tbaa !11
  %231 = load ptr, ptr %8, align 8, !tbaa !11
  %232 = ptrtoint ptr %230 to i64
  %233 = ptrtoint ptr %231 to i64
  %234 = sub i64 %232, %233
  %235 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %228, ptr noundef %229, i64 noundef %234)
  %236 = load ptr, ptr %8, align 8, !tbaa !11
  call void @free(ptr noundef %236) #7
  store i32 1, ptr %18, align 4
  br label %237

237:                                              ; preds = %223, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %238

238:                                              ; preds = %237, %22
  ret void
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #3

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) #1 align 2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN4ardbL10strreverseEPcS0_(ptr noundef, ptr noundef) #6

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 = { nounwind allocsize(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 = { 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 = { nounwind allocsize(1) "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(1) }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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

@_ZZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE12powers_of_10 = external hidden local_unnamed_addr constant [10 x double], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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
define dso_local void @_ZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(double noundef %0, i32 noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) local_unnamed_addr #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = fcmp ord double %0, 0.000000e+00
  br i1 %7, label %10, label %8

8:                                                ; preds = %3
  %9 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull @.str)
  br label %110

10:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  store i32 256, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %11 = tail call noalias dereferenceable_or_null(256) ptr @malloc(i64 noundef 256) #10
  store ptr %11, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  store ptr %11, ptr %6, align 8, !tbaa !9
  %12 = icmp slt i32 %1, 0
  %13 = tail call i32 @llvm.umin.i32(i32 %1, i32 9)
  %.062 = select i1 %12, i32 0, i32 %13
  %14 = fcmp uge double %0, 0.000000e+00
  %15 = fneg double %0
  %.054 = select i1 %14, double %0, double %15
  %16 = fptosi double %.054 to i32
  %17 = sitofp i32 %16 to double
  %18 = fsub double %.054, %17
  %19 = zext nneg i32 %.062 to i64
  %20 = getelementptr inbounds [10 x double], ptr @_ZZN4ardb9fast_dtoaEdiRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE12powers_of_10, i64 0, i64 %19
  %21 = load double, ptr %20, align 8, !tbaa !11
  %22 = fmul double %18, %21
  %23 = fptoui double %22 to i32
  %24 = uitofp i32 %23 to double
  %25 = fsub double %22, %24
  %26 = fcmp ogt double %25, 5.000000e-01
  br i1 %26, label %27, label %33

27:                                               ; preds = %10
  %28 = add i32 %23, 1
  %29 = uitofp i32 %28 to double
  %30 = fcmp ugt double %21, %29
  br i1 %30, label %39, label %31

31:                                               ; preds = %27
  %32 = add nsw i32 %16, 1
  br label %39

33:                                               ; preds = %10
  %34 = fcmp oeq double %25, 5.000000e-01
  br i1 %34, label %35, label %39

35:                                               ; preds = %33
  %36 = icmp eq i32 %23, 0
  %37 = and i32 %23, 1
  %.not = icmp ne i32 %37, 0
  %or.cond.not = or i1 %36, %.not
  %38 = zext i1 %or.cond.not to i32
  %spec.select = add i32 %38, %23
  br label %39

39:                                               ; preds = %35, %33, %27, %31
  %.055 = phi i32 [ %32, %31 ], [ %16, %27 ], [ %16, %33 ], [ %16, %35 ]
  %.053 = phi i32 [ 0, %31 ], [ %28, %27 ], [ %23, %33 ], [ %spec.select, %35 ]
  %40 = fcmp ogt double %.054, 0x41DFFFFFFFC00000
  br i1 %40, label %41, label %55

41:                                               ; preds = %39
  %42 = fneg double %.054
  %43 = select i1 %14, double %0, double %42
  %44 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %11, i64 noundef 256, ptr noundef nonnull @.str.1, double noundef %43) #9
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %.lr.ph92, label %._crit_edge93

.lr.ph92:                                         ; preds = %41, %.lr.ph92
  %46 = phi i32 [ %48, %.lr.ph92 ], [ 256, %41 ]
  %47 = phi ptr [ %50, %.lr.ph92 ], [ %11, %41 ]
  %48 = shl nsw i32 %46, 1
  %49 = sext i32 %48 to i64
  %50 = tail call ptr @realloc(ptr noundef %47, i64 noundef %49) #11
  %51 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %50, i64 noundef %49, ptr noundef nonnull @.str.1, double noundef %43) #9
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %.lr.ph92, label %._crit_edge93, !llvm.loop !13

._crit_edge93:                                    ; preds = %.lr.ph92, %41
  %.lcssa90 = phi ptr [ %11, %41 ], [ %50, %.lr.ph92 ]
  %.0.lcssa = phi i32 [ %44, %41 ], [ %51, %.lr.ph92 ]
  %53 = zext nneg i32 %.0.lcssa to i64
  %54 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef %.lcssa90, i64 noundef %53)
  tail call void @free(ptr noundef %.lcssa90) #9
  br label %109

55:                                               ; preds = %39
  %56 = icmp eq i32 %.062, 0
  br i1 %56, label %57, label %67

57:                                               ; preds = %55
  %58 = sitofp i32 %.055 to double
  %59 = fsub double %.054, %58
  %60 = fcmp ogt double %59, 5.000000e-01
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = add nsw i32 %.055, 1
  br label %.preheader111

63:                                               ; preds = %57
  %64 = fcmp oeq double %59, 5.000000e-01
  %65 = and i32 %.055, 1
  %.not72 = icmp ne i32 %65, 0
  %or.cond76.not = select i1 %64, i1 %.not72, i1 false
  %66 = zext i1 %or.cond76.not to i32
  %spec.select77 = add nsw i32 %.055, %66
  br label %.preheader111

67:                                               ; preds = %55
  %.not69 = icmp eq i32 %.053, 0
  br i1 %.not69, label %.preheader111, label %.preheader81

.preheader81:                                     ; preds = %67
  %68 = urem i32 %.053, 10
  %.not7082 = icmp eq i32 %68, 0
  br i1 %.not7082, label %.lr.ph, label %.preheader80.preheader

.lr.ph:                                           ; preds = %.preheader81, %.lr.ph
  %.184 = phi i32 [ %70, %.lr.ph ], [ %.053, %.preheader81 ]
  %.05983 = phi i32 [ %69, %.lr.ph ], [ %13, %.preheader81 ]
  %69 = add nsw i32 %.05983, -1
  %70 = udiv i32 %.184, 10
  %71 = urem i32 %70, 10
  %.not70 = icmp eq i32 %71, 0
  br i1 %.not70, label %.lr.ph, label %.preheader80.preheader, !llvm.loop !15

.preheader80.preheader:                           ; preds = %.lr.ph, %.preheader81
  %.160.ph = phi i32 [ %13, %.preheader81 ], [ %69, %.lr.ph ]
  %.2.ph = phi i32 [ %.053, %.preheader81 ], [ %70, %.lr.ph ]
  br label %.preheader80

.preheader80:                                     ; preds = %.preheader80.preheader, %.preheader80
  %.160 = phi i32 [ %72, %.preheader80 ], [ %.160.ph, %.preheader80.preheader ]
  %.2 = phi i32 [ %78, %.preheader80 ], [ %.2.ph, %.preheader80.preheader ]
  %72 = add nsw i32 %.160, -1
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %73 = urem i32 %.2, 10
  %74 = trunc nuw nsw i32 %73 to i8
  %75 = or disjoint i8 %74, 48
  %76 = load ptr, ptr %6, align 8, !tbaa !9
  %77 = getelementptr inbounds i8, ptr %76, i64 1
  store ptr %77, ptr %6, align 8, !tbaa !9
  store i8 %75, ptr %76, align 1, !tbaa !16
  %78 = udiv i32 %.2, 10
  %.not71 = icmp ult i32 %.2, 10
  br i1 %.not71, label %.preheader, label %.preheader80, !llvm.loop !17

.preheader:                                       ; preds = %.preheader80
  %79 = icmp sgt i32 %.160, 1
  br i1 %79, label %.lr.ph87, label %._crit_edge

.lr.ph87:                                         ; preds = %.preheader, %.lr.ph87
  %.26186 = phi i32 [ %80, %.lr.ph87 ], [ %72, %.preheader ]
  %80 = add nsw i32 %.26186, -1
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds i8, ptr %81, i64 1
  store ptr %82, ptr %6, align 8, !tbaa !9
  store i8 48, ptr %81, align 1, !tbaa !16
  %83 = icmp ugt i32 %.26186, 1
  br i1 %83, label %.lr.ph87, label %._crit_edge, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph87, %.preheader
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %84 = load ptr, ptr %6, align 8, !tbaa !9
  %85 = getelementptr inbounds i8, ptr %84, i64 1
  store ptr %85, ptr %6, align 8, !tbaa !9
  store i8 46, ptr %84, align 1, !tbaa !16
  br label %.preheader111

.preheader111:                                    ; preds = %63, %67, %._crit_edge, %61
  %.257.ph = phi i32 [ %spec.select77, %63 ], [ %.055, %67 ], [ %.055, %._crit_edge ], [ %62, %61 ]
  br label %86

86:                                               ; preds = %.preheader111, %86
  %.257 = phi i32 [ %92, %86 ], [ %.257.ph, %.preheader111 ]
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %87 = srem i32 %.257, 10
  %88 = trunc nsw i32 %87 to i8
  %89 = add nsw i8 %88, 48
  %90 = load ptr, ptr %6, align 8, !tbaa !9
  %91 = getelementptr inbounds i8, ptr %90, i64 1
  store ptr %91, ptr %6, align 8, !tbaa !9
  store i8 %89, ptr %90, align 1, !tbaa !16
  %92 = sdiv i32 %.257, 10
  %.257.off = add i32 %.257, 9
  %.not73 = icmp ult i32 %.257.off, 19
  br i1 %.not73, label %93, label %86, !llvm.loop !19

93:                                               ; preds = %86
  br i1 %14, label %97, label %94

94:                                               ; preds = %93
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %95 = load ptr, ptr %6, align 8, !tbaa !9
  %96 = getelementptr inbounds i8, ptr %95, i64 1
  store ptr %96, ptr %6, align 8, !tbaa !9
  store i8 45, ptr %95, align 1, !tbaa !16
  br label %97

97:                                               ; preds = %94, %93
  call void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %98 = load ptr, ptr %6, align 8, !tbaa !9
  store i8 0, ptr %98, align 1, !tbaa !16
  %99 = load ptr, ptr %5, align 8, !tbaa !9
  %100 = load ptr, ptr %6, align 8, !tbaa !9
  %101 = getelementptr inbounds i8, ptr %100, i64 -1
  call void @_ZN4ardbL10strreverseEPcS0_(ptr noundef %99, ptr noundef nonnull %101)
  %102 = load ptr, ptr %5, align 8, !tbaa !9
  %103 = load ptr, ptr %6, align 8, !tbaa !9
  %104 = ptrtoint ptr %103 to i64
  %105 = ptrtoint ptr %102 to i64
  %106 = sub i64 %104, %105
  %107 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef %102, i64 noundef %106)
  %108 = load ptr, ptr %5, align 8, !tbaa !9
  call void @free(ptr noundef %108) #9
  br label %109

109:                                              ; preds = %97, %._crit_edge93
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  br label %110

110:                                              ; preds = %109, %8
  ret void
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN4ardbL12ensure_spaceERPcRiS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN4ardbL10strreverseEPcS0_(ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #8

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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #7 = { 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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind allocsize(1) }

!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}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass