; LLVM IR from holzschu/ios_system :: text_cmds/paste (paste)

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

@.str.6 = external hidden unnamed_addr constant [24 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

; Function Attrs: nounwind uwtable
define dso_local i32 @tr(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %6, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %33, %1
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds i32, ptr %8, i32 1
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %10, ptr %4, align 4, !tbaa !9
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %38

12:                                               ; preds = %7
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 92
  br i1 %14, label %15, label %29

15:                                               ; preds = %12
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds i32, ptr %16, i32 1
  store ptr %17, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %18, ptr %4, align 4, !tbaa !9
  switch i32 %18, label %25 [
    i32 110, label %19
    i32 116, label %21
    i32 48, label %23
  ]

19:                                               ; preds = %15
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 10, ptr %20, align 4, !tbaa !9
  br label %28

21:                                               ; preds = %15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 9, ptr %22, align 4, !tbaa !9
  br label %28

23:                                               ; preds = %15
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %28

25:                                               ; preds = %15
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 %26, ptr %27, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %25, %23, %21, %19
  br label %32

29:                                               ; preds = %12
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 %30, ptr %31, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %29, %28
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds i32, ptr %34, i32 1
  store ptr %35, ptr %2, align 8, !tbaa !5
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %3, align 4, !tbaa !9
  br label %7, !llvm.loop !11

38:                                               ; preds = %7
  %39 = load i32, ptr %3, align 4, !tbaa !9
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str.6) #4
  unreachable

42:                                               ; preds = %38
  %43 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %43
}

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #2

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

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 = { 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 }
attributes #4 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 1, 0) i32 @tr(ptr nocapture noundef %0) local_unnamed_addr #0 {
  br label %2

2:                                                ; preds = %11, %1
  %.015 = phi ptr [ %0, %1 ], [ %12, %11 ]
  %.014 = phi i32 [ 0, %1 ], [ %13, %11 ]
  %.0 = phi ptr [ %0, %1 ], [ %.1, %11 ]
  %3 = getelementptr inbounds i8, ptr %.0, i64 4
  %4 = load i32, ptr %.0, align 4, !tbaa !5
  switch i32 %4, label %11 [
    i32 0, label %14
    i32 92, label %5
  ]

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %.0, i64 8
  %7 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %7, label %10 [
    i32 110, label %11
    i32 116, label %8
    i32 48, label %9
  ]

8:                                                ; preds = %5
  br label %11

9:                                                ; preds = %5
  br label %11

10:                                               ; preds = %5
  br label %11

11:                                               ; preds = %2, %5, %10, %9, %8
  %.sink = phi i32 [ %7, %10 ], [ 0, %9 ], [ 9, %8 ], [ 10, %5 ], [ %4, %2 ]
  %.1 = phi ptr [ %6, %10 ], [ %6, %9 ], [ %6, %8 ], [ %6, %5 ], [ %3, %2 ]
  store i32 %.sink, ptr %.015, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %.015, i64 4
  %13 = add nuw nsw i32 %.014, 1
  br label %2, !llvm.loop !9

14:                                               ; preds = %2
  %.not17 = icmp eq i32 %.014, 0
  br i1 %.not17, label %15, label %16

15:                                               ; preds = %14
  tail call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str.6) #2
  unreachable

16:                                               ; preds = %14
  ret i32 %.014
}

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass