iced_x86/
instruction_create.rs

1// SPDX-License-Identifier: MIT
2// Copyright (C) 2018-present iced project and contributors
3
4mod private {
5	use crate::{Code, IcedError, Instruction};
6
7	pub trait With1<T> {
8		fn with1(code: Code, op0: T) -> Result<Instruction, IcedError>;
9	}
10
11	pub trait With2<T, U> {
12		fn with2(code: Code, op0: T, op1: U) -> Result<Instruction, IcedError>;
13	}
14
15	pub trait With3<T, U, V> {
16		fn with3(code: Code, op0: T, op1: U, op2: V) -> Result<Instruction, IcedError>;
17	}
18
19	pub trait With4<T, U, V, W> {
20		fn with4(code: Code, op0: T, op1: U, op2: V, op3: W) -> Result<Instruction, IcedError>;
21	}
22
23	pub trait With5<T, U, V, W, X> {
24		fn with5(code: Code, op0: T, op1: U, op2: V, op3: W, op4: X) -> Result<Instruction, IcedError>;
25	}
26}
27
28use self::private::{With1, With2, With3, With4, With5};
29use crate::instruction_internal;
30use crate::{Code, IcedError, Instruction, MemoryOperand, OpKind, Register, RepPrefixKind};
31use core::{u16, u32, u64};
32
33impl Instruction {
34	fn init_memory_operand(instruction: &mut Instruction, memory: &MemoryOperand) {
35		instruction.set_memory_base(memory.base);
36		instruction.set_memory_index(memory.index);
37		instruction.set_memory_index_scale(memory.scale);
38		instruction.set_memory_displ_size(memory.displ_size);
39		instruction.set_memory_displacement64(memory.displacement as u64);
40		instruction.set_is_broadcast(memory.is_broadcast);
41		instruction.set_segment_prefix(memory.segment_prefix);
42	}
43
44	/// Creates an instruction with no operands
45	///
46	/// # Arguments
47	///
48	/// * `code`: Code value
49	#[must_use]
50	#[inline]
51	#[rustfmt::skip]
52	pub fn with(code: Code) -> Self {
53		let mut instruction = Self::default();
54		instruction.set_code(code);
55
56		debug_assert_eq!(instruction.op_count(), 0);
57		instruction
58	}
59
60	/// Creates an instruction with 1 operand
61	///
62	/// # Errors
63	///
64	/// Fails if one of the operands is invalid (basic checks)
65	///
66	/// # Arguments
67	///
68	/// * `code`: Code value
69	/// * `op0`: First operand (eg. a [`Register`], an integer (a `u32`/`i64`/`u64` number suffix is sometimes needed), or a [`MemoryOperand`])
70	///
71	/// [`Register`]: enum.Register.html
72	/// [`MemoryOperand`]: struct.MemoryOperand.html
73	///
74	/// # Examples
75	///
76	/// ```
77	/// use iced_x86::*;
78	///
79	/// # fn main() -> Result<(), IcedError> {
80	/// let _ = Instruction::with1(Code::Pop_rm64, Register::RCX)?;
81	/// let _ = Instruction::with1(Code::Pop_rm64, MemoryOperand::new(Register::RBP, Register::RSI, 2, -0x5432_10FF, 8, false, Register::FS))?;
82	/// # Ok(())
83	/// # }
84	/// ```
85	#[inline]
86	pub fn with1<T>(code: Code, op0: T) -> Result<Instruction, IcedError>
87	where
88		Self: With1<T>,
89	{
90		<Self as With1<T>>::with1(code, op0)
91	}
92
93	/// Creates an instruction with 2 operands
94	///
95	/// # Errors
96	///
97	/// Fails if one of the operands is invalid (basic checks)
98	///
99	/// # Arguments
100	///
101	/// * `code`: Code value
102	/// * `op0`: First operand (eg. a [`Register`], an integer (a `u32`/`i64`/`u64` number suffix is sometimes needed), or a [`MemoryOperand`])
103	/// * `op1`: Second operand
104	///
105	/// [`Register`]: enum.Register.html
106	/// [`MemoryOperand`]: struct.MemoryOperand.html
107	///
108	/// # Examples
109	///
110	/// ```
111	/// use iced_x86::*;
112	///
113	/// # fn main() -> Result<(), IcedError> {
114	/// let _ = Instruction::with2(Code::Add_rm8_r8, Register::CL, Register::DL)?;
115	/// let _ = Instruction::with2(Code::Add_r8_rm8, Register::CL, MemoryOperand::new(Register::RBP, Register::RSI, 2, -0x5432_10FF, 8, false, Register::FS))?;
116	/// # Ok(())
117	/// # }
118	/// ```
119	#[inline]
120	pub fn with2<T, U>(code: Code, op0: T, op1: U) -> Result<Instruction, IcedError>
121	where
122		Self: With2<T, U>,
123	{
124		<Self as With2<T, U>>::with2(code, op0, op1)
125	}
126
127	/// Creates an instruction with 3 operands
128	///
129	/// # Errors
130	///
131	/// Fails if one of the operands is invalid (basic checks)
132	///
133	/// # Arguments
134	///
135	/// * `code`: Code value
136	/// * `op0`: First operand (eg. a [`Register`], an integer (a `u32`/`i64`/`u64` number suffix is sometimes needed), or a [`MemoryOperand`])
137	/// * `op1`: Second operand
138	/// * `op2`: Third operand
139	///
140	/// [`Register`]: enum.Register.html
141	/// [`MemoryOperand`]: struct.MemoryOperand.html
142	///
143	/// # Examples
144	///
145	/// ```
146	/// use iced_x86::*;
147	///
148	/// # fn main() -> Result<(), IcedError> {
149	/// let _ = Instruction::with3(Code::Imul_r16_rm16_imm16, Register::CX, Register::DX, 0x5AA5)?;
150	/// let _ = Instruction::with3(Code::Imul_r16_rm16_imm16, Register::CX, MemoryOperand::new(Register::RBP, Register::RSI, 2, -0x5432_10FF, 8, false, Register::FS), 0xA55A)?;
151	/// # Ok(())
152	/// # }
153	/// ```
154	#[inline]
155	pub fn with3<T, U, V>(code: Code, op0: T, op1: U, op2: V) -> Result<Instruction, IcedError>
156	where
157		Self: With3<T, U, V>,
158	{
159		<Self as With3<T, U, V>>::with3(code, op0, op1, op2)
160	}
161
162	/// Creates an instruction with 4 operands
163	///
164	/// # Errors
165	///
166	/// Fails if one of the operands is invalid (basic checks)
167	///
168	/// # Arguments
169	///
170	/// * `code`: Code value
171	/// * `op0`: First operand (eg. a [`Register`], an integer (a `u32`/`i64`/`u64` number suffix is sometimes needed), or a [`MemoryOperand`])
172	/// * `op1`: Second operand
173	/// * `op2`: Third operand
174	/// * `op3`: Fourth operand
175	///
176	/// [`Register`]: enum.Register.html
177	/// [`MemoryOperand`]: struct.MemoryOperand.html
178	///
179	/// # Examples
180	///
181	/// ```
182	/// use iced_x86::*;
183	///
184	/// # fn main() -> Result<(), IcedError> {
185	/// let _ = Instruction::with4(Code::Insertq_xmm_xmm_imm8_imm8, Register::XMM1, Register::XMM2, 0xA5, 0xFD)?;
186	/// let _ = Instruction::with4(Code::VEX_Vfmaddsubps_xmm_xmm_xmm_xmmm128, Register::XMM1, Register::XMM2, Register::XMM3, MemoryOperand::new(Register::RBP, Register::RSI, 2, -0x5432_10FF, 8, false, Register::FS))?;
187	/// # Ok(())
188	/// # }
189	/// ```
190	#[inline]
191	pub fn with4<T, U, V, W>(code: Code, op0: T, op1: U, op2: V, op3: W) -> Result<Instruction, IcedError>
192	where
193		Self: With4<T, U, V, W>,
194	{
195		<Self as With4<T, U, V, W>>::with4(code, op0, op1, op2, op3)
196	}
197
198	/// Creates an instruction with 5 operands
199	///
200	/// # Errors
201	///
202	/// Fails if one of the operands is invalid (basic checks)
203	///
204	/// # Arguments
205	///
206	/// * `code`: Code value
207	/// * `op0`: First operand (eg. a [`Register`], an integer (a `u32`/`i64`/`u64` number suffix is sometimes needed), or a [`MemoryOperand`])
208	/// * `op1`: Second operand
209	/// * `op2`: Third operand
210	/// * `op3`: Fourth operand
211	/// * `op4`: Fifth operand
212	///
213	/// [`Register`]: enum.Register.html
214	/// [`MemoryOperand`]: struct.MemoryOperand.html
215	///
216	/// # Examples
217	///
218	/// ```
219	/// use iced_x86::*;
220	///
221	/// # fn main() -> Result<(), IcedError> {
222	/// let _ = Instruction::with5(Code::VEX_Vpermil2ps_xmm_xmm_xmmm128_xmm_imm4, Register::XMM1, Register::XMM2, Register::XMM3, Register::XMM4, 0x0)?;
223	/// let _ = Instruction::with5(Code::VEX_Vpermil2ps_xmm_xmm_xmm_xmmm128_imm4, Register::XMM1, Register::XMM2, Register::XMM3, MemoryOperand::new(Register::RBP, Register::RSI, 2, -0x5432_10FF, 8, false, Register::FS), 0x1)?;
224	/// # Ok(())
225	/// # }
226	/// ```
227	#[inline]
228	pub fn with5<T, U, V, W, X>(code: Code, op0: T, op1: U, op2: V, op3: W, op4: X) -> Result<Instruction, IcedError>
229	where
230		Self: With5<T, U, V, W, X>,
231	{
232		<Self as With5<T, U, V, W, X>>::with5(code, op0, op1, op2, op3, op4)
233	}
234}
235
236// GENERATOR-BEGIN: Create
237// ⚠️This was generated by GENERATOR!🦹‍♂️
238
239impl With1<Register> for Instruction {
240	#[allow(clippy::missing_inline_in_public_items)]
241	#[rustfmt::skip]
242	fn with1(code: Code, register: Register) -> Result<Self, IcedError> {
243		let mut instruction = Self::default();
244		instruction.set_code(code);
245
246		const _: () = assert!(OpKind::Register as u32 == 0);
247		//instruction.set_op0_kind(OpKind::Register);
248		instruction.set_op0_register(register);
249
250		debug_assert_eq!(instruction.op_count(), 1);
251		Ok(instruction)
252	}
253}
254
255impl With1<i32> for Instruction {
256	#[allow(clippy::missing_inline_in_public_items)]
257	#[rustfmt::skip]
258	fn with1(code: Code, immediate: i32) -> Result<Self, IcedError> {
259		let mut instruction = Self::default();
260		instruction.set_code(code);
261
262		instruction_internal::initialize_signed_immediate(&mut instruction, 0, immediate as i64)?;
263
264		debug_assert_eq!(instruction.op_count(), 1);
265		Ok(instruction)
266	}
267}
268
269impl With1<u32> for Instruction {
270	#[allow(clippy::missing_inline_in_public_items)]
271	#[rustfmt::skip]
272	fn with1(code: Code, immediate: u32) -> Result<Self, IcedError> {
273		let mut instruction = Self::default();
274		instruction.set_code(code);
275
276		instruction_internal::initialize_unsigned_immediate(&mut instruction, 0, immediate as u64)?;
277
278		debug_assert_eq!(instruction.op_count(), 1);
279		Ok(instruction)
280	}
281}
282
283impl With1<MemoryOperand> for Instruction {
284	#[allow(clippy::missing_inline_in_public_items)]
285	#[rustfmt::skip]
286	fn with1(code: Code, memory: MemoryOperand) -> Result<Self, IcedError> {
287		let mut instruction = Self::default();
288		instruction.set_code(code);
289
290		instruction.set_op0_kind(OpKind::Memory);
291		Instruction::init_memory_operand(&mut instruction, &memory);
292
293		debug_assert_eq!(instruction.op_count(), 1);
294		Ok(instruction)
295	}
296}
297
298impl With2<Register, Register> for Instruction {
299	#[allow(clippy::missing_inline_in_public_items)]
300	#[rustfmt::skip]
301	fn with2(code: Code, register1: Register, register2: Register) -> Result<Self, IcedError> {
302		let mut instruction = Self::default();
303		instruction.set_code(code);
304
305		const _: () = assert!(OpKind::Register as u32 == 0);
306		//instruction.set_op0_kind(OpKind::Register);
307		instruction.set_op0_register(register1);
308
309		const _: () = assert!(OpKind::Register as u32 == 0);
310		//instruction.set_op1_kind(OpKind::Register);
311		instruction.set_op1_register(register2);
312
313		debug_assert_eq!(instruction.op_count(), 2);
314		Ok(instruction)
315	}
316}
317
318impl With2<Register, i32> for Instruction {
319	#[allow(clippy::missing_inline_in_public_items)]
320	#[rustfmt::skip]
321	fn with2(code: Code, register: Register, immediate: i32) -> Result<Self, IcedError> {
322		let mut instruction = Self::default();
323		instruction.set_code(code);
324
325		const _: () = assert!(OpKind::Register as u32 == 0);
326		//instruction.set_op0_kind(OpKind::Register);
327		instruction.set_op0_register(register);
328
329		instruction_internal::initialize_signed_immediate(&mut instruction, 1, immediate as i64)?;
330
331		debug_assert_eq!(instruction.op_count(), 2);
332		Ok(instruction)
333	}
334}
335
336impl With2<Register, u32> for Instruction {
337	#[allow(clippy::missing_inline_in_public_items)]
338	#[rustfmt::skip]
339	fn with2(code: Code, register: Register, immediate: u32) -> Result<Self, IcedError> {
340		let mut instruction = Self::default();
341		instruction.set_code(code);
342
343		const _: () = assert!(OpKind::Register as u32 == 0);
344		//instruction.set_op0_kind(OpKind::Register);
345		instruction.set_op0_register(register);
346
347		instruction_internal::initialize_unsigned_immediate(&mut instruction, 1, immediate as u64)?;
348
349		debug_assert_eq!(instruction.op_count(), 2);
350		Ok(instruction)
351	}
352}
353
354impl With2<Register, i64> for Instruction {
355	#[allow(clippy::missing_inline_in_public_items)]
356	#[rustfmt::skip]
357	fn with2(code: Code, register: Register, immediate: i64) -> Result<Self, IcedError> {
358		let mut instruction = Self::default();
359		instruction.set_code(code);
360
361		const _: () = assert!(OpKind::Register as u32 == 0);
362		//instruction.set_op0_kind(OpKind::Register);
363		instruction.set_op0_register(register);
364
365		instruction_internal::initialize_signed_immediate(&mut instruction, 1, immediate)?;
366
367		debug_assert_eq!(instruction.op_count(), 2);
368		Ok(instruction)
369	}
370}
371
372impl With2<Register, u64> for Instruction {
373	#[allow(clippy::missing_inline_in_public_items)]
374	#[rustfmt::skip]
375	fn with2(code: Code, register: Register, immediate: u64) -> Result<Self, IcedError> {
376		let mut instruction = Self::default();
377		instruction.set_code(code);
378
379		const _: () = assert!(OpKind::Register as u32 == 0);
380		//instruction.set_op0_kind(OpKind::Register);
381		instruction.set_op0_register(register);
382
383		instruction_internal::initialize_unsigned_immediate(&mut instruction, 1, immediate)?;
384
385		debug_assert_eq!(instruction.op_count(), 2);
386		Ok(instruction)
387	}
388}
389
390impl With2<Register, MemoryOperand> for Instruction {
391	#[allow(clippy::missing_inline_in_public_items)]
392	#[rustfmt::skip]
393	fn with2(code: Code, register: Register, memory: MemoryOperand) -> Result<Self, IcedError> {
394		let mut instruction = Self::default();
395		instruction.set_code(code);
396
397		const _: () = assert!(OpKind::Register as u32 == 0);
398		//instruction.set_op0_kind(OpKind::Register);
399		instruction.set_op0_register(register);
400
401		instruction.set_op1_kind(OpKind::Memory);
402		Instruction::init_memory_operand(&mut instruction, &memory);
403
404		debug_assert_eq!(instruction.op_count(), 2);
405		Ok(instruction)
406	}
407}
408
409impl With2<i32, Register> for Instruction {
410	#[allow(clippy::missing_inline_in_public_items)]
411	#[rustfmt::skip]
412	fn with2(code: Code, immediate: i32, register: Register) -> Result<Self, IcedError> {
413		let mut instruction = Self::default();
414		instruction.set_code(code);
415
416		instruction_internal::initialize_signed_immediate(&mut instruction, 0, immediate as i64)?;
417
418		const _: () = assert!(OpKind::Register as u32 == 0);
419		//instruction.set_op1_kind(OpKind::Register);
420		instruction.set_op1_register(register);
421
422		debug_assert_eq!(instruction.op_count(), 2);
423		Ok(instruction)
424	}
425}
426
427impl With2<u32, Register> for Instruction {
428	#[allow(clippy::missing_inline_in_public_items)]
429	#[rustfmt::skip]
430	fn with2(code: Code, immediate: u32, register: Register) -> Result<Self, IcedError> {
431		let mut instruction = Self::default();
432		instruction.set_code(code);
433
434		instruction_internal::initialize_unsigned_immediate(&mut instruction, 0, immediate as u64)?;
435
436		const _: () = assert!(OpKind::Register as u32 == 0);
437		//instruction.set_op1_kind(OpKind::Register);
438		instruction.set_op1_register(register);
439
440		debug_assert_eq!(instruction.op_count(), 2);
441		Ok(instruction)
442	}
443}
444
445impl With2<i32, i32> for Instruction {
446	#[allow(clippy::missing_inline_in_public_items)]
447	#[rustfmt::skip]
448	fn with2(code: Code, immediate1: i32, immediate2: i32) -> Result<Self, IcedError> {
449		let mut instruction = Self::default();
450		instruction.set_code(code);
451
452		instruction_internal::initialize_signed_immediate(&mut instruction, 0, immediate1 as i64)?;
453
454		instruction_internal::initialize_signed_immediate(&mut instruction, 1, immediate2 as i64)?;
455
456		debug_assert_eq!(instruction.op_count(), 2);
457		Ok(instruction)
458	}
459}
460
461impl With2<u32, u32> for Instruction {
462	#[allow(clippy::missing_inline_in_public_items)]
463	#[rustfmt::skip]
464	fn with2(code: Code, immediate1: u32, immediate2: u32) -> Result<Self, IcedError> {
465		let mut instruction = Self::default();
466		instruction.set_code(code);
467
468		instruction_internal::initialize_unsigned_immediate(&mut instruction, 0, immediate1 as u64)?;
469
470		instruction_internal::initialize_unsigned_immediate(&mut instruction, 1, immediate2 as u64)?;
471
472		debug_assert_eq!(instruction.op_count(), 2);
473		Ok(instruction)
474	}
475}
476
477impl With2<MemoryOperand, Register> for Instruction {
478	#[allow(clippy::missing_inline_in_public_items)]
479	#[rustfmt::skip]
480	fn with2(code: Code, memory: MemoryOperand, register: Register) -> Result<Self, IcedError> {
481		let mut instruction = Self::default();
482		instruction.set_code(code);
483
484		instruction.set_op0_kind(OpKind::Memory);
485		Instruction::init_memory_operand(&mut instruction, &memory);
486
487		const _: () = assert!(OpKind::Register as u32 == 0);
488		//instruction.set_op1_kind(OpKind::Register);
489		instruction.set_op1_register(register);
490
491		debug_assert_eq!(instruction.op_count(), 2);
492		Ok(instruction)
493	}
494}
495
496impl With2<MemoryOperand, i32> for Instruction {
497	#[allow(clippy::missing_inline_in_public_items)]
498	#[rustfmt::skip]
499	fn with2(code: Code, memory: MemoryOperand, immediate: i32) -> Result<Self, IcedError> {
500		let mut instruction = Self::default();
501		instruction.set_code(code);
502
503		instruction.set_op0_kind(OpKind::Memory);
504		Instruction::init_memory_operand(&mut instruction, &memory);
505
506		instruction_internal::initialize_signed_immediate(&mut instruction, 1, immediate as i64)?;
507
508		debug_assert_eq!(instruction.op_count(), 2);
509		Ok(instruction)
510	}
511}
512
513impl With2<MemoryOperand, u32> for Instruction {
514	#[allow(clippy::missing_inline_in_public_items)]
515	#[rustfmt::skip]
516	fn with2(code: Code, memory: MemoryOperand, immediate: u32) -> Result<Self, IcedError> {
517		let mut instruction = Self::default();
518		instruction.set_code(code);
519
520		instruction.set_op0_kind(OpKind::Memory);
521		Instruction::init_memory_operand(&mut instruction, &memory);
522
523		instruction_internal::initialize_unsigned_immediate(&mut instruction, 1, immediate as u64)?;
524
525		debug_assert_eq!(instruction.op_count(), 2);
526		Ok(instruction)
527	}
528}
529
530impl With3<Register, Register, Register> for Instruction {
531	#[allow(clippy::missing_inline_in_public_items)]
532	#[rustfmt::skip]
533	fn with3(code: Code, register1: Register, register2: Register, register3: Register) -> Result<Self, IcedError> {
534		let mut instruction = Self::default();
535		instruction.set_code(code);
536
537		const _: () = assert!(OpKind::Register as u32 == 0);
538		//instruction.set_op0_kind(OpKind::Register);
539		instruction.set_op0_register(register1);
540
541		const _: () = assert!(OpKind::Register as u32 == 0);
542		//instruction.set_op1_kind(OpKind::Register);
543		instruction.set_op1_register(register2);
544
545		const _: () = assert!(OpKind::Register as u32 == 0);
546		//instruction.set_op2_kind(OpKind::Register);
547		instruction.set_op2_register(register3);
548
549		debug_assert_eq!(instruction.op_count(), 3);
550		Ok(instruction)
551	}
552}
553
554impl With3<Register, Register, i32> for Instruction {
555	#[allow(clippy::missing_inline_in_public_items)]
556	#[rustfmt::skip]
557	fn with3(code: Code, register1: Register, register2: Register, immediate: i32) -> Result<Self, IcedError> {
558		let mut instruction = Self::default();
559		instruction.set_code(code);
560
561		const _: () = assert!(OpKind::Register as u32 == 0);
562		//instruction.set_op0_kind(OpKind::Register);
563		instruction.set_op0_register(register1);
564
565		const _: () = assert!(OpKind::Register as u32 == 0);
566		//instruction.set_op1_kind(OpKind::Register);
567		instruction.set_op1_register(register2);
568
569		instruction_internal::initialize_signed_immediate(&mut instruction, 2, immediate as i64)?;
570
571		debug_assert_eq!(instruction.op_count(), 3);
572		Ok(instruction)
573	}
574}
575
576impl With3<Register, Register, u32> for Instruction {
577	#[allow(clippy::missing_inline_in_public_items)]
578	#[rustfmt::skip]
579	fn with3(code: Code, register1: Register, register2: Register, immediate: u32) -> Result<Self, IcedError> {
580		let mut instruction = Self::default();
581		instruction.set_code(code);
582
583		const _: () = assert!(OpKind::Register as u32 == 0);
584		//instruction.set_op0_kind(OpKind::Register);
585		instruction.set_op0_register(register1);
586
587		const _: () = assert!(OpKind::Register as u32 == 0);
588		//instruction.set_op1_kind(OpKind::Register);
589		instruction.set_op1_register(register2);
590
591		instruction_internal::initialize_unsigned_immediate(&mut instruction, 2, immediate as u64)?;
592
593		debug_assert_eq!(instruction.op_count(), 3);
594		Ok(instruction)
595	}
596}
597
598impl With3<Register, Register, MemoryOperand> for Instruction {
599	#[allow(clippy::missing_inline_in_public_items)]
600	#[rustfmt::skip]
601	fn with3(code: Code, register1: Register, register2: Register, memory: MemoryOperand) -> Result<Self, IcedError> {
602		let mut instruction = Self::default();
603		instruction.set_code(code);
604
605		const _: () = assert!(OpKind::Register as u32 == 0);
606		//instruction.set_op0_kind(OpKind::Register);
607		instruction.set_op0_register(register1);
608
609		const _: () = assert!(OpKind::Register as u32 == 0);
610		//instruction.set_op1_kind(OpKind::Register);
611		instruction.set_op1_register(register2);
612
613		instruction.set_op2_kind(OpKind::Memory);
614		Instruction::init_memory_operand(&mut instruction, &memory);
615
616		debug_assert_eq!(instruction.op_count(), 3);
617		Ok(instruction)
618	}
619}
620
621impl With3<Register, i32, i32> for Instruction {
622	#[allow(clippy::missing_inline_in_public_items)]
623	#[rustfmt::skip]
624	fn with3(code: Code, register: Register, immediate1: i32, immediate2: i32) -> Result<Self, IcedError> {
625		let mut instruction = Self::default();
626		instruction.set_code(code);
627
628		const _: () = assert!(OpKind::Register as u32 == 0);
629		//instruction.set_op0_kind(OpKind::Register);
630		instruction.set_op0_register(register);
631
632		instruction_internal::initialize_signed_immediate(&mut instruction, 1, immediate1 as i64)?;
633
634		instruction_internal::initialize_signed_immediate(&mut instruction, 2, immediate2 as i64)?;
635
636		debug_assert_eq!(instruction.op_count(), 3);
637		Ok(instruction)
638	}
639}
640
641impl With3<Register, u32, u32> for Instruction {
642	#[allow(clippy::missing_inline_in_public_items)]
643	#[rustfmt::skip]
644	fn with3(code: Code, register: Register, immediate1: u32, immediate2: u32) -> Result<Self, IcedError> {
645		let mut instruction = Self::default();
646		instruction.set_code(code);
647
648		const _: () = assert!(OpKind::Register as u32 == 0);
649		//instruction.set_op0_kind(OpKind::Register);
650		instruction.set_op0_register(register);
651
652		instruction_internal::initialize_unsigned_immediate(&mut instruction, 1, immediate1 as u64)?;
653
654		instruction_internal::initialize_unsigned_immediate(&mut instruction, 2, immediate2 as u64)?;
655
656		debug_assert_eq!(instruction.op_count(), 3);
657		Ok(instruction)
658	}
659}
660
661impl With3<Register, MemoryOperand, Register> for Instruction {
662	#[allow(clippy::missing_inline_in_public_items)]
663	#[rustfmt::skip]
664	fn with3(code: Code, register1: Register, memory: MemoryOperand, register2: Register) -> Result<Self, IcedError> {
665		let mut instruction = Self::default();
666		instruction.set_code(code);
667
668		const _: () = assert!(OpKind::Register as u32 == 0);
669		//instruction.set_op0_kind(OpKind::Register);
670		instruction.set_op0_register(register1);
671
672		instruction.set_op1_kind(OpKind::Memory);
673		Instruction::init_memory_operand(&mut instruction, &memory);
674
675		const _: () = assert!(OpKind::Register as u32 == 0);
676		//instruction.set_op2_kind(OpKind::Register);
677		instruction.set_op2_register(register2);
678
679		debug_assert_eq!(instruction.op_count(), 3);
680		Ok(instruction)
681	}
682}
683
684impl With3<Register, MemoryOperand, i32> for Instruction {
685	#[allow(clippy::missing_inline_in_public_items)]
686	#[rustfmt::skip]
687	fn with3(code: Code, register: Register, memory: MemoryOperand, immediate: i32) -> Result<Self, IcedError> {
688		let mut instruction = Self::default();
689		instruction.set_code(code);
690
691		const _: () = assert!(OpKind::Register as u32 == 0);
692		//instruction.set_op0_kind(OpKind::Register);
693		instruction.set_op0_register(register);
694
695		instruction.set_op1_kind(OpKind::Memory);
696		Instruction::init_memory_operand(&mut instruction, &memory);
697
698		instruction_internal::initialize_signed_immediate(&mut instruction, 2, immediate as i64)?;
699
700		debug_assert_eq!(instruction.op_count(), 3);
701		Ok(instruction)
702	}
703}
704
705impl With3<Register, MemoryOperand, u32> for Instruction {
706	#[allow(clippy::missing_inline_in_public_items)]
707	#[rustfmt::skip]
708	fn with3(code: Code, register: Register, memory: MemoryOperand, immediate: u32) -> Result<Self, IcedError> {
709		let mut instruction = Self::default();
710		instruction.set_code(code);
711
712		const _: () = assert!(OpKind::Register as u32 == 0);
713		//instruction.set_op0_kind(OpKind::Register);
714		instruction.set_op0_register(register);
715
716		instruction.set_op1_kind(OpKind::Memory);
717		Instruction::init_memory_operand(&mut instruction, &memory);
718
719		instruction_internal::initialize_unsigned_immediate(&mut instruction, 2, immediate as u64)?;
720
721		debug_assert_eq!(instruction.op_count(), 3);
722		Ok(instruction)
723	}
724}
725
726impl With3<MemoryOperand, Register, Register> for Instruction {
727	#[allow(clippy::missing_inline_in_public_items)]
728	#[rustfmt::skip]
729	fn with3(code: Code, memory: MemoryOperand, register1: Register, register2: Register) -> Result<Self, IcedError> {
730		let mut instruction = Self::default();
731		instruction.set_code(code);
732
733		instruction.set_op0_kind(OpKind::Memory);
734		Instruction::init_memory_operand(&mut instruction, &memory);
735
736		const _: () = assert!(OpKind::Register as u32 == 0);
737		//instruction.set_op1_kind(OpKind::Register);
738		instruction.set_op1_register(register1);
739
740		const _: () = assert!(OpKind::Register as u32 == 0);
741		//instruction.set_op2_kind(OpKind::Register);
742		instruction.set_op2_register(register2);
743
744		debug_assert_eq!(instruction.op_count(), 3);
745		Ok(instruction)
746	}
747}
748
749impl With3<MemoryOperand, Register, i32> for Instruction {
750	#[allow(clippy::missing_inline_in_public_items)]
751	#[rustfmt::skip]
752	fn with3(code: Code, memory: MemoryOperand, register: Register, immediate: i32) -> Result<Self, IcedError> {
753		let mut instruction = Self::default();
754		instruction.set_code(code);
755
756		instruction.set_op0_kind(OpKind::Memory);
757		Instruction::init_memory_operand(&mut instruction, &memory);
758
759		const _: () = assert!(OpKind::Register as u32 == 0);
760		//instruction.set_op1_kind(OpKind::Register);
761		instruction.set_op1_register(register);
762
763		instruction_internal::initialize_signed_immediate(&mut instruction, 2, immediate as i64)?;
764
765		debug_assert_eq!(instruction.op_count(), 3);
766		Ok(instruction)
767	}
768}
769
770impl With3<MemoryOperand, Register, u32> for Instruction {
771	#[allow(clippy::missing_inline_in_public_items)]
772	#[rustfmt::skip]
773	fn with3(code: Code, memory: MemoryOperand, register: Register, immediate: u32) -> Result<Self, IcedError> {
774		let mut instruction = Self::default();
775		instruction.set_code(code);
776
777		instruction.set_op0_kind(OpKind::Memory);
778		Instruction::init_memory_operand(&mut instruction, &memory);
779
780		const _: () = assert!(OpKind::Register as u32 == 0);
781		//instruction.set_op1_kind(OpKind::Register);
782		instruction.set_op1_register(register);
783
784		instruction_internal::initialize_unsigned_immediate(&mut instruction, 2, immediate as u64)?;
785
786		debug_assert_eq!(instruction.op_count(), 3);
787		Ok(instruction)
788	}
789}
790
791impl With4<Register, Register, Register, Register> for Instruction {
792	#[allow(clippy::missing_inline_in_public_items)]
793	#[rustfmt::skip]
794	fn with4(code: Code, register1: Register, register2: Register, register3: Register, register4: Register) -> Result<Self, IcedError> {
795		let mut instruction = Self::default();
796		instruction.set_code(code);
797
798		const _: () = assert!(OpKind::Register as u32 == 0);
799		//instruction.set_op0_kind(OpKind::Register);
800		instruction.set_op0_register(register1);
801
802		const _: () = assert!(OpKind::Register as u32 == 0);
803		//instruction.set_op1_kind(OpKind::Register);
804		instruction.set_op1_register(register2);
805
806		const _: () = assert!(OpKind::Register as u32 == 0);
807		//instruction.set_op2_kind(OpKind::Register);
808		instruction.set_op2_register(register3);
809
810		const _: () = assert!(OpKind::Register as u32 == 0);
811		//instruction.set_op3_kind(OpKind::Register);
812		instruction.set_op3_register(register4);
813
814		debug_assert_eq!(instruction.op_count(), 4);
815		Ok(instruction)
816	}
817}
818
819impl With4<Register, Register, Register, i32> for Instruction {
820	#[allow(clippy::missing_inline_in_public_items)]
821	#[rustfmt::skip]
822	fn with4(code: Code, register1: Register, register2: Register, register3: Register, immediate: i32) -> Result<Self, IcedError> {
823		let mut instruction = Self::default();
824		instruction.set_code(code);
825
826		const _: () = assert!(OpKind::Register as u32 == 0);
827		//instruction.set_op0_kind(OpKind::Register);
828		instruction.set_op0_register(register1);
829
830		const _: () = assert!(OpKind::Register as u32 == 0);
831		//instruction.set_op1_kind(OpKind::Register);
832		instruction.set_op1_register(register2);
833
834		const _: () = assert!(OpKind::Register as u32 == 0);
835		//instruction.set_op2_kind(OpKind::Register);
836		instruction.set_op2_register(register3);
837
838		instruction_internal::initialize_signed_immediate(&mut instruction, 3, immediate as i64)?;
839
840		debug_assert_eq!(instruction.op_count(), 4);
841		Ok(instruction)
842	}
843}
844
845impl With4<Register, Register, Register, u32> for Instruction {
846	#[allow(clippy::missing_inline_in_public_items)]
847	#[rustfmt::skip]
848	fn with4(code: Code, register1: Register, register2: Register, register3: Register, immediate: u32) -> Result<Self, IcedError> {
849		let mut instruction = Self::default();
850		instruction.set_code(code);
851
852		const _: () = assert!(OpKind::Register as u32 == 0);
853		//instruction.set_op0_kind(OpKind::Register);
854		instruction.set_op0_register(register1);
855
856		const _: () = assert!(OpKind::Register as u32 == 0);
857		//instruction.set_op1_kind(OpKind::Register);
858		instruction.set_op1_register(register2);
859
860		const _: () = assert!(OpKind::Register as u32 == 0);
861		//instruction.set_op2_kind(OpKind::Register);
862		instruction.set_op2_register(register3);
863
864		instruction_internal::initialize_unsigned_immediate(&mut instruction, 3, immediate as u64)?;
865
866		debug_assert_eq!(instruction.op_count(), 4);
867		Ok(instruction)
868	}
869}
870
871impl With4<Register, Register, Register, MemoryOperand> for Instruction {
872	#[allow(clippy::missing_inline_in_public_items)]
873	#[rustfmt::skip]
874	fn with4(code: Code, register1: Register, register2: Register, register3: Register, memory: MemoryOperand) -> Result<Self, IcedError> {
875		let mut instruction = Self::default();
876		instruction.set_code(code);
877
878		const _: () = assert!(OpKind::Register as u32 == 0);
879		//instruction.set_op0_kind(OpKind::Register);
880		instruction.set_op0_register(register1);
881
882		const _: () = assert!(OpKind::Register as u32 == 0);
883		//instruction.set_op1_kind(OpKind::Register);
884		instruction.set_op1_register(register2);
885
886		const _: () = assert!(OpKind::Register as u32 == 0);
887		//instruction.set_op2_kind(OpKind::Register);
888		instruction.set_op2_register(register3);
889
890		instruction.set_op3_kind(OpKind::Memory);
891		Instruction::init_memory_operand(&mut instruction, &memory);
892
893		debug_assert_eq!(instruction.op_count(), 4);
894		Ok(instruction)
895	}
896}
897
898impl With4<Register, Register, i32, i32> for Instruction {
899	#[allow(clippy::missing_inline_in_public_items)]
900	#[rustfmt::skip]
901	fn with4(code: Code, register1: Register, register2: Register, immediate1: i32, immediate2: i32) -> Result<Self, IcedError> {
902		let mut instruction = Self::default();
903		instruction.set_code(code);
904
905		const _: () = assert!(OpKind::Register as u32 == 0);
906		//instruction.set_op0_kind(OpKind::Register);
907		instruction.set_op0_register(register1);
908
909		const _: () = assert!(OpKind::Register as u32 == 0);
910		//instruction.set_op1_kind(OpKind::Register);
911		instruction.set_op1_register(register2);
912
913		instruction_internal::initialize_signed_immediate(&mut instruction, 2, immediate1 as i64)?;
914
915		instruction_internal::initialize_signed_immediate(&mut instruction, 3, immediate2 as i64)?;
916
917		debug_assert_eq!(instruction.op_count(), 4);
918		Ok(instruction)
919	}
920}
921
922impl With4<Register, Register, u32, u32> for Instruction {
923	#[allow(clippy::missing_inline_in_public_items)]
924	#[rustfmt::skip]
925	fn with4(code: Code, register1: Register, register2: Register, immediate1: u32, immediate2: u32) -> Result<Self, IcedError> {
926		let mut instruction = Self::default();
927		instruction.set_code(code);
928
929		const _: () = assert!(OpKind::Register as u32 == 0);
930		//instruction.set_op0_kind(OpKind::Register);
931		instruction.set_op0_register(register1);
932
933		const _: () = assert!(OpKind::Register as u32 == 0);
934		//instruction.set_op1_kind(OpKind::Register);
935		instruction.set_op1_register(register2);
936
937		instruction_internal::initialize_unsigned_immediate(&mut instruction, 2, immediate1 as u64)?;
938
939		instruction_internal::initialize_unsigned_immediate(&mut instruction, 3, immediate2 as u64)?;
940
941		debug_assert_eq!(instruction.op_count(), 4);
942		Ok(instruction)
943	}
944}
945
946impl With4<Register, Register, MemoryOperand, Register> for Instruction {
947	#[allow(clippy::missing_inline_in_public_items)]
948	#[rustfmt::skip]
949	fn with4(code: Code, register1: Register, register2: Register, memory: MemoryOperand, register3: Register) -> Result<Self, IcedError> {
950		let mut instruction = Self::default();
951		instruction.set_code(code);
952
953		const _: () = assert!(OpKind::Register as u32 == 0);
954		//instruction.set_op0_kind(OpKind::Register);
955		instruction.set_op0_register(register1);
956
957		const _: () = assert!(OpKind::Register as u32 == 0);
958		//instruction.set_op1_kind(OpKind::Register);
959		instruction.set_op1_register(register2);
960
961		instruction.set_op2_kind(OpKind::Memory);
962		Instruction::init_memory_operand(&mut instruction, &memory);
963
964		const _: () = assert!(OpKind::Register as u32 == 0);
965		//instruction.set_op3_kind(OpKind::Register);
966		instruction.set_op3_register(register3);
967
968		debug_assert_eq!(instruction.op_count(), 4);
969		Ok(instruction)
970	}
971}
972
973impl With4<Register, Register, MemoryOperand, i32> for Instruction {
974	#[allow(clippy::missing_inline_in_public_items)]
975	#[rustfmt::skip]
976	fn with4(code: Code, register1: Register, register2: Register, memory: MemoryOperand, immediate: i32) -> Result<Self, IcedError> {
977		let mut instruction = Self::default();
978		instruction.set_code(code);
979
980		const _: () = assert!(OpKind::Register as u32 == 0);
981		//instruction.set_op0_kind(OpKind::Register);
982		instruction.set_op0_register(register1);
983
984		const _: () = assert!(OpKind::Register as u32 == 0);
985		//instruction.set_op1_kind(OpKind::Register);
986		instruction.set_op1_register(register2);
987
988		instruction.set_op2_kind(OpKind::Memory);
989		Instruction::init_memory_operand(&mut instruction, &memory);
990
991		instruction_internal::initialize_signed_immediate(&mut instruction, 3, immediate as i64)?;
992
993		debug_assert_eq!(instruction.op_count(), 4);
994		Ok(instruction)
995	}
996}
997
998impl With4<Register, Register, MemoryOperand, u32> for Instruction {
999	#[allow(clippy::missing_inline_in_public_items)]
1000	#[rustfmt::skip]
1001	fn with4(code: Code, register1: Register, register2: Register, memory: MemoryOperand, immediate: u32) -> Result<Self, IcedError> {
1002		let mut instruction = Self::default();
1003		instruction.set_code(code);
1004
1005		const _: () = assert!(OpKind::Register as u32 == 0);
1006		//instruction.set_op0_kind(OpKind::Register);
1007		instruction.set_op0_register(register1);
1008
1009		const _: () = assert!(OpKind::Register as u32 == 0);
1010		//instruction.set_op1_kind(OpKind::Register);
1011		instruction.set_op1_register(register2);
1012
1013		instruction.set_op2_kind(OpKind::Memory);
1014		Instruction::init_memory_operand(&mut instruction, &memory);
1015
1016		instruction_internal::initialize_unsigned_immediate(&mut instruction, 3, immediate as u64)?;
1017
1018		debug_assert_eq!(instruction.op_count(), 4);
1019		Ok(instruction)
1020	}
1021}
1022
1023impl With5<Register, Register, Register, Register, i32> for Instruction {
1024	#[allow(clippy::missing_inline_in_public_items)]
1025	#[rustfmt::skip]
1026	fn with5(code: Code, register1: Register, register2: Register, register3: Register, register4: Register, immediate: i32) -> Result<Self, IcedError> {
1027		let mut instruction = Self::default();
1028		instruction.set_code(code);
1029
1030		const _: () = assert!(OpKind::Register as u32 == 0);
1031		//instruction.set_op0_kind(OpKind::Register);
1032		instruction.set_op0_register(register1);
1033
1034		const _: () = assert!(OpKind::Register as u32 == 0);
1035		//instruction.set_op1_kind(OpKind::Register);
1036		instruction.set_op1_register(register2);
1037
1038		const _: () = assert!(OpKind::Register as u32 == 0);
1039		//instruction.set_op2_kind(OpKind::Register);
1040		instruction.set_op2_register(register3);
1041
1042		const _: () = assert!(OpKind::Register as u32 == 0);
1043		//instruction.set_op3_kind(OpKind::Register);
1044		instruction.set_op3_register(register4);
1045
1046		instruction_internal::initialize_signed_immediate(&mut instruction, 4, immediate as i64)?;
1047
1048		debug_assert_eq!(instruction.op_count(), 5);
1049		Ok(instruction)
1050	}
1051}
1052
1053impl With5<Register, Register, Register, Register, u32> for Instruction {
1054	#[allow(clippy::missing_inline_in_public_items)]
1055	#[rustfmt::skip]
1056	fn with5(code: Code, register1: Register, register2: Register, register3: Register, register4: Register, immediate: u32) -> Result<Self, IcedError> {
1057		let mut instruction = Self::default();
1058		instruction.set_code(code);
1059
1060		const _: () = assert!(OpKind::Register as u32 == 0);
1061		//instruction.set_op0_kind(OpKind::Register);
1062		instruction.set_op0_register(register1);
1063
1064		const _: () = assert!(OpKind::Register as u32 == 0);
1065		//instruction.set_op1_kind(OpKind::Register);
1066		instruction.set_op1_register(register2);
1067
1068		const _: () = assert!(OpKind::Register as u32 == 0);
1069		//instruction.set_op2_kind(OpKind::Register);
1070		instruction.set_op2_register(register3);
1071
1072		const _: () = assert!(OpKind::Register as u32 == 0);
1073		//instruction.set_op3_kind(OpKind::Register);
1074		instruction.set_op3_register(register4);
1075
1076		instruction_internal::initialize_unsigned_immediate(&mut instruction, 4, immediate as u64)?;
1077
1078		debug_assert_eq!(instruction.op_count(), 5);
1079		Ok(instruction)
1080	}
1081}
1082
1083impl With5<Register, Register, Register, MemoryOperand, i32> for Instruction {
1084	#[allow(clippy::missing_inline_in_public_items)]
1085	#[rustfmt::skip]
1086	fn with5(code: Code, register1: Register, register2: Register, register3: Register, memory: MemoryOperand, immediate: i32) -> Result<Self, IcedError> {
1087		let mut instruction = Self::default();
1088		instruction.set_code(code);
1089
1090		const _: () = assert!(OpKind::Register as u32 == 0);
1091		//instruction.set_op0_kind(OpKind::Register);
1092		instruction.set_op0_register(register1);
1093
1094		const _: () = assert!(OpKind::Register as u32 == 0);
1095		//instruction.set_op1_kind(OpKind::Register);
1096		instruction.set_op1_register(register2);
1097
1098		const _: () = assert!(OpKind::Register as u32 == 0);
1099		//instruction.set_op2_kind(OpKind::Register);
1100		instruction.set_op2_register(register3);
1101
1102		instruction.set_op3_kind(OpKind::Memory);
1103		Instruction::init_memory_operand(&mut instruction, &memory);
1104
1105		instruction_internal::initialize_signed_immediate(&mut instruction, 4, immediate as i64)?;
1106
1107		debug_assert_eq!(instruction.op_count(), 5);
1108		Ok(instruction)
1109	}
1110}
1111
1112impl With5<Register, Register, Register, MemoryOperand, u32> for Instruction {
1113	#[allow(clippy::missing_inline_in_public_items)]
1114	#[rustfmt::skip]
1115	fn with5(code: Code, register1: Register, register2: Register, register3: Register, memory: MemoryOperand, immediate: u32) -> Result<Self, IcedError> {
1116		let mut instruction = Self::default();
1117		instruction.set_code(code);
1118
1119		const _: () = assert!(OpKind::Register as u32 == 0);
1120		//instruction.set_op0_kind(OpKind::Register);
1121		instruction.set_op0_register(register1);
1122
1123		const _: () = assert!(OpKind::Register as u32 == 0);
1124		//instruction.set_op1_kind(OpKind::Register);
1125		instruction.set_op1_register(register2);
1126
1127		const _: () = assert!(OpKind::Register as u32 == 0);
1128		//instruction.set_op2_kind(OpKind::Register);
1129		instruction.set_op2_register(register3);
1130
1131		instruction.set_op3_kind(OpKind::Memory);
1132		Instruction::init_memory_operand(&mut instruction, &memory);
1133
1134		instruction_internal::initialize_unsigned_immediate(&mut instruction, 4, immediate as u64)?;
1135
1136		debug_assert_eq!(instruction.op_count(), 5);
1137		Ok(instruction)
1138	}
1139}
1140
1141impl With5<Register, Register, MemoryOperand, Register, i32> for Instruction {
1142	#[allow(clippy::missing_inline_in_public_items)]
1143	#[rustfmt::skip]
1144	fn with5(code: Code, register1: Register, register2: Register, memory: MemoryOperand, register3: Register, immediate: i32) -> Result<Self, IcedError> {
1145		let mut instruction = Self::default();
1146		instruction.set_code(code);
1147
1148		const _: () = assert!(OpKind::Register as u32 == 0);
1149		//instruction.set_op0_kind(OpKind::Register);
1150		instruction.set_op0_register(register1);
1151
1152		const _: () = assert!(OpKind::Register as u32 == 0);
1153		//instruction.set_op1_kind(OpKind::Register);
1154		instruction.set_op1_register(register2);
1155
1156		instruction.set_op2_kind(OpKind::Memory);
1157		Instruction::init_memory_operand(&mut instruction, &memory);
1158
1159		const _: () = assert!(OpKind::Register as u32 == 0);
1160		//instruction.set_op3_kind(OpKind::Register);
1161		instruction.set_op3_register(register3);
1162
1163		instruction_internal::initialize_signed_immediate(&mut instruction, 4, immediate as i64)?;
1164
1165		debug_assert_eq!(instruction.op_count(), 5);
1166		Ok(instruction)
1167	}
1168}
1169
1170impl With5<Register, Register, MemoryOperand, Register, u32> for Instruction {
1171	#[allow(clippy::missing_inline_in_public_items)]
1172	#[rustfmt::skip]
1173	fn with5(code: Code, register1: Register, register2: Register, memory: MemoryOperand, register3: Register, immediate: u32) -> Result<Self, IcedError> {
1174		let mut instruction = Self::default();
1175		instruction.set_code(code);
1176
1177		const _: () = assert!(OpKind::Register as u32 == 0);
1178		//instruction.set_op0_kind(OpKind::Register);
1179		instruction.set_op0_register(register1);
1180
1181		const _: () = assert!(OpKind::Register as u32 == 0);
1182		//instruction.set_op1_kind(OpKind::Register);
1183		instruction.set_op1_register(register2);
1184
1185		instruction.set_op2_kind(OpKind::Memory);
1186		Instruction::init_memory_operand(&mut instruction, &memory);
1187
1188		const _: () = assert!(OpKind::Register as u32 == 0);
1189		//instruction.set_op3_kind(OpKind::Register);
1190		instruction.set_op3_register(register3);
1191
1192		instruction_internal::initialize_unsigned_immediate(&mut instruction, 4, immediate as u64)?;
1193
1194		debug_assert_eq!(instruction.op_count(), 5);
1195		Ok(instruction)
1196	}
1197}
1198
1199impl Instruction {
1200	/// Creates a new near/short branch instruction
1201	///
1202	/// # Errors
1203	///
1204	/// Fails if the created instruction doesn't have a near branch operand
1205	///
1206	/// # Arguments
1207	///
1208	/// * `code`: Code value
1209	/// * `target`: Target address
1210	#[allow(clippy::missing_inline_in_public_items)]
1211	#[rustfmt::skip]
1212	pub fn with_branch(code: Code, target: u64) -> Result<Self, IcedError> {
1213		let mut instruction = Self::default();
1214		instruction.set_code(code);
1215
1216		instruction.set_op0_kind(instruction_internal::get_near_branch_op_kind(code, 0)?);
1217		instruction.set_near_branch64(target);
1218
1219		debug_assert_eq!(instruction.op_count(), 1);
1220		Ok(instruction)
1221	}
1222
1223	/// Creates a new far branch instruction
1224	///
1225	/// # Errors
1226	///
1227	/// Fails if the created instruction doesn't have a far branch operand
1228	///
1229	/// # Arguments
1230	///
1231	/// * `code`: Code value
1232	/// * `selector`: Selector/segment value
1233	/// * `offset`: Offset
1234	#[allow(clippy::missing_inline_in_public_items)]
1235	#[rustfmt::skip]
1236	pub fn with_far_branch(code: Code, selector: u16, offset: u32) -> Result<Self, IcedError> {
1237		let mut instruction = Self::default();
1238		instruction.set_code(code);
1239
1240		instruction.set_op0_kind(instruction_internal::get_far_branch_op_kind(code, 0)?);
1241		instruction.set_far_branch_selector(selector);
1242		instruction.set_far_branch32(offset);
1243
1244		debug_assert_eq!(instruction.op_count(), 1);
1245		Ok(instruction)
1246	}
1247
1248	/// Creates a new `XBEGIN` instruction
1249	///
1250	/// # Errors
1251	///
1252	/// Fails if `bitness` is not one of 16, 32, 64.
1253	///
1254	/// # Arguments
1255	///
1256	/// * `bitness`: 16, 32, or 64
1257	/// * `target`: Target address
1258	#[allow(clippy::missing_inline_in_public_items)]
1259	#[rustfmt::skip]
1260	pub fn with_xbegin(bitness: u32, target: u64) -> Result<Self, IcedError> {
1261		let mut instruction = Self::default();
1262
1263		match bitness {
1264			16 => {
1265				instruction.set_code(Code::Xbegin_rel16);
1266				instruction.set_op0_kind(OpKind::NearBranch32);
1267				instruction.set_near_branch32(target as u32);
1268			}
1269
1270			32 => {
1271				instruction.set_code(Code::Xbegin_rel32);
1272				instruction.set_op0_kind(OpKind::NearBranch32);
1273				instruction.set_near_branch32(target as u32);
1274			}
1275
1276			64 => {
1277				instruction.set_code(Code::Xbegin_rel32);
1278				instruction.set_op0_kind(OpKind::NearBranch64);
1279				instruction.set_near_branch64(target);
1280			}
1281
1282			_ => return Err(IcedError::new("Invalid bitness")),
1283		}
1284
1285		debug_assert_eq!(instruction.op_count(), 1);
1286		Ok(instruction)
1287	}
1288
1289	/// Creates a `OUTSB` instruction
1290	///
1291	/// # Errors
1292	///
1293	/// Fails if `address_size` is not one of 16, 32, 64.
1294	///
1295	/// # Arguments
1296	///
1297	/// * `address_size`: 16, 32, or 64
1298	/// * `segment_prefix`: Segment override or [`Register::None`]
1299	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1300	///
1301	/// [`Register::None`]: enum.Register.html#variant.None
1302	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1303	#[inline]
1304	#[rustfmt::skip]
1305	pub fn with_outsb(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1306		instruction_internal::with_string_reg_segrsi(Code::Outsb_DX_m8, address_size, Register::DX, segment_prefix, rep_prefix)
1307	}
1308
1309	/// Creates a `REP OUTSB` instruction
1310	///
1311	/// # Errors
1312	///
1313	/// Fails if `address_size` is not one of 16, 32, 64.
1314	///
1315	/// # Arguments
1316	///
1317	/// * `address_size`: 16, 32, or 64
1318	#[inline]
1319	#[rustfmt::skip]
1320	pub fn with_rep_outsb(address_size: u32) -> Result<Self, IcedError> {
1321		instruction_internal::with_string_reg_segrsi(Code::Outsb_DX_m8, address_size, Register::DX, Register::None, RepPrefixKind::Repe)
1322	}
1323
1324	/// Creates a `OUTSW` instruction
1325	///
1326	/// # Errors
1327	///
1328	/// Fails if `address_size` is not one of 16, 32, 64.
1329	///
1330	/// # Arguments
1331	///
1332	/// * `address_size`: 16, 32, or 64
1333	/// * `segment_prefix`: Segment override or [`Register::None`]
1334	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1335	///
1336	/// [`Register::None`]: enum.Register.html#variant.None
1337	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1338	#[inline]
1339	#[rustfmt::skip]
1340	pub fn with_outsw(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1341		instruction_internal::with_string_reg_segrsi(Code::Outsw_DX_m16, address_size, Register::DX, segment_prefix, rep_prefix)
1342	}
1343
1344	/// Creates a `REP OUTSW` instruction
1345	///
1346	/// # Errors
1347	///
1348	/// Fails if `address_size` is not one of 16, 32, 64.
1349	///
1350	/// # Arguments
1351	///
1352	/// * `address_size`: 16, 32, or 64
1353	#[inline]
1354	#[rustfmt::skip]
1355	pub fn with_rep_outsw(address_size: u32) -> Result<Self, IcedError> {
1356		instruction_internal::with_string_reg_segrsi(Code::Outsw_DX_m16, address_size, Register::DX, Register::None, RepPrefixKind::Repe)
1357	}
1358
1359	/// Creates a `OUTSD` instruction
1360	///
1361	/// # Errors
1362	///
1363	/// Fails if `address_size` is not one of 16, 32, 64.
1364	///
1365	/// # Arguments
1366	///
1367	/// * `address_size`: 16, 32, or 64
1368	/// * `segment_prefix`: Segment override or [`Register::None`]
1369	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1370	///
1371	/// [`Register::None`]: enum.Register.html#variant.None
1372	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1373	#[inline]
1374	#[rustfmt::skip]
1375	pub fn with_outsd(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1376		instruction_internal::with_string_reg_segrsi(Code::Outsd_DX_m32, address_size, Register::DX, segment_prefix, rep_prefix)
1377	}
1378
1379	/// Creates a `REP OUTSD` instruction
1380	///
1381	/// # Errors
1382	///
1383	/// Fails if `address_size` is not one of 16, 32, 64.
1384	///
1385	/// # Arguments
1386	///
1387	/// * `address_size`: 16, 32, or 64
1388	#[inline]
1389	#[rustfmt::skip]
1390	pub fn with_rep_outsd(address_size: u32) -> Result<Self, IcedError> {
1391		instruction_internal::with_string_reg_segrsi(Code::Outsd_DX_m32, address_size, Register::DX, Register::None, RepPrefixKind::Repe)
1392	}
1393
1394	/// Creates a `LODSB` instruction
1395	///
1396	/// # Errors
1397	///
1398	/// Fails if `address_size` is not one of 16, 32, 64.
1399	///
1400	/// # Arguments
1401	///
1402	/// * `address_size`: 16, 32, or 64
1403	/// * `segment_prefix`: Segment override or [`Register::None`]
1404	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1405	///
1406	/// [`Register::None`]: enum.Register.html#variant.None
1407	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1408	#[inline]
1409	#[rustfmt::skip]
1410	pub fn with_lodsb(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1411		instruction_internal::with_string_reg_segrsi(Code::Lodsb_AL_m8, address_size, Register::AL, segment_prefix, rep_prefix)
1412	}
1413
1414	/// Creates a `REP LODSB` instruction
1415	///
1416	/// # Errors
1417	///
1418	/// Fails if `address_size` is not one of 16, 32, 64.
1419	///
1420	/// # Arguments
1421	///
1422	/// * `address_size`: 16, 32, or 64
1423	#[inline]
1424	#[rustfmt::skip]
1425	pub fn with_rep_lodsb(address_size: u32) -> Result<Self, IcedError> {
1426		instruction_internal::with_string_reg_segrsi(Code::Lodsb_AL_m8, address_size, Register::AL, Register::None, RepPrefixKind::Repe)
1427	}
1428
1429	/// Creates a `LODSW` instruction
1430	///
1431	/// # Errors
1432	///
1433	/// Fails if `address_size` is not one of 16, 32, 64.
1434	///
1435	/// # Arguments
1436	///
1437	/// * `address_size`: 16, 32, or 64
1438	/// * `segment_prefix`: Segment override or [`Register::None`]
1439	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1440	///
1441	/// [`Register::None`]: enum.Register.html#variant.None
1442	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1443	#[inline]
1444	#[rustfmt::skip]
1445	pub fn with_lodsw(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1446		instruction_internal::with_string_reg_segrsi(Code::Lodsw_AX_m16, address_size, Register::AX, segment_prefix, rep_prefix)
1447	}
1448
1449	/// Creates a `REP LODSW` instruction
1450	///
1451	/// # Errors
1452	///
1453	/// Fails if `address_size` is not one of 16, 32, 64.
1454	///
1455	/// # Arguments
1456	///
1457	/// * `address_size`: 16, 32, or 64
1458	#[inline]
1459	#[rustfmt::skip]
1460	pub fn with_rep_lodsw(address_size: u32) -> Result<Self, IcedError> {
1461		instruction_internal::with_string_reg_segrsi(Code::Lodsw_AX_m16, address_size, Register::AX, Register::None, RepPrefixKind::Repe)
1462	}
1463
1464	/// Creates a `LODSD` instruction
1465	///
1466	/// # Errors
1467	///
1468	/// Fails if `address_size` is not one of 16, 32, 64.
1469	///
1470	/// # Arguments
1471	///
1472	/// * `address_size`: 16, 32, or 64
1473	/// * `segment_prefix`: Segment override or [`Register::None`]
1474	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1475	///
1476	/// [`Register::None`]: enum.Register.html#variant.None
1477	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1478	#[inline]
1479	#[rustfmt::skip]
1480	pub fn with_lodsd(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1481		instruction_internal::with_string_reg_segrsi(Code::Lodsd_EAX_m32, address_size, Register::EAX, segment_prefix, rep_prefix)
1482	}
1483
1484	/// Creates a `REP LODSD` instruction
1485	///
1486	/// # Errors
1487	///
1488	/// Fails if `address_size` is not one of 16, 32, 64.
1489	///
1490	/// # Arguments
1491	///
1492	/// * `address_size`: 16, 32, or 64
1493	#[inline]
1494	#[rustfmt::skip]
1495	pub fn with_rep_lodsd(address_size: u32) -> Result<Self, IcedError> {
1496		instruction_internal::with_string_reg_segrsi(Code::Lodsd_EAX_m32, address_size, Register::EAX, Register::None, RepPrefixKind::Repe)
1497	}
1498
1499	/// Creates a `LODSQ` instruction
1500	///
1501	/// # Errors
1502	///
1503	/// Fails if `address_size` is not one of 16, 32, 64.
1504	///
1505	/// # Arguments
1506	///
1507	/// * `address_size`: 16, 32, or 64
1508	/// * `segment_prefix`: Segment override or [`Register::None`]
1509	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1510	///
1511	/// [`Register::None`]: enum.Register.html#variant.None
1512	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1513	#[inline]
1514	#[rustfmt::skip]
1515	pub fn with_lodsq(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1516		instruction_internal::with_string_reg_segrsi(Code::Lodsq_RAX_m64, address_size, Register::RAX, segment_prefix, rep_prefix)
1517	}
1518
1519	/// Creates a `REP LODSQ` instruction
1520	///
1521	/// # Errors
1522	///
1523	/// Fails if `address_size` is not one of 16, 32, 64.
1524	///
1525	/// # Arguments
1526	///
1527	/// * `address_size`: 16, 32, or 64
1528	#[inline]
1529	#[rustfmt::skip]
1530	pub fn with_rep_lodsq(address_size: u32) -> Result<Self, IcedError> {
1531		instruction_internal::with_string_reg_segrsi(Code::Lodsq_RAX_m64, address_size, Register::RAX, Register::None, RepPrefixKind::Repe)
1532	}
1533
1534	/// Creates a `SCASB` instruction
1535	///
1536	/// # Errors
1537	///
1538	/// Fails if `address_size` is not one of 16, 32, 64.
1539	///
1540	/// # Arguments
1541	///
1542	/// * `address_size`: 16, 32, or 64
1543	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1544	///
1545	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1546	#[inline]
1547	#[rustfmt::skip]
1548	pub fn with_scasb(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1549		instruction_internal::with_string_reg_esrdi(Code::Scasb_AL_m8, address_size, Register::AL, rep_prefix)
1550	}
1551
1552	/// Creates a `REPE SCASB` instruction
1553	///
1554	/// # Errors
1555	///
1556	/// Fails if `address_size` is not one of 16, 32, 64.
1557	///
1558	/// # Arguments
1559	///
1560	/// * `address_size`: 16, 32, or 64
1561	#[inline]
1562	#[rustfmt::skip]
1563	pub fn with_repe_scasb(address_size: u32) -> Result<Self, IcedError> {
1564		instruction_internal::with_string_reg_esrdi(Code::Scasb_AL_m8, address_size, Register::AL, RepPrefixKind::Repe)
1565	}
1566
1567	/// Creates a `REPNE SCASB` instruction
1568	///
1569	/// # Errors
1570	///
1571	/// Fails if `address_size` is not one of 16, 32, 64.
1572	///
1573	/// # Arguments
1574	///
1575	/// * `address_size`: 16, 32, or 64
1576	#[inline]
1577	#[rustfmt::skip]
1578	pub fn with_repne_scasb(address_size: u32) -> Result<Self, IcedError> {
1579		instruction_internal::with_string_reg_esrdi(Code::Scasb_AL_m8, address_size, Register::AL, RepPrefixKind::Repne)
1580	}
1581
1582	/// Creates a `SCASW` instruction
1583	///
1584	/// # Errors
1585	///
1586	/// Fails if `address_size` is not one of 16, 32, 64.
1587	///
1588	/// # Arguments
1589	///
1590	/// * `address_size`: 16, 32, or 64
1591	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1592	///
1593	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1594	#[inline]
1595	#[rustfmt::skip]
1596	pub fn with_scasw(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1597		instruction_internal::with_string_reg_esrdi(Code::Scasw_AX_m16, address_size, Register::AX, rep_prefix)
1598	}
1599
1600	/// Creates a `REPE SCASW` instruction
1601	///
1602	/// # Errors
1603	///
1604	/// Fails if `address_size` is not one of 16, 32, 64.
1605	///
1606	/// # Arguments
1607	///
1608	/// * `address_size`: 16, 32, or 64
1609	#[inline]
1610	#[rustfmt::skip]
1611	pub fn with_repe_scasw(address_size: u32) -> Result<Self, IcedError> {
1612		instruction_internal::with_string_reg_esrdi(Code::Scasw_AX_m16, address_size, Register::AX, RepPrefixKind::Repe)
1613	}
1614
1615	/// Creates a `REPNE SCASW` instruction
1616	///
1617	/// # Errors
1618	///
1619	/// Fails if `address_size` is not one of 16, 32, 64.
1620	///
1621	/// # Arguments
1622	///
1623	/// * `address_size`: 16, 32, or 64
1624	#[inline]
1625	#[rustfmt::skip]
1626	pub fn with_repne_scasw(address_size: u32) -> Result<Self, IcedError> {
1627		instruction_internal::with_string_reg_esrdi(Code::Scasw_AX_m16, address_size, Register::AX, RepPrefixKind::Repne)
1628	}
1629
1630	/// Creates a `SCASD` instruction
1631	///
1632	/// # Errors
1633	///
1634	/// Fails if `address_size` is not one of 16, 32, 64.
1635	///
1636	/// # Arguments
1637	///
1638	/// * `address_size`: 16, 32, or 64
1639	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1640	///
1641	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1642	#[inline]
1643	#[rustfmt::skip]
1644	pub fn with_scasd(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1645		instruction_internal::with_string_reg_esrdi(Code::Scasd_EAX_m32, address_size, Register::EAX, rep_prefix)
1646	}
1647
1648	/// Creates a `REPE SCASD` instruction
1649	///
1650	/// # Errors
1651	///
1652	/// Fails if `address_size` is not one of 16, 32, 64.
1653	///
1654	/// # Arguments
1655	///
1656	/// * `address_size`: 16, 32, or 64
1657	#[inline]
1658	#[rustfmt::skip]
1659	pub fn with_repe_scasd(address_size: u32) -> Result<Self, IcedError> {
1660		instruction_internal::with_string_reg_esrdi(Code::Scasd_EAX_m32, address_size, Register::EAX, RepPrefixKind::Repe)
1661	}
1662
1663	/// Creates a `REPNE SCASD` instruction
1664	///
1665	/// # Errors
1666	///
1667	/// Fails if `address_size` is not one of 16, 32, 64.
1668	///
1669	/// # Arguments
1670	///
1671	/// * `address_size`: 16, 32, or 64
1672	#[inline]
1673	#[rustfmt::skip]
1674	pub fn with_repne_scasd(address_size: u32) -> Result<Self, IcedError> {
1675		instruction_internal::with_string_reg_esrdi(Code::Scasd_EAX_m32, address_size, Register::EAX, RepPrefixKind::Repne)
1676	}
1677
1678	/// Creates a `SCASQ` instruction
1679	///
1680	/// # Errors
1681	///
1682	/// Fails if `address_size` is not one of 16, 32, 64.
1683	///
1684	/// # Arguments
1685	///
1686	/// * `address_size`: 16, 32, or 64
1687	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1688	///
1689	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1690	#[inline]
1691	#[rustfmt::skip]
1692	pub fn with_scasq(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1693		instruction_internal::with_string_reg_esrdi(Code::Scasq_RAX_m64, address_size, Register::RAX, rep_prefix)
1694	}
1695
1696	/// Creates a `REPE SCASQ` instruction
1697	///
1698	/// # Errors
1699	///
1700	/// Fails if `address_size` is not one of 16, 32, 64.
1701	///
1702	/// # Arguments
1703	///
1704	/// * `address_size`: 16, 32, or 64
1705	#[inline]
1706	#[rustfmt::skip]
1707	pub fn with_repe_scasq(address_size: u32) -> Result<Self, IcedError> {
1708		instruction_internal::with_string_reg_esrdi(Code::Scasq_RAX_m64, address_size, Register::RAX, RepPrefixKind::Repe)
1709	}
1710
1711	/// Creates a `REPNE SCASQ` instruction
1712	///
1713	/// # Errors
1714	///
1715	/// Fails if `address_size` is not one of 16, 32, 64.
1716	///
1717	/// # Arguments
1718	///
1719	/// * `address_size`: 16, 32, or 64
1720	#[inline]
1721	#[rustfmt::skip]
1722	pub fn with_repne_scasq(address_size: u32) -> Result<Self, IcedError> {
1723		instruction_internal::with_string_reg_esrdi(Code::Scasq_RAX_m64, address_size, Register::RAX, RepPrefixKind::Repne)
1724	}
1725
1726	/// Creates a `INSB` instruction
1727	///
1728	/// # Errors
1729	///
1730	/// Fails if `address_size` is not one of 16, 32, 64.
1731	///
1732	/// # Arguments
1733	///
1734	/// * `address_size`: 16, 32, or 64
1735	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1736	///
1737	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1738	#[inline]
1739	#[rustfmt::skip]
1740	pub fn with_insb(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1741		instruction_internal::with_string_esrdi_reg(Code::Insb_m8_DX, address_size, Register::DX, rep_prefix)
1742	}
1743
1744	/// Creates a `REP INSB` instruction
1745	///
1746	/// # Errors
1747	///
1748	/// Fails if `address_size` is not one of 16, 32, 64.
1749	///
1750	/// # Arguments
1751	///
1752	/// * `address_size`: 16, 32, or 64
1753	#[inline]
1754	#[rustfmt::skip]
1755	pub fn with_rep_insb(address_size: u32) -> Result<Self, IcedError> {
1756		instruction_internal::with_string_esrdi_reg(Code::Insb_m8_DX, address_size, Register::DX, RepPrefixKind::Repe)
1757	}
1758
1759	/// Creates a `INSW` instruction
1760	///
1761	/// # Errors
1762	///
1763	/// Fails if `address_size` is not one of 16, 32, 64.
1764	///
1765	/// # Arguments
1766	///
1767	/// * `address_size`: 16, 32, or 64
1768	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1769	///
1770	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1771	#[inline]
1772	#[rustfmt::skip]
1773	pub fn with_insw(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1774		instruction_internal::with_string_esrdi_reg(Code::Insw_m16_DX, address_size, Register::DX, rep_prefix)
1775	}
1776
1777	/// Creates a `REP INSW` instruction
1778	///
1779	/// # Errors
1780	///
1781	/// Fails if `address_size` is not one of 16, 32, 64.
1782	///
1783	/// # Arguments
1784	///
1785	/// * `address_size`: 16, 32, or 64
1786	#[inline]
1787	#[rustfmt::skip]
1788	pub fn with_rep_insw(address_size: u32) -> Result<Self, IcedError> {
1789		instruction_internal::with_string_esrdi_reg(Code::Insw_m16_DX, address_size, Register::DX, RepPrefixKind::Repe)
1790	}
1791
1792	/// Creates a `INSD` instruction
1793	///
1794	/// # Errors
1795	///
1796	/// Fails if `address_size` is not one of 16, 32, 64.
1797	///
1798	/// # Arguments
1799	///
1800	/// * `address_size`: 16, 32, or 64
1801	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1802	///
1803	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1804	#[inline]
1805	#[rustfmt::skip]
1806	pub fn with_insd(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1807		instruction_internal::with_string_esrdi_reg(Code::Insd_m32_DX, address_size, Register::DX, rep_prefix)
1808	}
1809
1810	/// Creates a `REP INSD` instruction
1811	///
1812	/// # Errors
1813	///
1814	/// Fails if `address_size` is not one of 16, 32, 64.
1815	///
1816	/// # Arguments
1817	///
1818	/// * `address_size`: 16, 32, or 64
1819	#[inline]
1820	#[rustfmt::skip]
1821	pub fn with_rep_insd(address_size: u32) -> Result<Self, IcedError> {
1822		instruction_internal::with_string_esrdi_reg(Code::Insd_m32_DX, address_size, Register::DX, RepPrefixKind::Repe)
1823	}
1824
1825	/// Creates a `STOSB` instruction
1826	///
1827	/// # Errors
1828	///
1829	/// Fails if `address_size` is not one of 16, 32, 64.
1830	///
1831	/// # Arguments
1832	///
1833	/// * `address_size`: 16, 32, or 64
1834	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1835	///
1836	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1837	#[inline]
1838	#[rustfmt::skip]
1839	pub fn with_stosb(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1840		instruction_internal::with_string_esrdi_reg(Code::Stosb_m8_AL, address_size, Register::AL, rep_prefix)
1841	}
1842
1843	/// Creates a `REP STOSB` instruction
1844	///
1845	/// # Errors
1846	///
1847	/// Fails if `address_size` is not one of 16, 32, 64.
1848	///
1849	/// # Arguments
1850	///
1851	/// * `address_size`: 16, 32, or 64
1852	#[inline]
1853	#[rustfmt::skip]
1854	pub fn with_rep_stosb(address_size: u32) -> Result<Self, IcedError> {
1855		instruction_internal::with_string_esrdi_reg(Code::Stosb_m8_AL, address_size, Register::AL, RepPrefixKind::Repe)
1856	}
1857
1858	/// Creates a `STOSW` instruction
1859	///
1860	/// # Errors
1861	///
1862	/// Fails if `address_size` is not one of 16, 32, 64.
1863	///
1864	/// # Arguments
1865	///
1866	/// * `address_size`: 16, 32, or 64
1867	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1868	///
1869	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1870	#[inline]
1871	#[rustfmt::skip]
1872	pub fn with_stosw(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1873		instruction_internal::with_string_esrdi_reg(Code::Stosw_m16_AX, address_size, Register::AX, rep_prefix)
1874	}
1875
1876	/// Creates a `REP STOSW` instruction
1877	///
1878	/// # Errors
1879	///
1880	/// Fails if `address_size` is not one of 16, 32, 64.
1881	///
1882	/// # Arguments
1883	///
1884	/// * `address_size`: 16, 32, or 64
1885	#[inline]
1886	#[rustfmt::skip]
1887	pub fn with_rep_stosw(address_size: u32) -> Result<Self, IcedError> {
1888		instruction_internal::with_string_esrdi_reg(Code::Stosw_m16_AX, address_size, Register::AX, RepPrefixKind::Repe)
1889	}
1890
1891	/// Creates a `STOSD` instruction
1892	///
1893	/// # Errors
1894	///
1895	/// Fails if `address_size` is not one of 16, 32, 64.
1896	///
1897	/// # Arguments
1898	///
1899	/// * `address_size`: 16, 32, or 64
1900	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1901	///
1902	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1903	#[inline]
1904	#[rustfmt::skip]
1905	pub fn with_stosd(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1906		instruction_internal::with_string_esrdi_reg(Code::Stosd_m32_EAX, address_size, Register::EAX, rep_prefix)
1907	}
1908
1909	/// Creates a `REP STOSD` instruction
1910	///
1911	/// # Errors
1912	///
1913	/// Fails if `address_size` is not one of 16, 32, 64.
1914	///
1915	/// # Arguments
1916	///
1917	/// * `address_size`: 16, 32, or 64
1918	#[inline]
1919	#[rustfmt::skip]
1920	pub fn with_rep_stosd(address_size: u32) -> Result<Self, IcedError> {
1921		instruction_internal::with_string_esrdi_reg(Code::Stosd_m32_EAX, address_size, Register::EAX, RepPrefixKind::Repe)
1922	}
1923
1924	/// Creates a `STOSQ` instruction
1925	///
1926	/// # Errors
1927	///
1928	/// Fails if `address_size` is not one of 16, 32, 64.
1929	///
1930	/// # Arguments
1931	///
1932	/// * `address_size`: 16, 32, or 64
1933	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1934	///
1935	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1936	#[inline]
1937	#[rustfmt::skip]
1938	pub fn with_stosq(address_size: u32, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1939		instruction_internal::with_string_esrdi_reg(Code::Stosq_m64_RAX, address_size, Register::RAX, rep_prefix)
1940	}
1941
1942	/// Creates a `REP STOSQ` instruction
1943	///
1944	/// # Errors
1945	///
1946	/// Fails if `address_size` is not one of 16, 32, 64.
1947	///
1948	/// # Arguments
1949	///
1950	/// * `address_size`: 16, 32, or 64
1951	#[inline]
1952	#[rustfmt::skip]
1953	pub fn with_rep_stosq(address_size: u32) -> Result<Self, IcedError> {
1954		instruction_internal::with_string_esrdi_reg(Code::Stosq_m64_RAX, address_size, Register::RAX, RepPrefixKind::Repe)
1955	}
1956
1957	/// Creates a `CMPSB` instruction
1958	///
1959	/// # Errors
1960	///
1961	/// Fails if `address_size` is not one of 16, 32, 64.
1962	///
1963	/// # Arguments
1964	///
1965	/// * `address_size`: 16, 32, or 64
1966	/// * `segment_prefix`: Segment override or [`Register::None`]
1967	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
1968	///
1969	/// [`Register::None`]: enum.Register.html#variant.None
1970	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
1971	#[inline]
1972	#[rustfmt::skip]
1973	pub fn with_cmpsb(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
1974		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsb_m8_m8, address_size, segment_prefix, rep_prefix)
1975	}
1976
1977	/// Creates a `REPE CMPSB` instruction
1978	///
1979	/// # Errors
1980	///
1981	/// Fails if `address_size` is not one of 16, 32, 64.
1982	///
1983	/// # Arguments
1984	///
1985	/// * `address_size`: 16, 32, or 64
1986	#[inline]
1987	#[rustfmt::skip]
1988	pub fn with_repe_cmpsb(address_size: u32) -> Result<Self, IcedError> {
1989		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsb_m8_m8, address_size, Register::None, RepPrefixKind::Repe)
1990	}
1991
1992	/// Creates a `REPNE CMPSB` instruction
1993	///
1994	/// # Errors
1995	///
1996	/// Fails if `address_size` is not one of 16, 32, 64.
1997	///
1998	/// # Arguments
1999	///
2000	/// * `address_size`: 16, 32, or 64
2001	#[inline]
2002	#[rustfmt::skip]
2003	pub fn with_repne_cmpsb(address_size: u32) -> Result<Self, IcedError> {
2004		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsb_m8_m8, address_size, Register::None, RepPrefixKind::Repne)
2005	}
2006
2007	/// Creates a `CMPSW` instruction
2008	///
2009	/// # Errors
2010	///
2011	/// Fails if `address_size` is not one of 16, 32, 64.
2012	///
2013	/// # Arguments
2014	///
2015	/// * `address_size`: 16, 32, or 64
2016	/// * `segment_prefix`: Segment override or [`Register::None`]
2017	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2018	///
2019	/// [`Register::None`]: enum.Register.html#variant.None
2020	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2021	#[inline]
2022	#[rustfmt::skip]
2023	pub fn with_cmpsw(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2024		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsw_m16_m16, address_size, segment_prefix, rep_prefix)
2025	}
2026
2027	/// Creates a `REPE CMPSW` instruction
2028	///
2029	/// # Errors
2030	///
2031	/// Fails if `address_size` is not one of 16, 32, 64.
2032	///
2033	/// # Arguments
2034	///
2035	/// * `address_size`: 16, 32, or 64
2036	#[inline]
2037	#[rustfmt::skip]
2038	pub fn with_repe_cmpsw(address_size: u32) -> Result<Self, IcedError> {
2039		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsw_m16_m16, address_size, Register::None, RepPrefixKind::Repe)
2040	}
2041
2042	/// Creates a `REPNE CMPSW` instruction
2043	///
2044	/// # Errors
2045	///
2046	/// Fails if `address_size` is not one of 16, 32, 64.
2047	///
2048	/// # Arguments
2049	///
2050	/// * `address_size`: 16, 32, or 64
2051	#[inline]
2052	#[rustfmt::skip]
2053	pub fn with_repne_cmpsw(address_size: u32) -> Result<Self, IcedError> {
2054		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsw_m16_m16, address_size, Register::None, RepPrefixKind::Repne)
2055	}
2056
2057	/// Creates a `CMPSD` instruction
2058	///
2059	/// # Errors
2060	///
2061	/// Fails if `address_size` is not one of 16, 32, 64.
2062	///
2063	/// # Arguments
2064	///
2065	/// * `address_size`: 16, 32, or 64
2066	/// * `segment_prefix`: Segment override or [`Register::None`]
2067	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2068	///
2069	/// [`Register::None`]: enum.Register.html#variant.None
2070	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2071	#[inline]
2072	#[rustfmt::skip]
2073	pub fn with_cmpsd(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2074		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsd_m32_m32, address_size, segment_prefix, rep_prefix)
2075	}
2076
2077	/// Creates a `REPE CMPSD` instruction
2078	///
2079	/// # Errors
2080	///
2081	/// Fails if `address_size` is not one of 16, 32, 64.
2082	///
2083	/// # Arguments
2084	///
2085	/// * `address_size`: 16, 32, or 64
2086	#[inline]
2087	#[rustfmt::skip]
2088	pub fn with_repe_cmpsd(address_size: u32) -> Result<Self, IcedError> {
2089		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsd_m32_m32, address_size, Register::None, RepPrefixKind::Repe)
2090	}
2091
2092	/// Creates a `REPNE CMPSD` instruction
2093	///
2094	/// # Errors
2095	///
2096	/// Fails if `address_size` is not one of 16, 32, 64.
2097	///
2098	/// # Arguments
2099	///
2100	/// * `address_size`: 16, 32, or 64
2101	#[inline]
2102	#[rustfmt::skip]
2103	pub fn with_repne_cmpsd(address_size: u32) -> Result<Self, IcedError> {
2104		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsd_m32_m32, address_size, Register::None, RepPrefixKind::Repne)
2105	}
2106
2107	/// Creates a `CMPSQ` instruction
2108	///
2109	/// # Errors
2110	///
2111	/// Fails if `address_size` is not one of 16, 32, 64.
2112	///
2113	/// # Arguments
2114	///
2115	/// * `address_size`: 16, 32, or 64
2116	/// * `segment_prefix`: Segment override or [`Register::None`]
2117	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2118	///
2119	/// [`Register::None`]: enum.Register.html#variant.None
2120	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2121	#[inline]
2122	#[rustfmt::skip]
2123	pub fn with_cmpsq(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2124		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsq_m64_m64, address_size, segment_prefix, rep_prefix)
2125	}
2126
2127	/// Creates a `REPE CMPSQ` instruction
2128	///
2129	/// # Errors
2130	///
2131	/// Fails if `address_size` is not one of 16, 32, 64.
2132	///
2133	/// # Arguments
2134	///
2135	/// * `address_size`: 16, 32, or 64
2136	#[inline]
2137	#[rustfmt::skip]
2138	pub fn with_repe_cmpsq(address_size: u32) -> Result<Self, IcedError> {
2139		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsq_m64_m64, address_size, Register::None, RepPrefixKind::Repe)
2140	}
2141
2142	/// Creates a `REPNE CMPSQ` instruction
2143	///
2144	/// # Errors
2145	///
2146	/// Fails if `address_size` is not one of 16, 32, 64.
2147	///
2148	/// # Arguments
2149	///
2150	/// * `address_size`: 16, 32, or 64
2151	#[inline]
2152	#[rustfmt::skip]
2153	pub fn with_repne_cmpsq(address_size: u32) -> Result<Self, IcedError> {
2154		instruction_internal::with_string_segrsi_esrdi(Code::Cmpsq_m64_m64, address_size, Register::None, RepPrefixKind::Repne)
2155	}
2156
2157	/// Creates a `MOVSB` instruction
2158	///
2159	/// # Errors
2160	///
2161	/// Fails if `address_size` is not one of 16, 32, 64.
2162	///
2163	/// # Arguments
2164	///
2165	/// * `address_size`: 16, 32, or 64
2166	/// * `segment_prefix`: Segment override or [`Register::None`]
2167	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2168	///
2169	/// [`Register::None`]: enum.Register.html#variant.None
2170	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2171	#[inline]
2172	#[rustfmt::skip]
2173	pub fn with_movsb(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2174		instruction_internal::with_string_esrdi_segrsi(Code::Movsb_m8_m8, address_size, segment_prefix, rep_prefix)
2175	}
2176
2177	/// Creates a `REP MOVSB` instruction
2178	///
2179	/// # Errors
2180	///
2181	/// Fails if `address_size` is not one of 16, 32, 64.
2182	///
2183	/// # Arguments
2184	///
2185	/// * `address_size`: 16, 32, or 64
2186	#[inline]
2187	#[rustfmt::skip]
2188	pub fn with_rep_movsb(address_size: u32) -> Result<Self, IcedError> {
2189		instruction_internal::with_string_esrdi_segrsi(Code::Movsb_m8_m8, address_size, Register::None, RepPrefixKind::Repe)
2190	}
2191
2192	/// Creates a `MOVSW` instruction
2193	///
2194	/// # Errors
2195	///
2196	/// Fails if `address_size` is not one of 16, 32, 64.
2197	///
2198	/// # Arguments
2199	///
2200	/// * `address_size`: 16, 32, or 64
2201	/// * `segment_prefix`: Segment override or [`Register::None`]
2202	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2203	///
2204	/// [`Register::None`]: enum.Register.html#variant.None
2205	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2206	#[inline]
2207	#[rustfmt::skip]
2208	pub fn with_movsw(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2209		instruction_internal::with_string_esrdi_segrsi(Code::Movsw_m16_m16, address_size, segment_prefix, rep_prefix)
2210	}
2211
2212	/// Creates a `REP MOVSW` instruction
2213	///
2214	/// # Errors
2215	///
2216	/// Fails if `address_size` is not one of 16, 32, 64.
2217	///
2218	/// # Arguments
2219	///
2220	/// * `address_size`: 16, 32, or 64
2221	#[inline]
2222	#[rustfmt::skip]
2223	pub fn with_rep_movsw(address_size: u32) -> Result<Self, IcedError> {
2224		instruction_internal::with_string_esrdi_segrsi(Code::Movsw_m16_m16, address_size, Register::None, RepPrefixKind::Repe)
2225	}
2226
2227	/// Creates a `MOVSD` instruction
2228	///
2229	/// # Errors
2230	///
2231	/// Fails if `address_size` is not one of 16, 32, 64.
2232	///
2233	/// # Arguments
2234	///
2235	/// * `address_size`: 16, 32, or 64
2236	/// * `segment_prefix`: Segment override or [`Register::None`]
2237	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2238	///
2239	/// [`Register::None`]: enum.Register.html#variant.None
2240	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2241	#[inline]
2242	#[rustfmt::skip]
2243	pub fn with_movsd(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2244		instruction_internal::with_string_esrdi_segrsi(Code::Movsd_m32_m32, address_size, segment_prefix, rep_prefix)
2245	}
2246
2247	/// Creates a `REP MOVSD` instruction
2248	///
2249	/// # Errors
2250	///
2251	/// Fails if `address_size` is not one of 16, 32, 64.
2252	///
2253	/// # Arguments
2254	///
2255	/// * `address_size`: 16, 32, or 64
2256	#[inline]
2257	#[rustfmt::skip]
2258	pub fn with_rep_movsd(address_size: u32) -> Result<Self, IcedError> {
2259		instruction_internal::with_string_esrdi_segrsi(Code::Movsd_m32_m32, address_size, Register::None, RepPrefixKind::Repe)
2260	}
2261
2262	/// Creates a `MOVSQ` instruction
2263	///
2264	/// # Errors
2265	///
2266	/// Fails if `address_size` is not one of 16, 32, 64.
2267	///
2268	/// # Arguments
2269	///
2270	/// * `address_size`: 16, 32, or 64
2271	/// * `segment_prefix`: Segment override or [`Register::None`]
2272	/// * `rep_prefix`: Rep prefix or [`RepPrefixKind::None`]
2273	///
2274	/// [`Register::None`]: enum.Register.html#variant.None
2275	/// [`RepPrefixKind::None`]: enum.RepPrefixKind.html#variant.None
2276	#[inline]
2277	#[rustfmt::skip]
2278	pub fn with_movsq(address_size: u32, segment_prefix: Register, rep_prefix: RepPrefixKind) -> Result<Self, IcedError> {
2279		instruction_internal::with_string_esrdi_segrsi(Code::Movsq_m64_m64, address_size, segment_prefix, rep_prefix)
2280	}
2281
2282	/// Creates a `REP MOVSQ` instruction
2283	///
2284	/// # Errors
2285	///
2286	/// Fails if `address_size` is not one of 16, 32, 64.
2287	///
2288	/// # Arguments
2289	///
2290	/// * `address_size`: 16, 32, or 64
2291	#[inline]
2292	#[rustfmt::skip]
2293	pub fn with_rep_movsq(address_size: u32) -> Result<Self, IcedError> {
2294		instruction_internal::with_string_esrdi_segrsi(Code::Movsq_m64_m64, address_size, Register::None, RepPrefixKind::Repe)
2295	}
2296
2297	/// Creates a `MASKMOVQ` instruction
2298	///
2299	/// # Errors
2300	///
2301	/// Fails if `address_size` is not one of 16, 32, 64.
2302	///
2303	/// # Arguments
2304	///
2305	/// * `address_size`: 16, 32, or 64
2306	/// * `register1`: Register
2307	/// * `register2`: Register
2308	/// * `segment_prefix`: Segment override or [`Register::None`]
2309	///
2310	/// [`Register::None`]: enum.Register.html#variant.None
2311	#[inline]
2312	#[rustfmt::skip]
2313	pub fn with_maskmovq(address_size: u32, register1: Register, register2: Register, segment_prefix: Register) -> Result<Self, IcedError> {
2314		instruction_internal::with_maskmov(Code::Maskmovq_rDI_mm_mm, address_size, register1, register2, segment_prefix)
2315	}
2316
2317	/// Creates a `MASKMOVDQU` instruction
2318	///
2319	/// # Errors
2320	///
2321	/// Fails if `address_size` is not one of 16, 32, 64.
2322	///
2323	/// # Arguments
2324	///
2325	/// * `address_size`: 16, 32, or 64
2326	/// * `register1`: Register
2327	/// * `register2`: Register
2328	/// * `segment_prefix`: Segment override or [`Register::None`]
2329	///
2330	/// [`Register::None`]: enum.Register.html#variant.None
2331	#[inline]
2332	#[rustfmt::skip]
2333	pub fn with_maskmovdqu(address_size: u32, register1: Register, register2: Register, segment_prefix: Register) -> Result<Self, IcedError> {
2334		instruction_internal::with_maskmov(Code::Maskmovdqu_rDI_xmm_xmm, address_size, register1, register2, segment_prefix)
2335	}
2336
2337	/// Creates a `VMASKMOVDQU` instruction
2338	///
2339	/// # Errors
2340	///
2341	/// Fails if `address_size` is not one of 16, 32, 64.
2342	///
2343	/// # Arguments
2344	///
2345	/// * `address_size`: 16, 32, or 64
2346	/// * `register1`: Register
2347	/// * `register2`: Register
2348	/// * `segment_prefix`: Segment override or [`Register::None`]
2349	///
2350	/// [`Register::None`]: enum.Register.html#variant.None
2351	#[inline]
2352	#[rustfmt::skip]
2353	pub fn with_vmaskmovdqu(address_size: u32, register1: Register, register2: Register, segment_prefix: Register) -> Result<Self, IcedError> {
2354		instruction_internal::with_maskmov(Code::VEX_Vmaskmovdqu_rDI_xmm_xmm, address_size, register1, register2, segment_prefix)
2355	}
2356
2357	#[doc(hidden)]
2358	#[allow(clippy::missing_inline_in_public_items)]
2359	#[rustfmt::skip]
2360	pub fn try_with_declare_byte_1(b0: u8) -> Result<Self, IcedError> {
2361		let mut instruction = Self::default();
2362		instruction.set_code(Code::DeclareByte);
2363		instruction_internal::internal_set_declare_data_len(&mut instruction, 1);
2364
2365		instruction.try_set_declare_byte_value(0, b0)?;
2366
2367		debug_assert_eq!(instruction.op_count(), 0);
2368		Ok(instruction)
2369	}
2370
2371	/// Creates a `db`/`.byte` asm directive
2372	///
2373	/// # Arguments
2374	///
2375	/// * `b0`: Byte 0
2376	#[allow(clippy::unwrap_used)]
2377	#[must_use]
2378	#[inline]
2379	#[rustfmt::skip]
2380	pub fn with_declare_byte_1(b0: u8) -> Self {
2381		Instruction::try_with_declare_byte_1(b0).unwrap()
2382	}
2383
2384	#[doc(hidden)]
2385	#[allow(clippy::missing_inline_in_public_items)]
2386	#[rustfmt::skip]
2387	pub fn try_with_declare_byte_2(b0: u8, b1: u8) -> Result<Self, IcedError> {
2388		let mut instruction = Self::default();
2389		instruction.set_code(Code::DeclareByte);
2390		instruction_internal::internal_set_declare_data_len(&mut instruction, 2);
2391
2392		instruction.try_set_declare_byte_value(0, b0)?;
2393		instruction.try_set_declare_byte_value(1, b1)?;
2394
2395		debug_assert_eq!(instruction.op_count(), 0);
2396		Ok(instruction)
2397	}
2398
2399	/// Creates a `db`/`.byte` asm directive
2400	///
2401	/// # Arguments
2402	///
2403	/// * `b0`: Byte 0
2404	/// * `b1`: Byte 1
2405	#[allow(clippy::unwrap_used)]
2406	#[must_use]
2407	#[inline]
2408	#[rustfmt::skip]
2409	pub fn with_declare_byte_2(b0: u8, b1: u8) -> Self {
2410		Instruction::try_with_declare_byte_2(b0, b1).unwrap()
2411	}
2412
2413	#[doc(hidden)]
2414	#[allow(clippy::missing_inline_in_public_items)]
2415	#[rustfmt::skip]
2416	pub fn try_with_declare_byte_3(b0: u8, b1: u8, b2: u8) -> Result<Self, IcedError> {
2417		let mut instruction = Self::default();
2418		instruction.set_code(Code::DeclareByte);
2419		instruction_internal::internal_set_declare_data_len(&mut instruction, 3);
2420
2421		instruction.try_set_declare_byte_value(0, b0)?;
2422		instruction.try_set_declare_byte_value(1, b1)?;
2423		instruction.try_set_declare_byte_value(2, b2)?;
2424
2425		debug_assert_eq!(instruction.op_count(), 0);
2426		Ok(instruction)
2427	}
2428
2429	/// Creates a `db`/`.byte` asm directive
2430	///
2431	/// # Arguments
2432	///
2433	/// * `b0`: Byte 0
2434	/// * `b1`: Byte 1
2435	/// * `b2`: Byte 2
2436	#[allow(clippy::unwrap_used)]
2437	#[must_use]
2438	#[inline]
2439	#[rustfmt::skip]
2440	pub fn with_declare_byte_3(b0: u8, b1: u8, b2: u8) -> Self {
2441		Instruction::try_with_declare_byte_3(b0, b1, b2).unwrap()
2442	}
2443
2444	#[doc(hidden)]
2445	#[allow(clippy::missing_inline_in_public_items)]
2446	#[rustfmt::skip]
2447	pub fn try_with_declare_byte_4(b0: u8, b1: u8, b2: u8, b3: u8) -> Result<Self, IcedError> {
2448		let mut instruction = Self::default();
2449		instruction.set_code(Code::DeclareByte);
2450		instruction_internal::internal_set_declare_data_len(&mut instruction, 4);
2451
2452		instruction.try_set_declare_byte_value(0, b0)?;
2453		instruction.try_set_declare_byte_value(1, b1)?;
2454		instruction.try_set_declare_byte_value(2, b2)?;
2455		instruction.try_set_declare_byte_value(3, b3)?;
2456
2457		debug_assert_eq!(instruction.op_count(), 0);
2458		Ok(instruction)
2459	}
2460
2461	/// Creates a `db`/`.byte` asm directive
2462	///
2463	/// # Arguments
2464	///
2465	/// * `b0`: Byte 0
2466	/// * `b1`: Byte 1
2467	/// * `b2`: Byte 2
2468	/// * `b3`: Byte 3
2469	#[allow(clippy::unwrap_used)]
2470	#[must_use]
2471	#[inline]
2472	#[rustfmt::skip]
2473	pub fn with_declare_byte_4(b0: u8, b1: u8, b2: u8, b3: u8) -> Self {
2474		Instruction::try_with_declare_byte_4(b0, b1, b2, b3).unwrap()
2475	}
2476
2477	#[doc(hidden)]
2478	#[allow(clippy::missing_inline_in_public_items)]
2479	#[rustfmt::skip]
2480	pub fn try_with_declare_byte_5(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8) -> Result<Self, IcedError> {
2481		let mut instruction = Self::default();
2482		instruction.set_code(Code::DeclareByte);
2483		instruction_internal::internal_set_declare_data_len(&mut instruction, 5);
2484
2485		instruction.try_set_declare_byte_value(0, b0)?;
2486		instruction.try_set_declare_byte_value(1, b1)?;
2487		instruction.try_set_declare_byte_value(2, b2)?;
2488		instruction.try_set_declare_byte_value(3, b3)?;
2489		instruction.try_set_declare_byte_value(4, b4)?;
2490
2491		debug_assert_eq!(instruction.op_count(), 0);
2492		Ok(instruction)
2493	}
2494
2495	/// Creates a `db`/`.byte` asm directive
2496	///
2497	/// # Arguments
2498	///
2499	/// * `b0`: Byte 0
2500	/// * `b1`: Byte 1
2501	/// * `b2`: Byte 2
2502	/// * `b3`: Byte 3
2503	/// * `b4`: Byte 4
2504	#[allow(clippy::unwrap_used)]
2505	#[must_use]
2506	#[inline]
2507	#[rustfmt::skip]
2508	pub fn with_declare_byte_5(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8) -> Self {
2509		Instruction::try_with_declare_byte_5(b0, b1, b2, b3, b4).unwrap()
2510	}
2511
2512	#[doc(hidden)]
2513	#[allow(clippy::missing_inline_in_public_items)]
2514	#[rustfmt::skip]
2515	pub fn try_with_declare_byte_6(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8) -> Result<Self, IcedError> {
2516		let mut instruction = Self::default();
2517		instruction.set_code(Code::DeclareByte);
2518		instruction_internal::internal_set_declare_data_len(&mut instruction, 6);
2519
2520		instruction.try_set_declare_byte_value(0, b0)?;
2521		instruction.try_set_declare_byte_value(1, b1)?;
2522		instruction.try_set_declare_byte_value(2, b2)?;
2523		instruction.try_set_declare_byte_value(3, b3)?;
2524		instruction.try_set_declare_byte_value(4, b4)?;
2525		instruction.try_set_declare_byte_value(5, b5)?;
2526
2527		debug_assert_eq!(instruction.op_count(), 0);
2528		Ok(instruction)
2529	}
2530
2531	/// Creates a `db`/`.byte` asm directive
2532	///
2533	/// # Arguments
2534	///
2535	/// * `b0`: Byte 0
2536	/// * `b1`: Byte 1
2537	/// * `b2`: Byte 2
2538	/// * `b3`: Byte 3
2539	/// * `b4`: Byte 4
2540	/// * `b5`: Byte 5
2541	#[allow(clippy::unwrap_used)]
2542	#[must_use]
2543	#[inline]
2544	#[rustfmt::skip]
2545	pub fn with_declare_byte_6(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8) -> Self {
2546		Instruction::try_with_declare_byte_6(b0, b1, b2, b3, b4, b5).unwrap()
2547	}
2548
2549	#[doc(hidden)]
2550	#[allow(clippy::missing_inline_in_public_items)]
2551	#[rustfmt::skip]
2552	pub fn try_with_declare_byte_7(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8) -> Result<Self, IcedError> {
2553		let mut instruction = Self::default();
2554		instruction.set_code(Code::DeclareByte);
2555		instruction_internal::internal_set_declare_data_len(&mut instruction, 7);
2556
2557		instruction.try_set_declare_byte_value(0, b0)?;
2558		instruction.try_set_declare_byte_value(1, b1)?;
2559		instruction.try_set_declare_byte_value(2, b2)?;
2560		instruction.try_set_declare_byte_value(3, b3)?;
2561		instruction.try_set_declare_byte_value(4, b4)?;
2562		instruction.try_set_declare_byte_value(5, b5)?;
2563		instruction.try_set_declare_byte_value(6, b6)?;
2564
2565		debug_assert_eq!(instruction.op_count(), 0);
2566		Ok(instruction)
2567	}
2568
2569	/// Creates a `db`/`.byte` asm directive
2570	///
2571	/// # Arguments
2572	///
2573	/// * `b0`: Byte 0
2574	/// * `b1`: Byte 1
2575	/// * `b2`: Byte 2
2576	/// * `b3`: Byte 3
2577	/// * `b4`: Byte 4
2578	/// * `b5`: Byte 5
2579	/// * `b6`: Byte 6
2580	#[allow(clippy::unwrap_used)]
2581	#[must_use]
2582	#[inline]
2583	#[rustfmt::skip]
2584	pub fn with_declare_byte_7(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8) -> Self {
2585		Instruction::try_with_declare_byte_7(b0, b1, b2, b3, b4, b5, b6).unwrap()
2586	}
2587
2588	#[doc(hidden)]
2589	#[allow(clippy::missing_inline_in_public_items)]
2590	#[rustfmt::skip]
2591	pub fn try_with_declare_byte_8(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8) -> Result<Self, IcedError> {
2592		let mut instruction = Self::default();
2593		instruction.set_code(Code::DeclareByte);
2594		instruction_internal::internal_set_declare_data_len(&mut instruction, 8);
2595
2596		instruction.try_set_declare_byte_value(0, b0)?;
2597		instruction.try_set_declare_byte_value(1, b1)?;
2598		instruction.try_set_declare_byte_value(2, b2)?;
2599		instruction.try_set_declare_byte_value(3, b3)?;
2600		instruction.try_set_declare_byte_value(4, b4)?;
2601		instruction.try_set_declare_byte_value(5, b5)?;
2602		instruction.try_set_declare_byte_value(6, b6)?;
2603		instruction.try_set_declare_byte_value(7, b7)?;
2604
2605		debug_assert_eq!(instruction.op_count(), 0);
2606		Ok(instruction)
2607	}
2608
2609	/// Creates a `db`/`.byte` asm directive
2610	///
2611	/// # Arguments
2612	///
2613	/// * `b0`: Byte 0
2614	/// * `b1`: Byte 1
2615	/// * `b2`: Byte 2
2616	/// * `b3`: Byte 3
2617	/// * `b4`: Byte 4
2618	/// * `b5`: Byte 5
2619	/// * `b6`: Byte 6
2620	/// * `b7`: Byte 7
2621	#[allow(clippy::unwrap_used)]
2622	#[must_use]
2623	#[inline]
2624	#[rustfmt::skip]
2625	pub fn with_declare_byte_8(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8) -> Self {
2626		Instruction::try_with_declare_byte_8(b0, b1, b2, b3, b4, b5, b6, b7).unwrap()
2627	}
2628
2629	#[doc(hidden)]
2630	#[allow(clippy::missing_inline_in_public_items)]
2631	#[rustfmt::skip]
2632	pub fn try_with_declare_byte_9(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8) -> Result<Self, IcedError> {
2633		let mut instruction = Self::default();
2634		instruction.set_code(Code::DeclareByte);
2635		instruction_internal::internal_set_declare_data_len(&mut instruction, 9);
2636
2637		instruction.try_set_declare_byte_value(0, b0)?;
2638		instruction.try_set_declare_byte_value(1, b1)?;
2639		instruction.try_set_declare_byte_value(2, b2)?;
2640		instruction.try_set_declare_byte_value(3, b3)?;
2641		instruction.try_set_declare_byte_value(4, b4)?;
2642		instruction.try_set_declare_byte_value(5, b5)?;
2643		instruction.try_set_declare_byte_value(6, b6)?;
2644		instruction.try_set_declare_byte_value(7, b7)?;
2645		instruction.try_set_declare_byte_value(8, b8)?;
2646
2647		debug_assert_eq!(instruction.op_count(), 0);
2648		Ok(instruction)
2649	}
2650
2651	/// Creates a `db`/`.byte` asm directive
2652	///
2653	/// # Arguments
2654	///
2655	/// * `b0`: Byte 0
2656	/// * `b1`: Byte 1
2657	/// * `b2`: Byte 2
2658	/// * `b3`: Byte 3
2659	/// * `b4`: Byte 4
2660	/// * `b5`: Byte 5
2661	/// * `b6`: Byte 6
2662	/// * `b7`: Byte 7
2663	/// * `b8`: Byte 8
2664	#[allow(clippy::unwrap_used)]
2665	#[must_use]
2666	#[inline]
2667	#[rustfmt::skip]
2668	pub fn with_declare_byte_9(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8) -> Self {
2669		Instruction::try_with_declare_byte_9(b0, b1, b2, b3, b4, b5, b6, b7, b8).unwrap()
2670	}
2671
2672	#[doc(hidden)]
2673	#[allow(clippy::missing_inline_in_public_items)]
2674	#[rustfmt::skip]
2675	pub fn try_with_declare_byte_10(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8) -> Result<Self, IcedError> {
2676		let mut instruction = Self::default();
2677		instruction.set_code(Code::DeclareByte);
2678		instruction_internal::internal_set_declare_data_len(&mut instruction, 10);
2679
2680		instruction.try_set_declare_byte_value(0, b0)?;
2681		instruction.try_set_declare_byte_value(1, b1)?;
2682		instruction.try_set_declare_byte_value(2, b2)?;
2683		instruction.try_set_declare_byte_value(3, b3)?;
2684		instruction.try_set_declare_byte_value(4, b4)?;
2685		instruction.try_set_declare_byte_value(5, b5)?;
2686		instruction.try_set_declare_byte_value(6, b6)?;
2687		instruction.try_set_declare_byte_value(7, b7)?;
2688		instruction.try_set_declare_byte_value(8, b8)?;
2689		instruction.try_set_declare_byte_value(9, b9)?;
2690
2691		debug_assert_eq!(instruction.op_count(), 0);
2692		Ok(instruction)
2693	}
2694
2695	/// Creates a `db`/`.byte` asm directive
2696	///
2697	/// # Arguments
2698	///
2699	/// * `b0`: Byte 0
2700	/// * `b1`: Byte 1
2701	/// * `b2`: Byte 2
2702	/// * `b3`: Byte 3
2703	/// * `b4`: Byte 4
2704	/// * `b5`: Byte 5
2705	/// * `b6`: Byte 6
2706	/// * `b7`: Byte 7
2707	/// * `b8`: Byte 8
2708	/// * `b9`: Byte 9
2709	#[allow(clippy::unwrap_used)]
2710	#[must_use]
2711	#[inline]
2712	#[rustfmt::skip]
2713	pub fn with_declare_byte_10(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8) -> Self {
2714		Instruction::try_with_declare_byte_10(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9).unwrap()
2715	}
2716
2717	#[doc(hidden)]
2718	#[allow(clippy::missing_inline_in_public_items)]
2719	#[rustfmt::skip]
2720	pub fn try_with_declare_byte_11(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8) -> Result<Self, IcedError> {
2721		let mut instruction = Self::default();
2722		instruction.set_code(Code::DeclareByte);
2723		instruction_internal::internal_set_declare_data_len(&mut instruction, 11);
2724
2725		instruction.try_set_declare_byte_value(0, b0)?;
2726		instruction.try_set_declare_byte_value(1, b1)?;
2727		instruction.try_set_declare_byte_value(2, b2)?;
2728		instruction.try_set_declare_byte_value(3, b3)?;
2729		instruction.try_set_declare_byte_value(4, b4)?;
2730		instruction.try_set_declare_byte_value(5, b5)?;
2731		instruction.try_set_declare_byte_value(6, b6)?;
2732		instruction.try_set_declare_byte_value(7, b7)?;
2733		instruction.try_set_declare_byte_value(8, b8)?;
2734		instruction.try_set_declare_byte_value(9, b9)?;
2735		instruction.try_set_declare_byte_value(10, b10)?;
2736
2737		debug_assert_eq!(instruction.op_count(), 0);
2738		Ok(instruction)
2739	}
2740
2741	/// Creates a `db`/`.byte` asm directive
2742	///
2743	/// # Arguments
2744	///
2745	/// * `b0`: Byte 0
2746	/// * `b1`: Byte 1
2747	/// * `b2`: Byte 2
2748	/// * `b3`: Byte 3
2749	/// * `b4`: Byte 4
2750	/// * `b5`: Byte 5
2751	/// * `b6`: Byte 6
2752	/// * `b7`: Byte 7
2753	/// * `b8`: Byte 8
2754	/// * `b9`: Byte 9
2755	/// * `b10`: Byte 10
2756	#[allow(clippy::unwrap_used)]
2757	#[must_use]
2758	#[inline]
2759	#[rustfmt::skip]
2760	pub fn with_declare_byte_11(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8) -> Self {
2761		Instruction::try_with_declare_byte_11(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10).unwrap()
2762	}
2763
2764	#[doc(hidden)]
2765	#[allow(clippy::missing_inline_in_public_items)]
2766	#[rustfmt::skip]
2767	pub fn try_with_declare_byte_12(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8) -> Result<Self, IcedError> {
2768		let mut instruction = Self::default();
2769		instruction.set_code(Code::DeclareByte);
2770		instruction_internal::internal_set_declare_data_len(&mut instruction, 12);
2771
2772		instruction.try_set_declare_byte_value(0, b0)?;
2773		instruction.try_set_declare_byte_value(1, b1)?;
2774		instruction.try_set_declare_byte_value(2, b2)?;
2775		instruction.try_set_declare_byte_value(3, b3)?;
2776		instruction.try_set_declare_byte_value(4, b4)?;
2777		instruction.try_set_declare_byte_value(5, b5)?;
2778		instruction.try_set_declare_byte_value(6, b6)?;
2779		instruction.try_set_declare_byte_value(7, b7)?;
2780		instruction.try_set_declare_byte_value(8, b8)?;
2781		instruction.try_set_declare_byte_value(9, b9)?;
2782		instruction.try_set_declare_byte_value(10, b10)?;
2783		instruction.try_set_declare_byte_value(11, b11)?;
2784
2785		debug_assert_eq!(instruction.op_count(), 0);
2786		Ok(instruction)
2787	}
2788
2789	/// Creates a `db`/`.byte` asm directive
2790	///
2791	/// # Arguments
2792	///
2793	/// * `b0`: Byte 0
2794	/// * `b1`: Byte 1
2795	/// * `b2`: Byte 2
2796	/// * `b3`: Byte 3
2797	/// * `b4`: Byte 4
2798	/// * `b5`: Byte 5
2799	/// * `b6`: Byte 6
2800	/// * `b7`: Byte 7
2801	/// * `b8`: Byte 8
2802	/// * `b9`: Byte 9
2803	/// * `b10`: Byte 10
2804	/// * `b11`: Byte 11
2805	#[allow(clippy::unwrap_used)]
2806	#[must_use]
2807	#[inline]
2808	#[rustfmt::skip]
2809	pub fn with_declare_byte_12(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8) -> Self {
2810		Instruction::try_with_declare_byte_12(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11).unwrap()
2811	}
2812
2813	#[doc(hidden)]
2814	#[allow(clippy::missing_inline_in_public_items)]
2815	#[rustfmt::skip]
2816	pub fn try_with_declare_byte_13(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8) -> Result<Self, IcedError> {
2817		let mut instruction = Self::default();
2818		instruction.set_code(Code::DeclareByte);
2819		instruction_internal::internal_set_declare_data_len(&mut instruction, 13);
2820
2821		instruction.try_set_declare_byte_value(0, b0)?;
2822		instruction.try_set_declare_byte_value(1, b1)?;
2823		instruction.try_set_declare_byte_value(2, b2)?;
2824		instruction.try_set_declare_byte_value(3, b3)?;
2825		instruction.try_set_declare_byte_value(4, b4)?;
2826		instruction.try_set_declare_byte_value(5, b5)?;
2827		instruction.try_set_declare_byte_value(6, b6)?;
2828		instruction.try_set_declare_byte_value(7, b7)?;
2829		instruction.try_set_declare_byte_value(8, b8)?;
2830		instruction.try_set_declare_byte_value(9, b9)?;
2831		instruction.try_set_declare_byte_value(10, b10)?;
2832		instruction.try_set_declare_byte_value(11, b11)?;
2833		instruction.try_set_declare_byte_value(12, b12)?;
2834
2835		debug_assert_eq!(instruction.op_count(), 0);
2836		Ok(instruction)
2837	}
2838
2839	/// Creates a `db`/`.byte` asm directive
2840	///
2841	/// # Arguments
2842	///
2843	/// * `b0`: Byte 0
2844	/// * `b1`: Byte 1
2845	/// * `b2`: Byte 2
2846	/// * `b3`: Byte 3
2847	/// * `b4`: Byte 4
2848	/// * `b5`: Byte 5
2849	/// * `b6`: Byte 6
2850	/// * `b7`: Byte 7
2851	/// * `b8`: Byte 8
2852	/// * `b9`: Byte 9
2853	/// * `b10`: Byte 10
2854	/// * `b11`: Byte 11
2855	/// * `b12`: Byte 12
2856	#[allow(clippy::unwrap_used)]
2857	#[must_use]
2858	#[inline]
2859	#[rustfmt::skip]
2860	pub fn with_declare_byte_13(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8) -> Self {
2861		Instruction::try_with_declare_byte_13(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12).unwrap()
2862	}
2863
2864	#[doc(hidden)]
2865	#[allow(clippy::missing_inline_in_public_items)]
2866	#[rustfmt::skip]
2867	pub fn try_with_declare_byte_14(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8, b13: u8) -> Result<Self, IcedError> {
2868		let mut instruction = Self::default();
2869		instruction.set_code(Code::DeclareByte);
2870		instruction_internal::internal_set_declare_data_len(&mut instruction, 14);
2871
2872		instruction.try_set_declare_byte_value(0, b0)?;
2873		instruction.try_set_declare_byte_value(1, b1)?;
2874		instruction.try_set_declare_byte_value(2, b2)?;
2875		instruction.try_set_declare_byte_value(3, b3)?;
2876		instruction.try_set_declare_byte_value(4, b4)?;
2877		instruction.try_set_declare_byte_value(5, b5)?;
2878		instruction.try_set_declare_byte_value(6, b6)?;
2879		instruction.try_set_declare_byte_value(7, b7)?;
2880		instruction.try_set_declare_byte_value(8, b8)?;
2881		instruction.try_set_declare_byte_value(9, b9)?;
2882		instruction.try_set_declare_byte_value(10, b10)?;
2883		instruction.try_set_declare_byte_value(11, b11)?;
2884		instruction.try_set_declare_byte_value(12, b12)?;
2885		instruction.try_set_declare_byte_value(13, b13)?;
2886
2887		debug_assert_eq!(instruction.op_count(), 0);
2888		Ok(instruction)
2889	}
2890
2891	/// Creates a `db`/`.byte` asm directive
2892	///
2893	/// # Arguments
2894	///
2895	/// * `b0`: Byte 0
2896	/// * `b1`: Byte 1
2897	/// * `b2`: Byte 2
2898	/// * `b3`: Byte 3
2899	/// * `b4`: Byte 4
2900	/// * `b5`: Byte 5
2901	/// * `b6`: Byte 6
2902	/// * `b7`: Byte 7
2903	/// * `b8`: Byte 8
2904	/// * `b9`: Byte 9
2905	/// * `b10`: Byte 10
2906	/// * `b11`: Byte 11
2907	/// * `b12`: Byte 12
2908	/// * `b13`: Byte 13
2909	#[allow(clippy::unwrap_used)]
2910	#[must_use]
2911	#[inline]
2912	#[rustfmt::skip]
2913	pub fn with_declare_byte_14(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8, b13: u8) -> Self {
2914		Instruction::try_with_declare_byte_14(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13).unwrap()
2915	}
2916
2917	#[doc(hidden)]
2918	#[allow(clippy::missing_inline_in_public_items)]
2919	#[rustfmt::skip]
2920	pub fn try_with_declare_byte_15(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8, b13: u8, b14: u8) -> Result<Self, IcedError> {
2921		let mut instruction = Self::default();
2922		instruction.set_code(Code::DeclareByte);
2923		instruction_internal::internal_set_declare_data_len(&mut instruction, 15);
2924
2925		instruction.try_set_declare_byte_value(0, b0)?;
2926		instruction.try_set_declare_byte_value(1, b1)?;
2927		instruction.try_set_declare_byte_value(2, b2)?;
2928		instruction.try_set_declare_byte_value(3, b3)?;
2929		instruction.try_set_declare_byte_value(4, b4)?;
2930		instruction.try_set_declare_byte_value(5, b5)?;
2931		instruction.try_set_declare_byte_value(6, b6)?;
2932		instruction.try_set_declare_byte_value(7, b7)?;
2933		instruction.try_set_declare_byte_value(8, b8)?;
2934		instruction.try_set_declare_byte_value(9, b9)?;
2935		instruction.try_set_declare_byte_value(10, b10)?;
2936		instruction.try_set_declare_byte_value(11, b11)?;
2937		instruction.try_set_declare_byte_value(12, b12)?;
2938		instruction.try_set_declare_byte_value(13, b13)?;
2939		instruction.try_set_declare_byte_value(14, b14)?;
2940
2941		debug_assert_eq!(instruction.op_count(), 0);
2942		Ok(instruction)
2943	}
2944
2945	/// Creates a `db`/`.byte` asm directive
2946	///
2947	/// # Arguments
2948	///
2949	/// * `b0`: Byte 0
2950	/// * `b1`: Byte 1
2951	/// * `b2`: Byte 2
2952	/// * `b3`: Byte 3
2953	/// * `b4`: Byte 4
2954	/// * `b5`: Byte 5
2955	/// * `b6`: Byte 6
2956	/// * `b7`: Byte 7
2957	/// * `b8`: Byte 8
2958	/// * `b9`: Byte 9
2959	/// * `b10`: Byte 10
2960	/// * `b11`: Byte 11
2961	/// * `b12`: Byte 12
2962	/// * `b13`: Byte 13
2963	/// * `b14`: Byte 14
2964	#[allow(clippy::unwrap_used)]
2965	#[must_use]
2966	#[inline]
2967	#[rustfmt::skip]
2968	pub fn with_declare_byte_15(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8, b13: u8, b14: u8) -> Self {
2969		Instruction::try_with_declare_byte_15(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14).unwrap()
2970	}
2971
2972	#[doc(hidden)]
2973	#[allow(clippy::missing_inline_in_public_items)]
2974	#[rustfmt::skip]
2975	pub fn try_with_declare_byte_16(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8, b13: u8, b14: u8, b15: u8) -> Result<Self, IcedError> {
2976		let mut instruction = Self::default();
2977		instruction.set_code(Code::DeclareByte);
2978		instruction_internal::internal_set_declare_data_len(&mut instruction, 16);
2979
2980		instruction.try_set_declare_byte_value(0, b0)?;
2981		instruction.try_set_declare_byte_value(1, b1)?;
2982		instruction.try_set_declare_byte_value(2, b2)?;
2983		instruction.try_set_declare_byte_value(3, b3)?;
2984		instruction.try_set_declare_byte_value(4, b4)?;
2985		instruction.try_set_declare_byte_value(5, b5)?;
2986		instruction.try_set_declare_byte_value(6, b6)?;
2987		instruction.try_set_declare_byte_value(7, b7)?;
2988		instruction.try_set_declare_byte_value(8, b8)?;
2989		instruction.try_set_declare_byte_value(9, b9)?;
2990		instruction.try_set_declare_byte_value(10, b10)?;
2991		instruction.try_set_declare_byte_value(11, b11)?;
2992		instruction.try_set_declare_byte_value(12, b12)?;
2993		instruction.try_set_declare_byte_value(13, b13)?;
2994		instruction.try_set_declare_byte_value(14, b14)?;
2995		instruction.try_set_declare_byte_value(15, b15)?;
2996
2997		debug_assert_eq!(instruction.op_count(), 0);
2998		Ok(instruction)
2999	}
3000
3001	/// Creates a `db`/`.byte` asm directive
3002	///
3003	/// # Arguments
3004	///
3005	/// * `b0`: Byte 0
3006	/// * `b1`: Byte 1
3007	/// * `b2`: Byte 2
3008	/// * `b3`: Byte 3
3009	/// * `b4`: Byte 4
3010	/// * `b5`: Byte 5
3011	/// * `b6`: Byte 6
3012	/// * `b7`: Byte 7
3013	/// * `b8`: Byte 8
3014	/// * `b9`: Byte 9
3015	/// * `b10`: Byte 10
3016	/// * `b11`: Byte 11
3017	/// * `b12`: Byte 12
3018	/// * `b13`: Byte 13
3019	/// * `b14`: Byte 14
3020	/// * `b15`: Byte 15
3021	#[allow(clippy::unwrap_used)]
3022	#[must_use]
3023	#[inline]
3024	#[rustfmt::skip]
3025	pub fn with_declare_byte_16(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8, b9: u8, b10: u8, b11: u8, b12: u8, b13: u8, b14: u8, b15: u8) -> Self {
3026		Instruction::try_with_declare_byte_16(b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15).unwrap()
3027	}
3028
3029	/// Creates a `db`/`.byte` asm directive
3030	///
3031	/// # Errors
3032	///
3033	/// Fails if `data.len()` is not 1-16
3034	///
3035	/// # Arguments
3036	///
3037	/// * `data`: Data
3038	#[allow(clippy::missing_inline_in_public_items)]
3039	#[rustfmt::skip]
3040	pub fn with_declare_byte(data: &[u8]) -> Result<Self, IcedError> {
3041		if data.len().wrapping_sub(1) > 16 - 1 {
3042			return Err(IcedError::new("Invalid slice length"));
3043		}
3044
3045		let mut instruction = Self::default();
3046		instruction.set_code(Code::DeclareByte);
3047		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32);
3048
3049		for i in data.iter().enumerate() {
3050			instruction.try_set_declare_byte_value(i.0, *i.1)?;
3051		}
3052
3053		debug_assert_eq!(instruction.op_count(), 0);
3054		Ok(instruction)
3055	}
3056
3057	#[doc(hidden)]
3058	#[allow(clippy::missing_inline_in_public_items)]
3059	#[rustfmt::skip]
3060	pub fn try_with_declare_word_1(w0: u16) -> Result<Self, IcedError> {
3061		let mut instruction = Self::default();
3062		instruction.set_code(Code::DeclareWord);
3063		instruction_internal::internal_set_declare_data_len(&mut instruction, 1);
3064
3065		instruction.try_set_declare_word_value(0, w0)?;
3066
3067		debug_assert_eq!(instruction.op_count(), 0);
3068		Ok(instruction)
3069	}
3070
3071	/// Creates a `dw`/`.word` asm directive
3072	///
3073	/// # Arguments
3074	///
3075	/// * `w0`: Word 0
3076	#[allow(clippy::unwrap_used)]
3077	#[must_use]
3078	#[inline]
3079	#[rustfmt::skip]
3080	pub fn with_declare_word_1(w0: u16) -> Self {
3081		Instruction::try_with_declare_word_1(w0).unwrap()
3082	}
3083
3084	#[doc(hidden)]
3085	#[allow(clippy::missing_inline_in_public_items)]
3086	#[rustfmt::skip]
3087	pub fn try_with_declare_word_2(w0: u16, w1: u16) -> Result<Self, IcedError> {
3088		let mut instruction = Self::default();
3089		instruction.set_code(Code::DeclareWord);
3090		instruction_internal::internal_set_declare_data_len(&mut instruction, 2);
3091
3092		instruction.try_set_declare_word_value(0, w0)?;
3093		instruction.try_set_declare_word_value(1, w1)?;
3094
3095		debug_assert_eq!(instruction.op_count(), 0);
3096		Ok(instruction)
3097	}
3098
3099	/// Creates a `dw`/`.word` asm directive
3100	///
3101	/// # Arguments
3102	///
3103	/// * `w0`: Word 0
3104	/// * `w1`: Word 1
3105	#[allow(clippy::unwrap_used)]
3106	#[must_use]
3107	#[inline]
3108	#[rustfmt::skip]
3109	pub fn with_declare_word_2(w0: u16, w1: u16) -> Self {
3110		Instruction::try_with_declare_word_2(w0, w1).unwrap()
3111	}
3112
3113	#[doc(hidden)]
3114	#[allow(clippy::missing_inline_in_public_items)]
3115	#[rustfmt::skip]
3116	pub fn try_with_declare_word_3(w0: u16, w1: u16, w2: u16) -> Result<Self, IcedError> {
3117		let mut instruction = Self::default();
3118		instruction.set_code(Code::DeclareWord);
3119		instruction_internal::internal_set_declare_data_len(&mut instruction, 3);
3120
3121		instruction.try_set_declare_word_value(0, w0)?;
3122		instruction.try_set_declare_word_value(1, w1)?;
3123		instruction.try_set_declare_word_value(2, w2)?;
3124
3125		debug_assert_eq!(instruction.op_count(), 0);
3126		Ok(instruction)
3127	}
3128
3129	/// Creates a `dw`/`.word` asm directive
3130	///
3131	/// # Arguments
3132	///
3133	/// * `w0`: Word 0
3134	/// * `w1`: Word 1
3135	/// * `w2`: Word 2
3136	#[allow(clippy::unwrap_used)]
3137	#[must_use]
3138	#[inline]
3139	#[rustfmt::skip]
3140	pub fn with_declare_word_3(w0: u16, w1: u16, w2: u16) -> Self {
3141		Instruction::try_with_declare_word_3(w0, w1, w2).unwrap()
3142	}
3143
3144	#[doc(hidden)]
3145	#[allow(clippy::missing_inline_in_public_items)]
3146	#[rustfmt::skip]
3147	pub fn try_with_declare_word_4(w0: u16, w1: u16, w2: u16, w3: u16) -> Result<Self, IcedError> {
3148		let mut instruction = Self::default();
3149		instruction.set_code(Code::DeclareWord);
3150		instruction_internal::internal_set_declare_data_len(&mut instruction, 4);
3151
3152		instruction.try_set_declare_word_value(0, w0)?;
3153		instruction.try_set_declare_word_value(1, w1)?;
3154		instruction.try_set_declare_word_value(2, w2)?;
3155		instruction.try_set_declare_word_value(3, w3)?;
3156
3157		debug_assert_eq!(instruction.op_count(), 0);
3158		Ok(instruction)
3159	}
3160
3161	/// Creates a `dw`/`.word` asm directive
3162	///
3163	/// # Arguments
3164	///
3165	/// * `w0`: Word 0
3166	/// * `w1`: Word 1
3167	/// * `w2`: Word 2
3168	/// * `w3`: Word 3
3169	#[allow(clippy::unwrap_used)]
3170	#[must_use]
3171	#[inline]
3172	#[rustfmt::skip]
3173	pub fn with_declare_word_4(w0: u16, w1: u16, w2: u16, w3: u16) -> Self {
3174		Instruction::try_with_declare_word_4(w0, w1, w2, w3).unwrap()
3175	}
3176
3177	#[doc(hidden)]
3178	#[allow(clippy::missing_inline_in_public_items)]
3179	#[rustfmt::skip]
3180	pub fn try_with_declare_word_5(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16) -> Result<Self, IcedError> {
3181		let mut instruction = Self::default();
3182		instruction.set_code(Code::DeclareWord);
3183		instruction_internal::internal_set_declare_data_len(&mut instruction, 5);
3184
3185		instruction.try_set_declare_word_value(0, w0)?;
3186		instruction.try_set_declare_word_value(1, w1)?;
3187		instruction.try_set_declare_word_value(2, w2)?;
3188		instruction.try_set_declare_word_value(3, w3)?;
3189		instruction.try_set_declare_word_value(4, w4)?;
3190
3191		debug_assert_eq!(instruction.op_count(), 0);
3192		Ok(instruction)
3193	}
3194
3195	/// Creates a `dw`/`.word` asm directive
3196	///
3197	/// # Arguments
3198	///
3199	/// * `w0`: Word 0
3200	/// * `w1`: Word 1
3201	/// * `w2`: Word 2
3202	/// * `w3`: Word 3
3203	/// * `w4`: Word 4
3204	#[allow(clippy::unwrap_used)]
3205	#[must_use]
3206	#[inline]
3207	#[rustfmt::skip]
3208	pub fn with_declare_word_5(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16) -> Self {
3209		Instruction::try_with_declare_word_5(w0, w1, w2, w3, w4).unwrap()
3210	}
3211
3212	#[doc(hidden)]
3213	#[allow(clippy::missing_inline_in_public_items)]
3214	#[rustfmt::skip]
3215	pub fn try_with_declare_word_6(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16, w5: u16) -> Result<Self, IcedError> {
3216		let mut instruction = Self::default();
3217		instruction.set_code(Code::DeclareWord);
3218		instruction_internal::internal_set_declare_data_len(&mut instruction, 6);
3219
3220		instruction.try_set_declare_word_value(0, w0)?;
3221		instruction.try_set_declare_word_value(1, w1)?;
3222		instruction.try_set_declare_word_value(2, w2)?;
3223		instruction.try_set_declare_word_value(3, w3)?;
3224		instruction.try_set_declare_word_value(4, w4)?;
3225		instruction.try_set_declare_word_value(5, w5)?;
3226
3227		debug_assert_eq!(instruction.op_count(), 0);
3228		Ok(instruction)
3229	}
3230
3231	/// Creates a `dw`/`.word` asm directive
3232	///
3233	/// # Arguments
3234	///
3235	/// * `w0`: Word 0
3236	/// * `w1`: Word 1
3237	/// * `w2`: Word 2
3238	/// * `w3`: Word 3
3239	/// * `w4`: Word 4
3240	/// * `w5`: Word 5
3241	#[allow(clippy::unwrap_used)]
3242	#[must_use]
3243	#[inline]
3244	#[rustfmt::skip]
3245	pub fn with_declare_word_6(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16, w5: u16) -> Self {
3246		Instruction::try_with_declare_word_6(w0, w1, w2, w3, w4, w5).unwrap()
3247	}
3248
3249	#[doc(hidden)]
3250	#[allow(clippy::missing_inline_in_public_items)]
3251	#[rustfmt::skip]
3252	pub fn try_with_declare_word_7(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16, w5: u16, w6: u16) -> Result<Self, IcedError> {
3253		let mut instruction = Self::default();
3254		instruction.set_code(Code::DeclareWord);
3255		instruction_internal::internal_set_declare_data_len(&mut instruction, 7);
3256
3257		instruction.try_set_declare_word_value(0, w0)?;
3258		instruction.try_set_declare_word_value(1, w1)?;
3259		instruction.try_set_declare_word_value(2, w2)?;
3260		instruction.try_set_declare_word_value(3, w3)?;
3261		instruction.try_set_declare_word_value(4, w4)?;
3262		instruction.try_set_declare_word_value(5, w5)?;
3263		instruction.try_set_declare_word_value(6, w6)?;
3264
3265		debug_assert_eq!(instruction.op_count(), 0);
3266		Ok(instruction)
3267	}
3268
3269	/// Creates a `dw`/`.word` asm directive
3270	///
3271	/// # Arguments
3272	///
3273	/// * `w0`: Word 0
3274	/// * `w1`: Word 1
3275	/// * `w2`: Word 2
3276	/// * `w3`: Word 3
3277	/// * `w4`: Word 4
3278	/// * `w5`: Word 5
3279	/// * `w6`: Word 6
3280	#[allow(clippy::unwrap_used)]
3281	#[must_use]
3282	#[inline]
3283	#[rustfmt::skip]
3284	pub fn with_declare_word_7(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16, w5: u16, w6: u16) -> Self {
3285		Instruction::try_with_declare_word_7(w0, w1, w2, w3, w4, w5, w6).unwrap()
3286	}
3287
3288	#[doc(hidden)]
3289	#[allow(clippy::missing_inline_in_public_items)]
3290	#[rustfmt::skip]
3291	pub fn try_with_declare_word_8(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16, w5: u16, w6: u16, w7: u16) -> Result<Self, IcedError> {
3292		let mut instruction = Self::default();
3293		instruction.set_code(Code::DeclareWord);
3294		instruction_internal::internal_set_declare_data_len(&mut instruction, 8);
3295
3296		instruction.try_set_declare_word_value(0, w0)?;
3297		instruction.try_set_declare_word_value(1, w1)?;
3298		instruction.try_set_declare_word_value(2, w2)?;
3299		instruction.try_set_declare_word_value(3, w3)?;
3300		instruction.try_set_declare_word_value(4, w4)?;
3301		instruction.try_set_declare_word_value(5, w5)?;
3302		instruction.try_set_declare_word_value(6, w6)?;
3303		instruction.try_set_declare_word_value(7, w7)?;
3304
3305		debug_assert_eq!(instruction.op_count(), 0);
3306		Ok(instruction)
3307	}
3308
3309	/// Creates a `dw`/`.word` asm directive
3310	///
3311	/// # Arguments
3312	///
3313	/// * `w0`: Word 0
3314	/// * `w1`: Word 1
3315	/// * `w2`: Word 2
3316	/// * `w3`: Word 3
3317	/// * `w4`: Word 4
3318	/// * `w5`: Word 5
3319	/// * `w6`: Word 6
3320	/// * `w7`: Word 7
3321	#[allow(clippy::unwrap_used)]
3322	#[must_use]
3323	#[inline]
3324	#[rustfmt::skip]
3325	pub fn with_declare_word_8(w0: u16, w1: u16, w2: u16, w3: u16, w4: u16, w5: u16, w6: u16, w7: u16) -> Self {
3326		Instruction::try_with_declare_word_8(w0, w1, w2, w3, w4, w5, w6, w7).unwrap()
3327	}
3328
3329	/// Creates a `dw`/`.word` asm directive
3330	///
3331	/// # Errors
3332	///
3333	/// Fails if `data.len()` is not 2-16 or not a multiple of 2
3334	///
3335	/// # Arguments
3336	///
3337	/// * `data`: Data
3338	#[allow(clippy::missing_inline_in_public_items)]
3339	#[rustfmt::skip]
3340	#[allow(trivial_casts)]
3341	pub fn with_declare_word_slice_u8(data: &[u8]) -> Result<Self, IcedError> {
3342		if data.len().wrapping_sub(1) > 16 - 1 || (data.len() & 1) != 0 {
3343			return Err(IcedError::new("Invalid slice length"));
3344		}
3345
3346		let mut instruction = Self::default();
3347		instruction.set_code(Code::DeclareWord);
3348		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32 / 2);
3349
3350		for i in 0..data.len() / 2 {
3351			let v = (data[i * 2] as u16) | ((data[i * 2 + 1] as u16) << 8);
3352			instruction.try_set_declare_word_value(i, v)?;
3353		}
3354
3355		debug_assert_eq!(instruction.op_count(), 0);
3356		Ok(instruction)
3357	}
3358
3359	/// Creates a `dw`/`.word` asm directive
3360	///
3361	/// # Errors
3362	///
3363	/// Fails if `data.len()` is not 1-8
3364	///
3365	/// # Arguments
3366	///
3367	/// * `data`: Data
3368	#[allow(clippy::missing_inline_in_public_items)]
3369	#[rustfmt::skip]
3370	pub fn with_declare_word(data: &[u16]) -> Result<Self, IcedError> {
3371		if data.len().wrapping_sub(1) > 8 - 1 {
3372			return Err(IcedError::new("Invalid slice length"));
3373		}
3374
3375		let mut instruction = Self::default();
3376		instruction.set_code(Code::DeclareWord);
3377		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32);
3378
3379		for i in data.iter().enumerate() {
3380			instruction.try_set_declare_word_value(i.0, *i.1)?;
3381		}
3382
3383		debug_assert_eq!(instruction.op_count(), 0);
3384		Ok(instruction)
3385	}
3386
3387	#[doc(hidden)]
3388	#[allow(clippy::missing_inline_in_public_items)]
3389	#[rustfmt::skip]
3390	pub fn try_with_declare_dword_1(d0: u32) -> Result<Self, IcedError> {
3391		let mut instruction = Self::default();
3392		instruction.set_code(Code::DeclareDword);
3393		instruction_internal::internal_set_declare_data_len(&mut instruction, 1);
3394
3395		instruction.try_set_declare_dword_value(0, d0)?;
3396
3397		debug_assert_eq!(instruction.op_count(), 0);
3398		Ok(instruction)
3399	}
3400
3401	/// Creates a `dd`/`.int` asm directive
3402	///
3403	/// # Arguments
3404	///
3405	/// * `d0`: Dword 0
3406	#[allow(clippy::unwrap_used)]
3407	#[must_use]
3408	#[inline]
3409	#[rustfmt::skip]
3410	pub fn with_declare_dword_1(d0: u32) -> Self {
3411		Instruction::try_with_declare_dword_1(d0).unwrap()
3412	}
3413
3414	#[doc(hidden)]
3415	#[allow(clippy::missing_inline_in_public_items)]
3416	#[rustfmt::skip]
3417	pub fn try_with_declare_dword_2(d0: u32, d1: u32) -> Result<Self, IcedError> {
3418		let mut instruction = Self::default();
3419		instruction.set_code(Code::DeclareDword);
3420		instruction_internal::internal_set_declare_data_len(&mut instruction, 2);
3421
3422		instruction.try_set_declare_dword_value(0, d0)?;
3423		instruction.try_set_declare_dword_value(1, d1)?;
3424
3425		debug_assert_eq!(instruction.op_count(), 0);
3426		Ok(instruction)
3427	}
3428
3429	/// Creates a `dd`/`.int` asm directive
3430	///
3431	/// # Arguments
3432	///
3433	/// * `d0`: Dword 0
3434	/// * `d1`: Dword 1
3435	#[allow(clippy::unwrap_used)]
3436	#[must_use]
3437	#[inline]
3438	#[rustfmt::skip]
3439	pub fn with_declare_dword_2(d0: u32, d1: u32) -> Self {
3440		Instruction::try_with_declare_dword_2(d0, d1).unwrap()
3441	}
3442
3443	#[doc(hidden)]
3444	#[allow(clippy::missing_inline_in_public_items)]
3445	#[rustfmt::skip]
3446	pub fn try_with_declare_dword_3(d0: u32, d1: u32, d2: u32) -> Result<Self, IcedError> {
3447		let mut instruction = Self::default();
3448		instruction.set_code(Code::DeclareDword);
3449		instruction_internal::internal_set_declare_data_len(&mut instruction, 3);
3450
3451		instruction.try_set_declare_dword_value(0, d0)?;
3452		instruction.try_set_declare_dword_value(1, d1)?;
3453		instruction.try_set_declare_dword_value(2, d2)?;
3454
3455		debug_assert_eq!(instruction.op_count(), 0);
3456		Ok(instruction)
3457	}
3458
3459	/// Creates a `dd`/`.int` asm directive
3460	///
3461	/// # Arguments
3462	///
3463	/// * `d0`: Dword 0
3464	/// * `d1`: Dword 1
3465	/// * `d2`: Dword 2
3466	#[allow(clippy::unwrap_used)]
3467	#[must_use]
3468	#[inline]
3469	#[rustfmt::skip]
3470	pub fn with_declare_dword_3(d0: u32, d1: u32, d2: u32) -> Self {
3471		Instruction::try_with_declare_dword_3(d0, d1, d2).unwrap()
3472	}
3473
3474	#[doc(hidden)]
3475	#[allow(clippy::missing_inline_in_public_items)]
3476	#[rustfmt::skip]
3477	pub fn try_with_declare_dword_4(d0: u32, d1: u32, d2: u32, d3: u32) -> Result<Self, IcedError> {
3478		let mut instruction = Self::default();
3479		instruction.set_code(Code::DeclareDword);
3480		instruction_internal::internal_set_declare_data_len(&mut instruction, 4);
3481
3482		instruction.try_set_declare_dword_value(0, d0)?;
3483		instruction.try_set_declare_dword_value(1, d1)?;
3484		instruction.try_set_declare_dword_value(2, d2)?;
3485		instruction.try_set_declare_dword_value(3, d3)?;
3486
3487		debug_assert_eq!(instruction.op_count(), 0);
3488		Ok(instruction)
3489	}
3490
3491	/// Creates a `dd`/`.int` asm directive
3492	///
3493	/// # Arguments
3494	///
3495	/// * `d0`: Dword 0
3496	/// * `d1`: Dword 1
3497	/// * `d2`: Dword 2
3498	/// * `d3`: Dword 3
3499	#[allow(clippy::unwrap_used)]
3500	#[must_use]
3501	#[inline]
3502	#[rustfmt::skip]
3503	pub fn with_declare_dword_4(d0: u32, d1: u32, d2: u32, d3: u32) -> Self {
3504		Instruction::try_with_declare_dword_4(d0, d1, d2, d3).unwrap()
3505	}
3506
3507	/// Creates a `dd`/`.int` asm directive
3508	///
3509	/// # Errors
3510	///
3511	/// Fails if `data.len()` is not 4-16 or not a multiple of 4
3512	///
3513	/// # Arguments
3514	///
3515	/// * `data`: Data
3516	#[allow(clippy::missing_inline_in_public_items)]
3517	#[rustfmt::skip]
3518	#[allow(trivial_casts)]
3519	pub fn with_declare_dword_slice_u8(data: &[u8]) -> Result<Self, IcedError> {
3520		if data.len().wrapping_sub(1) > 16 - 1 || (data.len() & 3) != 0 {
3521			return Err(IcedError::new("Invalid slice length"));
3522		}
3523
3524		let mut instruction = Self::default();
3525		instruction.set_code(Code::DeclareDword);
3526		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32 / 4);
3527
3528		for i in 0..data.len() / 4 {
3529			let v = (data[i * 4] as u32) | ((data[i * 4 + 1] as u32) << 8) | ((data[i * 4 + 2] as u32) << 16) | ((data[i * 4 + 3] as u32) << 24);
3530			instruction.try_set_declare_dword_value(i, v)?;
3531		}
3532
3533		debug_assert_eq!(instruction.op_count(), 0);
3534		Ok(instruction)
3535	}
3536
3537	/// Creates a `dd`/`.int` asm directive
3538	///
3539	/// # Errors
3540	///
3541	/// Fails if `data.len()` is not 1-4
3542	///
3543	/// # Arguments
3544	///
3545	/// * `data`: Data
3546	#[allow(clippy::missing_inline_in_public_items)]
3547	#[rustfmt::skip]
3548	pub fn with_declare_dword(data: &[u32]) -> Result<Self, IcedError> {
3549		if data.len().wrapping_sub(1) > 4 - 1 {
3550			return Err(IcedError::new("Invalid slice length"));
3551		}
3552
3553		let mut instruction = Self::default();
3554		instruction.set_code(Code::DeclareDword);
3555		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32);
3556
3557		for i in data.iter().enumerate() {
3558			instruction.try_set_declare_dword_value(i.0, *i.1)?;
3559		}
3560
3561		debug_assert_eq!(instruction.op_count(), 0);
3562		Ok(instruction)
3563	}
3564
3565	#[doc(hidden)]
3566	#[allow(clippy::missing_inline_in_public_items)]
3567	#[rustfmt::skip]
3568	pub fn try_with_declare_qword_1(q0: u64) -> Result<Self, IcedError> {
3569		let mut instruction = Self::default();
3570		instruction.set_code(Code::DeclareQword);
3571		instruction_internal::internal_set_declare_data_len(&mut instruction, 1);
3572
3573		instruction.try_set_declare_qword_value(0, q0)?;
3574
3575		debug_assert_eq!(instruction.op_count(), 0);
3576		Ok(instruction)
3577	}
3578
3579	/// Creates a `dq`/`.quad` asm directive
3580	///
3581	/// # Arguments
3582	///
3583	/// * `q0`: Qword 0
3584	#[allow(clippy::unwrap_used)]
3585	#[must_use]
3586	#[inline]
3587	#[rustfmt::skip]
3588	pub fn with_declare_qword_1(q0: u64) -> Self {
3589		Instruction::try_with_declare_qword_1(q0).unwrap()
3590	}
3591
3592	#[doc(hidden)]
3593	#[allow(clippy::missing_inline_in_public_items)]
3594	#[rustfmt::skip]
3595	pub fn try_with_declare_qword_2(q0: u64, q1: u64) -> Result<Self, IcedError> {
3596		let mut instruction = Self::default();
3597		instruction.set_code(Code::DeclareQword);
3598		instruction_internal::internal_set_declare_data_len(&mut instruction, 2);
3599
3600		instruction.try_set_declare_qword_value(0, q0)?;
3601		instruction.try_set_declare_qword_value(1, q1)?;
3602
3603		debug_assert_eq!(instruction.op_count(), 0);
3604		Ok(instruction)
3605	}
3606
3607	/// Creates a `dq`/`.quad` asm directive
3608	///
3609	/// # Arguments
3610	///
3611	/// * `q0`: Qword 0
3612	/// * `q1`: Qword 1
3613	#[allow(clippy::unwrap_used)]
3614	#[must_use]
3615	#[inline]
3616	#[rustfmt::skip]
3617	pub fn with_declare_qword_2(q0: u64, q1: u64) -> Self {
3618		Instruction::try_with_declare_qword_2(q0, q1).unwrap()
3619	}
3620
3621	/// Creates a `dq`/`.quad` asm directive
3622	///
3623	/// # Errors
3624	///
3625	/// Fails if `data.len()` is not 8-16 or not a multiple of 8
3626	///
3627	/// # Arguments
3628	///
3629	/// * `data`: Data
3630	#[allow(clippy::missing_inline_in_public_items)]
3631	#[rustfmt::skip]
3632	#[allow(trivial_casts)]
3633	pub fn with_declare_qword_slice_u8(data: &[u8]) -> Result<Self, IcedError> {
3634		if data.len().wrapping_sub(1) > 16 - 1 || (data.len() & 7) != 0 {
3635			return Err(IcedError::new("Invalid slice length"));
3636		}
3637
3638		let mut instruction = Self::default();
3639		instruction.set_code(Code::DeclareQword);
3640		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32 / 8);
3641
3642		for i in 0..data.len() / 8 {
3643			let v = (data[i * 8] as u64) | ((data[i * 8 + 1] as u64) << 8) | ((data[i * 8 + 2] as u64) << 16) | ((data[i * 8 + 3] as u64) << 24)
3644				| ((data[i * 8 + 4] as u64) << 32) | ((data[i * 8 + 5] as u64) << 40) | ((data[i * 8 + 6] as u64) << 48) | ((data[i * 8 + 7] as u64) << 56);
3645			instruction.try_set_declare_qword_value(i, v)?;
3646		}
3647
3648		debug_assert_eq!(instruction.op_count(), 0);
3649		Ok(instruction)
3650	}
3651
3652	/// Creates a `dq`/`.quad` asm directive
3653	///
3654	/// # Errors
3655	///
3656	/// Fails if `data.len()` is not 1-2
3657	///
3658	/// # Arguments
3659	///
3660	/// * `data`: Data
3661	#[allow(clippy::missing_inline_in_public_items)]
3662	#[rustfmt::skip]
3663	pub fn with_declare_qword(data: &[u64]) -> Result<Self, IcedError> {
3664		if data.len().wrapping_sub(1) > 2 - 1 {
3665			return Err(IcedError::new("Invalid slice length"));
3666		}
3667
3668		let mut instruction = Self::default();
3669		instruction.set_code(Code::DeclareQword);
3670		instruction_internal::internal_set_declare_data_len(&mut instruction, data.len() as u32);
3671
3672		for i in data.iter().enumerate() {
3673			instruction.try_set_declare_qword_value(i.0, *i.1)?;
3674		}
3675
3676		debug_assert_eq!(instruction.op_count(), 0);
3677		Ok(instruction)
3678	}
3679}
3680// GENERATOR-END: Create