; LLVM IR from Gottox/sqsh-tools :: tools/src (common)

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

@stdout = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @locked_fprintf(ptr noundef, ptr 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
declare dso_local void @locked_fputs(ptr noundef, ptr noundef) #0

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

7:                                                ; preds = %44, %2
  %8 = load i64, ptr %5, align 8, !tbaa !9
  %9 = load i64, ptr %4, align 8, !tbaa !9
  %10 = icmp ult i64 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %47

12:                                               ; preds = %7
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = load i64, ptr %5, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %13, i64 %14
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = sext i8 %16 to i32
  switch i32 %17, label %35 [
    i32 10, label %18
    i32 13, label %20
    i32 9, label %22
    i32 92, label %24
    i32 27, label %26
    i32 1, label %28
    i32 2, label %28
    i32 3, label %28
    i32 4, label %28
    i32 5, label %28
    i32 6, label %28
    i32 7, label %28
    i32 8, label %28
    i32 11, label %28
    i32 12, label %28
    i32 14, label %28
    i32 15, label %28
    i32 16, label %28
    i32 17, label %28
    i32 18, label %28
    i32 19, label %28
    i32 20, label %28
    i32 21, label %28
    i32 22, label %28
    i32 23, label %28
    i32 24, label %28
    i32 25, label %28
    i32 26, label %28
    i32 28, label %28
    i32 29, label %28
    i32 30, label %28
    i32 31, label %28
    i32 32, label %28
    i32 127, label %28
  ]

18:                                               ; preds = %12
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @locked_fputs(ptr noundef @.str.1, ptr noundef %19)
  br label %43

20:                                               ; preds = %12
  %21 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @locked_fputs(ptr noundef @.str.2, ptr noundef %21)
  br label %43

22:                                               ; preds = %12
  %23 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @locked_fputs(ptr noundef @.str.3, ptr noundef %23)
  br label %43

24:                                               ; preds = %12
  %25 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @locked_fputs(ptr noundef @.str.4, ptr noundef %25)
  br label %43

26:                                               ; preds = %12
  %27 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @locked_fputs(ptr noundef @.str.5, ptr noundef %27)
  br label %43

28:                                               ; preds = %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12, %12
  %29 = load ptr, ptr @stdout, align 8, !tbaa !5
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load i64, ptr %5, align 8, !tbaa !9
  %32 = getelementptr inbounds i8, ptr %30, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  call void (ptr, ptr, ...) @locked_fprintf(ptr noundef %29, ptr noundef @.str.6, i32 noundef %34)
  br label %43

35:                                               ; preds = %12
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = load i64, ptr %5, align 8, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %36, i64 %37
  %39 = load i8, ptr %38, align 1, !tbaa !11
  store i8 %39, ptr %6, align 1, !tbaa !11
  %40 = getelementptr inbounds i8, ptr %6, i64 1
  store i8 0, ptr %40, align 1, !tbaa !11
  %41 = getelementptr inbounds [2 x i8], ptr %6, i64 0, i64 0
  %42 = load ptr, ptr @stdout, align 8, !tbaa !5
  call void @locked_fputs(ptr noundef %41, ptr noundef %42)
  br label %43

43:                                               ; preds = %35, %28, %26, %24, %22, %20, %18
  br label %44

44:                                               ; preds = %43
  %45 = load i64, ptr %5, align 8, !tbaa !9
  %46 = add i64 %45, 1
  store i64 %46, ptr %5, align 8, !tbaa !9
  br label %7, !llvm.loop !12

47:                                               ; preds = %11
  ret void
}

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 }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @print_escaped(ptr nocapture noundef readonly %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = alloca [2 x i8], align 1
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %4 = getelementptr inbounds i8, ptr %3, i64 1
  br label %5

._crit_edge:                                      ; preds = %23, %2
  ret void

5:                                                ; preds = %.lr.ph, %23
  %.08 = phi i64 [ 0, %.lr.ph ], [ %24, %23 ]
  %6 = getelementptr inbounds i8, ptr %0, i64 %.08
  %7 = load i8, ptr %6, align 1, !tbaa !5
  switch i8 %7, label %21 [
    i8 10, label %8
    i8 13, label %10
    i8 9, label %12
    i8 92, label %14
    i8 27, label %16
    i8 1, label %18
    i8 2, label %18
    i8 3, label %18
    i8 4, label %18
    i8 5, label %18
    i8 6, label %18
    i8 7, label %18
    i8 8, label %18
    i8 11, label %18
    i8 12, label %18
    i8 14, label %18
    i8 15, label %18
    i8 16, label %18
    i8 17, label %18
    i8 18, label %18
    i8 19, label %18
    i8 20, label %18
    i8 21, label %18
    i8 22, label %18
    i8 23, label %18
    i8 24, label %18
    i8 25, label %18
    i8 26, label %18
    i8 28, label %18
    i8 29, label %18
    i8 30, label %18
    i8 31, label %18
    i8 32, label %18
    i8 127, label %18
  ]

8:                                                ; preds = %5
  %9 = load ptr, ptr @stdout, align 8, !tbaa !8
  call void @locked_fputs(ptr noundef nonnull @.str.1, ptr noundef %9)
  br label %23

10:                                               ; preds = %5
  %11 = load ptr, ptr @stdout, align 8, !tbaa !8
  call void @locked_fputs(ptr noundef nonnull @.str.2, ptr noundef %11)
  br label %23

12:                                               ; preds = %5
  %13 = load ptr, ptr @stdout, align 8, !tbaa !8
  call void @locked_fputs(ptr noundef nonnull @.str.3, ptr noundef %13)
  br label %23

14:                                               ; preds = %5
  %15 = load ptr, ptr @stdout, align 8, !tbaa !8
  call void @locked_fputs(ptr noundef nonnull @.str.4, ptr noundef %15)
  br label %23

16:                                               ; preds = %5
  %17 = load ptr, ptr @stdout, align 8, !tbaa !8
  call void @locked_fputs(ptr noundef nonnull @.str.5, ptr noundef %17)
  br label %23

18:                                               ; preds = %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5, %5
  %19 = load ptr, ptr @stdout, align 8, !tbaa !8
  %20 = zext nneg i8 %7 to i32
  call void (ptr, ptr, ...) @locked_fprintf(ptr noundef %19, ptr noundef nonnull @.str.6, i32 noundef %20)
  br label %23

21:                                               ; preds = %5
  store i8 %7, ptr %3, align 1, !tbaa !5
  store i8 0, ptr %4, align 1, !tbaa !5
  %22 = load ptr, ptr @stdout, align 8, !tbaa !8
  call void @locked_fputs(ptr noundef nonnull %3, ptr noundef %22)
  br label %23

23:                                               ; preds = %8, %10, %12, %14, %16, %18, %21
  %24 = add nuw i64 %.08, 1
  %exitcond.not = icmp eq i64 %24, %1
  br i1 %exitcond.not, label %._crit_edge, label %5, !llvm.loop !10
}

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

!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 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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