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

; 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 i64 @i64_load(ptr noundef, i64 noundef) #2

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3ABinaryOperatorInst0x3A0x3AparseOperator0x28llvh0x3A0x3AStringRef0x29(ptr noundef %0, i32 noundef %1) #4 {
  %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 i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  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) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, 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
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !11
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %15 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %15, ptr %10, align 4, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.w2c_hermes, ptr %16, i32 0, i32 6
  %18 = load i32, ptr %10, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = call i64 @i64_load(ptr noundef %17, i64 noundef %19)
  store i64 %20, ptr %13, align 8, !tbaa !11
  %21 = load i64, ptr %13, align 8, !tbaa !11
  store i64 %21, ptr %9, align 8, !tbaa !11
  store i64 32, ptr %14, align 8, !tbaa !11
  %22 = load i64, ptr %14, align 8, !tbaa !11
  %23 = and i64 %22, 63
  %24 = load i64, ptr %13, align 8, !tbaa !11
  %25 = lshr i64 %24, %23
  store i64 %25, ptr %13, align 8, !tbaa !11
  %26 = load i64, ptr %13, align 8, !tbaa !11
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr %10, align 4, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %28, ptr %5, align 4, !tbaa !9
  %29 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %29, ptr %13, align 8, !tbaa !11
  %30 = load i64, ptr %13, align 8, !tbaa !11
  %31 = trunc i64 %30 to i32
  store i32 %31, ptr %10, align 4, !tbaa !9
  %32 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %32, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  %33 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %33, ptr %4, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %105, %2
  store i32 0, ptr %10, align 4, !tbaa !9
  %35 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %35, ptr %6, align 4, !tbaa !9
  %36 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %36, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %11, align 4, !tbaa !9
  %37 = load i32, ptr %11, align 4, !tbaa !9
  %38 = and i32 %37, 31
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = shl i32 %39, %38
  store i32 %40, ptr %10, align 4, !tbaa !9
  store i32 268784, ptr %11, align 4, !tbaa !9
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = add i32 %42, %41
  store i32 %43, ptr %10, align 4, !tbaa !9
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.w2c_hermes, ptr %44, i32 0, i32 6
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = call i32 @i32_load(ptr noundef %45, i64 noundef %47)
  store i32 %48, ptr %10, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %49, ptr %7, align 4, !tbaa !9
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %34
  %53 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %53, ptr %10, align 4, !tbaa !9
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = call i32 @w2c_hermes_strlen(ptr noundef %54, i32 noundef %55)
  store i32 %56, ptr %10, align 4, !tbaa !9
  %57 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %57, ptr %6, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %52, %34
  %59 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %59, ptr %10, align 4, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %60, ptr %11, align 4, !tbaa !9
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = icmp eq i32 %61, %62
  %64 = zext i1 %63 to i32
  store i32 %64, ptr %10, align 4, !tbaa !9
  %65 = load i32, ptr %10, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %93

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

75:                                               ; preds = %67
  br label %119

76:                                               ; preds = %67
  %77 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %77, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %78, ptr %11, align 4, !tbaa !9
  %79 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %79, ptr %12, align 4, !tbaa !9
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = load i32, ptr %11, align 4, !tbaa !9
  %83 = load i32, ptr %12, align 4, !tbaa !9
  %84 = call i32 @w2c_hermes_memcmp(ptr noundef %80, i32 noundef %81, i32 noundef %82, i32 noundef %83)
  store i32 %84, ptr %10, align 4, !tbaa !9
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = icmp ne i32 %85, 0
  %87 = xor i1 %86, true
  %88 = zext i1 %87 to i32
  store i32 %88, ptr %10, align 4, !tbaa !9
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %76
  br label %119

92:                                               ; preds = %76
  br label %93

93:                                               ; preds = %92, %58
  %94 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %94, ptr %10, align 4, !tbaa !9
  store i32 1, ptr %11, align 4, !tbaa !9
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = add i32 %96, %95
  store i32 %97, ptr %10, align 4, !tbaa !9
  %98 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %98, ptr %4, align 4, !tbaa !9
  store i32 26, ptr %11, align 4, !tbaa !9
  %99 = load i32, ptr %10, align 4, !tbaa !9
  %100 = load i32, ptr %11, align 4, !tbaa !9
  %101 = icmp ne i32 %99, %100
  %102 = zext i1 %101 to i32
  store i32 %102, ptr %10, align 4, !tbaa !9
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %93
  br label %34

106:                                              ; preds = %93
  store i32 0, ptr %10, align 4, !tbaa !9
  %107 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %107, ptr %4, align 4, !tbaa !9
  store i32 86850, ptr %11, align 4, !tbaa !9
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = add i32 %109, %108
  store i32 %110, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %111, ptr %11, align 4, !tbaa !9
  store i32 55652, ptr %12, align 4, !tbaa !9
  %112 = load i32, ptr %12, align 4, !tbaa !9
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = add i32 %113, %112
  store i32 %114, ptr %11, align 4, !tbaa !9
  store i32 111, ptr %12, align 4, !tbaa !9
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = load i32, ptr %12, align 4, !tbaa !9
  call void @w2c_hermes_llvh0x3A0x3Allvm_unreachable_internal0x28char0x20const0x2A0x2C0x20char0x20const0x2A0x2C0x20unsigned0x20int0x29(ptr noundef %115, i32 noundef %116, i32 noundef %117, i32 noundef %118)
  call void @wasm_rt_trap(i32 noundef 5) #6
  unreachable

119:                                              ; preds = %91, %75
  %120 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %120, ptr %10, align 4, !tbaa !9
  %121 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  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 8, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 %121
}

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 i64 @i64_load(ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @w2c_hermes_hermes0x3A0x3ABinaryOperatorInst0x3A0x3AparseOperator0x28llvh0x3A0x3AStringRef0x29(ptr noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = zext i32 %1 to i64
  %5 = tail call i64 @i64_load(ptr noundef nonnull %3, i64 noundef %4)
  %.fr = freeze i64 %5
  %6 = lshr i64 %.fr, 32
  %7 = trunc nuw i64 %6 to i32
  %8 = trunc i64 %.fr to i32
  %.not65 = icmp ult i64 %.fr, 4294967296
  br i1 %.not65, label %.split.us, label %.split

.split.us:                                        ; preds = %2, %16
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %16 ], [ 0, %2 ]
  %9 = shl i64 %indvars.iv79, 2
  %10 = add nuw nsw i64 %9, 268784
  %11 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %10)
  %.not.us = icmp eq i32 %11, 0
  br i1 %.not.us, label %14, label %12

12:                                               ; preds = %.split.us
  %13 = tail call i32 @w2c_hermes_strlen(ptr noundef %0, i32 noundef %11) #4
  br label %14

14:                                               ; preds = %12, %.split.us
  %.061.us = phi i32 [ %13, %12 ], [ 0, %.split.us ]
  %15 = icmp eq i32 %.061.us, %7
  br i1 %15, label %.split70.us, label %16

16:                                               ; preds = %14
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %.not67.us = icmp eq i64 %indvars.iv.next80, 26
  br i1 %.not67.us, label %.split72.us, label %.split.us

.split:                                           ; preds = %2, %26
  %indvars.iv = phi i64 [ %indvars.iv.next, %26 ], [ 0, %2 ]
  %17 = shl i64 %indvars.iv, 2
  %18 = add nuw nsw i64 %17, 268784
  %19 = tail call i32 @i32_load(ptr noundef nonnull %3, i64 noundef %18)
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %22, label %20

20:                                               ; preds = %.split
  %21 = tail call i32 @w2c_hermes_strlen(ptr noundef %0, i32 noundef %19) #4
  br label %22

22:                                               ; preds = %20, %.split
  %.061 = phi i32 [ %21, %20 ], [ 0, %.split ]
  %23 = icmp eq i32 %.061, %7
  br i1 %23, label %24, label %26

24:                                               ; preds = %22
  %25 = tail call i32 @w2c_hermes_memcmp(ptr noundef %0, i32 noundef %8, i32 noundef %19, i32 noundef %7) #4
  %.not66 = icmp eq i32 %25, 0
  br i1 %.not66, label %.split70.us, label %26

26:                                               ; preds = %24, %22
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not67 = icmp eq i64 %indvars.iv.next, 26
  br i1 %.not67, label %.split72.us, label %.split

.split72.us:                                      ; preds = %26, %16
  tail call void @w2c_hermes_llvh0x3A0x3Allvm_unreachable_internal0x28char0x20const0x2A0x2C0x20char0x20const0x2A0x2C0x20unsigned0x20int0x29(ptr noundef %0, i32 noundef 86850, i32 noundef 55652, i32 noundef 111) #4
  tail call void @wasm_rt_trap(i32 noundef 5) #5
  unreachable

.split70.us:                                      ; preds = %24, %14
  %.us-phi.in = phi i64 [ %indvars.iv79, %14 ], [ %indvars.iv, %24 ]
  %.us-phi = trunc i64 %.us-phi.in to i32
  ret i32 %.us-phi
}

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,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass