; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_ArgsParser (parseBuildCommand__)

; 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.string__ = type { ptr, i32 }
%struct.tag_____ArgsParserState__ = type { ptr, ptr, ptr, ptr, ptr, %struct.string__, %struct.string__, i32, %struct.string__, %struct.tag_____IntRange__, ptr }
%struct.tag_____IntRange__ = type { i32, i32 }
%struct.tag_____CompileArgs__ = type { ptr, %struct.string__, %struct.string__, %struct.string__, i8, i8, %struct.string__, %struct.string__, i32, i8, i8, i8 }

@mu_____string0 = external dso_local global %struct.string__, align 8
@mu_____string585 = external dso_local global %struct.string__, align 8

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @string__equals__(ptr, i32, ptr, i32) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @ArgsParser__parseBuildCommand__(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  call void @ArgsParser__readToken__(ptr noundef %3)
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.tag_____ArgsParserState__, ptr %4, i32 0, i32 8
  %6 = getelementptr inbounds { ptr, i32 }, ptr %5, i32 0, i32 0
  %7 = load ptr, ptr %6, align 8
  %8 = getelementptr inbounds { ptr, i32 }, ptr %5, i32 0, i32 1
  %9 = load i32, ptr %8, align 8
  %10 = load ptr, ptr @mu_____string0, align 8
  %11 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string0, i32 0, i32 1), align 8
  %12 = call zeroext i8 @string__equals__(ptr %7, i32 %9, ptr %10, i32 %11)
  %13 = icmp ne i8 %12, 0
  br i1 %13, label %14, label %18

14:                                               ; preds = %1
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load ptr, ptr @mu_____string585, align 8
  %17 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string585, i32 0, i32 1), align 8
  call void @ArgsParser__expected__(ptr noundef %15, ptr %16, i32 %17)
  br label %27

18:                                               ; preds = %1
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tag_____ArgsParserState__, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.tag_____CompileArgs__, ptr %21, i32 0, i32 6
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.tag_____ArgsParserState__, ptr %23, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %24, i64 16, i1 false), !tbaa.struct !14
  br label %25

25:                                               ; preds = %18
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  call void @ArgsParser__readToken__(ptr noundef %26)
  br label %27

27:                                               ; preds = %25, %14
  ret void
}

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

attributes #0 = { nocallback nofree 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" }

!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, !6, i64 0}
!10 = !{!"tag_____ArgsParserState__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 56, !12, i64 72, !11, i64 80, !13, i64 96, !6, i64 104}
!11 = !{!"", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"tag_____IntRange__", !12, i64 0, !12, i64 4}
!14 = !{i64 0, i64 8, !5, i64 8, i64 4, !15}
!15 = !{!12, !12, 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"

%struct.string__ = type { ptr, i32 }

@mu_____string0 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string585 = external dso_local local_unnamed_addr global %struct.string__, align 8

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @string__equals__(ptr, i32, ptr, i32) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @ArgsParser__parseBuildCommand__(ptr noundef %0) local_unnamed_addr #1 {
  tail call void @ArgsParser__readToken__(ptr noundef %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 80
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load i32, ptr %4, align 8
  %6 = load ptr, ptr @mu_____string0, align 8
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string0, i64 8), align 8
  %8 = tail call zeroext i8 @string__equals__(ptr %3, i32 %5, ptr %6, i32 %7)
  %.not = icmp eq i8 %8, 0
  br i1 %.not, label %12, label %9

9:                                                ; preds = %1
  %10 = load ptr, ptr @mu_____string585, align 8
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string585, i64 8), align 8
  tail call void @ArgsParser__expected__(ptr noundef nonnull %0, ptr %10, i32 %11)
  br label %15

12:                                               ; preds = %1
  %13 = load ptr, ptr %0, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 64
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 16, i1 false), !tbaa.struct !13
  tail call void @ArgsParser__readToken__(ptr noundef nonnull %0)
  br label %15

15:                                               ; preds = %12, %9
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree 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" }

!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 = !{!"tag_____ArgsParserState__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 56, !11, i64 72, !10, i64 80, !12, i64 96, !7, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0, !11, i64 8}
!11 = !{!"int", !8, i64 0}
!12 = !{!"tag_____IntRange__", !11, i64 0, !11, i64 4}
!13 = !{i64 0, i64 8, !14, i64 8, i64 4, !15}
!14 = !{!7, !7, i64 0}
!15 = !{!11, !11, i64 0}


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