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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #3

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

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 = add i64 %24, 20
  %26 = call i32 @i32_load(ptr noundef %22, i64 noundef %25)
  store i32 %26, ptr %6, align 4, !tbaa !9
  %27 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %27, ptr %7, align 4, !tbaa !9
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.w2c_hermes, ptr %28, i32 0, i32 6
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = add i64 %31, 44
  %33 = call i32 @i32_load(ptr noundef %29, i64 noundef %32)
  store i32 %33, ptr %7, align 4, !tbaa !9
  %34 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %34, ptr %5, align 4, !tbaa !9
  %35 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %35, ptr %8, align 4, !tbaa !9
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = call i32 @w2c_hermes_strlen(ptr noundef %36, i32 noundef %37)
  store i32 %38, ptr %8, align 4, !tbaa !9
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = call i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %39, i32 noundef %40, i32 noundef %41, i32 noundef %42)
  store i32 %43, ptr %6, align 4, !tbaa !9
  %44 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %44, ptr %6, align 4, !tbaa !9
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.w2c_hermes, ptr %45, i32 0, i32 6
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = add i64 %48, 40
  %50 = call i32 @i32_load8_u(ptr noundef %46, i64 noundef %49)
  store i32 %50, ptr %6, align 4, !tbaa !9
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %95

53:                                               ; preds = %19
  %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, 20
  %60 = call i32 @i32_load(ptr noundef %56, i64 noundef %59)
  store i32 %60, ptr %6, align 4, !tbaa !9
  %61 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %61, ptr %7, align 4, !tbaa !9
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.w2c_hermes, ptr %62, i32 0, i32 6
  %64 = load i32, ptr %7, align 4, !tbaa !9
  %65 = zext i32 %64 to i64
  %66 = add i64 %65, 36
  %67 = call i32 @i32_load(ptr noundef %63, i64 noundef %66)
  store i32 %67, ptr %7, align 4, !tbaa !9
  %68 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %68, ptr %5, align 4, !tbaa !9
  %69 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %69, ptr %8, align 4, !tbaa !9
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.w2c_hermes, ptr %70, i32 0, i32 6
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = add i64 %73, 32
  %75 = call i32 @i32_load(ptr noundef %71, i64 noundef %74)
  store i32 %75, ptr %8, align 4, !tbaa !9
  %76 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %76, ptr %9, align 4, !tbaa !9
  %77 = load ptr, ptr %3, 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, 28
  %82 = call i32 @i32_load(ptr noundef %78, i64 noundef %81)
  store i32 %82, ptr %9, align 4, !tbaa !9
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = add i32 %84, %83
  store i32 %85, ptr %8, align 4, !tbaa !9
  %86 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %86, ptr %9, align 4, !tbaa !9
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = sub i32 %88, %87
  store i32 %89, ptr %8, align 4, !tbaa !9
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = load i32, ptr %6, align 4, !tbaa !9
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = load i32, ptr %8, align 4, !tbaa !9
  %94 = call i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %90, i32 noundef %91, i32 noundef %92, i32 noundef %93)
  store i32 %94, ptr %6, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %53, %19
  %96 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %96, ptr %6, align 4, !tbaa !9
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.w2c_hermes, ptr %97, i32 0, i32 6
  %99 = load i32, ptr %6, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = add i64 %100, 20
  %102 = call i32 @i32_load(ptr noundef %98, i64 noundef %101)
  store i32 %102, ptr %6, align 4, !tbaa !9
  %103 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %103, ptr %7, align 4, !tbaa !9
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.w2c_hermes, ptr %104, i32 0, i32 6
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = zext i32 %106 to i64
  %108 = add i64 %107, 32
  %109 = call i32 @i32_load(ptr noundef %105, i64 noundef %108)
  store i32 %109, ptr %7, align 4, !tbaa !9
  %110 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %110, ptr %5, align 4, !tbaa !9
  %111 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %111, ptr %8, align 4, !tbaa !9
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.w2c_hermes, ptr %112, i32 0, i32 6
  %114 = load i32, ptr %8, align 4, !tbaa !9
  %115 = zext i32 %114 to i64
  %116 = add i64 %115, 36
  %117 = call i32 @i32_load(ptr noundef %113, i64 noundef %116)
  store i32 %117, ptr %8, align 4, !tbaa !9
  %118 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %118, ptr %9, align 4, !tbaa !9
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = sub i32 %120, %119
  store i32 %121, ptr %8, align 4, !tbaa !9
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = load i32, ptr %6, align 4, !tbaa !9
  %124 = load i32, ptr %7, align 4, !tbaa !9
  %125 = load i32, ptr %8, align 4, !tbaa !9
  %126 = call i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %122, i32 noundef %123, i32 noundef %124, i32 noundef %125)
  store i32 %126, ptr %6, align 4, !tbaa !9
  %127 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %127, ptr %6, align 4, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !9
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.w2c_hermes, ptr %128, i32 0, i32 6
  %130 = load i32, ptr %6, align 4, !tbaa !9
  %131 = zext i32 %130 to i64
  %132 = add i64 %131, 40
  %133 = load i32, ptr %7, align 4, !tbaa !9
  call void @i32_store8(ptr noundef %129, i64 noundef %132, i32 noundef %133)
  %134 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %134, ptr %6, align 4, !tbaa !9
  %135 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %135, ptr %7, align 4, !tbaa !9
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.w2c_hermes, ptr %136, i32 0, i32 6
  %138 = load i32, ptr %7, align 4, !tbaa !9
  %139 = zext i32 %138 to i64
  %140 = add i64 %139, 32
  %141 = call i32 @i32_load(ptr noundef %137, i64 noundef %140)
  store i32 %141, ptr %7, align 4, !tbaa !9
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.w2c_hermes, ptr %142, i32 0, i32 6
  %144 = load i32, ptr %6, align 4, !tbaa !9
  %145 = zext i32 %144 to i64
  %146 = add i64 %145, 36
  %147 = load i32, ptr %7, align 4, !tbaa !9
  call void @i32_store(ptr noundef %143, i64 noundef %146, i32 noundef %147)
  br label %148

148:                                              ; preds = %95, %2
  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
  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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

7:                                                ; preds = %2
  %8 = add nuw nsw i64 %4, 20
  %9 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %8)
  %10 = add nuw nsw i64 %4, 44
  %11 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %10)
  %12 = tail call i32 @w2c_hermes_strlen(ptr noundef %0, i32 noundef %11) #3
  %13 = tail call i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %9, i32 noundef %11, i32 noundef %12)
  %14 = add nuw nsw i64 %4, 40
  %15 = tail call i32 @i32_load8_u(ptr noundef nonnull %3, i64 noundef %14)
  %.not71 = icmp eq i32 %15, 0
  %.pre72 = add nuw nsw i64 %4, 36
  br i1 %.not71, label %._crit_edge, label %16

._crit_edge:                                      ; preds = %7
  %.pre = add nuw nsw i64 %4, 32
  br label %25

16:                                               ; preds = %7
  %17 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %8)
  %18 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %.pre72)
  %19 = add nuw nsw i64 %4, 32
  %20 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %19)
  %21 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %5)
  %22 = sub i32 %20, %18
  %23 = add i32 %22, %21
  %24 = tail call i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %17, i32 noundef %18, i32 noundef %23)
  br label %25

25:                                               ; preds = %._crit_edge, %16
  %.pre-phi = phi i64 [ %.pre, %._crit_edge ], [ %19, %16 ]
  %26 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %8)
  %27 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %.pre-phi)
  %28 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %.pre72)
  %29 = sub i32 %28, %27
  %30 = tail call i32 @w2c_hermes_llvh0x3A0x3Araw_ostream0x3A0x3Awrite0x28char0x20const0x2A0x2C0x20unsigned0x20long0x29(ptr noundef %0, i32 noundef %26, i32 noundef %27, i32 noundef %29)
  tail call void @i32_store8(ptr noundef nonnull %3, i64 noundef %14, i32 noundef 0)
  %31 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %.pre-phi)
  tail call void @i32_store(ptr noundef nonnull %3, i64 noundef %.pre72, i32 noundef %31)
  br label %32

32:                                               ; 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,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass