; LLVM IR from caryll/otfcc :: lib/table (head)

; 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.table_head = type { i32, i32, i32, i32, i16, i16, i64, i64, i16, i16, i16, i16, i16, i16, i16, i16, i16 }

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @otfcc_buildHead(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %10, label %9

9:                                                ; preds = %2
  store ptr null, ptr %3, align 8
  br label %81

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %11 = call ptr (...) @bufnew()
  store ptr %11, ptr %6, align 8, !tbaa !5
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.table_head, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 8, !tbaa !9
  call void @bufwrite32b(ptr noundef %12, i32 noundef %15)
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.table_head, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !14
  call void @bufwrite32b(ptr noundef %16, i32 noundef %19)
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.table_head, ptr %21, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !15
  call void @bufwrite32b(ptr noundef %20, i32 noundef %23)
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.table_head, ptr %25, i32 0, i32 3
  %27 = load i32, ptr %26, align 4, !tbaa !16
  call void @bufwrite32b(ptr noundef %24, i32 noundef %27)
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.table_head, ptr %29, i32 0, i32 4
  %31 = load i16, ptr %30, align 8, !tbaa !17
  call void @bufwrite16b(ptr noundef %28, i16 noundef zeroext %31)
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.table_head, ptr %33, i32 0, i32 5
  %35 = load i16, ptr %34, align 2, !tbaa !18
  call void @bufwrite16b(ptr noundef %32, i16 noundef zeroext %35)
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.table_head, ptr %37, i32 0, i32 6
  %39 = load i64, ptr %38, align 8, !tbaa !19
  call void @bufwrite64b(ptr noundef %36, i64 noundef %39)
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.table_head, ptr %41, i32 0, i32 7
  %43 = load i64, ptr %42, align 8, !tbaa !20
  call void @bufwrite64b(ptr noundef %40, i64 noundef %43)
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.table_head, ptr %45, i32 0, i32 8
  %47 = load i16, ptr %46, align 8, !tbaa !21
  call void @bufwrite16b(ptr noundef %44, i16 noundef zeroext %47)
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.table_head, ptr %49, i32 0, i32 9
  %51 = load i16, ptr %50, align 2, !tbaa !22
  call void @bufwrite16b(ptr noundef %48, i16 noundef zeroext %51)
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.table_head, ptr %53, i32 0, i32 10
  %55 = load i16, ptr %54, align 4, !tbaa !23
  call void @bufwrite16b(ptr noundef %52, i16 noundef zeroext %55)
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.table_head, ptr %57, i32 0, i32 11
  %59 = load i16, ptr %58, align 2, !tbaa !24
  call void @bufwrite16b(ptr noundef %56, i16 noundef zeroext %59)
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.table_head, ptr %61, i32 0, i32 12
  %63 = load i16, ptr %62, align 8, !tbaa !25
  call void @bufwrite16b(ptr noundef %60, i16 noundef zeroext %63)
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.table_head, ptr %65, i32 0, i32 13
  %67 = load i16, ptr %66, align 2, !tbaa !26
  call void @bufwrite16b(ptr noundef %64, i16 noundef zeroext %67)
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.table_head, ptr %69, i32 0, i32 14
  %71 = load i16, ptr %70, align 4, !tbaa !27
  call void @bufwrite16b(ptr noundef %68, i16 noundef zeroext %71)
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.table_head, ptr %73, i32 0, i32 15
  %75 = load i16, ptr %74, align 2, !tbaa !28
  call void @bufwrite16b(ptr noundef %72, i16 noundef zeroext %75)
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.table_head, ptr %77, i32 0, i32 16
  %79 = load i16, ptr %78, align 8, !tbaa !29
  call void @bufwrite16b(ptr noundef %76, i16 noundef zeroext %79)
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %80, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %81

81:                                               ; preds = %10, %9
  %82 = load ptr, ptr %3, align 8
  ret ptr %82
}

declare ptr @bufnew(...) #2

declare void @bufwrite32b(ptr noundef, i32 noundef) #2

declare void @bufwrite16b(ptr noundef, i16 noundef zeroext) #2

declare void @bufwrite64b(ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 }

!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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 18, !13, i64 24, !13, i64 32, !12, i64 40, !12, i64 42, !12, i64 44, !12, i64 46, !12, i64 48, !12, i64 50, !12, i64 52, !12, i64 54, !12, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !11, i64 4}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !11, i64 12}
!17 = !{!10, !12, i64 16}
!18 = !{!10, !12, i64 18}
!19 = !{!10, !13, i64 24}
!20 = !{!10, !13, i64 32}
!21 = !{!10, !12, i64 40}
!22 = !{!10, !12, i64 42}
!23 = !{!10, !12, i64 44}
!24 = !{!10, !12, i64 46}
!25 = !{!10, !12, i64 48}
!26 = !{!10, !12, i64 50}
!27 = !{!10, !12, i64 52}
!28 = !{!10, !12, i64 54}
!29 = !{!10, !12, i64 56}


; 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 noundef ptr @otfcc_buildHead(ptr noundef readonly %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %38, label %3

3:                                                ; preds = %2
  %4 = tail call ptr (...) @bufnew() #2
  %5 = load i32, ptr %0, align 8, !tbaa !5
  tail call void @bufwrite32b(ptr noundef %4, i32 noundef %5) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !12
  tail call void @bufwrite32b(ptr noundef %4, i32 noundef %7) #2
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !13
  tail call void @bufwrite32b(ptr noundef %4, i32 noundef %9) #2
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !14
  tail call void @bufwrite32b(ptr noundef %4, i32 noundef %11) #2
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load i16, ptr %12, align 8, !tbaa !15
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %13) #2
  %14 = getelementptr inbounds i8, ptr %0, i64 18
  %15 = load i16, ptr %14, align 2, !tbaa !16
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %15) #2
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load i64, ptr %16, align 8, !tbaa !17
  tail call void @bufwrite64b(ptr noundef %4, i64 noundef %17) #2
  %18 = getelementptr inbounds i8, ptr %0, i64 32
  %19 = load i64, ptr %18, align 8, !tbaa !18
  tail call void @bufwrite64b(ptr noundef %4, i64 noundef %19) #2
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %21 = load i16, ptr %20, align 8, !tbaa !19
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %21) #2
  %22 = getelementptr inbounds i8, ptr %0, i64 42
  %23 = load i16, ptr %22, align 2, !tbaa !20
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %23) #2
  %24 = getelementptr inbounds i8, ptr %0, i64 44
  %25 = load i16, ptr %24, align 4, !tbaa !21
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %25) #2
  %26 = getelementptr inbounds i8, ptr %0, i64 46
  %27 = load i16, ptr %26, align 2, !tbaa !22
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %27) #2
  %28 = getelementptr inbounds i8, ptr %0, i64 48
  %29 = load i16, ptr %28, align 8, !tbaa !23
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %29) #2
  %30 = getelementptr inbounds i8, ptr %0, i64 50
  %31 = load i16, ptr %30, align 2, !tbaa !24
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %31) #2
  %32 = getelementptr inbounds i8, ptr %0, i64 52
  %33 = load i16, ptr %32, align 4, !tbaa !25
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %33) #2
  %34 = getelementptr inbounds i8, ptr %0, i64 54
  %35 = load i16, ptr %34, align 2, !tbaa !26
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %35) #2
  %36 = getelementptr inbounds i8, ptr %0, i64 56
  %37 = load i16, ptr %36, align 8, !tbaa !27
  tail call void @bufwrite16b(ptr noundef %4, i16 noundef zeroext %37) #2
  br label %38

38:                                               ; preds = %2, %3
  %.0 = phi ptr [ %4, %3 ], [ null, %2 ]
  ret ptr %.0
}

declare ptr @bufnew(...) local_unnamed_addr #1

declare void @bufwrite32b(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @bufwrite16b(ptr noundef, i16 noundef zeroext) local_unnamed_addr #1

declare void @bufwrite64b(ptr noundef, i64 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 18, !11, i64 24, !11, i64 32, !10, i64 40, !10, i64 42, !10, i64 44, !10, i64 46, !10, i64 48, !10, i64 50, !10, i64 52, !10, i64 54, !10, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = !{!6, !10, i64 16}
!16 = !{!6, !10, i64 18}
!17 = !{!6, !11, i64 24}
!18 = !{!6, !11, i64 32}
!19 = !{!6, !10, i64 40}
!20 = !{!6, !10, i64 42}
!21 = !{!6, !10, i64 44}
!22 = !{!6, !10, i64 46}
!23 = !{!6, !10, i64 48}
!24 = !{!6, !10, i64 50}
!25 = !{!6, !10, i64 52}
!26 = !{!6, !10, i64 54}
!27 = !{!6, !10, i64 56}


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