; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local void @w2c_hermes_out(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #1

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

38:                                               ; preds = %6
  br label %114

39:                                               ; preds = %6
  %40 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %40, ptr %14, align 4, !tbaa !9
  store i32 73728, ptr %15, align 4, !tbaa !9
  %41 = load i32, ptr %15, align 4, !tbaa !9
  %42 = load i32, ptr %14, align 4, !tbaa !9
  %43 = and i32 %42, %41
  store i32 %43, ptr %14, align 4, !tbaa !9
  %44 = load i32, ptr %14, align 4, !tbaa !9
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %39
  br label %114

47:                                               ; preds = %39
  %48 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %48, ptr %14, align 4, !tbaa !9
  %49 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %49, ptr %15, align 4, !tbaa !9
  store i32 255, ptr %16, align 4, !tbaa !9
  %50 = load i32, ptr %16, align 4, !tbaa !9
  %51 = load i32, ptr %15, align 4, !tbaa !9
  %52 = and i32 %51, %50
  store i32 %52, ptr %15, align 4, !tbaa !9
  %53 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %53, ptr %16, align 4, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %54, ptr %17, align 4, !tbaa !9
  %55 = load i32, ptr %17, align 4, !tbaa !9
  %56 = load i32, ptr %16, align 4, !tbaa !9
  %57 = sub i32 %56, %55
  store i32 %57, ptr %16, align 4, !tbaa !9
  %58 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %58, ptr %11, align 4, !tbaa !9
  store i32 256, ptr %17, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %59, ptr %18, align 4, !tbaa !9
  store i32 256, ptr %19, align 4, !tbaa !9
  %60 = load i32, ptr %18, align 4, !tbaa !9
  %61 = load i32, ptr %19, align 4, !tbaa !9
  %62 = icmp ult i32 %60, %61
  %63 = zext i1 %62 to i32
  store i32 %63, ptr %18, align 4, !tbaa !9
  %64 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %64, ptr %10, align 4, !tbaa !9
  %65 = load i32, ptr %18, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %69

67:                                               ; preds = %47
  %68 = load i32, ptr %16, align 4, !tbaa !9
  br label %71

69:                                               ; preds = %47
  %70 = load i32, ptr %17, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %69, %67
  %72 = phi i32 [ %68, %67 ], [ %70, %69 ]
  store i32 %72, ptr %16, align 4, !tbaa !9
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load i32, ptr %14, align 4, !tbaa !9
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = load i32, ptr %16, align 4, !tbaa !9
  %77 = call i32 @w2c_hermes_0x5F_memset(ptr noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76)
  store i32 %77, ptr %14, align 4, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %78, ptr %14, align 4, !tbaa !9
  %79 = load i32, ptr %14, align 4, !tbaa !9
  %80 = icmp ne i32 %79, 0
  %81 = xor i1 %80, true
  %82 = zext i1 %81 to i32
  store i32 %82, ptr %14, align 4, !tbaa !9
  %83 = load i32, ptr %14, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %106

85:                                               ; preds = %71
  br label %86

86:                                               ; preds = %104, %85
  %87 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %87, ptr %14, align 4, !tbaa !9
  %88 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %88, ptr %15, align 4, !tbaa !9
  store i32 256, ptr %16, align 4, !tbaa !9
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = load i32, ptr %14, align 4, !tbaa !9
  %91 = load i32, ptr %15, align 4, !tbaa !9
  %92 = load i32, ptr %16, align 4, !tbaa !9
  call void @w2c_hermes_out(ptr noundef %89, i32 noundef %90, i32 noundef %91, i32 noundef %92)
  %93 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %93, ptr %14, align 4, !tbaa !9
  store i32 256, ptr %15, align 4, !tbaa !9
  %94 = load i32, ptr %15, align 4, !tbaa !9
  %95 = load i32, ptr %14, align 4, !tbaa !9
  %96 = sub i32 %95, %94
  store i32 %96, ptr %14, align 4, !tbaa !9
  %97 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %97, ptr %11, align 4, !tbaa !9
  store i32 255, ptr %15, align 4, !tbaa !9
  %98 = load i32, ptr %14, align 4, !tbaa !9
  %99 = load i32, ptr %15, align 4, !tbaa !9
  %100 = icmp ugt i32 %98, %99
  %101 = zext i1 %100 to i32
  store i32 %101, ptr %14, align 4, !tbaa !9
  %102 = load i32, ptr %14, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %105

104:                                              ; preds = %86
  br label %86

105:                                              ; preds = %86
  br label %106

106:                                              ; preds = %105, %71
  %107 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %107, ptr %14, align 4, !tbaa !9
  %108 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %108, ptr %15, align 4, !tbaa !9
  %109 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %109, ptr %16, align 4, !tbaa !9
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = load i32, ptr %14, align 4, !tbaa !9
  %112 = load i32, ptr %15, align 4, !tbaa !9
  %113 = load i32, ptr %16, align 4, !tbaa !9
  call void @w2c_hermes_out(ptr noundef %110, i32 noundef %111, i32 noundef %112, i32 noundef %113)
  br label %114

114:                                              ; preds = %106, %46, %38
  %115 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %115, ptr %14, align 4, !tbaa !9
  store i32 256, ptr %15, align 4, !tbaa !9
  %116 = load i32, ptr %15, align 4, !tbaa !9
  %117 = load i32, ptr %14, align 4, !tbaa !9
  %118 = add i32 %117, %116
  store i32 %118, ptr %14, align 4, !tbaa !9
  %119 = load i32, ptr %14, align 4, !tbaa !9
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.w2c_hermes, ptr %120, i32 0, i32 3
  store i32 %119, ptr %121, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  ret void
}

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

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

!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, !10, i64 24}
!12 = !{!"w2c_hermes", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 40, !16, i64 80}
!13 = !{!"", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !15, i64 32}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12}


; 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: nounwind uwtable
declare dso_local void @w2c_hermes_out(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @w2c_hermes_pad(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = add i32 %8, -256
  store i32 %9, ptr %7, align 8, !tbaa !5
  %.not = icmp sgt i32 %3, %4
  %10 = and i32 %5, 73728
  %.not65 = icmp eq i32 %10, 0
  %or.cond = and i1 %.not, %.not65
  br i1 %or.cond, label %11, label %19

11:                                               ; preds = %6
  %12 = and i32 %2, 255
  %13 = sub i32 %3, %4
  %14 = icmp ugt i32 %13, 255
  %15 = tail call i32 @llvm.umin.i32(i32 %13, i32 256)
  %16 = tail call i32 @w2c_hermes_0x5F_memset(ptr noundef nonnull %0, i32 noundef %9, i32 noundef %12, i32 noundef %15) #3
  br i1 %14, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %11, %.preheader
  %.0 = phi i32 [ %17, %.preheader ], [ %13, %11 ]
  tail call void @w2c_hermes_out(ptr noundef %0, i32 noundef %1, i32 noundef %9, i32 noundef 256)
  %17 = add i32 %.0, -256
  %18 = icmp ugt i32 %17, 255
  br i1 %18, label %.preheader, label %.loopexit

.loopexit:                                        ; preds = %.preheader, %11
  %.1 = phi i32 [ %13, %11 ], [ %17, %.preheader ]
  tail call void @w2c_hermes_out(ptr noundef %0, i32 noundef %1, i32 noundef %9, i32 noundef %.1)
  br label %19

19:                                               ; preds = %6, %.loopexit
  store i32 %8, ptr %7, align 8, !tbaa !5
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #2

attributes #0 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}
!5 = !{!6, !10, i64 24}
!6 = !{!"w2c_hermes", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !11, i64 40, !14, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"", !7, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32}
!12 = !{!"long", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass