; LLVM IR from intel/intel-ipsec-mb :: test/common (utils)

; 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"

@hexdump_ex.hex_buffer = external hidden global [16384 x i8], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @memory_copy(ptr noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local void @hexdump_ex(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr @hexdump_ex.hex_buffer, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %17, ptr %13, align 8, !tbaa !5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %5
  store i32 1, ptr %14, align 4
  br label %122

21:                                               ; preds = %5
  %22 = load i64, ptr %9, align 8, !tbaa !9
  %23 = icmp ugt i64 %22, 16384
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store i64 16384, ptr %9, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %24, %21
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load i64, ptr %9, align 8, !tbaa !9
  call void @memory_copy(ptr noundef @hexdump_ex.hex_buffer, ptr noundef %26, i64 noundef %27)
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %34

30:                                               ; preds = %25
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str, ptr noundef %32) #4
  br label %34

34:                                               ; preds = %30, %25
  br label %35

35:                                               ; preds = %118, %34
  %36 = load i64, ptr %11, align 8, !tbaa !9
  %37 = load i64, ptr %9, align 8, !tbaa !9
  %38 = icmp ult i64 %36, %37
  br i1 %38, label %39, label %121

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = load i64, ptr %11, align 8, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %41, i64 %42
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.1, ptr noundef %43) #4
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %69, %39
  %46 = load i64, ptr %11, align 8, !tbaa !9
  %47 = load i32, ptr %15, align 4, !tbaa !11
  %48 = zext i32 %47 to i64
  %49 = add i64 %46, %48
  %50 = load i64, ptr %9, align 8, !tbaa !9
  %51 = icmp ult i64 %49, %50
  br i1 %51, label %52, label %55

52:                                               ; preds = %45
  %53 = load i32, ptr %15, align 4, !tbaa !11
  %54 = icmp ult i32 %53, 16
  br label %55

55:                                               ; preds = %52, %45
  %56 = phi i1 [ false, %45 ], [ %54, %52 ]
  br i1 %56, label %57, label %72

57:                                               ; preds = %55
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = load i64, ptr %11, align 8, !tbaa !9
  %61 = load i32, ptr %15, align 4, !tbaa !11
  %62 = zext i32 %61 to i64
  %63 = add i64 %60, %62
  %64 = getelementptr inbounds i8, ptr %59, i64 %63
  %65 = load i8, ptr %64, align 1, !tbaa !13
  %66 = zext i8 %65 to i32
  %67 = and i32 %66, 255
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.2, i32 noundef %67) #4
  br label %69

69:                                               ; preds = %57
  %70 = load i32, ptr %15, align 4, !tbaa !11
  %71 = add i32 %70, 1
  store i32 %71, ptr %15, align 4, !tbaa !11
  br label %45, !llvm.loop !14

72:                                               ; preds = %55
  br label %73

73:                                               ; preds = %79, %72
  %74 = load i32, ptr %15, align 4, !tbaa !11
  %75 = icmp ule i32 %74, 16
  br i1 %75, label %76, label %82

76:                                               ; preds = %73
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.3) #4
  br label %79

79:                                               ; preds = %76
  %80 = load i32, ptr %15, align 4, !tbaa !11
  %81 = add i32 %80, 1
  store i32 %81, ptr %15, align 4, !tbaa !11
  br label %73, !llvm.loop !16

82:                                               ; preds = %73
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %113, %82
  %84 = load i64, ptr %11, align 8, !tbaa !9
  %85 = load i64, ptr %9, align 8, !tbaa !9
  %86 = icmp ult i64 %84, %85
  br i1 %86, label %87, label %90

87:                                               ; preds = %83
  %88 = load i32, ptr %15, align 4, !tbaa !11
  %89 = icmp ult i32 %88, 16
  br label %90

90:                                               ; preds = %87, %83
  %91 = phi i1 [ false, %83 ], [ %89, %87 ]
  br i1 %91, label %92, label %118

92:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #4
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = load i64, ptr %11, align 8, !tbaa !9
  %95 = getelementptr inbounds i8, ptr %93, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !13
  store i8 %96, ptr %16, align 1, !tbaa !13
  %97 = call ptr @__ctype_b_loc() #5
  %98 = load ptr, ptr %97, align 8, !tbaa !5
  %99 = load i8, ptr %16, align 1, !tbaa !13
  %100 = zext i8 %99 to i32
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i16, ptr %98, i64 %101
  %103 = load i16, ptr %102, align 2, !tbaa !17
  %104 = zext i16 %103 to i32
  %105 = and i32 %104, 16384
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %108, label %107

107:                                              ; preds = %92
  store i8 46, ptr %16, align 1, !tbaa !13
  br label %108

108:                                              ; preds = %107, %92
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = load i8, ptr %16, align 1, !tbaa !13
  %111 = zext i8 %110 to i32
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef @.str.4, i32 noundef %111) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #4
  br label %113

113:                                              ; preds = %108
  %114 = load i32, ptr %15, align 4, !tbaa !11
  %115 = add i32 %114, 1
  store i32 %115, ptr %15, align 4, !tbaa !11
  %116 = load i64, ptr %11, align 8, !tbaa !9
  %117 = add i64 %116, 1
  store i64 %117, ptr %11, align 8, !tbaa !9
  br label %83, !llvm.loop !19

118:                                              ; preds = %90
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef @.str.5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %35, !llvm.loop !20

121:                                              ; preds = %35
  store i32 0, ptr %14, align 4
  br label %122

122:                                              ; preds = %121, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  %123 = load i32, ptr %14, align 4
  switch i32 %123, label %125 [
    i32 0, label %124
    i32 1, label %124
  ]

124:                                              ; preds = %122, %122
  ret void

125:                                              ; preds = %122
  unreachable
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #3

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

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}


; 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"

@hexdump_ex.hex_buffer = external hidden global [16384 x i8], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @memory_copy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @hexdump_ex(ptr nocapture noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = icmp eq ptr %2, null
  br i1 %6, label %.loopexit, label %7

7:                                                ; preds = %5
  %spec.store.select = tail call i64 @llvm.umin.i64(i64 %3, i64 16384)
  tail call void @memory_copy(ptr noundef nonnull @hexdump_ex.hex_buffer, ptr noundef nonnull %2, i64 noundef %spec.store.select)
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %10, label %8

8:                                                ; preds = %7
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %1) #4
  br label %10

10:                                               ; preds = %8, %7
  %.not51 = icmp eq i64 %3, 0
  br i1 %.not51, label %.loopexit, label %.lr.ph50

.lr.ph50:                                         ; preds = %10, %._crit_edge
  %.03648 = phi i64 [ %.137.lcssa, %._crit_edge ], [ 0, %10 ]
  %11 = getelementptr inbounds i8, ptr %4, i64 %.03648
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef %11) #4
  %invariant.gep = getelementptr i8, ptr @hexdump_ex.hex_buffer, i64 %.03648
  br label %14

.lr.ph.preheader:                                 ; preds = %14
  %13 = trunc nuw nsw i64 %indvars.iv.next to i32
  br label %.lr.ph

14:                                               ; preds = %.lr.ph50, %14
  %indvars.iv = phi i64 [ 0, %.lr.ph50 ], [ %indvars.iv.next, %14 ]
  %gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv
  %15 = load i8, ptr %gep, align 1, !tbaa !5
  %16 = zext i8 %15 to i32
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.2, i32 noundef %16) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = add i64 %.03648, %indvars.iv.next
  %19 = icmp ult i64 %18, %spec.store.select
  %20 = icmp ult i64 %indvars.iv, 15
  %21 = and i1 %20, %19
  br i1 %21, label %14, label %.lr.ph.preheader, !llvm.loop !8

.preheader:                                       ; preds = %.lr.ph
  %22 = icmp ult i64 %.03648, %spec.store.select
  br i1 %22, label %.lr.ph47, label %._crit_edge

.lr.ph47:                                         ; preds = %.preheader
  %23 = tail call ptr @__ctype_b_loc() #5
  br label %27

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.144 = phi i32 [ %25, %.lr.ph ], [ %13, %.lr.ph.preheader ]
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.3) #4
  %25 = add nuw nsw i32 %.144, 1
  %26 = icmp ult i32 %.144, 16
  br i1 %26, label %.lr.ph, label %.preheader, !llvm.loop !10

27:                                               ; preds = %.lr.ph47, %27
  %.246 = phi i32 [ 0, %.lr.ph47 ], [ %38, %27 ]
  %.13745 = phi i64 [ %.03648, %.lr.ph47 ], [ %39, %27 ]
  %28 = getelementptr inbounds i8, ptr @hexdump_ex.hex_buffer, i64 %.13745
  %29 = load i8, ptr %28, align 1, !tbaa !5
  %30 = load ptr, ptr %23, align 8, !tbaa !11
  %31 = zext i8 %29 to i64
  %32 = getelementptr inbounds i16, ptr %30, i64 %31
  %33 = load i16, ptr %32, align 2, !tbaa !13
  %34 = and i16 %33, 16384
  %.not41 = icmp eq i16 %34, 0
  %35 = zext i8 %29 to i32
  %36 = select i1 %.not41, i32 46, i32 %35
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.4, i32 noundef %36) #4
  %38 = add nuw nsw i32 %.246, 1
  %39 = add nuw nsw i64 %.13745, 1
  %40 = icmp ult i64 %39, %spec.store.select
  %41 = icmp ult i32 %.246, 15
  %42 = select i1 %40, i1 %41, i1 false
  br i1 %42, label %27, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %27, %.preheader
  %.137.lcssa = phi i64 [ %.03648, %.preheader ], [ %39, %27 ]
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.5) #4
  %44 = icmp ult i64 %.137.lcssa, %spec.store.select
  br i1 %44, label %.lr.ph50, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %._crit_edge, %10, %5
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #2

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

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 = { nofree nounwind "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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(none) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !6, i64 0}
!15 = distinct !{!15, !9}
!16 = distinct !{!16, !9}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass