; ModuleID = 'linkedlist.c'
source_filename = "linkedlist.c"
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.SimpleLinkedList = type { i32, ptr }
%struct.NodeA = type { i32, ptr }
%struct.NodeB = type { i32, ptr }
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @simple_linked_list(i32 noundef %0) #0 !dbg !12 {
%2 = alloca i32, align 4
%3 = alloca %struct.SimpleLinkedList, align 8
%4 = alloca %struct.SimpleLinkedList, align 8
%5 = alloca %struct.SimpleLinkedList, align 8
%6 = alloca %struct.SimpleLinkedList, align 8
%7 = alloca %struct.SimpleLinkedList, align 8
store i32 %0, ptr %2, align 4
#dbg_declare(ptr %2, !17, !DIExpression(), !18)
#dbg_declare(ptr %3, !19, !DIExpression(), !25)
%8 = getelementptr inbounds %struct.SimpleLinkedList, ptr %3, i32 0, i32 0, !dbg !26
%9 = load i32, ptr %2, align 4, !dbg !27
store i32 %9, ptr %8, align 8, !dbg !26
%10 = getelementptr inbounds %struct.SimpleLinkedList, ptr %3, i32 0, i32 1, !dbg !26
store ptr null, ptr %10, align 8, !dbg !26
%11 = getelementptr inbounds %struct.SimpleLinkedList, ptr %3, i32 0, i32 0, !dbg !28
%12 = load i32, ptr %11, align 8, !dbg !29
%13 = add nsw i32 %12, 2, !dbg !29
store i32 %13, ptr %11, align 8, !dbg !29
#dbg_declare(ptr %4, !30, !DIExpression(), !31)
%14 = getelementptr inbounds %struct.SimpleLinkedList, ptr %4, i32 0, i32 0, !dbg !32
%15 = load i32, ptr %2, align 4, !dbg !33
%16 = sub nsw i32 %15, 3, !dbg !34
store i32 %16, ptr %14, align 8, !dbg !32
%17 = getelementptr inbounds %struct.SimpleLinkedList, ptr %4, i32 0, i32 1, !dbg !32
store ptr null, ptr %17, align 8, !dbg !32
#dbg_declare(ptr %5, !35, !DIExpression(), !36)
%18 = getelementptr inbounds %struct.SimpleLinkedList, ptr %5, i32 0, i32 0, !dbg !37
%19 = load i32, ptr %2, align 4, !dbg !38
%20 = mul nsw i32 %19, 5, !dbg !39
store i32 %20, ptr %18, align 8, !dbg !37
%21 = getelementptr inbounds %struct.SimpleLinkedList, ptr %5, i32 0, i32 1, !dbg !37
store ptr null, ptr %21, align 8, !dbg !37
#dbg_declare(ptr %6, !40, !DIExpression(), !41)
%22 = getelementptr inbounds %struct.SimpleLinkedList, ptr %6, i32 0, i32 0, !dbg !42
%23 = load i32, ptr %2, align 4, !dbg !43
%24 = sdiv i32 %23, 2, !dbg !44
store i32 %24, ptr %22, align 8, !dbg !42
%25 = getelementptr inbounds %struct.SimpleLinkedList, ptr %6, i32 0, i32 1, !dbg !42
store ptr null, ptr %25, align 8, !dbg !42
#dbg_declare(ptr %7, !45, !DIExpression(), !46)
%26 = getelementptr inbounds %struct.SimpleLinkedList, ptr %7, i32 0, i32 0, !dbg !47
%27 = load i32, ptr %2, align 4, !dbg !48
%28 = sdiv i32 %27, 100, !dbg !49
store i32 %28, ptr %26, align 8, !dbg !47
%29 = getelementptr inbounds %struct.SimpleLinkedList, ptr %7, i32 0, i32 1, !dbg !47
store ptr null, ptr %29, align 8, !dbg !47
%30 = getelementptr inbounds %struct.SimpleLinkedList, ptr %3, i32 0, i32 1, !dbg !50
store ptr %4, ptr %30, align 8, !dbg !51
%31 = getelementptr inbounds %struct.SimpleLinkedList, ptr %4, i32 0, i32 1, !dbg !52
store ptr %5, ptr %31, align 8, !dbg !53
%32 = getelementptr inbounds %struct.SimpleLinkedList, ptr %5, i32 0, i32 1, !dbg !54
store ptr %6, ptr %32, align 8, !dbg !55
%33 = getelementptr inbounds %struct.SimpleLinkedList, ptr %6, i32 0, i32 1, !dbg !56
store ptr %7, ptr %33, align 8, !dbg !57
%34 = getelementptr inbounds %struct.SimpleLinkedList, ptr %7, i32 0, i32 1, !dbg !58
store ptr %3, ptr %34, align 8, !dbg !59
%35 = getelementptr inbounds %struct.SimpleLinkedList, ptr %3, i32 0, i32 1, !dbg !60
%36 = load ptr, ptr %35, align 8, !dbg !60
%37 = getelementptr inbounds %struct.SimpleLinkedList, ptr %36, i32 0, i32 1, !dbg !61
%38 = load ptr, ptr %37, align 8, !dbg !61
%39 = getelementptr inbounds %struct.SimpleLinkedList, ptr %38, i32 0, i32 1, !dbg !62
%40 = load ptr, ptr %39, align 8, !dbg !62
%41 = getelementptr inbounds %struct.SimpleLinkedList, ptr %40, i32 0, i32 1, !dbg !63
%42 = load ptr, ptr %41, align 8, !dbg !63
%43 = getelementptr inbounds %struct.SimpleLinkedList, ptr %42, i32 0, i32 1, !dbg !64
%44 = load ptr, ptr %43, align 8, !dbg !64
%45 = getelementptr inbounds %struct.SimpleLinkedList, ptr %44, i32 0, i32 1, !dbg !65
%46 = load ptr, ptr %45, align 8, !dbg !65
%47 = getelementptr inbounds %struct.SimpleLinkedList, ptr %46, i32 0, i32 1, !dbg !66
%48 = load ptr, ptr %47, align 8, !dbg !66
%49 = getelementptr inbounds %struct.SimpleLinkedList, ptr %48, i32 0, i32 1, !dbg !67
%50 = load ptr, ptr %49, align 8, !dbg !67
%51 = getelementptr inbounds %struct.SimpleLinkedList, ptr %50, i32 0, i32 1, !dbg !68
%52 = load ptr, ptr %51, align 8, !dbg !68
%53 = getelementptr inbounds %struct.SimpleLinkedList, ptr %52, i32 0, i32 1, !dbg !69
%54 = load ptr, ptr %53, align 8, !dbg !69
%55 = getelementptr inbounds %struct.SimpleLinkedList, ptr %54, i32 0, i32 0, !dbg !70
%56 = load i32, ptr %55, align 8, !dbg !70
ret i32 %56, !dbg !71
}
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @indirectly_recursive_type(i32 noundef %0) #0 !dbg !72 {
%2 = alloca i32, align 4
%3 = alloca %struct.NodeA, align 8
%4 = alloca %struct.NodeB, align 8
%5 = alloca %struct.NodeA, align 8
store i32 %0, ptr %2, align 4
#dbg_declare(ptr %2, !73, !DIExpression(), !74)
#dbg_declare(ptr %3, !75, !DIExpression(), !86)
%6 = getelementptr inbounds %struct.NodeA, ptr %3, i32 0, i32 0, !dbg !87
%7 = load i32, ptr %2, align 4, !dbg !88
store i32 %7, ptr %6, align 8, !dbg !87
%8 = getelementptr inbounds %struct.NodeA, ptr %3, i32 0, i32 1, !dbg !87
store ptr null, ptr %8, align 8, !dbg !87
#dbg_declare(ptr %4, !89, !DIExpression(), !90)
%9 = getelementptr inbounds %struct.NodeB, ptr %4, i32 0, i32 0, !dbg !91
%10 = load i32, ptr %2, align 4, !dbg !92
%11 = add nsw i32 %10, 3, !dbg !93
store i32 %11, ptr %9, align 8, !dbg !91
%12 = getelementptr inbounds %struct.NodeB, ptr %4, i32 0, i32 1, !dbg !91
store ptr null, ptr %12, align 8, !dbg !91
#dbg_declare(ptr %5, !94, !DIExpression(), !95)
%13 = getelementptr inbounds %struct.NodeA, ptr %5, i32 0, i32 0, !dbg !96
%14 = load i32, ptr %2, align 4, !dbg !97
%15 = sdiv i32 %14, 4, !dbg !98
store i32 %15, ptr %13, align 8, !dbg !96
%16 = getelementptr inbounds %struct.NodeA, ptr %5, i32 0, i32 1, !dbg !96
store ptr null, ptr %16, align 8, !dbg !96
%17 = getelementptr inbounds %struct.NodeA, ptr %3, i32 0, i32 1, !dbg !99
store ptr %4, ptr %17, align 8, !dbg !100
%18 = getelementptr inbounds %struct.NodeB, ptr %4, i32 0, i32 1, !dbg !101
store ptr %5, ptr %18, align 8, !dbg !102
%19 = getelementptr inbounds %struct.NodeA, ptr %5, i32 0, i32 1, !dbg !103
store ptr %4, ptr %19, align 8, !dbg !104
%20 = getelementptr inbounds %struct.NodeA, ptr %3, i32 0, i32 1, !dbg !105
%21 = load ptr, ptr %20, align 8, !dbg !105
%22 = getelementptr inbounds %struct.NodeB, ptr %21, i32 0, i32 1, !dbg !106
%23 = load ptr, ptr %22, align 8, !dbg !106
%24 = getelementptr inbounds %struct.NodeA, ptr %23, i32 0, i32 1, !dbg !107
%25 = load ptr, ptr %24, align 8, !dbg !107
%26 = getelementptr inbounds %struct.NodeB, ptr %25, i32 0, i32 1, !dbg !108
%27 = load ptr, ptr %26, align 8, !dbg !108
%28 = getelementptr inbounds %struct.NodeA, ptr %27, i32 0, i32 1, !dbg !109
%29 = load ptr, ptr %28, align 8, !dbg !109
%30 = getelementptr inbounds %struct.NodeB, ptr %29, i32 0, i32 1, !dbg !110
%31 = load ptr, ptr %30, align 8, !dbg !110
%32 = getelementptr inbounds %struct.NodeA, ptr %31, i32 0, i32 1, !dbg !111
%33 = load ptr, ptr %32, align 8, !dbg !111
%34 = getelementptr inbounds %struct.NodeB, ptr %33, i32 0, i32 0, !dbg !112
%35 = load i32, ptr %34, align 8, !dbg !112
ret i32 %35, !dbg !113
}
; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @takes_opaque_struct(ptr noundef %0) #0 !dbg !114 {
%2 = alloca ptr, align 8
store ptr %0, ptr %2, align 8
#dbg_declare(ptr %2, !119, !DIExpression(), !120)
%3 = load ptr, ptr %2, align 8, !dbg !121
%4 = icmp ne ptr %3, null, !dbg !122
%5 = zext i1 %4 to i32, !dbg !122
ret i32 %5, !dbg !123
}
attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "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.dbg.cu = !{!0}
!llvm.module.flags = !{!4, !5, !6, !7, !8, !9, !10}
!llvm.ident = !{!11}
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 19.1.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "linkedlist.c", directory: "/home/benji/Dev/OSSDev/Rust/llvm-ir/tests/basic_bc", checksumkind: CSK_MD5, checksum: "51bbed650ccc4fac49c6d479470eb8fb")
!2 = !{!3}
!3 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
!4 = !{i32 7, !"Dwarf Version", i32 5}
!5 = !{i32 2, !"Debug Info Version", i32 3}
!6 = !{i32 1, !"wchar_size", i32 4}
!7 = !{i32 8, !"PIC Level", i32 2}
!8 = !{i32 7, !"PIE Level", i32 2}
!9 = !{i32 7, !"uwtable", i32 2}
!10 = !{i32 7, !"frame-pointer", i32 2}
!11 = !{!"clang version 19.1.0"}
!12 = distinct !DISubprogram(name: "simple_linked_list", scope: !1, file: !1, line: 8, type: !13, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !16)
!13 = !DISubroutineType(types: !14)
!14 = !{!15, !15}
!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!16 = !{}
!17 = !DILocalVariable(name: "x", arg: 1, scope: !12, file: !1, line: 8, type: !15)
!18 = !DILocation(line: 8, column: 28, scope: !12)
!19 = !DILocalVariable(name: "list", scope: !12, file: !1, line: 9, type: !20)
!20 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "SimpleLinkedList", file: !1, line: 3, size: 128, elements: !21)
!21 = !{!22, !23}
!22 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !20, file: !1, line: 4, baseType: !15, size: 32)
!23 = !DIDerivedType(tag: DW_TAG_member, name: "next", scope: !20, file: !1, line: 5, baseType: !24, size: 64, offset: 64)
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!25 = !DILocation(line: 9, column: 27, scope: !12)
!26 = !DILocation(line: 9, column: 34, scope: !12)
!27 = !DILocation(line: 9, column: 36, scope: !12)
!28 = !DILocation(line: 10, column: 8, scope: !12)
!29 = !DILocation(line: 10, column: 12, scope: !12)
!30 = !DILocalVariable(name: "list_1", scope: !12, file: !1, line: 11, type: !20)
!31 = !DILocation(line: 11, column: 27, scope: !12)
!32 = !DILocation(line: 11, column: 36, scope: !12)
!33 = !DILocation(line: 11, column: 38, scope: !12)
!34 = !DILocation(line: 11, column: 40, scope: !12)
!35 = !DILocalVariable(name: "list_2", scope: !12, file: !1, line: 12, type: !20)
!36 = !DILocation(line: 12, column: 27, scope: !12)
!37 = !DILocation(line: 12, column: 36, scope: !12)
!38 = !DILocation(line: 12, column: 38, scope: !12)
!39 = !DILocation(line: 12, column: 40, scope: !12)
!40 = !DILocalVariable(name: "list_3", scope: !12, file: !1, line: 13, type: !20)
!41 = !DILocation(line: 13, column: 27, scope: !12)
!42 = !DILocation(line: 13, column: 36, scope: !12)
!43 = !DILocation(line: 13, column: 38, scope: !12)
!44 = !DILocation(line: 13, column: 40, scope: !12)
!45 = !DILocalVariable(name: "list_4", scope: !12, file: !1, line: 14, type: !20)
!46 = !DILocation(line: 14, column: 27, scope: !12)
!47 = !DILocation(line: 14, column: 36, scope: !12)
!48 = !DILocation(line: 14, column: 38, scope: !12)
!49 = !DILocation(line: 14, column: 40, scope: !12)
!50 = !DILocation(line: 15, column: 8, scope: !12)
!51 = !DILocation(line: 15, column: 13, scope: !12)
!52 = !DILocation(line: 16, column: 10, scope: !12)
!53 = !DILocation(line: 16, column: 15, scope: !12)
!54 = !DILocation(line: 17, column: 10, scope: !12)
!55 = !DILocation(line: 17, column: 15, scope: !12)
!56 = !DILocation(line: 18, column: 10, scope: !12)
!57 = !DILocation(line: 18, column: 15, scope: !12)
!58 = !DILocation(line: 19, column: 10, scope: !12)
!59 = !DILocation(line: 19, column: 15, scope: !12)
!60 = !DILocation(line: 20, column: 15, scope: !12)
!61 = !DILocation(line: 20, column: 21, scope: !12)
!62 = !DILocation(line: 20, column: 27, scope: !12)
!63 = !DILocation(line: 20, column: 33, scope: !12)
!64 = !DILocation(line: 20, column: 39, scope: !12)
!65 = !DILocation(line: 20, column: 45, scope: !12)
!66 = !DILocation(line: 20, column: 51, scope: !12)
!67 = !DILocation(line: 20, column: 57, scope: !12)
!68 = !DILocation(line: 20, column: 63, scope: !12)
!69 = !DILocation(line: 20, column: 69, scope: !12)
!70 = !DILocation(line: 20, column: 75, scope: !12)
!71 = !DILocation(line: 20, column: 3, scope: !12)
!72 = distinct !DISubprogram(name: "indirectly_recursive_type", scope: !1, file: !1, line: 35, type: !13, scopeLine: 35, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !16)
!73 = !DILocalVariable(name: "x", arg: 1, scope: !72, file: !1, line: 35, type: !15)
!74 = !DILocation(line: 35, column: 35, scope: !72)
!75 = !DILocalVariable(name: "a", scope: !72, file: !1, line: 36, type: !76)
!76 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NodeA", file: !1, line: 25, size: 128, elements: !77)
!77 = !{!78, !79}
!78 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !76, file: !1, line: 26, baseType: !15, size: 32)
!79 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !76, file: !1, line: 27, baseType: !80, size: 64, offset: 64)
!80 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !81, size: 64)
!81 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NodeB", file: !1, line: 30, size: 128, elements: !82)
!82 = !{!83, !84}
!83 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !81, file: !1, line: 31, baseType: !15, size: 32)
!84 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !81, file: !1, line: 32, baseType: !85, size: 64, offset: 64)
!85 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !76, size: 64)
!86 = !DILocation(line: 36, column: 16, scope: !72)
!87 = !DILocation(line: 36, column: 20, scope: !72)
!88 = !DILocation(line: 36, column: 22, scope: !72)
!89 = !DILocalVariable(name: "b", scope: !72, file: !1, line: 37, type: !81)
!90 = !DILocation(line: 37, column: 16, scope: !72)
!91 = !DILocation(line: 37, column: 20, scope: !72)
!92 = !DILocation(line: 37, column: 22, scope: !72)
!93 = !DILocation(line: 37, column: 24, scope: !72)
!94 = !DILocalVariable(name: "a_1", scope: !72, file: !1, line: 38, type: !76)
!95 = !DILocation(line: 38, column: 16, scope: !72)
!96 = !DILocation(line: 38, column: 22, scope: !72)
!97 = !DILocation(line: 38, column: 24, scope: !72)
!98 = !DILocation(line: 38, column: 26, scope: !72)
!99 = !DILocation(line: 39, column: 5, scope: !72)
!100 = !DILocation(line: 39, column: 7, scope: !72)
!101 = !DILocation(line: 40, column: 5, scope: !72)
!102 = !DILocation(line: 40, column: 7, scope: !72)
!103 = !DILocation(line: 41, column: 7, scope: !72)
!104 = !DILocation(line: 41, column: 9, scope: !72)
!105 = !DILocation(line: 42, column: 12, scope: !72)
!106 = !DILocation(line: 42, column: 15, scope: !72)
!107 = !DILocation(line: 42, column: 18, scope: !72)
!108 = !DILocation(line: 42, column: 21, scope: !72)
!109 = !DILocation(line: 42, column: 24, scope: !72)
!110 = !DILocation(line: 42, column: 27, scope: !72)
!111 = !DILocation(line: 42, column: 30, scope: !72)
!112 = !DILocation(line: 42, column: 33, scope: !72)
!113 = !DILocation(line: 42, column: 3, scope: !72)
!114 = distinct !DISubprogram(name: "takes_opaque_struct", scope: !1, file: !1, line: 48, type: !115, scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !16)
!115 = !DISubroutineType(types: !116)
!116 = !{!15, !117}
!117 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !118, size: 64)
!118 = !DICompositeType(tag: DW_TAG_structure_type, name: "SomeOpaqueStruct", file: !1, line: 46, flags: DIFlagFwdDecl)
!119 = !DILocalVariable(name: "s", arg: 1, scope: !114, file: !1, line: 48, type: !117)
!120 = !DILocation(line: 48, column: 50, scope: !114)
!121 = !DILocation(line: 49, column: 10, scope: !114)
!122 = !DILocation(line: 49, column: 12, scope: !114)
!123 = !DILocation(line: 49, column: 3, scope: !114)