SOURCE_FILE
  EXTERN_BLOCK
    UNSAFE_KW "unsafe"
    WHITESPACE " "
    ABI
      EXTERN_KW "extern"
    WHITESPACE " "
    EXTERN_ITEM_LIST
      L_CURLY "{"
      WHITESPACE "\n    "
      FN
        COMMENT "// sqrt (from libm) may be called with any `f64`"
        WHITESPACE "\n    "
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        SAFE_KW "safe"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "sqrt"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "x"
            COLON ":"
            WHITESPACE " "
            PATH_TYPE
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "f64"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "f64"
        SEMICOLON ";"
      WHITESPACE "\n\n    "
      FN
        COMMENT "// strlen (from libc) requires a valid pointer,"
        WHITESPACE "\n    "
        COMMENT "// so we mark it as being an unsafe fn"
        WHITESPACE "\n    "
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        UNSAFE_KW "unsafe"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "strlen"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "p"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              CONST_KW "const"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "c_char"
          R_PAREN ")"
        WHITESPACE " "
        RET_TYPE
          THIN_ARROW "->"
          WHITESPACE " "
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "usize"
        SEMICOLON ";"
      WHITESPACE "\n\n    "
      FN
        COMMENT "// this function doesn't say safe or unsafe, so it defaults to unsafe"
        WHITESPACE "\n    "
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        FN_KW "fn"
        WHITESPACE " "
        NAME
          IDENT "free"
        PARAM_LIST
          L_PAREN "("
          PARAM
            IDENT_PAT
              NAME
                IDENT "p"
            COLON ":"
            WHITESPACE " "
            PTR_TYPE
              STAR "*"
              MUT_KW "mut"
              WHITESPACE " "
              PATH_TYPE
                PATH
                  PATH
                    PATH
                      PATH_SEGMENT
                        NAME_REF
                          IDENT "core"
                    COLON2 "::"
                    PATH_SEGMENT
                      NAME_REF
                        IDENT "ffi"
                  COLON2 "::"
                  PATH_SEGMENT
                    NAME_REF
                      IDENT "c_void"
          R_PAREN ")"
        SEMICOLON ";"
      WHITESPACE "\n\n    "
      STATIC
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        SAFE_KW "safe"
        WHITESPACE " "
        STATIC_KW "static"
        WHITESPACE " "
        MUT_KW "mut"
        WHITESPACE " "
        NAME
          IDENT "COUNTER"
        COLON ":"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "i32"
        SEMICOLON ";"
      WHITESPACE "\n\n    "
      STATIC
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        UNSAFE_KW "unsafe"
        WHITESPACE " "
        STATIC_KW "static"
        WHITESPACE " "
        NAME
          IDENT "IMPORTANT_BYTES"
        COLON ":"
        WHITESPACE " "
        ARRAY_TYPE
          L_BRACK "["
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "u8"
          SEMICOLON ";"
          WHITESPACE " "
          CONST_ARG
            LITERAL
              INT_NUMBER "256"
          R_BRACK "]"
        SEMICOLON ";"
      WHITESPACE "\n\n    "
      STATIC
        VISIBILITY
          PUB_KW "pub"
        WHITESPACE " "
        SAFE_KW "safe"
        WHITESPACE " "
        STATIC_KW "static"
        WHITESPACE " "
        NAME
          IDENT "LINES"
        COLON ":"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "SyncUnsafeCell"
              GENERIC_ARG_LIST
                L_ANGLE "<"
                TYPE_ARG
                  PATH_TYPE
                    PATH
                      PATH_SEGMENT
                        NAME_REF
                          IDENT "i32"
                R_ANGLE ">"
        SEMICOLON ";"
      WHITESPACE "\n"
      R_CURLY "}"
  WHITESPACE "\n"
