// File: /workspace/github_c_makefile_star2_O3/6851-2021[P]euler_tour_tree/euler_tour_tree_test.c
// Function: main
int main() {
    int n = 10000;
    EulerTourTree* tree = make_euler_tour_tree(n);
    EulerTourTreeTest* tree_test = make_euler_tour_tree_test(n);
    srand(32492341);
    for (int i = 0; i < 1000; i++) {
        int op = rand() % 9;

        if (op > 5) {
            op = 1;
        }

        // scanf("%d\n", &op);
        if (op == 0) {
            for (int i = 0; i < n; i++) {
                assert(find_root(tree, i) == find_root_test(tree_test, i));
            }
        } else if (op == 1) {
            int i = rand() % n;
            for (int j = 0; j < n; j++) {
                if ((j+i)%n != 0 && tree_test->parent[(j+i)%n] == -1) {
                    k_t par = rand() % ((j+i)%n);
                    link(tree, (j+i)%n, par);
                    link_test(tree_test, (j+i)%n, par);
                    break;
                }
            }
        } else if (op == 2) {
            int i = rand() % n;
            for (int j = 0; j < n; j++) {
                if (tree_test->parent[(j+i)%n] != -1) {
                    cut(tree, (j+i)%n);
                    cut_test(tree_test, (j+i)%n);
                    break;
                }
            }
        } else if (op == 3) {
            for (int i = 0; i < n; i++) {
                assert(subtree_aggregate_min(tree, i) == subtree_aggregate_min_test(tree_test, i));
                assert(subtree_aggregate_max(tree, i) == subtree_aggregate_max_test(tree_test, i));
                assert(subtree_aggregate_sum(tree, i) == subtree_aggregate_sum_test(tree_test, i));
                assert(subtree_aggregate_size(tree, i) == subtree_aggregate_size_test(tree_test, i));
            }
        } else if (op == 4) {
            int v = rand() % n;
            int val = rand() % 1000000;
            point_update(tree, v, val);
            point_update_test(tree_test, v, val);
        } else if (op == 5) {
            int v = rand() % n;
            int val = rand() % 100000;
            subtree_update(tree, v, val);
            subtree_update_test(tree_test, v, val);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x2710, %edi           # imm = 0x2710
callq 0x16d0
movq %rax, %rbx
movl $0x2710, %edi           # imm = 0x2710
callq 0x1b64
movq %rax, %r14
movl $0x1efcb35, %edi        # imm = 0x1EFCB35
callq 0x1070
xorl %r13d, %r13d
callq 0x10a0
cltq
imulq $0x38e38e39, %rax, %rcx # imm = 0x38E38E39
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,8), %ecx
subl %ecx, %eax
cmpl $0x6, %eax
movl $0x1, %ecx
cmovgel %ecx, %eax
cmpl $0x5, %eax
ja 0x2186
leaq 0x11c4(%rip), %rcx      # 0x308c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x183a
movq (%r14), %rcx
movq %r15, %rsi
movq %rsi, %rdx
movq (%rcx,%rsi,8), %rsi
cmpq $-0x1, %rsi
jne 0x1ee5
cmpq %rdx, %rax
jne 0x21a7
incq %r15
cmpq $0x2710, %r15           # imm = 0x2710
jne 0x1ed4
jmp 0x2186
callq 0x10a0
movslq %eax, %r15
imulq $0x68db8bad, %r15, %rax # imm = 0x68DB8BAD
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x2c, %rax
addl %ecx, %eax
imull $0x2710, %eax, %eax     # imm = 0x2710
subl %eax, %r15d
callq 0x10a0
cltq
imulq $0x431bde83, %rax, %rcx # imm = 0x431BDE83
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x32, %rcx
addl %edx, %ecx
imull $0xf4240, %ecx, %ecx    # imm = 0xF4240
subl %ecx, %eax
movslq %r15d, %r15
movslq %eax, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1a7e
movq 0x8(%r14), %rax
movq %r12, (%rax,%r15,8)
jmp 0x2186
callq 0x10a0
cltq
imulq $0x68db8bad, %rax, %rcx # imm = 0x68DB8BAD
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x2c, %rcx
addl %edx, %ecx
imull $0x2710, %ecx, %ecx     # imm = 0x2710
subl %ecx, %eax
movq (%r14), %r12
xorl %ecx, %ecx
leal (%rax,%rcx), %edx
movslq %edx, %rdx
imulq $0x68db8bad, %rdx, %rsi # imm = 0x68DB8BAD
movq %rsi, %rdi
shrq $0x3f, %rdi
sarq $0x2c, %rsi
addl %edi, %esi
imull $0x2710, %esi, %esi     # imm = 0x2710
subl %esi, %edx
movslq %edx, %r15
cmpq $-0x1, (%r12,%r15,8)
jne 0x2152
incl %ecx
cmpl $0x2710, %ecx           # imm = 0x2710
jne 0x1f9d
jmp 0x2186
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1aa6
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1cf1
cmpq %rax, %r12
jne 0x21c6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1ad4
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1d4c
cmpq %rax, %r12
jne 0x2223
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b03
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1da7
cmpq %rax, %r12
jne 0x2204
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b32
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1dfe
cmpq %rax, %r12
jne 0x21e5
incq %r15
cmpq $0x2710, %r15           # imm = 0x2710
jne 0x1fdf
jmp 0x2186
callq 0x10a0
cltq
imulq $0x68db8bad, %rax, %rcx # imm = 0x68DB8BAD
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x2c, %rcx
addl %edx, %ecx
imull $0x2710, %ecx, %ecx     # imm = 0x2710
subl %ecx, %eax
xorl %ecx, %ecx
leal (%rax,%rcx), %edx
movslq %edx, %rdx
imulq $0x68db8bad, %rdx, %rsi # imm = 0x68DB8BAD
movq %rsi, %rdi
shrq $0x3f, %rdi
sarq $0x2c, %rsi
addl %edi, %esi
imull $0x2710, %esi, %esi     # imm = 0x2710
subl %esi, %edx
je 0x20d7
movq (%r14), %rbp
movslq %edx, %r15
cmpq $-0x1, (%rbp,%r15,8)
je 0x2167
incl %ecx
cmpl $0x2710, %ecx           # imm = 0x2710
jne 0x20a1
jmp 0x2186
callq 0x10a0
movslq %eax, %r15
imulq $0x68db8bad, %r15, %rax # imm = 0x68DB8BAD
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x2c, %rax
addl %ecx, %eax
imull $0x2710, %eax, %eax     # imm = 0x2710
subl %eax, %r15d
callq 0x10a0
cltq
imulq $0x14f8b589, %rax, %rcx # imm = 0x14F8B589
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x2d, %rcx
addl %edx, %ecx
imull $0x186a0, %ecx, %ecx    # imm = 0x186A0
subl %ecx, %eax
movslq %r15d, %r15
movslq %eax, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1a91
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1c9a
jmp 0x2186
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1865
movq $-0x1, (%r12,%r15,8)
jmp 0x2186
callq 0x10a0
cltd
idivl %r15d
movslq %edx, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x190b
movq %r12, (%rbp,%r15,8)
incl %r13d
cmpl $0x3e8, %r13d           # imm = 0x3E8
jne 0x1e8d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xef6(%rip), %rdi       # 0x30a4
leaq 0xf22(%rip), %rsi       # 0x30d7
leaq 0xf32(%rip), %rcx       # 0x30ee
movl $0x88, %edx
callq 0x1050
leaq 0xf2c(%rip), %rdi       # 0x30f9
leaq 0xf03(%rip), %rsi       # 0x30d7
leaq 0xf13(%rip), %rcx       # 0x30ee
movl $0x9f, %edx
callq 0x1050
leaq 0xfee(%rip), %rdi       # 0x31da
leaq 0xee4(%rip), %rsi       # 0x30d7
leaq 0xef4(%rip), %rcx       # 0x30ee
movl $0xa2, %edx
callq 0x1050
leaq 0xf84(%rip), %rdi       # 0x318f
leaq 0xec5(%rip), %rsi       # 0x30d7
leaq 0xed5(%rip), %rcx       # 0x30ee
movl $0xa1, %edx
callq 0x1050
leaq 0xf1a(%rip), %rdi       # 0x3144
leaq 0xea6(%rip), %rsi       # 0x30d7
leaq 0xeb6(%rip), %rcx       # 0x30ee
movl $0xa0, %edx
callq 0x1050