// File: halfflat[P]tinyopt/test/test_run.cc
// Function: run_restore_Test::TestBody()
TEST(run, restore) {
    int c = 0;
    to::option opts[] = {
        { to::increment(c), "-c", to::flag }
    };

    to::saved_options restore;
    restore.add("-c");
    restore.add("-c");

    auto r1 = to::run(opts, restore);
    EXPECT_TRUE(r1);
    EXPECT_EQ(2, c);

    c = 0;
    mockargs M2("-c\0-c\0-c\0");
    auto r2 = to::run(opts, M2.argc, M2.argv, restore);
    EXPECT_TRUE(r2);
    EXPECT_EQ(5, c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movb $0x1, -0xb9(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x1db80
jmp 0x6958a
movl $0x1, -0xb8(%rbp)
leaq 0x600f7(%rip), %rdx     # 0xc9692
leaq -0x80(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xb8(%rbp), %rcx
callq 0x6df30
jmp 0x695b4
movb $0x0, -0xb9(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x1d540
leaq -0xd8(%rbp), %rdi
callq 0x611a0
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x10e10
movq -0x268(%rbp), %rdx
leaq 0x6009e(%rip), %rsi     # 0xc9692
leaq -0xf8(%rbp), %rdi
callq 0x1d070
jmp 0x69602
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x61220
jmp 0x69617
leaq -0xf8(%rbp), %rdi
callq 0x10fc8
leaq -0xf9(%rbp), %rdi
callq 0x10810
leaq -0x121(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x10e10
movq -0x270(%rbp), %rdx
leaq 0x60042(%rip), %rsi     # 0xc9692
leaq -0x120(%rbp), %rdi
callq 0x1d070
jmp 0x6965e
leaq -0xd8(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x61220
jmp 0x69673
leaq -0x120(%rbp), %rdi
callq 0x10fc8
leaq -0x121(%rbp), %rdi
callq 0x10810
leaq -0x148(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x6e9c0
jmp 0x696a4
xorl %eax, %eax
movl %eax, %edx
leaq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x6e4b0
jmp 0x696bd
leaq -0x158(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x271(%rbp)
jmp 0x696d1
movb -0x271(%rbp), %al
testb $0x1, %al
jne 0x696e0
jmp 0x69839
jmp 0x6993a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x1d540
testb $0x1, -0xb9(%rbp)
jne 0x69722
jmp 0x69769
movq -0x88(%rbp), %rax
leaq -0x80(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x280(%rbp)
je 0x69767
movq -0x280(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x288(%rbp)
callq 0x38ed0
movq -0x288(%rbp), %rax
leaq -0x80(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x280(%rbp)
jne 0x69739
jmp 0x69769
jmp 0x69eb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x697a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x10fc8
leaq -0xf9(%rbp), %rdi
callq 0x10810
jmp 0x69e64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x697e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x10fc8
leaq -0x121(%rbp), %rdi
callq 0x10810
jmp 0x69e64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69e64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69e58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x6999c
leaq -0x160(%rbp), %rdi
callq 0x84210
jmp 0x69847
leaq 0x5f57d(%rip), %rdx     # 0xc8dcb
leaq 0x5ebfa(%rip), %rcx     # 0xc844f
leaq 0x5ebf9(%rip), %r8      # 0xc8455
leaq -0x188(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x7d210
jmp 0x69871
leaq -0x188(%rbp), %rdi
callq 0x102c0
movq %rax, %r8
leaq 0x61d13(%rip), %rdx     # 0xcb59a
leaq -0x168(%rbp), %rdi
movl $0x1, %esi
movl $0x8e, %ecx
callq 0x80580
jmp 0x6989f
leaq -0x168(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x7d370
jmp 0x698b4
leaq -0x168(%rbp), %rdi
callq 0x80600
leaq -0x188(%rbp), %rdi
callq 0x10fc8
leaq -0x160(%rbp), %rdi
callq 0x1d500
jmp 0x6993a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x6992c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x80600
leaq -0x188(%rbp), %rdi
callq 0x10fc8
leaq -0x160(%rbp), %rdi
callq 0x1d500
jmp 0x6999c
leaq -0x158(%rbp), %rdi
callq 0x1d520
movl $0x2, -0x19c(%rbp)
leaq 0x6096f(%rip), %rsi     # 0xca2c6
leaq 0x6663b(%rip), %rdx     # 0xcff99
leaq -0x198(%rbp), %rdi
leaq -0x19c(%rbp), %rcx
leaq -0xc(%rbp), %r8
callq 0x1d5d0
jmp 0x69977
leaq -0x198(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x289(%rbp)
jmp 0x6998b
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x69997
jmp 0x699c4
jmp 0x69a7f
leaq -0x158(%rbp), %rdi
callq 0x1d520
jmp 0x69e58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69b0c
leaq -0x1a8(%rbp), %rdi
callq 0x84210
jmp 0x699d2
leaq -0x198(%rbp), %rdi
callq 0x1d620
movq %rax, -0x298(%rbp)
jmp 0x699e7
movq -0x298(%rbp), %r8
leaq 0x61ba5(%rip), %rdx     # 0xcb59a
leaq -0x1b0(%rbp), %rdi
movl $0x1, %esi
movl $0x8f, %ecx
callq 0x80580
jmp 0x69a0d
leaq -0x1b0(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x7d370
jmp 0x69a22
leaq -0x1b0(%rbp), %rdi
callq 0x80600
leaq -0x1a8(%rbp), %rdi
callq 0x1d500
jmp 0x69a7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69a6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x80600
leaq -0x1a8(%rbp), %rdi
callq 0x1d500
jmp 0x69b0c
leaq -0x198(%rbp), %rdi
callq 0x1d520
movl $0x0, -0xc(%rbp)
leaq 0x62020(%rip), %rsi     # 0xcbab9
leaq -0x1d8(%rbp), %rdi
callq 0x4bfe0
jmp 0x69aa7
movq -0x1d0(%rbp), %rcx
leaq -0x1f8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x1d8(%rbp), %rdx
leaq -0xd8(%rbp), %r8
callq 0x6ea10
jmp 0x69ace
xorl %eax, %eax
movl %eax, %edx
leaq -0x208(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x6e4b0
jmp 0x69ae7
leaq -0x208(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x299(%rbp)
jmp 0x69afb
movb -0x299(%rbp), %al
testb $0x1, %al
jne 0x69b07
jmp 0x69b62
jmp 0x69c63
leaq -0x198(%rbp), %rdi
callq 0x1d520
jmp 0x69e58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69e4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69e40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69cc5
leaq -0x210(%rbp), %rdi
callq 0x84210
jmp 0x69b70
leaq 0x5f269(%rip), %rdx     # 0xc8de0
leaq 0x5e8d1(%rip), %rcx     # 0xc844f
leaq 0x5e8d0(%rip), %r8      # 0xc8455
leaq -0x238(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x7d210
jmp 0x69b9a
leaq -0x238(%rbp), %rdi
callq 0x102c0
movq %rax, %r8
leaq 0x619ea(%rip), %rdx     # 0xcb59a
leaq -0x218(%rbp), %rdi
movl $0x1, %esi
movl $0x94, %ecx
callq 0x80580
jmp 0x69bc8
leaq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x7d370
jmp 0x69bdd
leaq -0x218(%rbp), %rdi
callq 0x80600
leaq -0x238(%rbp), %rdi
callq 0x10fc8
leaq -0x210(%rbp), %rdi
callq 0x1d500
jmp 0x69c63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69c55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x80600
leaq -0x238(%rbp), %rdi
callq 0x10fc8
leaq -0x210(%rbp), %rdi
callq 0x1d500
jmp 0x69cc5
leaq -0x208(%rbp), %rdi
callq 0x1d520
movl $0x5, -0x24c(%rbp)
leaq 0x5f149(%rip), %rsi     # 0xc8dc9
leaq 0x66312(%rip), %rdx     # 0xcff99
leaq -0x248(%rbp), %rdi
leaq -0x24c(%rbp), %rcx
leaq -0xc(%rbp), %r8
callq 0x1d5d0
jmp 0x69ca0
leaq -0x248(%rbp), %rdi
callq 0x1d4e0
movb %al, -0x29a(%rbp)
jmp 0x69cb4
movb -0x29a(%rbp), %al
testb $0x1, %al
jne 0x69cc0
jmp 0x69ced
jmp 0x69da8
leaq -0x208(%rbp), %rdi
callq 0x1d520
jmp 0x69e40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69e34
leaq -0x258(%rbp), %rdi
callq 0x84210
jmp 0x69cfb
leaq -0x248(%rbp), %rdi
callq 0x1d620
movq %rax, -0x2a8(%rbp)
jmp 0x69d10
movq -0x2a8(%rbp), %r8
leaq 0x6187c(%rip), %rdx     # 0xcb59a
leaq -0x260(%rbp), %rdi
movl $0x1, %esi
movl $0x95, %ecx
callq 0x80580
jmp 0x69d36
leaq -0x260(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x7d370
jmp 0x69d4b
leaq -0x260(%rbp), %rdi
callq 0x80600
leaq -0x258(%rbp), %rdi
callq 0x1d500
jmp 0x69da8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
jmp 0x69d97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb0(%rbp)
movl %eax, -0xb4(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x80600
leaq -0x258(%rbp), %rdi
callq 0x1d500
jmp 0x69e34
leaq -0x248(%rbp), %rdi
callq 0x1d520
leaq -0x1f8(%rbp), %rdi
callq 0x6e5d0
leaq -0x1d8(%rbp), %rdi
callq 0x4c380
leaq -0x148(%rbp), %rdi
callq 0x6e5d0
leaq -0xd8(%rbp), %rdi
callq 0x61330
leaq -0x80(%rbp), %rax
movq %rax, -0x2b8(%rbp)
addq $0x70, %rax
movq %rax, -0x2b0(%rbp)
movq -0x2b0(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x38ed0
movq -0x2b8(%rbp), %rcx
movq -0x2c0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x2b0(%rbp)
jne 0x69dfa
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
leaq -0x248(%rbp), %rdi
callq 0x1d520
leaq -0x1f8(%rbp), %rdi
callq 0x6e5d0
leaq -0x1d8(%rbp), %rdi
callq 0x4c380
leaq -0x148(%rbp), %rdi
callq 0x6e5d0
leaq -0xd8(%rbp), %rdi
callq 0x61330
leaq -0x80(%rbp), %rax
movq %rax, -0x2d0(%rbp)
addq $0x70, %rax
movq %rax, -0x2c8(%rbp)
movq -0x2c8(%rbp), %rdi
addq $-0x70, %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x38ed0
movq -0x2d0(%rbp), %rcx
movq -0x2d8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x2c8(%rbp)
jne 0x69e86
jmp 0x69eb9
movq -0xb0(%rbp), %rdi
callq 0x10e00
nopw %cs:(%rax,%rax)