; LLVM IR from MaJerle/lwpkt :: examples (example_lwpkt)

; 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.lwrb = type { ptr, i64, i64, i64, ptr }
%struct.lwpkt = type { i32, [256 x i8], ptr, ptr, i32, ptr, i8, %struct.anon }
%struct.anon = type { i32, %struct.lwpkt_crc_t, i32, i32, i32, i32, i32, i64, i64 }
%struct.lwpkt_crc_t = type { i32 }

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@pkt_tx_rb = external hidden global %struct.lwrb, align 8
@pkt_tx_rb_data = external hidden global [64 x i8], align 16
@pkt_rx_rb = external hidden global %struct.lwrb, align 8
@pkt_rx_rb_data = external hidden global [64 x i8], align 16
@pkt = external hidden global %struct.lwpkt, align 8
@data = external hidden global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @example_lwpkt() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i8, align 1
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #4
  %6 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %7 = call zeroext i8 @lwrb_init(ptr noundef @pkt_tx_rb, ptr noundef @pkt_tx_rb_data, i64 noundef 64)
  %8 = call zeroext i8 @lwrb_init(ptr noundef @pkt_rx_rb, ptr noundef @pkt_rx_rb_data, i64 noundef 64)
  %9 = call i32 @lwpkt_init(ptr noundef @pkt, ptr noundef @pkt_tx_rb, ptr noundef @pkt_rx_rb)
  %10 = call i32 @lwpkt_set_addr(ptr noundef @pkt, i32 noundef 18)
  %11 = load ptr, ptr @data, align 8, !tbaa !5
  %12 = load ptr, ptr @data, align 8, !tbaa !5
  %13 = call i64 @strlen(ptr noundef %12) #5
  %14 = call i32 @lwpkt_write(ptr noundef @pkt, i32 noundef 17, i32 noundef 305419896, i32 noundef 133, ptr noundef %11, i64 noundef %13)
  store i32 %14, ptr %1, align 4, !tbaa !9
  %15 = call i64 @lwrb_get_full(ptr noundef @pkt_tx_rb)
  %16 = trunc i64 %15 to i32
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %16)
  br label %18

18:                                               ; preds = %21, %0
  %19 = call i64 @lwrb_read(ptr noundef @pkt_tx_rb, ptr noundef %2, i64 noundef 1)
  %20 = icmp eq i64 %19, 1
  br i1 %20, label %21, label %26

21:                                               ; preds = %18
  %22 = load i8, ptr %2, align 1, !tbaa !11
  %23 = zext i8 %22 to i32
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %23)
  %25 = call i64 @lwrb_write(ptr noundef @pkt_rx_rb, ptr noundef %2, i64 noundef 1)
  br label %18, !llvm.loop !12

26:                                               ; preds = %18
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %28 = call i32 @lwpkt_read(ptr noundef @pkt)
  store i32 %28, ptr %1, align 4, !tbaa !9
  %29 = load i32, ptr %1, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 3
  br i1 %30, label %31, label %85

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %33 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 3), align 4, !tbaa !14
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %33)
  %35 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 4), align 8, !tbaa !19
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %35)
  %37 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 5), align 4, !tbaa !20
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %37)
  %39 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 6), align 8, !tbaa !21
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %39)
  %41 = load i64, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 7), align 8, !tbaa !22
  %42 = trunc i64 %41 to i32
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %42)
  %44 = load i64, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 7), align 8, !tbaa !22
  store i64 %44, ptr %3, align 8, !tbaa !23
  %45 = icmp ugt i64 %44, 0
  br i1 %45, label %46, label %65

46:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 1), ptr %4, align 8, !tbaa !5
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !23
  br label %48

48:                                               ; preds = %60, %46
  %49 = load i64, ptr %5, align 8, !tbaa !23
  %50 = load i64, ptr %3, align 8, !tbaa !23
  %51 = icmp ult i64 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %63

53:                                               ; preds = %48
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i64, ptr %5, align 8, !tbaa !23
  %56 = getelementptr inbounds i8, ptr %54, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = zext i8 %57 to i32
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %58)
  br label %60

60:                                               ; preds = %53
  %61 = load i64, ptr %5, align 8, !tbaa !23
  %62 = add i64 %61, 1
  store i64 %62, ptr %5, align 8, !tbaa !23
  br label %48, !llvm.loop !24

63:                                               ; preds = %52
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %65

65:                                               ; preds = %63, %31
  br i1 true, label %66, label %70

66:                                               ; preds = %65
  %67 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 4), align 8, !tbaa !19
  %68 = load i32, ptr @pkt, align 8, !tbaa !25
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %71, label %73

70:                                               ; preds = %65
  br i1 false, label %71, label %73

71:                                               ; preds = %70, %66
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %84

73:                                               ; preds = %70, %66
  br i1 true, label %74, label %77

74:                                               ; preds = %73
  %75 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 4), align 8, !tbaa !19
  %76 = icmp eq i32 %75, 255
  br i1 %76, label %78, label %80

77:                                               ; preds = %73
  br i1 false, label %78, label %80

78:                                               ; preds = %77, %74
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %83

80:                                               ; preds = %77, %74
  %81 = load i32, ptr getelementptr inbounds (%struct.anon, ptr getelementptr inbounds (%struct.lwpkt, ptr @pkt, i32 0, i32 7), i32 0, i32 4), align 8, !tbaa !19
  %82 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %81)
  br label %83

83:                                               ; preds = %80, %78
  br label %84

84:                                               ; preds = %83, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %93

85:                                               ; preds = %26
  %86 = load i32, ptr %1, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 2
  br i1 %87, label %88, label %90

88:                                               ; preds = %85
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  br label %92

90:                                               ; preds = %85
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  br label %92

92:                                               ; preds = %90, %88
  br label %93

93:                                               ; preds = %92, %84
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret i32 0
}

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

declare i32 @printf(ptr noundef, ...) #2

declare zeroext i8 @lwrb_init(ptr noundef, ptr noundef, i64 noundef) #2

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

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

declare i32 @lwpkt_write(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

declare i64 @lwrb_get_full(ptr noundef) #2

declare i64 @lwrb_read(ptr noundef, ptr noundef, i64 noundef) #2

declare i64 @lwrb_write(ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @lwpkt_read(ptr noundef) #2

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

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 = { "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(read) "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(read) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !10, i64 316}
!15 = !{!"lwpkt", !10, i64 0, !7, i64 4, !6, i64 264, !6, i64 272, !10, i64 280, !6, i64 288, !7, i64 296, !16, i64 304}
!16 = !{!"", !10, i64 0, !17, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !18, i64 32, !18, i64 40}
!17 = !{!"", !10, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!15, !10, i64 320}
!20 = !{!15, !10, i64 324}
!21 = !{!15, !10, i64 328}
!22 = !{!15, !18, i64 336}
!23 = !{!18, !18, i64 0}
!24 = distinct !{!24, !13}
!25 = !{!15, !10, 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"

%struct.lwrb = type { ptr, i64, i64, i64, ptr }
%struct.lwpkt = type { i32, [256 x i8], ptr, ptr, i32, ptr, i8, %struct.anon }
%struct.anon = type { i32, %struct.lwpkt_crc_t, i32, i32, i32, i32, i32, i64, i64 }
%struct.lwpkt_crc_t = type { i32 }

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@pkt_tx_rb = external hidden global %struct.lwrb, align 8
@pkt_tx_rb_data = external hidden global [64 x i8], align 16
@pkt_rx_rb = external hidden global %struct.lwrb, align 8
@pkt_rx_rb_data = external hidden global [64 x i8], align 16
@pkt = external hidden global %struct.lwpkt, align 8
@data = external hidden local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @example_lwpkt() local_unnamed_addr #0 {
  %1 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #5
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %3 = tail call zeroext i8 @lwrb_init(ptr noundef nonnull @pkt_tx_rb, ptr noundef nonnull @pkt_tx_rb_data, i64 noundef 64) #5
  %4 = tail call zeroext i8 @lwrb_init(ptr noundef nonnull @pkt_rx_rb, ptr noundef nonnull @pkt_rx_rb_data, i64 noundef 64) #5
  %5 = tail call i32 @lwpkt_init(ptr noundef nonnull @pkt, ptr noundef nonnull @pkt_tx_rb, ptr noundef nonnull @pkt_rx_rb) #5
  %6 = tail call i32 @lwpkt_set_addr(ptr noundef nonnull @pkt, i32 noundef 18) #5
  %7 = load ptr, ptr @data, align 8, !tbaa !5
  %8 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %7) #6
  %9 = tail call i32 @lwpkt_write(ptr noundef nonnull @pkt, i32 noundef 17, i32 noundef 305419896, i32 noundef 133, ptr noundef %7, i64 noundef %8) #5
  %10 = tail call i64 @lwrb_get_full(ptr noundef nonnull @pkt_tx_rb) #5
  %11 = trunc i64 %10 to i32
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
  %13 = call i64 @lwrb_read(ptr noundef nonnull @pkt_tx_rb, ptr noundef nonnull %1, i64 noundef 1) #5
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %15 = load i8, ptr %1, align 1, !tbaa !9
  %16 = zext i8 %15 to i32
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
  %18 = call i64 @lwrb_write(ptr noundef nonnull @pkt_rx_rb, ptr noundef nonnull %1, i64 noundef 1) #5
  %19 = call i64 @lwrb_read(ptr noundef nonnull @pkt_tx_rb, ptr noundef nonnull %1, i64 noundef 1) #5
  %20 = icmp eq i64 %19, 1
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %.lr.ph, %0
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %22 = call i32 @lwpkt_read(ptr noundef nonnull @pkt) #5
  switch i32 %22, label %61 [
    i32 3, label %23
    i32 2, label %59
  ]

23:                                               ; preds = %._crit_edge
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @pkt, i64 316), align 4, !tbaa !12
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %25)
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @pkt, i64 320), align 8, !tbaa !18
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %27)
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @pkt, i64 324), align 4, !tbaa !19
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %29)
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @pkt, i64 328), align 8, !tbaa !20
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %31)
  %33 = load i64, ptr getelementptr inbounds (i8, ptr @pkt, i64 336), align 8, !tbaa !21
  %34 = trunc i64 %33 to i32
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %34)
  %36 = load i64, ptr getelementptr inbounds (i8, ptr @pkt, i64 336), align 8, !tbaa !21
  %.not = icmp eq i64 %36, 0
  br i1 %.not, label %47, label %37

37:                                               ; preds = %23
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %41

39:                                               ; preds = %41
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %47

41:                                               ; preds = %37, %41
  %.09 = phi i64 [ 0, %37 ], [ %46, %41 ]
  %42 = getelementptr inbounds i8, ptr getelementptr inbounds (i8, ptr @pkt, i64 4), i64 %.09
  %43 = load i8, ptr %42, align 1, !tbaa !9
  %44 = zext i8 %43 to i32
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %44)
  %46 = add nuw i64 %.09, 1
  %exitcond.not = icmp eq i64 %46, %36
  br i1 %exitcond.not, label %39, label %41, !llvm.loop !22

47:                                               ; preds = %23, %39
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @pkt, i64 320), align 8, !tbaa !18
  %49 = load i32, ptr @pkt, align 8, !tbaa !23
  %50 = icmp eq i32 %48, %49
  br i1 %50, label %51, label %53

51:                                               ; preds = %47
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  br label %63

53:                                               ; preds = %47
  %54 = icmp eq i32 %48, 255
  br i1 %54, label %55, label %57

55:                                               ; preds = %53
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %63

57:                                               ; preds = %53
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %48)
  br label %63

59:                                               ; preds = %._crit_edge
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %63

61:                                               ; preds = %._crit_edge
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  br label %63

63:                                               ; preds = %51, %57, %55, %59, %61
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #5
  ret i32 0
}

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

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

declare zeroext i8 @lwrb_init(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @lwpkt_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @lwpkt_set_addr(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @lwpkt_write(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

declare i64 @lwrb_get_full(ptr noundef) local_unnamed_addr #3

declare i64 @lwrb_read(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i64 @lwrb_write(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @lwpkt_read(ptr noundef) local_unnamed_addr #3

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

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

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !14, i64 316}
!13 = !{!"lwpkt", !14, i64 0, !7, i64 4, !6, i64 264, !6, i64 272, !14, i64 280, !6, i64 288, !7, i64 296, !15, i64 304}
!14 = !{!"int", !7, i64 0}
!15 = !{!"", !14, i64 0, !16, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !17, i64 32, !17, i64 40}
!16 = !{!"", !14, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!13, !14, i64 320}
!19 = !{!13, !14, i64 324}
!20 = !{!13, !14, i64 328}
!21 = !{!13, !17, i64 336}
!22 = distinct !{!22, !11}
!23 = !{!13, !14, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass