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

; 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 double @f64_reinterpret_i64(i64 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_nextafter(ptr noundef %0, double noundef %1, double noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %20 = load double, ptr %5, align 8, !tbaa !9
  store double %20, ptr %18, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load double, ptr %18, align 8, !tbaa !9
  %23 = call i64 @w2c_hermes_0x5F_DOUBLE_BITS0x2E2(ptr noundef %21, double noundef %22)
  store i64 %23, ptr %14, align 8, !tbaa !11
  store i64 9223372036854775807, ptr %15, align 8, !tbaa !11
  %24 = load i64, ptr %15, align 8, !tbaa !11
  %25 = load i64, ptr %14, align 8, !tbaa !11
  %26 = and i64 %25, %24
  store i64 %26, ptr %14, align 8, !tbaa !11
  store i64 9218868437227405312, ptr %15, align 8, !tbaa !11
  %27 = load i64, ptr %14, align 8, !tbaa !11
  %28 = load i64, ptr %15, align 8, !tbaa !11
  %29 = icmp ule i64 %27, %28
  %30 = zext i1 %29 to i32
  store i32 %30, ptr %11, align 4, !tbaa !13
  %31 = load i32, ptr %11, align 4, !tbaa !13
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %49

33:                                               ; preds = %3
  %34 = load double, ptr %6, align 8, !tbaa !9
  store double %34, ptr %18, align 8, !tbaa !9
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load double, ptr %18, align 8, !tbaa !9
  %37 = call i64 @w2c_hermes_0x5F_DOUBLE_BITS0x2E2(ptr noundef %35, double noundef %36)
  store i64 %37, ptr %14, align 8, !tbaa !11
  store i64 9223372036854775807, ptr %15, align 8, !tbaa !11
  %38 = load i64, ptr %15, align 8, !tbaa !11
  %39 = load i64, ptr %14, align 8, !tbaa !11
  %40 = and i64 %39, %38
  store i64 %40, ptr %14, align 8, !tbaa !11
  store i64 9218868437227405313, ptr %15, align 8, !tbaa !11
  %41 = load i64, ptr %14, align 8, !tbaa !11
  %42 = load i64, ptr %15, align 8, !tbaa !11
  %43 = icmp ult i64 %41, %42
  %44 = zext i1 %43 to i32
  store i32 %44, ptr %11, align 4, !tbaa !13
  %45 = load i32, ptr %11, align 4, !tbaa !13
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %33
  br label %55

48:                                               ; preds = %33
  br label %49

49:                                               ; preds = %48, %3
  %50 = load double, ptr %5, align 8, !tbaa !9
  store double %50, ptr %18, align 8, !tbaa !9
  %51 = load double, ptr %6, align 8, !tbaa !9
  store double %51, ptr %19, align 8, !tbaa !9
  %52 = load double, ptr %19, align 8, !tbaa !9
  %53 = load double, ptr %18, align 8, !tbaa !9
  %54 = fadd double %53, %52
  store double %54, ptr %18, align 8, !tbaa !9
  br label %149

55:                                               ; preds = %47
  %56 = load double, ptr %5, align 8, !tbaa !9
  store double %56, ptr %18, align 8, !tbaa !9
  %57 = load double, ptr %18, align 8, !tbaa !9
  %58 = call i64 @i64_reinterpret_f64(double noundef %57)
  store i64 %58, ptr %14, align 8, !tbaa !11
  %59 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %59, ptr %7, align 8, !tbaa !11
  %60 = load double, ptr %6, align 8, !tbaa !9
  store double %60, ptr %19, align 8, !tbaa !9
  %61 = load double, ptr %19, align 8, !tbaa !9
  %62 = call i64 @i64_reinterpret_f64(double noundef %61)
  store i64 %62, ptr %15, align 8, !tbaa !11
  %63 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %63, ptr %8, align 8, !tbaa !11
  %64 = load i64, ptr %14, align 8, !tbaa !11
  %65 = load i64, ptr %15, align 8, !tbaa !11
  %66 = icmp eq i64 %64, %65
  %67 = zext i1 %66 to i32
  store i32 %67, ptr %11, align 4, !tbaa !13
  %68 = load i32, ptr %11, align 4, !tbaa !13
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %55
  br label %147

71:                                               ; preds = %55
  %72 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %72, ptr %14, align 8, !tbaa !11
  store i64 9223372036854775807, ptr %15, align 8, !tbaa !11
  %73 = load i64, ptr %15, align 8, !tbaa !11
  %74 = load i64, ptr %14, align 8, !tbaa !11
  %75 = and i64 %74, %73
  store i64 %75, ptr %14, align 8, !tbaa !11
  %76 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %76, ptr %9, align 8, !tbaa !11
  %77 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %77, ptr %14, align 8, !tbaa !11
  store i64 9223372036854775807, ptr %15, align 8, !tbaa !11
  %78 = load i64, ptr %15, align 8, !tbaa !11
  %79 = load i64, ptr %14, align 8, !tbaa !11
  %80 = and i64 %79, %78
  store i64 %80, ptr %14, align 8, !tbaa !11
  %81 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %81, ptr %10, align 8, !tbaa !11
  %82 = load i64, ptr %14, align 8, !tbaa !11
  %83 = icmp ne i64 %82, 0
  %84 = xor i1 %83, true
  %85 = zext i1 %84 to i32
  store i32 %85, ptr %11, align 4, !tbaa !13
  %86 = load i32, ptr %11, align 4, !tbaa !13
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %105

88:                                               ; preds = %71
  %89 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %89, ptr %14, align 8, !tbaa !11
  %90 = load i64, ptr %14, align 8, !tbaa !11
  %91 = icmp ne i64 %90, 0
  %92 = xor i1 %91, true
  %93 = zext i1 %92 to i32
  store i32 %93, ptr %11, align 4, !tbaa !13
  %94 = load i32, ptr %11, align 4, !tbaa !13
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %88
  br label %147

97:                                               ; preds = %88
  %98 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %98, ptr %14, align 8, !tbaa !11
  store i64 -9223372036854775808, ptr %15, align 8, !tbaa !11
  %99 = load i64, ptr %15, align 8, !tbaa !11
  %100 = load i64, ptr %14, align 8, !tbaa !11
  %101 = and i64 %100, %99
  store i64 %101, ptr %14, align 8, !tbaa !11
  store i64 1, ptr %15, align 8, !tbaa !11
  %102 = load i64, ptr %15, align 8, !tbaa !11
  %103 = load i64, ptr %14, align 8, !tbaa !11
  %104 = or i64 %103, %102
  store i64 %104, ptr %14, align 8, !tbaa !11
  br label %142

105:                                              ; preds = %71
  %106 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %106, ptr %14, align 8, !tbaa !11
  store i64 1, ptr %15, align 8, !tbaa !11
  %107 = load i64, ptr %15, align 8, !tbaa !11
  %108 = load i64, ptr %14, align 8, !tbaa !11
  %109 = sub i64 %108, %107
  store i64 %109, ptr %14, align 8, !tbaa !11
  %110 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %110, ptr %15, align 8, !tbaa !11
  %111 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %111, ptr %16, align 8, !tbaa !11
  %112 = load i64, ptr %16, align 8, !tbaa !11
  %113 = load i64, ptr %15, align 8, !tbaa !11
  %114 = xor i64 %113, %112
  store i64 %114, ptr %15, align 8, !tbaa !11
  store i64 0, ptr %16, align 8, !tbaa !11
  %115 = load i64, ptr %15, align 8, !tbaa !11
  %116 = load i64, ptr %16, align 8, !tbaa !11
  %117 = icmp sge i64 %115, %116
  %118 = zext i1 %117 to i32
  %119 = sext i32 %118 to i64
  %120 = trunc i64 %119 to i32
  store i32 %120, ptr %12, align 4, !tbaa !13
  %121 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %121, ptr %16, align 8, !tbaa !11
  %122 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %122, ptr %17, align 8, !tbaa !11
  %123 = load i64, ptr %16, align 8, !tbaa !11
  %124 = load i64, ptr %17, align 8, !tbaa !11
  %125 = icmp uge i64 %123, %124
  %126 = zext i1 %125 to i32
  store i32 %126, ptr %13, align 4, !tbaa !13
  %127 = load i32, ptr %13, align 4, !tbaa !13
  %128 = load i32, ptr %12, align 4, !tbaa !13
  %129 = and i32 %128, %127
  store i32 %129, ptr %12, align 4, !tbaa !13
  %130 = load i32, ptr %12, align 4, !tbaa !13
  %131 = icmp ne i32 %130, 0
  %132 = xor i1 %131, true
  %133 = zext i1 %132 to i32
  store i32 %133, ptr %12, align 4, !tbaa !13
  %134 = load i32, ptr %12, align 4, !tbaa !13
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %105
  br label %142

137:                                              ; preds = %105
  %138 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %138, ptr %14, align 8, !tbaa !11
  store i64 1, ptr %15, align 8, !tbaa !11
  %139 = load i64, ptr %15, align 8, !tbaa !11
  %140 = load i64, ptr %14, align 8, !tbaa !11
  %141 = add i64 %140, %139
  store i64 %141, ptr %14, align 8, !tbaa !11
  br label %142

142:                                              ; preds = %137, %136, %97
  %143 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %143, ptr %7, align 8, !tbaa !11
  %144 = load i64, ptr %14, align 8, !tbaa !11
  %145 = call double @f64_reinterpret_i64(i64 noundef %144)
  store double %145, ptr %18, align 8, !tbaa !9
  %146 = load double, ptr %18, align 8, !tbaa !9
  store double %146, ptr %6, align 8, !tbaa !9
  br label %147

147:                                              ; preds = %142, %96, %70
  %148 = load double, ptr %6, align 8, !tbaa !9
  store double %148, ptr %18, align 8, !tbaa !9
  br label %149

149:                                              ; preds = %147, %49
  %150 = load double, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, 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 double %150
}

declare i64 @w2c_hermes_0x5F_DOUBLE_BITS0x2E2(ptr noundef, double noundef) #3

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 = { "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 = !{!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 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"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: inlinehint nounwind uwtable
declare hidden double @f64_reinterpret_i64(i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local double @w2c_hermes_nextafter(ptr noundef %0, double noundef %1, double noundef %2) local_unnamed_addr #1 {
  %4 = tail call i64 @w2c_hermes_0x5F_DOUBLE_BITS0x2E2(ptr noundef %0, double noundef %1) #3
  %5 = and i64 %4, 9223372036854775807
  %6 = icmp ult i64 %5, 9218868437227405313
  br i1 %6, label %7, label %11

7:                                                ; preds = %3
  %8 = tail call i64 @w2c_hermes_0x5F_DOUBLE_BITS0x2E2(ptr noundef %0, double noundef %2) #3
  %9 = and i64 %8, 9223372036854775807
  %10 = icmp ult i64 %9, 9218868437227405313
  br i1 %10, label %13, label %11

11:                                               ; preds = %7, %3
  %12 = fadd double %1, %2
  br label %30

13:                                               ; preds = %7
  %14 = tail call i64 @i64_reinterpret_f64(double noundef %1)
  %15 = tail call i64 @i64_reinterpret_f64(double noundef %2)
  %16 = icmp eq i64 %14, %15
  br i1 %16, label %30, label %17

17:                                               ; preds = %13
  %18 = and i64 %15, 9223372036854775807
  %19 = and i64 %14, 9223372036854775807
  %.not = icmp eq i64 %19, 0
  br i1 %.not, label %20, label %24

20:                                               ; preds = %17
  %.not78 = icmp eq i64 %18, 0
  br i1 %.not78, label %30, label %21

21:                                               ; preds = %20
  %22 = and i64 %15, -9223372036854775808
  %23 = or disjoint i64 %22, 1
  br label %28

24:                                               ; preds = %17
  %25 = xor i64 %15, %14
  %26 = icmp slt i64 %25, 0
  %27 = icmp ult i64 %18, %19
  %.not77 = or i1 %26, %27
  %spec.select.v = select i1 %.not77, i64 -1, i64 1
  %spec.select = add i64 %spec.select.v, %14
  br label %28

28:                                               ; preds = %24, %21
  %.072 = phi i64 [ %23, %21 ], [ %spec.select, %24 ]
  %29 = tail call double @f64_reinterpret_i64(i64 noundef %.072)
  br label %30

30:                                               ; preds = %28, %13, %20, %11
  %.0 = phi double [ %12, %11 ], [ %2, %13 ], [ %2, %20 ], [ %29, %28 ]
  ret double %.0
}

declare i64 @w2c_hermes_0x5F_DOUBLE_BITS0x2E2(ptr noundef, double noundef) local_unnamed_addr #2

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

!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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass