; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_opt_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

declare i32 @w2c_hermes_0x5F_memcpy(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i32_store8(ptr noundef, i64 noundef, i32 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @i32_store(ptr noundef, i64 noundef, i32 noundef) #2

; 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
define dso_local void @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Acopy_to_buffer0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(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
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %12 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %12, ptr %9, align 4, !tbaa !9
  %13 = load i32, ptr %9, align 4, !tbaa !9
  switch i32 %13, label %19 [
    i32 0, label %14
    i32 1, label %15
    i32 2, label %16
    i32 3, label %17
    i32 4, label %18
  ]

14:                                               ; preds = %4
  br label %117

15:                                               ; preds = %4
  br label %83

16:                                               ; preds = %4
  br label %62

17:                                               ; preds = %4
  br label %41

18:                                               ; preds = %4
  br label %20

19:                                               ; preds = %4
  br label %102

20:                                               ; preds = %18
  %21 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %21, ptr %9, align 4, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.w2c_hermes, ptr %22, i32 0, i32 6
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = add i64 %25, 12
  %27 = call i32 @i32_load(ptr noundef %23, i64 noundef %26)
  store i32 %27, ptr %9, align 4, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %28, ptr %10, align 4, !tbaa !9
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.w2c_hermes, ptr %29, i32 0, i32 6
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = add i64 %32, 3
  %34 = call i32 @i32_load8_u(ptr noundef %30, i64 noundef %33)
  store i32 %34, ptr %10, align 4, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.w2c_hermes, ptr %35, i32 0, i32 6
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = add i64 %38, 3
  %40 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store8(ptr noundef %36, i64 noundef %39, i32 noundef %40)
  br label %41

41:                                               ; preds = %20, %17
  %42 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %42, ptr %9, align 4, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.w2c_hermes, ptr %43, i32 0, i32 6
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = add i64 %46, 12
  %48 = call i32 @i32_load(ptr noundef %44, i64 noundef %47)
  store i32 %48, ptr %9, align 4, !tbaa !9
  %49 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %49, ptr %10, align 4, !tbaa !9
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.w2c_hermes, ptr %50, i32 0, i32 6
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = add i64 %53, 2
  %55 = call i32 @i32_load8_u(ptr noundef %51, i64 noundef %54)
  store i32 %55, ptr %10, align 4, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.w2c_hermes, ptr %56, i32 0, i32 6
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = add i64 %59, 2
  %61 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store8(ptr noundef %57, i64 noundef %60, i32 noundef %61)
  br label %62

62:                                               ; preds = %41, %16
  %63 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %63, ptr %9, align 4, !tbaa !9
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.w2c_hermes, ptr %64, i32 0, i32 6
  %66 = load i32, ptr %9, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = add i64 %67, 12
  %69 = call i32 @i32_load(ptr noundef %65, i64 noundef %68)
  store i32 %69, ptr %9, align 4, !tbaa !9
  %70 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %70, ptr %10, align 4, !tbaa !9
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.w2c_hermes, ptr %71, i32 0, i32 6
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = add i64 %74, 1
  %76 = call i32 @i32_load8_u(ptr noundef %72, i64 noundef %75)
  store i32 %76, ptr %10, align 4, !tbaa !9
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.w2c_hermes, ptr %77, i32 0, i32 6
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = add i64 %80, 1
  %82 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store8(ptr noundef %78, i64 noundef %81, i32 noundef %82)
  br label %83

83:                                               ; preds = %62, %15
  %84 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %84, ptr %9, align 4, !tbaa !9
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.w2c_hermes, ptr %85, i32 0, i32 6
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = add i64 %88, 12
  %90 = call i32 @i32_load(ptr noundef %86, i64 noundef %89)
  store i32 %90, ptr %9, align 4, !tbaa !9
  %91 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %91, ptr %10, align 4, !tbaa !9
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.w2c_hermes, ptr %92, i32 0, i32 6
  %94 = load i32, ptr %10, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = call i32 @i32_load8_u(ptr noundef %93, i64 noundef %95)
  store i32 %96, ptr %10, align 4, !tbaa !9
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.w2c_hermes, ptr %97, i32 0, i32 6
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store8(ptr noundef %98, i64 noundef %100, i32 noundef %101)
  br label %117

102:                                              ; preds = %19
  %103 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %103, ptr %9, align 4, !tbaa !9
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.w2c_hermes, ptr %104, i32 0, i32 6
  %106 = load i32, ptr %9, align 4, !tbaa !9
  %107 = zext i32 %106 to i64
  %108 = add i64 %107, 12
  %109 = call i32 @i32_load(ptr noundef %105, i64 noundef %108)
  store i32 %109, ptr %9, align 4, !tbaa !9
  %110 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %110, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %111, ptr %11, align 4, !tbaa !9
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = load i32, ptr %9, align 4, !tbaa !9
  %114 = load i32, ptr %10, align 4, !tbaa !9
  %115 = load i32, ptr %11, align 4, !tbaa !9
  %116 = call i32 @w2c_hermes_0x5F_memcpy(ptr noundef %112, i32 noundef %113, i32 noundef %114, i32 noundef %115)
  store i32 %116, ptr %9, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %102, %83, %14
  %118 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %118, ptr %9, align 4, !tbaa !9
  %119 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %119, ptr %10, align 4, !tbaa !9
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.w2c_hermes, ptr %120, i32 0, i32 6
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = zext i32 %122 to i64
  %124 = add i64 %123, 12
  %125 = call i32 @i32_load(ptr noundef %121, i64 noundef %124)
  store i32 %125, ptr %10, align 4, !tbaa !9
  %126 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %126, ptr %11, align 4, !tbaa !9
  %127 = load i32, ptr %11, align 4, !tbaa !9
  %128 = load i32, ptr %10, align 4, !tbaa !9
  %129 = add i32 %128, %127
  store i32 %129, ptr %10, align 4, !tbaa !9
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.w2c_hermes, ptr %130, i32 0, i32 6
  %132 = load i32, ptr %9, align 4, !tbaa !9
  %133 = zext i32 %132 to i64
  %134 = add i64 %133, 12
  %135 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %131, i64 noundef %134, i32 noundef %135)
  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 = { "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 = { 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 #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"

declare i32 @w2c_hermes_0x5F_memcpy(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Acopy_to_buffer0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  switch i32 %3, label %34 [
    i32 0, label %._crit_edge58
    i32 1, label %._crit_edge57
    i32 2, label %._crit_edge56
    i32 3, label %._crit_edge
    i32 4, label %5
  ]

._crit_edge58:                                    ; preds = %4
  %.pre = zext i32 %1 to i64
  %.pre59 = add nuw nsw i64 %.pre, 12
  br label %40

._crit_edge57:                                    ; preds = %4
  %.pre61 = zext i32 %1 to i64
  %.pre63 = add nuw nsw i64 %.pre61, 12
  %.pre65 = zext i32 %2 to i64
  br label %29

._crit_edge56:                                    ; preds = %4
  %.pre67 = zext i32 %1 to i64
  %.pre69 = add nuw nsw i64 %.pre67, 12
  %.pre71 = zext i32 %2 to i64
  br label %22

._crit_edge:                                      ; preds = %4
  %.pre73 = zext i32 %1 to i64
  %.pre75 = add nuw nsw i64 %.pre73, 12
  %.pre77 = zext i32 %2 to i64
  br label %15

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = zext i32 %1 to i64
  %8 = add nuw nsw i64 %7, 12
  %9 = tail call i32 @i32_load(ptr noundef nonnull %6, i64 noundef %8)
  %10 = zext i32 %2 to i64
  %11 = add nuw nsw i64 %10, 3
  %12 = tail call i32 @i32_load8_u(ptr noundef nonnull %6, i64 noundef %11)
  %13 = zext i32 %9 to i64
  %14 = add nuw nsw i64 %13, 3
  tail call void @i32_store8(ptr noundef nonnull %6, i64 noundef %14, i32 noundef %12)
  br label %15

15:                                               ; preds = %._crit_edge, %5
  %.pre-phi78 = phi i64 [ %.pre77, %._crit_edge ], [ %10, %5 ]
  %.pre-phi76 = phi i64 [ %.pre75, %._crit_edge ], [ %8, %5 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  %17 = tail call i32 @i32_load(ptr noundef nonnull %16, i64 noundef %.pre-phi76)
  %18 = add nuw nsw i64 %.pre-phi78, 2
  %19 = tail call i32 @i32_load8_u(ptr noundef nonnull %16, i64 noundef %18)
  %20 = zext i32 %17 to i64
  %21 = add nuw nsw i64 %20, 2
  tail call void @i32_store8(ptr noundef nonnull %16, i64 noundef %21, i32 noundef %19)
  br label %22

22:                                               ; preds = %._crit_edge56, %15
  %.pre-phi72 = phi i64 [ %.pre71, %._crit_edge56 ], [ %.pre-phi78, %15 ]
  %.pre-phi70 = phi i64 [ %.pre69, %._crit_edge56 ], [ %.pre-phi76, %15 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = tail call i32 @i32_load(ptr noundef nonnull %23, i64 noundef %.pre-phi70)
  %25 = add nuw nsw i64 %.pre-phi72, 1
  %26 = tail call i32 @i32_load8_u(ptr noundef nonnull %23, i64 noundef %25)
  %27 = zext i32 %24 to i64
  %28 = add nuw nsw i64 %27, 1
  tail call void @i32_store8(ptr noundef nonnull %23, i64 noundef %28, i32 noundef %26)
  br label %29

29:                                               ; preds = %._crit_edge57, %22
  %.pre-phi66 = phi i64 [ %.pre65, %._crit_edge57 ], [ %.pre-phi72, %22 ]
  %.pre-phi64 = phi i64 [ %.pre63, %._crit_edge57 ], [ %.pre-phi70, %22 ]
  %30 = getelementptr inbounds i8, ptr %0, i64 40
  %31 = tail call i32 @i32_load(ptr noundef nonnull %30, i64 noundef %.pre-phi64)
  %32 = tail call i32 @i32_load8_u(ptr noundef nonnull %30, i64 noundef %.pre-phi66)
  %33 = zext i32 %31 to i64
  tail call void @i32_store8(ptr noundef nonnull %30, i64 noundef %33, i32 noundef %32)
  br label %40

34:                                               ; preds = %4
  %35 = getelementptr inbounds i8, ptr %0, i64 40
  %36 = zext i32 %1 to i64
  %37 = add nuw nsw i64 %36, 12
  %38 = tail call i32 @i32_load(ptr noundef nonnull %35, i64 noundef %37)
  %39 = tail call i32 @w2c_hermes_0x5F_memcpy(ptr noundef %0, i32 noundef %38, i32 noundef %2, i32 noundef %3) #3
  br label %40

40:                                               ; preds = %._crit_edge58, %34, %29
  %.pre-phi60 = phi i64 [ %.pre59, %._crit_edge58 ], [ %37, %34 ], [ %.pre-phi64, %29 ]
  %41 = getelementptr inbounds i8, ptr %0, i64 40
  %42 = tail call i32 @i32_load(ptr noundef nonnull %41, i64 noundef %.pre-phi60)
  %43 = add i32 %42, %3
  tail call void @i32_store(ptr noundef nonnull %41, i64 noundef %.pre-phi60, i32 noundef %43)
  ret void
}

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


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