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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i32_store(ptr noundef, i64 noundef, i32 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: nounwind uwtable
declare dso_local void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @i32_load8_s(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3Aobject_deleter0x3Cstd0x3A0x3A_0x5F20x3A0x3Avector0x3Cstd0x3A0x3A_0x5F20x3A0x3Abasic_string0x3Cchar0x2C0x20std0x3A0x3A_0x5F20x3A0x3Achar_traits0x3Cchar0x3E0x2C0x20std0x3A0x3A_0x5F20x3A0x3Aallocator0x3Cchar0x3E0x3E0x2C0x20std0x3A0x3A_0x5F20x3A0x3Aallocator0x3Cstd0x3A0x3A_0x5F20x3A0x3Abasic_string0x3Cchar0x2C0x20std0x3A0x3A_0x5F20x3A0x3Achar_traits0x3Cchar0x3E0x2C0x20std0x3A0x3A_0x5F20x3A0x3Aallocator0x3Cchar0x3E0x3E0x3E0x3E0x3E0x3A0x3Acall0x28void0x2A0x29(ptr noundef %0, i32 noundef %1) #2 {
  %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) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %10 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %10, ptr %8, align 4, !tbaa !9
  %11 = load i32, ptr %8, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %107

13:                                               ; preds = %2
  %14 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %14, ptr %8, align 4, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.w2c_hermes, ptr %15, i32 0, i32 6
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = call i32 @i32_load(ptr noundef %16, i64 noundef %18)
  store i32 %19, ptr %8, align 4, !tbaa !9
  %20 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %20, ptr %6, align 4, !tbaa !9
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %103

23:                                               ; preds = %13
  %24 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %24, ptr %8, align 4, !tbaa !9
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.w2c_hermes, ptr %25, i32 0, i32 6
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = add i64 %28, 4
  %30 = call i32 @i32_load(ptr noundef %26, i64 noundef %29)
  store i32 %30, ptr %8, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %31, ptr %7, align 4, !tbaa !9
  %32 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %32, ptr %9, align 4, !tbaa !9
  %33 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %33, ptr %5, align 4, !tbaa !9
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = icmp ne i32 %34, %35
  %37 = zext i1 %36 to i32
  store i32 %37, ptr %8, align 4, !tbaa !9
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %91

40:                                               ; preds = %23
  br label %41

41:                                               ; preds = %82, %40
  %42 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %42, ptr %8, align 4, !tbaa !9
  store i32 12, ptr %9, align 4, !tbaa !9
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = sub i32 %44, %43
  store i32 %45, ptr %8, align 4, !tbaa !9
  %46 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %46, ptr %5, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %47, ptr %8, align 4, !tbaa !9
  store i32 1, ptr %9, align 4, !tbaa !9
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = load i32, ptr %8, align 4, !tbaa !9
  %50 = sub i32 %49, %48
  store i32 %50, ptr %8, 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 %8, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = call i32 @i32_load8_s(ptr noundef %52, i64 noundef %54)
  store i32 %55, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = icmp slt i32 %56, %57
  %59 = zext i1 %58 to i32
  store i32 %59, ptr %8, align 4, !tbaa !9
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %71

62:                                               ; preds = %41
  %63 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %63, ptr %8, align 4, !tbaa !9
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.w2c_hermes, ptr %64, i32 0, i32 6
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = call i32 @i32_load(ptr noundef %65, i64 noundef %67)
  store i32 %68, ptr %8, align 4, !tbaa !9
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = load i32, ptr %8, align 4, !tbaa !9
  call void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef %69, i32 noundef %70)
  br label %71

71:                                               ; preds = %62, %41
  %72 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %72, ptr %8, align 4, !tbaa !9
  %73 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %73, ptr %7, align 4, !tbaa !9
  %74 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %74, ptr %8, align 4, !tbaa !9
  %75 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %75, ptr %9, align 4, !tbaa !9
  %76 = load i32, ptr %8, align 4, !tbaa !9
  %77 = load i32, ptr %9, align 4, !tbaa !9
  %78 = icmp ne i32 %76, %77
  %79 = zext i1 %78 to i32
  store i32 %79, ptr %8, align 4, !tbaa !9
  %80 = load i32, ptr %8, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %71
  br label %41

83:                                               ; preds = %71
  %84 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %84, ptr %8, align 4, !tbaa !9
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.w2c_hermes, ptr %85, i32 0, i32 6
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = call i32 @i32_load(ptr noundef %86, i64 noundef %88)
  store i32 %89, ptr %8, align 4, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %90, ptr %5, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %83, %23
  %92 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %92, ptr %8, align 4, !tbaa !9
  %93 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %93, ptr %9, align 4, !tbaa !9
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.w2c_hermes, ptr %94, i32 0, i32 6
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = add i64 %97, 4
  %99 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %95, i64 noundef %98, i32 noundef %99)
  %100 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %100, ptr %8, align 4, !tbaa !9
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !9
  call void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef %101, i32 noundef %102)
  br label %103

103:                                              ; preds = %91, %13
  %104 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %104, ptr %8, align 4, !tbaa !9
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !9
  call void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef %105, i32 noundef %106)
  br label %107

107:                                              ; preds = %103, %2
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  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 = { 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 = !{!"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: inlinehint nounwind uwtable
declare hidden void @i32_store(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = zext i32 %1 to i64
  %6 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %5)
  %.not59 = icmp eq i32 %6, 0
  br i1 %.not59, label %22, label %7

7:                                                ; preds = %3
  %8 = add nuw nsw i64 %5, 4
  %9 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %8)
  %.not60 = icmp eq i32 %9, %6
  br i1 %.not60, label %21, label %.preheader

.preheader:                                       ; preds = %7, %18
  %.0 = phi i32 [ %10, %18 ], [ %9, %7 ]
  %10 = add i32 %.0, -12
  %11 = add i32 %.0, -1
  %12 = zext i32 %11 to i64
  %13 = tail call i32 @i32_load8_s(ptr noundef nonnull %4, i64 noundef %12)
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %15, label %18

15:                                               ; preds = %.preheader
  %16 = zext i32 %10 to i64
  %17 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %16)
  tail call void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef %0, i32 noundef %17)
  br label %18

18:                                               ; preds = %15, %.preheader
  %.not61 = icmp eq i32 %10, %6
  br i1 %.not61, label %19, label %.preheader

19:                                               ; preds = %18
  %20 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %5)
  br label %21

21:                                               ; preds = %19, %7
  %.054 = phi i32 [ %20, %19 ], [ %6, %7 ]
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %8, i32 noundef %6)
  tail call void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef %0, i32 noundef %.054)
  br label %22

22:                                               ; preds = %21, %3
  tail call void @w2c_hermes_operator0x20delete0x28void0x2A0x29(ptr noundef %0, i32 noundef %1)
  br label %23

23:                                               ; preds = %22, %2
  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 = { 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass