; LLVM IR from facebook/hermes :: API/hermes_sandbox/external (hermes_sandbox_impl_opt_compiled_2)

; 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

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

declare i32 @w2c_hermes_0x5F_memcpy(ptr noundef, i32 noundef, i32 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 i32 @w2c_hermes_hermes0x3A0x3Aregex0x3A0x3AMatchCharNode0x3A0x3AtryCoalesceCharacters0x28llvh0x3A0x3ASmallVector0x3Cunsigned0x20int0x2C0x205u0x3E0x2A0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %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
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %13 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %13, ptr %9, align 4, !tbaa !9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.w2c_hermes, ptr %14, i32 0, i32 6
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = zext i32 %16 to i64
  %18 = add i64 %17, 4
  %19 = call i32 @i32_load(ptr noundef %15, i64 noundef %18)
  store i32 %19, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %20, ptr %7, align 4, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %21, ptr %9, align 4, !tbaa !9
  %22 = load ptr, ptr %4, 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, 8
  %27 = call i32 @i32_load(ptr noundef %23, i64 noundef %26)
  store i32 %27, ptr %9, align 4, !tbaa !9
  %28 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %28, ptr %5, align 4, !tbaa !9
  %29 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %29, ptr %10, align 4, !tbaa !9
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.w2c_hermes, ptr %30, i32 0, i32 6
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = add i64 %33, 8
  %35 = call i32 @i32_load(ptr noundef %31, i64 noundef %34)
  store i32 %35, ptr %10, align 4, !tbaa !9
  %36 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %36, ptr %11, align 4, !tbaa !9
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.w2c_hermes, ptr %37, i32 0, i32 6
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = add i64 %40, 4
  %42 = call i32 @i32_load(ptr noundef %38, i64 noundef %41)
  store i32 %42, ptr %11, align 4, !tbaa !9
  %43 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %43, ptr %8, align 4, !tbaa !9
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = sub i32 %45, %44
  store i32 %46, ptr %10, align 4, !tbaa !9
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = icmp ugt i32 %47, %48
  %50 = zext i1 %49 to i32
  store i32 %50, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %69

53:                                               ; preds = %3
  %54 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %54, ptr %9, align 4, !tbaa !9
  %55 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %55, ptr %10, align 4, !tbaa !9
  store i32 12, ptr %11, align 4, !tbaa !9
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = add i32 %57, %56
  store i32 %58, ptr %10, align 4, !tbaa !9
  %59 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %59, ptr %11, align 4, !tbaa !9
  %60 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %60, 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
  store i32 4, ptr %12, align 4, !tbaa !9
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_llvh0x3A0x3ASmallVectorBase0x3A0x3Agrow_pod0x28void0x2A0x2C0x20unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef %64, i32 noundef %65, i32 noundef %66, i32 noundef %67, i32 noundef %68)
  br label %79

69:                                               ; preds = %3
  %70 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %70, ptr %9, align 4, !tbaa !9
  %71 = load i32, ptr %9, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  %73 = xor i1 %72, true
  %74 = zext i1 %73 to i32
  store i32 %74, ptr %9, align 4, !tbaa !9
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %78

77:                                               ; preds = %69
  br label %111

78:                                               ; preds = %69
  br label %79

79:                                               ; preds = %78, %53
  %80 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %80, ptr %9, align 4, !tbaa !9
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.w2c_hermes, ptr %81, i32 0, i32 6
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  %85 = call i32 @i32_load(ptr noundef %82, i64 noundef %84)
  store i32 %85, ptr %9, align 4, !tbaa !9
  %86 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %86, ptr %10, align 4, !tbaa !9
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.w2c_hermes, ptr %87, i32 0, i32 6
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = add i64 %90, 4
  %92 = call i32 @i32_load(ptr noundef %88, i64 noundef %91)
  store i32 %92, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %11, align 4, !tbaa !9
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = and i32 %93, 31
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = shl i32 %95, %94
  store i32 %96, ptr %10, align 4, !tbaa !9
  %97 = load i32, ptr %10, align 4, !tbaa !9
  %98 = load i32, ptr %9, align 4, !tbaa !9
  %99 = add i32 %98, %97
  store i32 %99, ptr %9, align 4, !tbaa !9
  %100 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %100, ptr %10, align 4, !tbaa !9
  %101 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %101, ptr %11, align 4, !tbaa !9
  store i32 2, ptr %12, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = and i32 %102, 31
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = shl i32 %104, %103
  store i32 %105, ptr %11, align 4, !tbaa !9
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = load i32, ptr %9, align 4, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = call i32 @w2c_hermes_0x5F_memcpy(ptr noundef %106, i32 noundef %107, i32 noundef %108, i32 noundef %109)
  store i32 %110, ptr %9, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %79, %77
  %112 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %112, ptr %9, align 4, !tbaa !9
  %113 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %113, ptr %10, align 4, !tbaa !9
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.w2c_hermes, ptr %114, i32 0, i32 6
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = zext i32 %116 to i64
  %118 = add i64 %117, 4
  %119 = call i32 @i32_load(ptr noundef %115, i64 noundef %118)
  store i32 %119, ptr %10, align 4, !tbaa !9
  %120 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %120, ptr %11, align 4, !tbaa !9
  %121 = load i32, ptr %11, align 4, !tbaa !9
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = add i32 %122, %121
  store i32 %123, ptr %10, align 4, !tbaa !9
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.w2c_hermes, ptr %124, i32 0, i32 6
  %126 = load i32, ptr %9, align 4, !tbaa !9
  %127 = zext i32 %126 to i64
  %128 = add i64 %127, 4
  %129 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %125, i64 noundef %128, i32 noundef %129)
  store i32 1, ptr %9, align 4, !tbaa !9
  %130 = load i32, ptr %9, align 4, !tbaa !9
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 %130
}

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @w2c_hermes_hermes0x3A0x3Aregex0x3A0x3AMatchCharNode0x3A0x3AtryCoalesceCharacters0x28llvh0x3A0x3ASmallVector0x3Cunsigned0x20int0x2C0x205u0x3E0x2A0x290x20const(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = zext i32 %1 to i64
  %6 = add nuw nsw i64 %5, 4
  %7 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %6)
  %8 = add nuw nsw i64 %5, 8
  %9 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %8)
  %10 = zext i32 %2 to i64
  %11 = add nuw nsw i64 %10, 8
  %12 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %11)
  %13 = add nuw nsw i64 %10, 4
  %14 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %13)
  %15 = sub i32 %12, %14
  %16 = icmp ugt i32 %9, %15
  br i1 %16, label %17, label %20

17:                                               ; preds = %3
  %18 = add i32 %2, 12
  %19 = add i32 %14, %9
  tail call void @w2c_hermes_llvh0x3A0x3ASmallVectorBase0x3A0x3Agrow_pod0x28void0x2A0x2C0x20unsigned0x20long0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %2, i32 noundef %18, i32 noundef %19, i32 noundef 4) #3
  br label %21

20:                                               ; preds = %3
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %28, label %21

21:                                               ; preds = %20, %17
  %22 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %10)
  %23 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %13)
  %24 = shl i32 %23, 2
  %25 = add i32 %24, %22
  %26 = shl i32 %9, 2
  %27 = tail call i32 @w2c_hermes_0x5F_memcpy(ptr noundef %0, i32 noundef %25, i32 noundef %7, i32 noundef %26) #3
  br label %28

28:                                               ; preds = %20, %21
  %29 = tail call i32 @i32_load(ptr noundef nonnull %4, i64 noundef %13)
  %30 = add i32 %29, %9
  tail call void @i32_store(ptr noundef nonnull %4, i64 noundef %13, i32 noundef %30)
  ret i32 1
}

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,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass