; LLVM IR from ramsdell/lineqpp :: lineqpp (main)

; 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 [6 x i8], align 1
@optarg = external global ptr, align 8
@optind = external global i32, align 4
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %38, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = call i32 @getopt(i32 noundef %12, ptr noundef %13, ptr noundef @.str) #4
  store i32 %14, ptr %9, align 4, !tbaa !5
  %15 = load i32, ptr %9, align 4, !tbaa !5
  %16 = icmp eq i32 %15, -1
  br i1 %16, label %17, label %18

17:                                               ; preds = %11
  store i32 2, ptr %10, align 4
  br label %36

18:                                               ; preds = %11
  %19 = load i32, ptr %9, align 4, !tbaa !5
  switch i32 %19, label %31 [
    i32 111, label %20
    i32 100, label %22
    i32 118, label %23
    i32 104, label %27
  ]

20:                                               ; preds = %18
  %21 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %21, ptr %7, align 8, !tbaa !9
  br label %35

22:                                               ; preds = %18
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %35

23:                                               ; preds = %18
  %24 = load ptr, ptr %5, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  call void @print_version(ptr noundef %26)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %36

27:                                               ; preds = %18
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds ptr, ptr %28, i64 0
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  call void @usage(ptr noundef %30)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %36

31:                                               ; preds = %18
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %32, i64 0
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  call void @usage(ptr noundef %34)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %36

35:                                               ; preds = %22, %20
  store i32 0, ptr %10, align 4
  br label %36

36:                                               ; preds = %35, %31, %27, %23, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %37 = load i32, ptr %10, align 4
  switch i32 %37, label %76 [
    i32 0, label %38
    i32 2, label %39
  ]

38:                                               ; preds = %36
  br label %11

39:                                               ; preds = %36
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = load i32, ptr @optind, align 4, !tbaa !5
  %42 = sub nsw i32 %40, %41
  switch i32 %42, label %56 [
    i32 0, label %62
    i32 1, label %43
  ]

43:                                               ; preds = %39
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = load i32, ptr @optind, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds ptr, ptr %44, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  store ptr %48, ptr %6, align 8, !tbaa !9
  %49 = load ptr, ptr %6, align 8, !tbaa !9
  %50 = load ptr, ptr @stdin, align 8, !tbaa !9
  %51 = call ptr @freopen(ptr noundef %49, ptr noundef @.str.1, ptr noundef %50)
  %52 = icmp ne ptr %51, null
  br i1 %52, label %55, label %53

53:                                               ; preds = %43
  %54 = load ptr, ptr %6, align 8, !tbaa !9
  call void @perror(ptr noundef %54)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %76

55:                                               ; preds = %43
  br label %62

56:                                               ; preds = %39
  %57 = load ptr, ptr @stderr, align 8, !tbaa !9
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.2) #4
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds ptr, ptr %59, i64 0
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  call void @usage(ptr noundef %61)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %76

62:                                               ; preds = %55, %39
  %63 = load ptr, ptr %7, align 8, !tbaa !9
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %72

65:                                               ; preds = %62
  %66 = load ptr, ptr %7, align 8, !tbaa !9
  %67 = load ptr, ptr @stdout, align 8, !tbaa !9
  %68 = call ptr @freopen(ptr noundef %66, ptr noundef @.str.3, ptr noundef %67)
  %69 = icmp ne ptr %68, null
  br i1 %69, label %72, label %70

70:                                               ; preds = %65
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  call void @perror(ptr noundef %71)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %76

72:                                               ; preds = %65, %62
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = load ptr, ptr %6, align 8, !tbaa !9
  %75 = call i32 @go(i32 noundef %73, ptr noundef %74)
  store i32 %75, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %76

76:                                               ; preds = %72, %70, %56, %53, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %77 = load i32, ptr %3, align 4
  ret i32 %77
}

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @print_version(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @usage(ptr noundef) #0

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #3

declare void @perror(ptr noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @go(i32 noundef, ptr noundef) #0

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 = { 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 #3 = { "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 = { 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 [6 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@optind = external local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  br label %.outer

.outer:                                           ; preds = %.loopexit73, %2
  %.022.ph = phi ptr [ %5, %.loopexit73 ], [ null, %2 ]
  %.019.ph = phi i32 [ %.019.lcssa65, %.loopexit73 ], [ 0, %2 ]
  %3 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #4
  switch i32 %3, label %.loopexit [
    i32 -1, label %.loopexit72
    i32 111, label %.loopexit73
    i32 100, label %.outer.peel.newph
    i32 118, label %.loopexit74
    i32 104, label %.loopexit75
  ]

.outer.peel.newph:                                ; preds = %.outer, %.outer.peel.newph
  %4 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #4
  switch i32 %4, label %.loopexit [
    i32 -1, label %.loopexit72
    i32 111, label %.loopexit73
    i32 100, label %.outer.peel.newph
    i32 118, label %.loopexit74
    i32 104, label %.loopexit75
  ], !llvm.loop !5

.loopexit73:                                      ; preds = %.outer.peel.newph, %.outer
  %.019.lcssa65 = phi i32 [ %.019.ph, %.outer ], [ 1, %.outer.peel.newph ]
  %5 = load ptr, ptr @optarg, align 8, !tbaa !7
  br label %.outer

.loopexit74:                                      ; preds = %.outer, %.outer.peel.newph
  %6 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @print_version(ptr noundef %6)
  br label %.thread

.loopexit75:                                      ; preds = %.outer, %.outer.peel.newph
  %7 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %7)
  br label %.thread

.loopexit:                                        ; preds = %.outer, %.outer.peel.newph
  %8 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %8)
  br label %.thread

.loopexit72:                                      ; preds = %.outer, %.outer.peel.newph
  %.019.lcssa64 = phi i32 [ 1, %.outer.peel.newph ], [ %.019.ph, %.outer ]
  %9 = load i32, ptr @optind, align 4, !tbaa !11
  %10 = sub nsw i32 %0, %9
  switch i32 %10, label %18 [
    i32 0, label %22
    i32 1, label %11
  ]

11:                                               ; preds = %.loopexit72
  %12 = sext i32 %9 to i64
  %13 = getelementptr inbounds ptr, ptr %1, i64 %12
  %14 = load ptr, ptr %13, align 8, !tbaa !7
  %15 = load ptr, ptr @stdin, align 8, !tbaa !7
  %16 = tail call ptr @freopen(ptr noundef %14, ptr noundef nonnull @.str.1, ptr noundef %15) #4
  %.not = icmp eq ptr %16, null
  br i1 %.not, label %17, label %22

17:                                               ; preds = %11
  tail call void @perror(ptr noundef %14) #5
  br label %.thread

18:                                               ; preds = %.loopexit72
  %19 = load ptr, ptr @stderr, align 8, !tbaa !7
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.2) #6
  %21 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %21)
  br label %.thread

22:                                               ; preds = %11, %.loopexit72
  %.025 = phi ptr [ %14, %11 ], [ null, %.loopexit72 ]
  %.not27 = icmp eq ptr %.022.ph, null
  br i1 %.not27, label %27, label %23

23:                                               ; preds = %22
  %24 = load ptr, ptr @stdout, align 8, !tbaa !7
  %25 = tail call ptr @freopen(ptr noundef nonnull %.022.ph, ptr noundef nonnull @.str.3, ptr noundef %24) #4
  %.not28 = icmp eq ptr %25, null
  br i1 %.not28, label %26, label %27

26:                                               ; preds = %23
  tail call void @perror(ptr noundef nonnull %.022.ph) #5
  br label %.thread

27:                                               ; preds = %23, %22
  %28 = tail call i32 @go(i32 noundef %.019.lcssa64, ptr noundef %.025)
  br label %.thread

.thread:                                          ; preds = %.loopexit74, %.loopexit75, %.loopexit, %27, %26, %18, %17
  %.2 = phi i32 [ 1, %18 ], [ %28, %27 ], [ 1, %26 ], [ 1, %17 ], [ 0, %.loopexit74 ], [ 0, %.loopexit75 ], [ 1, %.loopexit ]
  ret i32 %.2
}

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @print_version(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @usage(ptr noundef) local_unnamed_addr #0

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @go(i32 noundef, ptr noundef) local_unnamed_addr #0

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 = { 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 = { "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 = { 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 #4 = { nounwind }
attributes #5 = { cold }
attributes #6 = { cold 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.peeled.count", i32 1}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass