; LLVM IR from darnstrom/daqp :: codegen (codegen)

; 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.DAQPBnB = type { ptr, i32, i32, ptr, i32, ptr, i32, i32, ptr, i32, i32 }

@.str.69 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
define dso_local void @write_daqp_bnb_src(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %3
  br label %73

10:                                               ; preds = %3
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef @.str.76) #2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.DAQPBnB, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.DAQPBnB, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !13
  call void @write_int_array(ptr noundef %13, ptr noundef %16, i32 noundef %19, ptr noundef @.str.77)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.DAQPBnB, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 8, !tbaa !13
  %24 = add nsw i32 %23, 1
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str.78, i32 noundef %24) #2
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.DAQPBnB, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !13
  %32 = add nsw i32 %31, 1
  %33 = mul nsw i32 %28, %32
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.79, i32 noundef %33) #2
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.DAQPBnB, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 8, !tbaa !13
  %39 = add nsw i32 %38, 1
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.80, i32 noundef %39) #2
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str.81) #2
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.82) #2
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.DAQPBnB, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.83, i32 noundef %48) #2
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.DAQPBnB, ptr %51, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !14
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.83, i32 noundef %53) #2
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.84) #2
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.83, i32 noundef 0) #2
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.85) #2
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.83, i32 noundef 0) #2
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.83, i32 noundef 0) #2
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef @.str.86) #2
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef @.str.83, i32 noundef 0) #2
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef @.str.83, i32 noundef 0) #2
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.69) #2
  br label %73

73:                                               ; preds = %10, %9
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @write_int_array(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

attributes #0 = { nounwind "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 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !6, i64 48, !10, i64 56, !10, i64 60}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 12}


; 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.69 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @write_daqp_bnb_src(ptr noundef %0, ptr noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp eq ptr %1, null
  br i1 %4, label %37, label %5

5:                                                ; preds = %3
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.76) #2
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !11
  tail call void @write_int_array(ptr noundef %0, ptr noundef %7, i32 noundef %9, ptr noundef nonnull @.str.77)
  %10 = load i32, ptr %8, align 8, !tbaa !11
  %11 = add nsw i32 %10, 1
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.78, i32 noundef %11) #2
  %13 = add nsw i32 %2, 1
  %14 = load i32, ptr %8, align 8, !tbaa !11
  %15 = add nsw i32 %14, 1
  %16 = mul nsw i32 %15, %13
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.79, i32 noundef %16) #2
  %18 = load i32, ptr %8, align 8, !tbaa !11
  %19 = add nsw i32 %18, 1
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.80, i32 noundef %19) #2
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.81) #2
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.82) #2
  %23 = load i32, ptr %8, align 8, !tbaa !11
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef %23) #2
  %25 = getelementptr inbounds i8, ptr %1, i64 12
  %26 = load i32, ptr %25, align 4, !tbaa !12
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef %26) #2
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.84) #2
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef 0) #2
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.85) #2
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef 0) #2
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef 0) #2
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.86) #2
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef 0) #2
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.83, i32 noundef 0) #2
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.69) #2
  br label %37

37:                                               ; preds = %3, %5
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @write_int_array(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { nofree nounwind "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 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !10, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !7, i64 48, !10, i64 56, !10, i64 60}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 12}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass