module CI = Cstubs_internals

external async_ssl_stub_1_TLS_method : unit -> CI.voidp
  = "async_ssl_stub_1_TLS_method" 

external async_ssl_stub_2_TLSv1_method : unit -> CI.voidp
  = "async_ssl_stub_2_TLSv1_method" 

external async_ssl_stub_3_TLSv1_1_method : unit -> CI.voidp
  = "async_ssl_stub_3_TLSv1_1_method" 

external async_ssl_stub_4_TLSv1_2_method : unit -> CI.voidp
  = "async_ssl_stub_4_TLSv1_2_method" 

external async_ssl_stub_5_ERR_get_error : unit -> Unsigned.ulong
  = "async_ssl_stub_5_ERR_get_error" 

external async_ssl_stub_6_ERR_error_string_n
  : Unsigned.ulong -> _ CI.fatptr -> int -> unit
  = "async_ssl_stub_6_ERR_error_string_n" 

external async_ssl_stub_7_OpenSSL_add_all_digests : unit -> unit
  = "async_ssl_stub_7_OpenSSL_add_all_digests" 

external async_ssl_stub_8_OpenSSL_add_all_ciphers : unit -> unit
  = "async_ssl_stub_8_OpenSSL_add_all_ciphers" 

external async_ssl_stub_9_OpenSSL_add_ssl_algorithms : unit -> unit
  = "async_ssl_stub_9_OpenSSL_add_ssl_algorithms" 

external async_ssl_stub_10_OPENSSL_config : _ CI.fatptr -> unit
  = "async_ssl_stub_10_OPENSSL_config" 

external async_ssl_stub_11_SSL_library_init : unit -> Unsigned.ulong
  = "async_ssl_stub_11_SSL_library_init" 

external async_ssl_stub_12_SSL_load_error_strings : unit -> unit
  = "async_ssl_stub_12_SSL_load_error_strings" 

external async_ssl_stub_13_ERR_load_crypto_strings : unit -> unit
  = "async_ssl_stub_13_ERR_load_crypto_strings" 

external async_ssl_stub_14_ENGINE_load_builtin_engines : unit -> unit
  = "async_ssl_stub_14_ENGINE_load_builtin_engines" 

external async_ssl_stub_15_ENGINE_register_all_complete : unit -> unit
  = "async_ssl_stub_15_ENGINE_register_all_complete" 

external async_ssl_stub_16_SSL_CTX_new : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_16_SSL_CTX_new" 

external async_ssl_stub_17_SSL_CTX_free : _ CI.fatptr -> unit
  = "async_ssl_stub_17_SSL_CTX_free" 

external async_ssl_stub_18_SSL_CTX_set_security_level
  : _ CI.fatptr -> int -> unit
  = "async_ssl_stub_18_SSL_CTX_set_security_level" 

external async_ssl_stub_19_SSL_CTX_load_verify_locations
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_19_SSL_CTX_load_verify_locations" 

external async_ssl_stub_20_SSL_CTX_set_default_verify_paths
  : _ CI.fatptr -> int = "async_ssl_stub_20_SSL_CTX_set_default_verify_paths" 

external async_ssl_stub_21_SSL_CTX_set_session_id_context
  : _ CI.fatptr -> _ CI.fatptr -> Unsigned.uint -> int
  = "async_ssl_stub_21_SSL_CTX_set_session_id_context" 

external async_ssl_stub_22_SSL_CTX_set_cipher_list
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_22_SSL_CTX_set_cipher_list" 

external async_ssl_stub_23_SSL_CTX_set_options
  : _ CI.fatptr -> Unsigned.ulong -> Unsigned.ulong
  = "async_ssl_stub_23_SSL_CTX_set_options" 

external async_ssl_stub_24_SSL_CTX_use_certificate_chain_file
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_24_SSL_CTX_use_certificate_chain_file" 

external async_ssl_stub_25_SSL_CTX_use_certificate_file
  : _ CI.fatptr -> _ CI.fatptr -> int -> int
  = "async_ssl_stub_25_SSL_CTX_use_certificate_file" 

external async_ssl_stub_26_SSL_CTX_use_PrivateKey_file
  : _ CI.fatptr -> _ CI.fatptr -> int -> int
  = "async_ssl_stub_26_SSL_CTX_use_PrivateKey_file" 

external async_ssl_stub_27_BIO_new : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_27_BIO_new" 

external async_ssl_stub_28_BIO_s_mem : unit -> CI.voidp
  = "async_ssl_stub_28_BIO_s_mem" 

external async_ssl_stub_29_BIO_read
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_29_BIO_read" 

external async_ssl_stub_30_BIO_write
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_30_BIO_write" 

external async_ssl_stub_31_OBJ_obj2nid : _ CI.fatptr -> int
  = "async_ssl_stub_31_OBJ_obj2nid" 

external async_ssl_stub_32_OBJ_nid2sn : int -> CI.voidp
  = "async_ssl_stub_32_OBJ_nid2sn" 

external async_ssl_stub_33_OBJ_txt2nid : _ CI.fatptr -> int
  = "async_ssl_stub_33_OBJ_txt2nid" 

external async_ssl_stub_34_ASN1_STRING_length : _ CI.fatptr -> int
  = "async_ssl_stub_34_ASN1_STRING_length" 

external async_ssl_stub_35_ASN1_STRING_data : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_35_ASN1_STRING_data" 

external async_ssl_stub_36_X509_NAME_ENTRY_get_object
  : _ CI.fatptr -> CI.voidp = "async_ssl_stub_36_X509_NAME_ENTRY_get_object" 

external async_ssl_stub_37_X509_NAME_ENTRY_get_data : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_37_X509_NAME_ENTRY_get_data" 

external async_ssl_stub_38_X509_NAME_entry_count : _ CI.fatptr -> int
  = "async_ssl_stub_38_X509_NAME_entry_count" 

external async_ssl_stub_39_X509_NAME_get_entry
  : _ CI.fatptr -> int -> CI.voidp = "async_ssl_stub_39_X509_NAME_get_entry" 

external async_ssl_stub_40_EVP_sha1 : unit -> CI.voidp
  = "async_ssl_stub_40_EVP_sha1" 

external async_ssl_stub_41_X509_get_subject_name : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_41_X509_get_subject_name" 

external async_ssl_stub_42_X509_verify_cert_error_string
  : Signed.long -> CI.voidp
  = "async_ssl_stub_42_X509_verify_cert_error_string" 

external async_ssl_stub_43_X509_free : _ CI.fatptr -> unit
  = "async_ssl_stub_43_X509_free" 

external async_ssl_stub_44_async_ssl__subject_alt_names
  : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_44_async_ssl__subject_alt_names" 

external async_ssl_stub_45_async_ssl__free_subject_alt_names
  : _ CI.fatptr -> unit
  = "async_ssl_stub_45_async_ssl__free_subject_alt_names" 

external async_ssl_stub_46_X509_digest
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> bool
  = "async_ssl_stub_46_X509_digest" 

external async_ssl_stub_47_SSL_SESSION_new : unit -> CI.voidp
  = "async_ssl_stub_47_SSL_SESSION_new" 

external async_ssl_stub_48_SSL_SESSION_free : _ CI.fatptr -> unit
  = "async_ssl_stub_48_SSL_SESSION_free" 

external async_ssl_stub_49_BN_new : unit -> CI.voidp
  = "async_ssl_stub_49_BN_new" 

external async_ssl_stub_50_BN_free : _ CI.fatptr -> unit
  = "async_ssl_stub_50_BN_free" 

external async_ssl_stub_51_BN_bin2bn
  : _ CI.fatptr -> int -> _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_51_BN_bin2bn" 

external async_ssl_stub_52_BN_hex2bn : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_52_BN_hex2bn" 

external async_ssl_stub_53_DH_new : unit -> CI.voidp
  = "async_ssl_stub_53_DH_new" 

external async_ssl_stub_54_DH_free : _ CI.fatptr -> unit
  = "async_ssl_stub_54_DH_free" 

external async_ssl_stub_55_DH_generate_parameters
  : int -> int -> _ CI.fatfunptr -> _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_55_DH_generate_parameters" 

external async_ssl_stub_56_SSL_new : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_56_SSL_new" 

external async_ssl_stub_57_SSL_free : _ CI.fatptr -> unit
  = "async_ssl_stub_57_SSL_free" 

external async_ssl_stub_58_SSL_set_ssl_method
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_58_SSL_set_ssl_method" 

external async_ssl_stub_59_SSL_get_error : _ CI.fatptr -> int -> int
  = "async_ssl_stub_59_SSL_get_error" 

external async_ssl_stub_60_SSL_set_connect_state : _ CI.fatptr -> unit
  = "async_ssl_stub_60_SSL_set_connect_state" 

external async_ssl_stub_61_SSL_set_accept_state : _ CI.fatptr -> unit
  = "async_ssl_stub_61_SSL_set_accept_state" 

external async_ssl_stub_62_SSL_connect : _ CI.fatptr -> int
  = "async_ssl_stub_62_SSL_connect" 

external async_ssl_stub_63_SSL_accept : _ CI.fatptr -> int
  = "async_ssl_stub_63_SSL_accept" 

external async_ssl_stub_64_SSL_set_bio
  : _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> unit
  = "async_ssl_stub_64_SSL_set_bio" 

external async_ssl_stub_65_SSL_read
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_65_SSL_read" 

external async_ssl_stub_66_SSL_write
  : _ CI.fatptr -> _ CI.fatptr -> int -> int = "async_ssl_stub_66_SSL_write" 

external async_ssl_stub_67_SSL_set_verify
  : _ CI.fatptr -> int -> _ CI.fatptr -> unit
  = "async_ssl_stub_67_SSL_set_verify" 

external async_ssl_stub_68_SSL_set_cipher_list
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_68_SSL_set_cipher_list" 

external async_ssl_stub_69_SSL_get_cipher_list
  : _ CI.fatptr -> int -> CI.voidp = "async_ssl_stub_69_SSL_get_cipher_list" 

external async_ssl_stub_70_SSL_set1_groups_list
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_70_SSL_set1_groups_list" 

external async_ssl_stub_71_SSL_get_peer_certificate : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_71_SSL_get_peer_certificate" 

external async_ssl_stub_72_SSL_get_verify_result : _ CI.fatptr -> Signed.long
  = "async_ssl_stub_72_SSL_get_verify_result" 

external async_ssl_stub_73_SSL_get_version : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_73_SSL_get_version" 

external async_ssl_stub_74_SSL_set_session
  : _ CI.fatptr -> _ CI.fatptr -> int = "async_ssl_stub_74_SSL_set_session" 

external async_ssl_stub_75_SSL_session_reused : _ CI.fatptr -> int
  = "async_ssl_stub_75_SSL_session_reused" 

external async_ssl_stub_76_SSL_get1_session : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_76_SSL_get1_session" 

external async_ssl_stub_77_SSL_check_private_key : _ CI.fatptr -> int
  = "async_ssl_stub_77_SSL_check_private_key" 

external async_ssl_stub_78_SSL_set_tlsext_host_name
  : _ CI.fatptr -> _ CI.fatptr -> int
  = "async_ssl_stub_78_SSL_set_tlsext_host_name" 

external async_ssl_stub_79_async_ssl__pem_peer_certificate_chain
  : _ CI.fatptr -> CI.voidp
  = "async_ssl_stub_79_async_ssl__pem_peer_certificate_chain" 

external async_ssl_stub_80_async_ssl__free_pem_peer_certificate_chain
  : _ CI.fatptr -> unit
  = "async_ssl_stub_80_async_ssl__free_pem_peer_certificate_chain" 

type 'a result = 'a
type 'a return = 'a
type 'a fn =
 | Returns  : 'a CI.typ   -> 'a return fn
 | Function : 'a CI.typ * 'b fn  -> ('a -> 'b) fn
let map_result f x = f x
let returning t = Returns t
let (@->) f p = Function (f, p)
let foreign : type a b. string -> (a -> b) fn -> (a -> b) =
  fun name t -> match t, name with
| Function (CI.Pointer _, Returns CI.Void),
  "async_ssl__free_pem_peer_certificate_chain" ->
  (fun x1 ->
    let CI.CPointer x2 = x1 in
    async_ssl_stub_80_async_ssl__free_pem_peer_certificate_chain x2)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x5; read = x6; _})),
  "async_ssl__pem_peer_certificate_chain" ->
  (fun x3 ->
    let CI.CPointer x4 = x3 in
    x6
    (CI.make_ptr x5
       (async_ssl_stub_79_async_ssl__pem_peer_certificate_chain x4)))
| Function
    (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int))),
  "SSL_set_tlsext_host_name" ->
  (fun x7 x9 ->
    let CI.CPointer x10 = x9 in
    let CI.CPointer x8 = x7 in
    async_ssl_stub_78_SSL_set_tlsext_host_name x8 x10)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "SSL_check_private_key" ->
  (fun x11 ->
    let CI.CPointer x12 = x11 in async_ssl_stub_77_SSL_check_private_key x12)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x15; read = x16; _})),
  "SSL_get1_session" ->
  (fun x13 ->
    let CI.CPointer x14 = x13 in
    x16 (CI.make_ptr x15 (async_ssl_stub_76_SSL_get1_session x14)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "SSL_session_reused" ->
  (fun x17 ->
    let CI.CPointer x18 = x17 in async_ssl_stub_75_SSL_session_reused x18)
| Function
    (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int))),
  "SSL_set_session" ->
  (fun x19 x21 ->
    let CI.CPointer x22 = x21 in
    let CI.CPointer x20 = x19 in async_ssl_stub_74_SSL_set_session x20 x22)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x25; read = x26; _})),
  "SSL_get_version" ->
  (fun x23 ->
    let CI.CPointer x24 = x23 in
    x26 (CI.make_ptr x25 (async_ssl_stub_73_SSL_get_version x24)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Long)),
  "SSL_get_verify_result" ->
  (fun x27 ->
    let CI.CPointer x28 = x27 in async_ssl_stub_72_SSL_get_verify_result x28)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x31; read = x32; _})),
  "SSL_get_peer_certificate" ->
  (fun x29 ->
    let CI.CPointer x30 = x29 in
    x32 (CI.make_ptr x31 (async_ssl_stub_71_SSL_get_peer_certificate x30)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x36; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_set1_groups_list" ->
  (fun x33 x35 ->
    let CI.CPointer x38 = x36 x35 in
    let CI.CPointer x34 = x33 in
    let x37 = x38 in async_ssl_stub_70_SSL_set1_groups_list x34 x37)
| Function
    (CI.Pointer _,
     Function
       (CI.Primitive CI.Int,
        Returns (CI.View {CI.ty = CI.Pointer x42; read = x43; _}))),
  "SSL_get_cipher_list" ->
  (fun x39 x41 ->
    let CI.CPointer x40 = x39 in
    x43 (CI.make_ptr x42 (async_ssl_stub_69_SSL_get_cipher_list x40 x41)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x47; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_set_cipher_list" ->
  (fun x44 x46 ->
    let CI.CPointer x49 = x47 x46 in
    let CI.CPointer x45 = x44 in
    let x48 = x49 in async_ssl_stub_68_SSL_set_cipher_list x45 x48)
| Function
    (CI.Pointer _,
     Function (CI.Primitive CI.Int, Function (CI.Pointer _, Returns CI.Void))),
  "SSL_set_verify" ->
  (fun x50 x52 x53 ->
    let CI.CPointer x54 = x53 in
    let CI.CPointer x51 = x50 in async_ssl_stub_67_SSL_set_verify x51 x52 x54)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x58; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_write" ->
  (fun x55 x57 x61 ->
    let CI.CPointer x60 = x58 x57 in
    let CI.CPointer x56 = x55 in
    let x59 = x60 in async_ssl_stub_66_SSL_write x56 x59 x61)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_read" ->
  (fun x62 x64 x66 ->
    let CI.CPointer x65 = x64 in
    let CI.CPointer x63 = x62 in async_ssl_stub_65_SSL_read x63 x65 x66)
| Function
    (CI.Pointer _,
     Function (CI.Pointer _, Function (CI.Pointer _, Returns CI.Void))),
  "SSL_set_bio" ->
  (fun x67 x69 x71 ->
    let CI.CPointer x72 = x71 in
    let CI.CPointer x70 = x69 in
    let CI.CPointer x68 = x67 in async_ssl_stub_64_SSL_set_bio x68 x70 x72)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "SSL_accept" ->
  (fun x73 -> let CI.CPointer x74 = x73 in async_ssl_stub_63_SSL_accept x74)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "SSL_connect" ->
  (fun x75 -> let CI.CPointer x76 = x75 in async_ssl_stub_62_SSL_connect x76)
| Function (CI.Pointer _, Returns CI.Void), "SSL_set_accept_state" ->
  (fun x77 ->
    let CI.CPointer x78 = x77 in async_ssl_stub_61_SSL_set_accept_state x78)
| Function (CI.Pointer _, Returns CI.Void), "SSL_set_connect_state" ->
  (fun x79 ->
    let CI.CPointer x80 = x79 in async_ssl_stub_60_SSL_set_connect_state x80)
| Function
    (CI.Pointer _,
     Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))),
  "SSL_get_error" ->
  (fun x81 x83 ->
    let CI.CPointer x82 = x81 in async_ssl_stub_59_SSL_get_error x82 x83)
| Function
    (CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int))),
  "SSL_set_ssl_method" ->
  (fun x84 x86 ->
    let CI.CPointer x87 = x86 in
    let CI.CPointer x85 = x84 in async_ssl_stub_58_SSL_set_ssl_method x85 x87)
| Function (CI.Pointer _, Returns CI.Void), "SSL_free" ->
  (fun x88 -> let CI.CPointer x89 = x88 in async_ssl_stub_57_SSL_free x89)
| Function
    (CI.Pointer _, Returns (CI.View {CI.ty = CI.Pointer x92; read = x93; _})),
  "SSL_new" ->
  (fun x90 ->
    let CI.CPointer x91 = x90 in
    x93 (CI.make_ptr x92 (async_ssl_stub_56_SSL_new x91)))
| Function
    (CI.Primitive CI.Int,
     Function
       (CI.Primitive CI.Int,
        Function
          (CI.View {CI.ty = CI.Funptr _; write = x97; _},
           Function
             (CI.Pointer _,
              Returns (CI.View {CI.ty = CI.Pointer x102; read = x103; _}))))),
  "DH_generate_parameters" ->
  (fun x94 x95 x96 x100 ->
    let CI.CPointer x101 = x100 in
    let CI.Static_funptr x99 = x97 x96 in
    let x98 = x99 in
    x103
    (CI.make_ptr x102
       (async_ssl_stub_55_DH_generate_parameters x94 x95 x98 x101)))
| Function (CI.Pointer _, Returns CI.Void), "DH_free" ->
  (fun x104 -> let CI.CPointer x105 = x104 in async_ssl_stub_54_DH_free x105)
| Function
    (CI.Void, Returns (CI.View {CI.ty = CI.Pointer x107; read = x108; _})),
  "DH_new" ->
  (fun x106 -> x108 (CI.make_ptr x107 (async_ssl_stub_53_DH_new x106)))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x112; _},
        Returns (CI.Primitive CI.Int))),
  "BN_hex2bn" ->
  (fun x109 x111 ->
    let CI.CPointer x114 = x112 x111 in
    let CI.CPointer x110 = x109 in
    let x113 = x114 in async_ssl_stub_52_BN_hex2bn x110 x113)
| Function
    (CI.Pointer _,
     Function
       (CI.Primitive CI.Int,
        Function (CI.Pointer _, Returns (CI.Pointer x120)))),
  "BN_bin2bn" ->
  (fun x115 x117 x118 ->
    let CI.CPointer x119 = x118 in
    let CI.CPointer x116 = x115 in
    CI.make_ptr x120 (async_ssl_stub_51_BN_bin2bn x116 x117 x119))
| Function (CI.Pointer _, Returns CI.Void), "BN_free" ->
  (fun x121 -> let CI.CPointer x122 = x121 in async_ssl_stub_50_BN_free x122)
| Function
    (CI.Void, Returns (CI.View {CI.ty = CI.Pointer x124; read = x125; _})),
  "BN_new" ->
  (fun x123 -> x125 (CI.make_ptr x124 (async_ssl_stub_49_BN_new x123)))
| Function (CI.Pointer _, Returns CI.Void), "SSL_SESSION_free" ->
  (fun x126 ->
    let CI.CPointer x127 = x126 in async_ssl_stub_48_SSL_SESSION_free x127)
| Function
    (CI.Void, Returns (CI.View {CI.ty = CI.Pointer x129; read = x130; _})),
  "SSL_SESSION_new" ->
  (fun x128 ->
    x130 (CI.make_ptr x129 (async_ssl_stub_47_SSL_SESSION_new x128)))
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function
          (CI.Pointer _,
           Function (CI.Pointer _, Returns (CI.Primitive CI.Bool))))),
  "X509_digest" ->
  (fun x131 x133 x135 x137 ->
    let CI.CPointer x138 = x137 in
    let CI.CPointer x136 = x135 in
    let CI.CPointer x134 = x133 in
    let CI.CPointer x132 = x131 in
    async_ssl_stub_46_X509_digest x132 x134 x136 x138)
| Function (CI.Pointer _, Returns CI.Void),
  "async_ssl__free_subject_alt_names" ->
  (fun x139 ->
    let CI.CPointer x140 = x139 in
    async_ssl_stub_45_async_ssl__free_subject_alt_names x140)
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x143; read = x144; _})),
  "async_ssl__subject_alt_names" ->
  (fun x141 ->
    let CI.CPointer x142 = x141 in
    x144
    (CI.make_ptr x143 (async_ssl_stub_44_async_ssl__subject_alt_names x142)))
| Function (CI.Pointer _, Returns CI.Void), "X509_free" ->
  (fun x145 ->
    let CI.CPointer x146 = x145 in async_ssl_stub_43_X509_free x146)
| Function
    (CI.Primitive CI.Long,
     Returns (CI.View {CI.ty = CI.Pointer x148; read = x149; _})),
  "X509_verify_cert_error_string" ->
  (fun x147 ->
    x149
    (CI.make_ptr x148 (async_ssl_stub_42_X509_verify_cert_error_string x147)))
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x152; read = x153; _})),
  "X509_get_subject_name" ->
  (fun x150 ->
    let CI.CPointer x151 = x150 in
    x153 (CI.make_ptr x152 (async_ssl_stub_41_X509_get_subject_name x151)))
| Function (CI.Void, Returns (CI.Pointer x155)), "EVP_sha1" ->
  (fun x154 -> CI.make_ptr x155 (async_ssl_stub_40_EVP_sha1 x154))
| Function
    (CI.Pointer _, Function (CI.Primitive CI.Int, Returns (CI.Pointer x159))),
  "X509_NAME_get_entry" ->
  (fun x156 x158 ->
    let CI.CPointer x157 = x156 in
    CI.make_ptr x159 (async_ssl_stub_39_X509_NAME_get_entry x157 x158))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "X509_NAME_entry_count" ->
  (fun x160 ->
    let CI.CPointer x161 = x160 in
    async_ssl_stub_38_X509_NAME_entry_count x161)
| Function (CI.Pointer _, Returns (CI.Pointer x164)),
  "X509_NAME_ENTRY_get_data" ->
  (fun x162 ->
    let CI.CPointer x163 = x162 in
    CI.make_ptr x164 (async_ssl_stub_37_X509_NAME_ENTRY_get_data x163))
| Function (CI.Pointer _, Returns (CI.Pointer x167)),
  "X509_NAME_ENTRY_get_object" ->
  (fun x165 ->
    let CI.CPointer x166 = x165 in
    CI.make_ptr x167 (async_ssl_stub_36_X509_NAME_ENTRY_get_object x166))
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x170; read = x171; _})),
  "ASN1_STRING_data" ->
  (fun x168 ->
    let CI.CPointer x169 = x168 in
    x171 (CI.make_ptr x170 (async_ssl_stub_35_ASN1_STRING_data x169)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "ASN1_STRING_length" ->
  (fun x172 ->
    let CI.CPointer x173 = x172 in async_ssl_stub_34_ASN1_STRING_length x173)
| Function
    (CI.View {CI.ty = CI.Pointer _; write = x175; _},
     Returns (CI.Primitive CI.Int)),
  "OBJ_txt2nid" ->
  (fun x174 ->
    let CI.CPointer x177 = x175 x174 in
    let x176 = x177 in async_ssl_stub_33_OBJ_txt2nid x176)
| Function
    (CI.Primitive CI.Int,
     Returns (CI.View {CI.ty = CI.Pointer x179; read = x180; _})),
  "OBJ_nid2sn" ->
  (fun x178 -> x180 (CI.make_ptr x179 (async_ssl_stub_32_OBJ_nid2sn x178)))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "OBJ_obj2nid" ->
  (fun x181 ->
    let CI.CPointer x182 = x181 in async_ssl_stub_31_OBJ_obj2nid x182)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x186; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "BIO_write" ->
  (fun x183 x185 x189 ->
    let CI.CPointer x188 = x186 x185 in
    let CI.CPointer x184 = x183 in
    let x187 = x188 in async_ssl_stub_30_BIO_write x184 x187 x189)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "BIO_read" ->
  (fun x190 x192 x194 ->
    let CI.CPointer x193 = x192 in
    let CI.CPointer x191 = x190 in async_ssl_stub_29_BIO_read x191 x193 x194)
| Function (CI.Void, Returns (CI.Pointer x196)), "BIO_s_mem" ->
  (fun x195 -> CI.make_ptr x196 (async_ssl_stub_28_BIO_s_mem x195))
| Function (CI.Pointer _, Returns (CI.Pointer x199)), "BIO_new" ->
  (fun x197 ->
    let CI.CPointer x198 = x197 in
    CI.make_ptr x199 (async_ssl_stub_27_BIO_new x198))
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x203; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_use_PrivateKey_file" ->
  (fun x200 x202 x206 ->
    let CI.CPointer x205 = x203 x202 in
    let CI.CPointer x201 = x200 in
    let x204 = x205 in
    async_ssl_stub_26_SSL_CTX_use_PrivateKey_file x201 x204 x206)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x210; _},
        Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_use_certificate_file" ->
  (fun x207 x209 x213 ->
    let CI.CPointer x212 = x210 x209 in
    let CI.CPointer x208 = x207 in
    let x211 = x212 in
    async_ssl_stub_25_SSL_CTX_use_certificate_file x208 x211 x213)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x217; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_CTX_use_certificate_chain_file" ->
  (fun x214 x216 ->
    let CI.CPointer x219 = x217 x216 in
    let CI.CPointer x215 = x214 in
    let x218 = x219 in
    async_ssl_stub_24_SSL_CTX_use_certificate_chain_file x215 x218)
| Function
    (CI.Pointer _,
     Function (CI.Primitive CI.Ulong, Returns (CI.Primitive CI.Ulong))),
  "SSL_CTX_set_options" ->
  (fun x220 x222 ->
    let CI.CPointer x221 = x220 in
    async_ssl_stub_23_SSL_CTX_set_options x221 x222)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x226; _},
        Returns (CI.Primitive CI.Int))),
  "SSL_CTX_set_cipher_list" ->
  (fun x223 x225 ->
    let CI.CPointer x228 = x226 x225 in
    let CI.CPointer x224 = x223 in
    let x227 = x228 in async_ssl_stub_22_SSL_CTX_set_cipher_list x224 x227)
| Function
    (CI.Pointer _,
     Function
       (CI.Pointer _,
        Function (CI.Primitive CI.Uint, Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_set_session_id_context" ->
  (fun x229 x231 x233 ->
    let CI.CPointer x232 = x231 in
    let CI.CPointer x230 = x229 in
    async_ssl_stub_21_SSL_CTX_set_session_id_context x230 x232 x233)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)),
  "SSL_CTX_set_default_verify_paths" ->
  (fun x234 ->
    let CI.CPointer x235 = x234 in
    async_ssl_stub_20_SSL_CTX_set_default_verify_paths x235)
| Function
    (CI.Pointer _,
     Function
       (CI.View {CI.ty = CI.Pointer _; write = x239; _},
        Function
          (CI.View {CI.ty = CI.Pointer _; write = x243; _},
           Returns (CI.Primitive CI.Int)))),
  "SSL_CTX_load_verify_locations" ->
  (fun x236 x238 x242 ->
    let CI.CPointer x245 = x243 x242 in
    let CI.CPointer x241 = x239 x238 in
    let CI.CPointer x237 = x236 in
    let x240 = x241 in
    let x244 = x245 in
    async_ssl_stub_19_SSL_CTX_load_verify_locations x237 x240 x244)
| Function (CI.Pointer _, Function (CI.Primitive CI.Int, Returns CI.Void)),
  "SSL_CTX_set_security_level" ->
  (fun x246 x248 ->
    let CI.CPointer x247 = x246 in
    async_ssl_stub_18_SSL_CTX_set_security_level x247 x248)
| Function (CI.Pointer _, Returns CI.Void), "SSL_CTX_free" ->
  (fun x249 ->
    let CI.CPointer x250 = x249 in async_ssl_stub_17_SSL_CTX_free x250)
| Function
    (CI.Pointer _,
     Returns (CI.View {CI.ty = CI.Pointer x253; read = x254; _})),
  "SSL_CTX_new" ->
  (fun x251 ->
    let CI.CPointer x252 = x251 in
    x254 (CI.make_ptr x253 (async_ssl_stub_16_SSL_CTX_new x252)))
| Function (CI.Void, Returns CI.Void), "ENGINE_register_all_complete" ->
  async_ssl_stub_15_ENGINE_register_all_complete
| Function (CI.Void, Returns CI.Void), "ENGINE_load_builtin_engines" ->
  async_ssl_stub_14_ENGINE_load_builtin_engines
| Function (CI.Void, Returns CI.Void), "ERR_load_crypto_strings" ->
  async_ssl_stub_13_ERR_load_crypto_strings
| Function (CI.Void, Returns CI.Void), "SSL_load_error_strings" ->
  async_ssl_stub_12_SSL_load_error_strings
| Function (CI.Void, Returns (CI.Primitive CI.Ulong)), "SSL_library_init" ->
  async_ssl_stub_11_SSL_library_init
| Function (CI.View {CI.ty = CI.Pointer _; write = x261; _}, Returns CI.Void),
  "OPENSSL_config" ->
  (fun x260 ->
    let CI.CPointer x263 = x261 x260 in
    let x262 = x263 in async_ssl_stub_10_OPENSSL_config x262)
| Function (CI.Void, Returns CI.Void), "OpenSSL_add_ssl_algorithms" ->
  async_ssl_stub_9_OpenSSL_add_ssl_algorithms
| Function (CI.Void, Returns CI.Void), "OpenSSL_add_all_ciphers" ->
  async_ssl_stub_8_OpenSSL_add_all_ciphers
| Function (CI.Void, Returns CI.Void), "OpenSSL_add_all_digests" ->
  async_ssl_stub_7_OpenSSL_add_all_digests
| Function
    (CI.Primitive CI.Ulong,
     Function (CI.Pointer _, Function (CI.Primitive CI.Int, Returns CI.Void))),
  "ERR_error_string_n" ->
  (fun x267 x268 x270 ->
    let CI.CPointer x269 = x268 in
    async_ssl_stub_6_ERR_error_string_n x267 x269 x270)
| Function (CI.Void, Returns (CI.Primitive CI.Ulong)), "ERR_get_error" ->
  async_ssl_stub_5_ERR_get_error
| Function (CI.Void, Returns (CI.Pointer x273)), "TLSv1_2_method" ->
  (fun x272 -> CI.make_ptr x273 (async_ssl_stub_4_TLSv1_2_method x272))
| Function (CI.Void, Returns (CI.Pointer x275)), "TLSv1_1_method" ->
  (fun x274 -> CI.make_ptr x275 (async_ssl_stub_3_TLSv1_1_method x274))
| Function (CI.Void, Returns (CI.Pointer x277)), "TLSv1_method" ->
  (fun x276 -> CI.make_ptr x277 (async_ssl_stub_2_TLSv1_method x276))
| Function (CI.Void, Returns (CI.Pointer x279)), "TLS_method" ->
  (fun x278 -> CI.make_ptr x279 (async_ssl_stub_1_TLS_method x278))
| _, s ->  Printf.ksprintf failwith "No match for %s" s


let foreign_value : type a. string -> a Ctypes.typ -> a Ctypes.ptr =
  fun name t -> match t, name with
| _, s ->  Printf.ksprintf failwith "No match for %s" s

