/*
  Copyright (c) INRIA and Microsoft Corporation. All rights reserved.
  Licensed under the Apache 2.0 License.

  This file was generated by KreMLin <https://github.com/FStarLang/kremlin>
  KreMLin invocation: ../krml -fparentheses -fcurly-braces -fno-shadow -header copyright-header.txt -minimal -skip-compilation -extract-uints -tmpdir dist/minimal -bundle FStar.UInt64+FStar.UInt32+FStar.UInt16+FStar.UInt8=[rename=FStar_UInt_8_16_32_64] -library FStar.UInt128 -add-include <inttypes.h> -add-include <stdbool.h> -add-include "kremlin/internal/compat.h" -add-include "kremlin/lowstar_endianness.h" -add-include "kremlin/internal/types.h" -add-include "kremlin/internal/target.h" -bundle LowStar.Endianness= -bundle FStar.UInt128= -bundle *,WindowsWorkaroundSigh fstar_uint128.c -o libkremlib.a .extract/prims.krml .extract/FStar_Pervasives_Native.krml .extract/FStar_Pervasives.krml .extract/FStar_Preorder.krml .extract/FStar_Calc.krml .extract/FStar_Squash.krml .extract/FStar_Classical.krml .extract/FStar_StrongExcludedMiddle.krml .extract/FStar_FunctionalExtensionality.krml .extract/FStar_List_Tot_Base.krml .extract/FStar_List_Tot_Properties.krml .extract/FStar_List_Tot.krml .extract/FStar_Seq_Base.krml .extract/FStar_Seq_Properties.krml .extract/FStar_Seq.krml .extract/FStar_Mul.krml .extract/FStar_Math_Lib.krml .extract/FStar_Math_Lemmas.krml .extract/FStar_BitVector.krml .extract/FStar_UInt.krml .extract/FStar_UInt32.krml .extract/FStar_Int.krml .extract/FStar_Int16.krml .extract/FStar_Reflection_Types.krml .extract/FStar_Reflection_Data.krml .extract/FStar_Order.krml .extract/FStar_Reflection_Basic.krml .extract/FStar_Ghost.krml .extract/FStar_ErasedLogic.krml .extract/FStar_UInt64.krml .extract/FStar_UInt8.krml .extract/FStar_Endianness.krml .extract/FStar_Set.krml .extract/FStar_PropositionalExtensionality.krml .extract/FStar_PredicateExtensionality.krml .extract/FStar_TSet.krml .extract/FStar_Monotonic_Heap.krml .extract/FStar_Heap.krml .extract/FStar_Map.krml .extract/FStar_Monotonic_HyperHeap.krml .extract/FStar_Monotonic_HyperStack.krml .extract/FStar_HyperStack.krml .extract/FStar_Monotonic_Witnessed.krml .extract/FStar_HyperStack_ST.krml .extract/FStar_HyperStack_All.krml .extract/FStar_Char.krml .extract/FStar_Exn.krml .extract/FStar_ST.krml .extract/FStar_All.krml .extract/FStar_List.krml .extract/FStar_String.krml .extract/FStar_Reflection_Const.krml .extract/FStar_Reflection_Derived.krml .extract/FStar_Reflection_Derived_Lemmas.krml .extract/FStar_Date.krml .extract/FStar_Universe.krml .extract/FStar_GSet.krml .extract/FStar_ModifiesGen.krml .extract/FStar_Range.krml .extract/FStar_Tactics_Types.krml .extract/FStar_Tactics_Result.krml .extract/FStar_Tactics_Effect.krml .extract/FStar_Tactics_Builtins.krml .extract/FStar_Reflection.krml .extract/FStar_Tactics_SyntaxHelpers.krml .extract/FStar_Tactics_Util.krml .extract/FStar_Reflection_Formula.krml .extract/FStar_Tactics_Derived.krml .extract/FStar_Tactics_Logic.krml .extract/FStar_Tactics.krml .extract/FStar_BigOps.krml .extract/LowStar_Monotonic_Buffer.krml .extract/LowStar_Buffer.krml .extract/Spec_Loops.krml .extract/LowStar_BufferOps.krml .extract/C_Loops.krml .extract/FStar_Kremlin_Endianness.krml .extract/FStar_UInt63.krml .extract/FStar_Dyn.krml .extract/FStar_Int63.krml .extract/FStar_Int64.krml .extract/FStar_Int32.krml .extract/FStar_Int8.krml .extract/FStar_UInt16.krml .extract/FStar_Int_Cast.krml .extract/FStar_UInt128.krml .extract/C_Endianness.krml .extract/WasmSupport.krml .extract/FStar_Float.krml .extract/FStar_IO.krml .extract/C.krml .extract/LowStar_Modifies.krml .extract/C_String.krml .extract/FStar_Bytes.krml .extract/FStar_HyperStack_IO.krml .extract/LowStar_Printf.krml .extract/LowStar_Endianness.krml .extract/C_Failure.krml .extract/TestLib.krml .extract/FStar_Int_Cast_Full.krml
  F* version: b0467796
  KreMLin version: ab4c97c6
*/

#include <inttypes.h>
#include <stdbool.h>
#include "kremlin/internal/compat.h"
#include "kremlin/lowstar_endianness.h"
#include "kremlin/internal/types.h"
#include "kremlin/internal/target.h"

#ifndef __FStar_UInt_8_16_32_64_H
#define __FStar_UInt_8_16_32_64_H

extern Prims_int FStar_UInt64_n;

extern Prims_int FStar_UInt64_v(uint64_t x);

extern uint64_t FStar_UInt64_uint_to_t(Prims_int x);

extern uint64_t FStar_UInt64_minus(uint64_t a);

extern uint32_t FStar_UInt64_n_minus_one;

inline static uint64_t
FStar_UInt64_eq_mask(uint64_t a, uint64_t b)
{
    uint64_t x = a ^ b;
    uint64_t minus_x = ~x + (uint64_t)1U;
    uint64_t x_or_minus_x = x | minus_x;
    uint64_t xnx = x_or_minus_x >> (uint32_t)63U;
    return xnx - (uint64_t)1U;
}

inline static uint64_t
FStar_UInt64_gte_mask(uint64_t a, uint64_t b)
{
    uint64_t x = a;
    uint64_t y = b;
    uint64_t x_xor_y = x ^ y;
    uint64_t x_sub_y = x - y;
    uint64_t x_sub_y_xor_y = x_sub_y ^ y;
    uint64_t q = x_xor_y | x_sub_y_xor_y;
    uint64_t x_xor_q = x ^ q;
    uint64_t x_xor_q_ = x_xor_q >> (uint32_t)63U;
    return x_xor_q_ - (uint64_t)1U;
}

extern Prims_string FStar_UInt64_to_string(uint64_t uu____716);

extern uint64_t FStar_UInt64_of_string(Prims_string uu____728);

extern Prims_int FStar_UInt32_n;

extern Prims_int FStar_UInt32_v(uint32_t x);

extern uint32_t FStar_UInt32_uint_to_t(Prims_int x);

extern uint32_t FStar_UInt32_minus(uint32_t a);

extern uint32_t FStar_UInt32_n_minus_one;

inline static uint32_t
FStar_UInt32_eq_mask(uint32_t a, uint32_t b)
{
    uint32_t x = a ^ b;
    uint32_t minus_x = ~x + (uint32_t)1U;
    uint32_t x_or_minus_x = x | minus_x;
    uint32_t xnx = x_or_minus_x >> (uint32_t)31U;
    return xnx - (uint32_t)1U;
}

inline static uint32_t
FStar_UInt32_gte_mask(uint32_t a, uint32_t b)
{
    uint32_t x = a;
    uint32_t y = b;
    uint32_t x_xor_y = x ^ y;
    uint32_t x_sub_y = x - y;
    uint32_t x_sub_y_xor_y = x_sub_y ^ y;
    uint32_t q = x_xor_y | x_sub_y_xor_y;
    uint32_t x_xor_q = x ^ q;
    uint32_t x_xor_q_ = x_xor_q >> (uint32_t)31U;
    return x_xor_q_ - (uint32_t)1U;
}

extern Prims_string FStar_UInt32_to_string(uint32_t uu____716);

extern uint32_t FStar_UInt32_of_string(Prims_string uu____728);

extern Prims_int FStar_UInt16_n;

extern Prims_int FStar_UInt16_v(uint16_t x);

extern uint16_t FStar_UInt16_uint_to_t(Prims_int x);

extern uint16_t FStar_UInt16_minus(uint16_t a);

extern uint32_t FStar_UInt16_n_minus_one;

inline static uint16_t
FStar_UInt16_eq_mask(uint16_t a, uint16_t b)
{
    uint16_t x = a ^ b;
    uint16_t minus_x = ~x + (uint16_t)1U;
    uint16_t x_or_minus_x = x | minus_x;
    uint16_t xnx = x_or_minus_x >> (uint32_t)15U;
    return xnx - (uint16_t)1U;
}

inline static uint16_t
FStar_UInt16_gte_mask(uint16_t a, uint16_t b)
{
    uint16_t x = a;
    uint16_t y = b;
    uint16_t x_xor_y = x ^ y;
    uint16_t x_sub_y = x - y;
    uint16_t x_sub_y_xor_y = x_sub_y ^ y;
    uint16_t q = x_xor_y | x_sub_y_xor_y;
    uint16_t x_xor_q = x ^ q;
    uint16_t x_xor_q_ = x_xor_q >> (uint32_t)15U;
    return x_xor_q_ - (uint16_t)1U;
}

extern Prims_string FStar_UInt16_to_string(uint16_t uu____716);

extern uint16_t FStar_UInt16_of_string(Prims_string uu____728);

extern Prims_int FStar_UInt8_n;

extern Prims_int FStar_UInt8_v(uint8_t x);

extern uint8_t FStar_UInt8_uint_to_t(Prims_int x);

extern uint8_t FStar_UInt8_minus(uint8_t a);

extern uint32_t FStar_UInt8_n_minus_one;

inline static uint8_t
FStar_UInt8_eq_mask(uint8_t a, uint8_t b)
{
    uint8_t x = a ^ b;
    uint8_t minus_x = ~x + (uint8_t)1U;
    uint8_t x_or_minus_x = x | minus_x;
    uint8_t xnx = x_or_minus_x >> (uint32_t)7U;
    return xnx - (uint8_t)1U;
}

inline static uint8_t
FStar_UInt8_gte_mask(uint8_t a, uint8_t b)
{
    uint8_t x = a;
    uint8_t y = b;
    uint8_t x_xor_y = x ^ y;
    uint8_t x_sub_y = x - y;
    uint8_t x_sub_y_xor_y = x_sub_y ^ y;
    uint8_t q = x_xor_y | x_sub_y_xor_y;
    uint8_t x_xor_q = x ^ q;
    uint8_t x_xor_q_ = x_xor_q >> (uint32_t)7U;
    return x_xor_q_ - (uint8_t)1U;
}

extern Prims_string FStar_UInt8_to_string(uint8_t uu____716);

extern uint8_t FStar_UInt8_of_string(Prims_string uu____728);

typedef uint8_t FStar_UInt8_byte;

#define __FStar_UInt_8_16_32_64_H_DEFINED
#endif
