; 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

declare void @w2c_hermes_dlfree(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3ADenseMapBase0x3Cllvh0x3A0x3ADenseMap0x3Chermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x2C0x20llvh0x3A0x3ADenseMapInfo0x3Chermes0x3A0x3ABasicBlock0x2A0x3E0x2C0x20llvh0x3A0x3Adetail0x3A0x3ADenseMapPair0x3Chermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x3E0x3E0x2C0x20hermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x2C0x20llvh0x3A0x3ADenseMapInfo0x3Chermes0x3A0x3ABasicBlock0x2A0x3E0x2C0x20llvh0x3A0x3Adetail0x3A0x3ADenseMapPair0x3Chermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x3E0x3E0x3A0x3AdestroyAll0x280x29(ptr noundef %0, i32 noundef %1) #3 {
  %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
  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) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %9 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %9, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.w2c_hermes, ptr %10, i32 0, i32 6
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = add i64 %13, 12
  %15 = call i32 @i32_load(ptr noundef %11, i64 noundef %14)
  store i32 %15, ptr %6, align 4, !tbaa !9
  %16 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %16, ptr %5, align 4, !tbaa !9
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %114

19:                                               ; preds = %2
  %20 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %20, ptr %6, align 4, !tbaa !9
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.w2c_hermes, ptr %21, i32 0, i32 6
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = call i32 @i32_load(ptr noundef %22, i64 noundef %24)
  store i32 %25, ptr %6, align 4, !tbaa !9
  %26 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %26, ptr %4, align 4, !tbaa !9
  %27 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %27, ptr %7, align 4, !tbaa !9
  store i32 6, ptr %8, align 4, !tbaa !9
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = and i32 %28, 31
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = shl i32 %30, %29
  store i32 %31, ptr %7, align 4, !tbaa !9
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = add i32 %33, %32
  store i32 %34, ptr %6, align 4, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %35, ptr %5, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %112, %19
  %37 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %37, ptr %6, align 4, !tbaa !9
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.w2c_hermes, ptr %38, i32 0, i32 6
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = zext i32 %40 to i64
  %42 = call i32 @i32_load(ptr noundef %39, i64 noundef %41)
  store i32 %42, ptr %6, align 4, !tbaa !9
  store i32 8, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = add i32 %44, %43
  store i32 %45, ptr %6, align 4, !tbaa !9
  %46 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %46, label %52 [
    i32 0, label %47
    i32 1, label %48
    i32 2, label %49
    i32 3, label %50
    i32 4, label %51
  ]

47:                                               ; preds = %36
  br label %99

48:                                               ; preds = %36
  br label %53

49:                                               ; preds = %36
  br label %53

50:                                               ; preds = %36
  br label %53

51:                                               ; preds = %36
  br label %99

52:                                               ; preds = %36
  br label %53

53:                                               ; preds = %52, %50, %49, %48
  %54 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %54, ptr %6, align 4, !tbaa !9
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.w2c_hermes, ptr %55, i32 0, i32 6
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = zext i32 %57 to i64
  %59 = add i64 %58, 52
  %60 = call i32 @i32_load(ptr noundef %56, i64 noundef %59)
  store i32 %60, ptr %6, align 4, !tbaa !9
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !9
  call void @w2c_hermes_dlfree(ptr noundef %61, i32 noundef %62)
  %63 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %63, ptr %6, 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 %6, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = add i64 %67, 40
  %69 = call i32 @i32_load(ptr noundef %65, i64 noundef %68)
  store i32 %69, ptr %6, align 4, !tbaa !9
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = load i32, ptr %6, align 4, !tbaa !9
  call void @w2c_hermes_dlfree(ptr noundef %70, i32 noundef %71)
  %72 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %72, ptr %6, align 4, !tbaa !9
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.w2c_hermes, ptr %73, i32 0, i32 6
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = add i64 %76, 28
  %78 = call i32 @i32_load(ptr noundef %74, i64 noundef %77)
  store i32 %78, ptr %6, align 4, !tbaa !9
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = load i32, ptr %6, align 4, !tbaa !9
  call void @w2c_hermes_dlfree(ptr noundef %79, i32 noundef %80)
  %81 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %81, ptr %6, align 4, !tbaa !9
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.w2c_hermes, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = add i64 %85, 16
  %87 = call i32 @i32_load(ptr noundef %83, i64 noundef %86)
  store i32 %87, ptr %6, align 4, !tbaa !9
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = load i32, ptr %6, align 4, !tbaa !9
  call void @w2c_hermes_dlfree(ptr noundef %88, i32 noundef %89)
  %90 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %90, ptr %6, align 4, !tbaa !9
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.w2c_hermes, ptr %91, i32 0, i32 6
  %93 = load i32, ptr %6, align 4, !tbaa !9
  %94 = zext i32 %93 to i64
  %95 = add i64 %94, 4
  %96 = call i32 @i32_load(ptr noundef %92, i64 noundef %95)
  store i32 %96, ptr %6, align 4, !tbaa !9
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = load i32, ptr %6, align 4, !tbaa !9
  call void @w2c_hermes_dlfree(ptr noundef %97, i32 noundef %98)
  br label %99

99:                                               ; preds = %53, %51, %47
  %100 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %100, ptr %6, align 4, !tbaa !9
  store i32 -64, ptr %7, align 4, !tbaa !9
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = load i32, ptr %6, align 4, !tbaa !9
  %103 = sub i32 %102, %101
  store i32 %103, ptr %6, align 4, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %104, ptr %4, align 4, !tbaa !9
  %105 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %105, ptr %7, align 4, !tbaa !9
  %106 = load i32, ptr %6, align 4, !tbaa !9
  %107 = load i32, ptr %7, align 4, !tbaa !9
  %108 = icmp ne i32 %106, %107
  %109 = zext i1 %108 to i32
  store i32 %109, ptr %6, align 4, !tbaa !9
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %113

112:                                              ; preds = %99
  br label %36

113:                                              ; preds = %99
  br label %114

114:                                              ; preds = %113, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  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 = { "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 }

!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

declare void @w2c_hermes_dlfree(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3ADenseMapBase0x3Cllvh0x3A0x3ADenseMap0x3Chermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x2C0x20llvh0x3A0x3ADenseMapInfo0x3Chermes0x3A0x3ABasicBlock0x2A0x3E0x2C0x20llvh0x3A0x3Adetail0x3A0x3ADenseMapPair0x3Chermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x3E0x3E0x2C0x20hermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x2C0x20llvh0x3A0x3ADenseMapInfo0x3Chermes0x3A0x3ABasicBlock0x2A0x3E0x2C0x20llvh0x3A0x3Adetail0x3A0x3ADenseMapPair0x3Chermes0x3A0x3ABasicBlock0x2A0x2C0x20hermes0x3A0x3ARegisterAllocator0x3A0x3ABlockLifetimeInfo0x3E0x3E0x3A0x3AdestroyAll0x280x29(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, 12
  %6 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %5)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %.loopexit, label %7

7:                                                ; preds = %2
  %8 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %4)
  %9 = shl i32 %6, 6
  %10 = add i32 %8, %9
  br label %11

11:                                               ; preds = %25, %7
  %.0 = phi i32 [ %8, %7 ], [ %26, %25 ]
  %12 = zext i32 %.0 to i64
  %13 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %12)
  switch i32 %13, label %14 [
    i32 -8, label %25
    i32 -4, label %25
  ]

14:                                               ; preds = %11
  %15 = add nuw nsw i64 %12, 52
  %16 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %15)
  tail call void @w2c_hermes_dlfree(ptr noundef %0, i32 noundef %16) #3
  %17 = add nuw nsw i64 %12, 40
  %18 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %17)
  tail call void @w2c_hermes_dlfree(ptr noundef %0, i32 noundef %18) #3
  %19 = add nuw nsw i64 %12, 28
  %20 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %19)
  tail call void @w2c_hermes_dlfree(ptr noundef %0, i32 noundef %20) #3
  %21 = add nuw nsw i64 %12, 16
  %22 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %21)
  tail call void @w2c_hermes_dlfree(ptr noundef %0, i32 noundef %22) #3
  %23 = add nuw nsw i64 %12, 4
  %24 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %23)
  tail call void @w2c_hermes_dlfree(ptr noundef %0, i32 noundef %24) #3
  br label %25

25:                                               ; preds = %11, %11, %14
  %26 = add i32 %.0, 64
  %.not55 = icmp eq i32 %26, %10
  br i1 %.not55, label %.loopexit, label %11

.loopexit:                                        ; preds = %25, %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 = { "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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass