; LLVM IR from golems/ach :: src/test (mask)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [79 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1

; 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 i32, align 4
  %7 = alloca i32, align 4
  %8 = 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
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %36, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %12 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %12, ptr %7, align 4, !tbaa !5
  %13 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %13, label %35 [
    i32 1, label %14
    i32 3, label %14
    i32 2, label %14
    i32 4, label %14
    i32 6, label %14
    i32 7, label %14
    i32 5, label %14
    i32 9, label %14
    i32 10, label %14
    i32 11, label %14
    i32 12, label %14
    i32 13, label %14
    i32 14, label %14
    i32 15, label %14
    i32 16, label %14
    i32 17, label %14
    i32 18, label %14
    i32 19, label %14
    i32 8, label %14
    i32 0, label %26
  ]

14:                                               ; preds = %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11, %11
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = shl i32 1, %15
  %17 = load i32, ptr %6, align 4, !tbaa !5
  %18 = sub nsw i32 %17, 1
  %19 = shl i32 1, %18
  %20 = mul nsw i32 2, %19
  %21 = icmp eq i32 %16, %20
  br i1 %21, label %25, label %22

22:                                               ; preds = %14
  %23 = load ptr, ptr @stderr, align 8, !tbaa !9
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 92) #6
  call void @exit(i32 noundef 1) #7
  unreachable

25:                                               ; preds = %14
  br label %26

26:                                               ; preds = %25, %11
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = call ptr @ach_result_to_string(i32 noundef %27)
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = call i32 @ach_status_mask(i32 noundef %30)
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %28, i32 noundef %29, i32 noundef %31)
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %6, align 4, !tbaa !5
  store i32 3, ptr %8, align 4
  br label %36

35:                                               ; preds = %11
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %36

36:                                               ; preds = %35, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %37 = load i32, ptr %8, align 4
  switch i32 %37, label %38 [
    i32 3, label %11
  ]

38:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %39 = load i32, ptr %3, align 4
  ret i32 %39
}

; 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 @fprintf(ptr noundef, ptr noundef, ...) #2

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

declare i32 @printf(ptr noundef, ...) #4

declare ptr @ach_result_to_string(i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ach_status_mask(i32 noundef) #5

; 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 = { 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 = { 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 #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 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 }
attributes #7 = { 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 = !{!"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.3 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = tail call ptr @ach_result_to_string(i32 noundef 0) #4
  %4 = tail call i32 @ach_status_mask(i32 noundef 0)
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %3, i32 noundef 0, i32 noundef %4)
  %6 = tail call ptr @ach_result_to_string(i32 noundef 1) #4
  %7 = tail call i32 @ach_status_mask(i32 noundef 1)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %6, i32 noundef 1, i32 noundef %7)
  %9 = tail call ptr @ach_result_to_string(i32 noundef 2) #4
  %10 = tail call i32 @ach_status_mask(i32 noundef 2)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %9, i32 noundef 2, i32 noundef %10)
  %12 = tail call ptr @ach_result_to_string(i32 noundef 3) #4
  %13 = tail call i32 @ach_status_mask(i32 noundef 3)
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %12, i32 noundef 3, i32 noundef %13)
  %15 = tail call ptr @ach_result_to_string(i32 noundef 4) #4
  %16 = tail call i32 @ach_status_mask(i32 noundef 4)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %15, i32 noundef 4, i32 noundef %16)
  %18 = tail call ptr @ach_result_to_string(i32 noundef 5) #4
  %19 = tail call i32 @ach_status_mask(i32 noundef 5)
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %18, i32 noundef 5, i32 noundef %19)
  %21 = tail call ptr @ach_result_to_string(i32 noundef 6) #4
  %22 = tail call i32 @ach_status_mask(i32 noundef 6)
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %21, i32 noundef 6, i32 noundef %22)
  %24 = tail call ptr @ach_result_to_string(i32 noundef 7) #4
  %25 = tail call i32 @ach_status_mask(i32 noundef 7)
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %24, i32 noundef 7, i32 noundef %25)
  %27 = tail call ptr @ach_result_to_string(i32 noundef 8) #4
  %28 = tail call i32 @ach_status_mask(i32 noundef 8)
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %27, i32 noundef 8, i32 noundef %28)
  %30 = tail call ptr @ach_result_to_string(i32 noundef 9) #4
  %31 = tail call i32 @ach_status_mask(i32 noundef 9)
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %30, i32 noundef 9, i32 noundef %31)
  %33 = tail call ptr @ach_result_to_string(i32 noundef 10) #4
  %34 = tail call i32 @ach_status_mask(i32 noundef 10)
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %33, i32 noundef 10, i32 noundef %34)
  %36 = tail call ptr @ach_result_to_string(i32 noundef 11) #4
  %37 = tail call i32 @ach_status_mask(i32 noundef 11)
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %36, i32 noundef 11, i32 noundef %37)
  %39 = tail call ptr @ach_result_to_string(i32 noundef 12) #4
  %40 = tail call i32 @ach_status_mask(i32 noundef 12)
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %39, i32 noundef 12, i32 noundef %40)
  %42 = tail call ptr @ach_result_to_string(i32 noundef 13) #4
  %43 = tail call i32 @ach_status_mask(i32 noundef 13)
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %42, i32 noundef 13, i32 noundef %43)
  %45 = tail call ptr @ach_result_to_string(i32 noundef 14) #4
  %46 = tail call i32 @ach_status_mask(i32 noundef 14)
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %45, i32 noundef 14, i32 noundef %46)
  %48 = tail call ptr @ach_result_to_string(i32 noundef 15) #4
  %49 = tail call i32 @ach_status_mask(i32 noundef 15)
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %48, i32 noundef 15, i32 noundef %49)
  %51 = tail call ptr @ach_result_to_string(i32 noundef 16) #4
  %52 = tail call i32 @ach_status_mask(i32 noundef 16)
  %53 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %51, i32 noundef 16, i32 noundef %52)
  %54 = tail call ptr @ach_result_to_string(i32 noundef 17) #4
  %55 = tail call i32 @ach_status_mask(i32 noundef 17)
  %56 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %54, i32 noundef 17, i32 noundef %55)
  %57 = tail call ptr @ach_result_to_string(i32 noundef 18) #4
  %58 = tail call i32 @ach_status_mask(i32 noundef 18)
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %57, i32 noundef 18, i32 noundef %58)
  %60 = tail call ptr @ach_result_to_string(i32 noundef 19) #4
  %61 = tail call i32 @ach_status_mask(i32 noundef 19)
  %62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %60, i32 noundef 19, i32 noundef %61)
  ret i32 0
}

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

declare ptr @ach_result_to_string(i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ach_status_mask(i32 noundef) local_unnamed_addr #3

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 = { 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 #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 = { 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 #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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass