open Lwt.Infix
type 'a io = 'a Lwt.t
let return = Lwt.return
let run t = Unix_os.Main.run t ; exit
0

let mirage_runtime_delay__key = Mirage_runtime.register_arg @@
# 32 "lib/devices/runtime_arg.ml"
  Mirage_runtime.delay
;;

let mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00__key = Mirage_runtime.register_arg @@
# 63 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.V4.network (Ipaddr.V4.Prefix.of_string_exn "0.0.0.0/0")
;;

let mirage_runtime_network_v6_network_none__key = Mirage_runtime.register_arg @@
# 80 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.V6.network None
;;

let mirage_runtime_network_ipv4_only___key = Mirage_runtime.register_arg @@
# 93 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.ipv4_only ()
;;

let mirage_runtime_network_ipv6_only___key = Mirage_runtime.register_arg @@
# 97 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.ipv6_only ()
;;

let mirage_runtime_network_dns_servers_none__key = Mirage_runtime.register_arg @@
# 109 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.dns_servers None
;;

let mirage_runtime_network_dns_timeout_none__key = Mirage_runtime.register_arg @@
# 115 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.dns_timeout None
;;

let mirage_runtime_network_dns_cache_size_none__key = Mirage_runtime.register_arg @@
# 119 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.dns_cache_size None
;;

let mirage_runtime_network_he_aaaa_timeout_none__key = Mirage_runtime.register_arg @@
# 123 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.he_aaaa_timeout None
;;

let mirage_runtime_network_he_connect_delay_none__key = Mirage_runtime.register_arg @@
# 127 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.he_connect_delay None
;;

let mirage_runtime_network_he_connect_timeout_none__key = Mirage_runtime.register_arg @@
# 131 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.he_connect_timeout None
;;

let mirage_runtime_network_he_resolve_timeout_none__key = Mirage_runtime.register_arg @@
# 135 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.he_resolve_timeout None
;;

let mirage_runtime_network_he_resolve_retries_none__key = Mirage_runtime.register_arg @@
# 139 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.he_resolve_retries None
;;

let mirage_runtime_network_he_timer_interval_none__key = Mirage_runtime.register_arg @@
# 143 "lib/devices/runtime_arg.ml"
  Mirage_runtime_network.he_timer_interval None
;;

let mirage_runtime_logs__key = Mirage_runtime.register_arg @@
# 199 "lib/devices/runtime_arg.ml"
  Mirage_runtime.logs
;;

let cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true___key = Mirage_runtime.register_arg @@
# 382 "lib/mirage.ml"
  Cmdliner_stdlib.setup ~backtrace:(Some true) ~randomize_hashtables:(Some true) ()
;;

let unikernel_pgx_setup__key = Mirage_runtime.register_arg @@
# 3 "unikernel/config.ml"
  Unikernel.pgx_setup
;;

let unikernel_port__key = Mirage_runtime.register_arg @@
# 36 "unikernel/config.ml"
  Unikernel.port
;;

# 98 "unikernel/mirage/main.ml"

module Tcpip_stack_direct_tcpv4v6__17 = Tcpip_stack_direct.TCPV4V6(Tcpip_stack_socket.V4V6)

# 102 "unikernel/mirage/main.ml"

module Paf_mirage_make__18 = Paf_mirage.Make(Tcpip_stack_direct_tcpv4v6__17)

# 106 "unikernel/mirage/main.ml"

module Happy_eyeballs_mirage_make__19 = Happy_eyeballs_mirage.Make(Tcpip_stack_socket.V4V6)

# 110 "unikernel/mirage/main.ml"

module Dns_client_mirage_make__20 = Dns_client_mirage.Make(Tcpip_stack_socket.V4V6)(Happy_eyeballs_mirage_make__19)

# 114 "unikernel/mirage/main.ml"

module Unikernel_make__21 = Unikernel.Make(Static____data_assets)(Static____data_tls_certificates)(Static____data_tls_keys)(Tcpip_stack_direct_tcpv4v6__17)(Paf_mirage_make__18)(Tcpip_stack_socket.V4V6)(Dns_client_mirage_make__20)

let mirage_bootvar__1 = lazy (
# 15 "lib/devices/argv.ml"
  return (Mirage_bootvar.argv ())
);;
# 122 "unikernel/mirage/main.ml"

let struct_end__2 = lazy (
  let __mirage_bootvar__1 = Lazy.force mirage_bootvar__1 in
  __mirage_bootvar__1 >>= fun _mirage_bootvar__1 ->
# 47 "lib/functoria/job.ml"
  return Mirage_runtime.(with_argv (runtime_args ()) "mte" _mirage_bootvar__1)
);;
# 130 "unikernel/mirage/main.ml"

let cmdliner_stdlib__3 = lazy (
  let _cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true_ = (cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true___key ()) in
  return (_cmdliner_stdlib_setup_backtracesome_true_randomize_hashtablessome_true_)
);;
# 136 "unikernel/mirage/main.ml"

let mirage_runtime__4 = lazy (
  let _mirage_runtime_delay = (mirage_runtime_delay__key ()) in
# 268 "lib/mirage.ml"
  Mirage_sleep.ns (Duration.of_sec _mirage_runtime_delay)
);;
# 143 "unikernel/mirage/main.ml"

let mirage_logs__5 = lazy (
  let _mirage_runtime_logs = (mirage_runtime_logs__key ()) in
# 20 "lib/devices/reporter.ml"
  let reporter = Mirage_logs.create () in
  Mirage_runtime.set_level ~default:(Some Logs.Info) _mirage_runtime_logs;
  Logs.set_reporter reporter;
  Lwt.return reporter
);;
# 153 "unikernel/mirage/main.ml"

let mirage_sleep__6 = lazy (
  return ()
);;
# 158 "unikernel/mirage/main.ml"

let mirage_ptime__7 = lazy (
  return ()
);;
# 163 "unikernel/mirage/main.ml"

let mirage_mtime__8 = lazy (
  return ()
);;
# 168 "unikernel/mirage/main.ml"

let mirage_crypto_rng_mirage__9 = lazy (
# 13 "lib/devices/random.ml"
  Mirage_crypto_rng_mirage.initialize (module Mirage_crypto_rng.Fortuna)
);;
# 174 "unikernel/mirage/main.ml"

let mirage_runtime__10 = lazy (
# 277 "lib/mirage.ml"
  Mirage_runtime.set_name "mte"; Lwt.return_unit
);;
# 180 "unikernel/mirage/main.ml"

let static____data_assets__11 = lazy (
# 23 "lib/devices/kv.ml"
  Static____data_assets.connect ()
);;
# 186 "unikernel/mirage/main.ml"

let static____data_tls_certificates__12 = lazy (
# 23 "lib/devices/kv.ml"
  Static____data_tls_certificates.connect ()
);;
# 192 "unikernel/mirage/main.ml"

let static____data_tls_keys__13 = lazy (
# 23 "lib/devices/kv.ml"
  Static____data_tls_keys.connect ()
);;
# 198 "unikernel/mirage/main.ml"

let udpv4v6_socket__14 = lazy (
  let _mirage_runtime_network_ipv4_only_ = (mirage_runtime_network_ipv4_only___key ()) in
  let _mirage_runtime_network_ipv6_only_ = (mirage_runtime_network_ipv6_only___key ()) in
  let _mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00 = (mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00__key ()) in
  let _mirage_runtime_network_v6_network_none = (mirage_runtime_network_v6_network_none__key ()) in
# 34 "lib/devices/udp.ml"
  Udpv4v6_socket.connect ~ipv4_only:_mirage_runtime_network_ipv4_only_ ~ipv6_only:_mirage_runtime_network_ipv6_only_ _mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00 _mirage_runtime_network_v6_network_none
);;
# 208 "unikernel/mirage/main.ml"

let tcpv4v6_socket__15 = lazy (
  let _mirage_runtime_network_ipv4_only_ = (mirage_runtime_network_ipv4_only___key ()) in
  let _mirage_runtime_network_ipv6_only_ = (mirage_runtime_network_ipv6_only___key ()) in
  let _mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00 = (mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00__key ()) in
  let _mirage_runtime_network_v6_network_none = (mirage_runtime_network_v6_network_none__key ()) in
# 34 "lib/devices/tcp.ml"
  Tcpv4v6_socket.connect ~ipv4_only:_mirage_runtime_network_ipv4_only_ ~ipv6_only:_mirage_runtime_network_ipv6_only_ _mirage_runtime_network_v4_network_ipaddr_v4_prefix_of_string_exn_0_0_0_00 _mirage_runtime_network_v6_network_none
);;
# 218 "unikernel/mirage/main.ml"

let tcpip_stack_socket_v4v6__16 = lazy (
  let __udpv4v6_socket__14 = Lazy.force udpv4v6_socket__14 in
  let __tcpv4v6_socket__15 = Lazy.force tcpv4v6_socket__15 in
  __udpv4v6_socket__14 >>= fun _udpv4v6_socket__14 ->
  __tcpv4v6_socket__15 >>= fun _tcpv4v6_socket__15 ->
# 89 "lib/devices/stack.ml"
  Tcpip_stack_socket.V4V6.connect _udpv4v6_socket__14 _tcpv4v6_socket__15
);;
# 228 "unikernel/mirage/main.ml"

let tcpip_stack_direct_tcpv4v6__17 = lazy (
  let __tcpip_stack_socket_v4v6__16 = Lazy.force tcpip_stack_socket_v4v6__16 in
  __tcpip_stack_socket_v4v6__16 >>= fun _tcpip_stack_socket_v4v6__16 ->
# 161 "lib/mirage.ml"
  Tcpip_stack_direct_tcpv4v6__17.connect _tcpip_stack_socket_v4v6__16
);;
# 236 "unikernel/mirage/main.ml"

let paf_mirage_make__18 = lazy (
  let __tcpip_stack_direct_tcpv4v6__17 = Lazy.force tcpip_stack_direct_tcpv4v6__17 in
  __tcpip_stack_direct_tcpv4v6__17 >>= fun _tcpip_stack_direct_tcpv4v6__17 ->
  let _unikernel_port = (unikernel_port__key ()) in
# 47 "lib/devices/http.ml"
  Paf_mirage_make__18.init ~port:_unikernel_port _tcpip_stack_direct_tcpv4v6__17
);;
# 245 "unikernel/mirage/main.ml"

let happy_eyeballs_mirage_make__19 = lazy (
  let __tcpip_stack_socket_v4v6__16 = Lazy.force tcpip_stack_socket_v4v6__16 in
  __tcpip_stack_socket_v4v6__16 >>= fun _tcpip_stack_socket_v4v6__16 ->
  let _mirage_runtime_network_he_aaaa_timeout_none = (mirage_runtime_network_he_aaaa_timeout_none__key ()) in
  let _mirage_runtime_network_he_connect_delay_none = (mirage_runtime_network_he_connect_delay_none__key ()) in
  let _mirage_runtime_network_he_connect_timeout_none = (mirage_runtime_network_he_connect_timeout_none__key ()) in
  let _mirage_runtime_network_he_resolve_timeout_none = (mirage_runtime_network_he_resolve_timeout_none__key ()) in
  let _mirage_runtime_network_he_resolve_retries_none = (mirage_runtime_network_he_resolve_retries_none__key ()) in
  let _mirage_runtime_network_he_timer_interval_none = (mirage_runtime_network_he_timer_interval_none__key ()) in
# 39 "lib/devices/happy_eyeballs.ml"
  Happy_eyeballs_mirage_make__19.connect_device ?aaaa_timeout:_mirage_runtime_network_he_aaaa_timeout_none ?connect_delay:_mirage_runtime_network_he_connect_delay_none
?connect_timeout:_mirage_runtime_network_he_connect_timeout_none ?resolve_timeout:_mirage_runtime_network_he_resolve_timeout_none ?resolve_retries:_mirage_runtime_network_he_resolve_retries_none ?timer_interval:_mirage_runtime_network_he_timer_interval_none _tcpip_stack_socket_v4v6__16
);;
# 260 "unikernel/mirage/main.ml"

let dns_client_mirage_make__20 = lazy (
  let __tcpip_stack_socket_v4v6__16 = Lazy.force tcpip_stack_socket_v4v6__16 in
  let __happy_eyeballs_mirage_make__19 = Lazy.force happy_eyeballs_mirage_make__19 in
  __tcpip_stack_socket_v4v6__16 >>= fun _tcpip_stack_socket_v4v6__16 ->
  __happy_eyeballs_mirage_make__19 >>= fun _happy_eyeballs_mirage_make__19 ->
  let _mirage_runtime_network_dns_servers_none = (mirage_runtime_network_dns_servers_none__key ()) in
  let _mirage_runtime_network_dns_timeout_none = (mirage_runtime_network_dns_timeout_none__key ()) in
  let _mirage_runtime_network_dns_cache_size_none = (mirage_runtime_network_dns_cache_size_none__key ()) in
# 15 "lib/devices/dns.ml"
  Dns_client_mirage_make__20.connect ?nameservers:_mirage_runtime_network_dns_servers_none ?timeout:_mirage_runtime_network_dns_timeout_none ?cache_size:_mirage_runtime_network_dns_cache_size_none
                                   (_tcpip_stack_socket_v4v6__16, _happy_eyeballs_mirage_make__19)
);;
# 274 "unikernel/mirage/main.ml"

let unikernel_make__21 = lazy (
  let __static____data_assets__11 = Lazy.force static____data_assets__11 in
  let __static____data_tls_certificates__12 = Lazy.force static____data_tls_certificates__12 in
  let __static____data_tls_keys__13 = Lazy.force static____data_tls_keys__13 in
  let __tcpip_stack_direct_tcpv4v6__17 = Lazy.force tcpip_stack_direct_tcpv4v6__17 in
  let __paf_mirage_make__18 = Lazy.force paf_mirage_make__18 in
  let __tcpip_stack_socket_v4v6__16 = Lazy.force tcpip_stack_socket_v4v6__16 in
  let __dns_client_mirage_make__20 = Lazy.force dns_client_mirage_make__20 in
  __static____data_assets__11 >>= fun _static____data_assets__11 ->
  __static____data_tls_certificates__12 >>= fun _static____data_tls_certificates__12 ->
  __static____data_tls_keys__13 >>= fun _static____data_tls_keys__13 ->
  __tcpip_stack_direct_tcpv4v6__17 >>= fun _tcpip_stack_direct_tcpv4v6__17 ->
  __paf_mirage_make__18 >>= fun _paf_mirage_make__18 ->
  __tcpip_stack_socket_v4v6__16 >>= fun _tcpip_stack_socket_v4v6__16 ->
  __dns_client_mirage_make__20 >>= fun _dns_client_mirage_make__20 ->
  let _unikernel_pgx_setup = (unikernel_pgx_setup__key ()) in
  (Unikernel_make__21.start _static____data_assets__11
_static____data_tls_certificates__12 _static____data_tls_keys__13
_tcpip_stack_direct_tcpv4v6__17 _paf_mirage_make__18
_tcpip_stack_socket_v4v6__16 _dns_client_mirage_make__20 _unikernel_pgx_setup
: unit io)
);;
# 298 "unikernel/mirage/main.ml"

let mirage_runtime__22 = lazy (
  let __struct_end__2 = Lazy.force struct_end__2 in
  let __cmdliner_stdlib__3 = Lazy.force cmdliner_stdlib__3 in
  let __mirage_runtime__4 = Lazy.force mirage_runtime__4 in
  let __mirage_logs__5 = Lazy.force mirage_logs__5 in
  let __mirage_sleep__6 = Lazy.force mirage_sleep__6 in
  let __mirage_ptime__7 = Lazy.force mirage_ptime__7 in
  let __mirage_mtime__8 = Lazy.force mirage_mtime__8 in
  let __mirage_crypto_rng_mirage__9 = Lazy.force mirage_crypto_rng_mirage__9 in
  let __mirage_runtime__10 = Lazy.force mirage_runtime__10 in
  let __unikernel_make__21 = Lazy.force unikernel_make__21 in
  __struct_end__2 >>= fun _struct_end__2 ->
  __cmdliner_stdlib__3 >>= fun _cmdliner_stdlib__3 ->
  __mirage_runtime__4 >>= fun _mirage_runtime__4 ->
  __mirage_logs__5 >>= fun _mirage_logs__5 ->
  __mirage_sleep__6 >>= fun _mirage_sleep__6 ->
  __mirage_ptime__7 >>= fun _mirage_ptime__7 ->
  __mirage_mtime__8 >>= fun _mirage_mtime__8 ->
  __mirage_crypto_rng_mirage__9 >>= fun _mirage_crypto_rng_mirage__9 ->
  __mirage_runtime__10 >>= fun _mirage_runtime__10 ->
  __unikernel_make__21 >>= fun _unikernel_make__21 ->
# 363 "lib/mirage.ml"
  return ()
);;
# 324 "unikernel/mirage/main.ml"

let () =
  let t = Lazy.force struct_end__2 >>= fun _ ->
  Lazy.force cmdliner_stdlib__3 >>= fun _ ->
  Lazy.force mirage_runtime__4 >>= fun _ ->
  Lazy.force mirage_logs__5 >>= fun _ ->
  Lazy.force mirage_sleep__6 >>= fun _ ->
  Lazy.force mirage_ptime__7 >>= fun _ ->
  Lazy.force mirage_mtime__8 >>= fun _ ->
  Lazy.force mirage_crypto_rng_mirage__9 >>= fun _ ->
  Lazy.force mirage_runtime__10 >>= fun _ ->
  Lazy.force mirage_runtime__22 in
  run t
;;
