; LLVM IR from square/subzero :: core/external-crypto/aes (aesaux)

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

@st = external dso_local global [8 x ptr], align 16
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @file_name(ptr noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store i64 %2, ptr %9, align 8, !tbaa !9
  store i64 %3, ptr %10, align 8, !tbaa !9
  store i64 %4, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %14 = load i64, ptr %8, align 8, !tbaa !9
  %15 = icmp ult i64 %14, 12
  br i1 %15, label %16, label %17

16:                                               ; preds = %5
  store ptr null, ptr %6, align 8
  store i32 1, ptr %13, align 4
  br label %49

17:                                               ; preds = %5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = load i64, ptr %9, align 8, !tbaa !9
  %20 = icmp ult i64 %19, 6
  %21 = zext i1 %20 to i64
  %22 = select i1 %20, ptr @.str.6, ptr @.str.7
  %23 = call ptr @copy_str(ptr noundef %18, ptr noundef %22)
  store ptr %23, ptr %12, align 8, !tbaa !5
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = load i64, ptr %9, align 8, !tbaa !9
  %26 = getelementptr inbounds [8 x ptr], ptr @st, i64 0, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = call ptr @copy_str(ptr noundef %24, ptr noundef %27)
  store ptr %28, ptr %12, align 8, !tbaa !5
  %29 = load i64, ptr %10, align 8, !tbaa !9
  %30 = trunc i64 %29 to i8
  %31 = sext i8 %30 to i32
  %32 = sdiv i32 %31, 4
  %33 = add nsw i32 48, %32
  %34 = trunc i32 %33 to i8
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i32 1
  store ptr %36, ptr %12, align 8, !tbaa !5
  store i8 %34, ptr %35, align 1, !tbaa !11
  %37 = load i64, ptr %11, align 8, !tbaa !9
  %38 = trunc i64 %37 to i8
  %39 = sext i8 %38 to i32
  %40 = sdiv i32 %39, 4
  %41 = add nsw i32 48, %40
  %42 = trunc i32 %41 to i8
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i32 1
  store ptr %44, ptr %12, align 8, !tbaa !5
  store i8 %42, ptr %43, align 1, !tbaa !11
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = call ptr @copy_str(ptr noundef %45, ptr noundef @.str.8)
  store ptr %46, ptr %12, align 8, !tbaa !5
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  store i8 0, ptr %47, align 1, !tbaa !11
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %48, ptr %6, align 8
  store i32 1, ptr %13, align 4
  br label %49

49:                                               ; preds = %17, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  %50 = load ptr, ptr %6, align 8
  ret ptr %50
}

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @copy_str(ptr noundef, ptr noundef) #0

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

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

@st = external dso_local local_unnamed_addr global [8 x ptr], align 16
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @file_name(ptr noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4) local_unnamed_addr #0 {
  %6 = icmp ult i64 %1, 12
  br i1 %6, label %23, label %7

7:                                                ; preds = %5
  %8 = icmp ult i64 %2, 6
  %9 = select i1 %8, ptr @.str.6, ptr @.str.7
  %10 = tail call ptr @copy_str(ptr noundef %0, ptr noundef nonnull %9)
  %11 = getelementptr inbounds [8 x ptr], ptr @st, i64 0, i64 %2
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = tail call ptr @copy_str(ptr noundef %10, ptr noundef %12)
  %14 = trunc i64 %3 to i8
  %15 = sdiv i8 %14, 4
  %16 = add nsw i8 %15, 48
  %17 = getelementptr inbounds i8, ptr %13, i64 1
  store i8 %16, ptr %13, align 1, !tbaa !9
  %18 = trunc i64 %4 to i8
  %19 = sdiv i8 %18, 4
  %20 = add nsw i8 %19, 48
  %21 = getelementptr inbounds i8, ptr %13, i64 2
  store i8 %20, ptr %17, align 1, !tbaa !9
  %22 = tail call ptr @copy_str(ptr noundef nonnull %21, ptr noundef nonnull @.str.8)
  store i8 0, ptr %22, align 1, !tbaa !9
  br label %23

23:                                               ; preds = %5, %7
  %.0 = phi ptr [ %0, %7 ], [ null, %5 ]
  ret ptr %.0
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @copy_str(ptr 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" }

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


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