; LLVM IR from square/subzero :: core/external-crypto/modes/ltc (ltc_omac_test)

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

%struct.anon = type { i32, i32, [16 x i8], [64 x i8], [16 x i8] }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@tests = external hidden constant <{ %struct.anon, { i32, i32, [16 x i8], <{ [16 x i8], [48 x i8] }>, [16 x i8] }, { i32, i32, [16 x i8], <{ [40 x i8], [24 x i8] }>, [16 x i8] }, %struct.anon }>, align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @omac_test() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [16 x i8], align 16
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %61, %0
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = icmp slt i32 %8, 4
  br i1 %9, label %10, label %64

10:                                               ; preds = %7
  store i64 16, ptr %4, align 8, !tbaa !9
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [4 x %struct.anon], ptr @tests, i64 0, i64 %12
  %14 = getelementptr inbounds %struct.anon, ptr %13, i32 0, i32 2
  %15 = getelementptr inbounds [16 x i8], ptr %14, i64 0, i64 0
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [4 x %struct.anon], ptr @tests, i64 0, i64 %17
  %19 = getelementptr inbounds %struct.anon, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = sext i32 %20 to i64
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [4 x %struct.anon], ptr @tests, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.anon, ptr %24, i32 0, i32 3
  %26 = getelementptr inbounds [64 x i8], ptr %25, i64 0, i64 0
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [4 x %struct.anon], ptr @tests, i64 0, i64 %28
  %30 = getelementptr inbounds %struct.anon, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [16 x i8], ptr %2, i64 0, i64 0
  %34 = call i32 @omac_memory(ptr noundef %15, i64 noundef %21, ptr noundef %26, i64 noundef %32, ptr noundef %33, ptr noundef %4)
  %35 = getelementptr inbounds [16 x i8], ptr %2, i64 0, i64 0
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [4 x %struct.anon], ptr @tests, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.anon, ptr %38, i32 0, i32 4
  %40 = getelementptr inbounds [16 x i8], ptr %39, i64 0, i64 0
  %41 = call i32 @memcmp(ptr noundef %35, ptr noundef %40, i64 noundef 16) #5
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %60

43:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %55, %43
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 16
  br i1 %47, label %48, label %58

48:                                               ; preds = %45
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [16 x i8], ptr %2, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !14
  %53 = zext i8 %52 to i32
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %53)
  br label %55

55:                                               ; preds = %48
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %5, align 4, !tbaa !5
  br label %45, !llvm.loop !15

58:                                               ; preds = %45
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %65

60:                                               ; preds = %10
  br label %61

61:                                               ; preds = %60
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %3, align 4, !tbaa !5
  br label %7, !llvm.loop !17

64:                                               ; preds = %7
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %65

65:                                               ; preds = %64, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #4
  %66 = load i32, ptr %1, align 4
  ret i32 %66
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @printf(ptr 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 willreturn memory(read) "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 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 4, !7, i64 8, !7, i64 24, !7, i64 88}
!13 = !{!12, !6, i64 4}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

%struct.anon = type { i32, i32, [16 x i8], [64 x i8], [16 x i8] }

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@tests = external hidden constant <{ %struct.anon, { i32, i32, [16 x i8], <{ [16 x i8], [48 x i8] }>, [16 x i8] }, { i32, i32, [16 x i8], <{ [40 x i8], [24 x i8] }>, [16 x i8] }, %struct.anon }>, align 16

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @omac_test() local_unnamed_addr #0 {
  %1 = alloca [16 x i8], align 16
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  store i64 16, ptr %2, align 8, !tbaa !5
  %3 = load i32, ptr @tests, align 16, !tbaa !9
  %4 = sext i32 %3 to i64
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 4), align 4, !tbaa !12
  %6 = sext i32 %5 to i64
  %7 = call i32 @omac_memory(ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 8), i64 noundef %4, ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 24), i64 noundef %6, ptr noundef nonnull %1, ptr noundef nonnull %2) #5
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %1, ptr noundef nonnull dereferenceable(16) getelementptr inbounds (i8, ptr @tests, i64 88), i64 16)
  %.not = icmp eq i32 %bcmp, 0
  br i1 %.not, label %8, label %26

8:                                                ; preds = %0
  store i64 16, ptr %2, align 8, !tbaa !5
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 104), align 8, !tbaa !9
  %10 = sext i32 %9 to i64
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 108), align 4, !tbaa !12
  %12 = sext i32 %11 to i64
  %13 = call i32 @omac_memory(ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 112), i64 noundef %10, ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 128), i64 noundef %12, ptr noundef nonnull %1, ptr noundef nonnull %2) #5
  %bcmp.1 = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %1, ptr noundef nonnull dereferenceable(16) getelementptr inbounds (i8, ptr @tests, i64 192), i64 16)
  %.not.1 = icmp eq i32 %bcmp.1, 0
  br i1 %.not.1, label %14, label %26

14:                                               ; preds = %8
  store i64 16, ptr %2, align 8, !tbaa !5
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 208), align 16, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 212), align 4, !tbaa !12
  %18 = sext i32 %17 to i64
  %19 = call i32 @omac_memory(ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 216), i64 noundef %16, ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 232), i64 noundef %18, ptr noundef nonnull %1, ptr noundef nonnull %2) #5
  %bcmp.2 = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %1, ptr noundef nonnull dereferenceable(16) getelementptr inbounds (i8, ptr @tests, i64 296), i64 16)
  %.not.2 = icmp eq i32 %bcmp.2, 0
  br i1 %.not.2, label %20, label %26

20:                                               ; preds = %14
  store i64 16, ptr %2, align 8, !tbaa !5
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 312), align 8, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @tests, i64 316), align 4, !tbaa !12
  %24 = sext i32 %23 to i64
  %25 = call i32 @omac_memory(ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 320), i64 noundef %22, ptr noundef nonnull getelementptr inbounds (i8, ptr @tests, i64 336), i64 noundef %24, ptr noundef nonnull %1, ptr noundef nonnull %2) #5
  %bcmp.3 = call i32 @bcmp(ptr noundef nonnull dereferenceable(16) %1, ptr noundef nonnull dereferenceable(16) getelementptr inbounds (i8, ptr @tests, i64 400), i64 16)
  %.not.3 = icmp eq i32 %bcmp.3, 0
  br i1 %.not.3, label %.loopexit, label %26

26:                                               ; preds = %20, %14, %8, %0
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %28 = load i8, ptr %1, align 16, !tbaa !13
  %29 = zext i8 %28 to i32
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %29)
  %31 = getelementptr inbounds i8, ptr %1, i64 1
  %32 = load i8, ptr %31, align 1, !tbaa !13
  %33 = zext i8 %32 to i32
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %33)
  %35 = getelementptr inbounds i8, ptr %1, i64 2
  %36 = load i8, ptr %35, align 2, !tbaa !13
  %37 = zext i8 %36 to i32
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %37)
  %39 = getelementptr inbounds i8, ptr %1, i64 3
  %40 = load i8, ptr %39, align 1, !tbaa !13
  %41 = zext i8 %40 to i32
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %41)
  %43 = getelementptr inbounds i8, ptr %1, i64 4
  %44 = load i8, ptr %43, align 4, !tbaa !13
  %45 = zext i8 %44 to i32
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %45)
  %47 = getelementptr inbounds i8, ptr %1, i64 5
  %48 = load i8, ptr %47, align 1, !tbaa !13
  %49 = zext i8 %48 to i32
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %49)
  %51 = getelementptr inbounds i8, ptr %1, i64 6
  %52 = load i8, ptr %51, align 2, !tbaa !13
  %53 = zext i8 %52 to i32
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %53)
  %55 = getelementptr inbounds i8, ptr %1, i64 7
  %56 = load i8, ptr %55, align 1, !tbaa !13
  %57 = zext i8 %56 to i32
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %57)
  %59 = getelementptr inbounds i8, ptr %1, i64 8
  %60 = load i8, ptr %59, align 8, !tbaa !13
  %61 = zext i8 %60 to i32
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %61)
  %63 = getelementptr inbounds i8, ptr %1, i64 9
  %64 = load i8, ptr %63, align 1, !tbaa !13
  %65 = zext i8 %64 to i32
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %65)
  %67 = getelementptr inbounds i8, ptr %1, i64 10
  %68 = load i8, ptr %67, align 2, !tbaa !13
  %69 = zext i8 %68 to i32
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %69)
  %71 = getelementptr inbounds i8, ptr %1, i64 11
  %72 = load i8, ptr %71, align 1, !tbaa !13
  %73 = zext i8 %72 to i32
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %73)
  %75 = getelementptr inbounds i8, ptr %1, i64 12
  %76 = load i8, ptr %75, align 4, !tbaa !13
  %77 = zext i8 %76 to i32
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %77)
  %79 = getelementptr inbounds i8, ptr %1, i64 13
  %80 = load i8, ptr %79, align 1, !tbaa !13
  %81 = zext i8 %80 to i32
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %81)
  %83 = getelementptr inbounds i8, ptr %1, i64 14
  %84 = load i8, ptr %83, align 2, !tbaa !13
  %85 = zext i8 %84 to i32
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %85)
  %87 = getelementptr inbounds i8, ptr %1, i64 15
  %88 = load i8, ptr %87, align 1, !tbaa !13
  %89 = zext i8 %88 to i32
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %89)
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.loopexit

.loopexit:                                        ; preds = %20, %26
  %.012 = phi i32 [ -1, %26 ], [ 0, %20 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #5
  ret i32 %.012
}

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

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

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

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4

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 = { 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 = { 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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !7, i64 8, !7, i64 24, !7, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass