// File: /workspace/github_c_makefile_star2_O1/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 0x16d4
movq %rax, %rbx
movl $0x2710, %edi           # imm = 0x2710
callq 0x1b60
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 0x217a
leaq 0x11b0(%rip), %rcx      # 0x306c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x183e
movq (%r14), %rcx
movq %r15, %rsi
movq %rsi, %rdx
movq (%rcx,%rsi,8), %rsi
cmpq $-0x1, %rsi
jne 0x1ed9
cmpq %rdx, %rax
jne 0x219b
incq %r15
cmpq $0x2710, %r15           # imm = 0x2710
jne 0x1ec8
jmp 0x217a
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 0x1a7c
movq 0x8(%r14), %rax
movq %r12, (%rax,%r15,8)
jmp 0x217a
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 0x2146
incl %ecx
cmpl $0x2710, %ecx           # imm = 0x2710
jne 0x1f91
jmp 0x217a
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1aa4
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1ce5
cmpq %rax, %r12
jne 0x21ba
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1ad2
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1d40
cmpq %rax, %r12
jne 0x2217
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b01
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1d9b
cmpq %rax, %r12
jne 0x21f8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b30
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1df2
cmpq %rax, %r12
jne 0x21d9
incq %r15
cmpq $0x2710, %r15           # imm = 0x2710
jne 0x1fd3
jmp 0x217a
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 0x20cb
movq (%r14), %rbp
movslq %edx, %r15
cmpq $-0x1, (%rbp,%r15,8)
je 0x215b
incl %ecx
cmpl $0x2710, %ecx           # imm = 0x2710
jne 0x2095
jmp 0x217a
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 0x1a8f
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1c96
jmp 0x217a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1869
movq $-0x1, (%r12,%r15,8)
jmp 0x217a
callq 0x10a0
cltd
idivl %r15d
movslq %edx, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x190f
movq %r12, (%rbp,%r15,8)
incl %r13d
cmpl $0x3e8, %r13d           # imm = 0x3E8
jne 0x1e81
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xee2(%rip), %rdi       # 0x3084
leaq 0xf0e(%rip), %rsi       # 0x30b7
leaq 0xf1e(%rip), %rcx       # 0x30ce
movl $0x88, %edx
callq 0x1050
leaq 0xf18(%rip), %rdi       # 0x30d9
leaq 0xeef(%rip), %rsi       # 0x30b7
leaq 0xeff(%rip), %rcx       # 0x30ce
movl $0x9f, %edx
callq 0x1050
leaq 0xfda(%rip), %rdi       # 0x31ba
leaq 0xed0(%rip), %rsi       # 0x30b7
leaq 0xee0(%rip), %rcx       # 0x30ce
movl $0xa2, %edx
callq 0x1050
leaq 0xf70(%rip), %rdi       # 0x316f
leaq 0xeb1(%rip), %rsi       # 0x30b7
leaq 0xec1(%rip), %rcx       # 0x30ce
movl $0xa1, %edx
callq 0x1050
leaq 0xf06(%rip), %rdi       # 0x3124
leaq 0xe92(%rip), %rsi       # 0x30b7
leaq 0xea2(%rip), %rcx       # 0x30ce
movl $0xa0, %edx
callq 0x1050