; 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 }
%struct.wasm_rt_funcref_t = type { ptr, ptr, ptr }

@w2c_hermes_t3 = external constant ptr, 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: 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @func_types_eq(ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_std0x3A0x3A_0x5F20x3A0x3A_0x5Ffunction0x3A0x3A_0x5Ffunc0x3Cstd0x3A0x3A_0x5F20x3A0x3Afunction0x3Cbool0x200x28hermes0x3A0x3AFunction0x20const0x2A0x290x3E0x2C0x20std0x3A0x3A_0x5F20x3A0x3Aallocator0x3Cstd0x3A0x3A_0x5F20x3A0x3Afunction0x3Cbool0x200x28hermes0x3A0x3AFunction0x20const0x2A0x290x3E0x3E0x2C0x20bool0x200x28hermes0x3A0x3AFunction0x2A0x290x3E0x3A0x3Adestroy0x280x29(ptr noundef %0, i32 noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %10 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %10, ptr %7, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.w2c_hermes, ptr %11, i32 0, i32 6
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = zext i32 %13 to i64
  %15 = add i64 %14, 24
  %16 = call i32 @i32_load(ptr noundef %12, i64 noundef %15)
  store i32 %16, ptr %7, align 4, !tbaa !9
  %17 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %17, ptr %5, align 4, !tbaa !9
  %18 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %18, ptr %8, align 4, !tbaa !9
  store i32 8, ptr %9, align 4, !tbaa !9
  %19 = load i32, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = add i32 %20, %19
  store i32 %21, ptr %8, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %22, ptr %4, align 4, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = icmp eq i32 %23, %24
  %26 = zext i1 %25 to i32
  store i32 %26, ptr %7, align 4, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %39

29:                                               ; preds = %2
  %30 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %30, ptr %7, align 4, !tbaa !9
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.w2c_hermes, ptr %31, i32 0, i32 6
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = call i32 @i32_load(ptr noundef %32, i64 noundef %34)
  store i32 %35, ptr %7, align 4, !tbaa !9
  store i32 16, ptr %8, align 4, !tbaa !9
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = add i32 %37, %36
  store i32 %38, ptr %7, align 4, !tbaa !9
  br label %59

39:                                               ; preds = %2
  %40 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %40, ptr %7, align 4, !tbaa !9
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 0
  %43 = xor i1 %42, true
  %44 = zext i1 %43 to i32
  store i32 %44, ptr %7, align 4, !tbaa !9
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %39
  br label %129

48:                                               ; preds = %39
  %49 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %49, ptr %7, align 4, !tbaa !9
  %50 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %50, ptr %4, align 4, !tbaa !9
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.w2c_hermes, ptr %51, i32 0, i32 6
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = call i32 @i32_load(ptr noundef %52, i64 noundef %54)
  store i32 %55, ptr %7, align 4, !tbaa !9
  store i32 20, ptr %8, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = add i32 %57, %56
  store i32 %58, ptr %7, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %48, %29
  %60 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %60, ptr %6, align 4, !tbaa !9
  %61 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %61, ptr %7, align 4, !tbaa !9
  %62 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %62, ptr %8, align 4, !tbaa !9
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.w2c_hermes, ptr %63, i32 0, i32 6
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = call i32 @i32_load(ptr noundef %64, i64 noundef %66)
  store i32 %67, ptr %8, align 4, !tbaa !9
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.w2c_hermes, ptr %69, i32 0, i32 7
  %71 = getelementptr inbounds %struct.wasm_rt_funcref_table_t, ptr %70, i32 0, i32 2
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = icmp ult i32 %68, %72
  br i1 %73, label %74, label %97

74:                                               ; preds = %59
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.w2c_hermes, ptr %75, i32 0, i32 7
  %77 = getelementptr inbounds %struct.wasm_rt_funcref_table_t, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %78, i64 %80
  %82 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %81, i32 0, i32 1
  %83 = load ptr, ptr %82, align 8, !tbaa !18
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %97

85:                                               ; preds = %74
  %86 = load ptr, ptr @w2c_hermes_t3, align 8, !tbaa !5
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.w2c_hermes, ptr %87, i32 0, i32 7
  %89 = getelementptr inbounds %struct.wasm_rt_funcref_table_t, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !17
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %90, i64 %92
  %94 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !20
  %96 = call zeroext i1 @func_types_eq(ptr noundef %86, ptr noundef %95)
  br label %97

97:                                               ; preds = %85, %74, %59
  %98 = phi i1 [ false, %74 ], [ false, %59 ], [ %96, %85 ]
  %99 = xor i1 %98, true
  %100 = xor i1 %99, true
  %101 = zext i1 %100 to i32
  %102 = sext i32 %101 to i64
  %103 = call i64 @llvm.expect.i64(i64 %102, i64 1)
  %104 = icmp ne i64 %103, 0
  br i1 %104, label %107, label %105

105:                                              ; preds = %97
  call void @wasm_rt_trap(i32 noundef 6) #6
  unreachable

106:                                              ; No predecessors!
  br label %107

107:                                              ; preds = %106, %97
  %108 = phi i1 [ true, %97 ], [ false, %106 ]
  %109 = zext i1 %108 to i32
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.w2c_hermes, ptr %110, i32 0, i32 7
  %112 = getelementptr inbounds %struct.wasm_rt_funcref_table_t, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !17
  %114 = load i32, ptr %8, align 4, !tbaa !9
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %113, i64 %115
  %117 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %116, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !18
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.w2c_hermes, ptr %119, i32 0, i32 7
  %121 = getelementptr inbounds %struct.wasm_rt_funcref_table_t, ptr %120, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = load i32, ptr %8, align 4, !tbaa !9
  %124 = zext i32 %123 to i64
  %125 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %122, i64 %124
  %126 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %125, i32 0, i32 2
  %127 = load ptr, ptr %126, align 8, !tbaa !21
  %128 = load i32, ptr %7, align 4, !tbaa !9
  call void %118(ptr noundef %127, i32 noundef %128)
  br label %129

129:                                              ; preds = %107, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, 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 void
}

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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { 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 #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}
!11 = !{!12, !10, i64 92}
!12 = !{!"w2c_hermes", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 40, !16, i64 80}
!13 = !{!"", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !15, i64 32}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}
!17 = !{!12, !6, i64 80}
!18 = !{!19, !6, i64 8}
!19 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!19, !6, i64 0}
!21 = !{!19, !6, i64 16}


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

%struct.wasm_rt_funcref_t = type { ptr, ptr, ptr }

@w2c_hermes_t3 = external local_unnamed_addr constant ptr, align 8

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @func_types_eq(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_std0x3A0x3A_0x5F20x3A0x3A_0x5Ffunction0x3A0x3A_0x5Ffunc0x3Cstd0x3A0x3A_0x5F20x3A0x3Afunction0x3Cbool0x200x28hermes0x3A0x3AFunction0x20const0x2A0x290x3E0x2C0x20std0x3A0x3A_0x5F20x3A0x3Aallocator0x3Cstd0x3A0x3A_0x5F20x3A0x3Afunction0x3Cbool0x200x28hermes0x3A0x3AFunction0x20const0x2A0x290x3E0x3E0x2C0x20bool0x200x28hermes0x3A0x3AFunction0x2A0x290x3E0x3A0x3Adestroy0x280x29(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = zext i32 %1 to i64
  %5 = add nuw nsw i64 %4, 24
  %6 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %5)
  %7 = add i32 %1, 8
  %8 = icmp eq i32 %6, %7
  br i1 %8, label %10, label %9

9:                                                ; preds = %2
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %37, label %10

10:                                               ; preds = %9, %2
  %.sink45 = phi i32 [ 16, %2 ], [ 20, %9 ]
  %11 = zext i32 %6 to i64
  %12 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %11)
  %13 = add i32 %12, %.sink45
  %14 = zext i32 %13 to i64
  %15 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %14)
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  %17 = getelementptr inbounds i8, ptr %0, i64 92
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp ult i32 %15, %18
  br i1 %19, label %20, label %.critedge, !prof !15

20:                                               ; preds = %10
  %21 = load ptr, ptr %16, align 8, !tbaa !16
  %22 = zext i32 %15 to i64
  %23 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %21, i64 %22
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !17
  %.not44 = icmp eq ptr %25, null
  br i1 %.not44, label %.critedge, label %26, !prof !19

26:                                               ; preds = %20
  %27 = load ptr, ptr @w2c_hermes_t3, align 8, !tbaa !20
  %28 = load ptr, ptr %23, align 8, !tbaa !21
  %29 = tail call zeroext i1 @func_types_eq(ptr noundef %27, ptr noundef %28)
  br i1 %29, label %30, label %.critedge, !prof !15

.critedge:                                        ; preds = %20, %10, %26
  tail call void @wasm_rt_trap(i32 noundef 6) #3
  unreachable

30:                                               ; preds = %26
  %31 = load ptr, ptr %16, align 8, !tbaa !16
  %32 = getelementptr inbounds %struct.wasm_rt_funcref_t, ptr %31, i64 %22
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  %35 = getelementptr inbounds i8, ptr %32, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !22
  tail call void %34(ptr noundef %36, i32 noundef %6) #4
  br label %37

37:                                               ; preds = %9, %30
  ret void
}

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 = { 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 = { noreturn nounwind }
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, !10, i64 92}
!6 = !{!"w2c_hermes", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !11, i64 40, !14, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"", !7, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32}
!12 = !{!"long", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}
!15 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!16 = !{!6, !7, i64 80}
!17 = !{!18, !7, i64 8}
!18 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!19 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!20 = !{!7, !7, i64 0}
!21 = !{!18, !7, i64 0}
!22 = !{!18, !7, i64 16}


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