; LLVM IR from control-flow-attestation/c-flat :: samples/soldering (Iron)

; 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.IronStruct = type { %struct.HistoryStruct, i32, i8, i8, i32, i8, i8, i8, i32, [2 x i32], i8, i32, i32, i16, i16, i8, i16, i8, i8, i8, i16, i32, i32, i8, i32, i32, i32 }
%struct.HistoryStruct = type { i8, [8 x i32] }

; Function Attrs: nounwind uwtable
define dso_local void @createIron(ptr noundef %0, i8 noundef zeroext %1, i8 noundef zeroext %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i8 %1, ptr %5, align 1, !tbaa !9
  store i8 %2, ptr %6, align 1, !tbaa !9
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.IronStruct, ptr %7, i32 0, i32 0
  call void @createHistory(ptr noundef %8)
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.IronStruct, ptr %9, i32 0, i32 16
  store i16 255, ptr %10, align 2, !tbaa !10
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.IronStruct, ptr %11, i32 0, i32 17
  store i8 -36, ptr %12, align 4, !tbaa !16
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.IronStruct, ptr %13, i32 0, i32 18
  store i8 25, ptr %14, align 1, !tbaa !17
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.IronStruct, ptr %15, i32 0, i32 19
  store i8 2, ptr %16, align 2, !tbaa !18
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.IronStruct, ptr %17, i32 0, i32 20
  store i16 500, ptr %18, align 4, !tbaa !19
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.IronStruct, ptr %19, i32 0, i32 21
  store i32 10, ptr %20, align 4, !tbaa !20
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.IronStruct, ptr %21, i32 0, i32 22
  store i32 10, ptr %22, align 4, !tbaa !21
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.IronStruct, ptr %23, i32 0, i32 23
  store i8 10, ptr %24, align 4, !tbaa !22
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.IronStruct, ptr %25, i32 0, i32 24
  store i32 5120, ptr %26, align 4, !tbaa !23
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.IronStruct, ptr %27, i32 0, i32 25
  store i32 512, ptr %28, align 4, !tbaa !24
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.IronStruct, ptr %29, i32 0, i32 26
  store i32 768, ptr %30, align 4, !tbaa !25
  %31 = load i8, ptr %5, align 1, !tbaa !9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.IronStruct, ptr %32, i32 0, i32 2
  store i8 %31, ptr %33, align 4, !tbaa !26
  %34 = load i8, ptr %6, align 1, !tbaa !9
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.IronStruct, ptr %35, i32 0, i32 3
  store i8 %34, ptr %36, align 1, !tbaa !27
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.IronStruct, ptr %37, i32 0, i32 5
  store i8 0, ptr %38, align 4, !tbaa !28
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.IronStruct, ptr %39, i32 0, i32 7
  store i8 1, ptr %40, align 2, !tbaa !29
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.IronStruct, ptr %41, i32 0, i32 6
  store i8 0, ptr %42, align 1, !tbaa !30
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.IronStruct, ptr %43, i32 0, i32 7
  store i8 1, ptr %44, align 2, !tbaa !29
  ret void
}

declare void @createHistory(ptr noundef) #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 = { "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}
!10 = !{!11, !15, i64 82}
!11 = !{!"IronStruct", !12, i64 0, !13, i64 36, !7, i64 40, !7, i64 41, !13, i64 44, !14, i64 48, !14, i64 49, !14, i64 50, !13, i64 52, !7, i64 56, !14, i64 64, !13, i64 68, !13, i64 72, !15, i64 76, !15, i64 78, !14, i64 80, !15, i64 82, !7, i64 84, !7, i64 85, !7, i64 86, !15, i64 88, !13, i64 92, !13, i64 96, !7, i64 100, !13, i64 104, !13, i64 108, !13, i64 112}
!12 = !{!"HistoryStruct", !7, i64 0, !7, i64 4}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!11, !7, i64 84}
!17 = !{!11, !7, i64 85}
!18 = !{!11, !7, i64 86}
!19 = !{!11, !15, i64 88}
!20 = !{!11, !13, i64 92}
!21 = !{!11, !13, i64 96}
!22 = !{!11, !7, i64 100}
!23 = !{!11, !13, i64 104}
!24 = !{!11, !13, i64 108}
!25 = !{!11, !13, i64 112}
!26 = !{!11, !7, i64 40}
!27 = !{!11, !7, i64 41}
!28 = !{!11, !14, i64 48}
!29 = !{!11, !14, i64 50}
!30 = !{!11, !14, i64 49}


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

; Function Attrs: nounwind uwtable
define dso_local void @createIron(ptr noundef %0, i8 noundef zeroext %1, i8 noundef zeroext %2) local_unnamed_addr #0 {
  tail call void @createHistory(ptr noundef %0) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 82
  store i16 255, ptr %4, align 2, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 84
  store i8 -36, ptr %5, align 4, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 85
  store i8 25, ptr %6, align 1, !tbaa !14
  %7 = getelementptr inbounds i8, ptr %0, i64 86
  store i8 2, ptr %7, align 2, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  store i16 500, ptr %8, align 4, !tbaa !16
  %9 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 10, ptr %9, align 4, !tbaa !17
  %10 = getelementptr inbounds i8, ptr %0, i64 96
  store i32 10, ptr %10, align 4, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %0, i64 100
  store i8 10, ptr %11, align 4, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %0, i64 104
  store i32 5120, ptr %12, align 4, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 512, ptr %13, align 4, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 768, ptr %14, align 4, !tbaa !22
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  store i8 %1, ptr %15, align 4, !tbaa !23
  %16 = getelementptr inbounds i8, ptr %0, i64 41
  store i8 %2, ptr %16, align 1, !tbaa !24
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  store i8 0, ptr %17, align 4, !tbaa !25
  %18 = getelementptr inbounds i8, ptr %0, i64 50
  %19 = getelementptr inbounds i8, ptr %0, i64 49
  store i8 0, ptr %19, align 1, !tbaa !26
  store i8 1, ptr %18, align 2, !tbaa !27
  ret void
}

declare void @createHistory(ptr noundef) local_unnamed_addr #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 = { "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 = { 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, !12, i64 82}
!6 = !{!"IronStruct", !7, i64 0, !10, i64 36, !8, i64 40, !8, i64 41, !10, i64 44, !11, i64 48, !11, i64 49, !11, i64 50, !10, i64 52, !8, i64 56, !11, i64 64, !10, i64 68, !10, i64 72, !12, i64 76, !12, i64 78, !11, i64 80, !12, i64 82, !8, i64 84, !8, i64 85, !8, i64 86, !12, i64 88, !10, i64 92, !10, i64 96, !8, i64 100, !10, i64 104, !10, i64 108, !10, i64 112}
!7 = !{!"HistoryStruct", !8, i64 0, !8, i64 4}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !8, i64 84}
!14 = !{!6, !8, i64 85}
!15 = !{!6, !8, i64 86}
!16 = !{!6, !12, i64 88}
!17 = !{!6, !10, i64 92}
!18 = !{!6, !10, i64 96}
!19 = !{!6, !8, i64 100}
!20 = !{!6, !10, i64 104}
!21 = !{!6, !10, i64 108}
!22 = !{!6, !10, i64 112}
!23 = !{!6, !8, i64 40}
!24 = !{!6, !8, i64 41}
!25 = !{!6, !11, i64 48}
!26 = !{!6, !11, i64 49}
!27 = !{!6, !11, i64 50}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass