; LLVM IR from aws/s2n-tls :: tests/unit (s2n_fragmentation_coalescing_test)

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

@server_hello_message = external dso_local global [74 x i8], align 16
@warning_alert = external dso_local global [2 x i8], align 1

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

declare i64 @write(i32 noundef, ptr noundef, i64 noundef) #1

; Function Attrs: noreturn
declare void @_exit(i32 noundef) #2

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

declare i32 @close(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @interleaved_fragmented_warning_alert(i32 noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [5 x i8], align 1
  %5 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 37, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 5, ptr %4) #4
  store i8 22, ptr %4, align 1, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 3, ptr %6, align 1, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %4, i64 2
  store i8 3, ptr %7, align 1, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %4, i64 3
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = ashr i32 %9, 8
  %11 = trunc i32 %10 to i8
  store i8 %11, ptr %8, align 1, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %4, i64 4
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = and i32 %13, 255
  %15 = trunc i32 %14 to i8
  store i8 %15, ptr %12, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  %18 = call i64 @write(i32 noundef %16, ptr noundef %17, i64 noundef 5)
  %19 = icmp ne i64 %18, 5
  br i1 %19, label %20, label %21

20:                                               ; preds = %1
  call void @_exit(i32 noundef 100) #5
  unreachable

21:                                               ; preds = %1
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = call i64 @write(i32 noundef %22, ptr noundef @server_hello_message, i64 noundef %24)
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp ne i64 %25, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %21
  call void @_exit(i32 noundef 100) #5
  unreachable

30:                                               ; preds = %21
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = add nsw i32 %32, %31
  store i32 %33, ptr %5, align 4, !tbaa !5
  %34 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  store i8 21, ptr %34, align 1, !tbaa !9
  %35 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 3
  store i8 0, ptr %35, align 1, !tbaa !9
  %36 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 4
  store i8 1, ptr %36, align 1, !tbaa !9
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = call i64 @write(i32 noundef %37, ptr noundef @warning_alert, i64 noundef 1)
  %39 = icmp ne i64 %38, 1
  br i1 %39, label %40, label %41

40:                                               ; preds = %30
  call void @_exit(i32 noundef 100) #5
  unreachable

41:                                               ; preds = %30
  store i32 18, ptr %3, align 4, !tbaa !5
  %42 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  store i8 22, ptr %42, align 1, !tbaa !9
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = ashr i32 %43, 8
  %45 = trunc i32 %44 to i8
  %46 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 3
  store i8 %45, ptr %46, align 1, !tbaa !9
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = and i32 %47, 255
  %49 = trunc i32 %48 to i8
  %50 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 4
  store i8 %49, ptr %50, align 1, !tbaa !9
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  %53 = call i64 @write(i32 noundef %51, ptr noundef %52, i64 noundef 5)
  %54 = icmp ne i64 %53, 5
  br i1 %54, label %55, label %56

55:                                               ; preds = %41
  call void @_exit(i32 noundef 100) #5
  unreachable

56:                                               ; preds = %41
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i8, ptr @server_hello_message, i64 %59
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = call i64 @write(i32 noundef %57, ptr noundef %60, i64 noundef %62)
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = icmp ne i64 %63, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %56
  call void @_exit(i32 noundef 100) #5
  unreachable

68:                                               ; preds = %56
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, %69
  store i32 %71, ptr %5, align 4, !tbaa !5
  %72 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  store i8 21, ptr %72, align 1, !tbaa !9
  %73 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 3
  store i8 0, ptr %73, align 1, !tbaa !9
  %74 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 4
  store i8 1, ptr %74, align 1, !tbaa !9
  %75 = load i32, ptr %2, align 4, !tbaa !5
  %76 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  %77 = call i64 @write(i32 noundef %75, ptr noundef %76, i64 noundef 5)
  %78 = icmp ne i64 %77, 5
  br i1 %78, label %79, label %80

79:                                               ; preds = %68
  call void @_exit(i32 noundef 100) #5
  unreachable

80:                                               ; preds = %68
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = call i64 @write(i32 noundef %81, ptr noundef getelementptr inbounds (i8, ptr @warning_alert, i64 1), i64 noundef 1)
  %83 = icmp ne i64 %82, 1
  br i1 %83, label %84, label %85

84:                                               ; preds = %80
  call void @_exit(i32 noundef 100) #5
  unreachable

85:                                               ; preds = %80
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = sub i64 74, %87
  %89 = trunc i64 %88 to i32
  store i32 %89, ptr %3, align 4, !tbaa !5
  %90 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  store i8 22, ptr %90, align 1, !tbaa !9
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = ashr i32 %91, 8
  %93 = trunc i32 %92 to i8
  %94 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 3
  store i8 %93, ptr %94, align 1, !tbaa !9
  %95 = load i32, ptr %3, align 4, !tbaa !5
  %96 = and i32 %95, 255
  %97 = trunc i32 %96 to i8
  %98 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 4
  store i8 %97, ptr %98, align 1, !tbaa !9
  %99 = load i32, ptr %2, align 4, !tbaa !5
  %100 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  %101 = call i64 @write(i32 noundef %99, ptr noundef %100, i64 noundef 5)
  %102 = icmp ne i64 %101, 5
  br i1 %102, label %103, label %104

103:                                              ; preds = %85
  call void @_exit(i32 noundef 100) #5
  unreachable

104:                                              ; preds = %85
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i8, ptr @server_hello_message, i64 %107
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = call i64 @write(i32 noundef %105, ptr noundef %108, i64 noundef %110)
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = icmp ne i64 %111, %113
  br i1 %114, label %115, label %116

115:                                              ; preds = %104
  call void @_exit(i32 noundef 100) #5
  unreachable

116:                                              ; preds = %104
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = call i32 @close(i32 noundef %117)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !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"

@server_hello_message = external dso_local global [74 x i8], align 16
@warning_alert = external dso_local global [2 x i8], align 1

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

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn
declare void @_exit(i32 noundef) local_unnamed_addr #2

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

declare i32 @close(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @interleaved_fragmented_warning_alert(i32 noundef %0) local_unnamed_addr #4 {
  %2 = alloca [5 x i8], align 4
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %2) #5
  %3 = getelementptr inbounds i8, ptr %2, i64 3
  store <4 x i8> <i8 22, i8 3, i8 3, i8 0>, ptr %2, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %2, i64 4
  store i8 37, ptr %4, align 4, !tbaa !5
  %5 = call i64 @write(i32 noundef %0, ptr noundef nonnull %2, i64 noundef 5) #5
  %.not = icmp eq i64 %5, 5
  br i1 %.not, label %7, label %6

6:                                                ; preds = %1
  tail call void @_exit(i32 noundef 100) #6
  unreachable

7:                                                ; preds = %1
  %8 = tail call i64 @write(i32 noundef %0, ptr noundef nonnull @server_hello_message, i64 noundef 37) #5
  %.not29 = icmp eq i64 %8, 37
  br i1 %.not29, label %10, label %9

9:                                                ; preds = %7
  tail call void @_exit(i32 noundef 100) #6
  unreachable

10:                                               ; preds = %7
  %11 = tail call i64 @write(i32 noundef %0, ptr noundef nonnull @warning_alert, i64 noundef 1) #5
  %.not30 = icmp eq i64 %11, 1
  br i1 %.not30, label %13, label %12

12:                                               ; preds = %10
  tail call void @_exit(i32 noundef 100) #6
  unreachable

13:                                               ; preds = %10
  store i8 22, ptr %2, align 4, !tbaa !5
  store i8 0, ptr %3, align 1, !tbaa !5
  store i8 18, ptr %4, align 4, !tbaa !5
  %14 = call i64 @write(i32 noundef %0, ptr noundef nonnull %2, i64 noundef 5) #5
  %.not31 = icmp eq i64 %14, 5
  br i1 %.not31, label %16, label %15

15:                                               ; preds = %13
  tail call void @_exit(i32 noundef 100) #6
  unreachable

16:                                               ; preds = %13
  %17 = tail call i64 @write(i32 noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @server_hello_message, i64 37), i64 noundef 18) #5
  %.not32 = icmp eq i64 %17, 18
  br i1 %.not32, label %19, label %18

18:                                               ; preds = %16
  tail call void @_exit(i32 noundef 100) #6
  unreachable

19:                                               ; preds = %16
  store i8 21, ptr %2, align 4, !tbaa !5
  store i8 0, ptr %3, align 1, !tbaa !5
  store i8 1, ptr %4, align 4, !tbaa !5
  %20 = call i64 @write(i32 noundef %0, ptr noundef nonnull %2, i64 noundef 5) #5
  %.not33 = icmp eq i64 %20, 5
  br i1 %.not33, label %22, label %21

21:                                               ; preds = %19
  tail call void @_exit(i32 noundef 100) #6
  unreachable

22:                                               ; preds = %19
  %23 = tail call i64 @write(i32 noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @warning_alert, i64 1), i64 noundef 1) #5
  %.not34 = icmp eq i64 %23, 1
  br i1 %.not34, label %25, label %24

24:                                               ; preds = %22
  tail call void @_exit(i32 noundef 100) #6
  unreachable

25:                                               ; preds = %22
  store i8 22, ptr %2, align 4, !tbaa !5
  store i8 0, ptr %3, align 1, !tbaa !5
  store i8 19, ptr %4, align 4, !tbaa !5
  %26 = call i64 @write(i32 noundef %0, ptr noundef nonnull %2, i64 noundef 5) #5
  %.not35 = icmp eq i64 %26, 5
  br i1 %.not35, label %28, label %27

27:                                               ; preds = %25
  tail call void @_exit(i32 noundef 100) #6
  unreachable

28:                                               ; preds = %25
  %29 = tail call i64 @write(i32 noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @server_hello_message, i64 55), i64 noundef 19) #5
  %.not36 = icmp eq i64 %29, 19
  br i1 %.not36, label %31, label %30

30:                                               ; preds = %28
  tail call void @_exit(i32 noundef 100) #6
  unreachable

31:                                               ; preds = %28
  %32 = tail call i32 @close(i32 noundef %0) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %2) #5
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree "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 = { 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 #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 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass