; LLVM IR from chdb-io/chdb :: base/glibc-compatibility/musl (log)

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

%struct.log_data = type { double, double, [5 x double], [11 x double], [128 x %struct.anon], [128 x %struct.anon.4] }
%struct.anon = type { double, double }
%struct.anon.4 = type { double, double }
%union.anon = type { double }
%union.anon.0 = type { double }
%union.anon.1 = type { double }
%union.anon.2 = type { double }
%union.anon.3 = type { double }
%union.anon.5 = type { double }
%union.anon.6 = type { double }
%union.anon.7 = type { i64 }

@__log_data = external hidden constant %struct.log_data, align 8

; Function Attrs: nounwind uwtable
define dso_local double @log(double noundef %0) #0 {
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %union.anon, align 8
  %22 = alloca %union.anon.0, align 8
  %23 = alloca %union.anon.1, align 8
  %24 = alloca %union.anon.2, align 8
  %25 = alloca %union.anon.3, align 8
  %26 = alloca i32, align 4
  %27 = alloca double, align 8
  %28 = alloca double, align 8
  %29 = alloca %union.anon.5, align 8
  %30 = alloca %union.anon.6, align 8
  %31 = alloca %union.anon.7, align 8
  store double %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %32 = load double, ptr %3, align 8, !tbaa !5
  store double %32, ptr %21, align 8, !tbaa !9
  %33 = load i64, ptr %21, align 8, !tbaa !9
  store i64 %33, ptr %15, align 8, !tbaa !10
  %34 = load double, ptr %3, align 8, !tbaa !5
  %35 = call i32 @top16(double noundef %34)
  store i32 %35, ptr %18, align 4, !tbaa !12
  %36 = load i64, ptr %15, align 8, !tbaa !10
  store double 9.375000e-01, ptr %22, align 8, !tbaa !9
  %37 = load i64, ptr %22, align 8, !tbaa !9
  %38 = sub i64 %36, %37
  store double 0x3FF1090000000000, ptr %23, align 8, !tbaa !9
  %39 = load i64, ptr %23, align 8, !tbaa !9
  store double 9.375000e-01, ptr %24, align 8, !tbaa !9
  %40 = load i64, ptr %24, align 8, !tbaa !9
  %41 = sub i64 %39, %40
  %42 = icmp ult i64 %38, %41
  %43 = zext i1 %42 to i32
  %44 = sext i32 %43 to i64
  %45 = call i64 @llvm.expect.i64(i64 %44, i64 0)
  %46 = icmp ne i64 %45, 0
  br i1 %46, label %47, label %134

47:                                               ; preds = %1
  %48 = load i64, ptr %15, align 8, !tbaa !10
  store double 1.000000e+00, ptr %25, align 8, !tbaa !9
  %49 = load i64, ptr %25, align 8, !tbaa !9
  %50 = icmp eq i64 %48, %49
  %51 = zext i1 %50 to i32
  %52 = sext i32 %51 to i64
  %53 = call i64 @llvm.expect.i64(i64 %52, i64 0)
  %54 = icmp ne i64 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %47
  store double 0.000000e+00, ptr %2, align 8
  store i32 1, ptr %26, align 4
  br label %254

56:                                               ; preds = %47
  %57 = load double, ptr %3, align 8, !tbaa !5
  %58 = fsub double %57, 1.000000e+00
  store double %58, ptr %6, align 8, !tbaa !5
  %59 = load double, ptr %6, align 8, !tbaa !5
  %60 = load double, ptr %6, align 8, !tbaa !5
  %61 = fmul double %59, %60
  store double %61, ptr %7, align 8, !tbaa !5
  %62 = load double, ptr %6, align 8, !tbaa !5
  %63 = load double, ptr %7, align 8, !tbaa !5
  %64 = fmul double %62, %63
  store double %64, ptr %8, align 8, !tbaa !5
  %65 = load double, ptr %8, align 8, !tbaa !5
  %66 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 1), align 8, !tbaa !5
  %67 = load double, ptr %6, align 8, !tbaa !5
  %68 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 2), align 8, !tbaa !5
  %69 = call double @llvm.fmuladd.f64(double %67, double %68, double %66)
  %70 = load double, ptr %7, align 8, !tbaa !5
  %71 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 3), align 8, !tbaa !5
  %72 = call double @llvm.fmuladd.f64(double %70, double %71, double %69)
  %73 = load double, ptr %8, align 8, !tbaa !5
  %74 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 4), align 8, !tbaa !5
  %75 = load double, ptr %6, align 8, !tbaa !5
  %76 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 5), align 8, !tbaa !5
  %77 = call double @llvm.fmuladd.f64(double %75, double %76, double %74)
  %78 = load double, ptr %7, align 8, !tbaa !5
  %79 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 6), align 8, !tbaa !5
  %80 = call double @llvm.fmuladd.f64(double %78, double %79, double %77)
  %81 = load double, ptr %8, align 8, !tbaa !5
  %82 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 7), align 8, !tbaa !5
  %83 = load double, ptr %6, align 8, !tbaa !5
  %84 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 8), align 8, !tbaa !5
  %85 = call double @llvm.fmuladd.f64(double %83, double %84, double %82)
  %86 = load double, ptr %7, align 8, !tbaa !5
  %87 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 9), align 8, !tbaa !5
  %88 = call double @llvm.fmuladd.f64(double %86, double %87, double %85)
  %89 = load double, ptr %8, align 8, !tbaa !5
  %90 = load double, ptr getelementptr inbounds ([11 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), i64 0, i64 10), align 8, !tbaa !5
  %91 = call double @llvm.fmuladd.f64(double %89, double %90, double %88)
  %92 = call double @llvm.fmuladd.f64(double %81, double %91, double %80)
  %93 = call double @llvm.fmuladd.f64(double %73, double %92, double %72)
  %94 = fmul double %65, %93
  store double %94, ptr %9, align 8, !tbaa !5
  %95 = load double, ptr %6, align 8, !tbaa !5
  %96 = fmul double %95, 0x41A0000000000000
  store double %96, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %97 = load double, ptr %6, align 8, !tbaa !5
  %98 = load double, ptr %4, align 8, !tbaa !5
  %99 = fadd double %97, %98
  %100 = load double, ptr %4, align 8, !tbaa !5
  %101 = fsub double %99, %100
  store double %101, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  %102 = load double, ptr %6, align 8, !tbaa !5
  %103 = load double, ptr %27, align 8, !tbaa !5
  %104 = fsub double %102, %103
  store double %104, ptr %28, align 8, !tbaa !5
  %105 = load double, ptr %27, align 8, !tbaa !5
  %106 = load double, ptr %27, align 8, !tbaa !5
  %107 = fmul double %105, %106
  %108 = load double, ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), align 8, !tbaa !5
  %109 = fmul double %107, %108
  store double %109, ptr %4, align 8, !tbaa !5
  %110 = load double, ptr %6, align 8, !tbaa !5
  %111 = load double, ptr %4, align 8, !tbaa !5
  %112 = fadd double %110, %111
  store double %112, ptr %13, align 8, !tbaa !5
  %113 = load double, ptr %6, align 8, !tbaa !5
  %114 = load double, ptr %13, align 8, !tbaa !5
  %115 = fsub double %113, %114
  %116 = load double, ptr %4, align 8, !tbaa !5
  %117 = fadd double %115, %116
  store double %117, ptr %14, align 8, !tbaa !5
  %118 = load double, ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 3), align 8, !tbaa !5
  %119 = load double, ptr %28, align 8, !tbaa !5
  %120 = fmul double %118, %119
  %121 = load double, ptr %27, align 8, !tbaa !5
  %122 = load double, ptr %6, align 8, !tbaa !5
  %123 = fadd double %121, %122
  %124 = load double, ptr %14, align 8, !tbaa !5
  %125 = call double @llvm.fmuladd.f64(double %120, double %123, double %124)
  store double %125, ptr %14, align 8, !tbaa !5
  %126 = load double, ptr %14, align 8, !tbaa !5
  %127 = load double, ptr %9, align 8, !tbaa !5
  %128 = fadd double %127, %126
  store double %128, ptr %9, align 8, !tbaa !5
  %129 = load double, ptr %13, align 8, !tbaa !5
  %130 = load double, ptr %9, align 8, !tbaa !5
  %131 = fadd double %130, %129
  store double %131, ptr %9, align 8, !tbaa !5
  %132 = load double, ptr %9, align 8, !tbaa !5
  %133 = call double @eval_as_double(double noundef %132)
  store double %133, ptr %2, align 8
  store i32 1, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  br label %254

134:                                              ; preds = %1
  %135 = load i32, ptr %18, align 4, !tbaa !12
  %136 = sub i32 %135, 16
  %137 = icmp uge i32 %136, 32736
  %138 = zext i1 %137 to i32
  %139 = sext i32 %138 to i64
  %140 = call i64 @llvm.expect.i64(i64 %139, i64 0)
  %141 = icmp ne i64 %140, 0
  br i1 %141, label %142, label %171

142:                                              ; preds = %134
  %143 = load i64, ptr %15, align 8, !tbaa !10
  %144 = mul i64 %143, 2
  %145 = icmp eq i64 %144, 0
  br i1 %145, label %146, label %148

146:                                              ; preds = %142
  %147 = call double @__math_divzero(i32 noundef 1)
  store double %147, ptr %2, align 8
  store i32 1, ptr %26, align 4
  br label %254

148:                                              ; preds = %142
  %149 = load i64, ptr %15, align 8, !tbaa !10
  store double 0x7FF0000000000000, ptr %29, align 8, !tbaa !9
  %150 = load i64, ptr %29, align 8, !tbaa !9
  %151 = icmp eq i64 %149, %150
  br i1 %151, label %152, label %154

152:                                              ; preds = %148
  %153 = load double, ptr %3, align 8, !tbaa !5
  store double %153, ptr %2, align 8
  store i32 1, ptr %26, align 4
  br label %254

154:                                              ; preds = %148
  %155 = load i32, ptr %18, align 4, !tbaa !12
  %156 = and i32 %155, 32768
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %162, label %158

158:                                              ; preds = %154
  %159 = load i32, ptr %18, align 4, !tbaa !12
  %160 = and i32 %159, 32752
  %161 = icmp eq i32 %160, 32752
  br i1 %161, label %162, label %165

162:                                              ; preds = %158, %154
  %163 = load double, ptr %3, align 8, !tbaa !5
  %164 = call double @__math_invalid(double noundef %163)
  store double %164, ptr %2, align 8
  store i32 1, ptr %26, align 4
  br label %254

165:                                              ; preds = %158
  %166 = load double, ptr %3, align 8, !tbaa !5
  %167 = fmul double %166, 0x4330000000000000
  store double %167, ptr %30, align 8, !tbaa !9
  %168 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %168, ptr %15, align 8, !tbaa !10
  %169 = load i64, ptr %15, align 8, !tbaa !10
  %170 = sub i64 %169, 234187180623265792
  store i64 %170, ptr %15, align 8, !tbaa !10
  br label %171

171:                                              ; preds = %165, %134
  %172 = load i64, ptr %15, align 8, !tbaa !10
  %173 = sub i64 %172, 4604367669032910848
  store i64 %173, ptr %17, align 8, !tbaa !10
  %174 = load i64, ptr %17, align 8, !tbaa !10
  %175 = lshr i64 %174, 45
  %176 = urem i64 %175, 128
  %177 = trunc i64 %176 to i32
  store i32 %177, ptr %20, align 4, !tbaa !12
  %178 = load i64, ptr %17, align 8, !tbaa !10
  %179 = ashr i64 %178, 52
  %180 = trunc i64 %179 to i32
  store i32 %180, ptr %19, align 4, !tbaa !12
  %181 = load i64, ptr %15, align 8, !tbaa !10
  %182 = load i64, ptr %17, align 8, !tbaa !10
  %183 = and i64 %182, -4503599627370496
  %184 = sub i64 %181, %183
  store i64 %184, ptr %16, align 8, !tbaa !10
  %185 = load i32, ptr %20, align 4, !tbaa !12
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [128 x %struct.anon], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 4), i64 0, i64 %186
  %188 = getelementptr inbounds %struct.anon, ptr %187, i32 0, i32 0
  %189 = load double, ptr %188, align 8, !tbaa !14
  store double %189, ptr %10, align 8, !tbaa !5
  %190 = load i32, ptr %20, align 4, !tbaa !12
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [128 x %struct.anon], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 4), i64 0, i64 %191
  %193 = getelementptr inbounds %struct.anon, ptr %192, i32 0, i32 1
  %194 = load double, ptr %193, align 8, !tbaa !16
  store double %194, ptr %11, align 8, !tbaa !5
  %195 = load i64, ptr %16, align 8, !tbaa !10
  store i64 %195, ptr %31, align 8, !tbaa !9
  %196 = load double, ptr %31, align 8, !tbaa !9
  store double %196, ptr %5, align 8, !tbaa !5
  %197 = load double, ptr %5, align 8, !tbaa !5
  %198 = load i32, ptr %20, align 4, !tbaa !12
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [128 x %struct.anon.4], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 5), i64 0, i64 %199
  %201 = getelementptr inbounds %struct.anon.4, ptr %200, i32 0, i32 0
  %202 = load double, ptr %201, align 8, !tbaa !14
  %203 = fsub double %197, %202
  %204 = load i32, ptr %20, align 4, !tbaa !12
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [128 x %struct.anon.4], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 5), i64 0, i64 %205
  %207 = getelementptr inbounds %struct.anon.4, ptr %206, i32 0, i32 1
  %208 = load double, ptr %207, align 8, !tbaa !16
  %209 = fsub double %203, %208
  %210 = load double, ptr %10, align 8, !tbaa !5
  %211 = fmul double %209, %210
  store double %211, ptr %6, align 8, !tbaa !5
  %212 = load i32, ptr %19, align 4, !tbaa !12
  %213 = sitofp i32 %212 to double
  store double %213, ptr %12, align 8, !tbaa !5
  %214 = load double, ptr %12, align 8, !tbaa !5
  %215 = load double, ptr @__log_data, align 8, !tbaa !17
  %216 = load double, ptr %11, align 8, !tbaa !5
  %217 = call double @llvm.fmuladd.f64(double %214, double %215, double %216)
  store double %217, ptr %4, align 8, !tbaa !5
  %218 = load double, ptr %4, align 8, !tbaa !5
  %219 = load double, ptr %6, align 8, !tbaa !5
  %220 = fadd double %218, %219
  store double %220, ptr %13, align 8, !tbaa !5
  %221 = load double, ptr %4, align 8, !tbaa !5
  %222 = load double, ptr %13, align 8, !tbaa !5
  %223 = fsub double %221, %222
  %224 = load double, ptr %6, align 8, !tbaa !5
  %225 = fadd double %223, %224
  %226 = load double, ptr %12, align 8, !tbaa !5
  %227 = load double, ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 1), align 8, !tbaa !19
  %228 = call double @llvm.fmuladd.f64(double %226, double %227, double %225)
  store double %228, ptr %14, align 8, !tbaa !5
  %229 = load double, ptr %6, align 8, !tbaa !5
  %230 = load double, ptr %6, align 8, !tbaa !5
  %231 = fmul double %229, %230
  store double %231, ptr %7, align 8, !tbaa !5
  %232 = load double, ptr %14, align 8, !tbaa !5
  %233 = load double, ptr %7, align 8, !tbaa !5
  %234 = load double, ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 2), align 8, !tbaa !5
  %235 = call double @llvm.fmuladd.f64(double %233, double %234, double %232)
  %236 = load double, ptr %6, align 8, !tbaa !5
  %237 = load double, ptr %7, align 8, !tbaa !5
  %238 = fmul double %236, %237
  %239 = load double, ptr getelementptr inbounds ([5 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 2), i64 0, i64 1), align 8, !tbaa !5
  %240 = load double, ptr %6, align 8, !tbaa !5
  %241 = load double, ptr getelementptr inbounds ([5 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 2), i64 0, i64 2), align 8, !tbaa !5
  %242 = call double @llvm.fmuladd.f64(double %240, double %241, double %239)
  %243 = load double, ptr %7, align 8, !tbaa !5
  %244 = load double, ptr getelementptr inbounds ([5 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 2), i64 0, i64 3), align 8, !tbaa !5
  %245 = load double, ptr %6, align 8, !tbaa !5
  %246 = load double, ptr getelementptr inbounds ([5 x double], ptr getelementptr inbounds (%struct.log_data, ptr @__log_data, i32 0, i32 2), i64 0, i64 4), align 8, !tbaa !5
  %247 = call double @llvm.fmuladd.f64(double %245, double %246, double %244)
  %248 = call double @llvm.fmuladd.f64(double %243, double %247, double %242)
  %249 = call double @llvm.fmuladd.f64(double %238, double %248, double %235)
  %250 = load double, ptr %13, align 8, !tbaa !5
  %251 = fadd double %249, %250
  store double %251, ptr %9, align 8, !tbaa !5
  %252 = load double, ptr %9, align 8, !tbaa !5
  %253 = call double @eval_as_double(double noundef %252)
  store double %253, ptr %2, align 8
  store i32 1, ptr %26, align 4
  br label %254

254:                                              ; preds = %171, %162, %152, %146, %56, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %255 = load double, ptr %2, align 8
  ret double %255
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @top16(double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @eval_as_double(double noundef) #2

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

declare hidden double @__math_divzero(i32 noundef) #5

declare hidden double @__math_invalid(double noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { "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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"", !6, i64 0, !6, i64 8}
!16 = !{!15, !6, i64 8}
!17 = !{!18, !6, i64 0}
!18 = !{!"log_data", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 56, !7, i64 144, !7, i64 2192}
!19 = !{!18, !6, i64 8}


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

%struct.log_data = type { double, double, [5 x double], [11 x double], [128 x %struct.anon], [128 x %struct.anon.4] }
%struct.anon = type { double, double }
%struct.anon.4 = type { double, double }

@__log_data = external hidden local_unnamed_addr constant %struct.log_data, align 8

; Function Attrs: nounwind uwtable
define dso_local double @log(double noundef %0) local_unnamed_addr #0 {
  %2 = bitcast double %0 to i64
  %3 = tail call i32 @top16(double noundef %0)
  %4 = add i64 %2, -4606619468846596096
  %5 = icmp ult i64 %4, 854320534781952
  br i1 %5, label %6, label %48, !prof !5

6:                                                ; preds = %1
  %7 = icmp eq i64 %2, 4607182418800017408
  br i1 %7, label %109, label %8, !prof !5

8:                                                ; preds = %6
  %9 = fadd double %0, -1.000000e+00
  %10 = fmul double %9, %9
  %11 = fmul double %9, %10
  %12 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 64), align 8, !tbaa !6
  %13 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 72), align 8, !tbaa !6
  %14 = tail call double @llvm.fmuladd.f64(double %9, double %13, double %12)
  %15 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 80), align 8, !tbaa !6
  %16 = tail call double @llvm.fmuladd.f64(double %10, double %15, double %14)
  %17 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 88), align 8, !tbaa !6
  %18 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 96), align 8, !tbaa !6
  %19 = tail call double @llvm.fmuladd.f64(double %9, double %18, double %17)
  %20 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 104), align 8, !tbaa !6
  %21 = tail call double @llvm.fmuladd.f64(double %10, double %20, double %19)
  %22 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 112), align 8, !tbaa !6
  %23 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 120), align 8, !tbaa !6
  %24 = tail call double @llvm.fmuladd.f64(double %9, double %23, double %22)
  %25 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 128), align 8, !tbaa !6
  %26 = tail call double @llvm.fmuladd.f64(double %10, double %25, double %24)
  %27 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 136), align 8, !tbaa !6
  %28 = tail call double @llvm.fmuladd.f64(double %11, double %27, double %26)
  %29 = tail call double @llvm.fmuladd.f64(double %11, double %28, double %21)
  %30 = tail call double @llvm.fmuladd.f64(double %11, double %29, double %16)
  %31 = fmul double %11, %30
  %32 = fmul double %9, 0x41A0000000000000
  %33 = fadd double %9, %32
  %34 = fsub double %33, %32
  %35 = fsub double %9, %34
  %36 = fmul double %34, %34
  %37 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 56), align 8, !tbaa !6
  %38 = fmul double %36, %37
  %39 = fadd double %9, %38
  %40 = fsub double %9, %39
  %41 = fadd double %38, %40
  %42 = fmul double %35, %37
  %43 = fadd double %9, %34
  %44 = tail call double @llvm.fmuladd.f64(double %42, double %43, double %41)
  %45 = fadd double %31, %44
  %46 = fadd double %39, %45
  %47 = tail call double @eval_as_double(double noundef %46)
  br label %109

48:                                               ; preds = %1
  %49 = add i32 %3, -32752
  %50 = icmp ult i32 %49, -32736
  br i1 %50, label %51, label %67, !prof !5

51:                                               ; preds = %48
  %52 = fcmp oeq double %0, 0.000000e+00
  br i1 %52, label %53, label %55

53:                                               ; preds = %51
  %54 = tail call double @__math_divzero(i32 noundef 1) #4
  br label %109

55:                                               ; preds = %51
  %56 = icmp eq i64 %2, 9218868437227405312
  br i1 %56, label %109, label %57

57:                                               ; preds = %55
  %58 = and i32 %3, 32768
  %.not = icmp ne i32 %58, 0
  %59 = and i32 %3, 32752
  %60 = icmp eq i32 %59, 32752
  %or.cond = or i1 %.not, %60
  br i1 %or.cond, label %61, label %63

61:                                               ; preds = %57
  %62 = tail call double @__math_invalid(double noundef %0) #4
  br label %109

63:                                               ; preds = %57
  %64 = fmul double %0, 0x4330000000000000
  %65 = bitcast double %64 to i64
  %66 = add i64 %65, -234187180623265792
  br label %67

67:                                               ; preds = %63, %48
  %.089 = phi i64 [ %66, %63 ], [ %2, %48 ]
  %68 = add i64 %.089, -4604367669032910848
  %69 = lshr i64 %68, 45
  %70 = and i64 %69, 127
  %71 = ashr i64 %68, 52
  %72 = trunc nsw i64 %71 to i32
  %73 = and i64 %68, -4503599627370496
  %74 = sub i64 %.089, %73
  %75 = getelementptr inbounds [128 x %struct.anon], ptr getelementptr inbounds (i8, ptr @__log_data, i64 144), i64 0, i64 %70
  %76 = load double, ptr %75, align 8, !tbaa !10
  %77 = getelementptr inbounds i8, ptr %75, i64 8
  %78 = load double, ptr %77, align 8, !tbaa !12
  %79 = bitcast i64 %74 to double
  %80 = getelementptr inbounds [128 x %struct.anon.4], ptr getelementptr inbounds (i8, ptr @__log_data, i64 2192), i64 0, i64 %70
  %81 = load double, ptr %80, align 8, !tbaa !10
  %82 = fsub double %79, %81
  %83 = getelementptr inbounds i8, ptr %80, i64 8
  %84 = load double, ptr %83, align 8, !tbaa !12
  %85 = fsub double %82, %84
  %86 = fmul double %76, %85
  %87 = sitofp i32 %72 to double
  %88 = load double, ptr @__log_data, align 8, !tbaa !13
  %89 = tail call double @llvm.fmuladd.f64(double %87, double %88, double %78)
  %90 = fadd double %89, %86
  %91 = fsub double %89, %90
  %92 = fadd double %86, %91
  %93 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 8), align 8, !tbaa !15
  %94 = tail call double @llvm.fmuladd.f64(double %87, double %93, double %92)
  %95 = fmul double %86, %86
  %96 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 16), align 8, !tbaa !6
  %97 = tail call double @llvm.fmuladd.f64(double %95, double %96, double %94)
  %98 = fmul double %86, %95
  %99 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 24), align 8, !tbaa !6
  %100 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 32), align 8, !tbaa !6
  %101 = tail call double @llvm.fmuladd.f64(double %86, double %100, double %99)
  %102 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 40), align 8, !tbaa !6
  %103 = load double, ptr getelementptr inbounds (i8, ptr @__log_data, i64 48), align 8, !tbaa !6
  %104 = tail call double @llvm.fmuladd.f64(double %86, double %103, double %102)
  %105 = tail call double @llvm.fmuladd.f64(double %95, double %104, double %101)
  %106 = tail call double @llvm.fmuladd.f64(double %98, double %105, double %97)
  %107 = fadd double %90, %106
  %108 = tail call double @eval_as_double(double noundef %107)
  br label %109

109:                                              ; preds = %55, %6, %67, %61, %53, %8
  %.0 = phi double [ %47, %8 ], [ %54, %53 ], [ %62, %61 ], [ %108, %67 ], [ 0.000000e+00, %6 ], [ %0, %55 ]
  ret double %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @top16(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @eval_as_double(double noundef) local_unnamed_addr #1

declare hidden double @__math_divzero(i32 noundef) local_unnamed_addr #3

declare hidden double @__math_invalid(double noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !7, i64 0}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 8}
!12 = !{!11, !7, i64 8}
!13 = !{!14, !7, i64 0}
!14 = !{!"log_data", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 56, !8, i64 144, !8, i64 2192}
!15 = !{!14, !7, i64 8}


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