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

; 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.w2c_hermes = type { ptr, ptr, ptr, i32, i32, i32, %struct.wasm_rt_memory_t, %struct.wasm_rt_funcref_table_t }
%struct.wasm_rt_memory_t = type { ptr, i64, i64, i64, i8 }
%struct.wasm_rt_funcref_table_t = type { ptr, i32, i32 }

; 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: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @f64_store(ptr noundef, i64 noundef, double noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_modf(ptr noundef %0, double noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %18 = load double, ptr %5, align 8, !tbaa !9
  store double %18, ptr %16, align 8, !tbaa !9
  %19 = load double, ptr %16, align 8, !tbaa !9
  %20 = call i64 @i64_reinterpret_f64(double noundef %19)
  store i64 %20, ptr %13, align 8, !tbaa !13
  %21 = load i64, ptr %13, align 8, !tbaa !13
  store i64 %21, ptr %9, align 8, !tbaa !13
  store i64 52, ptr %14, align 8, !tbaa !13
  %22 = load i64, ptr %14, align 8, !tbaa !13
  %23 = and i64 %22, 63
  %24 = load i64, ptr %13, align 8, !tbaa !13
  %25 = lshr i64 %24, %23
  store i64 %25, ptr %13, align 8, !tbaa !13
  %26 = load i64, ptr %13, align 8, !tbaa !13
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr %11, align 4, !tbaa !11
  store i32 2047, ptr %12, align 4, !tbaa !11
  %28 = load i32, ptr %12, align 4, !tbaa !11
  %29 = load i32, ptr %11, align 4, !tbaa !11
  %30 = and i32 %29, %28
  store i32 %30, ptr %11, align 4, !tbaa !11
  %31 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %31, ptr %7, align 4, !tbaa !11
  store i32 1023, ptr %12, align 4, !tbaa !11
  %32 = load i32, ptr %12, align 4, !tbaa !11
  %33 = load i32, ptr %11, align 4, !tbaa !11
  %34 = sub i32 %33, %32
  store i32 %34, ptr %11, align 4, !tbaa !11
  %35 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %35, ptr %8, align 4, !tbaa !11
  %36 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %36, ptr %11, align 4, !tbaa !11
  store i32 1075, ptr %12, align 4, !tbaa !11
  %37 = load i32, ptr %11, align 4, !tbaa !11
  %38 = load i32, ptr %12, align 4, !tbaa !11
  %39 = icmp uge i32 %37, %38
  %40 = zext i1 %39 to i32
  store i32 %40, ptr %11, align 4, !tbaa !11
  %41 = load i32, ptr %11, align 4, !tbaa !11
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %77

43:                                               ; preds = %3
  %44 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %44, ptr %11, align 4, !tbaa !11
  %45 = load double, ptr %5, align 8, !tbaa !9
  store double %45, ptr %17, align 8, !tbaa !9
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.w2c_hermes, ptr %46, i32 0, i32 6
  %48 = load i32, ptr %11, align 4, !tbaa !11
  %49 = zext i32 %48 to i64
  %50 = load double, ptr %17, align 8, !tbaa !9
  call void @f64_store(ptr noundef %47, i64 noundef %49, double noundef %50)
  %51 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %51, ptr %11, align 4, !tbaa !11
  store i32 1024, ptr %12, align 4, !tbaa !11
  %52 = load i32, ptr %11, align 4, !tbaa !11
  %53 = load i32, ptr %12, align 4, !tbaa !11
  %54 = icmp eq i32 %52, %53
  %55 = zext i1 %54 to i32
  store i32 %55, ptr %11, align 4, !tbaa !11
  %56 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %56, ptr %14, align 8, !tbaa !13
  store i64 4503599627370495, ptr %15, align 8, !tbaa !13
  %57 = load i64, ptr %15, align 8, !tbaa !13
  %58 = load i64, ptr %14, align 8, !tbaa !13
  %59 = and i64 %58, %57
  store i64 %59, ptr %14, align 8, !tbaa !13
  store i64 0, ptr %15, align 8, !tbaa !13
  %60 = load i64, ptr %14, align 8, !tbaa !13
  %61 = load i64, ptr %15, align 8, !tbaa !13
  %62 = icmp ne i64 %60, %61
  %63 = zext i1 %62 to i32
  store i32 %63, ptr %12, align 4, !tbaa !11
  %64 = load i32, ptr %12, align 4, !tbaa !11
  %65 = load i32, ptr %11, align 4, !tbaa !11
  %66 = and i32 %65, %64
  store i32 %66, ptr %11, align 4, !tbaa !11
  %67 = load i32, ptr %11, align 4, !tbaa !11
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %43
  br label %155

70:                                               ; preds = %43
  %71 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %71, ptr %13, align 8, !tbaa !13
  store i64 -9223372036854775808, ptr %14, align 8, !tbaa !13
  %72 = load i64, ptr %14, align 8, !tbaa !13
  %73 = load i64, ptr %13, align 8, !tbaa !13
  %74 = and i64 %73, %72
  store i64 %74, ptr %13, align 8, !tbaa !13
  %75 = load i64, ptr %13, align 8, !tbaa !13
  %76 = call double @f64_reinterpret_i64(i64 noundef %75)
  store double %76, ptr %16, align 8, !tbaa !9
  br label %157

77:                                               ; preds = %3
  %78 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %78, ptr %11, align 4, !tbaa !11
  store i32 1022, ptr %12, align 4, !tbaa !11
  %79 = load i32, ptr %11, align 4, !tbaa !11
  %80 = load i32, ptr %12, align 4, !tbaa !11
  %81 = icmp ule i32 %79, %80
  %82 = zext i1 %81 to i32
  store i32 %82, ptr %11, align 4, !tbaa !11
  %83 = load i32, ptr %11, align 4, !tbaa !11
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %97

85:                                               ; preds = %77
  %86 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %86, ptr %11, align 4, !tbaa !11
  %87 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %87, ptr %14, align 8, !tbaa !13
  store i64 -9223372036854775808, ptr %15, align 8, !tbaa !13
  %88 = load i64, ptr %15, align 8, !tbaa !13
  %89 = load i64, ptr %14, align 8, !tbaa !13
  %90 = and i64 %89, %88
  store i64 %90, ptr %14, align 8, !tbaa !13
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.w2c_hermes, ptr %91, i32 0, i32 6
  %93 = load i32, ptr %11, align 4, !tbaa !11
  %94 = zext i32 %93 to i64
  %95 = load i64, ptr %14, align 8, !tbaa !13
  call void @i64_store(ptr noundef %92, i64 noundef %94, i64 noundef %95)
  %96 = load double, ptr %5, align 8, !tbaa !9
  store double %96, ptr %16, align 8, !tbaa !9
  br label %157

97:                                               ; preds = %77
  %98 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %98, ptr %13, align 8, !tbaa !13
  %99 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %99, ptr %12, align 4, !tbaa !11
  %100 = load i32, ptr %12, align 4, !tbaa !11
  %101 = zext i32 %100 to i64
  store i64 %101, ptr %14, align 8, !tbaa !13
  %102 = load i64, ptr %14, align 8, !tbaa !13
  store i64 %102, ptr %10, align 8, !tbaa !13
  %103 = load i64, ptr %14, align 8, !tbaa !13
  %104 = and i64 %103, 63
  %105 = load i64, ptr %13, align 8, !tbaa !13
  %106 = shl i64 %105, %104
  store i64 %106, ptr %13, align 8, !tbaa !13
  store i64 4503599627370495, ptr %14, align 8, !tbaa !13
  %107 = load i64, ptr %14, align 8, !tbaa !13
  %108 = load i64, ptr %13, align 8, !tbaa !13
  %109 = and i64 %108, %107
  store i64 %109, ptr %13, align 8, !tbaa !13
  %110 = load i64, ptr %13, align 8, !tbaa !13
  %111 = icmp ne i64 %110, 0
  %112 = xor i1 %111, true
  %113 = zext i1 %112 to i32
  store i32 %113, ptr %11, align 4, !tbaa !11
  %114 = load i32, ptr %11, align 4, !tbaa !11
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %130

116:                                              ; preds = %97
  %117 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %117, ptr %11, align 4, !tbaa !11
  %118 = load double, ptr %5, align 8, !tbaa !9
  store double %118, ptr %17, align 8, !tbaa !9
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.w2c_hermes, ptr %119, i32 0, i32 6
  %121 = load i32, ptr %11, align 4, !tbaa !11
  %122 = zext i32 %121 to i64
  %123 = load double, ptr %17, align 8, !tbaa !9
  call void @f64_store(ptr noundef %120, i64 noundef %122, double noundef %123)
  %124 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %124, ptr %13, align 8, !tbaa !13
  store i64 -9223372036854775808, ptr %14, align 8, !tbaa !13
  %125 = load i64, ptr %14, align 8, !tbaa !13
  %126 = load i64, ptr %13, align 8, !tbaa !13
  %127 = and i64 %126, %125
  store i64 %127, ptr %13, align 8, !tbaa !13
  %128 = load i64, ptr %13, align 8, !tbaa !13
  %129 = call double @f64_reinterpret_i64(i64 noundef %128)
  store double %129, ptr %16, align 8, !tbaa !9
  br label %157

130:                                              ; preds = %97
  %131 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %131, ptr %11, align 4, !tbaa !11
  store i64 -4503599627370496, ptr %14, align 8, !tbaa !13
  %132 = load i64, ptr %10, align 8, !tbaa !13
  store i64 %132, ptr %15, align 8, !tbaa !13
  %133 = load i64, ptr %14, align 8, !tbaa !13
  %134 = load i64, ptr %15, align 8, !tbaa !13
  %135 = and i64 %134, 63
  %136 = ashr i64 %133, %135
  store i64 %136, ptr %14, align 8, !tbaa !13
  %137 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %137, ptr %15, align 8, !tbaa !13
  %138 = load i64, ptr %15, align 8, !tbaa !13
  %139 = load i64, ptr %14, align 8, !tbaa !13
  %140 = and i64 %139, %138
  store i64 %140, ptr %14, align 8, !tbaa !13
  %141 = load i64, ptr %14, align 8, !tbaa !13
  store i64 %141, ptr %9, align 8, !tbaa !13
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.w2c_hermes, ptr %142, i32 0, i32 6
  %144 = load i32, ptr %11, align 4, !tbaa !11
  %145 = zext i32 %144 to i64
  %146 = load i64, ptr %14, align 8, !tbaa !13
  call void @i64_store(ptr noundef %143, i64 noundef %145, i64 noundef %146)
  %147 = load double, ptr %5, align 8, !tbaa !9
  store double %147, ptr %16, align 8, !tbaa !9
  %148 = load i64, ptr %9, align 8, !tbaa !13
  store i64 %148, ptr %14, align 8, !tbaa !13
  %149 = load i64, ptr %14, align 8, !tbaa !13
  %150 = call double @f64_reinterpret_i64(i64 noundef %149)
  store double %150, ptr %17, align 8, !tbaa !9
  %151 = load double, ptr %17, align 8, !tbaa !9
  %152 = load double, ptr %16, align 8, !tbaa !9
  %153 = fsub double %152, %151
  store double %153, ptr %16, align 8, !tbaa !9
  %154 = load double, ptr %16, align 8, !tbaa !9
  store double %154, ptr %5, align 8, !tbaa !9
  br label %155

155:                                              ; preds = %130, %69
  %156 = load double, ptr %5, align 8, !tbaa !9
  store double %156, ptr %16, align 8, !tbaa !9
  br label %157

157:                                              ; preds = %155, %116, %85, %70
  %158 = load double, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret double %158
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !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: inlinehint nounwind uwtable
declare hidden void @i64_store(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @f64_store(ptr noundef, i64 noundef, double noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @f64_reinterpret_i64(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_modf(ptr noundef %0, double noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = tail call i64 @i64_reinterpret_f64(double noundef %1)
  %5 = lshr i64 %4, 52
  %6 = trunc nuw nsw i64 %5 to i32
  %7 = and i32 %6, 2047
  %8 = add nsw i32 %7, -1023
  %9 = icmp ugt i32 %7, 1074
  br i1 %9, label %10, label %20

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = zext i32 %2 to i64
  tail call void @f64_store(ptr noundef nonnull %11, i64 noundef %12, double noundef %1)
  %13 = icmp eq i32 %8, 1024
  %14 = and i64 %4, 4503599627370495
  %15 = icmp ne i64 %14, 0
  %16 = and i1 %15, %13
  br i1 %16, label %42, label %17

17:                                               ; preds = %10
  %18 = and i64 %4, -9223372036854775808
  %19 = tail call double @f64_reinterpret_i64(i64 noundef %18)
  br label %42

20:                                               ; preds = %3
  %21 = icmp ult i32 %7, 1023
  br i1 %21, label %22, label %26

22:                                               ; preds = %20
  %23 = and i64 %4, -9223372036854775808
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = zext i32 %2 to i64
  tail call void @i64_store(ptr noundef nonnull %24, i64 noundef %25, i64 noundef %23)
  br label %42

26:                                               ; preds = %20
  %27 = zext nneg i32 %8 to i64
  %28 = lshr i64 4503599627370495, %27
  %29 = and i64 %28, %4
  %.not = icmp eq i64 %29, 0
  br i1 %.not, label %30, label %35

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %0, i64 40
  %32 = zext i32 %2 to i64
  tail call void @f64_store(ptr noundef nonnull %31, i64 noundef %32, double noundef %1)
  %33 = and i64 %4, -9223372036854775808
  %34 = tail call double @f64_reinterpret_i64(i64 noundef %33)
  br label %42

35:                                               ; preds = %26
  %36 = ashr i64 -4503599627370496, %27
  %37 = and i64 %36, %4
  %38 = getelementptr inbounds i8, ptr %0, i64 40
  %39 = zext i32 %2 to i64
  tail call void @i64_store(ptr noundef nonnull %38, i64 noundef %39, i64 noundef %37)
  %40 = tail call double @f64_reinterpret_i64(i64 noundef %37)
  %41 = fsub double %1, %40
  br label %42

42:                                               ; preds = %35, %10, %30, %22, %17
  %.0 = phi double [ %19, %17 ], [ %1, %22 ], [ %34, %30 ], [ %1, %10 ], [ %41, %35 ]
  ret double %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @i64_reinterpret_f64(double noundef) local_unnamed_addr #0

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

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


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