; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/Netlib/src/netlib/slatec (dgamma)

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

@dgamma_.gamcs = external hidden global [42 x double], align 16
@dgamma_.pi = external hidden global double, align 8
@dgamma_.sq2pil = external hidden global double, align 8
@c__3 = external hidden global i64, align 8
@c__42 = external hidden global i64, align 8
@c__4 = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@c__2 = external hidden global i64, align 8
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@c__1 = external hidden global i64, align 8
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local double @dgamma_(ptr noundef %0) #0 {
  %2 = alloca double, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca float, align 4
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca double, align 8
  %12 = alloca i64, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %18 = call double @d1mach_(ptr noundef @c__3)
  %19 = fptrunc double %18 to float
  %20 = fmul float %19, 0x3FB99999A0000000
  store float %20, ptr %5, align 4, !tbaa !9
  %21 = call i64 @initds_(ptr noundef @dgamma_.gamcs, ptr noundef @c__42, ptr noundef %5)
  store i64 %21, ptr %12, align 8, !tbaa !11
  %22 = call i32 @dgamlm_(ptr noundef %13, ptr noundef %14)
  %23 = call double @d1mach_(ptr noundef @c__4)
  %24 = call double @sqrt(double noundef %23) #5
  store double %24, ptr %15, align 8, !tbaa !13
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load double, ptr %25, align 8, !tbaa !13
  %27 = fcmp oge double %26, 0.000000e+00
  br i1 %27, label %28, label %31

28:                                               ; preds = %1
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = load double, ptr %29, align 8, !tbaa !13
  br label %35

31:                                               ; preds = %1
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load double, ptr %32, align 8, !tbaa !13
  %34 = fneg double %33
  br label %35

35:                                               ; preds = %31, %28
  %36 = phi double [ %30, %28 ], [ %34, %31 ]
  store double %36, ptr %11, align 8, !tbaa !13
  %37 = load double, ptr %11, align 8, !tbaa !13
  %38 = fcmp ogt double %37, 1.000000e+01
  br i1 %38, label %39, label %40

39:                                               ; preds = %35
  br label %158

40:                                               ; preds = %35
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = load double, ptr %41, align 8, !tbaa !13
  %43 = fptosi double %42 to i64
  store i64 %43, ptr %10, align 8, !tbaa !11
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load double, ptr %44, align 8, !tbaa !13
  %46 = fcmp olt double %45, 0.000000e+00
  br i1 %46, label %47, label %50

47:                                               ; preds = %40
  %48 = load i64, ptr %10, align 8, !tbaa !11
  %49 = add nsw i64 %48, -1
  store i64 %49, ptr %10, align 8, !tbaa !11
  br label %50

50:                                               ; preds = %47, %40
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = load double, ptr %51, align 8, !tbaa !13
  %53 = load i64, ptr %10, align 8, !tbaa !11
  %54 = sitofp i64 %53 to double
  %55 = fsub double %52, %54
  store double %55, ptr %11, align 8, !tbaa !13
  %56 = load i64, ptr %10, align 8, !tbaa !11
  %57 = add nsw i64 %56, -1
  store i64 %57, ptr %10, align 8, !tbaa !11
  %58 = load double, ptr %11, align 8, !tbaa !13
  %59 = call double @llvm.fmuladd.f64(double %58, double 2.000000e+00, double -1.000000e+00)
  store double %59, ptr %7, align 8, !tbaa !13
  %60 = call double @dcsevl_(ptr noundef %7, ptr noundef @dgamma_.gamcs, ptr noundef %12)
  %61 = fadd double %60, 9.375000e-01
  store double %61, ptr %6, align 8, !tbaa !13
  %62 = load i64, ptr %10, align 8, !tbaa !11
  %63 = icmp eq i64 %62, 0
  br i1 %63, label %64, label %66

64:                                               ; preds = %50
  %65 = load double, ptr %6, align 8, !tbaa !13
  store double %65, ptr %2, align 8
  store i32 1, ptr %17, align 4
  br label %240

66:                                               ; preds = %50
  %67 = load i64, ptr %10, align 8, !tbaa !11
  %68 = icmp sgt i64 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %66
  br label %140

70:                                               ; preds = %66
  %71 = load i64, ptr %10, align 8, !tbaa !11
  %72 = sub nsw i64 0, %71
  store i64 %72, ptr %10, align 8, !tbaa !11
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = load double, ptr %73, align 8, !tbaa !13
  %75 = fcmp oeq double %74, 0.000000e+00
  br i1 %75, label %76, label %78

76:                                               ; preds = %70
  %77 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, ptr noundef @c__4, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 6)
  br label %78

78:                                               ; preds = %76, %70
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = load double, ptr %79, align 8, !tbaa !13
  %81 = fcmp olt double %80, 0.000000e+00
  br i1 %81, label %82, label %92

82:                                               ; preds = %78
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = load double, ptr %83, align 8, !tbaa !13
  %85 = load i64, ptr %10, align 8, !tbaa !11
  %86 = sitofp i64 %85 to double
  %87 = fadd double %84, %86
  %88 = fsub double %87, 2.000000e+00
  %89 = fcmp oeq double %88, 0.000000e+00
  br i1 %89, label %90, label %92

90:                                               ; preds = %82
  %91 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.3, ptr noundef @c__4, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 23)
  br label %92

92:                                               ; preds = %90, %82, %78
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = load double, ptr %93, align 8, !tbaa !13
  %95 = fsub double %94, 5.000000e-01
  store double %95, ptr %8, align 8, !tbaa !13
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = load double, ptr %96, align 8, !tbaa !13
  %98 = fcmp olt double %97, -5.000000e-01
  br i1 %98, label %99, label %120

99:                                               ; preds = %92
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = load double, ptr %100, align 8, !tbaa !13
  %102 = call double @d_int(ptr noundef %8)
  %103 = fsub double %101, %102
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = load double, ptr %104, align 8, !tbaa !13
  %106 = fdiv double %103, %105
  store double %106, ptr %7, align 8, !tbaa !13
  %107 = load double, ptr %7, align 8, !tbaa !13
  %108 = fcmp oge double %107, 0.000000e+00
  br i1 %108, label %109, label %111

109:                                              ; preds = %99
  %110 = load double, ptr %7, align 8, !tbaa !13
  br label %114

111:                                              ; preds = %99
  %112 = load double, ptr %7, align 8, !tbaa !13
  %113 = fneg double %112
  br label %114

114:                                              ; preds = %111, %109
  %115 = phi double [ %110, %109 ], [ %113, %111 ]
  %116 = load double, ptr %15, align 8, !tbaa !13
  %117 = fcmp olt double %115, %116
  br i1 %117, label %118, label %120

118:                                              ; preds = %114
  %119 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.4, ptr noundef @c__1, ptr noundef @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 60)
  br label %120

120:                                              ; preds = %118, %114, %92
  %121 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %121, ptr %4, align 8, !tbaa !11
  store i64 1, ptr %9, align 8, !tbaa !11
  br label %122

122:                                              ; preds = %135, %120
  %123 = load i64, ptr %9, align 8, !tbaa !11
  %124 = load i64, ptr %4, align 8, !tbaa !11
  %125 = icmp sle i64 %123, %124
  br i1 %125, label %126, label %138

126:                                              ; preds = %122
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = load double, ptr %127, align 8, !tbaa !13
  %129 = load i64, ptr %9, align 8, !tbaa !11
  %130 = sitofp i64 %129 to double
  %131 = fadd double %128, %130
  %132 = fsub double %131, 1.000000e+00
  %133 = load double, ptr %6, align 8, !tbaa !13
  %134 = fdiv double %133, %132
  store double %134, ptr %6, align 8, !tbaa !13
  br label %135

135:                                              ; preds = %126
  %136 = load i64, ptr %9, align 8, !tbaa !11
  %137 = add nsw i64 %136, 1
  store i64 %137, ptr %9, align 8, !tbaa !11
  br label %122, !llvm.loop !15

138:                                              ; preds = %122
  %139 = load double, ptr %6, align 8, !tbaa !13
  store double %139, ptr %2, align 8
  store i32 1, ptr %17, align 4
  br label %240

140:                                              ; preds = %69
  %141 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %141, ptr %4, align 8, !tbaa !11
  store i64 1, ptr %9, align 8, !tbaa !11
  br label %142

142:                                              ; preds = %153, %140
  %143 = load i64, ptr %9, align 8, !tbaa !11
  %144 = load i64, ptr %4, align 8, !tbaa !11
  %145 = icmp sle i64 %143, %144
  br i1 %145, label %146, label %156

146:                                              ; preds = %142
  %147 = load double, ptr %11, align 8, !tbaa !13
  %148 = load i64, ptr %9, align 8, !tbaa !11
  %149 = sitofp i64 %148 to double
  %150 = fadd double %147, %149
  %151 = load double, ptr %6, align 8, !tbaa !13
  %152 = fmul double %150, %151
  store double %152, ptr %6, align 8, !tbaa !13
  br label %153

153:                                              ; preds = %146
  %154 = load i64, ptr %9, align 8, !tbaa !11
  %155 = add nsw i64 %154, 1
  store i64 %155, ptr %9, align 8, !tbaa !11
  br label %142, !llvm.loop !17

156:                                              ; preds = %142
  %157 = load double, ptr %6, align 8, !tbaa !13
  store double %157, ptr %2, align 8
  store i32 1, ptr %17, align 4
  br label %240

158:                                              ; preds = %39
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  %160 = load double, ptr %159, align 8, !tbaa !13
  %161 = load double, ptr %14, align 8, !tbaa !13
  %162 = fcmp ogt double %160, %161
  br i1 %162, label %163, label %165

163:                                              ; preds = %158
  %164 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.5, ptr noundef @c__3, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 24)
  br label %165

165:                                              ; preds = %163, %158
  store double 0.000000e+00, ptr %6, align 8, !tbaa !13
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = load double, ptr %166, align 8, !tbaa !13
  %168 = load double, ptr %13, align 8, !tbaa !13
  %169 = fcmp olt double %167, %168
  br i1 %169, label %170, label %172

170:                                              ; preds = %165
  %171 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.6, ptr noundef @c__2, ptr noundef @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 27)
  br label %172

172:                                              ; preds = %170, %165
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = load double, ptr %173, align 8, !tbaa !13
  %175 = load double, ptr %13, align 8, !tbaa !13
  %176 = fcmp olt double %174, %175
  br i1 %176, label %177, label %179

177:                                              ; preds = %172
  %178 = load double, ptr %6, align 8, !tbaa !13
  store double %178, ptr %2, align 8
  store i32 1, ptr %17, align 4
  br label %240

179:                                              ; preds = %172
  %180 = load double, ptr %11, align 8, !tbaa !13
  %181 = fsub double %180, 5.000000e-01
  %182 = load double, ptr %11, align 8, !tbaa !13
  %183 = call double @log(double noundef %182) #5
  %184 = load double, ptr %11, align 8, !tbaa !13
  %185 = fneg double %184
  %186 = call double @llvm.fmuladd.f64(double %181, double %183, double %185)
  %187 = load double, ptr @dgamma_.sq2pil, align 8, !tbaa !13
  %188 = fadd double %186, %187
  %189 = call double @d9lgmc_(ptr noundef %11)
  %190 = fadd double %188, %189
  %191 = call double @exp(double noundef %190) #5
  store double %191, ptr %6, align 8, !tbaa !13
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = load double, ptr %192, align 8, !tbaa !13
  %194 = fcmp ogt double %193, 0.000000e+00
  br i1 %194, label %195, label %197

195:                                              ; preds = %179
  %196 = load double, ptr %6, align 8, !tbaa !13
  store double %196, ptr %2, align 8
  store i32 1, ptr %17, align 4
  br label %240

197:                                              ; preds = %179
  %198 = load ptr, ptr %3, align 8, !tbaa !5
  %199 = load double, ptr %198, align 8, !tbaa !13
  %200 = fsub double %199, 5.000000e-01
  store double %200, ptr %8, align 8, !tbaa !13
  %201 = load ptr, ptr %3, align 8, !tbaa !5
  %202 = load double, ptr %201, align 8, !tbaa !13
  %203 = call double @d_int(ptr noundef %8)
  %204 = fsub double %202, %203
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  %206 = load double, ptr %205, align 8, !tbaa !13
  %207 = fdiv double %204, %206
  store double %207, ptr %7, align 8, !tbaa !13
  %208 = load double, ptr %7, align 8, !tbaa !13
  %209 = fcmp oge double %208, 0.000000e+00
  br i1 %209, label %210, label %212

210:                                              ; preds = %197
  %211 = load double, ptr %7, align 8, !tbaa !13
  br label %215

212:                                              ; preds = %197
  %213 = load double, ptr %7, align 8, !tbaa !13
  %214 = fneg double %213
  br label %215

215:                                              ; preds = %212, %210
  %216 = phi double [ %211, %210 ], [ %214, %212 ]
  %217 = load double, ptr %15, align 8, !tbaa !13
  %218 = fcmp olt double %216, %217
  br i1 %218, label %219, label %221

219:                                              ; preds = %215
  %220 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.7, ptr noundef @c__1, ptr noundef @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 53)
  br label %221

221:                                              ; preds = %219, %215
  %222 = load double, ptr @dgamma_.pi, align 8, !tbaa !13
  %223 = load double, ptr %11, align 8, !tbaa !13
  %224 = fmul double %222, %223
  %225 = call double @sin(double noundef %224) #5
  store double %225, ptr %16, align 8, !tbaa !13
  %226 = load double, ptr %16, align 8, !tbaa !13
  %227 = fcmp oeq double %226, 0.000000e+00
  br i1 %227, label %228, label %230

228:                                              ; preds = %221
  %229 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.3, ptr noundef @c__4, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 23)
  br label %230

230:                                              ; preds = %228, %221
  %231 = load double, ptr @dgamma_.pi, align 8, !tbaa !13
  %232 = fneg double %231
  %233 = load double, ptr %11, align 8, !tbaa !13
  %234 = load double, ptr %16, align 8, !tbaa !13
  %235 = fmul double %233, %234
  %236 = load double, ptr %6, align 8, !tbaa !13
  %237 = fmul double %235, %236
  %238 = fdiv double %232, %237
  store double %238, ptr %6, align 8, !tbaa !13
  %239 = load double, ptr %6, align 8, !tbaa !13
  store double %239, ptr %2, align 8
  store i32 1, ptr %17, align 4
  br label %240

240:                                              ; preds = %230, %195, %177, %156, %138, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %241 = load double, ptr %2, align 8
  ret double %241
}

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

declare double @d1mach_(ptr noundef) #2

declare i64 @initds_(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @dgamlm_(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

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

declare double @dcsevl_(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @xermsg_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef) #2

declare double @d_int(ptr noundef) #2

; Function Attrs: nounwind
declare double @exp(double noundef) #3

; Function Attrs: nounwind
declare double @log(double noundef) #3

declare double @d9lgmc_(ptr noundef) #2

; Function Attrs: nounwind
declare double @sin(double noundef) #3

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

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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@dgamma_.gamcs = external hidden global [42 x double], align 16
@dgamma_.pi = external hidden local_unnamed_addr global double, align 8
@dgamma_.sq2pil = external hidden local_unnamed_addr global double, align 8
@c__3 = external hidden global i64, align 8
@c__42 = external hidden global i64, align 8
@c__4 = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@c__2 = external hidden global i64, align 8
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@c__1 = external hidden global i64, align 8
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local double @dgamma_(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca float, align 4
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca i64, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %9 = tail call double @d1mach_(ptr noundef nonnull @c__3) #6
  %10 = fptrunc double %9 to float
  %11 = fmul float %10, 0x3FB99999A0000000
  store float %11, ptr %2, align 4, !tbaa !5
  %12 = call i64 @initds_(ptr noundef nonnull @dgamma_.gamcs, ptr noundef nonnull @c__42, ptr noundef nonnull %2) #6
  store i64 %12, ptr %6, align 8, !tbaa !9
  %13 = call i32 @dgamlm_(ptr noundef nonnull %7, ptr noundef nonnull %8) #6
  %14 = call double @d1mach_(ptr noundef nonnull @c__4) #6
  %15 = call double @sqrt(double noundef %14) #6
  %16 = load double, ptr %0, align 8, !tbaa !11
  %17 = fcmp ult double %16, 0.000000e+00
  %18 = fneg double %16
  %19 = select i1 %17, double %18, double %16
  store double %19, ptr %5, align 8, !tbaa !11
  %20 = fcmp ogt double %19, 1.000000e+01
  br i1 %20, label %107, label %21

21:                                               ; preds = %1
  %22 = fptosi double %16 to i64
  %23 = fcmp olt double %16, 0.000000e+00
  %24 = sext i1 %23 to i64
  %.051 = add i64 %24, %22
  %25 = sitofp i64 %.051 to double
  %26 = fsub double %16, %25
  %27 = call double @llvm.fmuladd.f64(double %26, double 2.000000e+00, double -1.000000e+00)
  store double %27, ptr %3, align 8, !tbaa !11
  %28 = call double @dcsevl_(ptr noundef nonnull %3, ptr noundef nonnull @dgamma_.gamcs, ptr noundef nonnull %6) #6
  %29 = fadd double %28, 9.375000e-01
  %30 = icmp eq i64 %.051, 1
  br i1 %30, label %.loopexit, label %31

31:                                               ; preds = %21
  %32 = icmp sgt i64 %.051, 1
  br i1 %32, label %.preheader.preheader, label %37

.preheader.preheader:                             ; preds = %31
  %33 = add i64 %22, %24
  %34 = add i64 %33, -1
  %35 = add i64 %33, -2
  %xtraiter81 = and i64 %34, 3
  %36 = icmp ult i64 %35, 3
  br i1 %36, label %.loopexit.loopexit.unr-lcssa, label %.preheader.preheader.new

.preheader.preheader.new:                         ; preds = %.preheader.preheader
  %unroll_iter85 = and i64 %34, -4
  br label %.preheader

37:                                               ; preds = %31
  %38 = sub i64 1, %.051
  %39 = load double, ptr %0, align 8, !tbaa !11
  %40 = fcmp oeq double %39, 0.000000e+00
  br i1 %40, label %41, label %43

41:                                               ; preds = %37
  %42 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, ptr noundef nonnull @c__4, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 6) #6
  %.pr = load double, ptr %0, align 8, !tbaa !11
  br label %43

43:                                               ; preds = %41, %37
  %44 = phi double [ %.pr, %41 ], [ %39, %37 ]
  %45 = fcmp olt double %44, 0.000000e+00
  br i1 %45, label %46, label %53

46:                                               ; preds = %43
  %47 = uitofp nneg i64 %38 to double
  %48 = fadd double %44, %47
  %49 = fadd double %48, -2.000000e+00
  %50 = fcmp oeq double %49, 0.000000e+00
  br i1 %50, label %51, label %53

51:                                               ; preds = %46
  %52 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.3, ptr noundef nonnull @c__4, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 23) #6
  %.pre = load double, ptr %0, align 8, !tbaa !11
  br label %53

53:                                               ; preds = %51, %46, %43
  %54 = phi double [ %.pre, %51 ], [ %44, %46 ], [ %44, %43 ]
  %55 = fadd double %54, -5.000000e-01
  store double %55, ptr %4, align 8, !tbaa !11
  %56 = fcmp olt double %54, -5.000000e-01
  br i1 %56, label %57, label %.lr.ph

57:                                               ; preds = %53
  %58 = call double @d_int(ptr noundef nonnull %4) #6
  %59 = fsub double %54, %58
  %60 = load double, ptr %0, align 8, !tbaa !11
  %61 = fdiv double %59, %60
  store double %61, ptr %3, align 8, !tbaa !11
  %62 = fcmp oge double %61, 0.000000e+00
  %63 = fneg double %61
  %64 = select i1 %62, double %61, double %63
  %65 = fcmp olt double %64, %15
  br i1 %65, label %66, label %.lr.ph

66:                                               ; preds = %57
  %67 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.4, ptr noundef nonnull @c__1, ptr noundef nonnull @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 60) #6
  br label %.lr.ph

.lr.ph:                                           ; preds = %53, %57, %66
  %68 = load double, ptr %0, align 8, !tbaa !11
  %smax = call i64 @llvm.smax.i64(i64 %38, i64 1)
  %xtraiter = and i64 %smax, 3
  %69 = icmp slt i64 %38, 4
  br i1 %69, label %.loopexit.loopexit78.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %smax, 9223372036854775804
  br label %70

70:                                               ; preds = %70, %.lr.ph.new
  %.05265 = phi i64 [ 1, %.lr.ph.new ], [ %90, %70 ]
  %.05364 = phi double [ %29, %.lr.ph.new ], [ %89, %70 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %70 ]
  %71 = uitofp nneg i64 %.05265 to double
  %72 = fadd double %68, %71
  %73 = fadd double %72, -1.000000e+00
  %74 = fdiv double %.05364, %73
  %75 = add nuw nsw i64 %.05265, 1
  %76 = uitofp nneg i64 %75 to double
  %77 = fadd double %68, %76
  %78 = fadd double %77, -1.000000e+00
  %79 = fdiv double %74, %78
  %80 = add nuw nsw i64 %.05265, 2
  %81 = uitofp nneg i64 %80 to double
  %82 = fadd double %68, %81
  %83 = fadd double %82, -1.000000e+00
  %84 = fdiv double %79, %83
  %85 = add nuw i64 %.05265, 3
  %86 = uitofp nneg i64 %85 to double
  %87 = fadd double %68, %86
  %88 = fadd double %87, -1.000000e+00
  %89 = fdiv double %84, %88
  %90 = add nuw i64 %.05265, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.loopexit.loopexit78.unr-lcssa, label %70, !llvm.loop !13

.preheader:                                       ; preds = %.preheader, %.preheader.preheader.new
  %.167 = phi i64 [ 1, %.preheader.preheader.new ], [ %106, %.preheader ]
  %.15466 = phi double [ %29, %.preheader.preheader.new ], [ %105, %.preheader ]
  %niter86 = phi i64 [ 0, %.preheader.preheader.new ], [ %niter86.next.3, %.preheader ]
  %91 = uitofp nneg i64 %.167 to double
  %92 = fadd double %26, %91
  %93 = fmul double %.15466, %92
  %94 = add nuw nsw i64 %.167, 1
  %95 = uitofp nneg i64 %94 to double
  %96 = fadd double %26, %95
  %97 = fmul double %93, %96
  %98 = add nuw nsw i64 %.167, 2
  %99 = uitofp nneg i64 %98 to double
  %100 = fadd double %26, %99
  %101 = fmul double %97, %100
  %102 = add nuw nsw i64 %.167, 3
  %103 = uitofp nneg i64 %102 to double
  %104 = fadd double %26, %103
  %105 = fmul double %101, %104
  %106 = add nuw nsw i64 %.167, 4
  %niter86.next.3 = add i64 %niter86, 4
  %niter86.ncmp.3 = icmp eq i64 %niter86.next.3, %unroll_iter85
  br i1 %niter86.ncmp.3, label %.loopexit.loopexit.unr-lcssa, label %.preheader, !llvm.loop !15

107:                                              ; preds = %1
  %108 = load double, ptr %8, align 8, !tbaa !11
  %109 = fcmp ogt double %16, %108
  br i1 %109, label %110, label %112

110:                                              ; preds = %107
  %111 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.5, ptr noundef nonnull @c__3, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 24) #6
  %.pre71 = load double, ptr %0, align 8, !tbaa !11
  br label %112

112:                                              ; preds = %110, %107
  %113 = phi double [ %.pre71, %110 ], [ %16, %107 ]
  %114 = load double, ptr %7, align 8, !tbaa !11
  %115 = fcmp olt double %113, %114
  br i1 %115, label %116, label %118

116:                                              ; preds = %112
  %117 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.6, ptr noundef nonnull @c__2, ptr noundef nonnull @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 27) #6
  %.pre72 = load double, ptr %0, align 8, !tbaa !11
  %.pre73 = load double, ptr %7, align 8, !tbaa !11
  br label %118

118:                                              ; preds = %116, %112
  %119 = phi double [ %.pre73, %116 ], [ %114, %112 ]
  %120 = phi double [ %.pre72, %116 ], [ %113, %112 ]
  %121 = fcmp olt double %120, %119
  br i1 %121, label %.loopexit, label %122

122:                                              ; preds = %118
  %123 = fadd double %19, -5.000000e-01
  %124 = call double @log(double noundef %19) #6
  %125 = fneg double %19
  %126 = call double @llvm.fmuladd.f64(double %123, double %124, double %125)
  %127 = load double, ptr @dgamma_.sq2pil, align 8, !tbaa !11
  %128 = fadd double %126, %127
  %129 = call double @d9lgmc_(ptr noundef nonnull %5) #6
  %130 = fadd double %128, %129
  %131 = call double @exp(double noundef %130) #6
  %132 = load double, ptr %0, align 8, !tbaa !11
  %133 = fcmp ogt double %132, 0.000000e+00
  br i1 %133, label %.loopexit, label %134

134:                                              ; preds = %122
  %135 = fadd double %132, -5.000000e-01
  store double %135, ptr %4, align 8, !tbaa !11
  %136 = call double @d_int(ptr noundef nonnull %4) #6
  %137 = fsub double %132, %136
  %138 = load double, ptr %0, align 8, !tbaa !11
  %139 = fdiv double %137, %138
  %140 = fcmp oge double %139, 0.000000e+00
  %141 = fneg double %139
  %142 = select i1 %140, double %139, double %141
  %143 = fcmp olt double %142, %15
  br i1 %143, label %144, label %146

144:                                              ; preds = %134
  %145 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.7, ptr noundef nonnull @c__1, ptr noundef nonnull @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 53) #6
  br label %146

146:                                              ; preds = %144, %134
  %147 = load double, ptr @dgamma_.pi, align 8, !tbaa !11
  %148 = load double, ptr %5, align 8, !tbaa !11
  %149 = fmul double %147, %148
  %150 = call double @sin(double noundef %149) #6
  %151 = fcmp oeq double %150, 0.000000e+00
  br i1 %151, label %152, label %154

152:                                              ; preds = %146
  %153 = call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.3, ptr noundef nonnull @c__4, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 23) #6
  br label %154

154:                                              ; preds = %152, %146
  %155 = load double, ptr @dgamma_.pi, align 8, !tbaa !11
  %156 = fneg double %155
  %157 = load double, ptr %5, align 8, !tbaa !11
  %158 = fmul double %150, %157
  %159 = fmul double %131, %158
  %160 = fdiv double %156, %159
  br label %.loopexit

.loopexit.loopexit.unr-lcssa:                     ; preds = %.preheader, %.preheader.preheader
  %.lcssa.ph = phi double [ poison, %.preheader.preheader ], [ %105, %.preheader ]
  %.167.unr = phi i64 [ 1, %.preheader.preheader ], [ %106, %.preheader ]
  %.15466.unr = phi double [ %29, %.preheader.preheader ], [ %105, %.preheader ]
  %lcmp.mod83.not = icmp eq i64 %xtraiter81, 0
  br i1 %lcmp.mod83.not, label %.loopexit, label %.preheader.epil

.preheader.epil:                                  ; preds = %.loopexit.loopexit.unr-lcssa, %.preheader.epil
  %.167.epil = phi i64 [ %164, %.preheader.epil ], [ %.167.unr, %.loopexit.loopexit.unr-lcssa ]
  %.15466.epil = phi double [ %163, %.preheader.epil ], [ %.15466.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter82 = phi i64 [ %epil.iter82.next, %.preheader.epil ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %161 = uitofp nneg i64 %.167.epil to double
  %162 = fadd double %26, %161
  %163 = fmul double %.15466.epil, %162
  %164 = add nuw nsw i64 %.167.epil, 1
  %epil.iter82.next = add i64 %epil.iter82, 1
  %epil.iter82.cmp.not = icmp eq i64 %epil.iter82.next, %xtraiter81
  br i1 %epil.iter82.cmp.not, label %.loopexit, label %.preheader.epil, !llvm.loop !16

.loopexit.loopexit78.unr-lcssa:                   ; preds = %70, %.lr.ph
  %.lcssa79.ph = phi double [ poison, %.lr.ph ], [ %89, %70 ]
  %.05265.unr = phi i64 [ 1, %.lr.ph ], [ %90, %70 ]
  %.05364.unr = phi double [ %29, %.lr.ph ], [ %89, %70 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.epil.preheader

.epil.preheader:                                  ; preds = %.loopexit.loopexit78.unr-lcssa, %.epil.preheader
  %.05265.epil = phi i64 [ %169, %.epil.preheader ], [ %.05265.unr, %.loopexit.loopexit78.unr-lcssa ]
  %.05364.epil = phi double [ %168, %.epil.preheader ], [ %.05364.unr, %.loopexit.loopexit78.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.loopexit.loopexit78.unr-lcssa ]
  %165 = uitofp nneg i64 %.05265.epil to double
  %166 = fadd double %68, %165
  %167 = fadd double %166, -1.000000e+00
  %168 = fdiv double %.05364.epil, %167
  %169 = add nuw i64 %.05265.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.loopexit, label %.epil.preheader, !llvm.loop !18

.loopexit:                                        ; preds = %.loopexit.loopexit78.unr-lcssa, %.epil.preheader, %.loopexit.loopexit.unr-lcssa, %.preheader.epil, %122, %118, %21, %154
  %.0 = phi double [ %160, %154 ], [ %29, %21 ], [ 0.000000e+00, %118 ], [ %131, %122 ], [ %.lcssa.ph, %.loopexit.loopexit.unr-lcssa ], [ %163, %.preheader.epil ], [ %.lcssa79.ph, %.loopexit.loopexit78.unr-lcssa ], [ %168, %.epil.preheader ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  ret double %.0
}

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

declare double @d1mach_(ptr noundef) local_unnamed_addr #2

declare i64 @initds_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @dgamlm_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

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

declare double @dcsevl_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @xermsg_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

declare double @d_int(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #3

declare double @d9lgmc_(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nofree nounwind willreturn memory(write) "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/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"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !17}


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