1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/* automatically generated by rust-bindgen 0.69.2 */

pub const tb_MAXPATHLEN: u32 = 1024;
impl TB_return_values {
    pub const tb_DRAW: TB_return_values = TB_return_values(0);
}
impl TB_return_values {
    pub const tb_WMATE: TB_return_values = TB_return_values(1);
}
impl TB_return_values {
    pub const tb_BMATE: TB_return_values = TB_return_values(2);
}
impl TB_return_values {
    pub const tb_FORBID: TB_return_values = TB_return_values(3);
}
impl TB_return_values {
    pub const tb_UNKNOWN: TB_return_values = TB_return_values(7);
}
impl ::std::ops::BitOr<TB_return_values> for TB_return_values {
    type Output = Self;
    #[inline]
    fn bitor(self, other: Self) -> Self {
        TB_return_values(self.0 | other.0)
    }
}
impl ::std::ops::BitOrAssign for TB_return_values {
    #[inline]
    fn bitor_assign(&mut self, rhs: TB_return_values) {
        self.0 |= rhs.0;
    }
}
impl ::std::ops::BitAnd<TB_return_values> for TB_return_values {
    type Output = Self;
    #[inline]
    fn bitand(self, other: Self) -> Self {
        TB_return_values(self.0 & other.0)
    }
}
impl ::std::ops::BitAndAssign for TB_return_values {
    #[inline]
    fn bitand_assign(&mut self, rhs: TB_return_values) {
        self.0 &= rhs.0;
    }
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TB_return_values(pub ::std::os::raw::c_uint);
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum TB_pieces {
    tb_NOPIECE = 0,
    tb_PAWN = 1,
    tb_KNIGHT = 2,
    tb_BISHOP = 3,
    tb_ROOK = 4,
    tb_QUEEN = 5,
    tb_KING = 6,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum TB_sides {
    tb_WHITE_TO_MOVE = 0,
    tb_BLACK_TO_MOVE = 1,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum TB_squares {
    tb_A1 = 0,
    tb_B1 = 1,
    tb_C1 = 2,
    tb_D1 = 3,
    tb_E1 = 4,
    tb_F1 = 5,
    tb_G1 = 6,
    tb_H1 = 7,
    tb_A2 = 8,
    tb_B2 = 9,
    tb_C2 = 10,
    tb_D2 = 11,
    tb_E2 = 12,
    tb_F2 = 13,
    tb_G2 = 14,
    tb_H2 = 15,
    tb_A3 = 16,
    tb_B3 = 17,
    tb_C3 = 18,
    tb_D3 = 19,
    tb_E3 = 20,
    tb_F3 = 21,
    tb_G3 = 22,
    tb_H3 = 23,
    tb_A4 = 24,
    tb_B4 = 25,
    tb_C4 = 26,
    tb_D4 = 27,
    tb_E4 = 28,
    tb_F4 = 29,
    tb_G4 = 30,
    tb_H4 = 31,
    tb_A5 = 32,
    tb_B5 = 33,
    tb_C5 = 34,
    tb_D5 = 35,
    tb_E5 = 36,
    tb_F5 = 37,
    tb_G5 = 38,
    tb_H5 = 39,
    tb_A6 = 40,
    tb_B6 = 41,
    tb_C6 = 42,
    tb_D6 = 43,
    tb_E6 = 44,
    tb_F6 = 45,
    tb_G6 = 46,
    tb_H6 = 47,
    tb_A7 = 48,
    tb_B7 = 49,
    tb_C7 = 50,
    tb_D7 = 51,
    tb_E7 = 52,
    tb_F7 = 53,
    tb_G7 = 54,
    tb_H7 = 55,
    tb_A8 = 56,
    tb_B8 = 57,
    tb_C8 = 58,
    tb_D8 = 59,
    tb_E8 = 60,
    tb_F8 = 61,
    tb_G8 = 62,
    tb_H8 = 63,
    tb_NOSQUARE = 64,
}
impl TB_castling {
    pub const tb_NOCASTLE: TB_castling = TB_castling(0);
}
impl TB_castling {
    pub const tb_WOO: TB_castling = TB_castling(8);
}
impl TB_castling {
    pub const tb_WOOO: TB_castling = TB_castling(4);
}
impl TB_castling {
    pub const tb_BOO: TB_castling = TB_castling(2);
}
impl TB_castling {
    pub const tb_BOOO: TB_castling = TB_castling(1);
}
impl ::std::ops::BitOr<TB_castling> for TB_castling {
    type Output = Self;
    #[inline]
    fn bitor(self, other: Self) -> Self {
        TB_castling(self.0 | other.0)
    }
}
impl ::std::ops::BitOrAssign for TB_castling {
    #[inline]
    fn bitor_assign(&mut self, rhs: TB_castling) {
        self.0 |= rhs.0;
    }
}
impl ::std::ops::BitAnd<TB_castling> for TB_castling {
    type Output = Self;
    #[inline]
    fn bitand(self, other: Self) -> Self {
        TB_castling(self.0 & other.0)
    }
}
impl ::std::ops::BitAndAssign for TB_castling {
    #[inline]
    fn bitand_assign(&mut self, rhs: TB_castling) {
        self.0 &= rhs.0;
    }
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TB_castling(pub ::std::os::raw::c_uint);
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum TB_compression_scheme {
    tb_UNCOMPRESSED = 0,
    tb_CP1 = 1,
    tb_CP2 = 2,
    tb_CP3 = 3,
    tb_CP4 = 4,
}
extern "C" {
    pub fn tb_init(
        verbosity: ::std::os::raw::c_int,
        compression_scheme: ::std::os::raw::c_int,
        paths: *mut *const ::std::os::raw::c_char,
    ) -> *mut ::std::os::raw::c_char;
}
extern "C" {
    pub fn tb_restart(
        verbosity: ::std::os::raw::c_int,
        compression_scheme: ::std::os::raw::c_int,
        paths: *mut *const ::std::os::raw::c_char,
    ) -> *mut ::std::os::raw::c_char;
}
extern "C" {
    pub fn tb_done();
}
extern "C" {
    pub fn tb_probe_hard(
        stm: ::std::os::raw::c_uint,
        epsq: ::std::os::raw::c_uint,
        castles: ::std::os::raw::c_uint,
        inp_wSQ: *const ::std::os::raw::c_uint,
        inp_bSQ: *const ::std::os::raw::c_uint,
        inp_wPC: *const ::std::os::raw::c_uchar,
        inp_bPC: *const ::std::os::raw::c_uchar,
        tbinfo: *mut ::std::os::raw::c_uint,
        plies: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tb_probe_soft(
        stm: ::std::os::raw::c_uint,
        epsq: ::std::os::raw::c_uint,
        castles: ::std::os::raw::c_uint,
        inp_wSQ: *const ::std::os::raw::c_uint,
        inp_bSQ: *const ::std::os::raw::c_uint,
        inp_wPC: *const ::std::os::raw::c_uchar,
        inp_bPC: *const ::std::os::raw::c_uchar,
        tbinfo: *mut ::std::os::raw::c_uint,
        plies: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tb_probe_WDL_hard(
        stm: ::std::os::raw::c_uint,
        epsq: ::std::os::raw::c_uint,
        castles: ::std::os::raw::c_uint,
        inp_wSQ: *const ::std::os::raw::c_uint,
        inp_bSQ: *const ::std::os::raw::c_uint,
        inp_wPC: *const ::std::os::raw::c_uchar,
        inp_bPC: *const ::std::os::raw::c_uchar,
        tbinfo: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tb_probe_WDL_soft(
        stm: ::std::os::raw::c_uint,
        epsq: ::std::os::raw::c_uint,
        castles: ::std::os::raw::c_uint,
        inp_wSQ: *const ::std::os::raw::c_uint,
        inp_bSQ: *const ::std::os::raw::c_uint,
        inp_wPC: *const ::std::os::raw::c_uchar,
        inp_bPC: *const ::std::os::raw::c_uchar,
        tbinfo: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tb_is_initialized() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tb_availability() -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn tb_indexmemory() -> usize;
}
extern "C" {
    pub fn tbcache_init(
        cache_mem: usize,
        wdl_fraction: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tbcache_restart(
        cache_mem: usize,
        wdl_fraction: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tbcache_done();
}
extern "C" {
    pub fn tbcache_is_on() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn tbcache_flush();
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TB_STATS {
    pub wdl_easy_hits: [::std::os::raw::c_ulong; 2usize],
    pub wdl_hard_prob: [::std::os::raw::c_ulong; 2usize],
    pub wdl_soft_prob: [::std::os::raw::c_ulong; 2usize],
    pub wdl_cachesize: usize,
    pub wdl_occupancy: f64,
    pub dtm_easy_hits: [::std::os::raw::c_ulong; 2usize],
    pub dtm_hard_prob: [::std::os::raw::c_ulong; 2usize],
    pub dtm_soft_prob: [::std::os::raw::c_ulong; 2usize],
    pub dtm_cachesize: usize,
    pub dtm_occupancy: f64,
    pub total_hits: [::std::os::raw::c_ulong; 2usize],
    pub memory_hits: [::std::os::raw::c_ulong; 2usize],
    pub drive_hits: [::std::os::raw::c_ulong; 2usize],
    pub drive_miss: [::std::os::raw::c_ulong; 2usize],
    pub bytes_read: [::std::os::raw::c_ulong; 2usize],
    pub files_opened: ::std::os::raw::c_ulong,
    pub memory_efficiency: f64,
}
extern "C" {
    pub fn tbstats_reset();
}
extern "C" {
    pub fn tbstats_get(stats: *mut TB_STATS);
}
extern "C" {
    pub fn tbpaths_init() -> *mut *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn tbpaths_add(
        ps: *mut *const ::std::os::raw::c_char,
        newpath: *const ::std::os::raw::c_char,
    ) -> *mut *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn tbpaths_done(
        ps: *mut *const ::std::os::raw::c_char,
    ) -> *mut *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn tbpaths_getmain() -> *const ::std::os::raw::c_char;
}