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

%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: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 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: noreturn
declare void @wasm_rt_trap(i32 noundef) #2

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_llvh0x3A0x3ADominatorTreeBase0x3Chermes0x3A0x3ABasicBlock0x2C0x20false0x3E0x3A0x3AdominatedBySlowTreeWalk0x28llvh0x3A0x3ADomTreeNodeBase0x3Chermes0x3A0x3ABasicBlock0x3E0x20const0x2A0x2C0x20llvh0x3A0x3ADomTreeNodeBase0x3Chermes0x3A0x3ABasicBlock0x3E0x20const0x2A0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %16 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %16, ptr %11, align 4, !tbaa !9
  %17 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %17, ptr %12, align 4, !tbaa !9
  %18 = load i32, ptr %11, align 4, !tbaa !9
  %19 = load i32, ptr %12, align 4, !tbaa !9
  %20 = icmp ne i32 %18, %19
  %21 = zext i1 %20 to i32
  store i32 %21, ptr %11, align 4, !tbaa !9
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %87

24:                                               ; preds = %4
  %25 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %25, ptr %11, align 4, !tbaa !9
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = icmp ne i32 %26, 0
  %28 = xor i1 %27, true
  %29 = zext i1 %28 to i32
  store i32 %29, ptr %11, align 4, !tbaa !9
  %30 = load i32, ptr %11, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %24
  br label %105

33:                                               ; preds = %24
  %34 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %34, ptr %11, align 4, !tbaa !9
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = icmp ne i32 %35, 0
  %37 = xor i1 %36, true
  %38 = zext i1 %37 to i32
  store i32 %38, ptr %11, align 4, !tbaa !9
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %33
  br label %123

42:                                               ; preds = %33
  %43 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %43, ptr %11, align 4, !tbaa !9
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.w2c_hermes, ptr %44, i32 0, i32 6
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = add i64 %47, 8
  %49 = call i32 @i32_load(ptr noundef %45, i64 noundef %48)
  store i32 %49, ptr %11, align 4, !tbaa !9
  %50 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %50, ptr %9, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %78, %42
  %52 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %52, ptr %11, align 4, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %53, ptr %10, align 4, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.w2c_hermes, ptr %54, i32 0, i32 6
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = add i64 %57, 4
  %59 = call i32 @i32_load(ptr noundef %55, i64 noundef %58)
  store i32 %59, ptr %11, align 4, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %60, ptr %8, align 4, !tbaa !9
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %80

63:                                               ; preds = %51
  %64 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %64, ptr %11, align 4, !tbaa !9
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.w2c_hermes, ptr %65, i32 0, i32 6
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = add i64 %68, 8
  %70 = call i32 @i32_load(ptr noundef %66, i64 noundef %69)
  store i32 %70, ptr %11, align 4, !tbaa !9
  %71 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %71, ptr %12, align 4, !tbaa !9
  %72 = load i32, ptr %11, align 4, !tbaa !9
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = icmp uge i32 %72, %73
  %75 = zext i1 %74 to i32
  store i32 %75, ptr %11, align 4, !tbaa !9
  %76 = load i32, ptr %11, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %63
  br label %51

79:                                               ; preds = %63
  br label %80

80:                                               ; preds = %79, %51
  %81 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %81, ptr %11, align 4, !tbaa !9
  %82 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %82, ptr %12, align 4, !tbaa !9
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = load i32, ptr %12, align 4, !tbaa !9
  %85 = icmp eq i32 %83, %84
  %86 = zext i1 %85 to i32
  store i32 %86, ptr %11, align 4, !tbaa !9
  br label %141

87:                                               ; preds = %4
  store i32 0, ptr %11, align 4, !tbaa !9
  %88 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %88, ptr %8, align 4, !tbaa !9
  store i32 109836, ptr %12, align 4, !tbaa !9
  %89 = load i32, ptr %12, align 4, !tbaa !9
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = add i32 %90, %89
  store i32 %91, ptr %11, align 4, !tbaa !9
  %92 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %92, ptr %12, align 4, !tbaa !9
  store i32 85325, ptr %13, align 4, !tbaa !9
  %93 = load i32, ptr %13, align 4, !tbaa !9
  %94 = load i32, ptr %12, align 4, !tbaa !9
  %95 = add i32 %94, %93
  store i32 %95, ptr %12, align 4, !tbaa !9
  store i32 832, ptr %13, align 4, !tbaa !9
  %96 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %96, ptr %14, align 4, !tbaa !9
  store i32 74770, ptr %15, align 4, !tbaa !9
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = load i32, ptr %14, align 4, !tbaa !9
  %99 = add i32 %98, %97
  store i32 %99, ptr %14, align 4, !tbaa !9
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = load i32, ptr %11, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = load i32, ptr %13, align 4, !tbaa !9
  %104 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %100, i32 noundef %101, i32 noundef %102, i32 noundef %103, i32 noundef %104)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

105:                                              ; preds = %32
  store i32 0, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %106, ptr %8, align 4, !tbaa !9
  store i32 117352, ptr %12, align 4, !tbaa !9
  %107 = load i32, ptr %12, align 4, !tbaa !9
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = add i32 %108, %107
  store i32 %109, ptr %11, align 4, !tbaa !9
  %110 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %110, ptr %12, align 4, !tbaa !9
  store i32 85325, ptr %13, align 4, !tbaa !9
  %111 = load i32, ptr %13, align 4, !tbaa !9
  %112 = load i32, ptr %12, align 4, !tbaa !9
  %113 = add i32 %112, %111
  store i32 %113, ptr %12, align 4, !tbaa !9
  store i32 833, ptr %13, align 4, !tbaa !9
  %114 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %114, ptr %14, align 4, !tbaa !9
  store i32 74770, ptr %15, align 4, !tbaa !9
  %115 = load i32, ptr %15, align 4, !tbaa !9
  %116 = load i32, ptr %14, align 4, !tbaa !9
  %117 = add i32 %116, %115
  store i32 %117, ptr %14, align 4, !tbaa !9
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = load i32, ptr %11, align 4, !tbaa !9
  %120 = load i32, ptr %12, align 4, !tbaa !9
  %121 = load i32, ptr %13, align 4, !tbaa !9
  %122 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %118, i32 noundef %119, i32 noundef %120, i32 noundef %121, i32 noundef %122)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

123:                                              ; preds = %41
  store i32 0, ptr %11, align 4, !tbaa !9
  %124 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %124, ptr %8, align 4, !tbaa !9
  store i32 117376, ptr %12, align 4, !tbaa !9
  %125 = load i32, ptr %12, align 4, !tbaa !9
  %126 = load i32, ptr %11, align 4, !tbaa !9
  %127 = add i32 %126, %125
  store i32 %127, ptr %11, align 4, !tbaa !9
  %128 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %128, ptr %12, align 4, !tbaa !9
  store i32 85325, ptr %13, align 4, !tbaa !9
  %129 = load i32, ptr %13, align 4, !tbaa !9
  %130 = load i32, ptr %12, align 4, !tbaa !9
  %131 = add i32 %130, %129
  store i32 %131, ptr %12, align 4, !tbaa !9
  store i32 834, ptr %13, align 4, !tbaa !9
  %132 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %132, ptr %14, align 4, !tbaa !9
  store i32 74770, ptr %15, align 4, !tbaa !9
  %133 = load i32, ptr %15, align 4, !tbaa !9
  %134 = load i32, ptr %14, align 4, !tbaa !9
  %135 = add i32 %134, %133
  store i32 %135, ptr %14, align 4, !tbaa !9
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = load i32, ptr %11, align 4, !tbaa !9
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = load i32, ptr %13, align 4, !tbaa !9
  %140 = load i32, ptr %14, align 4, !tbaa !9
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %136, i32 noundef %137, i32 noundef %138, i32 noundef %139, i32 noundef %140)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

141:                                              ; preds = %80
  %142 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret i32 %142
}

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 = { 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 = { "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 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 #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 = !{!"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 i32 @i32_load(ptr noundef, i64 noundef) local_unnamed_addr #0

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

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @w2c_hermes_llvh0x3A0x3ADominatorTreeBase0x3Chermes0x3A0x3ABasicBlock0x2C0x20false0x3E0x3A0x3AdominatedBySlowTreeWalk0x28llvh0x3A0x3ADomTreeNodeBase0x3Chermes0x3A0x3ABasicBlock0x3E0x20const0x2A0x2C0x20llvh0x3A0x3ADomTreeNodeBase0x3Chermes0x3A0x3ABasicBlock0x3E0x20const0x2A0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %.not = icmp eq i32 %2, %3
  br i1 %.not, label %23, label %5

5:                                                ; preds = %4
  %.not77 = icmp eq i32 %3, 0
  br i1 %.not77, label %24, label %6

6:                                                ; preds = %5
  %.not78 = icmp eq i32 %2, 0
  br i1 %.not78, label %25, label %7

7:                                                ; preds = %6
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = zext i32 %2 to i64
  %10 = add nuw nsw i64 %9, 8
  %11 = tail call i32 @i32_load(ptr noundef nonnull %8, i64 noundef %10)
  br label %12

12:                                               ; preds = %16, %7
  %.0 = phi i32 [ %3, %7 ], [ %15, %16 ]
  %13 = zext i32 %.0 to i64
  %14 = add nuw nsw i64 %13, 4
  %15 = tail call i32 @i32_load(ptr noundef nonnull %8, i64 noundef %14)
  %.not79 = icmp eq i32 %15, 0
  br i1 %.not79, label %20, label %16

16:                                               ; preds = %12
  %17 = zext i32 %15 to i64
  %18 = add nuw nsw i64 %17, 8
  %19 = tail call i32 @i32_load(ptr noundef nonnull %8, i64 noundef %18)
  %.not80 = icmp ult i32 %19, %11
  br i1 %.not80, label %20, label %12

20:                                               ; preds = %16, %12
  %21 = icmp eq i32 %.0, %2
  %22 = zext i1 %21 to i32
  ret i32 %22

23:                                               ; preds = %4
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 109836, i32 noundef 85325, i32 noundef 832, i32 noundef 74770) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

24:                                               ; preds = %5
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 117352, i32 noundef 85325, i32 noundef 833, i32 noundef 74770) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

25:                                               ; preds = %6
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 117376, i32 noundef 85325, i32 noundef 834, i32 noundef 74770) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable
}

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 = { 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 #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 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 = { nounwind }
attributes #5 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass