; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_compiled_5)

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

; 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: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #1

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden double @wasm_fabs(double noundef) #3

declare double @w2c_hermes_fmod(ptr noundef, double noundef, double noundef) #4

; Function Attrs: nounwind uwtable
declare hidden double @wasm_floor(double noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AweekDay0x28double0x29(ptr noundef %0, double noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, 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
  %12 = load double, ptr %4, align 8, !tbaa !9
  store double %12, ptr %7, align 8, !tbaa !9
  store double 8.640000e+07, ptr %8, align 8, !tbaa !9
  %13 = load double, ptr %8, align 8, !tbaa !9
  %14 = load double, ptr %7, align 8, !tbaa !9
  %15 = fdiv double %14, %13
  store double %15, ptr %7, align 8, !tbaa !9
  %16 = load double, ptr %7, align 8, !tbaa !9
  %17 = call double @wasm_floor(double noundef %16)
  store double %17, ptr %7, align 8, !tbaa !9
  store double 4.000000e+00, ptr %8, align 8, !tbaa !9
  %18 = load double, ptr %8, align 8, !tbaa !9
  %19 = load double, ptr %7, align 8, !tbaa !9
  %20 = fadd double %19, %18
  store double %20, ptr %7, align 8, !tbaa !9
  store double 7.000000e+00, ptr %8, align 8, !tbaa !9
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = load double, ptr %7, align 8, !tbaa !9
  %23 = load double, ptr %8, align 8, !tbaa !9
  %24 = call double @w2c_hermes_fmod(ptr noundef %21, double noundef %22, double noundef %23)
  store double %24, ptr %7, align 8, !tbaa !9
  %25 = load double, ptr %7, align 8, !tbaa !9
  store double %25, ptr %4, align 8, !tbaa !9
  store double 7.000000e+00, ptr %8, align 8, !tbaa !9
  store double -0.000000e+00, ptr %9, align 8, !tbaa !9
  %26 = load double, ptr %4, align 8, !tbaa !9
  store double %26, ptr %10, align 8, !tbaa !9
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  %27 = load double, ptr %10, align 8, !tbaa !9
  %28 = load double, ptr %11, align 8, !tbaa !9
  %29 = fcmp olt double %27, %28
  %30 = zext i1 %29 to i32
  store i32 %30, ptr %6, align 4, !tbaa !11
  %31 = load i32, ptr %6, align 4, !tbaa !11
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %2
  %34 = load double, ptr %8, align 8, !tbaa !9
  br label %37

35:                                               ; preds = %2
  %36 = load double, ptr %9, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %35, %33
  %38 = phi double [ %34, %33 ], [ %36, %35 ]
  store double %38, ptr %8, align 8, !tbaa !9
  %39 = load double, ptr %8, align 8, !tbaa !9
  %40 = load double, ptr %7, align 8, !tbaa !9
  %41 = fadd double %40, %39
  store double %41, ptr %7, align 8, !tbaa !9
  %42 = load double, ptr %7, align 8, !tbaa !9
  store double %42, ptr %4, align 8, !tbaa !9
  %43 = load double, ptr %7, align 8, !tbaa !9
  %44 = call double @wasm_fabs(double noundef %43)
  store double %44, ptr %7, align 8, !tbaa !9
  store double 0x41E0000000000000, ptr %8, align 8, !tbaa !9
  %45 = load double, ptr %7, align 8, !tbaa !9
  %46 = load double, ptr %8, align 8, !tbaa !9
  %47 = fcmp olt double %45, %46
  %48 = zext i1 %47 to i32
  store i32 %48, ptr %5, align 4, !tbaa !11
  %49 = load i32, ptr %5, align 4, !tbaa !11
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %88

51:                                               ; preds = %37
  %52 = load double, ptr %4, align 8, !tbaa !9
  store double %52, ptr %7, align 8, !tbaa !9
  %53 = load double, ptr %7, align 8, !tbaa !9
  %54 = load double, ptr %7, align 8, !tbaa !9
  %55 = fcmp une double %53, %54
  %56 = xor i1 %55, true
  %57 = xor i1 %56, true
  %58 = zext i1 %57 to i32
  %59 = sext i32 %58 to i64
  %60 = call i64 @llvm.expect.i64(i64 %59, i64 0)
  %61 = icmp ne i64 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %51
  call void @wasm_rt_trap(i32 noundef 4) #6
  unreachable

63:                                               ; No predecessors!
  br label %86

64:                                               ; preds = %51
  %65 = load double, ptr %7, align 8, !tbaa !9
  %66 = fcmp ogt double %65, 0xC1E0000000200000
  br i1 %66, label %67, label %70

67:                                               ; preds = %64
  %68 = load double, ptr %7, align 8, !tbaa !9
  %69 = fcmp olt double %68, 0x41E0000000000000
  br label %70

70:                                               ; preds = %67, %64
  %71 = phi i1 [ false, %64 ], [ %69, %67 ]
  %72 = xor i1 %71, true
  %73 = xor i1 %72, true
  %74 = xor i1 %73, true
  %75 = zext i1 %74 to i32
  %76 = sext i32 %75 to i64
  %77 = call i64 @llvm.expect.i64(i64 %76, i64 0)
  %78 = icmp ne i64 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %70
  call void @wasm_rt_trap(i32 noundef 2) #6
  unreachable

80:                                               ; No predecessors!
  br label %84

81:                                               ; preds = %70
  %82 = load double, ptr %7, align 8, !tbaa !9
  %83 = fptosi double %82 to i32
  br label %84

84:                                               ; preds = %81, %80
  %85 = phi i32 [ 0, %80 ], [ %83, %81 ]
  br label %86

86:                                               ; preds = %84, %63
  %87 = phi i32 [ 0, %63 ], [ %85, %84 ]
  store i32 %87, ptr %5, align 4, !tbaa !11
  br label %89

88:                                               ; preds = %37
  store i32 -2147483648, ptr %5, align 4, !tbaa !11
  br label %89

89:                                               ; preds = %88, %86
  %90 = load i32, ptr %5, align 4, !tbaa !11
  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 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 %90
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { noreturn "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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"

; Function Attrs: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3AweekDay0x28double0x29(ptr noundef %0, double noundef %1) local_unnamed_addr #1 {
  %3 = fdiv double %1, 8.640000e+07
  %4 = tail call double @wasm_floor(double noundef %3)
  %5 = fadd double %4, 4.000000e+00
  %6 = tail call double @w2c_hermes_fmod(ptr noundef %0, double noundef %5, double noundef 7.000000e+00) #3
  %7 = fcmp olt double %6, 0.000000e+00
  %8 = select i1 %7, double 7.000000e+00, double -0.000000e+00
  %9 = fadd double %6, %8
  %10 = tail call double @wasm_fabs(double noundef %9)
  %11 = fcmp olt double %10, 0x41E0000000000000
  br i1 %11, label %12, label %21

12:                                               ; preds = %2
  %13 = fcmp uno double %9, 0.000000e+00
  br i1 %13, label %14, label %15, !prof !5

14:                                               ; preds = %12
  tail call void @wasm_rt_trap(i32 noundef 4) #4
  unreachable

15:                                               ; preds = %12
  %16 = fcmp ule double %9, 0xC1E0000000200000
  %17 = fcmp uge double %9, 0x41E0000000000000
  %.not30 = or i1 %16, %17
  br i1 %.not30, label %18, label %19, !prof !5

18:                                               ; preds = %15
  tail call void @wasm_rt_trap(i32 noundef 2) #4
  unreachable

19:                                               ; preds = %15
  %20 = fptosi double %9 to i32
  br label %21

21:                                               ; preds = %2, %19
  %.0 = phi i32 [ %20, %19 ], [ -2147483648, %2 ]
  ret i32 %.0
}

attributes #0 = { noreturn "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 = { "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 }
attributes #4 = { noreturn 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}


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