; LLVM IR from asllop/AppOS :: app (main_term)

; 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"

@.str = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [10 x i8], align 1
  %11 = alloca [10 x i8], align 1
  %12 = alloca [10 x i8], align 1
  %13 = alloca [10 x i8], align 1
  %14 = alloca [100 x i8], align 16
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %15 = call i32 @term_serial_init(i8 noundef zeroext 0)
  store i32 %15, ptr %5, align 4, !tbaa !5
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  call void @core_fatal(ptr noundef @.str)
  br label %19

19:                                               ; preds = %18, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_resolution(i32 noundef %20, ptr noundef %6, ptr noundef %7)
  %21 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_reset(i32 noundef %21)
  %22 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_text(i32 noundef %22, i32 noundef 1)
  %23 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_position(i32 noundef %23, i32 noundef 2, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !5
  %24 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_where(i32 noundef %24, ptr noundef %8, ptr noundef %9)
  %25 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %25, ptr noundef @.str.1)
  %26 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %26, ptr noundef @.str.2)
  %27 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %27, ptr noundef @.str.3)
  %28 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %28, ptr noundef @.str.4)
  %29 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %29, ptr noundef @.str.5)
  %30 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %30, ptr noundef @.str.6)
  %31 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %31, ptr noundef @.str.7)
  %32 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %32, ptr noundef @.str.8)
  %33 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %33, ptr noundef @.str.9)
  %34 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %34, ptr noundef @.str.2)
  %35 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %35, ptr noundef @.str.10)
  %36 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_text(i32 noundef %36, i32 noundef 7)
  %37 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_background(i32 noundef %37, i32 noundef 4)
  call void @llvm.lifetime.start.p0(i64 10, ptr %10) #3
  %38 = load i32, ptr %8, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10 x i8], ptr %10, i64 0, i64 0
  %41 = call ptr @itoa(i64 noundef %39, ptr noundef %40, i32 noundef 10)
  call void @llvm.lifetime.start.p0(i64 10, ptr %11) #3
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10 x i8], ptr %11, i64 0, i64 0
  %45 = call ptr @itoa(i64 noundef %43, ptr noundef %44, i32 noundef 10)
  %46 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %46, ptr noundef @.str.11)
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = getelementptr inbounds [10 x i8], ptr %10, i64 0, i64 0
  call void @term_puts(i32 noundef %47, ptr noundef %48)
  %49 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %49, ptr noundef @.str.12)
  %50 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %50, ptr noundef @.str.13)
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = getelementptr inbounds [10 x i8], ptr %11, i64 0, i64 0
  call void @term_puts(i32 noundef %51, ptr noundef %52)
  %53 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %53, ptr noundef @.str.12)
  call void @llvm.lifetime.start.p0(i64 10, ptr %12) #3
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [10 x i8], ptr %12, i64 0, i64 0
  %57 = call ptr @itoa(i64 noundef %55, ptr noundef %56, i32 noundef 10)
  call void @llvm.lifetime.start.p0(i64 10, ptr %13) #3
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [10 x i8], ptr %13, i64 0, i64 0
  %61 = call ptr @itoa(i64 noundef %59, ptr noundef %60, i32 noundef 10)
  %62 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %62, ptr noundef @.str.14)
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = getelementptr inbounds [10 x i8], ptr %12, i64 0, i64 0
  call void @term_puts(i32 noundef %63, ptr noundef %64)
  %65 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %65, ptr noundef @.str.12)
  %66 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %66, ptr noundef @.str.15)
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = getelementptr inbounds [10 x i8], ptr %13, i64 0, i64 0
  call void @term_puts(i32 noundef %67, ptr noundef %68)
  %69 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %69, ptr noundef @.str.12)
  br label %70

70:                                               ; preds = %71, %19
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %5, align 4, !tbaa !5
  call void @term_puts(i32 noundef %72, ptr noundef @.str.16)
  call void @llvm.lifetime.start.p0(i64 100, ptr %14) #3
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = getelementptr inbounds [100 x i8], ptr %14, i64 0, i64 0
  %75 = call i32 @term_gets(i32 noundef %73, ptr noundef %74, i32 noundef 100)
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = getelementptr inbounds [100 x i8], ptr %14, i64 0, i64 0
  call void @term_puts(i32 noundef %76, ptr noundef %77)
  call void @llvm.lifetime.end.p0(i64 100, ptr %14) #3
  br label %70
}

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

declare i32 @term_serial_init(i8 noundef zeroext) #2

declare void @core_fatal(ptr noundef) #2

declare void @term_resolution(i32 noundef, ptr noundef, ptr noundef) #2

declare void @term_reset(i32 noundef) #2

declare void @term_text(i32 noundef, i32 noundef) #2

declare void @term_position(i32 noundef, i32 noundef, i32 noundef) #2

declare void @term_where(i32 noundef, ptr noundef, ptr noundef) #2

declare void @term_puts(i32 noundef, ptr noundef) #2

declare void @term_background(i32 noundef, i32 noundef) #2

declare ptr @itoa(i64 noundef, ptr noundef, i32 noundef) #2

declare i32 @term_gets(i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@.str = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: noreturn nounwind uwtable
define dso_local void @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [10 x i8], align 1
  %8 = alloca [10 x i8], align 1
  %9 = alloca [10 x i8], align 1
  %10 = alloca [10 x i8], align 1
  %11 = alloca [100 x i8], align 16
  %12 = tail call i32 @term_serial_init(i8 noundef zeroext 0) #3
  %13 = icmp eq i32 %12, -1
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  tail call void @core_fatal(ptr noundef nonnull @.str) #3
  br label %15

15:                                               ; preds = %14, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @term_resolution(i32 noundef %12, ptr noundef nonnull %3, ptr noundef nonnull %4) #3
  call void @term_reset(i32 noundef %12) #3
  call void @term_text(i32 noundef %12, i32 noundef 1) #3
  call void @term_position(i32 noundef %12, i32 noundef 2, i32 noundef 2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @term_where(i32 noundef %12, ptr noundef nonnull %5, ptr noundef nonnull %6) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.1) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.2) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.3) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.4) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.5) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.6) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.7) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.8) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.9) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.2) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.10) #3
  call void @term_text(i32 noundef %12, i32 noundef 7) #3
  call void @term_background(i32 noundef %12, i32 noundef 4) #3
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %7) #3
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = call ptr @itoa(i64 noundef %17, ptr noundef nonnull %7, i32 noundef 10) #3
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %8) #3
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = call ptr @itoa(i64 noundef %20, ptr noundef nonnull %8, i32 noundef 10) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.11) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull %7) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.12) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.13) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull %8) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.12) #3
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %9) #3
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = call ptr @itoa(i64 noundef %23, ptr noundef nonnull %9, i32 noundef 10) #3
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %10) #3
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = call ptr @itoa(i64 noundef %26, ptr noundef nonnull %10, i32 noundef 10) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.14) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull %9) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.12) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.15) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull %10) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.12) #3
  br label %28

28:                                               ; preds = %28, %15
  call void @term_puts(i32 noundef %12, ptr noundef nonnull @.str.16) #3
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %11) #3
  %29 = call i32 @term_gets(i32 noundef %12, ptr noundef nonnull %11, i32 noundef 100) #3
  call void @term_puts(i32 noundef %12, ptr noundef nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %11) #3
  br label %28
}

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

declare i32 @term_serial_init(i8 noundef zeroext) local_unnamed_addr #2

declare void @core_fatal(ptr noundef) local_unnamed_addr #2

declare void @term_resolution(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @term_reset(i32 noundef) local_unnamed_addr #2

declare void @term_text(i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @term_position(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @term_where(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @term_puts(i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @term_background(i32 noundef, i32 noundef) local_unnamed_addr #2

declare ptr @itoa(i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @term_gets(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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