; LLVM IR from jgaeddert/liquid-dsp :: src/fft/src (spgramcf)

; 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.asgramcf_s = type { i32, i32, i32, ptr, ptr, ptr, [10 x float], [10 x i8], i32, float, float }

@.str = external hidden unnamed_addr constant [81 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [50 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 @asgramcf_set_display(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %36, %2
  %7 = load i32, ptr %5, align 4, !tbaa !9
  %8 = icmp ult i32 %7, 10
  br i1 %8, label %9, label %39

9:                                                ; preds = %6
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %10, i64 %12
  %14 = load i8, ptr %13, align 1, !tbaa !11
  %15 = sext i8 %14 to i32
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %9
  %18 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 157, ptr noundef @.str.6, ptr noundef @.str.2)
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.asgramcf_s, ptr %19, i32 0, i32 7
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds [10 x i8], ptr %20, i64 0, i64 %22
  store i8 63, ptr %23, align 1, !tbaa !11
  br label %35

24:                                               ; preds = %9
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds i8, ptr %25, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !11
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.asgramcf_s, ptr %30, i32 0, i32 7
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds [10 x i8], ptr %31, i64 0, i64 %33
  store i8 %29, ptr %34, align 1, !tbaa !11
  br label %35

35:                                               ; preds = %24, %17
  br label %36

36:                                               ; preds = %35
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = add i32 %37, 1
  store i32 %38, ptr %5, align 4, !tbaa !9
  br label %6, !llvm.loop !12

39:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 0
}

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

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

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

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


; 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 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @asgramcf_set_display(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  %4 = load i8, ptr %1, align 1, !tbaa !5
  %5 = icmp eq i8 %4, 0
  br i1 %5, label %6, label %8

6:                                                ; preds = %2
  %7 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %8

8:                                                ; preds = %2, %6
  %storemerge = phi i8 [ 63, %6 ], [ %4, %2 ]
  store i8 %storemerge, ptr %3, align 1, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 1
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = icmp eq i8 %10, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %8
  %13 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %14

14:                                               ; preds = %8, %12
  %.sink = phi i8 [ 63, %12 ], [ %10, %8 ]
  %15 = getelementptr inbounds i8, ptr %0, i64 81
  store i8 %.sink, ptr %15, align 1, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 2
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = icmp eq i8 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %14
  %20 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %21

21:                                               ; preds = %14, %19
  %.sink12 = phi i8 [ 63, %19 ], [ %17, %14 ]
  %22 = getelementptr inbounds i8, ptr %0, i64 82
  store i8 %.sink12, ptr %22, align 1, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 3
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = icmp eq i8 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %21
  %27 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %28

28:                                               ; preds = %21, %26
  %.sink14 = phi i8 [ 63, %26 ], [ %24, %21 ]
  %29 = getelementptr inbounds i8, ptr %0, i64 83
  store i8 %.sink14, ptr %29, align 1, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %1, i64 4
  %31 = load i8, ptr %30, align 1, !tbaa !5
  %32 = icmp eq i8 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %28
  %34 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %35

35:                                               ; preds = %28, %33
  %.sink16 = phi i8 [ 63, %33 ], [ %31, %28 ]
  %36 = getelementptr inbounds i8, ptr %0, i64 84
  store i8 %.sink16, ptr %36, align 1, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %1, i64 5
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %39 = icmp eq i8 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %42

42:                                               ; preds = %35, %40
  %.sink18 = phi i8 [ 63, %40 ], [ %38, %35 ]
  %43 = getelementptr inbounds i8, ptr %0, i64 85
  store i8 %.sink18, ptr %43, align 1, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %1, i64 6
  %45 = load i8, ptr %44, align 1, !tbaa !5
  %46 = icmp eq i8 %45, 0
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %49

49:                                               ; preds = %42, %47
  %.sink20 = phi i8 [ 63, %47 ], [ %45, %42 ]
  %50 = getelementptr inbounds i8, ptr %0, i64 86
  store i8 %.sink20, ptr %50, align 1, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %1, i64 7
  %52 = load i8, ptr %51, align 1, !tbaa !5
  %53 = icmp eq i8 %52, 0
  br i1 %53, label %54, label %56

54:                                               ; preds = %49
  %55 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %56

56:                                               ; preds = %49, %54
  %.sink22 = phi i8 [ 63, %54 ], [ %52, %49 ]
  %57 = getelementptr inbounds i8, ptr %0, i64 87
  store i8 %.sink22, ptr %57, align 1, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %1, i64 8
  %59 = load i8, ptr %58, align 1, !tbaa !5
  %60 = icmp eq i8 %59, 0
  br i1 %60, label %61, label %63

61:                                               ; preds = %56
  %62 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %63

63:                                               ; preds = %56, %61
  %.sink24 = phi i8 [ 63, %61 ], [ %59, %56 ]
  %64 = getelementptr inbounds i8, ptr %0, i64 88
  store i8 %.sink24, ptr %64, align 1, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %1, i64 9
  %66 = load i8, ptr %65, align 1, !tbaa !5
  %67 = icmp eq i8 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %63
  %69 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 157, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #2
  br label %70

70:                                               ; preds = %63, %68
  %.sink26 = phi i8 [ 63, %68 ], [ %66, %63 ]
  %71 = getelementptr inbounds i8, ptr %0, i64 89
  store i8 %.sink26, ptr %71, align 1, !tbaa !5
  ret i32 0
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, 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 = { "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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


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