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

; 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: noreturn
declare void @wasm_rt_trap(i32 noundef) #1

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

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

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ATwineChar160x3A0x3ATwineChar160x28char0x20const0x2A0x29(ptr noundef %0, i32 noundef %1, i32 noundef %2) #4 {
  %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
  %13 = alloca i64, align 8
  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) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %14 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %14, ptr %8, align 4, !tbaa !9
  %15 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %15, ptr %9, align 4, !tbaa !9
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  %18 = xor i1 %17, true
  %19 = zext i1 %18 to i32
  store i32 %19, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %37

22:                                               ; preds = %3
  %23 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %23, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.w2c_hermes, ptr %24, i32 0, i32 6
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = add i64 %27, 32
  %29 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %25, i64 noundef %28, i32 noundef %29)
  %30 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %30, ptr %9, align 4, !tbaa !9
  store i64 1, ptr %13, align 8, !tbaa !11
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.w2c_hermes, ptr %31, i32 0, i32 6
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = add i64 %34, 24
  %36 = load i64, ptr %13, align 8, !tbaa !11
  call void @i64_store(ptr noundef %32, i64 noundef %35, i64 noundef %36)
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %81

37:                                               ; preds = %3
  %38 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %38, ptr %9, align 4, !tbaa !9
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = call i32 @w2c_hermes_strlen(ptr noundef %39, i32 noundef %40)
  store i32 %41, ptr %9, align 4, !tbaa !9
  %42 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %42, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %43, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.w2c_hermes, ptr %44, i32 0, i32 6
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = add i64 %47, 32
  %49 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %45, i64 noundef %48, i32 noundef %49)
  %50 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %50, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %51, ptr %10, align 4, !tbaa !9
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.w2c_hermes, ptr %52, i32 0, i32 6
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = add i64 %55, 28
  %57 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %53, i64 noundef %56, i32 noundef %57)
  %58 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %58, ptr %9, align 4, !tbaa !9
  store i32 1, ptr %10, align 4, !tbaa !9
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.w2c_hermes, ptr %59, i32 0, i32 6
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = add i64 %62, 24
  %64 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %60, i64 noundef %63, i32 noundef %64)
  store i32 1, ptr %9, align 4, !tbaa !9
  %65 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %65, ptr %10, align 4, !tbaa !9
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 0
  %68 = xor i1 %67, true
  %69 = zext i1 %68 to i32
  store i32 %69, ptr %10, align 4, !tbaa !9
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %37
  br label %81

73:                                               ; preds = %37
  %74 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %74, ptr %9, align 4, !tbaa !9
  %75 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %75, ptr %10, align 4, !tbaa !9
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.w2c_hermes, ptr %76, i32 0, i32 6
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  %80 = load i32, ptr %10, align 4, !tbaa !9
  call void @i32_store(ptr noundef %77, i64 noundef %79, i32 noundef %80)
  store i32 3, ptr %9, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %73, %72, %22
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.w2c_hermes, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = add i64 %85, 8
  %87 = load i32, ptr %9, align 4, !tbaa !9
  call void @i32_store(ptr noundef %83, i64 noundef %86, i32 noundef %87)
  %88 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %88, ptr %8, align 4, !tbaa !9
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = load i32, ptr %8, align 4, !tbaa !9
  %91 = call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ATwineChar160x3A0x3AisValid0x280x290x20const(ptr noundef %89, i32 noundef %90)
  store i32 %91, ptr %8, align 4, !tbaa !9
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  %94 = xor i1 %93, true
  %95 = zext i1 %94 to i32
  store i32 %95, ptr %8, align 4, !tbaa !9
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %116

98:                                               ; preds = %81
  store i32 0, ptr %8, align 4, !tbaa !9
  %99 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %99, ptr %5, align 4, !tbaa !9
  store i32 118970, ptr %9, align 4, !tbaa !9
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = add i32 %101, %100
  store i32 %102, ptr %8, align 4, !tbaa !9
  %103 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %103, ptr %9, align 4, !tbaa !9
  store i32 86509, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %10, align 4, !tbaa !9
  %105 = load i32, ptr %9, align 4, !tbaa !9
  %106 = add i32 %105, %104
  store i32 %106, ptr %9, align 4, !tbaa !9
  store i32 132, ptr %10, align 4, !tbaa !9
  %107 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %107, ptr %11, align 4, !tbaa !9
  store i32 110848, ptr %12, align 4, !tbaa !9
  %108 = load i32, ptr %12, align 4, !tbaa !9
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = add i32 %109, %108
  store i32 %110, ptr %11, align 4, !tbaa !9
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = load i32, ptr %8, align 4, !tbaa !9
  %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
  call void @w2c_hermes_0x5F_assert_fail(ptr noundef %111, i32 noundef %112, i32 noundef %113, i32 noundef %114, i32 noundef %115)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

116:                                              ; preds = %81
  %117 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %117, ptr %8, align 4, !tbaa !9
  %118 = load i32, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret i32 %118
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn "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 = { "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 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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: noreturn
declare void @wasm_rt_trap(i32 noundef) local_unnamed_addr #0

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

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

declare void @w2c_hermes_0x5F_assert_fail(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ATwineChar160x3A0x3ATwineChar160x28char0x20const0x2A0x29(ptr noundef %0, i32 noundef returned %1, i32 noundef %2) local_unnamed_addr #3 {
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %4, label %9

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  %6 = zext i32 %1 to i64
  %7 = add nuw nsw i64 %6, 32
  tail call void @i32_store(ptr noundef nonnull %5, i64 noundef %7, i32 noundef 0)
  %8 = add nuw nsw i64 %6, 24
  tail call void @i64_store(ptr noundef nonnull %5, i64 noundef %8, i64 noundef 1)
  br label %17

9:                                                ; preds = %3
  %10 = tail call i32 @w2c_hermes_strlen(ptr noundef %0, i32 noundef %2) #4
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = zext i32 %1 to i64
  %13 = add nuw nsw i64 %12, 32
  tail call void @i32_store(ptr noundef nonnull %11, i64 noundef %13, i32 noundef 0)
  %14 = add nuw nsw i64 %12, 28
  tail call void @i32_store(ptr noundef nonnull %11, i64 noundef %14, i32 noundef %10)
  %15 = add nuw nsw i64 %12, 24
  tail call void @i32_store(ptr noundef nonnull %11, i64 noundef %15, i32 noundef 1)
  %.not60 = icmp eq i32 %10, 0
  br i1 %.not60, label %17, label %16

16:                                               ; preds = %9
  tail call void @i32_store(ptr noundef nonnull %11, i64 noundef %12, i32 noundef %2)
  br label %17

17:                                               ; preds = %9, %16, %4
  %.pre-phi = phi i64 [ %12, %9 ], [ %12, %16 ], [ %6, %4 ]
  %.0 = phi i32 [ 1, %9 ], [ 3, %16 ], [ 1, %4 ]
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  %19 = add nuw nsw i64 %.pre-phi, 8
  tail call void @i32_store(ptr noundef nonnull %18, i64 noundef %19, i32 noundef %.0)
  %20 = tail call i32 @w2c_hermes_hermes0x3A0x3Avm0x3A0x3ATwineChar160x3A0x3AisValid0x280x290x20const(ptr noundef %0, i32 noundef %1)
  %.not61 = icmp eq i32 %20, 0
  br i1 %.not61, label %21, label %22

21:                                               ; preds = %17
  tail call void @w2c_hermes_0x5F_assert_fail(ptr noundef %0, i32 noundef 118970, i32 noundef 86509, i32 noundef 132, i32 noundef 110848) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

22:                                               ; preds = %17
  ret i32 %1
}

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

attributes #0 = { noreturn "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 = { "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 }
attributes #5 = { noreturn 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,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass