; LLVM IR from ramsdell/lineqpp :: bin2c (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 [7 x i8], align 1
@optarg = external global ptr, align 8
@optind = external global i32, align 4
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external global ptr, align 8
@.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 ptr, align 8
  %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 8, ptr %8) #4
  store ptr null, ptr %8, align 8, !tbaa !9
  br label %11

11:                                               ; preds = %39, %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 %37

18:                                               ; preds = %11
  %19 = load i32, ptr %9, align 4, !tbaa !5
  switch i32 %19, label %32 [
    i32 110, label %20
    i32 111, label %22
    i32 118, label %24
    i32 104, label %28
  ]

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

22:                                               ; preds = %18
  %23 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %23, ptr %7, align 8, !tbaa !9
  br label %36

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

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

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

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

37:                                               ; preds = %36, %32, %28, %24, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %38 = load i32, ptr %10, align 4
  switch i32 %38, label %83 [
    i32 0, label %39
    i32 2, label %40
  ]

39:                                               ; preds = %37
  br label %11

40:                                               ; preds = %37
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = load i32, ptr @optind, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  %44 = icmp ne i32 %41, %43
  br i1 %44, label %45, label %51

45:                                               ; preds = %40
  %46 = load ptr, ptr @stderr, align 8, !tbaa !9
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.1) #4
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %48, i64 0
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  call void @usage(ptr noundef %50)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %83

51:                                               ; preds = %40
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = load i32, ptr @optind, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds ptr, ptr %52, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  store ptr %56, ptr %6, align 8, !tbaa !9
  %57 = load ptr, ptr %6, align 8, !tbaa !9
  %58 = load ptr, ptr @stdin, align 8, !tbaa !9
  %59 = call ptr @freopen(ptr noundef %57, ptr noundef @.str.2, ptr noundef %58)
  %60 = icmp ne ptr %59, null
  br i1 %60, label %63, label %61

61:                                               ; preds = %51
  %62 = load ptr, ptr %6, align 8, !tbaa !9
  call void @perror(ptr noundef %62)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %83

63:                                               ; preds = %51
  %64 = load ptr, ptr %7, align 8, !tbaa !9
  %65 = icmp ne ptr %64, null
  br i1 %65, label %66, label %73

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

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

73:                                               ; preds = %66, %63
  %74 = load ptr, ptr %8, align 8, !tbaa !9
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %78

76:                                               ; preds = %73
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  br label %80

78:                                               ; preds = %73
  %79 = load ptr, ptr %6, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %78, %76
  %81 = phi ptr [ %77, %76 ], [ %79, %78 ]
  %82 = call i32 @emit(ptr noundef %81)
  store i32 %82, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %83

83:                                               ; preds = %80, %71, %61, %45, %37
  call void @llvm.lifetime.end.p0(i64 8, 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
  %84 = load i32, ptr %3, align 4
  ret i32 %84
}

; 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

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

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

declare void @perror(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @emit(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 [7 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@optind = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.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 = %7, %2
  %.023.ph = phi ptr [ %8, %7 ], [ null, %2 ]
  %.020.ph = phi ptr [ %.020, %7 ], [ null, %2 ]
  br label %3

3:                                                ; preds = %.outer, %5
  %.020 = phi ptr [ %6, %5 ], [ %.020.ph, %.outer ]
  %4 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #4
  switch i32 %4, label %13 [
    i32 -1, label %15
    i32 110, label %5
    i32 111, label %7
    i32 118, label %9
    i32 104, label %11
  ]

5:                                                ; preds = %3
  %6 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %3

7:                                                ; preds = %3
  %8 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %.outer

9:                                                ; preds = %3
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @print_version(ptr noundef %10)
  br label %.thread

11:                                               ; preds = %3
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %12)
  br label %.thread

13:                                               ; preds = %3
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %14)
  br label %.thread

15:                                               ; preds = %3
  %16 = load i32, ptr @optind, align 4, !tbaa !9
  %17 = add nsw i32 %16, 1
  %.not = icmp eq i32 %17, %0
  br i1 %.not, label %22, label %18

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

22:                                               ; preds = %15
  %23 = sext i32 %16 to i64
  %24 = getelementptr inbounds ptr, ptr %1, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = load ptr, ptr @stdin, align 8, !tbaa !5
  %27 = tail call ptr @freopen(ptr noundef %25, ptr noundef nonnull @.str.2, ptr noundef %26) #4
  %.not27 = icmp eq ptr %27, null
  br i1 %.not27, label %28, label %29

28:                                               ; preds = %22
  tail call void @perror(ptr noundef %25) #6
  br label %.thread

29:                                               ; preds = %22
  %.not28 = icmp eq ptr %.023.ph, null
  br i1 %.not28, label %34, label %30

30:                                               ; preds = %29
  %31 = load ptr, ptr @stdout, align 8, !tbaa !5
  %32 = tail call ptr @freopen(ptr noundef nonnull %.023.ph, ptr noundef nonnull @.str.3, ptr noundef %31) #4
  %.not29 = icmp eq ptr %32, null
  br i1 %.not29, label %33, label %34

33:                                               ; preds = %30
  tail call void @perror(ptr noundef nonnull %.023.ph) #6
  br label %.thread

34:                                               ; preds = %30, %29
  %.not30 = icmp eq ptr %.020, null
  %35 = select i1 %.not30, ptr %25, ptr %.020
  %36 = tail call i32 @emit(ptr noundef %35)
  br label %.thread

.thread:                                          ; preds = %9, %11, %13, %34, %33, %28, %18
  %.2 = phi i32 [ 1, %18 ], [ %36, %34 ], [ 1, %33 ], [ 1, %28 ], [ 0, %9 ], [ 0, %11 ], [ 1, %13 ]
  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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @emit(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 = { 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 #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 }
attributes #5 = { cold nounwind }
attributes #6 = { cold }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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