; LLVM IR from holzschu/ios_system :: shell_cmds/hexdump (parse)

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

; 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
define dso_local void @escape(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %4, ptr %3, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %43, %1
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = load i8, ptr %6, align 1, !tbaa !9
  %8 = icmp ne i8 %7, 0
  br i1 %8, label %13, label %9

9:                                                ; preds = %5
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = load i8, ptr %10, align 1, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 %11, ptr %12, align 1, !tbaa !9
  br label %48

13:                                               ; preds = %5
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load i8, ptr %14, align 1, !tbaa !9
  %16 = sext i8 %15 to i32
  %17 = icmp eq i32 %16, 92
  br i1 %17, label %18, label %42

18:                                               ; preds = %13
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i32 1
  store ptr %20, ptr %2, align 8, !tbaa !5
  %21 = load i8, ptr %20, align 1, !tbaa !9
  %22 = sext i8 %21 to i32
  switch i32 %22, label %37 [
    i32 97, label %23
    i32 98, label %25
    i32 102, label %27
    i32 110, label %29
    i32 114, label %31
    i32 116, label %33
    i32 118, label %35
  ]

23:                                               ; preds = %18
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 7, ptr %24, align 1, !tbaa !9
  br label %41

25:                                               ; preds = %18
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 8, ptr %26, align 1, !tbaa !9
  br label %41

27:                                               ; preds = %18
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 12, ptr %28, align 1, !tbaa !9
  br label %41

29:                                               ; preds = %18
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 10, ptr %30, align 1, !tbaa !9
  br label %41

31:                                               ; preds = %18
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 13, ptr %32, align 1, !tbaa !9
  br label %41

33:                                               ; preds = %18
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 9, ptr %34, align 1, !tbaa !9
  br label %41

35:                                               ; preds = %18
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 11, ptr %36, align 1, !tbaa !9
  br label %41

37:                                               ; preds = %18
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = load i8, ptr %38, align 1, !tbaa !9
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  store i8 %39, ptr %40, align 1, !tbaa !9
  br label %41

41:                                               ; preds = %37, %35, %33, %31, %29, %27, %25, %23
  br label %42

42:                                               ; preds = %41, %13
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i32 1
  store ptr %45, ptr %2, align 8, !tbaa !5
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i32 1
  store ptr %47, ptr %3, align 8, !tbaa !5
  br label %5

48:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

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 = { 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 = !{!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"

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @escape(ptr nocapture noundef %0) local_unnamed_addr #0 {
  br label %2

2:                                                ; preds = %15, %1
  %.017 = phi ptr [ %0, %1 ], [ %16, %15 ]
  %.0 = phi ptr [ %0, %1 ], [ %17, %15 ]
  %3 = load i8, ptr %.017, align 1, !tbaa !5
  switch i8 %3, label %15 [
    i8 0, label %4
    i8 92, label %5
  ]

4:                                                ; preds = %2
  store i8 0, ptr %.0, align 1, !tbaa !5
  ret void

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %.017, i64 1
  %7 = load i8, ptr %6, align 1, !tbaa !5
  switch i8 %7, label %14 [
    i8 97, label %.sink.split
    i8 98, label %8
    i8 102, label %9
    i8 110, label %10
    i8 114, label %11
    i8 116, label %12
    i8 118, label %13
  ]

8:                                                ; preds = %5
  br label %.sink.split

9:                                                ; preds = %5
  br label %.sink.split

10:                                               ; preds = %5
  br label %.sink.split

11:                                               ; preds = %5
  br label %.sink.split

12:                                               ; preds = %5
  br label %.sink.split

13:                                               ; preds = %5
  br label %.sink.split

14:                                               ; preds = %5
  br label %.sink.split

.sink.split:                                      ; preds = %5, %8, %9, %10, %11, %12, %13, %14
  %.sink = phi i8 [ %7, %14 ], [ 11, %13 ], [ 9, %12 ], [ 13, %11 ], [ 10, %10 ], [ 12, %9 ], [ 8, %8 ], [ 7, %5 ]
  store i8 %.sink, ptr %.0, align 1, !tbaa !5
  br label %15

15:                                               ; preds = %.sink.split, %2
  %.1 = phi ptr [ %.017, %2 ], [ %6, %.sink.split ]
  %16 = getelementptr inbounds i8, ptr %.1, i64 1
  %17 = getelementptr inbounds i8, ptr %.0, i64 1
  br label %2
}

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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" }

!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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass