; LLVM IR from caryll/otfcc :: dep/extern (sds)

; 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 [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @sdscatlen(ptr noundef, ptr noundef, i64 noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local ptr @sdscatrepr(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = call ptr @sdscatlen(ptr noundef %7, ptr noundef @.str.6, i64 noundef 1)
  store ptr %8, ptr %4, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %63, %3
  %10 = load i64, ptr %6, align 8, !tbaa !9
  %11 = add i64 %10, -1
  store i64 %11, ptr %6, align 8, !tbaa !9
  %12 = icmp ne i64 %10, 0
  br i1 %12, label %13, label %66

13:                                               ; preds = %9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load i8, ptr %14, align 1, !tbaa !11
  %16 = sext i8 %15 to i32
  switch i32 %16, label %38 [
    i32 92, label %17
    i32 34, label %17
    i32 10, label %23
    i32 13, label %26
    i32 9, label %29
    i32 7, label %32
    i32 8, label %35
  ]

17:                                               ; preds = %13, %13
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load i8, ptr %19, align 1, !tbaa !11
  %21 = sext i8 %20 to i32
  %22 = call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %18, ptr noundef @.str.7, i32 noundef %21)
  store ptr %22, ptr %4, align 8, !tbaa !5
  br label %63

23:                                               ; preds = %13
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call ptr @sdscatlen(ptr noundef %24, ptr noundef @.str.8, i64 noundef 2)
  store ptr %25, ptr %4, align 8, !tbaa !5
  br label %63

26:                                               ; preds = %13
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call ptr @sdscatlen(ptr noundef %27, ptr noundef @.str.9, i64 noundef 2)
  store ptr %28, ptr %4, align 8, !tbaa !5
  br label %63

29:                                               ; preds = %13
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = call ptr @sdscatlen(ptr noundef %30, ptr noundef @.str.10, i64 noundef 2)
  store ptr %31, ptr %4, align 8, !tbaa !5
  br label %63

32:                                               ; preds = %13
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = call ptr @sdscatlen(ptr noundef %33, ptr noundef @.str.11, i64 noundef 2)
  store ptr %34, ptr %4, align 8, !tbaa !5
  br label %63

35:                                               ; preds = %13
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call ptr @sdscatlen(ptr noundef %36, ptr noundef @.str.12, i64 noundef 2)
  store ptr %37, ptr %4, align 8, !tbaa !5
  br label %63

38:                                               ; preds = %13
  %39 = call ptr @__ctype_b_loc() #2
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = sext i8 %42 to i32
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i16, ptr %40, i64 %44
  %46 = load i16, ptr %45, align 2, !tbaa !12
  %47 = zext i16 %46 to i32
  %48 = and i32 %47, 16384
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %56

50:                                               ; preds = %38
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load i8, ptr %52, align 1, !tbaa !11
  %54 = sext i8 %53 to i32
  %55 = call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %51, ptr noundef @.str.13, i32 noundef %54)
  store ptr %55, ptr %4, align 8, !tbaa !5
  br label %62

56:                                               ; preds = %38
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = load i8, ptr %58, align 1, !tbaa !11
  %60 = zext i8 %59 to i32
  %61 = call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %57, ptr noundef @.str.14, i32 noundef %60)
  store ptr %61, ptr %4, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %56, %50
  br label %63

63:                                               ; preds = %62, %35, %32, %29, %26, %23, %17
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i32 1
  store ptr %65, ptr %5, align 8, !tbaa !5
  br label %9, !llvm.loop !14

66:                                               ; preds = %9
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = call ptr @sdscatlen(ptr noundef %67, ptr noundef @.str.6, i64 noundef 1)
  ret ptr %68
}

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #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 = { nounwind willreturn memory(none) "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 willreturn memory(none) }

!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 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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 [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @sdscatrepr(ptr noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = tail call ptr @sdscatlen(ptr noundef %0, ptr noundef nonnull @.str.6, i64 noundef 1)
  %.not19 = icmp eq i64 %2, 0
  br i1 %.not19, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %32
  %.in = phi i64 [ %5, %32 ], [ %2, %3 ]
  %.01621 = phi ptr [ %33, %32 ], [ %1, %3 ]
  %.01720 = phi ptr [ %.1, %32 ], [ %4, %3 ]
  %5 = add i64 %.in, -1
  %6 = load i8, ptr %.01621, align 1, !tbaa !5
  %7 = sext i8 %6 to i32
  switch i8 %6, label %20 [
    i8 92, label %8
    i8 34, label %8
    i8 10, label %10
    i8 13, label %12
    i8 9, label %14
    i8 7, label %16
    i8 8, label %18
  ]

8:                                                ; preds = %.lr.ph, %.lr.ph
  %9 = tail call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %.01720, ptr noundef nonnull @.str.7, i32 noundef %7)
  br label %32

10:                                               ; preds = %.lr.ph
  %11 = tail call ptr @sdscatlen(ptr noundef %.01720, ptr noundef nonnull @.str.8, i64 noundef 2)
  br label %32

12:                                               ; preds = %.lr.ph
  %13 = tail call ptr @sdscatlen(ptr noundef %.01720, ptr noundef nonnull @.str.9, i64 noundef 2)
  br label %32

14:                                               ; preds = %.lr.ph
  %15 = tail call ptr @sdscatlen(ptr noundef %.01720, ptr noundef nonnull @.str.10, i64 noundef 2)
  br label %32

16:                                               ; preds = %.lr.ph
  %17 = tail call ptr @sdscatlen(ptr noundef %.01720, ptr noundef nonnull @.str.11, i64 noundef 2)
  br label %32

18:                                               ; preds = %.lr.ph
  %19 = tail call ptr @sdscatlen(ptr noundef %.01720, ptr noundef nonnull @.str.12, i64 noundef 2)
  br label %32

20:                                               ; preds = %.lr.ph
  %21 = tail call ptr @__ctype_b_loc() #2
  %22 = load ptr, ptr %21, align 8, !tbaa !8
  %23 = sext i8 %6 to i64
  %24 = getelementptr inbounds i16, ptr %22, i64 %23
  %25 = load i16, ptr %24, align 2, !tbaa !10
  %26 = and i16 %25, 16384
  %.not18 = icmp eq i16 %26, 0
  br i1 %.not18, label %29, label %27

27:                                               ; preds = %20
  %28 = tail call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %.01720, ptr noundef nonnull @.str.13, i32 noundef %7)
  br label %32

29:                                               ; preds = %20
  %30 = zext i8 %6 to i32
  %31 = tail call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %.01720, ptr noundef nonnull @.str.14, i32 noundef %30)
  br label %32

32:                                               ; preds = %27, %29, %18, %16, %14, %12, %10, %8
  %.1 = phi ptr [ %28, %27 ], [ %31, %29 ], [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ]
  %33 = getelementptr inbounds i8, ptr %.01621, i64 1
  %.not = icmp eq i64 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %32, %3
  %.017.lcssa = phi ptr [ %4, %3 ], [ %.1, %32 ]
  %34 = tail call ptr @sdscatlen(ptr noundef %.017.lcssa, ptr noundef nonnull @.str.6, i64 noundef 1)
  ret ptr %34
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() 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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 willreturn memory(none) }

!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 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass