; LLVM IR from pmwkaa/monotone :: monotone/main/command (parse_cloud)

; 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.Runtime = type { %struct.ExceptionMgr, %struct.Error, ptr }
%struct.ExceptionMgr = type { ptr }
%struct.Error = type { [256 x i8], i32, ptr, ptr, i32, ptr, ptr }
%struct.Guard = type { ptr, ptr, ptr }
%struct.CmdCloudAlter = type { %struct.Cmd, i8, %struct.Token, %struct.Token, ptr, i32 }
%struct.Cmd = type { i32, ptr }
%struct.Token = type { i32, %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { %struct.Str, i8 }
%struct.Str = type { ptr, ptr, i8 }
%struct.Exception = type { ptr, i8, ptr, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@mn_runtime = external thread_local global %struct.Runtime, align 8
@.str = external hidden unnamed_addr constant [85 x i8], align 1
@__func__.parse_cloud_alter = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [42 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: inlinehint nounwind uwtable
declare hidden void @cmd_free(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #2

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @guard_runner(ptr noundef) #3

declare zeroext i1 @lex_if(ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: inlinehint noreturn nounwind uwtable
declare hidden void @error_throw_as(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) #5

; Function Attrs: alwaysinline nounwind uwtable
declare hidden ptr @unguard() #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @parse_if_exists(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @parse_cloud_alter(ptr noundef %0) #6 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.Guard, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %8 = call ptr @cmd_cloud_alter_allocate()
  store ptr %8, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #7
  %9 = getelementptr inbounds %struct.Guard, ptr %4, i32 0, i32 0
  store ptr @cmd_free, ptr %9, align 8, !tbaa !9
  %10 = getelementptr inbounds %struct.Guard, ptr %4, i32 0, i32 1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.CmdCloudAlter, ptr %11, i32 0, i32 0
  store ptr %12, ptr %10, align 8, !tbaa !11
  %13 = getelementptr inbounds %struct.Guard, ptr %4, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %14 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %15 = getelementptr inbounds %struct.Runtime, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.ExceptionMgr, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  store ptr %17, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Exception, ptr %18, i32 0, i32 2
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  store ptr %20, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Exception, ptr %21, i32 0, i32 2
  store ptr %4, ptr %22, align 8, !tbaa !17
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %23, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %24, ptr %13, align 8, !tbaa !20
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = call zeroext i1 @parse_if_exists(ptr noundef %25)
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.CmdCloudAlter, ptr %27, i32 0, i32 1
  %29 = zext i1 %26 to i8
  store i8 %29, ptr %28, align 8, !tbaa !21
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.CmdCloudAlter, ptr %31, i32 0, i32 2
  %33 = call zeroext i1 @lex_if(ptr noundef %30, i32 noundef 4, ptr noundef %32)
  br i1 %33, label %39, label %34

34:                                               ; preds = %1
  %35 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %36 = getelementptr inbounds %struct.Runtime, ptr %35, i32 0, i32 1
  %37 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %38 = getelementptr inbounds %struct.Runtime, ptr %37, i32 0, i32 0
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %36, ptr noundef %38, ptr noundef @.str, ptr noundef @__func__.parse_cloud_alter, i32 noundef 204, ptr noundef @.str.4) #8
  unreachable

39:                                               ; preds = %1
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = call zeroext i1 @lex_if(ptr noundef %40, i32 noundef 43, ptr noundef null)
  br i1 %41, label %42, label %46

42:                                               ; preds = %39
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.CmdCloudAlter, ptr %44, i32 0, i32 0
  call void @parse_cloud_alter_rename(ptr noundef %43, ptr noundef %45)
  br label %59

46:                                               ; preds = %39
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = call zeroext i1 @lex_if(ptr noundef %47, i32 noundef 25, ptr noundef null)
  br i1 %48, label %49, label %53

49:                                               ; preds = %46
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.CmdCloudAlter, ptr %51, i32 0, i32 0
  call void @parse_cloud_alter_set(ptr noundef %50, ptr noundef %52)
  br label %58

53:                                               ; preds = %46
  %54 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %55 = getelementptr inbounds %struct.Runtime, ptr %54, i32 0, i32 1
  %56 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %57 = getelementptr inbounds %struct.Runtime, ptr %56, i32 0, i32 0
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef %55, ptr noundef %57, ptr noundef @.str, ptr noundef @__func__.parse_cloud_alter, i32 noundef 213, ptr noundef @.str.5) #8
  unreachable

58:                                               ; preds = %49
  br label %59

59:                                               ; preds = %58, %42
  %60 = call ptr @unguard()
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.CmdCloudAlter, ptr %61, i32 0, i32 0
  call void @guard_runner(ptr noundef %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  ret ptr %62
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cmd_cloud_alter_allocate() #1

; Function Attrs: nounwind uwtable
declare hidden void @parse_cloud_alter_rename(ptr noundef, ptr noundef) #6

; Function Attrs: nounwind uwtable
declare hidden void @parse_cloud_alter_set(ptr noundef, ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { alwaysinline 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 #4 = { "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 #5 = { inlinehint noreturn 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"Guard", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !6, i64 0}
!13 = !{!"Runtime", !14, i64 0, !15, i64 8, !6, i64 312}
!14 = !{!"ExceptionMgr", !6, i64 0}
!15 = !{!"Error", !7, i64 0, !16, i64 256, !6, i64 264, !6, i64 272, !16, i64 280, !6, i64 288, !6, i64 296}
!16 = !{!"int", !7, i64 0}
!17 = !{!18, !6, i64 16}
!18 = !{!"Exception", !6, i64 0, !19, i64 8, !6, i64 16, !7, i64 24}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{!10, !6, i64 16}
!21 = !{!22, !19, i64 16}
!22 = !{!"CmdCloudAlter", !23, i64 0, !19, i64 16, !24, i64 24, !24, i64 64, !6, i64 104, !16, i64 112}
!23 = !{!"Cmd", !16, i64 0, !6, i64 8}
!24 = !{!"Token", !16, i64 0, !7, i64 8}


; 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.Runtime = type { %struct.ExceptionMgr, %struct.Error, ptr }
%struct.ExceptionMgr = type { ptr }
%struct.Error = type { [256 x i8], i32, ptr, ptr, i32, ptr, ptr }
%struct.Guard = type { ptr, ptr, ptr }

@mn_runtime = external thread_local global %struct.Runtime, align 8
@.str = external hidden unnamed_addr constant [85 x i8], align 1
@__func__.parse_cloud_alter = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cmd_free(ptr noundef) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #2

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @guard_runner(ptr noundef) local_unnamed_addr #3

declare zeroext i1 @lex_if(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint noreturn nounwind uwtable
declare hidden void @error_throw_as(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #5

; Function Attrs: alwaysinline nounwind uwtable
declare hidden ptr @unguard() local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @parse_if_exists(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @parse_cloud_alter(ptr noundef %0) local_unnamed_addr #6 {
  %2 = alloca %struct.Guard, align 8
  %3 = tail call ptr @cmd_cloud_alter_allocate()
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #7
  store ptr @cmd_free, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr %3, ptr %4, align 8, !tbaa !10
  %5 = getelementptr inbounds i8, ptr %2, i64 16
  %6 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !16
  store ptr %2, ptr %8, align 8, !tbaa !16
  store ptr %9, ptr %5, align 8, !tbaa !19
  %10 = call zeroext i1 @parse_if_exists(ptr noundef %0)
  %11 = getelementptr inbounds i8, ptr %3, i64 16
  %12 = zext i1 %10 to i8
  store i8 %12, ptr %11, align 8, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %3, i64 24
  %14 = call zeroext i1 @lex_if(ptr noundef %0, i32 noundef 4, ptr noundef nonnull %13) #7
  br i1 %14, label %17, label %15

15:                                               ; preds = %1
  %16 = getelementptr inbounds i8, ptr %6, i64 8
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %16, ptr noundef nonnull %6, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.parse_cloud_alter, i32 noundef 204, ptr noundef nonnull @.str.4) #8
  unreachable

17:                                               ; preds = %1
  %18 = call zeroext i1 @lex_if(ptr noundef %0, i32 noundef 43, ptr noundef null) #7
  br i1 %18, label %19, label %20

19:                                               ; preds = %17
  call void @parse_cloud_alter_rename(ptr noundef %0, ptr noundef nonnull %3)
  br label %25

20:                                               ; preds = %17
  %21 = call zeroext i1 @lex_if(ptr noundef %0, i32 noundef 25, ptr noundef null) #7
  br i1 %21, label %22, label %23

22:                                               ; preds = %20
  call void @parse_cloud_alter_set(ptr noundef %0, ptr noundef nonnull %3)
  br label %25

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %6, i64 8
  call void (ptr, ptr, ptr, ptr, i32, ptr, ...) @error_throw_as(ptr noundef nonnull %24, ptr noundef nonnull %6, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.parse_cloud_alter, i32 noundef 213, ptr noundef nonnull @.str.5) #8
  unreachable

25:                                               ; preds = %22, %19
  %26 = call ptr @unguard()
  call void @guard_runner(ptr noundef nonnull %2)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #7
  ret ptr %3
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @cmd_cloud_alter_allocate() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @parse_cloud_alter_rename(ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare hidden void @parse_cloud_alter_set(ptr noundef, ptr noundef) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { alwaysinline 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 #4 = { "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 #5 = { inlinehint noreturn 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"Guard", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !7, i64 0}
!12 = !{!"Runtime", !13, i64 0, !14, i64 8, !7, i64 312}
!13 = !{!"ExceptionMgr", !7, i64 0}
!14 = !{!"Error", !8, i64 0, !15, i64 256, !7, i64 264, !7, i64 272, !15, i64 280, !7, i64 288, !7, i64 296}
!15 = !{!"int", !8, i64 0}
!16 = !{!17, !7, i64 16}
!17 = !{!"Exception", !7, i64 0, !18, i64 8, !7, i64 16, !8, i64 24}
!18 = !{!"_Bool", !8, i64 0}
!19 = !{!6, !7, i64 16}
!20 = !{!21, !18, i64 16}
!21 = !{!"CmdCloudAlter", !22, i64 0, !18, i64 16, !23, i64 24, !23, i64 64, !7, i64 104, !15, i64 112}
!22 = !{!"Cmd", !15, i64 0, !7, i64 8}
!23 = !{!"Token", !15, i64 0, !8, i64 8}


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