; 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: 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 void @i64_store(ptr noundef, i64 noundef, i64 noundef) #1

declare i32 @w2c_hermes_0x5F_memset(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3AAPInt0x3A0x3AtcSetLeastSignificantBits0x28unsigned0x20long0x20long0x2A0x2C0x20unsigned0x20int0x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #3 {
  %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 i64, align 8
  %16 = alloca i64, align 8
  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) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  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 4, 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
  %17 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %17, ptr %11, align 4, !tbaa !9
  store i32 65, 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 uge 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 %65

24:                                               ; preds = %4
  %25 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %25, ptr %11, align 4, !tbaa !9
  store i32 255, ptr %12, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %26, ptr %13, align 4, !tbaa !9
  store i32 65, ptr %14, align 4, !tbaa !9
  %27 = load i32, ptr %14, align 4, !tbaa !9
  %28 = load i32, ptr %13, align 4, !tbaa !9
  %29 = sub i32 %28, %27
  store i32 %29, ptr %13, align 4, !tbaa !9
  %30 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %30, ptr %10, align 4, !tbaa !9
  store i32 6, ptr %14, align 4, !tbaa !9
  %31 = load i32, ptr %14, align 4, !tbaa !9
  %32 = and i32 %31, 31
  %33 = load i32, ptr %13, align 4, !tbaa !9
  %34 = lshr i32 %33, %32
  store i32 %34, ptr %13, align 4, !tbaa !9
  %35 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %35, ptr %9, align 4, !tbaa !9
  store i32 3, ptr %14, align 4, !tbaa !9
  %36 = load i32, ptr %14, align 4, !tbaa !9
  %37 = and i32 %36, 31
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = shl i32 %38, %37
  store i32 %39, ptr %13, align 4, !tbaa !9
  store i32 8, ptr %14, align 4, !tbaa !9
  %40 = load i32, ptr %14, align 4, !tbaa !9
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = add i32 %41, %40
  store i32 %42, ptr %13, align 4, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = load i32, ptr %12, align 4, !tbaa !9
  %46 = load i32, ptr %13, align 4, !tbaa !9
  %47 = call i32 @w2c_hermes_0x5F_memset(ptr noundef %43, i32 noundef %44, i32 noundef %45, i32 noundef %46)
  store i32 %47, ptr %11, align 4, !tbaa !9
  %48 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %48, ptr %11, align 4, !tbaa !9
  store i32 1, ptr %12, align 4, !tbaa !9
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = add i32 %50, %49
  store i32 %51, ptr %11, align 4, !tbaa !9
  %52 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %52, ptr %9, align 4, !tbaa !9
  %53 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %53, ptr %11, align 4, !tbaa !9
  %54 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %54, ptr %12, align 4, !tbaa !9
  store i32 -64, ptr %13, align 4, !tbaa !9
  %55 = load i32, ptr %13, align 4, !tbaa !9
  %56 = load i32, ptr %12, align 4, !tbaa !9
  %57 = and i32 %56, %55
  store i32 %57, ptr %12, align 4, !tbaa !9
  %58 = load i32, ptr %12, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = sub i32 %59, %58
  store i32 %60, ptr %11, align 4, !tbaa !9
  store i32 -64, ptr %12, align 4, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = add i32 %62, %61
  store i32 %63, ptr %11, align 4, !tbaa !9
  %64 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %64, ptr %8, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %24, %4
  %66 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %66, ptr %11, align 4, !tbaa !9
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %99

69:                                               ; preds = %65
  %70 = load i32, ptr %6, align 4, !tbaa !9
  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
  store i32 3, ptr %13, align 4, !tbaa !9
  %72 = load i32, ptr %13, align 4, !tbaa !9
  %73 = and i32 %72, 31
  %74 = load i32, ptr %12, align 4, !tbaa !9
  %75 = shl i32 %74, %73
  store i32 %75, ptr %12, align 4, !tbaa !9
  %76 = load i32, ptr %12, align 4, !tbaa !9
  %77 = load i32, ptr %11, align 4, !tbaa !9
  %78 = add i32 %77, %76
  store i32 %78, ptr %11, align 4, !tbaa !9
  store i64 -1, ptr %15, align 8, !tbaa !11
  store i32 64, ptr %13, align 4, !tbaa !9
  %79 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %79, ptr %14, align 4, !tbaa !9
  %80 = load i32, ptr %14, align 4, !tbaa !9
  %81 = load i32, ptr %13, align 4, !tbaa !9
  %82 = sub i32 %81, %80
  store i32 %82, ptr %13, align 4, !tbaa !9
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  store i64 %84, ptr %16, align 8, !tbaa !11
  %85 = load i64, ptr %16, align 8, !tbaa !11
  %86 = and i64 %85, 63
  %87 = load i64, ptr %15, align 8, !tbaa !11
  %88 = lshr i64 %87, %86
  store i64 %88, ptr %15, align 8, !tbaa !11
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.w2c_hermes, ptr %89, i32 0, i32 6
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = zext i32 %91 to i64
  %93 = load i64, ptr %15, align 8, !tbaa !11
  call void @i64_store(ptr noundef %90, i64 noundef %92, i64 noundef %93)
  %94 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %94, ptr %11, align 4, !tbaa !9
  store i32 1, ptr %12, align 4, !tbaa !9
  %95 = load i32, ptr %12, align 4, !tbaa !9
  %96 = load i32, ptr %11, align 4, !tbaa !9
  %97 = add i32 %96, %95
  store i32 %97, ptr %11, align 4, !tbaa !9
  %98 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %98, ptr %9, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %69, %65
  %100 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %100, ptr %11, align 4, !tbaa !9
  %101 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %101, ptr %12, align 4, !tbaa !9
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = load i32, ptr %12, align 4, !tbaa !9
  %104 = icmp ugt i32 %102, %103
  %105 = zext i1 %104 to i32
  store i32 %105, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %132

108:                                              ; preds = %99
  %109 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %109, ptr %11, align 4, !tbaa !9
  %110 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %110, ptr %12, align 4, !tbaa !9
  store i32 3, ptr %13, align 4, !tbaa !9
  %111 = load i32, ptr %13, align 4, !tbaa !9
  %112 = and i32 %111, 31
  %113 = load i32, ptr %12, align 4, !tbaa !9
  %114 = shl i32 %113, %112
  store i32 %114, ptr %12, align 4, !tbaa !9
  %115 = load i32, ptr %12, align 4, !tbaa !9
  %116 = load i32, ptr %11, align 4, !tbaa !9
  %117 = add i32 %116, %115
  store i32 %117, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %12, align 4, !tbaa !9
  %118 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %118, ptr %13, align 4, !tbaa !9
  %119 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %119, ptr %14, align 4, !tbaa !9
  %120 = load i32, ptr %14, align 4, !tbaa !9
  %121 = load i32, ptr %13, align 4, !tbaa !9
  %122 = sub i32 %121, %120
  store i32 %122, ptr %13, align 4, !tbaa !9
  store i32 3, ptr %14, align 4, !tbaa !9
  %123 = load i32, ptr %14, align 4, !tbaa !9
  %124 = and i32 %123, 31
  %125 = load i32, ptr %13, align 4, !tbaa !9
  %126 = shl i32 %125, %124
  store i32 %126, ptr %13, align 4, !tbaa !9
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = load i32, ptr %11, align 4, !tbaa !9
  %129 = load i32, ptr %12, align 4, !tbaa !9
  %130 = load i32, ptr %13, align 4, !tbaa !9
  %131 = call i32 @w2c_hermes_0x5F_memset(ptr noundef %127, i32 noundef %128, i32 noundef %129, i32 noundef %130)
  store i32 %131, ptr %11, align 4, !tbaa !9
  br label %132

132:                                              ; preds = %108, %99
  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 4, 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 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #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}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !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 void @i64_store(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

declare i32 @w2c_hermes_0x5F_memset(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3AAPInt0x3A0x3AtcSetLeastSignificantBits0x28unsigned0x20long0x20long0x2A0x2C0x20unsigned0x20int0x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = icmp ugt i32 %3, 64
  br i1 %5, label %6, label %16

6:                                                ; preds = %4
  %7 = add i32 %3, -65
  %8 = lshr i32 %7, 6
  %9 = shl nuw nsw i32 %8, 3
  %10 = add nuw nsw i32 %9, 8
  %11 = tail call i32 @w2c_hermes_0x5F_memset(ptr noundef %0, i32 noundef %1, i32 noundef 255, i32 noundef %10) #3
  %12 = add nuw nsw i32 %8, 1
  %13 = and i32 %7, -64
  %14 = add i32 %3, -64
  %15 = sub i32 %14, %13
  br label %16

16:                                               ; preds = %6, %4
  %.074 = phi i32 [ %12, %6 ], [ 0, %4 ]
  %.0 = phi i32 [ %15, %6 ], [ %3, %4 ]
  %.not = icmp eq i32 %.0, 0
  br i1 %.not, label %27, label %17

17:                                               ; preds = %16
  %18 = shl nuw nsw i32 %.074, 3
  %19 = add i32 %18, %1
  %20 = sub i32 0, %.0
  %21 = and i32 %20, 63
  %22 = zext nneg i32 %21 to i64
  %23 = lshr i64 -1, %22
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = zext i32 %19 to i64
  tail call void @i64_store(ptr noundef nonnull %24, i64 noundef %25, i64 noundef %23)
  %26 = add nuw nsw i32 %.074, 1
  br label %27

27:                                               ; preds = %17, %16
  %.1 = phi i32 [ %26, %17 ], [ %.074, %16 ]
  %28 = icmp ult i32 %.1, %2
  br i1 %28, label %29, label %35

29:                                               ; preds = %27
  %30 = shl nuw nsw i32 %.1, 3
  %31 = add i32 %30, %1
  %32 = sub i32 %2, %.1
  %33 = shl i32 %32, 3
  %34 = tail call i32 @w2c_hermes_0x5F_memset(ptr noundef %0, i32 noundef %31, i32 noundef 0, i32 noundef %33) #3
  br label %35

35:                                               ; preds = %29, %27
  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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,TailCallElimPass