; LLVM IR from cselab/aphros :: src/gen (wave_lamb)

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

@k = external hidden global double, align 8
@h = external hidden global double, align 8
@g = external hidden global double, align 8
@ak = external hidden global double, align 8

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL9__tg_tanhd(double noundef) #1

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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL9__tg_sqrtd(double noundef) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL9__tg_coshd(double noundef) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL8__tg_sind(double noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @f2(double noundef %0, double noundef %1, ptr noundef %2) #2 {
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca ptr, 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
  store double %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %15 = load double, ptr @k, align 8, !tbaa !5
  %16 = load double, ptr @h, align 8, !tbaa !5
  %17 = fmul double %15, %16
  %18 = call double @_ZL9__tg_tanhd(double noundef %17)
  %19 = fdiv double 1.000000e+00, %18
  store double %19, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %20 = load double, ptr @ak, align 8, !tbaa !5
  %21 = load double, ptr @k, align 8, !tbaa !5
  %22 = fdiv double %20, %21
  store double %22, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %23 = load double, ptr @g, align 8, !tbaa !5
  %24 = load double, ptr @k, align 8, !tbaa !5
  %25 = fmul double %23, %24
  %26 = load double, ptr @k, align 8, !tbaa !5
  %27 = load double, ptr @h, align 8, !tbaa !5
  %28 = fmul double %26, %27
  %29 = call double @_ZL9__tg_tanhd(double noundef %28)
  %30 = fmul double %25, %29
  %31 = load double, ptr @k, align 8, !tbaa !5
  %32 = load double, ptr @k, align 8, !tbaa !5
  %33 = fmul double %31, %32
  %34 = load double, ptr %9, align 8, !tbaa !5
  %35 = fmul double %33, %34
  %36 = load double, ptr %9, align 8, !tbaa !5
  %37 = fmul double %35, %36
  %38 = load double, ptr %8, align 8, !tbaa !5
  %39 = call double @sq(double noundef %38)
  %40 = fsub double %39, 1.000000e+00
  %41 = fmul double 1.125000e+00, %40
  %42 = load double, ptr %8, align 8, !tbaa !5
  %43 = call double @sq(double noundef %42)
  %44 = fsub double %43, 1.000000e+00
  %45 = load double, ptr %8, align 8, !tbaa !5
  %46 = call double @sq(double noundef %45)
  %47 = call double @llvm.fmuladd.f64(double %41, double %44, double %46)
  %48 = call double @llvm.fmuladd.f64(double %37, double %47, double 1.000000e+00)
  %49 = fmul double %30, %48
  %50 = call double @_ZL9__tg_sqrtd(double noundef %49)
  store double %50, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %51 = load double, ptr %9, align 8, !tbaa !5
  %52 = load double, ptr @g, align 8, !tbaa !5
  %53 = fmul double %51, %52
  %54 = load double, ptr %10, align 8, !tbaa !5
  %55 = fdiv double %53, %54
  store double %55, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %56 = load double, ptr %11, align 8, !tbaa !5
  %57 = load double, ptr @k, align 8, !tbaa !5
  %58 = load double, ptr %5, align 8, !tbaa !5
  %59 = load double, ptr @h, align 8, !tbaa !5
  %60 = fadd double %58, %59
  %61 = fmul double %57, %60
  %62 = call double @_ZL9__tg_coshd(double noundef %61)
  %63 = fmul double %56, %62
  %64 = load double, ptr @k, align 8, !tbaa !5
  %65 = load double, ptr @h, align 8, !tbaa !5
  %66 = fmul double %64, %65
  %67 = call double @_ZL9__tg_coshd(double noundef %66)
  %68 = fdiv double %63, %67
  %69 = load double, ptr @k, align 8, !tbaa !5
  %70 = load double, ptr %4, align 8, !tbaa !5
  %71 = fmul double %69, %70
  %72 = call double @_ZL8__tg_sind(double noundef %71)
  %73 = fmul double %68, %72
  store double %73, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %74 = load double, ptr @ak, align 8, !tbaa !5
  %75 = fmul double 3.000000e+00, %74
  %76 = load double, ptr %11, align 8, !tbaa !5
  %77 = fmul double %75, %76
  %78 = load double, ptr %8, align 8, !tbaa !5
  %79 = fmul double 8.000000e+00, %78
  %80 = fdiv double %77, %79
  %81 = load double, ptr %8, align 8, !tbaa !5
  %82 = call double @sq(double noundef %81)
  %83 = fsub double %82, 1.000000e+00
  %84 = fmul double %80, %83
  %85 = load double, ptr %8, align 8, !tbaa !5
  %86 = call double @sq(double noundef %85)
  %87 = fsub double %86, 1.000000e+00
  %88 = fmul double %84, %87
  %89 = load double, ptr @k, align 8, !tbaa !5
  %90 = fmul double 2.000000e+00, %89
  %91 = load double, ptr %5, align 8, !tbaa !5
  %92 = load double, ptr @h, align 8, !tbaa !5
  %93 = fadd double %91, %92
  %94 = fmul double %90, %93
  %95 = call double @_ZL9__tg_coshd(double noundef %94)
  %96 = fmul double %88, %95
  %97 = load double, ptr @k, align 8, !tbaa !5
  %98 = fmul double 2.000000e+00, %97
  %99 = load double, ptr %4, align 8, !tbaa !5
  %100 = fmul double %98, %99
  %101 = call double @_ZL8__tg_sind(double noundef %100)
  %102 = fmul double %96, %101
  %103 = load double, ptr @k, align 8, !tbaa !5
  %104 = fmul double 2.000000e+00, %103
  %105 = load double, ptr @h, align 8, !tbaa !5
  %106 = fmul double %104, %105
  %107 = call double @_ZL9__tg_coshd(double noundef %106)
  %108 = fdiv double %102, %107
  store double %108, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %109 = load double, ptr %8, align 8, !tbaa !5
  %110 = call double @sq(double noundef %109)
  %111 = fsub double %110, 1.000000e+00
  %112 = fmul double 1.562500e-02, %111
  %113 = load double, ptr %8, align 8, !tbaa !5
  %114 = call double @sq(double noundef %113)
  %115 = fadd double %114, 3.000000e+00
  %116 = fmul double %112, %115
  %117 = load double, ptr %8, align 8, !tbaa !5
  %118 = call double @sq(double noundef %117)
  %119 = call double @llvm.fmuladd.f64(double 9.000000e+00, double %118, double -1.300000e+01)
  %120 = fmul double %116, %119
  %121 = load double, ptr @k, align 8, !tbaa !5
  %122 = fmul double 3.000000e+00, %121
  %123 = load double, ptr %5, align 8, !tbaa !5
  %124 = load double, ptr @h, align 8, !tbaa !5
  %125 = fadd double %123, %124
  %126 = fmul double %122, %125
  %127 = call double @_ZL9__tg_coshd(double noundef %126)
  %128 = fmul double %120, %127
  %129 = load double, ptr @k, align 8, !tbaa !5
  %130 = fmul double 3.000000e+00, %129
  %131 = load double, ptr @h, align 8, !tbaa !5
  %132 = fmul double %130, %131
  %133 = call double @_ZL9__tg_coshd(double noundef %132)
  %134 = fdiv double %128, %133
  %135 = load double, ptr %9, align 8, !tbaa !5
  %136 = fmul double %134, %135
  %137 = load double, ptr %9, align 8, !tbaa !5
  %138 = fmul double %136, %137
  %139 = load double, ptr @k, align 8, !tbaa !5
  %140 = fmul double %138, %139
  %141 = load double, ptr @k, align 8, !tbaa !5
  %142 = fmul double %140, %141
  %143 = load double, ptr %11, align 8, !tbaa !5
  %144 = fmul double %142, %143
  %145 = load double, ptr @k, align 8, !tbaa !5
  %146 = fmul double 3.000000e+00, %145
  %147 = load double, ptr %4, align 8, !tbaa !5
  %148 = fmul double %146, %147
  %149 = call double @_ZL8__tg_sind(double noundef %148)
  %150 = fmul double %144, %149
  store double %150, ptr %14, align 8, !tbaa !5
  %151 = load double, ptr %12, align 8, !tbaa !5
  %152 = load double, ptr @ak, align 8, !tbaa !5
  %153 = load double, ptr %13, align 8, !tbaa !5
  %154 = call double @llvm.fmuladd.f64(double %152, double %153, double %151)
  %155 = load double, ptr @ak, align 8, !tbaa !5
  %156 = load double, ptr @ak, align 8, !tbaa !5
  %157 = fmul double %155, %156
  %158 = load double, ptr %14, align 8, !tbaa !5
  %159 = call double @llvm.fmuladd.f64(double %157, double %158, double %154)
  store double %159, ptr %7, align 8, !tbaa !5
  %160 = load double, ptr %7, align 8, !tbaa !5
  %161 = load ptr, ptr %6, align 8, !tbaa !9
  store double %160, ptr %161, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline 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 = { 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 speculatable willreturn memory(none) }
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 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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

@k = external hidden local_unnamed_addr global double, align 8
@h = external hidden local_unnamed_addr global double, align 8
@g = external hidden local_unnamed_addr global double, align 8
@ak = external hidden local_unnamed_addr global double, align 8

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL9__tg_tanhd(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden double @sq(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: alwaysinline nounwind uwtable
declare hidden double @_ZL9__tg_sqrtd(double noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL9__tg_coshd(double noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden double @_ZL8__tg_sind(double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @f2(double noundef %0, double noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #1 {
  %4 = load double, ptr @k, align 8, !tbaa !5
  %5 = load double, ptr @h, align 8, !tbaa !5
  %6 = fmul double %4, %5
  %7 = tail call double @_ZL9__tg_tanhd(double noundef %6)
  %8 = fdiv double 1.000000e+00, %7
  %9 = load double, ptr @ak, align 8, !tbaa !5
  %10 = load double, ptr @k, align 8, !tbaa !5
  %11 = fdiv double %9, %10
  %12 = load double, ptr @g, align 8, !tbaa !5
  %13 = fmul double %10, %12
  %14 = load double, ptr @h, align 8, !tbaa !5
  %15 = fmul double %10, %14
  %16 = tail call double @_ZL9__tg_tanhd(double noundef %15)
  %17 = fmul double %13, %16
  %18 = load double, ptr @k, align 8, !tbaa !5
  %19 = fmul double %18, %18
  %20 = fmul double %11, %19
  %21 = fmul double %11, %20
  %22 = tail call double @sq(double noundef %8)
  %23 = fadd double %22, -1.000000e+00
  %24 = fmul double %23, 1.125000e+00
  %25 = tail call double @sq(double noundef %8)
  %26 = fadd double %25, -1.000000e+00
  %27 = tail call double @sq(double noundef %8)
  %28 = tail call double @llvm.fmuladd.f64(double %24, double %26, double %27)
  %29 = tail call double @llvm.fmuladd.f64(double %21, double %28, double 1.000000e+00)
  %30 = fmul double %17, %29
  %31 = tail call double @_ZL9__tg_sqrtd(double noundef %30)
  %32 = load double, ptr @g, align 8, !tbaa !5
  %33 = fmul double %11, %32
  %34 = fdiv double %33, %31
  %35 = load double, ptr @k, align 8, !tbaa !5
  %36 = load double, ptr @h, align 8, !tbaa !5
  %37 = fadd double %36, %1
  %38 = fmul double %35, %37
  %39 = tail call double @_ZL9__tg_coshd(double noundef %38)
  %40 = fmul double %34, %39
  %41 = load double, ptr @k, align 8, !tbaa !5
  %42 = load double, ptr @h, align 8, !tbaa !5
  %43 = fmul double %41, %42
  %44 = tail call double @_ZL9__tg_coshd(double noundef %43)
  %45 = fdiv double %40, %44
  %46 = load double, ptr @k, align 8, !tbaa !5
  %47 = fmul double %46, %0
  %48 = tail call double @_ZL8__tg_sind(double noundef %47)
  %49 = fmul double %45, %48
  %50 = load double, ptr @ak, align 8, !tbaa !5
  %51 = fmul double %50, 3.000000e+00
  %52 = fmul double %34, %51
  %53 = fmul double %8, 8.000000e+00
  %54 = fdiv double %52, %53
  %55 = tail call double @sq(double noundef %8)
  %56 = fadd double %55, -1.000000e+00
  %57 = fmul double %56, %54
  %58 = tail call double @sq(double noundef %8)
  %59 = fadd double %58, -1.000000e+00
  %60 = fmul double %59, %57
  %61 = load double, ptr @k, align 8, !tbaa !5
  %62 = fmul double %61, 2.000000e+00
  %63 = load double, ptr @h, align 8, !tbaa !5
  %64 = fadd double %63, %1
  %65 = fmul double %62, %64
  %66 = tail call double @_ZL9__tg_coshd(double noundef %65)
  %67 = fmul double %60, %66
  %68 = load double, ptr @k, align 8, !tbaa !5
  %69 = fmul double %68, 2.000000e+00
  %70 = fmul double %69, %0
  %71 = tail call double @_ZL8__tg_sind(double noundef %70)
  %72 = fmul double %67, %71
  %73 = load double, ptr @k, align 8, !tbaa !5
  %74 = fmul double %73, 2.000000e+00
  %75 = load double, ptr @h, align 8, !tbaa !5
  %76 = fmul double %74, %75
  %77 = tail call double @_ZL9__tg_coshd(double noundef %76)
  %78 = fdiv double %72, %77
  %79 = tail call double @sq(double noundef %8)
  %80 = fadd double %79, -1.000000e+00
  %81 = fmul double %80, 1.562500e-02
  %82 = tail call double @sq(double noundef %8)
  %83 = fadd double %82, 3.000000e+00
  %84 = fmul double %81, %83
  %85 = tail call double @sq(double noundef %8)
  %86 = tail call double @llvm.fmuladd.f64(double %85, double 9.000000e+00, double -1.300000e+01)
  %87 = fmul double %84, %86
  %88 = load double, ptr @k, align 8, !tbaa !5
  %89 = fmul double %88, 3.000000e+00
  %90 = load double, ptr @h, align 8, !tbaa !5
  %91 = fadd double %90, %1
  %92 = fmul double %89, %91
  %93 = tail call double @_ZL9__tg_coshd(double noundef %92)
  %94 = fmul double %87, %93
  %95 = load double, ptr @k, align 8, !tbaa !5
  %96 = fmul double %95, 3.000000e+00
  %97 = load double, ptr @h, align 8, !tbaa !5
  %98 = fmul double %96, %97
  %99 = tail call double @_ZL9__tg_coshd(double noundef %98)
  %100 = fdiv double %94, %99
  %101 = fmul double %11, %100
  %102 = fmul double %11, %101
  %103 = load double, ptr @k, align 8, !tbaa !5
  %104 = fmul double %103, %102
  %105 = fmul double %103, %104
  %106 = fmul double %34, %105
  %107 = fmul double %103, 3.000000e+00
  %108 = fmul double %107, %0
  %109 = tail call double @_ZL8__tg_sind(double noundef %108)
  %110 = fmul double %109, %106
  %111 = load double, ptr @ak, align 8, !tbaa !5
  %112 = tail call double @llvm.fmuladd.f64(double %111, double %78, double %49)
  %113 = fmul double %111, %111
  %114 = tail call double @llvm.fmuladd.f64(double %113, double %110, double %112)
  store double %114, ptr %2, align 8, !tbaa !5
  ret void
}

attributes #0 = { alwaysinline 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 = { 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) }

!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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass