// File: AndreRenaud[P]simple_options/simple_options_test.c
// Function: extra_params
static void extra_params(void)
{
	int extra;
	const char *foo = NULL;
	struct option_entry entries[] = {
		{"foo", 'f', NULL, OPTION_FLAG_string, .string = &foo},
		{NULL},
	};

	const char *args[] = {"prorgram", "extra"};
	extra = opt_parse(2, args, entries);
	TEST_CHECK(extra == 1);
	TEST_CHECK(strcmp(args[extra], "extra") == 0);

	const char *args2[] = {"program", "extra", "-f", "foo"};
	extra = opt_parse(4, args2, entries);
	TEST_CHECK(extra == 3);
	TEST_CHECK(strcmp(args2[extra], "extra") == 0);

	const char *args3[] = {"program", "extra1", "extra2", "extra3", "-f", "foo", "extra4"};
	extra = opt_parse(7, args3, entries);
	TEST_CHECK(extra == 3);
	TEST_CHECK(strcmp(args3[extra], "extra1") == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq $0x0, -0x10(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x2120
leaq 0x25a3(%rip), %rax      # 0x817d
movq %rax, -0x70(%rbp)
movb $0x66, -0x68(%rbp)
movl $0x4, -0x58(%rbp)
leaq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x5168(%rip), %rax      # 0xad60
movq %rax, -0x80(%rbp)
movq 0x5165(%rip), %rax      # 0xad68
movq %rax, -0x78(%rbp)
leaq -0x80(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movl $0x2, %edi
callq 0x2660
movl %eax, -0x4(%rbp)
cmpl $0x1, -0x4(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x225f(%rip), %rsi      # 0x7e8e
movl $0x76, %edx
leaq 0x1416(%rip), %rcx      # 0x7051
leaq 0x2596(%rip), %r8       # 0x81d8
movb $0x0, %al
callq 0x3080
movslq -0x4(%rbp), %rax
movq -0x80(%rbp,%rax,8), %rdi
leaq 0x2579(%rip), %rsi      # 0x81d2
callq 0x2170
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x221e(%rip), %rsi      # 0x7e8e
movl $0x77, %edx
leaq 0x13d5(%rip), %rcx      # 0x7051
leaq 0x2560(%rip), %r8       # 0x81e3
movb $0x0, %al
callq 0x3080
movq 0x50df(%rip), %rax      # 0xad70
movq %rax, -0xa0(%rbp)
movq 0x50d9(%rip), %rax      # 0xad78
movq %rax, -0x98(%rbp)
movq 0x50d3(%rip), %rax      # 0xad80
movq %rax, -0x90(%rbp)
movq 0x50cd(%rip), %rax      # 0xad88
movq %rax, -0x88(%rbp)
leaq -0xa0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movl $0x4, %edi
callq 0x2660
movl %eax, -0x4(%rbp)
cmpl $0x3, -0x4(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x21a1(%rip), %rsi      # 0x7e8e
movl $0x7b, %edx
leaq 0x1358(%rip), %rcx      # 0x7051
leaq 0x2505(%rip), %r8       # 0x8205
movb $0x0, %al
callq 0x3080
movslq -0x4(%rbp), %rax
movq -0xa0(%rbp,%rax,8), %rdi
leaq 0x24b8(%rip), %rsi      # 0x81d2
callq 0x2170
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x215d(%rip), %rsi      # 0x7e8e
movl $0x7c, %edx
leaq 0x1314(%rip), %rcx      # 0x7051
leaq 0x24cc(%rip), %r8       # 0x8210
movb $0x0, %al
callq 0x3080
leaq -0xe0(%rbp), %rdi
leaq 0x5037(%rip), %rsi      # 0xad90
movl $0x38, %edx
callq 0x21a0
leaq -0xe0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
movl $0x7, %edi
callq 0x2660
movl %eax, -0x4(%rbp)
cmpl $0x3, -0x4(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x2100(%rip), %rsi      # 0x7e8e
movl $0x80, %edx
leaq 0x12b7(%rip), %rcx      # 0x7051
leaq 0x2464(%rip), %r8       # 0x8205
movb $0x0, %al
callq 0x3080
movslq -0x4(%rbp), %rax
movq -0xe0(%rbp,%rax,8), %rdi
leaq 0x2478(%rip), %rsi      # 0x8233
callq 0x2170
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x20bc(%rip), %rsi      # 0x7e8e
movl $0x81, %edx
leaq 0x1273(%rip), %rcx      # 0x7051
leaq 0x246a(%rip), %r8       # 0x824f
movb $0x0, %al
callq 0x3080
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)