; LLVM IR from masyagin1998/GCI :: src/parser (ast)

; 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.STMT_AST = type { %union.anon, i32 }
%union.anon = type { ptr }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @stmt_ast_free(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.STMT_AST, ptr %3, i32 0, i32 1
  %5 = load i32, ptr %4, align 8, !tbaa !9
  switch i32 %5, label %46 [
    i32 0, label %6
    i32 1, label %10
    i32 2, label %14
    i32 3, label %18
    i32 4, label %22
    i32 5, label %26
    i32 6, label %30
    i32 7, label %34
    i32 8, label %38
    i32 9, label %42
  ]

6:                                                ; preds = %1
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.STMT_AST, ptr %7, i32 0, i32 0
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  call void @decl_stmt_ast_free(ptr noundef %9)
  br label %52

10:                                               ; preds = %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.STMT_AST, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  call void @assign_stmt_ast_free(ptr noundef %13)
  br label %52

14:                                               ; preds = %1
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.STMT_AST, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  call void @function_call_stmt_ast_free(ptr noundef %17)
  br label %52

18:                                               ; preds = %1
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.STMT_AST, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !12
  call void @if_stmt_ast_free(ptr noundef %21)
  br label %52

22:                                               ; preds = %1
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.STMT_AST, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !12
  call void @while_stmt_ast_free(ptr noundef %25)
  br label %52

26:                                               ; preds = %1
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.STMT_AST, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  call void @break_stmt_ast_free(ptr noundef %29)
  br label %52

30:                                               ; preds = %1
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.STMT_AST, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !12
  call void @continue_stmt_ast_free(ptr noundef %33)
  br label %52

34:                                               ; preds = %1
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.STMT_AST, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !12
  call void @append_stmt_ast_free(ptr noundef %37)
  br label %52

38:                                               ; preds = %1
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.STMT_AST, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !12
  call void @delete_stmt_ast_free(ptr noundef %41)
  br label %52

42:                                               ; preds = %1
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.STMT_AST, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !12
  call void @return_stmt_ast_free(ptr noundef %45)
  br label %52

46:                                               ; preds = %1
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.STMT_AST, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.2, i32 noundef %50) #3
  call void @exit(i32 noundef 1) #4
  unreachable

52:                                               ; preds = %42, %38, %34, %30, %26, %22, %18, %14, %10, %6
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %54) #3
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %53
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @decl_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @assign_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @function_call_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @if_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @while_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @break_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @continue_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @append_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @delete_stmt_ast_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @return_stmt_ast_free(ptr noundef) #2

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 = { noreturn 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 #2 = { 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 #3 = { nounwind }
attributes #4 = { noreturn 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, !11, i64 8}
!10 = !{!"STMT_AST", !7, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, 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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [27 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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @stmt_ast_free(ptr nocapture noundef %0) local_unnamed_addr #3 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %3, label %24 [
    i32 0, label %4
    i32 1, label %6
    i32 2, label %8
    i32 3, label %10
    i32 4, label %12
    i32 5, label %14
    i32 6, label %16
    i32 7, label %18
    i32 8, label %20
    i32 9, label %22
  ]

4:                                                ; preds = %1
  %5 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @decl_stmt_ast_free(ptr noundef %5)
  br label %27

6:                                                ; preds = %1
  %7 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @assign_stmt_ast_free(ptr noundef %7)
  br label %27

8:                                                ; preds = %1
  %9 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @function_call_stmt_ast_free(ptr noundef %9)
  br label %27

10:                                               ; preds = %1
  %11 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @if_stmt_ast_free(ptr noundef %11)
  br label %27

12:                                               ; preds = %1
  %13 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @while_stmt_ast_free(ptr noundef %13)
  br label %27

14:                                               ; preds = %1
  %15 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @break_stmt_ast_free(ptr noundef %15)
  br label %27

16:                                               ; preds = %1
  %17 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @continue_stmt_ast_free(ptr noundef %17)
  br label %27

18:                                               ; preds = %1
  %19 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @append_stmt_ast_free(ptr noundef %19)
  br label %27

20:                                               ; preds = %1
  %21 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @delete_stmt_ast_free(ptr noundef %21)
  br label %27

22:                                               ; preds = %1
  %23 = load ptr, ptr %0, align 8, !tbaa !10
  tail call void @return_stmt_ast_free(ptr noundef %23)
  br label %27

24:                                               ; preds = %1
  %25 = load ptr, ptr @stderr, align 8, !tbaa !11
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.2, i32 noundef %3) #4
  tail call void @exit(i32 noundef 1) #5
  unreachable

27:                                               ; preds = %4, %6, %8, %10, %12, %14, %16, %18, %20, %22
  tail call void @free(ptr noundef nonnull %0) #6
  ret void
}

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

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

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

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

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

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

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

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

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

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

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 = { noreturn 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 #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 = { cold nounwind }
attributes #5 = { noreturn nounwind }
attributes #6 = { 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, !9, i64 8}
!6 = !{!"STMT_AST", !7, i64 0, !9, i64 8}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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